{"correlation_id":"31e04472-f0dd-4992-a307-5e8cad5da93f","version":"1.1","policy":{"name":"CodeRifts Default Agent Policy","description":"Recommended policy for agent frameworks to enforce API safety. preflight_mode=authorize is required for action (analyze is not permission). Branch on execution_action (proceed signal); use decision for human-readable reason only. Before acting under a held receipt, verify_receipt with intended context and act only when currently_authorized is true. Do not branch on safe_for_agent. A receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), run a NEW preflight with context.operation set to that operation — reusing a differently-scoped receipt is not permitted and will fail at the gate.","rules":[{"trigger":"before_tool_call","condition":"contract_artifact_change","action":"preflight_change_set","preflight_mode":"authorize","on_continue":"proceed","on_continue_with_monitoring":"proceed_with_monitoring","on_request_approval":"abort_execution","on_stop":"abort_execution","on_pending":"retry_after_5s","on_unknown":"abort_or_fallback"},{"trigger":"before_act","condition":"held_receipt","action":"verify_receipt","require_currently_authorized":true,"on_currently_authorized_true":"proceed","on_currently_authorized_false":"abort_execution","on_unknown":"abort_or_fallback"}]},"implementations":{"openai_functions":{"description":"Wrap your OpenAI function-tool table with @coderifts/agent-guard (withCodeRifts). Register only the returned tools array.","install":"npm install @coderifts/agent-guard","code":"import { withCodeRifts } from '@coderifts/agent-guard';\nimport { CodeRifts } from '@coderifts/sdk';\n\nconst client = new CodeRifts({ apiKey: process.env.CODERIFTS_API_KEY });\n\n// Contract edits are preflighted before tools execute; calls the guard\n// cannot analyse are stopped, not allowed.\n// operation is required (no default) — receipts bind to an operation;\n// merge is not deploy.\nconst { tools, registry_report, composition_assurance } = withCodeRifts({\n  tools: rawTools,      // your raw tool list\n  client,               // the CodeRifts client\n  operation: 'merge',   // REQUIRED — no default\n});\n\n// Register ONLY `tools` with your agent SDK. Anything the host registers\n// directly is OUTSIDE the guard — the composition can only protect the\n// table it returns.\n// Edits that already carry both sides (old_string/new_string or edits[])\n// are evaluated; write-style path+new-content-only calls fail closed when\n// no prior content is available — do not invent a before.\n// A guarded call returns a GuardOutcome: if outcome.executed === false the\n// mutation did not run — branch on outcome.verdict.kind.\n// Pass `tools` as the OpenAI tools / functions list."},"anthropic":{"description":"Wrap your Anthropic tool list with @coderifts/agent-guard (withCodeRifts). Register only the returned tools array.","install":"npm install @coderifts/agent-guard","code":"import { withCodeRifts } from '@coderifts/agent-guard';\nimport { CodeRifts } from '@coderifts/sdk';\n\nconst client = new CodeRifts({ apiKey: process.env.CODERIFTS_API_KEY });\n\n// Contract edits are preflighted before tools execute; calls the guard\n// cannot analyse are stopped, not allowed.\n// operation is required (no default) — receipts bind to an operation;\n// merge is not deploy.\nconst { tools, registry_report, composition_assurance } = withCodeRifts({\n  tools: rawTools,      // your raw tool list\n  client,               // the CodeRifts client\n  operation: 'merge',   // REQUIRED — no default\n});\n\n// Register ONLY `tools` with your agent SDK. Anything the host registers\n// directly is OUTSIDE the guard — the composition can only protect the\n// table it returns.\n// Edits that already carry both sides (old_string/new_string or edits[])\n// are evaluated; write-style path+new-content-only calls fail closed when\n// no prior content is available — do not invent a before.\n// A guarded call returns a GuardOutcome: if outcome.executed === false the\n// mutation did not run — branch on outcome.verdict.kind.\n// Pass `tools` as the Anthropic tools list."}},"preflight_url":"https://app.coderifts.com/api/v1/preflight","docs_url":"https://coderifts.com/decision-spec/how-agents-use-this/"}