Skip to content
2 changes: 1 addition & 1 deletion src/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Source domain for the Pi extension implementation. Route to narrower AGENTS.md f

### Domain Details
- `index.ts` → Pi extension entry point; registers commands, tools, and events, and wires `guard/tool-policy.ts` in front of every tool call before it reaches `runtime/`.
- `index.tool-visibility.ts` → computes which tools are visible/hidden to the model for the current state (separate from whether a tool call is *allowed*, which `guard/tool-policy.ts` decides); read by `index.ts` when building the tool list for a turn.
- `index.tool-visibility.ts` → computes which tools are visible/hidden to the model for the current state (separate from whether a tool call is *allowed*, which `guard/tool-policy.ts` decides); read by `index.ts` when building the tool list for a turn. **It states only the planner's own invariants — never the whole world.** `pi.setActiveTools` is a global setter with no notion of whose tools are whose, and other extensions write it too; rebuilding the list from `getAllTools()` resurrected everything they had just hidden and rewrote the head of the prompt mid-turn, discarding the prefix cache. `computePlannerActiveTools` is therefore a subtraction — `(active now ∪ what we claim) \ what we hide`, walked in registry order because order is part of those bytes — and it converges, so a stable decision means a stable head. The contract gate is the one exception and is a *sandbox*: project reads must be unreachable, so the world is remembered on the way in and restored on the way out. `plannerLastSetToolNames()` exposes our own footprint for `runtime/prefix-watch.ts`.
- `constants.ts` → two package-wide constants, `EXTENSION_NAME` and `SCHEMA_VERSION`; bump `SCHEMA_VERSION` only alongside a real persisted-schema migration in `storage/schema.ts`.
- `public-api.ts` → barrel re-export of the full public surface (types + functions) across every domain — git, guard, instructions, project-local, runtime, session, settings, storage, worktree. Adding an export here without a corresponding domain change is a smell; every new domain export usually needs an entry added here too.
- Most extension work starts in `src/index.ts`, then moves to a runtime/storage helper once behavior needs tests.
Expand Down
Loading