Run with Browser AI · Chapter 10

Run Chapter 10: Context Budget Laboratory

Measure Prompt API context pressure, apply an admission reserve, stop a bounded fill loop, build a validated checkpoint and create a replacement session.

← Read When the Context Window Fills
Execution Not inspected
Secure contextUnknown
Top-level pageUnknown
Prompt APIUnknown
AvailabilityNot inspected

Chapter experiment

When the Context Window Fills

Metrics-only trace

Loading the chapter experiment…

No model output yet.
Inspect the context supplied by this chapter

What this experience knows

This experience is grounded in Chapter 10 and treats context as a measurable but implementation-dependent budget.

Measurement boundary

inputUsage and inputQuota come from the active session. If measureInputUsage() is exposed, its result informs admission. Otherwise the interface labels a character-based fallback as an estimate. Missing counters never become zero.

Admission boundary

Reported remaining capacity is not automatically safe capacity. The policy reserves room for output and runtime overhead, and it pauses the bounded fill loop at the configured pressure threshold.

Overflow boundary

A blocked operation is not sent automatically. The separate runtime-probe control lets the operator test one rejected candidate and records the exact exception without assuming its name or message.

Compaction boundary

The replacement session does not remember the original. It receives a structured checkpoint containing protected goals, authority constraints, observations and pending work. Old and new session IDs remain distinct.

Evidence boundary

Compression ratio is not correctness. Checkpoint structure is validated deterministically, and the replacement receives a behavioral probe for protected state. Metrics-only events retain sizes and measurements rather than prompt or output content.

This laboratory makes context pressure visible before failure. It measures or estimates the next input, preserves an output reserve, runs a bounded sequence of deterministic turns, and stops when application policy says the next operation is unsafe.

Compaction creates an inspectable checkpoint and a separately identified replacement session. The reviewed replay proves only an initial quota of 9,216 with zero usage; it contains no prompt delta, overflow or compaction evidence.