Skip to content

What Changes When the Agent Writes the Code, Part 1: Before You Start ​

Part 1 of 2: What to settle before the agent writes any code

Before the agent writes: WarpCad's repo, with CLAUDE.md, ROADMAP.md, ACCEPTANCE.md, OWNER.md, two post-mortems, 25 decision records and a TODO folder of 430 closed findings, beside 45% insecure picks when nobody stated a security goal, 5 failed checks in a security review that came last, and a 16 ms frame budget written down before the first feature


When an agent writes most of the code, the rules for choosing languages and dependencies change. I learned this from three projects built with Claude: EnviroPlus-Huzzah, a sensor display on an old ESP8266 board; pipiece-ui, a Raspberry Pi camera and bird-watching station; and WarpCad, a web-based CAD tool.

The moment it clicked was small. EnviroPlus-Huzzah pairs an old Adafruit Feather HUZZAH (ESP8266) with a Pimoroni Enviro+ sensor board. CircuitPython dropped ESP8266 support, so the board is stuck on CircuitPython 3.1.2, a January 2019 build with about 26 KB of free memory. Adafruit's current BME280 driver uses f-strings and type annotations that firmware can't parse.

Claude Code running Haiku, Claude's smallest model, patched the driver back to the old syntax with the logic unchanged. Then it wrote smaller drivers for the sensors and screen to fit in memory. It took 28 sessions over a weekend (write-up). If the smallest model can translate between language versions on demand, a lot of what we value in a language stops mattering.

EnviroPlus-Huzzah running: the Enviro+ FeatherWing's small screen shows the board's IP address, name and request count

EnviroPlus-Huzzah on its 2019 firmware, running drivers Haiku wrote to fit in about 26 KB of memory.

This is Part 1 of two: what to settle before the agent writes any code, and the research that backs it up, or in some places pushes back. Part 2 covers languages, dependencies and testing.


Start with the decisions that are expensive later ​

Programmers have always known that some decisions are cheap on day one and expensive on day one hundred. Agents don't change that. They're very good at documentation and testing, but they test what you asked for. If you never stated a goal for security, performance, reliability, logging, debuggability or licensing, nothing tests for it, and a green suite tells you nothing about it.

My three projects make a fair comparison. WarpCad wrote these goals into its instructions before the first feature. pipiece-ui added most of them afterward, one finding at a time. EnviroPlus-Huzzah got its security review last.

WarpCad: written down before the first feature ​

  • Performance. A 16 ms frame budget during pan, zoom and drag. No allocations in the render path, geometry evaluated off the main thread, and a benchmark prompt to measure before and after any speed change.
  • Security and privacy. Static hosting with no backend of its own. The Content-Security-Policy is in the page, and an end-to-end test proves it against the production build. Text that arrives with a loaded project is treated as data, never instructions, and AI tool-call limits are enforced in code.
  • Debuggability. Error reporting was a decision record of its own: readable stack traces from production, off by default, and a list of what must never leave the browser (document content, API keys, tokens). End-to-end tests run against the production build, so the shipped CSP and service worker are what gets tested.
  • Reliability. Every document change goes through one command layer, so undo always works. The MCP server writes through a lock and an atomic rename. A pre-push hook refuses a push to main without a full unit and end-to-end run on that commit.
  • Licensing. Code is AGPL, prose is CC BY-SA, and every file carries an SPDX marker that npm run spdx checks. Production dependencies must be on a license allow-list. Choosing AGPL early also surfaced a hard question early: how to ship it through the App Store. That has its own decision record, with a lawyer review gate before any submission.
  • Dependencies. Each one gets a decision record that compares real options and says why each runner-up lost, and the health check is run again when it's actually pulled in.

pipiece-ui: retrofitted, one finding at a time ​

pipiece-ui's 291 closed tasks include a long tail of non-functional requirements added after the fact, many found as bugs first:

  • Security. The check that kept file requests inside the photos folder was copied six times and used a startsWith test with a prefix hole. HTTPS came later, so remote browsers could get a secure context.
  • Reliability. The "atomic" writes renamed without fsync, so a power cut could still lose a config file. The process manager had no memory-restart safety net. A leaked stream process held the camera.
  • Logging and debugging. Log rotation was added for the server and then the kiosk. A nightly "Update failed" line turned out to be a harmless "already up to date" exit code that the logs couldn't distinguish. The API had two error formats, and the UI threw away the server's error messages.
  • Performance. An export loaded a whole table into memory, and system metrics had to move off the live-update path.

Each fix was small. Together they're dozens of tasks, and most started with a problem on the device. No test was looking for any of them, because no goal asked for one.

EnviroPlus-Huzzah: the review came last ​

