← Blog

Context Is the New Code: How We Ship Production Features with AI Agents

By Jeet Patel7 min read
Context first. AI agents build from specifications, with human review before production.Structured contextShared AI agentsProduction code

In short: AI coding agents fail when they have to guess. We stopped prompting and started specifying: every feature gets structured, version-controlled context that tells the agent what to build, where to build it and how. On a subscription billing module for a US healthcare platform, this let a team of 8 deliver about 60 user stories, with over 700 passing test cases, in 6–8 weeks from design approval. Our own estimate for building it the traditional way was 6–9 months.

We wrote over 11,000 lines of structured context before an AI agent wrote a single line of a billing system. Here’s why that was the fastest route to production.

The problem with “AI coding” as most teams do it

Most teams adopt AI coding the same way. A developer opens a chat, describes the task, gets code back, and fixes what’s wrong. Then they do it again for the next task, and the one after that.

It works for small things. For a real production feature it breaks down quickly, for a simple reason: the AI doesn’t know what you know. It doesn’t know that money is stored as integer cents, that the handler owns the database transaction, that a discount can only apply once per billing cycle, or that last quarter a Stripe invoice went unpaid because nobody called the payment step.

So it guesses. Some guesses are right. Many are plausible and wrong, and plausible-and-wrong is the expensive kind, because it passes a quick review and fails in production.

Each session starts from zero. The agent rediscovers the codebase, invents its own patterns and drifts from your conventions. Developers end up spending their time correcting the AI instead of shipping.

The shift: from prompts to context

We changed the question we were asking. Instead of “how do we prompt the AI better?”, we asked “what would a new senior engineer need to know to build this correctly on day one?”

Then we wrote that down, in a structure an AI can read reliably, and put it in a shared repository that every agent reads before touching code.

We call this context-first development. The context is not documentation written after the fact. It’s the working specification the code is built from, and it’s maintained with the same care as the code itself.

What the context repository holds

The context lives in its own repository, separate from the application code, and serves several code repositories (backend and mobile). It has three layers.

LayerWhat it answersExample
Initial contextHow do we build things here?Architecture, coding patterns, conventions, workflows
API specificationWhat exists?Endpoints, request and response models, permissions, per module
Knowledge baseHow does it actually work?Step-by-step flows, business rules, validations, edge cases, per module

Every agent follows the same reading order: initial context first, then the module’s API spec, then the relevant knowledge-base flows. Only then does it look at the code.

Context repository

Initial context
API specification
Knowledge base

Shared AI agents

Context generator
Backend coder
Mobile coder
PR reviewer · and more

Code repositories

Backend API
Mobile app

Figure 1. The context repository sits next to the code and is read by every agent before any work starts.

How precise is “precise”?

For the billing module alone, we wrote 65 context documents, about 11,400 lines. Each document describes one flow, such as starting a subscription, switching packages mid-cycle, or applying a coupon, and follows the same strict template:

  • Gist: two or three sentences on what the flow does and why it exists.
  • Key files: the exact files involved, verified against the codebase.
  • Authentication and permissions: who can do this, with which role, scoped to what.
  • Validations: every check, in the order it happens, each with a unique code.
  • Flow: the step-by-step behaviour, including branches.
  • Business rules: every rule the agent must not break, each with a unique code.
  • Test hints: a table mapping each rule and validation to a test case and expected outcome.
  • External calls: every third-party call, when it happens, and what to do if it fails.
  • Edge cases, dependencies and a changelog.

No section can be skipped. If a section doesn’t apply, it says “N/A”. That rule matters more than it sounds: a missing section is exactly where an AI fills the gap with a guess.

How a feature flows through the system

1 · Specify
2 · Build
3 · Release
Feature request
Design mockups
Review with
stakeholder
Schema and
user stories
Context per story
AI builds each story
Developer review and
first-round testing
AI PR review
and merge
QA writes test cases
in parallel
Staging: QA testing
and demo
SOP for
operations
Automated
deployment
feedback
Figure 2. The delivery flow, from feature request to production. Humans approve every transition.

The AI writes the code. People decide what gets built, approve each plan, review each change, and own the quality. That split is deliberate and doesn’t move.

The results

MeasureBilling module
User storiesAbout 60, all deployed
Context written65 documents, about 11,400 lines
Test casesOver 700, all passing
Team8 developers across backend and frontend
Time from design approval to productionAbout 6–8 weeks
Our estimate without AI6–9 months

The estimate is ours, not a controlled experiment, and we treat it that way. But the direction is clear, and so is where the time went.

Where the time actually goes now

Here’s the counter-intuitive part: writing the context took more effort than writing the code.

Most of a feature’s timeline is now specification: design rounds, schema design, breaking the feature into stories, and writing context precise enough that nothing is left to interpretation. Once that’s done, the AI builds quickly, and it builds what was specified.

We think that’s the right trade. Specification is where engineering judgment lives. Typing was never the valuable part.

Why this works

  1. The agent doesn’t rediscover the codebase every session. It reads curated knowledge instead of inferring it from code.
  2. Rules are explicit, so they’re followed. An agent can’t respect a rule it was never told.
  3. Every rule is traceable to a test. The QA team writes test cases directly from the rule codes.
  4. The context compounds. Each feature leaves the context repository richer, so the next feature starts further ahead.
  5. Humans stay in control. Agents propose; people approve.
Explicit rules

Business rules and validations, each with a unique code.

Traceable tests

Test hints map each rule to a case and expected outcome.

Human approval

People review each change and own the quality.

Rules become testable evidence. Agents build; people approve.

What it doesn’t solve

We’d be misleading you if we stopped there.

  • Context goes stale unless updating it is part of the definition of done.
  • Testing becomes the next constraint. When development speeds up, QA capacity sets the release pace.
  • It takes discipline. The template only works if nobody skips sections.

The forward deployed angle

Forward deployed engineering puts engineers close to a client’s real problem and makes them own the outcome. Its classic weakness is that every engagement is bespoke and the knowledge leaves with the engineer. Context-first development is how we fix that: what’s learned with the client is captured as structured, reusable context, and AI agents build from it. The engagement leaves an asset behind, not just delivered code. We cover this in more depth in our article on forward deployed engineering in the age of AI agents.

Key takeaways

  • AI coding quality is limited by context quality, not model quality.
  • Treat context as a first-class, version-controlled engineering artifact.
  • Make the spec precise enough that the AI never has to guess.
  • Expect specification, not coding, to become your biggest time investment.
  • Keep humans in charge of every decision that matters.

Frequently asked questions

What is context-first development?

Context-first development is an approach to AI-assisted software engineering where structured, version-controlled specifications are written before code, and AI agents build from them. The context describes what to build, where, and how, so the agent doesn’t have to guess.

How is this different from writing a good prompt?

A prompt lives for one session. Context lives in a repository, is reviewed like code, and is shared by every developer and every agent on the team. It improves with every feature instead of being rewritten each time.

Does more context always make AI agents better?

No. Research has found that generic repository context files can reduce agent success and raise cost. What helps is context that is specific, structured and relevant to the task, organized so the agent reads only what it needs.

Which AI tools does this work with?

We use Claude Code with shared, version-controlled agent definitions. The approach itself is tool-agnostic: the context repository is plain Markdown that any capable coding agent can read.

How long does it take to set up?

Start with one module: write its context, create one shared agent, add one human approval gate, and measure. The system grows from there.