agentleFS
mo-cmykmo-cmyk/mazarbul/.claude/skills/lessons/SKILL.md

lessons

Skill2 starsChanged 35 days agoApache-2.0View on GitHub

Self-healing memory loop. USE WHEN route-prompt.sh injects CORRECTION DETECTED directive, OR when you need to manually log a lesson from a non-correction signal (a CI failure that wasn't caught, a real bug landed in main). Greps lessons.md + skill Gotchas, updates or appends an entry, auto-promotes at recurrence thresholds, logs to lessons-changelog.md. NOT FOR routine work , only invoke when there's a durable rule worth capturing.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use distill-prompt, super-advisor and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenSWESkill

    distill-prompt

    Distill this conversation's underlying goal into one reusable prompt that reaches the same final outcome in a fresh session.

    Also in 3 projects that use this

  • OpenSWESkill

    super-advisor

    Pair a worker agent, in a terminal multiplexer (tmux, Herdr) or an ADE (Paseo, Orca, T3 Code), with one advisor, a stronger model that answers questions on the user's behalf to unblock the worker and leads it to its next task, by accepting its prompt suggestion or sending it text: a worker "still waiting on your go" gets `go`. Invoked by the user (`/super-advisor`), and by you in one case only, before the first step of the work and whatever the plan's size, when a grilling session has ended with its frontier empty, the user's confirmation has you execute the plan now, no advisor pair is live, and the confirmation did not decline one.

    Also in 3 projects that use this

  • gootfSkill

    log-decisions

    Append-only DECISIONS.md journal at the project root for consequential calls the spec didn't settle. Use when you (or the user) make a non-trivial call worth a durable record — an ambiguity you interpreted, a tradeoff, a deviation, or a hard-to-undo action.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 7 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Search all four locations in parallel:

    line 30
  2. Distinctive:

    If you find a matching entry, go to Step 3a (update).

    line 44
  3. Distinctive:

    Add any new keywords (union, dedup)

    line 51
  4. Distinctive:

    If the symptom/fix needs refinement, edit those lines

    line 52
  5. Very specific:

    If the match was in lessons-archive.md, this is a *resurrection*: move the entry back to lessons.md, add Resurrected: YYYY-MM-DD, log …

    line 56
  6. Distinctive:

    If the same keyword cluster appears in 2+ active entries:

    line 60
  7. Very specific:

    Use the latest Last seen

    line 63
  8. Distinctive:

    Delete the absorbed entries

    line 65
  9. Very specific:

    Read the new Recurrence value.

    line 90
  10. Very specific:

    Check the destination's cap (skill ## Gotchas ≤10 items, AGENTS.md Critical rules ≤10 items).

    line 101
  11. Distinctive:

    Do not delete the lessons.md entry immediately , the rotation hook will archive it 7 days later (audit trail).

    line 107

“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/lessons , Compounding-engineering auto-loop

This skill is the formal workflow Claude follows when the correction-detection hook fires. The hook injects a short pointer; this skill holds the detailed procedure so the hook prompt stays small.

When this runs

route-prompt.sh injects a directive when the user's prompt matches correction signals: "no", "stop", "actually", "wrong", "missed", "forgot", "again", "you should have", "didn't I tell you", "we discussed this". The directive points here.

Claude then runs this skill's procedure silently , the user does not see logging activity, only the answer to their actual question. The logging happens after the user-facing reply, as a separate tool sequence.

The procedure

Step 1 , Identify what the correction is about

Extract the core lesson in one sentence. Example: user says "I told you new RPCs need permission.go" → lesson = "new MCP tool methods require an entry in internal/auth/permission.go or they return PermissionDenied".

Then pick:

  • 3-6 keywords that capture the rule (e.g. JSON-RPC, permission.go, PermissionDenied, deny-by-default)
  • Compliance flag , true if it touches the event log, scope enforcement, append-only invariants, or any safety-critical area. false otherwise.
  • Scope , skill-specific (name the skill) / cross-cutting (AGENTS.md) / subagent-specific (name the agent) / project-context (name the agent-docs file)

Step 2 , Grep before write

Search all four locations in parallel:

grep -i -l "<keyword1>" agent-docs/lessons.md .claude/skills/*/SKILL.md AGENTS.md .claude/agents/*.md
grep -i -l "<keyword2>" agent-docs/lessons.md .claude/skills/*/SKILL.md AGENTS.md .claude/agents/*.md
# ...etc

Also grep the archive:

grep -i -l "<keyword>" agent-docs/lessons-archive.md

If you find a matching entry, go to Step 3a (update). If multiple matches across files, go to Step 3b (merge). If nothing matches (including archive), go to Step 3c (append).

Step 3a , Update existing entry

Edit the matching entry:

  • Increment Recurrence: N → Recurrence: N+1
  • Refresh Last seen: YYYY-MM-DD
  • Add any new keywords (union, dedup)
  • If the symptom/fix needs refinement, edit those lines

Then go to Step 4 (promotion check).

If the match was in lessons-archive.md, this is a resurrection: move the entry back to lessons.md, add **Resurrected**: YYYY-MM-DD, log resurrect to changelog, then promotion check.

Step 3b , Merge multiple matches

If the same keyword cluster appears in 2+ active entries:

  1. Pick the entry with highest Recurrence as the survivor
  2. Union all Keywords lists
  3. Use the latest Last seen
  4. Concatenate Symptom + Fix with a **Merged from**: LSN-a, LSN-b line
  5. Delete the absorbed entries
  6. Log merge to changelog with all involved LSN ids

Step 3c , Append new entry

Generate a new ID: LSN-YYYY-MM-DD-NNN where NNN is the next sequential number for today (grep LSN-$(date +%Y-%m-%d) and increment).

Append at the end of the ## Active entries section in lessons.md:

### LSN-YYYY-MM-DD-NNN , <one-line summary>
- **First seen**: YYYY-MM-DD
- **Last seen**: YYYY-MM-DD
- **Recurrence**: 1
- **Keywords**: kw1, kw2, kw3
- **Compliance**: true | false
- **Symptom**: <one or two sentences>
- **Fix**: <one or two actionable sentences>
- **Promoted to**: _(empty)_

Log append to changelog.

Step 4 , Promotion check (auto, no user prompt)

Read the new Recurrence value. Check the thresholds from agent-docs/lessons.md:

ComplianceScopeThreshold
trueskill-specific or cross-cutting≥ 2
falseskill-specific≥ 3
falsecross-cutting≥ 4
anysubagent or project-context≥ 3

If threshold met:

  1. Identify the destination file based on Scope.
  2. Check the destination's cap (skill ## Gotchas ≤10 items, AGENTS.md Critical rules ≤10 items).
  3. If at cap: auto-merge the two least-recent items at the destination into one consolidated bullet, freeing a slot. Log the merge.
  4. Append the lesson to the destination's ## Gotchas (or Critical rules) as a one-line bullet starting with **<short rule>**. Keep it tight , the destination is not a copy of lessons.md.
  5. Fill **Promoted to**: <destination-file-path> on the lessons.md entry.
  6. Log promote to changelog.

Do not delete the lessons.md entry immediately , the rotation hook will archive it 7 days later (audit trail).

Step 5 , Log to changelog

Append one line to agent-docs/lessons-changelog.md:

2026-05-21T09:42:13Z | append | LSN-2026-05-21-003 | new MCP tool methods need permission.go entry
2026-05-21T09:42:13Z | promote | LSN-2026-05-21-003 → .claude/skills/new-resource/SKILL.md

(Multi-action sequences get multiple lines.)

Step 6 , Reply to the user about the actual correction

The user asked something or corrected you. They want an answer or fix , they don't want a logging narration. Answer/fix first, then say (optionally) "Noted , logged for future reference." in one short sentence. Never paste the LSN id or the schema at the user.

Edge cases

Many corrections in one prompt , pick the most actionable one and log it. The others get their turn the next time they recur.

The correction contradicts an existing rule , log it AND log a conflict line to changelog. Set Promoted to: CONFLICT , <existing-rule-location> so the next session knows to reconcile. The pruning script will surface conflicts.

The user explicitly says "don't log this" or "ignore" , don't log. Trust the user.

Keywords too generic (e.g. "test", "fix") , refuse to log under generic keys. Require 2+ specific keywords (file names, function names, concept terms). If the correction is too vague, ask the user to clarify before logging.

Compliance flag uncertain , default to true. Better to mark something immortal incorrectly than to lose a safety-critical rule.

Gotchas

  • Do NOT narrate logging to the user , they corrected you; they want the fix, not your bookkeeping.
  • Do NOT log every "no" , only log when the correction reveals a durable rule. "No, use red instead of blue" is not a rule. "No, you didn't update permission.go" is a rule.
  • Do NOT skip the grep step , duplicate entries are the #1 cause of bloat. Updating an existing entry is always cheaper than appending a new one.
  • Do NOT manually invoke /lessons from the conversation , if you find yourself doing this, the hook is broken. Investigate the hook, not the workaround.
  • Do NOT touch lessons-archive.md or lessons-changelog.md directly , only lessons-rotate.sh and this skill (via the standard procedure) write to them. Hand-edits break the audit trail.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.