Skip to content

docs(adr): reduce ADR book to ~250pp (taxonomy, dedup, density build) - #574

Merged
alpergundogdu merged 51 commits into
mainfrom
claude/hungry-greider-799fed
May 15, 2026
Merged

alpergundogdu merged 51 commits into
mainfrom
claude/hungry-greider-799fed

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Goal: shrink the bundled ADR PDF (adrs-book.pdf) from ~400 to ~250 pages without losing any decision, invariant, contract behavior, or cross-reference.

Honest outcome, in two parts:

  • Content side (modest, by nature). This corpus is a maintained canonical spec, not redundant copy-paste — a cross-file scan found only ~28 words of near-duplicate prose. Under a strict no-decision-loss gate, safe condensation across ~38 files yielded ~8.5k book words (~6.5%). Levers: A verify-and-delete Cross-ADR-Impact residue (amendments were already applied to targets — grep-proven; folds 031→009, 022→observability); B architecture.md dedup + taxonomy-normalize; C ADR 016 IFeeRouter NatSpec condense (premise corrected — IFeeRouter is the corpus-canonical definition, not a restatement, so it was tightened, not pointer-ized); D the 028/031/032 shared-appendix extraction was deliberately skipped — it would have inverted a security property (031 burns vs 032 refunds the appeal bond) for ~0 net pages; E condensed all 12 appendices; F prose-tightened 24 numbered ADRs (conservative — agents stopped at the decision-loss boundary).
  • Layout side (the actual win, reversible). The default pandoc/typst template was extremely loose (~2.5 cm margins, 11 pt, slack leading). A purely-presentational density config (_build/book-margins.yaml + _build/book-density.typ, wired into the build) takes the book to ~257 pp no-mermaid (≈ ~230 mermaid-rendered), numeric ~250 pp. It changes no content — drop the four flags for byte-identical output.

Also in this branch (reviewer note): its first commit is #571 (section-taxonomy unification) — it was not previously in main, so this PR ships #571 + the reduction work. opt4/#346 relocated all inline Alternatives Considered + resolved-tombstone residue to the _history audit trail (verbatim) so the spec reads as canonical design, not an iteration log.

Tooling added: adr/Makefile (make / make book / make numeric / make MERMAID=0 / make clean / make check-book-list) as the single build source of truth; a CI job + pre-commit hook that validate the reading-order list only when ADR-book files change.

Verification (mechanically proven, not asserted)

  • Both PDFs build exit 0 with ZERO typst dangling-label errors at HEAD (typst hard-fails on any unresolved reference).
  • Solidity contract surface byte-identical: 291 declaration lines in main, 291 in HEAD, set-difference = 0 — no ABI/struct/event/enum/function/mapping lost.
  • Both load-bearing anchors preserved exactly (appendix-poc-production-seams seam-1, appendix-observability §2.6).
  • Every rejected alternative preserved verbatim in adr/_history/ (8→16 sections).
  • Clean fast-forward onto main; pre-commit hooks pass on every commit. No Rust/Cargo touched. No PDFs committed (per the mermaid-CI constraint — CI must regenerate the binaries).

Reviewer guidance

  • Structural integrity is proven above. The one thing scripts can't prove is prose-semantic fidelity of the ~8.5k condensed words — if you want a spot review, focus on the most aggressively cut files: adr/003-payments.md, adr/011-content-takedown.md, adr/016-contract-interactions.md, adr/026-gauge-boost-tokenomics.md.
  • The density config is presentational and reversible — flag it if you'd prefer the default density or a different page target.
  • docs/superpowers/plans/2026-05-15-adr-book-reduction.md is the planning/methodology artifact, included for traceability — safe to drop if you don't want a docs/superpowers/ tree.
  • No open ADR questions remain; "deferred" items are intentional out-of-PoC future features.

Test plan

  • cd adr && make MERMAID=0 — both PDFs build, exit 0, no dangling-label errors
  • cd adr && make (with mmdc/puppeteer) — canonical mermaid-rendered build, confirm ~230 pp book
  • cd adr && make check-book-list — reports "book list in sync"
  • CI: adr-book-list job runs on this PR (ADR files changed) and passes; skips on non-ADR PRs
  • Spot-review prose diffs of 003/011/016/026 for semantic fidelity

