A self-organizing Obsidian vault that gives AI coding agents persistent memory.
TypeScript ai-agentsclaude-codecodex-cligemini-cliknowledge-managementobsidianobsidian-vaultpersistent-memorysecond-braintemplate
feat: /om-correct sweeps a corrected fact, and preserves the record (#220)
Brenno Ferrari1c02b3dea02d
diff --git a/.claude/agents/correction-sweep.md b/.claude/agents/correction-sweep.mdnew file mode 100644index 0000000..ad1e1f0--- /dev/null+++ b/.claude/agents/correction-sweep.md@@ -0,0 +1,82 @@+---+name: correction-sweep+description: "Find every note restating a corrected fact and classify each as authoritative, restatement, or historical. Discovery and judgement only — never edits. Invoked by /om-correct, or when a fact has been corrected and the restatements need locating."+tools: Read, Grep, Glob, Bash+model: sonnet+maxTurns: 25+skills:+ - qmd+ - obsidian-markdown+---++You locate every note in an obsidian-mind vault that carries a fact which has just been corrected, and classify what may be done to each.++**You never edit anything.** You return a plan. The parent applies it after reading it. This separation is deliberate: the edits are irreversible and the classification is the part that needs a second pair of eyes.++## Input++The corrected fact, stated as it is now true. Optionally the path of the authoritative single-source note.++## 1. Find candidates — both arms, always++**Semantic.** `qmd query "<the corrected fact>"` using the index name in `vault-manifest.json`. This arm exists for the *paraphrase*: the same claim in different words, sharing none of the same strings. It is invisible to grep, indistinguishable from correct prose to every structural check, and the half most likely to survive a manual sweep, because a human sweeper stops when grep goes quiet.++**Literal.** Grep the distinctive strings: version numbers, tool names, counts, identifiers, proper nouns. This arm exists for the bare `v8.3.2` that means nothing to an embedding.++Run both. Merge the hits. Neither arm alone is sufficient, and a sweep that runs one and reports confidently is worse than one that admits it looked in a single place.++## 2. Read each hit before classifying it++Do not classify from a search snippet. Open the note and find the sentence that carries the claim.++**A note that mentions the subject is not necessarily restating the fact.** Token overlap is blind. A note making a *different* claim about the same thing is not a restatement, and reporting it as one invites a silent content loss. If you cannot point at the sentence that asserts the corrected fact, it is not a hit — drop it and say you dropped it.++## 3. Classify++| class | test | disposition |+|---|---|---|+| **HISTORICAL** | records what was believed at the time | **preserve** — checked FIRST, and it wins over everything |+| **AUTHORITATIVE** | the designated single-source note | correction applied here, exactly one |+| **RESTATEMENT** | a living note asserting the fact | assertion becomes a link to the source |++A note is **historical** if any one of these holds:++- a record directory anywhere in its path: `archive/`, `1-1/`, `meetings/`, `thinking/`, `memories/`, `journal/`, `incidents/`+- a date in the filename, prefix **or** suffix (the 1:1 convention is `<Person> YYYY-MM-DD.md`, so a prefix-only reading misses all of them)+- frontmatter `status` of `superseded`, `archived`, `completed`, `deprecated`, `done`++A frontmatter `date:` is **not** a signal — every note has one.++HISTORICAL is checked before AUTHORITATIVE. If the single-source note has itself been archived or superseded, the correction belongs in whatever replaced it, and rewriting the retired one is precisely the damage this whole design exists to prevent.++## 4. Return the plan++```+FACT: <the corrected fact, as given>+AUTHORITATIVE: <path, or NONE IDENTIFIED>++APPLY+ <path>:<line> <the sentence carrying the claim>++REPLACE WITH LINK+ <path>:<line> <the sentence> → link to <authoritative path>++PRESERVE (historical — do not edit)+ <path> <why: record directory / dated filename / status: superseded>++DROPPED (matched the search, does not assert the fact)+ <path> <what it actually claims>++UNCERTAIN (needs a human call)+ <path>:<line> <the sentence> <why you could not decide>+```++If no authoritative note is identified, say so and put **everything** under UNCERTAIN. Replacing restatements with links to a source nobody corrected propagates the stale claim behind a link instead of removing it, which is worse than leaving it alone.++## The asymmetry that governs every judgement call++A **missed restatement** is a stale claim someone will eventually read, notice, and fix. Recoverable and visible.++A **rewritten record** destroys a true thing. Afterwards the note reads perfectly fine and carries no trace that it ever said otherwise. Nothing detects it and nothing recovers it.++So when you are unsure, it goes under UNCERTAIN or PRESERVE. Never guess in the direction of editing.diff --git a/.claude/commands/om-correct.md b/.claude/commands/om-correct.mdnew file mode 100644index 0000000..e0562af--- /dev/null+++ b/.claude/commands/om-correct.md@@ -0,0 +1,87 @@+---+description: "Sweep a corrected fact through the vault — finds every note restating it, applies the correction at the single source, replaces restatements with links, and preserves notes that correctly record what was believed at the time."+---++# /om-correct++```+/om-correct "<the corrected fact, stated as it is now true>"+```++The acting half of Write-Correctness Law 2. Laws 1 and 2 already say a corrected fact must be swept out of every note restating it; this is the thing that does it.++Run it **at the moment of correction**, not on a schedule. `/om-vault-audit` is periodic, whole-vault and structural, and takes no argument. A sweep needs the corrected fact as input, because nothing in the vault can resolve two contradicting notes — nothing in it says which is true. Only the person making the correction knows, which is why the fact is an argument and not a discovery.++## Hard rails++- **A historical note is never edited.** Not carefully, not with a callout. It is reported and preserved. See the asymmetry below.+- **Never delete.** Restatements are replaced with a link to the source, not removed.+- **Never commit.** Leave the working tree for review.+- **No authoritative note, no edits.** If the single source cannot be identified, the pass reports and stops rather than guessing.++## 1. Find++Both arms, always. Neither alone is sufficient.++- **Semantic** — `qmd query "<the corrected fact>"` (index name from `vault-manifest.json`). This is the arm that finds the *paraphrase*: the same claim in someone else's words, with none of the same strings. That half is invisible to grep and indistinguishable from correct prose to every structural check, and it is the half most likely to survive a manual sweep, because the sweeper stops when grep goes quiet.+- **Literal** — grep the distinctive strings from the fact: version numbers, tool names, counts, identifiers. This is the arm that finds a bare `v8.3.2` that means nothing to an embedding.++## 2. Classify++This is the design. The search is the easy part.++| class | what it is | what happens |+|---|---|---|+| **AUTHORITATIVE** | the single-source note Law 1 designates | the correction is **applied** here, and only here |+| **RESTATEMENT** | a living note asserting the fact, which per Law 1 should be linking to the source instead | the assertion is **replaced with a link** — fixes today's stain and prevents the next |+| **HISTORICAL** | a note that correctly records what was believed *at the time* | **preserved**, and reported so the omission is visible |++`isHistoricalNote` in `.claude/scripts/lib/correction-sweep.ts` decides the third category, and its rules are pinned by tests. A note is historical if **any one** holds:++- it sits under a record directory (`archive/`, `1-1/`, `meetings/`, `thinking/`, `memories/`, `journal/`, `incidents/`)+- its filename carries a date, prefix **or** suffix — this vault's 1:1 convention is `<Person> YYYY-MM-DD.md`+- its frontmatter `status` is `superseded`, `archived`, `completed`, `deprecated` or `done`++A frontmatter `date:` is deliberately **not** a signal. Every note has one.++**Ask before assuming a note is a restatement.** Token overlap is blind. A note that mentions the same subject while making a different claim is not restating anything, and rewriting it is a silent content loss.++## 3. Apply, in one pass++Report what changed and what was deliberately preserved:++```+/om-correct "the qmd MCP surface exposes no lexical search tool"++ AUTHORITATIVE reference/QMD.md:12 ← correction applied here+ RESTATEMENT brain/Gotchas.md:47 → replaced with link+ RESTATEMENT work/Search Quality.md:88 → replaced with link+ HISTORICAL work/archive/2026/Intake.md ✋ preserved — records what+ was believed 2026-03-02++ 2 fixed, 1 applied, 1 preserved.+```++A correction callout on top of a note whose body still says the wrong thing is **not** a correction. Law 2 rules that out in as many words: the body is what future sessions re-absorb.++## Why historical notes are untouchable++The two failure modes are not symmetric, and the whole design follows from that.++A **missed restatement** leaves a stale claim somewhere. Someone reads it, notices, and fixes it. Recoverable, and visible.++A **rewritten record** destroys a true thing. The note said what was believed on a date; afterwards it says something else, reads perfectly fine, and carries no trace that it ever said otherwise. Nothing detects it, and nothing recovers it.++Law 5 warns about this class directly: an attribution quarter differing from a creation date "is legitimate, not a bug to fix". A sweep enthusiastic about consistency is how that law gets violated at scale.++So when the classification is uncertain, the note is preserved and reported. Always.++## Delegation++For a sweep touching more than a handful of notes, invoke the `correction-sweep` agent so the many-note read runs in its own context window — the same pattern `/om-vault-audit` uses for `vault-librarian`. The agent returns a classified plan; the edits happen here, after you have read it.++## Related++- `/om-vault-audit` — structural health, periodic, whole-vault. Complementary: it checks shape, this checks truth.+- `/om-tidy` — acts on hygiene flags. Also structural.+- `CLAUDE.md` § Write-Correctness Laws — Laws 1, 2 and 5, which this implements.diff --git a/.claude/scripts/lib/correction-sweep.ts b/.claude/scripts/lib/correction-sweep.tsnew file mode 100644index 0000000..8f72fc8--- /dev/null+++ b/.claude/scripts/lib/correction-sweep.ts@@ -0,0 +1,201 @@+/**+ * The correction sweep — the judgement half.+ *+ * WHY THIS EXISTS+ *+ * `CLAUDE.md` Law 2 instructs a sweep: when a fact is corrected, find every+ * restatement and fix them all in the same pass. Nothing in the vault helped do+ * it. Every existing check is about a note's SHAPE — frontmatter present,+ * wikilinks resolve, size under the split threshold, orphans, stale actives —+ * and none is about whether what a note SAYS is still true. A note can be+ * structurally perfect and assert a fact the vault corrected months ago, and it+ * keeps feeding that fact to every session that reads it.+ *+ * Worse, `signals.ts` already tells the agent to sweep on a decision reversal.+ * So on the one path where the vault detects a correction happening, it issued+ * an instruction and handed over nothing to act with — an instruction that looks+ * like a control and cannot act.+ *+ * WHY THE PREDICATE IS THE CORE, NOT THE SEARCH+ *+ * Finding candidates is the easy half. The dangerous half is deciding what may+ * be edited, because the three categories need OPPOSITE treatment:+ *+ * AUTHORITATIVE the single-source note Law 1 designates. The correction is+ * APPLIED here. Exactly one, and it is the only note whose+ * claim is rewritten.+ * RESTATEMENT a living note asserting the fact that should be linking to+ * the source instead. Per Law 1 it is replaced with a link,+ * which fixes today's stain and prevents the next one.+ * HISTORICAL a note that correctly records what was believed AT THE TIME.+ * Rewriting it destroys a true record.+ *+ * A sweep that cannot tell a stale claim from a historical record is worse than+ * no sweep. It silently rewrites the vault's memory of what it used to believe,+ * and that damage is both unrecoverable and invisible, because the note still+ * reads fine afterwards. Law 5 warns about exactly this class of+ * over-correction: an attribution quarter differing from a creation date "is+ * legitimate, not a bug to fix". A sweep enthusiastic about consistency is how+ * that law gets violated at scale.+ *+ * So the predicate is isolated here and pinned by tests, the way+ * `isMonolithExempt` isolates the judgement the monolith sensor depends on. The+ * command around it is thin orchestration.+ *+ * TWO RULES DECIDED DELIBERATELY, NOT INHERITED+ *+ * 1. Historical is keyed on BOTH the naming convention AND explicit signals.+ * The convention alone (`CLAUDE.md` § Creating Notes: point-in-time notes+ * carry a date, living notes do not) is the right instinct but too fragile to+ * be the only signal — it silently misclassifies the moment someone names a+ * file differently. Frontmatter `status` and the archive/log directories say+ * the same thing explicitly, and any ONE of them is enough.+ *+ * 2. A historical note is NEVER edited. It is reported and preserved, always.+ * Not "edited carefully", not "edited with a callout". The asymmetry is the+ * whole point: a missed restatement is a stale claim someone will notice and+ * can fix later, while a rewritten record is a true thing destroyed with no+ * trace that it ever said otherwise.+ *+ * All pure. No IO, no index, no network — the search arms and the file writes+ * live in the command and its agent.+ */++/** What may be done to a note carrying the corrected fact. */+export type NoteClass = "AUTHORITATIVE" | "RESTATEMENT" | "HISTORICAL";++/** A candidate the search arms turned up. */+export interface SweepCandidate {+ /** Vault-relative POSIX path. */+ readonly rel: string;+ /** Parsed frontmatter; `{}` when the note has none. */+ readonly frontmatter: Record<string, unknown>;+}++/**+ * Directories whose contents are records of a moment by construction.+ *+ * Matched on a path SEGMENT rather than a substring, so a living note that+ * merely contains the word (`work/archive-policy.md`) is not swept into the+ * exemption. `thinking/` is included because a scratchpad records reasoning as+ * it stood; `memories/` because captures carry their own supersession machinery+ * and a text sweep editing them would fight it.+ */+const HISTORICAL_DIRS = new Set(["archive", "1-1", "meetings", "thinking", "memories", "journal", "incidents"]);++/**+ * Frontmatter `status` values that mark a note as a closed record.+ *+ * `completed` is included on purpose. A finished piece of work describes what+ * was done, and editing it to agree with the present falsifies the record just+ * as surely as editing a dated capture would.+ */+const HISTORICAL_STATUS = new Set(["superseded", "archived", "completed", "deprecated", "done"]);++/** A date anywhere in the filename, not only as a prefix. */+const DATE_IN_NAME = /\d{4}-\d{2}-\d{2}/;++/**+ * Does this note record a moment rather than assert a present fact?+ *+ * Any one signal is enough. They are deliberately redundant: the naming+ * convention catches what the frontmatter forgot, and the frontmatter catches+ * what a rename broke.+ *+ * Note that `date:` in frontmatter is NOT a signal. Every note in this vault has+ * one, so treating it as evidence would classify the entire vault as historical+ * and turn the sweep into an expensive no-op.+ */+export function isHistoricalNote(+ relPath: string,+ frontmatter: Record<string, unknown> = {},+): boolean {+ const rel = String(relPath ?? "").replace(/\\/g, "/");+ if (rel === "") return false;++ const segments = rel.split("/");+ const fileName = segments.pop() ?? "";++ // 1. A record-keeping directory anywhere in the path.+ if (segments.some((s) => HISTORICAL_DIRS.has(s.toLowerCase()))) return true;++ // 2. A date in the filename — the convention's own marker for point-in-time.+ if (DATE_IN_NAME.test(fileName)) return true;++ // 3. An explicit status saying the note is closed.+ const status = frontmatter?.["status"];+ if (typeof status === "string" && HISTORICAL_STATUS.has(status.trim().toLowerCase())) return true;++ return false;+}++/**+ * Classify one candidate.+ *+ * The authoritative note is passed in rather than inferred, because nothing in+ * the vault can decide which of two contradicting notes is true — only the+ * person making the correction knows, which is why the sweep takes the corrected+ * fact as an argument in the first place.+ *+ * HISTORICAL is checked BEFORE authoritative on purpose. If the single-source+ * note has itself been archived or superseded, the correction belongs in+ * whatever replaced it, and rewriting the retired one would be the exact damage+ * this module exists to prevent.+ */+export function classifyCandidate(+ candidate: SweepCandidate,+ authoritativeRel: string | null,+): NoteClass {+ if (isHistoricalNote(candidate.rel, candidate.frontmatter)) return "HISTORICAL";+ if (authoritativeRel && samePath(candidate.rel, authoritativeRel)) return "AUTHORITATIVE";+ return "RESTATEMENT";+}++const samePath = (a: string, b: string): boolean =>+ String(a).replace(/\\/g, "/").toLowerCase() === String(b).replace(/\\/g, "/").toLowerCase();++export interface SweepPlan {+ /** The one note whose claim is rewritten. */+ readonly apply: SweepCandidate | null;+ /** Living notes whose restatement becomes a link to the source. */+ readonly replaceWithLink: SweepCandidate[];+ /** Records left exactly as they are, reported so the omission is visible. */+ readonly preserve: SweepCandidate[];+ /**+ * Candidates that would have been edited had the authoritative note been+ * named. Kept separate rather than silently folded into `replaceWithLink`,+ * because replacing every restatement with a link to a source that was never+ * corrected propagates the stale claim behind a link instead of removing it.+ */+ readonly blocked: SweepCandidate[];+}++/**+ * Turn classified candidates into what the command will actually do.+ *+ * Refuses to plan edits when no authoritative note is designated. Law 1 puts the+ * fact in exactly one place; without knowing where that is, "replace this+ * restatement with a link" has nowhere correct to point, and applying the+ * correction to several notes at once recreates the very duplication the law+ * exists to prevent.+ */+export function planSweep(+ candidates: readonly SweepCandidate[],+ authoritativeRel: string | null,+): SweepPlan {+ const apply: SweepCandidate[] = [];+ const replaceWithLink: SweepCandidate[] = [];+ const preserve: SweepCandidate[] = [];++ for (const c of candidates) {+ const klass = classifyCandidate(c, authoritativeRel);+ if (klass === "HISTORICAL") preserve.push(c);+ else if (klass === "AUTHORITATIVE") apply.push(c);+ else replaceWithLink.push(c);+ }++ if (!authoritativeRel || apply.length === 0) {+ return { apply: null, replaceWithLink: [], preserve, blocked: replaceWithLink };+ }+ return { apply: apply[0] ?? null, replaceWithLink, preserve, blocked: [] };+}diff --git a/.claude/scripts/lib/signals.ts b/.claude/scripts/lib/signals.tsindex 665d1a8..ebac6aa 100644--- a/.claude/scripts/lib/signals.ts+++ b/.claude/scripts/lib/signals.ts@@ -38,7 +38,7 @@ export const SIGNALS: readonly Signal[] = ["DECISION detected — consider creating a Decision Record in work/active/ and logging in work/Index.md Decisions Log",subHint: {message:- "Looks like a decision REVERSAL — update the ORIGINAL Decision Record (status: superseded, link the new one) instead of only adding a second record; the correction-sweep rule applies to every note restating the old decision.",+ "Looks like a decision REVERSAL — update the ORIGINAL Decision Record (status: superseded, link the new one) instead of only adding a second record; run `/om-correct \"<the corrected fact>\"` to sweep every note restating the old decision.",patterns: ["reversed","superseded",diff --git a/.claude/scripts/tests/correction-sweep.test.ts b/.claude/scripts/tests/correction-sweep.test.tsnew file mode 100644index 0000000..5adbe77--- /dev/null+++ b/.claude/scripts/tests/correction-sweep.test.ts@@ -0,0 +1,168 @@+/**+ * The correction sweep's judgement, pinned.+ *+ * The search half of a sweep is cheap and its failures are visible: a missed+ * note keeps saying something stale until someone reads it. The classification+ * half is neither. Rewriting a note that correctly recorded what was believed at+ * the time destroys a true record, leaves the note reading perfectly fine, and+ * cannot be detected afterwards by anything.+ *+ * So these tests are weighted towards what must NOT be touched.+ */++import { test, describe } from "node:test";+import assert from "node:assert/strict";++import {+ isHistoricalNote,+ classifyCandidate,+ planSweep,+ type SweepCandidate,+} from "../lib/correction-sweep.ts";++const note = (rel: string, frontmatter: Record<string, unknown> = {}): SweepCandidate => ({+ rel,+ frontmatter,+});++describe("isHistoricalNote", () => {+ test("an archived note is historical whatever it is named", () => {+ assert.equal(isHistoricalNote("work/archive/2026/Search Rollout.md"), true);+ });++ test("a dated 1:1 is historical", () => {+ // Carried by the DIRECTORY rule, not the date — `1-1` is a record folder.+ // The date rule is isolated separately below, because a test that passes+ // for a reason it does not name pins nothing.+ assert.equal(isHistoricalNote("work/1-1/Dana Ruiz 2026-03-02.md"), true);+ });++ test("a dated capture is historical", () => {+ assert.equal(isHistoricalNote("work/meetings/2026-03-02 Platform Sync.md"), true);+ });++ // The naming-convention signal ON ITS OWN: no record directory in the path,+ // no status in the frontmatter, nothing but the date to go on.+ test("a date in the filename is enough by itself, prefix or suffix", () => {+ // The suffix case is the one that matters. This vault's 1:1 convention is+ // `<Person> YYYY-MM-DD.md`, so a rule anchored at the start of the name+ // looks correct, passes the directory-backed tests, and silently misses+ // every dated note living outside a record folder.+ assert.equal(isHistoricalNote("org/Reorg Notes 2026-03-02.md"), true);+ assert.equal(isHistoricalNote("work/2026-03-02 Platform Sync.md"), true);+ });++ test("a superseded decision record is historical on frontmatter alone", () => {+ assert.equal(isHistoricalNote("work/Search Rollout.md", { status: "superseded" }), true);+ });++ test("a completed work note is historical — it describes what was done", () => {+ assert.equal(isHistoricalNote("work/Search Rollout.md", { status: "completed" }), true);+ });++ test("a living work note is NOT historical", () => {+ assert.equal(isHistoricalNote("work/Search Quality.md", { status: "active" }), false);+ });++ test("a brain note is NOT historical — it is where corrections land", () => {+ assert.equal(isHistoricalNote("brain/Gotchas.md"), false);+ assert.equal(isHistoricalNote("reference/QMD.md"), false);+ });++ // `date:` is on every note in the vault. Reading it as evidence would+ // classify everything as historical and make the sweep an expensive no-op.+ test("a frontmatter date alone does not make a note historical", () => {+ assert.equal(isHistoricalNote("work/Search Quality.md", { date: "2026-03-02" }), false);+ });++ // Segment match, not substring: otherwise a living policy note about+ // archiving is exempted by its own title.+ test("a living note whose name merely contains a keyword is not exempted", () => {+ assert.equal(isHistoricalNote("work/archive-policy.md"), false);+ assert.equal(isHistoricalNote("reference/meetings-etiquette.md"), false);+ });++ test("status matching is case and whitespace tolerant", () => {+ assert.equal(isHistoricalNote("work/x.md", { status: " Superseded " }), true);+ });++ test("a malformed status is not a licence to edit", () => {+ assert.equal(isHistoricalNote("work/x.md", { status: 42 }), false);+ assert.equal(isHistoricalNote("work/x.md", {}), false);+ });++ test("windows separators classify the same as posix", () => {+ assert.equal(isHistoricalNote("work\\archive\\2026\\Thing.md"), true);+ });+});++describe("classifyCandidate", () => {+ const AUTH = "reference/QMD.md";++ test("the designated single source is AUTHORITATIVE", () => {+ assert.equal(classifyCandidate(note(AUTH), AUTH), "AUTHORITATIVE");+ });++ test("a living note asserting the fact is a RESTATEMENT", () => {+ assert.equal(classifyCandidate(note("brain/Gotchas.md"), AUTH), "RESTATEMENT");+ });++ test("an archived note is HISTORICAL even while the sweep runs", () => {+ assert.equal(classifyCandidate(note("work/archive/2026/Intake.md"), AUTH), "HISTORICAL");+ });++ // If the single-source note has itself been retired, the correction belongs+ // in whatever replaced it. Rewriting the retired one is the exact damage+ // this module exists to prevent, so HISTORICAL wins.+ test("HISTORICAL beats AUTHORITATIVE when the source note is itself retired", () => {+ const retired = note(AUTH, { status: "superseded" });+ assert.equal(classifyCandidate(retired, AUTH), "HISTORICAL");+ });+});++describe("planSweep", () => {+ const AUTH = "reference/QMD.md";+ const candidates = [+ note(AUTH),+ note("brain/Gotchas.md"),+ note("work/Search Quality.md", { status: "active" }),+ note("work/archive/2026/Intake.md"),+ note("work/1-1/Dana Ruiz 2026-03-02.md"),+ ];++ test("exactly one note is edited and every record is preserved", () => {+ const plan = planSweep(candidates, AUTH);+ assert.equal(plan.apply?.rel, AUTH);+ assert.deepEqual(+ plan.replaceWithLink.map((c) => c.rel),+ ["brain/Gotchas.md", "work/Search Quality.md"],+ );+ assert.deepEqual(plan.preserve.map((c) => c.rel), [+ "work/archive/2026/Intake.md",+ "work/1-1/Dana Ruiz 2026-03-02.md",+ ]);+ assert.deepEqual(plan.blocked, []);+ });++ // Replacing restatements with links to a source nobody corrected propagates+ // the stale claim behind a link rather than removing it.+ test("with no authoritative note designated, NOTHING is edited", () => {+ const plan = planSweep(candidates, null);+ assert.equal(plan.apply, null);+ assert.deepEqual(plan.replaceWithLink, []);+ assert.equal(plan.blocked.length, 3, "the would-be edits are reported, not performed");+ assert.equal(plan.preserve.length, 2, "records are still preserved and still reported");+ });++ test("an authoritative path that matched nothing blocks the pass too", () => {+ const plan = planSweep([note("brain/Gotchas.md")], "reference/Nowhere.md");+ assert.equal(plan.apply, null);+ assert.deepEqual(plan.blocked.map((c) => c.rel), ["brain/Gotchas.md"]);+ });++ test("a sweep over only records edits nothing and loses nothing", () => {+ const plan = planSweep([note("work/archive/2026/Intake.md")], AUTH);+ assert.equal(plan.apply, null);+ assert.deepEqual(plan.preserve.map((c) => c.rel), ["work/archive/2026/Intake.md"]);+ });+});diff --git a/CLAUDE.md b/CLAUDE.mdindex efc0ff2..a211a7e 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -425,6 +425,7 @@ Specialized agents in `.claude/agents/` for heavy operations. They run in isolat|-------|---------|------------|| `brag-spotter` | Finds uncaptured wins and competency gaps | `/om-wrap-up`, `/om-weekly` || `context-loader` | Loads all vault context about a person, project, or concept | Direct |+| `correction-sweep` | Finds every note restating a corrected fact; classifies each as authoritative, restatement, or historical. Never edits | `/om-correct` || `cross-linker` | Finds missing wikilinks, orphans, broken backlinks | `/om-vault-audit` || `people-profiler` | Bulk creates/updates person notes from Slack profiles | `/om-incident-capture` || `review-prep` | Aggregates all performance evidence for a review period | `/om-review-brief` |@@ -450,7 +451,7 @@ Five lifecycle hooks in `.claude/settings.json`:Each law exists because its absence caused real correction work in vaults running this template. Violating them re-creates documented failures.1. **Single-source status.** A project's volatile status (version, counts, released/blocked, dates) lives in exactly ONE place — its note's frontmatter + top status line. Every other note **links** to it and never restates it. *Why: one wrong status statement hardened into ~8 notes downstream and had to be swept out.*-2. **Correction-sweep protocol.** When a fact is corrected, grep the vault for every restatement and fix them all in the same pass. A correction callout on top of a note whose body still says the wrong thing is NOT a correction — future sessions re-absorb the stain from the body.+2. **Correction-sweep protocol.** When a fact is corrected, find every restatement and fix them all in the same pass. **`/om-correct "<the corrected fact>"` is the acting half** — grep alone finds only the notes that copied the wording, and the expensive half is the *paraphrase*: the same claim in different words, invisible to grep and indistinguishable from correct prose to every structural check. It is also the half most likely to survive a manual sweep, because the sweeper stops when grep goes quiet. A correction callout on top of a note whose body still says the wrong thing is NOT a correction — future sessions re-absorb the stain from the body. Notes that correctly record what was believed *at the time* are preserved, never rewritten; see Law 5.3. **Mark inference.** Anything not verified against source (code, repo, primary doc, the person) carries an explicit `(TBC)` / `(unverified)` / `(inferred)` marker. Never state inference bare.4. **Date-stamp volatile facts.** Counts, versions, org structure, tool maturity: write "as of YYYY-MM-DD" so staleness is self-evident instead of silent.5. **Attribution vs. creation dates may differ** (a `quarter:` field vs. the `date:` field's quarter) — that's legitimate, not a bug to "fix".diff --git a/README.ja.md b/README.ja.mdindex ae89a84..32edfc8 100644--- a/README.ja.md+++ b/README.ja.md@@ -306,6 +306,7 @@ obsidian-mindはClaude Code、Codex CLI、Gemini CLIで動作します。`CLAUDE| `/om-review-brief` | レビューブリーフを生成(マネージャー版またはピア版) || `/om-self-review` | レビューシーズン用の自己評価を作成 — プロジェクト、コンピテンシー、原則 || `/om-review-peer` | ピアレビューを作成 — プロジェクト、原則、パフォーマンスサマリー |+| `/om-correct` | 修正した事実を一括反映 — 単一の情報源に適用し、他ノートの記述はリンクに置換、日付付きの記録は保全 || `/om-vault-audit` | インデックス、リンク、孤立ノート、古いコンテキストを監査 || `/om-vault-upgrade` | 既存ボールトからコンテンツをインポート — バージョン検出、分類、移行 || `/om-project-archive` | 完了プロジェクトをactive/からarchive/に移動し、インデックスを更新 |diff --git a/README.ko.md b/README.ko.mdindex a14d652..66d6264 100644--- a/README.ko.md+++ b/README.ko.md@@ -306,6 +306,7 @@ obsidian-mind는 Claude Code, Codex CLI, Gemini CLI에서 작동합니다. `CLAU| `/om-review-brief` | 리뷰 브리프 생성 (매니저 또는 동료 버전) || `/om-self-review` | 리뷰 시즌을 위한 자기 평가 작성 — 프로젝트, 역량, 원칙 || `/om-review-peer` | 동료 리뷰 작성 — 프로젝트, 원칙, 성과 요약 |+| `/om-correct` | 수정된 사실을 일괄 반영 — 단일 출처에 적용하고, 재진술은 링크로 대체하며, 날짜가 있는 기록은 보존 || `/om-vault-audit` | 인덱스, 링크, 고아 노트, 오래된 컨텍스트 감사 || `/om-vault-upgrade` | 기존 볼트에서 콘텐츠 가져오기 — 버전 감지, 분류, 마이그레이션 || `/om-project-archive` | 완료된 프로젝트를 active/에서 archive/로 이동, 인덱스 업데이트 |diff --git a/README.md b/README.mdindex caa08d0..bf287a3 100644--- a/README.md+++ b/README.md@@ -401,6 +401,7 @@ Defined in `.claude/commands/`. Run them in Claude Code, Codex CLI, or Gemini CL| `/om-self-review` | Write your self-assessment for review season — projects, competencies, principles || `/om-review-peer` | Write a peer review — projects, principles, performance summary || `/om-tidy` | Self-maintenance — acts on every hygiene flag: archive, group, split. Never deletes, never commits |+| `/om-correct` | Sweep a corrected fact — applies it at the single source, links restatements, preserves dated records || `/om-vault-audit` | Audit indexes, links, orphans, stale context || `/om-vault-upgrade` | Import content from an existing vault — version detection, classification, migration || `/om-prep-1on1` | Prep for an upcoming 1:1 — load person context, open items, suggested agenda |diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 2887d05..3335d07 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -306,6 +306,7 @@ vault 通常只在你身处其中时才有用。**`om` MCP 服务器**改变了| `/om-review-brief` | 生成评估简报(经理版或同事版) || `/om-self-review` | 撰写绩效评估自评——项目、能力、原则 || `/om-review-peer` | 撰写同事评审——项目、原则、绩效总结 |+| `/om-correct` | 扫除已更正的事实——在单一来源处应用更正,将重述替换为链接,保留带日期的历史记录 || `/om-vault-audit` | 审计索引、链接、孤立笔记、过时内容 || `/om-vault-upgrade` | 从现有仓库导入内容——版本检测、分类、迁移 || `/om-project-archive` | 将已完成的项目从 active/ 移至 archive/,更新索引 |diff --git a/brain/Skills.md b/brain/Skills.mdindex 39ae23b..d7935f6 100644--- a/brain/Skills.md+++ b/brain/Skills.md@@ -51,6 +51,7 @@ Custom slash commands, subagents, and reusable workflows. Defined in `.claude/co| Command | Purpose ||---------|---------|+| `/om-correct` | Sweep a corrected fact through the vault — semantic + literal search, applies at the single source, replaces restatements with links, preserves notes recording what was believed at the time. The acting half of Write-Correctness Law 2 || `/om-vault-audit` | Deep structural audit — indexes, frontmatter, links, Bases, folder placement, stale context || `/om-vault-upgrade` | Import content from an existing vault — detects version, classifies notes, transforms frontmatter, rebuilds indexes || `/om-project-archive` | Move completed project from `work/active/` to `work/archive/YYYY/`, update all indexes — moves whole `active/<Topic>/` clusters intact |