Repository navigation
Description
Part of #4278. Deferred from the first review of PR #4394 (#4325).
Blocked by #4325
Context
- The host bridge does not exist on
mainyet. It arrives with PR CONTRACT: feat(backends): bridge hosted brain reads before runtime startup #4394 (draft, for backends: serve the brain's MCP tools as host bridge tools that forward to a per-turn sandboxed server, so tool search survives non-blocking startup #4325). At that PR's head8aefa80be, the bridge is created withoutinstructions(createSdkMcpServer({ name: "brain", ... tools: [] }),packages/ui-backend-claude/src/brain-tool-forwarder.ts:63). Onmain, the stdio brain MCP server sendsserverInstructionsat initialize (serverInstructions,packages/core/src/mcp-server.ts:97-111; sent at:779; the owner name is sanitized byownerName,:84-90). Bridged sessions therefore lose that guidance. The Claude Agent SDK'sCreateSdkMcpServerOptionsaccepts an optionalinstructionsstring, which is "returned frominitializeand surfaced to the model as an MCP instructions block" (installed@anthropic-ai/claude-agent-sdk0.3.293,sdk.d.ts). - The current text names the owner from config, which the host must not read, and it recommends
brain_addandbrain_update, which hosted sessions disallow.docs/integration-contract/mcp.md:38-46describes the stdio text as descriptive, not frozen. The text a bridged session should receive needs a decision.
Scope
Choose the static instruction text a bridged session receives, and pass it at registration, fixed for the session.
Acceptance criteria
- The maintainer records the chosen text, or the rule for deriving it without a host read of the brain.
- The keyless wire test shows a new bridged session's first request carries the chosen instructions block.
- The text is identical across turns and on resume.
-
docs/integration-contract/mcp.mdstates what a bridged session receives.
Decision needed
Question. What instructions block, if any, does a bridged (hosted) brain session receive?
- Option A. A fixed, owner-neutral variant of the stdio text, written for hosted sessions: no owner name, no write-tool advice, and only the tools the bridge serves.
- Consequences: bridged agents keep the guidance to prefer brain tools over grepping files, and on which tool answers which need. It costs a few hundred bytes in every new bridged session's context. Because the block is fixed per session, provider history stays byte-identical (
docs/decisions/provider-history.md), and it applies to new sessions only. A package-owned constant then has to track the hosted tool roster.
- Consequences: bridged agents keep the guidance to prefer brain tools over grepping files, and on which tool answers which need. It costs a few hundred bytes in every new bridged session's context. Because the block is fixed per session, provider history stays byte-identical (
- Option B. No instructions block for bridged sessions, with the difference documented.
- Consequences: no cost and nothing to keep in sync. But hosted agents lose the tool-selection guidance that stdio clients get, and fall back to tool descriptions alone.
Recommendation: Option A, as a package-owned constant in the same style as autonomous-prompt.ts ("package-owned instructions only"), so the host never reads the brain to build it. This is a recommendation, not a ruling.
Contract impact
docs/integration-contract/mcp.md gains a statement of what a bridged session receives, in a CONTRACT: commit (additive).
2026-11-23 triage at main a3395c4: the forwarder exists only on PR #4394's head, so I added Blocked by #4325 and repaired the main citations for serverInstructions. Added the SDK instructions option evidence, consequences and a recommendation. The ruling is still open.
Activity