🤖 Generated with Claude Code

…applied)

All 5 amendments (003/012/014/016/019) verified already native in targets:
003 uses SignatureChecker (L54/599/704); 016 OZ table lists it (L819);
019 documents Safe+ERC-7579+smartsessions (L46/L260); 012/014 reflect it.
No decision lost: 024's design lives in its Decision §3; targets canonical.
…applied)

002 reads canonical (no open on-chain-verif Q); 005 already slash_sig-sole
(L57); 003 has §Corrupted delivery; 011 §Slashing uses ecrecover slash_sig;
028 openSlashAppeal(slashId) canonical in 028. No decision lost.
…applied)

003 L277 already states eclipse resolved-in-ADR-012 / PoC-registry-only;
001 retains node bootstrap; 005 wire fields + 008 client-local-reputation
decisions canonical in 012 body. No decision lost.
…applied)

005 L170 already frames voucher_interval_mb as Tier-1 minor evolution;
001 already validates GossipEnvelope-unwrapped payloads; arch index has
ADR 013 entry. Consequences section preserved. No decision lost.
Genuine fold: 3 decdn_dht_* metrics moved into appendix-observability
§2.11 (the canonical metric registry) -> decision preserved. Other bullets
verified residue: 022 body L150/L205/L225 canonically state origin-not-at
-probe + false-STORE->reputation; 001 already shows Future Work resolved.
No decision lost.
…applied)

All 9 bullets are restatement of decisions canonical in 011's own body:
§Slashing (serving-blacklisted slashable, L582+), §Origin Assignment
Authority, §OriginAssignment contract, §Interaction-with-appeals
(028 decoupling). Targets 009/016/022/002 already integrated; 001 has
no permissionless-origin claim; 005 L53 origin-not-at-probe. No decision lost.
…in ADR 009)

Genuine fold: ADR 009 Emergency Multisig capability (3) now enumerates the
ContentBlacklist blacklist-entry-appeal sub-modes (fastTrackAppeal/
unFastTrackAppeal/rejectAppeal/rejectAppealAsPerjury), mirroring how cap (4)
documents its slash-appeal sub-modes -> decision preserved in 009's
exhaustive list. Residue bullets removed: 011 L312 already points to ADR 031
for ABI; 016 no-op; 032 parallel-pointer obvious. References kept. No decision lost.
…applied)

Event/storage spec is canonical in 032 §3 (032 is THE impl ADR); 026 stub
is a forward-pointer (no decision there); 028 L178 already 'six new entry
points'; arch index + CLAUDE.md are bookkeeping (CLAUDE.md is not a book
file). References kept. 028#cross-adr-impact anchor still served by A.9.
No decision lost.
KEEP heading (anchor served to 014/032) + full SafetyReserve-future-split
migration decision (4-item coupling list + escrow-semantics constraint
preserved verbatim in substance). Prose tightened ~222->~160w; 032-pinning
+ 011-decoupling reduced to tight pointers (canonical in 032 §3 / 011
§Interaction-with-appeals). No decision lost.
026: removed empty Cross-ADR Impact (its '(none — wash-trading defense is
the §3 cap)' note is a pointer to §3, which stays canonical).
030: condensed the deliberate tracked-divergence notes (#400-response)
~121->~90w; every tracked fact (ADR 008 scope, validation.rs spec/impl
divergence, §3-canonical) preserved. No decision lost.
B.1 dedup (~1,210w): removed Origin Integration prose (kept the unique
Supported-Origins table/OriginStore trait + Hash-to-Object-Key catalog as
'## Origin Backends'), Cache Behavior, Crate Structure, Binaries,
Dependency Chain, Observability — each duplicated an authoritative ADR/
appendix. Decision-loss guard: cache/incentive-independence + binary-split
preserved as a new Key Invariant citing appendix-poc-production-seams /
appendix-binaries (canonical there + CLAUDE.md).
B.2 taxonomy: merged 'Future Work: *' + 'What Is Not Decided Yet' into one
'## Deferred & Open' (canonical -> lua-stripped from book; preserved in
numeric+source). Repointed 4 inbound links (005x2, 011, blob-cache-eviction)
to appendix-observability / ADR 005. Zero dangling anchors. No decision lost.
Premise correction (Phase 1): IFeeRouter is the corpus-canonical FeeRouter
definition (not a restatement) — NOT pointer-ized. Instead: tightened the
verbose multi-line NatSpec comment essays that restate ADR 026 mechanics,
and the **Notes** block. PRESERVED verbatim: every function signature,
every event, the ShareDestinations struct, and every invariant/security
line (cross-validation, 26-epoch claim window, msg.sender==delegatorBuyer
sole-auth, epoch-immutability, 'no operator-asserted summary/identity-gate
/fraud-challenge', what-is-paused). §1 table/classDiagram/Tunable-Economics
/No-proxy/Shared-swap-helper and §2-§8 (deploy order, call table, role
grants, fund-flow, reentrancy) left structurally intact. No decision lost.
All headings + link targets identical; every schema field, 6 path-safety
rules, 5 determinism axes, hash-format rule, non-goal preserved (agent
decision-preservation report verified). No decision lost.
…prose only)

All headings + link targets identical; every rotation step/command/
contract-call/parameter/failure-mode preserved; collapsed one redundant
dual cast-code example (both outcomes kept in prose). No decision lost.
…prose only)

