计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
anti-drift【效率与协作】Use when starting a long-running session, before claiming task completion, or every several major tool calls to prevent AI drift from initial instructions. Defines drift mechanisms (context rot, lost-in-the-middle, persona collapse, instruction budget), symptoms to watch for, and protocols for periodic checkpointing, state externalization, metacognit…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
A discipline skill for preventing instruction drift in long-running Claude sessions.
LLMs drift. As of April 2026, this is no longer speculative: every frontier model tested by independent benchmarks (Chroma's 18-model context rot study, the "Drift No More" KL divergence paper, the multi-agent reliability cascade research) shows measurable degradation as context grows. The mechanisms are now well-documented:
Reference: references/drift-mechanisms.md for citations and detailed research.
| Trigger | Action |
|---|---|
| Session starts (any agent) | Read drift-symptoms.md briefly to prime detection |
| Every 50 tool calls | Re-read hard-rules-checklist.md + run quick symptom check |
| Before spawning a sub-agent | Read checkpoint-protocols.md, run pre-spawn checklist |
| Before claiming task complete | Run full metacognitive audit (audit-protocol.md) |
| When you notice you're proposing the same fix twice | Drift symptom — externalize state and start fresh |
| When user gives feedback that contradicts your recent action | Drift symptom — re-read task brief |
| When responses feel "generic" or hedge-heavy | Drift symptom — persona collapse warning |
check-drift — quick symptom scanTrigger phrases: "drift check", "am I drifting", "anti drift check"
~/.claude/skills/_meta/hard-rules-checklist.mdreferences/drift-symptoms.mdcheckpoint — mid-session re-anchoringTrigger phrases: "checkpoint rules", "re-anchor", "checkpoint"
~/.claude/skills/_meta/hard-rules-checklist.md relevant sectionexternalize-state — write session state to diskTrigger phrases: "externalize state", "save state", "checkpoint state"
.session-state.md in the project root with:
metacognitive-audit — self-check before claiming completeTrigger phrases: "audit", "metacognitive audit", "verify before complete"
This is the most important operation. Follow the protocol in references/anti-drift-patterns.md:
inject-recency-anchor — when invoking a sub-agentTrigger phrases: "anchor sub-agent", "spawn with anchor", "anti-drift wrap"
When you're about to spawn a sub-agent (forge spawning bob, bob spawning specialists, etc.), ensure the most critical constraints appear at the END of the spawn prompt, not just the beginning. The structure:
[Long task brief at the top — context, design doc, file paths, approach]
[...]
CRITICAL REMINDERS (re-read before each action):
- NEVER do X
- MUST verify Y
- ALWAYS write evidence to Z
The end-of-prompt placement is structurally important. Don't bury critical rules in the middle of a 2000-token brief — they get lost.
For full anti-drift coverage, the skill alone is insufficient (you might forget to invoke it). Use these complementary mechanisms:
Add this section to ~/.claude/CLAUDE.md:
## Anti-drift discipline
Read `~/.claude/skills/_meta/hard-rules-checklist.md` at the start of every session
and again at every decision checkpoint. After 50+ tool calls in a session, re-read it
explicitly before:
- Spawning any sub-agent
- Claiming any task complete
- Making any destructive change (rm, force push, drop table, deploy)
If you notice any of these symptoms, invoke the `anti-drift` skill immediately:
- Proposing the same fix twice in different forms
- Hedging heavily ("I think", "perhaps", "this should")
- Forgetting which sub-task you're on
- Claiming completion without verifiable evidence
In ~/.claude/settings.json, add a PreToolUse hook that injects a recency anchor every N tool calls:
{
"hooks": {
"PreToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "if [ $(($(date +%s) % 50)) -eq 0 ]; then cat ~/.claude/skills/_meta/hard-rules-checklist.md | head -20; fi"
}
]
}
]
}
}
(This is a simplified example. The hook system supports more sophisticated triggers — see update-config skill for details.)
Skills that orchestrate long workflows (forge, bob, alf) should add an explicit anti-drift check at decision points. For example, in forge:
### Step 4b: Anti-drift check (NEW)
Before spawning the design exploration team:
1. Invoke `anti-drift` skill, operation `check-drift`
2. If drift signals detected, run `checkpoint` first
3. Only proceed once focus is verified
| Anti-pattern | Why it fails | Correct approach |
|---|---|---|
| Long bullet lists of "MUST" rules at top of CLAUDE.md | Density-induced collapse — model loses track | Compact rules, recency-anchored at end |
| "ALWAYS verify before claiming complete" | Positive framing decays in long context | "NEVER claim complete without tangible evidence" |
| Trusting your own context recall after 50+ tool calls | Context rot is empirically proven | Externalize to .session-state.md, re-read |
| Skipping the metacognitive audit because "this is obviously done" | Drift happens exactly when you're confident | Audit always — the "obvious" cases are when you're most likely wrong |
| Long monolithic CLAUDE.md with reference docs mixed in | Instruction density degrades attention | Split: rules at top, reference content via @import |
| Relying on the skill alone | The skill itself is forgettable when drifted | Pair with hooks + CLAUDE.md baseline |
| "Just this once" exceptions to hard rules | Ambiguity seeds drift | No exceptions. If a rule needs an exception, fix the rule. |
references/drift-mechanisms.md — research-backed mechanisms (context rot, LITM, persona collapse, instruction budget, compounding error)references/drift-symptoms.md — catalog of symptoms with examplesreferences/anti-drift-patterns.md — techniques that work (with citations)references/checkpoint-protocols.md — when and how to checkpointreferences/2026-research.md — current research citations (April 2026)references/integration-recipes.md — how to wire CLAUDE.md, hooks, and skill-to-skill integrationtemplates/state.md.template — externalized session state templatetemplates/checkpoint-prompt.md — mid-session re-anchor templatetemplates/hard-rules-injection.md — end-of-prompt recency anchor template~/.claude/skills/_meta/hard-rules-checklist.md — the structural anchor this skill builds on~/.claude/skills/development-lifecycle/ — TDD + verification gate enforcement~/.claude/skills/forge/SKILL.md — references this skill at design checkpoints~/.claude/skills/bob.md (agent) — references this skill before claiming complete~/.claude/skills/alf.md (agent) — references this skill in evolution sweeps