Skip to content

marcj/handover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Handover

A Claude Code plugin for preserving context, learnings, and state across agent sessions. When you're running low on context (~80% used), invoke /handover to create a living document that the next agent can pick up seamlessly.

This is specifically designed for long-running, big and complex tasks; to keep Claude on track. Tasks where a single session is not enough and auto-compact doesn't cut it.

This works for me much better than auto-compact. This helps also a messing-up agent to stop, reflect, and restart with learnings in a fresh context. In this case I just tell the agent "You messed up, we need to handover"; works great!

Note: This is not designed to make agents run forever autonomously; Quite the opposite: You are still in the driver seat. From my experience going full auto-pilot is a bad idea and never worked, hence why I designed this plugin and workflow instead.

Features

  • Living handover document (.claude/handover.md) that accumulates learnings across generations
  • Context-aware statusline showing usage percentage and topic segmentation
  • Suppressed issue tracking β€” catches when agents hide problems instead of fixing them
  • Task preservation β€” captures in-flight tasks before session ends
  • WIP commits β€” automatically commits current state so next agent can't accidentally revert
  • Takeover skill β€” for when you forgot to handover and need to recover from a closed session

Nice status line to know when you have context-rot and should handover:

Statusline showing context usage and topic segments

Quick Install

Tell Claude:

Read https://github.com/marcj/handover and install it in this project

Claude will read the repo, understand the installation steps, and set everything up for you.

Workflow

                              THE HANDOVER CYCLE
                              ==================

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚                                                                      β”‚
    β”‚    SESSION N                              SESSION N+1                β”‚
    β”‚    ─────────                              ───────────                β”‚
    β”‚                                                                      β”‚
    β”‚    Agent works                            Agent reads                β”‚
    β”‚         β”‚                                 .claude/handover.md        β”‚
    β”‚         β”‚                                      β”‚                     β”‚
    β”‚         β–Ό                                      β–Ό                     β”‚
    β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”‚
    β”‚    β”‚ context β”‚                           β”‚ init    β”‚                 β”‚
    β”‚    β”‚ fills   β”‚                           β”‚checklistβ”‚                 β”‚
    β”‚    β”‚ up...   β”‚                           β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜                 β”‚
    β”‚    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜                                β”‚                      β”‚
    β”‚         β”‚                                     β–Ό                      β”‚
    β”‚         β”‚ ~80% used?                     continues work              β”‚
    β”‚         β”‚                                with full context           β”‚
    β”‚         β–Ό                                     β”‚                      β”‚
    β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                β”‚                      β”‚
    β”‚    β”‚/handoverβ”‚                                β”‚                      β”‚
    β”‚    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜                                β”‚                      β”‚
    β”‚         β”‚                                     β”‚                      β”‚
    β”‚         β”œβ”€β”€ gather context                    β”‚                      β”‚
    β”‚         β”œβ”€β”€ extract learnings                 β”‚                      β”‚
    β”‚         β”œβ”€β”€ capture tasks                     β”‚                      β”‚
    β”‚         β”œβ”€β”€ scan suppressed issues            β”‚                      β”‚
    β”‚         β”œβ”€β”€ curate existing knowledge         β”‚                      β”‚
    β”‚         └── WIP commit                        β”‚                      β”‚
    β”‚              β”‚                                β”‚                      β”‚
    β”‚              β–Ό                                β”‚                      β”‚
    β”‚    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚                      β”‚
    β”‚    β”‚.claude/handover.md                       β”‚                      β”‚
    β”‚    β”‚                  β”‚β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚
    β”‚    β”‚ β€’ architecture   β”‚                                              β”‚
    β”‚    β”‚ β€’ current state  β”‚      (living document that                   β”‚
    β”‚    β”‚ β€’ learnings βš οΈβœ…  β”‚       accumulates across                     β”‚
    β”‚    β”‚ β€’ dead ends      β”‚       agent generations)                     β”‚
    β”‚    β”‚ β€’ suppressed     β”‚                                              β”‚
    β”‚    β”‚ β€’ tasks          β”‚                                              β”‚
    β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                              β”‚
    β”‚                                                                      β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

                    Knowledge compounds, not resets.

