Skip to content

feat: mistake ledger — never make the same mistake twice - #24

Merged
willynikes2 merged 23 commits into
masterfrom
feat/mistake-ledger
Oct 14, 2026
Merged

willynikes2 merged 23 commits into
masterfrom
feat/mistake-ledger

Conversation

@willynikes2

Copy link
Copy Markdown
Owner

Every mistake a reviewer or test catches in an agent's work is kept with its fix. Mistakes that repeat across tasks become short rules ("patterns"); the operator approves them; agents get the matching ones before they start a task. The first-review pass rate is recorded per run and per model.

  • Ledger: append-only ~/.knowledge-base/mistakes/ledger.jsonl; secrets removed before anything is kept; corrections supersede, never edit.
  • Patterns: vault notes patterns/<slug>.md, drafted by a model (with every tool off) and gated by code: mistakes from at least 2 tasks, a rule of at most 60 words, real examples. Approved patterns are split into a taught half and a held-back half for a later experiment; only taught patterns are searchable.
  • Approval: kb patterns page writes a numbered page; kb patterns set-status "approve 1 and 3, edit 2: …, reject 4" applies all-or-nothing. Numbers are permanent, and a decision is refused if the pattern changed after the page was made.
  • Delivery and metrics: /api/v1/patterns/for, /mistakes, /runs and /mistakes/metrics, for the swarm key only (that key opens nothing else). Local MCP tools kb_mistake_record and kb_patterns_for. A Learning panel in the dashboard.
  • Importers: past subagent-build review records and the October catalogue of mined mistakes.
  • CLI: kb mistakes …, kb patterns ….

Spec: docs/superpowers/specs/2026-10-13-mistake-ledger-design.md. Plan: docs/superpowers/plans/2026-10-14-mistake-ledger.md (see its amendments). Docs: docs/mistake-ledger.md.

Tests: 313 passing (154 new). Reviewed by Opus (whole branch), an automated security pass and Codex. Every finding was fixed with a test seen failing first.

Rollout steps after merge (adding a swarm key, restarting the server, backfill, the first approval page) are separate and need the operator's go-ahead.

🤖 Generated with Claude Code

willynikes2 and others added 22 commits October 13, 2026 20:15
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ten tasks in five waves, plus the controller's rollout and backfill. Every code block was run as a
prototype first (112 new tests and the existing tools, v1 and api-key tests passing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and supersede

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and unused-pattern detection

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d log each delivery

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d the seed catalogue

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ast two tasks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… reject 4') applied all-or-nothing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/middleware/api-key.js
…al numbers, swarm-only routes

- Secrets: wider patterns (keys with dashes, tokens by prefix, bearer headers, quoted names, URL passwords,
  private-key blocks) on every kept field; caught_by is bounded.
- The idempotency key is compared exactly and never rewritten; run keys keep their parts apart.
- Approval: a pattern keeps its number across pages, a number is never reused, and a decision is refused
  when the pattern changed after the page was made.
- The ledger routes take the swarm key only; that key opens nothing else (not the rest of the API, not MCP).
  A record sent over HTTP is a swarm record and cannot supersede. Server faults answer with a plain message.
- kb_mistake_record is a local tool only.
- Pattern notes are read as YAML data; a draft never overwrites an existing note file; a correction stays
  with the pattern that used the original.
- The KB copy of a record is made once and retried on a repeat; imports say how many copies failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the review changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a local tool

Bounded the name and URL-scheme parts of the redaction patterns and cut input past 64 KB (nothing past
4 KB is kept), so one large request cannot stall the server. The MCP pitfalls tool joins the local-only
list, matching the swarm-only HTTP route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… itself)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only patterns approved for teaching are indexed, so the held-back half stays unseen by agents and the
later experiment that compares them stays fair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/mistakes/store.js Fixed
Comment thread src/mistakes/store.js Fixed
Comment thread src/mistakes/store.js Fixed
Comment thread src/mistakes/store.js Fixed
…ore cleaning

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/mistakes/store.js Dismissed
@willynikes2
willynikes2 merged commit 2dc3e53 into master Oct 14, 2026
8 of 9 checks passed
@willynikes2
willynikes2 deleted the feat/mistake-ledger branch October 14, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants