Skip to content
Workflow · AI agents

Handoff without compaction

Write HANDOFF.md before you clear context or switch agents: goal, decisions, exact failing test, next step, commit. A checker flags stale or incomplete handoffs.

Verified install Not agent-tested v1.0.0 MIT updated anygit
Equips
  • 1 1 Rules
  • 2 2 Skills
  • – 0 MCP

Automatic compaction keeps what a summariser thought mattered, and decisions are the first thing to go. Practitioners have converged on the same fix: before clearing context or moving work to another agent or person, write a short handoff file with the goal, files touched, decisions and why, the exact failing test and error, and one next step. This loadout makes that a habit. One skill writes HANDOFF.md from git facts and a template; another resumes from it by re-running the verify commands before changing anything. A small checker flags missing sections, leftover placeholders, secrets, and handoffs written at an older commit. The verifier runs the checker through a template, a good handoff, a stale one and a leaky one.

What's in it

  • Write a handoff before /clear, compaction or switching agents, not after
  • Template: goal, state, files, decisions, exact failure, next step, verify commands
  • Checker compares the recorded commit with HEAD and counts the commits since
  • Resume skill re-runs the checks and confirms the next step before editing
  • Works across Claude Code, Codex, Antigravity, Cursor and Copilot

You'll need

  • Tools: python3, git
Level 1 · automated

Verification

Verified install

Checked at commit 021470d · 9 passed, 0 failed, 1 not applicable

CheckResultWhat we found
Listinglisting.yaml matches the schema and declares every file in the folder. Pass
Schema valid; 7 files declared, none missing or extra
  • tested.status: untested (agent tests are separate from Level 1)
Files parseJSON parses; SKILL.md and .mdc front matter is valid YAML with the fields each agent needs; code fences are closed. Pass All 7 files parse; front matter valid
AdaptersCLAUDE.md imports @AGENTS.md, GEMINI.md imports @./AGENTS.md, and both match the generator. Pass
CLAUDE.md and GEMINI.md import AGENTS.md and are up to date
  • CLAUDE.md: matches the generator
  • GEMINI.md: matches the generator
Install pathsEvery file lands where each agent documents it, with no collisions, and the laid-out project is re-discovered correctly. Pass
Correct paths for all 6 agents; layouts re-discovered
  • Claude Code: 6 files, 2 skills in .claude/skills/
  • Codex CLI: 5 files, 2 skills in .agents/skills/
  • Cursor: 5 files, 2 skills in .agents/skills/
  • Gemini CLI: 6 files, 2 skills in .agents/skills/
  • Antigravity CLI: 5 files, 2 skills in .agents/skills/
  • GitHub Copilot: 5 files, 2 skills in .agents/skills/
MCP configmcp.json is structurally valid, converts to each agent's format, declares no literal secrets, and referenced packages exist on npm/PyPI. Not applicable No MCP servers in this loadout
Safety scanThe intake scanner finds no credentials, risky shell, hidden Unicode or prompt-injection wording, and the listing's network flag is honest. Pass
Clean: no credentials, risky shell or hidden text
  • Scanner intake-precheck/1: verdict clean; network no (listing says no)
ReferencesLinks and file paths between the loadout's files resolve, including for each agent's installed layout. Pass 4 references between files resolve for every agent
Size limitsFile count and sizes are within the submission limits; SKILL.md bodies stay under 500 lines. Pass
7 files, 8.8 KB total; largest skills/write-handoff/scripts/check_handoff.py 3.2 KB
  • Limits: 30 files, 32 KB per file, 128 KB total, 500 lines per skill or rule
