Respawn
Hand this session off to a fresh agent in the same window. Two moves: write a complete handoff to a stash file that the next session ingests automatically, and show it to the user for review. The user then runs /clear; a UserPromptSubmit hook injects the stash at the first prompt of the fresh session, with a visible confirmation (sessions that start with nobody typing, like app-relaunch warm sessions, cannot consume it, and ongoing conversations in other windows are skipped).
Step 1: Compose the handoff
Write it for an agent with zero context. Include, in this order:
- Task and goal: what this session is doing and why.
- State: what is already done, with evidence (files changed, commits, test results, decisions the user approved).
- Open items: what remains, in priority order, with enough detail to act on each.
- Next step: the single concrete action the new agent should take first.
- References: paths, URLs, ticket/PR numbers. Reference artifacts (plans, PRDs, commits, diffs) instead of duplicating their content.
- Suggested skills the next agent should invoke, if any.
Redact secrets (API keys, passwords, personal data). If the user passed arguments, treat them as what the next session will focus on and tailor the handoff accordingly.
Step 2: Prepend the resume preamble
The stash must open with instructions to the NEXT agent, above the handoff body:
You are resuming a session via /respawn. The previous agent in this window
wrote the handoff below, then the user cleared the context. If you are
reading this directly from ~/.claude/respawn-pending.md (manual fallback,
no automatic injection), first move that file to ~/.claude/respawn-last.md
so it cannot leak into an unrelated session. Open your first reply with
"Resumed from respawn." followed by one or two short paragraphs: what was
already done, and what remains open. Then continue the work; the handoff's
"Next step" is your starting point. Do not re-litigate decisions recorded
here.
Step 3: Stash, show, arm
- Write preamble + handoff to
~/.claude/respawn-pending.md (overwrite if present).
- Print the full handoff inline in the reply so the user can review it while this agent can still amend it.
- End the reply with exactly this instruction, bolded, as its own final paragraph so it cannot be missed: "Stash armed → run
/clear now. (Your first message in the cleared window resumes automatically. Don't prompt a different fresh session in between; the first fresh session you type into consumes the stash.)"
- If the user requests changes after reviewing, apply them, rewrite the stash file, reprint the full amended handoff, and end with the same closing instruction. The stash on disk must always match the last handoff shown; the version the user approved is the version the next agent gets.
Requirements and fallback
Automatic injection requires the UserPromptSubmit hook shipped with this skill (see README). If the hook is not installed, or this harness has no hook support (e.g. Codex), say so and fall back: keep the stash file, and replace the closing instruction from step 3 with: "Stash written → run /new now. Then open the fresh chat with: read ~/.claude/respawn-pending.md and continue." Never skip writing the stash; the inline copy disappears when the user resets the window.
1---2name: respawn3description: Use when the user invokes /respawn, or asks to hand this session off to a fresh one in the same window, reset context without losing state, or continue seamlessly after the context fills up.4---56# Respawn78Hand this session off to a fresh agent in the same window. Two moves: write a complete handoff to a stash file that the next session ingests automatically, and show it to the user for review. The user then runs `/clear`; a UserPromptSubmit hook injects the stash at the first prompt of the fresh session, with a visible confirmation (sessions that start with nobody typing, like app-relaunch warm sessions, cannot consume it, and ongoing conversations in other windows are skipped).910## Step 1: Compose the handoff1112Write it for an agent with zero context. Include, in this order:13141. **Task and goal**: what this session is doing and why.152. **State**: what is already done, with evidence (files changed, commits, test results, decisions the user approved).163. **Open items**: what remains, in priority order, with enough detail to act on each.174. **Next step**: the single concrete action the new agent should take first.185. **References**: paths, URLs, ticket/PR numbers. Reference artifacts (plans, PRDs, commits, diffs) instead of duplicating their content.196. **Suggested skills** the next agent should invoke, if any.2021Redact secrets (API keys, passwords, personal data). If the user passed arguments, treat them as what the next session will focus on and tailor the handoff accordingly.2223## Step 2: Prepend the resume preamble2425The stash must open with instructions to the NEXT agent, above the handoff body:2627```28You are resuming a session via /respawn. The previous agent in this window29wrote the handoff below, then the user cleared the context. If you are30reading this directly from ~/.claude/respawn-pending.md (manual fallback,31no automatic injection), first move that file to ~/.claude/respawn-last.md32so it cannot leak into an unrelated session. Open your first reply with33"Resumed from respawn." followed by one or two short paragraphs: what was34already done, and what remains open. Then continue the work; the handoff's35"Next step" is your starting point. Do not re-litigate decisions recorded36here.37```3839## Step 3: Stash, show, arm40411. Write preamble + handoff to `~/.claude/respawn-pending.md` (overwrite if present).422. Print the full handoff inline in the reply so the user can review it while this agent can still amend it.433. End the reply with exactly this instruction, bolded, as its own final paragraph so it cannot be missed: "**Stash armed → run `/clear` now.** (Your first message in the cleared window resumes automatically. Don't prompt a different fresh session in between; the first fresh session you type into consumes the stash.)"444. If the user requests changes after reviewing, apply them, rewrite the stash file, reprint the full amended handoff, and end with the same closing instruction. The stash on disk must always match the last handoff shown; the version the user approved is the version the next agent gets.4546## Requirements and fallback4748Automatic injection requires the UserPromptSubmit hook shipped with this skill (see README). If the hook is not installed, or this harness has no hook support (e.g. Codex), say so and fall back: keep the stash file, and replace the closing instruction from step 3 with: "**Stash written → run `/new` now.** Then open the fresh chat with: `read ~/.claude/respawn-pending.md and continue`." Never skip writing the stash; the inline copy disappears when the user resets the window.