Detailed Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                            SESSION 1 (Agent A)                              β”‚
β”‚                                                                             β”‚
β”‚   Work, work, work...                                                       β”‚
β”‚                                                                             β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚   β”‚ Opus 4.5 β”‚ 82% used (164k) β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘ ● task A  ● free   β”‚   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                             β”‚
β”‚   User: "Let's handover"                                                    β”‚
β”‚                                    β”‚                                        β”‚
β”‚                                    β–Ό                                        β”‚
β”‚                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                               β”‚
β”‚                         β”‚    /handover      β”‚                               β”‚
β”‚                         β”‚                   β”‚                               β”‚
β”‚                         β”‚ β€’ Gather context  β”‚                               β”‚
β”‚                         β”‚ β€’ Extract learns  β”‚                               β”‚
β”‚                         β”‚ β€’ Capture tasks   β”‚                               β”‚
β”‚                         β”‚ β€’ Scan issues     β”‚                               β”‚
β”‚                         β”‚ β€’ WIP commit      β”‚                               β”‚
β”‚                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                               β”‚
β”‚                                   β”‚                                         β”‚
β”‚                                   β–Ό                                         β”‚
β”‚                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                               β”‚
β”‚                         β”‚ .claude/handover.md                               β”‚
β”‚                         β”‚                   β”‚                               β”‚
β”‚                         β”‚ β€’ Init checklist  β”‚                               β”‚
β”‚                         β”‚ β€’ Architecture    β”‚                               β”‚
β”‚                         β”‚ β€’ Current state   β”‚                               β”‚
β”‚                         β”‚ β€’ Next steps      β”‚                               β”‚
β”‚                         β”‚ β€’ Tasks           β”‚                               β”‚
β”‚                         β”‚ β€’ Learnings βš οΈβœ…   β”‚                               β”‚
β”‚                         β”‚ β€’ Dead ends       β”‚                               β”‚
β”‚                         β”‚ β€’ Suppressed      β”‚                               β”‚
β”‚                         β”‚ β€’ Generation log  β”‚                               β”‚
β”‚                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β”‚  (session ends)
                                    β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                            SESSION 2 (Agent B)                              β”‚
β”‚                                    β”‚                                        β”‚
β”‚   User: "Read .claude/handover.md and continue"                             β”‚
β”‚                                    β”‚                                        β”‚
β”‚                                    β–Ό                                        β”‚
β”‚                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                               β”‚
β”‚                         β”‚   Init Checklist  β”‚                               β”‚
β”‚                         β”‚                   β”‚                               β”‚
β”‚                         β”‚ 1. Read handover  β”‚                               β”‚
β”‚                         β”‚ 2. Read CLAUDE.md β”‚                               β”‚
β”‚                         β”‚ 3. Read plan file β”‚                               β”‚
β”‚                         β”‚ 4. Run verify cmd β”‚                               β”‚
β”‚                         β”‚ 5. Recreate tasks β”‚                               β”‚
β”‚                         β”‚ 6. Verify learns  β”‚                               β”‚
β”‚                         β”‚ 7. Check issues   β”‚                               β”‚
β”‚                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                               β”‚
β”‚                                   β”‚                                         β”‚
β”‚                                   β–Ό                                         β”‚
β”‚                                                                             β”‚
β”‚   Agent B continues with full context, learnings, and task list...          β”‚
β”‚                                                                             β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚   β”‚ Opus 4.5 β”‚ 15% used (30k) β–’β–’β–’β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ ● setup  ● free      β”‚   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Screenshots

Statusline with context segmentation

Statusline showing context usage and topic segments

Statusline with different segments

Statusline with different segments

Handover document

Handover skill generating the living document

Manual Installation

If you prefer to install manually (or Claude's install didn't work):

1. Copy the skill to your project

# In your project directory
mkdir -p .claude/skills/handover
curl -o .claude/skills/handover/SKILL.md https://raw.githubusercontent.com/marcj/handover/main/skills/handover/SKILL.md

# Optional: takeover skill for recovering from forgotten handovers
mkdir -p .claude/skills/takeover
curl -o .claude/skills/takeover/SKILL.md https://raw.githubusercontent.com/marcj/handover/main/skills/takeover/SKILL.md

Or for global installation (all projects):

mkdir -p ~/.claude/skills/handover ~/.claude/skills/takeover
curl -o ~/.claude/skills/handover/SKILL.md https://raw.githubusercontent.com/marcj/handover/main/skills/handover/SKILL.md
curl -o ~/.claude/skills/takeover/SKILL.md https://raw.githubusercontent.com/marcj/handover/main/skills/takeover/SKILL.md

2. Install the statusline (optional but recommended)

The statusline shows context usage and topic segmentation at a glance.

# Create statusline directory
mkdir -p ~/.claude/statusline

# Download the scripts
curl -o ~/.claude/statusline/ctx_monitor.js https://raw.githubusercontent.com/marcj/handover/main/statusline/ctx_monitor.js
curl -o ~/.claude/statusline/ctx_daemon.js https://raw.githubusercontent.com/marcj/handover/main/statusline/ctx_daemon.js

