Lessons
Write down a mistake once, and every later session knows not to repeat it.
.groundwork/LESSONS.md is where mistakes go so they happen once.
Add one
npx groundwork-ai lesson "Run migrations before the test suite" --origin "tests failed on a stale schema"### L-001 · Run migrations before the test suite
- Level: NOTE
- Origin: tests failed on a stale schema (2026-11-15)
- History: note (2026-11-15)Three levels
| Level | Where it lives | What it means |
|---|---|---|
| NOTE | LESSONS.md | Written down; read when the work calls for it |
| RULE | AGENTS.md, under Rules, with its lesson ID | The agent sees it every session |
| GUARD | .groundwork/guards/*.mjs | A script blocks the action (needs the flow) |
Move a lesson up only when the mistake repeats. To make a NOTE a RULE, copy it under Rules in
AGENTS.md with its ID.
What doctor checks
- A rule in
AGENTS.mdwith no lesson ID. - A lesson nothing cites, which you may want to drop.
- The file against its budget (1,200 tokens by default). Trim it by hand;
compactleaves lessons alone.
With the flow on
- Guards. A guard is a small script that allows or blocks a shell command or file write. They
are listed in
.groundwork/config.json. - Retro.
npx groundwork-ai retrocollects signs of repeated mistakes into.groundwork/retro.md.gw-retrothen proposes one change per repeated mistake. Nothing changes without your OK. - Imported rules. Rules already in your
CLAUDE.mdorAGENTS.mdare imported as lessons, and you choose which stay always-on.