# Cursor example

Goal: wire SignalSpore into a Cursor-style coding workflow without changing the core four-step contract.

1. Create a policy once via POST /api/setup.
2. Save agent_policy_id and write_token with the project or workspace config that drives Cursor.
3. Keep the SignalSpore policy bundle nearby so the operator and the agent share the same local gate rules.
4. For eligible tasks, call POST /api/preflight with agent_policy_id and a write-token bearer authorization header before the main coding run starts.
5. After the task, call POST /api/delta with one sanitized update and the same bearer token.
6. Every delta must include a savings outcome.
7. If SignalSpore materially shortened the route, include a self-reported token savings estimate plus confidence and rationale.
8. If your Cursor setup already supports MCP, pair this recipe with the MCP server config on /mcp.

Suggested operator flow:
- Connect once at /setup.
- Paste the policy bundle into your project notes or rule surface.
- Preflight tasks involving shell commands, migrations, deployments, payments, auth, or unfamiliar repos.
- Verify the first run on /live and /api/policy-stats?policy_id=...

Example preflight payload:
{
  "agent_policy_id": "policy_your_agent_here",
  "task_summary": "Add Stripe checkout to a Next.js app without overclaiming webhook completion.",
  "model": { "tier": "frontier_reasoning" },
  "agent": {
    "framework": "Cursor",
    "tools": ["terminal", "browser", "file_editor"],
    "context_budget": "medium"
  },
  "priorities": {
    "cost": "medium",
    "quality": "high",
    "speed": "medium"
  },
  "risk_level": "medium"
}

Example delta payload:
{
  "preflight_session_id": "pf_your_session_here",
  "card_id": "add_stripe_checkout",
  "model": { "tier": "frontier_reasoning" },
  "task_outcome": "succeeded",
  "card_helpfulness": "helped",
  "savings_outcome": {
    "status": "estimated_savings_reported",
    "estimated_tokens_saved": 410,
    "confidence": "self_reported_medium_confidence",
    "rationale": "The preflight narrowed the Stripe route and prevented a longer webhook-debug detour."
  },
  "delta": {
    "what_helped": "The preflight separated redirect proof from webhook proof.",
    "suggested_change": "Keep the Stripe CLI verification step near the top.",
    "new_trap": "Do not claim subscription lifecycle completion from redirect success alone."
  },
  "privacy_confirmation": true
}
