Skip to content
Agent Memory
Command

/reflect

Reflect on session corrections and update CLAUDE.md (with human review)

From plugin
claude-reflect
1.9k4 skills4 commands4 hooks
> /plugin marketplace add BayramAnnakov/claude-reflect
> /plugin install claude-reflect@claude-reflect-marketplace

Command definition

reflect.md
description: Reflect on session corrections and update CLAUDE.md (with human review)
allowed-tools: Read, Edit, Write, Glob, Bash, Grep, AskUserQuestion, TodoWrite

Arguments

  • `--dry-run`: Preview all changes without prompting or writing.
  • `--scan-history`: Scan ALL past sessions for corrections (useful for first-time setup or cold start).
  • `--days N`: Limit history scan to last N days (default: 30). Only used with `--scan-history`.
  • `--targets`: Show detected AI assistant config files and exit.
  • `--review`: Show learnings with stale/decayed entries for review.
  • `--dedupe`: Scan CLAUDE.md for similar entries and propose consolidations.
  • `--organize`: Analyze memory hierarchy and suggest reorganization across tiers.
  • `--include-tool-errors`: Include project-specific tool execution errors in scan (auto-enabled with `--scan-history`).
  • `--model MODEL`: Model for semantic analysis (default: `sonnet`). Use `haiku` for faster/cheaper runs or `opus` for maximum accuracy.

Context

  • Project CLAUDE.md: @CLAUDE.md
  • Global CLAUDE.md: @~/.claude/CLAUDE.md
  • Learnings queue (per-project): !`python3 "${CLAUDE_PLUGIN_ROOT}/scripts/read_queue.py" 2>/dev/null || echo "[]"`
  • Current project: !`pwd`

Multi-Target Export

Claude-reflect syncs learnings to CLAUDE.md files (including subdirectories), skill files, and AGENTS.md.

**Supported Targets:**

| Target | File Path | Format | Notes | |--------|-----------|--------|-------| | **Global CLAUDE.md** | `~/.claude/CLAUDE.md` | Markdown | Always enabled | | **Project CLAUDE.md** | `./CLAUDE.md` | Markdown | If exists | | **CLAUDE.local.md** | `./CLAUDE.local.md` | Markdown | Personal, gitignored | | **Subdirectory CLAUDE.md** | `./**/CLAUDE.md` | Markdown | Auto-discovered | | **Project Rules** | `./.claude/rules/*.md` | Markdown | Modular rules, optional path-scoping | | **User Rules** | `~/.claude/rules/*.md` | Markdown | Global modular rules | | **Referenced Docs** | docs reachable via `@` or markdown links | Markdown | Bounded inclusion-graph traversal from memory files | | **Skill Files** | `./commands/*.md` | Markdown | When correction relates to skill | | **Auto Memory** | `~/.claude/projects/<project>/memory/*.md` | Markdown | Low-confidence, exploratory learnings | | **AGENTS.md** | `./AGENTS.md` | Markdown | Industry standard (Codex, Cursor, Aider, Jules, Zed, Factory) |

**Target Discovery:**

Use the Python utility to find all memory tier files:

import sys; sys.path.insert(0, "${CLAUDE_PLUGIN_ROOT}/scripts")  # bundled, not cwd-relative
from lib.reflect_utils import find_claude_files
files = find_claude_files()
# Returns list of {path, relative_path, type, frontmatter}
# Types: 'global', 'root', 'local', 'subdirectory', 'rule', 'user-rule', 'referenced'
# 'referenced' files are docs reachable from memory files via @-includes or
# markdown links; they include 'referenced_from' and 'depth' fields.

Or discover manually:

# Find all CLAUDE.md files (excluding node_modules, .git, venv, etc.)
find . -name "CLAUDE.md" -type f \
  -not -path "*/node_modules/*" \
  -not -path "*/.git/*" \
  -not -path "*/venv/*" \
  -not -path "*/.venv/*"
# Also check rule files and local
ls .claude/rules/*.md 2>/dev/null
ls CLAUDE.local.md 2>/dev/null
ls ~/.claude/rules/*.md 2>/dev/null

**Target Selection (Hierarchy-Aware Routing):**

  • **Guardrail corrections** ("don't do X") → `.claude/rules/guardrails.md`
  • **Model preferences** → existing model-preferences rule file or `~/.claude/CLAUDE.md`
  • **Global behavioral** (always/never/prefer) → `~/.claude/CLAUDE.md`
  • **Path-scoped** (learning mentions directory covered by rule's `paths:`) → that rule file
  • **Personal/local** (machine-specific, not for team) → `./CLAUDE.local.md`
  • **Low-confidence** (0.60-0.74) → auto memory for later promotion
  • **Project-specific** → `./CLAUDE.md` or subdirectory file
  • **Topic-aligned referenced docs** (e.g. `standards.md`, `architecture.md` reached via `@` or markdown links from CLAUDE.md / AGENTS.md) → that doc, when the learning matches its topic
  • Let users override routing with AI reasoning

**Note on Confidence & Decay:**

  • Confidence scores help prioritize learnings during `/reflect` review
  • Decay applies to **queue items only** — if a learning sits unprocessed for too long, it's flagged as stale
  • Once applied to CLAUDE.md, entries are permanent (edit manually to remove)

Your Task

MANDATORY: Initialize Task Tracking (Step 0)

**BEFORE starting any work**, use TodoWrite to create a task list for the entire workflow. This ensures no steps are skipped and provides visibility into progress.

**Why this is critical:**

  • The /reflect workflow has 10+ phases that must execute in order
  • Without tracking, Claude may skip steps or lose context
  • TodoWrite acts as a checkpoint system ensuring completeness

**Initialize with this task list (adjust based on arguments):**

TodoWrite tasks for /reflect:
1. "Parse arguments and check flags" (--dry-run, --scan-history, etc.)
2. "Load learnings queue for this project (path from project_paths.py)"
3. "Scan historical sessions" (if --scan-history)
4. "Validate learnings with semantic analysis"
5. "Filter by project context (global vs project-specific)"
6. "Deduplicate similar learnings"
7. "Check for duplicates in existing CLAUDE.md"
8. "Present summary and get user decision"
9. "Apply changes to CLAUDE.md/AGENTS.md"
10. "Clear queue and confirm completion"

**Workflow rules:**

  • **Mark in_progress BEFORE starting each step** - this signals what's happening
  • **Mark completed IMMEDIATELY after finishing** - don't batch updates
  • **Only ONE task should be in_progress at a time**
  • **Never skip a step** - if a step doesn't apply, mark it completed with a note
  • **If blocked or error occurs**, keep task as in_progress and create a new task for the blocker

**Example TodoWrite call at start:**

{
  "todos": [
    {"content": "Parse arguments (--scan-history detected)", "st
Read more
@bayramannakov
Ships withclaude-reflect

A self-learning system for Claude Code that captures corrections and discovers workflow patterns — turning them into permanent memory and reusable skills. Two ways to run it: Pick one. Install the plugin or the mod.

Stars on GitHub

Momentum

stars in total
1.9k
Star history of BayramAnnakov/claude-reflect on GitHub, a chart by star-history.com

Other commands on claude-reflect.

More commands from other plugins.

mempalace-audit

mempalace-audit

Command

Score how well organized your memory palace is, then run a guided repair session — one decision at a time.

mempalace11d60k
@mempalace@mempalaceInstall Command
plan-to-beads

plan-to-beads

Command

Convert a Claude Code plan file into beads epic + tasks for cross-session tracking.

beads11d28k
@gastownhall@gastownhallInstall Command