claude-reflect

作者 BayramAnnakov已验证

A self-learning system for Claude Code that captures corrections, positive feedback, and preferences — then syncs them to CLAUDE.md and AGENTS.md.

1,412
Stars
118
Forks
Python
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/BayramAnnakov/claude-reflect

快速入门

使用 claude-reflect 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

claude-reflect

GitHub stars Version License: MIT Tests Platform

A self-learning system for Claude Code that captures corrections and discovers workflow patterns — turning them into permanent memory and reusable skills.

What it does

1. Learn from Corrections

When you correct Claude ("no, use gpt-5.1 not gpt-5"), it remembers forever.

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  You correct    │ ──► │  Hook captures  │ ──► │  /reflect adds  │
│  Claude Code    │     │  to queue       │     │  to CLAUDE.md   │
└─────────────────┘     └─────────────────┘     └─────────────────┘
      (automatic)            (automatic)            (manual review)

2. Discover Workflow Patterns (NEW in v2)

Analyzes your session history to find repeating tasks that could become reusable commands.

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  Your past      │ ──► │ /reflect-skills │ ──► │   Generates     │
│  sessions       │     │ finds patterns  │     │   /commands     │
└─────────────────┘     └─────────────────┘     └─────────────────┘
    (68 sessions)         (AI-powered)            (you approve)

Example: You've asked "review my productivity" 12 times → suggests creating /daily-review

Key Features

FeatureWhat it does
Permanent MemoryCorrections sync to CLAUDE.md — Claude remembers across sessions
Skill DiscoveryFinds repeating patterns in your history → generates commands
Multi-languageAI understands corrections in any language
Skill ImprovementCorrections during /deploy improve the deploy skill itself

Installation

# Add the marketplace
claude plugin marketplace add bayramannakov/claude-reflect

# Install the plugin
claude plugin install claude-reflect@claude-reflect-marketplace

# IMPORTANT: Restart Claude Code to activate the plugin

After installation, restart Claude Code (exit and reopen). Then hooks auto-configure and commands are ready.

First run? When you run /reflect for the first time, you'll be prompted to scan your past sessions for learnings.

Prerequisites

  • Claude Code CLI installed
  • Python 3.6+ (included on most systems)

Platform Support

  • macOS: Fully supported
  • Linux: Fully supported
  • Windows: Fully supported (native Python, no WSL required)

Commands

CommandDescription
/reflectProcess queued learnings with human review
/reflect --scan-historyScan ALL past sessions for missed learnings
/reflect --dry-runPreview changes without applying
/reflect --targetsShow detected config files (CLAUDE.md, AGENTS.md)
/reflect --reviewShow queue with confidence scores and decay status
/reflect --dedupeFind and consolidate similar entries in CLAUDE.md
/reflect --include-tool-errorsInclude tool execution errors in scan
/reflect-skillsDiscover skill candidates from repeating patterns
/reflect-skills --days NAnalyze last N days (default: 14)
/reflect-skills --project <path>Analyze specific project
/reflect-skills --all-projectsScan all projects for cross-project patterns
/reflect-skills --dry-runPreview patterns without generating skill files
/skip-reflectDiscard all queued learnings
/view-queueView pending learnings without processing

How It Works

claude-reflect in action

Two-Stage Process

Stage 1: Capture (Automatic)

Hooks run automatically to detect and queue corrections:

HookTriggerPurpose
session_start_reminder.pySession startShows pending learnings reminder
capture_learning.pyEvery promptDetects correction patterns and queues them
check_learnings.pyBefore compactionBacks up queue and informs user
post_commit_reminder.pyAfter git commitReminds to run /reflect after completing work

Stage 2: Process (Manual)

Run /reflect to review and apply queued learnings to CLAUDE.md.

Detection Methods

Claude-reflect uses a hybrid detection approach:

1. Regex patterns (real-time capture)

Fast pattern matching during sessions detects:

  • Corrections: "no, use X" / "don't use Y" / "actually..." / "that's wrong"
  • Positive feedback: "Perfect!" / "Exactly right" / "Great approach"
  • Explicit markers: "remember:" — highest confidence

2. Semantic AI validation (during /reflect)

When you run /reflect, an AI-powered semantic filter:

  • Multi-language support — understands corrections in any language
  • Better accuracy — filters out false positives from regex
  • Cleaner learnings — extracts concise, actionable statements

