ccc-safety ยท diff

git:20260720.7ee5b5c to git:20260722.9d3ab82

9 added, 5 removed. Audit A to A.

---
name: ccc-safety
description: "Safety deck: what Commander's hooks caught for you โ€” dangerous actions blocked, auto-fixes applied, and where your tools fail most. A self-contained artifact."
allowed-tools:
- Read
- Bash
- Write
- AskUserQuestion
argument-hint: "[open | status]"
---
- # /ccc-safety โ€” Safety
+ # $ccc-safety โ€” Safety
The guardrails deck. CC Commander's hooks already journal every permission decision (`~/.claude/commander/analytics/permission-gate.jsonl`) and every tool failure (`~/.claude/commander/tool-failures.jsonl`). This turns them into one page: how many dangerous actions got blocked, how many were auto-fixed, and which tools/errors trip you up most (a Sniffly-style breakdown).
> ๐Ÿ”’ Privacy: read locally. Publishing uploads the artifact (counts, tool names, redacted error signatures) to your private claude.ai artifact URL โ€” private to your account, but it leaves the machine. Always ask before publishing; never publish automatically. Error text is redacted (sk-/Bearer/token patterns โ†’ [redacted]) before it ever reaches the page.
## How it routes
- On `/ccc-safety` with no argument, open a click-first picker:
+ On `$ccc-safety` with no argument, open a click-first picker:
```
AskUserQuestion:
question: "Safety โ€” how do you want it?"
options:
- ๐Ÿ›ฐ๏ธ Publish the deck โ€” a living Safety artifact: blocked actions, auto-fixes, failure hotspots
- ๐Ÿ—ฃ๏ธ Plain-English status โ€” narrate the headline numbers here, no jargon
```
- `/ccc-safety open` (or `snapshot`) โ†’ publish the deck. `/ccc-safety status` โ†’ narrate.
+ `$ccc-safety open` (or `snapshot`) โ†’ publish the deck. `$ccc-safety status` โ†’ narrate.
**Zero-state:** if `permission-gate.jsonl` and `tool-failures.jsonl` are both missing/empty, say so plainly โ€” "No guardrail activity logged yet โ€” the hooks fill this in as you work." Never render an error for an empty deck.
### ๐Ÿ›ฐ๏ธ Publish the deck
**LIVING PATTERN:** always render to the SAME file path (`scratchpad/ccc-safety-live.html`), then republish that same path with the Artifact tool โ€” same path, same URL, one living page.
Build the self-contained HTML with the plugin's own library:
```bash
mkdir -p scratchpad
node --input-type=module -e "
- import { readSafetyModel, buildSafetyHtml } from '${CODEX_PLUGIN_ROOT}/lib/safety-snapshot.js';
+ import { readSafetyModel, buildSafetyHtml } from '${CLAUDE_PLUGIN_ROOT}/lib/safety-snapshot.js';
import { writeFile } from 'node:fs/promises';
const now = Date.now();
const html = buildSafetyHtml(await readSafetyModel({ now }), { now });
await writeFile('scratchpad/ccc-safety-live.html', html);
console.log('wrote scratchpad/ccc-safety-live.html');
"
```
- Then **ask before publishing**, and publish `scratchpad/ccc-safety-live.html` with the Artifact tool (favicon ๐Ÿ›ก๏ธ). Republish the same path to the same URL if you've published it before. End with the artifact title + the headline: "blocked N dangerous actions, auto-fixed M."
+ **First publish this session** โ†’ ask before publishing (counts, tool names, redacted error signatures leave the machine for your private artifact URL). **Every later run of `$ccc-safety`** โ†’ invoking the skill again IS the refresh consent: republish the same file path to the same URL without re-asking. Publish `scratchpad/ccc-safety-live.html` with the Artifact tool (favicon ๐Ÿ›ก๏ธ). End with the artifact title + the headline: "blocked N dangerous actions, auto-fixed M." To refresh later: run `$ccc-safety` again โ€” same URL updates in place; viewers reload.
### ๐Ÿ—ฃ๏ธ Plain-English status
Run `readSafetyModel({})` and read the decision counts + top failing tool, then narrate caveman-simple: "Commander stopped N risky actions and quietly fixed M. Your Bash commands fail most โ€” usually timeouts." No jargon.
## The deck also links the others
The published artifact carries the shared **Commander decks** strip at the top โ€” one click (copy) away from the Cockpit, Mission Control, and Usage & Cost decks. Users always know the other decks exist.
+ > **On Codex:** some panels may be empty on Codex today โ€” Safety's failure hotspots, Mission Control's agent roster, and Usage's savings hero are fed from Claude-only hooks right now. A follow-up workstream wires the matching Codex telemetry.
+
---
> โš™๏ธ **Fable contract:** plan before build ยท verifier โ‰  worker ยท prove before alarm ยท loops need gates ยท leave durable state โ€” `rules/fable-method.md`
+
+ > (On Codex, present these options as a numbered list and ask the user to reply with a number โ€” AskUserQuestion is Claude-only.)