LicenceA recognised SPDX licence, with the licence text available. Pass MIT, by Agent Loadout; text in the repository LICENSE
Starter buildA minimal fixture project with the loadout applied installs and builds or type-checks, and the loadout's own code examples compile. Pass
The write-handoff checker rejects the bare template, passes a filled HANDOFF.md at the current commit, then flags it as stale after a new commit, and catches a pasted password and a missing section
  • Applied 11 loadout files at every agent's paths
  • ✓ set up a repo: bash -c git init -q -b fix-refunds && echo 'x = 1' > calc.py && git add calc.py && git commit -qm start && echo repo ready
  • ✓ bare template is rejected: bash -c cp .agents/skills/write-handoff/references/HANDOFF.template.md HANDOFF.md && python3 .agents/skills/write-handoff/scripts/check_handoff.py HANDOFF.md; echo "exit=$?"
  • ✓ filled handoff passes: bash -c bash filled.sh && python3 .agents/skills/write-handoff/scripts/check_handoff.py HANDOFF.md
  • ✓ handoff goes stale after a commit: bash -c echo 'x = 2' > calc.py && git commit -qam more && python3 .agents/skills/write-handoff/scripts/check_handoff.py; echo "exit=$?"
  • ✓ password and missing section are caught: bash -c bash filled.sh >/dev/null && sed -i 's/^- none$/- password: hunter2hunter2/' HANDOFF.md && sed -i '/^## Decisions/,/^## Failing/{/^## Failing/!d}' HANDOFF.md && python3 .agents/skills/write-handoff/scripts/check_handoff.py; echo "exit=$?"
  • Covers: Required sections, placeholders and length
  • Covers: Recorded commit compared with HEAD, with the number of commits since
  • Covers: Secret-shaped strings rejected before a handoff is shared

What this means: a script checked the files themselves: they parse, they install where each agent looks, any MCP config is sound, the safety scan is clean, references between files resolve, and, where a free and repeatable fixture exists, a small starter project builds with the loadout applied. No AI agent was run. Per-agent results ("tested with agent") are separate and stay untested until an agent actually runs.

Install

Choose your agent. Run the commands from your project root, or download a zip already laid out in the right folders.

Claude Code reads CLAUDE.md (imports AGENTS.md with @AGENTS.md) and skills from .claude/skills/.

Download zip
curl -fsSL --create-dirs -o AGENTS.md https://loadout.jnw-it.com/raw/agent-handoff/1.0.0/AGENTS.md
curl -fsSL --create-dirs -o CLAUDE.md https://loadout.jnw-it.com/raw/agent-handoff/1.0.0/CLAUDE.md
curl -fsSL --create-dirs -o .claude/skills/write-handoff/SKILL.md https://loadout.jnw-it.com/raw/agent-handoff/1.0.0/skills/write-handoff/SKILL.md
curl -fsSL --create-dirs -o .claude/skills/write-handoff/references/HANDOFF.template.md https://loadout.jnw-it.com/raw/agent-handoff/1.0.0/skills/write-handoff/references/HANDOFF.template.md
curl -fsSL --create-dirs -o .claude/skills/write-handoff/scripts/check_handoff.py https://loadout.jnw-it.com/raw/agent-handoff/1.0.0/skills/write-handoff/scripts/check_handoff.py
curl -fsSL --create-dirs -o .claude/skills/resume-from-handoff/SKILL.md https://loadout.jnw-it.com/raw/agent-handoff/1.0.0/skills/resume-from-handoff/SKILL.md
FileGoes to
AGENTS.mdAGENTS.md
CLAUDE.mdCLAUDE.md
skills/write-handoff/SKILL.md.claude/skills/write-handoff/SKILL.md
skills/write-handoff/references/HANDOFF.template.md.claude/skills/write-handoff/references/HANDOFF.template.md
skills/write-handoff/scripts/check_handoff.py.claude/skills/write-handoff/scripts/check_handoff.py
skills/resume-from-handoff/SKILL.md.claude/skills/resume-from-handoff/SKILL.md

Already have an AGENTS.md or CLAUDE.md? The commands above overwrite it — download the file instead and merge the sections you want.

Files

Rules AGENTS.md When to write and read a handoff file, and what goes in it. 28 lines
Download Raw
# AGENTS.md: hand off work without compaction

Long sessions end in one of three ways: the context fills and gets compacted, you `/clear`, or the work moves to another
agent or person. Compaction keeps what a summariser thought mattered. A handoff file keeps what the next session needs.

## When to write a handoff
- Before `/clear`, `/compact` or ending a long session with work unfinished.
- Before switching agents (for example Claude Code to Codex or Antigravity) or handing to a teammate.
- When the context is clearly getting long: answers slow down, you re-read files you already read, or you lose track
  of earlier decisions. Do not wait for automatic compaction.
- Use the `write-handoff` skill. It writes `HANDOFF.md` at the repo root and checks it.

## When to read one
- At the start of every session, if `HANDOFF.md` exists, use the `resume-from-handoff` skill before doing anything
  else. Confirm the goal and next step with the user in one or two sentences.

