omp packages

@pixs/cbm-tools0.4.0

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

dzag Published 8 days ago UNLICENSED ~446 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

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 0.12.0 or newer on PATH. The 0.12 CLI contract is not backward compatible; at session start the extension warns when the binary is missing or older (codebase-memory-mcp update upgrades it).
  • 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_get_architecture, cbm_get_file_outline, cbm_check_index_coverage, cbm_compare_graphs, cbm_manage_adr, cbm_ingest_traces, cbm_get_graph_schema.

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

Auto-index

The binary keeps an index fresh only for the project of an open MCP session; this extension calls the cli one-shot, so /cbm:index-status reports watched: no (cli_session). Turn on auto-index to have the extension refresh the index itself:

// .pi/settings.json (or ~/.pi/agent/settings.json for every project)
{
  "cbm": {
    "autoIndex": true,          // default false
    "autoIndexMode": "fast"     // optional: full | moderate | fast; default: the binary's (full)
  }
}

/cbm:auto-index on|off writes cbm.autoIndex to <cwd>/.pi/settings.json. pi reads that file only in trusted projects, so in an untrusted project the command writes ~/.pi/agent/settings.json instead. /cbm:auto-index with no argument shows the effective value, where it comes from, and the project it refreshes. Project values win over global ones, and changes apply without /reload.

When it is on, the extension runs index_repository in the background, one at a time, with the footer showing cbm: indexing…:

  • at session start, to pick up edits made outside pi;
  • after each agent run that used edit, write, or bash.

It only refreshes a project that is already indexed and whose root is the Git toplevel of the cwd or a folder inside it (outside Git: the cwd itself). It never creates an index, and it skips indexed parent folders such as ~ and linked worktrees, whose index belongs to the main checkout. Sessions without a UI (print mode, subagents) never auto-index.

Generator compatibility

codebase-memory-mcp install can write its own Pi extension, which registers one unprefixed tool per binary tool (search_graph, get_file_outline, ...). At session start, this extension deactivates those tools:

  • Generators before 0.11 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
    
  • Current generators emit valid schemas, but their tools duplicate the cbm_* set.

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, binary version check)
src/active-tools.ts            - lazy activation and generated-tool quarantine
src/cli.ts                     - runCli() + resolveProject() + autoIndexTarget() (binary interface)
src/settings.ts                - the `cbm` key of pi's settings files (read, locked write)
src/auto-index.ts              - auto-index triggers, single-flight runner, /cbm:auto-index
src/schemas.ts                 - TOOLS: tool defs + typed typebox schemas
src/tree.ts                    - parser for the binary's compact tree-text responses
src/summaries.ts               - tree/JSON output -> renderer summaries (pi-free, tested)
src/fixtures/<version>/        - real binary output used by the tests
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