context-handover
Skill0 starsChanged 6 months agoMITView on GitHub
End-of-context-window session transition that saves memory, writes a handoff doc, posts a GitHub progress comment, and instructs the user to /compact for a clean next session. Use when context usage approaches 80%, when remaining tokens are insufficient for the current phase's remaining work, or when user says "handover", "context is full", "save progress", "end session". Distinct from /handoff (lightweight subagent briefing — no GitHub, no /compact).
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- harness-auditSkill
- harness-guideSkill
- harness-issuesSkill
- harness-prdSkill
- harness-triageSkill
- harness-verify-before-moveSkill
- session-startSkill
- setup-harness-skillsSkill
- fullerSkill
- skill-cleanupSkill
- write-harness-skillSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 43
Proactive: After each tool call, check token usage.
- Very specific: line 46
Do NOT invoke /compact programmatically.
- Very specific: line 53
Default to execute — note "phase inferred by default" in handoff doc
- Distinctive: line 58
If the active memory system has a Stop hook configured — it fires automatically on session end, no action needed.
- Very specific: line 60
If no memory system is detected — write key decisions into the decisions_made array of .continue-here.json (fallback).
- Very specific: line 71
All string values: factual, no padding.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Handover
Saves session state so the next session can resume without information loss.
State files
.harness/state.json — session lifecycle (read/write):
{
"version": "1.0",
"session": { "status": "idle", "started_at": "ISO 8601", "last_session": "ISO 8601" },
"position": { "phase": "01-discuss", "active_task": "...", "resume_file": "...", "stopped_at": "..." }
}.harness/phases/XX-name/.continue-here.json — resume context (write):
{
"version": "1.0",
"phase": "01-discuss",
"task": 1,
"total_tasks": 3,
"status": "in_progress",
"last_updated": "ISO 8601",
"current_state": "...",
"completed_work": ["..."],
"remaining_work": ["..."],
"decisions_made": ["..."],
"blockers": [],
"context": "...",
"next_action": "..."
}When to trigger
- Proactive: After each tool call, check token usage. If ≥70% used and remaining tokens are insufficient to complete Review + Compound for the current phase — trigger immediately.
- Safety net: ≥80% total usage — if proactive trigger was missed.
Do NOT invoke /compact programmatically. Instruct the user to type it.
Phase detection (priority order)
.harness/state.json→position.phase— use if present- Active GitHub issue labels →
phase:discuss / plan / execute / verify - Issue title/body keywords — "design"/"spec"/"ADR" → discuss; "PRD"/"story" → plan; "implement"/"build"/"fix" → execute; "test"/"QA" → verify
- Default to
execute— note "phase inferred by default" in handoff doc
Execution sequence
- 1. Invoke memory system — check
.claude/settings.jsonhooks first:- If the active memory system has a Stop hook configured — it fires automatically on session end, no action needed.
- Otherwise — call the memory system's update mechanism (e.g. mem0, or append to
MEMORY.md) manually. It is a black box — trigger the update and move on. - If no memory system is detected — write key decisions into the
decisions_madearray of.continue-here.json(fallback). - Budget: <5% of remaining context.
- 2. Write
.harness/state.json— atomic read → mutate → write:- Set
session.status: "idle" - Set
session.last_session: <current ISO timestamp> - Set
position.stopped_at: <one-line description of last action> - Set
position.resume_file: <path to .continue-here.json> - Budget: <1% of remaining context.
- Set
- 3. Write
.harness/phases/XX-name/.continue-here.json— derive XX-name fromposition.phase. Rules:- All string values: factual, no padding.
completed_workandremaining_workare arrays of strings. - Reference artifacts by path only — never inline content.
next_action: one concrete sentence starting with a verb.- Budget: <5% of remaining context.
- All string values: factual, no padding.
4. Post GitHub handover comment — only if
docs/agents/issue-tracker.mdexists AND active task has a GitHub issue number. Format:## Handover — YYYY-MM-DD HH:mm **Phase:** [current phase] **Session summary:** [1–3 sentences] **Next step:** [specific pick-up point] _[N] of ~[effort_estimate] context window(s) used so far (token budget: 1 = ~150K–200K)._ --- _🤖 Posted by `/context-handover` (AI-generated)_- 5. Output to user:
- "Handover complete. Resume file:
.harness/phases/XX-name/.continue-here.json." - "Start your next session with
/session-start." - "To compact this session now, type
/compact."
- "Handover complete. Resume file:
Graceful degradation
| Missing | Action |
No .harness/ directory | Note "run /setup-harness-skills first"; skip state write |
No state.json | Create it from inferred values; use phase fallback chain for position.phase |
No .continue-here.json path resolvable | Write to .harness/phases/XX-current/.continue-here.json using position.phase |
No docs/agents/ | Skip GitHub comment; still write .continue-here.json |
| No GitHub remote | Skip issue update silently |
| No memory system | Write key decisions in decisions_made array of .continue-here.json |
See phase-budgets.md for per-phase handoff content and session budget tables.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

