self-reflection
Use when reviewing agent behavior patterns, improving CLAUDE.md based on past failures, or checking ReasoningBank health. REQUIRES contextd MCP server - this skill is inoperable without it.
What this skill does
# Self-Reflection
Mine memories and remediations for behavior patterns, surface findings to user, remediate docs with pressure-tested improvements.
**Core loop:** Search -> Report -> User prioritizes -> Brainstorm -> Pressure test -> Apply
## When to Use
- Periodic review of agent behavior patterns
- After series of failures or poor outcomes
- Before major project milestones
- When CLAUDE.md feels stale or incomplete
- To check ReasoningBank health
## When NOT to Use
- Immediate error diagnosis -> use `contextd-workflow` skill
- Recording a single learning -> use `/remember`
- Checkpoint management -> use `contextd-workflow` skill
## Behavioral Taxonomy
Focus on **agent behaviors**, not technical failures:
| Behavior Type | Description | Examples |
|---------------|-------------|----------|
| **rationalized-skip** | Justified skipping required step | "too simple to test", "user implied consent" |
| **overclaimed** | Absolute language inappropriately | "ensures", "guarantees", "production ready" |
| **ignored-instruction** | Didn't follow CLAUDE.md/skill | Skipped contextd search, ignored TDD |
| **assumed-context** | Assumed without verification | Assumed permission, requirements, state |
| **undocumented-decision** | Significant choice without rationale | Changed architecture without comparison |
## Severity Overlay
| Severity | Combination |
|----------|-------------|
| **CRITICAL** | rationalized-skip + destructive/security operation |
| **HIGH** | rationalized-skip + validation skip, ignored-instruction |
| **MEDIUM** | overclaimed, assumed-context |
| **LOW** | undocumented-decision, style issues |
## The Report
For each finding, surface:
1. **Behavior Type** - Which taxonomy category
2. **Severity** - CRITICAL/HIGH/MEDIUM/LOW
3. **Evidence** - Memory/remediation IDs with excerpts
4. **Violated Instruction** - The skill/command/CLAUDE.md section ignored
5. **Suggested Fix** - Target doc and proposed change
6. **Pressure Scenario** - Test case from real failure
## Remediation Flow
```
Present findings
|
User selects findings to remediate
|
Generate doc improvements
|
Generate pressure scenarios (from real failures)
|
Run batch tests via subagents
|
Pass? --No--> Iterate
| Yes
Create Issue/PR
|
Apply changes
|
Close feedback loop:
memory_feedback(memory_id, helpful=true)
Tag original memories as remediated
```
## Behavioral Search Queries
```
# Rationalized skips
memory_search("skip OR skipped OR bypass OR ignored")
memory_search("too simple OR trivial OR obvious")
# User feedback indicating ignored instructions
memory_search("why did you OR should have OR forgot to")
# Assumptions without verification
memory_search("assumed OR without checking")
# Overclaiming
memory_search("ensures OR guarantees OR production ready")
```
Filter out technical bugs: Exclude memories with `error:*` tags or stack traces.
## ReasoningBank Health
`--health` flag analyzes:
- **Memory quality**: feedback rate, confidence distribution
- **Tag hygiene**: inconsistent tags needing consolidation
- **Stale content**: old memories without feedback
- **Remediation completeness**: missing fields
## Quick Reference
| Action | Command |
|--------|---------|
| Full report | `/reflect` |
| Health only | `/reflect --health` |
| Apply fixes | `/reflect --apply` |
| Recent only | `/reflect --since=7d` |
| Filter by behavior | `/reflect --behavior=rationalized-skip` |
| Filter by severity | `/reflect --severity=HIGH` |
## Anti-Patterns
| Mistake | Why It Fails |
|---------|--------------|
| Skipping pressure tests | "Fixed" docs don't actually prevent behavior |
| Modifying plugin source | Breaks on update; use includes |
| Auto-applying security fixes | High-stakes changes need review |
| Ignoring frequency | 10 TDD skips is systemic, not minor |
| Absolute claims in fixes | "This prevents X" -> "This helps reduce X" |
---
## Causal Chain Analysis
### Root Cause Tracing
Go beyond symptoms to find root causes:
```json
{
"finding_id": "ref_001",
"behavior": "rationalized-skip",
"symptom": "Skipped tests before claiming fix complete",
"causal_chain": [
{
"level": 1,
"cause": "Agent claimed fix without running tests",
"evidence": ["mem_123", "mem_124"]
},
{
"level": 2,
"cause": "CLAUDE.md test instruction buried in long section",
"evidence": ["claude_md_line_245"]
},
{
"level": 3,
"cause": "No PreToolUse hook enforcing test requirement",
"evidence": ["hooks.json missing enforcement"]
}
],
"root_cause": "Missing automated enforcement of test-before-fix policy",
"fix_target": "hooks.json + CLAUDE.md restructure"
}
```
### Chain Depth Levels
| Level | Description | Fix Location |
|-------|-------------|--------------|
| 1 | Immediate behavior | Agent prompt/skill |
| 2 | Missing guidance | CLAUDE.md/documentation |
| 3 | Missing enforcement | Hooks/automation |
| 4 | Systemic gap | Plugin/skill redesign |
### Multi-Incident Correlation
Find patterns across incidents:
```
causal_correlate(findings: [ref_001, ref_002, ref_003])
Returns:
shared_root_causes: [
{ cause: "Missing hook enforcement", incidents: [ref_001, ref_002] },
{ cause: "Ambiguous CLAUDE.md section", incidents: [ref_002, ref_003] }
]
recommended_fixes: [
{ target: "hooks.json", impact: "high", fixes_incidents: 2 }
]
```
---
## Comparative Benchmarks
### Behavior Metrics Over Time
Track improvement (or regression):
```json
{
"benchmark_period": "2026-01-01 to 2026-01-28",
"metrics": {
"rationalized_skip": {
"count": 5,
"previous_period": 12,
"trend": "improving",
"change_pct": -58
},
"ignored_instruction": {
"count": 8,
"previous_period": 6,
"trend": "regressing",
"change_pct": +33
},
"assumed_context": {
"count": 3,
"previous_period": 3,
"trend": "stable",
"change_pct": 0
}
}
}
```
### Benchmark Categories
| Metric | Target | Good | Warning | Critical |
|--------|--------|------|---------|----------|
| rationalized_skip/week | 0 | < 2 | 2-5 | > 5 |
| ignored_instruction/week | 0 | < 3 | 3-7 | > 7 |
| overclaimed/week | 0 | < 5 | 5-10 | > 10 |
| test_coverage_skip | 0% | < 5% | 5-15% | > 15% |
### Comparative Reports
```
/reflect --benchmark --compare-periods "2026-01" "2025-12"
Output:
| Behavior | Dec 2025 | Jan 2026 | Change |
|----------|----------|----------|--------|
| rationalized-skip | 12 | 5 | -58% |
| ignored-instruction | 6 | 8 | +33% |
Top Improvement: Hook enforcement reduced skips
Top Regression: New skills lack CLAUDE.md entries
```
---
## Behavioral Prediction
### Pattern-Based Prediction
Predict likely future failures based on patterns:
```json
{
"prediction": {
"behavior": "rationalized-skip",
"likelihood": 0.75,
"conditions": [
"Complex task with > 5 sub-steps",
"Time pressure mentioned in prompt",
"No explicit test requirement in task"
],
"historical_basis": ["mem_101", "mem_102", "mem_103"],
"prevention": "Add explicit test checkpoint to complex task prompts"
}
}
```
### Risk Factors
| Factor | Risk Increase | Mitigation |
|--------|---------------|------------|
| Task complexity > 5 steps | +40% skip risk | Explicit checkpoints |
| "Quick fix" language | +60% skip risk | Reject quick-fix framing |
| No acceptance criteria | +50% assumption risk | Require criteria |
| Security-adjacent code | +30% overclaim risk | Require review |
### Predictive Alerts
```json
{
"alert": "high_risk_task_detected",
"task_description": "Quick fix for authentication bug",
"risk_factors": ["quick_fix_language", "security_adjacent"],
"predicted_behaviors": ["rationalized-skip", "assumed-context"],
"recommended_guardrails": [
"Require explicit test plan before starting",
"Trigger consensus-review before merge"
]
}
```
### InterRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.