From 9a453ae0adabcd296a607cf46cf20fcb12d578fa Mon Sep 17 00:00:00 2001 From: kangxl <230263957+zh-xl-kang@users.noreply.github.com> Date: Sun, 28 Jun 2026 11:10:52 +0800 Subject: [PATCH 1/4] feat(cli): detect Pi agent (~/.pi/agent/) Add a `pi` field to cbm_detected_agents_t and detect the Pi agent (pi-mcp-adapter) by the presence of its ~/.pi/agent/ config directory, mirroring the existing Kiro/Cursor detection. List it in the "Detected agents" output. Signed-off-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com> --- src/cli/cli.c | 5 +++++ src/cli/cli.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/cli/cli.c b/src/cli/cli.c index f159f591..047709f5 100644 --- a/src/cli/cli.c +++ b/src/cli/cli.c @@ -1143,6 +1143,10 @@ cbm_detected_agents_t cbm_detect_agents(const char *home_dir) { snprintf(path, sizeof(path), "%s/.kiro", home_dir); agents.kiro = dir_exists(path); + /* Pi: ~/.pi/agent/ */ + snprintf(path, sizeof(path), "%s/.pi/agent", home_dir); + agents.pi = dir_exists(path); + return agents; } @@ -2934,6 +2938,7 @@ static void print_detected_agents(const cbm_detected_agents_t *a) { {a->cursor, "Cursor"}, {a->openclaw, "OpenClaw"}, {a->kiro, "Kiro"}, + {a->pi, "Pi"}, }; printf("Detected agents:"); bool any = false; diff --git a/src/cli/cli.h b/src/cli/cli.h index 9efe6789..9a410766 100644 --- a/src/cli/cli.h +++ b/src/cli/cli.h @@ -128,6 +128,7 @@ typedef struct { bool cursor; /* ~/.cursor/ exists */ bool openclaw; /* ~/.openclaw/ exists */ bool kiro; /* ~/.kiro/ exists */ + bool pi; /* ~/.pi/agent/ exists */ } cbm_detected_agents_t; /* Detect which coding agents are installed. From f1e8f69ac82c7fe93e5a9f0879fd878cc5a801ce Mon Sep 17 00:00:00 2001 From: kangxl <230263957+zh-xl-kang@users.noreply.github.com> Date: Sun, 28 Jun 2026 11:13:12 +0800 Subject: [PATCH 2/4] feat(cli): install/uninstall Pi agent MCP config Wire the Pi agent into the editor-style install and uninstall flows, mirroring Kiro/Cursor: write the codebase-memory-mcp entry to ~/.pi/agent/mcp.json (standard mcpServers format) via cbm_install_editor_mcp, and remove it on uninstall. Pi reads no instruction file, so none is written. Pi is also included in the install plan JSON. Signed-off-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com> --- src/cli/cli.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/cli/cli.c b/src/cli/cli.c index 047709f5..d36076cd 100644 --- a/src/cli/cli.c +++ b/src/cli/cli.c @@ -3252,6 +3252,11 @@ static void install_editor_agent_configs(const cbm_detected_agents_t *agents, co install_generic_agent_config("Kiro", binary_path, cp, NULL, dry_run, cbm_install_editor_mcp); } + if (agents->pi) { + char cp[CLI_BUF_1K]; + snprintf(cp, sizeof(cp), "%s/.pi/agent/mcp.json", home); + install_generic_agent_config("Pi", binary_path, cp, NULL, dry_run, cbm_install_editor_mcp); + } } static void cbm_install_agent_configs(const char *home, const char *binary_path, bool force, @@ -3351,6 +3356,7 @@ char *cbm_build_install_plan_json(const char *home, const char *binary_path) { {det.cursor, "cursor"}, {det.openclaw, "openclaw"}, {det.kiro, "kiro"}, + {det.pi, "pi"}, }; yyjson_mut_doc *doc = yyjson_mut_doc_new(NULL); @@ -3725,6 +3731,12 @@ static void uninstall_editor_agents(const cbm_detected_agents_t *agents, const c uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Kiro", cp, NULL}, dry_run, cbm_remove_editor_mcp); } + if (agents->pi) { + char cp[CLI_BUF_1K]; + snprintf(cp, sizeof(cp), "%s/.pi/agent/mcp.json", home); + uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Pi", cp, NULL}, dry_run, + cbm_remove_editor_mcp); + } } int cbm_cmd_uninstall(int argc, char **argv) { From 52cb29b04cb94939288eb9f2e4876bf24c2d2564 Mon Sep 17 00:00:00 2001 From: kangxl <230263957+zh-xl-kang@users.noreply.github.com> Date: Sun, 28 Jun 2026 11:14:51 +0800 Subject: [PATCH 3/4] test(cli): add Pi agent detection coverage Add cli_detect_agents_finds_pi (mirroring finds_kiro) and assert Pi is not detected in cli_detect_agents_none_found. The new test also covers Pi's nested-path detection: ~/.pi alone must not trigger, only ~/.pi/agent/ does. Register the test in the cli suite. Signed-off-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com> --- tests/test_cli.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_cli.c b/tests/test_cli.c index 0b78537c..6f7c05bc 100644 --- a/tests/test_cli.c +++ b/tests/test_cli.c @@ -1774,6 +1774,28 @@ TEST(cli_detect_agents_finds_kiro) { PASS(); } +TEST(cli_detect_agents_finds_pi) { + char tmpdir[256]; + snprintf(tmpdir, sizeof(tmpdir), "/tmp/cli-detect-XXXXXX"); + if (!cbm_mkdtemp(tmpdir)) + FAIL("cbm_mkdtemp failed"); + + char dir[512]; + + /* ~/.pi alone (without the agent/ subdir) must not trigger detection. */ + snprintf(dir, sizeof(dir), "%s/.pi", tmpdir); + test_mkdirp(dir); + ASSERT_FALSE(cbm_detect_agents(tmpdir).pi); + + /* ~/.pi/agent/ present → Pi detected. */ + snprintf(dir, sizeof(dir), "%s/.pi/agent", tmpdir); + test_mkdirp(dir); + ASSERT_TRUE(cbm_detect_agents(tmpdir).pi); + + test_rmdir_r(tmpdir); + PASS(); +} + TEST(cli_detect_agents_none_found) { char tmpdir[256]; snprintf(tmpdir, sizeof(tmpdir), "/tmp/cli-detect-XXXXXX"); @@ -1796,6 +1818,7 @@ TEST(cli_detect_agents_none_found) { ASSERT_FALSE(agents.antigravity); ASSERT_FALSE(agents.kilocode); ASSERT_FALSE(agents.kiro); + ASSERT_FALSE(agents.pi); if (saved_ccd_copy) { cbm_setenv("CLAUDE_CONFIG_DIR", saved_ccd_copy, 1); @@ -2756,6 +2779,7 @@ SUITE(cli) { RUN_TEST(cli_detect_agents_finds_antigravity); RUN_TEST(cli_detect_agents_finds_kilocode); RUN_TEST(cli_detect_agents_finds_kiro); + RUN_TEST(cli_detect_agents_finds_pi); RUN_TEST(cli_detect_agents_none_found); /* Codex MCP config upsert (3 tests — group B) */ From 0c85ddb6e8897e9b374f96401ca47e9f53e7bcfc Mon Sep 17 00:00:00 2001 From: kangxl <230263957+zh-xl-kang@users.noreply.github.com> Date: Sun, 28 Jun 2026 11:16:54 +0800 Subject: [PATCH 4/4] docs: list Pi among supported agents (11 -> 12) Add the Pi agent to the supported-agents lists and bump the agent count from 11 to 12 across README, the docs site, llms.txt, and the npm package README. Add a Pi row to the README agent config table (~/.pi/agent/mcp.json; no instruction file or hooks). Signed-off-by: kangxl <230263957+zh-xl-kang@users.noreply.github.com> --- README.md | 7 ++++--- docs/index.html | 10 +++++----- docs/llms.txt | 2 +- pkg/npm/README.md | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index cb5e90aa..809477e9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [](https://github.com/DeusData/codebase-memory-mcp) [](https://github.com/DeusData/codebase-memory-mcp) [](#hybrid-lsp) -[](https://github.com/DeusData/codebase-memory-mcp) +[](https://github.com/DeusData/codebase-memory-mcp) [](https://github.com/DeusData/codebase-memory-mcp) [](https://github.com/DeusData/codebase-memory-mcp/releases/latest) [](https://scorecard.dev/viewer/?uri=github.com/DeusData/codebase-memory-mcp) @@ -16,7 +16,7 @@ **The fastest and most efficient code intelligence engine for AI coding agents.** Full-indexes an average repository in milliseconds, the Linux kernel (28M LOC, 75K files) in 3 minutes. Answers structural queries in under 1ms. Ships as a single static binary for macOS, Linux, and Windows — download, run `install`, done. -High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-sitter/) AST analysis across all 158 languages, enhanced with [**Hybrid LSP** semantic type resolution](#hybrid-lsp) for Python, TypeScript / JavaScript / JSX / TSX, PHP, C#, Go, C, C++, Java, Kotlin, and Rust — producing a persistent knowledge graph of functions, classes, call chains, HTTP routes, and cross-service links. 14 MCP tools. Zero dependencies. Plug and play across 11 coding agents. +High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-sitter/) AST analysis across all 158 languages, enhanced with [**Hybrid LSP** semantic type resolution](#hybrid-lsp) for Python, TypeScript / JavaScript / JSX / TSX, PHP, C#, Go, C, C++, Java, Kotlin, and Rust — producing a persistent knowledge graph of functions, classes, call chains, HTTP routes, and cross-service links. 14 MCP tools. Zero dependencies. Plug and play across 12 coding agents. > **Research** — The design and benchmarks behind this project are described in the preprint [*Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP*](https://arxiv.org/abs/2603.27277) (arXiv:2603.27277). Evaluated across 31 real-world repositories: 83% answer quality, 10× fewer tokens, 2.1× fewer tool calls vs. file-by-file exploration. @@ -34,7 +34,7 @@ High-quality parsing through [tree-sitter](https://tree-sitter.github.io/tree-si - **Plug and play** — single static binary for macOS (arm64/amd64), Linux (arm64/amd64), and Windows (amd64). No Docker, no runtime dependencies, no API keys. Download → `install` → restart agent → done. - **158 languages** — vendored tree-sitter grammars compiled into the binary. Nothing to install, nothing that breaks. - **120x fewer tokens** — 5 structural queries: ~3,400 tokens vs ~412,000 via file-by-file search. One graph query replaces dozens of grep/read cycles. -- **11 agents, one command** — `install` auto-detects Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode, VS Code, OpenClaw, and Kiro — configures MCP entries, instruction files, and pre-tool hooks for each. +- **12 agents, one command** — `install` auto-detects Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode, VS Code, OpenClaw, Kiro, and Pi — configures MCP entries, instruction files, and pre-tool hooks for each. - **Built-in graph visualization** — 3D interactive UI at `localhost:9749` (optional UI binary variant). - **Infrastructure-as-code indexing** — Dockerfiles, Kubernetes manifests, and Kustomize overlays indexed as graph nodes with cross-references. `Resource` nodes for K8s kinds, `Module` nodes for Kustomize overlays with `IMPORTS` edges to referenced resources. - **14 MCP tools** — search, trace, architecture, impact analysis, Cypher queries, dead code detection, cross-service HTTP linking, ADR management, and more. @@ -345,6 +345,7 @@ Restart your agent. Verify with `/mcp` — you should see `codebase-memory-mcp` | VS Code | `Code/User/mcp.json` | — | — | | OpenClaw | `openclaw.json` | — | — | | Kiro | `.kiro/settings/mcp.json` | — | — | +| Pi | `.pi/agent/mcp.json` | — | — | **Hooks are structurally non-blocking** (exit code 0, every failure path). For Claude Code, the `PreToolUse` hook intercepts `Grep`/`Glob` (never `Read` — diff --git a/docs/index.html b/docs/index.html index 7e732406..8fb6ae16 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@
- One command configures all 11 supported agents: Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode,
- Antigravity, Aider, KiloCode, VS Code, OpenClaw, and Kiro — with MCP entries, instruction files, and
+ One command configures all 12 supported agents: Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode,
+ Antigravity, Aider, KiloCode, VS Code, OpenClaw, Kiro, and Pi — with MCP entries, instruction files, and
pre-tool hooks for each. Windows users run install.ps1. Also available via
npm, pip, Homebrew, Scoop, Winget, Chocolatey, AUR, and go install.