context-handoff
Summarize critical context (decisions, forks, pitfalls) into a handoff file for the next agent. Use before a context reset (invoked by context-reset), when explicitly asked to save current context, or before delegating work to a sub-agent that needs background.
- License 许可
- MIT
- 所属仓库
- muratovv/ai-hats
- 最近更新
- 2026-11-05
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- context-handoff
- license
- MIT
- description
- Summarize critical context (decisions, forks, pitfalls) into a handoff file for the next agent. Use before a context reset (invoked by context-reset), when explicitly asked to save current context, or before delegating work to a sub-agent that needs background.
03 SKILL.md 正文
Context Handoff
Summarize critical context and write a handoff file for the next agent or session.
When to Use
Don't reach for this standalone during a full context reset — context-reset calls it as its handoff-writing step. Invoke directly only when you need a handoff without a reset: briefing a sub-agent you're about to delegate to, or an explicit "save where we are" with no intent to clear context. For the backward-looking "what was done" record of a finished task (not a forward brief), use task-summary instead.
Procedure
-
Identify the handoff path:
- Session-scoped:
<ai_hats_dir>/sessions/handoffs/YYYY-MM-DD-<title>.md - Task-scoped: write it OUTSIDE the tracker (
/tmp/<ID>-handoff.md), then bring it in withrack transition <ID> --attach /tmp/<ID>-handoff.md:handoff.md. A direct write undertracker/backlog/tasks/<ID>/is denied bybacklog_write_gate.py—plan.mdis the one carve-out.
- Session-scoped:
-
Collect only what matters. Ignore routine actions. Focus on:
- Architectural decisions — what was chosen and WHY (not just what)
- Decision forks — alternatives considered, why rejected
- Pitfalls & gotchas — traps the next agent will hit without warning
- Current state — what is done, what is in progress, what is blocked
- Open questions — unresolved ambiguities that need supervisor input
-
Write the handoff file using the format below.
-
Verify the file is written and readable.
Format
# Handoff: <task or session title>
Date: YYYY-MM-DD
Previous agent context: <brief identifier>
## Current State
<What is done. What is in progress. What is blocked.>
## Key Decisions
| Decision | Alternatives Considered | Why This Way |
| -------- | ----------------------- | ------------ |
| ... | ... | ... |
## Pitfalls
- <Trap 1> — <why it's dangerous>
- <Trap 2> — <why it's dangerous>
## Open Questions
- <Question that needs supervisor or further research>
## Next Steps
1. <Concrete next action>
2. ...
What NOT to Include
- Play-by-play of every command run
- Routine git operations or file reads
- Information derivable from code or git history
- Full error logs (reference the file path instead)
Completion
- Handoff file written to the correct path
- File contains at least: Current State, Key Decisions, Next Steps
- No routine noise — only decision-critical context
Anti-Patterns
- Dumping full conversation history — the point is compression, not transcription
- Omitting the WHY behind decisions — facts without reasoning are useless for handoff
- Including information the next agent can get from
git logor reading code
04 同仓库更多 Skills
tool-evaluation-protocol
Time-bounded protocol for evaluating new tools, libraries, or methodologies before adoption. Use when evaluating a candidate dependency for the project, researching a methodology (e.g. ML/LLM frameworks, testing approaches), or following up on a hype-driven recommendation.
systematic-debugging
4-phase bug-fix protocol (evidence, pattern, hypothesis, verify). Use when investigating any error, failure, or unexpected behavior, handling bug reports from users or monitoring, or diagnosing test failures with non-obvious causes.
skill-template
Canonical template and validation guide for ai-hats skills. Use when creating a new skill, reviewing an existing one for structural compliance, or deciding which pattern fits a new behavior.
skill-optimization
Audit and refactor library components to eliminate redundancy and staleness. Use during periodic library maintenance, after adding multiple new skills or rules, when a role's token budget is too high, or after retrospectives identify component issues.
silent-fallback-gate
PreToolUse hook — refuses an Edit or Write that adds an inert broad except. Use when a Python edit was blocked for a silent fallback.
retro-to-framework
Convert an observation about agent behavior — from a retrospective or from a single incident — into a framework-level change (hook, rule, skill, skill update). Use after a retrospective identifies problems that are not project-specific, after an incident where an agent misapplied a component it had read, when CLAUDE.md band-aids accumulate (more than 3 per-project rules that could be generic), or when the same problem recurs across multiple projects.