Documentation
Code
The agentic build loop, which models it uses, and why it is cheap.
/m/code is a small multi-file IDE with a live preview: an editor, a file list, a console, and a chat that builds. The stack it writes is HTML, CSS and vanilla JavaScript. It is a Pro feature and it is desktop-only — a phone shows a notice rather than an unusable editor.
How a build turn works#
- It plans first, on Claude Haiku 4.5: a small structured call that names only the files that must change and why. Plans are cheap; wrong rewrites are not.
- Then it writes those files, one call each, on Claude Sonnet 5. Files the plan did not name are not regenerated.
- While writing a file, every other file is sent as a one-line outline rather than its full text — which is why editing a ten-file project costs about what editing a two-file project costs.
- Each step is shown as it happens, with the file it touched and the result.
At most six files are written in one turn. A file whose generation fails is marked failed and left at its previous contents — it is never replaced with an empty file, and the rest of the turn continues.
Why the models are what they are
This used to re-emit the entire project on Opus for every message, so a one-line change to a 700-line app cost a full 700-line Opus generation. Planning on Haiku and writing on Sonnet is the same work for a fraction of your allowance. It is the deliberate reason Code does not run on the largest model.
Written from the code that implements it. Verify against src/lib/m/code/codeAgent.js, src/pages/m/CodeIDE.jsx.