pi-codebase-memory-bridge

Pi extension: bridges the codebase-memory-mcp knowledge graph into pi as native tools. pi has no MCP support, so this registers search_graph, trace_path, query_graph, get_architecture and the rest by shelling out to the codebase-memory-mcp CLI.

Packages

Package details

extension

Install pi-codebase-memory-bridge from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-codebase-memory-bridge
Package
pi-codebase-memory-bridge
Version
1.0.2
Published
Jul 9, 2026
Downloads
52/mo · 20/wk
Author
aptha
License
MIT
Types
extension
Size
10.7 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-codebase-memory-bridge

A pi extension that bridges the codebase-memory-mcp knowledge graph into pi as native tools.

pi intentionally ships without MCP support (see pi's docs/usage.md: "It intentionally does not include built-in MCP..."). A Kiro/Claude-Desktop-style mcpServers block in settings.json is silently ignored — pi never spawns the server. This extension is the supported way to get those tools into pi: it talks to codebase-memory-mcp and registers each of its tools as a real pi tool.

How it works

  • On session_start, it does a one-time MCP handshake over stdio to fetch the server's tool list with input schemas (so it stays correct across codebase-memory-mcp versions — no hardcoded schemas to drift).
  • It registers one pi tool per server tool: search_graph, query_graph, trace_path, get_architecture, get_code_snippet, search_code, list_projects, index_status, detect_changes, manage_adr, and the rest.
  • Each call shells out to codebase-memory-mcp cli <tool> <json>, which returns JSON synchronously — no long-lived connection to manage.
  • When a tool takes a project and you omit it, the extension injects a project id derived from the current working directory (abs path with /-), which matches codebase-memory-mcp's default naming. Pass project explicitly to override, or call list_projects to see what's indexed.

Prerequisites

  1. Install the codebase-memory-mcp binary (its own installer/README).
  2. Index your repo at least once: codebase-memory-mcp cli index_repository '{"repo_path":"."}'.

Install

# from npm
pi install npm:pi-codebase-memory-bridge

# from GitHub (pinned ref recommended)
pi install git:github.com/yanralapdy/pi-codebase-memory-bridge

# or during development, from a local checkout
pi install /path/to/pi-codebase-memory-bridge

Configuration

The binary is resolved in this order:

  1. CODEBASE_MEMORY_MCP_BIN env var (if the path exists)
  2. ~/.local/bin/codebase-memory-mcp
  3. codebase-memory-mcp on PATH

Development

npm test   # runs unit tests for the pure helpers via tsx

License

MIT