mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-01 07:44:01 +08:00
Adds boolean config key context_injection (default true, env CBM_CONTEXT_INJECTION)
that controls whether inject_context_once embeds the _context header in the first
tool response.
WHAT _context contains: node/edge counts, all node labels with counts, edge types
with counts, PageRank stats, and detected ecosystem (Go/Python/Rust/etc.).
WHEN TO DISABLE (context_injection=false):
- Scripted/programmatic use: extra JSON adds noise to parsed output
- CI pipelines: token cost is metered, model needs no schema context
- Model has explicit codebase instructions via system prompt
- Benchmarking: removes schema-query overhead from latency measurements
WHEN TO KEEP ENABLED (default):
- Interactive AI sessions benefit from automatic situational awareness
- Saves 2-3 round-trips otherwise needed for get_architecture/get_graph_schema
Usage:
codebase-memory-mcp config set context_injection false # per-install
CBM_CONTEXT_INJECTION=false codebase-memory-mcp # per-session
Implementation:
- Config check placed BEFORE setting context_injected flag so toggling
mid-session works (re-enable without server restart)
- session_project is still always included regardless of this setting
- cbm_config_get_bool reads CBM_CONTEXT_INJECTION env var automatically
via cbm_config_get_effective (the standard env-override path)
TDD: config_context_injection_disabled, config_context_injection_enabled_by_default
Tests: 2274 passed, 0 failed
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>