All headings + 15 link targets identical; every tier def, Tier-1/2/3 step,
ordering constraint, MUST/SHOULD, failure mode preserved. No decision lost.
…y-size restatement)

All 6 headings + the one link target identical; binary-split decision +
all 4 rationale points preserved (binary-size mechanics stated once in
Cross-ADR Impact, cross-referenced). No decision lost.
Arbitrum-One decision + all criteria + every ADR-dependent number + the
chain-comparison table byte-identical; headings + 6 link targets unchanged
(fixed one non-descriptive link text to satisfy MD059, target preserved).
Cut only post-table prose re-narrating table cells. No decision lost.
Every endpoint/route/error-code/security decision + both links preserved;
headings identical. Collapsed Rationale Q&A restating the Decision. No decision lost.
Heavily-referenced (10 inbound); 8 headings + all link targets identical;
every detection mechanism/parameter/cross-ref preserved. No decision lost.
…569->3435w)

ADR-017-cited section names: 13 headings TEXT+ORDER identical; every ALPN/
message/key-rule/lease-mechanic/threat + all links preserved (code, crypto,
2 mermaid, tables untouched). Prose-only. No decision lost.
LOAD-BEARING anchor #### 2.6 Gossip Metrics byte-identical; all headings +
numbers unchanged; 64 metric names == 64 (every row/Type/Tier/Label/
threshold/health-key preserved); §2.11 DHT block intact. Description-cell
+ §5/§6 narrative prose tightened only. No decision lost.
§2/§3 anchor headings byte-identical; 5 resolved questions + every
invariant (LRU key, pinning-overrides, evict-orthogonal, probe-hold,
reputation-not-a-factor) + all params/metrics/links preserved. Collapsed
2 structural duplications. No decision lost.
§1/§3/§4 anchor headings byte-identical; TTL 600s/last_seen_us, active-
eviction triggers, no-hard-cap rationale, reputation-not-a-factor, all
metrics/links preserved. No decision lost.
LOAD-BEARING seam-1 heading byte-identical (em-dash xxd-confirmed); all 9
seam headings text+number unchanged; every trait/PoC/prod/decision + leaf-
crate principle + single-poc-feature + mechanical-deletion rule preserved.
Seam-preamble prose only. No decision lost.
Collapsed 3x zero-voucher-close restatement to canonical home + back-refs;
deduped 3x 10-USDC-minimum; cut Attack-Vectors ceremony; tightened NatSpec
essays. All 3 settlement invariants, Channel struct, function/reject tables,
NodeId-binding security props, decimal invariants, headings, links preserved.
No decision lost.
…ive)

