lessons-compact

lessons-compact is a command for Claude Code from fusengine/agents. It costs 49 tokens per session (1,143 once invoked), scanned A, original, MIT.

A tool for shortening a project's MEMORY/LESSON.md by finding duplicates, combining lessons with the same root cause, and removing entries replaced by newer ones. It proposes changes but does not edit the file itself.

In plain words
What is it for?
Use it when MEMORY/LESSON.md has become long or repetitive, or when the /lessons-compact command is run. It produces a before-and-after proposal for someone else to approve and apply.
Why use it?
It keeps accumulated project memory readable while preserving distinct lessons. Requiring a proposal helps prevent the accidental loss of useful information.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents.

Part of the fuse-lessons plugin — 2 commands, 1 agent 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/fusengine/agents/lessons-compact
Clone the repo
git clone --depth 1 https://github.com/fusengine/agents

Made for: Claude Code.

Or install fuse-lessons, the plugin that ships this one along with the rest of its 2 commands, 1 agent.

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 lessons-compact

README.md
[![agentmods](https://agentmods.dev/badge/commands/fusengine/agents/lessons-compact.svg)](https://agentmods.dev/commands/fusengine/agents/lessons-compact)
Your own site
<a href="https://agentmods.dev/commands/fusengine/agents/lessons-compact"><img src="https://agentmods.dev/badge/commands/fusengine/agents/lessons-compact.svg" alt="Measured on agentmods" height="20"></a>
Per session 49 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,143 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.00049 $0.01143
Opus 5 $0.00024 $0.00571
Sonnet 5 $0.00010 $0.00229
Haiku 4.5 $0.00005 $0.00114

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

Security

Grade A, and why

lessons-compact 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 2d 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.

plugins/fuse-lessons/commands/lessons-compact.md · 69 lines

How it starts

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

/lessons-compact

Compact the project's MEMORY/LESSON.md (project root). Over time this file accumulates near-duplicate entries, several lessons about the same root cause, and entries a later lesson has since contradicted.

Use /lessons to just view or append a single lesson — this command is the dedicated compaction pass.

How it runs — delegate, then arbitrate

Do not classify the entries yourself. Spawn the fuse-lessons:lessons-compactor agent and let it do the reading and the analysis.

Why delegate: compaction is a heavy-context, light-output task — it means reading the whole file, classifying every entry, and cross-checking each against all the others, to produce a verdict of a dozen lines. Doing that inline burns the lead's context for a result that fits in a paragraph.

Step 1 — spawn the agent

Pass it, in its prompt:

  • the absolute path of MEMORY/LESSON.md,
  • the absolute path of a scratchpad directory where it must write its proposal (it needs one — it will ask rather than guess if you omit it),
  • any specific concern the user raised when invoking the command.

Step 2 — relay its report to the user

The agent returns a verdict, before/after sizes, the observed ordering convention, the merge list (with the shared root cause of each) and the drop list (each naming the later entry that supersedes it).

Show the user the proposed merges and drops, and ask for explicit confirmation before anything is written.

This is deliberately ask-first, not write-then-diff. Compaction is inherently lossy — it deletes lines — and MEMORY/LESSON.md is committed team memory, force-read into every session and every subagent. An unwanted compaction that already overwrote the file is far harder to notice and walk back than one caught in review. Nobody misses a lesson until the mistake it prevented happens again.

If git diff shows uncommitted changes on the file, the agent flags it — pass that warning on. Compacting on top of unsaved manual edits makes the proposal harder to trust.

Read the full file on GitHub · 69 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. 2d ago First seen · 69 lines · 49 tokens per session scan A a1f904d15f7f

Subscribe to this mod's changes

lessons-compact is a command published in the GitHub repository fusengine/agents (25 stars, last pushed yesterday), licensed MIT. It adds 49 tokens to every session and 1,143 once invoked, about $0.0002 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-09-03.