Skip to content
Development
Command

/lesson

Use when: capturing a non-obvious lesson/gotcha/workaround after a tricky fix or surprising behavior. Writes a searchable observation (findable via mem_search + surfaced by recall hooks; still NOT memdir/L1 prompt). Skip for typos, renames, or user-preference rules.

From plugin
claude-mem-lite
607 skills7 commands7 hooks1 MCP
Install
> /plugin marketplace add sdsrss/claude-mem-lite
> /plugin install claude-mem-lite@sdsrss

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/lesson

Context preview

What this command does when you run it.

Use when: capturing a non-obvious lesson/gotcha/workaround after a tricky fix or surprising behavior. Writes a searchable observation (findable via mem_search + surfaced by recall hooks; still NOT memdir/L1 prompt). Skip for typos, renames, or user-preference rules.

Command definition

lesson.md
name: lesson
description: "Use when: capturing a non-obvious lesson/gotcha/workaround after a tricky fix or surprising behavior. Writes a searchable observation (findable via mem_search + surfaced by recall hooks; still NOT memdir/L1 prompt). Skip for typos, renames, or user-preference rules."

/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>`.

Examples

  • `/lesson fix a bug now` — stores a short lesson for the current project; no file scope.
  • `/lesson --file src/auth.mjs "session cookies must be httpOnly or the e2e tests bleed across browsers"` — file-scoped.
  • `/lesson --files src/a.mjs,src/b.mjs --importance 3 "both modules share a cache via WeakMap; clearing one invalidates the other"` — multi-file, high importance.
Read more
Ships withclaude-mem-lite

claude-mem-lite is a persistent memory (also called long-term memory or cross-session context) system for Claude Code — Anthropic's CLI coding agent.

Get the whole plugin
Stats
60
Stars
11
Forks
Active
Maintenance
JavaScript
Language
MIT
License
2d ago
Last commit
7mo ago
Created

Repo: sdsrss/claude-mem-lite

Other commands on claude-mem-lite.