@casualjim/pi-codebase-memory
v0.1.2
Published
Codebase-memory MCP wiring and guidance plugin for Pi
Readme
pi-codebase-memory
pi-codebase-memory is a standalone Pi package that wires codebase-memory MCP tools into Pi and reminds agents to use graph-first discovery before broad raw code search.
What it provides
codebase-memory-mcpbundled as a package dependency.- Pi extension at
extensions/codebase-memory. - Automatic
~/.pi/agent/mcp.jsonsetup when no codebase-memory server is present. directTools: trueMCP configuration so Pi exposescodebase_memory_*tools directly.- One-shot reminders when broad raw discovery tools (
grep,find,ls, and equivalents) are used before codebase-memory discovery. - Public
codebase-memoryskill with graph query guidance.
Install
pi install npm:@casualjim/pi-codebase-memoryFor local development from this monorepo:
pi install ./packages/pi-codebase-memoryReload Pi if the current session does not yet expose the codebase_memory_* tools after install.
MCP configuration behaviour
On startup, the extension checks ~/.pi/agent/mcp.json.
If no codebase-memory server is configured, it adds:
{
"mcpServers": {
"codebase-memory": {
"command": "<current node executable>",
"args": ["<bundled codebase-memory-mcp binary>"],
"directTools": true
}
}
}If a codebase-memory server already exists, the extension leaves it alone. If the JSON is malformed or the bundled binary cannot be resolved, setup reports the error instead of overwriting user config.
Discovery guidance
Agents should use this ladder for code discovery:
- Index the current repository if needed with
codebase_memory_index_repository. - Start with
codebase_memory_get_architecture. - Search symbols or code with
codebase_memory_search_graphorcodebase_memory_search_code. - Trace callers, callees, or data flow with
codebase_memory_trace_path. - Read exact symbol source with
codebase_memory_get_code_snippet. - Use exact file reads or shell inspection for configs, text files, non-code assets, graph-insufficient cases, and follow-up verification.
If codebase-memory tools are missing or stale, report degraded discovery and avoid claiming architecture-aware analysis.
Development
npm test --workspace @casualjim/pi-codebase-memory
npm run typecheck --workspace @casualjim/pi-codebase-memory
npm run check:pack --workspace @casualjim/pi-codebase-memory