AGENT SKILL

context-reset

Clean context reset protocol covering commit work, write handoff, update task card, and inform supervisor. Use when the context window is approaching its limit (system signals compression), when switching to a fundamentally different task domain, or when explicitly requested by the supervisor.

License 许可
MIT
所属仓库
muratovv/ai-hats
最近更新
2026-11-05
Stars
★ 3
Forks
1

01 前言 Front Matter

name
context-reset
ai_hats
{ "type": "skill", "schema_version": 1 }
license
MIT
description
Clean context reset protocol covering commit work, write handoff, update task card, and inform supervisor. Use when the context window is approaching its limit (system signals compression), when switching to a fundamentally different task domain, or when explicitly requested by the supervisor.

03 SKILL.md 正文

Context Reset

Protocol for cleanly resetting agent context when the context window fills up or a fresh start is needed.

When to Use

The full commit → handoff → card-update → clear protocol, triggered by context pressure or a domain switch — not by finishing a task. For end-of-task wrap-up where context is still healthy, use task-summary (the record) or just transition the card; you don't need a reset. The handoff-file step itself is context-handoff, which this protocol invokes — call that one directly if you want a handoff without clearing context.

Procedure

  1. Assess current state:

    • Is there uncommitted work? → commit or stash first
    • Is there an active task card? → note current state in work_log
    • Are there open files or running processes? → clean up
  2. Run context-handoff:

    • Execute context-handoff to write a handoff file
    • For general sessions: write to <ai_hats_dir>/sessions/handoffs/YYYY-MM-DD-<title>.md
    • For active tasks: rack transition <ID> --attach <file>:handoff.md — the tracker refuses a direct write (see context-handoff step 1)
  3. Update task card (if exists):

    • Remaining work is a coherent chunk → shape it per task-slicing, append as ## Steps checklist items in plan.md, run rack plan-extract <ID> (idempotent), wire order via rack transition <ID> --link depends:<DEP> — the tail becomes takeable successor tasks instead of a frozen card
    • Otherwise set state to blocked with reason: context-reset
    • Add handoff_file path to work_log
  4. Report to supervisor:

    • Print the handoff file path
    • Print brief summary: what was done, what remains
    • Suggest the command to resume (e.g., "continue task HATS-XXX using handoff at <path>")

Completion

  • All work committed or stashed
  • Handoff file written via context-handoff
  • Task card updated (if applicable)
  • Supervisor informed with resume instructions

Anti-Patterns

  • Resetting without saving context — the next agent starts blind
  • Leaving uncommitted changes — work is lost on context switch
  • Writing the handoff AFTER reset — too late, context is already gone

04 同仓库更多 Skills

muratovv
muratovv/ai-hats

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.

★ 3
muratovv
muratovv/ai-hats

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.

★ 3
muratovv
muratovv/ai-hats

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与智能体开发
★ 3
muratovv
muratovv/ai-hats

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.

Skill与智能体开发
★ 3
muratovv
muratovv/ai-hats

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.

★ 3
muratovv
muratovv/ai-hats

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.

Skill与智能体开发
★ 3