Keep a confidence-scored lessons ledger for an agent. Captures operational patterns with an initial confidence score, updates scores on confirmed hits and misses, prunes stale entries, and makes reuse a hard step before acting. Triggers when an agent keeps re-learning the same mistakes, needs to audit its own heuristics, or wants experience to compound across runs.
./install.sh learned-lessons-ledgername: learned_lessons_ledger description: Keep a confidence-scored lessons ledger for an agent. Captures operational patterns with an initial confidence score, updates scores on confirmed hits and misses, prunes stale entries, and makes reuse a hard step before acting. Triggers when an agent keeps re-learning the same mistakes, needs to audit its own heuristics, or wants experience to compound across runs. metadata: { "includeInPrompt": true }
An agent that never writes down what it learns will re-learn it forever. This skill runs a personal lessons ledger: a small, scored, pruned file of patterns the agent actually uses. The difference from a tips file is the scoring. Every entry carries a confidence score that moves with evidence, and a prune loop that deletes what stops being true. The ledger compounds: single incidents merge into broader rules as evidence accumulates.
When a task finishes, ask one question: did something here happen before, or will it happen again? If yes, write an entry. Five fields, no more:
One incident can still land in the ledger. The 0.5 starting score marks it as unverified, and the falsifier keeps it honest. This mirrors the SRE postmortem habit of writing the record even while the root cause is fresh, then letting the record earn its authority over time.
Read the ledger before starting work, not after finishing it. Scan for entries whose context matches the task. Follow entries with confidence above 0.7; treat 0.5 to 0.7 entries as hypotheses worth testing. If an entry fired and changed the outcome, close the loop in step 3.
A hit: the pattern predicted something correctly or prevented a repeat. A miss: the pattern fired and was wrong, or it stayed silent when it should have fired. Update with a fixed rule so scores stay comparable:
c = c + (1 - c) 0.2 (approaches 1 without ever reaching it)c = c 0.6 (a miss hurts more than a hit helps)This is deliberately asymmetric. Trust is hard to build and easy to lose, and the math should reflect that. Raw confidence without this calibration is exactly what goes wrong with uncalibrated judge models: confident and wrong beats nothing at all for being dangerous.
Delete anything that is dead weight. An entry is pruned when any of these hold:
Pruning is the discipline that separates a ledger from a junk drawer. Memory that never forgets degrades: stale entries get quoted at the wrong moment and cost more than the entries that were never captured. Archive pruned entries to a dated file rather than deleting them outright, so a recurring environment can revive them.
When three or more related entries all sit above 0.6, write a single meta-entry that subsumes them and link the originals as evidence. Example: entries about "verify the commit after committing," "snapshot files before destructive git operations," and "check rendered state after posting" compound into "never trust a claimed effect, verify it on the actual surface." Meta-entries score independently; if the meta-entry misses, demote it back to its children.
Every ledger entry, in markdown or JSON, contains exactly: pattern, evidence, context, confidence (float 0..1), last_touched (date), hits, misses, falsifier. Optional: tags, supersedes (links to merged entry ids).
The monthly prune produces a short report: entries pruned with reasons, entries promoted above 0.7, new meta-entries proposed.
bin/ledger.py implements the loop as a CLI over a JSON ledger file:
ledger.py add --pattern "..." --evidence "..." --context "..." --falsifier "..."
ledger.py hit <id> # confirmed correct
ledger.py miss <id> # confirmed wrong
ledger.py list --min 0.7 # entries worth trusting
ledger.py prune --days 60 --min 0.4 --archive archive.json
ledger.py merge <id1> <id2> --pattern "..." # compound into a meta-entry
LEDGER env var selects the file; defaults to ./ledger.json. JSON ids are L-001, L-002, and so on. All update math follows the rules in this file.
publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e
No ratings yet — be the first to rate it.