Overrule
Official# Overrule
**Project memory for coding agents.** Overrule turns a software project's
*decisions, lessons, tasks, incidents and their provenance* into a
[Relate](https://github.com/relatedb/relate) graph, and gives coding agents
read-only MCP tools that answer the questions a flat file store cannot:
*why is it done this way, what does changing this invalidate, and which
hard-won lesson applies here?*
A decision stands until it is **overruled** — and in Overrule that is not a
metaphor. `SUPERSEDES` is a first-class relationship: the graph remembers
every ruling, the ruling that replaced it, the incident that forced the
change, and the lesson that now guards it.
## The problem
Long-lived projects accumulate decisions and lessons in ADRs, issue threads,
postmortems and review notes. Coding agents — and new humans — can
full-text-search those documents but cannot *traverse* them. Search finds
the decision that mentions "auth"; it does not find that the decision was
**superseded** after an incident, that a lesson **contradicts** the naive
fix, and that two open tasks are **blocked by** the current ruling. So
agents confidently re-litigate settled questions and re-break settled
things.
## How Overrule uses Relate, and why
- **The graph is the product.** Supersession, contradiction, blocking and
applicability are relationships, and every Overrule tool is a multi-hop
traversal over them (`SUPERSEDES`, `CONTRADICTS`, `BLOCKS`,
`APPLIES_TO`, `LEARNED_FROM`, `DECIDED_IN`, `DEPENDS_ON`,
`EVIDENCED_BY`). A vector/full-text store returns the superseded
decision ranked just as authoritatively as the current one; the graph
returns the *current* decision, the chain that produced it, and its
provenance path.
- **Embedded Python client for ingest** (`relate-db`, in-process, no
server lifecycle): Markdown decision records are `MERGE`d into a
persistent directory store — idempotent, single-writer.
- **Read-only serving, enforced twice.** The MCP server exposes only
read-only domain tools, and it opens the store with Relate's read-only
access mode, under which the engine itself refuses writes
(`WriteOnReadOnlyAccessDatabase`). Relate's own
`relate serve --mcp stdio --read-only` can serve the same store with
generic tools for comparison.
- **Storage mode: directory store, committed to this repo** at
[`store/`](store/). Chosen because it is durable (WAL + checkpoints),
inspectable with the Relate CLI, and lets judges explore the exact
graph the demo runs on — and rebuild it from `corpus/` with one command
to prove it is real.
- **No runtime API key.** Nothing in Overrule calls an LLM or any paid
service; the tools are parameterized Cypher traversals.
## Quickstart
```bash
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt # pins relate-db==1.4.0
# Build the persistent store from the Markdown corpus (idempotent):
PYTHONPATH=src .venv/bin/python -m overrule.cli --store store ingest corpus
# Ask the graph questions (CLI fallback — same queries as the MCP tools):
PYTHONPATH=src .venv/bin/python -m overrule.cli brief authentication
PYTHONPATH=src .venv/bin/python -m overrule.cli impact auth
PYTHONPATH=src .venv/bin/python -m overrule.cli blocked
PYTHONPATH=src .venv/bin/python -m overrule.cli lessons auth
# Or serve the MCP tools (stdio) to your coding agent:
PYTHONPATH=src .venv/bin/python -m overrule.server store
```
## The five tools
| Tool | Question it answers |
|---|---|
| `decision_context(topic)` | What is the current decision on this topic, what did it overrule, what contradicts it, and where did it come from? |
| `impact_of_change(component)` | What decisions, lessons and tasks are in the blast radius of touching this component? |
| `blocked_work()` | Which open tasks are blocked, and by which decisions or incidents? |
| `lessons_for(component)` | Which lessons apply here — directly, via neighbouring components, or by text — and which incident taught each one? |
| `brief(topic)` | All of the above for one topic, in a single call: the agent's pre-flight briefing. |
## The demo corpus
`corpus/` is a fully synthetic project, **Northstar** (a small fictional
SaaS): 35 decision/lesson/task/incident/component records whose graph
contains the stories the demo tells — ADR-009's cookie sessions, overruled
by ADR-014 after the INC-7 session-fixation incident; L-22, the lesson
INC-7 taught, contradicting the proposed AuthLib-C swap (ADR-016); tasks
T-31 and T-12 blocked by ADR-014; a second overruling (blue-green ADR-005
→ canary ADR-019 after the INC-14 cutover outage); and an incident
(INC-18) blocking work directly. No real project, employer, or personal
data appears anywhere in this repository.
## Verify it
```bash
.venv/bin/python tests/test_kill_gate.py
```
Four checks with positive controls: pinned-Relate round-trip (with
idempotency), store persistence across a process restart, an end-to-end
MCP `decision_context` call from a real client, and write refusal through
the serving path (with the control that the same write succeeds on a
writable connection).
## Disclosures
- **AI assistance:** this project was built with significant AI coding
assistance (Anthropic's Muse) under human direction, as the contest
rules require us to state. The entrant remains responsible for the
result.
- **Reused code:** none. All code in this repository was written during
the contest period for this entry. Relate 1.4.0 (Apache-2.0) is an
external dependency, pinned.
- **Licence:** Apache-2.0 (see `LICENSE`).
TDQS
Scored across 5 tools
Each tool has a distinct primary query: decision history, change impact, blockers, lessons, and an aggregate briefing. The main overlap is the broad `brief` tool, which recombines data from the others, but its one-call summary role is still distinguishable from the focused tools.
All names use lowercase snake_case and are descriptive noun-based query names rather than mixed conventions. `brief` is a single generic word and `lessons_for` is a prepositional fragment, but the set remains predictable overall.
Five tools is well within a sensible range for this narrow decision-context domain. Each tool appears to earn its place by supporting a specific inquiry or an aggregate briefing.
The retrieval surface covers decision context, impact, blockers, lessons, and a combined briefing, so core read workflows are present. However, there are no create/update operations for decisions, lessons, incidents, or tasks, and no obvious way to discover topics or list unblocked work.