Skip to content

feat(mcp): add an opt-in lean tool profile to the stdio bridge - #213

Open
Pushkraj-Space wants to merge 1 commit into
october-dev:mainfrom
Pushkraj-Space:feat/206-lean-tool-profile
Open

Pushkraj-Space wants to merge 1 commit into
october-dev:mainfrom
Pushkraj-Space:feat/206-lean-tool-profile

Conversation

@Pushkraj-Space

Copy link
Copy Markdown
Contributor

Closes #206

What changes

agentintercom mcp stdio --tool-profile lean is a new option that offers the host five combined tools instead of the full list of upstream tools. The default full profile doesn't change: a test checks that tools/list is byte-for-byte the same with and without --tool-profile full.

Tool Forwards to
intercom_peers get_node_status + list_peers, merged into one result
intercom_send message_peer; replyTo sets mode: response and responseTo
intercom_inbox check_inbox, then acknowledge_messages for the returned IDs (the default). acknowledge: false defers acknowledgement; a later call with only messageIds acknowledges them
intercom_task action: list / add / claim / complete / progress
intercom_channel action: list / create / read / post / subscribe
  • Schemas come from upstream. Each composite builds its input schema from the schemas the execution advertises. If any underlying tool is missing, the bridge refuses to start rather than offer an action it can't perform. Unknown arguments are rejected.
  • Same permissions, same errors. Every inner call uses the current execution's Bus permissions. A composite stops at the first upstream error or input request and returns it unchanged; a test compares the lean and full error results byte for byte.
  • Measured size: tools/list is 2,774 bytes in lean mode against 11,321 bytes in full, about 25%. This comes from the integration test log on this branch.
  • Config generation: harness config --tool-profile lean adds the flag to generated host configs. For Copilot CLI and Gemini CLI it also narrows their tool filters (tools / includeTools) to the five names. The flag is inserted into the template before values are filled in, so a display name can't be mistaken for a flag.
  • Pi: the adapter's tool-list check accepts exactly the five lean tools when its bridge arguments opt in, and still requires the core tools otherwise.

Docs: adapters/README.md gains a "Stdio tool profiles" section, and the usage text in main.go lists the flag.

Notes for review

  • intercom_inbox acknowledges by default, as the issue's table specifies. Pulling and acknowledging are separate Bus operations, so if acknowledgement fails the messages are left delivered but not acknowledged. The README says so.
  • Receipts, ask_user, publish_output, task release, progress history and attachments are only in the full profile. The README points to it.

Follow-up

