~/groundwork

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

LevelWhere it livesWhat it means
NOTELESSONS.mdWritten down; read when the work calls for it
RULEAGENTS.md, under Rules, with its lesson IDThe agent sees it every session
GUARD.groundwork/guards/*.mjsA 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.md with 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; compact leaves 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 retro collects signs of repeated mistakes into .groundwork/retro.md. gw-retro then proposes one change per repeated mistake. Nothing changes without your OK.
  • Imported rules. Rules already in your CLAUDE.md or AGENTS.md are imported as lessons, and you choose which stay always-on.

On this page