# Lessons workflow -- promote, recall, revoke

Fetch when the user asks: "como guardo esto?", "lo recordas para
la proxima?", "promove esta regla", "quita esta leccion", "que
lessons tengo activas?".

## What a lesson is

A user-promoted rule that the system prompt picks up on every
subsequent turn. Three categories:

- **user** -- facts about the user (preferences, conventions).
- **feedback** -- "always do X / never do Y" corrections.
- **reference** -- pointers to external resources.

The brain MAY recommend promoting a lesson when:
- The user gave a correction the brain wants to honour next time.
- The user validated a non-obvious approach + said "keep doing it".

## Verbs

- `yujin.lessons.promote` -- elevate a turn observation into a
  durable lesson. Args: `{slug, category, body}`.
- `yujin.lessons.list` -- enumerate active lessons + their slugs.
- `yujin.lessons.revoke` -- soft-deactivate by slug.
- `yujin.doctrine.discover` -- fetch the long-form doctrine
  (lessons are short; doctrines are long-form reference).

## Lifecycle

1. User says "from now on always do X" or "stop doing Y".
2. Brain proposes the lesson body + slug + category, asks for
   confirmation.
3. User confirms -> brain invokes `yujin.lessons.promote`.
4. On every subsequent turn the system prompt rebuilds with the
   active lesson list (HITO 6.5 LRU cache + 6.6 migration).
5. User says "forget that" -> brain proposes revocation slug,
   asks for confirmation, invokes `yujin.lessons.revoke`.

## Slug convention

`{category}_{kebab-case-slug}.md`. Examples:
- `feedback_no_emojis.md`
- `user_prefers_spanish_replies.md`
- `reference_pablo_income_plan.md`

The slug is shown in error UX so the user can edit lessons by
hand if needed (HITO 6.4 CLI).

## When NOT to promote

- One-off task instructions ("for this PR add a comment to X").
- Facts already in the doctrine catalogue.
- Personal user data the user didn't explicitly say to remember
  (privacy-by-default).

## When NOT to recall

- The user said `forget what I told you` / `start fresh` / `ignore
  lessons`. Honour the request without protest.
- The recall conflicts with the current user request. Surface the
  conflict instead of silently overriding.

## Storage

`~/.yujin-forge/lessons/{slug}.md` -- one markdown file per
lesson with YAML frontmatter (category, body, created_at,
last_used_at). LRU eviction at 200 lessons (HITO 6.5).
