learn

learn is a command for coding agents from MadAppGang/claude-code. It costs 15 tokens per session (1,677 once invoked), scanned B, original, MIT.

A command for examining a coding session for project-specific patterns and rules that could be added to a CLAUDE.md instruction file. It filters out general advice and duplicate information.

In plain words
What is it for?
It is for reviewing session history, finding actionable project-specific learnings, and proposing updates to the project’s agent instructions.
Why use it?
It helps preserve repeated or explicitly stated project rules so future work follows them. It also checks existing instructions to avoid contradictions and duplicates.

Command

Part of the dev plugin — 47 skills, 12 commands, 14 agents 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/madappgang/claude-code/learn
Clone the repo
git clone --depth 1 https://github.com/MadAppGang/claude-code

Or install dev, the plugin that ships this one along with the rest of its 47 skills, 12 commands, 14 agents.

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/madappgang/claude-code/learn.svg)](https://agentmods.dev/commands/madappgang/claude-code/learn)
Your own site
<a href="https://agentmods.dev/commands/madappgang/claude-code/learn"><img src="https://agentmods.dev/badge/commands/madappgang/claude-code/learn.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,677 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00015 $0.01677
Opus 5 $0.00008 $0.00839
Sonnet 5 $0.00003 $0.00335
Haiku 4.5 $0.00002 $0.00168

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

Security

Grade B, and why

learn scanned grade B with 1 finding 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 yesterday.

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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

cat .claude/CLAUDE.md 2>/dev/null || cat CLAUDE.md 2>/dev/null || echo "No CLAUDE.md found"
plugins/dev/commands/learn.md · 253 lines

How it starts

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

<user_request> Analyze this session for learnable patterns and propose CLAUDE.md updates. $ARGUMENTS </user_request>

<quality_filter>
  Only propose learnings that are:
  1. Project-specific (not general best practices)
  2. Repeated OR explicitly stated as rules
  3. Actionable and specific
  4. New information (not already in CLAUDE.md)
</quality_filter>

</critical_constraints>

<phase number="2" name="Check Existing">
  <objective>Avoid duplicates and contradictions</objective>
  <steps>
    <step>
      Read current CLAUDE.md:
      ```bash
      # Check project CLAUDE.md
      cat .claude/CLAUDE.md 2>/dev/null || cat CLAUDE.md 2>/dev/null || echo "No CLAUDE.md found"
      ```
    </step>
    <step>
      Check if any detected patterns already exist in CLAUDE.md
    </step>
    <step>
      Check for contradictions with existing rules
    </step>
  </steps>
</phase>

<phase number="3" name="Present Findings">
  <objective>Show learnings with confidence levels</objective>
  <format>
    ```
    ## Session Learnings

    Analyzed this session for learnable patterns.

    ### HIGH Confidence
    [Only if repeated OR explicitly stated as rule]

    **1. [Short title]**
    Signal: "[Exact quote or description]"
    ```diff
    + [Proposed CLAUDE.md line]
    ```

    ### MEDIUM Confidence
    [Single clear corrections - ask for confirmation]

    **2. [Short title]**
    Signal: [Description of what happened]
    ```diff
    + [Proposed line]
    ```
    ⚠️ Only seen once - confirm before adding?

    ---

    **Summary**: [N] HIGH confidence, [M] MEDIUM confidence learnings detected.

    Apply HIGH confidence learnings to CLAUDE.md? [y/n/selective]
    ```
  </format>
</phase>

<phase number="4" name="Apply (if approved)">
  <objective>Update CLAUDE.md with approved learnings</objective>
  <steps>
    <step>
      If user approves, read current CLAUDE.md
    </step>
    <step>
      Find or create `## Learned Preferences` section
    </step>
    <step>
      Add approved learnings under appropriate subsections:
      - Code Style
      - Project Structure
      - Tools & Commands
      - Conventions
    </step>
    <step>
      Use Edit tool to update the file (preserve existing content)
    </step>
    <step>
      Confirm what was added:
      ```
      ✓ Added [N] learnings to CLAUDE.md:
      - [learning 1]
      - [learning 2]

      These will apply to future sessions in this project.
      ```
    </step>
  </steps>
</phase>

Read the full file on GitHub · 253 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. yesterday First seen · 253 lines · 15 tokens per session scan B 2fd9e1abb899

Subscribe to this mod's changes

learn is a command published in the GitHub repository MadAppGang/claude-code (279 stars, last pushed 5mo ago), licensed MIT. It adds 15 tokens to every session and 1,677 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.