feat: persist the claim ledger with an inverted SM-2 interval (#26)
The plugin could already warn about a restated figure within one transcript. This makes it remember across turns and sessions. A claim is keyed by unit+value, so '6,884 lines' and '6884 lines' are the same claim. Interval arithmetic is SM-2 with the sign flipped: verification expands the interval and restores ease, while restating a claim without new evidence contracts ease and falls due immediately — repetition is the failure signal, not the achievement. Adds 'knox claims record' (fold check verdicts into the ledger) and 'knox claims due' (what needs re-checking). The plugin records once per distinct prose (the context hook fires for every model call, so naive recording would inflate the reuse count) and injects a capped digest at turn start. Two bugs caught by the tests: a new claim defaulted to EF=0 and contracted straight to the 1.3 floor, and my first test encoded the wrong policy — a single restatement is already due, which is the behaviour worth having.
This commit is contained in:
@@ -133,6 +133,27 @@ CREATE TABLE IF NOT EXISTS settings (
|
||||
);
|
||||
|
||||
-- PEERS: other knox nodes known to this one (gossip ring)
|
||||
-- CLAIM LEDGER: numeric assertions the agent has made, with how often they were
|
||||
-- restated versus actually re-verified. Standard SM-2 expands an interval on
|
||||
-- successful recall; here the sign is inverted, because repeating a figure
|
||||
-- without re-checking it is the failure, not the achievement.
|
||||
CREATE TABLE IF NOT EXISTS claims (
|
||||
fingerprint TEXT PRIMARY KEY, -- hash of unit + value
|
||||
assertion TEXT NOT NULL, -- as last written, e.g. "6,884 lines"
|
||||
unit TEXT NOT NULL,
|
||||
value INTEGER NOT NULL,
|
||||
status TEXT NOT NULL, -- sourced | stale | unsupported
|
||||
reuse_count INTEGER NOT NULL DEFAULT 0, -- restatements since last verification
|
||||
verify_count INTEGER NOT NULL DEFAULT 0, -- times a tool backed it
|
||||
ef REAL NOT NULL DEFAULT 2.5,
|
||||
interval_days REAL NOT NULL DEFAULT 1,
|
||||
due_at TEXT, -- date re-verification is due
|
||||
first_seen TEXT DEFAULT (datetime('now')),
|
||||
last_seen TEXT DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_claims_due ON claims(due_at);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS peers (
|
||||
peer_id TEXT PRIMARY KEY, -- remote node_id
|
||||
addr TEXT, -- e.g. http://192.168.1.20:8931
|
||||
|
||||
Reference in New Issue
Block a user