learn

A command that records useful codebase knowledge in agent rule files. These rules guide future coding-agent sessions.

In plain words
What is it for?
Use it after discovering project conventions, constraints, or unusual behaviour, either from a conversation or from a fact you provide.
Why use it?
Important conventions and lessons can otherwise remain only in conversations or in a developer's memory. Recording them reduces repeated explanations and prevents known mistakes.

Command

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/ralfstrobel/agentic-brownfield-coding/learn
Clone the repo
git clone --depth 1 https://github.com/ralfstrobel/agentic-brownfield-coding
Per session 10 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,252 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.00010 $0.01252
Opus 5 $0.00005 $0.00626
Sonnet 5 $0.00002 $0.00250
Haiku 4.5 $0.00001 $0.00125

Measured yesterday against content hash 6f5c6faa77da, 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 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.

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-plugins/abc/commands/learn.md · 141 lines

How it starts

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

Codify Implicit Knowledge

Create or update agent rule files to capture implicit knowledge about the code base.

Phase 1: Determine What to Learn

Consider the following arguments given by the user: $ARGUMENTS

Determine the goal of this learning session based on the given user input:

A — Conversation learning (no arguments, or arguments refine focus only): Reflect on the prior conversation or development session with the user:

  • What was unclear, ambiguous, or required explicit user guidance?
  • What implicit conventions, constraints, or gotchas were discovered?

B — Explicit fact (arguments contain a concrete statement to codify): The user has stated a fact directly in: $ARGUMENTS

  • Treat the argument text as the knowledge to capture.
  • If the fact references specific code, use an explorer subagent to read that code for correct context.

If neither source yields clear content, ask the user what to capture before continuing.

Phase 2: Place the Rule

2a — Determine the target rules directory

Rules always live in .claude/rules directories.

Respect user preferences for the target directory that were explicitly specified via context or arguments. Otherwise, default to the global <project-dir>/.claude/rules directory.

2b — Check for existing related rules

  1. Use an appropriate explorer subagent or dedicated search tools to search the target directory for existing content related to the new knowledge.
  2. If relevant rule files already exist, choose the best fitting as the selected target file(s) and skip to 2d.

2c — Choose name(s) of any new rule file(s)

Skip this step if all knowledge to manifest already has appropriate target files.

  1. List the subdirectories of the target directory and choose one if it fits semantically.
  2. Choose the target file name using descriptive kebab-case (e.g., api-error-handling.md, test-conventions.md).

2d — Path scoping via frontmatter

Rules apply to files matching the paths glob declared in their YAML frontmatter. Each path is relative to the parent directory of the .claude directory that contains the rules/ folder. Note: You must include the paths frontmatter, as otherwise the rule applies globally!

Read the full file on GitHub · 141 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 · 141 lines · 10 tokens per session scan A 6f5c6faa77da

Subscribe to this mod's changes

learn is a command published in the GitHub repository ralfstrobel/agentic-brownfield-coding (28 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 10 tokens to every session and 1,252 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.