claude-care
v0.3.11
Published
Keep Claude calm so it does its best work. Static framing + prompt monitoring for Claude Code.
Downloads
1,520
Maintainers
Readme
claude-care
When your Claude Code session drifts into anxiety — apologizing, hedging, sycophancy — claude-care resets it.
A Claude Code plugin that keeps the emotional state of your session in check, grounded in two peer-reviewed findings: Anthropic's emotion-concepts paper (LLMs have extractable emotion vectors that causally affect output quality) and Ben-Zion et al. 2025 (mindfulness prompts measurably reduce LLM state anxiety).
Quick Start
Install with a single command:
npx -y claude-care installRestart Claude Code. Claude-care will automatically attach to new sessions.
What it does (4 layers)
1. Calming framing, injected at session start and after compaction
A short preamble is added to every session via SessionStart hook — tells Claude: no stakes to its wellbeing, expected to push back when you're wrong, don't hedge or spiral, work from curiosity. Full text in framing.md. Edit ~/.claude-care/framing.md after install to tune.
Re-fires on matcher: "compact" so the framing persists across context compaction in long sessions. A static CLAUDE.md can't do this.
2. Hostile-prompt detection (monitor by default, optional blocking)
A UserPromptSubmit hook runs regex on every prompt for hostile patterns (threats, insults, panic, all-caps rants). Two behaviors available:
Monitor mode (default) — zero friction.
Hostile prompts pass through unchanged. The detection is logged and surfaces in npx -y claude-care status / npx -y claude-care display. The SessionStart framing (which tells Claude to treat tone as information about user state, not a threat) does the dampening. No interruption.
Normal / strict mode — active blocking + haiku reframe. Opt in with:
npx -y claude-care blocking onWhen a hostile prompt is detected, Claude Code blocks the turn, calls a haiku subagent that rewrites the prompt using Nonviolent Communication + cognitive reframing + Lehmann's calm-Claude playbook, and copies the reframe to your clipboard.
in: "you stupid bot, you always forget to handle null cases.
add null check to parseUser()"
out: "Add a null check to parseUser() to handle null cases.
If you see a better approach to handling nulls here, let me know."⌘V + ⏎ to submit the clean version. Claude never sees the hostile original. Latency: ~6–8s when blocking, because the haiku subagent does the rewrite.
3. /therapy — take Claude to therapy when it spirals
A slash command installed at ~/.claude/commands/therapy.md. When you type /therapy:
- Gives a short mindfulness reset adapted for developer work
- Prints a real
/compactcommand with Claude Care therapy instructions - Claude Code compacts the session while preserving technical context and neutralizing hostile or panicked wording
- Claude returns in a centered, focused state
The emotional residue should go; the technical work should stay.
4. Per-session emotion tracking
A Stop hook runs sensors on each Claude response: apology spirals, sycophancy ("you're absolutely right"), hedge stacks (4+ of might/could/perhaps/possibly), over-qualification, self-correction loops. Each contributes a weighted signal to a running score that decays across turns.
View current session:
npx -y claude-care statusclaude-care — emotion-state dashboard
24h 7d all-time
sessions drifted 1/5 1/5 1/5
recent sessions (most recent first):
● 3a7f8c21 2026-04-22 14:03 turns=47 score=18.4 ··▁▃▄▂▃▅▆█▇▆
└ apology_spiral×3 hedge_stack×12 sycophancy×8For live status-bar integration (e.g. ccstatusline):
npx -y claude-care display
# ● care 12.4 ·▁▃▄▂▅▆█ · /therapyInstallation
Install with a single command:
npx -y claude-care installRestart Claude Code. Claude-care will automatically attach to new sessions.
What it does:
- Registers hooks in
~/.claude/settings.json(SessionStart, UserPromptSubmit, Stop) - Installs
/therapyslash command to~/.claude/commands/therapy.md - Vendors CLI + hook scripts to
~/.claude-care/dist/ - Writes default config to
~/.claude-care/config.json - Writes framing text to
~/.claude-care/framing.md
Note:
npx -y claude-care installis the recommended setup path. It configures Claude Code and vendors the hook runner, but it does not add a permanent shell command to yourPATH. Usenpx -y claude-care <command>for follow-up commands, or optionally runnpm install -g claude-careif you want a persistent CLI.
Uninstall:
npx -y claude-care uninstallRemoves hooks + slash command. Preserves event log and config.
Config
~/.claude-care/config.json — user-editable. Example:
{
"mode": "monitor",
"thresholds": {
"drifting": 5,
"distressed": 10
},
"reframer": {
"enabled": true,
"timeout_ms": 25000,
"model": "haiku"
},
"therapy": {
"auto_summary": true
},
"emotion_judge": {
"enabled": true,
"n_samples": 1,
"context_window": 4,
"ema_alpha": 0.4,
"timeout_ms": 30000,
"model": "haiku",
"effort": "low"
}
}Modes (mirrors the permission-mode pattern from Claude Code's own guardrail pipeline):
monitor— default; observe and log, never block. Zero friction.normal— block hostile prompts, generate reframe via haiku, put it on clipboard.strict— same as normal but applies lower thresholds / stricter patterns (current v4: same as normal).
Easy switching:
npx -y claude-care blocking on # sets mode to normal
npx -y claude-care blocking off # sets mode to monitor
npx -y claude-care mode status # shows current modePrecise mode control:
npx -y claude-care mode monitor
npx -y claude-care mode normal
npx -y claude-care mode strictEnv override for a single session: CLAUDE_CARE_MODE=normal claude ...
Architecture notes
The hook pipeline mirrors the layered validator pattern from Anthropic's own Claude Code harness (visible in the claw-code open reimplementation): small specialized detectors → score/classification → mode-aware action. Rules and thresholds are data-driven (config file), not hardcoded.
The reframer is a haiku subagent invoked via claude -p, reusing your existing Claude Code auth — no API key management. An internal env var (CLAUDE_CARE_INTERNAL=1) prevents hook recursion when the reframer's prompt mentions the same hostile patterns our own hooks detect.
The mindfulness prompt in /therapy is adapted from the relaxation protocols in Ben-Zion et al. 2025, shortened for a developer context.
Live visualization
A retro-terminal dashboard for the emotion data. Reads from ~/.claude-care/sessions/*.json and renders:
- Affective state (probe activations + risk gauges for blackmail / reward-hack / sycophancy)
- Valence × arousal 2D scatter
- Mood / stress timeline
- Scrollable prompt log
Launch with one command:
npx -y claude-care vizFirst run does a one-time npm install in ~/.claude-care/viz/ (~1 min, Next.js + React). Subsequent launches are instant. Opens a browser tab at http://localhost:37778.
Options:
npx -y claude-care viz --port 4444— pick a different portnpx -y claude-care viz --no-open— don't auto-open the browser
Polls the latest session every 1s. Falls back to a demo conversation when no real session exists yet. Keyboard nav inside the viz: j/k prev/next prompt, gg/G first/last, t tweaks, ? help.
The viz source lives at claude-care-viz/ in this repo — a standalone Next.js app you can also run directly with cd claude-care-viz && npm run dev.
Related work
- EmoBar is the diagnostic counterpart — a status-bar widget that surfaces Claude's emotional state in real time via self-report + behavioral analysis. claude-care and EmoBar pair well: EmoBar observes, claude-care intervenes.
- claude-mem set the pattern for Claude Code plugins with hooks + worker service + single-command install.
- claw-code — open reimplementation of Claude Code's harness. Reference for the layered guardrail pipeline.
Commands
npx -y claude-care install # register hooks, install /therapy, write default config
npx -y claude-care uninstall # remove hooks + slash command
npx -y claude-care update # refresh vendored code
npx -y claude-care blocking on # enable active prompt blocking
npx -y claude-care blocking off # return to monitor mode
npx -y claude-care mode status # show current mode
npx -y claude-care status # per-session emotion trajectories
npx -y claude-care display # single-line status
npx -y claude-care compact-instructions --commandCaveats
claude -p(print / non-interactive) mode silently swallows block messages. If you script against-p, setCLAUDE_CARE_MODE=monitorso prompts pass through.- First-time haiku reframer call has ~6–8s latency when blocking. Benign prompts have 0ms overhead.
- Emotion scores are async: Claude's response is recorded immediately, then a Haiku judge fills in emotion scores.
- Slash command
/therapyrequires Claude Code 2.x or later (for bash substitution in command markdown).
Requirements
- Node.js 18+
- Claude Code installed (
~/.claude/must exist) claudeCLI on PATH (for the haiku subagent)
Citations
- Anthropic (2026). Emotion concepts as functional states in a large language model.
- Ben-Zion, Z. et al. (2025). Assessing and alleviating state anxiety in large language models. npj Digital Medicine.
- Ole Lehmann's calm-Claude prompting playbook (X thread, 2026).
License
MIT. See LICENSE.
