Compact-and-Continue

loop pattern · maturity: established · risk: medium

When context approaches its limit mid-task, the agent writes a structured continuation summary (state, next steps, open questions, key facts), context compacts, and work resumes from the summary.

When to use

Any task that outlives a context window: the loop that makes long work possible at all.

Steps

StepWhat happensVerification
Checkpoint before the cliffWrite the continuation summary while capacity remains, not after truncation.Summary passes the cold-reader test: sufficient to continue with zero prior context.
CompactContext compresses; the summary and remaining budget carry forward.Post-compaction state includes the summary verbatim.
Reconcile and resumeRe-verify the summary's claims against the workspace before trusting them, then continue.Stated done items spot-checked; drift flagged rather than inherited.

Specification

Verification methodReconcile-on-resume: the summary is a claim set to verify, exactly as in checkpoint-resume.
Recovery behaviorreconcile-then-continue
ObservabilityThe summaries themselves, versioned per compaction.
InputsLong-running task, Compaction mechanism
OutputsContinuous progress across context boundaries
Risk level / maturitymedium / established

Failure modes

  • Summaries recording intentions as outcomes
  • The one critical detail dropped in compression
  • Resuming without reconciliation, inheriting stale claims

Assessment

Checkpoint-resume's in-session sibling, and the pattern every agent runtime now implements somewhere. The intentions-as-outcomes failure is the one that poisons; write summaries in past tense only about verified facts.

Go deeper