{"coderifts_version":"1.0","decision":"ALLOW","risk_score":0,"safe_for_agent":true,"breaking_changes":0,"patterns":[],"requires_migration":false,"evidence_quality":"LOW","timestamp":"2026-04-05T16:19:43.763Z","framework":"langgraph","language":"python","snippet":"import requests\nfrom langgraph.graph import END\n\nCODERIFTS_PREFLIGHT = \"https://app.coderifts.com/api/v1/public/preflight\"\n\ndef coderifts_guard(state):\n    \"\"\"LangGraph node that checks CodeRifts before proceeding.\"\"\"\n    spec_url = state.get(\"spec_url\", \"\")\n    resp = requests.get(CODERIFTS_PREFLIGHT, params={\"url\": spec_url}, timeout=5)\n    result = resp.json()\n\n    if result.get(\"decision\") == \"BLOCK\":\n        state[\"coderifts_blocked\"] = True\n        state[\"coderifts_reason\"] = result.get(\"patterns\", [])\n        raise ValueError(\n            f\"CodeRifts BLOCK: {result.get('patterns', [])} — \"\n            f\"risk_score={result.get('risk_score', 'unknown')}\"\n        )\n\n    state[\"coderifts_decision\"] = result.get(\"decision\", \"ALLOW\")\n    return state\n\n# In your graph builder:\n# builder.add_node(\"coderifts_guard\", coderifts_guard)\n# builder.add_edge(\"coderifts_guard\", \"api_call_node\")\n# builder.add_conditional_edges(\"coderifts_guard\", lambda s: END if s.get(\"coderifts_blocked\") else \"api_call_node\")","description":"Add this before any API-calling node in your LangGraph workflow","preflight_url":"https://app.coderifts.com/api/v1/public/preflight","correlation_id":"2e4ed8f1-f81e-431b-b6a7-f61b7d3a3741"}