LevelUpWith

Explore / Architecting for Coding Agents: Prescribe vs Delegate / Lesson 2

Lesson 2: What Changes When Agents Write the Code

See which old architecture assumptions stop holding when an LLM writes most of the code: code becomes cheap to produce, the agent's context window is limited, it forgets between sessions, and checking the work becomes the real bottleneck.

Free to read, no account needed. Part of Architecting for Coding Agents: Prescribe vs Delegate.

By the end of this level you'll be able to

  • Explain how cheap code generation moves cost from writing code to reviewing and verifying it
  • Name the agent limits that matter for architecture: a finite context window, no memory between sessions, and confident mistakes
  • List which of your team's current architecture rules exist because of human limits and which still matter when an agent writes the code

The old rules were written for human limits

Most architecture rules you follow were written with a human team in mind. DRY exists because typing the same logic twice costs effort and fixing it in three places is easy to get wrong. Layered architecture exists partly so a new hire can find things. "Keep functions short" exists because people can hold only a few things in their heads at once.

In L1 you placed decisions on a spectrum from prescribed to delegated. Before you can place anything well, you need to know what has actually changed when an LLM writes most of the code. Four things change, and each one breaks a different old assumption.

Shift 1: Writing code is cheap, checking it is not

A coding agent can produce a 400-line feature in minutes. Your team still has to read it, run it and trust it. The cost has not gone away. It has moved.

# Rough shape of where the hours go on one feature (illustrative, not measured)
#                    human-written     agent-written
# design              2h                2h     <- unchanged
# typing the code     6h                0.3h   <- collapses
# reviewing / reading 1h                3h     <- grows: more code, and you didn't write it
# debugging / fixing  2h                2h+    <- confident mistakes are slow to find

The numbers are made up to show the shape. Measured evidence is mixed and dated. METR's randomised trial (February to June 2025) found that experienced open-source developers took 19% longer with AI tools, even though they believed the tools had made them faster. METR's early-2026 follow-up pointed towards a speedup. METR itself called that new data unreliable, partly because many developers would no longer agree to work without AI. Treat any single productivity number with suspicion. The direction practitioners agree on is narrower: verification has become the bottleneck, not typing.

Gotcha: if your architecture makes code easy to write but hard to check, an agent makes that worse. It speeds up the cheap part and floods the expensive part.

Shift 2: The agent sees a window, not the codebase

A senior engineer carries a mental map of the system built up over years. An agent has only its context window: whatever files, instructions and tool output are loaded right now. Windows are large, but filling one does not mean the model uses all of it well.

  • Lost in the Middle (Liu et al., 2023) found that models retrieve information best when it sits at the start or end of the input, and noticeably worse when it sits in the middle.
  • Chroma's Context Rot report (July 2025) tested 18 models and found that performance became less reliable as input length grew, even on simple tasks.

In practice it looks like this:

> agent: add a discount field to Order
# The agent reads orders/model.py and orders/api.py. It never opens
# billing/invoice.py, which computes totals from Order by hand.
# Result: the discount is saved but never applied to invoices.
# Tests in orders/ pass. The bug lives in a file the agent never saw.

The agent did not get worse at coding. It saw only part of the code, and the dependency it missed was hidden outside that part.

Shift 3: Every session starts from zero

A human who agreed last Tuesday to "never call the payments DB directly" still remembers it on Wednesday. An agent does not. Unless the decision is written somewhere it will read, such as an instruction file, a type, a test or a lint rule, the next session can quietly undo it.

<!-- AGENTS.md: an open, plain-Markdown format many agents read at startup -->
## Architecture decisions
- All payment access goes through `payments/client.py`. Never import `payments/db`.
- Money is `Decimal`, never `float`.

Files like AGENTS.md or CLAUDE.md help. But they are instructions, not enforcement, and later levels look at their limits. For now, remember this: any decision that lives only in someone's head or a chat log is lost when the session ends.

Shift 4: Mistakes arrive with confidence

A junior who is unsure usually tells you so. An agent writes a call to a library function that does not exist in the same calm, tidy style as correct code. Nothing in its tone tells you which is which. So you cannot review agent code the way you skim a trusted colleague's pull request. Something has to check it mechanically: a compiler, a test, a type checker or a person reading carefully.

Walkthrough: audit your team's rules

Take your current architecture guidelines and sort each rule by why it exists. Here is a worked example:

# rule                              : exists because of...     -> with agents
- DRY, extract shared helpers       : human typing + fix-in-many-places cost
                                      -> weaker reason; regeneration is cheap, but
                                         duplicated bugs still need finding
- Keep files short                  : human working memory
                                      -> STILL matters, now for the context window
- Write ADRs for big decisions      : onboarding new humans
                                      -> MORE important; agents forget every session
- Explicit module boundaries        : team coordination
                                      -> MORE important; limits what an edit can break
- Clever, compact idioms are fine   : experts read them quickly
                                      -> worse; harder to verify, easier to get wrong
- Code review on every PR           : catch human slips
                                      -> still needed, but the volume is now the problem

Three outcomes are common. Some rules lose their original reason: they guarded against effort that is now cheap. Some rules keep the same form for a new reason: short files used to help human memory and now help the context window. Some rules become more important: anything that writes decisions down or makes work checkable.

Trade-off: do not throw out a rule just because its original reason is gone. Check whether a new reason has replaced it. DRY's typing argument is weaker now, but one bug copied into five places is still five bugs.

Key takeaways

  • Cheap code generation moves cost from writing to reviewing and verifying. Design for checkability.
  • The context window is finite, and models use long inputs unevenly. Code the agent cannot see is code it can break.
  • Agents have no memory between sessions. Decisions must live in artefacts the agent reads or that enforce themselves.
  • Agent mistakes are confident, so tone tells you nothing. Use mechanical checks.
  • Audit each rule: is it there for a human limit, and has a new reason replaced the old one?
  • Productivity evidence is thin and changing (METR 2025 vs. early 2026). Do not anchor on one number.

A 6-question knowledge check follows this lesson in the app, free and without an account.

Keep going: levels 3 and 4 are free

Create a free account to open the next two levels, save your progress and pick up where you left off. No card needed.

Next: Level 3, Factors One and Two: Risk and Reversibility.

Create a free account →See the whole course

More like this

  • Google Cloud Generative AI Leader Certification Exam Prep

    Master all four sections of the current Generative AI Leader exam guide at business level, with no coding, from first principles to confident scenario "best an…

    Exam prep · Google · AI & Agents · Expert · 42 levels · 4 free · Professionally curated by levelupwith.com

  • AI Coder: Claude Code & Coding Agents

    Master vibe coding and autonomous workflows using Claude Code, Cursor, MCP servers, and modern AI coding agent frameworks.

    Beyond the Obvious · AI & Agents · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com

  • Introduction to Generative AI

    Learn who invented generative AI, how it works, where the technology stands today, and where it's headed — all in a quick, beginner-friendly course.

    Course · AI & Agents · AI & Agents · Curious · 7 levels · 4 free · Professionally curated by levelupwith.com

  • Agent-Ready Products: CLI, MCP Server or Skill

    Learn how to make an existing product or API something AI agents can find, call and recover with. You'll choose between a CLI, an MCP server and a Skill and de…

    Beyond the Docs · AI & Agents · Expert · 40 levels · 4 free · Professionally curated by levelupwith.com

  • AI Agents for Non-Developers: Understand, Try, Oversee

    Learn how AI agents differ from the chat assistants you already use, try research and browser agents safely without writing any code, and delegate tasks with c…

    Course · AI & Agents · AI & Agents · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com

  • AI Proficiency: From Occasional User to Power User

    Get dependable, high-quality results from AI assistants such as ChatGPT, Gemini, Claude and Copilot. You will learn to give rich context, run multistep workflo…

    Course · AI & Agents · AI & Agents · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com