"Understanding AI hinges on understanding its statelessness. Your codebase should shed all procedural and historical baggage so that any reader—every AI session—needs zero historical context to operate."
Extended reading: How the test system provides a safety net for uncertainty in a stateless world, see Test–Code Loop: Why Test Code Is More Important Than Functional Code.
1. Understanding AI Statelessness
Understanding AI hinges on understanding its statelessness. Your codebase should shed all procedural and historical baggage so that any reader—every AI session—needs zero historical context to operate.
If an AI's context and capabilities have an upper bound for a single work session, we need to let AIs work in relay on the same problem. A better approach is:
- Have the previous AI session write all the context it has acquired into a document
- Start a new AI session and have it read that document, then continue working from there
Codebases cannot contain large amounts of documentation. We once tried a workflow:
- For each new requirement, have AI write a PRD first
- Then have it write a TDD technical document based on the PRD
- Then have it write an execution record based on the technical document
- Then write code based on the execution record
- When code is half-written, come back and update that execution record
We used this approach for over a dozen requirements, but eventually couldn't bear it anymore. The reason was that the documentation it produced was simply too much—human brains couldn't read through it all. If human brains can't read through it, imagine what happens to your codebase: you lose control, you don't know what AI will fill in, and you have no way to evaluate or review AI's work. It will inevitably collapse very quickly.
2. Code as Documentation: Why We Should Abandon Historical Information
Codebases cannot have too much documentation, because a good goal that everyone pursues is "code as documentation."
If your code is written well enough—which is actually achievable with today's AI capabilities—it can do well in naming and structural organization.
In this case, you don't need to repeat and convey the same information. Because doing so will occupy its context space, and when you occupy AI's context window, AI becomes dumber.
Documentation cannot always stay in sync with code. Especially in today's high-productivity environment with AI assistance, you can't even finish reading all the new code AI has changed each day, let alone keep documentation and code in sync.
As long as code and documentation are out of sync, every AI session will receive two contradictory pieces of information:
"As soon as AI receives contradictory information, it becomes dumber, because it doesn't know which one is correct. It will naturally assume everything you tell it is true. It will think A is correct and B is correct, but only one is correct. Once it falls into this confusion, it becomes dumber."