Collapsed 4x appeal-decoupling + 2x 'not-a-new-multisig-power' restatement
to canonical homes + back-refs. Synthetic-standing clawback, half-open
evidence window + µs-invariant, compliance/bond tables, On-Blacklist-Event
steps, §Slashing, interfaces, headings, links all byte-preserved. No decision lost.
Collapsed §5 payout-ordering / §2 pre-launch / §11 / Risks restatements to
canonical homes + pointers; tightened NatSpec essays. Allocation + 6-bucket
+ ve + §11 safety-bounds tables, working_bytes/share_i formulas, div-by-zero
fallbacks, 3 queue-ordering properties, interfaces, headings, links
preserved. No decision lost.
Deduped 5x 'probe data not confidential' + redundant rate-manipulation
explanatory tail to canonical homes. Every ALPN/wire-message/field/error
code/MUST-SHOULD rule/parameter, headings, 33 link targets byte-preserved.
No decision lost.
…prose (no-decision-loss; headings+links preserved)
…se (no-decision-loss; headings+links preserved)
…ory (#346)

Moved the 6 still-inline '## Alternatives Considered' bodies (028/030/031/
032 + blob-cache-eviction + peer-table-eviction appendices) into the
_history audit trail, leaving the standard one-line breadcrumb stub —
completing the #346 Tier-3 pattern already applied to 014/018/022/026/etc.
Every rejected alternative preserved verbatim in _history (no decision-
record loss). Zero inbound #alternatives-considered links. NOTE: 0 book-page
impact (lua already strips Alternatives from adrs-book.pdf); shrinks the
numeric build + source only.
…nly)

The pandoc/typst defaults (~2.5cm margins, 11pt, slack leading, toc-depth 2)
rendered the reading-order book at ~429pp (no-mermaid). Adding a standard
technical-book geometry — _build/book-margins.yaml (1.6cm/1.8cm) +
_build/book-density.typ (10pt, linestretch 1.0, tighter par/raw/table/
heading) wired into both README build commands — takes it to 258pp
no-mermaid (~230pp mermaid-rendered), numeric 251pp. Section-level TOC
(toc-depth 2) retained. ZERO content/decision change: drop the four flags
to render byte-identical content at the loose default. Both builds exit 0,
zero typst dangling-label errors. No PDFs committed (per task: leave
binary regeneration to the mermaid-fixed CI pipeline).
Makefile is the single source of truth for the pandoc invocation:
  make            both PDFs (mermaid-rendered, canonical)
  make book/numeric   one PDF
  make MERMAID=0  no mermaid-filter (no mmdc/puppeteer; soundness check)
  make clean / help
  make check-book-list   drift guard — fails if a numbered/appendix .md
                         is missing from the hand-maintained BOOK_SRCS
Recipes mirror the prior README commands exactly (incl. density flags,
npm PATH prefix, lua filter, title/date). README's two copy-paste pandoc
blocks replaced with make usage + a pointer; all explanatory notes
(deps, mermaid, lua-strip, density, hand-maintained-list caveat) kept.
Verified: make MERMAID=0 exit 0, zero dangling, adrs.pdf 251pp /
adrs-book.pdf 258pp, make clean works. No PDFs committed.
Guards the silent-omission hazard (a numbered ADR/appendix added without
updating adr/Makefile BOOK_SRCS would drop it from adrs-book.pdf).

