Project memory for future Codex runs on codesmart.
CodeSmart is a local-first, deterministic codebase intelligence system with:
- SQLite-backed snapshots/checkpoints
- Symbol graph + semantic labels
- Deterministic literal index (strings/comments/docstrings)
- Optional asynchronous GLiNER2-style enrichment (
ml_entities) - CLI + MCP interfaces
Important product position:
- Deterministic baseline is primary and immediately usable.
- Enrichment is secondary, non-blocking, and improves recall on semantic/prose-heavy fan-out cases.
- No LLM calls in indexing/query path.
- Index first, enrich later: start->usable latency is optimized.
- Content-addressed dedup is in place (parse artifacts keyed by path/hash strategy).
- Snapshot diff is a core gatekeeping feature.
- MCP transport support is intentionally dual:
- stdio
- Streamable HTTP (single endpoint)
HTTP MCP details already implemented:
- origin validation
- localhost-safe defaults (
127.0.0.1) MCP-Protocol-Versionhandling (2025-11-25, fallback path for2025-03-26)
Top-level commands include:
index,stats,find-symbol,symbol,file,label,find-text,ml-entitiescallers,calleesdiff,call-diff,snapshot(list/show/delete)serve-mcp,serve-mcp-httpdoctor,hooks,enrich
Notable behavior:
indexsupports--enqueue-enrichand optional background worker startup.- Snapshot creation is implicit via
index(nosnapshot createcommand).
Methods implemented:
initializetools/list,tools/callresources/list,resources/read,resources/templates/listroots/list
Current tool set includes:
index_repoget_stats(includes enrichment readiness fields)find_symbolsfind_by_labelfind_textfind_ml_entitiesget_callersget_calleeslist_snapshotsdiff_snapshotsdiff_call_graph
Important: get_stats now includes:
ml_entitiesenrichment_readyenrichment_status
Default sequence for agents:
find_symbolsfor typed/API retrieval.find_textfor fan-out phrase/warning consistency retrieval.find_ml_entitiesonly when deterministic recall is insufficient.- Use snapshots +
diff_snapshotsfor completeness validation.
This ordering is critical to keep answers deterministic, explainable, and token-efficient.
Evaluation scripts are in scripts/eval/.
Canonical flow:
clone_and_index_eval_repos.pyrun_graph_eval.pyrun_enrich_eval.pyrun_callgraph_parity_eval.pyrun_baseline_literal_eval.py- case-study scripts for VS Code and Turbopack
Benchmark/case-study facts are documented in:
README.mddocs/CASE_STUDY_VSCODE.mddocs/CASE_STUDY_TURBOPACK.mddocs/index.html
If behavior changes, re-run evals before editing claims.
Lint is configured with Ruff in pyproject.toml.
Current lint profile:
select = ["E", "W", "F", "I", "UP"]ignore = ["E402", "E501"]- excludes:
eval-repos,draft
Run before commits:
uv run lint
uv run testWhy E402 ignored: eval scripts intentionally modify sys.path before imports.
Why E501 ignored: avoid huge non-functional line-wrap churn.
docs/index.htmlis the polished landing page; keep it externally focused.- Emphasize deterministic baseline + no LLM in runtime/index/query.
- Mention enrichment as additive recall, not foundational requirement.
- Snapshot diff gatekeeping is a key selling point.
There are intentionally untracked docs that may stay uncommitted unless explicitly requested:
docs/GLi_PLAN.mddocs/ref/pearls-user-guide.md
Do not stage random workspace noise. Keep commits focused and split by concern.
- Prefer small, focused commits.
- Verify with tests/evals after meaningful behavior changes.
- Avoid docs drift from actual CLI/MCP behavior; confirm via
-hand source. - For MCP changes, always add/adjust unit tests in
tests/unit/test_mcp_server.py.