Karpathy CLAUDE.md Grows to Ten Rules: New Self-Check Protocol for AI Coding Loops - Tech Times
Techtimes
### Four Rules You Already Know The first four rules in the circulating document cover the same territory as the community file, and for good reason: they address the most common and expensive LLM coding failure modes. Think Before Coding requires the agent to state assumptions explicitly, surface ambiguity, and ask rather than guess before writing a line. Simplicity First limits output to the minimum code that solves the stated problem — no speculative abstractions, no unrequested features. Surgical Changes prohibits editing code adjacent to the task; every changed line must trace directly to what was asked. Goal-Driven Execution converts vague instructions into verifiable success criteria before work begins: "add authentication" is rewritten as five specific, checkable outcomes. [...] Token costs in autonomous agent loops compound significantly faster than in interactive sessions. Each tool call an agent makes — reading a file, running a test, editing code — re-sends the full conversation history to the LLM API, which is stateless. Research shows that agentic tasks use roughly four times more tokens than standard chat; multi-agent systems can reach fifteen times the cost. In documented cases, unguarded loops have generated thousands of dollars in API costs overnight. The practical fix — which the ten-rule document supports through its emphasis on verification and named stop conditions — is to define precise completion criteria before a loop starts and to set hard token budget limits outside the model's control. [...] Abstraction, Optimistic Path, Runaway Refactor — give the agent a vocabulary for recognizing when it is about to compound a mistake rather than correct one.
阅读原文