{
  "pack_version": "v1",
  "outcome": {
    "id": "edgar-reg-state-v1",
    "name": "Regulatory State Transition Monitor (EDGAR)",
    "run_id": "run_2024_10_14_181522Z_04",
    "org": "Public Example",
    "as_of": "2024-10-14T18:15:22Z",
    "health_status": "Healthy",
    "sla_context": "On-time",
    "back_link": "/outcomes/edgar-disclosure-state-monitor/"
  },
  "trigger": {
    "type": "New EDGAR filing / Amendment",
    "issuer": {
      "name": "Example Issuer Corp",
      "cik": "0000123456"
    },
    "filing": {
      "form_type": "10-K/A",
      "accession": "0000123456-24-000789"
    },
    "detected_at": "2024-10-14T18:10:04Z",
    "delivered_at": "2024-10-14T18:15:22Z",
    "transition": "AMENDED_AFTER_PUBLICATION",
    "confidence": "HIGH"
  },
  "sources": {
    "primary_urls": [
      "https://www.sec.gov/Archives/edgar/data/0000123456/000012345624000789/primary-doc.html",
      "https://www.sec.gov/Archives/edgar/data/0000123456/000012345623000456/primary-doc.html"
    ],
    "published_at": "2024-10-14T17:58:11Z",
    "ingested_at": "2024-10-14T18:09:42Z",
    "checksums": {
      "primary_sha256": "b3b5c91d1d8f1c4c9bdc5f820b7f96a7c9f3c2de1f4b3f9a0a7c9d3c4f1a2b3c",
      "predecessor_sha256": "d9f1a3c4b5e6f70918273645a1b2c3d4e5f60718293a4b5c6d7e8f9012345678"
    },
    "note": "Primary source links are authoritative."
  },
  "entities": {
    "issuer": {
      "label": "Issuer (CIK)",
      "value": "0000123456"
    },
    "filings": [
      {
        "label": "Filing accession (current)",
        "value": "0000123456-24-000789"
      },
      {
        "label": "Filing accession (prior)",
        "value": "0000123456-23-000456"
      }
    ],
    "internal_ids": [
      {
        "label": "issuer_internal_id",
        "value": "issuer_91bf2a"
      },
      {
        "label": "filing_internal_id",
        "value": "filing_a3f10c"
      },
      {
        "label": "obligation_id",
        "value": "obligation_48c201"
      }
    ]
  },
  "state_transition": {
    "show_all_default": false,
    "keys": [
      {
        "key": "LATEST_10K_ACCESSION",
        "before": "0000123456-23-000321",
        "after": "0000123456-24-000789",
        "changed": true
      },
      {
        "key": "LATEST_10Q_ACCESSION",
        "before": "0000123456-24-000210",
        "after": "0000123456-24-000210",
        "changed": false
      },
      {
        "key": "AMENDMENT_FLAG",
        "before": "FALSE",
        "after": "TRUE",
        "changed": true
      },
      {
        "key": "FRESHNESS_STATUS",
        "before": "CURRENT",
        "after": "STALE",
        "changed": true
      }
    ]
  },
  "evidence": {
    "prior_pointer": "https://www.sec.gov/Archives/edgar/data/0000123456/000012345623000456/primary-doc.html",
    "diff_summary": "Sections 2 and 9 updated; new exhibit added.",
    "narrative": "Issuer amended previously filed 10-K to add updated risk language and revised financial tables. Amendment introduces a new Exhibit 99.3 and corrects the MD&A section.",
    "raw_diff": "@@ MD&A @@\n- Revenue increased 12%\n+ Revenue increased 10% due to FX headwinds\n\n@@ Exhibit 99.3 @@\n+ Added updated covenant summary"
  },
  "methodology": {
    "method_hash": "method_7b9c2f19c4",
    "detection_logic": [
      "Monitor EDGAR index feeds every 5 minutes.",
      "Normalize filings to canonical accession numbers.",
      "Compare latest accession to stored state for issuer.",
      "Flag amendments when form type ends with /A.",
      "Validate timestamps against publication window."
    ],
    "thresholds": [
      "Freshness window: 72 hours",
      "Amendment lookback: 180 days",
      "Confidence minimum: MED"
    ],
    "known_exclusions": [
      "Inline XBRL exhibits",
      "Redacted exhibits requiring confidential treatment requests"
    ]
  },
  "limitations": [
    "Formatting noise can obscure section-level diffs.",
    "Late amendments may arrive outside the freshness window.",
    "Missing tables in HTML can reduce confidence scores."
  ],
  "delivery": {
    "note": "This proves chain-of-custody for the evidence pack.",
    "attempts": [
      {
        "channel": "webhook",
        "destination": "https://hooks.example.com/cmdrvl/edgar",
        "delivered_at": "2024-10-14T18:15:22Z",
        "status": "DELIVERED",
        "retries": 0
      },
      {
        "channel": "email",
        "destination": "alerts+example@cmdrvl.com",
        "delivered_at": "2024-10-14T18:15:28Z",
        "status": "DELIVERED",
        "retries": 1
      },
      {
        "channel": "slack",
        "destination": "#sec-alerts (redacted)",
        "delivered_at": "2024-10-14T18:15:35Z",
        "status": "DELIVERED",
        "retries": 0
      }
    ]
  },
  "reproduce": {
    "steps": [
      "Fetch EDGAR filings for issuer CIK 0000123456.",
      "Normalize accession numbers and compare against stored latest state.",
      "Run amendment detection rules with the configured lookback.",
      "Generate evidence pack JSON and verify checksums."
    ],
    "inputs_required": [
      "EDGAR index feed snapshot (CIK 0000123456)",
      "Prior state snapshot (latest accessions)",
      "Method hash method_7b9c2f19c4"
    ],
    "expected_output": {
      "run_id": "run_2024_10_14_181522Z_04",
      "hashes": [
        "b3b5c91d1d8f1c4c9bdc5f820b7f96a7c9f3c2de1f4b3f9a0a7c9d3c4f1a2b3c",
        "d9f1a3c4b5e6f70918273645a1b2c3d4e5f60718293a4b5c6d7e8f9012345678"
      ]
    },
    "command": "cmdrvl evidence generate --outcome edgar-reg-state-v1 --run run_2024_10_14_181522Z_04"
  },

  "lineage": {
    "pipeline_run_id": "pipe_2024_10_14_180900Z_01",
    "note": "Ordered transformation steps used to produce this pack. Each step references inputs/outputs and code provenance for reconstruction.",
    "steps": [
      {
        "step_id": "s1_poll_edgar_index",
        "name": "Poll EDGAR index feed",
        "started_at": "2024-10-14T18:05:00Z",
        "ended_at": "2024-10-14T18:05:02Z",
        "status": "SUCCESS",
        "input_refs": [],
        "output_refs": ["edgar_index_snapshot:idx_2024_10_14_1805Z"],
        "code_ref": {
          "repo": "cmdrvl-context",
          "commit": "commit_placeholder_001",
          "artifact": "poller/edgar_index.py"
        }
      },
      {
        "step_id": "s2_fetch_filing_docs",
        "name": "Fetch current and predecessor filings",
        "started_at": "2024-10-14T18:06:10Z",
        "ended_at": "2024-10-14T18:08:55Z",
        "status": "SUCCESS",
        "input_refs": ["edgar_index_snapshot:idx_2024_10_14_1805Z"],
        "output_refs": [
          "raw_filing:0000123456-24-000789",
          "raw_filing:0000123456-23-000456"
        ],
        "code_ref": {
          "repo": "cmdrvl-context",
          "commit": "commit_placeholder_002",
          "artifact": "ingest/edgar_fetcher.py"
        }
      },
      {
        "step_id": "s3_normalize_and_hash",
        "name": "Normalize filing content and compute checksums",
        "started_at": "2024-10-14T18:09:00Z",
        "ended_at": "2024-10-14T18:09:42Z",
        "status": "SUCCESS",
        "input_refs": [
          "raw_filing:0000123456-24-000789",
          "raw_filing:0000123456-23-000456"
        ],
        "output_refs": [
          "normalized_filing:norm_0000123456-24-000789",
          "normalized_filing:norm_0000123456-23-000456",
          "checksum:primary_sha256",
          "checksum:predecessor_sha256"
        ],
        "code_ref": {
          "repo": "cmdrvl-context",
          "commit": "commit_placeholder_003",
          "artifact": "transform/normalize_filing.py"
        }
      },
      {
        "step_id": "s4_update_state_and_emit_transition",
        "name": "Update issuer state and emit transition event",
        "started_at": "2024-10-14T18:10:00Z",
        "ended_at": "2024-10-14T18:10:04Z",
        "status": "SUCCESS",
        "input_refs": [
          "normalized_filing:norm_0000123456-24-000789",
          "state_snapshot:issuer_91bf2a_latest"
        ],
        "output_refs": [
          "state_snapshot:issuer_91bf2a_latest",
          "transition_event:AMENDED_AFTER_PUBLICATION"
        ],
        "code_ref": {
          "repo": "cmdrvl-context",
          "commit": "commit_placeholder_004",
          "artifact": "outcomes/edgar_state_machine.py"
        }
      },
      {
        "step_id": "s5_generate_evidence_pack",
        "name": "Generate evidence pack JSON",
        "started_at": "2024-10-14T18:12:00Z",
        "ended_at": "2024-10-14T18:14:40Z",
        "status": "SUCCESS",
        "input_refs": [
          "transition_event:AMENDED_AFTER_PUBLICATION",
          "normalized_filing:norm_0000123456-24-000789",
          "normalized_filing:norm_0000123456-23-000456"
        ],
        "output_refs": ["evidence_pack:run_2024_10_14_181522Z_04"],
        "code_ref": {
          "repo": "cmdrvl-context",
          "commit": "commit_placeholder_005",
          "artifact": "evidence/pack_builder.py"
        }
      },
      {
        "step_id": "s6_deliver_notifications",
        "name": "Deliver state transition to destinations",
        "started_at": "2024-10-14T18:15:10Z",
        "ended_at": "2024-10-14T18:15:35Z",
        "status": "SUCCESS",
        "input_refs": ["evidence_pack:run_2024_10_14_181522Z_04"],
        "output_refs": ["delivery_log:run_2024_10_14_181522Z_04"],
        "code_ref": {
          "repo": "cmdrvl-context",
          "commit": "commit_placeholder_006",
          "artifact": "notify/deliver.py"
        }
      }
    ]
  },

  "policy": {
    "policy_version": "policy_2024_10_01_v1",
    "note": "Assurance controls evaluated during this run. Failed checks must downgrade health_status or emit a degraded transition.",
    "budget": {
      "max_retries_per_step": 3,
      "max_total_runtime_seconds": 300,
      "max_fetch_bytes_per_filing": 52428800
    },
    "checks": [
      {
        "check_id": "sources_allowed",
        "description": "Only approved sources were used (SEC EDGAR).",
        "status": "PASS",
        "evaluated_at": "2024-10-14T18:09:42Z",
        "detail": "All primary_urls are on sec.gov."
      },
      {
        "check_id": "evidence_completeness",
        "description": "Evidence Pack contains required sections and hashes.",
        "status": "PASS",
        "evaluated_at": "2024-10-14T18:14:40Z",
        "detail": "Required fields present: checksums, timestamps, transition, delivery attempts."
      },
      {
        "check_id": "delivery_success",
        "description": "At least one configured delivery channel succeeded.",
        "status": "PASS",
        "evaluated_at": "2024-10-14T18:15:35Z",
        "detail": "Webhook, email, and slack delivered."
      }
    ]
  },

  "entity_resolution": {
    "note": "How identifiers were resolved and validated for this pack.",
    "issuer": {
      "input": { "type": "CIK", "value": "0000123456" },
      "resolution_method": "deterministic",
      "validation": [
        "CIK normalized to 10 digits (left-padded).",
        "CIK matched EDGAR filing path and accession header."
      ],
      "confidence": "HIGH",
      "ambiguities": []
    },
    "filings": [
      {
        "input": { "type": "accession", "value": "0000123456-24-000789" },
        "resolution_method": "deterministic",
        "validation": ["Accession found in EDGAR index snapshot and SEC Archives URL."],
        "confidence": "HIGH",
        "ambiguities": []
      },
      {
        "input": { "type": "accession", "value": "0000123456-23-000456" },
        "resolution_method": "deterministic",
        "validation": ["Predecessor accession selected as immediate prior for issuer and form family."],
        "confidence": "HIGH",
        "ambiguities": []
      }
    ]
  },

  "time": {
    "timezone": "UTC",
    "note": "Explicit timing semantics for audit: event_time (source), observed_time (ingestion), decision_time (delivery).",
    "event_time": {
      "published_at": "2024-10-14T17:58:11Z",
      "source": "SEC EDGAR"
    },
    "observed_time": {
      "ingested_at": "2024-10-14T18:09:42Z",
      "detected_at": "2024-10-14T18:10:04Z",
      "source": "CMD+RVL ingestion and detection clocks"
    },
    "decision_time": {
      "delivered_at": "2024-10-14T18:15:22Z",
      "source": "CMD+RVL delivery ledger"
    },
    "as_known_as_of": "2024-10-14T18:15:22Z",
    "clock_sources": [
      { "name": "sec_edgar_published_at", "trust_level": "authoritative" },
      { "name": "cmdrvl_ingest_clock", "trust_level": "operational" },
      { "name": "cmdrvl_delivery_clock", "trust_level": "operational" }
    ]
  },

  "models": {
    "llm_used": true,
    "note": "Explicit model disclosure for any LLM-assisted steps. If llm_used=false, tasks must be empty.",
    "tasks": [
      {
        "task": "diff_summary",
        "provider": "openai",
        "model": "gpt-5.2",
        "model_version": "2024-10-01",
        "prompt_hash": "prompt_4f1c2a9b",
        "temperature": 0.2,
        "max_tokens": 600,
        "input_refs": [
          "normalized_filing:norm_0000123456-24-000789",
          "normalized_filing:norm_0000123456-23-000456"
        ],
        "output_ref": "evidence.diff_summary",
        "confidence": "HIGH"
      },
      {
        "task": "narrative",
        "provider": "openai",
        "model": "gpt-5.2",
        "model_version": "2024-10-01",
        "prompt_hash": "prompt_7a9b1c0d",
        "temperature": 0.2,
        "max_tokens": 900,
        "input_refs": [
          "evidence.raw_diff",
          "trigger",
          "state_transition"
        ],
        "output_ref": "evidence.narrative",
        "confidence": "MED"
      }
    ]
  }
}
