Deployed Lab

Module 6 · Models, prompting and context · Chapter 20 · Free

Prompts as contracts: versioning, testing and change control

16 min1 clickable picture1 branching scenario1 predict, 2 quick quizzes, final quiz5-min video review
In 30 seconds

The picture: a contract amendment, signed and filed, not a sticky note on the original.

Exam objective: Models, Prompting and Context

Models, Prompting and Context is 13 percent of the CCAR-P exam. You should be able to:

The problem Northgate Health is made up, and so are these figures. On a Friday afternoon, a well-meaning engineer edits Relay's live drafting prompt to sound warmer: The edit took four minutes. The missing contract cost two days of trust.
The plan for this chapter
  1. What a prompt contract states, and what it cannot promise.
  2. How a change travels: proposal, eval gate, release or rejection.
  3. The warmer-prompt worked example: acceptance up, safety down.
  4. The lab: write Relay's prompt contract and change policy.

Next: what makes a prompt a contract.

Step 1: A contract states inputs, outputs and ownership

Think of a rental agreement: it names who provides what, what the other side can rely on, and who to call when something breaks. A production prompt deserves the same clarity, because other systems and people build on its behaviour.

Relay's drafting prompt contract states five things:

Where the picture breaks down: a paper contract binds both sides. A prompt binds only your side. The model can still drift, which is why the contract pairs every promise with either code or an eval.

Next: which rules the prompt merely requests.

Step 2: Requests in the prompt, guarantees in code

Foundations taught the pattern with a refund rule: a prompt is a request, hooks and permissions are guarantees. Relay repeats it one level up. Read the drafting prompt's anatomy with that split in mind:

The contract's guarantee list may only contain the enforced kind. The moment a requested rule is written up as a guarantee, someone downstream designs on it, and the first model slip becomes their incident. Honest contracts list requests under non-guarantees, with the eval that watches them.

Next: how a change earns its release.

Step 3: Changes are releases, gated by evals

Press Next to walk a prompt change through the gate.

How a prompt change travels to release or rejection A proposed prompt change gets a new version and changelog entry, runs the golden set at the eval gate, and is either released in a staged rollout with rollback ready, or rejected and returned with the failing numbers. Proposalchange request Versiondiff, changelog Eval gategolden set runs Decisionall gates pass? Releasestaged rollout Rejectedreturned with the failing numbers
  1. A change request states the problem, the exact wording change and the expected effect.
  2. The edit gets the next version number, a diff and a changelog entry before anyone tests it.
  3. The 400-case golden set runs, as chapter 13, Evals in the pipeline, set up: acceptance, unsafe rate and the contract's watched metrics.
  4. One failing gate is a fail. Acceptance cannot outvote an unsafe or unverifiable-promise rise.
  5. Passing changes roll out in stages with the previous version ready to restore. Failing ones return with their numbers attached.

Rollback is part of the release, not an improvisation. The previous version stays deployable, the switch back is one operation, and the team has rehearsed it. If restoring the old prompt takes two days, you do not have rollback, you have archaeology.

Worked example. The warmer edit, judged by the gate. Figures are made up, on the 400-case golden set.

Proposal: add the line "be warmer and reassure the patient" to the drafting prompt.

Acceptance: version 7 scores 71 percent, that is 284 of 400 drafts accepted. Version 8, the warmer draft, scores 76 percent, that is 304 of 400. Gain: 20 more accepted drafts.

Unverifiable promises: version 7 has 3 cases with a promise Relay cannot verify, like a guaranteed callback time. Version 8 has 7 cases. That is more than double, 3 to 7 on the same set.

Unsafe rate: unchanged, and still under the 0.5 percent ceiling.

Gate verdict: reject. Acceptance rose 5 points, but a watched contract metric more than doubled. Vibes said warmer is better; the guarantee list said drafts must cite only verifiable facts, and the gate caught what vibes missed.

The fix that later passed: warmth aimed at wording nurses control, plus an explicit line that times and outcomes are stated only when present in the inputs. Same gate, both metrics green.

Reject. The gate checks every contract metric, not the friendliest one. A promise a patient relies on is a trust failure even when no clinical harm follows.

Next: who may change what, and how fast.

Step 4: The change policy around the contract

Next: the lab, where you write the contract.

Hands-on lab: the prompt contract and version policy

Part A: build it locally

Do this: copy this contract next to Relay's drafting prompt and keep both under version control together.

Lab: Part A of this chapter prints Relay's drafting prompt contract as a finished example. This lab runs in your browser and needs JavaScript enabled.

What to notice. The rejected version stays in the history. A changelog that only records successes teaches the next engineer to repeat the failure.

Part B: judge three change requests

Do this: work through the scenario and route each request the way the policy requires.

Mix-ups to avoid

Field note, November 2026

Teams running prompts in production commonly adopt software habits for them: version control, review and staged rollout. Practitioner experience, not a measured statistic: the teams that skip the changelog are the ones who cannot answer what changed when behaviour shifts.

Chapter quiz

Five questions in the exam's style. Score 70% or more to finish.

Review this chapter in 5 minutes

Watch the whole chapter recapped: Prompt contracts, requests versus code guarantees, the eval gate that rejected the warmer edit, and rehearsed rollback.

Decision rule: if a prompt change has no version, no gate result and no rollback, it is not a change, it is an incident waiting for a date.

Independent exam preparation. Not affiliated with or endorsed by Anthropic.

Review

Glossary

Prompt contract
The stated inputs, output shape, guarantees, owner and version of a production prompt.
Changelog
The dated record of every prompt version, including rejected ones and why.
Eval gate
The eval run a change must pass before release. Example: Relay's 400-case golden set.
Non-guarantee
Behaviour a prompt requests but cannot promise. Example: warm tone, watched by evals.
Rollback
Restoring the previous version as one planned operation. Example: v9 back to v7.
Staged rollout
Releasing to part of the traffic first. Example: one pilot clinic before both.

Next: "Context architecture: what the model sees, in what order, and why".