Decision log
Every decision in Rematch is written down as an architecture decision record (ADR): the context, the decision, the alternatives and the consequences. This log is generated at build time from docs/decisions/, so it is always the repository’s own record. New decisions take the next number.
One file per decision: context, decision, alternatives, consequences. New decisions get the next number. Every record is listed here once.
- 0001. Monorepo in TypeScript with pnpm workspaces and Turborepo
- 0002. Next.js (App Router) for the web app
- 0003. Background workers on BullMQ with a native Stockfish 19 pool
- 0004. Postgres with Drizzle ORM
- 0005. Better Auth for authentication
- 0006. chess.com integration behind a flag, with a Lichess-first fallback
- 0007. Pinned analysis protocol and a shared position cache
- 0008. Lichess win% formulas for accuracy and move classification
- 0009. The improvement engine follows the research spec
- 0010. Maia-2 as a separate Python service, with a fallback
- 0011. Claude API with structured outputs and a claim validator
- 0012. Build our own rating-band opening explorer
- 0013. Local 5-piece Syzygy plus the Lichess tablebase API
- 0014. Stockfish WASM in the browser, GPL-compliant
- 0015. UI stack and an anti-slop design process
-
- Withdrawn: Rematch has no paid plans.
- 0017. Per-game metrics plus append-only KPI snapshots
- 0018. Age gate and privacy defaults
- 0019. Hosting: Vercel for the web app, a dedicated-CPU host for the workers
- 0020. Post-launch backlog
- 0021. TypeScript everywhere; Rust only for a profiled hot job
- 0022. Biome for lint and format, Vitest for tests
- 0023. Local stack host ports 55432 and 56379
- 0024. Weakness timeline with change-point detection
- 0025. Tiered import and prioritised analysis for large histories
- 0026. Workspace packages resolve source via a development condition
- 0027. Lichess server evals accepted into the eval cache
- 0028. BullMQ job ids and analysis persistence
- 0029. State in Postgres, queue as delivery; reconciler instead of an outbox
- 0030. Rust for the entire backend
- 0031. Rust workspace, toolchain and crates
- 0031 addendum. npm enforcement
- 0032. Postgres job queue
- 0033. SQL migrations own the schema, Drizzle is generated
- 0034. User events over LISTEN/NOTIFY with a reset marker
- 0035. Analysis generations and job outcome rules
- 0036. Per-stage timing metrics
- 0037. Own PGN parser with chess.js-compatible FEN and SAN
- 0038. Parity acceptance and removal of the TS backend
- 0039. Piece set: Cburnett by default, Chessnut as an option
- 0040. chess.com first; Lichess accounts deferred
- 0041. First target: a private beta for the owner and a few friends
- 0042. Shared Rust build caches across lanes
- 0043. No email address in outbound requests
- 0044. Postgres runs under an init process with an exec-form TCP healthcheck
- 0045. Rust worker runtime image and graceful shutdown
- 0046. The games read model: scoped, read-only, no API routes
- 0047. Honest overview statistics
- 0048. Games explorer: URL state, offset paging and UTC day filters
- 0049. Game review data: PGN-first plies, stored engine scores, honest gaps
- 0050. Overview chart encodings
- 0051. Game review interaction, board marks and honest judgements
- 0052. The analysis reveal on the review page
- 0053. Overview layout
- 0054. Game review layout: the graph as the spine, with the mistakes ledger
- 0055. The overview page: honest rows, a broken trend line, a server-safe band, a session reveal
- 0056. Live refresh of the game pages, and a dev-only account link
- 0057. Rust Anthropic client and the
aicrate’s dependencies - 0058. Porting the TS AI reference to Rust, and how parity is kept
- 0059. AI tables, jobs and events
- 0060. Sectioned generation and facts by reference
- 0061. Models, budgets and degradation
- 0062. Claude calls go through a Claude Agent SDK sidecar
- 0063. Monthly and weekly regeneration through the Message Batches API
- 0064. “Ask your coach”: the chat engine
- 0065. Game pages e2e: a guarded seed, their own quality and visual specs
- 0066. Postgres connection limit for the integrated worker
- 0067. CI runs the gates in compose, and e2e on a production build
- 0068. Coach read models: scope, exemplars, sufficiency and the catalogue
- 0069. Report requests and report states on the web
- 0070. Coach chat: the web’s hand-off to the worker, and the allowance it shows
- 0071. Coach text, disclosure and states in
@ci/ui - 0072. Profile encodings: weakness rate, KPI small multiples, exemplar arrows, optional next band
- 0073. Coach surfaces and the report page
- 0074. Coach e2e: a guarded coach seed, a simulated worker, and the coach baselines
- 0075. Coach data for the beta: the beta AI plan, weekly-review inputs, the first report
- 0076. Recurring incremental sync of linked accounts
- 0077. “Sync now” and the analysis-progress panel
- 0078. Honest coach availability, uncompared weaknesses and R2-backed examples
- 0079. Explained stats: definition lines, an explanation popover and the weakness story
- 0080. A chess.com peer benchmark from the opponents you have faced
- 0081. The peer benchmark compares with the pooled rate, in the player’s window, without mirrors
- 0082. The colour split: profile rows per side the player had
- 0083. One filter URL contract, and honest period comparison
- 0084. A costing state and its peer comparison never contradict each other
- 0085. The coach reads the colour split, names the peer benchmark and uses the glossary
- 0090. The missed-moments trainer
- 0087. One plain name per measure, and filters that follow the player
- 0086. The coach reads a coaching-input snapshot written at every profile build
- 0091. A weekly focus with a measurable goal
- 0089. The rating trajectory, and then against now
- 0092. A focused overview: trend, focus, practise, then the detail
- 0093. The report validator drops claims, not honest wording
- 0094. The coach knows the player’s plan: a per-user plan context
- 0095. Open source under AGPL-3.0, with the SDLC, protection and releases as code
- 0096. The public face: the Rematch name, the README and a GitHub Pages site
- 0102. The coach’s voice: a patient voice at the board
- 0103. The Rematch palette, a crayon for celebrations and dad’s handwriting (Amendment 1: the cool palette is back)
- 0099. The roadmap as GitHub milestones and spec issues, and scheduled maintenance sweeps
- 0098. Release images on GHCR, signed, with the GPL source attached
- 0097. Self-hosting: one setup script, its data, the AI choice and a demo player
- 0100. A pipeline benchmark: synthetic players with injected flaws (Tier 1)
- 0101. A ranking floor, W1 compared with the opponents, and W5 compared with the evaluation
- 0104. Factual and deterministic: four layers, one versioned recommendation algorithm
- 0105. The algorithm manifest, stamping and the replay suite
- 0106. Algorithm science: pre-registered experiments and a Python lab that drives the Rust algorithm
- 0107. The experiment value gate, and the catalogue that checks the learning framework
- 0108. Reviewing outside code: sensitive paths, fork approval and a read-only token
- 0109. Champion and challenger: decided experiments stay live, and every version is compared on all of them
- 0110. A pinned “today” for the visual e2e
- 0111. Prior-rule variants behind
ALGO_VARIANT, and the fix for the 80% ranges - 0112. Hide the motif tags EXP-0007 did not clear
- 0113. Analyse at 1 million nodes: the protocol EXP-0008 chose
- 0114. Following anonymised Lichess players across months
- 0115. The lab calls the trajectory, the timeline and the web’s rules
- 0116. Hide the trajectory’s rating verdict until a rule clears EXP-0015
Records with placeholder numbers
Section titled “Records with placeholder numbers”These lanes wrote their records under a lane prefix. The controller gives each its final number when it renumbers; until then the prefix is the name.
Web (M4): ADR-WEB
Section titled “Web (M4): ADR-WEB”- ADR-WEB-1. Source-only UI packages and the web dependency set
- ADR-WEB-2. Web development stack in Compose
- ADR-WEB-3. Auth data model, Better Auth configuration and invite-only sign-up
- ADR-WEB-4. Lichess OAuth (PKCE) and Lichess linking
- ADR-WEB-5. chess.com linking and location-code verification
- ADR-WEB-6. Age gate, under-13 block and private defaults
- ADR-WEB-7. Design tokens, themes and self-hosted fonts
- ADR-WEB-8. Live user events: one LISTEN per process, SSE with replay, polling fallback
- ADR-WEB-9. Third-party design tooling review and the ban lint
- ADR-WEB-10. Visual QA loop: Playwright, shots, lab and critique
- ADR-WEB-11. Overlay libraries: sonner, vaul and cmdk
- ADR-WEB-12. KPI stats: a fixed percent window, outward-rounded interval ends, a host-set halo and an honest trend scale
- ADR-WEB-13. Board: shipped Cburnett pieces, coordinates and piece motion
- ADR-WEB-14. Weakness timeline and area score encoding
- ADR-WEB-15. Annotation overlay: geometry, draw-on and placement rules
- ADR-WEB-16. App shell, sign-in, age and account-linking screens
- ADR-WEB-17. Original procedural board sounds
- ADR-WEB-18. Quality sweep, visual baselines and the throttle fix
- ADR-WEB-19. One statistics convention, and the critic’s layout fixes
- ADR-WEB-20. The styleguide’s off-screen sections skip rendering
Profile engine (R2): ADR-R2
Section titled “Profile engine (R2): ADR-R2”Every R2 record has a file (titles final at R2 Task 35); numbers 19 to 21 were never used.
- ADR-R2-1. Profile engine crates, dependencies and data layout
- ADR-R2-2. The coaching-input contract crate
- ADR-R2-3. Clean-room motif tagger
- ADR-R2-4. Weakness metric rulings (detectors W1-W12)
- ADR-R2-5. Posterior and priority conventions
- ADR-R2-6. Timeline change detector and states
- ADR-R2-7. KPI catalogue, snapshots and area scores
- ADR-R2-8. Repertoire tree, line keys, struggles and opening verdicts
- ADR-R2-9. Lichess database pipeline: streamed, verified, never stored
- ADR-R2-10. Opening explorer build: one parallel pass, verified before activation
- ADR-R2-11: Band reference method
- ADR-R2-12. Local Syzygy probe through a separate Stockfish set
- ADR-R2-13. Maia licence check and difficulty providers
- ADR-R2-14. Enrichment protocol
- ADR-R2-15. Fair scheduling and preview
- ADR-R2-16. Tiered analysis scheduler
- ADR-R2-17. ETA and autoscaling hooks
- ADR-R2-18. Build-profile and the CoachingInput builder
- ADR-R2-22. Syzygy 3-4-5 tablebases: pinned, verified, never committed
- ADR-R2-23. Reference build storage: lifecycle guards and per-metric band fallback
- ADR-R2-24. The analyse-game hook: per-game features at analysis time
- ADR-R2-25. Worker wiring of the profile engine, and the read-only CLI