# Make executable
chmod +x ~/.claude/statusline/ctx_monitor.js ~/.claude/statusline/ctx_daemon.js

# Add to Claude Code settings
cat ~/.claude/settings.json | jq '. + {"statusLine": {"type": "command", "command": "~/.claude/statusline/ctx_monitor.js"}}' > /tmp/settings.json && mv /tmp/settings.json ~/.claude/settings.json

Or manually add to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline/ctx_monitor.js"
  }
}

Usage

Handover (end of session)

When you're running low on context or ending a work session:

/handover

Or naturally mention it:

  • "We need to handover"
  • "Let's handover to the next agent"
  • "You keep making the same mistake, we need to handover to a fresh agent"

The agent will:

  1. Gather context from the conversation
  2. Scan for suppressed issues (tests skipped, code commented out, etc.)
  3. Capture active tasks
  4. Propose learnings extracted from the session
  5. Curate existing knowledge (verify what's still relevant)
  6. Write/update .claude/handover.md
  7. Create a WIP commit

Takeover (new session, forgot to handover)

If you closed a session without running /handover:

/takeover

This will:

  1. Find recent session transcripts
  2. Let you pick which session to recover
  3. Run the handover protocol on that closed session
  4. Create the handover document retroactively

Starting a new session

The next agent should begin with:

Read .claude/handover.md and continue the work

The handover document includes an init checklist the agent must follow.

Handover Document Structure

.claude/handover.md contains:

  • Init Checklist β€” steps the next agent must complete before starting
  • Architecture Snapshot β€” high-level project structure (evolves slowly)
  • Current State β€” branch, dirty files, failing tests, verification command
  • Next Steps β€” prioritized task list
  • Alignment Check β€” goal, scope boundary, plan file reference
  • Tasks β€” captured from Claude's task list
  • Learnings β€” accumulated knowledge (⚠️ unverified, βœ… verified)
  • Dead Ends β€” approaches that didn't work
  • Suppressed Issues β€” problems hidden instead of fixed
  • Open Questions β€” unresolved technical decisions
  • Generation Log β€” audit trail of all handovers

Statusline

The statusline shows:

Opus 4.5 β”‚ 82.0% used (164k) β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘ ● handover skill  ● statusline  ● free
  • Model name
  • Context usage percentage and token count
  • Visual bar with topic segments
  • Legend showing what each segment represents

The segmentation is powered by a background daemon that calls Claude Sonnet via claude --print to analyze the conversation topics. It only re-analyzes when context increases by 10%+ and at least 60 seconds have passed.

How It Works

Knowledge Preservation

The handover document is a living document β€” it's not just a snapshot, it accumulates knowledge across agent generations:

  • Learnings are appended with each handover, marked as unverified (⚠️)
  • Later agents can verify learnings against the codebase and mark them βœ…
  • Stale entries are pruned when the agent confirms they no longer apply

Suppressed Issue Detection

Agents sometimes "solve" problems by hiding them:

  • Removing tests from whitelists
  • Adding .skip to failing tests
  • Commenting out problematic code
  • Adding workarounds with "doesn't support yet" comments

The handover skill scans for these patterns and tracks them in the Suppressed Issues section. These can only be removed when the underlying issue is actually fixed.

No Interruptions

The handover process is designed to be fast and non-intrusive:

  • Agent extracts information from conversation context (no re-reading files)
  • Agent proposes learnings instead of asking you to recall
  • Agent curates existing entries by checking the codebase, not asking you
  • Only asks for human judgment where needed (direction, scope)

Configuration

Segmentation Thresholds

In ctx_daemon.js:

const MIN_INTERVAL_MS = 60 * 1000;  // 60 seconds between analyses
const MIN_PCT_DELTA = 10;           // 10% context increase before re-analyze

Daemon Idle Timeout

The daemon automatically shuts down after 10 minutes of inactivity:

const IDLE_TIMEOUT_MS = 10 * 60 * 1000;

Troubleshooting

Statusline shows wrong segments

The daemon caches segments by session ID. If you see segments from another session:

rm ~/.claude/statusline/segment_cache.json
pkill -f ctx_daemon.js

Daemon not starting

Check if it's running:

ps aux | grep ctx_daemon

The statusline auto-starts the daemon on first refresh. Check for errors:

node ~/.claude/statusline/ctx_daemon.js

Context percentage doesn't match /context

The statusline uses Claude's provided used_percentage from the input data. If there's a mismatch, check ~/.claude/statusline/debug_input.json (if debug logging is enabled).

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors