From 6f29c9cdcf80385b9425c32e46d97d66b71d9823 Mon Sep 17 00:00:00 2001 From: "Dr. Fabian Wilde" Date: Wed, 25 Nov 2026 22:28:22 +0100 Subject: [PATCH 1/2] fix(beliefs): exclude heuristic audit outcomes from calibration --- .claude-plugin/marketplace.json | 2 +- .claude-plugin/plugin.json | 2 +- CHANGELOG.md | 5 ++++ Cargo.lock | 2 +- antigravity/plugin.json | 2 +- docs/manual.md | 4 +-- lore_core/beliefs.py | 23 +++++++++------ lore_core/dialectic.py | 4 +-- lore_core/store.py | 6 ++++ plugin.json | 2 +- rust/lore-core/Cargo.toml | 2 +- rust/lore-core/src/beliefs.rs | 3 +- rust/lore-core/src/context.rs | 2 +- rust/lore-core/src/schema.json | 1 + rust/lore-core/src/standalone_ops.rs | 15 ++++++---- rust/lore-core/tests/cli.rs | 43 ++++++++++++++++++++++++++++ tests/test_calibration.py | 32 +++++++++++++++++++-- tests/test_graph.py | 2 +- tests/test_sync_oplog.py | 4 +-- 19 files changed, 123 insertions(+), 33 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 236e44f..a52c04e 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "lore", "source": "./", "description": "Shared memory for Claude Code, Codex, and DOXA: capped curated facts, evidence-backed beliefs, FTS5 session search, staged review, learned skills, and signed sync.", - "version": "0.62.34" + "version": "0.62.35" } ] } diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index cadbc0f..0ad2bdb 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "lore", "description": "Memory for Claude Code that reasons about you and improves itself: Honcho-pattern belief store with deriver, dreamer and dialectic (/lore:ask), automatic skillification with a closed judge/update/retire loop, on a Hermes-pattern core \u2014 hard-capped curated memory, FTS5 session search, staged review.", - "version": "0.62.34", + "version": "0.62.35", "author": { "name": "Fabian Wilde", "email": "docwilde@proton.me" diff --git a/CHANGELOG.md b/CHANGELOG.md index de6c00c..6806a3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.62.35 — 2026-11-25 + +- Exclude historical heuristic audit outcomes from belief calibration, graph ranking, and the STEER threshold. Preserve signed ledger history. +- Report the excluded audit count and the eligible calibration total in `lore stats`. + ## 0.62.34 — 2026-11-25 - Fix **`lore audit`** writing belief outcomes from path existence and literal Git matches. Report fragment matches for review and count historical audit outcomes. diff --git a/Cargo.lock b/Cargo.lock index 5d3826d..2c7f320 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -612,7 +612,7 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "lore-core" -version = "0.62.34" +version = "0.62.35" dependencies = [ "fancy-regex", "hmac", diff --git a/antigravity/plugin.json b/antigravity/plugin.json index fcf892b..d458e9d 100644 --- a/antigravity/plugin.json +++ b/antigravity/plugin.json @@ -1,6 +1,6 @@ { "$schema": "https://antigravity.google/schemas/v1/plugin.json", "name": "lore-tool-evidence", - "version": "0.62.34", + "version": "0.62.35", "description": "Record reported tool outcomes in the local LORE evidence store." } diff --git a/docs/manual.md b/docs/manual.md index 8d4bb2f..c084044 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -142,14 +142,14 @@ Four rules keep the loop honest: The deriver writes beliefs straight to SQLite, ungated. The gate sits on the read side instead: -- **World beliefs** — projects, systems, environment — reach the agent only on demand: `/lore:ask`, or `lore consult` at act time (opt in with `LORE_CONSULT=1`). Consult splits results into **STEER** (≥3 rows in the outcomes ledger, may shape the decision) and **CITE ONLY** (deriver-claimed — mention, never follow). +- **World beliefs** — projects, systems, environment — reach the agent only on demand: `/lore:ask`, or `lore consult` at act time (opt in with `LORE_CONSULT=1`). Consult splits results into **STEER** (at least three calibration-eligible outcomes, may shape the decision) and **CITE ONLY** (deriver-claimed — mention, never follow). - **User-model beliefs** (`subject: user-model`) ride into the snapshot openly, labeled uncalibrated. They shape tone and approach, never authorize an action, and stamp `last_referenced` so the influence stays auditable. **`user` and `user-model` are separate channels.** A preference the user stated goes to `user`, where a later session may act on it; a pattern the reviewer inferred from behaviour goes to `user-model`, which authorizes nothing. A conclusion already covered by the other channel is dropped before it is written. Rationale, the channel rule, and the containment check behind the drop logic: [`user-model-channel-separation.md`](user-model-channel-separation.md). `lore crosscheck` lists cross-channel near-duplicate pairs, read-only, for a human to resolve. LORE measures confidence instead of asserting it: `lore stats` prints per-bucket empirical precision from the outcomes ledger, and shouts UNCALIBRATED below 100 outcomes. -`lore audit` samples active beliefs for review. `MATCH` and `NO_MATCH` describe a path or literal token in the current environment. Record verified claim outcomes with `lore outcome`. The audit reports the count of historical heuristic outcomes, which still count toward calibration. +`lore audit` samples active beliefs for review. `MATCH` and `NO_MATCH` describe a path or literal token in the current environment. Record verified claim outcomes with `lore outcome`. The audit reports historical heuristic outcomes. LORE keeps those entries in the ledger and excludes them from calibration and the STEER threshold. **The cost, plainly.** A belief goes live the moment the deriver writes it; no human sees it first. Beliefs unreferenced for 45 days go dormant (`LORE_BELIEF_DORMANT_DAYS`; confidence ≥0.95 exempt) and two recorded contradictions retire one — but nothing re-verifies a claim that keeps getting cited. Read the store yourself now and then: diff --git a/lore_core/beliefs.py b/lore_core/beliefs.py index c8a8a77..7a89ddb 100644 --- a/lore_core/beliefs.py +++ b/lore_core/beliefs.py @@ -649,9 +649,10 @@ def record_outcome(conn: sqlite3.Connection, belief_id: int, event: str, source: "uid": outcome_uid, "belief_uid": row[1], "event": event, "source": source, "session_id": session_id, "agent": agent_val, "note": note_text, }) - if event == "contradicted": + if event == "contradicted" and source != "audit": n = conn.execute( - "SELECT count(*) FROM belief_outcomes WHERE belief_id = ? AND event = 'contradicted'", + "SELECT count(*) FROM belief_calibration_outcomes" + " WHERE belief_id = ? AND event = 'contradicted'", (belief_id,), ).fetchone()[0] if n >= CONTRADICTIONS_TO_DORMANT: @@ -670,11 +671,11 @@ def record_outcome(conn: sqlite3.Connection, belief_id: int, event: str, source: def outcome_counts(conn: sqlite3.Connection, belief_id: int) -> tuple[int, int, int]: - """(confirms, contradicts, stales) for one belief.""" + """(confirms, contradicts, stales) eligible for calibration.""" row = conn.execute( "SELECT coalesce(sum(event = 'confirmed'), 0)," " coalesce(sum(event = 'contradicted'), 0), coalesce(sum(event = 'stale'), 0)" - " FROM belief_outcomes WHERE belief_id = ?", + " FROM belief_calibration_outcomes WHERE belief_id = ?", (belief_id,), ).fetchone() return int(row[0]), int(row[1]), int(row[2]) @@ -784,12 +785,15 @@ def cmd_stats(args) -> int: event name retired it. """ conn = db_connect() - total = conn.execute("SELECT count(*) FROM belief_outcomes").fetchone()[0] + total, legacy = conn.execute( + "SELECT count(*), count(CASE WHEN source = 'audit' THEN 1 END) FROM belief_outcomes" + ).fetchone() + eligible = total - legacy rows = conn.execute( "SELECT round(b.confidence, 1) AS bucket, count(DISTINCT b.id), count(o.id)," " coalesce(sum(o.event = 'confirmed'), 0)," " coalesce(sum(o.event = 'contradicted'), 0), coalesce(sum(o.event = 'stale'), 0)" - " FROM beliefs b LEFT JOIN belief_outcomes o ON o.belief_id = b.id" + " FROM beliefs b LEFT JOIN belief_calibration_outcomes o ON o.belief_id = b.id" " GROUP BY bucket ORDER BY bucket" ).fetchall() print("claimed n_beliefs n_outcomes precision") @@ -797,11 +801,12 @@ def cmd_stats(args) -> int: prec = f"{c / (c + x + s):.2f}" if (c + x + s) else " -" print(f"{bucket:>7.1f} {nb:>9} {no:>10} {prec:>9}") print(f"\nledger total: {total} outcome row(s)") - if total < 100: + print(f"calibration outcomes: {eligible}. Legacy audit outcomes excluded: {legacy}.") + if eligible < 100: # loud on purpose: below ~100 outcomes the per-bucket precision is a # handful of coin flips, and a confident-looking table would invite # exactly the overtrust this ledger exists to end. - print(f"!!! UNCALIBRATED — n={total}, display gate at 100 !!!") + print(f"!!! UNCALIBRATED — n={eligible}, display gate at 100 !!!") print("!!! per-bucket precision below is anecdote, not a curve — keep" " recording verified outcomes (lore outcome) !!!") return 0 @@ -852,7 +857,7 @@ def interaction_model_lines(limit: int = 5) -> "list[str]": conn = db_connect() rows = conn.execute( "SELECT b.id, claim, confidence, source_engine," - " (SELECT count(*) FROM belief_outcomes o WHERE o.belief_id = b.id)" + " (SELECT count(*) FROM belief_calibration_outcomes o WHERE o.belief_id = b.id)" " FROM beliefs b WHERE status = 'active' AND subject = 'user-model'" " ORDER BY confidence DESC, updated DESC LIMIT ?", (limit,)).fetchall() if rows: diff --git a/lore_core/dialectic.py b/lore_core/dialectic.py index 1c193d7..fe20a44 100644 --- a/lore_core/dialectic.py +++ b/lore_core/dialectic.py @@ -153,8 +153,8 @@ def cmd_consult(args) -> int: q = " ".join(args.query) rows = conn.execute( "SELECT b.id, b.subject, b.claim, b.confidence, " - "(SELECT count(*) FROM belief_outcomes o WHERE o.belief_id = b.id) AS n_out, " - "(SELECT sum(CASE WHEN o.event='confirmed' THEN 1 ELSE 0 END) FROM belief_outcomes o WHERE o.belief_id = b.id) AS n_conf " + "(SELECT count(*) FROM belief_calibration_outcomes o WHERE o.belief_id = b.id) AS n_out, " + "(SELECT sum(CASE WHEN o.event='confirmed' THEN 1 ELSE 0 END) FROM belief_calibration_outcomes o WHERE o.belief_id = b.id) AS n_conf " "FROM beliefs b JOIN belief_fts f ON b.id = f.belief_id " "WHERE belief_fts MATCH ? AND b.status = 'active' " "ORDER BY bm25(belief_fts) LIMIT ?", (fts_expr(q, " OR "), args.limit)).fetchall() diff --git a/lore_core/store.py b/lore_core/store.py index 8d1b82a..4e60c4b 100644 --- a/lore_core/store.py +++ b/lore_core/store.py @@ -304,6 +304,12 @@ def db_connect() -> sqlite3.Connection: pass # column already present _backfill_uids(conn, "belief_outcomes") # every connect, as for beliefs conn.execute("CREATE UNIQUE INDEX IF NOT EXISTS belief_outcomes_uid ON belief_outcomes(uid)") + # Historical audit observations stay signed and replayable. Only the + # evidence used for calibration and belief decisions is filtered. + conn.execute( + "CREATE VIEW IF NOT EXISTS belief_calibration_outcomes AS" + " SELECT id,belief_id,event FROM belief_outcomes WHERE source<>'audit'" + ) # SYNC OP LOG (sync spec PR 3, docs/plans/sync.md "The core: a local op # log"): every mutation to a synced class appends one row here, in the # SAME transaction as the mutation when the mutation is itself SQLite diff --git a/plugin.json b/plugin.json index 62f8bb8..b52c04e 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", "name": "lore", - "version": "0.62.34", + "version": "0.62.35", "description": "Unified user, repo, and session memory for Claude Code, Codex, and DOXA", "author": { "name": "Dr. Fabian Wilde", diff --git a/rust/lore-core/Cargo.toml b/rust/lore-core/Cargo.toml index c278706..0e194f6 100644 --- a/rust/lore-core/Cargo.toml +++ b/rust/lore-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lore-core" -version = "0.62.34" +version = "0.62.35" edition = "2021" license = "AGPL-3.0-only" description = "Native LORE memory, beliefs, review and session index" diff --git a/rust/lore-core/src/beliefs.rs b/rust/lore-core/src/beliefs.rs index 6d5e20b..ba740f2 100644 --- a/rust/lore-core/src/beliefs.rs +++ b/rust/lore-core/src/beliefs.rs @@ -390,7 +390,7 @@ pub fn calibrated_confidence(prior: f64, confirms: u64, contradicts: u64) -> f64 (prior * 2. + confirms as f64) / (2. + confirms as f64 + contradicts as f64) } pub fn outcome_counts(conn: &Connection, bid: i64) -> Result<(u64, u64, u64)> { - Ok(conn.query_row("SELECT coalesce(sum(event='confirmed'),0),coalesce(sum(event='contradicted'),0),coalesce(sum(event='stale'),0) FROM belief_outcomes WHERE belief_id=?",[bid],|r|Ok((sql_count(r,0)?,sql_count(r,1)?,sql_count(r,2)?)))?) + Ok(conn.query_row("SELECT coalesce(sum(event='confirmed'),0),coalesce(sum(event='contradicted'),0),coalesce(sum(event='stale'),0) FROM belief_calibration_outcomes WHERE belief_id=?",[bid],|r|Ok((sql_count(r,0)?,sql_count(r,1)?,sql_count(r,2)?)))?) } pub(crate) fn reinforce_in_transaction( cfg: &Config, @@ -522,6 +522,7 @@ pub(crate) fn outcome_in_transaction( &json!({"uid":uid,"belief_uid":belief_uid,"event":event,"source":source,"session_id":sid,"agent":agent,"note":note}), )?; if event == "contradicted" + && source != "audit" && outcome_counts(conn, bid)?.1 >= 2 && conn.execute( "UPDATE beliefs SET status='dormant',updated=? WHERE id=? AND status='active'", diff --git a/rust/lore-core/src/context.rs b/rust/lore-core/src/context.rs index 71d8576..b0c0f74 100644 --- a/rust/lore-core/src/context.rs +++ b/rust/lore-core/src/context.rs @@ -76,7 +76,7 @@ pub fn interaction_model_lines(cfg: &Config) -> Result> { let mut conn = crate::store::connect(cfg)?; let tx = conn.transaction_with_behavior(rusqlite::TransactionBehavior::Immediate)?; let rows = { - let mut query=tx.prepare("SELECT b.id,claim,confidence,source_engine,(SELECT count(*) FROM belief_outcomes o WHERE o.belief_id=b.id) FROM beliefs b WHERE status='active' AND subject='user-model' ORDER BY confidence DESC,updated DESC LIMIT 5")?; + let mut query=tx.prepare("SELECT b.id,claim,confidence,source_engine,(SELECT count(*) FROM belief_calibration_outcomes o WHERE o.belief_id=b.id) FROM beliefs b WHERE status='active' AND subject='user-model' ORDER BY confidence DESC,updated DESC LIMIT 5")?; let rows = query .query_map([], |row| { Ok(( diff --git a/rust/lore-core/src/schema.json b/rust/lore-core/src/schema.json index 304be1d..658d0f8 100644 --- a/rust/lore-core/src/schema.json +++ b/rust/lore-core/src/schema.json @@ -24,6 +24,7 @@ "CREATE TABLE IF NOT EXISTS belief_outcomes(id INTEGER PRIMARY KEY, belief_id INTEGER NOT NULL, event TEXT NOT NULL CHECK(event IN ('confirmed','contradicted','stale')), source TEXT NOT NULL, session_id TEXT, agent TEXT, note TEXT, created TEXT)", "ALTER TABLE belief_outcomes ADD COLUMN uid TEXT", "CREATE UNIQUE INDEX IF NOT EXISTS belief_outcomes_uid ON belief_outcomes(uid)", + "CREATE VIEW IF NOT EXISTS belief_calibration_outcomes AS SELECT id,belief_id,event FROM belief_outcomes WHERE source<>'audit'", "CREATE TABLE IF NOT EXISTS sync_ops(seq INTEGER PRIMARY KEY, op_id TEXT NOT NULL UNIQUE, machine_id TEXT NOT NULL, machine_seq INTEGER NOT NULL, lamport INTEGER NOT NULL, class TEXT NOT NULL, op TEXT NOT NULL, project_key TEXT, payload TEXT NOT NULL, mac TEXT, created TEXT NOT NULL, applied INTEGER NOT NULL DEFAULT 0)", "CREATE INDEX IF NOT EXISTS sync_ops_order ON sync_ops(lamport, machine_id, machine_seq)", "CREATE UNIQUE INDEX IF NOT EXISTS sync_ops_slot ON sync_ops(machine_id, machine_seq) WHERE applied != 2", diff --git a/rust/lore-core/src/standalone_ops.rs b/rust/lore-core/src/standalone_ops.rs index b48a71c..79ec98e 100644 --- a/rust/lore-core/src/standalone_ops.rs +++ b/rust/lore-core/src/standalone_ops.rs @@ -554,12 +554,15 @@ fn backfill_project( pub fn calibration(cfg: &Config) -> Result { let conn = store::connect(cfg)?; - let total = conn.query_row("SELECT count(*) FROM belief_outcomes", [], |r| { - r.get::<_, i64>(0) - })?; - let mut stmt=conn.prepare("SELECT round(b.confidence,1),count(DISTINCT b.id),count(o.id),coalesce(sum(o.event='confirmed'),0),coalesce(sum(o.event='contradicted'),0),coalesce(sum(o.event='stale'),0) FROM beliefs b LEFT JOIN belief_outcomes o ON o.belief_id=b.id GROUP BY round(b.confidence,1) ORDER BY round(b.confidence,1)")?; + let (total, legacy) = conn.query_row( + "SELECT count(*),count(CASE WHEN source='audit' THEN 1 END) FROM belief_outcomes", + [], + |r| Ok((beliefs::sql_count(r, 0)?, beliefs::sql_count(r, 1)?)), + )?; + let eligible = total.saturating_sub(legacy); + let mut stmt=conn.prepare("SELECT round(b.confidence,1),count(DISTINCT b.id),count(o.id),coalesce(sum(o.event='confirmed'),0),coalesce(sum(o.event='contradicted'),0),coalesce(sum(o.event='stale'),0) FROM beliefs b LEFT JOIN belief_calibration_outcomes o ON o.belief_id=b.id GROUP BY round(b.confidence,1) ORDER BY round(b.confidence,1)")?; let rows=stmt.query_map([],|r|{let c=r.get::<_,i64>(3)?;let x=r.get::<_,i64>(4)?;let s=r.get::<_,i64>(5)?;Ok(json!({"claimed":r.get::<_,f64>(0)?,"beliefs":r.get::<_,i64>(1)?,"outcomes":r.get::<_,i64>(2)?,"confirmed":c,"contradicted":x,"stale":s,"precision":if c+x+s>0{Some(c as f64/(c+x+s) as f64)}else{None}}))})?.collect::,_>>()?; - Ok(json!({"calibrated":total>=100,"ledger_total":total,"display_gate":100,"buckets":rows})) + Ok(json!({"calibrated":eligible>=100,"ledger_total":total,"calibration_total":eligible,"legacy_audit_outcomes":legacy,"display_gate":100,"buckets":rows})) } pub fn duplicates(cfg: &Config, req: &Value, cross: bool) -> Result { let threshold = req["threshold"] @@ -1609,7 +1612,7 @@ pub fn consult(cfg: &Config, req: &Value, ask: bool) -> Result { let limit = cap(req, "limit", if ask { 12 } else { 8 }, 100)?; let conn = store::connect(cfg)?; let dormant = ask && cfg.disabled("LORE_INCLUDE_DORMANT"); - let mut statement=conn.prepare("SELECT b.id,b.subject,b.claim,b.confidence,b.status,(SELECT count(*) FROM belief_outcomes o WHERE o.belief_id=b.id),(SELECT coalesce(sum(event='confirmed'),0) FROM belief_outcomes o WHERE o.belief_id=b.id),(SELECT coalesce(sum(event='contradicted'),0) FROM belief_outcomes o WHERE o.belief_id=b.id),(SELECT count(*) FROM belief_evidence e WHERE e.belief_id=b.id),(SELECT count(DISTINCT session_id) FROM belief_evidence e WHERE e.belief_id=b.id) FROM beliefs b JOIN belief_fts f ON b.id=f.belief_id WHERE belief_fts MATCH ? AND (status='active' OR (? AND status='dormant')) ORDER BY bm25(belief_fts) LIMIT ?")?; + let mut statement=conn.prepare("SELECT b.id,b.subject,b.claim,b.confidence,b.status,(SELECT count(*) FROM belief_calibration_outcomes o WHERE o.belief_id=b.id),(SELECT coalesce(sum(event='confirmed'),0) FROM belief_calibration_outcomes o WHERE o.belief_id=b.id),(SELECT coalesce(sum(event='contradicted'),0) FROM belief_calibration_outcomes o WHERE o.belief_id=b.id),(SELECT count(*) FROM belief_evidence e WHERE e.belief_id=b.id),(SELECT count(DISTINCT session_id) FROM belief_evidence e WHERE e.belief_id=b.id) FROM beliefs b JOIN belief_fts f ON b.id=f.belief_id WHERE belief_fts MATCH ? AND (status='active' OR (? AND status='dormant')) ORDER BY bm25(belief_fts) LIMIT ?")?; let mut cursor = statement.query(params![expression, dormant, limit as i64])?; let mut budget = 8 * 1024 * 1024; let mut steer = Vec::new(); diff --git a/rust/lore-core/tests/cli.rs b/rust/lore-core/tests/cli.rs index 9e6d0e4..e135463 100644 --- a/rust/lore-core/tests/cli.rs +++ b/rust/lore-core/tests/cli.rs @@ -183,6 +183,49 @@ fn audit_reports_fragments_across_checkouts_without_recording_outcomes() { assert_eq!(outcomes, (1, "stale".into(), "audit".into())); } +#[test] +fn legacy_audit_outcomes_remain_in_the_ledger_without_admitting_steer() { + let fixture = Fixture::new(); + let cfg = config::Config::for_root(fixture.root.clone()); + let conn = lore_core::store::connect(&cfg).unwrap(); + conn.execute( + "INSERT INTO beliefs(id,subject,claim,confidence) VALUES(1,'user','calibrationfixture',0.7)", + [], + ) + .unwrap(); + conn.execute_batch( + "INSERT INTO belief_fts(belief_id,claim) VALUES(1,'calibrationfixture'); + INSERT INTO belief_outcomes(belief_id,event,source) VALUES + (1,'confirmed','audit'),(1,'confirmed','audit'),(1,'stale','audit'), + (1,'confirmed','user'),(1,'confirmed','user');", + ) + .unwrap(); + let invoke = |args: &[&str]| -> serde_json::Value { + let (ok, report, error) = fixture.invoke(args); + assert!(ok, "{error}"); + serde_json::from_str(&report).unwrap() + }; + let consult = || invoke(&["consult", "calibrationfixture"]); + let report = consult(); + assert_eq!(report["steer"], json!([])); + assert_eq!(report["cite_only"][0]["outcomes"], 2, "{report}"); + let stats = invoke(&["stats"]); + assert_eq!(stats["ledger_total"], 5); + assert_eq!(stats["calibration_total"], 2); + assert_eq!(stats["legacy_audit_outcomes"], 3); + assert_eq!(stats["buckets"][0]["precision"], 1.0); + + conn.execute( + "INSERT INTO belief_outcomes(belief_id,event,source) VALUES(1,'contradicted','user')", + [], + ) + .unwrap(); + let report = consult(); + assert_eq!(report["steer"][0]["outcomes"], 3); + assert_eq!(report["steer"][0]["stale"], 0); + assert!((report["steer"][0]["calibrated_confidence"].as_f64().unwrap() - 0.68).abs() < 1e-9); +} + fn sync_reply(status: u16, body: serde_json::Value) -> (String, std::thread::JoinHandle<()>) { use std::io::{BufRead, Write}; let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); diff --git a/tests/test_calibration.py b/tests/test_calibration.py index 1cde323..02d5ab2 100644 --- a/tests/test_calibration.py +++ b/tests/test_calibration.py @@ -154,6 +154,16 @@ def test_stales_do_not_flip(self): conn.commit() self.assertEqual(self._status(conn, bid), "active") + def test_legacy_audit_contradiction_does_not_count_toward_dormancy(self): + conn = self.connect() + bid = _belief(conn, "legacy audit contradicted a belief", 0.9) + lore.record_outcome(conn, bid, "contradicted", "audit") + lore.record_outcome(conn, bid, "contradicted", "user") + self.assertEqual(self._status(conn, bid), "active") + self.assertEqual(lore.outcome_counts(conn, bid), (0, 1, 0)) + lore.record_outcome(conn, bid, "contradicted", "user") + self.assertEqual(self._status(conn, bid), "dormant") + def test_terminal_status_is_not_overwritten(self): conn = self.connect() bid = _belief(conn, "dormancy superseded claim", 0.9) @@ -180,14 +190,30 @@ def test_bucket_line_and_uncalibrated_banner(self): with contextlib.redirect_stdout(buf): self.assertEqual(lore.cmd_stats(argparse.Namespace()), 0) out = buf.getvalue() - # 2 beliefs, 4 outcomes, precision 2/(2+1+1) = 0.50 - self.assertRegex(out, re.compile(r"^\s*0\.3\s+2\s+4\s+0\.50\s*$", re.MULTILINE)) + # 2 beliefs, 2 eligible outcomes, precision 1/(1+1) = 0.50 + self.assertRegex(out, re.compile(r"^\s*0\.3\s+2\s+2\s+0\.50\s*$", re.MULTILINE)) m = re.search(r"UNCALIBRATED — n=(\d+), display gate at 100", out) self.assertIsNotNone(m) # this test DB never reaches 100 rows total = lore.db_connect().execute( - "SELECT count(*) FROM belief_outcomes").fetchone()[0] + "SELECT count(*) FROM belief_outcomes WHERE source <> 'audit'").fetchone()[0] self.assertEqual(int(m.group(1)), total) + def test_consult_uses_only_eligible_outcomes(self): + conn = self.connect() + bid = _belief(conn, "consultcalibration fixture claim", 0.7) + for event, source in (("confirmed", "audit"), ("stale", "audit"), + ("confirmed", "user")): + lore.record_outcome(conn, bid, event, source) + conn.commit() + report = io.StringIO() + with contextlib.redirect_stdout(report): + lore.cmd_consult(argparse.Namespace(query=["consultcalibration"], limit=8)) + self.assertIn("CITE ONLY", report.getvalue()) + self.assertIn("(uncalibrated, n=1)", report.getvalue()) + self.assertEqual(conn.execute( + "SELECT count(*) FROM belief_outcomes WHERE belief_id = ?", (bid,) + ).fetchone()[0], 3) + class TestAuditSampler(DBTest): def test_path_check_match_and_no_match(self): diff --git a/tests/test_graph.py b/tests/test_graph.py index abce797..a5f875f 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -364,7 +364,7 @@ def setUp(self): conn.execute("UPDATE beliefs SET confidence = 1.0 WHERE id = ?", (self.hi,)) conn.execute("UPDATE beliefs SET confidence = 0.6 WHERE id = ?", (self.cal,)) for _ in range(3): - lore.record_outcome(conn, self.cal, "confirmed", "audit") + lore.record_outcome(conn, self.cal, "confirmed", "user") conn.commit() def _rows(self, prompt=""): diff --git a/tests/test_sync_oplog.py b/tests/test_sync_oplog.py index 8fa9686..f5b6436 100644 --- a/tests/test_sync_oplog.py +++ b/tests/test_sync_oplog.py @@ -469,8 +469,8 @@ def test_belief_dormant_status_op_from_record_outcome_contradiction(self): conn = self.lore.db_connect() bid, _ = self.lore.belief_insert(conn, "user", "will go dormant", 0.6, "s1", None, None, via="direct") conn.commit() - self.lore.record_outcome(conn, bid, "contradicted", "audit") - self.lore.record_outcome(conn, bid, "contradicted", "audit") + self.lore.record_outcome(conn, bid, "contradicted", "user") + self.lore.record_outcome(conn, bid, "contradicted", "user") conn.commit() status = conn.execute("SELECT status FROM beliefs WHERE id = ?", (bid,)).fetchone()[0] self.assertEqual(status, "dormant") From 3db138828b5cc3e0c78a81fc9912bc4be203cc62 Mon Sep 17 00:00:00 2001 From: "Dr. Fabian Wilde" Date: Wed, 25 Nov 2026 22:31:07 +0100 Subject: [PATCH 2/2] docs(readme): clarify Antigravity integration scope --- README.md | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d723342..2d31fc1 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ are hard-capped; curated proposals wait for review. Derived beliefs retain their evidence and appear on request or through explicitly enabled context. +Gemini sessions launched through Google Antigravity in DOXA share the same +memory and local session index. The standalone Antigravity companion records +tool evidence. [Antigravity setup](#google-antigravity) + > [!WARNING] > **Beta.** Commands, caps, and configuration may change between releases. > LORE indexes local transcripts; Claude review sends a scrubbed digest to @@ -30,15 +34,9 @@ and relations between beliefs do not turn them into approved facts. ## What you get -[LORE 0.62.32](https://github.com/docwilde/LORE/releases/tag/v0.62.32) records -tool outcomes by default and lets reviewers link them to beliefs and learned -recipes. - -[LORE 0.62.31](https://github.com/docwilde/LORE/releases/tag/v0.62.31) documents -shared memory for Gemini sessions through Google Antigravity in DOXA. - -[LORE 0.62.30](https://github.com/docwilde/LORE/releases/tag/v0.62.30) adds -paged pending review, protected cleanup, and optional shared skill usage. +LORE 0.62.35 excludes historical heuristic audit outcomes from belief +calibration and the STEER threshold. `lore audit` reports path and Git token +matches for review. [Release notes](https://github.com/docwilde/LORE/releases/tag/v0.62.35) - **Claude Code, Codex, and DOXA memory.** Share one native store for capped user and project facts across engines; host facts stay local. @@ -68,6 +66,8 @@ Use `/lore:filemap` to inspect file maps; `LORE_FILEMAP_CAP` and ## Install +### Claude Code + ``` /plugin marketplace add docwilde/lore /plugin install lore @@ -109,10 +109,24 @@ filesystem (for example, under `~/`), then follow the install steps above. This WSL 2 setup has not been verified in LORE CI; see the [platform notes](docs/manual.md#platform-support) before relying on it. -### Antigravity in DOXA +### Google Antigravity + +**Shared memory through DOXA.** On native Linux, choose **Antigravity** in DOXA’s +**New Session** form and select a Gemini model. DOXA injects the working +directory’s LORE memory on the first turn and indexes the scrubbed transcript +on session shutdown. Set `DOXA_LORE=0` to disable both for a session. +[DOXA Antigravity setup](https://github.com/docwilde/doxa/blob/main/docs/antigravity.md) -[DOXA](https://github.com/docwilde/doxa/blob/main/docs/antigravity.md) connects to Google Antigravity on native Linux. Gemini sessions in DOXA receive LORE memory with their first prompt and contribute scrubbed transcripts to local LORE session search. Use `DOXA_LORE=0` to disable memory injection and indexing for a session. +**Tool evidence in the standalone Antigravity CLI.** The `lore-tool-evidence` +companion records reported tool successes and failures in the local LORE store. +Install it from this checkout and keep `lore-rs` on `PATH`. + +```sh +./task install +agy plugin install "$PWD/antigravity" +``` +See [tool evidence](docs/tool-evidence.md) for storage and linking details. ### Codex LORE supports Codex through the portable [`plugin.json`](plugin.json) and