claw-brain: Command for Claude Code

.claude/commands/learn.md

learn is a command for Claude Code from Lanzelot1/claw-brain. It costs 7 tokens per session (561 once invoked), scanned A, original, MIT.

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

Written for Claude Code: installed under .claude/.

This is Lanzelot1/claw-brain's own configuration. It tells Claude Code how to work on claw-brain itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claw-brain configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Lanzelot1/claw-brain. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Lanzelot1/claw-brain/main/.claude/commands/learn.md
Clone the repo
git clone --depth 1 https://github.com/Lanzelot1/claw-brain

Made for: Claude Code.

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 learn

README.md
[![agentmods](https://agentmods.dev/badge/commands/lanzelot1/claw-brain/learn/github.svg)](https://agentmods.dev/commands/lanzelot1/claw-brain/learn)
Your own site
<a href="https://agentmods.dev/commands/lanzelot1/claw-brain/learn"><img src="https://agentmods.dev/badge/commands/lanzelot1/claw-brain/learn/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for learn

Your own site · 80×15
<a href="https://agentmods.dev/commands/lanzelot1/claw-brain/learn"><img src="https://agentmods.dev/badge/commands/lanzelot1/claw-brain/learn.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00007 $0.00561
Opus 5.5 $0.00003 $0.00224
Sonnet 5.5 $0.00001 $0.00112
Haiku 4.5 $0.00001 $0.00056

Measured 2mo ago against content hash c76cef33c9b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 6mo ago), licensed MIT. It adds 7 tokens to every session and 561 once invoked, about $0.0000 per session on Opus 5.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.