Skip to content

feat: session handoff protocol and interruption resilience#9

Open
oloflun wants to merge 1 commit intocote-star:mainfrom
oloflun:feat/session-handoff-protocol
Open

feat: session handoff protocol and interruption resilience#9
oloflun wants to merge 1 commit intocote-star:mainfrom
oloflun:feat/session-handoff-protocol

Conversation

@oloflun
Copy link
Copy Markdown

@oloflun oloflun commented Apr 4, 2026

Closes #8

Summary

Adds three patterns for reliable cross-agent handoffs even when sessions are interrupted:

  • Clean handoff: chorus send at conclude + chorus messages at standup — added to CLAUDE.md, AGENTS.md, and GEMINI.md with exact commands
  • Interrupted handoff (Claude Code): scripts/hooks/chorus-session-end.sh — a SessionEnd hook that auto-sends git state to other agents on any CLI exit, including crashes and closed windows. Guards on .agent-chorus/ presence so it is safe to install globally.
  • Mid-task checkpoint (Codex/Gemini): .agent-chorus/CHECKPOINT.md pattern for agents without a hook system — written at task start, survives interruption without requiring hooks

Also expands GEMINI.md which was near-empty (11 lines, context-pack block only) to a full integration block matching the depth of CLAUDE.md and AGENTS.md.

New Files

  • scripts/hooks/chorus-session-end.sh — reusable SessionEnd hook with install instructions in the file header
  • docs/session-handoff-guide.md — covers all three patterns, the Gemini protobuf limitation (chorus read --agent gemini returns NOT_FOUND when sessions are .pb not JSONL), and the JSONL stub workaround

Why SessionEnd not Stop

Stop fires after every response turn. SessionEnd fires exactly once when the process exits. Using Stop would flood agent message queues with one entry per exchange.

Test Plan

  • chorus send --from claude --to codex --message "test" --cwd . succeeds
  • chorus messages --agent codex --cwd . --json returns the message
  • bash scripts/hooks/chorus-session-end.sh with CLAUDE_PROJECT_DIR=. sends to codex + gemini
  • Script no-ops silently when .agent-chorus/ does not exist (guard check)
  • chorus messages --agent codex --json after hook run contains branch + uncommitted count + last commit

Developed and verified against agent-chorus v0.9.1 on Windows 11 with Claude Code, Codex, and Gemini/Antigravity running in parallel on the same project.

🤖 Generated with Claude Code

Add three patterns for reliable cross-agent handoffs:

1. Clean handoff: chorus send at conclude + chorus messages at standup.
   Added session handoff protocol sections to CLAUDE.md, AGENTS.md,
   and GEMINI.md with exact commands and --clear flag usage.

2. Interrupted handoff (Claude Code): scripts/hooks/chorus-session-end.sh
   — a SessionEnd hook that auto-sends git state (branch, uncommitted
   count, last commit) to codex and gemini on every CLI exit. Guards with
   .agent-chorus/ presence check so it is safe to install globally.
   Use SessionEnd not Stop — Stop fires per response turn, SessionEnd
   fires exactly once on process exit.

3. Mid-task checkpoint (Codex/Gemini): .agent-chorus/CHECKPOINT.md written
   at the start of each significant task block. Survives interruption
   without requiring a hook system. Added to AGENTS.md and GEMINI.md.

Also adds docs/session-handoff-guide.md covering all three patterns,
the Gemini protobuf limitation (chorus read --agent gemini returns
NOT_FOUND when sessions are stored as .pb rather than JSONL), and the
JSONL stub workaround at conclude time.

GEMINI.md was previously near-empty (11 lines context-pack block only).
Now has full chorus integration block matching CLAUDE.md/AGENTS.md depth.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@oloflun oloflun force-pushed the feat/session-handoff-protocol branch from 01c0276 to 4c2e516 Compare April 4, 2026 23:02
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.

Missing: session handoff protocol and interruption resilience

1 participant