Claude Said "Done as Instructed" but Wasn't Following Me. It Was Following Old Specs It Had Saved in Its Own Memory and Rules

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Claude Said “Done as Instructed” but Wasn’t Following Me. It Was Following Old Specs It Had Saved in Its Own Memory and Rules

本文是发表在 Zenn 上的日语文章的英文版本。简介:如果你长期使用 Claude Code,你可能会开始觉得“它不像以前那样理解我了”或者“它捕捉我意图的能力突然变差了”。Claude 说“我已按指示完成”,但产出的结果却并未遵循指示。这种情况也发生在我身上。我第一次注意到是在 2026 年 9 月。Claude 一直试图使用一个我已经从产品中移除的流程。当时,我问了 Claude 类似这样的话(措辞略有调整):这个功能已经停用了,为什么它还在?是不是内存里残留了什么旧东西?原因是自动内存中悄悄保留的一条旧笔记。我清理了内存,以为问题解决了。但到了 10 月,当 Claude 在修复我自己开发的开发工具的分析屏幕时,同样的事情再次发生。每次它修复什么,屏幕就会变回我认为已经修复的旧形式。修复了一个部分,另一个部分又被重构,只有我的 Token 被消耗了。

Around then, I told it this: I’ve asked many times, but I want it at the same granularity as the graph. How do I say this so it gets through? I asked it to change only the text, and the whole screen got rebuilt. When I asked about a different part, the text changed instead. I no longer understood what was going on. This time it was not memory. An old spec had quietly been written into an instruction file that is read every time: a rule (files in .claude/rules/). In my setup, the Claude I talk to (below, “the main agent”) splits up the work, and the actual edits are done by other AIs it hands the work to (below, “subagents”).

那时,我告诉它:我已经问过很多次了,但我希望它的粒度与图表相同。我该怎么说它才能听进去?我要求它只修改文本,结果整个屏幕都被重构了。当我询问另一个部分时,文本反而变了。我不再明白发生了什么。这一次不是内存的问题。一个旧的规范被悄悄写入了一个每次都会被读取的指令文件中:一条规则(.claude/rules/ 中的文件)。在我的设置中,我与之对话的 Claude(以下简称“主代理”)会拆分工作,而实际的编辑工作由它分派给其他 AI(以下简称“子代理”)来完成。

Afterwards, I went back through the work logs from that time, built a similar situation on a small screen, and ran it 155 times on the current Claude. Even when an old spec stayed in memory or a rule, the current Claude followed the correction whenever the new correction came into view. Out of 155 runs, the number of runs that read the correction and still went back to the old form was 0. In 19 of 20 runs, Claude itself rewrote the memory holding the old spec to match the current spec. The only runs that went back were the ones where the correction was out of reach. In this article I describe what actually happened, the results of the reproduction experiment, and the structure I changed afterwards.

事后,我回顾了当时的工作日志,在一个小屏幕上构建了类似的情况,并在当前的 Claude 上运行了 155 次。即使旧规范保留在内存或规则中,只要新的修正出现在视野中,当前的 Claude 都会遵循该修正。在 155 次运行中,读取了修正却仍回到旧形式的次数为 0。在 20 次运行中有 19 次,Claude 自己重写了保存旧规范的内存以匹配当前规范。唯一回到旧形式的运行是那些修正无法触及的情况。在本文中,我将描述实际发生的事情、复现实验的结果以及我随后更改的结构。

What actually happened 1. A retired path kept coming back from old memory (September) When I asked an external AI for a review, I used to put a relay mechanism in between. On September 12 I retired this relay path from the product, but the main agent kept using it after that. The cause was a note in auto memory dated September 4: “Use this path by default for external reviews.” There was a document recording the retirement, but it covered the product’s feature. It did not touch the path the main agent used when asking for reviews. The main agent treated the memory as the truth. Looking back now, I remember asking for it to be removed again and again, and it still stayed (the number of times it came back is not in the records).