## Rules for the file
- Facts, not narrative: goal, current state, files touched, decisions with reasons, what still fails (exact error),
  the next step, and the commands that prove it works.
- Record the commit (`git rev-parse --short HEAD`) and branch. A handoff for a different commit is stale until checked.
- Short: under 120 lines. Link to files and line numbers instead of pasting code.
- No secrets, tokens or personal data. It may be committed or shared.
- One owner per open task. If something is unverified, say so; do not round "probably works" up to "done".
- Delete or archive the file (`git rm HANDOFF.md` or move it to `docs/handoffs/`) when the work is finished.

## MCP servers and tools
- Note which MCP servers and CLIs the work depended on. A new agent may not have them configured.
Adapter CLAUDE.md Imports AGENTS.md for Claude Code. 10 lines
Download Raw
# CLAUDE.md

@AGENTS.md

## Claude Code notes
- Skills from this loadout live in `.claude/skills/`: `write-handoff`, `resume-from-handoff`. Use them when their description matches the task.
- Follow AGENTS.md above; where this file and AGENTS.md disagree, AGENTS.md wins.

<!-- From the Agent Loadout "Handoff without compaction" v1.0.0 — https://loadout.jnw-it.com/loadouts/agent-handoff/ -->
Adapter GEMINI.md Imports AGENTS.md for Gemini CLI. 10 lines
Download Raw
# GEMINI.md

@./AGENTS.md

## Gemini CLI notes
- Skills from this loadout live in `.agents/skills/`: `write-handoff`, `resume-from-handoff`. Use them when their description matches the task.
- Follow AGENTS.md above; where this file and AGENTS.md disagree, AGENTS.md wins.

<!-- From the Agent Loadout "Handoff without compaction" v1.0.0 — https://loadout.jnw-it.com/loadouts/agent-handoff/ -->
Skill skills/write-handoff/SKILL.md Write HANDOFF.md from git facts and check it. 24 lines
Download Raw
---
name: write-handoff
description: Write HANDOFF.md so a fresh session or a different agent can continue without the old context. Use before clearing or compacting context, at the end of a long session, or when switching agents or people.
---

# Write a handoff

1. Gather facts, do not summarise from memory alone:
   - `git rev-parse --abbrev-ref HEAD` and `git rev-parse --short HEAD`
   - `git status --short` and `git diff --stat` for files touched
   - Run the project's test command once and copy the first failing test and its exact error line.
2. Fill in `references/HANDOFF.template.md` and save it as `HANDOFF.md` at the repository root. Keep every heading.
   Write "none" rather than deleting a section.
3. Check it: `python3 scripts/check_handoff.py HANDOFF.md`. Fix everything it reports. It checks the required
   sections, the recorded commit against `HEAD`, length, leftover placeholders and secret-shaped strings.
4. Tell the user where the file is and the single next step. Do not commit it unless the user asks.

## Writing well
- Goal: one sentence on what "done" means, in the user's words.
- Decisions: what you chose, the alternative you rejected, and why. These are what compaction loses first.
- Failing or open: exact test name, command and error. "Tests flaky" is not useful; `test_refund_rounding: expected
  10.00, got 9.99` is.
- Next step: one concrete action the next session can start on without asking.
Skill file skills/write-handoff/references/HANDOFF.template.md Handoff template with every required section. 31 lines
Download Raw
# Handoff

- Branch: <branch>
- Commit: <short sha>
- Written: <YYYY-MM-DD HH:MM timezone>
- Owner: <who picks this up, or "unassigned">

## Goal
<one sentence: what done looks like>

## Current state
<what works now, what was verified and how>

## Files touched
- <path>: <what changed>

## Decisions
- <decision>: <why; alternative rejected>

## Failing or open
- <test or task>: <exact command and error, or "none">

## Next step
<one concrete action>

## Verify with
- <command that proves it works>

## Tools and MCP servers needed
- <name, or "none">
Skill file skills/write-handoff/scripts/check_handoff.py Checks sections, commit freshness, length and secrets. 76 lines
Download Raw
#!/usr/bin/env python3
"""Check a HANDOFF.md before a session ends or another agent picks it up.

Usage: python3 check_handoff.py [HANDOFF.md] [--max-lines 120]
Exit 0 when complete, 1 when something needs fixing. Standard library and git only; no network.
"""
import re
import subprocess
import sys
from pathlib import Path

