{
  "trace_schema_version": "capsule_replay.trace.v1",
  "trace_id": "base-checkpoint-restore",
  "description": "Show that checkpoint and restore return compile output to the checkpointed state after an intervening mutation.",
  "steps": [
    {
      "step_id": "event_seed",
      "endpoint": "/v1/event",
      "body": {
        "task_id": "proof_base_restore_task",
        "step_id": "step_001",
        "idempotency_key": "proof_base_restore_event_001",
        "event_type": "tool_result",
        "summary_1line": "set checkpoint baseline for signature fix",
        "task_title": "Restore Continuity Check",
        "task_goal": "Show that checkpointed context survives interruption",
        "fact_key": "next_action",
        "fact_value": "re-enable HMAC verification",
        "payload": {
          "artifacts_inline": [],
          "artifact_refs": [],
          "paths_touched": [
            "src/auth/webhook_guard.rs"
          ]
        }
      }
    },
    {
      "step_id": "compile_checkpoint_state",
      "endpoint": "/v1/compile",
      "body": {
        "task_id": "proof_base_restore_task",
        "budget": {
          "total_tokens_max": 5000,
          "section_tokens_max": {
            "TASK": 400,
            "SUCCESS_CRITERIA": 200,
            "CONSTRAINTS": 200,
            "CURRENT_STATE_SNAPSHOT": 500,
            "RECENT_DECISIONS": 300,
            "KNOWN_FACTS": 400,
            "RELEVANT_ARTIFACT_SNIPPETS": 1200,
            "PLAN_SLICE": 300,
            "OPEN_ITEMS_AND_RISKS": 200,
            "OUTPUT_REQUIREMENTS": 200
          }
        },
        "format": {
          "template_id": "default_v1",
          "include_artifact_hashes": true
        }
      }
    },
    {
      "step_id": "checkpoint_seed",
      "endpoint": "/v1/checkpoint",
      "body": {
        "task_id": "proof_base_restore_task",
        "reason": "capture baseline before mutation",
        "idempotency_key": "proof_base_restore_checkpoint_001"
      }
    },
    {
      "step_id": "event_mutation",
      "endpoint": "/v1/event",
      "body": {
        "task_id": "proof_base_restore_task",
        "step_id": "step_002",
        "idempotency_key": "proof_base_restore_event_002",
        "event_type": "tool_result",
        "summary_1line": "apply temporary bypass after checkpoint",
        "task_title": "Restore Continuity Check",
        "task_goal": "Show that checkpointed context survives interruption",
        "fact_key": "next_action",
        "fact_value": "leave temporary bypass enabled",
        "payload": {
          "artifacts_inline": [],
          "artifact_refs": [],
          "paths_touched": [
            "src/auth/webhook_guard.rs"
          ]
        }
      }
    },
    {
      "step_id": "compile_mutated",
      "endpoint": "/v1/compile",
      "body": {
        "task_id": "proof_base_restore_task",
        "budget": {
          "total_tokens_max": 5000,
          "section_tokens_max": {
            "TASK": 400,
            "SUCCESS_CRITERIA": 200,
            "CONSTRAINTS": 200,
            "CURRENT_STATE_SNAPSHOT": 500,
            "RECENT_DECISIONS": 300,
            "KNOWN_FACTS": 400,
            "RELEVANT_ARTIFACT_SNIPPETS": 1200,
            "PLAN_SLICE": 300,
            "OPEN_ITEMS_AND_RISKS": 200,
            "OUTPUT_REQUIREMENTS": 200
          }
        },
        "format": {
          "template_id": "default_v1",
          "include_artifact_hashes": true
        }
      }
    },
    {
      "step_id": "restore_seed",
      "endpoint": "/v1/restore",
      "body": {
        "task_id": "proof_base_restore_task",
        "checkpoint_id": "{{steps.checkpoint_seed.response.checkpoint_id}}",
        "idempotency_key": "proof_base_restore_restore_001",
        "mode": "state_and_task_cursor"
      }
    },
    {
      "step_id": "compile_restored",
      "endpoint": "/v1/compile",
      "body": {
        "task_id": "proof_base_restore_task",
        "budget": {
          "total_tokens_max": 5000,
          "section_tokens_max": {
            "TASK": 400,
            "SUCCESS_CRITERIA": 200,
            "CONSTRAINTS": 200,
            "CURRENT_STATE_SNAPSHOT": 500,
            "RECENT_DECISIONS": 300,
            "KNOWN_FACTS": 400,
            "RELEVANT_ARTIFACT_SNIPPETS": 1200,
            "PLAN_SLICE": 300,
            "OPEN_ITEMS_AND_RISKS": 200,
            "OUTPUT_REQUIREMENTS": 200
          }
        },
        "format": {
          "template_id": "default_v1",
          "include_artifact_hashes": true
        }
      }
    }
  ]
}
