@pixs/cbm-tools

Native pi tools (cbm_*) wrapping the codebase-memory-mcp binary's cli subcommand - graph search, code snippets, indexing, with worktree-aware project resolution.

Packages

Package details

extension

Install @pixs/cbm-tools from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@pixs/cbm-tools
Package
@pixs/cbm-tools
Version
0.2.0
Published
Aug 24, 2026
Downloads
646/mo · 43/wk
Author
dzag
License
UNLICENSED
Types
extension
Size
58.3 KB
Dependencies
0 dependencies · 4 peers
Pi manifest JSON
{
  "extensions": [
    "./src/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

Native pi tools wrapping the codebase-memory-mcp binary's cli subcommand. Replaces the MCP-server transport with first-class cbm_* pi tools - same engine and graph DB, only the transport changes.

Requirements

  • codebase-memory-mcp on PATH
  • git (for worktree-aware project resolution)

Install

pi install /path/to/codebase-memory      # local path
# or
pi install git:github.com/<user>/codebase-memory

Tools

Eager: cbm_list_projects, cbm_search_graph, cbm_search_code, cbm_get_code_snippet, cbm_index_repository, cbm_search_tools.

Lazy (activated via cbm_search_tools): cbm_query_graph, cbm_trace_path, cbm_detect_changes, cbm_manage_adr, cbm_ingest_traces, cbm_get_graph_schema.

Commands: /cbm:index-status, /cbm:index-repository.

Legacy generator compatibility

At session start, the extension deactivates the unprefixed tools produced by older codebase-memory-mcp Pi generators. Those generators used the obsolete { name, run } registration shape and emitted tools without input schemas, causing Claude requests to fail with errors such as:

tools.4.custom.input_schema: Field required

The supported cbm_* tools remain active. No aliases are registered.

Worktree awareness

Indexes are keyed by the canonical checkout's absolute path. Inside a linked Git worktree:

  • resolveProject() translates the worktree cwd to the canonical checkout path (dirname of git rev-parse --git-common-dir) before matching project roots.
  • Every tool retries once with the cwd-resolved project when the binary answers "project not found or not indexed", so agents in worktrees don't conclude they must re-index.

Layout

src/index.ts                   - extension entry (registers everything)
src/active-tools.ts            - lazy activation and legacy-tool quarantine
src/cli.ts                     - runCli() + resolveProject() (binary interface)
src/schemas.ts                 - TOOLS: tool defs + typed typebox schemas
src/commands.ts                - /cbm:index-status, /cbm:index-repository
src/tools/generic.ts           - passthrough cbm_* tools
src/tools/index-repository.ts  - bespoke renderer
src/tools/search-graph.ts      - bespoke found/not-found renderer
src/tools/get-code-snippet.ts  - bespoke retrieved/not-found renderer
src/tools/search-code.ts       - bespoke found/not-found renderer
src/tools/list-projects.ts     - bespoke count renderer
src/tools/search-tools.ts      - lazy-tool loader