context-handoff
Scannednpx machina-cli add skill NorthShoreAutomation/trellis/context-handoff --openclawContext Handoff
Generate a handoff.md file that captures everything a fresh Claude Code session needs to resume the current work seamlessly.
Process
1. Gather objective state
Run these commands and capture their output for analysis:
# Branch and commit state
git branch --show-current
git log --oneline -10
git status --short
# What changed this session (staged + unstaged + untracked)
git diff --stat HEAD~5 2>/dev/null || git diff --stat
# Any stashed work
git stash list
Also note:
- Current working directory
- Any running background processes or servers relevant to the work
- Active beads issues if
bdis available (bd list --status=in_progress)
2. Synthesize from conversation memory
Reflect on the full conversation and extract:
- The goal: What the user asked for, in their words and in technical terms
- What's done: Completed work with enough detail to not re-do it
- What's in progress: Partially completed work and its current state
- What's left: Remaining work, ordered by priority
- Decisions made: Choices and their rationale — these are expensive to re-derive
- Dead ends: Approaches that were tried and abandoned, and why — prevents repeating mistakes
- Key discoveries: Non-obvious things learned during the session (quirks, undocumented behavior, surprising constraints)
- Active mental model: How the relevant code/system actually works, as understood through this session's work
3. Write handoff.md
Write to handoff.md in the project root using this structure:
# Context Handoff
<!-- Generated: {timestamp} | Branch: {branch} | Session: {brief-description} -->
## Goal
{What we're trying to accomplish. Start with the user's original request, then add
technical framing. A new session should read this and immediately understand the mission.}
## Status
### Completed
- {Thing done} — {file(s) touched}
- ...
### In Progress
- {Partially done thing} — {current state, what's left on it}
### Remaining
- [ ] {Next task, in priority order}
- [ ] ...
## Key Files
| File | Role | State |
|------|------|-------|
| {path} | {what it does in this context} | {modified/created/needs-work} |
## Decisions
| Decision | Rationale | Alternatives Considered |
|----------|-----------|------------------------|
| {chose X} | {why} | {Y, Z — why not} |
## Dead Ends
- **{Approach}**: {Why it failed or was abandoned. Be specific enough to prevent retry.}
## Discoveries
- {Non-obvious finding that would take time to rediscover}
## Git State
- **Branch**: {branch name}
- **Last commit**: {hash} {message}
- **Uncommitted changes**: {summary or "none"}
- **Beads**: {active issue IDs and titles, or "n/a"}
## Resume Instructions
{Concrete first steps for the next session. Not "continue working" — specific actions
like "Run the test suite to verify X still passes, then implement the Y function in Z file."}
4. Confirm with user
After writing, display:
- The file path
- A 2-3 line summary of what was captured
- Reminder: "Start your next session with:
/trellis:context-resume"
Guidelines
- Bias toward too much context over too little. A fresh session has zero memory. Anything omitted must be rediscovered from scratch.
- Be concrete, not abstract. "Modified the search query builder" is useless. "Added fuzzy matching to
buildQuery()insearch.service.ts:142using Levenshtein distance with threshold 2" is actionable. - Capture the why behind decisions. Code shows what was done. The handoff must preserve why — the reasoning that led to the current approach.
- Include failed approaches. A new session will naturally consider the same approaches. Documenting dead ends saves significant re-exploration time.
- Git state is not enough.
git diffshows what changed but not what it means, what's left, or what was learned. The handoff bridges that gap. - Omit sections that don't apply. If there are no dead ends or discoveries, drop those sections rather than writing "None."
Source
git clone https://github.com/NorthShoreAutomation/trellis/blob/main/skills/context-handoff/SKILL.mdView on GitHub Overview
context-handoff generates a handoff.md to ensure seamless session continuity in Claude Code. It captures the current Git state, environment details, and a synthesized summary of goals, work completed, and next steps so a new session can resume without re-explanation.
How This Skill Works
It collects the objective state by running the specified git commands, notes the current directory and any running background processes, and records active beads if available. It then synthesizes a memory-style summary including the goal, what's done, what's in progress, what's left, decisions made, dead ends, key discoveries, and the active mental model, and finally writes handoff.md at the project root with the structured sections from the Skill guide.
When to Use It
- When a Claude Code session is approaching context limits and you need to preserve state for later resumption.
- When you want to pause work and resume later without repeating setup or context.
- When switching between sessions on the same task to maintain continuity.
- When the user explicitly says handoff, context handoff, or save context.
- When handing off to a teammate or a new session to take over the task.
Quick Start
- Step 1: Trigger the handoff process by saying handoff or /trellis:context-handoff.
- Step 2: Confirm handoff.md is saved at the project root and review its contents.
- Step 3: In the next session, start by reading the Goal and Status sections to resume without re-explanation.
Best Practices
- Pause and generate handoff.md before large context changes or long gaps in work.
- Capture git state: branch, last 10 commits, status, and any diffs or unstaged changes; note stash entries.
- Record the current directory, any running background processes, and beads in_progress if bd is available.
- Synthesize clear sections: Goal, Completed, In Progress, Remaining, Decisions, Dead Ends, Discoveries, and Mental Model.
- Review and update handoff.md after changes; include concrete first steps for the next session.
Example Use Cases
- After finishing an initial feature draft, generate handoff.md so a new session can resume without re-explanation.
- Pausing for a meeting: create handoff.md to preserve context and pick up where you left off.
- Switching between related tasks in the same project: produce handoff.md to maintain cross-session continuity.
- User requests a handoff or save context to persist state across sessions.
- A new teammate inherits the task by reading handoff.md to understand current state and next steps.