/learning-loop:rewritefrom learning-loop
Corrects outdated beliefs across vault notes, auto-memory, and episodic history. Searches all stores for the old pattern, presents an impact map, then executes user-approved edits and records a supersession.
Ships in learning-loop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When a belief turns out to be wrong (or refined), the wrong version sits in three places: the vault as durable notes, the auto-memory as preferences/feedback, and the episodic history as past conversations the LLM may resurface. This skill edits all three coherently.
The Katsuno-Mendelzon split:
/learning-loop:rewrite "old pattern" "new pattern": full form, with reason inferred/learning-loop:rewrite "old pattern" "new pattern" "reason": explicit reason for the supersession record/learning-loop:rewrite: no args, infer the change from recent conversation contextIf args are provided, parse old_pattern, new_pattern, optional reason.
If no args, read the conversation. The user just learned something that contradicts a prior belief. Identify:
If you cannot find a clear correction in the conversation, tell the user and stop. Ask them to provide old and new explicitly.
Confirm the framing in one line before proceeding:
Rewriting: "<old>" → "<new>" (reason: <reason>)
Search every store for the OLD pattern. Run all four searches in parallel (single message, multiple Bash calls):
Vault: semantic + keyword:
ll-run vault-search.mjs search "<old pattern>" --rerank
Vault: wiki-link/title hits:
Use Glob for filename matches: **/*<key-noun>*.md in {{VAULT}}/
Auto-memory:
Grep the project's ~/.claude/projects/*/memory/ directory for substrings of the old pattern. Read MEMORY.md and any matching files.
Episodic memory:
If the episodic memory MCP tool is available (mcp__plugin_episodic-memory_episodic-memory__search), call it with the old pattern. The post-search-tracking hook will already annotate the result if a supersession exists: do not pre-create one yet. If unavailable, skip this leg and note it in the hit map.
For every vault note hit from Phase 2, identify the primary note that codifies the old belief (or notes: there may be more than one). For each primary note, dispatch the correction-analyser agent (dispatch: skills-shared/dispatch.md):
agent: correction-analyser
prompt: |
note_path: <vault-relative path>
change_type: <retraction|update|weakening>
new_claim: <new pattern, if change_type is update>
Produce the impact map per your spec.
The agent traces the justification index for sole-justification dependents and classifies each by attack type. Run agents in parallel if there are multiple primary notes.
Show the user a single consolidated triage map:
# Rewrite Plan: <old> → <new>
## Vault notes (N hits)
- `path/to/primary.md`: primary belief codification
- Suggested: REWRITE (replace old claim with new)
- Downstream impact: 3 critical, 1 high, 0 medium (from correction-analyser)
- `path/to/related.md`: references the old belief
- Suggested: AMEND (update the wiki-link surrounding text)
## Auto-memory (N hits)
- `feedback_<name>.md`: captures the old guidance
- Suggested: REWRITE
## Episodic memory (N matches)
- N past conversations contain the pattern
- Suggested: SUPERSESSION RECORD (no edits: annotation only)
## Downstream cascade (from correction-analyser)
- `path/dependent-a.md`: CRITICAL (sole-dependent rebuttal)
- `path/dependent-b.md`: HIGH (sole-dependent undercutting)
- ...
Total proposed actions: <N>
Then ask the user, exactly once, in plain English:
Approve the plan? You can say
yes,no, or list specific items to skip (e.g. "skip auto-memory, skip dependent-b").
Wait for confirmation. Do not proceed until the user has answered. If they say no, stop and report nothing changed.
Run the approved actions. Use the right tool per store.
Vault rewrites/amends:
Use Edit for surgical changes (preferred: preserves frontmatter, links)
Always Read the file immediately before each Edit, even if you read it during Phase 2. The triage map can grow stale between rendering and execution if other tools touched the file in the meantime. The fresh read also lets you verify the surrounding text still matches what you'll pass to Edit.
For an ARCHIVE action, stamp the note in place rather than replacing it:
ll-run supersede-note.mjs <archived-note> --replacement <replacement-path> [--date YYYY-MM-DD]
This adds invalidated: <date> and superseded_by: <replacement-path> to the note's frontmatter, in the exact form capture-rules.md defines and enrichVaultHits honours, and leaves the body untouched. The note stays at its original path: history is what "archive" means here, not deletion or relocation, so "what did I believe, and what changed it" stays answerable from the note itself. A non-zero exit is a failure to report, not a skip: treat it as an error for this action rather than silently moving on. The script exits 0 and reports stamped: false, reason: 'already-invalidated' only when the note already carries invalidated: -- that is the one legitimate skip case. Because the file is not moved or overwritten, supersedeNoteFile itself archives the note's outgoing edges (marks them source_graph='archived'), so the links the retired note's own text makes stop counting in downstream traversal, without dumping and re-inserting them. Links other notes make to it ("[[retired]] confirms this") stay live until those notes are rewritten: they are dependents this flow should surface, not history.
The retired note stays in retrieval's search index, though: the Rust indexer only skips _-prefixed directories, which is how the old _archive/ move used to drop a note from search, and this flow leaves the note at its original path. It is dropped post-hoc by enrichVaultHits instead, so it still consumes a candidate slot in the ranked result set before that JS-side filter runs.
Vault transition note (mandatory if any vault notes were touched):
Write a new note to 0-inbox/ capturing the correction itself:
<new pattern phrased as a claim>[rewrite-transition]Auto-memory rewrites:
Edit on the relevant feedback_*.md or project_*.md fileMEMORY.md only if the description line changedSupersession record (mandatory): Always write the supersession, regardless of which other actions ran:
ll-run edges-cli.mjs super-add "<old pattern>" \
--replacement "<vault path of transition note or primary rewritten note>" \
--reason "<reason>"
This is what makes future episodic searches surface the correction inline.
Federation retraction notify (conditional, fail-soft): After the supersession record, check whether this instance is federated:
ll-run federation-active.mjs
If it prints FEDERATED, emit a retraction event for each vault note that was REWRITTEN or ARCHIVED this run, so peers holding the old version learn of the correction:
ll-run retraction-notify.mjs "<note_path>" \
--reason "<reason>" \
--replacement "<vault path of transition note or rewritten note>"
The script targets only peers whose index contains the note and appends the event to the federation outbox (retractions-YYYY-MM.jsonl). Nothing delivers that outbox today — no client or hub code reads federation/outbox/, so the event is a local record of what you would tell peers, not a message they receive. Peers learn of the correction when they next fetch your index and the note is changed or gone. If the probe prints not-federated (exit 1), skip silently. A notify failure is non-fatal: report it in Phase 6 and continue; it must never block or roll back the retraction itself.
Show one final block:
# Rewrite Complete
- Vault: <N rewrites>, <N amends>, <N archives>
- Auto-memory: <N rewrites>
- Transition note: <path>
- Supersession recorded: id <N>, pattern "<old>"
- Federation: <N retraction events emitted | not federated | notify failed: <error>>
Future episodic searches matching "<old>" will be annotated automatically.
supersede-note.mjs only edits frontmatter and, best-effort, marks the edges from the note's own links archived so they drop out of downstream traversal (other notes' links to it stay live); the note itself is untouched, and the post-write hook chain never fires for it./learning-loop:deepen: strengthens a single note in place (no cross-store coordination)/learning-loop:reflect: end-of-session consolidation (different intent: capture, not retract)learning-loop:correction-analyser (agent, not skill): the edge-traversal subroutine this skill callsWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub robinslange/learning-loop --plugin learning-loop24 skills in this plugin
/deepenStrengthen a single vault note with research. Usage: /learning-loop:deepen "note name" or /learning-loop:deepen (picks shallowest inbox note). Assesses maturity, researches gaps, rewrites in vault voice, promotes when ready./diagramGenerate an Excalidraw diagram for the vault. Usage: /learning-loop:diagram "concept or mechanism" or /learning-loop:diagram (infers from context). Produces .excalidraw.md in vault Excalidraw/ folder./discoveryExplore a topic interactively with web research and vault context. Usage: /learning-loop:discovery "topic" [--style guided|branch|checkpoint] [--tone academic|conversational|persona] [--surf]. --surf skips note creation./doctorDiagnose your learning-loop installation. Runs health checks, presents issues, offers per-fix remediation, re-runs each check after the fix to confirm. Safe to run anytime; only makes changes you approve. Pass --redact to scan plugin data files for leaked credentials instead./dreamConsolidate auto-memory between sessions. Usage: /learning-loop:dream (no args). Four-phase cycle: Orient, Gather Signal, Consolidate, Prune Index. Seven operators: MERGE, RESOLVE, ABSTRACT, COMPRESS, PRUNE, LINK, DATE NORMALIZE. Rebuilds MEMORY.md./dream-evalmeasure whether a /dream pass helps, hurts, or ties against no consolidation. usage: /learning-loop:dream-eval --mode={single|control|repeated} [--passes=N] [--mine]. single scores pre/post on the live corpus; control forks two clones and dreams one; repeated dreams a clone N times and plots the drift + content-survival curve.Other plugins' skills for the same job