Separating Planning from Execution: A New Paradigm for AI Coding in the Era of Large Language Models
A practical engineering approach to AI-assisted coding that separates planning from execution: how to structure design documents, constrain execution models, control token budgets, and validate output quality when different models handle architecture design and code generation.
1. What We’re Observing: Two Signals from Generative Development
Debate over whether large language models can build complex software on their own has heated up recently. One line of examples drops a model directly into the requirements for a large interactive application and asks it to build a runnable graphical prototype from scratch; the other has the model carry out a large number of fine-grained drawing instructions until it renders a scene image that is hard to tell apart from a real one. The former can burn external training costs in the hundreds of dollars; the latter demonstrates the model’s patience and consistency across long instruction sequences.
Looking at these two cases side by side yields two valuable observations.
The first signal is that the ceiling on model capability is being redefined. Models are no longer just code-completion tools that “write a few functions”; they can take on architecture design, module decomposition, interface definition, and even iteration planning. When planning quality is high enough, the demands placed on the model during the execution phase actually drop.
The second signal is that the cost structure is shifting. What really eats the budget is not lines of code but “wasted context plus repeated trial and error.” Implementing a large interactive application, even in simplified form, can consume an entire common monthly subscription allowance, while a “photorealistic” drawing result is often the product of hundreds of thousands of instruction calls accumulated over time. Together, these points show that without task layering, the budget gets consumed by pointless back-and-forth.
This article is not about the performance of any specific tool. It addresses a more universal engineering question: when planning capability and execution capability come from different models, how do you organize a collaboration workflow that controls costs while still delivering usable results?
2. The Core Idea: Separate “Thinking It Through” from “Writing It Out”
Traditionally we ask a model to do everything in one pass — understand requirements, design a solution, write code, and self-check and fix. This works for small scripts, but on systems with a certain level of complexity it quickly exposes three problems:
- Wasted context window: the reasoning, trial and error, and failure logs from the design phase crowd out the space needed for subsequent coding;
- Error propagation: an incorrect interface decision made early on gets amplified across dozens of later calls, eventually requiring a full rollback;
- Unpredictable cost: there is no upper bound on retry attempts, so budget consumption is out of proportion to output.
The idea behind separating planning from execution is to cut this coupling:
Requirements description↓[Planning model] produces a structured design document (local file)↓[Execution model] implements in chunks based on the document + self-tests↓[Verification] runs, checks against the document, and writes back deviations
The planning output must be saved to disk as a local document, not left in the conversation history. This step looks trivial, but it is actually the key to the whole pattern, for three reasons:
- Reusability: the same design document can drive multiple rounds of implementation across multiple models and branches, with no need to re-derive anything;
- Auditability: when requirements change, you only edit the relevant section of the document, and the implementation side updates incrementally against the diff;
- Trimability: each execution round only loads the sections relevant to its task, avoiding repeated injection of the entire context.
3. What a Planning Document Should Look Like
Whether the separation pattern holds depends on the information density and actionability of the planning document. A document that can genuinely drive implementation should contain at least the following parts.
3.1 Functional Scope and Non-Goals
First, define “what to build” and “explicitly what not to build.” For example, if the goal is to recreate the interaction prototype of a spreadsheet application, the non-goals should state clearly: no cross-document collaboration, no macro system, no full coverage of the function library, no pursuit of large-scale data performance. The more specific the non-goals, the less the execution model drifts.
3.2 Data Model and Core State
This is the part of the document where ambiguity is least tolerable. Use pseudo-structures to pin down field semantics, types, constraints, and default values all at once:
Sheet {id: string # globally uniquename: string # tab name, unique within the documentrows: intcols: int}Cell {sheetId: stringrow: int # 0-basedcol: int # 0-basedraw: string # user's original inputformula: string|null # parsed when starting with '='value: scalar|null # cached computed valuestyleId: string|null}Style {bold: boolalign: "left"|"center"|"right"numberFormat: "text"|"number"|"percent"|"currency"}
Once the data model stabilizes, UI rendering, formula evaluation, and undo/redo can all be built around the same state, reducing the “fix one thing, break three others” situation.
3.3 Module Decomposition and Interface Definitions
Cut the system into modules with single responsibilities and explicitly define inputs and outputs. For a spreadsheet-type application, a reasonable split is:
| Module | Responsibility | Key Interface |
|---|---|---|
| Syntax parser | Convert formula strings to an abstract syntax tree | parse(text) -> Node |
| Dependency graph | Compute reference relationships between cells | buildGraph(cells) -> DAG |
| Evaluation engine | Topological ordering and cycle detection | evaluate(node, ctx) -> scalar |
| View layer | Render the grid and editing state | render(state, viewport) |
| Command layer | Edit operations and the undo stack | apply(cmd) / undo() |
When interface definitions go down to the granularity of “function name + parameters + return value + exception conditions,” the execution model can implement with almost no ambiguity.
3.4 Iteration Order and Acceptance Criteria
The document must end with verifiable milestones, each of which can run and be accepted independently:
- Render an empty grid with fixed rows and columns, with keyboard-driven selection movement;
- Support input of text and numbers, persisted to a local file and reopenable;
- Support basic formulas (arithmetic, cell references, range summation);
- Support circular reference detection with clear error messages;
- Support undo/redo, with editable styles and number formats;
- Viewport virtualization and large-dataset rendering optimization.
With this document, the execution model’s input each round can be compressed to “document sections + current milestone + failure logs,” significantly improving context utilization.
4. The Right Way to Use the Execution Side: Small Steps, Rollback-Ready, Verifiable
Even with a high-quality document, the execution model still needs constraints. Several rules that work well in practice:
- Do one thing per round. Deliver only one milestone at a time; avoid large cross-module changes.
- Enforce self-checking. Require the execution model to run a minimal test case after implementing and output the actual result, rather than claiming “it’s done.”
- Feed failure information back in structured form. Return compilation errors, runtime exceptions, and assertion failures as-is, instead of letting the model patch based on guesswork.
- Keep rollback points. Archive a version immediately after each milestone passes acceptance, so later iterations don’t overwrite a working state.
- No unilateral scope expansion. The execution model must not add features not specified in the document; when it finds a defect in the document, it should submit a “document change proposal” rather than altering the design directly.
A typical effective prompt structure looks roughly like this:
[Input]- Design document sections: 3.2 Data Model / 4.1 Evaluation Engine- Current milestone: Support SUM(A1:A10) and circular reference detection- Previous round's failure log:RecursionError: maximum recursion depth exceeded- Constraints: do not modify the agreed Cell structure; do not add third-party dependencies[Output requirements]1. Provide only the code changed this round;2. Run the minimal test case and paste the real output;3. List test cases that still fail.
The value of this approach is that it constrains “model uncertainty” within a very small radius, keeping the cost of failure controllable.
5. Cost Control: Where the Budget Should Go
When a monthly plan gets burned through quickly, it is usually not because the task itself is too large, but because the budget allocation is wrong. An actionable allocation principle:
- Fund the planning phase generously. The per-token return in the design phase is far higher than repeated trial and error in the coding phase, so it is worth using a model with stronger reasoning capability and allowing a longer thinking process.
- Prioritize cost-effectiveness in the execution phase. Implementation, refactoring, and test writing are relatively less demanding on reasoning depth and can be handled by a more economical model.
- Cache repetitive work. Once build scripts, coding conventions, and common utility functions are settled, write them into the document to avoid re-explaining them every round.
- Trim context. Don’t inject the whole repository; load relevant file lists per module and keep it within the necessary scope.
- Set a hard budget ceiling. Assign a call-count limit per milestone; when exceeded, pause and return to the planning phase to correct the approach rather than continuing to trial-and-error.
In one sentence: planning saves money by “fewer wrong turns,” execution saves money by “less rework.”
6. Quality Verification: How to Judge “Does It Look Right”
For a goal like “recreate the prototype of a mature application,” acceptance cannot rely on visual inspection of the UI alone. Actionable judgment dimensions can be divided into four layers:
- Runnability: can it cold-start, can it open and save files, does malformed input cause a crash;
- Functional alignment: check off each milestone in the document item by item, and record failures and their causes;
- Interaction details: focus behavior, keyboard navigation, selection and edit-state switching, and error message wording;
- Scale robustness: rendering frame rate, recalculation time, and memory usage at larger row/column scales — whether they are acceptable.
The fourth layer is the most easily overlooked, yet it best distinguishes “usable as a demo” from “usable as engineering.” It is recommended to specify target values for scale metrics in the document, giving the execution model a clear optimization direction.
7. A Rational View of Capability Boundaries
The separation pattern can raise the success rate, but it does not eliminate the model’s inherent limitations. The following areas still need a human backstop:
- Implicit knowledge of complex business rules. Industry conventions not written into the document cannot be conjured up by the model;
- Cross-module performance tradeoffs. Decisions involving caching strategy, memory layout, and concurrency models need an experienced engineer to make the call;
- Long-term maintainability. Naming, layering, and boundary clarity are “slow variables” that don’t affect runtime in the short term but determine project cost over the long term;
- Ecosystem compatibility details. Compatibility with external formats and protocols often depends on a large amount of concrete experience.
Therefore, a more reasonable division is: the model handles rapidly converting well-defined requirements into code, while the human defines goals, sets boundaries, and makes tradeoffs. When this division of labor is clear, the stronger the model’s capability, the greater the human’s leverage.
8. A Practical Implementation Checklist
If you plan to adopt this pattern in your own project, you can proceed in the following order:
- Pick a scenario with “moderate complexity and clear acceptance criteria” for a pilot — for example, an internal tool, a data analytics dashboard, or a format-conversion prototype;
- First hand-write a minimal viable skeleton of a design document, run through the full workflow once, and confirm whether the document fields are sufficient;
- Lock down the document template into a team-level “design document standard,” covering a four-part structure: data model, interface definitions, milestones, and acceptance criteria;
- Establish a call budget and an over-limit policy, and define the minimal context set for each round of input;
- Maintain an acceptance record table, archiving versions and remaining issues milestone by milestone;
- Review the distribution of failure cases monthly to judge whether they are planning defects or execution defects, then adjust the division of labor accordingly.
9. Conclusion
“Two tasks exhausting the monthly allowance” is not a sign that the model isn’t strong enough; it is a result of mixing strengths and weaknesses in the way it is used. The only conclusion truly worth paying attention to is: the core dimension for measuring the gap between models is planning quality, not the amount of code generated in a single pass.
Separating planning from execution — letting a high-capability model think the problem through and turn the solution into a document, then letting an economical model implement it quickly against the document and self-test — is currently the reliable approach that balances effectiveness and cost. This workflow does not depend on any specific tool and need not be tied to any one service; whatever type of AI coding capability you ultimately use, as long as document standards, acceptance criteria, and budget strategy are in place, you can move the model’s output from “looks like it runs” to “deliverable and maintainable.”
