Skip to content

feat(phase5): epistemic confidence model#137

Merged
salishforge merged 1 commit into
mainfrom
feat/phase5-epistemic-confidence
May 21, 2026
Merged

feat(phase5): epistemic confidence model#137
salishforge merged 1 commit into
mainfrom
feat/phase5-epistemic-confidence

Conversation

@salishforge

Copy link
Copy Markdown
Owner

Summary

Second of six PRs splitting #129. Ships Feature 1: Epistemic Confidence Model — calibrated uncertainty levels on warm-tier memories with auto-promotion via sleep cycle.

What lands

  • New columns on warm_tier: epistemic_status TEXT NOT NULL DEFAULT 'provisional', evidence_count INTEGER NOT NULL DEFAULT 1, last_corroborated_at TIMESTAMPTZ. Index warm_tier_epistemic_idx on (agent_id, epistemic_status).
  • Sleep cycle Phase 5.12 (Epistemic Promotion) — runs in the run() loop after deprecated decay, before drift snapshot. Promotes provisional → established when both evidence_count >= 3 AND positive retrievals come from ≥2 distinct namespaces (cross-context corroboration required). Stamps last_corroborated_at. Does NOT touch contested rows.
  • Query filter: query({ epistemic: 'established' }) or array form filters retrieval by status.
  • REST endpoint: GET /memory/:agentId/epistemic returns per-status counts.
  • MCP tools: memforge_certainty (filtered query) and memforge_epistemic_profile (counts).
  • SDK: TypeScript + Python clients both gain epistemic query param and epistemicProfile() method.

Migration: schema/migration-v3.9.sql.

Notes

Part of the #129 split

Test plan

  • `npm run type-check` — clean
  • `npm run build` — clean
  • `npm run lint` — clean
  • `npm run test:epistemic-confidence` — 30/30 pass (7 unit + 12 integration + 5 e2e + 6 migration)
  • `npm audit --omit=dev` — 0 vulnerabilities
  • CI green on push

🤖 Generated with Claude Code

Calibrated uncertainty levels (established/provisional/contested/inferred)
on warm-tier memories with auto-promotion via new sleep cycle Phase 5.12.
New columns: epistemic_status, evidence_count, last_corroborated_at on
warm_tier. New endpoint GET /memory/:id/epistemic and MCP tools
memforge_certainty + memforge_epistemic_profile. Phase 5.12 promotes
provisional rows with evidence_count >= 3 and multi-namespace positive
retrievals to established, stamps last_corroborated_at, and demotes stale
established rows back to provisional. Epistemic filter on query() restricts
results to the desired confidence tier. TypeScript SDK, Python SDK,
tool-definitions, and OpenAPI spec updated.

Migration: schema/migration-v3.9.sql
Split from #129 (PR-B of 6).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salishforge
salishforge merged commit 8d2b16c into main May 21, 2026
12 checks passed
salishforge added a commit that referenced this pull request Jul 26, 2026
The final Phase 5 slice — the Feature 1 remnant that never landed with
PR #137. Phase 2.5 conflict resolution stops encoding noise as fact.

- When the multi-factor score gap between two conflicting live memories
  is at most one point (one factor's worth of noise on the quantized
  integer scale), both are marked epistemic_status='contested' and the
  conflict resolves with a contested(...) strategy and no winner. The
  umbrella used a relative 20% threshold, which inverts on small
  integer scores (pure-noise 1-vs-0 reads as decisive, well-evidenced
  6-vs-5 as contested) and is distorted by the mutual +100 supersession
  offset — the absolute delta is immune to both.
- Superseded rows never contest: supersession is an absolute signal,
  and marking stale facts contested would resurface them as live
  disputes.
- Contested is not terminal (the trap this same stack fixed for
  'inferred'): Phase 5.12 promotes contested rows that earn the
  corroboration bar, and a decisive re-resolution of the dispute clears
  the winner's badge back to provisional.
- tests/contested-conflicts.test.ts: 9 tests — close-call semantics,
  the exact one-vs-two-point boundary, winner/loser path preservation
  incl. untouched winner confidence, both-superseded decisiveness,
  contested recovery via decisive re-resolution. Conflict pairs share
  an identical relative timestamp (separate INSERTs see different
  now(), silently handing one side the +3 recency factor).
- tests/epistemic-confidence.test.ts: the promotion tests now pin the
  new behavior (corroborated contested rows promote; uncorroborated
  ones stay).


Claude-Session: https://claude.ai/code/session_011xCqQo49d3CEbn6oEvb3Ru

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant