你已经取消的需求又回来了
A requirement you cancelled comes back
你在会话中途改了方向,旧的指令却在后面的代码或输出里又冒了出来。
适用于: Claude Code · Cursor · Codex · Copilot agent
症状
“算了,不要加缓存。”三步之后 diff 里出现了缓存层,或者总结里描述的还是旧方案。
为什么会这样
新旧两条指令都留在上下文里,长会话还会被压缩。如果没有明确记录哪条已作废,更早、更详细的那条可能胜出。agent-failure-modes 称之为 AFM-6 僵尸需求。
示例
示意。
textYou (turn 3): Add a Redis cache for /products.
You (turn 9): Drop the cache idea, the data must always be fresh.
Agent (turn 15): "Done. /products now reads through the Redis cache with a 60s TTL."
复制即用的修复
按你用的智能体挑选文件。规则片段用英文写,放进任何仓库都能用。
规则
Claude Code:加入 CLAUDE.md
CLAUDE.md## Track decisions explicitly
- Keep a short `DECISIONS.md` (or a "Decisions" section in the task file) during long tasks.
When the user changes direction, write `SUPERSEDED: <old instruction> -> <new instruction>`.
- Before the final summary, re-read that list and check the diff against the latest decisions only.
- If two instructions conflict and neither is marked superseded, ask.
规则
Codex、Copilot 编码智能体等:加入 AGENTS.md
AGENTS.md## Track decisions explicitly
- Keep a short `DECISIONS.md` (or a "Decisions" section in the task file) during long tasks.
When the user changes direction, write `SUPERSEDED: <old instruction> -> <new instruction>`.
- Before the final summary, re-read that list and check the diff against the latest decisions only.
- If two instructions conflict and neither is marked superseded, ask.
Cursor 规则
Cursor:项目规则
.cursor/rules/zombie-requirement.mdc---
description: "AgentFails: A requirement you cancelled comes back"
alwaysApply: true
---
## Track decisions explicitly
- Keep a short `DECISIONS.md` (or a "Decisions" section in the task file) during long tasks.
When the user changes direction, write `SUPERSEDED: <old instruction> -> <new instruction>`.
- Before the final summary, re-read that list and check the diff against the latest decisions only.
- If two instructions conflict and neither is marked superseded, ask.
技能
全新上下文的审查技能(子智能体只看 diff,不看聊天记录)
沿用 Anthropic 代码审查文章里的做法:先验证,再让一个上下文干净的子智能体审 diff。命名为 review-diff,避免和内置或流行的 /code-review 技能重名。
.claude/skills/review-diff/SKILL.md---
name: review-diff
description: Review the current diff with fresh context before a PR. Use after /verify passes.
---
# Review the diff
Start a subagent that has NOT seen this conversation. Give it only:
- the original request (one paragraph, verbatim),
- the output of `git diff origin/main...HEAD`,
- the names of the test/build commands.
Ask it to report, with file:line for each finding:
1. **Wrong feature**: does the diff do what the request asked? Quote the request line each change serves.
2. **Bugs**: logic errors, missing edge cases (empty, null, boundary), unhandled errors,
unawaited promises, invented APIs or packages, swallowed exceptions.
3. **Overreach**: changes no request line needs (refactors, renames, formatting, dependency or
config edits, public API changes, weakened tests).
4. **Evidence gaps**: claims in the PR description that no command output supports.
Then fix real findings, or list them under "Known issues" in the PR. Do not argue with the reviewer
in the PR text; either fix or explain in one line.