Skip to content

Spike: MCP threads toolkit, Agents panel and Subagents section (#3) - #4

Closed
lukemaj wants to merge 4 commits into
mainfrom
spike/3-threads-toolkit
Closed

lukemaj wants to merge 4 commits into
mainfrom
spike/3-threads-toolkit

Conversation

@lukemaj

@lukemaj lukemaj commented Sep 24, 2026 •

Copy link
Copy Markdown

Throwaway spike for #3. Draft, not for merge.

Agents in a T3 thread can now start child threads on a chosen provider instance, model and effort through a new threads MCP toolkit, next to device, preview and pullRequests. Each child shows in the parent's Agents panel, and clicking its row opens the child thread, where the user reads it and messages it with the normal composer. Child threads are hidden from the sidebar. This replaces the earlier Subagents shelf (commit 8638154). Findings and the recommendation are on #3.

How it works

  • Toolkit (spawn_thread, message_thread, read_thread, list_child_threads): dispatches the ordinary thread.create and thread.turn.start commands for the calling thread's project.
  • Parent link: the child's id carries its parent, sub.<parentThreadId>.<suffix>, so no contract, projector or migration change is needed. A production version would add a real parentThreadId field.
  • Agents panel: a bridge subscribes to domain events and mirrors each child's lifecycle into the parent's activities as the task.* rows (agentKind: "agent") that subagentRuntime.ts already folds. AgentsPanel.tsx and subagentRuntime.ts are unchanged.
  • Report back: when reportBack is true (the default), each finished child turn is sent to the parent as a message, so the reply reaches the parent without polling.

Diff split

New files (6, 604 lines):

File Lines
apps/server/src/mcp/toolkits/threads/handlers.ts 363
apps/server/src/mcp/toolkits/threads/tools.ts 143
apps/server/src/mcp/toolkits/threads/subagentThreadId.ts 25
apps/server/src/mcp/toolkits/threads/subagentThreadId.test.ts 18
apps/web/src/components/AgentThreadLink.tsx 30
apps/web/src/components/subagentThreads.ts 25

Edited upstream files (3, +14 / -1):

File Change Upstream commits, last 90 days
apps/server/src/mcp/McpHttpServer.ts +7: register the toolkit 8
apps/web/src/components/Sidebar.tsx +3: filter child threads out 142
apps/web/src/components/AgentsPanel.tsx +4 / -1: wrap direct-spawn rows in AgentThreadLink 6

The earlier shelf version edited 2 upstream files, +54 / -3 (Sidebar.tsx +47 / -3), and added sidebar/SidebarSubagentsShelf.tsx.

The spike merges cleanly with upstream/main as of f3cb2a1 (checked with git merge-tree).

Proof

  • Isolated dev instance: T3 home under /tmp, server port 14791, web port 7056. The user's instance was not touched.
  • tsc --noEmit passes for apps/server and apps/web. vp test run src/mcp/toolkits/threads/ passes (2 tests). Lint on the changed files adds no new errors.
  • In a live run, a Claude Haiku parent spawned children on Codex (gpt-6-luna), Grok (grok-build), OpenCode (nemotron-3.5-lightning-free) and a second Claude instance. It also messaged a working child and an idle child, and got each child's reply back as a message.

Children hidden from the sidebar; the parent's Agents panel lists them:

Hidden children

After clicking a child row and sending a message with the composer, the child replied:

Child reply

Earlier shelf version (superseded), with MCP-spawned and outside-process children in the Agents panel:

Agents panel

Children created from outside through POST /api/orchestration/dispatch show up the same way:

Outside-process jobs

Not covered: mobile, and a way back from a child thread to its parent. The child has no sidebar row, so the user returns through the parent's own row.

Model and harness: Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

lukemaj and others added 3 commits September 24, 2026 22:39
…eads (#3)

Adds a threads toolkit (spawn_thread, message_thread, read_thread,
list_child_threads) next to device, preview and pullRequests. A bridge
mirrors each child thread's lifecycle into its parent's activities as the
task.* rows the Agents panel already folds, and can send each finished
turn back to the parent.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…elf (#3)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… a starting child (#3)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e Agents panel (#3)

Replaces the Subagents shelf: child threads are filtered out of the
sidebar, and their Agents panel rows link to the child thread.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@lukemaj

lukemaj commented Sep 25, 2026

Copy link
Copy Markdown
Author

Superseded by #10, which carries this spike to production for issue #8 (parent link decision, Agents panel listing, sidebar hiding in both sidebars, toolkit guards, tests, live proof with Codex and OpenCode children). Leaving this draft open as the spike record.

@lukemaj

lukemaj commented Sep 25, 2026

Copy link
Copy Markdown
Author

Superseded by #10 (production version for #8, merged as dbc38af).

@lukemaj lukemaj closed this Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant