Experimental


Precision context for AI-built software.

Engineer the frame.
Not the code.

Give a model exactly what a change needs, and nothing more. The context frame is what you write, review and keep. The code is generated from it, accepted mechanically and replaced freely.

FRAME

Exactly what the change needs.The change, what it depends on, what must not move, and how it will be judged.

GENERATE

One artifact per frame.No repository access. No code review. No test writing.

ACCEPT

Mechanical, not manual.The oracle decides. Repeated failure means the frame is short.

  1. Frame
  2. Generate
  3. Accept
Glossary of key terms
Context frame
The complete, minimal input for one change: Δ, D, I and an oracle. Nothing else is supplied.
Δ · Change
The behaviour being added or altered, stated observably.
D · Dependencies
The interfaces and facts the change relies on. Signatures and shapes, not implementations.
I · Frame condition
What must stay exactly as it is. The part most often left unstated.
Oracle
The observable pass/fail checks that decide acceptance. It runs outside the model.
ε-sufficient
A frame whose success rate is within ε of the best frame tried for that change and model.
Morphic code
Generated output. Never hand-edited: change the frame and regenerate.

In plain terms

A recipe card, not a library

Imagine asking a cook to make tonight's soup.

? ? ?

1. Hand over every cookbook

Give a new cook every book you own and ask for soup. The right page is in there, but so is everything else. They get distracted, and the soup suffers. More pages, worse soup.

2. Write one recipe card

The dish. The five ingredients, set out on the counter. What must stay as it is: the other pans on the stove, and no nuts. The cook already knows how to cook. That card is the frame.

3. Taste it, don't watch them

Nobody stands over the cook. A taste test decides. If it fails, rewrite the card and cook again. You never scrape and fix the soup.

How the kitchen maps to software
  • Every cookbook: the whole repository.
  • The cook: the AI model.
  • The recipe card: the context frame.
  • The dish: the change, Δ.
  • Ingredients on the counter: the dependencies, D.
  • What must stay as it is: the invariants, I.
  • The taste test: the oracle.
  • A fresh pot each time: regenerated code.

What we know

More context can make a model worse

Retrieval usually assumes extra information never hurts. That holds for a compiler or a careful human, not for a language model.

Models are lossy readers

A language model's accuracy falls as its input grows. Irrelevant material is not free: it competes with what matters.

Proved, in a model

Under a stylised coverage × degradation model, a sufficient context can stop being sufficient when you add to it, and the loss grows with the irrelevant material. Mechanised in Lean 4.

Measured on real code

On a real Go repository, some body-only changes were caught only by tests outside the changed package. Locality has to be shown, not assumed.

What “sufficient” means, precisely

A change request is a contract (Δ, D, I) with an explicit frame condition and an oracle that approximates it. A context K is ε-sufficient for a model when the model's success on K is within ε of its success on the best context in a stated candidate family, not on the whole repository.

For a lossless reader, adding context never breaks sufficiency. For a degrading reader it can. That is the gap precision context is built on: the right frame is found as much by removing irrelevant material as by adding what is needed.

ε-Sufficient Context for Bounded Readers (preprint, Zenodo)

The method

Change → Depend → Hold → Generate → Accept

Write the frame in four parts, then let generation and acceptance run without a human reading the code.

  1. ChangeState Δ
  2. DependAttach D
  3. HoldFix I
  4. GenerateOne artifact
  5. AcceptOracle decides

Failed? The frame was insufficient. Fix the frame and regenerate. Never patch the output.

Change: state Δ observably

Describe what will be different from the outside: inputs, outputs, visible states. If you cannot say how it would be observed, it is not ready to frame.

Depend: attach interfaces, not code

Include the signatures, schemas, IDs and contracts the change touches. Leave out their implementations, history and neighbours. Every extra line has to earn its place.

Hold: name what must not move

The frame condition is the most valuable and most often missing part. Unchanged interfaces, untouched behaviour and constraints belong here, explicitly.

Generate: one artifact, no exploration

The model receives the frame and returns one named artifact. It does not browse the repository, write tests, review code or fix anything outside its output.

Accept: the oracle runs, not the model

The oracle is part of the frame but executes outside it. Acceptance is mechanical: pass is accepted, fail returns to the frame. Once a frame shape has earned trust, nobody reads the diff.

Include the checks that would catch it

Our Go measurement shows some changes are caught only by tests in other packages. The oracle must cover where a change can be observed, not just where it is written.

Anatomy of a frame

One change, framed precisely

A catalogue page needs an empty state. This is everything the model receives.

The context frame

frame: CAT-02 empty state
change (Δ):
  products.json is []
  → show "No products found."
depends on (D):
  #product-list   ul
  #empty-state    p, hidden
  products.json   array of
    {id, name, description,
     url, image|null}
holds (I):
  IDs and classes unchanged
  populated render unchanged
  no inline CSS or JS
oracle:
  []       → message visible
  [1 item] → message hidden
  existing tests still pass
output: scripts/catalogue.js

Left out, on purpose

  • The rest of the repository.
  • The stylesheet and HTML beyond two hooks.
  • Other features and their tests.
  • Tickets, history and design debate.
  • Instructions on how to write the code.

Each omission removes material the model would otherwise have to read past.

Generated, then judged

The model returns one file. The oracle runs its checks. Pass: the file is accepted as-is. Fail: look for what Δ, D or I left out, revise the frame and regenerate. One unlucky run may only need a retry; a pattern of failures always means the frame.

The frame is the reviewable artifact: about twenty lines, stable across regenerations.

The model's rules

Must not

  • Explore or read the repository.
  • Write, run or change tests.
  • Review, debug or refactor other code.
  • Create anything outside its named output.

Must

Use only the frame. Produce exactly the named artifact. If the frame conflicts with itself or is plainly insufficient, say so instead of guessing.

Owned elsewhere

Running the oracle, assembling artifacts and accepting a release belong to the system and the engineer, not the model.

Frame checklist
  • Observable: every line of Δ can be checked from outside.
  • Interfaces only: D has shapes and signatures, not bodies.
  • Explicit invariants: I lists what must not change, even if it seems obvious.
  • Reach: the oracle covers everywhere the change can be observed.
  • One output: a single named artifact per frame.
  • Subtract first: if a line would not change the result, remove it.

Consequences

What changes if the frame is right

These follow from the idea. They are directions we are exploring, not results we have measured.

Review moves upstream

Engineers review twenty-line frames instead of hundred-line diffs. The frame is where intent lives.

Code becomes a build output

Version the frames and the accepted releases. Treat generated code like a compiled binary: reproducible in the behaviour the oracle checks, not byte for byte.

Debugging becomes frame repair

A failure points at a missing dependency or invariant: a fact to add, not a line to patch.

Work runs in parallel

Each frame names its own inputs and output. Frames that do not share an output can be generated at the same time.

Models become swappable

A frame and its oracle do not depend on a vendor. Sufficiency is measured per model, so re-check frames after a switch, but the acceptance bar stays the same.

Sufficiency becomes measurable

Track which frame shapes pass first time. Frames that are reliably sufficient earn trust from evidence, not assumption.

Restructuring the work

From writing code to writing frames

If the frame is the unit of work, the shape of a software team changes with it.

Tickets become frames

Prose requirements give way to Δ, D, I and an oracle. A change that cannot be framed is not ready to build.

Engineers specify, systems generate

Senior time goes into dependencies and invariants, where judgement matters, not into typing the implementation.

Tests come first, from people

Engineers write the oracle before generation. The model never writes the checks that judge it.

The repository changes shape

Frames, interfaces and oracles are the source of truth. Code is regenerated from them, and accepted releases are kept.

Architecture serves the frame

Narrow interfaces and local observability make frames small. Good modular design becomes a direct cost lever.

Failure is information

A rejected output shows what the frame left out. Teams build a library of frame shapes that pass, by change type.

Roles in a framed team
  • Frame author: states Δ, selects D and writes I for one change.
  • Oracle owner: makes sure the checks reach everywhere the change can be observed.
  • Interface owner: keeps the contracts that frames depend on small and stable.
  • Release owner: assembles accepted artifacts and signs off the release.

One engineer may hold all four. The point is that each is explicit and none belongs to the model.

Cost, in theory

Where the savings would come from

None of this is measured. It is the arithmetic that follows if frames are sufficient, and where the cost moves instead.

Fewer tokens per attempt

Input scales with the frame, not the repository. A model that does not explore does not pay to read what it ignores.

Fewer attempts

If irrelevant context degrades a model, removing it should raise the first-pass rate and cut retries.

Less review time

Engineer time is usually the largest cost. Reviewing a twenty-line frame should be faster than reviewing the diff it produces.

Smaller models

A precise frame may let a cheaper model succeed where a larger one was needed to cope with noise. A hypothesis to test.

Cheap regeneration

When a model changes, rerunning accepted frames costs tokens and oracle time, not a rewrite.

Where the cost moves

Writing frames and oracles is up-front engineering. The saving only exists if that work is less than the review and rework it replaces.

In practice

Where it works today

Precision context needs no new platform: a frame file, one model call and the CI you already run. What matters is choosing the right changes.

Fits well

Bounded changes behind clear interfaces: UI states, data transforms, API handlers, validators, adapters and migrations with fixtures.

Fits poorly

Exploratory work, unclear requirements, cross-cutting refactors, and anything without a checkable oracle, such as visual taste or untested performance.

Existing codebases

Start where tests already exist. Choose the oracle by where a change can be observed, including other packages.

  1. PickOne change type
  2. FrameWrite Δ, D, I
  3. ShadowKeep usual review
  4. MeasurePass rate, minutes
  5. TrustDrop the review

Earned, not assumed. Remove human review only for frame shapes whose record shows they pass the oracle reliably.

What to measure
  • First-pass rate: how often a frame's first output passes the oracle.
  • Attempts per acceptance: regenerations before a pass.
  • Escapes: defects found after acceptance, which point to a weak oracle.
  • Tokens and engineer minutes per accepted change, against your current process.

This is how the cost theory above becomes data for your own codebase.

What we don't claim

Where the evidence stops

Precision context is experimental. These limits are part of the method, not footnotes to it.

No model experiments yet

The non-monotonicity result is a proof under a stylised model, mechanised in Lean 4. No language-model benchmark has been reported.

Sufficient is not infallible

ε-sufficient means close to the best frame tried, for a stated model. It is a bound, not a guarantee of correct output.

Generation is not deterministic

The same frame can produce different code across runs and model versions. The oracle, not the model, is what makes regeneration safe.

Next: SuffBench

A planned benchmark whose instances carry observation-based oracle slices, so frame sufficiency can be measured on real models and real changes. About SuffBench