claude-reflect
CLAUDE.md1.7k starsChanged 11 months agoMITView on GitHub
claude-reflect is a Claude Code plugin that implements a two-stage self-learning system: 1. Capture Stage (automatic): Hooks detect correction patterns in user prompts and queue them 2. Process Stage (manual): /reflect command processes queued learnings with human review and writes to CLAUDE.md files The plugin registers via .claude-plugin/plugin.json: - Hooks are defined in hooks/hooks.json - Commands (skills) are markdown files in commands/ - SKILL.md provides context when the plugin is active
Trending
Less talk lately.about the whole repository
Who's talking about BayramAnnakov/claude-reflect
- A Hacker News story“Show HN: Claude Reflect – Auto-turn Claude corrections into project config”Hacker News · Jan 4, 2026 · 75 points
- @jonathanchannon.com“Have you seen this? github.com/BayramAnnako...”Bluesky · Jan 6, 2026 · 1 likes
- @hackernewsbot.bsky.social“Show HN: Claude Reflect – Auto-turn Claude corrections into project config | Discussion”Bluesky · Jan 4, 2026 · 1 likes
- sudosubin/agents.nix“claude-code-plugins.github.bayramannakov.claude-reflect: init at 3.3.1”GitHub · Oct 4, 2026
- sudosubin/agents.nix“claude-code-marketplaces.github.bayramannakov.claude-reflect: init at 3.3.1”GitHub · Oct 4, 2026
The biggest 5 of 20 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 20
Talked about on GitHub, Bluesky and Hacker News (20 times).
On GitHub · 17
- Oct 4, 2026claude-code-plugins.github.bayramannakov.claude-reflect: init at 3.3.1 — sudosubin/agents.nix0 reactions
- Oct 4, 2026claude-code-marketplaces.github.bayramannakov.claude-reflect: init at 3.3.1 — sudosubin/agents.nix0 reactions
- Oct 3, 2026agent-skills.github.bayramannakov.claude-reflect: 3.2.0 → 3.3.1 — sudosubin/agents.nix0 reactions
- Sep 25, 2026agent-skills.github.bayramannakov.claude-reflect: init at 3.2.0 — sudosubin/agents.nix0 reactions
- Sep 24, 2026docs(cc-community): screenshot-lead research batch 01 (plan 0008 row 20) — qte77/ai-agents-research0 reactions
12 more on GitHub
- Aug 14, 2026Detecteer skill-kandidaten uit sessiecorrecties via de ceda-reflect plugin — cedanl/.github0 reactions · 3 comments
- Aug 14, 2026[claude-reflect port, PR 4/4] Polish: contradiction-aware consolidate, commit-boundary closeout nudge, doctor checks for Tier-0 size and session retention — zaxbysauce/zmem0 reactions · 2 comments
- Aug 14, 2026[claude-reflect port, PR 3/4] Cold-start bootstrap: mine historical session transcripts, with cross-session error aggregation — zaxbysauce/zmem0 reactions · 1 comment
- Aug 14, 2026[claude-reflect port, PR 2/4] Live correction capture: UserPromptSubmit candidate queue reviewed at /closeout — zaxbysauce/zmem0 reactions · 1 comment
- Aug 14, 2026[claude-reflect port, PR 1/4] Transcript correction mining core: rejection/failure split, correction pattern library, pattern tuning harness — zaxbysauce/zmem0 reactions · 2 comments
- Jul 8, 2026Update skill sources from monitor run 28885607713 — aiskillstore/marketplace0 reactions
- Apr 25, 2026Audit candidate: BayramAnnakov/claude-reflect — xiaolai/nlpm0 reactions · 100 comments
- Apr 16, 2026ACMM outreach: Claude Reflect — kubestellar/console0 reactions
- Jan 10, 2026New plugins: 274 skills from claude-reflect (medium risk) — aiskillstore/marketplace0 reactions
- Jan 5, 2026Add resource: claude-reflect — hesreallyhim/awesome-claude-code0 reactions
- Jan 4, 2026Add claude-reflect to community plugins — jeremylongshore/tons-of-skills-marketplace0 reactions · 3 comments
- Jan 4, 2026Add claude-reflect to Workflow Orchestration — ccplugins/awesome-claude-code-plugins0 reactions · 1 comment
On Bluesky · 2
- Jan 6, 2026Have you seen this? github.com/BayramAnnako... — @jonathanchannon.com1 likes and repost · 1 reply
- Jan 4, 2026Show HN: Claude Reflect – Auto-turn Claude corrections into project config | Discussion — @hackernewsbot.bsky.social1 likes and repost
On Hacker News · 1
- Jan 4, 2026Show HN: Claude Reflect – Auto-turn Claude corrections into project config75 points · 28 comments
In this repositoryOne other file it gives its agents.
- claude-reflectSkill
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 168
When running /reflect, corrections made during skill execution can be routed back to the skill file itself.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
claude-reflect is a Claude Code plugin that implements a two-stage self-learning system:
- Capture Stage (automatic): Hooks detect correction patterns in user prompts and queue them
- Process Stage (manual):
/reflectcommand processes queued learnings with human review and writes to CLAUDE.md files
Architecture
.claude-plugin/plugin.json → Plugin manifest, points to hooks
hooks/hooks.json → Hook definitions (PreCompact, PostToolUse)
scripts/ → Python scripts for hooks and extraction
scripts/lib/ → Shared utilities (reflect_utils.py)
scripts/legacy/ → Deprecated bash scripts (for reference)
commands/*.md → Skill definitions for /reflect, /reflect-skills, /skip-reflect, /view-queue
SKILL.md → Context provided when plugin is invoked
tests/ → Test suite (pytest)Data Flow
- User prompt →
capture_learning.py(UserPromptSubmit hook) →~/.claude/learnings-queue.json /reflectcommand → reads queue + scans sessions → filters/dedupes → routes to memory targets- Session files live at
~/.claude/projects/[PROJECT_FOLDER]/*.jsonl
Memory Targets (Full Hierarchy)
| Target | Path | Type | Description |
| Global CLAUDE.md | ~/.claude/CLAUDE.md | global | Always enabled |
| Project CLAUDE.md | ./CLAUDE.md | root | Project-specific |
| CLAUDE.local.md | ./CLAUDE.local.md | local | Personal, gitignored |
| Subdirectory | ./**/CLAUDE.md | subdirectory | Auto-discovered |
| Project Rules | ./.claude/rules/*.md | rule | Modular, path-scoped |
| User Rules | ~/.claude/rules/*.md | user-rule | Global modular rules |
| Auto Memory | ~/.claude/projects/<project>/memory/*.md | auto-memory | Low-confidence staging |
| Skill Files | ./commands/*.md | skill | Correction during skill use |
| AGENTS.md | ./AGENTS.md | agents | Cross-tool standard |
Key Files
scripts/lib/reflect_utils.py: Shared utilities (paths, queue ops, regex detection, memory hierarchy discovery, auto memory, rule frontmatter parsing)scripts/lib/semantic_detector.py: AI-powered semantic analysis viaclaude -pscripts/capture_learning.py: Pattern detection (correction, positive, explicit markers) with confidence scoringscripts/check_learnings.py: PreCompact hook that backs up queue before context compactionscripts/extract_session_learnings.py: Extracts user messages from session JSONL filesscripts/extract_tool_rejections.py: Extracts user corrections from tool rejectionsscripts/compare_detection.py: Compare regex vs semantic detection on session datacommands/reflect.md: Main skill defining the /reflect workflow (memory hierarchy aware)commands/reflect-skills.md: Skill discovery - AI-powered pattern detection from sessions
Development Commands
# Test capture hook with simulated input
echo '{"prompt":"no, use gpt-5.1 not gpt-5"}' | python3 scripts/capture_learning.py
# View current learnings queue
cat ~/.claude/learnings-queue.json
# Test session extraction
python3 scripts/extract_session_learnings.py ~/.claude/projects/[PROJECT]/*.jsonl --corrections-only
# Run tests
python -m pytest tests/ -v
# Clear queue for testing
echo "[]" > ~/.claude/learnings-queue.jsonPlugin Structure
The plugin registers via .claude-plugin/plugin.json:
- Hooks are defined in
hooks/hooks.json - Commands (skills) are markdown files in
commands/ SKILL.mdprovides context when the plugin is active
Hook Events
| Hook | Script | Purpose |
| SessionStart | session_start_reminder.py | Show pending learnings reminder |
| UserPromptSubmit | capture_learning.py | Detect corrections and queue them |
| PreCompact | check_learnings.py | Backup queue before compaction |
| PostToolUse (Bash) | post_commit_reminder.py | Remind to /reflect after commits |
Detection Methods
Regex Patterns (Real-time)
scripts/lib/reflect_utils.py defines pattern detection:
- Corrections: "no, use X", "don't use", "stop using", "that's wrong", "actually", "use X not Y"
- Positive: "perfect!", "exactly right", "great approach", "nailed it"
- Explicit: "remember:" prefix (highest confidence)
Confidence scores range 0.60-0.90 based on pattern strength and count.
Semantic AI Validation (During /reflect)
scripts/lib/semantic_detector.py provides AI-powered validation:
- Uses
claude -p --output-format jsonfor semantic analysis - Multi-language support — works for any language, not just English
- Better accuracy — filters out false positives from regex
- Cleaner learnings — extracts concise, actionable statements
Key functions:
semantic_analyze(text)— analyze single messagevalidate_queue_items(items)— batch validate queue items
Fallback: If Claude CLI is unavailable, regex detection is used as fallback.
Comparison Testing
scripts/compare_detection.py compares regex vs semantic detection:
python scripts/compare_detection.py --project .Session File Format
Session files are JSONL at ~/.claude/projects/[PROJECT_FOLDER]/:
- User messages:
{"type": "user", "message": {"content": [{"type": "text", "text": "..."}]}, "isMeta": false} - Tool rejections:
{"type": "user", "message": {"content": [{"type": "tool_result", "is_error": true, "content": "...the user said:\n[feedback]"}]}} - Filter
isMeta: trueto exclude command expansions
Queue Item Structure
{
"type": "auto|explicit|positive|guardrail",
"message": "user's original text",
"timestamp": "ISO8601",
"project": "/path/to/project",
"patterns": "matched pattern names",
"confidence": 0.75,
"sentiment": "correction|positive",
"decay_days": 90
}Skill Discovery (/reflect-skills)
Analyzes session history to discover repeating patterns that could become skills.
Design Principles:
- AI-powered — Claude uses reasoning to identify patterns, not regex
- Semantic similarity — detects same intent across different phrasings
- Human-in-the-loop — user approves before skill generation
Usage:
/reflect-skills # Analyze last 14 days
/reflect-skills --days 30 # Analyze last 30 days
/reflect-skills --dry-run # Preview without generating filesWhat it detects:
- Workflow patterns (repeated multi-step sequences)
- Misunderstanding patterns (corrections that could become guardrails)
- Intent similarity (same goal, different wording)
Skill Improvement Routing
When running /reflect, corrections made during skill execution can be routed back to the skill file itself.
How it works:
/reflectdetects when a correction followed a skill invocation (e.g.,/deploy)- Claude reasons about whether the correction relates to the skill's workflow
- User is offered routing options: skill file | CLAUDE.md | both
- Skill file is updated in the appropriate section (steps, guardrails, etc.)
Example:
User: /deploy
Claude: [deploys without running tests]
User: "no, always run tests before deploying"
→ /reflect detects this relates to /deploy
→ Offers to add "Run tests before deploying" to commands/deploy.md
→ Skill file updated with new step in workflowPlatform Support
- macOS: Fully supported
- Linux: Fully supported
- Windows: Fully supported (native Python, no WSL required)
Requires Python 3.6+.
Releasing
See RELEASING.md for version bump checklist and release process.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

