learn

A command that reviews the current conversation and saves reusable lessons to a Markdown file, including preferences, confirmed conventions, and non-obvious solutions.

In plain words
What is it for?
Useful for updating memory/lessons.md, removing duplicate lessons, recording durable project insights, and identifying facts that may need user confirmation.
Why use it?
It preserves useful knowledge from a session so the same mistakes and discoveries do not have to be revisited.

Command for Claude Code

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/lanzelot1/claw-brain/learn
Clone the repo
git clone --depth 1 https://github.com/Lanzelot1/claw-brain

Made for: Claude Code.

Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 561 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.00007 $0.00561
Opus 5 $0.00003 $0.00280
Sonnet 5 $0.00001 $0.00112
Haiku 4.5 $0.00001 $0.00056

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

Security

Grade A, and why

learn 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 2d 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.

.claude/commands/learn.md · 41 lines

How it starts

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

Review the current conversation and save reusable insights to memory/lessons.md.

Steps

  1. Read memory/lessons.md (if it exists) to see what's already saved
  2. Scan the conversation for:
    • Workarounds or solutions discovered through trial-and-error
    • User corrections or preferences ("don't do that", "I prefer X")
    • Patterns or conventions confirmed
    • Mistakes worth avoiding next time
  3. Filter by priority:
    • Always save: user corrections, stated preferences, confirmed conventions
    • Save if non-trivial: debugging solutions, workflow patterns, tool quirks
    • Skip: obvious facts, session-specific details, raw logs
  4. Check for duplicates — don't add entries that overlap with existing ones. Update existing entries if the new version is better.
  5. Append new entries to memory/lessons.md. Format:
    - YYYY-MM-DD: [topic] — insight text
    
  6. Graduation check — Review the extracted learnings for any insight that is a durable fact about the domain (not a personal preference, not a debugging workaround, not session-specific). Examples: "API rate-limits at 100 req/s", "The auth service requires JWT with RS256".
    • For each durable insight, ask the user: "This looks like permanent knowledge rather than a session learning: {insight}. Want me to add it to knowledge/{area}/ instead?"
    • If yes: append to the most relevant existing knowledge file (don't create a new file). Add source: "session discovery, YYYY-MM-DD" to the frontmatter if needed. Search other knowledge areas for related files and add cross-references using [title](../area/file.md) format under a ## Related section.
    • If no: leave it in lessons.md as normal
  7. If the file exceeds 50 entries, ask the user which older entries can be consolidated or removed
  8. Show a summary of what was saved (or "nothing new to save" if the session was routine)

Git

memory/lessons.md is gitignored — no branch or PR needed.

Rules

Read the full file on GitHub · 41 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. 2d ago First seen · 41 lines · 7 tokens per session scan A c76cef33c9b0

Subscribe to this mod's changes

learn is a command published in the GitHub repository Lanzelot1/claw-brain (11 stars, last pushed 4mo ago), licensed MIT. It adds 7 tokens to every session and 561 once invoked, about $0.0000 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.