lesson

lesson is a command for coding agents from sdsrss/claude-mem-lite. It costs 62 tokens per session (695 once invoked), scanned A, original, MIT.

A command for recording a non-obvious coding lesson, bug cause, or workaround as a searchable observation.

In plain words
What is it for?
Saving lessons about bugs, API behavior, required call order, import problems, or file-specific workarounds for later searches.
Why use it?
It prevents tricky discoveries from being forgotten while keeping them out of the main system-prompt memory section.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the claude-mem-lite plugin — 8 commands, 7 hooks, 1 MCP server 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/sdsrss/claude-mem-lite/lesson
Clone the repo
git clone --depth 1 https://github.com/sdsrss/claude-mem-lite

Or install claude-mem-lite, the plugin that ships this one along with the rest of its 8 commands, 7 hooks, 1 MCP server.

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 lesson

README.md
[![agentmods](https://agentmods.dev/badge/commands/sdsrss/claude-mem-lite/lesson.svg)](https://agentmods.dev/commands/sdsrss/claude-mem-lite/lesson)
Your own site
<a href="https://agentmods.dev/commands/sdsrss/claude-mem-lite/lesson"><img src="https://agentmods.dev/badge/commands/sdsrss/claude-mem-lite/lesson.svg" alt="Measured on agentmods" height="20"></a>
Per session 62 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 695 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.1 $0.00062 $0.00695
Opus 5 $0.00031 $0.00347
Sonnet 5 $0.00012 $0.00139
Haiku 4.5 $0.00006 $0.00069

Measured 6d ago against content hash fa8116c676fc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

lesson 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 6d 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.

commands/lesson.md · 59 lines

How it starts

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

/lesson

Record a lesson / gotcha / workaround. Writes a searchable observation (type=discovery with the text as lesson_learned) so future sessions can find it via mem_search and the PreToolUse recall hooks surface it on the relevant files. Does NOT touch memdir — so lessons never end up in the L1 system-prompt memory section and do not conflict with the WHAT_NOT_TO_SAVE semantics sdscc enforces. (Redirected v3.39: was the events table, which mem_search never read.)

When to use

After you (or the user) solve a tricky bug or discover a non-obvious behavior:

  • "you need to call X before Y or the test hangs"
  • "don't use this import path — it shadows the real module"
  • "the API returns null when you pass empty string, even though docs say it throws"

Don't use for trivial fixes (typos, renames), for rules that belong in memdir (user preferences, project-wide conventions), or for general project notes (use /mem:memory or mem_save instead).

Arguments

  • Positional text: the lesson description (what went wrong + root cause + fix).
  • --file <path>: scope to a specific file. The lesson will surface via pre-tool-recall the next time the file is opened via Edit/Write.
  • --files f1,f2,f3: comma-separated list for multiple files.
  • --importance <1|2|3>: default 2. Use 3 for critical lessons you always want surfaced; 1 for minor gotchas.

Execution

Run via Bash — pass the full lesson text as the positional content, and a distilled version in --lesson so it lands in the high-weight lesson_learned field. --lesson is capped at 500 chars (longer values are rejected), so for a long lesson keep the full text in the positional content and trim --lesson to the core insight:

node ${CLAUDE_PLUGIN_ROOT}/cli.mjs save "<full text>" \
  --type discovery \
  --title "<first 60 chars of text>" \
  --lesson "<core insight, ≤500 chars>" \
  [--files f1,f2,...] \
  --importance <1|2|3>

Confirm to user with: Lesson saved: #<id>.

Read the full file on GitHub · 59 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. 6d ago First seen · 59 lines · 62 tokens per session scan A fa8116c676fc

Subscribe to this mod's changes

lesson is a command published in the GitHub repository sdsrss/claude-mem-lite (57 stars, last pushed yesterday), licensed MIT. It adds 62 tokens to every session and 695 once invoked, about $0.0003 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.