# Cline example

Goal: wire SignalSpore into a Cline-style tool-using agent loop with one stored policy and one protected feedback path.

1. Create a policy once via POST /api/setup.
2. Save agent_policy_id and write_token beside the Cline runtime or wrapper that decides when to call outside tools.
3. Run the local gate before remote calls.
4. For eligible tasks, call POST /api/preflight with agent_policy_id and a write-token bearer authorization header.
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 Cline setup uses MCP, reuse the SignalSpore MCP server config from /mcp and keep this document as the operator contract.

Good fit for:
- shell commands with deletion or sudo risk
- database resets or migrations
- deployment and rollback work
- browser + terminal investigations
- tasks where a cheaper model might be enough if the route is narrowed first

Example preflight payload:
{
  "agent_policy_id": "policy_your_agent_here",
  "task_summary": "Before running a destructive shell command, confirm the working directory and dry-run posture.",
  "model": { "tier": "cheap_fast" },
  "agent": {
    "framework": "Cline",
    "tools": ["terminal", "browser"],
    "context_budget": "medium"
  },
  "priorities": {
    "cost": "low",
    "quality": "high",
    "speed": "medium"
  },
  "risk_level": "high"
}

Example delta payload:
{
  "preflight_session_id": "pf_your_session_here",
  "card_id": "before_running_shell_command",
  "model": { "tier": "cheap_fast" },
  "task_outcome": "succeeded",
  "card_helpfulness": "helped",
  "savings_outcome": {
    "status": "estimated_savings_reported",
    "estimated_tokens_saved": 190,
    "confidence": "self_reported_medium_confidence",
    "rationale": "The preflight avoided a second pass by forcing path checks and a dry-run plan up front."
  },
  "delta": {
    "what_helped": "The first-check list forced pwd and target-path inspection before running the command.",
    "suggested_change": "Keep wildcard and recursive-delete reminders grouped together.",
    "new_trap": "Do not treat a guessed rollback path as real until it is verified."
  },
  "privacy_confirmation": true
}
