{"$schema":"http://json-schema.org/draft-07/schema#","$id":"https://coderifts.com/decision-spec/v2.0.json","title":"CodeRifts Decision Spec v2.0","$comment":"Curated Decision Spec summary for agents (same KIND as decision-spec/v1.0.json — not a raw producer dump). Content measured from schemas/preflight-response.v2.producer.json (oneOf analyze|authorize) and live buildChangeSet output (src/change-set.js). Full structural producer: https://coderifts.com/schemas/preflight-response.v2.producer.json. Decision-result envelope (authorize): decision-result.v1.consumer.json / producer. Spec 1.0 remains available as an opt-in legacy pin (request decision_spec_version:\"1.0\") until DECISION_SPEC_LEGACY_SUNSET.","description":"Machine-readable standard for API governance preflight responses (Decision Spec major 2.0). Discriminated on preflight_mode: analyze is informational (not permission); authorize is operation-bound and may carry decision / execution_action / safe_for_agent and optional receipts. Branch on execution_action when present; an unrecognised value is not permission. Full field sets: preflight-response.v2.producer.json.","oneOf":[{"title":"Analyze preflight (informational — not permission)","type":"object","required":["preflight_mode","analysis_outcome","authorization_effect","may_execute","receipt_kind","decision_spec_version","risk_score","breaking_changes"],"properties":{"preflight_mode":{"const":"analyze","description":"Source: v2 producer analyze branch preflight_mode const (schemas/preflight-response.v2.producer.json)."},"analysis_outcome":{"type":"string","enum":["NO_BREAK_DETECTED","BREAKS_DETECTED","ANALYSIS_FAILED"],"description":"Source: v2 producer analyze required + change-set deriveAnalysisOutcome."},"authorization_effect":{"const":"NONE","description":"Source: v2 producer analyze const; live change-set analyze sets authorization_effect:'NONE'."},"may_execute":{"const":false,"description":"Source: v2 producer analyze const; live change-set analyze sets may_execute:false."},"receipt_kind":{"const":"NONE","description":"Source: v2 producer analyze const; live change-set analyze sets receipt_kind:'NONE'."},"decision_spec_version":{"type":"string","enum":["2.0"],"description":"Source: change-set DECISION_SPEC_VERSION ('2.0'); v2 producer decision_spec_version required string."},"risk_score":{"type":"integer","minimum":0,"maximum":100,"description":"Source: v2 producer analyze required integer 0–100."},"breaking_changes":{"type":"integer","minimum":0,"description":"Source: v2 producer analyze required integer count (not detail rows)."},"breaking_changes_details":{"type":"array","description":"Source: v2 producer (F2); measured item keys type, path, method, field, severity, description.","items":{"type":"object","properties":{"type":{"type":"string"},"path":{"type":"string"},"method":{"type":"string"},"field":{"type":"string"},"severity":{"type":"string"},"description":{"type":"string"}}}},"patterns":{"type":"array","items":{"type":"string"},"description":"Source: v2 producer patterns string[]."},"detected_patterns":{"type":"array","description":"Source: v2 producer (F2); governance detector rows. Measured required item keys: name, severity, description, consequence, affected_path, affected_field; optional side.","items":{"type":"object","properties":{"name":{"type":"string"},"severity":{"type":"string"},"description":{"type":"string"},"consequence":{"type":"string"},"affected_path":{"type":"string"},"affected_field":{"type":"string"},"side":{"type":"string"}}}},"analysis":{"type":"object","description":"Source: v2 producer analysis (F2); tier-2 mirror from response-envelope attachControlSurface — not a closed property set."},"human_report":{"type":"object","description":"Source: v2 producer human_report (F2). Measured keys: summary, breaking_highlights, suggestions, next_steps_prose.","properties":{"summary":{"type":"string"},"breaking_highlights":{"type":"array"},"suggestions":{"type":"array"},"next_steps_prose":{"type":"string"}}},"severity_summary":{"type":"object","description":"Source: v2 producer severity_summary (F2); change-set bundle axes. Measured keys: diff_severity, governance_severity, policy_effect, note.","properties":{"diff_severity":{"type":"string"},"governance_severity":{"type":"string"},"policy_effect":{"type":"string"},"note":{"type":"string"}}},"requires_migration":{"type":"boolean"},"evidence_quality":{"type":"string"},"verdict_fingerprint":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}}},{"title":"Authorize preflight (operation-bound)","type":"object","required":["preflight_mode","decision","execution_action","safe_for_agent","receipt_kind","decision_spec_version","risk_score","breaking_changes"],"properties":{"preflight_mode":{"const":"authorize","description":"Source: v2 producer authorize branch preflight_mode const."},"decision":{"type":"string","enum":["ALLOW","WARN","REQUIRE_APPROVAL","BLOCK"],"description":"Source: v2 producer authorize required decision enum."},"execution_action":{"type":"string","enum":["CONTINUE","CONTINUE_WITH_MONITORING","REQUEST_APPROVAL","STOP"],"description":"Source: v2 producer authorize required; branch control surface (not decision)."},"safe_for_agent":{"type":"boolean","description":"Source: v2 producer authorize required boolean."},"decision_spec_version":{"type":"string","enum":["2.0"],"description":"Source: change-set DECISION_SPEC_VERSION; v2 producer required."},"receipt_kind":{"type":"string","enum":["operation_authorization","NONE"],"description":"Source: v2 producer authorize receipt_kind; live change-set authorize (non-legacy) sets operation_authorization when a receipt was issued else NONE."},"risk_score":{"type":"integer","minimum":0,"maximum":100},"breaking_changes":{"type":"integer","minimum":0},"breaking_changes_details":{"type":"array","description":"Source: v2 producer (F2); same measured item keys as analyze branch."},"patterns":{"type":"array","items":{"type":"string"}},"detected_patterns":{"type":"array","description":"Source: v2 producer (F2); same measured item shape as analyze branch."},"analysis":{"type":"object","description":"Source: v2 producer analysis (F2); attachControlSurface tier-2 mirror."},"human_report":{"type":"object","description":"Source: v2 producer human_report (F2). Measured keys: summary, breaking_highlights, suggestions, next_steps_prose."},"severity_summary":{"type":"object","description":"Source: v2 producer severity_summary (F2). Measured keys: diff_severity, governance_severity, policy_effect, note."},"decision_result":{"type":"object","description":"Source: v2 producer authorize optional; decision-result.v1 envelope when issuance path produced one."},"chain_receipt":{"type":"string","description":"Source: v2 producer authorize optional chain receipt token when issued."},"control_envelope":{"type":"object","description":"Source: v2 producer authorize optional control surface projection."},"requires_migration":{"type":"boolean"},"evidence_quality":{"type":"string"},"verdict_fingerprint":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}}}],"related":{"producer_schema":"https://coderifts.com/schemas/preflight-response.v2.producer.json","consumer_schema":"https://coderifts.com/schemas/preflight-response.v2.consumer.json","decision_result_consumer":"https://coderifts.com/schemas/decision-result.v1.consumer.json","legacy_decision_spec":"https://coderifts.com/decision-spec/v1.0.json"}}