# Proof Plan

## Objective

Show, with bounded replay and the existing daemon HTTP surface only, that ClawCapsule:

1. admits information through a disciplined event path
2. retains it as authoritative structured state
3. survives interruption via checkpoint and restore
4. deterministically re-emits bounded context through compile
5. re-emits context in a form that is useful to downstream execution
6. continues to do the above under realistic clutter pressure

## Review Method

Each case provides:

- one replay trace
- explicit expected outcomes
- explicit manifest evidence to inspect
- one executed manifest when run
- one short interpretation note

Reviewers should prefer manifest inspection over narrative interpretation.

## Proof Classes

### A. Base Mechanism Proofs

1. `base_disciplined_ingress`
2. `base_authoritative_retention`
3. `base_deterministic_compile`
4. `base_checkpoint_restore`
5. `base_useful_reemission`

### B. Long-Run Clutter Pressure Proofs

The clutter ladder is bounded but explicit.

1. `clutter_light_retention`
2. `clutter_medium_compile_reemission`
3. `clutter_heavy_restore_continuity`
4. `clutter_endurance_500_restore_reemission`

## Case Matrix

### `base_disciplined_ingress`

- Claim focus: disciplined ingress
- Trace shape: compile empty state, emit one event, compile again
- Expected outcome: only post-event compile contains the event-derived decision, fact, and artifact references
- Manifest evidence:
  - `event_seed.response_body.event_id`
  - `event_seed.response_body.state_version`
  - post-event `compile.response_body.bundle_text`
  - post-event `compile.response_body.included_items`

### `base_authoritative_retention`

- Claim focus: authoritative retention
- Trace shape: emit one fact, emit an updated fact with the same key, compile
- Expected outcome: compile includes only the latest fact value for that key
- Manifest evidence:
  - both event `state_version` increments
  - final `bundle_text` contains the newer fact value
  - final `bundle_text` excludes the superseded fact value
  - final `included_items.fact_ids` points at the later fact id

### `base_deterministic_compile`

- Claim focus: deterministic compile
- Trace shape: emit stable state, compile twice with identical request body
- Expected outcome: the two compile responses differ in `compiled_at` only; `bundle_text` and `included_items` remain identical
- Manifest evidence:
  - `compile_a.response_body.bundle_text`
  - `compile_b.response_body.bundle_text`
  - `compile_a.response_body.included_items`
  - `compile_b.response_body.included_items`

### `base_checkpoint_restore`

- Claim focus: interruption, checkpoint, and restore
- Trace shape: seed state, checkpoint, mutate state, restore checkpoint, compile
- Expected outcome: post-restore compile matches the pre-mutation compile and excludes the post-checkpoint mutation
- Manifest evidence:
  - checkpoint response `checkpoint_id`
  - mutated compile `bundle_text`
  - restore response `restored=true`
  - post-restore compile `bundle_text`

### `base_useful_reemission`

- Claim focus: useful re-emission into `bundle_text`
- Trace shape: emit a concrete issue, decision, and artifact tied to a target path, then compile
- Expected outcome: bundle text carries specific facts, decision text, and path-tagged snippet material that can guide a downstream execution step
- Manifest evidence:
  - `bundle_text`
  - `included_items.decision_ids`
  - `included_items.fact_ids`
  - `included_items.artifact_hashes`

### `clutter_light_retention`

- Claim focus: cluttered retention
- Ladder level: light
- Trace shape: many low-priority but valid events, then a smaller relevant cluster, then compile under bounded caps
- Expected outcome: compile retains authoritative latest relevant facts rather than collapsing into older clutter
- Manifest evidence:
  - final `bundle_text`
  - final `included_items`
  - bounded `token_estimate`

### `clutter_medium_compile_reemission`

- Claim focus: cluttered deterministic compile and cluttered useful re-emission
- Ladder level: medium
- Trace shape: larger valid clutter set, relevant cluster at the tail, then two identical compiles under tight section caps
- Expected outcome: both compiles are identical in `bundle_text` and `included_items`, and the emitted bundle still contains the relevant operational subset
- Manifest evidence:
  - both compile `bundle_text` values
  - both compile `included_items`
  - `token_estimate.by_section`
  - relevant fact/path strings present, clutter strings absent

### `clutter_heavy_restore_continuity`

- Claim focus: cluttered restore continuity
- Ladder level: heavy
- Trace shape: heavy valid clutter, relevant cluster, checkpoint, post-checkpoint mutations, restore, repeated compile
- Expected outcome: restore returns the bundle to the checkpointed relevant state and compile remains deterministic after restore
- Manifest evidence:
  - checkpoint response
  - post-mutation compile `bundle_text`
- restore response
- both post-restore compile `bundle_text` values
- post-restore `included_items`

### `clutter_endurance_500_restore_reemission`

- Claim focus: bounded long-horizon retention, deterministic compile checkpoints, restore continuity, and useful final re-emission
- Ladder level: capped endurance extension
- Trace shape: 2 early retained targets, 2 clutter waves to step 250, deterministic compile pairs around steps 100 and 250, checkpoint, 4 post-checkpoint mutations, 1 mutated compile, a long third clutter wave, restore, and 2 identical final compiles at step 500
- Expected outcome: early retained targets remain authoritative at the checkpointed state, compile remains deterministic at the checked points, restore returns the task to the checkpointed relevant state, and the final bounded compile still surfaces the auth-fix subset rather than the long clutter history
- Manifest evidence:
  - both step-100 compile `bundle_text` values
  - both step-250 compile `bundle_text` values
  - checkpoint response
  - mutated compile `bundle_text`
  - restore response
  - both final compile `bundle_text` values
  - final `included_items`

## Boundaries

- The packet proves substrate mechanics, not model behavior
- The packet proves bounded clutter recall, not unbounded endurance or SLA claims
- The packet uses only current daemon HTTP endpoints and replayed bodies
- The packet does not touch `claw-agent-ref`