实际发生的事情 1. 一个已停用的路径不断从旧内存中恢复(9 月)。当我请求外部 AI 进行审查时,我过去常在中间放置一个中继机制。9 月 12 日,我从产品中停用了这个中继路径,但主代理在此之后一直使用它。原因是 9 月 4 日自动内存中的一条笔记:“默认使用此路径进行外部审查。”有一份记录了停用的文档,但它涵盖的是产品功能。它没有触及主代理在请求审查时使用的路径。主代理将该内存视为真理。现在回想起来,我记得曾一次又一次地要求将其删除,但它仍然存在(它恢复的次数没有记录在案)。

  1. A one-off exception was written to memory as a permanent policy (late September) In late September, a check that stops contradictions between documents was too strict and was blocking even valid writes. What I meant was: redesign it, drop it if it isn’t needed, keep it if it is. With that in mind, I removed the check for the time being. But the main agent wrote this down as a permanent policy: “Don’t add mechanisms that find contradictions.” It wrote it in both the decision log (a file where decisions are collected) and auto memory. Later conversations treated this policy as the truth. On the same day, September 29, I cleaned up memory. I cut the notes from 26 files and 590 lines to 19 files and 269 lines. I thought that settled it.

  2. 一个一次性的例外被作为永久策略写入内存(9 月下旬)。9 月下旬,一个阻止文档间矛盾的检查过于严格,甚至阻碍了有效的写入。我的意思是:重新设计它,如果不需要就放弃,如果需要就保留。考虑到这一点,我暂时移除了该检查。但主代理将其写为一项永久策略:“不要添加发现矛盾的机制。”它将其写入了决策日志(收集决策的文件)和自动内存中。随后的对话将此策略视为真理。同一天,即 9 月 29 日,我清理了内存。我将笔记从 26 个文件 590 行缩减到 19 个文件 269 行。我以为这解决了问题。

  3. I thought I had cleaned up memory, but it was in a rule too (October) When I cleaned up memory, I also remember asking whether anything similar was left elsewhere. Even so, next it came out of a rule. When you are looking for “old notes in memory,” copies that went into some other place don’t come into view. This is the October analysis-screen case. The correction I had given many times, “list the rows of the analysis screen in the same units as the graph screen,” was written in the decision log. Meanwhile, the instruction file loaded every time (a rule in .claude/rules/) still held an old copy of the screen spec. According to the records, the subagent fixing the screen read this rule as the correct spec every time and put the screen back into the old form. Whether it followed the decision log or the rule, the result would conflict with one of them. It was the main agent’s own instructions that had put that copy into the rule.

  4. 我以为我已经清理了内存,但它也存在于规则中(10 月)。当我清理内存时,我也记得问过是否还有类似的东西留在其他地方。即便如此,接下来它还是从规则中冒了出来。当你寻找“内存中的旧笔记”时,进入其他地方的副本是不会出现在视野中的。这就是 10 月份分析屏幕的案例。我多次给出的修正,“以与图表屏幕相同的单位列出分析屏幕的行”,被写在了决策日志中。与此同时,每次加载的指令文件(.claude/rules/ 中的规则)仍然保留着屏幕规范的旧副本。根据记录,修复屏幕的子代理每次都将此规则读取为正确规范,并将屏幕改回了旧形式。无论它遵循决策日志还是规则,结果都会与其中之一冲突。正是主代理自己的指令将该副本放入了规则中。

Back then, the main agent looked back and said “I had been giving the same wrong instruction myself.” It admitted that the instruction it had just given the subagent was to rewrite the rule to the new spec. CLAUDE.md had this rule: “When the user decides something, rewrite the rule and spec files it binds in the same change.” The aim was: “When I decide something, also fix the rule and spec files related to that decision at the same time.” It existed to prevent a state where the decision lives only in the log and the rule read every time stays old. But according to the main agent’s explanation, it read this as “write the spec into the rule” and told the subagent to do so. A rule meant to stop copies was misread and created more copies. The main agent gave detailed instructions. Even so, it wrote, the subagent treated the old text left in the repository as the truth over the instructions it was given.

当时,主代理回顾并说:“我自己一直在给出同样的错误指令。”它承认它刚刚给子代理的指令是重写规则以符合新规范。CLAUDE.md 有这样一条规则:“当用户决定某事时,在同一次更改中重写它所绑定的规则和规范文件。”目的是:“当我决定某事时,同时修复与该决定相关的规则和规范文件。”它的存在是为了防止决策仅存在于日志中而每次读取的规则保持旧状态的情况。但根据主代理的解释,它将其解读为“将规范写入规则”,并告诉子代理这样做。一条旨在阻止副本的规则被误读,反而创造了更多副本。主代理给出了详细的指令。即便如此,它写道,子代理还是将存储库中留下的旧文本视为真理,而不是它所给出的指令。

  1. There was no “correct side” to go back to The decision log, the rules, and auto memory were all written by the AI. And they contradicted each other. Clean up memory, and the same thing enters a rule. It was past the stage where stopp

  2. 没有可以回溯的“正确方”。决策日志、规则和自动内存都是由 AI 编写的。而且它们相互矛盾。清理了内存,同样的东西又进入了规则。这已经过了停止的阶段。