Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/pghh84/claude-layered-learning/reflectgit clone --depth 1 https://github.com/PGHH84/claude-layered-learningWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/pghh84/claude-layered-learning/reflect)<a href="https://agentmods.dev/commands/pghh84/claude-layered-learning/reflect"><img src="https://agentmods.dev/badge/commands/pghh84/claude-layered-learning/reflect.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00022 | $0.01964 |
| Opus 5 | $0.00011 | $0.00982 |
| Sonnet 5 | $0.00004 | $0.00393 |
| Haiku 4.5 | $0.00002 | $0.00196 |
Grade A, and why
reflect scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 250 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Reflect on Diary Entries and Synthesize Insights
Analyze accumulated diary entries to identify recurring patterns across sessions and projects, then route durable learnings to the canonical local or global instruction source.
/reflect:
- reads diary entries and supporting memory
- identifies repeated patterns, rule violations, contradictions, and one-off observations
- proposes durable promotions to repo
CLAUDE.mdor~/.agents/global/PROJECT.md - applies approved durable promotions in the same reflection flow
Parameters
The user can provide:
- Date range: "from YYYY-MM-DD to YYYY-MM-DD" or "last N days"
- Entry count: "last N entries" (for example "last 10 entries")
- Project filter: "for project [project-path]"
- Pattern filter: "related to [keyword]"
Default: analyze all unprocessed diary entries.
Runtime Paths
- diary input:
~/.claude/memory/diary/ - reflections:
~/.claude/memory/reflections/ - processed index:
~/.claude/memory/reflections/processed.log - project memory:
~/.claude/projects/<slug>/memory/MEMORY.md - project operating guidance source: repo
CLAUDE.md - global operating guidance source:
~/.agents/global/PROJECT.md - generated global mirrors:
~/.claude/CLAUDE.md,~/.codex/AGENTS.md
Path-To-Slug Transform
Use this exact transform so /reflect, /diary, wrap-up, and the PreCompact
hook agree on project identity:
- If inside a git repository, resolve the canonical project root with
git rev-parse --show-toplevel. - If that repo root contains
/.worktrees/, strip the/.worktrees/<name>suffix and use the parent repo path as the canonical project root. - Otherwise, if not inside a git repository, use the canonical absolute working directory.
- Resolve symlinks before deriving the slug.
- Replace every
/in the canonical absolute path with-.
Processing Workflow
- Resolve the filter set and project slug mapping using the shared path-derived slug rule.
- Load matching diary entries from
~/.claude/memory/diary/. - Skip entries already listed in
processed.logunless the user explicitly requests reprocessing. - Read supporting context relevant to the filtered corpus:
- recent reflections
~/.claude/memory/reflections/processed.log- project
~/.claude/projects/<slug>/memory/MEMORY.mdwhen project context is relevant - repo
CLAUDE.mdwhen project operating-guidance candidates are being considered - canonical global
~/.agents/global/PROJECT.mdwhen evaluating global promotion candidates
- Group repeated patterns, explicit rule violations, contradictions, and one-off observations.
- Carry forward recent one-off observations from prior reflections when the same signal reappears.
- Prioritize repeated violation of existing guidance over inventing a new rule.
- Route each repeated learning by scope and destination, strengthening weak existing guidance before proposing a brand-new durable rule.
- Write the reflection file to
~/.claude/memory/reflections/YYYY-MM-DD-reflection-N.md. - Present proposed durable edits with destination, evidence, and confidence.
- If the user approves any durable edits, apply them in the same flow.
- If approved global canonical edits were applied, run
~/.agents/global/sync_global_instructions.sh. - Update
processed.logonly after the user accepts the reflection pass as complete and any approved durable edits for that pass were applied.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 250 lines · 22 tokens per session scan A 202ca9608eb5
reflect is a command published in the GitHub repository PGHH84/claude-layered-learning (2 stars, last pushed 5mo ago), licensed MIT. It adds 22 tokens to every session and 1,964 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
minutes-ideas
Surface recent voice memos and ideas captured from any device. Use when the user asks "what ideas did I have?", "what were my recent memos?", "what did I record while walking?", or wants to recall a captured thought.
learn
Force claude-smart to extract learnings from this session now.
memory-store
Store an insight, decision, or pattern to memory.
cc-memory
Configure persistent memory that survives across sessions using a layered approach: split rule files for always-loaded context, auto-memory for organic learning, and optional MCP-backed long-term memory for large codebases.
analyze-context
USE WHEN you want to analyze project context before starting work on a task. Calls context + recall, then synthesizes goals, decisions, gotchas, and relevant memories into a pre-task brief.
music-suno-prompt
Grounded Suno prompt synthesis from local knowledge corpus + persona canon + label canon. No vibes-prompting.