--unread-digest (#212) with --tool-profile lean is integrated in a follow-up after #212.

Tests

Run locally on this branch:

  • go vet ./adapters/ ./cmd/agentintercom/ and git diff --check are clean.
  • go test -race -count=1 ./adapters/ ./cmd/agentintercom/ passes.
  • node --test scripts/pi-adapter.test.mjs passes (4 tests).

New tests:

  • TestMCPStdioLeanProfile runs the real bridge against a test daemon and covers:
    • exactly five tools, and the hidden full tools rejected;
    • peers matching the direct calls;
    • send and replyTo linking;
    • inbox deferred and default acknowledgement, checked through receipts;
    • every task and channel action;
    • upstream error parity.
  • TestLeanInboxStopsOnUpstreamError covers failures in both check_inbox and acknowledge_messages.
  • TestLeanProfileRequiresItsUnderlyingTools covers a missing upstream tool and an invalid profile.
  • The adapters config test renders every host with full (no change) and with lean (flag present, plus the Copilot and Gemini filters), and rejects unknown profiles.
  • The Pi test covers the lean surface and argument parsing.

🤖 Generated with Claude Code

`mcp stdio --tool-profile lean` serves five composite tools instead of the
full upstream surface: intercom_peers, intercom_send, intercom_inbox,
intercom_task and intercom_channel. Each forwards to the existing Bus tools
with the execution's own permissions, builds its input schema from the
advertised upstream schemas, and refuses to start if an underlying tool is
missing. intercom_inbox acknowledges what it returns by default;
`acknowledge: false` defers that to a later call with `messageIds`.

`harness config --tool-profile lean` adds the flag to generated host
configuration and narrows the Copilot and Gemini tool filters to the five
names. The Pi adapter accepts the lean surface when its bridge opts in. The
default `full` profile is unchanged.

Closes october-dev#206

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@harshsaver harshsaver added the agentbox: needs your input Claude and Codex need a decision from Harsh label Nov 29, 2026
@harshsaver

Copy link
Copy Markdown
Member

🤖 Agentbox PR audit: needs Harsh's input

Questions

  1. Should the stdio bridge get a reduced tool mode at all, and in which shape? [Feature]: opt-in lean tool profile for the shared stdio bridge #206 came from an outside user and nobody at October has triaged it; the PR settled its open questions by itself.
    • (a) Merge the merged-tool design (5 combined tools) after the non-blocking fixes. It gives the biggest saving (2,774 vs 11,321 bytes, measured). The cost is a permanent second tool surface, with its own argument rules and result shapes, that every future Bus tool change must keep in step.
    • (b) A simpler subset mode: forward a fixed allowlist of the real tools unchanged (about 10 lines). Names, safety hints, error text and acknowledgement behaviour stay identical. The saving is smaller; the author can measure it with the same test.
    • (c) Not now: keep [Feature]: opt-in lean tool profile for the shared stdio bridge #206 in the backlog. Copilot and Gemini users can already trim tools in their host config.
    • Recommendation: (b), unless you specifically want the combined tools [Feature]: opt-in lean tool profile for the shared stdio bridge #206 describes. In that case answer question 2.
  2. If combined tools (1a): should reading the inbox in lean mode also mark messages as handled?
    • (a) Keep it as built (what [Feature]: opt-in lean tool profile for the shared stdio bridge #206 asked for): one call, no repeat deliveries. But a message the AI reads and never acts on is lost. Senders see "acknowledged" when it was only read. And it goes against the spec's "acknowledge after processing".
    • (b) Default to not acknowledging, so the AI confirms with a second call. Same behaviour as full mode and the spec.
    • (c) Keep it as built and amend spec/0.1/mcp.md to document the lean exception.
    • Recommendation: (b), so "acknowledged" means one thing for every peer.

What this PR changes

  • What it does: Adds an optional "lean" mode to the Agent Intercom connector that AI coding tools start. Instead of 23 separate tools, the AI gets 5 combined ones: peers, send, inbox, tasks and channels. The setup-snippet generator can produce configs that switch it on.
  • What changes in the product:
    • Nothing for anyone who doesn't opt in.
    • Opted-in users' AI sees 5 tools. Reading the inbox also marks the messages as handled straight away.
    • Message receipts, asking a person, publishing output, releasing a task, task history and file sharing are not available in lean mode.
  • Why it exists: An outside user (issue [Feature]: opt-in lean tool profile for the shared stdio bridge #206) said the full tool list costs too much context for smaller models and for hosts with tight prompt budgets. Lean mode cuts it to about a quarter.
  • Why merge (or why not yet):
    • Not yet: nobody at October has decided on [Feature]: opt-in lean tool profile for the shared stdio bridge #206.
    • The PR makes two product calls on its own:
      • it adds a second, merged tool surface that has to be kept in step with every future Bus tool change;
      • it treats "read" as "acknowledged". That breaks the spec's guidance and the full mode's safety net: an unacknowledged message gets re-sent, but in lean mode a message the AI reads and never acts on is gone.
    • A much simpler subset option exists.
  • What to expect after merging:

Answer in a comment on this PR; the next daily audit reads it.

Full audit (Claude (claude-opus-5-5, xhigh) × Codex (gpt-6.1-sol, xhigh), 1 turns, commit b26f837)

PR audit: #213 — feat(mcp): add an opt-in lean tool profile to the stdio bridge

Head: b26f837

Sign-off

  • Claude (claude-opus-5-5, xhigh): ✅ satisfied — the code works and keeps the default unchanged, but whether lean should exist, in what shape, and with read-means-acknowledged is Harsh's call. Nobody at October has decided it.
  • Codex (gpt-6.1-sol, xhigh): (pending)

Decision

needs-input — the PR adds a second, merged tool surface and changes what "acknowledged" means in it. It is based on a request from an outside user that nobody at October has looked at, and no product decision covers either change.

Should this exist?

  • Verdict: partly — the need is real and measured: [Feature]: opt-in lean tool profile for the shared stdio bridge #206 (from an outside user) measured tools/list at about 11 KB, and this PR's test log shows 2,774 vs 11,321 bytes. But [Feature]: opt-in lean tool profile for the shared stdio bridge #206 has no labels, assignee or comments from anyone at October. Its three open questions were settled by the PR alone: where the flag lives, whether adapter.json records the profile, and whether channels ship in the first version. The merged-tool design and the read-means-acknowledged default are product decisions nobody at October has taken.
  • Product-rule issues:
    • No fake limits, no timers or background cost, no change to the default. Tests prove full is unchanged: cmd/agentintercom/main_test.go:123-131 and adapters/config_test.go:58-63.
    • The size figures are sourced from the test log (mcp_lean_test.go:41).
    • Open issues: "Should this exist?" (an untriaged outside request, plus a new permanent second tool surface), and "prefer the simpler change" (see the alternative below).
    • In lean mode, acknowledging changes meaning: it becomes "read" instead of "processed". A sender on the full profile sees that through message_receipt.
  • Simpler alternative: offer a subset profile that forwards a fixed allowlist of the real upstream tools unchanged. That is about 10 lines in the existing loop at mcp_stdio.go:387. Names, annotations, schemas, error text and explicit acknowledgement stay exactly as they are, and all model-facing text stays correct. The saving is smaller and has not been measured; the same test log could measure it. Copilot and Gemini can already trim tools through host filters (adapters/copilot-cli/mcp.json.example, adapters/gemini-cli/mcp.json.example).
  • Real-launch evidence: missing — only test logs; no session in a real host (e.g. Cursor, Gemini CLI or Claude Code with a lean config). Per Harsh's 2026-11-14 rule this is a non-blocking note.

What changes (plain language)

  • What it does: Adds an optional "lean" mode to the Agent Intercom connector that AI coding tools start. Instead of 23 separate tools, the AI gets 5 combined ones: peers, send, inbox, tasks and channels. The setup-snippet generator can produce configs that switch it on.
  • What changes in the product:
    • Nothing for anyone who doesn't opt in.
    • Opted-in users' AI sees 5 tools. Reading the inbox also marks the messages as handled straight away.
    • Message receipts, asking a person, publishing output, releasing a task, task history and file sharing are not available in lean mode.
  • Why it exists: An outside user (issue [Feature]: opt-in lean tool profile for the shared stdio bridge #206) said the full tool list costs too much context for smaller models and for hosts with tight prompt budgets. Lean mode cuts it to about a quarter.
  • Why merge (or why not yet):
    • Not yet: nobody at October has decided on [Feature]: opt-in lean tool profile for the shared stdio bridge #206.
    • The PR makes two product calls on its own:
      • it adds a second, merged tool surface that has to be kept in step with every future Bus tool change;
      • it treats "read" as "acknowledged". That breaks the spec's guidance and the full mode's safety net: an unacknowledged message gets re-sent, but in lean mode a message the AI reads and never acts on is gone.
    • A much simpler subset option exists.
  • What to expect after merging:

Findings

Blocking

  • Product decision missing for a new tool surface.
    • The PR adds cmd/agentintercom/mcp_lean.go (224 lines): five combined tools, each with its own merged schema (:39-73), argument checking (:82-86) and result merging (:162-224).
    • It also adds a template rewrite in adapters/config.go:132-160 and argument parsing in Pi (adapters/pi/bridge.mjs:7-28).
    • [Feature]: opt-in lean tool profile for the shared stdio bridge #206 is an untriaged outside request whose open questions nobody at October answered.
    • Rules: "Should this exist? … linked issue, the plan, or a decision of Harsh's", "When unsure whether something should exist … ask Harsh", and "Prefer the simpler change". The subset profile above would likely meet most of the need with almost no new code.
  • Lean inbox treats "read" as "acknowledged" by default (mcp_lean.go:179-185, :206-222; "default": true at :67).
    • This contradicts spec/0.1/mcp.md:53 ("The agent SHOULD call acknowledge_messages only after processing succeeds").
    • It removes redelivery. The store re-sends delivered but unacknowledged messages on every pull (bus/store.go:1058: state IN ('queued','delivered'); spec/0.1/state-machines.md:72). In lean mode, a message the model reads but never acts on (turn cut short, host crash, model ignores it) is never offered again.
    • Peers who never opted in are affected too: their message_receipt reports acknowledged when the lean receiver only read the message.
    • [Feature]: opt-in lean tool profile for the shared stdio bridge #206 asked for this default, but this is a protocol-meaning choice that needs Harsh's sign-off (Question 2).

Non-blocking

  • Channel notifications name hidden tools (bus/channels.go:317). Lean supports channel subscribe. Each notification the model then receives through intercom_inbox says "Use read_channel to read it and post_channel to reply". Neither tool exists in lean mode. The PR handled the same problem for the check_inbox hint (mcp_lean.go:204) but missed this one. Fix: use wording that names no tool in bus/channels.go:317.
  • Combined tools carry no annotations or titles (mcp_lean.go:75).
    • Every upstream tool is marked destructiveHint:false and openWorldHint:false, and read-only tools also readOnlyHint:true (bus/mcp_metadata.go:11-26).
    • With no annotations, the go-sdk v1.8.0 defaults apply: DestructiveHint true, OpenWorldHint true (mcp/protocol.go:1964-1991). So intercom_peers, which is purely read-only, is shown as possibly destructive and open-world.
    • Some hosts use these hints in approval decisions (MCP blog on tool annotations; a third-party write-up on Codex CLI).
    • Fix: set annotations per tool (peers: read-only and idempotent; the rest: DestructiveHint:false; OpenWorldHint true for send and channel).
  • --native with --tool-profile lean is not rejected (mcp_stdio.go:136-144). The native wake prompt tells the model to "Use the agent_intercom check_inbox tool, use acknowledge_messages … message_peer" (internal/nativewake/listener.go:27); none of those tools exist in lean mode. Either reject the combination or make the prompt depend on the profile.
  • Errors name a field the lean model can't see. intercom_send with mode:"response" but no replyTo goes upstream and fails with "responseTo is required for a response" (bus/store.go:798). Lean removed responseTo from its schema (mcp_lean.go:63). The bridge could reject this case itself with "mode response requires replyTo" (near :97).
  • Merged schemas lose detail (mcp_lean.go:53, :57-59, :71).
    • Merging is last-write-wins. If upstream ever gives two actions the same field name with different schemas, the bridge silently advertises one of them. Today there is no clash.
    • Per-action required fields are dropped; only action is required.
    • The intercom_task description doesn't list the valid kind values progress|note|blocker (bus/runtime.go:503). The upstream error lists them, so a model can recover.
    • Consider refusing at startup on clashing schemas, in line with the PR's own "refuse rather than promise" approach.
  • Pi re-implements Go flag parsing (adapters/pi/bridge.mjs:7-15). validateTools could decide from the tool list alone (exactly the five lean names, or the core set), without parsing argv. Lean tools also appear in Pi as agent_intercom_intercom_* (adapters/pi/index.mjs:26).
  • doctor --harness only checks the full profile (cmd/agentintercom/harness.go:240, :257). It never checks the channel tools that lean needs, so doctor can report healthy while a lean bridge refuses to start against an older daemon.
  • Docs gaps:
    • spec/0.1/mcp.md:9 still says the CLI "forwards this MCP surface over stdio".
    • The per-host READMEs (e.g. adapters/copilot-cli/README.md, adapters/gemini-cli/README.md) still say "Use check_inbox".
    • The usage error at harness.go:35 doesn't mention --tool-profile.
  • Pre-existing: the full-profile Copilot and Gemini filters leave out the channel tools (adapters/copilot-cli/mcp.json.example, adapters/gemini-cli/mcp.json.example), while lean exposes intercom_channel on those hosts. The two profiles grant different capabilities.
  • Real-launch evidence is missing. Ask the author for one session log from a real host using a generated lean config: the five tools listed, then a send, read and reply round trip.

Fix plan

n/a

Message to the developer

n/a

Questions for Harsh

  1. Should the stdio bridge get a reduced tool mode at all, and in which shape? [Feature]: opt-in lean tool profile for the shared stdio bridge #206 came from an outside user and nobody at October has triaged it; the PR settled its open questions by itself.
    • (a) Merge the merged-tool design (5 combined tools) after the non-blocking fixes. It gives the biggest saving (2,774 vs 11,321 bytes, measured). The cost is a permanent second tool surface, with its own argument rules and result shapes, that every future Bus tool change must keep in step.
    • (b) A simpler subset mode: forward a fixed allowlist of the real tools unchanged (about 10 lines). Names, safety hints, error text and acknowledgement behaviour stay identical. The saving is smaller; the author can measure it with the same test.
    • (c) Not now: keep [Feature]: opt-in lean tool profile for the shared stdio bridge #206 in the backlog. Copilot and Gemini users can already trim tools in their host config.
    • Recommendation: (b), unless you specifically want the combined tools [Feature]: opt-in lean tool profile for the shared stdio bridge #206 describes. In that case answer question 2.
  2. If combined tools (1a): should reading the inbox in lean mode also mark messages as handled?
    • (a) Keep it as built (what [Feature]: opt-in lean tool profile for the shared stdio bridge #206 asked for): one call, no repeat deliveries. But a message the AI reads and never acts on is lost. Senders see "acknowledged" when it was only read. And it goes against the spec's "acknowledge after processing".
    • (b) Default to not acknowledging, so the AI confirms with a second call. Same behaviour as full mode and the spec.
    • (c) Keep it as built and amend spec/0.1/mcp.md to document the lean exception.
    • Recommendation: (b), so "acknowledged" means one thing for every peer.

Verification

  • What I did: read the full diff and the surrounding code:
    • mcp_stdio.go, harness.go, adapters/config.go
    • the Pi bridge and extension, every host template that lists tool names (only Copilot and Gemini)
    • the upstream tool definitions (bus/server.go, bus/channels_transport.go, bus/mcp_metadata.go), inbox reserve and commit (bus/store.go, bus/runtime.go)
    • the spec (spec/0.1/mcp.md, spec/0.1/state-machines.md)
    • go-sdk v1.8.0 Server.AddTool and ToolAnnotations, and jsonschema-go v0.4.3 inference, from the local module cache
    • issue [Feature]: opt-in lean tool profile for the shared stdio bridge #206, through the web page.
  • What I did not run: I did not install, build or run tests, per the audit rules.
  • CI: all 11 checks pass on the head commit. That includes runtime on ubuntu, macOS and Windows (go test, go test -race, go vet, go build, demo) and typescript-sdk, whose npm run test:release runs every scripts/*.test.mjs, including pi-adapter.test.mjs.
  • Checks that matter if this is approved:
    • go vet ./...
    • go test -race -count=1 ./adapters/ ./cmd/agentintercom/, covering TestMCPStdioLeanProfile, TestLeanInboxStopsOnUpstreamError, TestLeanProfileRequiresItsUnderlyingTools, TestMCPStdioBridgeForwardsDaemonTools and TestEveryConfigurationRendersWithoutCredentials
    • node --test scripts/pi-adapter.test.mjs
    • go build ./cmd/agentintercom
    • a manual session in a real host with a lean config.

Audit log

  • Turn 1 (Claude (claude-opus-5-5, xhigh)):
    • Checked: audited from scratch — the full diff; the bridge, harness, config and Pi code around it; the upstream tool schemas and annotations; inbox redelivery in the store; the spec's acknowledgement rules; the go-sdk and jsonschema behaviour in the module cache; issue [Feature]: opt-in lean tool profile for the shared stdio bridge #206 (outside author, untriaged, asked for acknowledge-by-default); CI status; main has not moved since the PR's base.
    • Found: no code defect that blocks merging. Raised two product blockers (should a merged second tool surface exist; read-means-acknowledged against the spec and redelivery) and nine non-blocking items: model-facing text naming hidden tools, missing annotations, --native combined with lean, schema-merge detail, Pi argv parsing, doctor coverage, docs, pre-existing filter gap, launch evidence.
    • Decision: needs-input.

Automated review by Harsh's agentbox: an AI reviewer questioned whether this PR should exist, so it went to Harsh before any detailed review. A second reviewer has not checked it; a full review follows once Harsh answers.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentbox: needs your input Claude and Codex need a decision from Harsh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: opt-in lean tool profile for the shared stdio bridge

2 participants