REQUIRED = ["Goal", "Current state", "Files touched", "Decisions", "Failing or open", "Next step", "Verify with"]
SECRET = re.compile(r"\b(?:sk-[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{30,}|AKIA[0-9A-Z]{16}|xox[abposr]-[A-Za-z0-9-]{10,})"
                    r"|-----BEGIN [A-Z ]*PRIVATE" r" KEY-----|\b(?:password|passwd|token|secret)\s*[:=]\s*\S{8,}", re.I)
PLACEHOLDER = re.compile(r"<[A-Za-z][A-Za-z0-9 ,/:\"'-]*>")


def git(*args):
    try:
        return subprocess.run(["git", *args], capture_output=True, text=True, check=True).stdout.strip()
    except (OSError, subprocess.CalledProcessError):
        return None


def main(argv):
    path = Path(next((a for a in argv[1:] if not a.startswith("--")), "HANDOFF.md"))
    max_lines = int(argv[argv.index("--max-lines") + 1]) if "--max-lines" in argv else 120
    if not path.is_file():
        print(f"FAIL {path} not found")
        return 1
    text = path.read_text(encoding="utf-8")
    lines = text.splitlines()
    problems = []
    headings = {m.group(1).strip().lower(): i for i, l in enumerate(lines) if (m := re.match(r"^##\s+(.+)$", l))}
    for name in REQUIRED:
        if name.lower() not in headings:
            problems.append(f"missing section: ## {name}")
            continue
        start = headings[name.lower()] + 1
        body = []
        for l in lines[start:]:
            if l.startswith("## "):
                break
            if l.strip():
                body.append(l)
        if not body:
            problems.append(f"empty section: ## {name} (write 'none' if there is nothing)")
    if len(lines) > max_lines:
        problems.append(f"too long: {len(lines)} lines (max {max_lines}); link to files instead of pasting")
    for n, l in enumerate(lines, 1):
        if PLACEHOLDER.search(l):
            problems.append(f"line {n}: template placeholder left in: {PLACEHOLDER.search(l).group(0)}")
        if SECRET.search(l):
            problems.append(f"line {n}: looks like a secret; remove it")
    m = re.search(r"^- Commit:\s*([0-9a-f]{7,40})\b", text, re.M)
    head = git("rev-parse", "HEAD")
    if not m:
        problems.append("no '- Commit: <sha>' line")
    elif head and not head.startswith(m.group(1)):
        ahead = git("rev-list", "--count", f"{m.group(1)}..HEAD")
        problems.append(f"stale: written at {m.group(1)}, HEAD is {head[:7]}" + (f" ({ahead} commits later)" if ahead else "")
                        + "; re-check the state before trusting it")
    b = re.search(r"^- Branch:\s*(\S+)", text, re.M)
    branch = git("rev-parse", "--abbrev-ref", "HEAD")
    if b and branch and b.group(1) != branch:
        problems.append(f"branch mismatch: handoff says {b.group(1)}, checkout is {branch}")
    for p in problems:
        print(f"FAIL {p}")
    if not problems:
        print(f"OK {path}: {len(REQUIRED)} sections, {len(lines)} lines, commit matches HEAD")
    return 1 if problems else 0


if __name__ == "__main__":
    sys.exit(main(sys.argv))
Skill skills/resume-from-handoff/SKILL.md Start a session from HANDOFF.md: check, re-run, confirm. 17 lines
Download Raw
---
name: resume-from-handoff
description: Pick up work from HANDOFF.md at the start of a session. Checks the handoff is current, re-runs its verify commands and confirms the next step before changing anything.
---

# Resume from a handoff

1. Read `HANDOFF.md` in full before opening other files.
2. Check it is current: `python3 .agents/skills/write-handoff/scripts/check_handoff.py HANDOFF.md` (or the same script
   under `.claude/skills/`). If it reports "stale", run `git log --oneline <recorded commit>..HEAD` and read what
   changed before trusting the "Current state" section.
3. Re-run the "Verify with" commands. Compare the result with "Failing or open". Note any difference.
4. Check the "Tools and MCP servers needed" are available in this agent. If one is missing, say so; do not guess.
5. Reply to the user in two or three sentences: the goal, what you found when you re-ran the checks, and the next step
   you propose. Wait for a yes if anything differs from the handoff.
6. As you work, keep `HANDOFF.md` updated at natural stopping points, using the `write-handoff` skill.

All files: source zip · Licence MIT · By Agent Loadout · First listed

Installing and testing

How do I install Handoff without compaction in Claude Code?

From your project root, put AGENTS.md, CLAUDE.md, skills/write-handoff/SKILL.md at .claude/skills/write-handoff/SKILL.md, skills/write-handoff/references/HANDOFF.template.md at .claude/skills/write-handoff/references/HANDOFF.template.md, skills/write-handoff/scripts/check_handoff.py at .claude/skills/write-handoff/scripts/check_handoff.py, skills/resume-from-handoff/SKILL.md at .claude/skills/resume-from-handoff/SKILL.md. The "Claude Code" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/agent-handoff/claude-code.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Handoff without compaction in Codex CLI?

From your project root, put AGENTS.md, skills/write-handoff/SKILL.md at .agents/skills/write-handoff/SKILL.md, skills/write-handoff/references/HANDOFF.template.md at .agents/skills/write-handoff/references/HANDOFF.template.md, skills/write-handoff/scripts/check_handoff.py at .agents/skills/write-handoff/scripts/check_handoff.py, skills/resume-from-handoff/SKILL.md at .agents/skills/resume-from-handoff/SKILL.md. The "Codex CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/agent-handoff/codex.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Handoff without compaction in Cursor?

From your project root, put AGENTS.md, skills/write-handoff/SKILL.md at .agents/skills/write-handoff/SKILL.md, skills/write-handoff/references/HANDOFF.template.md at .agents/skills/write-handoff/references/HANDOFF.template.md, skills/write-handoff/scripts/check_handoff.py at .agents/skills/write-handoff/scripts/check_handoff.py, skills/resume-from-handoff/SKILL.md at .agents/skills/resume-from-handoff/SKILL.md. The "Cursor" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/agent-handoff/cursor.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Handoff without compaction in Gemini CLI?

From your project root, put AGENTS.md, GEMINI.md, skills/write-handoff/SKILL.md at .agents/skills/write-handoff/SKILL.md, skills/write-handoff/references/HANDOFF.template.md at .agents/skills/write-handoff/references/HANDOFF.template.md, skills/write-handoff/scripts/check_handoff.py at .agents/skills/write-handoff/scripts/check_handoff.py, skills/resume-from-handoff/SKILL.md at .agents/skills/resume-from-handoff/SKILL.md. The "Gemini CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/agent-handoff/gemini-cli.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Handoff without compaction in Antigravity CLI?

From your project root, put AGENTS.md, skills/write-handoff/SKILL.md at .agents/skills/write-handoff/SKILL.md, skills/write-handoff/references/HANDOFF.template.md at .agents/skills/write-handoff/references/HANDOFF.template.md, skills/write-handoff/scripts/check_handoff.py at .agents/skills/write-handoff/scripts/check_handoff.py, skills/resume-from-handoff/SKILL.md at .agents/skills/resume-from-handoff/SKILL.md. The "Antigravity CLI" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/agent-handoff/antigravity-cli.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

How do I install Handoff without compaction in GitHub Copilot?

From your project root, put AGENTS.md, skills/write-handoff/SKILL.md at .agents/skills/write-handoff/SKILL.md, skills/write-handoff/references/HANDOFF.template.md at .agents/skills/write-handoff/references/HANDOFF.template.md, skills/write-handoff/scripts/check_handoff.py at .agents/skills/write-handoff/scripts/check_handoff.py, skills/resume-from-handoff/SKILL.md at .agents/skills/resume-from-handoff/SKILL.md. The "GitHub Copilot" tab on this page has the curl commands, or download https://loadout.jnw-it.com/download/agent-handoff/copilot.zip, which is already laid out. Do not overwrite an existing AGENTS.md or CLAUDE.md; merge it.

Has Handoff without compaction been tested?

It passed the Level 1 automated install checks on 2026-10-17: the files parse, install to each agent's documented paths, and pass the safety scan. No AI agent has run it yet, so no agent pass or fail is claimed.

More for Claude Code, Codex, Cursor, Gemini CLI, Antigravity CLI and GitHub Copilot.