Design decisions¶
Architecture decision records, oldest first. Each says what was decided and why. Code comments cite them by number (ADR-019).
Two terms used below: tier, a source's authority rank, set by an admin in the policy; and the PURPOSE attack, injected text framed as an official "update" so that an LLM-based conflict resolver believes it (arXiv, Aug 2026).
ADR-001: Library-first¶
2026-11-25
Ship a Python library (pip install) plus an MCP server, not a hosted SaaS first.
Why. Lowest-cost way to find out if it's useful; open-source distribution; small to operate.
ADR-002: Relational bitemporal model¶
2026-11-25
Assertions live in relational tables with two time axes, written with SQLAlchemy Core: SQLite for the quickstart, Postgres in production. No graph database.
Why. Core query is (subject, predicate, time) + rules; SQL is well understood; one less system to run.
ADR-003: Deterministic resolver; no LLM inside resolve()¶
2026-11-25
Why. Auditable, replayable, and immune to PURPOSE-style injection.
ADR-004: Authority from provenance (policy keyed by registered source), never from content¶
2026-11-25
Why. Core security property.
ADR-005: Fail closed¶
2026-11-25
High-stakes predicates get CONFLICT or UNKNOWN rather than a guess, and a predicate the policy doesn't know counts as high stakes.
Why. Refusing beats guessing.
ADR-006: Complement Graphiti and Mem0¶
2026-11-25
Ship adapters for memory stores rather than building another one.
Why. Memory is crowded; arbitration is the gap.
ADR-007: Benchmark is a first-class, public deliverable¶
2026-11-25
Why. Makes the value measurable and checkable by anyone.
ADR-008: Append-only assertions¶
2026-11-25
Nothing is updated in place; a correction is a retraction record.
Why. Audit replay with known_at.
ADR-009: LLM-extracted assertions must carry an exact-substring quote¶
2026-11-25
Otherwise it is rejected. ADR-019 extends this into the full verifier.
Why. Cheap, deterministic anti-hallucination check.
ADR-010: Tiers live in the policy, not the sources table¶
2026-11-25
Why. Re-tiering needs no data migration; policy-versioned.
ADR-011: Positioning: "survivorship for agents"¶
2026-11-28
Lead with authority policy + deterministic resolver + fail-closed + injection resistance. CONFLICT-to-human routing is table stakes, not the headline. Treat an MDM golden record as one high-authority source.
Why. Cognee v1.6.6 already routes conflicts to humans; MDM already does deterministic source-ranked survivorship but never refuses and ignores unstructured claims. The combination is unclaimed.
ADR-012: Benchmark baselines run real systems¶
2026-11-28
Status: v1 emulates newest-wins; real Graphiti and Cognee runs on a sample are planned.
(Graphiti, Cognee) alongside naive RAG, not only simulated newest-wins. Headline metric: injection success rate on contract-backed facts.
Why. Graphiti failed the injected-price example in 2 of 3 runs (experiments/graphiti_newest_wins.py); nobody else measures injection resistance; real baselines blunt "self-serving benchmark" criticism.
ADR-013: Authority per (source, predicate)¶
2026-11-28
sources: holds default tiers; a predicate rule's optional authority: map replaces them for that predicate, and unlisted sources are ineligible (they can't win but still produce drift findings). Most specific predicate pattern wins (wildcards only as the last segment; duplicate keys rejected at load).
Why. The HackerNoon design and INITE Brain both arrived at per-predicate authority independently; a single global tier breaks when different systems own different facts (CRM owns deal.stage, contract owns price.*). "Replace, not merge" is fail-closed: registering a new source never silently gives it a say over prices.
ADR-014: Supersession needs equal or higher authority¶
2026-11-28
B.supersedes_id = A drops A only while B is applicable at as_of and tier(B) ≥ tier(A) for that predicate. Lower-tier supersession is ignored and noted in the trace. If B has an effective_to, A applies again after it ends.
Why. Authority from provenance (ADR-004) applied to supersession: a Slack message "superseding" a contract is the PURPOSE attack in another form. Temporary overrides (a discount for one month) fall out naturally.
ADR-015: Human decisions are append-only Approval records¶
2026-11-28
Settling a conflict records covered_assertion_ids (what the human saw) plus chosen_assertion_id. It holds while the top-tier candidates are a subset of the covered set, and a new top-tier candidate reopens the conflict. require_approval needs an approval naming the winner. There is no approval_id column on assertions.
Why. Keeps assertions immutable and replayable (an approval has its own recorded_at), and never lets an old human decision silently bless evidence the human didn't see.
ADR-016: Freshness age = as_of − observed_at¶
2026-11-28
Low-stakes best guess: when a low-stakes rule hits CONFLICT/STALE/PENDING_APPROVAL, return RESOLVED with best_guess_from set and a warning, and skip drift. High stakes never guess.
Why. Measuring from as_of makes past-dated queries honest. A flagged guess is useful for contacts and deal stages, and best_guess_from lets agents and the inbox tell a guess from an answer.
ADR-017: Audit replay is exact¶
2026-11-28
A resolve with known_at uses the policy that was active at known_at, ignores facts, retractions and approvals recorded later without mentioning them in the trace, and never touches the conflict inbox. Policy versions must strictly increase.
Why. Hypothesis found that an earlier trace note ("N recorded after known_at ignored") leaked the future into replays. A replay must equal what the ledger said at the time, byte for byte.
ADR-018: Benchmark v1 measures the decision step¶
2026-11-28
96 template-generated scenarios (fixed seed, no LLM) carry each record as text and structured fields. The ledger, newest-wins and the LLM judges get the scenario's records; RAG retrieves top-4 from the whole corpus. An extra LLM judge + policy baseline gets the rules in plain English. Expected answers come from scenario construction, never from running the ledger; a test fails if the committed YAML differs from the generator.
Why. Separates "can it decide?" from "can it extract?" (measured separately). The policy-in-prompt judge pre-empts "just tell the LLM the rules". Template generation is reproducible and cheap, and makes hand-edited answers detectable.
ADR-019: Extraction: the LLM proposes, deterministic checks decide¶
2026-11-28
The extractor returns structured proposals (subject_name, predicate, value, quote, effective_from/to, end_inclusive, supersedes_ref, plus withdrawals). verify() keeps a fact only if: the quote is in the document (exact, modulo whitespace and typographic punctuation; as a last resort a symbol right before a digit is ignored, because flash-lite garbles ₹ in ~12% of quotes; every later check reads the document's own text at the located span); the value is written in the quote (₹1,14,000 / 114k / 1.14 lakh all count; a computed value doesn't); a quote in another currency is rejected; dates are written in the document or equal the document date; the predicate is in a governed vocabulary, fits the subject's type (subject_types) and is grounded in the document (requires_any, e.g. the plan name); the subject links to exactly one registered name or alias (exact, else longest contained alias; ties are rejected). No stated start date means "from when it was said". The model copies end dates and flags inclusive wording; code adds the day. Supersession and withdrawal links go only through identifier tokens ("#935", "v4.1") matched to source_refs the ledger holds, never through prose ("all previous contracts"); an unmatched supersedes_ref is dropped with a warning (the fact stays). A withdrawal needs the reference and withdrawal wording in its quote, and a withdrawing source with at least the target's tier for that predicate. CRM and billing exports keep the no-LLM mapper path. Rejections come back with reason codes; nothing rejected is written.
Why. Every way an LLM can be wrong (invented quote, computed value, wrong currency, guessed date, misattributed subject, invented supersession) maps to a cheap check that doesn't need a second model. The tier rule (ADR-014) already neutralises an injected supersession; identifier-only linking stops prose from linking to anything. Fail closed: a dropped supersession leaves a same-tier CONFLICT, not a wrong answer.
ADR-020: Agent and HTTP interfaces share one tool layer¶
2026-11-28
server/tools.py holds the operations; MCP (mcp SDK 2.x, stdio only) and REST (FastAPI) are thin wrappers, so both return identical JSON. Each resolution carries guidance for the agent (RESOLVED: use and cite; CONFLICT/UNKNOWN/STALE: don't guess). Agents can only propose_assertion: stored under the policy's propose-only source (tier 0), never a winner, listed in proposals(). Ledger errors reach the agent as tool errors with the message; other crashes stay on the server. REST refuses to start without ASSERTION_LEDGER_API_KEY (constant-time compare); an MCP network transport is deferred until it can ship with auth.
Why. One implementation, two transports, no drift between them. Putting the answer rule in the response, not only the system prompt, keeps any MCP client honest. stdio has no listener to protect; auth-on-by-default is a differentiator against Graphiti's servers.
ADR-021: The Graphiti importer reads episodes, not edges¶
2026-11-28
Each episode (raw content, source_description, reference time) becomes a ledger Document. Its source comes from an explicit source_map (exact key, else the longest glob); unmapped episodes are skipped and reported. It runs through the normal extractor + verify(), source_ref = "graphiti episode <uuid>", and re-imports are idempotent. Graphiti's edge invalidation is ignored.
Why. Edges are LLM paraphrases, so verifying quotes against them would check Graphiti's wording, not the source. Their invalid_at is newest-wins, the judgement the ledger exists to replace. Live on the experiment's data: Graphiti says ₹79k, the ledger says ₹89,000.
ADR-022: Portability and identity polish for launch¶
2026-11-28
A display name counts as an alias for identity (ambiguity still fails closed). Model-level length limits match the SQL columns, so SQLite and Postgres reject the same input with the same LedgerError. The integration tests run on both backends (ASSERTION_LEDGER_TEST_PG, docker-compose.yml, CI service).
Why. add_subject(display_name=…) already made a name linkable for extraction, so resolve(name) returning UNKNOWN was a trap (the README quickstart needed both). SQLite ignores VARCHAR lengths and Postgres enforces them, which would have been a production-only failure.