From circuit
Core lifecycle primitive. Save session state to disk so a fresh session can resume automatically. Use when context is getting heavy, the user asks for a handoff, or you need to preserve progress before a session boundary. Also supports `/circuit:handoff done` to clear a pending handoff. Works alongside active-run.md (automatic continuity) as the intentional high-quality continuity path.
How this skill is triggered — by the user, by Claude, or both
Slash command
/circuit:handoffThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Core lifecycle primitive. Write a handoff file to disk. On the next `/clear` or
Core lifecycle primitive. Write a handoff file to disk. On the next /clear or
session start, the Circuit hook auto-injects it so the fresh session picks up
where this one left off. No clipboard, no paste.
Circuit provides two continuity mechanisms:
/circuit:handoff. Distills
hard-to-rediscover facts that active-run.md cannot capture (eliminated approaches,
operating constraints, debug state). Higher-effort, higher-fidelity.Both mechanisms coexist. Handoff.md is the richer path. active-run.md is the safety net.
/circuit:handoff -- capture current state and write to disk/circuit:handoff done -- delete the pending handoffClears both continuity mechanisms so the next session starts fresh.
.circuit/current-run exists, remove it.active-run.md files under .circuit/circuit-runs/ (any depth)
and rename each to completed-run.md. This archives every run's dashboard,
not just the currently pointed one, so the fallback heuristic finds nothing.Why all active-run.md files are archived: session-start.sh has a fallback
heuristic that finds the most recently modified active-run.md when no explicit
pointer exists. Removing the pointer alone is not enough -- the fallback would
inject a finished or stale run. Archiving only the pointed run can surface a
different stale run instead of the welcome screen. Renaming all active-run.md
files to completed-run.md ensures the fallback finds nothing regardless of
how many prior runs exist. Run directories stay intact for reference.
The handoff file is stored using a git-root-normalized slug so it can be found from any subdirectory within the same repo.
git rev-parse --show-toplevel as the slug source$PWD as the slug sourceDIR in the handoff should still be $PWD (the actual working directory), not the git root.
The slug source and DIR may differ -- that is correct.
Worktree check: If the project uses git worktrees, note the worktree path in STATE. The slug is derived from the git root of the current worktree. If you are in a worktree, the slug will be the worktree's git root, not the main repo's root.
Collect details that are expensive to recover:
If the work lives in a git repo, run $CLAUDE_PLUGIN_ROOT/skills/handoff/scripts/gather-git-state.sh
for reference, but do not encode anything in the handoff that git status, git log, or
git diff would show.
Never imply certainty the session did not earn.
Classify by the number of distinct moving parts the consuming session needs to track:
Most sessions are medium. Do not default to complex because the work felt hard.
Is the session primarily about reproducing, diagnosing, or fixing a failure? If yes, STATE must lead with the debug block before other STATE bullets.
Use exactly this structure. Omit DEBT if empty. STATE is never empty.
# Handoff
WRITTEN: <ISO 8601 timestamp, e.g. 2026-04-03T14:30:00Z>
DIR: /absolute/path/to/working/directory
NEXT: [DO: <exact command, file:line, or concrete step> | DECIDE: <decision name> -- options: A) <option>, B) <option>]
GOAL: <one sentence -- what done looks like> [VERIFY: confirm this is still the right target before acting]
STATE:
- <what is true right now that git cannot show -- one bullet per fact>
DEBT:
- RULED OUT: <approach> -- <why, short form>
- DECIDED: <decision> -- <reason>
- BLOCKED: <blocker> -- <unblocking condition>
- CONSTRAINT: <operating rule>
Field rules:
$PWD). The cold-start anchor.DO: or DECIDE:.
DO: means the action is ready to execute. Use only when unambiguous.DECIDE: means the session ended at a branch point. Name the decision and list options.DECIDE: need user input -- <specific question> when it genuinely requires the user.[VERIFY: confirm this is still the right target before acting]. This annotation is an instruction to the consuming agent, not prose to trim.hypothesis:, repro:, expected:, actual:, eliminated:.RULED OUT:, DECIDED:, BLOCKED:, or CONSTRAINT:. No unprefixed entries. Format: <PREFIX>: <subject> -- <compressed rationale>. Target ~25 tokens per entry. If more is needed, use a reference: RULED OUT: JWT -- scaling cost; see prior session STATE for full reasoning. For research sessions, DEBT includes collapsed argument chains as RULED OUT entries.Token targets (soft, DEBT-excluded):
DEBT entries are excluded from ceiling tracking. The per-entry ~25 token guideline applies instead.
Apply compression in this order. Stop when within target:
git status, git log, git diff)The structure is the same for all task types. Content differs:
The handoff uses git-root-normalized slugs so it can be found from any subdirectory.
git rev-parse --show-toplevel as the slug source$PWD as the slug source/ with - to get the project slug~/.claude/projects/<slug>/handoff.mdExample: invoking /circuit:handoff from /Users/petepetrash/Code/circuit/hooks uses git root
/Users/petepetrash/Code/circuit, slug becomes -Users-petepetrash-Code-circuit,
handoff goes to ~/.claude/projects/-Users-petepetrash-Code-circuit/handoff.md.
Use the Write tool. Overwrite any existing handoff at that path.
Note: Auto-resume on /clear requires the Circuit session-start hook to be active.
Without it, the handoff file is written to disk but must be manually referenced in a new
session. The hook handles detection, validation, and injection automatically.
After writing, confirm briefly:
Handoff saved.
/clearwhen ready for a fresh session.
Do not display the handoff contents. Do not copy to clipboard. The hook handles injection.
When writing a handoff during an active circuit run, also check for
${RUN_ROOT}/artifacts/active-run.md. If it exists:
## Current Phase
pause
## Next Step
Resume from handoff.md
## Last Updated
<ISO 8601 timestamp>
This ensures both continuity mechanisms are synchronized.
After updating this skill, verify the hook wrapper in the Circuit plugin's
hooks/session-start.sh is consistent with this format before closing.
npx claudepluginhub petekp/circuit --plugin circuitGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.