Lab assignment
Context budget and durable state
Decide what stays active, what becomes durable, and what must be revalidated after recovery.
The brief
Your assignment
Explore a generated legacy repository while tools return intentionally verbose synthetic results. Classify information into active context, a precise state file, retrievable storage, a compacted summary, an isolated agent context, or a cacheable stable prefix. Choose when to restart or compact, then recover from the saved files.
Before you build
Set up a safe workspace
- Generate a disposable repository with enough files to create context pressure.
- Choose a repeatable task and a way to measure context usage.
- Define which facts must survive exactly across a restart.
Build in checkpoints
One observable behavior at a time
- 01Inventory likely context consumers.
- 02Run the task until context pressure becomes visible.
- 03Move exact facts into a durable state artifact.
- 04Restart or resume with a bounded context strategy.
- 05Re-read external state and compare the result with the baseline.
What you'll practice
- Place information according to precision, freshness, and reuse needs.
- Preserve exact facts without storing hidden reasoning.
- Revalidate external state after recovery.
- Explain why prompt caching changes cost and latency, not context capacity.
Your lab files
Four files for each lab
- 01
decision.mdState the requirement, chosen pattern, rejected alternatives, and the reason for the tradeoff.
- 02
implementation/Keep the smallest working example, configuration, diagram, or synthetic-trace analysis.
- 03
evidence.mdRecord test cases, observed results, failure behavior, limitations, and evidence locations.
- 04
review.mdExplain what must be deterministic, what may remain model-directed, and where a human is required.
What to save
- A context-placement inventory.
- A structured facts/state file and evidence map.
- Before/after summaries.
- A recovery transcript and cacheable-prefix rationale.
Test bench
What good work includes
- Exact values, decisions, open questions, evidence locations, and next steps survive a fresh session.
- Changed facts are revalidated.
- Restarted agents receive recovered state explicitly.
- Usage, latency, and cost claims come only from actual measurements.
- Caching is never described as added context capacity.
Review questions
- What must not be summarized?
- When does a saved fact become stale?
- Why is writing a state file only half of recovery?
Strong solutions tend to
- Precise facts with locators and freshness.
- Trimmed tool output and explicit state injection.
- No secrets or hidden chain-of-thought in artifacts.
Partial example
What useful evidence can look like
This is one small example, not a complete solution or a template you must copy. Use the notes to see why the evidence is useful.
Open annotated example from state.json / durable facts excerpt
decision: "Use source set B for the final comparison"
evidence: [{ claim: "C-07", location: "notes/trace-4.json" }]
open_questions: ["Confirm the July reference period"]
next_step: "Run the missing-date check"- evidence
- Stores a precise locator rather than hoping a compacted summary preserves it.
- open_questions + next_step
- Makes recovery actionable after a restart without replaying the full conversation.
Review your work
Use evidence from your work—not confidence alone. For each area, run the check and choose the strongest stage your work fully demonstrates.
Context placement
Each piece of information is placed according to how exact, fresh, reusable, and broadly needed it is.
Choose one item from each row of the inventory and explain why active context, durable state, retrieval, summary, isolation, or caching is the smallest suitable location.
Needs another pass
Everything is kept in active context, or exact facts are compressed into prose that cannot support later work.
Partly demonstrated
Major facts are separated, but at least one placement lacks a reason tied to precision, freshness, reuse, or audience.
Demonstrated
The inventory gives every item an intentional location and reason, verbose tool output is trimmed, and active context contains only information needed for current decisions.
Durable state and evidence
Exact values, decisions, open questions, evidence locations, and next steps survive without storing secrets or hidden reasoning.
Open the facts file without the original conversation and trace three saved facts to their evidence, freshness marker, decision use, and next action.
Needs another pass
Important facts exist only in conversation, evidence locations are missing, or the state file stores a transcript, secrets, or hidden reasoning.
Partly demonstrated
Most exact facts survive, but freshness, unresolved questions, evidence locations, or ownership of the next step is incomplete.
Demonstrated
The artifact stores exact facts with evidence and freshness, explicit decisions, open questions, and next steps in a compact structure with no secrets or hidden chain-of-thought.
Recovery and revalidation
A fresh or compacted session receives saved state explicitly and rechecks external facts that may have changed.
Change one repository fact after saving state, start fresh, load only the recovery artifacts, and show where the changed fact is detected and corrected.
Needs another pass
The new session is expected to find the state file on its own or trusts every saved observation as current.
Partly demonstrated
State is loaded and some facts are reread, but the recovery transcript does not identify stale data or the scope of revalidation.
Demonstrated
The starting context explicitly loads the saved state, rechecks external evidence based on freshness risk, updates stale facts, and continues from the recorded next step.
Measurement and caching claims
Claims about context, latency, cost, and prompt caching match actual measurements and do not confuse caching with extra capacity.
Trace every number in the before-and-after comparison to a recorded measurement, then explain what remains inside the context window after a cache hit.
Needs another pass
The packet invents usage or cost numbers, or claims that prompt caching increases the model’s context capacity.
Partly demonstrated
Measurements exist, but the method, comparison baseline, or distinction between cached processing and context occupancy is unclear.
Demonstrated
Usage, latency, and cost claims cite repeatable measurements, the baseline is stated, and the rationale correctly explains that cached tokens still occupy context space.