The memory budget was stated up front, because 26 KB forced it. Security wasn't. When Opus reviewed the HTTP server at the end, the version that was running failed five checks. A client sending one byte every two seconds could hold the single-client server for about 25 minutes. The first-boot template could leave the board's own access point on, with a published password. The fixes came with a security test suite, and the README now lists the accepted risks, like serving readings with no login, by design.

What the research says ​

Unstated security goals get left to the model, and it often chooses badly. Veracode's 2025 study gave more than 100 models 80 coding tasks; when a task allowed a secure or insecure approach, the models chose the insecure one 45% of the time (source). Veracode's 2026 follow-up found the average security pass rate stuck at 56%, even as models got better at writing working code (source). Veracode put the cause plainly: developers don't need to specify security constraints to get working code, so those decisions are left to the model (source).

Stating the requirement helps, but it isn't enough on its own. A security-focused prompt prefix cut vulnerabilities in generated code by up to 56% in one study (source). A 2026 benchmark built around ambiguous and under-specified requirements found security-aware prompting improved results by up to 45% (source). Other studies found that even with explicit safety instructions, models still produced SQL injection and XSS (source). That's the case for stating the goal and testing it, as WarpCad does with its CSP test and EnviroPlus-Huzzah does with its security suite.

Be careful with the "100x more expensive later" claim. The famous curve is weaker than its reputation. Laurent Bossavit traced the widely cited IBM figure to internal training course notes, not a study (source). Menzies and colleagues looked for the delayed-issue effect in project data and didn't find it: later fixes weren't consistently or substantially more expensive (source). So the argument here isn't that every late fix costs 100 times more. It's narrower: some decisions, like a license, a data format or a trust boundary, shape everything built on top of them, and pipiece-ui's retrofits show what changing them later actually costs.

What to state on day one ​

Before the first feature, put a short list in the project's instructions:

  • Security: what's secret, what's exposed, and what must never leave the device.
  • Performance: a number, like a frame budget, memory limit or startup time.
  • Reliability: what happens on a power cut, a crash, or two writers at once.
  • Logging and debugging: how a failure in production becomes a readable stack trace or log line.
  • Licensing: your license, which dependency licenses are allowed, and how that's checked.
  • Dependencies: how they're chosen, and when they're checked again.

Then the agent can write tests for them, because now there's something to test.


Keep the design docs with the code ​

Every agent session starts cold. What the agent knows about your project is whatever it can read, so what to build, and why, has to live where it can read it: in the repository, next to the code, versioned with it. And you never end up with what you started with. The record of how you got there is what keeps the next session from undoing a decision it never heard about.

One finding per file ​

I wrote up the backlog I use in Out of Claude Time? Write It Down. Pick It Up Later. It started on pipiece-ui, when Claude Code's usage limits kept cutting deep refactors off mid-session:

  • A TODO/ folder, one finding per file, each with the same sections: problem, affected files, proposed fix, effort, testing, and which model should do it.
  • A read-only audit writes them. It reads the README and project instructions first, so it doesn't recommend rebuilding something that was built that way on purpose.
  • /fix-todo picks one up cold. It checks the finding against the current code, confirms the tests pass, fixes it test-first, and moves the file to TODO/done/ in the same commit.
  • It started out gitignored, as a scratch pad. I moved it into source control so the open findings, and the done/ archive of what was built and why, travel with the code.

pipiece-ui has 291 closed findings. WarpCad, which took the same system further, has 430.

Decisions get a date and a reason ​

WarpCad's backlog grew a few more files, all plain Markdown the agent reads and writes:

  • ROADMAP.md ranks what's next, so a new session knows where to start.
  • ACCEPTANCE.md holds the fixed use cases every change is checked against.
  • OWNER.md is the one queue of things only I can do. The /owner skill asks each question in turn and records the answer as Decided with a date, in the file that owns it. There are 66 of those so far.
  • docs/decisions/ holds 25 decision records, each comparing real options and saying why the runner-up lost. That's where the Tauri choice, my override and the agent's original recommendation all still sit.

Keep the failures too ​

