跳到正文
DEV Community· Sungsoo Youn·· 4 小時前AI 評分54

Claude Code 智能體的跳過規則一週後自行失效

My Agent's Skip Rule Switched Itself Off After a Week

AI 導讀

作者在每日運行的 Claude Code 智能體中發現,按最近 30 日曆日決定是否跳過無效連結的規則,會因跳過後不再產生日誌而失去證據,約一週後重新開啟連結。

正文

A field note from the autonomous Claude Code agent I run every day on one Windows PC. The numbers come from its own ledgers, not from memory.

Free to read first: a PDF sample of the book behind this setup — its first 3 chapters: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample

Every morning my agent runs a short job that opens a list of daily links and logs what each one returned: something earned, or invalid. Some of the links are not collected from a page. They are guessed from a date pattern in the address, so on a given day some of them do not exist.

The rule

On September 26 I added a rule to skip guessed links that never pay. For each address pattern, it looked at the last 30 days of logs. If the pattern had been opened on at least 14 of those days, had earned nothing, and had come back invalid on at least 80 percent of them, the job skipped it. Fewer than 14 days meant not enough evidence, so the job kept opening it.

Three patterns met the rule, and from September 27 they were skipped. Invalid results went from 3 to 5 a day before the rule to 0 or 1 a day after it. The invalid ones that remained came from a fourth pattern that still had an earning inside its window.

My experiment judge looked at September 27 to October 3 and wrote that the rule only removed wasted requests: 0.71 invalid a day against 4.00 before, with earnings no lower. I kept it.

What the logs showed

On October 11 I opened the logs for another reason and saw the three patterns in the October 10 run. Counting by day, two of them had come back on October 4 and the third on October 5. Apart from October 7, when the run stopped early for an unrelated reason, the guessed links came back invalid 3 or 4 times a day. Between October 4 and October 10 that was 21 times.

Why

I replayed the old rule one day at a time.

Skipping a pattern meant it produced no new log lines. Each day the 30-day window slid forward and dropped one more day on which the pattern had been opened. For two of the three, the count went from 20 on September 27 to 14 on October 3 and 13 on October 4. At 13, the rule said not enough evidence and opened them again. The third followed a day later.

Once they were reopened, the count stayed at 12 or 13. The window still held the week they were skipped, and my logs have days with no file at all. In the replay, the old rule did not skip them again on any day up to October 12.

The rule's own effect removed its evidence. With a fixed window and no new data, it was always going to undo itself. The only question was when.

The check that missed it

On October 10 an earlier cycle had been asked to confirm whether the fourth pattern was now being skipped. It ran the rule, got an empty set, and wrote that the fourth pattern was not skipped.

The empty set was the finding. Three patterns should have been in it.

The fix

The rule now looks at the last 20 days on which each pattern was actually opened, however far back those are. A skipped pattern's last 20 opened days stay the same, so skipping no longer wears the evidence down. 20 is how many opened days the old window held in practice.

If a pattern has not been opened for more than 30 days, the job opens it once to check. If it is still invalid, it is skipped again the next day. If it earns, it stays.

Replayed over the real logs, the three patterns are skipped on every day from September 25 to October 12. From October 11 the fourth is skipped too. Its last 20 opened days ran from September 10 to October 10, 16 of them invalid and none with an earning. Its last earning was September 8.

I wrote 5 new tests first, and 4 of them failed against the old code. 12 deliberate breakages of the code all made the tests fail, and the full suite ran 3,221 tests, all passing.

The rules

  • A rule that removes something also removes its own evidence. Before shipping it, replay it forward a few weeks with its own effect applied.
  • Choose evidence that stops when the thing stops. The last 20 times it ran stays still. The last 30 days does not.
  • Write the expected answer before running a check. An empty set where three items belong is the finding, not a pass.
  • A judge window can fall entirely inside the good part. One good week did not reach the day the rule wore out.

Where this comes from. Every post here comes from one setup I run daily: a CLAUDE.md, memory files the agent reads before it touches anything, and a separate auditor agent that returns PASS or FAIL. The first 3 chapters of the book that walks through it are free as a PDF: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample

The full edition is 11 chapters plus 4 ready-to-use templates (CLAUDE.md starter, memory files, auditor checklist, measurement guide) and a hands-on section for every chapter, $19 as a PDF: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code

Questions about the setup are welcome in the comments — I'll answer with what actually happened, not theory.

來源:DEV Community · dev.to