---
name: ccd-radar
description: This skill should be used when wrapping up a session, at natural checkpoints, or when context pressure is high — evaluates session delta against the CCD state model and updates the workspace-local handoff
---
# CCD Radar Gate
Machine-centric handoff. Evaluate the session delta against the landed CCD state model, update the workspace-local handoff when needed, and wrap up cleanly only after the developer approves.
## Gotchas
- **Shared safety contract:** evaluate read-only state first, honor preview/apply metadata, stop short of Git follow-through or destructive repair until developer approves.
- **Human-facing default is outcome-first:** keep brief short, calm, action-oriented. Use CCD internals to decide, not to dump onto the developer.
- **Native handoff is CLI-owned:** update through `ccd handoff write` (stdin JSON). Never hand-edit `state.db`.
- **Handoff write validates:** rejects neutral titles, empty `immediate_actions`, empty `definition_of_done`.
- **Recovery is CLI-owned:** persist via `ccd recovery write` (stdin JSON).
- **Memory has a token cost:** only propose an entry when a pattern repeats twice or a hard rule changes.
- **CLI unavailable = blocked close-out:** do not clear session state or present as fully handed off.
- **Git workflow split:** branch/worktree/commit/push/merge belongs in `ccd-git-workflow`; queue, assignment, and extension-owned context belongs behind explicit extension surfaces.
- **Stale worktree binaries:** never fall back to `./target/debug/ccd`.
- **Radar cache is transparent:** checkpoint/evaluation cache reuse is an internal optimization; do not treat cache hits or misses as user-facing findings unless the CLI reports a material warning or error.
- **Inherited handoff-reference cleanup:** when `handoff_references_resolved.provenance = inherited_from_startup`, frame stale paths as inherited cleanup, not current-session recalibration.
- **Thread binding is part of continuity:** include `thread` in handover reads and stop if the active session/thread binding is inconsistent.
- **Lifeloop renewal evidence:** if `session_boundary.evidence` mentions Lifeloop renewal status, report the token-safe state and retry posture. Do not inspect continuation-token files directly.
## Human-facing brief contract
- Start with the outcome, not the diagnosis.
- Never enumerate empty categories ("Blockers: none").
- Keep CCD internals (`behavioral_drift`, `session_boundary`, `candidate_updates`) out of default brief.
- Do not surface helper-level control flow as a warning after successful close-out. For example, a clean-close refusal caused only by `session_boundary.action = continue` means the kernel would not auto-clear without an operator decision; an explicit `$ccd-radar` invocation is that decision.
- Translate continuity problems into operator-safe language.
- Report close-out as handled only after required handoff/recovery writes and session clear all succeed.
- Ask at most one direct question. If no input is needed, finish and say it is handled.
## Gather session state
1. Resolve CLI: `CCD_BIN` → `which ccd` → `$HOME/.ccd/bin/ccd` → `$HOME/.cargo/bin/ccd`. Do **not** fall back to `./target/debug/ccd`.

2. Run:
   ```bash
   ccd --output json handover \
     --since-session current \
     --fields command,mode,session_delta,handoff,git,thread,session_state,recovery,projection_telemetry,work_stream_decay,session_boundary,evaluation,candidate_updates,approval_steps,context_health,behavioral_drift,escalation,execution_gates \
     --path .
   ```
   Load `references/handover-schema.json` for field-level descriptions.
   Clean close-out: prefer `ccd --output json handover --close-clean --path .` when handover reports no material findings and no operator-authored handoff rewrite is needed; it clears the session only when there are no candidates, unfinished gates, or human-choice surfaces. If `close_clean.outcome` is `refused`, preserve the reason and use manual `--commit` only after deciding the candidate writes explicitly.
   Operator-invoked close-out: only a literal `$ccd-radar` request is approval to close the session after a clean evaluation. Verify clean state from the original handover JSON, not from the clean-close refusal: no handoff/memory candidates, no unfinished gates, no blocking escalation, and no drift signal. Then write the handoff for the current completed state, clear session state, and report only the successful outcome. Surface helper refusal only if it blocks completion, exposes material findings, or still needs developer input.
   Write coalescing fallback: append `--commit` and pipe JSON with optional `handoff`, `recovery`, `clear_session` fields to reduce 3-5 tool calls to 1.

3. If CLI is unavailable, see `references/radar-details.md` for fallback path.

## Evaluate session
Evaluate accomplishment, blockers, policy drift, behavioral drift, context health, and session boundary. Use `session_boundary` as primary recommendation, then `evaluation` buckets and `candidate_updates`.

**Classify findings:**
- **Clean:** no blockers, no drift, every `behavioral_drift.signals` entry `aligned`/`no_signal`. Common case.
- **Material findings:** blocker, retargeting needed, policy drift, or any `drift` signal. Requires human decision.

On clean evaluation → fast-path for checkpoint-style use: do not rewrite handoff if only live checkout context changed.
On explicit `$ccd-radar` close-out → write the handoff for the current completed state before clearing, after clean-state preconditions are verified from the handover JSON. A clean kernel boundary of `continue` is not a warning in this path; it only means the auto-clear helper did not infer operator intent.
On material findings → present findings, ask one question, draft correction. See `references/radar-details.md` for detailed evaluation rules.

## Execute handoff
Run in order without per-step confirmation.

1. **Uncommitted check:** use `git.*` fields from handover output (do not issue separate `git status`).
2. **Draft:** update handoff via `ccd handoff write --path .` with stdin JSON: `{"title": "...", "immediate_actions": [...], "completed_state": [...], "operational_guardrails": [...], "key_files": [...], "definition_of_done": [...]}`.
3. **Validate:** run `ccd doctor --path .` only if radar wrote to policy or other CCD-owned state surfaces.
4. **Clear session:** run `ccd session-state clear --path .`.
5. **Git hand-off:** route to `ccd-git-workflow` if the developer wants branch/PR workflow.

For extended evaluation rules, material findings prompt, fallback paths, and recovery handling, load `references/radar-details.md`.