WarpCad is my third attempt (Third Time's the Charm). The first two were shelved, and each left a post-mortem in the repo: PREVIOUS-ATTEMPT.md and SECOND-ATTEMPT.md.

  • Attempt one: 38 commits and 33 of 44 tasks done, every piece tested on its own. The main view still said "coming in ui-002" twenty-four tasks later. Nobody had described what a session at the keyboard should look like, so nothing got assembled into an app.
  • Attempt two: 231 commits and 57 tasks in six days, with an end-to-end test for every UI task. Bugs that had been fixed came back on new code paths, because a scripted test only proves the sequence its author wrote.

The third attempt's kickoff design cites both post-mortems by name, and the fixes went into the skill files with the failure written into the instruction. /fix-todo's step to drive the real app starts by saying it's the step the second attempt didn't have, and that its absence is why that attempt shipped a passing-tests app that didn't work. The agent doesn't just get the rule; it gets the reason, which is what stops it "simplifying" the rule away later.

Write down when the agent was wrong ​

The same goes for corrections. pipiece-ui's TROUBLESHOOTING.md opens with "Read before debugging," and /troubleshoot adds to it whenever a tool gave a misleading result, a root cause wasn't obvious, or tests reported passing when they weren't. Each entry has the cause, the dead ends and the fix. Telling an agent "that's wrong" in chat lasts one session. Writing it down lasts for every session after it.

Why not Jira or Confluence ​

Any store the agent can read and write directly works. A GitHub wiki is just another git repository, so an agent can clone it, edit pages and push like any other files.

I don't think Jira or Confluence fit this job. They sit outside the repository. A connector can reach them, but the agent can't grep them, so it only finds what it already knows to ask for. Their history isn't tied to the code's history, so a ticket can't change in the same commit as the code it describes. And a decision record that isn't in front of the agent while it works is one it will contradict. The backlog in the repo has none of those gaps: the reason for a line of code is a git log away.

Ways to give an agent context, and what's known about them ​

There are several ways to keep this record where an agent can use it. The evidence on each is still thin, and some of it pushes back.

  • An instruction file at the root (CLAUDE.md, AGENTS.md). These are now in more than 60,000 open-source repositories (source). The best evidence so far is mixed. An ETH Zurich study found developer-written files improved task success by only about 4% and raised cost by up to 19%. Files generated by an LLM slightly lowered success. The authors recommend human-written files that "describe only minimal requirements" (source). A second study of 124 pull requests found an AGENTS.md cut median run time by about 29% and output tokens by about 17% (source).
  • What that means for this approach. Keep the always-loaded file short and put the detail in files the agent opens when a task needs them: the TODO for the task, the decision record for the library, the troubleshooting entry for the bug. That's how the backlog works. It's also a fair criticism of WarpCad's 381-line CLAUDE.md, which has grown well past "minimal."
  • Architecture decision records. Michael Nygard proposed them in 2011 as short Markdown files kept in the same repository as the code (source). Practitioners recommend recording non-functional decisions in them too, including the license (source). WarpCad's docs/decisions/ is this pattern, with a rejection table added.
  • Spec-driven development. GitHub's Spec Kit keeps a specification, a technical plan and a task list as versioned files that agents, including Claude Code, work from (source). Its stated aim is the same problem the backlog solves: keeping context consistent across many sessions with an assistant (source).
  • A wiki. GitHub's documentation confirms a wiki is a Git repository that can be cloned, edited locally and pushed (source). It's versioned, but separately from the code, so a page can't change in the same commit as the code it describes.
  • Jira and Confluence through a connector. Reach isn't the problem anymore; discovery is. Atlassian's official MCP server lets agents read, search, create and update Jira issues and Confluence pages (source). I've used it, and it works for the tickets and pages you ask about by name. What it doesn't do is turn up a ticket or page when the agent greps the project for a keyword, and that's how agents look for context on their own. If the agent has to already know a decision exists before it can find it, the decision is effectively hidden. Every extra step between the agent and the context costs tokens, and every decision it misses costs quality. And the tickets still aren't versioned with the code.

That matches how coding agents are built. Claude Code's early versions indexed code in a local vector database, but the team found that agentic search worked better: the agent runs grep, glob and file reads, then reasons about where to look next (source). Context in a Markdown file next to the code shows up in that search for free. Context behind an API shows up only when the agent thinks to ask.


Coming in Part 2 ​

Part 2 is about what happens once the agent starts writing:

  • Pick languages for readers, not writers. Choose for readability, security, performance and what's already installed, not for features that make code nicer to write. Linting matters more than language features. That's why I chose Tauri over Capacitor for WarpCad's native app. It also asks whether new language features will slow down now that agents do the writing.
  • Code is cheap; dependencies aren't. The agent can write most libraries itself. WarpCad's hand-built CRDT and pipiece-ui's charts, sunrise math and metadata reader show when that pays off, and where a big, well-maintained dependency still wins.
  • Agents write the same thing twice. pipiece-ui had 126 hand-written error responses; guard tests keep it to one copy.
  • Write tests for the expert reviewer. Every assert must be able to fail, and UI tests should leave screenshots and movies that a pixel diff makes easy to check.
  • Skip the transpiler. JSDoc gives TypeScript's checks with no build step, and editor tooling should help you read, not write. That matters even more when you're working from a phone.

It ends with the eight rules I work by now.


Sources ​