Example: A Spanish correction like "no, usa Python" is correctly detected even though it doesn't match English patterns.

Each captured learning has a confidence score (0.60-0.95). The final score is the higher of regex and semantic confidence.

Human Review

When you run /reflect, Claude presents a summary table with options:

  • Apply - Accept the learning and add to CLAUDE.md
  • Edit before applying - Modify the learning text first
  • Skip - Don't apply this learning

Multi-Target Sync

Approved learnings are synced to:

  • ~/.claude/CLAUDE.md (global - applies to all projects)
  • ./CLAUDE.md (project-specific)
  • ./**/CLAUDE.md (subdirectories - auto-discovered)
  • ./.claude/commands/*.md (skill files - when correction relates to a skill)
  • AGENTS.md (if exists - works with Codex, Cursor, Aider, Jules, Zed, Factory)

Run /reflect --targets to see which files will be updated.

Skill Discovery

Run /reflect-skills to discover repeating patterns in your sessions that could become reusable skills:

/reflect-skills                 # Analyze current project (last 14 days)
/reflect-skills --days 30       # Analyze last 30 days
/reflect-skills --all-projects  # Analyze all projects (slower)
/reflect-skills --dry-run       # Preview patterns without generating files

Features:

  • AI-powered detection — uses reasoning, not regex, to find patterns
  • Semantic similarity — detects same intent across different phrasings
  • Project-aware — groups patterns by project, suggests correct location
  • Smart assignment — asks where each skill should go (project vs global)
  • Generates skill files — creates draft skills in .claude/commands/

How it works:

The skill discovers patterns by analyzing your session history semantically. Different phrasings of the same intent are recognized:

Session 1: "review my productivity for today"
Session 2: "how was my focus this afternoon?"
Session 3: "check my ActivityWatch data"
Session 4: "evaluate my work hours"

Claude reasons: "These 4 requests have the same intent - reviewing productivity data. The workflow is: fetch time tracking data → categorize activities → calculate focus score. This is a strong candidate for /daily-review."

Example output:

════════════════════════════════════════════════════════════
SKILL CANDIDATES DISCOVERED
════════════════════════════════════════════════════════════

Found 2 potential skills from analyzing 68 sessions:

1. /daily-review (High) — from my-productivity-tools
   → Review productivity using time tracking data
   Evidence: 15 similar requests
   Corrections learned: "use local timezone", "chat apps can be work"

2. /deploy-app (High) — from my-webapp
   → Deploy application with pre-flight checks
   Evidence: 10 similar requests
   Corrections learned: "always run tests first"

════════════════════════════════════════════════════════════

Which skills should I generate?
> [1] /daily-review, [2] /deploy-app

Where should each skill be created?
┌──────────────────────┬─────────────────────────┐
│ /daily-review        │ my-productivity-tools   │
│ /deploy-app          │ my-webapp               │
└──────────────────────┴─────────────────────────┘

Skills created:
  ~/projects/my-productivity-tools/.claude/commands/daily-review.md
  ~/projects/my-webapp/.claude/commands/deploy-app.md

Generated skill file example:

---
description: Deploy application with pre-flight checks
allowed-tools: Bash, Read, Write
---

## Context
Deployment scripts in ./scripts/deploy/

## Your Task
Deploy the application to the specified environment.

### Steps
1. Run test suite
2. Build production assets
3. Deploy to target environment
4. Verify deployment health

### Guardrails
- Always run tests before deploying
- Never deploy to production on Fridays
- Check for pending migrations

---
*Generated by /reflect-skills from 10 session patterns*

Skill Improvement Routing

When you correct Claude while using a skill (e.g., /deploy), the correction can be routed back to the skill file itself:

User: /deploy
Claude: [deploys without running tests]
User: "no, always run tests before deploying"

→ /reflect detects this relates to /deploy
→ Offers to add learning to .claude/commands/deploy.md
→ Skill file updated with new step

This makes skills smarter over time, not just CLAUDE.md.

Upgrading

From v2.0.x or earlier

If you see errors like "Duplicate hooks file detected" or "No such file or directory" after updating, you need to clear the plugin cache. This is due to known Claude Code caching issues:

  • #14061 - /plugin update doesn't invalidate cache
  • #15369 - Uninstall doesn't clear cached files
# 1. Uninstall the plugin
claude plugin uninstall claude-reflect@claude-reflect-marketplace

# 2. Clear both caches (required!)
rm -rf ~/.claude/plugins/marketplaces/claude-reflect-marketplace
rm -rf ~/.claude/plugins/cache/claude-reflect-marketplace

# 3. Exit Claude Code completely (restart terminal or close app)

# 4. Reinstall
claude plugin install claude-reflect@claude-reflect-marketplace

Standard Update

For normal updates (when no cache issues):

# Use the /plugin menu in Claude Code
/plugin
# Select "Update now" for claude-reflect

Uninstall

claude plugin uninstall claude-reflect@claude-reflect-marketplace

File Structure

claude-reflect/
├── .claude-plugin/
│   └── plugin.json         # Plugin manifest (auto-registers hooks)
├── commands/
│   ├── reflect.md          # Main command
│   ├── reflect-skills.md   # Skill discovery
│   ├── skip-reflect.md     # Discard queue
│   └── view-queue.md       # View queue
├── hooks/
│   └── hooks.json          # Auto-configured when plugin installed
├── scripts/
│   ├── lib/
│   │   ├── reflect_utils.py      # Shared utilities
│   │   └── semantic_detector.py  # AI-powered semantic analysis
│   ├── capture_learning.py       # Hook: detect corrections
│   ├── check_learnings.py        # Hook: pre-compact check
│   ├── post_commit_reminder.py   # Hook: post-commit reminder
│   ├── compare_detection.py      # Compare regex vs semantic detection
│   ├── extract_session_learnings.py
│   ├── extract_tool_errors.py
│   ├── extract_tool_rejections.py
│   └── legacy/                   # Bash scripts (deprecated)
├── tests/                  # Test suite
└── SKILL.md                # Skill context for Claude

Features

Historical Scan

First time using claude-reflect? Run:

/reflect --scan-history

This scans all your past sessions for corrections you made, so you don't lose learnings from before installation.

Smart Filtering

Claude filters out:

  • Questions (not corrections)
  • One-time task instructions
  • Context-specific requests
  • Vague/non-actionable feedback

Only reusable learnings are kept.

Duplicate Detection

Before adding a learning, existing CLAUDE.md content is checked. If similar content exists, you can:

  • Merge with existing entry
  • Replace the old entry
  • Skip the duplicate

Semantic Deduplication

Over time, CLAUDE.md can accumulate similar entries. Run /reflect --dedupe to:

  • Find semantically similar entries (even with different wording)
  • Propose consolidated versions
  • Clean up redundant learnings

Example:

Before:
  - Use gpt-5.1 for complex tasks
  - Prefer gpt-5.1 for reasoning
  - gpt-5.1 is better for hard problems

After:
  - Use gpt-5.1 for complex reasoning tasks

Tips

  1. Use explicit markers for important learnings:

    remember: always use venv for Python projects
    
  2. Run /reflect after git commits - The hook reminds you, but make it a habit

  3. Historical scan on new machines - When setting up a new dev environment:

    /reflect --scan-history --days 90
    
  4. Project vs Global - Model names and general patterns go global; project-specific conventions stay in project CLAUDE.md

  5. Discover skills monthly - Run /reflect-skills --days 30 monthly to find automation opportunities you might have missed

  6. Skills get smarter - When you correct Claude during a skill, that correction can be routed back to the skill file itself via /reflect

  7. Extend session retention - Claude Code deletes local sessions after 30 days by default. Since claude-reflect relies on session history for /reflect --scan-history and /reflect-skills, extend this in ~/.claude/settings.json:

    { "cleanupPeriodDays": 99999 }
    

Contributing

Pull requests welcome! Please read the contributing guidelines first.

License

MIT

常见问题

What is claude-reflect?

claude-reflect is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by BayramAnnakov. A self-learning system for Claude Code that captures corrections, positive feedback, and preferences — then syncs them to CLAUDE.md and AGENTS.md. It has 1,412 GitHub stars.

Is claude-reflect safe to use?

Yes. claude-reflect passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install claude-reflect?

Clone the repository with "git clone https://github.com/BayramAnnakov/claude-reflect" and add it to your Claude Code skills directory (see the Installation section above). claude-reflect ships a SKILL.md manifest, so compatible agents can discover and load it automatically.

What programming language is claude-reflect written in?

claude-reflect is primarily written in Python. It is open-source under BayramAnnakov on GitHub, so you can review or fork the full source.

Are there alternatives to claude-reflect?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-reflect against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情