From 887576bf22552a8182c4f4c2175dfaa24b55fc38 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 12 Aug 2026 18:27:17 +0000 Subject: [PATCH] pi bridge: activate the full built-in tool set (grep/find/ls) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pi ships seven built-in tools but activates only read/write/edit/bash by default. The --tools flag can't fix this (it is a strict allowlist that drops extension tools — verified against a live endpoint), so the bridge calls setActiveTools with everything registered at session start: all seven built-ins plus ask_operator and the four memory tools. Verified live: the model now receives all twelve tool definitions. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01KdGv3u3DfTsP1S188KDhVH --- docs/local-models.md | 4 +++- src/handler/control/pi_bridge.ts | 8 ++++++++ tests/test_pi_harness.py | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/local-models.md b/docs/local-models.md index 0f43239..258f38f 100644 --- a/docs/local-models.md +++ b/docs/local-models.md @@ -134,7 +134,9 @@ completion gate never sees generated files: `PI_CONTEXT_WINDOW`, and `PI_MAX_TOKENS` tune it; everything else in the env map passes through to the process. - **`extensions/handler-bridge.ts`** — the bundled bridge extension that adapts pi's - events to the same `python -m handler.hooks` contract claude uses. The gates are the + events to the same `python -m handler.hooks` contract claude uses. It also activates + pi's full built-in tool set — `read`, `write`, `edit`, `bash`, plus `grep`, `find`, + and `ls`, which pi leaves off by default — alongside the handler tools it registers. The gates are the *same tested Python code*: the Stop/completion gate re-prompts pi with the blockers, `git push` runs the test + image-build + protected-branch approval gates and denies on failure, and questions go through an `ask_operator` tool that pauses the agent for the diff --git a/src/handler/control/pi_bridge.ts b/src/handler/control/pi_bridge.ts index f5f41eb..03a8b66 100644 --- a/src/handler/control/pi_bridge.ts +++ b/src/handler/control/pi_bridge.ts @@ -84,6 +84,14 @@ export default function (pi: ExtensionAPI) { let stopRounds = 0; let lastAssistantText = ""; + // Tool parity with the claude harness: pi ships read/write/edit/bash active and + // leaves grep/find/ls off by default. Enable everything registered — the built-ins + // plus this bridge's own tools. (The --tools flag can't do this: it is a strict + // allowlist that would drop extension tools.) + pi.on("session_start", async () => { + pi.setActiveTools(pi.getAllTools().map((t) => t.name)); + }); + // ---- memory recall at session start (claude's SessionStart hook) ---------------- pi.on("before_agent_start", async () => { if (contextInjected) return; diff --git a/tests/test_pi_harness.py b/tests/test_pi_harness.py index 250515b..bd370e8 100644 --- a/tests/test_pi_harness.py +++ b/tests/test_pi_harness.py @@ -106,6 +106,9 @@ def test_write_config_renders_provider_and_bridge(pi_env, tmp_path): assert "handler.hooks" in text assert "handler.mcpserver" in text assert "ask_operator" in text + # Tool parity: the bridge activates pi's full built-in set (grep/find/ls are off + # by default) alongside its own tools. + assert "setActiveTools" in text assert (base / "APPEND_SYSTEM.md").read_text().strip()