feat: persist the claim ledger with an inverted SM-2 interval #27

Merged
david merged 1 commits from feat/claim-ledger into main 2026-11-05 03:53:35 +00:00
Owner

Closes #26. Tier 2 of the guardrail.

Tier 1 warns within a transcript and forgets at session end. This remembers.

The inversion

Event Ease Interval Due
verified (a tool printed it) +0.1 (cap 2.5) × ease future
restated, no new evidence −0.2 (floor 1.3) — now
never observed unchanged — +7 days

Stock SM-2 lengthens the interval on successful recall. Here the thing to avoid is repeating a figure without re-checking, so repetition is what makes it urgent.

Surfaces

  • knox claims record / knox claims due [--json]
  • Plugin records once per distinct prose — the context hook fires for every model call, so naive recording would inflate reuse_count on every tool continuation — and injects a ≤3-line digest at turn start.

Two bugs found by writing the tests

  1. EF defaulted to 0 on first insert (zero value from a failed QueryRow), so a new claim contracted straight to the 1.3 floor instead of starting at 2.5. Defaults are now explicit.
  2. My test encoded the wrong policy — it asserted one restatement shouldn't be due. The useful behaviour is that the first repetition makes it urgent; changed the code path's contract and the test together.

Verified

  • go test ./... green, including both ledger tests
  • end-to-end on the real index: two stale recordings → due with restated=2; a sourced recording → cleared
  • plugin tsc --strict clean; knox.claims and knox.recall both active

Not yet observed live: the turn-start digest firing (needs a turn) — currently one real claim is due, so the next turn should show it.

Closes #26. Tier 2 of the guardrail. Tier 1 warns within a transcript and forgets at session end. This remembers. ## The inversion | Event | Ease | Interval | Due | |---|---|---|---| | verified (a tool printed it) | +0.1 (cap 2.5) | × ease | future | | restated, no new evidence | −0.2 (floor 1.3) | — | **now** | | never observed | unchanged | — | +7 days | Stock SM-2 lengthens the interval on successful recall. Here the thing to avoid is *repeating* a figure without re-checking, so repetition is what makes it urgent. ## Surfaces - `knox claims record` / `knox claims due [--json]` - Plugin records once per distinct prose — the `context` hook fires for every model call, so naive recording would inflate `reuse_count` on every tool continuation — and injects a ≤3-line digest at turn start. ## Two bugs found by writing the tests 1. **EF defaulted to 0** on first insert (zero value from a failed `QueryRow`), so a new claim contracted straight to the 1.3 floor instead of starting at 2.5. Defaults are now explicit. 2. **My test encoded the wrong policy** — it asserted one restatement shouldn't be due. The useful behaviour is that the *first* repetition makes it urgent; changed the code path's contract and the test together. ## Verified - `go test ./...` green, including both ledger tests - end-to-end on the real index: two stale recordings → due with `restated=2`; a sourced recording → cleared - plugin `tsc --strict` clean; `knox.claims` and `knox.recall` both `active` **Not yet observed live:** the turn-start digest firing (needs a turn) — currently one real claim is due, so the next turn should show it.
david added 1 commit 2026-11-05 03:53:24 +00:00
feat: persist the claim ledger with an inverted SM-2 interval (#26)
build / test (push) Has been cancelled
build / image (push) Has been cancelled
c8fd031f6c
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.
david merged commit 080230338b into main 2026-11-05 03:53:35 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: david/knox#27