Engineering
Coding Agent Handoff
Keep a written ledger of every spawned coding agent, check it is alive, and never report done without a PR link or commit hash.
- Skill
coding-agent-handoff- Version
- 1.0.0
- License
- MIT
- By
- Christensen Equity · Austin Christensen
- agents
- delegation
- reliability
- git
- handoff
Use this skill
Claude Code: install for your user
curl -fsSL --create-dirs -o ~/.claude/skills/coding-agent-handoff/SKILL.md https://www.austinchristensen.tech/skills/coding-agent-handoff/SKILL.mdOr download SKILL.md and drop it in .claude/skills/coding-agent-handoff/ in a project, upload it in Claude.ai under Settings → Capabilities → Skills, or view the source.
When the agent uses it
Protocol for spawning background coding agents, tracking what each one owes, checking that they are still alive, and handing their work off across sessions. Use when starting any coding agent or subagent on a task that outlives the current turn, when a session resumes and needs to know what was in flight, when the user asks "is that done?" or "what are the agents doing?", or when reporting finished work. Prevents the most common agent failure, which is saying work was started or done when it wasn't. Not for writing the task prompt itself (use agent-task-brief) or for one-shot edits done inline.
Coding Agent Handoff
Sessions restart with no memory. Background agents crash, lose their worktree, or stall quietly. Without a written record, the next session cannot tell what was promised, started, or finished, and the user gets told "done" about work that does not exist. This skill makes every spawned agent a row in a ledger and every "done" a link.
When to use
- Before spawning any coding agent, subagent, or background job that will outlive this turn.
- At the start of a session, to recover what was in flight.
- Whenever the user asks for status, and before reporting anything as finished.
Inputs
- The task, the repository, and the base branch.
- A ledger file. Default:
agents/ledger.mdin the workspace (outside the repo being changed), or wherever the user already keeps state.
Workflow
- Write the ledger entry before spawning. Not after. If the spawn fails, mark the entry failed.
## 2026-03-04 14:10 · fix-invoice-rounding - Agent/session id: <id the tool returned> - Repo / base: <owner/repo> @ main - Branch: fix/invoice-rounding - Worktree: <path> - Task: <one sentence> - Expected deliverable: PR against main with a regression test - Check back: 30 min - Status: RUNNING - Isolate the work. One agent, one branch, one worktree:
Agents sharing a checkout overwrite each other.git fetch origin main git worktree add ../wt-invoice-rounding -b fix/invoice-rounding origin/main - End the agent's prompt with a definition of done: lint, typecheck, and tests pass; the branch is pushed; a PR is open; reply with the PR URL and the final commit hash. Use
agent-task-briefto write the rest of the prompt. - Check liveness on a schedule. For every entry still RUNNING past its check-back time:
Plus the agent tool's own status for its session id. Then classify:git -C <worktree> log --oneline -3 2>/dev/null || echo "WORKTREE GONE" git ls-remote --heads origin fix/invoice-rounding gh pr list --head fix/invoice-rounding --json number,url,state- Progressing: new commits or output. Leave it alone.
- Stalled: no commits or output for longer than expected. Nudge the agent or tell the user it has gone quiet.
- Dead: process gone or worktree missing. Mark it DEAD, record what it produced, and tell the user.
- Verify before closing an entry. Branch pushed, PR exists, checks green or their failures understood:
Record the PR URL and head commit in the ledger, set Status to DONE, and remove the worktree once merged.gh pr view <number> --json url,headRefOid,state gh pr checks <number> - Report with evidence. Every status line the user sees carries a link or hash.
Output
A status report, newest first:
| Task | Status | Evidence |
|---|---|---|
| fix-invoice-rounding | DONE, checks green | PR #212, a1b2c3d |
| upgrade-auth-lib | RUNNING, 2 commits | branch upgrade/auth-lib |
| export-pagination | DEAD (worktree gone) | no commits; respawn? |
Guardrails
- Never say "the agent is building it" without a session id in the ledger.
- Never say "done" without a PR URL or commit hash you have just checked.
- Never let a dead agent sit as RUNNING. Stale entries are how work silently disappears for weeks.
- Never point an agent at the user's live working copy or a production system; use a worktree or a fresh clone.
- Don't let an agent merge its own PR or push to the default branch unless the user explicitly allowed it.
- Keep secrets out of agent prompts and the ledger.
Handoff
Use promise-ledger for human-facing promises ("I'll tell you when CI is green"). For a batch of fixes from an audit, pair with review-to-prs; for PR bodies, pr-description.
Works well with
- Agent Task BriefBrief a subagent or coding agent like a peer, with goal, context, scope, definition of done, and how to report back.
- Promise LedgerA durable ledger of the agent's time-bound promises, so follow-ups survive restarts and never die silently.
- Review to PRsAudit a subsystem, file one issue per bug, then ship one small tested PR per fix that a reviewer can merge or revert on its own.
- PR DescriptionWrite a PR title and body from the real diff, covering what changed, why, how it was tested, the risks, and what the reviewer should look at first.