Inspiration

Coding agents now read architecture decision records (ADRs, RFCs) and treat them as instructions. But a decision record is never edited: when a team changes its mind, a new record says, somewhere inside a paragraph, "§4 is superseded". The old record still says Accepted. Courts solved this long ago: a citator tells you whether a case is still good law, clause by clause. Precedent is that, for a codebase.

What it does

I ran it on the real, public decision log of Relate itself (533 ADRs). 115 (21.6 %) are partly or wholly overruled, and 111 of those still say Accepted or Proposed. A plain full-text search puts at least one overruled decision in the top 5 for 74.5 % of queries. ADR-0116 is declared Accepted, yet seven of its ten clauses were taken out of force by three later decisions.

Precedent turns the log into a citation graph in Relate and computes standing for every clause:

  • Clause-level standing (in force / partly superseded / out / contested) using grounded argumentation semantics, so "A overruled B, then C overruled A" correctly restores B.
  • Evidence on every edge: the exact sentence, the rule that fired, a confidence. No model is called at runtime.
  • preflight for agents (MCP): before an agent changes code it asks what it must respect. Dead clauses are flagged and the controlling decision is pulled in, inside a token budget.
  • A guard for agent-written ADRs: propose_decision writes the draft into the graph in a Relate transaction, recomputes standing on the uncommitted state, reports what changes and who relies on what you overrule, then commits or rolls back. A dry run is a what-if.
  • find_overlaps: before writing a decision, which clauses would it overrule? On 55 known overrulings, the overruled decision is in the top 8 candidates 76 % of the time.
  • fix-status: every stale "Accepted" becomes a one-line patch in the corpus's own wording. 111 stale headers become 0, with no verdict changed.
  • Browser explorer: the same graph in your tab, queried with Cypher. Relate compiled to WebAssembly, no server.

How it uses Relate

  • Mode: single file. data/relate-adr.rl (17.9 MB) is committed to the repo.
  • Why: the single file is the product. The CLI and the MCP server open it embedded; the browser loads it into Relate-WASM; relate serve exposes it over Bolt, HTTP and MCP (the official Neo4j Python driver connects, example in the repo); and a file copy is a cheap fork of the graph, which the guard uses for what-ifs on a read-only store.
  • What the graph models: Decision → HAS_CLAUSE → Clause; CITES; typed treatments SUPERSEDES / REVERSES / WITHDRAWS / AMENDS / REINSTATES / AFFIRMS carrying clauses, evidence, rule, confidence and whether they took effect; REFERS_TO → CodePath; SIMILAR. 533 decisions, 1,591 clauses, 362 treatment edges, 3,741 citations, 697 code paths.
  • Relate features used: constraints, persisted full-text and vector indexes with SEARCH (hybrid retrieval with rank fusion), shortestPath, explicit transactions with rollback and read-your-writes, read-only opens, the WASM build, MCP, Bolt.

Does it change what a model does?

24 tasks in areas where a decision is partly overruled, each run 3 times with Claude Sonnet 5.5 (no tools, no memory). Given the documents as a plain search returns them, the model builds on an already-overruled clause in 46 of 72 runs (64 %). With a generic "be careful, later decisions may have overruled parts" note: 48 of 72 (67 %). With Precedent's preflight in context: 3 of 72 (4 %), and it cites more live clauses, not fewer. Caveats, also in the repo: tasks were chosen where such a clause exists, only the cited clauses were scored (not code quality), one model, one corpus, and one residual miss where preflight did not surface the document holding the dead clause.

How I built it

Python and the relate-db embedded engine. A deterministic extractor reads treatments out of prose and keeps the evidence sentence; a pure-Python standing engine writes derived standing back into the graph; everything else is Cypher. I audited all 178 negative treatments by reading each evidence sentence: 176 correct, 1 plausible, 1 wrong, and I fixed the root cause of the first-round false positives. make data-check rebuilds the store from the pinned upstream commit and proves the content is identical. 72 tests, including 31 real ADRs.

Challenges

Status hides in prose and applies per clause ("§4's rule is superseded… Decisions 1 and 2 stand"). Precision matters more than recall, because a wrong "superseded" is worse than a missed one. Relate connections are thread-affine, which shaped the MCP server. The audit found real bugs in my own rules, which is why the evaluation page states its caveats up front.

What I learned

Treat treatments (supersedes, reverses, withdraws…) as first-class edges and "is this still good law?" becomes a graph question. Relate's embedded single-file model let the CLI, the MCP server, the WASM explorer and the fork-for-what-if all fit in one artifact.

What's next

Other record styles (MADR front-matter, PEPs, RFCs with Obsoletes), a GitHub Action that posts cite-check results on pull requests, optional model adjudication of low-confidence edges (cached in the store), the agent experiment on real coding tasks and more models.

Built With

Share this project:

Updates

Submission history