reflect

reflect is a command for coding agents from drobins25/craft. It costs 24 tokens per session (2,937 once invoked), scanned A, original, MIT.

A command that turns recorded project learnings into lasting rules and updates for the coding-agent setup.

In plain words
What is it for?
Use it after a work cycle or when you want to review pending learnings and promote useful fixes into project rules.
Why use it?
It prevents repeated mistakes by carrying pending lessons and confirmed fixes into future work. It can be run automatically or manually.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the craft plugin — 29 commands, 27 agents, 1 MCP server shipped together

Install

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.

agentmods
npx agentmods add commands/drobins25/craft/craft-reflect
Clone the repo
git clone --depth 1 https://github.com/drobins25/craft

Or install craft, the plugin that ships this one along with the rest of its 29 commands, 27 agents, 1 MCP server.

Wrote 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.

agentmods badge for reflect

README.md
[![agentmods](https://agentmods.dev/badge/commands/drobins25/craft/craft-reflect.svg)](https://agentmods.dev/commands/drobins25/craft/craft-reflect)
Your own site
<a href="https://agentmods.dev/commands/drobins25/craft/craft-reflect"><img src="https://agentmods.dev/badge/commands/drobins25/craft/craft-reflect.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,937 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00024 $0.02937
Opus 5 $0.00012 $0.01469
Sonnet 5 $0.00005 $0.00587
Haiku 4.5 $0.00002 $0.00294

Measured 5d ago against content hash 0eb927bffd7e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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 5d 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.

commands/craft-reflect.md · 417 lines

How it starts

The opening of the file, as written. The whole thing — 417 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Reflect

Convert captured learnings from .craft/.learnings.yaml into permanent harness files in .claude/.

When to Use

  • Triggered automatically by /craft when pending learnings exist
  • Manually via /craft:reflect at any time
  • Prompted at cycle-complete before archiving

Flow

Step 1: Load Pending Learnings & Ungraduated Fixes

Read .craft/.learnings.yaml and filter for status: pending:

Use Grep with pattern status: pending, path .craft/.learnings.yaml, output_mode countpending_count. If the file doesn't exist, pending_count = 0.

Also check for aggregated failure patterns from the active cycle:

If ACTIVE_CYCLE is set, use Grep with pattern ^ - pattern:, path .craft/cycles/$ACTIVE_CYCLE/.failure-patterns.yaml, output_mode countfailure_patterns. If file doesn't exist or ACTIVE_CYCLE not set, failure_patterns = 0.

Also count ungraduated fix records (the second intake - fixes carry human-confirmed root causes that can graduate into .claude/rules/):

FIX_COUNT=$(bash "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/count-ungraduated-fixes.sh")
THRESHOLD=$(grep -m1 '^rule_pass_threshold:' "${CRAFT_PROJECT_ROOT:-.}/.craft/settings.yaml" 2>/dev/null | sed 's/^rule_pass_threshold:[[:space:]]*//')
THRESHOLD=${THRESHOLD:-10}

The fix queue is actionable only when FIX_COUNT >= THRESHOLD - below the threshold there is no fix action available, so it counts as empty for this gate.

If no pending learnings AND no failure patterns AND FIX_COUNT < THRESHOLD:

"No pending learnings to process. Harness is up to date."

If anything is actionable: Continue to Step 1b.


Step 1b: Rule-Pass Offer (when the fix queue is actionable)

If FIX_COUNT >= THRESHOLD, offer the rule pass FIRST - before any learnings drain. Fixes are the denser signal (every record is a human-confirmed root cause).

Use AskUserQuestion:

question: "[FIX_COUNT] fixes have accumulated since the last rule pass. Run a rule pass to mine them for graduation-worthy rules?"
header: "Rule pass"
options:
  - label: "Run the rule pass"
    description: "~2-3 min agent read + per-rule review. Proposals are review-gated - nothing is written without your approval."
  - label: "Not now"
    description: "Skip - the offer returns next reflect (the counter does not reset on decline)"

Read the full file on GitHub · 417 lines

Changes

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.

  1. 5d ago First seen · 417 lines · 24 tokens per session scan A 0eb927bffd7e

Subscribe to this mod's changes

reflect is a command published in the GitHub repository drobins25/craft (53 stars, last pushed 6d ago), licensed MIT. It adds 24 tokens to every session and 2,937 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-30.