Skip to content

feat: BTW ephemeral forks + MCP mode descriptions#954

Open
mistercrunch wants to merge 4 commits into
mainfrom
btw-ephemeral-fork
Open

feat: BTW ephemeral forks + MCP mode descriptions#954
mistercrunch wants to merge 4 commits into
mainfrom
btw-ephemeral-fork

Conversation

@mistercrunch
Copy link
Copy Markdown
Member

Summary

  • BTW ephemeral forks: Fork a running session with a side question (❓ button). Result is injected as a system message in the parent conversation, fork auto-archives.
  • MCP agor_sessions_prompt mode descriptions: Clarified what each mode is for — btw is for quick side questions (status checks, summaries, fixes), not restricted to read-only.
  • UI polish: Capability-gated Fork/Spawn/BTW buttons, consistent toolbar styling, btw result rendering with markdown blockquotes.

Test plan

  • Create a Claude Code session, verify ❓ button appears
  • Click ❓ with a side question while session is running — verify ephemeral fork runs and result appears in parent
  • Verify Codex/Gemini sessions hide Fork and BTW buttons but show Spawn
  • Verify MCP agor_sessions_prompt with mode: "btw" on a Claude session works
  • Verify MCP agor_sessions_prompt with mode: "btw" on a Codex session returns capability error

🤖 Generated with Claude Code

mistercrunch and others added 4 commits April 11, 2026 00:49
…Mode support

Implements three connected features:

1. **Fork-while-running**: Removed the isRunning guard from the fork button
   in SessionPanel, allowing users to fork sessions at any time regardless
   of status. The fork captures persisted conversation history.

2. **callbackMode ("once" | "persistent")**: Added callback firing mode to
   control how many times callbacks fire. "once" (new default) fires on
   first completion then auto-disables. "persistent" preserves legacy
   behavior. Available on spawn, create, and update MCP tools.

3. **"btw" mode on sessions.prompt**: New ephemeral fork mode that forks
   the target session (even if running), sets up a one-shot callback to
   the caller, and auto-archives the fork after the callback delivers.
   Perfect for asking side questions without disrupting running work.

Frontend additions:
- "btw" button appears next to Send when session is running
- Placeholder text hints at btw mode when session is working
- BTW forks show orange "btw" badge instead of cyan "FORK" tag
- WorktreeCard tree shows "btw" label for ephemeral forks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dge cases

Fixes from Codex code review of PR #953:

**Critical**: btw button now uses dedicated `btwForkSession` action that
patches fork_origin:"btw" on the forked session, instead of calling the
regular fork flow which had no btw semantics.

**Backward compat**: Legacy sessions without callback_mode now default to
"persistent" (not "once"), preserving existing behavior for pre-existing
spawned sessions.

**Edge cases**: Moved btw auto-archive and once-mode auto-disable out of
queueCallbackToSession into the parent task completion handler, so they
run even if the callback target session is deleted/inaccessible.

**DRY**: Merged fork and btw mode handlers into a single code path in
the MCP sessions.prompt tool, with conditional btw-specific patch.

**Modeling**: Simplified fork_origin type to just "btw" (undefined for
regular forks). Added "btw_completed" archived_reason for auto-archived
ephemeral forks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Inject system message into parent session when btw fork completes,
  showing the question (blockquote) and response as markdown
- Include caller session info for remote btw (MCP), hidden for local
- BTW button always visible with ? icon, consistent button styling
- FileUploadButton matches other toolbar buttons (remove type="text")

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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