extract-lessons

extract-lessons is a command for Claude Code from runnithan/claudex-setup. It costs 29 tokens per session (5,256 once invoked), scanned A, original, MIT.

A command that reads saved transcripts from Claude Code, Claude Design, and Codex to extract reusable lessons about using coding-agent tools.

In plain words
What is it for?
Use it to process transcripts, write individual lesson files, and keep the lesson index and processed-transcript record up to date.
Why use it?
It turns scattered conversations into an organized lessons library and updates older guidance when newer advice conflicts with it.

Command for Claude Code

Part of the claudex-setup plugin — 3 skills, 21 commands, 22 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/runnithan/claudex-setup/extract-lessons
Clone the repo
git clone --depth 1 https://github.com/runnithan/claudex-setup

Made for: Claude Code.

Or install claudex-setup, the plugin that ships this one along with the rest of its 3 skills, 21 commands, 22 agents.

Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,256 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.00029 $0.05256
Opus 5 $0.00015 $0.02628
Sonnet 5 $0.00006 $0.01051
Haiku 4.5 $0.00003 $0.00526

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

Security

Grade A, and why

extract-lessons 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 3d 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/extract-lessons.md · 235 lines

How it starts

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

Extract Lessons

Mine reusable agent-tooling lessons from locally saved practitioner transcripts and file each one into the lessons/ library as its own markdown file, keeping lessons/INDEX.md and the processed-transcript ledger in sync. Newer lessons supersede older contradicting ones on the same topic.

A "lesson" is a concrete, transferable improvement to how someone uses the agent tooling this repo tracks, Claude Code, Claude Design, or Codex: a command, flag, hook, skill pattern, workflow, config, design-surface technique, or gotcha that a reader could apply. Marketing claims, hype, product announcements without a usable technique, and generic AI-coding platitudes are NOT lessons.

Scope covers all three tools, do not silently drop two of them. This command was Claude-Code-only until 2026-07-17, and the omission was self-confirming: Claude Design and Codex transcripts were marked processed while yielding ~0 lessons, so /optimise --design and --codex kept concluding "no relevant lessons exist" when the truth was that nobody had ever looked. A 28k-word Claude Design course and a 1-hour Codex course both extracted zero. If a transcript teaches real Claude Design or Codex technique, that is in scope and must be filed under design or codex. A zero-lesson result for a technique-dense transcript is a red flag to re-read it, not a valid outcome.

Arguments

$ARGUMENTS:

  • empty or new (default): process only transcripts not yet in lessons/.processed.json
  • all: reprocess every transcript (rare, only when the extraction criteria change). The criteria changed on 2026-07-17 (scope widened to Claude Design + Codex), so every transcript ledgered before that date was mined against Claude-Code-only criteria and its .processed.json entry is not evidence that its design or Codex content was ever considered. Re-run with all over the design/Codex-heavy scopes to backfill.
  • a path or glob (e.g. transcripts/ray-amjad/): process just that scope, minus already-processed (unless all is also passed)

Read the full file on GitHub · 235 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. 3d ago First seen · 235 lines · 29 tokens per session scan A 3db34034dc4a

Subscribe to this mod's changes

extract-lessons is a command published in the GitHub repository runnithan/claudex-setup (1 stars, last pushed 3d ago), licensed MIT. It adds 29 tokens to every session and 5,256 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-31.