{
  "product_surface": "caseflow",
  "preferred_client": "iphone_first_pwa",
  "provenance": {
    "project_name": "solvulator",
    "repo_path": "/home/tom/solvulator",
    "git_remote": "",
    "git_branch": "master",
    "git_commit": "fe13b075d419eb40e999f382053615597ffef891",
    "generated_at": "2026-07-06T09:49:24.502907+00:00",
    "generator": "solvulator-system",
    "session_source": "codex",
    "session_locator": "/home/tom/.codex/sessions"
  },
  "foundation": {
    "schema_version": "solvulator-sheet-state-v1",
    "deployment_role": "backend_foundation",
    "preferred_client": "iphone_first_pwa",
    "demo": {
      "action": "none",
      "run_count": 1,
      "step_count": 1,
      "queue_job_count": 1,
      "gate_count": 1,
      "approval_count": 0,
      "task_count": 0,
      "event_count": 13,
      "event_types": [
        "run_created",
        "step_queued",
        "queue_job_queued",
        "run_projection_updated",
        "queue_job_started",
        "step_started",
        "run_projection_updated",
        "gate_opened",
        "step_gate_linked",
        "run_projection_updated",
        "step_completed",
        "run_projection_updated",
        "queue_job_completed"
      ],
      "views": {
        "runs": [
          {
            "run_id": "run_foundation_0001",
            "title": "State Workbook Foundation",
            "status": "awaiting_approval",
            "current_stage": 1,
            "active_gate": "gate_foundation_0001_intake",
            "open_tasks": 0,
            "failed_steps": 0,
            "artifact_count": 0,
            "updated_at": "2026-07-06T09:49:24.494948+00:00"
          }
        ],
        "current_run_state": [
          {
            "run_id": "run_foundation_0001",
            "title": "State Workbook Foundation",
            "status": "awaiting_approval",
            "current_step": "step_foundation_0001_01_intake",
            "current_agent": "agent_01_intake",
            "current_gate": "gate_foundation_0001_intake",
            "latest_artifact": "",
            "latest_error": "",
            "next_action": "review_gate"
          }
        ]
      },
      "tasks": [],
      "approvals": [],
      "invariants": {
        "results": [
          {
            "name": "event_sequences",
            "status": "pass",
            "details": {
              "count": 13
            }
          },
          {
            "name": "last_event_links",
            "status": "pass",
            "details": {
              "tables_checked": 9
            }
          },
          {
            "name": "single_open_gate_per_run",
            "status": "pass",
            "details": {
              "open_runs": 1
            }
          },
          {
            "name": "completed_steps_have_outputs",
            "status": "pass",
            "details": {
              "completed_steps": 1
            }
          },
          {
            "name": "queued_jobs_are_schedulable",
            "status": "pass",
            "details": {
              "queued_jobs": 0
            }
          },
          {
            "name": "running_jobs_hold_locks",
            "status": "pass",
            "details": {
              "running_jobs": 0
            }
          },
          {
            "name": "run_aggregate_links",
            "status": "pass",
            "details": {
              "runs_checked": 1
            }
          }
        ],
        "failed": []
      }
    },
    "related_urls": {
      "schema": "http://127.0.0.1:9805/state/schema",
      "protocol": "http://127.0.0.1:9805/state/protocol",
      "invariants": "http://127.0.0.1:9805/state/invariants",
      "vault": "http://127.0.0.1:9805/vault/manifest"
    }
  },
  "iphone_flow": {
    "product_surface": "iphone_first_pwa",
    "form_factor": "iphone",
    "orientation": "portrait_first",
    "primary_routes": {
      "home": "http://127.0.0.1:9805/",
      "timeline": "http://127.0.0.1:9805/storyboard.html",
      "opposition": "http://127.0.0.1:9805/opposition.html",
      "communications": "http://127.0.0.1:9805/communications.html",
      "state_foundation": "http://127.0.0.1:9805/state/foundation",
      "vault_manifest": "http://127.0.0.1:9805/vault/manifest"
    },
    "workflow_goal": "guide a user from case timeline to a submission-ready legal response packet",
    "scenes": [
      {
        "id": "timeline_overview",
        "title": "Case Timeline",
        "purpose": "show live runs and their current legal posture",
        "transition": "stagger_in_cards",
        "data_source": "/state/foundation",
        "focus": {
          "run_id": "run_foundation_0001",
          "status": "awaiting_approval"
        },
        "cta": "open_case_zoom"
      },
      {
        "id": "case_zoom",
        "title": "Case Zoom",
        "purpose": "zoom into one case and expose the current step, gate, and next action",
        "transition": "zoom_to_case",
        "data_source": "/state/foundation",
        "focus": {
          "run_id": "run_foundation_0001",
          "title": "State Workbook Foundation",
          "status": "awaiting_approval",
          "current_step": "step_foundation_0001_01_intake",
          "current_agent": "agent_01_intake",
          "current_gate": "gate_foundation_0001_intake",
          "latest_artifact": "",
          "latest_error": "",
          "next_action": "review_gate"
        },
        "cta": "walk_submission_packet"
      },
      {
        "id": "guided_packet_walkthrough",
        "title": "Guided Packet",
        "purpose": "walk the user through intake, review, drafting, and packet assembly",
        "transition": "sheet_slide_sequence",
        "steps": [
          "review case timeline",
          "inspect triggering document",
          "confirm response strategy",
          "review open gate",
          "assemble packet for submission"
        ],
        "cta": "open_packet_builder"
      },
      {
        "id": "vault_backed_submission",
        "title": "Backend Vault",
        "purpose": "bind credential refs, configs, and case wrappers without exposing secrets to the phone",
        "transition": "secure_reveal",
        "vault_summary": {
          "credential_ref_count": 4,
          "secrets_policy": "references_only_no_secret_values"
        },
        "cta": "continue_with_backend_execution"
      }
    ],
    "animation_contract": {
      "timeline_overview": "staggered card reveal",
      "case_zoom": "timeline-to-case zoom",
      "guided_packet_walkthrough": "panel slide with progress rail",
      "vault_backed_submission": "minimal secure reveal"
    }
  },
  "vault_summary": {
    "secrets_policy": "references_only_no_secret_values",
    "credential_refs": [
      {
        "name": "anthropic",
        "present": false,
        "ref": "env:ANTHROPIC_API_KEY"
      },
      {
        "name": "openrouter",
        "present": true,
        "ref": "env:OPENROUTER_API_KEY|~/.env.openrouter"
      },
      {
        "name": "gemini",
        "present": true,
        "ref": "env:GEMINI_API_KEY|~/.env.openrouter"
      },
      {
        "name": "sheets",
        "present": false,
        "ref": "env:SHEETS_TOKEN|~/.env.openrouter"
      }
    ]
  },
  "tasks": [
    {
      "id": "review_timeline",
      "label": "Review Timeline",
      "scene_id": "timeline_overview",
      "description": "Confirm the procedural sequence and identify the currently active case thread."
    },
    {
      "id": "inspect_case_zoom",
      "label": "Inspect Case Zoom",
      "scene_id": "case_zoom",
      "description": "Inspect the selected case, active step, and open gate before drafting."
    },
    {
      "id": "confirm_strategy",
      "label": "Confirm Strategy",
      "scene_id": "guided_packet_walkthrough",
      "description": "Translate the current posture into a filing strategy and relief request."
    },
    {
      "id": "review_gate",
      "label": "Review Gate",
      "scene_id": "guided_packet_walkthrough",
      "description": "Resolve the open human-review gate before continuing to filing assembly."
    },
    {
      "id": "assemble_packet",
      "label": "Assemble Packet",
      "scene_id": "vault_backed_submission",
      "description": "Prepare the final packet sections, attachments, and submission channel."
    }
  ],
  "llm": {
    "default_order": [
      "gemini",
      "openrouter",
      "anthropic"
    ],
    "backends": [
      {
        "name": "gemini",
        "available": true,
        "priority": 1
      },
      {
        "name": "openrouter",
        "available": true,
        "priority": 2
      },
      {
        "name": "anthropic",
        "available": false,
        "priority": 3
      }
    ],
    "default_max_tokens": 8192,
    "prompts": [
      {
        "id": "timeline_brief",
        "label": "Timeline Brief",
        "purpose": "Summarize the procedural situation visible on the timeline."
      },
      {
        "id": "case_zoom_brief",
        "label": "Case Zoom",
        "purpose": "Explain the selected case, the open gate, and the consequence chain."
      },
      {
        "id": "packet_strategy",
        "label": "Packet Strategy",
        "purpose": "Turn the current case and gate state into a filing strategy outline."
      },
      {
        "id": "submission_packet",
        "label": "Submission Packet",
        "purpose": "Draft a submission-ready packet skeleton tied to the current workflow state."
      },
      {
        "id": "legal_triage_chat",
        "label": "Legal Triage Chat",
        "purpose": "A chatty assistant that explains the situation, risks, and likely next legal moves in plain language."
      },
      {
        "id": "packet_coach_chat",
        "label": "Packet Coach Chat",
        "purpose": "A chatty coach for assembling a filing or response packet from the current state."
      },
      {
        "id": "skeptical_reviewer_chat",
        "label": "Skeptical Reviewer Chat",
        "purpose": "A chatty skeptical reviewer that pressure-tests weak assumptions, gaps, and unsupported claims."
      },
      {
        "id": "outreach_clerk_chat",
        "label": "Outreach Clerk Chat",
        "purpose": "A chatty assistant for turning current case state into human-sendable outreach and follow-up language."
      },
      {
        "id": "concern_reframer_chat",
        "label": "Concern Reframer Chat",
        "purpose": "Catch an incoming concern, classify it, reduce panic load, and reframe it into the next practical engagement move."
      },
      {
        "id": "rule_of_two_strategy",
        "label": "Rule of Two (Asymmetric)",
        "purpose": "Generate two 'How' counter-moves for every state 'No'."
      },
      {
        "id": "foi_double_bind",
        "label": "Double-Binding FOI",
        "purpose": "Generate an interlocking FOI request based on a specific court order or state claim."
      }
    ]
  },
  "selected_run": {
    "run_id": "run_foundation_0001",
    "title": "State Workbook Foundation",
    "status": "awaiting_approval",
    "current_step": "step_foundation_0001_01_intake",
    "current_agent": "agent_01_intake",
    "current_gate": "gate_foundation_0001_intake",
    "latest_artifact": "",
    "latest_error": "",
    "next_action": "review_gate"
  },
  "human_review": {
    "active_gate": "gate_foundation_0001_intake",
    "actions": [
      {
        "id": "approve",
        "label": "Approve",
        "resulting_status": "completed",
        "description": "Close the review gate and move the workflow to packet assembly."
      },
      {
        "id": "revise",
        "label": "Request Revision",
        "resulting_status": "needs_revision",
        "description": "Return the step for revision and create a concrete rerun task."
      },
      {
        "id": "escalate",
        "label": "Escalate",
        "resulting_status": "blocked",
        "description": "Escalate to manual legal review and block further automated progress."
      }
    ],
    "note": "",
    "action_result": {}
  },
  "effect_cascade": [
    {
      "event_type": "run_created",
      "effect": "A new response workflow is initialized."
    },
    {
      "event_type": "step_queued",
      "effect": "The first procedural analysis step is queued."
    },
    {
      "event_type": "queue_job_queued",
      "effect": "A worker-visible job is waiting to be claimed."
    },
    {
      "event_type": "run_projection_updated",
      "effect": "Aggregate run state has been synchronized for the UI."
    },
    {
      "event_type": "queue_job_started",
      "effect": "The backend worker has claimed the step."
    },
    {
      "event_type": "step_started",
      "effect": "Context is assembled and inference can begin."
    },
    {
      "event_type": "run_projection_updated",
      "effect": "Aggregate run state has been synchronized for the UI."
    },
    {
      "event_type": "gate_opened",
      "effect": "Human review is now required before the workflow can proceed safely."
    },
    {
      "event_type": "step_gate_linked",
      "effect": "The open gate is attached to the active step for UI focus."
    },
    {
      "event_type": "run_projection_updated",
      "effect": "Aggregate run state has been synchronized for the UI."
    },
    {
      "event_type": "step_completed",
      "effect": "A step result is available for packet assembly."
    },
    {
      "event_type": "run_projection_updated",
      "effect": "Aggregate run state has been synchronized for the UI."
    },
    {
      "event_type": "queue_job_completed",
      "effect": "The worker has released the queued job lifecycle."
    }
  ],
  "blockers": [
    {
      "id": "open_human_gate",
      "kind": "human_review",
      "status": "blocked",
      "title": "Human review gate is open",
      "detail": "Current gate `gate_foundation_0001_intake` must be reviewed before continuing.",
      "possible_resolutions": [
        "Review the current case zoom and confirm the step result.",
        "Approve or revise the gate before packet assembly.",
        "Escalate to manual counsel review if evidence is incomplete."
      ]
    }
  ],
  "routes": {
    "dispatch": "http://127.0.0.1:9805/llm/dispatch",
    "backends": "http://127.0.0.1:9805/llm/backends",
    "prompts": "http://127.0.0.1:9805/llm/prompts",
    "caseflow": "http://127.0.0.1:9805/workflow/caseflow",
    "review_action": "http://127.0.0.1:9805/workflow/caseflow/review-action"
  },
  "status_board": {
    "working": [
      "foundation_demo",
      "iphone_flow_contract",
      "vault_reference_contract",
      "llm_dispatch_surface",
      "human_review_actions"
    ],
    "not_working": [],
    "human_in_loop": [
      {
        "id": "open_human_gate",
        "kind": "human_review",
        "status": "blocked",
        "title": "Human review gate is open",
        "detail": "Current gate `gate_foundation_0001_intake` must be reviewed before continuing.",
        "possible_resolutions": [
          "Review the current case zoom and confirm the step result.",
          "Approve or revise the gate before packet assembly.",
          "Escalate to manual counsel review if evidence is incomplete."
        ]
      }
    ]
  },
  "checklist": {
    "summary": {
      "passed": 7,
      "total": 7
    },
    "items": [
      {
        "id": "current_run_present",
        "label": "Current run is materialized",
        "severity": "critical",
        "status": "PASS"
      },
      {
        "id": "current_step_present",
        "label": "Current step is visible",
        "severity": "critical",
        "status": "PASS"
      },
      {
        "id": "open_gate_present",
        "label": "Open review gate is surfaced",
        "severity": "high",
        "status": "PASS"
      },
      {
        "id": "event_cascade_present",
        "label": "Effect cascade is available",
        "severity": "high",
        "status": "PASS"
      },
      {
        "id": "credential_refs_present",
        "label": "Vault exposes credential references only",
        "severity": "critical",
        "status": "PASS"
      },
      {
        "id": "workflow_tasks_present",
        "label": "Named workflow tasks are available",
        "severity": "medium",
        "status": "PASS"
      },
      {
        "id": "human_review_actions_present",
        "label": "Human review actions are explicit",
        "severity": "high",
        "status": "PASS"
      }
    ]
  }
}