- ci.yml: new 'adr' dorny/paths-filter (adr/**/*.md, adr/Makefile) + a
  lightweight 'adr-book-list' job (checkout + 'make -C adr
  check-book-list', no pandoc/typst, sub-second) gated
  'if: needs.changes.outputs.adr == true' so it runs ONLY on ADR-book
  changes; wired into ci-success needs + allowed-skips so the skip on
  unrelated PRs is accepted.
- .pre-commit-config.yaml: local 'adr-book-list' hook scoped via
  files: ^adr/(.*\.md|Makefile)$ — instant local feedback, skips on
  non-ADR commits.

Verified: check-yaml passes both files; pre-commit hook fires on
adr/Makefile (Passed) and skips on a Rust file.
Zero decision-loss — every removed item's resolution is canonical in the
ADR it points to:
- 001: delete struck '### ~~Future Work: Scaling Content Discovery~~
  (Resolved by ADR 022)' section (no inbound links; canonical in ADR 022)
- 005: delete struck '~~Postcard has no schema evolution~~ — resolved by
  ADR 013' bullet (canonical in ADR 013)
- 019: delete the 2 struck '~~…~~ Resolved —' Deferred&Open bullets
  (Geolocation→ADR 030, Delegated-signer→ADR 024); kept the 2 genuinely
  open items
- 012: drop 'Resolves the open question in ADR 003…' meta-line (section
  already states the Option-B decision); reword the Consequences bullet
  to canonical voice
- architecture.md: collapse '### Open / undecided' to the one real open
  item (Parallel multi-node streaming), dropping 8 struck 'decided —'
  changelog tombstones; reword the ERC-20 Trust-Assumption that called
  ADR 010 vetting 'an open question' -> points at ADR 010's decided
  Token Vetting Checklist
…fix orphaned ref

- 003 § Probe fishing: moved the 3 rejected probe-DoS options (require-
  channel-to-probe / PoW / monitor-only) to _history, leaving the canonical
  mitigation (layered rate limit, ADR 005) + Note inline + a breadcrumb.
- 018: replaced the V2-vs-V3 drafting-history blockquote with a canonical
  V3 statement + breadcrumb; the V2-rejection + 2025-11-03 exploit record
  preserved verbatim in _history (affirmative V3 justification stays in
  ADR 018 § Consequences).
- _history: +2 sections (ADR 003 probe-fishing, ADR 018 Balancer V2) —
  every rejected alternative preserved verbatim; section count 14->16.
- FIX: 001-network.md:176 same-file link '[Future Work](#future-work-
  scaling-...)' orphaned by the Commit-1 tombstone removal -> repointed to
  [ADR 022]. (My pre-removal grep required a filename prefix and missed the
  bare same-file ref — exactly the failure mode the verification protocol
  warns about; caught by the typst build, now fixed.)

Authoritative: both builds exit 0, ZERO typst dangling-label errors,
book 257pp / numeric 250pp (no-mermaid). No decision lost.
The written plan that drove this branch: per-lever analysis, the measured
'corpus is decision-dense' headline finding, page calibration, and the
verification protocol. Reviewer traceability for a 50-commit reduction;
safe to drop if the repo doesn't want a docs/superpowers/ tree.
@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 89.03% (was 89.02%, ▲ +0.01%) — 14728/16543 lines

No Rust files changed in this PR.

History
Commit Total Δ vs base
0ba819f 89.02% ▲ +0.01%
3a0fe77 89.03% ▲ +0.01%
7a1b938 (HEAD) 89.03% ▲ +0.01%

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request streamlines the project's Architecture Decision Records (ADRs) by refining the text for better consistency and readability across the documentation set. It introduces a new Makefile-based system for generating ADR PDFs in both numeric and thematic reading orders, supported by a pre-commit hook to maintain synchronization. The review feedback correctly identifies broken internal Markdown links in the slashing appeals and safety reserve contract ADRs, where references to ADR 014 used incorrect anchor slugs.

Comment thread adr/028-slashing-appeals.md Resolved
Per maintainer request — it was the working-process Phase-1 plan, flagged
as droppable. (docs/runbook.md is a pre-existing repo file, untouched.)
…natives pointers

_history/alternatives-pre-launch.md is in neither built PDF, so the 'see
_history' stubs were dead pointers in the artifacts and iteration-log noise
in a canonical spec. Removed:
- 14 '## Alternatives Considered' breadcrumb stub sections (014 #### / 018
  /022/026/028/030/031/032 + architecture.md + 5 appendices) — heading +
  the one _history pointer line; 014's substantive '> Note' kept
- 2 inline _history breadcrumbs (003 § Probe fishing, 018 V2-vs-V3)
- 026: 4 same-file '[Alternatives Considered](#alternatives-considered)'
  refs reworded to '… was considered and rejected' (named alternatives
  kept inline, no dangling link)
Docs synced to the new reality: README (design principle, Decision-record
context, #346 note now 'complete', strip paragraph, taxonomy row),
_history header, _build/preface.md.
The _history archive itself is unchanged (every rejected alternative still
preserved verbatim) — it is simply no longer linked from the spec.
Both builds exit 0, ZERO typst dangling-label errors; book 257pp / numeric
248pp (no-mermaid). No decision lost.
@alpergundogdu
alpergundogdu merged commit 55fe463 into main May 15, 2026
11 checks passed
@alpergundogdu
alpergundogdu deleted the claude/hungry-greider-799fed branch May 15, 2026 18:22
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