跪拜 Guibai
← All articles
AI Programming

Requirements Entropy, Not Token Count, Is the Real AI Coding Cost

By libokaifa ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Teams that skip requirement disambiguation will face agents generating plausible but wrong code, burning tokens and debugging cycles. The discipline of writing explicit, testable specifications becomes the competitive advantage in AI-driven development.

Summary

When an AI agent is given a twenty-page PRD and asked to break it into tasks, the result looks plausible but runs off the rails. The cause is not lack of capability but requirement entropy: every unstated assumption makes the model guess a probability distribution, and plausible guesses are worse than no answer. The article quantifies this with Shannon entropy and maps it to Cynefin's four domains, arguing that the goal of documentation is to lower the conditional entropy on the receiving side.

The core shift is from a reader-side to an author-side responsibility. Traditional PRDs rely on shared context among teammates; an AI has none. So every ambiguous phrase like "handle it per the old logic" or "exceptional cases are covered" must be chased down. The article proposes a decomposition pipeline: flag ambiguous spots, extract entities/states/rules/actions, query black boxes, align with existing code, and produce one task per testable rule. It also recommends using memory files (CLAUDE.md) as routing maps rather than encyclopedias, with explicit prohibitions on dependencies and keystone zones.

Takeaways
— Shannon entropy H(X) is 0 when an outcome is certain and reaches its maximum log₂n when all n outcomes are equally likely; requirement ambiguity raises this entropy for LLM reception.
— Cynefin's four domains correspond to entropy levels: chaos has the highest, simple the lowest; the goal is to move requirements from complex/chaotic to simple/complicated before handing them to AI.
— Tacit knowledge, such as the feel of a basketball shot or which API is more suitable in a specific scenario, cannot be transferred through docs; it requires feedback loops like review and agent-based testing.
— AI documentation must be authored for a reader with no shared context: every implicit assumption must be made explicit, shifting the cost of entropy reduction from the reader side to the writer side.
— The requirement decomposition pipeline: flag ambiguous phrases, extract entities/states/rules/actions, query black boxes, align with existing code, and produce one task per testable rule with an assertion.
— Memory files like CLAUDE.md should be routing maps: directory tree, one-line module responsibilities, dependency prohibitions, and commands. They should not be encyclopedic descriptions.
— Explicit prohibitions are more effective than permissions because crossing boundaries produces compile-time errors, so agents respect 'don't touch' rules better than 'you may' rules.
— A task can be anchored by module, entry file, diffusion radius, and frozen zones; a task card with exact paths and forbidden directories contains the precision of a mini architecture spec.
Conclusions

The article reframes an LLM's core value as de-conditioning: reducing the receiver's uncertainty rather than accelerating code generation. That inversion shifts the developer's skill set from syntax to specification.

The suggestion to use agent-based testing (performance/exception agents) as a way to encode tacit knowledge is a pragmatic move, but it assumes those agents themselves don't inherit the same tacit gaps, so human review on top remains necessary.

Placing the cost of entropy reduction on the writer side works for formalizable rules, but deceptive cases like chaotic incidents require constant human intervention; the claim that LLM can 'open black boxes' is optimistic until shown otherwise.

Concepts & terms
Shannon entropy
A measure of uncertainty in a set of outcomes, H(X) = -∑ p(x) log₂ p(x). For requirements, high entropy means many possible interpretations; low entropy means the meaning is deterministic.
Cynefin framework
A model that categorizes problems into four domains (Simple, Complicated, Complex, Chaotic) based on cause-effect clarity and uncertainty. It guides whether to categorize, analyze, probe, or act first.
Tacit knowledge
Knowledge that is difficult to write down because it is acquired through personal experience, such as the feel of a basketball shot or judging which internal API behaves better in a specific scenario. It cannot be fully transferred through docs or tutorials.
Chain of Thought (CoT)
A reasoning method that makes an LLM solve a problem step-by-step in a logical sequence, instead of trying to jump to the answer. It is suited for Complicated-domain tasks where knowledge exists but needs structured decomposition.
Memory file (CLAUDE.md/AGENTS.md)
A markdown file that guides an AI agent to the correct modules and constraints. It should act as a routing map (directory tree, responsibilities, commands, prohibitions) rather than an encyclopedia of the codebase.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