Session Handoff
Create a self-contained handoff for a new session. Preserve the active work, not the full conversation.
Choose The Slice
- If the user names a task, feature, bug, or workstream, hand off only that slice.
- Otherwise infer the currently active objective and its immediate dependencies.
- Include older context only when it changes a future decision, prevents a known failure, or explains current state.
- Exclude completed exploration, conversational repetition, abandoned approaches, and unrelated work.
- If two unrelated tasks are genuinely active, create separate handoff files rather than mixing them.
This is a handoff, not conversation compaction. The new session should receive a clean operating brief rather than a chronological transcript.
Verify Before Writing
Check current, inexpensive sources of truth when available:
- repository root, branch, HEAD, remote relationship, and working-tree status
- relevant worktrees and uncommitted changes
- tests, builds, deployments, or external environment state already established in the task
- exact files, errors, identifiers, URLs, and commands the next session will need
Label facts that were not reverified as historical or possibly stale. Never present remembered deployment, credential, or branch state as current without checking it when checking is practical.
Do not make unrelated changes merely to prepare the handoff. Do not commit or push unless the user separately requests it.
Write A Disposable Brief
Save the handoff as Markdown in the operating system's temporary directory by default. Use a descriptive filename containing the project or task and date, such as:
/tmp/<project>-<task>-handoff-YYYY-MM-DD.md
If /tmp is unavailable, use the platform's temporary directory. If the handoff must move to another computer, ask for or choose an explicitly transferable location; do not silently add the handoff to source control.
The brief should contain the sections that materially help the next session, normally:
- Objective - the concrete outcome still being pursued.
- Current state - what works, what is complete, and what remains unresolved.
- Confirmed evidence - exact errors, observations, decisions, and relevant source locations.
- Environment coordinates - repository/worktree paths, branches, commits, services, and URLs, clearly marked as time-sensitive where appropriate.
- Safety and scope boundaries - unrelated dirty files, forbidden artifacts, production cautions, authorization limits, and actions not yet approved.
- Immediate next action - the first useful thing the new session should do.
- Verification and done criteria - observable proof that the task is complete.
- Avoided paths - only known false fixes or repeated failures likely to waste the next session's time.
- Fresh-session prompt - a short instruction telling the new session to read the handoff completely, verify current state, and continue within scope.
Adapt the structure to the task. Do not add empty sections or force a large document for a small handoff.
Security And Privacy
- Never include passwords, API keys, OAuth tokens, cookies, private keys, service-role credentials, signing credentials, or contents of secret environment files.
- Record secret names or required setup steps only when needed.
- Do not copy sensitive production data into the brief. Use safe identifiers or descriptions sufficient to resume work.
- Treat browser authentication and external side effects as pending unless they were actually completed and verified.
Check The Artifact
After writing, read the file back and confirm:
- the next session can identify the task and first action without this conversation
- claims about current state are sourced or marked as possibly stale
- unrelated work is excluded
- no secrets or generated artifacts were captured
- the file is outside the repository unless the user explicitly requested a versioned handoff
Return To The User
Provide:
- a clickable absolute link to the handoff file
- a one- or two-sentence description of its scope
- the exact fresh-session prompt in a fenced text block
Use this default prompt, adjusted to the task and path:
Read <absolute-handoff-path> completely and continue from it. Verify current state before acting, preserve its scope and safety constraints, and continue until you need a decision or authorization from me.
Do not paste the entire handoff into chat unless the user asks. The file is the transport artifact.
1---2name: session-handoff3description: Prepare a focused, disposable Markdown brief when the user wants to move active work to a fresh Codex session without carrying the entire conversation forward.4---56# Session Handoff78Create a self-contained handoff for a new session. Preserve the active work, not the full conversation.910## Choose The Slice1112- If the user names a task, feature, bug, or workstream, hand off only that slice.13- Otherwise infer the currently active objective and its immediate dependencies.14- Include older context only when it changes a future decision, prevents a known failure, or explains current state.15- Exclude completed exploration, conversational repetition, abandoned approaches, and unrelated work.16- If two unrelated tasks are genuinely active, create separate handoff files rather than mixing them.1718This is a handoff, not conversation compaction. The new session should receive a clean operating brief rather than a chronological transcript.1920## Verify Before Writing2122Check current, inexpensive sources of truth when available:2324- repository root, branch, HEAD, remote relationship, and working-tree status25- relevant worktrees and uncommitted changes26- tests, builds, deployments, or external environment state already established in the task27- exact files, errors, identifiers, URLs, and commands the next session will need2829Label facts that were not reverified as historical or possibly stale. Never present remembered deployment, credential, or branch state as current without checking it when checking is practical.3031Do not make unrelated changes merely to prepare the handoff. Do not commit or push unless the user separately requests it.3233## Write A Disposable Brief3435Save the handoff as Markdown in the operating system's temporary directory by default. Use a descriptive filename containing the project or task and date, such as:3637```text38/tmp/<project>-<task>-handoff-YYYY-MM-DD.md39```4041If `/tmp` is unavailable, use the platform's temporary directory. If the handoff must move to another computer, ask for or choose an explicitly transferable location; do not silently add the handoff to source control.4243The brief should contain the sections that materially help the next session, normally:44451. **Objective** - the concrete outcome still being pursued.462. **Current state** - what works, what is complete, and what remains unresolved.473. **Confirmed evidence** - exact errors, observations, decisions, and relevant source locations.484. **Environment coordinates** - repository/worktree paths, branches, commits, services, and URLs, clearly marked as time-sensitive where appropriate.495. **Safety and scope boundaries** - unrelated dirty files, forbidden artifacts, production cautions, authorization limits, and actions not yet approved.506. **Immediate next action** - the first useful thing the new session should do.517. **Verification and done criteria** - observable proof that the task is complete.528. **Avoided paths** - only known false fixes or repeated failures likely to waste the next session's time.539. **Fresh-session prompt** - a short instruction telling the new session to read the handoff completely, verify current state, and continue within scope.5455Adapt the structure to the task. Do not add empty sections or force a large document for a small handoff.5657## Security And Privacy5859- Never include passwords, API keys, OAuth tokens, cookies, private keys, service-role credentials, signing credentials, or contents of secret environment files.60- Record secret *names* or required setup steps only when needed.61- Do not copy sensitive production data into the brief. Use safe identifiers or descriptions sufficient to resume work.62- Treat browser authentication and external side effects as pending unless they were actually completed and verified.6364## Check The Artifact6566After writing, read the file back and confirm:6768- the next session can identify the task and first action without this conversation69- claims about current state are sourced or marked as possibly stale70- unrelated work is excluded71- no secrets or generated artifacts were captured72- the file is outside the repository unless the user explicitly requested a versioned handoff7374## Return To The User7576Provide:7778- a clickable absolute link to the handoff file79- a one- or two-sentence description of its scope80- the exact fresh-session prompt in a fenced text block8182Use this default prompt, adjusted to the task and path:8384```text85Read <absolute-handoff-path> completely and continue from it. Verify current state before acting, preserve its scope and safety constraints, and continue until you need a decision or authorization from me.86```8788Do not paste the entire handoff into chat unless the user asks. The file is the transport artifact.