🧠 RetainCode — Less AI Hallucinations
Give your AI the right context. Get better code.
RetainCode indexes your codebase locally and lets AI tools (Copilot, Claude, etc.) find the exact code they need — no guessing, no hallucinating, no data leaving your machine.
⚡ Get Started in 3 Steps
1. Install the extension from the VS Code Marketplace
2. Open the RetainCode sidebar (🧠 icon in the Activity Bar) → Click ▶ Turn On
3. Press Ctrl+Shift+H and search your code in plain English
Done. Your codebase is now indexed and searchable.
What It Does
| Feature |
How |
| Semantic Search |
Ctrl+Shift+H — find code by meaning, not keywords |
| CodeLens |
"Find similar" and "Search references" above every function |
| Hover Context |
Hover any symbol → see related code from other files |
| TODO Tree |
Sidebar shows all TODO/FIXME/HACK comments |
| Integrations |
Connect Jira, Slack, GitHub from the sidebar |
Click the 🧠 icon in the Activity Bar:
🧠 RetainCode
├── ▶ Turn On ← starts indexing + MCP server
├── 🔍 Semantic Search ← search by meaning
├── 📊 Show Status ← indexed files, chunks, cache
├── 🔄 Reindex Workspace ← rebuild from scratch
├── 🗑️ Clear Index ← delete everything
└── ⚙️ Settings ← configure options
All features are disabled until you turn it on — no surprise background tasks.
Save Tokens & Reduce Hallucinations
These settings give your AI tighter, more relevant context:
| Setting |
Recommended |
Why |
| Auto Index |
false |
Index only when you choose |
| Min Score |
0.75 |
Fewer but more accurate results |
| CodeLens |
true |
See related code at a glance |
| Hover |
true |
Quick context without searching |
Add to your settings.json:
{
"codegraph.codeLens.enabled": true,
"codegraph.hover.enabled": true
}
How It Works
- Turn On → starts the MCP server as a background process
- Indexes your files using AST parsing (Tree-sitter) + local embeddings (384-dim)
- Searches combine semantic similarity + keyword matching
- Everything stays local — no API calls, no cloud, 100% private
Settings Reference
| Setting |
Default |
Description |
codegraph.codeLens.enabled |
true |
Show CodeLens above functions |
codegraph.hover.enabled |
true |
Show related code on hover |
codegraph.todos.tags |
TODO,FIXME,... |
Tags to scan |
codegraph.indexing.maxFileSize |
1 MB |
Max file size to index |
codegraph.indexing.excludePatterns |
[] |
Globs to skip |
codegraph.jira.baseUrl |
— |
Jira URL |
codegraph.slack.botToken |
— |
Slack Bot Token |
codegraph.github.token |
— |
GitHub PAT |
FAQ
Does it send my code anywhere?
No. Everything runs locally on your machine.
How long does indexing take?
Small projects: ~10s. Large projects (10K+ files): 1–2 minutes.
What languages work?
TypeScript, JavaScript, Python, and any text file. More parsers coming.
Do I need an API key?
No. Embeddings are generated locally. Jira/Slack/GitHub tokens are optional extras.
Release Notes
v2.0.0
- Renamed to RetainCode
- Sidebar with Turn On/Off control
- Semantic search picker (
Ctrl+Shift+H)
- CodeLens actions on functions
- Hover context provider
- TODO/FIXME tree view
License: MIT · Report Issues