{"id":50413670,"url":"https://github.com/pedrozadotdev/pi-cbm","last_synced_at":"2026-05-31T05:01:52.087Z","repository":{"id":356381654,"uuid":"1232285988","full_name":"pedrozadotdev/pi-cbm","owner":"pedrozadotdev","description":"A Pi agent extension that integrates codebase-memory-mcp.","archived":false,"fork":false,"pushed_at":"2026-05-07T20:09:39.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-07T21:32:21.415Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pedrozadotdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-07T19:25:04.000Z","updated_at":"2026-05-07T20:09:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pedrozadotdev/pi-cbm","commit_stats":null,"previous_names":["pedrozadotdev/pi-cbm"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/pedrozadotdev/pi-cbm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrozadotdev%2Fpi-cbm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrozadotdev%2Fpi-cbm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrozadotdev%2Fpi-cbm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrozadotdev%2Fpi-cbm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedrozadotdev","download_url":"https://codeload.github.com/pedrozadotdev/pi-cbm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrozadotdev%2Fpi-cbm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33719601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-31T05:01:51.226Z","updated_at":"2026-05-31T05:01:52.077Z","avatar_url":"https://github.com/pedrozadotdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pi-cbm\n\nA [Pi agent](https://pi.dev) extension that integrates [codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp) using its **CLI mode** — no MCP server, no stdio transport, just direct subprocess calls.\n\n## What it does\n\n| Feature | Pi mechanism | Claude Code equivalent |\n|---------|-------------|----------------------|\n| System prompt instructions | `before_agent_start` event | `CLAUDE.md` / instructions file |\n| Advisory pre-tool hooks | `tool_call` event (non-blocking) | `PreToolUse` hooks (exit 0) |\n| 14 codebase-memory-mcp tools | `pi.registerTool()` | MCP tool calls |\n| `/cbm-index` command | `pi.registerCommand()` | — |\n| `/cbm-status` command | `pi.registerCommand()` | — |\n\n## Prerequisites\n\nInstall `codebase-memory-mcp` and ensure it is available in your `PATH`:\n\n```powershell\n# Windows (PowerShell)\nInvoke-WebRequest -Uri https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 -OutFile install.ps1\n.\\install.ps1 --skip-config\n```\n\n```bash\n# macOS / Linux\ncurl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash -s -- --skip-config\n```\n\n\u003e Use `--skip-config` since this extension replaces the MCP server configuration.\n\nVerify installation:\n```bash\ncodebase-memory-mcp --version\n```\n\n## Installation\n\n### As a Pi package (recommended)\n\n```bash\n\n# From git\npi install git:github.com/pedrozadotdev/pi-cbm\n```\n\n### Manual install (global)\n```bash\n# Copy the entire directory\ncp -r . ~/.pi/agent/extensions/pi-cbm/\n```\n\n### Manual install (project-local)\n```bash\ncp -r . .pi/extensions/pi-cbm/\n```\n\n### Quick test\n```bash\npi -e ./src/index.ts\n```\n\n## Usage\n\n### 1. Index your project\n```\n/cbm-index\n```\nOr ask the agent:\n```\nIndex this project with codebase-memory-mcp\n```\n\n### 2. Use graph tools\n\nThe agent will automatically prefer `cbm_` tools for structural queries:\n\n```\nWhat functions call processOrder?\n→ agent uses cbm_trace_call_path\n\nSearch for all HTTP route handlers\n→ agent uses cbm_search_graph with label='Route'\n\nWhat is the architecture of this codebase?\n→ agent uses cbm_get_architecture\n\nFind code related to \"authentication middleware\" semantically\n→ agent uses cbm_semantic_query\n```\n\n### 3. Check status\n```\n/cbm-status\n```\n\n## Available Tools\n\n| Tool | Description |\n|------|-------------|\n| `cbm_index_repository` | Index a repo into the knowledge graph |\n| `cbm_index_status` | Indexing status for a project |\n| `cbm_search_graph` | Structural search (symbols, patterns, labels) |\n| `cbm_search_code` | Graph-augmented grep over indexed files |\n| `cbm_semantic_query` | Semantic vector search (no API key needed) |\n| `cbm_query_graph` | Cypher-like graph queries |\n| `cbm_get_graph_schema` | Graph schema (node labels, edge types) |\n| `cbm_trace_call_path` | Call graph traversal (callers/callees) |\n| `cbm_get_code_snippet` | Source code for a symbol by qualified name |\n| `cbm_get_architecture` | Architecture overview (languages, packages, routes) |\n| `cbm_detect_changes` | Impact analysis of uncommitted changes |\n| `cbm_list_projects` | List all indexed projects |\n| `cbm_delete_project` | Remove a project from the index |\n| `cbm_manage_adr` | Architecture Decision Records management |\n\n## Project Structure\n\n```\npi-cbm/\n├── package.json              # npm package with pi.extensions entry\n├── README.md\n├── LICENSE\n└── src/\n    ├── index.ts              # Extension entry point (factory function)\n    ├── cli.ts                # Binary detection + CLI runner helper\n    ├── instructions.ts       # System prompt text (≈ CLAUDE.md)\n    ├── hooks.ts              # Lifecycle hooks (session_start, before_agent_start, tool_call)\n    ├── commands.ts           # Slash commands (/cbm-index, /cbm-status)\n    └── tools/\n        ├── index.ts          # Barrel — registers all tool groups\n        ├── indexing.ts       # index_repository, index_status\n        ├── search.ts         # search_graph, search_code, semantic_query\n        ├── graph.ts          # query_graph, get_graph_schema, trace_call_path, get_code_snippet\n        ├── analysis.ts       # get_architecture, detect_changes\n        └── management.ts     # list_projects, delete_project, manage_adr\n```\n\n## CLI Mode vs MCP Mode\n\nThis extension uses **CLI mode** exclusively:\n\n```bash\n# Under the hood, each tool call runs:\ncodebase-memory-mcp cli --raw \u003ctool_name\u003e '{\"param\": \"value\"}'\n```\n\nBenefits:\n- No background server process to manage\n- Works in any environment where the binary is in PATH\n- Simple subprocess call with JSON in/out\n- No port conflicts, no server restarts needed\n\n## How it maps to Claude Code integration\n\ncodebase-memory-mcp for Claude Code uses:\n1. **CLAUDE.md** — instructions injected into every session → replicated via `before_agent_start` in [`src/hooks.ts`](src/hooks.ts)\n2. **PreToolUse hooks** — advisory shell scripts that remind Claude to use graph tools → replicated via `tool_call` event in [`src/hooks.ts`](src/hooks.ts)\n\nThis extension replicates both patterns using Pi's native extension API.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrozadotdev%2Fpi-cbm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedrozadotdev%2Fpi-cbm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrozadotdev%2Fpi-cbm/lists"}