Ask questions about any codebase using AI — your code stays private
Project description
askmycode
Ask questions about any codebase in plain English. Your code never leaves your machine.
$ askmycode ask "how does authentication work?"
Authentication is handled in src/auth/middleware.py (lines 12–45).
The require_auth decorator validates a JWT from the Authorization header,
looks up the user in the session store (Redis), and attaches the user object
to the request context. Unauthenticated requests are rejected with a 401...
Why askmycode?
Most AI coding tools send your entire codebase to a remote server. askmycode doesn't.
- Your code stays local. Only the question + a few relevant snippets reach the AI.
- Works on any codebase — Python, Go, TypeScript, Rust, Java, and more.
- No more grepping. Ask "where is the rate limiter?" instead of
grep -r "rate" . - Onboarding superpower. New to a repo? Ask questions instead of reading every file.
- Multi-provider. Gemini (free tier), OpenAI, Claude, or fully offline via Ollama.
How it works
Your code ──► chunked locally ──► embedded locally ──► stored in local vector DB
│
Your question ──► embed locally ──► find top chunks ──► send to AI ──► Answer
↑
only ~500 lines of relevant code
travel to the AI, not your whole repo
Embeddings run on your machine via sentence-transformers. Only the retrieved snippets and your question are sent to the LLM.
Install
pip install askmycode
Or from source:
git clone https://github.com/NewtYao/askmycode
cd askmycode
pip install -e .
Quick start
1. Set your API key
askmycode config set-key YOUR_GEMINI_KEY # get a free key at aistudio.google.com
2. Initialise your project (optional — sets up .gitignore and suggests starter questions)
cd your-project/
askmycode init .
3. Index your codebase (run once; re-run after big changes)
askmycode index .
4. Ask questions
askmycode ask "where is the database connection configured?"
askmycode ask "how does the retry logic work?"
askmycode ask "what does UserService do?"
Commands
askmycode ask
askmycode ask "your question"
--sources, -s Show which files and lines were used to answer
--results, -n INT Chunks to retrieve (default: 8)
--provider TEXT gemini | openai | anthropic | ollama
--model TEXT Model name override
--project, -p PATH Path to indexed project (default: .)
# Show sources alongside the answer
askmycode ask "how is caching implemented?" --sources
# Use a different provider for one question
askmycode ask "what does this codebase do?" --provider openai
askmycode chat
Multi-turn conversation — follow-up questions remember previous answers.
askmycode chat
You: how does auth work?
Assistant: ...
You: what about the refresh token flow? # remembers the previous answer
Assistant: ...
askmycode index
askmycode index . # index current directory
askmycode index /path/to/project # index a specific path
Re-indexing is incremental — only changed files are re-embedded.
askmycode stats
askmycode stats
Files indexed: 42
Total chunks: 187
Last indexed: 2026-05-23 14:30:01
Index location: /your/project/.askmycode
askmycode init
askmycode init .
Detects your project type (Python, Go, Node, Rust...), adds .askmycode/ to .gitignore, and prints suggested first questions.
askmycode config
askmycode config set-key YOUR_API_KEY
askmycode config set-provider gemini # gemini | openai | anthropic | ollama
askmycode config set-model gpt-4o # optional model override
askmycode config show
Multiple providers
| Provider | Command | Notes |
|---|---|---|
| Gemini (default) | config set-provider gemini |
Free tier at aistudio.google.com |
| OpenAI | config set-provider openai |
Requires OPENAI_API_KEY |
| Claude | config set-provider anthropic |
Requires ANTHROPIC_API_KEY |
| Ollama | config set-provider ollama |
100% offline, no API key |
Fully offline with Ollama
# 1. Install Ollama: https://ollama.com
# 2. Pull a model
ollama pull llama3
# 3. Use it
askmycode config set-provider ollama
askmycode config set-model llama3
askmycode ask "how does this work?" # zero internet required
Per-project config
Commit an .askmycode.toml to share settings with your team:
[askmycode]
provider = "gemini"
model = "gemini-2.5-flash-lite"
n_results = 10
GitHub Action
Add AI-powered Q&A directly to your pull requests. Team members comment /ask <question> and get an instant answer.
Setup:
- Add your API key as a repository secret:
GEMINI_API_KEY - Create
.github/workflows/askmycode.yml(see example)
Usage in a PR:
/ask where is error handling for the payment flow?
The bot replies with the answer + source file references, inline in the PR.
Privacy
| What happens | Where it goes |
|---|---|
| Your full codebase | Stays on your machine |
| Embeddings (vector index) | Stored in .askmycode/ in your project |
| Your question + ~500 lines of relevant code | Sent to the LLM API |
Use --provider ollama for zero data leaving your machine.
Supported file types
Python · JavaScript · TypeScript · Go · Rust · Java · C/C++ · Ruby · PHP · Swift · Kotlin · Scala · Shell · SQL · YAML · JSON · TOML · Markdown · HTML · CSS · Vue · Svelte
Python files are chunked at function and class boundaries using AST parsing, giving higher-quality retrieval than fixed-size splitting.
How retrieval works (technical)
- Index: Files are chunked (AST-aware for Python, sliding window for others), embedded with
all-MiniLM-L6-v2, and stored in a local ChromaDB. - Query: Your question is embedded. The top
n × 3candidates are fetched by cosine similarity, then re-ranked with a cross-encoder (ms-marco-MiniLM-L-6-v2) for higher precision. - Answer: The top N chunks + a project file tree are sent to the LLM with a developer-focused system prompt. The answer streams back in real time.
Roadmap
- VS Code extension
- Watch mode (auto re-index on file save)
- Semantic diff Q&A (
askmycode askabout uncommitted changes) - Kotlin / Swift AST chunking
- Web UI
Contributing
PRs welcome. Run the tool against itself to test:
askmycode index .
askmycode ask "how does the indexer work?"
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file askmycode-0.1.1.tar.gz.
File metadata
- Download URL: askmycode-0.1.1.tar.gz
- Upload date:
- Size: 150.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61c44d7f83096f9ef03cfd521a26e37981fccf20c3e8155264e497cdb827ea86
|
|
| MD5 |
3b18cd8f36d3ac794aa510658cc159cf
|
|
| BLAKE2b-256 |
4dd3f1f9ffb4ea71616eee211c7ccd7ad2d411194968212757bf0e3bceffa25a
|
File details
Details for the file askmycode-0.1.1-py3-none-any.whl.
File metadata
- Download URL: askmycode-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
233e303aa433df85c8b6b0e88798cd144890e42aee417d3cd758d3aeabe34c81
|
|
| MD5 |
8795e51b8cf6f3cb63fcb24de3a92e6d
|
|
| BLAKE2b-256 |
495ed80d4e99170c59576f09212914d47dd1fcbbf08715d6ec706c13f769687b
|