Let agents park a fork of the chat when they find a tangent - #301
Open
frenchie4111 wants to merge 2 commits into
Open
Let agents park a fork of the chat when they find a tangent#301frenchie4111 wants to merge 2 commits into
frenchie4111 wants to merge 2 commits into
Conversation
Agents routinely notice a second problem while answering the first, and today they have no sanctioned move: derail into it, or bury it in a closing bullet. The new fork_chat MCP tool copies the caller's transcript into a second session and stops there — no tab, no subprocess, nothing running until the user clicks the card. That asymmetry is the safety story; an autonomous fork that spawned a sibling agent in the same working tree would not be. There is deliberately no slice behind a parked fork. The topic and prompt live in the tool_use input, the fork's session id in the tool_result, and "has it been opened" is answered by the panes tree — all already durable and already synced, so a restart can't disagree with a parallel record. The cap of 3 unopened forks per conversation derives from the same walk. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
frenchie4111
force-pushed
the
love-expiriment-chats-being-able
branch
from
August 27, 2026 13:19
8b93a11 to
c851b42
Compare
The agent-initiated fork_chat tool only fires when the model happens to notice a tangent, which is rare. This adds the user-initiated half: an "ask in fork" button (Cmd/Ctrl+Alt+Enter) next to Send that copies the conversation into a sibling tab, asks the draft there, and switches to it — leaving the original untouched even mid-stream, so a side question no longer costs an interrupt. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Agents routinely notice a second problem while answering the first. Today they have no sanctioned move: derail into it, or bury it in a closing bullet. Both lose it.
create_worktree({forkConversation})exists but explicitly tells agents not to use it for adjacent tangents, andjsonClaude:forkAtis wired only to the right-click menu and opens empty.This adds a
fork_chatMCP tool. The agent calls it mid-answer; Ness copies the caller's transcript as it stands into a fresh session id and stops there — no tab, no subprocess, nothing running. A parked fork is a jsonl on disk plus a card in the transcript at the exact point the agent had the thought. It only becomes a chat when the user clicks Open.That asymmetry is the whole safety story: an autonomous fork that spawned a sibling agent into the same working tree would not be acceptable; one that leaves a note behind is.
UI
textrow so it can't get buried inside a collapsed tool group.chat-forkautomated turn (renders as "Forked Thread"). The fork gets guidance telling it the transcript above is inherited context, not its task.fork_chatis stripped from the tool list entirely rather than advertised and then rejected.No slice
There is deliberately no state backing a parked fork. Everything is already durable and already synced:
tool_useinputtool_resulttext (parseable marker)Panes persist across restart, so this stays correct with zero bookkeeping. A parallel record would be a second source of truth a restart could disagree with. The cap derives from the same walk.
Test plan
npm run typechecknpx electron-vite buildnpx vitest run— 14 new tests insrc/shared/fork-chat.test.ts, 6 new insrc/main/control-server.test.ts(55 pass in those two files). The 3 unrelated failures in a full parallel run (git-ops-state,worktree-watcher.integration) are load flakes — both pass in isolation, with and without this branch.fork_chat→ card renders → Open promotes it to a sibling tab that resumes with the queued prompt. Not yet verified at runtime.tools/listwhen conversation forking is disabled.🤖 Generated with Claude Code