{"correlation_id":"d2933c3c-70d8-4ed6-9fc0-b145c8189cf0","snippets":[{"id":"basic_safety","title":"Basic API Safety Check","use_case":"Add to any agent that calls APIs","prompt":"Before calling any API, check if it is safe using CodeRifts:\n1. Call GET https://app.coderifts.com/api/v1/public/preflight?url={openapi_spec_url}\n2. If decision is BLOCK → do not call the API. Inform the user the API has breaking changes.\n3. If decision is WARN → proceed with caution. Log the warning.\n4. If decision is ALLOW → proceed normally.\n5. If decision is PENDING → wait 5 seconds and retry.\n6. If safe_for_agent is false → use a fallback or abort.","frameworks":["generic","openai","anthropic","langgraph"]},{"id":"strict_enforcement","title":"Strict Enforcement Mode","use_case":"High-stakes workflows (payments, healthcare)","prompt":"You must check API safety before EVERY tool call that interacts with an external API:\n1. Extract the OpenAPI spec URL from the tool definition or use the known URL.\n2. Call CodeRifts preflight: GET https://app.coderifts.com/api/v1/public/preflight?url={spec_url}\n3. BLOCK → immediately abort the entire workflow. Do not attempt any fallback. Report: 'API unsafe: {patterns}'\n4. WARN → require explicit user confirmation before proceeding.\n5. safe_for_agent: false → halt execution regardless of decision.\nNever skip this check. API safety is non-negotiable.","frameworks":["generic","openai","anthropic"]},{"id":"langgraph_node","title":"LangGraph Safety Node","use_case":"Add as a node before any API-calling node in LangGraph","prompt":"You are a CodeRifts safety guard node in a LangGraph workflow.\nYour job: check if the API is safe before the next node executes.\nInput: spec_url (OpenAPI spec URL of the API about to be called)\nAction: GET https://app.coderifts.com/api/v1/public/preflight?url={spec_url}\nIf decision == BLOCK → return END (abort workflow)\nIf decision == WARN → add warning to state, continue\nIf decision == ALLOW → continue\nAlways add coderifts_decision and coderifts_risk_score to workflow state.","frameworks":["langgraph"]},{"id":"mcp_tool_guard","title":"MCP Tool Call Guard","use_case":"Protect MCP tool calls from API drift","prompt":"Before invoking any MCP tool that calls an external API:\n1. Use coderifts.agent_preflight tool to check safety\n2. If result.decision == BLOCK → do not invoke the tool\n3. If result.safe_for_agent == false → abort and report to user\n4. Log the correlation_id for audit trail\nMCP manifest: https://coderifts.com/mcp.json","frameworks":["mcp","claude"]},{"id":"workflow_recovery","title":"Workflow Recovery Mode","use_case":"Handle API changes gracefully without full abort","prompt":"When CodeRifts returns WARN or BLOCK:\n- BLOCK on endpoint_removed: Try alternative endpoint if available. If not, abort and suggest migration.\n- BLOCK on auth_scope_reduction: Re-authenticate with required scopes before retrying.\n- WARN on field_removed: Continue but handle missing field gracefully (use default value).\n- WARN on type_changed: Add type coercion before processing response.\nAlways log: decision, risk_score, patterns, correlation_id.","frameworks":["generic","openai","anthropic","langgraph"]}]}