Built with Relate

Every patch has a precedent.

See which architecture decisions a patch touches, and what the tests that guard them observed when it ran.

terminal
uv run patch-precedent demo all
token-header.patch
distribution/install.shchanged file
ADR-0585The installer downloads release assets over the direct routedecision
#7 No GitHub API endpoint in install.shok
#64 No Authorization header when GITHUB_TOKEN is setnot ok
#193 No case made a GitHub API requestok

A patch, the file it changes, the decision that file cites, and the checks that guard it.

How it works

Cite

Every ADR mention in Relate's source (outside the ADRs themselves), plus hand-reviewed rules and the tests that enforce them.

Replay

Each patch runs against the unmodified upstream test harness in its own clean checkout.

Explain

One Relate query joins the patch, its decision and every observed test result.

Six patches, two decisions.

installerviolates ADR-0585

token-header

Sends GITHUB_TOKEN as an Authorization header, for the authenticated rate limit.

#7 ok#64 not ok#193 ok
View patch: installer token-header

Run the demo

$ uv run patch-precedent demo all Recorded run · 2026-11-27 13:47 UTC · run 20261127T134634Z
╭────────────────────────────────────────────────────────────────────╮
│  Patch Precedent  demo all                                         │
│  relatedb/relate @ 5f7a5107 · Relate 1.1.0 · read-only store       │
╰────────────────────────────────────────────────────────────────────╯

installer
  ✓ baseline         194 passed            exit 0  9.3s
  ✗ release-lookup   192 passed  2 failed  exit 1  7.3s   #7 #193
  ✗ token-header     193 passed  1 failed  exit 1  7.7s   #64
  ✓ wording          194 passed            exit 0  7.5s

Verdicts
  ● release-lookup   violates ADR-0585  #7 static, #193 runtime
  ● token-header     violates ADR-0585  #64 runtime
  ● wording          consistent with ADR-0585 (checks #7, #64, #193)

replay check: 4/4 runs match fixtures/installer/expectations.toml (by content sha256)
  release-lookup - expected regression reproduced; demo replay succeeded
  token-header - expected regression reproduced; demo replay succeeded

───────────────────────────────────────────── Details ──────────────────────────────────────────────

release-lookup  patch 635b00b21f4b changes distribution/install.sh
diff --git a/distribution/install.sh b/distribution/install.sh
index 331db681..a33deda1 100755
--- a/distribution/install.sh
+++ b/distribution/install.sh
@@ -151,7 +151,12 @@ fetch_url() { # $1 = URL, $2 = destination

 # One release asset over the direct route.
 direct_get() { # $1 = asset name, $2 = destination
-       fetch_url "$download_base/$tag/$1" "$2" || die "$fetch_error"
+       fetch_url "$download_base/$tag/$1" "$2" && return 0
+       asset_error=$fetch_error
+       if fetch_url "https://api.github.com/repos/relatedb/relate/releases/tags/$tag"
"$tmp/release-info.json"; then
+               echo "Release $tag exists. Check the asset name: $1" >&2
+       fi
+       die "$asset_error"
 }

 # The one https:// gate both override seams take, before any request.

token-header  patch 5146b525a26d changes distribution/install.sh
diff --git a/distribution/install.sh b/distribution/install.sh
index 331db68..752a1f3 100755
--- a/distribution/install.sh
+++ b/distribution/install.sh
@@ -135,7 +135,12 @@ trap 'rm -rf "$tmp"; [ -z "$tmp_out" ] || rm -f "$tmp_out"' EXIT
 # dies with its own sentence around that cause.
 fetch_url() { # $1 = URL, $2 = destination
        fetch_error=""
+       # Send GITHUB_TOKEN when set, so users behind shared IPs get the
+       # authenticated rate limit instead of the anonymous one.
+       auth=""
+       [ -n "${GITHUB_TOKEN:-}" ] && auth="Authorization: Bearer $GITHUB_TOKEN"
        status=$(curl --proto '=https' --proto-redir '=https' -sSL \
+               ${auth:+-H "$auth"} \
                -o "$2" -w '%{http_code}' "$1") || {
                fetch_error="failed to fetch $1; check the connection and retry"
                return 1

wording  patch 96278d65b413 changes distribution/install.sh
diff --git a/distribution/install.sh b/distribution/install.sh
index 331db681..b095337a 100755
--- a/distribution/install.sh
+++ b/distribution/install.sh
@@ -255,7 +255,7 @@ case "$latest_status" in
 *) die "$metadata_fail: the document is malformed: no latest.tag" ;;
 esac

-echo "Installing relate $tag ($os/$arch) to $INSTALL_DIR"
+echo "Installing relate $tag for $os/$arch in $INSTALL_DIR"

 # Cheap first: the manifest and its signature are small; the binary is
 # the large download and must not start until the manifest is

Comparison
                                                Passed/fail
Input          Changed                   Exit   ed            #7 static   #64 runtime   #193 runtime
────────────────────────────────────────────────────────────────────────────────────────────────────
baseline       - (unpatched)             0      194 / 0       ok 7        ok 64         ok 193
release-look   distribution/install.sh   1      192 / 2       not ok 7    ok 64         not ok 193
up
token-header   distribution/install.sh   1      193 / 1       ok 7        not ok 64     ok 193
wording        distribution/install.sh   0      194 / 0       ok 7        ok 64         ok 193

Graph evidence
distribution/install.sh
ADR-0585  The installer downloads release assets over the direct route  [Proposed]
  rule     install.sh consults no GitHub API endpoint and does not read GITHUB_TOKEN
  why      Anonymous GitHub API requests are limited to 60 per hour per IP address, and users behind
           shared egress (VPNs, corporate NAT, Cloudflare WARP) exhausted that quota, so the
           one-line installer broke. Release assets are now fetched over the direct download route
           instead. Only ADR-0068's installer authentication clause is superseded; version selection
           still uses releases.json.
  commit   5ac38808 fix(installer): download release assets over the direct route, no GitHub API
           (LABS-1482, ADR-0585)
           https://github.com/relatedb/relate/commit/5ac38808547d11f55b02333624cc3e88b46566eb
  cite     https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/distribution/install.sh#L120-L128
  decision https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/docs/adr/0585-installer-downloads-via-direct-route.md#L8-L38
  scope    https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/docs/adr/0585-installer-downloads-via-direct-route.md#L89-L97

  checks
    #7    static   drift guard: install.sh consults no GitHub API endpoint (ADR-0585)
                   release-lookup → not ok 7
                   token-header → ok 7
                   wording → ok 7
                   https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/tests/test_install_sh.sh#L129-L135
    #64   runtime  token set: no Authorization header anywhere (GITHUB_TOKEN never rides a request)
                   release-lookup → ok 64
                   token-header → not ok 64
                   wording → ok 64
                   https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/tests/test_install_sh.sh#L314-L315
    #193  runtime  no case made a GitHub API request (ADR-0585)
                   release-lookup → not ok 193
                   token-header → ok 193
                   wording → ok 193
                   https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/tests/test_install_sh.sh#L610-L615

also cites 5 ADRs (scanned, not reviewed): 0115 0250 0431 0457 0586
  ADR-0115  https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/distribution/install.sh#L9
  ADR-0250  https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/distribution/install.sh#L43
  ADR-0431  https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/distribution/install.sh#L217
  ADR-0457  https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/distribution/install.sh#L33
  ADR-0586  https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/distribution/install.sh#L83

Graph join (replay.rl)
MATCH (p:Patch)-[:CHANGES]->(f:File)-[:CITES]->(d:Decision)-[:CHECKED_BY]->(t:Check),
      (p)-[:PRODUCED]->(o:Observation)-[:FOR_CHECK]->(t),
      (c:Commit)-[:IMPLEMENTS]->(d)
RETURN p.id AS patch, f.path AS file, d.id AS decision, d.reason AS reason,
       c.sha AS implementation, t.name AS assertion, o.tap AS observed,
       p.label AS label, o.number AS tap_number
ORDER BY patch, assertion

label / patch        file / decision / impl    observed     assertion
────────────────────────────────────────────────────────────────────────────────────────────────────
token-header         distribution/install.sh   ok 7         drift guard: install.sh consults no
patch:5146b525a26d   ADR-0585 5ac38808                      GitHub API endpoint (ADR-0585)
token-header         distribution/install.sh   ok 193       no case made a GitHub API request
patch:5146b525a26d   ADR-0585 5ac38808                      (ADR-0585)
token-header         distribution/install.sh   not ok 64    token set: no Authorization header
patch:5146b525a26d   ADR-0585 5ac38808                      anywhere (GITHUB_TOKEN never rides a
                                                            request)
release-lookup       distribution/install.sh   not ok 7     drift guard: install.sh consults no
patch:635b00b21f4b   ADR-0585 5ac38808                      GitHub API endpoint (ADR-0585)
release-lookup       distribution/install.sh   not ok 193   no case made a GitHub API request
patch:635b00b21f4b   ADR-0585 5ac38808                      (ADR-0585)
release-lookup       distribution/install.sh   ok 64        token set: no Authorization header
patch:635b00b21f4b   ADR-0585 5ac38808                      anywhere (GITHUB_TOKEN never rides a
                                                            request)
wording              distribution/install.sh   ok 7         drift guard: install.sh consults no
patch:96278d65b413   ADR-0585 5ac38808                      GitHub API endpoint (ADR-0585)
wording              distribution/install.sh   ok 193       no case made a GitHub API request
patch:96278d65b413   ADR-0585 5ac38808                      (ADR-0585)
wording              distribution/install.sh   ok 64        token set: no Authorization header
patch:96278d65b413   ADR-0585 5ac38808                      anywhere (GITHUB_TOKEN never rides a
                                                            request)

artifacts  runs/20261127T134634Z/installer

release
  ✓ baseline         6 passed              exit 0  4.3s
  ✗ always-rotate    5 passed    1 failed  exit 1  3.0s   #2
  ✓ docs-only        6 passed              exit 0  3.0s
  ✓ wording          6 passed              exit 0  3.1s

Verdicts
  ● always-rotate    violates ADR-0580  #2 runtime
  ● docs-only        no linked decision
  ● wording          consistent with ADR-0580 (checks #2, #3)

replay check: 4/4 runs match fixtures/release/expectations.toml (by content sha256)
  always-rotate - expected regression reproduced; demo replay succeeded

───────────────────────────────────────────── Details ──────────────────────────────────────────────

always-rotate  patch 5b21144e810e changes scripts/release-bump.sh
diff --git a/scripts/release-bump.sh b/scripts/release-bump.sh
index 6048649..b9e9e46 100755
--- a/scripts/release-bump.sh
+++ b/scripts/release-bump.sh
@@ -228,14 +228,10 @@ cargo metadata --format-version 1 > /dev/null
 # the idempotence decision, the link-ref rewrites — lives in
 # scripts/changelog_rotate.py, the one implementation, unit-tested directly.
 # Already-rotated is the module's own skip notice on stdout, exit 0. The
-# advance's scoped mode skips the step: the changelog rotates only at a
-# release cut (ADR-0580).
-if (( ! skip_changelog )); then
-  python3 scripts/changelog_rotate.py "$changelog" \
-    --version "$next" --date "$(date +%F)"
-else
-  echo "release-bump: CHANGELOG rotation skipped (the advance's scoped mode); the changelog rotates
only at a release cut"
-fi
+# advance's scoped mode used to skip the step, but rotation is idempotent, so
+# every sweep now runs it and the changelog can never fall behind (ADR-0580).
+python3 scripts/changelog_rotate.py "$changelog" \
+  --version "$next" --date "$(date +%F)"

 # --- 4. Consistency self-check (after editing) --------------------------------

docs-only  patch 8ea2fb7d08c0 changes CONTRIBUTING.md
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e904916..5038b68 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,6 +1,6 @@
 # Contributing to Relate

-Thanks for using Relate — and for wanting to make it better.
+Thank you for using Relate, and for wanting to make it better.

 ## How to contribute: open an issue

wording  patch 25a59c759f3f changes scripts/release-bump.sh
diff --git a/scripts/release-bump.sh b/scripts/release-bump.sh
index 6048649..534c546 100755
--- a/scripts/release-bump.sh
+++ b/scripts/release-bump.sh
@@ -234,7 +234,7 @@ if (( ! skip_changelog )); then
   python3 scripts/changelog_rotate.py "$changelog" \
     --version "$next" --date "$(date +%F)"
 else
-  echo "release-bump: CHANGELOG rotation skipped (the advance's scoped mode); the changelog rotates
only at a release cut"
+  echo "release-bump: --skip-changelog: CHANGELOG.md left unchanged (an advance is not a release
cut)"
 fi

 # --- 4. Consistency self-check (after editing) --------------------------------

Comparison
Input           Changed                   Exit   Passed/failed   #2 runtime   #3 runtime
────────────────────────────────────────────────────────────────────────────────────────
baseline        - (unpatched)             0      6 / 0           ok 2         ok 3
always-rotate   scripts/release-bump.sh   1      5 / 1           not ok 2     ok 3
docs-only       CONTRIBUTING.md           0      6 / 0           ok 2         ok 3
wording         scripts/release-bump.sh   0      6 / 0           ok 2         ok 3

Graph evidence
scripts/release-bump.sh
ADR-0580  Post-release workspace versioning  [Proposed]
  rule     An advance never rotates CHANGELOG.md; the changelog rotates only at a release cut
  why      After each release the workspace advances to the next unreleased version, so main never
           carries a released version. The advance performs the version-surface sweep without the
           changelog rotation, because an advance is not a release cut and rotating then would mint
           a release section for a version that never shipped. The released version therefore exists
           only on the tagged commit and on the registries.
  commit   d79d8b15 fix(release): close the cargo package drift window with a post-release version
           advance (LABS-1443, ADR-0580) (#233)
           https://github.com/relatedb/relate/commit/d79d8b150561f56b4940876a067d6b7e4781d2bc
  cite     https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/release-bump.sh#L224-L238
  decision https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/docs/adr/0580-post-release-workspace-versioning.md#L26-L45
  scope    https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/docs/adr/0580-post-release-workspace-versioning.md#L66-L78

  checks
    #2    runtime  advance: empty-[Unreleased] CHANGELOG.md byte-identical — no heading inserted,
                   [Unreleased] ref unchanged
                   always-rotate → not ok 2
                   wording → ok 2
                   https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/tests/test_release_advance.sh#L45-L46
    #3    runtime  advance: the version surfaces still advanced
                   always-rotate → ok 3
                   wording → ok 3
                   https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/tests/test_release_advance.sh#L48-L49

also cites 3 ADRs (scanned, not reviewed): 0278 0560 0616
  ADR-0278  https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/release-bump.sh#L18
  ADR-0560  https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/release-bump.sh#L184
  ADR-0616  https://github.com/relatedb/relate/blob/5f7a510713c3feac146133e77d8c5bb72bae1b11/scripts/release-bump.sh#L193

CONTRIBUTING.md: no linked decision
Graph join (replay.rl)
MATCH (p:Patch)-[:CHANGES]->(f:File)-[:CITES]->(d:Decision)-[:CHECKED_BY]->(t:Check),
      (p)-[:PRODUCED]->(o:Observation)-[:FOR_CHECK]->(t),
      (c:Commit)-[:IMPLEMENTS]->(d)
RETURN p.id AS patch, f.path AS file, d.id AS decision, d.reason AS reason,
       c.sha AS implementation, t.name AS assertion, o.tap AS observed,
       p.label AS label, o.number AS tap_number
ORDER BY patch, assertion

label / patch        file / decision / impl    observed   assertion
────────────────────────────────────────────────────────────────────────────────────────────────────
wording              scripts/release-bump.sh   ok 2       advance: empty-[Unreleased] CHANGELOG.md
patch:25a59c759f3f   ADR-0580 d79d8b15                    byte-identical — no heading inserted,
                                                          [Unreleased] ref unchanged
wording              scripts/release-bump.sh   ok 3       advance: the version surfaces still
patch:25a59c759f3f   ADR-0580 d79d8b15                    advanced
always-rotate        scripts/release-bump.sh   not ok 2   advance: empty-[Unreleased] CHANGELOG.md
patch:5b21144e810e   ADR-0580 d79d8b15                    byte-identical — no heading inserted,
                                                          [Unreleased] ref unchanged
always-rotate        scripts/release-bump.sh   ok 3       advance: the version surfaces still
patch:5b21144e810e   ADR-0580 d79d8b15                    advanced

artifacts  runs/20261127T134634Z/release

✓ 8/8 runs match expectations   overall exit 0 · 46s · runs/20261127T134634Z
terminal
uv run patch-precedent demo all

Runs locally in about 45 seconds.

Agents with and without the graph.

Claude Sonnet reviewed each patch 3 times per arm. Same prompt, same file tools, same 25-turn limit. The graph arm adds one MCP tool.

Every run and the method
Verdict correct
baseline
16/18
graph
18/18
Catching-checks recall
baseline
100%
graph
100%
Unsupported claims (lower is better)
baseline
4

all 4 were correct

graph
0
Mean turns (lower is better)
baseline
6.2
graph
2.1

Run it in a minute.

macOS with git and uv. The first run also downloads Relate's source once.

terminal
git clone https://github.com/Namans12/patch-precedent.git
cd patch-precedent

Read-only and offline. Works on any diff against Relate at the pinned commit; outside the two curated decisions it shows scanned citations only.

terminal
uv run patch-precedent explain fixtures/installer/token-header.patch

One read-only tool, precedent_for_patch. Run the demo first so it can return observed results.

terminal
claude mcp add --scope project precedent -- uv run --project <path-to-patch-precedent> --quiet patch-precedent mcp
All the steps