codemap_reindex
Rebuild code graph. Rescans all project files to update symbol table, dependencies, and file metadata. Use after external file changes or when graph state seems stale.
Usage Examples
MCP Usage (for AI Agents like Claude)
json
{
"name": "codemap_reindex",
"arguments": {}
}Example Output
JSON Response
json
{
"success": true,
"data": {
"message": "Reindex complete",
"before": {
"files": 299,
"symbols": 3099
},
"after": {
"files": 305,
"symbols": 3150
},
"changes": {
"files": 6,
"symbols": 51
}
}
}When to Use This Tool
-
Use
- Rebuild code graph after external file changes (git pull, npm install, etc.)
- Fix stale or missing symbols in search results
- Update graph after manual file edits outside CodeMap
- Verify graph state after suspected corruption
- Refresh counts after large refactoring
codemap_reindex when you need to:
Common Patterns
After Git Operations
External version control changes don't auto-update the graph.
After npm install
New dependencies need graph rebuild to be searchable.
Troubleshooting Stale Data
When in doubt, reindex.
1. git pull / git checkout / git merge
2. codemap_reindex()
3. Verify changes with codemap_stats()External version control changes don't auto-update the graph.
After npm install
1. npm install new-package
2. codemap_reindex()
3. New package files now indexedNew dependencies need graph rebuild to be searchable.
Troubleshooting Stale Data
1. Search returns outdated results
2. codemap_reindex()
3. Search again with fresh graphWhen in doubt, reindex.
Pro Tips
- Fast operation: Full reindex typically takes < 5 seconds for medium projects
- Shows delta: Response includes before/after counts and changes
- Safe to call anytime: No data loss, rebuilds from filesystem
- Automatic tracking: File operations through CodeMap tools auto-update graph
- Manual edits need reindex: Changes made outside CodeMap (IDE, git) require manual reindex
Best Practices
- Reindex after external file operations (git, npm, manual edits)
- Don't reindex unnecessarily - CodeMap auto-tracks its own changes
- Check the changes delta to verify expected updates
- Use as troubleshooting step when search seems stale
Common Mistakes
â Mistake: Reindexing after every CodeMap operation
â Instead: CodeMap auto-updates on its own operations, only reindex after external changes
â Mistake: Expecting instant graph updates after git pull
â Instead: Always reindex after git operations to sync graph with filesystem
â Mistake: Ignoring the changes delta in response
â Instead: Check changes to verify expected files were picked up
â Mistake: Using reindex to "fix" missing files
â Instead: Missing files might be .gitignored - check ignore patterns first
â Mistake: Not reindexing after switching branches
â Instead: Always reindex after
â Instead: CodeMap auto-updates on its own operations, only reindex after external changes
â Mistake: Expecting instant graph updates after git pull
â Instead: Always reindex after git operations to sync graph with filesystem
â Mistake: Ignoring the changes delta in response
â Instead: Check changes to verify expected files were picked up
â Mistake: Using reindex to "fix" missing files
â Instead: Missing files might be .gitignored - check ignore patterns first
â Mistake: Not reindexing after switching branches
â Instead: Always reindex after
git checkout to sync with new branch state