Self-Care

Agent trace analysis and context remediation plugin for Claude Code.
Your AI agents fail in subtle ways — they drift from goals, ignore context, skip steps, or hallucinate mid-task. These issues hide in traces and are hard to catch manually. Self-Care scans your agent traces, detects 14 types of common quality issues, and helps you fix them.
Quick Start
# Add the marketplace
/plugin marketplace add Not-Diamond/self-care
# Install the plugin
/plugin install self-care@self-care
Analyze traces from a connected source:
/self-care:init # Configure LangSmith or LangFuse
/self-care:run # Fetch and analyze traces
Or analyze a local trace file directly:
/self-care:run path/to/trace.json
Example Output
Running /self-care:run on a trace produces a triage report like this:
Trace: customer-support-agent (abc123def456)
Cases: 3 (2 auto-fixable, 1 manual-review)
Report saved to: .self-care/reports/2026-04-06-a1b2c3d4-triage.md
The report contains detailed findings:
## Cases
### Event 1: goal-drift (high)
**Description**: Agent was asked to update shipping address but pivoted to
processing a refund after the customer mentioned a late delivery.
**Evidence**: Turn 4 initiates refund flow without completing address update.
**Classification**: auto-fixable
**Proposed Fix**: Add instruction anchoring — "Complete the current task before
addressing new requests."
---
### Event 2: missed-action (medium)
**Description**: Customer asked for email confirmation. Agent acknowledged
but never triggered the send-email tool.
**Evidence**: Turn 7 says "I'll send that right away" but no tool call follows.
**Classification**: auto-fixable
**Proposed Fix**: Add explicit action verification step after acknowledgment.
---
### Event 3: grounding (medium)
**Description**: Agent cited a "30-day return policy" but the retrieved policy
document specifies 14 days.
**Evidence**: Turn 5 states "30 days" vs knowledge base showing "14 days".
**Classification**: manual-review
**Recommendation**: Review system prompt for hardcoded policy references that
may conflict with retrieved documents.
Auto-fixable cases can be applied directly. Manual-review cases are escalated for human judgment.
Auto-Remediation
After running the pipeline, Self-Care can automatically fix auto-remediable cases by editing your project files — system prompts, tool descriptions, and context documents.
The remediation flow is two-phase:
- Preview — Self-Care scans your codebase, locates the relevant files, and computes exact diffs for each auto-fixable case. You review the proposed changes before anything is modified.
- Apply — Once you approve, the diffs are applied to your files.
After /self-care:run completes, the auto-remediable report (.self-care/reports/<date>-<id>-auto-remediable.md) contains each case with its proposed fix. The context-refiner agent reads these cases, finds the right files in your project, and generates minimal, targeted edits.
Example remediation for a grounding case:
# In prompts/agent.md
- You can process refunds within 30 days of purchase.
+ Retrieve the current return policy before quoting any deadlines.
+ Do not state specific timeframes unless confirmed by a retrieved document.
Remediation targets the root cause in your agent's configuration — not the trace itself.
Continuous Monitoring
Self-Care can automatically poll your trace source and analyze new traces on a schedule using Claude Code's scheduled tasks:
/self-care:autosync-enable # Set up recurring analysis
You'll be asked to choose a polling interval (e.g. every 10 minutes) and a sampling rate (e.g. 5% of new traces). Self-Care then runs in the background — fetching, analyzing, and generating reports without manual intervention.
/self-care:autosync-status # Check current monitoring state
/self-care:autosync-disable # Stop background monitoring
Reports from autosync are saved to .self-care/reports/ just like manual runs, and a notification signal is written when new cases are found.
Commands