- We publish with CI/CD (automated releases)
mnemex is a local semantic code search tool that combines:
- AST parsing (tree-sitter) for intelligent code chunking
- Embeddings (OpenRouter/Ollama) for semantic similarity
- Symbol graph with PageRank for importance ranking
- LanceDB for local vector storage
src/
├── core/
│ ├── analysis/ # Code analysis (dead-code, test-gaps, impact)
│ │ ├── analyzer.ts # CodeAnalyzer class
│ │ └── test-detector.ts # Language-aware test file detection
│ ├── graph/ # Symbol graph with PageRank
│ ├── enrichment/ # LLM-based code summaries
│ ├── indexer/ # Code indexing pipeline
│ ├── search/ # Hybrid search (vector + BM25)
│ └── watcher/ # File system watcher
├── git/ # Git hook integration
│ └── hook-manager.ts # Post-commit hook management
├── cli.ts # Main CLI entry point
├── mcp-server.ts # MCP server for Claude Code
├── ai-instructions.ts # Role-based AI agent prompts
└── ai-skill.ts # Skill documents for embedding
map [query]- Repo structure with PageRank rankingsymbol <name>- Find symbol definitioncallers <name>- What depends on this symbolcallees <name>- What this symbol depends oncontext <name>- Full context: symbol + callers + callees
dead-code- Find unused symbols (zero callers + low PageRank)test-gaps- Find untested high-PageRank symbolsimpact <name>- Transitive callers across all files
watch- Auto-reindex on file changes (daemon)hooks install- Git post-commit hook for auto-indexing
- Add command case in
cli.tsswitch statement - Create handler function following existing patterns
- Update help text in
printHelp()function - Update README.md CLI reference section
- Update ai-instructions.ts and ai-skill.ts for AI agents
import { createCodeAnalyzer } from "./core/analysis/index.js";
const analyzer = await createCodeAnalyzer(projectPath);
const results = analyzer.findDeadCode({ maxPageRank: 0.001 });Uses language-specific patterns:
- TypeScript/JS:
*.test.ts,*.spec.ts,__tests__/ - Python:
test_*.py,*_test.py,tests/ - Go:
*_test.go - etc.
# Run tests
bun test
# Type check
bun run typecheck
# Build
bun run buildRole-based prompts for different agent personas:
architect- System design, dead-code detectiondeveloper- Implementation, impact analysistester- Test coverage gaps, test planningdebugger- Error tracing, bug impact
Multiple skill document variants for different contexts:
MNEMEX_SKILL- Full comprehensive skill (~200 lines)MNEMEX_SKILL_COMPACT- Tight context budgetsMNEMEX_MCP_SKILL- MCP server integrationMNEMEX_QUICK_REF- Minimal token reference
Evaluation harness lives in the sibling ../agentbench/ repo. See the agentbench-eval skill (.claude/skills/agentbench-eval) for full details on:
- Pre-indexed repos (12 repos, ~39K symbols, ~1.9GB indexes in
../agentbench/data/) - Experiment conditions (no_plan, mnemex_full, dc_planner, ace_planner)
- Running benchmarks, restoring indexes, analyzing results
- Always use
--agentfor machine-parseable output (replaces --nologo --raw --plain) - PageRank > 0.05 indicates high-importance symbols
- Test file detection is language-specific (see test-detector.ts)
- Impact analysis uses BFS with depth limiting to avoid infinite loops
- Watch mode uses native
fs.watch(no external deps like chokidar) - OpenTUI
<text>overlap: Multiple<text>siblings in a<box>render at (0,0). Use single<text>per<box>, or<box flexDirection="row">with each<text>in its own<box> - OpenTUI
useAlternateScreen: falseappends lines on re-render instead of overwriting — not suitable for progress bars. Use ANSI cursor-based rendering (\x1b[${lines}A) for progress displays - CLI alias ordering: Flag-style command aliases (e.g.
--watch→watch) must mutateargsBEFOREconst command = args[0]to take effect - Data directory: mnemex uses
.mnemex/(migrated from.claudemem/automatically on first run) - Env vars:
MNEMEX_MODEL,MNEMEX_LLM,MNEMEX_DOCS_ENABLED(renamed from CLAUDEMEM_*)