# Performance log

This file records every algorithm or data-structure change made for performance, with the numbers
before and after and how they were measured. It also records changes that were measured and
rejected, changes that had no effect, and regressions, so the same idea is not tried twice and a
slowdown is never silent. The reasoning behind each change lives in its ADR (`docs/adr/`); this file
is the index of the numbers. 한국어: [PERFORMANCE.ko.md](PERFORMANCE.ko.md).

## Measurement principles

- **Same data, same conditions.** Before and after run on the same seed, machine and settings,
  ideally back to back or interleaved. A number measured on different data is not a comparison.
- **Distributions, not single runs.** Report p50 and p95 (or median and range) for latency, and
  the number of runs. Ranges in the tables are the spread over runs as given in the ADR.
- **State the load.** Concurrency (sequential, N parallel clients), data size (pages, rows, chunks,
  blocks, bytes) and whether caches were warm.
- **State the environment.** Node version, Postgres version, browser engine and build type
  (production or dev server), machine class and database size.
- **Link the source.** Every number links to the ADR (and, where possible, the commit) where it
  was recorded together with its script or test. A number without a source does not go in.
- **Improvement** is computed from the Before and After cells of the same row: percentages for
  token and size reductions, multiples (×) for time. Ranges in the inputs give a range here; no
  midpoint is picked.
- **Cost** lists what the change made worse or what it trades away. An honest cost is not a
  regression; a regression is a measured slowdown of something users already had.

The entries below were recorded before this log existed. Their "How measured" cell repeats only
what the ADR states; Node version, hardware and run counts are given where the ADR records them
and are otherwise not recorded. Commit hashes are not listed yet; the ADR is the source.

## Retrieval & MCP

Token counts are `estimateTokens` (ADR 0926) of the tool output an agent receives.

| Area | Change (what algorithm or structure) | Before | After | Improvement | Cost | How measured | Source |
|---|---|---|---|---|---|---|---|
| find_context, large corpus | Section-level retrieval: stored section index, lexical ranking, greedy packing into a token budget, instead of search + whole-page reads | 2,254 mean tokens (median 1,910), 3.68 calls, success 0.75 (page@1 0.68) | 624 mean tokens (median 123), 1.00 call, success 0.93 (section@1 0.93, section@3 0.93) | −72% tokens (3.6×), 3.68× fewer calls, success +0.18 | Lexical only: no synonyms or cross-language matching | 28 questions (English and Korean, `context/evalSet.ts`), fictional 25-page wiki padded to 1–2k tokens/page + 5,000 distractor pages (15,310 chunks). Before = old tools with an oracle stop (≤ 3 reads). `apps/server/scripts/context-bench.ts`, Postgres 16 in Docker on a laptop | [ADR 0927](adr/0927-find-context-ranking-and-budget-packing.md) |
| find_context, small corpus | Same as above | 377 mean tokens (median 308), 3.36 calls, success 1.00 | 135 mean tokens (median 121), 1.00 call, success 1.00 | −64% tokens (2.8×), 3.36× fewer calls | Same as above | Same 28 questions on the unpadded 25-page wiki, same script and setup | [ADR 0927](adr/0927-find-context-ranking-and-budget-packing.md) |
| find_context latency | Coverage-ordered coarse SQL + trigram probe only for CJK terms, 300-candidate cut | Old one-term search route p50 3 ms (does far less work, not comparable) | p50 49 ms, p95 67 ms | None claimed (absolute latency of the new tool) | New per-question latency compared with a plain search | 15k-chunk workspace above, direct call, 3 × 28 queries | [ADR 0927](adr/0927-find-context-ranking-and-budget-packing.md) |
| Section index full-text search | Stored `tsvector` column on `page_chunks` instead of an expression GIN index | p50 182 ms, p95 404 ms (expression index; `ts_rank` and coverage re-parse every candidate) | p50 ≈ 48 ms, p95 ≈ 68 ms | 3.8× (p50), 5.9× (p95) | About 1× extra text size on disk | 15k chunks, same data for both | [ADR 0926](adr/0926-section-index-and-stable-anchors.md) |
| list_pages / search output | Compact `format: "lines"` output instead of JSON | list_pages 967 tokens, search 75 tokens | list_pages 392 tokens, search 43 tokens | −59% (list_pages), −43% (search) | Opt-in; JSON stays the default | Evaluation wiki, `context.db.test.ts` log lines; conditions not recorded beyond that | [ADR 0928](adr/0928-partial-and-batch-reads-compact-output.md) |
| patch_section | Edit one section as a Yjs edit with a base version, instead of read_page + update_page replace | ≈ 2,415 tokens (read + update_page replace) | ≈ 222 tokens (outline + call + result) | −91% (10.9×) | None for tokens; see Sync & collaboration for the echo cost | Changing one sentence on the padded evaluation page, `context.db.test.ts` | [ADR 0930](adr/0930-patch-section-yjs-splice-with-base-version.md) |
| patch_section replace latency (0.12) | Echo shortcut: an old block equal to one of the agent's new blocks as it is skips the Markdown round trip; nodes known to the server schema (callout, embeds, mention) | p50 small 7.3–7.6 ms, 100-block section 54.4–62.0 ms, 1.4 MB page 125.9–130.6 ms | 4.1–4.2 ms, 23.4–26.2 ms, 116.1–122.1 ms | 1.8× / 2.1–2.6× / 1.0–1.1× p50 | Synchronous part unchanged (1.4 / 7.2–8.2 / 57–63 ms) | `apps/server/scripts/section-write-bench.ts` (in-process core, no database: parse, echo, synchronous patch; read = section blocks on a copy + Markdown). Synthetic pages: small 5 sections × 6 blocks (14 KB state), one 100-block section (123 KB), 180 sections × 10 blocks + a 10×5 table every third section (1.4 MB); the agent changes one word. Before = a copy of the working tree before this change (v0.11.0 plus other 0.12 work in progress) beside the new one, interleaved before, after, before, after; one warm-up excluded, n = 15; ranges over the 2 runs of each. Node 22.23.4, Apple-silicon MacBook Air shared with other agents' test runs (±30% between rounds) | [ADR 1500](adr/1500-agent-markdown-notation-for-custom-nodes.md) |
| read_page(section) with the agent notation (0.12) | Notation pass (sentinels) around BlockNote's exporter; nodes kept by the server schema | p50 small 1.6–1.7 ms, 100-block section 12.0–13.7 ms, 1.4 MB page 55.8–59.6 ms | 2.0 ms, 13.6–14.6 ms, 56.5–57.2 ms | None (within noise on the large page; +0.3 ms small) | Output now includes callouts, mentions, embeds and file tokens (more tokens on pages that have them) | `apps/server/scripts/section-write-bench.ts` (in-process core, no database: parse, echo, synchronous patch; read = section blocks on a copy + Markdown). Synthetic pages: small 5 sections × 6 blocks (14 KB state), one 100-block section (123 KB), 180 sections × 10 blocks + a 10×5 table every third section (1.4 MB); the agent changes one word. Before = a copy of the working tree before this change (v0.11.0 plus other 0.12 work in progress) beside the new one, interleaved before, after, before, after; one warm-up excluded, n = 15; ranges over the 2 runs of each. Node 22.23.4, Apple-silicon MacBook Air shared with other agents' test runs (±30% between rounds) | [ADR 1500](adr/1500-agent-markdown-notation-for-custom-nodes.md) |
| changes_since | Cursor-based section change feed with merged log rows and line diffs, instead of re-reading pages | 5,724 tokens (re-read the 4 pages with read_page) | 388 tokens, recall 12/12 | −93% (14.8×) | Before/after text up to 2 × 16 KB per log row | 40 edits on 12 sections of 4 pages → 12 log rows, `apps/server/src/context/changeFeed.test.ts` ([db] suite) | [ADR 0932](adr/0932-change-feed-cursor.md) |
| query_rows, first page | Row-level collection query (filters, fields, paging) instead of read_page of the whole table | 7,083 tokens (read_page) | 838 tokens (25 rows, default columns) | −88% | 200 rows with all columns cost 9,679 tokens (+37% over read_page) | 200-row, 7-field collection, `collectionQuery/collectionQuery.db.test.ts` | [ADR 0934](adr/0934-collection-query-tools-for-agents.md) |
| query_rows, filtered | Same, 3-condition filter, 2 columns | 7,083 tokens (read_page) | 519 tokens, 17 of 17 expected rows | −93% | Each row line carries its id and version (about 13 tokens) | Same collection and test | [ADR 0934](adr/0934-collection-query-tools-for-agents.md) |
| find_context location format | Last heading + shortest page-unique anchor suffix, "Also relevant" one line per page, real header cost in packing, instead of the full heading path twice per result and a flat 30-token header estimate | Same ranking, budget 1,500, relevance floor off (budget filled), per question: section text 689.9, everything else 579.4 tokens, 8.1 fragments. Production copy, field query: section text 845, everything else 902 tokens, 5 fragments; old code printed 2,511 tokens for a 1,500 budget | 735.2 / 439.1 tokens, 8.7 fragments. Production copy: 990 / 621 tokens, 6 fragments; new code 1,611 tokens for the same budget | +6.6% (+45) section text, −24% other tokens (synthetic); +17% (+145) section text, −31% other (production copy) | A short anchor can become ambiguous when a same-named section is added to the page (404 with the anchor list) | Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work; fresh scratch database per run; `apps/server/scripts/context-bench.ts --pages 5000 --final`: 47 questions (`context/evalSet.ts`), padded wiki + contest pages (62) + 5,000 distractor pages, 15,693 chunks; before = the code before ADR 1210 with the same questions and corpus; the production copy is a local restore of a backup (numbers only, dropped afterwards), new ranking in both columns | [ADR 1212](adr/1212-find-context-short-section-locations.md) |
| find_context ranking accuracy | idf-weighted BM25 + adjacency + per-page rule (see the accuracy table below) | dev MRR 0.848, test 0.806 | dev MRR 0.897, test 0.944 | +0.049 dev, +0.138 test MRR | Latency, see Regressions | Same as the accuracy table | [ADR 1210](adr/1210-find-context-idf-weighted-ranking.md), [1213](adr/1213-retrieval-evaluation-dev-test-split.md) |
| Untrusted-data wrappers | Data/instruction boundary markers and `can:` attributes around user-written content in tool output | find_context + section mean 631 (padded) / 135 (unpadded) tokens; old flow 2,264 | 665 / 158 tokens; old flow 2,320 | None (security mitigation) | +5.4% (+34) padded, +17% (+23) unpadded, +2.5% (+56) old flow; fixed ≈ 15–25 tokens per call | `apps/server/scripts/context-bench.ts --pages 1000`, fresh DB each run | [ADR 0976](adr/0976-data-instruction-boundary-in-mcp-output.md) |
| Injection scan, URL rules | URL and image-exfil rules as one left-to-right pass (non-overlapping URL tokens, each `=` after `?` checked once) instead of regexes whose classes both accepted `?` and `=` (backtracking over every split point, cubic) | 20 KB adversarial text: `http://?` 19,522 ms, `http://a?b` 12,465 ms, `![x](http://a?` 7,799 ms, `https://x/p?a=&` 2,606 ms; 180 KB did not finish in 10 min | 20 KB: 0.2–0.4 ms; 180 KB: 1.7–3.0 ms; ordinary prose unchanged (0.5 ms / 20 KB, 4.1 ms / 180 KB) | ≈ 10⁴–10⁵× on adversarial input (one document could stall the server's event loop for seconds to hours) | None found; same 50 detection cases pass, plus placeholders in a later query parameter or after a space | `scanInjection` called directly, Node 22.23.4, Apple-silicon MacBook Air; before = 1 run per input (20 KB), after = median of 3 (20 KB) and 5 (180 KB). Guard test in `mcpTools/trust.test.ts` (180 KB < 1 s) | [ADR 0977](adr/0977-injection-signals-and-taint-record.md) |
| Section index coverage, long page | `page_chunks` without the 200 KB text cap (bound 5,000 rows); `page_texts` keeps head + tail instead of head | Sections indexed 56/170 (production copy), 62/181 (synthetic); a term only in the last section: not found by find_context, not in page_texts | 170/170, 181/181; found by find_context; tail in page_texts (search finds it) | Whole page covered | Index rows 130 → 490 / 122 → 361, index text 205 KB → 781 / 614 KB; see Regressions for CPU and find_context latency | `apps/server/scripts/large-page-bench.ts`: in-process test app (real routes + Hocuspocus), MCP over the in-memory transport, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Pages: copy of the production page (4.50 MB state, 170 sections, 1,989 blocks, 192 tables; numbers only) / synthetic log (4.13 MB, 181 sections, 1,802 blocks, 181 tables). Sequential calls, one warm-up excluded; event-loop max via `monitorEventLoopDelay` (2 ms); "other requests" = GET /backlinks of a small page every 10 ms during the run. Before/after interleaved (before, after, before, after); ranges are over the 2 runs of each; coverage = distinct anchors in page_chunks vs `splitSections`, plus one find_context of words that occur only in the last section | [ADR 1040](adr/1040-index-the-whole-page.md) |
| read_page outline, 4.5 MB page | Answer from `page_chunks` rows when the freshness record proves the index current, instead of decoding the whole document | Production copy p50 150.1–152.5 / p95 182.2–188.6 ms, event loop max 172.0–173.8 ms, other requests p95 166.8–177.2 ms; synthetic 132.9–134.6 / 168.9–178.4 ms; page open in a tab: 172.2–189.4 / 249.8–261.5 ms | 7.1–7.2 / 8.6–8.8 ms, loop max 3.5–3.6 ms, other requests p95 3.5–3.9 ms; synthetic 5.8–6.8 / 8.8–10.1 ms; open in a tab: 6.7–7.3 / 8.7–9.0 ms | 21× p50, 21× p95 (production copy); loop max 48–50× | First read after a restart decodes and compares chunk hashes (see Regressions) | `apps/server/scripts/large-page-bench.ts`: in-process test app (real routes + Hocuspocus), MCP over the in-memory transport, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Pages: copy of the production page (4.50 MB state, 170 sections, 1,989 blocks, 192 tables; numbers only) / synthetic log (4.13 MB, 181 sections, 1,802 blocks, 181 tables). Sequential calls, one warm-up excluded; event-loop max via `monitorEventLoopDelay` (2 ms); "other requests" = GET /backlinks of a small page every 10 ms during the run. Before/after interleaved (before, after, before, after); ranges are over the 2 runs of each; n = 30 (open in a tab: 15) | [ADR 1041](adr/1041-outline-and-section-reads-from-the-index.md) |
| read_page section, 4.5 MB page | Resolve the section on the index, convert only its top-level range; Markdown cached per (page, stored state, anchor) | Different section each call: p50 201.2 / p95 260.5 ms; same two sections alternating: 164.9–173.7 / 200.5–206.3 ms; page open in a tab: 184.5–196.3 / 282.2–841.1 ms | Different section each call: 123.9 / 150.4 ms; alternating (cache): 6.5–6.8 / 7.7–12.9 ms; open in a tab: 5.9–6.0 / 7.4–7.5 ms | 1.6–1.7× (cold), ≈ 25× (repeat), ≈ 31× p50 (open in a tab) | A cold read of a stored (closed) page still applies the whole state once (≈ 100 ms); cache up to 4M characters | `apps/server/scripts/large-page-bench.ts`: in-process test app (real routes + Hocuspocus), MCP over the in-memory transport, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Pages: copy of the production page (4.50 MB state, 170 sections, 1,989 blocks, 192 tables; numbers only) / synthetic log (4.13 MB, 181 sections, 1,802 blocks, 181 tables). Sequential calls, one warm-up excluded; event-loop max via `monitorEventLoopDelay` (2 ms); "other requests" = GET /backlinks of a small page every 10 ms during the run. Before/after interleaved (before, after, before, after); ranges are over the 2 runs of each. Cold numbers: 30 reads of 10 distinct anchors on 3 fresh copies, 1 run per tree; alternating: n = 30 | [ADR 1041](adr/1041-outline-and-section-reads-from-the-index.md) |
| read_page section, 8 concurrent cold reads | Same as above (no shared decode between concurrent requests) | Production copy p50 1,268.3–1,282.9 / p95 1,276.5–1,330.6 ms, loop max 1,083–1,084 ms; synthetic 1,052.3–1,085.9 / 1,064.7–1,125.6 ms | 964.9–1,137.7 / 1,009.3–1,331.7 ms, loop max 486–959 ms; synthetic 724.7–832.6 / 774.3–869.1 ms | 1.1–1.3× p50; p95 within spread on the production copy | Each concurrent miss applies the state separately | `apps/server/scripts/large-page-bench.ts`: in-process test app (real routes + Hocuspocus), MCP over the in-memory transport, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Pages: copy of the production page (4.50 MB state, 170 sections, 1,989 blocks, 192 tables; numbers only) / synthetic log (4.13 MB, 181 sections, 1,802 blocks, 181 tables). Sequential calls, one warm-up excluded; event-loop max via `monitorEventLoopDelay` (2 ms); "other requests" = GET /backlinks of a small page every 10 ms during the run. Before/after interleaved (before, after, before, after); ranges are over the 2 runs of each; 4 rounds × 8 parallel reads of different anchors | [ADR 1041](adr/1041-outline-and-section-reads-from-the-index.md) |
| MCP page tools (read_page, update_page, add_comment, …) | Agent context (`can:`, `applies:`, provenance) from an in-process function instead of a second `app.inject` of `GET /pages/agent-context`; workspace access version keys the lock-chain, agent-block and has-instructions caches | read_page p50 10.75–11.13 / p95 13.0–17.9 ms, 2 internal requests, 14.4 statements; 16 clients p50 71.9–75.6 / p95 91.2–99.3 ms; update_page append 30.3 / 32.5 ms, 39.6–39.7 statements; add_comment 8.4–8.9 / 11.0–13.4 ms, 20.9 statements | read_page 8.8–9.2 / 11.2–11.8 ms, 1 internal request, 10.4 statements; 16 clients 65.7–69.3 / 80.6–86.1 ms; update_page 27.3–27.5 / 30.7–32.1 ms, 33.6 statements; add_comment 7.6–7.8 / 10.2–10.9 ms, 17.9 statements | read_page 1.2× p50, −4 statements; update_page 1.1× p50, −6; add_comment 1.1–1.2×, −3 (v0.2.0 build in the same rounds: read_page 10.5–10.8 ms / 14.4, update_page 36.0–36.7 ms / 30.3, add_comment 9.9–10.1 ms / 16.0; v0.1.0 in the regression report: 7.3 ms / 7.4, 33.2 ms / 39.6, 10.6 ms / 18.1) | The token is not re-validated between a tool's REST call and its facts (same MCP request) | Seed of the v0.2.0 regression report (v0.1.0 seed: 3 users, 2 workspaces, 5,000 docs, 3 × 2,000 rows, 26k links, 3k comments; upgraded by v0.2.0), restored from a dump before every round; production builds (`NODE_ENV=production`), Node 22.23.4, Postgres 16.15 in Docker (`pg_stat_statements`, `random_page_cost = 1.1`), Apple-silicon MacBook Air shared with other work. Before = the same tree without this change (it already contains other unreleased work, so its statement counts are higher than v0.2.0's); rounds interleaved before/after/v0.2.0 × 2, ranges over the 2 rounds; real `/mcp` over HTTP, 1 client (16 for c16), client re-initialised every 8 calls; statements = `pg_stat_statements` calls / tool calls. Round 1 of Before was disturbed (search 66.9 ms, list_pages 120 ms, update_page p95 115 ms in that round only); update_page Before is round 2. Measured before the browser-request membership refinement (it removes one EXISTS probe from agent requests, counts unchanged) | [ADR 1070](adr/1070-mcp-agent-context-in-process.md), [ADR 1071](adr/1071-workspace-access-version-and-write-gate.md) |
| Connection range in the access checks (read_page, list, search) | `visibleTo` gains a range term only inside a range-limited token's request: `workspace_id = ANY(…)` and, for a subtree, `pages.id IN (recursive CTE from the root)`; browser sessions and unlimited tokens get no extra SQL (ADR 1202) | Cookie session (the SQL before this change): read_page p50 1.85 / p95 2.12, list 27.30 / 32.97, search 4.69 / 6.36 ms | Token 'all': 1.95 / 2.40, 27.83 / 33.21, 4.34 / 4.79 ms. Workspaces range: 2.02 / 2.55, 26.29 / 31.46, 4.25 / 4.66 ms. Subtree of 102 pages: 2.41 / 2.73, 3.53 / 3.87, 3.28 / 3.62 ms. Subtree of 1,012 pages: 2.60 / 3.28, 8.08 / 8.98, 4.58 / 5.39 ms | No measurable change without a range or with a workspace range; subtree: read_page +0.5–0.8 ms p50, list and search faster (fewer rows returned) | One recursive walk over the subtree per statement that checks visibility (≈ +0.6 ms at 100 pages, +0.8 ms at 1,000 on read_page) | `apps/server/scripts/range-bench.ts`: in-process Fastify app with the real workspace, page and export routes, `app.inject`; 5,053 pages in one workspace (40 folders × 100 docs, 1 folder × 10 × 100 docs, 1 in 20 titled "needle"), `page_texts` of ≈ 560 characters each, `ANALYZE` after the seed. read_page = `GET /pages/:id/export?format=md` of a 400-word doc inside both subtrees; list = `GET /workspaces/:id/pages`; search = `GET /workspaces/:id/search?q=needle`. One full warm-up round of every cell (30 + 300 calls), then the reported round in reverse order, 30 warm-up + 300 sequential calls per cell. Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other agents' builds and tests. A first run without the warm-up round put the first mode 6× slower (JIT and cache warm-up), so only the second round is reported | [ADR 1202](adr/1202-range-enforced-at-the-permission-boundary.md) |
| Guests and page levels in the access checks (read_page, list, search) | One `EXISTS` on `page_grants(user_id)` folded into the user lookup every request already runs; accounts with rows load their guest scope (1 statement) and `visibleTo` gains `workspace_id <> ALL(guest workspaces) OR id IN (walk from their rows)` for the guest's workspaces only; levels are cached per workspace access version, skipped for accounts known to have no rows (ADR 1252) | Tree without this change (same seed and rounds): member, workspace without rows: read_page p50 1.97–2.52 / p95 2.51–4.17, list 19.91–19.97 / 24.75–25.46, search 5.19–5.44 / 5.94–6.87 ms; member, workspace with others' rows: 2.01–2.14 / 2.71–2.88, 22.76–25.27 / 26.83–31.16, 5.04–7.47 / 6.17–10.69; member with a row elsewhere: 2.26–2.29 / 3.23–3.59, 21.75–27.72 / 26.54–39.78, 5.06–5.09 / 6.06–6.92 | Member, workspace without rows: 2.02–2.30 / 2.42–3.13, 19.57–20.72 / 24.22–27.85, 5.16–5.38 / 6.03–7.12; others' rows: 2.23–2.49 / 2.71–5.31, 23.44–24.92 / 27.19–30.89, 5.32–5.57 / 6.57–7.34; member with a row elsewhere: 2.59–2.80 / 3.33–4.06, 22.08–22.23 / 26.33–26.53, 5.65–5.84 / 6.46–7.00. Guest, 102-page tree: page open (lock + comments) 9.87–10.32 / 11.06–15.26, list 5.63–5.69 / 6.65–7.05; 1,012-page tree: 11.31–11.93 / 12.87–18.11, 10.28–10.73 / 11.49–12.93 | Members without rows: within the spread of the rounds (no statement added, `visibleTo` SQL unchanged to the character, unit test `pageGrants.test.ts`); an account with a row anywhere: +0.3–0.5 ms per request (loading its scope) | The user lookup statement is one `EXISTS` longer for everyone; a guest's page open costs ≈ 10 ms for two requests (one subtree walk per statement that checks visibility) | `apps/server/scripts/guest-bench.ts`: in-process Fastify app with the real workspace, page, export, lock and comment routes, `app.inject` with browser cookies; 5,053 pages in one workspace (the range-bench seed) plus 5,001 in a workspace without rows; rows: 3 guests on a 102-page folder, 2 on a 1,012-page folder, one member with a view row on a third folder. read_page = `GET /pages/:id/export?format=md` (members) or `GET /pages/:id/lock` + `GET /pages/:id/comments` (what a guest's page view loads; the export is member-only); list = `GET /workspaces/:id/pages`; search = `GET /workspaces/:id/search?q=needle` (member-only). Before = a copy of the tree with the user lookup and request scope of before this change (the rest of the code is identical for members; guest modes cannot run there). Rounds interleaved before/after/before/after on fresh databases; each round: one full warm-up of every cell, then the reported pass in reverse order, 30 warm-up + 300 sequential calls per cell; ranges over the 2 rounds. Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other agents' builds and tests | [ADR 1252](adr/1252-guest-visibility-at-the-permission-boundary.md) |
| read_ink rendering | New: strokes rendered to PNG on the server with the web layer's outline (shared `strokeOutline`), scanline fill with 4 sub-scanlines and exact horizontal coverage, own PNG encoder over `node:zlib`; no dependency | None (no ink for agents before) | Typical page (300 strokes × 40 points, 1,500 px, 1 image): p50 31 ms, PNG 101 KiB. Dense page near the 8 MiB save limit (2,000 × 80 points, 4,800 px, 3 images): p50 221 ms, max 227 ms, PNG 1,075 KiB. Synthetic 4,000 × 150 points (over the save limit): p50 664 ms, PNG 3,019 KiB. Heap 21–70 MiB, RSS +21–44 MiB | None claimed (new tool) | Synchronous on the event loop for the whole render (≈ 0.2 s at the realistic maximum) | `renderInk` called directly from a throwaway script (random-walk strokes, every 10th a highlighter; JSON sizes 0.7 / 8.6 / 32 MiB with unrounded coordinates), one warm-up, 7 runs, p50 / max; Node 22.23.4, Apple M4, other agents' builds and tests running. Fidelity: the same 23 strokes as a Chrome SVG screenshot vs the PNG, 896×380: mean per-channel difference 0.24/255, max 90, 12.5 % of inked pixels differ by > 16 (anti-aliased edges) | [ADR 1511](adr/1511-server-side-ink-rendering-without-dependencies.md) |
| read_page / find_context ink marker | One extra statement per call: `jsonb_array_length(page_ink.strokes)` joined to the workspace setting, for the ids already shown | No statement | Setting off: p50 0.31–0.41 / p95 0.38–1.01 ms whatever the ink size. Setting on: no ink 0.31 / 0.38, 151 KiB of ink 0.43 / 0.86, 1,918 KiB 2.53 / 2.75, 10 ids incl. that page 2.81 / 3.14 ms | None (cost of a feature) | +0.3–0.4 ms per read_page/find_context; +2.5 ms on a page with ≈ 2 MB of ink while the setting is on (the length detoasts the whole array; a stored count column is the fix if it matters) | `inkStrokeCounts` called directly, 10 warm-up + 100 sequential calls, p50 / p95; Postgres 16 in Docker on localhost, Node 22.23.4, Apple M4 shared with other work | [ADR 1512](adr/1512-ink-marker-in-page-headers.md) |
| catch_up (new, 0.12) | One ranked call (ADR 1520–1522): change-log aggregate per page (one GROUP BY over the window), section diffs for the 40 most important pages (change feed fold/diff), comments since, inbox after a notification seq, due items per workspace, Later; importance packing with a per-group decay | The same picture needed `changes_since` + `inbox` + `later` + `list_comments` per page (≥ 4 calls, log order, no ranking) | 2,500 pages, 6,000 changes in the window, 400 comments, 30 inbox items, 200 dated tasks: median 100 ms (budget 4,000) / 91 ms (12,000), output 3,983 / 11,787 tokens; 20,000 changes: 201 / 203 ms; all workspaces of the person 82 ms | One call, budget used 99 % | Grows with the rows in the window (one aggregate over them) and with the 40 diffed pages | `apps/server/scripts/catch-up-bench.ts` on a fresh migrated database (6 people, 30 % of edits via an agent, skewed: a few hot pages get most edits), `readCatchUp` called directly, 6 runs per budget, median of runs 2–6; Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon Mac shared with two other agents' builds and tests | [ADR 1520](adr/1520-catch-up-for-agents.md), [1521](adr/1521-catch-up-importance-packing.md) |
| POST /mcp body (B-L10) | Bearer token checked before the body is read; value count (commas and brackets outside strings, strings skipped with `Buffer.indexOf`, stop at 20,000) before Fastify's JSON parser, 413 above it (ADR 1526) | Longest event-loop delay per request, value-heavy body 1 / 4.1 / 8.2 / 12.4 MB: 4.9 / 20.6 / 45.3 / 70.1 ms (parsed, also without a token); string-heavy 1 / 3.8 / 7.6 / 11.4 MB: 2.9 / 9.7 / 17.8 / 29.7 ms | Value-heavy: 1.3 / 1.4 / 1.5 / 2.3 ms (413); string-heavy: 3.6 / 9.2 / 18.1 / 30.7 ms (unchanged); no token: 401 without parsing | Value-heavy 12.4 MB: 30× shorter stall | Requests over 20,000 JSON values are refused (no tool needs that many) | `apps/server/scripts/mcp-body-bench.ts`: Fastify `inject` into a route with the default parser (before) and with `registerMcpJsonParser` (after), `monitorEventLoopDelay` (1 ms resolution) max per request, median of 7; string-heavy = import_folder-like files of Korean/English Markdown, value-heavy = objects of 5 small fields; Node 22.23.4, same machine as above | [ADR 1526](adr/1526-mcp-request-body-before-and-during-parse.md) |
| read_page re-reads, 3 agents (0.12) | Page version (hash of kind, title, properties, body) and `known=` on read_page/read_pages: an unchanged page is one line | Re-read pass, nothing changed: 39,231 tokens; re-read pass after a person edited the top page of every question: 39,495 | 759; 27,273 | −98.1%; −30.9% | The body is still read and rendered on the server (read_page p50 17.7–23.4 → 17.1–22.4 ms over 2 runs: no time saved); the agent keeps versions | `scripts/mcp-token-bench.ts`: one 2,000-page workspace (padded evaluation wiki + synthetic folders, every page indexed), sequential in-memory MCP calls, warm; Node 22.23.4, Postgres 16.13 (Docker, arm64), Apple M4 24 GB, other test runs on the same machine at the time; 3 agents (3 OAuth clients of one user) × 8 dev questions, find_context → read_page of up to the first 3 pages it names (it named 11 distinct pages over the 8 questions, so 11 reads per agent per pass), then the two re-read passes; 3 bench runs, token counts identical in every run | [ADR 1540](adr/1540-known-versions-and-unchanged-reads.md) |
| Multi-agent question flow, total (0.12) | Same as above, whole flow: ask + read, re-ask + re-read (unchanged), re-ask + re-read (edited) | 134,301 tokens (288 calls) | 83,607 | −37.7% | find_context answers are not shortened (16,344 of the tokens; byte-identical across agents, 19 of 19 first-pass answers) | Same run as above | [ADR 1540](adr/1540-known-versions-and-unchanged-reads.md) |
| find_context, three agents repeating questions (0.12) | Result cache per person (ADR 1550): key = permission inputs + per-workspace access version, page marker and section index epoch + normalised query + budget, read in one statement before the retrieval | 300 calls (10 questions × 5 rounds × 3 agents, 2 interleaved rounds): p50 113.3 ms, p95 174.1, mean 117.3; 0% from cache | p50 20.4 ms, p95 121.2, mean 28.5; 93.3% from cache (20 misses = 10 questions × 2 rounds) | 5.6× p50, 4.1× mean; the first ask of each question is unchanged | Up to 32 MB / 1,000 entries; a miss runs one marker statement (instead of `memberWorkspaceIds`, same size) before the retrieval. Invalidation checked: after an edit + reindex the next calls were 2 misses, 0 hits | `apps/server/scripts/agent-efficiency-bench.ts 1500 40`: one workspace, 1,500 doc pages × 6 sections (9,000 sections, seeded and indexed by the script), three agent connections of one person through the in-memory MCP client (`testHarness.ts`, every REST call through `app.inject` as in production); Node 22.23.4, Postgres 16 in Docker, Apple-silicon MacBook Air shared with other agents' work; tool latency as the agent sees it (includes review facts, agent context, ink marker, which are not cached) | [ADR 1550](adr/1550-find-context-result-cache.md) |
| changes_since, three agents watching (0.12) | `wait` long-poll (ADR 1551): one call waits up to 25 s and returns when the change consumer commits rows in the agent's workspaces | Polling every 2 s, 40 s, an edit every 8 s (5 edits): 60 calls (90/min), 433 database transactions incl. the edits', change seen after p50 695 ms / max 1,300 ms | `wait=25`: 15 calls (23/min), 190 transactions, seen after p50 57 ms / max 90 ms | −75% calls, −56% transactions, 12× faster to see a change | One waiting call per open request (256 per process, 4 per connection); idle it costs no statement | Same script and seed as the row above, phase B; transactions = `pg_stat_database.xact_commit` delta of the database during the phase (the writer's edits and the consumer's passes included in both), delay = commit time of an edit to the first answer of each agent that listed it. Real socket on a running server: `wait=25` answered after 25.0 s, a wake-up 0 ms after the creating call returned, a client abort freed the slot, SIGTERM answered a waiting call at once | [ADR 1551](adr/1551-changes-since-long-poll.md) |
| read_pages, 3 unchanged pages (0.12) | `known=` on read_pages; unchanged pages use no budget | 3,781 tokens, p50 29.2–37.9 ms | 70 tokens, p50 30.1–34.7 ms | −98.1% tokens; latency unchanged | Same as above | `scripts/mcp-token-bench.ts`: one 2,000-page workspace (padded evaluation wiki + synthetic folders, every page indexed), sequential in-memory MCP calls, warm; Node 22.23.4, Postgres 16.13 (Docker, arm64), Apple M4 24 GB, other test runs on the same machine at the time; 3 padded wiki pages, 20 runs × 2 bench runs | [ADR 1540](adr/1540-known-versions-and-unchanged-reads.md) |
| list_pages, 2,000 pages in one call (0.12) | `format: "compact"`: 8-character ids, numbered/dated leaf siblings folded into one line, one-space indent | lines: 6,986 tokens for 500 pages (cap; json 22,971 for 500) | compact: 4,430 tokens for 1,043 pages | −36.6% tokens for 2.1× the pages (14.0 → 4.2 tokens per page) | Option, not the default; short ids accepted by 4 tools only | `scripts/mcp-token-bench.ts`: one 2,000-page workspace (padded evaluation wiki + synthetic folders, every page indexed), sequential in-memory MCP calls, warm; Node 22.23.4, Postgres 16.13 (Docker, arm64), Apple M4 24 GB, other test runs on the same machine at the time; p50 lines 32.7–51.8 ms, compact 31.1–56.6 ms (3 runs × 20; no consistent difference) | [ADR 1541](adr/1541-compact-lists-and-short-page-ids.md) |
| list_pages, complete 2,000-page tree (0.12) | Same; root at depth 1 + one call per top-level folder (each under the 500-line cap) | lines 25,256 tokens (9 calls) | compact 10,821 tokens (9 calls) | −57.2% | Same as above | `scripts/mcp-token-bench.ts`: one 2,000-page workspace (padded evaluation wiki + synthetic folders, every page indexed), sequential in-memory MCP calls, warm; Node 22.23.4, Postgres 16.13 (Docker, arm64), Apple M4 24 GB, other test runs on the same machine at the time | [ADR 1541](adr/1541-compact-lists-and-short-page-ids.md) |
| list_pages, dated/numbered folders (0.12) | Same, one folder | Meeting notes (100 weekly): lines 1,564 (json 4,830); daily log (365): 4,577 (json 16,547); 실험 일지 (96, Korean): 1,484 (json 4,620) | 543; 970; 395 | −65.3% (−88.8% vs json); −78.8%; −73.4% | Same as above | `scripts/mcp-token-bench.ts`: one 2,000-page workspace (padded evaluation wiki + synthetic folders, every page indexed), sequential in-memory MCP calls, warm; Node 22.23.4, Postgres 16.13 (Docker, arm64), Apple M4 24 GB, other test runs on the same machine at the time | [ADR 1541](adr/1541-compact-lists-and-short-page-ids.md) |
| search, compact (0.12) | `format: "compact"` (8-character ids) | lines 324 tokens | 247 | −23.8% | Same as above | `scripts/mcp-token-bench.ts`: one 2,000-page workspace (padded evaluation wiki + synthetic folders, every page indexed), sequential in-memory MCP calls, warm; Node 22.23.4, Postgres 16.13 (Docker, arm64), Apple M4 24 GB, other test runs on the same machine at the time; query "sync" in the bench workspace | [ADR 1541](adr/1541-compact-lists-and-short-page-ids.md) |
| patch_sections vs 3 × patch_section (0.12) | Several section edits in one call under one write gate, all or nothing | 3 calls, 40 output tokens, wall p50 76–155 ms (p95 113–245) | 1 call, 26 tokens, p50 34–66 ms (p95 37–97) | 3 → 1 round trips, −35% output tokens, 2.2–2.3× (p50) | The batch runs twice on the server (copy, then live) | `scripts/mcp-token-bench.ts`: one 2,000-page workspace (padded evaluation wiki + synthetic folders, every page indexed), sequential in-memory MCP calls, warm; Node 22.23.4, Postgres 16.13 (Docker, arm64), Apple M4 24 GB, other test runs on the same machine at the time; 3 appends to the padded "Deploy runbook", 10 runs per bench run, 3 runs | [ADR 1542](adr/1542-patch-sections-all-or-nothing.md) |
| find_context ranking accuracy (0.14) | Korean partial match at query time (compound splits, one-syllable nouns with particles as whole words, more endings), aliases as title, heading weight 0.2 → 0.3 | Large set: dev MRR 0.874, recall@5 0.910, nDCG@5 0.881; test MRR 0.920, recall@5 0.927, nDCG@5 0.908 | dev 0.901 / 0.937 / 0.909; test 0.940 / 0.947 / 0.931 | dev +3.1% / +3.0% / +3.2%, test +2.2% / +2.2% / +2.5% (table below) | p50 +4–6 ms (see Regressions) | `apps/server/scripts/context-bench.ts --pages 5000`: evaluation wiki padded to 1–2k tokens per page + contest pages + Korean partial-match pages + 5,000 distractors (15,732 chunks), local Postgres 16.13 (Docker, aarch64), Apple Silicon laptop; 0.13 = HEAD a2f5d41 ranking code (`git archive`) with the new evaluation files, 0.14 = the same tree with only rank.ts and retrieve.ts replaced; each run on a freshly created and migrated database; one `--final` run each, weights tuned on dev only | [ADR 1702](adr/1702-evaluation-korean-partial-match-questions.md) |
| find_context output, budget 1,500 (0.14) | Same | 250.6 tokens per question | 233.1 | −7.0% | — | Same runs as the row above, mean over the 62 questions | [ADR 1702](adr/1702-evaluation-korean-partial-match-questions.md) |
| find_context, several phrasings (default budget 3,500) | `queries=[…]`: per-query retrieval (cached), RRF merge (k = 60), one budget, each section once, header/footer once | 18 calls, 15,172 tokens returned, 10/10 answer sections shown | 5 calls, 11,487 tokens, 10/10 | −13 round trips (3.6× fewer calls), −24% tokens, no answer lost | A bundle runs up to 5 retrievals in parallel; RRF favours sections every phrasing finds (KNOWN-ISSUES MQ-1) | 5 bundles of 3–5 phrasings (English/Korean synonyms and translations, `mcpTools/multiQueryCorpus.ts`), 10 topic pages + 60 filler pages (one word in five a query word). Before = each phrasing as its own `find_context` call (sum of tool-text `estimateTokens`); after = one call with `queries`. Postgres 16 in Docker on a laptop; `multi-query-bench.ts 0.2 3500` | [ADR 1720](adr/1720-find-context-several-queries-merged-by-rrf.md) |
| find_context, several phrasings (budget 1,200) | Same | 18 calls, 10,299 tokens, 10/10 | 5 calls, 6,369 tokens, 10/10 | −38% tokens, 3.6× fewer calls | Same | Same, `multi-query-bench.ts 0.2 1200` | [ADR 1720](adr/1720-find-context-several-queries-merged-by-rrf.md) |
| find_context, several phrasings, worst-case corpus | Same | 18 calls, 31,701–31,706 tokens, 10/10 | 5 calls, 17,534–17,638 tokens, 9–10/10 | −44% tokens; one answer section (restore bundle) sometimes only a pointer | Consensus effect of RRF | Filler made only of query words: `multi-query-bench.ts 1 3500`, two runs | [ADR 1720](adr/1720-find-context-several-queries-merged-by-rrf.md) |
| find_context bundle latency | Per-query cache entries reused by bundles (one marker statement per bundle) | Bundle with nothing cached: mean 12–18 ms | Per-query entries warm (asked alone before): mean 6–8 ms | ~2× faster when phrasings repeat | Bundle entries share the same 32 MB LRU | Mean over the 5 bundles, three runs of `multi-query-bench.ts` | [ADR 1721](adr/1721-several-queries-share-the-find-context-cache.md) |
| Semantic candidates (new, 0.14, optional) | Brute-force cosine over `Float32Array` vectors from a per-workspace in-process cache (`real[]` column, no pgvector) | None (new) | Warm median 10.7 ms, p95 11.8 ms; first query after a change (cache load + query embedding) 182 ms | None claimed (new) | Cache up to `EMBEDDING_CACHE_MB` (128 MB); grows linearly with chunks | Fake local endpoint (ADR 1745, no model time), 1,000 sections = 2,667 chunks × 768 dims, one workspace, Postgres 16 (compose database, OrbStack on the Mac), 40 queries, limit 20 | [ADR 1741](adr/1741-vectors-in-real-arrays-brute-force-cosine.md) |
| Semantic candidates, SQL fallback (`EMBEDDING_CACHE_MB=0` or a workspace that does not fit) | Same scoring in SQL | None (new) | Median 148 ms, p95 169 ms | None claimed | ~14× the cached path | Same data, 20 queries | [ADR 1741](adr/1741-vectors-in-real-arrays-brute-force-cosine.md) |
| Semantic indexer (new, 0.14, optional) | Content-addressed chunk vectors: only chunks whose text hash has no vector are sent, 32 per request | None (new) | 25.6 ms overhead per request (scan, write, cache bump); 2,667 chunks in 84 requests, 2.15 s at an unlimited rate; idle pending scan 51 ms | None claimed (new) | The pending scan reads every live chunk (md5 of its text): ~2 s at 100k chunks, once per ~8 requests during a backfill and once per 5 min idle | Fake local endpoint (ADR 1745, no model time), 1,000 sections = 2,667 chunks × 768 dims, one workspace, Postgres 16 (compose database, OrbStack on the Mac); rate limit off | [ADR 1742](adr/1742-background-indexer-content-addressed-chunks.md) |
| Semantic search off (default) | Nothing loaded or started unless `EMBEDDING_URL` and `EMBEDDING_MODEL` are set | — | 0 queries, 0 requests, no timer; find_context byte-identical (100 answers compared with and without the wiring) | No cost when off | — | `semantic.test.ts`, `semantic.db.test.ts` counters; 25 queries × 3 variants through MCP + REST on one seeded database, four code trees compared | [ADR 1745](adr/1745-testing-semantic-search-with-a-fake-endpoint.md), [1723](adr/1723-semantic-candidates-wired-into-find-context.md) |
| query_rows filter and sort on a formula (new, 0.15) | Formula conditions and sort keys decided in memory: the visible rows are read once, evaluated with the shared formula engine, and handed to SQL as a jsonb id set (filter) and a dense rank map (sort) | None (not possible) | 16.2 ms at 2,000 rows; 96.1 ms at 20,000 rows | None claimed (new) | 2.1–2.7× the same query on a stored number (7.6 / 35.2 ms); reads every visible row of the collection once per call; 100k rows not measured | Median of 7 `GET …/collection/query?filter=Total > 500&sort=Total desc&limit=25`, `app.inject` in process, Postgres 16 in Docker on the same Mac (M-series), formula `round(prop("Price") * prop("Qty") * 1.1, 2)`. `GET /collection` with that formula: 16.4 / 113.7 ms (mean of 5, no baseline taken) | [ADR 1826](adr/1826-formulas-in-query-rows.md) |
| query_rows formula sort, cursor pages (new, 0.15) | Same; the cursor predicate repeats the rank map as a bind parameter once per key part | None (new) | 20,000 rows, 12 runs each: first page 89–121 ms (no drift after 5 runs, so no generic-plan effect); cursor page 161–172 ms | None claimed | A cursor page costs 1.3–1.9× the first page | Same setup as the row above | [ADR 1826](adr/1826-formulas-in-query-rows.md) |
| MCP tool list, hand-off and team parameters (0.15) | `handoffTo` on add_comment / reply_comment, `team` on catch_up, hand-off text in the inbox description | add_comment 262, reply_comment 173, inbox 371, catch_up 399 tokens | 314, 224, 390, 426 | None (a cost) | +149 tokens per session, 0.9% of a 16.5k-token tool list | `estimateTokens(JSON.stringify(tool))` over `listTools()` of `buildMcpServer`; "before" with the new parameter and description text removed | [ADR 1863](adr/1863-hand-offs-go-to-one-connection.md), [1865](adr/1865-team-summary-in-catch-up.md) |
| inbox line for a hand-off (0.15) | `→ this connection` on items handed to this connection, header count | 115 tokens (one item) | 127 | None (a cost) | +12 tokens on hand-off items; other items byte-identical | `teamAgents.test.ts`, `TOKENS=1` | [ADR 1863](adr/1863-hand-offs-go-to-one-connection.md) |
| catch_up team=true (0.15) | One extra "Team agents" group: others' claims and one line per busy agent | 398 tokens (DB test fixture) | 511 | None (a cost, opt-in) | +113 tokens (+113…117 across runs); the team group for 1 person, 2 claims and 1 busy agent is 103 tokens; `team=false` unchanged | `teamAgents.db.test.ts` log line, `teamAgents.test.ts` | [ADR 1865](adr/1865-team-summary-in-catch-up.md) |
| Status line after row assignment / query_rows (0.15) | One last `status: Name "…" until …` line for assigned people (update_row, create_row) or shown person cells (query_rows) who have a status | — | +11 tokens per line with one person; +0 when nobody involved has a status | None (a cost) | REST `GET …/collection/query` adds `people` (~40 bytes per listed id) only when a person column is shown | `estimateTokens`, `rowStatus.db.test.ts` with `TOKENS=1` | [ADR 1846](adr/1846-member-status-in-presence-mentions-and-agent-output.md), [1870](adr/1870-public-form-answers-are-people-not-agents.md) |
| find_context ranking accuracy (0.15.1) | Title-only / link-only sections do not take a page's slot, URL words ignored, large chunks cut around their best lines (small-chunk weight 80), English inflection and Korean double particles, RRF k 10 | Large set, own budgets: dev MRR 0.841, recall@5 0.881, nDCG@5 0.850, answer in body 0.889; test 0.879 / 0.899 / 0.876 / 0.909 | dev 0.896 / 0.948 / 0.909 / 0.956; test 0.909 / 0.960 / 0.914 / 0.970 | dev +6.5% MRR, +7.6% recall@5; test +3.4% / +6.8%; answer in body +0.067 / +0.061 | Latency p50 about +5.5 ms, +14% (see Regressions); one test bundle question rank 1 → 2 | `apps/server/scripts/context-bench.ts --pages 5000 --final`: 78 questions (16 new, `FIELD_QUESTIONS`), padded wiki + contest + partial-match + field pages + 5,000 distractors (15,806 chunks), Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with two other agents' test runs; 0.15 = `git archive` of 771e6cc with only the new evaluation files and bench script copied in; same scratch database (0047 applied before the 0.15.1 run); one `--final` run each; tuning on dev only (`context-tune.ts`) | [ADR 1900](adr/1900-thin-and-title-only-sections-do-not-take-the-page-slot.md)–[1905](adr/1905-query-forms-and-rrf-k.md), [1909](adr/1909-evaluation-field-cases-of-0151.md) |
| find_context tokens per question (0.15.1) | Same ranking changes + 8-character ids, `can:` once, verification marks in one line | Own budgets: dev 361.6, test 399.1 tokens (whole tool output); all at budget 1,000: 252.6 / 250.7; old-flow table "after": 379 mean; budget 1,500 with the floor: 249.1 | 317.6 / 290.2; 213.5 / 220.5; 302; 210.5 | −12.2% / −27.3%; −15.5% / −12.0%; −20.3%; −15.5% | — | Same runs | [ADR 1902](adr/1902-large-chunks-are-cut-around-their-best-lines.md), [1906](adr/1906-find-context-short-page-ids-and-shared-can.md), [1907](adr/1907-find-context-verification-marks-at-the-end.md) |
| find_context output format alone (0.15.1) | 8-character page ids, `can:` once (2+ results), verification line (ranking switched to 0.15 behaviour) | 74 single-query questions: header lines 87.5, whole output 376.3 tokens per question (default budget); 74.2 / 270.1 at 1,500 | 65.0 / 360.4; 56.5 / 257.9 | header lines −25.7% / −23.9%, output −4.2% / −4.5% | Part of the saving goes into more text (smaller header estimate); 4 of 74 answers carry the other-language hint with the 0.15 ranking (0 with 0.15.1's) | MCP in-process on the bench workspace (padded + 5,000 distractors), 0.15 tree vs this tree with every ranking knob of ADR 1900–1905 off and minWeight 60; `estimateTokens` | [ADR 1906](adr/1906-find-context-short-page-ids-and-shared-can.md), [1907](adr/1907-find-context-verification-marks-at-the-end.md) |
| find_context budget filled (0.15.1) | Same | Budget 1,500, floor off (budget filled), per question: section text 700.9, other 407.4 tokens, 8.1 fragments | 834.1 / 369.4, 8.9 fragments | +19.0% text, −9.3% other | — | context-bench "location format (floor off)" line, same runs | [ADR 1902](adr/1902-large-chunks-are-cut-around-their-best-lines.md), [1906](adr/1906-find-context-short-page-ids-and-shared-can.md) |
| RRF k (0.15.1) | k 60 → 10 in the queries=[…] merge | Worst-case filler (100% query words): MRR of the first gold 0.850 (3,500) / 0.900 (1,200), nDCG@5 0.759 / 0.800 | 1.000 / 1.000, 0.845 / 0.845 | +0.15 / +0.10 MRR | Normal filler (20%): identical for k 5–60 | 5 bundles of `mcpTools/multiQueryCorpus.ts`, findContext + fuseContextResults per k, gold = answer sections in a header | [ADR 1905](adr/1905-query-forms-and-rrf-k.md) |
| MCP tools/list, whole (0.15.1) | Id fields as refined strings (no pattern), SDK `execution`/`$schema` defaults dropped, structure/chart specs listed once, repeated enum descriptions cut | 65,971 chars, ~16,504 tok (45 tools; descriptions ~4,264, schemas ~10,583) | 47,646 chars, ~11,923 tok (descriptions ~4,251, schemas ~6,469) | −27.8% tokens (−4,581; this change alone ≈ −4,700, the tree also had ≈ +121 from inbox/ack/find_context work) | New arguments +77 tok (backlinks, kind, baseVersion) and +60 tok of their descriptions included | `cd apps/server && npx tsx scripts/mcp-tools-list-cost.ts --by-tool` (MCP server for a read-write connection with an inert context, no database; tools listed through an in-memory client; `JSON.stringify` of the listed tools, `estimateTokens`; deterministic for a build). Before = 771e6cc (0.15.0) | [ADR 1940](adr/1940-id-arguments-without-patterns-in-the-tool-list.md), [1945](adr/1945-tool-list-without-sdk-defaults-and-one-copy-of-each-spec.md) |
| — of which: id patterns (0.15.1) | `z.uuid()` → string + refinement | 51 patterns, 9,927 chars | 0 | ~−2,458 tok | Validation moved to a zod refinement (same place, better message) | same | [ADR 1940](adr/1940-id-arguments-without-patterns-in-the-tool-list.md) |
| — of which: SDK defaults (0.15.1) | tools/list wrapper drops `execution:{taskSupport:"forbidden"}` and `$schema` | 1,755 + 2,244 chars | 0 | −439 / −561 tok | Depends on the SDK's internal handler map (exact pin 1.32.2; a test fails if it stops applying) | same | [ADR 1945](adr/1945-tool-list-without-sdk-defaults-and-one-copy-of-each-spec.md) |
| — of which: structure/chart tools (0.15.1) | update_fields `add`, `change.options`, create_view `chart` listed loosely and parsed in the handler with the same schemas | update_fields 1,215, create_view 1,100, create_chart 1,006, create_collection 928 tok (4,249) | 561, 485, 818, 718 (2,582) | −39% for the four (−1,667 tok, incl. their id patterns) | Shape of `add`/`chart` described in words, checked after the SDK's validation | same | [ADR 1945](adr/1945-tool-list-without-sdk-defaults-and-one-copy-of-each-spec.md) |
| MCP fixed cost per session, final (0.15.1) | The tool list above + one server-instruction sentence ("If the notes may be in another language than the question, pass queries=[question, translation].") | tools/list ~16,504 tok + instructions 1,732 chars ~434 tok = ~16,938 tok (0.15.0) | tools/list ~11,923 tok + instructions 1,865 chars ~467 tok = ~12,390 tok | −26.9% | Instructions +33 tok: +9 for the update_page / get_instructions wording, +24 for the other-language sentence | `scripts/mcp-tools-list-cost.ts --json` on the integrated tree | [ADR 1904](adr/1904-other-language-notes-guidance-and-weak-result-hint.md), [1940](adr/1940-id-arguments-without-patterns-in-the-tool-list.md), [1945](adr/1945-tool-list-without-sdk-defaults-and-one-copy-of-each-spec.md) |
| read_page outline (0.15.1) | Full anchor only (no repeated heading path), indent per level, 8-character page id; outline version | 20,474 tok (74 pages, 748 sections) | 13,435 | −34.4% | — | `DATABASE_URL=… npx tsx scripts/mcp-output-cost.ts`: 74 padded evaluation pages (`ALL_EVAL_PAGES` + `padPages`, 748 sections) created through create_page in a scratch database; 0.15.0 outline and header rebuilt from the same route answers in the old format; Node 22.23.4, Postgres 16 (Docker), Apple silicon, other agents' test runs at the same time | [ADR 1942](adr/1942-ids-once-and-outline-without-repeated-headings.md) |
| read_page outline, repeat (0.15.1) | `known=<outline v>` → one line | 20,474 tok | 1,332 | −93.5% | The outline is still read on the server | same | [ADR 1942](adr/1942-ids-once-and-outline-without-repeated-headings.md) |
| read_page full, header + wrapper (0.15.1) | Ids once: 8-character `id`/`workspaceId`/`parentId`/wrapper id, full only in the url | 9,745 tok (74 pages), 370 full UUIDs | 8,191, 148 full UUIDs | −15.9% | — | same | [ADR 1942](adr/1942-ids-once-and-outline-without-repeated-headings.md) |
| list_pages / search without `format` (0.15.1) | Default `json` → `compact` | list_pages 2,811 tok; search "deploy" 70 | 523; 57 | −81.4%; −18.6% | JSON parsers must pass `format: 'json'` | same | [ADR 1944](adr/1944-compact-is-the-default-list-format.md) |
| update_page replace with baseVersion (0.15.1) | Version check before the write (one agent-notation export) | — | one extra export per replace with baseVersion (same work as a read_page) | None (a cost, for safety) | Not timed; a replace without baseVersion adds one agent-context query | — | [ADR 1947](adr/1947-update-page-replace-names-the-version-it-read.md) |
| Section write resolution (0.15.1) | Outline read + renamed-anchor and indexed-anchor queries before each section write by name | — | two small indexed queries and an outbox existence check per write; change-log events read only when a rename carries the name | None (a cost, for safety) | Not timed | — | [ADR 1960](adr/1960-a-section-name-another-section-answered-to-needs-the-version.md) |
| MCP tools/list, core profile (0.16) | `?profile=core` lists 31 everyday tools + `more_tools`; the other 16 are listed by `more_tools()` and run through the same tools/call handler | 45 tools, 47,646 chars, ~11,923 tok (0.15.1, one list for everyone) | core: 32 tools, 29,710 chars, ~7,437 tok (descriptions ~2,938, schemas ~3,675); full: 47 tools, 49,433 chars, ~12,370 tok (descriptions ~4,383, schemas ~6,736) | core −37.6% (−4,486 tok); full +3.7% (+447 tok) | A hidden tool costs one `more_tools(tool)` call (~150–850 tok, the tool's own spec) before its first use, or the full profile; `more_tools` itself is 155 tok of the core list | `cd apps/server && npx tsx scripts/mcp-tools-list-cost.ts --profile core|full --by-tool`: MCP server for a read-write connection with an inert context, no database, tools listed through an in-memory client, `JSON.stringify` of every listed tool, `estimateTokens` (context/tokens.ts); deterministic for a build. Before = 0.15.1 (9c1eb16), after = the integrated 0.16 tree, 2026-11-10 | [ADR 2000](adr/2000-tool-profiles-core-and-full-in-the-mcp-url.md) |
| — of which: new and changed tools (0.16) | upload_file (new), check_notes (new), read_file description and `pages` argument | read_file 156 tok | upload_file 207 tok (828 chars), check_notes 201 (804), read_file 194 (774) | None (a cost) | full only for upload_file and check_notes (hidden in core); read_file +38 in both profiles | same, `--by-tool` | [ADR 2003](adr/2003-check-notes-memory-check.md), [2044](adr/2044-upload-file-for-agents.md), [2047](adr/2047-pdf-text-with-unpdf.md) |
| MCP fixed cost per session, final (0.16) | tools/list of the profile + server instructions (unchanged) | ~11,923 + ~467 = ~12,390 tok (0.15.1) | full ~12,370 + ~467 = ~12,837 tok; core ~7,437 + ~467 = ~7,904 tok | core −36.2%; full +3.6% | `AGENT_UPLOAD_MAX_MB` other than 5 changes two numbers in the upload_file entry (a few bytes; still the same bytes for every connection of that server and profile) | same, `--json` | [ADR 2000](adr/2000-tool-profiles-core-and-full-in-the-mcp-url.md), [2065](adr/2065-agent-uploads-switch-and-limits.md) |
| MCP fixed surface: resources and prompts (0.16) | Capabilities `resources` and `prompts`, one resource template, three prompts | initialize result 2,013 chars, ~504 tok | 2,077 chars, ~520 tok; templates/list 225 chars ~57 tok; prompts/list 691 chars ~173 tok; resources/list at the cap (50) 8,165 chars ~2,097 tok, 3.2 ms in-process | +16 tok model-visible (initialize); the lists are client menus | resources/list is one query pair per call (favorites, recent) | initialize: `mcp-tools-list-cost.ts --surface`; before = the same build with registerResource/registerPrompt stubbed out. resources/list: scratch run on the [db] test database, 60 pages (mixed English/Korean titles) in one workspace, in-memory transport, 20 calls | [ADR 2001](adr/2001-pages-as-mcp-resources.md), [2002](adr/2002-fixed-mcp-prompts-with-id-arguments.md) |
| check_notes (0.16) | New: one route reads the visible page set, literal `[[…]]` from page_texts (LIKE prefilter), page_links of the workspace, verified pages, page_chunks token sums ≥ 3,000; rendering fits a token budget | None (dozens of list/read calls, no link or verification data) | 2,000 pages: p50 18.0 ms, p95 26.8 ms; default answer 552 tok | None claimed (new tool) | Fixed cost +201 tok in full, 0 in core; all visible pages of the workspace loaded per call (id, title, parent, kind, updated) | Scratch script on the [db] test database: 2,000 pages in one workspace, 500 with two literal links, 3,000 page_links, 300 duplicate pairs; in-process test app (`app.inject`), MCP over the in-memory transport, 5 warm-up + 20 calls; Postgres 16 in Docker on localhost, Node 22, Apple-silicon MacBook Air shared with other agents' runs | [ADR 2003](adr/2003-check-notes-memory-check.md) |
| read_file PDF text (0.16) | unpdf 1.9.1 in a worker thread per call (256 MB heap, 10 s, two at once) | metadata only (no text) | 3 pages / 14 KB: median 73 ms; 50 pages / 231 KB (pages 1–50, maxChars 100k, stops at page 35): 122 ms; 200 pages / 929 KB: 129 ms; main-thread longest timer gap 2.6 ms | None claimed (new capability) | ~45 ms of the call is worker start-up; +2.5 MB in the image | Generated PDFs, 50 lines per page, 5 runs, Node 22.23 on Apple silicon, while the db suite ran in parallel | [ADR 2047](adr/2047-pdf-text-with-unpdf.md), [2048](adr/2048-pdf-limits-in-a-worker-thread.md) |
| Suggest-only check (0.16) | `demotionFor` per write request of a bearer connection, memoised per request | — | 0 statements for browser requests; 1 indexed statement per bearer write request and workspace; 1 statement per flagged read (pages without flags: 1 aggregate on page_chunks) | None (a cost, for safety) | Not timed | Code reading; `agentTaint.db.test.ts` | [ADR 2040](adr/2040-suggest-only-after-flagged-content.md) |
| Agent upload budget (0.16) | Sum of the account's connection uploads in 24 hours over a partial index `files (created_by, created_at) WHERE uploaded_via IS NOT NULL` | Sum over every file of the account (0.16 development builds) | Only rows uploaded through connections; browser uploads are not in the index | None (a cost, per agent upload) | Not timed | Code reading | [ADR 2065](adr/2065-agent-uploads-switch-and-limits.md) |
| MCP tools/list per profile (0.17) | import_zip (new, hidden group `files`), database parameters (new field types, `prefix`, `subItems`, `under` / `depth`, `parent`), `list_versions(all)`, `search(limit)`, workspace names in `workspaceId` descriptions | 0.16 (bd30a54): full 47 tools, 49,433 chars, ~12,370 tok; core 32 tools, 29,710 chars, ~7,437 tok; instructions 1,865 chars, ~467 tok | full 48 tools, 51,059 chars, ~12,777 tok (descriptions ~4,442, schemas ~7,063); core 32 tools, 30,093 chars, ~7,533 tok (descriptions ~2,929, schemas ~3,779); instructions 1,965 chars, ~492 tok | none (a cost row) | full +407 tok (+3.3%), core +96 tok (+1.3%), instructions +25 tok | `cd apps/server && npx tsx scripts/mcp-tools-list-cost.ts --profile full\|core --by-tool` on the 0.17 tree and on a `git archive bd30a54` copy of 0.16 with the same script; no database, exact for a build, 2026-11-10 | [ADR 2162](adr/2162-import-zip-for-agents-with-the-upload-rules.md), [2147](adr/2147-agent-task-board-template-and-mcp-parameters.md), [2182](adr/2182-list-versions-shows-steps-folded.md), [2186](adr/2186-workspace-arguments-take-a-name.md) |
| — of which: per tool (0.17) | Tool descriptions and schemas that changed | import_zip —, create_collection 718, query_rows 440, list_versions 111, create_row 303, update_fields 561, search 181, find_context 282, get_instructions 180, create_view 485, restore_version 157 tok | import_zip 181, create_collection 794, query_rows 496, list_versions 147, create_row 332, update_fields 580, search 185, find_context 285, get_instructions 183, create_view 486, restore_version 154 tok | — | +181, +76, +56, +36, +29, +19, +4, +3, +3, +1, −3 tok (rounded per tool, so the sum differs by 1–3). In core: query_rows, create_row, search, find_context, get_instructions; import_zip is hidden from core | Same script, `--by-tool` | Same |
| MCP fixed cost per session, final (0.17) | tools/list of the profile + server instructions | full ~12,370 + ~467 = ~12,837 tok; core ~7,437 + ~467 = ~7,904 tok (0.16) | full ~12,777 + ~492 = ~13,269 tok; core ~7,533 + ~492 = ~8,025 tok | — | full +432 tok (+3.4%), core +121 tok (+1.5%) | Same script | [ADR 2000](adr/2000-tool-profiles-core-and-full-in-the-mcp-url.md) |
| MCP tools/list, annotations on every tool (0.20) | Annotation hints on all 48 tools and more_tools from one table (`mcpTools/annotations.ts`); tools/list leaves out hints equal to the MCP defaults except `destructiveHint` and `openWorldHint` on write tools | full 48 tools, 51,059 chars, ~12,777 tok; core 32 tools, 30,093 chars, ~7,533 tok | full 52,932 chars, ~13,245 tok; core 31,391 chars, ~7,857 tok (descriptions and schemas unchanged) | none (a cost row): full +468 tok (+3.7%), core +324 tok (+4.3%) | Measured and rejected: all four hints on every tool, full 54,897 chars / ~13,737 tok (+960, +7.5%), core 32,657 / ~8,174 (+641, +8.5%) (ADR 2460) | `cd apps/server && npx tsx scripts/mcp-tools-list-cost.ts --profile full\|core` on 2413d43 (before) and 34a794d (after); no database, exact for a build, 2026-11-11 | [ADR 2460](adr/2460-mcp-tool-annotations-on-every-tool.md) |
| MCP search, several workspaces (0.17) | One statement over all searched workspaces (`GET /api/search`: candidates from the trigram probes, grades title/heading/body × whole word/part, per-workspace counts, top 10) instead of `GET /api/workspaces` + one `GET /api/workspaces/:id/search` per workspace in sequence | p50 / p95 ms, 5 workspaces: "ai" 79.29 / 83.39, "deploy" 102.40 / 108.35, "zanzibar" 35.49 / 44.96; 10 workspaces: 106.20 / 113.38, 182.69 / 189.85, 29.82 / 42.44 | 5 workspaces: 72.58 / 74.95, 24.23 / 26.38, 6.56 / 10.13; 10 workspaces: 73.42 / 75.64, 22.49 / 24.43, 3.11 / 5.29 | 5 ws: 1.1×, 4.2×, 5.4× p50; 10 ws: 1.4×, 8.1×, 9.6× p50 | Shows 10 results instead of 20 per workspace (counts for the rest) | `apps/server/scripts/search-bench.ts`: in-process test app (`buildTestApp`), `app.inject` with an OAuth bearer token and the MCP internal header (the MCP tools' path); per workspace count a fresh user with W workspaces holding 5,000 pages in all (≈ 1.8 KB `page_texts` each, 3 `page_chunks` rows, "deploy" in every 5th body, every 20th heading path and every 100th title, "zanzibar" in 3 bodies; "ai" is inside "said"/"maintain" in every body), the previous count's pages deleted, `ANALYZE`; 20 warm-up calls, then N = 100 rounds with before/after interleaved and alternating order; fresh scratch database (Postgres 16.13 in Docker on localhost, `random_page_cost = 1.1` via `withSsdPlanCosts`), Node 22.23.4, Apple-silicon MacBook shared with other agents' tests (load average 3–10 during the run) | [ADR 2183](adr/2183-search-ranking-and-one-agent-search-route.md) |
| MCP search, one workspace (0.17) | Same | "ai" 50.59 / 53.36, "deploy" 19.81 / 23.20, "zanzibar" 4.27 / 6.59 | 72.18 / 74.88, 20.25 / 21.43, 2.81 / 4.09 (compiled pattern cached) | "zanzibar" 1.5× warm, ≈ 1.25× for a new term; "deploy" none (1.0×); "ai" see Regressions | A term not compiled before on that connection: +0.5–0.6 ms p50 (written-out word class, case-insensitive compile) | Same; the cold cost from a second script on the 10-workspace seed that alternates the same word with rotating case variants (> 32 distinct patterns, so Postgres's per-backend regex cache misses), 100 + 100 calls: "zanzibar" 3.08 → 3.69 ms (10 workspaces), 3.02 → 3.52 ms (one 500-page workspace), "deploy" 21.27 → 21.77 ms | [ADR 2183](adr/2183-search-ranking-and-one-agent-search-route.md) |
| search evaluation, old-flow baseline of evalRun (0.17) | Ranked search with a cap of 10 feeding evalRun's "before" flow (search json → read top 3) | mean tokens 3,131 (median 2,058), calls 3.77, success 0.756, page@1 0.615 | 2,841 (median 2,104), 3.67, 0.795, 0.667 | −9% tokens, +0.038 success | — | 78 questions, `context.db.test.ts` ("[eval] before"), and an A/B script that runs the same flow with the 0.16 search emulated (list + per-workspace web search) on the same code and data: identical numbers on both sides | [ADR 2184](adr/2184-search-output-grouped-by-workspace-with-a-more-line.md) |
| find_context, several workspaces (0.17) | Workspace labels when an answer spans workspaces | no workspace shown; one-workspace eval dev MRR 0.93 / R@5 0.993, test 0.924 / 0.99 | the same numbers and bytes for one workspace; labels + one closing line otherwise | Not a ranking change | ~4–8 tokens per labelled line + ~40 for the closing line, only on multi-workspace answers; a primary-key lookup of ≤ ~20 printed page ids on most calls without workspaceId (any pointer to a page not shown triggers it; not timed) | context.db.test.ts `[rank]` lines on this tree vs the HEAD bd30a54 numbers; rule-on owner rows asserted identical at the time of measurement (the switch was removed afterwards, ADR 2188) | [ADR 2185](adr/2185-find-context-names-workspaces-when-an-answer-spans-several.md) |
| Version history with AI steps, 30 agent writes (0.17) | One version per agent write (step rows as small Yjs diffs, content digest, step caps 20/client and 30/page, squash on prune) | 12 KB note: 1 row, 12.3 KB raw / 4.5 KB on disk. 4.1 MB log: 1 row, 4.13 MB raw / 1.07 MB on disk | 12 KB note: 21 rows (4 whole), 71.9 KB raw / 34.3 KB on disk, median step 691 B. 4.1 MB log: 21 rows (4 whole), 12.47 MB raw / 2.37 MB on disk, median step 698 B | Accepted: every step restorable; bounded by the caps (≤ the 50-version budget of ADR 1100: 9.3 MB raw / 2.2 MB on disk for a 4.5 MB page) | A whole row every 10th row of a chain (ADR 1100 rule): on a 4 MB page about 4 MB raw (1 MB on disk) written and later pruned per 10 agent writes | `apps/server/scripts/ai-step-bench.ts --writes 30`: in-process test app, MCP over the in-memory transport as an agent connection; pages made by the script (12-section note; the synthetic 4.1 MB log of large-page-bench.ts); 30 sequential writes with nothing in between, alternating `patch_section` replace of a middle section and `update_page` append; rows counted with `octet_length` / `pg_column_size`; 0.16 = `git archive` of v0.16.0 with the same script; Postgres 16 in Docker, Node 22.23.4, Apple-silicon laptop shared with four other agents' test runs | [ADR 2180](adr/2180-one-version-per-agent-write.md) |
| Agent write latency with AI steps (0.17) | Digest before and after each agent write, a step row (diff) after it | 12 KB note: `patch_section` replace p50 33.3 ms (quiet run; a disturbed run 290.7), `update_page` append 27.8 ms. 4.1 MB log: replace 843.8–1,270.8 ms, append 508.8–672.3 ms | 12 KB note: 40.5–41.9 ms, 33.0–34.9 ms. 4.1 MB log: 1,025.2–1,463.9 ms, 576.6–1,046.1 ms | +6–9 ms per write on small pages; within the spread on the 4 MB page | Two short transactions and two digests per agent write (4.66 MB document at load 2.5: digest 0.2 ms from a live document, 11.5 ms from a stored state; step diff 0.2 / 5.5 ms) | Same script and runs as above: p50 over 15 writes of each kind, two interleaved pairs (after, before, after, before), load average 20–100 during the runs; CPU parts measured in-process with `yjs` alone on a 4.66 MB document, median of 9 | [ADR 2180](adr/2180-one-version-per-agent-write.md) |
| Prune at the AI step cap (0.17) | Squash: a kept row absorbs the diffs of the dropped rows between it and its nearest kept ancestor (`mergeUpdatesV2`, checked with `diffMatches`) instead of being rebuilt and stored whole | Rebuild + whole encode of the kept row: 34.9 ms on a 4.66 MB document at load 2.5 (197 ms at load ≈ 40), plus a new whole row | Merge of two step diffs 0.2–0.3 ms; the successor stays a diff | One whole-document rebuild less per agent write at the cap | A merged diff keeps content later steps deleted until the row is rebuilt | `apps/server/src/mcpTools/aiSteps.db.test.ts` (25 appends past the cap: ≥ 5 squashes, every version reads; 28 replace/insert/delete writes past the cap: the 20 surviving steps' Markdown byte-identical to before pruning, the oldest restores exactly); CPU from the in-process `yjs` measurement above | [ADR 2180](adr/2180-one-version-per-agent-write.md) |
| Archived workspaces out of the default scope (0.18) | The default scope of find_context, search and catch_up without `workspaceId` leaves the caller's archived workspaces out: one more probe of `workspace_listings` in the scope statement (`contextCache.ts` searchScope) | 50 workspaces, 5,000 pages (~1.8 KB, three sections, "deploy" in every 5th), query "deploy", 0 of 50 archived: find_context uncached 55.45 / 80.80 ms (p50 / p95), cached 8.97 / 13.74, search 59.38 / 73.02 (1,000 matches). Scope statement alone, 0.17 SQL: 0 archived 3.86 / 6.84 ms, 40 archived 4.15 / 7.27 | 40 of 50 archived: find_context uncached 32.65 / 44.33 ms, cached 8.66 / 14.41, search 43.11 / 60.30 (200 matches). Scope statement with the probe: 0 archived 4.19 / 6.72 ms, 40 archived 4.37 / 6.69. With 49 of 50 archived: uncached find_context 23 ms, search total 20 | With 40 archived: find_context uncached −41 %, search −27 %, cached within noise | The scope statement costs ~0.3 ms p50 more per default call (0 archived 3.86 → 4.19 ms); separate-process runs against the 0.17 tree show no regression beyond their noise | `apps/server/scripts/archive-bench.ts`, N = 100 after 15 warm-ups, without workspaceId, bearer token through app.inject; scope statement 0.17 vs with the probe interleaved in one process. Postgres 16 in Docker, M-series MacBook Air **shared with five other test runs** at the same time: separate processes vary by up to 2× between runs, so the in-process statement comparison is the regression figure | [ADR 2303](adr/2303-archived-workspaces-leave-the-default-scope.md) |
| find_context ranking accuracy, recall set (0.20) | Shorter form of a Korean compound in titles/headings (×0.7), rare-word rule (×0.75 without the word whose idf ≥ 1.1 × all others), title words in df | Recall set (32 q, 3 workspaces, asked without a workspace), own workspaces: dev page@1 0.813, page@3 0.875, page MRR 0.856; test 0.750 / 0.938 / 0.854. With the padded 5,000-page workspace: dev 0.750 / 0.813 / 0.794; test 0.750 / 0.938 / 0.844 | own: dev 0.938 / 1.000 / 0.958; test 0.750 / 0.938 / 0.854. + padded: dev 0.813 / 0.938 / 0.865; test 0.813 / 0.938 / 0.885 | dev page@3 +0.125 (both sets), page MRR +0.10 / +0.07; test page MRR +0.04 with the padded workspace, own-workspace test unchanged | One test question loses its second relevant section (recall@5 1.0 → 0.5), see Regressions | `apps/server/scripts/context-bench.ts --pages 5000 --final`, 15,806 chunks + recall workspaces; 0.19.0 = `git archive` 958a9b4 + the evaluation files and bench script; fresh migrated database per run; Postgres 16 in Docker on localhost, Node 22, Apple-silicon MacBook Air | [ADR 2400](adr/2400-recall-evaluation-set-and-page-metrics.md)–[2403](adr/2403-title-words-count-in-document-frequency.md) |
| find_context ranking accuracy, existing 78 questions (0.20) | Same | padded + 5,000: dev MRR 0.896, page@1 0.844; test MRR 0.909, recall@5 0.960. Unpadded: dev 0.930 / 0.889, test 0.924, recall@5 0.990 | padded: dev 0.907 / 0.867; test 0.909, recall@5 0.944. Unpadded: dev 0.941 / 0.911, test 0.939, recall@5 0.975 | dev MRR +0.011 (both); page@3 unchanged everywhere; tokens/question unpadded 211 → 167 (dev), 190 → 173 (test) | test recall@5 −0.016 / −0.015: one question (see Regressions) | Same runs | [ADR 2402](adr/2402-a-chunk-without-the-rare-query-word-keeps-three-quarters.md), [2403](adr/2403-title-words-count-in-document-frequency.md) |
| find_context, private check (0.20) | Same | 36 questions written from page titles as remembered, read-only local copy of a production database: page@1 0.917, page@3 0.917, MRR 0.928, 1,789 tokens | 0.944, 0.972, 0.964, 1,770 tokens; the field case rank 5 → 1 | +0.028 / +0.055 / +0.036 | — | Direct findContext over the owner's member workspaces, read-only connection, rules off/on interleaved 3×; numbers only, nothing copied | [ADR 2400](adr/2400-recall-evaluation-set-and-page-metrics.md) |
| find_context latency (0.20) | Same (title flags computed once in `matched`) | Rules off, same data, interleaved: 78 q on 15.8k chunks p50 36.2 ms, p95 102.2; 32 recall q over 4 workspaces p50 27.9, p95 141.5. Bench run 0.19.0: p50 38.4, p95 108.8 | 34.6 / 90.8; 26.8 / 137.7. Bench run: 35.2 / 92.7 | None (within noise, slightly faster) | — | an interleaving script outside the tree: 3 rounds × every question, off/on alternating, direct calls; bench rows from the two `--final` runs | [ADR 2403](adr/2403-title-words-count-in-document-frequency.md) |

### find_context ranking accuracy (ADR 1213)

Metrics over the sections one find_context call shows (default budget), binary relevance. precision@5 divides by
the number shown in the first five; P@5 by 5 (the textbook form). dev = tuning questions, test = held out.
Large = padded wiki + contest pages + 5,000 distractors (15,693 chunks); small = the 62 unpadded pages. Same
data, machine and script as the location row above; before = the code before ADR 1210.

| corpus | split | n | MRR before → after | recall@5 | nDCG@5 | precision@5 | P@5 (÷5) |
|---|---|---|---|---|---|---|---|
| large | dev | 29 | 0.848 → 0.897 | 0.897 → 0.920 | 0.858 → 0.900 | 0.648 → 0.806 | 0.193 → 0.200 |
| large | test | 18 | 0.806 → 0.944 | 0.861 → 0.926 | 0.819 → 0.931 | 0.702 → 0.926 | 0.200 → 0.211 |
| small | dev | 29 | 0.845 → 0.948 | 0.931 → 0.954 | 0.863 → 0.947 | 0.704 → 0.885 | 0.200 → 0.207 |
| small | test | 18 | 0.819 → 1.000 | 0.917 → 0.981 | 0.848 → 0.987 | 0.716 → 0.981 | 0.211 → 0.222 |

dev − test after the change is negative on every metric (test is higher), so no sign of over-fitting to dev; one
test question moves MRR by up to 0.056. Field query on the production copy (budget 1,500): answer sections at
ranks –/– (not shown) → –/5, sections of the most frequent page 3 → 1.

### find_context ranking accuracy, 0.14 (ADR 1702)

Same metrics as above, 62 questions (dev 37, test 25: the ADR 1213 questions plus 15 Korean partial-match questions
in four families). Large = padded wiki + contest + partial-match pages + 5,000 distractors (15,732 chunks); small =
the 66 unpadded pages. Before = 0.13 ranking code with the new questions, after = 0.14; one `--final` run each.

| corpus | split | n | MRR before → after | recall@5 | nDCG@5 | precision@5 |
|---|---|---|---|---|---|---|
| large | dev | 37 | 0.874 → 0.901 | 0.910 → 0.937 | 0.881 → 0.909 | 0.765 → 0.823 |
| large | test | 25 | 0.920 → 0.940 | 0.927 → 0.947 | 0.908 → 0.931 | 0.865 → 0.871 |
| small | dev | 37 | 0.914 → 0.941 | 0.937 → 0.991 | 0.918 → 0.954 | — |
| small | test | 25 | 0.960 → 0.980 | 0.987 → 0.987 | 0.959 → 0.971 | — |

Per family (large set; n is 1–3 per split, so one question moves MRR by 0.33–1.0):

| family | split | n | MRR before → after | recall@5 | nDCG@5 |
|---|---|---|---|---|---|
| ko-compound-query | dev | 2 | 0.25 → 0.75 | 0.5 → 1 | 0.315 → 0.847 |
| ko-compound-query | test | 2 | 0.75 → 1 | 1 → 1 | 0.847 → 1 |
| ko-particle | dev | 3 | 1 → 1 | 1 → 1 | 1 → 1 |
| ko-particle | test | 2 | 0.75 → 0.75 | 1 → 1 | 0.815 → 0.815 |
| ko-doc-compound | dev / test | 2 / 2 | 1 → 1 | 1 → 1 | 1 → 1 |
| alias | dev / test | 1 / 1 | 1 → 1 | 1 → 1 | 1 → 1 |

The gain is the compound-query family (and the heading weight on the small set); the other families already passed
on their other words and guard against regressions. Test ≥ dev on every metric before and after. pg_trgm was checked
and not used for the Korean forms: similarity('팀구성', '팀 구성') 0.29 (threshold 0.3), word_similarity 0.25, while an
unrelated pair, word_similarity('팀을', '팀 구성'), is 0.33 (ADR 1700).

### find_context with several queries, per bundle (ADR 1720)

Default budget, `multi-query-bench.ts 0.2 3500`. Gold = answer sections whose header line is in the text (pointers
do not count); "separate" counts a gold section when any of the N answers shows it.

| bundle | queries | separate: calls / tokens / gold | bundled: calls / tokens / gold | tokens saved |
|---|---:|---|---|---:|
| rollback | 3 | 3 / 3,862 / 2/2 | 1 / 3,507 / 2/2 | 9% |
| escalation | 3 | 3 / 1,796 / 2/2 | 1 / 1,671 / 2/2 | 7% |
| restore | 4 | 4 / 6,196 / 2/2 | 1 / 3,482 / 2/2 | 44% |
| two-factor | 5 | 5 / 1,851 / 2/2 | 1 / 1,490 / 2/2 | 20% |
| cache | 3 | 3 / 1,468 / 2/2 | 1 / 1,337 / 2/2 | 9% |
| total | 18 | 18 / 15,173 / 10 | 5 / 11,487 / 10 | 24% |

The savings depend on how much each phrasing finds alone. When one phrasing fills its budget and the others find
little (rollback, cache), the bundle is about one full answer (−7…9%); when several phrasings each fill a budget
(restore), it is −44%. The round trips always go from N to 1. Tokens = `estimateTokens` of the tool text the agent
receives (including `can:` lines, wrapper and footer). To repeat:

```
docker exec nodian-db-1 psql -U nodian -d nodian -c "create database inkling_bench"
cd apps/server
DATABASE_URL=postgres://nodian:nodian@localhost:55432/inkling_bench pnpm db:migrate
DATABASE_URL=postgres://nodian:nodian@localhost:55432/inkling_bench npx tsx scripts/multi-query-bench.ts 0.2 3500 1200
DATABASE_URL=postgres://nodian:nodian@localhost:55432/inkling_bench npx tsx scripts/multi-query-bench.ts 1 3500
```

The `[db]` test `src/mcpTools/multiQuery.db.test.ts` runs the same measurement (prints both tables) and asserts
bundle tokens < separate tokens, one call, and no answer section lost at the default budget.

Not measured yet: the per-call cost of the semantic merge in find_context with semantic search on (query vector
cached, scoring, one fragment statement; a bundle-key hit still pays it).

### find_context ranking accuracy, 0.15.1 (ADR 1909)

78 questions (dev 45, test 33: the 0.14 questions plus 16 fictional pages and questions of the same shape as two field
reports, ADR 1909). Large = padded wiki + contest + partial-match + field pages + 5,000 distractors (15,806 chunks).
Each question at its own budget (default 3,500). Before = 0.15.0 ranking code with the new questions, after = 0.15.1;
one `--final` run each. "Answer in body" = the question's evidence text is in the data block before "Also relevant";
tokens = `estimateTokens` of the whole tool output.

| split | n | MRR before → after | recall@5 | nDCG@5 | precision@5 | answer in body | tokens/question |
|---|---|---|---|---|---|---|---|
| dev | 45 | 0.841 → 0.896 | 0.881 → 0.948 | 0.850 → 0.909 | 0.761 → 0.817 | 0.889 → 0.956 | 361.6 → 317.6 |
| test | 33 | 0.879 → 0.909 | 0.899 → 0.960 | 0.876 → 0.914 | 0.821 → 0.842 | 0.909 → 0.970 | 399.1 → 290.2 |

All questions at a budget of 1,000: answer in body 0.889 → 0.956 (dev), 0.909 → 0.970 (test); tokens 252.6 → 213.5 and
250.7 → 220.5. Unpadded set: dev MRR 0.863 → 0.930, recall@5 0.915 → 0.981, answer in body 0.933 → 1.000; test MRR
0.894 → 0.924, recall@5 0.929 → 0.990, answer in body 0.939 → 1.000. The [db] suite's corpus logs dev MRR 0.930,
recall@5 0.993, answer in body 1.0; test 0.924 / 0.990 / 1.0.

Per family (large set; n = 1–3 per split, so one question moves MRR by 0.33–1.0):

| family | split | MRR before → after | answer in body |
|---|---|---|---|
| thin-intro | dev / test | 0 → 0.5 / 0 → 0.5 | 0 → 1 / 0 → 1 |
| url-table | dev / test | 0 → 1 / 1 → 1 | 0 → 1 / 1 → 1 |
| en-inflection | dev / test | 0.5 → 1 / 0.5 → 1 | 0.5 → 1 / 0.5 → 1 |
| ko-double | dev / test | 1 → 1 / 1 → 1 | 1 → 1 |
| cross-lang | dev / test | 0.75 → 0.75 / 0.75 → 0.5 | 1 → 1 |

The test loss is one bundle ("how are newcomers assigned to teams" + "신입 팀 배정", rank 1 → 2): the English phrasing
now finds an English section at its rank 1 and the RRF tie goes to the first query (docs/KNOWN-ISSUES.md). Test ≥ dev
on MRR, recall and answer in body after the change; the dev gain is mostly the dev field questions. To repeat:

```
docker exec nodian-db-1 psql -U nodian -d nodian -c "create database inkling_bench"
cd apps/server
DATABASE_URL=postgres://nodian:nodian@localhost:55432/inkling_bench pnpm db:migrate
DATABASE_URL=postgres://nodian:nodian@localhost:55432/inkling_bench npx tsx scripts/context-bench.ts --pages 5000 --final
```

## Editor & web

| Area | Change (what algorithm or structure) | Before | After | Improvement | Cost | How measured | Source |
|---|---|---|---|---|---|---|---|
| Initial bundle with charts (0.13) | Chart block, chart view and settings in the page / collection chunks; the chart library only in a lazy chunk loaded when a chart is first on screen (React.lazy + IntersectionObserver) | Initial JS 1,021.2 KB raw / 297.2 KB gzip (20 files); PageView chunk 482,044 B / 131,691 B gzip | Initial JS 1,032.6 KB / 300.9 KB gzip, of which charts +9.1 KB raw (shared chart schemas +3.6 KB, en strings +5.5 KB) and the rest other work of the same tree; PageView 492.5 KB / 134.9 KB gzip; new lazy `ChartRender` chunk 138.6 KB / 48.1 KB gzip | None claimed (new feature); initial +0.9% raw | Pages with a chart download 48.1 KB gzip once | `vite build` (Vite 8.3, rolldown) of apps/web to a scratch outDir before and after, same machine; initial = scripts and modulepreloads of index.html, gzip level 9 via node:zlib | [ADR 1601](adr/1601-ztd-charts-behind-one-adapter.md) |
| Presence list | Push the online-users list to React only when it changes (`sameUsers` comparison) | 303 React commits | 2–3 commits | ≈ 100–150× fewer commits | O(users) comparison per awareness event | Headless Chromium and WebKit, production build, a second client changing an awareness field 150 times at 100 ms intervals, commits counted through the DevTools hook | [ADR 0700](adr/0700-awareness-users-equality.md) |
| Table view, 10,000 rows | Own fixed-height list windowing (`useWindowedRows`) | First paint ~14 s, scroll frame p50 482 ms / p95 783 ms | First paint 2.4 s, 26 rows in the DOM, scroll p50 50 ms / p95 100 ms | ≈ 5.8× (first paint), 9.6× (p50), 7.8× (p95) | Windowed rows are one line high (cells clipped) | Headless Chromium against the Vite dev server (dev-mode React; first paint includes the 4.4 MB API response), synthetic 2,500 px-per-frame scroll | [ADR 0302](adr/0302-own-list-virtualization.md) |
| Bundle size | Route- and feature-level code splitting (`React.lazy` routes, lazy canvas/collection/graph, lazy Shiki) | 680 KB gzip on every route | Entry 163 KB, doc page 517 KB, canvas 578 KB, database 540 KB, graph 179 KB, admin 174 KB | −76% entry, −15% to −24% on editor routes | One extra round trip on a cold first visit to a non-shell route | `vite build`, gzip of the static import closure from `index.html`; CSS unchanged (49 KB gzip) | [ADR 0704](adr/0704-route-and-feature-code-splitting.md) |
| Right-panel outline | Outline read from the ProseMirror doc with a per-block `WeakMap` cache, instead of `editor.document` walked three times | 1.4–4.9 ms per tick | 0.2 ms per tick after an edit | 7–25× | Depends on BlockNote's ProseMirror layout | Chromium, 3,701-block document, per 300 ms tick | [ADR 0705](adr/0705-right-panel-incremental-outline.md) |
| Sidebar tree navigation | Memoized rows with per-row store subscriptions (`useSyncExternalStore`), node reuse in `buildTreeShared` | 7,009 row renders, ~430 ms long tasks per navigation | 4 row renders, ~115 ms long tasks (remainder is layout of the 40k-node sidebar) | 1,750× fewer renders, ≈ 3.7× less long-task time | Rows read flags from a store written during render | Headless Chromium, production build, 2,335 rows expanded, 6 navigations | [ADR 0708](adr/0708-page-tree-row-subscriptions.md) |
| Board view, 10,000 rows | Columns render the first 50 cards plus "Show N more" | 50,929 DOM nodes, 5,682 ms long tasks on open, 645 ms while scrolling | 1,682 DOM nodes, 0 ms, 0 ms | 30× fewer nodes; long tasks eliminated | Cards past the first 50 are not drop targets until shown | Production build, headless Chromium, long tasks via PerformanceObserver | [ADR 0709](adr/0709-board-incremental-columns.md) |
| Math pages, 1,000 formulas | Shipped math rendering (memory LRU, 8 ms render slices, ≤ 16 insertions per frame, cap of 100 rendered display formulas, deferral from 300 formulas) vs the first version (synchronous render in React render) | First display 1,427 ms; long tasks 3, max 516 ms; typing p50 29.9 / p95 64.4 ms; 123,656 DOM nodes | 670–685 ms; 1, max 169–171 ms; 21.9–22.3 / 30.1–38.2 ms; 62,080 nodes (final build, 1 run: 683 ms, 169 ms, 18.9 / 30.2 ms) | 2.1× first display, 3.0× longest task, 1.3–1.4× p50, 1.7–2.1× p95 | Formulas past two screens render later (all done after ≈ 7 s); CLS on load stays ≈ 0.07 | Headless Chromium, Apple-silicon MacBook Air, production build, 1280×900, fresh profile per run, 1–2 runs (ranges); N formulas half display (≈110 chars) / half inline; typing = 43 keys at 60 ms, keydown → next frame; plain-text control: 411 ms, no long task, 5.0 / 15.3 ms | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math pages, 500 formulas | Same | 912 ms; 3, max 268 ms; 19.6 / 26.6 ms; 62,020 nodes | 556–598 ms; 1, max 71–77 ms; 17.2–20.0 / 23.4–26.5 ms; 44,365 nodes | 1.5–1.6× first display, 3.5–3.8× longest task | Same | Same | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math pages, 100 formulas | Same (below the deferral threshold: render all, paced) | 570 ms; 1, max 81 ms; 12.0 / 18.6 ms | 585–587 ms; no long task; 9.2–9.4 / 13.5–14.2 ms | Long task removed; first display unchanged | — | Same | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math insertion pacing | Hand rendered formulas to React ≤ 16 per animation frame instead of all results of a batch at once | 1,000 formulas: long tasks 4–9, max 423–683 ms; 500: 5–6, max 184–240 ms | 1, max 170–173 ms; 1, max 71–73 ms | 2.5–4× longest task | All formulas on screen a few frames later | Same setup, worker variant before/after, 2 runs | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math resident cap | At most 100 rendered display formulas in the DOM, evict farthest from the viewport (placeholder keeps source text and exact box) | 1,000 formulas: typing p50 29.9–30.5 ms, 123,656 nodes | 22.9 ms, 62,114 nodes; ping-pong scroll re-insertions 126 (OPT 71), scan 237; scroll CLS 0 | 1.3× p50, −50 % DOM | Re-insertions while scrolling (from the cache, paced) | Same; scroll scan 160 × 400 px, ping-pong 3 × 40 steps; OPT = Belady on the recorded trace | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math deferral threshold | Defer off-screen formulas from 300 formulas on (not below) | Not deferred: first display 760–836 ms (300), 1,224–1,272 ms (500), 2,584–2,616 ms (1,000) | Deferred: 507, 564, 698 ms | 1.5×, 2.2×, 3.7× | All formulas rendered only after ≈ 5.6–7.7 s; at 100 formulas the gain is 1.16× (510 vs 589–592 ms), so not enabled there | Same, worker variant, deferral forced on/off | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Margin outline and heading folds, 2,000-block page | Outline: heading offsets measured once per outline change (ResizeObserver on the editor for height changes), scroll reads `scrollTop` once per frame and binary-searches them; folds: one generated stylesheet keyed by block id, recomputed synchronously per editor change/selection event (one pass over the top-level blocks) | Scroll frame p50 16.7 / p95 17.6–18.5 ms; typing keydown → next frame p50 6.5–8.6 / p95 11.4–13.2 ms | Outline on: scroll p95 18.6 ms, typing p50 7.4–8.9 / p95 12.4–13.4 ms. Outline on + 10 folded H1 sections (990 hidden blocks): scroll p95 18.2–18.5 ms, typing p50 6.2–7.3 / p95 12.9–18.3 ms; 0 WebSocket frames sent while folding | None measurable (new feature at no cost to scroll or typing) | Unfolding a section (~100 blocks) 28–59 ms from click to the next frame (layout of the revealed blocks; final build, 2 runs × 6 unfolds) | Headless Chromium (Playwright 1.61, chromium 1228), production builds before/after in `scratchpad`, local server (Node 22.23.4, Postgres 16 in Docker), 1440×900, fresh context per run; page of 2,000 blocks (a heading every 20 blocks: 20 H1, 80 H2/H3, the rest paragraphs and list items); scroll = 80 wheel steps of 300 px at 16 ms, rAF intervals; typing = 60 keys at 50 ms into a paragraph in the middle; before 3 runs, after 2 runs each, interleaved; Apple-silicon MacBook Air shared with other agents (load average 10–58) | [ADR 1220](adr/1220-mini-outline-in-the-margin.md), [ADR 1221](adr/1221-heading-folds-per-device.md) |
| Soft corners and motion, 2,000-block page | Radius/shadow/ease tokens, drawn checkboxes, rounded tables (separate borders), slash-menu and dropdown pop-in, a base-layer press rule on buttons; nothing animated inside blocks | Scroll frame p50 16.7 / p95 17.6–18.6 ms; typing keydown → next frame p50 10.3–13.4 / p95 16.5–18.7 ms (4 runs) | Scroll p50 16.7 / p95 17.7–18.6 ms; typing p50 11.2–14.5 / p95 16.3–19.9 ms (4 runs) | None measurable (within run-to-run spread; the margin-outline row's 2.0× ADR 1220 regression is not repeated) | Main stylesheet 86.0 → 92.6 KB (15.8 → 17.2 KB gzip; part of it is other workers' concurrent changes) | Same harness as the margin-outline row (`perf.mjs`: 80 wheel steps of 300 px at 16 ms, 60 keys at 50 ms into a paragraph in the middle), Headless Chromium (Playwright 1.61.1, chromium 1228), production builds in `scratchpad/motion/web-before` and `web-after`, local 0.8.0 server snapshot (Node 22.23.4, Postgres 16 in Docker), 1440×900; before/after interleaved 4×; Apple-silicon MacBook Air shared with other agents (load average 2.4–3.6). The before build predates concurrent edits by other workers, so it differs in more than this change | [ADR 1280](adr/1280-soft-corner-scale-and-shadows.md), [ADR 1281](adr/1281-motion-tokens-enter-and-exit.md) |
| Sidebar tree reveal, 1,000-item tree | Child list grows its grid row 0fr → 1fr (220 ms) and closes 1fr → 0fr (120 ms) with a presence hook; while closing it reuses the elements of its last open render; chevron turned by `rotate` | Same source with the old reveal (fade + 4 px slide on mount, unmount on close): 400-child folder expand click → next frame 79.6–121.9 ms, collapse 26.9–47.1 ms; with 20 other folders open (1,024 rows) expand 107.3–118.4, collapse 58.9–80.9 ms; 30-child folder 11.9–27.0 ms; frame p95 during the following 400 ms 16.8–18.2 ms | Expand 76.8–110.4 ms, collapse 29.7–39.1 ms; with 1,024 rows expand 81.3–105.0, collapse 26.5–39.2 ms; 30-child folder 14.1–29.7 ms; frame p95 16.7–18.3 ms, one 33–34 ms frame when the 400 closed rows unmount 120 ms after the click | None for expand; collapse with many rows open is faster at the click (the unmount moves to a later frame) | The unmount frame after a large collapse; 3 hooks more per row. A first version re-rendered every closing row (new `expand` prop): collapse 43–62 ms at the click, fixed by reusing the last elements | `treeperf.mjs`: 1,000 pages (one folder of 400, 20 folders of 30), arrow clicked through `click()`, click → next rAF, rAF intervals for 400 ms, long tasks; 4 expand/collapse pairs per case, 2 interleaved runs per build; same browser, server and machine as the row above (load average 1.9–3.4). `varD` = this change's source with only the tree reveal reverted | [ADR 1281](adr/1281-motion-tokens-enter-and-exit.md) |
| Web bundle, Mermaid diagrams (0.17) | `mermaid` 12.3.0 behind `import()` on the first diagram; its chunks, the libraries only it uses and the d3 parts only its charts use under `assets/lazy/` (not precached) | entry 413.91 kB (gzip 114.58); editor chunk `PageView` 521.27 kB (gzip 144.09); precache 94 entries, 4,313.82 KiB | entry 413.86 kB (gzip 114.57); editor 533.19 kB (gzip 148.44); precache 95 entries, 4,327.98 KiB; Mermaid lazy: 90 files, 5.16 MB (gzip 1.44 MB); first flowchart: 26 files, 941 kB (gzip 246 kB) | Pages without a diagram: entry unchanged, editor +11.9 kB (+4.35 kB gzip, block UI + section links), precache +1 entry / +14.2 KiB (d3-interpolate's core split into a chunk shared by editor, canvas and Mermaid); a static-import walk from entry, editor and code-block chunks reaches no Mermaid chunk | First diagram on a page downloads ~246 kB gzip | `vite build` (Vite 8.3, rolldown) of HEAD bd30a54 and HEAD + the Mermaid and section-link change only, in isolated copies (other 0.17 changes excluded); sizes from the build log, gzip -9 for the lazy sums; "first flowchart" = static import closure of the `mermaid` entry chunk plus `flowDiagram` | [ADR 2104](adr/2104-mermaid-diagrams-in-code-blocks.md) |
| Web bundle, the integrated 0.17 tree | Public pages draw diagrams with the same lazy renderer (`lib/mermaid.ts` in the `Presentation` chunk shared by the public view and the editor, which only `import()`s `assets/lazy/mermaid…`) | (see the row above for 0.16) | entry 413.80 kB; editor `PageView` 586.85 kB (every 0.17 change included); `PublicView` 17.80 kB; `Presentation` 20.1 kB; precache 96 entries, 4,363.44 KiB; the Mermaid library still only under `assets/lazy/` | A public page without a diagram loads nothing of Mermaid | — | `vite build` of the whole 0.17 tree at integration; sizes from the build log | [ADR 2191](adr/2191-mermaid-on-public-pages.md) |
| Opening a large page (web, 0.18) | Device copy (IndexedDB) loaded into the Y.Doc before the provider; one GET /sync-check before Auth when a copy exists; updates appended to IndexedDB in 120 ms batches | Setting off on the same build: 476 / 515 / 682 ms (median 515) | Setting on: first open (no copy yet, the 1.8 MB state is then written to IndexedDB) 912 ms; reopen from the copy 541 / 536 ms | No regression on reopen (median 536–541 vs 515 ms, within the spread of the off runs); the first open after turning it on was 912 ms in one sample | One IndexedDB read and one Yjs apply at open; one small GET per open of a page with a copy and per reconnect | One page of 500 paragraphs (~2.4 kB each), `stateBytes` 1,828,980 (≥ 1 MiB). Chrome (headless, Playwright `channel: 'chrome'`) on a MacBook Air, local server serving the built app and the stream's database, time from `page.goto` to the last paragraph in the editor's DOM, 8 s pause between runs, one warm-up; "before" is this build with the setting off, not db0d9be. `scratchpad/w18-browser/offline/check.mjs` step 10, `large-page.json` (not in the repo) | [ADR 2200](adr/2200-device-copies-of-pages-in-indexeddb.md) |
| Public page bundle (0.19) | Toolbar (wide view, Save as PDF, Markdown, "⋯" menu), print.css shared with the app's PDF export, view CSS | Entry JS 438,323 B (120,072 gz); PublicView chunk 16,934 B (5,718 gz); public-only closure 39,275 B (15,465 gz); no public-only CSS | Entry JS 439,145 B (120,197 gz); PublicView 21,804 B (7,061 gz); public-only closure 45,553 B (17,207 gz); CSS +5,358 B print chunk (1,348 gz) + 469 B view CSS (231 gz) | — (feature cost) | +822 B entry (i18n strings), +6,278 B JS and +5,827 B CSS on the public page (≈ +3.4 KB gzip in total) | `pnpm --filter ./apps/web build` before (11d0707, the 0.18 tree the share branch started from) and after (the share branch with this change, before it was merged with the rename, the screen notices and onboarding) on the same machine; the absolute sizes are on that baseline, not on dd933e5 as in the two rows below; sizes from `dist/assets` with `bundle-size.mjs` (gzip -9; the static-import closure of the PublicView chunk minus the entry's closure) | [ADR 2363](adr/2363-public-page-toolbar-folds-into-one-menu-on-phones.md) |
| Screen notices and IndexedDB open limit (0.19) | Error boundaries around the app, the routes and the page, the static boot notice in `index.html`, a 5 s limit on `indexedDB.open` | dd933e5: entry `index-*.js` 441,025 B (120,776 B gzip -9); entry + modulepreload (26 files) 1,350,583 B (396,113 B gzip); precache 102 entries, 4,694,314 B | 5ee9f3a: entry 442,897 B (121,329 B gzip); entry + modulepreload (26 files) 1,353,435 B (397,027 B gzip); precache 102 entries, 4,698,043 B | — (feature cost) | +1,872 B / +553 B gzip on the entry; +2,852 B / +914 B gzip entry + modulepreload; precache +3,729 B | `pnpm --filter ./apps/web build` of dd933e5 (from `git archive`), 5ee9f3a and c6634d0 on the merged main tree; `w19-browser/onboard/bundle-size.sh`: `gzip -9` over the JS that `dist/index.html` loads or modulepreloads; precache = the entries in `sw.js` and their bytes | [ADR 2324](adr/2324-a-screen-that-cannot-be-drawn-says-so-instead-of-going-white.md) |
| Onboarding bundle (0.19) | Getting started card as a precached route-level chunk (`assets/Checklist-*.js`), the intro in a lazy chunk (`assets/lazy/IntroOverlay-*.js`, not precached), en and ko strings in the i18n chunk | 5ee9f3a (row above): entry `index-*.js` 442,897 B (121,329 B gzip -9); entry + modulepreload (26 files) 1,353,435 B (397,027 B gzip); precache 102 entries, 4,698,043 B | c6634d0: entry 446,120 B (122,577 B gzip); entry + modulepreload (27 files, the new one an i18n chunk) 1,367,542 B (402,646 B gzip); precache 104 entries, 4,723,305 B | — (feature cost) | +3,223 B / +1,248 B gzip on the entry (most of it the en+ko strings); +14,107 B / +5,619 B gzip entry + modulepreload; precache +2 entries, +25,262 B. The intro chunk is 20.63 kB (7.60 kB gzip), loaded only when it plays; the card chunk 7.81 kB (3.00 kB gzip). Both rows together (dd933e5 → c6634d0): entry +5,095 B (+1,801 gzip), entry + modulepreload +16,959 B (+6,533 gzip), precache +2 entries, +28,991 B | `pnpm --filter ./apps/web build` of dd933e5 (from `git archive`), 5ee9f3a and c6634d0 on the merged main tree; `w19-browser/onboard/bundle-size.sh`: `gzip -9` over the JS that `dist/index.html` loads or modulepreloads; precache = the entries in `sw.js` and their bytes | [ADR 2382](adr/2382-intro-motion-drawn-in-code-as-a-function-of-time.md) |
| Intro motion bundle (0.19.1) | The intro redrawn with real content, a per-scene camera (viewBox keys), ink-wipe transitions (clipPath), the drop with eyes and squash, and the end screen with its actions (sample, new page, AI connection) — all in the lazy `assets/lazy/IntroOverlay-*.js` chunk; the end screen's actions reuse hooks already in the entry (`useCreatePage`, `newPageTarget`, `useCreateSample`, `showHint`); longer intro copy in the en/ko i18n dictionaries | 958a9b4 (v0.19.0, built from `git archive`): intro chunk 20,634 B (7,512 B gzip -9); entry `index-*.js` 447,094 B (122,916 B gzip); entry + modulepreload (27 files) 1,368,719 B (403,057 B gzip); precache 104 entries, 4,725,833 B | 0.19.1 tree: intro chunk 34,937 B (13,573 B gzip); entry 447,032 B (122,962 B gzip); entry + modulepreload (26 files: the i18n and api chunks came out as one) 1,371,693 B (403,152 B gzip); precache 104 entries, 4,728,128 B | — (feature cost) | Intro chunk +14,303 B / +6,061 B gzip, loaded only when the intro plays, not precached (target was ≤ 16 kB gzip). Entry −62 B (+46 B gzip); entry + modulepreload +2,974 B / +95 B gzip, the longer intro copy in the dictionaries (en 5,469 → 7,155 B, ko 6,299 → 8,164 B of source); precache +2,295 B (`onboarding/hint.ts` became its own 2,548 B chunk, shared by the card and the intro, and left the card's chunk). The SVG is 0.6–17 KB of markup per frame (median 9 KB; 0.04 ms to build in Node), rebuilt every frame while it plays | `pnpm --filter ./apps/web build` of both trees; `w19-browser/onboard/bundle-size.sh` (`gzip -9` over the JS that `dist/index.html` loads or modulepreloads; precache = the `sw.js` entries and their bytes) | [ADR 2385](adr/2385-intro-end-screen-camera-and-ink-wipe.md) |
| Image viewer bundle (0.19.1) | The viewer (`components/imageViewer/ImageViewer.tsx`, zoom arithmetic in `lib/imageZoom.ts`) in a lazy chunk loaded on its first open, its stylesheet with it; the editor and the public page import the open helper (`openImageViewer.ts`); the magnifier button is part of BlockNote's own image render; en/ko strings and the shortcut rows in the i18n chunk. Not a performance change; feature cost only | 958a9b4 (v0.19.0), the zoom branch's own build: entry `index-*.js` 447,123 B (122,930 B gzip -9); entry + modulepreload (27 files) 1,368,748 B (403,068 B gzip); PageView 136,084 B; PublicView 21,834 B; precache 104 entries, 4,726,081 B | Zoom branch on 958a9b4 after its follow-up (38da342 + 7cfe4e8 without the intro): entry 447,131 B (122,941 B gzip); entry + modulepreload 1,370,905 B (403,616 B gzip); new lazy `ImageViewer-*.js` 9,655 B (3,550 B gzip) and `ImageViewer-*.css` 448 B (303 B gzip); PageView 136,092 B; PublicView 22,043 B; precache 106 entries, 4,745,398 B. Released tree (main at 7cfe4e8, intro and viewer together): entry 447,198 B (122,985 B gzip); entry + modulepreload (27 files) 1,374,102 B (404,595 B gzip); `ImageViewer-*` 9,655 / 448 B as above; entry CSS `index-*.css` 109,881 B (19,717 B gzip); precache 107 entries, 4,748,962 B. The bundler also emits a shared chunk named `openImageViewer-*.js`, 17,263 B (7,413 B gzip), referenced by the CollabEditor, PageView, PublicView, Presentation and Settings chunks, precached and not modulepreloaded; it holds the open helper with other shared modules, and its contents were not broken down | — (feature cost) | Entry +8 B (+11 B gzip); entry + modulepreload +2,157 B / +548 B gzip (the viewer's strings and shortcut rows in the i18n chunk); the viewer itself 3.5 kB + 0.3 kB gzip, loaded only on the first open and precached; precache +19,317 B (+2 entries). The image moves by `transform` only and one `requestAnimationFrame` writes it, so React does not re-render while zooming. No new dependency (a lightbox library was rejected, ADR 2386) | `pnpm --filter ./apps/web build`; `w19-browser/onboard/bundle-size.sh` as in the row above. The 958a9b4 figures here and in the row above come from two separate builds of the same commit and differ by a few bytes; compare within a row | [ADR 2386](adr/2386-image-viewer-double-click-in-the-editor-click-elsewhere.md) |
| Columns bundle (0.20) | The columns (`components/blocks/Columns.tsx`, `lib/columns.ts`: nodes, side menu items, resize handle, keys, paste) in the editor chunk; their CSS in the entry stylesheet; en/ko strings; the document schema banner and the offline `outdated` reason. Not a performance change; feature cost only | 0.19.1 (365b664, built from `git archive`): entry `index-*.js` 447,198 B (122,995 B gzip -9); entry + modulepreload (27 files) 1,374,102 B (404,604 B gzip); entry CSS 109,881 B (19,717 B gzip); CollabEditor chunk 451,460 B (126,070 B gzip); precache 107 entries, 4,748,962 B | 0.20.0 (2413d43, the same web code as 2c024f5, built from `git archive`): entry 449,412 B (123,356 B gzip); entry + modulepreload (26 files) 1,381,039 B (406,213 B gzip); entry CSS 119,339 B (20,944 B gzip); CollabEditor 463,518 B (130,001 B gzip); precache 109 entries, 4,785,852 B | — (feature cost) | Entry +2,214 B (+361 B gzip); entry + modulepreload +6,937 B / +1,609 B gzip, one file fewer; entry CSS +9,458 B / +1,227 B gzip; editor chunk +12,058 B / +3,931 B gzip, loaded with the editor as before; precache +2 entries, +36,890 B. These include every 0.20 web change: the columns, the public chart code with the chart adapter split out of the editor chunk (next row), and the public page callouts and colours in the entry stylesheet. The columns alone (c356b62, before the others, measured then): entry −23 B gzip, editor chunk +4,802 B gzip. No new dependency | `pnpm --filter ./apps/web build` of both trees back to back on 2026-11-11 (Node 22.23.4, vite 8.3.0); `gzip -9 -c <file> \| wc -c` (Apple gzip 479, file name stored) of the JS that `dist/index.html` loads or modulepreloads; precache = the `sw.js` entries and their bytes on disk. The build id compiled into the bundle (a hash of the build time) moves gzip sizes by up to about 15 B per file between builds of the same commit (two builds of 2413d43: entry 123,371 and 123,356 B gzip); the 0.19.1 numbers recorded first (122,992 / 404,600 / 126,072 B gzip) differ by less | [ADR 2420](adr/2420-columns-are-columnlist-and-column-nodes.md) |
| Public charts bundle (0.20) | Public chart code (`lib/publicCharts.ts`, `components/charts/PublicChartMount.tsx` + CSS) loaded only by a public page that has charts; the chart adapter split out of the editor chunk. Not a performance change; feature cost only | 0.19.1 (365b664, built from `git archive`): entry `index-*.js` 122,977 B gzip; entry static closure 404,032 B gzip; `PublicView-*.js` 7,152 B; PublicView closure outside the entry (PublicView, openImageViewer, ThemeToggle, Presentation) 18,760 B; `CollabEditor-*.js` 126,045 B | 0.20.0 (2413d43, built from `git archive`): entry 123,338 B (+361); entry closure 405,655 B (+1,623); `PublicView` 7,184 B (+32); PublicView closure 19,589 B (+829: the Presentation chunk carries `lib/publicCharts.ts` and its preload list, 3,745 → 4,552 B); `CollabEditor` 129,976 B (+3,931); only on a public page with charts: `PublicChartMount` 1,392 B + CSS 226 B + `adapter` 961 B + `ChartRender` 50,822 B (the same file as 0.19.1) | — (feature cost) | The entry, closure and CollabEditor deltas include the columns (row above); on the public charts branch alone (365b664 + public charts, measured then) they were +267, +84 and −770 B (the adapter left the editor chunk). A public page without charts requests neither `PublicChartMount` nor `ChartRender` (browser network log on that branch; on 0.20.0 neither is in PublicView's static closure). The app's idle warm-up of the editor chunk (every page, public ones included) now also fetches `adapter-*.js` (961 B), which was inside the editor chunk before | `pnpm --filter ./apps/web build` of both trees back to back on 2026-11-11 (Node 22.23.4, vite 8.3.0); `gzip -9 < <file> \| wc -c` (Apple gzip 479, no file name; all sizes gzip); closure = the files reached from a chunk by static imports, which for the entry are exactly the files `dist/index.html` loads or modulepreloads. The 0.19.1 numbers recorded first (122,979 / 404,727 / 7,146 / 18,781 / 126,044) came from another build and a closure count that did not reproduce exactly | [ADR 2442](adr/2442-public-charts-drawn-in-the-browser-from-labels-and-numbers.md) |
| PDF preview bundle (0.21) | The PDF preview (`components/pdfPreview/`, `lib/pdfFile.ts`, `lib/pdfPreview.ts`): the file block's wrapped render and portals in the editor chunk, host rules in the entry stylesheet, en/ko strings; the preview UI and pdf.js (legacy build) lazy. Not a performance change; feature cost only | 0.20.0 (4780c95, built from `git archive`): entry `index-*.js` 449,412 B (123,352 B gzip -9); entry + modulepreload (26 files) 1,381,039 B (406,209 B gzip); entry CSS 119,339 B (20,944 B gzip); CollabEditor 463,518 B (130,005 B gzip); precache 109 entries, 4,785,852 B | 0.21 code (a5c7bad): entry 449,394 B (123,349 B gzip, build-id noise); entry + modulepreload (26 files) 1,384,740 B (407,133 B gzip); entry CSS 120,620 B (21,134 B gzip); CollabEditor 468,660 B (131,644 B gzip); precache 111 entries, 4,822,584 B (`PdfPreview-*.js` 23,532 B / 8,331 B gzip and its CSS 2,966 B / 1,142 B gzip). Lazy, never precached: `assets/lazy/pdfDocument-*.js` 501,358 B (150,974 B gzip), `assets/lazy/pdf.worker.min-*.mjs` 1,327,591 B (394,383 B gzip), both from pdf.js's legacy build; `assets/lazy/pdfjs-6.5.438/`: cmaps 169 files 1,167,747 B, standard_fonts 16 files 798,046 B, wasm 11 files 910,945 B (3 .wasm, 2 no-wasm fallbacks, 6 licences), iccs 2 files 15,017 B, LICENSE 10,174 B | — (feature cost) | Entry ±0 B (build-id noise); entry + modulepreload +3,701 B (+924 B gzip); entry CSS +1,281 B (+190 B gzip); editor chunk +5,142 B (+1,639 B gzip); precache +2 entries, +36,732 B. A page without a PDF requests none of the preview's files (browser check step 11); a Korean PDF fetched 2 cMaps (UniKS-UCS2-H, Adobe-Korea1-UCS2) | `pnpm --filter ./apps/web build` of both trees on 2026-11-11 (Node 22.23.4, vite 8.3.0); `gzip -9 -c <file> \| wc -c` (Apple gzip, file name stored) of the JS that `dist/index.html` loads or modulepreloads; precache = `sw.js` entries and their bytes on disk | [ADR 2480](adr/2480-pdf-preview-with-pdfjs-from-the-apps-own-origin.md) |
| PDF preview first page (0.21) | Time from the start of the `/files/<id>` request to page 1 drawn, by file size and network | — | local: 0.07–0.47 s for 5–25 MB; 20 Mbit/s: 2.1 s (5 MB), 4.2 s (10 MB), 6.6 s (16 MB), 8.6 s (21 MB), 10.2 s (25 MB); 5 Mbit/s: 8.2 s (5 MB), 16.3 s (10 MB), 26.0 s (16 MB). A 40-page text PDF: page open → page 1 drawn about 0.95 s locally (cold: preview chunk, pdf.js, worker, file) | Auto-load limit 10 MB instead of the proposed 15 MB (ADR 2482) | The route sends no byte ranges, so the transfer is the whole time (download vs first page within 80 ms in every throttled row) | Real Chrome headless (playwright-core 1.65), built app on localhost, CDP network emulation with 40 ms latency, PDFs of 580×580 uncompressed RGB image pages, fresh context per row with pdf.js warmed once, 20 ms polling; MacBook Air (Apple silicon) | [ADR 2482](adr/2482-pdf-preview-loads-files-up-to-10-mb-on-sight.md) |
| PDF preview, long files (0.21) | Limits against hostile or huge files: one size per page, only the page boxes near the view in the DOM, at most 8 pages drawn per pass; a preview far from the screen lets go of its canvases at once and of its document after 10 s | — | 5,000-page PDF: page open → page 1 drawn 0.88 s; jump to page 5,000 → drawn 75 ms; JS heap 27 MB. 3,000-page PDF: jump to page 2,500 77 ms, 5 page slots in the DOM. A page with 12 PDFs scrolled to the end: 28 s later 1 open document, 2 canvases | — (limits; files of more than 5,000 pages are not previewed) | A preview that comes back after its document was let go parses the file again | Real Chrome 157 headless, built app on localhost, the browser check in `scratchpad` (steps 13c, 13d and 18); MacBook Air (Apple silicon) | [ADR 2483](adr/2483-pdf-preview-limits-against-hostile-files.md) |

## Server & database

| Area | Change (what algorithm or structure) | Before | After | Improvement | Cost | How measured | Source |
|---|---|---|---|---|---|---|---|
| Share dialog chart count (new, 0.20) | `GET /pages/:id/share` counts the chart blocks of a folder link's doc pages (at most 300) from configs only, no aggregation; reads only `page_docs` rows whose state bytes contain `chart` | — (no count) | Folder link, 300 doc pages of 60 kB: 26 ms with 1 page holding a chart, 75 ms with 30, 361 ms with 300 (median of 6) | — (new feature) | Without the byte filter on `page_docs.state` the 30-chart folder took 330 ms (kept: the filter); also run on every link setting change | Local Postgres 16 in Docker, server on tsx, Apple-silicon MacBook Air; synthetic folder of 300 pages | [ADR 2440](adr/2440-public-link-charts-switch-per-link-off-by-default.md) |
| Chart aggregate (new, 0.13) | POST /workspaces/:id/charts/aggregate: one statement selecting only the needed properties (`jsonb_build_object`), view filters, keys and measuring in JS (shared pure functions), result cached per viewer + range + workspace version | None (new) | 2,000 rows: cold median 8.6–10.5 ms (max 10.7 ms), multi-select × person 10.6–12.7 ms, cached 3.8–5.0 ms; 10,000 rows: cold median 26.3–26.5 ms (max 27.3–29.6 ms), multi-select × person 30.3–31.2 ms, cached 6.9–8.8 ms; inside the full parallel `--db` suite (86 files at once) 2,000 rows 37.0–56.0 ms, 10,000 rows 75.2–83.9 ms cold median | None claimed (new) | Up to 10k rows in Node memory per cold call (projected props only); statement timeout 3 s as the collection query | `charts.db.test.ts` "large collections": rows inserted directly, 7 fields, group by select / date-month × select with sum of a number, 5 cold runs each (cache cleared), app.inject through the route, local Postgres 16 (Docker), Node 22.23, 3 runs of the file | [ADR 1602](adr/1602-chart-aggregate-endpoint.md) |
| Collab store path | Auto snapshot inside Postgres, one-round-trip persistence, debounced and diffed derived-index rewrites | 40,006 SQL statements; DB time 4.9–5.9 s; wall 29.6–35.5 s; Node CPU 10.7–11.6 s | 1,042 statements; DB 0.8–1.3 s; wall 4.7–6.3 s; Node CPU 4.2–6.0 s | 38× fewer statements; DB 3.8–7.4×; wall 4.7–7.6×; CPU 1.8–2.8× | Search, backlinks, tags and tasks of a page being typed in lag by up to 30 s | 1,000 store calls on a ~300-block page (93 KB state), same machine, back-to-back runs, `pg_stat_statements`; Node CPU includes a 1.5 s harness | [ADR 0750](adr/0750-collab-store-path-db-side-snapshot-debounced-diffed-indexing.md) |
| Conditional GET | Version ETags checked before doing the work (`precheckEtag`), content-hash ETags otherwise | Full 200: tree 101 ms, graph 91 ms, due 84 ms, collection 80 ms | 304: tree 7.1 ms (0 B), graph 6.4 ms, due 7.1 ms, collection 7.3 ms | 11–14× | Version ETag only as precise as `workspaceVersion` (user renames do not bump it) | 5k pages + 10k-row collection, interleaved full vs conditional requests, p50 | [ADR 0752](adr/0752-http-caching-policy-and-conditional-gets.md) |
| Public share pages | Bounded LRU with TTL and byte budget for rendered HTML and allowed file ids | p50 17.0 ms | p50 0.9–2.1 ms | 8–19× | Up to ~40 MB of cache in the worst case | 30 sequential views of a 93 KB-state page | [ADR 0753](adr/0753-public-share-render-cache.md) |
| Public share pages, link gate | Expiry and password gate on the link's root row (same SELECT, two more columns; HMAC check of the unlock cookie only for password links); folder root reuses the gated row instead of looking the token up twice | Open link p50/p95: doc JSON 0.93–0.95 / 1.59–1.63 ms, doc file 0.90–1.01 / 1.20–1.21 ms, folder root 1.03–1.04 / 1.21–1.62 ms, folder child 0.82–0.84 / 1.06–1.53 ms | Open link: doc JSON 0.91 / 1.56–1.64 ms, doc file 0.88–0.97 / 0.99–1.40 ms, folder root 0.76–0.78 / 0.92–1.07 ms, folder child 0.80–0.84 / 0.94–0.97 ms; expiring link doc JSON 0.94–0.97 / 1.63–1.87 ms; password link with unlock cookie 0.96–0.98 / 1.75–1.84 ms | No change within spread for doc JSON, files and children (the gate adds no query); folder root 1.3× p50 (one token lookup fewer); password link +0.05 ms p50 over an open link | Unlock POST answers in ≥ 300 ms by design (floor; argon2 verify alone p50 11.5–12.5 ms, p95 21.4–26.6 ms) | `apps/server/scripts/share-gate-bench.ts`: one process, two Fastify apps on the same scratch database (old `routes/public.ts` copied verbatim vs current), `app.inject` without network or rate limiter, render caches warm; doc of 400 paragraphs (170,506-byte Yjs state) with a 20 KB cover file, folder with 20 child docs; sequential, 30 warm-up then 300 requests per cell, 2 rounds interleaved before/after (ranges over the rounds). Node 22.23.4, Postgres 16 in Docker on localhost, Apple-silicon MacBook Air. A second run on the same machine was disturbed by other test runs in parallel (p50 1.0–7.2 ms on both sides, same ordering) and is not used | [ADR 1170](adr/1170-public-link-expiry.md), [ADR 1171](adr/1171-public-link-passwords.md) |
| Search | Two index-friendly probes (title ∪ body ILIKE) for terms ≥ 3 characters, instead of OR across a LEFT JOIN | 78 ms | 3 ms, identical result sets | 26× | A term matching nearly every page is ~10% slower (66 → 73 ms) | Seed: 5,000 pages (≈ 2 KB body each), 10k-row collection, 15k links, 20k notifications; EXPLAIN (ANALYZE, BUFFERS) | [ADR 0755](adr/0755-search-indexes-planner-costs-and-hot-updates.md) |
| Unlinked mentions | Transaction-local `random_page_cost = 1.1` (`withSsdPlanCosts`) flips the plan from a seq scan | 94 ms | 0.4 ms | 235× | None recorded | Same seed and method | [ADR 0755](adr/0755-search-indexes-planner-costs-and-hot-updates.md) |
| Notifications | Index on `notifications(user_id, created_at)`, ordered index scan stops at 50 rows | 8.1 ms | 0.33 ms | 25× | One more index to maintain | Same seed and method | [ADR 0755](adr/0755-search-indexes-planner-costs-and-hot-updates.md) |
| `pages` HOT updates | `fillfactor = 85` on `pages` (90 on `page_docs`) so `updated_at` bumps stay on the heap page | 2 of 2,267 updates HOT (0.1%) | 4,090 of 4,484 HOT (91%) | 0.1% → 91% HOT | 15% of each `pages` heap page left empty; applies to newly written pages only | Same seed, after a table rewrite | [ADR 0755](adr/0755-search-indexes-planner-costs-and-hot-updates.md) |
| Query blocks | Lateral fence + `SET LOCAL jit = off` in the query compiler | 3.4–90.5 ms across 8 representative queries (e.g. no-filter LIMIT 500: 90.5 ms) | 1.7–29.2 ms (same query: 29.2 ms) | 1.6–4.1× per query | None recorded | 5,000 docs + 50 folders + a 500-row collection, Postgres 16 on a laptop, median SQL time of 7 runs | [ADR 0203](adr/0203-query-language-parser-and-sql-compilation.md) |
| update_page append, 4.5 MB page | One DirectConnection; emptiness from the Yjs structure; verify only the new blocks on a throwaway doc; no read-back; skip stores whose state digest equals page_docs | Production copy p50 1,556.1–1,655.0 / p95 1,618.8–3,379 ms, event loop max 638.6–1,755.3 ms, other requests p95 287.0–336.5 ms; synthetic 1,292.5–1,325.9 / 1,370.5–1,423.8 ms, loop max 540.0–591.9 ms | 528.6–594.1 / 553.6–623.9 ms, loop max 211.0–235.7 ms, other requests p95 193.4–208.0 ms; synthetic 431.4–482.5 / 445.6–514.4 ms, loop max 177.1–217.3 ms | 2.6–3.1× p50, 2.6–6.1× p95; loop max 2.7–8.3× | No read-back of the result (callers that need blocks ask for it); remaining cost is load + one store + one index pass of the whole page | `apps/server/scripts/large-page-bench.ts`: in-process test app (real routes + Hocuspocus), MCP over the in-memory transport, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Pages: copy of the production page (4.50 MB state, 170 sections, 1,989 blocks, 192 tables; numbers only) / synthetic log (4.13 MB, 181 sections, 1,802 blocks, 181 tables). Sequential calls, one warm-up excluded; event-loop max via `monitorEventLoopDelay` (2 ms); "other requests" = GET /backlinks of a small page every 10 ms during the run. Before/after interleaved (before, after, before, after); ranges are over the 2 runs of each; n = 20 one-line appends | [ADR 1042](adr/1042-write-path-on-large-pages.md) |
| patch_section append, 4.5 MB page | Dry run and validation on a copy of the edited region; result = first read + region read back; unchanged disconnect store skipped | Production copy p50 1,029.0–1,089.2 / p95 1,049.2–1,201.1 ms, loop max 525.6–611.3 ms, other requests p95 232.0–536.9 ms; synthetic 904.7–910.6 / 946.0–959.8 ms, loop max 512.8–532.7 ms | 759.9–872.9 / 930.6–1,311.1 ms, loop max 756.0–788.5 ms, other requests p95 326.4–378.7 ms; synthetic 559.9–619.8 / 608.2–651.5 ms, loop max 339.2–387.7 ms | 1.2–1.4× p50 (production copy), 1.5–1.6× (synthetic); p95 and loop max on the production copy not improved (one full read, one store and one index pass of the whole page remain, see Regressions for the larger index pass) | — | `apps/server/scripts/large-page-bench.ts`: in-process test app (real routes + Hocuspocus), MCP over the in-memory transport, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Pages: copy of the production page (4.50 MB state, 170 sections, 1,989 blocks, 192 tables; numbers only) / synthetic log (4.13 MB, 181 sections, 1,802 blocks, 181 tables). Sequential calls, one warm-up excluded; event-loop max via `monitorEventLoopDelay` (2 ms); "other requests" = GET /backlinks of a small page every 10 ms during the run. Before/after interleaved (before, after, before, after); ranges are over the 2 runs of each; n = 20 one-line appends to the middle section | [ADR 1042](adr/1042-write-path-on-large-pages.md) |
| Change log on the write path | Transactional outbox: the request inserts one outbox row (in the chunk transaction for section changes); one consumer per database under an advisory lock assigns seqs; high-water mark in `change_feed_state` — instead of a process-wide promise chain every request awaited | Title PATCH, 16 clients: p50 27.8 / p95 40.6 ms, 533 req/s; 1 client: 3.9 / 5.5 ms | 23.8 / 32.4 ms, 648 req/s; 1 client: 3.9 / 6.7 ms | 1.17× p50, 1.25× p95 at 16 clients; none at 1 | Statements per request 9 → 14 (consumer, off the request path); readers other than changes_since see a write after the consumer (see Regressions) | Production builds (tsup) of the same tree with and without the change; v0.1.0 seed of the v0.2.0 regression report (5,000 docs, 2 workspaces, 3 × 2,000-row collections, 3,000 comments; `page_chunks` backfilled) restored into Postgres 16.15 in Docker on localhost; Node 22.23.4; Apple-silicon MacBook Air shared with other work (±20–30% between rounds). `fetch` load generator on the same machine, X-Forwarded-For rotated past the rate limits; per level 30 warm-up then 300 requests at 1 and at 16 concurrent clients; statements per request from `pg_stat_statements` over the 1-client run. Rounds interleaved (before, after, …): before 4 runs, after 2 runs of the final code (built before a later fix of the consumer's row order, `ORDER BY` on the numeric outbox id, which has no performance effect); cells are medians of the per-run p50/p95 | [ADR 1080](adr/1080-change-log-through-a-transactional-outbox.md) |
| Write in one workspace during a burst in another | Same as above | Sequential title PATCH in workspace B while 16 clients append to / rename pages of workspace A: p50 71.2 / p95 95.8 ms (idle: 3.4 / 5.4 ms) | 44.6 / 85.0 ms (idle: 3.6 / 5.4 ms) | 1.6× p50, 1.13× p95 | What remains is the shared event loop and CPU, not the queue | Production builds (tsup) of the same tree with and without the change; v0.1.0 seed of the v0.2.0 regression report (5,000 docs, 2 workspaces, 3 × 2,000-row collections, 3,000 comments; `page_chunks` backfilled) restored into Postgres 16.15 in Docker on localhost; Node 22.23.4; Apple-silicon MacBook Air shared with other work (±20–30% between rounds). `fetch` load generator on the same machine, X-Forwarded-For rotated past the rate limits; per level 30 warm-up then 300 requests at 1 and at 16 concurrent clients; statements per request from `pg_stat_statements` over the 1-client run. Rounds interleaved (before, after, …): before 4 runs, after 2 runs of the final code (built before a later fix of the consumer's row order, `ORDER BY` on the numeric outbox id, which has no performance effect); cells are medians of the per-run p50/p95; 150 probe requests per run after 20 warm-up, background started 0.5 s before | [ADR 1080](adr/1080-change-log-through-a-transactional-outbox.md) |
| Title PATCH | Membership read under the write gate in the transaction (`gateWrite`, one statement for role + access version), no lock walk when the workspace has no locked page | 1 client p50 3.66–4.10 / p95 4.54–6.22 ms; 16 clients 21.4–22.5 / 26.9–34.1 ms; 14.0 statements | 3.54–3.65 / 4.53–4.74 ms; 18.5–20.6 / 24.8–26.4 ms; 13.0 statements | −1 statement; 1.0–1.2× p50 at 16 clients | Every gated write takes a share lock on the workspace's version row (a lock change waits for it) | Seed of the v0.2.0 regression report (v0.1.0 seed: 3 users, 2 workspaces, 5,000 docs, 3 × 2,000 rows, 26k links, 3k comments; upgraded by v0.2.0), restored from a dump before every round; production builds (`NODE_ENV=production`), Node 22.23.4, Postgres 16.15 in Docker (`pg_stat_statements`, `random_page_cost = 1.1`), Apple-silicon MacBook Air shared with other work. Before = the same tree without this change (it already contains other unreleased work, so its statement counts are higher than v0.2.0's); rounds interleaved before/after/v0.2.0 × 2, ranges over the 2 rounds; 30 warm-up, then 300 requests at 1 client and 300 at 16; statements = `pg_stat_statements` calls / requests (background work included) | [ADR 1071](adr/1071-workspace-access-version-and-write-gate.md) |
| Title PATCH under a lock (cached chain) | Lock chain cached per page and access version; denial re-checked uncached | Workspace with a lock on a depth-6 page, owner writing at depth 8: 3.42 / 4.66 ms; 21.9 / 31.4 ms; 14.0 statements. Member refused (403): 1.87 / 2.57 ms, 6.3 statements | 3.10 / 4.51 ms; 18.4 / 27.4 ms; 13.0 statements. Refused: 1.78 / 2.34 ms, 6.3 statements | −1 statement (the walk) per repeated write; refusal unchanged | One walk per page after each access change | Same setup, 1 round each, lock set before the run (v0.2.0: 3.44 / 4.17 ms, 26.3 / 91.1 ms, 9 statements) | [ADR 1071](adr/1071-workspace-access-version-and-write-gate.md) |
| Row property PATCH, comment POST | Role + access version with the membership statement (`requireMembershipAcl`); no role re-lookup, no walk without locks; row PATCH re-checks in the gate only when the version or role changed | Row 2.83–3.18 / 3.58–4.90 ms, 16 clients 15.1–17.7 / 19.9–26.5 ms, 10.0 statements; comment 2.44–2.98 / 3.19–4.46 ms, 16.2–17.7 / 18.4–20.8 ms, 12.5 statements | Row 2.68–2.78 / 3.37–3.50 ms, 14.5–16.9 / 18.9–24.3 ms, 9.0 statements; comment 2.30–2.36 / 2.94–3.38 ms, 14.8–14.9 / 17.2–17.8 ms, 11.5 statements | −1 statement each; 1.0–1.3× p50 | Row PATCH: gate statement in the transaction | Seed of the v0.2.0 regression report (v0.1.0 seed: 3 users, 2 workspaces, 5,000 docs, 3 × 2,000 rows, 26k links, 3k comments; upgraded by v0.2.0), restored from a dump before every round; production builds (`NODE_ENV=production`), Node 22.23.4, Postgres 16.15 in Docker (`pg_stat_statements`, `random_page_cost = 1.1`), Apple-silicon MacBook Air shared with other work. Before = the same tree without this change (it already contains other unreleased work, so its statement counts are higher than v0.2.0's); rounds interleaved before/after/v0.2.0 × 2, ranges over the 2 rounds; 30 warm-up, then 300 requests at 1 client and 300 at 16; statements = `pg_stat_statements` calls / requests (background work included) | [ADR 1071](adr/1071-workspace-access-version-and-write-gate.md) |
| Review score of one page (owner/living change, mark reviewed) | Change aggregation restricted to the page and its link neighbours instead of the whole workspace's `page_changes` | p50 117.2 ms (112.8–122.0) | p50 4.3 ms (3.6–14.3) | 27× p50; same stored row | None | Same seed + 300k `page_changes` over 60 days, 300k `page_reads`, 200k audit events; old and new statement alternated, 20 pages each, in-process call | `apps/server/src/review.ts` (`computeReviewScores`, `chgOnly`); equality test in `apps/server/src/aclVersion.db.test.ts` |
| Audit retention purge, nothing due (the usual hourly tick) | Per-workspace `LATERAL` range scan on a new `(workspace_id, created_at)` index instead of a join with the retention computed per row | 28.3–33.7 ms (Seq Scan of 200k rows, all removed by the join filter) | 0.4 ms (index scan, 0 rows) | ≈ 80× | One more index on `workspace_audit_events` | Same seeded DB, retention set to 3,650 days in a rolled-back transaction, 2 runs each; EXPLAIN ANALYZE | `apps/server/src/housekeeping.ts` (`purgeOldAuditEvents`), index in `db/schema-workspaceAdmin.ts`; test in `apps/server/src/aclVersion.db.test.ts` |
| Union-find `find` (shared module for islands and import grouping) | Union by size + path compression (`packages/shared/src/unionFind.ts`) instead of plain parent pointers | Worst-case inputs, n = 4,096: chain (n unions `union(0, k)` + n finds) 16,769,025 parent hops; binomial tree (height 12), n finds of the deepest leaf 49,152 hops | 8,189 hops; 4,107 hops (size only: 8,189 / 49,152; compression only: 16,376 / 4,107) | 2,048× fewer hops (chain), 12× (binomial) | None measurable (two `Int32Array`s per use) | Hop counter in the module, `apps/server/src/unionFind.test.ts` (asserts the bounds and prints the table); deterministic, no timing | [ADR 1120](adr/1120-union-find-module.md) |
| Link islands and unlinked pages (`GET /workspaces/:id/graph/islands`) | Connected components by union-find over the viewer's link graph, rebuilt per request under the graph's version ETag (no maintained structure: links can be deleted) | — (new endpoint); `/graph`'s node + link queries on the same data p50 52.3–56.6 / p95 62.4–66.0 ms | p50 56.5–62.6 / p95 71.8–91.4 ms, of which `components()` 2.4–2.9 / 4.3–7.8 ms | None claimed (new endpoint); union-find ≈ 4–5% of the request, the reads dominate | One scan of the workspace's pages and links per non-304 request | 5,000 pages, 26,000 random links (one giant island), `linkIslands()` called directly, 20 calls after 3 warm-ups, 2 runs (ranges); Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work (two other agents building and testing on the same machine) | [ADR 1123](adr/1123-link-islands-and-unlinked-pages.md) |
| Import attachments (zip, folder, Notion) | SHA-256 of each attachment; identical bytes stored once, later entries point at the first (`Map` from hash; Notion pages with the same id merged with `groupByKeys`) | Test archives: 3 asset entries (2 identical) → 3 stored files; Notion: 2 identical images → 2 files, 2 copies of one page → 2 pages | 2 stored files; 1 file; 1 page (subpage under it) | −1 file per duplicate (storage of each duplicate saved); merged count in the import report | Hashing ≈ 0.5–0.65 ms per MB of attachments (SHA-256 of 40 MB: 19–26 ms p50 over 3 runs of 6); end-to-end import time not measured | `apps/server/src/md/importDedup.db.test.ts` (counts of `files` rows and files on disk); hash timing `createHash` in Node 22.23.4 on the same machine | [ADR 1122](adr/1122-import-deduplication.md) |
| Version history storage, 4.5 MB page, 50 versions | Snapshot rows as Yjs V2 diffs from the previous version, a whole state every 10th row of a chain, rebase of the oldest kept row on prune (ADR 1100) | 50 whole V1 rows: 107.2–107.6 MB raw, 33.72–33.77 MB on disk; one version (median) 2.10 MB raw / 659 KB on disk | 6 whole + 44 diffs (max depth 9): 9.30 MB raw, 2.155–2.157 MB on disk; one diff (median) 64.1 KB raw / 15.0 KB on disk | −91.3 % raw, −93.6 % on disk (whole history); one version −97 % raw | A version is rebuilt from up to 10 rows; a bad row makes ≤ 9 later rows unreadable (409); due auto snapshots cost Node CPU (see Regressions) | `apps/server/scripts/snapshot-chain-bench.ts`: the production copy (4.50 MB, 1,989 top-level blocks; numbers only) replayed as 50 appends of 40 blocks through `writeBlocksToDoc` (DirectConnection, store hook, index pass), auto-snapshot throttle opened before each append so every store snapshots the version before it; in-process test app, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work (other agents ran test suites at the same time). 3 runs per tree interleaved (before, after ×3); latency n = 7 after one warm-up, ranges are over the runs' p50; on-disk = `pg_column_size` (after TOAST compression) | [ADR 1100](adr/1100-incremental-version-history.md) |
| Stored document size (`page_docs`) | Yjs V2 encoding for stored states, read in either format, converted on the next store (ADR 1101) | Production copy 4,499,751 B (V1); replayed page 4.318–4.330 MB raw, 1.361–1.363 MB on disk | 3,079,353 B (V2); replayed page 3.076 MB raw, 0.701–0.703 MB on disk | −31.6 % (production copy); −28.8 % raw, −48 % on disk (replayed page) | Tiny documents grow by 10–20 B (V2 fixed overhead); old servers cannot read V2 (`scripts/states-to-v1.ts` before a rollback) | Production copy: `Y.convertUpdateFormatV1ToV2` byte count. Replayed page: `apps/server/scripts/snapshot-chain-bench.ts`: the production copy (4.50 MB, 1,989 top-level blocks; numbers only) replayed as 50 appends of 40 blocks through `writeBlocksToDoc` (DirectConnection, store hook, index pass), auto-snapshot throttle opened before each append so every store snapshots the version before it; in-process test app, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work (other agents ran test suites at the same time). 3 runs per tree interleaved (before, after ×3); latency n = 7 after one warm-up, ranges are over the runs' p50; on-disk = `pg_column_size` (after TOAST compression) | [ADR 1101](adr/1101-yjs-v2-encoding-for-stored-states.md) |
| Collab store encode, 4.5 MB page | One V2 encode + state vector per store instead of the Database extension's V1 encode plus our V1 re-encode (ADR 1102) | 2 × `encodeStateAsUpdate`: p50 59.3–62.9 / p95 64.7–186.1 ms; with GC isolated before each step 183.0–186.3 ms | `encodeStateAsUpdateV2` + `encodeStateVector`: 27.0–29.1 / 29.9–35.7 ms; GC isolated 45.9–46.6 ms | 2.1–2.2× (4.0× with GC isolated) on every store, typing stores included | — | In-process A/B on the production copy decoded once, both variants alternating in one loop, n = 12–20 per run, 4 runs (2 with `--expose-gc` and `gc()` before each step), Node 22.23.4 | [ADR 1102](adr/1102-one-encode-per-store-one-decode-per-index-pass.md) |
| update_page append, 4.5 MB page (round 2) | ADR 1102 store + ADR 1101 V2 rows + ADR 1100 snapshots on top of ADR 1042 | Production copy p50 604.5–711.7 / p95 663.8–850.2 ms, loop max 259.9–396.4 ms, other requests p95 215.9–238.2 ms; synthetic 575.5–688.1 / 705.7–870.4 ms | 542.1–610.9 / 623.7–719.1 ms, loop max 311.2–366.0 ms, other requests p95 215.7–290.8 ms; synthetic 445.8–465.4 / 580.2–590.5 ms | 1.0–1.3× p50 (production copy), 1.2–1.5× (synthetic); loop max unchanged within spread | — | `apps/server/scripts/large-page-bench.ts` (unchanged): in-process test app, MCP over the in-memory transport, Postgres 16 in Docker, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Production copy (4.50 MB) and synthetic log (4.13 MB). Interleaved before, after, before, after; ranges over the 2 runs of each; n = 20 one-line appends (patch_section: to the middle section) | [ADR 1102](adr/1102-one-encode-per-store-one-decode-per-index-pass.md) |
| patch_section append, 4.5 MB page (round 2) | Same as above | Production copy p50 907.9–927.9 / p95 1,102.8–1,117.5 ms, loop max 608.7–756.5 ms; synthetic 758.9–778.3 / 913.1–943.3 ms, loop max 513.0–539.0 ms | 762.7–834.4 / 906.6–911.1 ms, loop max 473.4–492.3 ms; synthetic 614.1–813.6 / 701.2–1,133.0 ms, loop max 420.0–1,057.0 ms | 1.1–1.2× p50, 1.2× p95, loop max 1.2–1.6× (production copy); synthetic within spread | Other requests p95 got worse on the production copy (see Regressions) | `apps/server/scripts/large-page-bench.ts` (unchanged): in-process test app, MCP over the in-memory transport, Postgres 16 in Docker, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Production copy (4.50 MB) and synthetic log (4.13 MB). Interleaved before, after, before, after; ranges over the 2 runs of each; n = 20 one-line appends (patch_section: to the middle section) | [ADR 1102](adr/1102-one-encode-per-store-one-decode-per-index-pass.md) |
| Split a page into subpages, 4.5 MB page | Sections cut at top-level headings on the Yjs tree: clones of the containers into new `page_docs` rows in one transaction, one Yjs transaction on the live document, subpages indexed after the response (ADR 1140) | — (new; before: copy sections by hand) | Split at h2, document not loaded: production copy p50 731.4 / p95 742.9 ms, loop max 315.1 ms (163 subpages); synthetic 670.1 / 707.4 ms, loop max 306.7 ms (180). Open in another connection: 484.9 / 550.2 ms, loop max 226.4 ms; synthetic 475.6 / 578.4 ms, 210.5 ms. Other requests p95 5.9–9.9 ms. Subpage index passes after the response: 2,241.8–2,763.9 ms (p50) | Page left: 4,499,751 → 104,563 B stored, −97.7 % (production copy); 4,128,264 → 70,166 B, −98.3 % (synthetic) | Once per split: a "Before split" version; search lists the subpages ≈ 2–3 s after the response | `apps/server/scripts/split-bench.ts`, in-process test app, Node 22.23.4, Postgres 16.13 (Docker), Apple M4 / 24 GB; production copy (4,499,751 B V1, 163 h2 sections) and synthetic log (4,128,264 B, 180 h2 sections); 5 splits per case, a fresh copy per split, interleaved by case; event loop max at 2 ms resolution, probe = GET /backlinks of a small page every 10 ms | [ADR 1140](adr/1140-split-a-page-at-its-headings.md) |
| Split preview, 4.5 MB page | Plan + per-section copy sizes from the open document or one decode of the stored state; nothing written | — (new) | Production copy p50 259.7 / p95 312.8 ms, loop max 165.9 ms; synthetic 243.6 / 290.1 ms, 156.4 ms | — | Other requests p95 225.4–304.1 ms during previews (one decode each) | `apps/server/scripts/split-bench.ts`, in-process test app, Node 22.23.4, Postgres 16.13 (Docker), Apple M4 / 24 GB; production copy (4,499,751 B V1, 163 h2 sections) and synthetic log (4,128,264 B, 180 h2 sections); 10 sequential previews after one warm-up; event loop max at 2 ms resolution, probe = GET /backlinks of a small page every 10 ms | [ADR 1140](adr/1140-split-a-page-at-its-headings.md) |
| update_page append, rotation lookup | `update_page append` first asks `POST /pages/:id/rotation/target` (one statement: rotation row, current subpage, stored size from the TOAST header) | REST append alone: small page p50 17.2–23.2 / p95 21.8–29.0 ms; 4.5 MB page 390.5–563.4 / 461.1–889.1 ms | Target + append: small 21.0–26.3 / 25.0–30.5 ms; 4.5 MB 404.2–573.9 / 446.7–857.2 ms; target route alone p50 3.0–4.3 / p95 3.8–7.0 ms | — (cost row) | +3–4 ms per append (one more internal request) | `apps/server/scripts/split-bench.ts`, in-process test app, Node 22.23.4, Postgres 16.13 (Docker), Apple M4 / 24 GB; production copy (4,499,751 B V1, 163 h2 sections) and synthetic log (4,128,264 B, 180 h2 sections); 20 pairs per page, interleaved, order alternating, index passes flushed between calls, two runs; event loop max at 2 ms resolution, probe = GET /backlinks of a small page every 10 ms | [ADR 1141](adr/1141-logs-that-split-themselves-and-a-one-time-large-page-notice.md) |
| update_page append into a page that rotates monthly | Appends go to the current month subpage instead of the large page (ADR 1141) | Append into the 4.5 MB page itself: production copy p50 538.2–610.5 / p95 657.1–809.4 ms, loop max 353.6–367.0 ms, other requests p95 206.5–219.4 ms; synthetic 432.3–721.1 / 503.5–1,174.0 ms, loop max 260.7–460.6 ms | Same page with "one subpage per month": production copy 28.7–38.9 / 33.8–63.2 ms, loop max 8.0–15.4 ms, other requests p95 5.3–17.6 ms; synthetic 24.0–32.9 / 26.6–38.4 ms, 4.9–5.5 ms | 14–19× p50 (production copy), 13–22× (synthetic); the large page stops growing | Entries land on a subpage, not on the page addressed (the output says where) | `apps/server/scripts/split-bench.ts`, in-process test app, Node 22.23.4, Postgres 16.13 (Docker), Apple M4 / 24 GB; production copy (4,499,751 B V1, 163 h2 sections) and synthetic log (4,128,264 B, 180 h2 sections); 20 sequential MCP calls after one warm-up, two runs; event loop max at 2 ms resolution, probe = GET /backlinks of a small page every 10 ms | [ADR 1141](adr/1141-logs-that-split-themselves-and-a-one-time-large-page-notice.md) |
| Comment POST, events in the write statement | The comment, its notification row and its webhook rows in ONE statement that also takes the write gate (ADR 1151); NOTIFY only for rows another process can act on, after the commit, coalesced; notification consumer resolves a pass with 2 statements + 1 INSERT per event instead of 5 per event (ADR 1150) | 1 client p50 3.49–7.74 / p95 5.12–13.82 ms; 16 clients p50 20.6–24.2 / p95 27.2–42.0 ms, 605–741 req/s; 7.13 commits per request (1 client); 1 NOTIFY per request; `Lock:object` (NOTIFY commit lock) 0.88–1.08 connections; outbox empty 296–358 ms after the last response | 1 client p50 3.81–4.24 / p95 6.54–25.2 ms (a third round was disturbed: 13.76 / 33.83 ms); 16 clients p50 17.0–17.8 / p95 23.5–41.2 ms, 839–885 req/s; 6.17 commits per request; 0 NOTIFY; no `Lock:object`; outbox empty 43–47 ms | 1.16–1.42× p50 and +13–46% req/s at 16 clients; the consumer keeps up (outbox empty 6–8× sooner); p95 within the spread; none at 1 client | 1 client not faster (p50 +0.2–0.8 ms in the undisturbed rounds, within the spread); one share row lock on the workspace's access row per comment; `Client:ClientRead` waits 1.4–1.5 → 2.7–3.1 connections (more requests per second on the same Node process) | `apps/server/scripts/comment-post-bench.ts`: production builds (tsup) of the v0.5.0 tree without and with the change (the 'with' build = the same snapshot plus only these files, so other unreleased work is in neither); seed made by the script (51 users, 1 workspace, 2,000 shared doc pages created by 50 of them, 3,000 comments; every comment notifies the page's creator, nobody reaches the hourly cap), copied with `CREATE DATABASE … TEMPLATE` before every run; server as its own process (NODE_ENV=production, outbox worker on), Postgres 16.13 in Docker on localhost (`synchronous_commit = on`), Node 22.23.4, Apple-silicon MacBook Air shared with other agents' test runs (load average 4–13; ±30% and more between rounds). `fetch` load generator in another process, X-Forwarded-For rotated past the rate limits; per level 30 warm-up, then 300 requests at 1 and at 16 clients. Commits per request from `pg_stat_database.xact_commit` (11 s wait so idle backends flush; read statements count as commits; the script's own statements subtracted); NOTIFYs counted by a LISTEN on `inkling_outbox`; waits = average number of the app's active connections per wait event, `pg_stat_activity` sampled every 2 ms during the 16-client run; "outbox empty" = time from the last response until no pending row. `pg_stat_statements` is not loaded in this container, so statement counts are not comparable with older rows. Rounds interleaved, 3 per build, after first | [ADR 1150](adr/1150-events-in-the-writers-transaction.md), [ADR 1151](adr/1151-write-gate-on-comments-and-document-edits.md) |
| Webhook consumer (outbox topic `webhook`) | Delivery record + outbox finish + the hook's success reset in ONE statement (data-modifying CTEs) instead of the outbox UPDATE and a separate hook UPDATE; generic (signed JSON) deliveries add an HMAC-SHA256 per attempt and a workspace-name read cached 60 s (ADR 1191, 1190) | Slack, receiver answers at once: 422–492 deliveries/s (medians of 4 runs); 6.52–6.65 statements per delivery. Receiver 20 ms: 109–154 deliveries/s; 6.92–6.94 statements | Slack: 503–565 deliveries/s; 5.54–5.64 statements. Generic: 439–573 deliveries/s; 5.61–5.73 statements. Receiver 20 ms: Slack 148–150, generic 144–151 deliveries/s; 5.99–6.07 statements | −1 statement per successful delivery (−15%); throughput +2–34% for Slack at 0 ms (overlapping spread, load average 4–15), none at 20 ms (bound by the 4 deliveries in flight) | Generic: +0.07 statements per delivery (the cached workspace-name read); a delivery-record row per delivery (insert or update, index on `(hook_id, id)` and `outbox_id`), pruned to 100 per hook every 20 records | `apps/server/scripts/webhook-consumer-bench.ts`, in process: 25 fresh workspaces × 20 comment events (= the per-workspace token bucket, so the bucket never delays a row) queued with the consumer stopped, then drained to a local `node:http` receiver (`WEBHOOK_TEST_ALLOW_LOOPBACK=1`) answering 200 after 0 or 20 ms; statements counted with a drizzle query logger over the drain minus the loop's own polling reads (empty claim passes included). Before = the v0.6.0 tree's `apps/server/src` copied aside, run with the same script; scratch database migrated + this change's SQL, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other agents' test runs (load average 4–15). Interleaved before / after-slack / after-generic, 4 alternations × 3 rounds at 0 ms and 2 × 2 at 20 ms; ranges are over the per-run medians | [ADR 1191](adr/1191-webhook-delivery-records-and-resend.md), [ADR 1190](adr/1190-generic-webhooks-and-signatures.md) |
| New empty row (table/gallery "New row") | One row route (`POST /pages/:id/collection/rows`, template lookup + row cap + sort order in one pass over the children, no field load for an empty row) instead of `POST /pages` | p50 2.71–3.41 ms, p95 3.35–4.99 ms | p50 2.81–3.22 ms, p95 3.40–3.83 ms | none (same within noise) | One indexed lookup for the default template; the row cap is now checked for single rows (a count over the collection's children, the same rows `max(sort_order)` already reads) | In-process `app.inject` against Postgres 16.13 (Docker), Node 22.23.4, Apple M4; N=200 sequential requests per case after 20 warm-up, two rounds (cases forward, then reversed); collection with 4 fields, ≤ 440 rows; script described in ADR 1181 | [ADR 1181](adr/1181-one-create-path-for-rows.md) |
| New row in a board column / on a calendar day | Column value or date sent with the create (one request) instead of `POST /pages` then `PATCH /pages/:id/props` | p50 5.30–5.92 ms, p95 6.88–7.04 ms (2 requests) | p50 3.05–3.34 ms, p95 3.64–4.05 ms (1 request) | 1.6–1.9× | None measured | In-process `app.inject` against Postgres 16.13 (Docker), Node 22.23.4, Apple M4; N=200 sequential requests per case after 20 warm-up, two rounds (cases forward, then reversed); collection with 4 fields, ≤ 440 rows; script described in ADR 1181 | [ADR 1181](adr/1181-one-create-path-for-rows.md) |
| New row from a row template (new) | Title, 4 values and a 1.8 KB body rendered on the server, row + body in one transaction, body indexed after commit | — (no templates before) | p50 11.18–11.40 ms, p95 13.29–13.49 ms | — | About 8 ms more than an empty row in the same rounds; the work is the variable rendering, the body insert and the five index passes after commit (text, chunks, tags, tasks, links), as for a page made from a template. Not broken down further: a later run on a loaded machine put a values-only template (no body) between an empty row and a full one | In-process `app.inject` against Postgres 16.13 (Docker), Node 22.23.4, Apple M4; N=200 sequential requests per case after 20 warm-up, two rounds (cases forward, then reversed); collection with 4 fields, ≤ 440 rows; script described in ADR 1181 | [ADR 1181](adr/1181-one-create-path-for-rows.md) |
| Admin status summary `GET /api/admin/status` (new) | Heavy probes (statfs of DATA_DIR and the backup volume, `pg_database_size`, `sum(files.size)`, the site-wide large-page count, the stored-secret count, applied migrations) cached for 5 minutes with one in-flight computation; sidecar `status.json`, process counters and env flags read on every request (ADR 1230) | — (no endpoint before) | Cache miss (`?refresh=1`): p50 29.74–30.30 ms, p95 31.88–37.90 ms; cache hit: p50 0.57–0.58 ms, p95 0.72–0.84 ms, max 2.17–5.17 ms; heavy probes alone p50 28.76–29.87 ms | Hit 51–53× faster than a miss (p50); at most one miss per 5 minutes plus explicit rechecks | One round of 7 small queries (the large-page count groups every `page_chunks` row) and two `statfs` calls per 5 minutes; a just-measured disk value can be up to 5 minutes old | `apps/server/scripts/admin-status-bench.ts`: in-process Fastify app with the admin routes, `app.inject` as an admin session, 3 warm-up calls, then 30 misses and 200 hits sequentially, plus 10 direct `computeHeavyFacts()` calls. Seed: the database left by `pnpm test:db` plus 20,000 doc pages (20 with 1.2 MB states, 10 with 60k tokens), 201,938 `page_chunks` rows and 5,037 files (102 MB database, 34 large pages); `BACKUP_DIR` with a healthy `status.json`. Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other agents' test runs (load average 4.7–14.8); ranges over 3 runs | [ADR 1230](adr/1230-admin-status-summary.md) |
| Query block person / relation display (new) | Names and linked titles resolved after LIMIT in one pass: collections' field definitions, member names, linked pages, at most 3 statements whatever the row count (`query/cellRefs.ts`) | Statement only (ids shown): LIMIT 50 median 12.6 ms (p90 12.9); LIMIT 500 median 14.2 ms (p90 14.6) | Statement + pass: LIMIT 50 median 13.6 ms (p90 14.1), pass alone 1.3 ms; LIMIT 500 median 17.2 ms (p90 18.2), pass alone 3.4 ms | New work: +1.0 ms (50 rows), +3.0 ms (500 rows) for names instead of ids | Up to 3 extra statements per uncached query with person / relation columns | `TABLE Status, Owner, Depends FROM "Perf" LIMIT n` over a 2,000-row collection (person field over 4 members, 3 relation links per row), in-process (no HTTP, no rate limit), the three variants interleaved, 33 runs each, first 3 dropped; Node 22.23.4, Postgres 16.13 in Docker, Apple M4 | [ADR 1320](adr/1320-query-block-person-and-relation-display.md) |
| Query block WHERE / SORT on person and relation fields (new) | Per-property comparison key in its own lateral, computed only for properties WHERE / SORT use: member name (one users PK probe), titles of the visible linked rows (one pages PK probe per link, `LIMIT 1` so it stays a probe); field definition looked up once for value and key (`query/compile.ts`) | Stored ids compared (no names): `SORT Owner LIMIT 50` median 10.7 ms (p90 11.3); `WHERE Owner = "Bea Brown"` 10.2 (10.7), matched nothing; `TABLE Status, Owner, Depends … SORT Owner LIMIT 500` 22.5 (29.1); no person / relation in WHERE or SORT (`TABLE … LIMIT 500`) 21.1 (22.6); `WHERE file.name != "x" SORT file.name` 5.1 (5.2) | Names: 11.1 (11.8); 11.4 (11.9), 51 rows; 24.0 (27.5); unchanged 21.1 (22.6); 5.0 (5.2) | New behaviour; person keys +0.4 to +1.5 ms per 2,000 candidate rows; queries that compare no property run the same SQL as before | See the relation and select rows under Regressions | 2,000-row collection `Perf` (select, person over 4 members whose id order is the reverse of their name order, 3 relation links per row) + 3,000 plain docs, `FROM "Perf"`; compiled statement only, in-process (`SET LOCAL jit = off` like the route), 0.9.0 compiler and the new one interleaved, 33 runs each, first 3 dropped; Node 22.23.4, Postgres 16.13 in Docker, Apple M4 | [ADR 1352](adr/1352-query-block-compares-people-by-name-and-relations-by-title.md) |
| Later reminders, idle tick (new) | Due rows claimed through a partial index `later_items(remind_at) WHERE remind_at IS NOT NULL AND reminded_at IS NULL AND done_at IS NULL`, instead of a scan of the table | Without the partial index: p50 3.41–3.62 / p95 3.87–4.09 ms (Seq Scan, 25,000 rows removed by the filter, claim 0.948 ms) | p50 0.81–0.91 / p95 1.53–1.79 ms (Index Scan, claim 0.006 ms) | 4.0–4.2× p50 | One more index on `later_items`, updated on every save, done and reminder change; the tick runs at most once a minute when nothing is due | `apps/server/scripts/later-bench.ts`, in process with the outbox worker off (`OUTBOX_AUTORUN=0`), fresh migrated scratch database per run; 50 users, 1 workspace, 200 pages; `later_items` with 10,000 open reminders spread over the next 30 days (one every 4 min), 10,000 saved items without a reminder and 5,000 done items, `ANALYZE` after the seed. Idle tick = `runLaterSweep()` + the next-due `min(remind_at)` lookup the timer does, 5 warm-up + 50 sequential runs. Postgres 16 in Docker on localhost, Node 22.23.4, Apple M4 laptop (10 cores) shared with other agents' builds and tests; 2 runs, ranges over them | [ADR 1411](adr/1411-later-reminders-through-the-outbox.md) |
| Later reminders, 10,000 due at once (new) | Sweep claims 500 rows per transaction (`FOR UPDATE SKIP LOCKED`, `reminded_at = now()`) and queues their `notify` outbox rows in the same transaction; the unchanged notification consumer (50 events per pass) writes them | (no previous implementation) | Sweeps: 10,000 claimed in 20 sweeps, 444–460 ms (p50 21.8–22.0 ms per sweep of 500); notification consumer 3,181–3,259 ms; 10,000 notifications written; total 3,642–3,703 ms | None claimed (absolute cost of a backlog, e.g. after a long downtime) | The burst holds the notification consumer for about 3 s; other notification events wait behind it in id order | Same script and seed; then every open reminder set to `now() - 1 s`, sweeps run until one claims nothing, then `drainOutbox('notify')`; 2 runs | [ADR 1411](adr/1411-later-reminders-through-the-outbox.md) |
| Comment POST, author auto-follows the thread (v0.10.0 → v0.11.0) | Two more CTEs in the comment's single statement (ADR 1151): `UPDATE thread_follows` (read up to now) and `INSERT … ON CONFLICT DO NOTHING` of the author's follow row; reply recipients read from `thread_follows` instead of the thread's authors | 1 client p50 3.47–3.91 / p95 6.43–8.87 ms, 214–235 req/s; 16 clients p50 16.07–22.83 / p95 54.5–77.6 ms, 628–828 req/s; 6.16 commits per request (1 client), 5.17 (16 clients); 0 NOTIFY; outbox empty 45–57 ms | 1 client p50 4.07–4.36 / p95 6.93–10.93 ms, 192–208 req/s; 16 clients p50 16.21–17.37 / p95 56.6–75.2 ms, 746–807 req/s; 6.16 commits per request, 5.17–5.18; 0 NOTIFY; outbox empty 42–51 ms | — (cost row): 16 clients within the spread; 1 client slower in every round (see Regressions) | +0.4–0.9 ms p50 at 1 client (one index insert into `thread_follows` and its two partial indexes per new thread); no extra commit or statement round trip | `apps/server/scripts/comment-post-bench.ts` (unchanged, run from the v0.10.0 tree): production builds (tsup) of v0.10.0 (4476084) and of 9089d2a; each build started through a small entry file that sets `DRIZZLE_DIR` to its own tree, so the seed (made by the script, 51 users, 1 workspace, 2,000 shared doc pages, 3,000 comments) is migrated to 0038 and the after server applies `0039_v011_later_threads` (with the follow backfill, 3,000 rows) at boot on every fresh copy (`CREATE DATABASE … TEMPLATE`); server as its own process (NODE_ENV=production, outbox worker on), Postgres 16 in Docker on localhost, Node 22.23.4, Apple M4 laptop shared with other agents' work (load average 2.5–3.3). Every request starts a new thread, so the after build inserts one `thread_follows` row and its `read_up` UPDATE matches nothing; replies (followers read from `thread_follows`) not measured. Per level 30 warm-up, then 300 requests at 1 and at 16 clients; commits per request from `pg_stat_database.xact_commit` as in the ADR 1150 row; 4 rounds interleaved (before, after ×4), ranges over the rounds | [ADR 1412](adr/1412-followed-threads-and-the-inbox.md) |
| query_rows on a collection with automatic fields (0.17) | Automatic values in SQL only for the fields a filter or sort reads; the returned rows' values from a second read of those rows | 0.17 as first written (measured during the work, never released): 2,000 rows 27.7–29.6 ms p50, 20,000 rows 200.2–201.1 ms (every call built every automatic value for every row) | 8.3–8.4 ms, 32.2–33.6 ms | 3.4×, 6.1× p50; same as a collection without automatic fields (8.3 / 29.6) + ~3 ms | One more short statement per call with automatic fields; a filter / sort on an ID scans with that one value (20,000 rows 111 ms) | `apps/server/scripts/collection017-bench.ts`, filter `Points > 500`, sort `Points desc`, 25 rows; two interleaved runs per tree, N = 15 after 1 warm-up; Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon laptop shared with other agents (load 1.7–2.6) | [ADR 2192](adr/2192-query-rows-computes-automatic-values-only-when-read.md) |
| Page and row writes with the 0.17 ID trigger and last-editor update | `BEFORE INSERT` trigger on pages, `markEdited` UPDATE per logged change | 0.16: page create 4.36–4.67 ms p50, row create 4.58–4.77, props write 3.65–3.66, section write (N=300) 16.5–17.7 | 4.28–4.45, 4.76–4.80, 3.79–3.85, 16.9–19.2 | None on single writes (within noise; props write +0.15 ms) | Bulk inserts: see Regressions | Same script, N = 200 (writes), N = 300 × 3 pairs (section); 0.16 = `git archive bd30a54` with the same script, each tree on its own database, runs interleaved 0.16 → 0.17 → 0.16 → 0.17 | [ADR 2140](adr/2140-automatic-values-email-phone-and-unique-ids.md), [2141](adr/2141-last-editor-from-the-change-log.md) |
| Row numbers in bulk inserts (0.18, migration 0058) | `inkling_row_number()` keeps the ctid of the collection row version its transaction bumped last (transaction-local setting `inkling.row_seq_at`) and updates that version first; same UPDATE, WHERE and row lock as 0051, a stale note falls back to the 0051 lookup | 50,000 rows into an ID collection in one transaction, 1,000 per INSERT (sheet sync's shape): 41.1 s; statement 1 / 20 / 50: 95 / 699 / 1,460 ms | 3.7 s; statement 1 / 20 / 50: 68 / 60 / 92 ms (trigger disabled: 1.9 s) | −91 %, linear instead of quadratic | Single-row creates: insert p50 5–6 ms either way; the trigger's own time under an ID collection +~10 µs (76–162 → 85–170 µs per row over three runs), unchanged under plain parents | Postgres 16 in Docker, Apple-silicon laptop, scratchpad w18-bench (`sheet.ts` 50,000 rows, `single.ts` 1,000 single-row creates per parent kind, three runs); regression test `collectionQuery/rowNumberBulk.db.test.ts`: 20,000 rows in one transaction, last 3 statements vs first 3: 1.15x (0058) vs 4.5x (0051) | [ADR 2320](adr/2320-row-numbers-in-bulk-inserts-without-walking-row-versions.md) |
| Row writes with database automations (0.18) | Rules are queued by the change-log consumer from events writers already log; writers run no new statement | — | — | Row create p50 33.8 → 35.6 ms and 36.7 → 36.2 ms, props write 30.9 → 31.6 ms and 34.2 → 34.3 ms (no hook vs the shipped hook, collection without rules: within noise); change-log pass for one row's events p50 15.9 → 21.8 ms and 18.2 → 23.9 ms (+~5–6 ms: the one rules lookup per batch, off the request path) | The consumer pays one indexed query per batch with row events; bulk inserts are untouched (no trigger) | A/B in one process, hook toggled every iteration (scratchpad auto-hook-ab.mts, buildTestApp + POST …/collection/rows, PATCH …/props, drainChangeLog), N = 300 and 200 after 10 warm-ups; Postgres 16 in Docker, Node 22.23.4, Apple-silicon laptop **shared with four other agent streams at load 25–160 (absolute numbers inflated ~5×)** | [ADR 2240](adr/2240-database-automations-run-from-the-change-log.md) |
| Base vs 0.18 tree, collection017-bench --auto (0.18) | Same script on db0d9be and w18/auto, interleaved ×2 | page create 4.33 / 3.64 ms; row create (no ID) 7.00 / 5.87; row create (ID) 5.55 / 4.68; props write 4.29 / 3.88; insert 2,000 rows 244.6 / 171.2 ms; 20,000 rows 1,730 / 1,883 ms | 4.35 / 4.26; 8.05 / 7.27; 6.45 / 4.80; 4.21 / 4.08; 273.3 / 161.0; 1,535 / 1,653 | Not attributable: run-to-run spread larger than the difference **at load 10–23** (a third round at load 30+ swung base row create 5 → 45 ms and was dropped); the in-process A/B above is the measurement | — | collection017-bench.ts, N = 200 / 50, N_QUERY = 5, one database migrated to 0055 for both trees | — |
| Web push queueing in the notify consumer pass (0.18) | After a notify pass writes its notification rows, one statement inside a savepoint queues an outbox row per (notification, device) of the people who push that kind | 22.4 ms p50 (WEB_PUSH=off) | 25.0 ms p50 (push on, recipients without devices); 23.8 ms p50 (each recipient with one device: +50 outbox rows) | Within noise | One cached EXISTS and one INSERT…SELECT per pass when any subscription exists | 50 doc_mention events, one recipient each, drained in one `drainOutbox('notify')`; 40 rounds after 3 warm-up; local Postgres 16 in Docker, MacBook Air (Apple silicon), **other test suites running at the same time (noise of a few ms)**. Script: scratchpad push-bench/bench.mts (not in the repo) | [ADR 2222](adr/2222-push-deliveries-through-the-outbox-from-the-notification-rows.md) |
| Web clipper article extraction (0.18, `clip/extract.ts`) | Read-only string serialization and one walk over the elements, instead of changing the DOM (unwrap / removeChild) | 1.6 MB page with 8,000 paragraphs: cleanup step 3.4 s + cutting 1.0 s | the whole extraction of the same page ~0.35 s idle; 0.85–2.0 s **at load average 33** | ≥ 12× idle (Before counts two steps only) | Runs on the request thread (0.3–0.9 s CPU for such a page) | tsx, Node 22, M-series Mac, JSDOM 25 (server-util), 3 runs each | [ADR 2261](adr/2261-article-extraction-on-the-server-dom-without-readability.md) |
| Web clipper, pathological markup (0.18) | A linear pre-scan refuses nesting deeper than 400 levels; the HTML is cut at 20,000 tags | 3,000-deep nested `div`: parsing alone 8.7 s, extraction 53 s | refused in 5 ms | — | A page past the cut keeps the article text before it; a page nested deeper than 400 has no article text (saved as a link) | same conditions as the row above | [ADR 2261](adr/2261-article-extraction-on-the-server-dom-without-readability.md) |
| Onboarding checklist facts (0.19) | One statement of EXISTS subqueries per `GET /api/me/onboarding` while the card is open (`pages_created_by_idx` for pages, collections and links) | — | one statement per read; refetched on window focus, staleTime 30 s | — (feature cost) | one indexed statement per read | Not measured at scale | [ADR 2380](adr/2380-onboarding-state-per-person-new-accounts-only.md) |
| Instance fuse walk of the data folder (0.22.1) | 64 `lstat` calls at a time instead of one after another, each file and folder counted as `max(size, blocks × 512)`; a stale measurement answered at once and measured again in the background | 100,000 one-byte files: 882 ms, saw 100,000 B | 341–350 ms, saw 412.8 MB | 2.5–2.6× | Folders count their own blocks too; the first write after the fuse is released can still be refused once | 100,000 one-byte files on APFS (macOS); other conditions not recorded | [ADR 2545](adr/2545-small-files-and-indexes-count-toward-storage.md) |

Restricted mode (0.22, not measured; a description of the structure from the code). With a limit set, every
transaction that creates pages takes a transaction-scoped advisory lock per workspace (`ws-quota:<workspace>`) and
counts the workspace's `pages` rows under it; adding a member counts `workspace_members` under the member lock;
creating or taking over a workspace counts the person's owned workspaces under `user-ws:<user>`. With
`LIMIT_WORKSPACE_STORAGE_MB` an upload reads and updates the workspace's cached count in its transaction, each save of
a page body runs one `UPDATE … RETURNING` on the workspace row, a REST or MCP body write reads the workspace row and
the page's stored body size, and a full count (one statement over about a dozen tables of the workspace) runs every
hour for every workspace in turn, at a save when the cached count is more than 10 minutes old, when Workspace
settings › General finds it more than a minute old, and after a purge. With `LEGAL_DIR` each authenticated request
asks whether the person agreed: "agreed" is cached for 10 minutes (at most 20,000 entries), "not agreed" is read
from `user_consents` each time. With none of the settings the checks return before any SQL (a test passes them an
executor that throws), and a request costs one length check for the features turned off and one size check for
the request gates. Two things run without any setting: `GET /api/workspaces/:id/usage`, which Workspace settings ›
General calls on every server, runs the full count when the workspace's cached count is more than a minute old
(so at most once a minute per workspace) and stores it, and the hourly housekeeping runs two more `DELETE`
statements (old sign-up records and old `ip_bans` rows). `LIMIT_TRASH_DAYS` changes only the interval inside the
existing trash purge statement (`LEAST(trash_retention_days, cap)`); without it the statement is the 0.21.1 one. With
`LIMIT_WORKSPACE_STORAGE_MB` or `LIMIT_INSTANCE_STORAGE_MB` (docs/adr/2530-* .. 2533-*), every live-editing update is
counted before it is applied against sums in memory and a byte budget per client address (no SQL on that path; the
cached count is re-read in the background when older than 2 s), the writes that can grow a workspace run one
`UPDATE` adding the request's JSON size, and the fuse runs at most once a minute one `pg_database_size` query and a
walk over every file of the data folder. The only numbers are ADR 2530's, from the development server (`tsx`), not
a production build: 40 pages × 8 MB on one socket stored 18.0 MB under a 20 MB limit with resident memory 356 → 615
MB at the peak, against 320 MB stored and 2.1 GB before the fix.

Storage limit in 0.22.1 (not measured beyond the rows above; from the code, docs/adr/2545-*, 2548-*). With
`LIMIT_WORKSPACE_STORAGE_MB`, the full count also sums `pg_column_size` of the rows of seven index tables
(`page_texts`, `page_chunks`, `page_chunk_vectors`, `page_tasks`, `page_links`, `page_tags`, `page_former_titles`), and
each body store reads the page's workspace once more to take its turn with the recounts of that workspace. Without
the setting the count is the 0.22.0 statement and `noteBodyStore` returns before any SQL; on every server each index
pass increments one counter and makes one call that returns at once.

## Sync & collaboration

| Area | Change (what algorithm or structure) | Before | After | Improvement | Cost | How measured | Source |
|---|---|---|---|---|---|---|---|
| Collab WebSockets | One tab-wide multiplexed Hocuspocus socket instead of one per provider | 7 sockets open on the page, 13 created over the run | 1 open, 3 created (2 short-lived fallbacks) | 7× fewer open sockets | Fallback rules for duplicate, just-closed and denied documents | Production build, headless Chromium and WebKit, page with 5 page embeds, then 6 SPA navigations | [ADR 0702](adr/0702-shared-collab-websocket.md) |
| patch_section concurrency | Minimal Yjs edit (block alignment + character diff) instead of deleting and re-inserting the section | Concurrent typing kept in 1/6 scenarios; fuzz markers kept 0/240; block ids kept 0/4; callouts and mentions lost | 6/6; 240/240; 4/4; all kept | Correctness: no lost concurrent input in the tested cases | Echo before the patch ≈ 43 ms (100 blocks) / 94 ms (300 blocks); synchronous part in the transaction ≈ 9 / 15 ms | `apps/server/src/context/sectionPatch.test.ts`, old splice kept as `legacyPatch`; fuzz = 60 random sections and agent edits with a marker typed into every block | [ADR 0940](adr/0940-patch-section-minimal-yjs-edit.md) |
| Vault sync revision of a stored page (0.15.1) | State vector and delete set hashed from one `Y.decodeUpdateV2` of the stored state, so a pure deletion changes the revision | 3.0 ms (state vector only, 0.15.0) | 11.5 ms | None (a cost, for correctness) | Computed only for pages changed since the sync cursor; a two-pass variant (state vector, then decode) measured 14.4 ms and was rejected | 1.17 MB V2 state, 6,000 paragraphs with deletions and formats, Apple M-series, tsx, 20 runs after 3 warm-ups | [ADR 1920](adr/1920-vault-sync-revision-sees-deletions.md) |
| Vault sync, 1,000-file vault, rate limiter off (0.17) | Readiness work of 0.17 (create retry key, block tokens, directory renames and deletes, skip-and-list) | — (not measured at this size before) | vault → server, first sync (1,000 notes, 10 folders, 10% with `[[links]]`): 23.5 s, 1,112 requests; no-change re-run 0.4 s, 2 requests; server → vault, first sync (1,000 pages) 4.4 s, 12 requests; no-change re-run 0.3 s, 2 requests | — (a scale check, condition R14 of docs/VAULT-SYNC.md) | A `PUT` with a stale revision renders the note once more to compare it with the page before answering 412 (only on 412 paths; not measured) | `VSYNC_SCALE_N=1000 node ../../scripts/run-tests.mjs --db --test-name-pattern=scale` in apps/server (`vaultSyncScale.db.test.ts`; CI runs N = 100): the CLI run through tsx against a test Fastify app, local Postgres 16 in Docker, Apple M4 shared with other agents (load average 4–18, briefly 112) | [ADR 2166](adr/2166-vault-sync-retries-create-once-and-rewrite-nothing.md)–[2169](adr/2169-vault-sync-writes-embeds-as-block-tokens.md) |
| Vault sync, 1,000-file vault, rate limiter on (0.17) | Same, with the limits of index.ts (300/min, create/PUT 600/min) | — | vault → server, first sync 120.1 s, 1,117 requests, 5 waits on 429 (90.4 s at low load); no-change re-run 1.3 s, 2 requests; server → vault, first sync 15.5 s (load rose during the run); no-change re-run 0.6 s, 2 requests | — | The first upload of a large vault is paced by the rate limit | Same | Same |
| Document schema guard, server side (0.20) | Each loaded page remembers the schema it needs: a walk at load, then an `afterTransaction` handler that looks only at element children inserted in the transaction (text changes skipped at once, nothing once the page holds a group); older clients' authentication walks the page (live) or decodes `page_docs.state` | Without the handler: keystroke transaction on a 2,000-block page 3.0 µs; a new block in its 2,000-block top group 2.7 µs | With it: 2.6 µs; 50.4 µs. Walks: live page 0.65 ms (2,000 blocks, p95 0.91), stored state 12.4 ms (570 KB, p95 14.0); 200 blocks 0.02 / 1.1 ms | — (correctness feature) | +48 µs per new block in a 2,000-block group; a walk per older-client authentication, only while such clients exist. A deep observer (`observeDeep`, `event.changes.added`) cost 3.1 → 30.9 µs per keystroke and was replaced before release | `docSchema.ts` functions in a loop under tsx, Node 22, Apple-silicon MacBook Air shared with other work; synthetic pages of 200 / 2,000 blocks (a heading every 10 paragraphs) from `blocksToStateBuffer`; 7 interleaved rounds of 2,000 keystrokes / 200 inserts, medians; walks 25 runs each | [ADR 2425](adr/2425-older-clients-are-read-only-on-pages-with-newer-nodes.md) |
| Live editing against a storage limit (0.22.1) | Admission counts `cached use + 3 × (unsaved growth + update) + version copy`; the store reserves 2 bytes per body byte for the index and keeps that estimate until a recount sees the index pass; a stale recount runs after the store's upsert | One socket, 8 pages: prose 214 % of the limit after the recount (database +38 MB), random words 274 % (+96 MB), a workspace never recounted 317 % (+36 MB); 1 MB pastes page after page 106 % / 137 %; a 1 MB paste then typing: first read-only moment at a real use of 4.5 MB (2 s), at 5.5 MB 42 s with the editor lost; cache right after a store 0.00 MB | 71 % (+18.7 MB), 91 % (+24.9 MB), 95 % (+10.9 MB); 71 % / 91 %; first read-only moment at 5.5 MB; cache right after a store 3.58 MB (3.60 MB after the recount). Re-run on fafddbe: 71 % (+16.55 MB), 91 % (+25.47 MB), 95 % (+10.81 MB); a second re-run (tree not recorded): 71 % (+18.70 MB), 91 % (+25.58 MB), 95 % (+10.77 MB) | Storage after the recount 214–317 % → 71–95 % of the limit | Through the editor a workspace fills only to 71–91 % of its limit; content without an index counts × 3 for up to 40 s; one more read per body store with a limit (KNOWN-ISSUES LIMITS-45, LIMITS-46) | Production build, demo preset (10 MB limit, 448 MB heap), macOS, local Postgres 16 in Docker; scripts of the 0.22.1 measurement (one socket, 8 pages, about 1 MB pastes paced at about 3.5 MB/s, the count read 40 s after the last frame); before = 1e1d0cb, after = 34aff9c + 0f00809, re-runs as noted; one run per cell | [ADR 2548](adr/2548-store-estimates-stay-until-a-recount-sees-them.md) |

## Memory

Peak RSS delta is measured on the server process; heap is the JS heap after a forced GC.

| Area | Change (what algorithm or structure) | Before | After | Improvement | Cost | How measured | Source |
|---|---|---|---|---|---|---|---|
| Undo history | Cap the Yjs undo stack at 500 captures (trim at 550), un-keeping deleted structs | +3.88 MB heap, 4,997 stack items | +1.52 MB heap, ≤ 550 items | −61% heap growth | Edits older than 500 undo bursts cannot be undone | Headless Chromium, 5,000 programmatic captures with `stopCapturing()` between edits | [ADR 0701](adr/0701-yjs-undo-stack-cap.md) |
| Upload | Stream to disk through a byte-counting transform instead of `toBuffer` | +31 MB | +1–7 MB | 4.4–31× less | Needs free disk in `DATA_DIR` | 24 MB upload, fresh process per operation, same seed, original vs new code | [ADR 0751](adr/0751-stream-large-bodies-to-disk-and-copy-in-postgres.md) |
| Folder import | Stream each part to a temp dir and feed entries lazily, instead of buffering and re-zipping | +114 MB, 782 ms | +32–37 MB, 351–695 ms | 3.1–3.6× less memory, 1.1–2.2× faster | Temp files remain until `finally` or the next boot if interrupted | 2 × 20 MB assets + 8 Markdown files, same method | [ADR 0751](adr/0751-stream-large-bodies-to-disk-and-copy-in-postgres.md) |
| Duplicate / instantiate | `INSERT … SELECT … FROM unnest(old_ids, new_ids)` in Postgres instead of loading every state into a Map | +286 MB, 296 ms | +5–6 MB, 87–135 ms | 48–57× less memory, 2.2–3.4× faster | Only template pages containing `{{` are still decoded in Node | 99 docs (9.2 MB of Yjs state), same method | [ADR 0751](adr/0751-stream-large-bodies-to-disk-and-copy-in-postgres.md) |
| Public share pages | Render cache (see Server & database) | Peak RSS +88 MB | +5 MB | 17.6× less | Up to ~40 MB of cache in the worst case | 30 sequential views of a 93 KB-state page | [ADR 0753](adr/0753-public-share-render-cache.md) |
| 8 concurrent zip imports (4 people × 2) | Heavy-job cap: `HEAVY_JOBS_MAX` slots with a fair queue (default 2) | RSS rise 198–206 MB (peak 664–677 MB), burst 2.4–3.0 s | 2 slots: +104–142 MB (582–618 MB), 3.9–4.0 s; 1 slot: +74–80 MB (531–554 MB), 6.2–6.5 s | 2 slots: 1.4–2.0× less; 1 slot: 2.5–2.8× less | The burst takes 1.3–1.7× (2 slots) / 2.1–2.7× (1 slot) longer; the last request waits | `scripts/heavy-jobs-bench.ts`, one scenario per process (`--scenario`), 3 runs per setting interleaved; RSS sampled every 10 ms, rise = peak − RSS before the burst after a forced GC; client and server in one process (the shared request body counts once in both). Data: folder of 120 docs + 24 × 1 MiB incompressible attachments (24.9 MiB zip); import archive 60 docs + 20 × 1 MiB attachments (≈ 20 MiB). Before = the new code with `HEAVY_JOBS_MAX=100` (no effective cap; the upload path is already the spooled one). Node 22.23.4, Postgres 16.13 in Docker Desktop, Apple M4, scratch DB | [ADR 1240](adr/1240-heavy-job-concurrency-cap.md) |
| 4 concurrent zip imports | Same | +82–94 MB (550–570 MB), 1.4–5.0 s | 2 slots: +82–89 MB, 2.0–2.1 s; 1 slot: +65–66 MB, 3.2–3.4 s | 2 slots: none measurable (four 20 MiB jobs barely overlap at the peak); 1 slot: 1.2–1.4× less | Burst 2.0–2.1 s (2 slots) / 3.2–3.4 s (1 slot) against 1.4–1.7 s in two of three uncapped runs | Same | [ADR 1240](adr/1240-heavy-job-concurrency-cap.md) |
| 4 concurrent zip exports (24.9 MiB each) | Same (slot held until the stream ends) | +8–15 MB, 1.81–1.85 s | 2 slots: +7–19 MB, 1.85–2.0 s; 1 slot: +2–33 MB, 2.0–3.4 s | None measurable: exports already stream (ADR 0751) | Burst up to 1.1× (2 slots) / 1.9× (1 slot) longer | Same | [ADR 1240](adr/1240-heavy-job-concurrency-cap.md) |
| Aborted zip export | Destroy the open entry stream, temp dir and slot from the output stream's `_destroy` (B-M1) | 20 downloads dropped after 4 MiB: open fds 31 → 49 (+18, 3 of 3 runs) | 31 → 29 (no leak, 3 of 3 runs); 0 temp dirs, 0 running jobs left | fd leak 18 → 0 | Relies on JSZip / readable-stream 2.x internals | Same script, `abort20`; before = current code with the `_destroy` hook removed in a scratch copy; fds counted in `/dev/fd` 1 s after the last abort | [ADR 1241](adr/1241-zip-export-teardown-on-abort.md) |
| Single zip export (24.9 MiB) | Teardown and slot bookkeeping | 503–2,413 ms, median 526 ms (9 runs) | 503–625 ms, median 523–526 ms (9 runs each, 1 and 2 slots) | None (unchanged) | — | Same script, `export1` (second export of each process) | [ADR 1241](adr/1241-zip-export-teardown-on-abort.md) |
| Replace of a large body, 512 MB heap (0.22.1) | Edit budget per replace for ranges over 128 KiB (2,000 Yjs text operations, 40M diff steps), past it the changed block's content swapped whole; unchanged blocks skipped before any diff; many deleted blocks in one `toArray`; the parse DOM released after more than 64 KiB of Markdown; the throwaway documents read without copies | cookie random990: died at request 2 (1085 ms, stall ≤ 54.6 s, RSS ≤ 741 MB); cookie prose990: 6/6 ok, 2721–8609 ms, stall ≤ 5.6 s, RSS ≤ 889 MB; cookie random250 × 10: died at 8 (338–12441 ms, stall ≤ 9.6 s, RSS ≤ 902 MB); agent random990: died at 2 (1447 ms, stall ≤ 55.1 s, RSS ≤ 742 MB); agent prose990: died at 2 (4659 ms, stall ≤ 1.8 s, RSS ≤ 780 MB); agent random250 × 10: died at 8 (431–13169 ms, stall ≤ 9.6 s, RSS ≤ 904 MB) | cookie random990: 6/6 ok, 945–2497 ms, stall ≤ 1.1 s, RSS ≤ 520 MB; cookie prose990: 6/6, 3793–6219 ms, ≤ 2.4 s, ≤ 856 MB; cookie random250 × 10: 10/10, 323–1402 ms, ≤ 0.8 s, ≤ 372 MB; agent random990: 6/6, 1132–2124 ms, ≤ 1.0 s, ≤ 503 MB; agent prose990: 6/6, 3040–4951 ms, ≤ 2.3 s, ≤ 832 MB; agent random250 × 10: 10/10, 432–1498 ms, ≤ 0.8 s, ≤ 389 MB. Main re-run: cookie random990 6/6, 1.1–2.2 s, stall ≤ 1.07 s, RSS ≤ 509 MB; agent prose990 6/6, 3.3–5.3 s, stall ≤ 2.66 s, RSS ≤ 846 MB | Every case answers 200 and the server stays up (before: 5 of 6 cases died); longest stall 55.1 s → 2.4 s (2.66 s in the re-run) | Past the budget a changed block loses concurrent typing, underline, text colors and inline nodes the Markdown did not carry; ordinary Markdown of 990 KB still peaks at 832–856 MB of RSS, above a 768 MB container (KNOWN-ISSUES LIMITS-54) | Production build (`node --max-old-space-size=<heap>`) on macOS, machine class and Node version not recorded, local Postgres 16 in Docker. One account, one page, then N replaces of the whole body: about 990 KB (× 6) or 250 KB (× 10) of random words, or about 990 KB of ordinary Markdown (the repository's ADRs, "prose"); through `POST /api/pages/:id/content` with a cookie session or through MCP `update_page` with an agent connection token. RSS sampled every 100 ms; stall = the longest wait of a `GET /api/health` sent every 50 ms. Before = 1e1d0cb, after = 33c9aa5; one run per cell (an out-of-tree script); the main re-run was made separately on 33c9aa5 | [ADR 2550](adr/2550-edit-budget-for-one-replace.md), [ADR 2551](adr/2551-memory-of-a-large-markdown-replace.md) |
| Replace of a large body, 320 MB heap (0.22.1) | Same | cookie random990: died at 2 (1074 ms, stall ≤ 44.8 s, RSS ≤ 519 MB); cookie prose990: died at 2 (3445 ms, ≤ 1.4 s, ≤ 538 MB); cookie random250 × 10: died at 4 (340–9983 ms, ≤ 9.3 s, ≤ 593 MB); agent random990: died at 2 (1576 ms, ≤ 44.3 s, ≤ 521 MB); agent prose990: died at 1 (—, ≤ 1.3 s, ≤ 487 MB); agent random250 × 10: died at 4 (439–9860 ms, ≤ 8.4 s, ≤ 586 MB) | cookie random990: 6/6 ok, 1067–2265 ms, ≤ 1.0 s, ≤ 493 MB; cookie prose990: died at 2 (2527 ms, ≤ 1.4 s, ≤ 570 MB); cookie random250 × 10: 10/10, 340–1355 ms, ≤ 0.8 s, ≤ 378 MB; agent random990: 6/6, 1059–2327 ms, ≤ 1.1 s, ≤ 480 MB; agent prose990: died at 2 (3238 ms, ≤ 1.3 s, ≤ 547 MB); agent random250 × 10: 10/10, 419–1485 ms, ≤ 0.8 s, ≤ 381 MB | Random words survive (4 of 6 cases); ordinary Markdown of 990 KB still dies at the second replace | As above; ADR 2551: 800 KB of ordinary Markdown survives six replaces, 900 KB dies at the third to sixth | Same | Same |

## Rejected / no effect

Measured and not adopted, or adopted for reasons other than speed. "Before" is the kept or baseline
variant, "After" the variant that was tried.

| Area | Change (what algorithm or structure) | Before | After | Improvement | Cost | How measured | Source |
|---|---|---|---|---|---|---|---|
| Chart library chunk | Draw through the library's spec renderer `<Chart>` (its registry imports all 36 charts) instead of the 15 named components we offer | 138.6 KB raw / 48.1 KB gzip (named components, kept) | 290.5 KB / 98.5 KB gzip | −52% gzip for the kept variant | The kept variant maps spec → props itself (resolveDef + encodingToProps, as `<Chart>` does) | `vite build`, size of the lazy chunk; a split into basic + full chunks gave no gain (one module, shared chunk) | [ADR 1601](adr/1601-ztd-charts-behind-one-adapter.md) |
| Margin outline bars, 2,000-block page | Bars change colour with a 200 ms transition | No transition: scroll p95 18.6 ms | Transition: scroll p95 33.9–34.7 ms (4 runs); hiding the outline (18.3 ms) or turning transitions off (18.4 ms) restored it | 1.8× worse p95 | — | Same setup as the margin-outline row; isolated with injected CSS | [ADR 1220](adr/1220-mini-outline-in-the-margin.md) |
| Sidebar tree collapse exit, 1,000-item tree | Closing child list kept mounted 120 ms by re-rendering its rows (new `expand` prop reaches every memoized row), with `aria-hidden` and `pointer-events: none` on the list | Kept: closing list reuses the elements of its last open render — collapse of a 400-child folder, click → next frame 29.3–40.4 ms | Tried: 43.0–62.6 ms (dropping `aria-hidden`/`pointer-events` alone: 33.2–60.6 ms) | 1.5× worse at the click; not adopted | — | `treeperf.mjs` as in the tree-reveal row, 4 collapses per run, interleaved with the kept variant | [ADR 1281](adr/1281-motion-tokens-enter-and-exit.md) |
| find_context ranking | Link-graph proximity boost (+0.05 for pages linked to/from the top 3) | section@1 0.93 | section@1 0.93 | None; removed from the code | One extra `page_links` query | Large corpus of ADR 0927 with four cross links added | [ADR 0927](adr/0927-find-context-ranking-and-budget-packing.md) |
| find_context packing | Relative relevance floor 0.45 instead of 0.6 | 624 mean tokens at 0.6, success 0.93 | 1,416 mean tokens at 0.45, success 0.93 | Worse: 2.3× the tokens for the same success; 0.6 kept | — | Same benchmark | [ADR 0927](adr/0927-find-context-ranking-and-budget-packing.md) |
| find_context candidates | Trigram probe for every term ≥ 3 characters + ts_rank-only coarse order | Coverage order + trigram only for CJK: recall 0.93, p50 49 ms / p95 67 ms | Recall 0.75, p50 182 ms / p95 404 ms | Worse; rejected | — | Same 15k-chunk corpus | [ADR 0927](adr/0927-find-context-ranking-and-budget-packing.md) |
| find_context coarse order | First version: `ts_rank(tsv, query)` in the idf-weighted coarse SQL order, weights and title ILIKEs recomputed per row inside the sort expression | Kept version (no ts_rank, weights in a one-row materialized CTE, title flags once per row): dev MRR 0.897, recall@5 0.920; p50 40.7 ms / p95 102.0 ms | Same dev numbers; p50 60.3 ms / p95 165.8 ms (old code 27–28 / 70 ms in the same runs) | None for quality; the kept version is 1.5× faster | — | Interleaved A/B on a database holding four bench runs (larger table, same 15k-chunk workspace), 3 × 47 questions; dev numbers from `scripts/context-tune.ts` | [ADR 1210](adr/1210-find-context-idf-weighted-ranking.md) |
| find_context coarse order | Heading-path flags dropped from the coarse SQL order | With: dev recall@5 0.920, p50 38.4 ms | Without: dev recall@5 0.885 ("인덱스 정리" cut before scoring), p50 34.2 ms | Worse; kept the flags | ~4 ms p50 | Same setup | [ADR 1210](adr/1210-find-context-idf-weighted-ranking.md) |
| find_context per-page rule | No limit / hard limit 2 / hard limit 3 / 2 at full score then ×0.5, instead of 1 at full score then ×0.7 | 1 then ×0.7: dev MRR 0.897, nDCG@5 0.900, precision@5 0.806 | No limit 0.825 / 0.843 / 0.707; hard 2 0.862 / 0.874 / 0.748; hard 3 0.833 / 0.861 / 0.734; 2 then ×0.5 0.862 / 0.874 / 0.748 | Worse on dev; 1 then ×0.7 kept | — | Dev questions, large corpus, `scripts/context-tune.ts`, before the 30 contest notes were added | [ADR 1211](adr/1211-find-context-per-page-diversification.md) |
| find_context BM25 parameters | k1 = 2 or b = 0 instead of k1 = 1.2, b = 0.75 (b = 0.5 equal) | dev MRR 0.862 | 0.845 (both) | Worse; standard values kept | — | Same as above | [ADR 1210](adr/1210-find-context-idf-weighted-ranking.md) |
| Section full-text index | Expression GIN index on `to_tsvector(...)` (first version) | Stored vector: p50 ≈ 48 ms / p95 ≈ 68 ms | p50 182 ms / p95 404 ms | Worse; replaced by the stored column | — | 15k chunks, same data | [ADR 0926](adr/0926-section-index-and-stable-anchors.md) |
| Search plans | `enable_seqscan = off` instead of local `random_page_cost` | Local `random_page_cost = 1.1` | 1–2 character searches 9× slower (GIN full-index scan) | Worse; rejected | — | Seed of ADR 0755 | [ADR 0755](adr/0755-search-indexes-planner-costs-and-hot-updates.md) |
| Query blocks | Expression index `page_tags (lower(tag))` | 12.0 ms | 12.1 ms | None; not added | — | 5,000 docs seed of ADR 0203, median of 7 runs | [ADR 0203](adr/0203-query-language-parser-and-sql-compilation.md) |
| Zip export | Spill rendered entries to temp files, lazy asset streams | +49 MB peak RSS | +43–58 MB | No measurable change; kept on design grounds (bounded by one page) | Needs free disk in `DATA_DIR` | 99 docs (2.9 MB zip), fresh process per operation; at 990 pages one run each, too noisy to claim | [ADR 0751](adr/0751-stream-large-bodies-to-disk-and-copy-in-postgres.md) |
| JSON serialisation | Schema-based serializer for large responses | `JSON.stringify` 2.6 ms of a 26 ms DB query (4.6 MB collection) | Not built | Not worth it; 304s avoid the work instead (ADR 0752) | — | 10k-row collection GET | [ADR 0758](adr/0758-postgres-and-node-runtime-settings.md), [ADR 0759](adr/0759-hardware-cache-hot-loops-measured-and-rust-notes.md) |
| Collection GET hot loops | Monomorphic shapes / typed arrays for per-row loops | Row DTO spread 0.4 ms, `JSON.stringify` 2.6 ms, DB 26 ms | Not built | Cannot move the total; the driver materialising rows dominates | — | 10k-row collection GET | [ADR 0759](adr/0759-hardware-cache-hot-loops-measured-and-rust-notes.md) |
| Graph view | Structure-of-arrays (TypedArray) layout instead of d3-force node objects | Frame p50 16.7 ms, p95 16.8 ms (vsync-bound), one 57 ms task at start | Not built | No measurable gain at this size | Would mean re-implementing the force engine | Workspace with 2,335 pages, production build, headless Chromium, M-series Mac, first 6 s of simulation | [ADR 0710](adr/0710-graph-engine-soa-rejected.md) |
| WebKit editor blocks | `content-visibility: auto` variants in WebKit | Off: open 1,065 ms, relayout 40 ms, keystroke 33 ms | On (current CSS): 3,600 / 300 ms / —; plain `auto 60px`: 1,440 / 130–360 / 590 ms; `contain: layout style`: 1,435 / 195 / 200 ms | Worse in every variant; rejected (also 1/6 new blocks painted) | — | Playwright WebKit, production build, 3,701-block document, median of 3–5 runs | [ADR 0703](adr/0703-webkit-content-visibility-stays-off.md) |
| Math rendering in a Web Worker | KaTeX in one worker (queue, cancel, main-thread fallback) instead of main-thread 8 ms slices, both with paced insertion | Main thread: 1,000 formulas 2,776 ms first display, long task max 176 ms, typing p50 31.1 ms; 500: 1,249 ms, 70 ms | Worker: 2,584–2,616 ms, 169–176 ms, 29.9–30.5 ms; 1,224–1,272 ms, 71 ms | None measurable; removed | +77 KB gzip second download | Headless Chromium, Apple-silicon MacBook Air, production build, 1280×900, fresh profile per run, 1–2 runs (ranges); N formulas half display (≈110 chars) / half inline; typing = 43 keys at 60 ms, keydown → next frame. KaTeX alone: 0.6 ms per benchmark formula, ≤ 5.2 ms for 4,000-character worst cases (Node) | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math persistent cache | IndexedDB cache of rendered HTML (key: KaTeX version, options, latex, display mode) | Cold: 100 / 500 / 1,000 formulas first display 585–587 / 556–598 / 670–685 ms | Warm (second visit): 532 / 540 / 733 ms; long task 218 vs 169–171 ms at 1,000 | Within spread or worse; removed (memory LRU kept) | — | Same, 1 warm run after a first visit in the same profile | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math output format | KaTeX `output: 'mathml'` instead of `htmlAndMathml` | 500 formulas: 62,020 nodes, typing p50 21.5–21.8 ms; 1,000: 29.9–30.5 ms | 16,459 nodes, 12.5 ms; 14.4 ms | 1.7–2.1× p50, but Chromium draws ∑, limits and stretchy delimiters wrong; rejected | — | Same; appearance compared on screenshots | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math resident cap variants | Cap 50 / 200 display formulas; LRU instead of distance | Cap 100, distance: ping-pong re-insertions 126, scan 237 (1,000 formulas), typing p50 22.9 ms | Cap 50: 426 (OPT 321), typing 19.9 ms; cap 200: 0, typing 23.6 ms; LRU: 129, scan 301 | 50 thrashes, 200 gains nothing over 100, LRU re-inserts more on a scan | — | Same | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Math placeholders (first cap) | `min-height` / `min-width` reservation for evicted formulas, inline formulas evicted too | — | Scroll CLS 1.2–4.0 (scan), 6.7–11.4 (ping-pong) | Replaced by exact display boxes, no inline eviction: 0 / 0 | — | Same, caps 100–200 | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Section reads | LRU of decoded documents or blocks per (page, stored state) instead of index rows + range reads | — | One decoded Y.Doc of the 4.5 MB page holds 77.9 MB of heap | Not built: one entry would be a large share of the server's memory | — | `--expose-gc`, heap delta of `Y.applyUpdate` of the production copy, Node 22.23.4 | [ADR 1041](adr/1041-outline-and-section-reads-from-the-index.md) |
| Body append, collection row edit | Change log through the outbox (ADR 1080), no change of their own | Append 1 client p50 33.5 / p95 37.0 ms, 16 clients 185.9 / 215.0 ms; row edit 3.1 / 4.5 ms, 16.1 / 19.3 ms | Append 30.7 / 35.5 ms, 184.0 / 210.4 ms; row edit 3.0 / 4.5 ms, 16.2 / 20.3 ms | None beyond the spread between rounds | Statements per append 31.4–32.0 → 41.5–41.8 | Production builds (tsup) of the same tree with and without the change; v0.1.0 seed of the v0.2.0 regression report (5,000 docs, 2 workspaces, 3 × 2,000-row collections, 3,000 comments; `page_chunks` backfilled) restored into Postgres 16.15 in Docker on localhost; Node 22.23.4; Apple-silicon MacBook Air shared with other work (±20–30% between rounds). `fetch` load generator on the same machine, X-Forwarded-For rotated past the rate limits; per level 30 warm-up then 300 requests at 1 and at 16 concurrent clients; statements per request from `pg_stat_statements` over the 1-client run. Rounds interleaved (before, after, …): before 4 runs, after 2 runs of the final code (built before a later fix of the consumer's row order, `ORDER BY` on the numeric outbox id, which has no performance effect); cells are medians of the per-run p50/p95 | [ADR 1080](adr/1080-change-log-through-a-transactional-outbox.md) |
| Body append (REST `POST /pages/:id/content`) | Role + access version with the membership statement instead of `roleForPage` + lock walk | 1 client p50 24.1–26.9 / p95 30.3–32.7 ms; 16 clients 163.5–171.9 / 184.9–192.7 ms; 43.3 statements | 27.4–28.0 / 34.0–35.4 ms; 165.2–169.1 / 189.2–194.3 ms; 41.3–41.4 statements | −2 statements, no latency gain (1 client p50 +1–3 ms in 4 of 4 paired runs; server CPU equal: 7.25 vs 7.30 s for 330 requests in a CPU profile) | — | Same setup as the title PATCH row, 4 paired rounds (one with `--cpu-prof`); the request is dominated by the Yjs write, title resolver and store/index path | [ADR 1071](adr/1071-workspace-access-version-and-write-gate.md) |
| Audit retention purge, 100k rows due | Same index + per-workspace scan | 20 batches of 5,000: 345–361 ms | 330–332 ms | ≈ 5%; the DELETE itself dominates | — | Same seeded DB, whole purge in a rolled-back transaction, 2 runs each | `apps/server/src/housekeeping.ts` |
| MCP search / list_pages | Agent-block check from the version-keyed cache (one statement fewer per call) | search p50 12.4–13.6 ms, 7.37 statements; list_pages 51.5–52.5 ms, 6.36 statements (v0.2.0) | search 12.8–13.0 ms, 6.58; list_pages 53.0–53.2 ms, 5.78 (this tree) | Statements −0.8 / −0.6; latency within noise | — | Interleaved v0.1.0 / v0.2.0 / this tree × 2 on the same seed, 300 search and 100 list_pages calls each (v0.1.0: search 11.6 ms, list_pages 49.1–49.4 ms) | [ADR 1071](adr/1071-workspace-access-version-and-write-gate.md) |
| Cache replacement (section Markdown cache, lock-chain cache, math render cache) | SIEVE (NSDI '24) and S3-FIFO (SOSP '23) instead of LRU, Belady OPT as the bound | LRU hit ratio: agent section reads at the real 4M characters 78.1%; lock chains at 50,000 entries 69.4%; math formulas at 2,000 entries 84.3% | SIEVE 77.9% / 69.4% / 77.8%; S3-FIFO 77.8% / 69.4% / 84.5% (OPT 82.7% / 69.5% / 92.1%) | None: −6.5 to +0.6 pp at the real capacities (bar was +5 pp); on synthetic Zipf the FIFO policies win by 5–13 pp, but our caches see recency (session re-reads, scrolling) and version-bump cold misses; LRU kept, no code changed | — | `apps/server/scripts/cache-sim.ts`: same trace and capacity for every policy, 7 capacities per trace, simulated LRU checked against `BoundedLru`; traces = agent section-read model, lock-chain lookups with version bumps, formula scrolling, the large-page bench's own sequence, Zipf / scan / loop; seeds 1–3 (differences within 1 pp) | [ADR 1124](adr/1124-cache-replacement-lru-vs-sieve-s3fifo.md) |
| Index pass decode, 4.5 MB page | One decode shared by the mention walk and the BlockNote read, V2 bytes instead of V1 (ADR 1102) | `stateToBlocks(V1)` + mention scan: p50 126.1–127.2 / p95 187.6–195.7 ms; `applyUpdate` V1 alone 89.2 ms | One `applyUpdateV2` + walk + BlockNote read: 126.5–154.6 / 168.9–193.5 ms; `applyUpdateV2` alone 88.1–88.4 ms | No effect on this page (it holds no mention chips, so it decoded once before too; V1 and V2 decode cost the same) | — | One variant per process, 20 timed runs after 2 warm-ups, 2 rounds, production copy, Node 22.23.4. The saving (one fewer decode) applies only to pages containing the bytes "mention"; not measured on such a page. An apparent 55 ms cost of `Y.Doc.destroy()` in an interleaved A/B vanished with GC isolated (GC placement) | [ADR 1102](adr/1102-one-encode-per-store-one-decode-per-index-pass.md) |
| Version preview / compare / restore, 4.5 MB page | Versions rebuilt from a diff chain (whole row + ≤ 9 diffs) instead of one whole row (ADR 1100) | p50: preview oldest 19.6–118.9, middle 695.7–1,292.6, newest 1,367.6–2,229.4 ms; compare middle↔current 2,118.8–3,691.5, oldest↔newest 1,429.5–1,588.8 ms; restore middle 664.2–794.3 ms | 23.7–27.3; 853.2–936.4; 1,632.9–2,029.3 ms; 2,077.4–2,524.5; 1,425.4–2,963.3 ms; 790.6–2,784 ms | No measurable change: run-to-run spread exceeds the difference. Component: rebuilding a depth-9 version 109.6–115.5 ms vs applying the same version as one whole V1 state 121.9–140.9 ms | — | `apps/server/scripts/snapshot-chain-bench.ts`: the production copy (4.50 MB, 1,989 top-level blocks; numbers only) replayed as 50 appends of 40 blocks through `writeBlocksToDoc` (DirectConnection, store hook, index pass), auto-snapshot throttle opened before each append so every store snapshots the version before it; in-process test app, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work (other agents ran test suites at the same time). 3 runs per tree interleaved (before, after ×3); latency n = 7 after one warm-up, ranges are over the runs' p50; on-disk = `pg_column_size` (after TOAST compression). Component: in-process, chain read from the bench database, median of 8, one run with `gc()` isolation | [ADR 1100](adr/1100-incremental-version-history.md) |
| Editor: draw only the blocks near the viewport | Investigated (BlockNote 0.51.4 has no virtualisation; `content-visibility` lost typed text, ADR 0850) | Open the 4.5 MB production copy: 1,277–1,431 ms until > 1,500 blocks are in the DOM (2,011 blocks, 46.8k DOM nodes) | Not built | Rejected: no safe mechanism under the editor pins; splitting the page is the remedy (ADR 1103) | — | Production web build served by the server, Playwright `chromium-headless-shell` (build 1234), 1280×820, fresh context per open, n = 4 | [ADR 1104](adr/1104-editor-viewport-rendering-not-adopted.md) |
| Index the subpages before answering a split | `scheduleDocIndex` of every subpage inside the request (first version) instead of after the response | Kept (index after the response): p50 475.6–731.4 ms | Production copy p50 3,054.3 (uncontended smoke run, n = 2) – 12,813.7 ms (contended DB, n = 5), loop max 493.4–1,411.4 ms; synthetic 2,417.8 / 3,139.7 ms, 321.1 ms; subpage index phase 1,782.4–10,071.2 ms | Replaced: the request answers in 0.48–0.73 s and the same passes run after it | The request held for ≈ 10 ms × subpages, more under database load | `apps/server/scripts/split-bench.ts`, in-process test app, Node 22.23.4, Postgres 16.13 (Docker), Apple M4 / 24 GB; production copy (4,499,751 B V1, 163 h2 sections) and synthetic log (4,128,264 B, 180 h2 sections); same script, 5 splits per case (the 12.8 s run overlapped other test suites on the same Postgres); event loop max at 2 ms resolution, probe = GET /backlinks of a small page every 10 ms | [ADR 1140](adr/1140-split-a-page-at-its-headings.md) |
| NOTIFY on the comment path | `pg_notify` removed from the producer statements, nothing else changed (ablation build) | 16 clients p50 21.8–23.0 / p95 31.4–33.5 ms, 649–700 req/s; `Lock:object` 0.91–0.95 connections | 19.6–22.4 / 31.4–33.1 ms, 687–761 req/s; no `Lock:object` | None beyond the spread: the commit-time NOTIFY lock disappears and WAL flush / CPU waits take its place | — | Same script and machine, earlier seed (3 users; notifications reached the hourly cap during the 16-client run, so that run wrote none), 2 rounds interleaved. Kept anyway as part of ADR 1150 (no NOTIFY for rows only this process takes), because it removes a database-wide serialisation point, not for latency | [ADR 1150](adr/1150-events-in-the-writers-transaction.md) |
| Query block person / relation display | One users / pages lookup per row (and one collection lookup per row) instead of the batched pass | Batched: LIMIT 50 median 13.6 ms; LIMIT 500 median 17.2 ms | Per row: LIMIT 50 median 45.0 ms (p90 48.7); LIMIT 500 median 320.2 ms (p90 328.0) | 3.3× (50 rows) to 18.6× (500 rows) slower; rejected | — | Same runs as the adopted row (interleaved with it) | [ADR 1320](adr/1320-query-block-person-and-relation-display.md) |
| Query block relation key as a join | Linked pages joined to the list of ids (no `LIMIT 1` in the probe): the planner flattened it and bitmap-scanned the whole target collection (2,000 rows) for every result row | Kept (PK probe with `LIMIT 1`): `SORT Depends LIMIT 50` median 48.7 ms; `WHERE Depends = "…"` 59.2 ms | Join: 497.9 ms (p90 562.5); 490.7 ms (p90 574.9) | 10× slower; rejected | — | Same seed and method as the adopted row, 33 runs | [ADR 1352](adr/1352-query-block-compares-people-by-name-and-relations-by-title.md) |
| Query block relation key, other shapes | (a) `ORDER BY` inside each of the three aggregates plus de-duplication of repeated links (`GROUP BY`); (b) one pass over the list doing the shape check and the probes (`bool_and` + `LEFT JOIN LATERAL`) instead of a separate `NOT EXISTS` shape check | Kept (separate shape check, aggregates in probe order, duplicates kept): `SORT Depends` 48.7 ms, `WHERE Depends` 59.2 ms (33 runs) | (a) 52.5 / 63.6 ms; (b) 75.3 / 57.2 ms, with the de-duplication of (a) 66.0 / 60.3 ms | None or slower; not adopted | — | Same seed, 8 runs each (first 3 dropped), interleaved with the 0.9.0 compiler | [ADR 1352](adr/1352-query-block-compares-people-by-name-and-relations-by-title.md) |
| Reminders as future-dated `notify` outbox rows | Rejected: each reminder an outbox row with `available_at = remind_at`, no table of its own | One notification pass with one due event, 0 future rows: p50 2.55–2.58 / p95 2.70–2.81 ms | Same with 10,000 future-dated pending rows: p50 3.90–4.03 / p95 4.64–6.13 ms | Kept the table + sweep: every notification pass would pay +1.3–1.5 ms p50 (+51–58%) for reminders not due yet, and cancelling or moving a reminder would need an outbox lookup | — | `apps/server/scripts/later-bench.ts`; `enqueue` + `runNotifyBatch` of one event, 5 warm-up + 40 runs, before and after inserting 10,000 `notify` rows due over 30 days; 2 runs | [ADR 1411](adr/1411-later-reminders-through-the-outbox.md) |
| POST /mcp body in a worker thread (B-L10) | Rejected: parse in one `Worker` (buffer transferred, object structured-cloned back) instead of `JSON.parse` on the main thread | Main thread `JSON.parse`: value-heavy 1 / 4.1 / 8.2 / 12.4 MB 4.0 / 17.9 / 39.2 / 59.2 ms; string-heavy 1 / 3.8 / 7.6 / 11.4 MB 0.7 / 2.7 / 5.1 / 9.3 ms | Longest main-thread block: value-heavy 5.2 / 23.8 / 52.4 / 81.9 ms (the clone back is slower than parsing); string-heavy 0.1 / 0.3 / 0.8 / 3.1 ms | Worse for value-heavy bodies; better for strings but a thread, a parser without Fastify's prototype checks and a second error path; the value cap (ADR 1526) handles the expensive case | — | `apps/server/scripts/mcp-body-worker-bench.mjs`: same bodies as `mcp-body-bench.ts`, median of 7, `setImmediate` gap during the worker round trip; Node 22.23.4 | [ADR 1526](adr/1526-mcp-request-body-before-and-during-parse.md) |
| POST /mcp body limit 4 MB (B-L10) | Rejected: lower `bodyLimit` from 12 MB to 4 MB | String-heavy 11.4 MB: stall 29.7 ms | ≤ 9.7 ms (3.8 MB) | Caps the string case | Breaks folder imports between 4 and 12 MB that work today | Same runs as the POST /mcp body row | [ADR 1526](adr/1526-mcp-request-body-before-and-during-parse.md) |
| find_context with 8-character page ids (0.12) | Print the first 8 hex characters of each page id instead of the full id | 1,863 tokens (8 questions) | 1,758 | −5.6% | Ids feed patch_section/read_page, which would all need short-id support; bodies dominate the output | `scripts/mcp-token-bench.ts`: one 2,000-page workspace (padded evaluation wiki + synthetic folders, every page indexed), sequential in-memory MCP calls, warm; Node 22.23.4, Postgres 16.13 (Docker, arm64), Apple M4 24 GB, other test runs on the same machine at the time; same 8 dev questions | [ADR 1541](adr/1541-compact-lists-and-short-page-ids.md) Reason gone in 0.15.1: every tool accepts short ids (ADR 1941); adopted in ADR 1906 |
| Semantic scoring (0.14) | Dot products in SQL: `sum(a*b) FROM unnest(v.embedding, q)` over the rows, instead of vectors cached in process memory | In memory (kept): ~5 ms for the dot products | 360–420 ms per query | 72–84× slower; not adopted as the main path | — | 5,000 × 768-dim `real[]` rows, Postgres 16 (compose database container, OrbStack on the Mac), psql `\timing`, 2 runs | [ADR 1741](adr/1741-vectors-in-real-arrays-brute-force-cosine.md) |
| Semantic scoring (0.14) | Fetch the `real[]` rows into Node per query, then dot products | In memory (kept): ~5 ms | ~350 ms per query (wire + parse; the dot products 5 ms) | ~70× slower; not adopted | — | Same data, postgres.js, 3 runs | [ADR 1741](adr/1741-vectors-in-real-arrays-brute-force-cosine.md) |
| Korean compound splits (0.14) | Split readings for every query word with a prefix head, instead of only for compounds | Kept variant | Same quality on dev, +10 to +20 ms on queries with three-syllable words | Worse latency, no gain | — | `context-bench.ts`, same data as the 0.14 accuracy row | [ADR 1700](adr/1700-korean-partial-match-at-query-time.md) |
| query_rows formula cursor page (0.15) | Rejected: wrap the id set and rank maps as `(SELECT $1::jsonb)` (an InitPlan, parsed once per statement) instead of repeating the bind parameter per key part | Repeated parameter (kept): first page 89–121 ms, cursor page 161–172 ms | InitPlan: first page 89–121 ms, cursor page 161–172 ms | No change | — (the cost is in sending and parsing the repeated parameter, not per-row evaluation) | 20,000 rows, 12 runs each, same setup as the formula rows under Retrieval & MCP | [ADR 1826](adr/1826-formulas-in-query-rows.md) |
| find_context per-page rule (0.15.1) | Decay 0.6/0.8/0.9, cap 2 with decay 0.5/0.7, floor 0.5/0.55/0.65/0.7 instead of 1/0.7/0.6 | Kept 1/0.7/0.6 | Best alternative, decay 0.8: dev R@5 +0.008, MRR −0.015, P@5 −0.011; floor 0.55/0.5: +45/+141 tokens per question, no rank gain | Not adopted | — | context-tune.ts, dev 45 questions | [ADR 1903](adr/1903-per-page-rule-and-floor-re-measured.md) |
| find_context large-chunk cap share (0.15.1) | 0.25 / 0.33 / 0.4 / 0.5 / off | 0.4 kept as the guard for the field shape | No dev metric change at the default and 1,000 budgets; tokens per question 310 / 313 / 316 / 319 / 328 (URL rule off) | — | — | context-tune.ts | [ADR 1902](adr/1902-large-chunks-are-cut-around-their-best-lines.md) |
| find_context small-chunk weight (0.15.1) | minWeight 60 / 80 / 100 / 150 / score order | 80 adopted (the smallest that fixes the field query on the [db] corpus) | Bench corpus: identical; [db] corpus at 1,000: 60 → recall@5 0.981, answer in body 0.956; 80 to score order → 0.993 / 0.978 | — | — | context-tune.ts, dev | [ADR 1902](adr/1902-large-chunks-are-cut-around-their-best-lines.md) |
| find_context weak-answer hint threshold (0.15.1) | "Half or more" of the query's words in no result | Kept: more than half, and at least two | Half or more: 5 of 74 single-query questions got the line, all with a right answer at rank 1–2; kept rule: 0 of 74, and 1 of the 4 English-only cross-language phrasings | Not adopted | — | MCP outputs on the bench workspace | [ADR 1904](adr/1904-other-language-notes-guidance-and-weak-result-hint.md) |
| find_context thin-section threshold (0.15.1) | 4 / 8 / 16 / 30 letters | 8 kept | 4–16 identical; 30: dev MRR 0.896 → 0.885, +77 tokens per question | — | — | context-tune.ts | [ADR 1900](adr/1900-thin-and-title-only-sections-do-not-take-the-page-slot.md) |
| Index-side URL stripping (0.15.1) | CHUNKER_VERSION 5 with a URL-free search text | Query-time rule kept | Not built: Postgres already keeps URL paths as one lexeme; boot re-index ≈ 11.7 ms per page (≈ 2 min per 10k pages) | Rejected | — | context-bench index build, 5,000 pages in 58 s | [ADR 1901](adr/1901-urls-are-not-words-of-the-note.md) |
| Dropping maxLength/maxItems from the listed tool schemas (0.15.1) | Length caps only in zod, not in the list | Kept | ~270 tok of 11,923 | Not adopted | The list would advertise looser limits than enforced | `scripts/mcp-tools-list-cost.ts` (keyword census) | [ADR 1945](adr/1945-tool-list-without-sdk-defaults-and-one-copy-of-each-spec.md) |
| Short section anchors in the outline (0.15.1) | find_context's suffix anchors in `read_page(outline=true)` | Full anchors kept | — | Not adopted | A moved section's short anchor can resolve to another section (ADR 1960) | `toolSurface.db.test.ts` | [ADR 1942](adr/1942-ids-once-and-outline-without-repeated-headings.md) |
| Memory check as a catch_up option (0.16) | `check: boolean` + `parentId` on catch_up instead of a tool | — | ~84 tok in both profiles (vs 201 in full, 0 in core for check_notes) | Rejected | catch_up moves its marker and is a time window; a mode switch is harder for a model than a named tool | estimateTokens of the two schema properties and the description sentence | [ADR 2003](adr/2003-check-notes-memory-check.md) |
| Long-lived PDF worker pool (0.16) | Keep PDF workers between calls | Worker per call | Would save ~45 ms start-up per call | Rejected | A hostile document's state would outlive its call | Same PDF runs as the read_file row | [ADR 2048](adr/2048-pdf-limits-in-a-worker-thread.md) |
| find_context, several workspaces: "best workspace first" (0.17) | Answer from the best-matching workspace alone, others' fragments as pointers (`top` = workspace of result 1, `sum` = largest summed score) | rule off, 90 questions: dev MRR 0.897–0.910 / R@5 0.984, test 0.902 / 0.991; intrusion dev 0.082, test 0.076 | top: dev 0.879–0.899 / 0.935–0.954, test 0.897 / 0.966, intrusion 0.039–0.059 / 0.026; sum: dev 0.879 / 0.935, test 0.872 / 0.940 | MRR −0.005 to −0.03, recall@5 −0.025 to −0.05; intrusion about halved. Rejected; the switch was removed at integration | Answers lost when result 1 is in the wrong workspace (3 of 12 new questions) | context.db.test.ts "several workspaces": a member of the main eval workspace with two more contest workspaces (12 new questions, dev 6 / test 6), MCP find_context without workspaceId, 2 runs (test split once, `INKLING_EVAL_FINAL=1`). "Intrusion" = share of the first five shown fragments whose page is in another workspace than the answer, averaged per question; the several-workspace numbers vary by about one question between runs (multi-ws dev MRR 0.917 in one run, 0.806 in the other) | [ADR 2188](adr/2188-best-workspace-first-measured-and-not-adopted.md) |
| MCP search heading grades (0.17) | Two correlated `EXISTS` probes on `page_chunks` per candidate (heading whole word, heading contains) | (kept: one grouped join of the candidates' section rows) | ≈ 10 µs per probe; a short first run (N = 10, 10,000 pages in the database) put "ai" in one workspace at 194 ms vs the web route's 115 ms | Rejected | ×2 probes per candidate | search-bench.ts, early run; probe cost measured with a `count(*) FILTER` over 10,000 bodies (96 ms) | [ADR 2183](adr/2183-search-ranking-and-one-agent-search-route.md) |
| MCP search heading grades, workspace scan (0.17) | Heading flags from a scan of every section row of the searched workspaces (`workspace_id = ANY`, `heading_path ILIKE`) | (kept: join on the candidates) | "zanzibar", one workspace: 6.32 ms p50 vs 3.82 ms before (the scan costs the rare word) | Rejected | — | search-bench.ts, N = 100 | [ADR 2183](adr/2183-search-ranking-and-one-agent-search-route.md) |
| MCP search body grade (0.17) | Body whole-word regex in a second join of `page_texts` after the heading join | (kept: regex inside the candidate CTE, skipped for title matches) | "ai", one workspace: 78.53 vs 71.83 ms p50 (each body read twice) | Rejected | — | search-bench.ts, N = 40 | [ADR 2183](adr/2183-search-ranking-and-one-agent-search-route.md) |
| query_rows, automatic-value columns in the sorted statement (0.17) | One statement with the source columns, values filled in JS | — | 20,000 rows 38.3–39.3 ms (vs 32.2–33.6 ms for the kept two-statement path) | Rejected | The timestamp formatting runs for every row that passes the filter | collection017-bench.ts, as in "Server & database" | [ADR 2192](adr/2192-query-rows-computes-automatic-values-only-when-read.md) |
| Row numbers in bulk inserts, other designs (0.18) | (a) tid note + a "no ID field" note for plain parents, made safe with `FOR SHARE` on the collection row; (b) EXISTS probe before the UPDATE | (a) 50,000 rows 6.2 s; (b) same chain walk as 0051 | | | (a) slower and needs a reset in the backfill trigger; (b) helps only parents without an ID | same scripts (`fns.ts` FN_V2, FN_SEL) | [ADR 2320](adr/2320-row-numbers-in-bulk-inserts-without-walking-row-versions.md) |
| Database automations from a Postgres trigger or a per-route rule lookup (0.18) | Rules found by a database trigger on every write, or looked up in each write route | — (not measured) | | | Rejected: would add a statement per row on every write, on top of the 0051 trigger's +27–30 % on bulk inserts | — | [ADR 2240](adr/2240-database-automations-run-from-the-change-log.md) |
| An in-process "workspace has rules" cache to skip the consumer query (0.18) | Cache per process whether a workspace has rules | — (not measured) | | | Not done: saves the ~5 ms per change batch, but a rule made on another process would be missed until the cache expires | — | [ADR 2240](adr/2240-database-automations-run-from-the-change-log.md) |
| Web clipper extraction, other designs (0.18) | `querySelectorAll('*')` and attribute reads to drop junk: ~0.8 s per 1.6 MB page, replaced by a firstElementChild walk; a tag limit of 40,000 (0.5–1.8 s) lowered to 20,000 | | | | | same conditions as the extraction row under "Server & database" | [ADR 2261](adr/2261-article-extraction-on-the-server-dom-without-readability.md) |
| find_context shorter form | As one more variant of the word (prefix search, shared df) instead of a discounted title/heading signal | Separate signal: recall dev MRR 0.938, page@3 1.000; + padded page@3 0.938; private page@1 0.944, 1,770 tok | Variant: 0.844 / 0.938; 0.875; 0.889, 1,847 tok | Worse; rejected | — | `context-tune.ts` dev, private check | [ADR 2401](adr/2401-shorter-form-of-a-korean-compound-in-titles-and-headings.md) |
| find_context rare-word rule | rareFactor 0.6 instead of 0.75 | padded existing dev MRR 0.896 (ratio 1.15) | 0.885, unpadded recall@5 0.993 → 0.970 | Worse on the existing set; 0.75 kept | — | `context-tune.ts` dev | [ADR 2402](adr/2402-a-chunk-without-the-rare-query-word-keeps-three-quarters.md) |
| find_context rare-word rule | rareRatio 1.0 (always) instead of 1.1 | unpadded dev MRR 0.941 | 0.919 | Worse; 1.1 kept | — | Same | [ADR 2402](adr/2402-a-chunk-without-the-rare-query-word-keeps-three-quarters.md) |
| Semantic search with `multilingual-e5-small` (0.20) | `intfloat/multilingual-e5-small` (384 dimensions) through `EMBEDDING_*` with the role prefixes of ADR 2404 (`"query: "`, `"passage: "`), fused into find_context by the 0.20 code as it is (semantic candidates below `SEMANTIC_RELATIVE_FLOOR` = 0.6 × the best cosine dropped), instead of semantic search off | Off. Padded + 5,000 pages (15,806 chunks; 45 dev and 33 test questions): dev page@1 0.867, MRR 0.907; test page@1 0.848, MRR 0.909; tokens/question 318.5 (dev) / 271.4 (test). Recall set (16 dev and 16 test questions), own 3 workspaces: dev page@1 0.938, test 0.750. Private copy (36 questions, 4,873 chunks): page@1 0.944, page@3 0.972, MRR 0.964, 1,802 tokens. Latency, 78 q: p50 47.6 / 47.3 ms, p95 108.6 / 104.9 ms; 32 recall q: p50 40.8 / 41.2 ms, p95 158.0 / 170.6 ms | e5: padded dev page@1 0.844, MRR 0.873; test page@1 0.939, MRR 0.962; tokens/question 1,982 / 2,048.1. Recall, own 3 workspaces: dev 0.813, test 0.875. Private copy: 0.917, 1.000, 0.954, 2,994 tokens. Latency, 78 q: p50 81.0 / 86.6 ms, p95 145.3 / 156.5 ms; 32 recall q: p50 80.4 / 77.9 ms, p95 227.6 / 194.5 ms | Mixed: test page@1 +0.091 and recall test +0.125, but dev page@1 −0.023, recall dev −0.125, private page@1 −0.027 (page@3 +0.028); tokens 6.2× / 7.5× (bench), 1.66× (private); p50 +33.4 / +39.3 ms (78 q) and +39.6 / +36.7 ms (recall), per off/on pair. Not adopted: code and defaults unchanged; docs/OPERATIONS.md (semantic search) points here | Precision@5 of the shown sections (padded) falls from 0.799 / 0.849 to 0.213 / 0.222: many more sections are shown. Likely cause, not isolated by any run: the relative floor of 0.6 × the best cosine lets most e5 candidates through. Without the prefixes (same data): padded test page@1 0.939, dev 0.844, tokens 1,627.2 / 1,764.8; private page@1 0.889, page@3 1.000, 2,890 tokens. Embedding the bench: 16,178 chunks in 129 s | `apps/server/scripts/context-bench.ts --pages 5000 --final` on a freshly migrated database per run, Postgres in Docker (version not recorded). Embeddings from a local OpenAI-compatible server (sentence-transformers on Apple MPS, sequences cut at 512 tokens). Private check: 36 questions written from page titles as remembered, on a local copy of a production database, through the MCP `find_context` tool (the private row above calls findContext directly, hence 1,770 there and 1,802 here); numbers only, nothing copied. Latency: find_context through the MCP tool, result cache off, first round (cold query embedding), off and on runs interleaved twice. Node version, machine model and tree commit not recorded | Measured on 2026-11-11 for [ADR 2404](adr/2404-embedding-role-prefixes.md) with scripts outside the tree; raw output not kept in the repository |

## Regressions

Measured slowdowns that were accepted on purpose.

| Area | Change (what algorithm or structure) | Before | After | Improvement | Cost | How measured | Source |
|---|---|---|---|---|---|---|---|
| update_page replace (0.12) | Minimal edit of the whole document (block alignment + character diff, dry run on a copy) instead of deleting and rebuilding every block | Rewrite p50: small 4.6–5.1 ms, 100-block section 30.3–31.2 ms, 1.4 MB page 353.0–581.8 ms | Minimal edit 7.8–8.5 ms, 46.9–49.2 ms, 702.3–1,146.8 ms | Slower (1.5–2.0×) — accepted: blocks sent back unchanged keep ids (comment anchors), colors, toggles, widths, callouts, embeds, chips and concurrent typing (census: 22 losses → 0) | One extra full read (dry run) and the echo; echo skipped above 2,000 blocks | `apps/server/scripts/section-write-bench.ts` (in-process core, no database: parse, echo, synchronous patch; read = section blocks on a copy + Markdown). Synthetic pages: small 5 sections × 6 blocks (14 KB state), one 100-block section (123 KB), 180 sections × 10 blocks + a 10×5 table every third section (1.4 MB); the agent changes one word. Before = a copy of the working tree before this change (v0.11.0 plus other 0.12 work in progress) beside the new one, interleaved before, after, before, after; one warm-up excluded, n = 8, both implementations in the same process, alternating per iteration; ranges over the 2 runs of each. Node 22.23.4, Apple-silicon MacBook Air shared with other agents' test runs (±30% between rounds) | [ADR 1500](adr/1500-agent-markdown-notation-for-custom-nodes.md) |
| Large-document open (Chromium) | Removed `content-visibility: auto` from editor blocks in every engine (typed text was lost after Enter) | Open 320 ms; typed text lost in 17/20 runs | Open 455 ms; 0/20 lost | Correctness fix | +135 ms to open a 3,701-block document; relayout after a width change loses the skip | Open times from ADR 0703 (Playwright Chromium, production build, 3,701 blocks); loss from a strict Playwright repro, 20 runs per scenario | [ADR 0850](adr/0850-editor-blocks-without-content-visibility.md), [ADR 0703](adr/0703-webkit-content-visibility-stays-off.md) |
| Math pages, layout shift on open | Formulas replace placeholders that hold their source text | Plain-text control CLS 0.004 | CLS 0.06–0.09 (every variant, first version included) | Accepted | Placeholders size from estimates until a formula was seen once | Headless Chromium, Apple-silicon MacBook Air, production build, 1280×900, fresh profile per run, 1–2 runs (ranges); N formulas half display (≈110 chars) / half inline; typing = 43 keys at 60 ms, keydown → next frame | [ADR 0998](adr/0998-math-render-scheduling.md) |
| Index pass of a long page | Section index covers the whole page (ADR 1040) | `chunkBlocks` 18.3–23.4 ms; first index write 91.8–158.2 ms (130 rows) | 42.9–49.6 ms; 260.7–349.8 ms (490 rows) | Accepted: the cost of indexing what was missing | +25 ms CPU per index pass of the 4.5 MB page; first write (upgrade backfill, import) 2–3× | Production copy, 3 fresh pages per tree, `chunkBlocks` called directly and `reindexPageChunks` timed, 1 run per tree | [ADR 1040](adr/1040-index-the-whole-page.md) |
| find_context with a long page in the workspace | More rows to rank (whole page indexed) + `large` flag in the agent-context query | p50 4.4–5.8 / p95 5.7–8.8 ms (synthetic), 6.9–7.5 / 9.0–9.2 ms (production copy) | 11.3–12.5 / 15.8–15.9 ms, 9.5–11.7 / 12.1–12.5 ms | Accepted | +3–7 ms per call on a workspace holding one 4 MB page | `apps/server/scripts/large-page-bench.ts`: in-process test app (real routes + Hocuspocus), MCP over the in-memory transport, Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Pages: copy of the production page (4.50 MB state, 170 sections, 1,989 blocks, 192 tables; numbers only) / synthetic log (4.13 MB, 181 sections, 1,802 blocks, 181 tables). Sequential calls, one warm-up excluded; event-loop max via `monitorEventLoopDelay` (2 ms); "other requests" = GET /backlinks of a small page every 10 ms during the run. Before/after interleaved (before, after, before, after); ranges are over the 2 runs of each; n = 10 | [ADR 1040](adr/1040-index-the-whole-page.md), [ADR 1043](adr/1043-large-page-hint-for-agents.md) |
| find_context latency, ranking | Per-word flags over every candidate row for document frequencies (`matched`/`df`/`scope` CTEs), idf-weighted coarse order with title and heading flags, a second small query for page anchors, BM25 + adjacency in Node | p50 26.6 ms, p95 63.3 ms, max 76.3 ms | p50 35.3 ms, p95 88.7 ms, max 93.1 ms | Accepted | +8.7 ms p50 (+33%), +25.4 ms p95 (+40%) on a 15,693-chunk workspace; mean 204 candidate rows | Interleaved A/B in one process on the same fresh database (old and new `findContext` alternating per question, order swapped each round), 5 rounds × 47 questions, 5 warm-up calls excluded, direct calls without MCP. Data and environment as the location row. The sequential bench line of the same runs: p50 32.5 → 37.0 ms, p95 103.0 → 111.7 ms | [ADR 1210](adr/1210-find-context-idf-weighted-ranking.md) |
| First outline read after a restart | Decode + chunk-hash comparison to adopt the index (ADR 1041) | 170.6–195.4 ms | 191.7–236.1 ms, then 6.8–8.2 ms for every later read | Accepted (once per page per process) | +20–40 ms on the first read | Production copy, 3 fresh pages per tree, 1 run per tree | [ADR 1041](adr/1041-outline-and-section-reads-from-the-index.md) |
| Comment POST | Notification events in the outbox (one insert + a consumer transaction that deletes the row with the notifications) instead of an in-memory queue (ADR 1081) | 1 client p50 2.4 / p95 3.3 ms; 16 clients 12.0 / 15.7 ms, 1,298 req/s | 2.7 / 3.9 ms; 16.5 / 19.5 ms, 956 req/s | Accepted: events survive a crash and are written exactly once | +4.5 ms p50 at 16 clients; statements per request 8.9 → 11.9 | Production builds (tsup) of the same tree with and without the change; v0.1.0 seed of the v0.2.0 regression report (5,000 docs, 2 workspaces, 3 × 2,000-row collections, 3,000 comments; `page_chunks` backfilled) restored into Postgres 16.15 in Docker on localhost; Node 22.23.4; Apple-silicon MacBook Air shared with other work (±20–30% between rounds). `fetch` load generator on the same machine, X-Forwarded-For rotated past the rate limits; per level 30 warm-up then 300 requests at 1 and at 16 concurrent clients; statements per request from `pg_stat_statements` over the 1-client run. Rounds interleaved (before, after, …): before 4 runs, after 2 runs of the final code (built before a later fix of the consumer's row order, `ORDER BY` on the numeric outbox id, which has no performance effect); cells are medians of the per-run p50/p95 | [ADR 1081](adr/1081-notifications-and-webhooks-through-the-outbox.md) |
| changes_since right after a write | Existence probe for pending change rows, then the reservation under the writer lock (ADR 1080) | p50 1.3–2.4 / p95 2.0–5.7 ms; the change was in the answer 60/60 | 3.4–5.0 / 4.5–7.9 ms; 60/60 | Accepted: ordering is enforced in the database, no request-wide queue | +2 ms per call | Same setup; title PATCH, then `GET /api/changes?detail=none` with the previous cursor, 60 times per run; ranges over 4 runs each (after: 2 of an earlier variant of the consumer included) | [ADR 1080](adr/1080-change-log-through-a-transactional-outbox.md) |
| Write → visible to other `page_changes` readers | Background consumer instead of a write before the response (ADR 1080) | Row present when the response arrives (one poll query: p50 0.16–0.42 ms) | p50 1.6–3.7 / p95 2.3–8.4 / max 4.5–139 ms; another process's commit: 9–10 ms (LISTEN) | Accepted: activity, provenance badge and review scores may lag a write by milliseconds; bound 1 s poll | — | Same setup; title PATCH, then `SELECT` the row in a ~0.2 ms loop, 60 times per run, 4 runs each; cross-process number from `outbox.db.test.ts` | [ADR 1080](adr/1080-change-log-through-a-transactional-outbox.md) |
| `[[title]]` resolver (agent writes, imports, sync) | Former titles: one more query (in parallel) so `[[old name]]` finds a renamed page; two statements per rename | 5,000 pages: p50 8.3–9.9 / p95 10.7–12.7 ms | 0 former names: 7.6–9.0 / 9.7–11.8 ms; 1,000 former names: 10.3–10.6 / 15.4–15.5 ms; `recordRename` 2 statements, p50 2.4–3.0 ms in its own transaction | Accepted: none measurable with 0 former names, about +0.5 to +2 ms p50 with 1,000 | Grows with the number of former names in the workspace (one row per page and former name); measured with the first key (one row per name), the final key adds an `ORDER BY` over the same rows, not re-measured | `buildTitleResolver` called directly, before (the old function body) and after interleaved 3 × 20 calls, 2 runs (ranges); Postgres 16 in Docker on localhost, Node 22.23.4, Apple-silicon MacBook Air shared with other work (two other agents building and testing on the same machine) | [ADR 1121](adr/1121-former-titles-for-wikilinks-after-rename.md) |
| Due auto snapshot, 4.5 MB page at the 50-version cap | Diff of the stored state in Node + rebase of the oldest kept version (ADR 1100) instead of `INSERT … SELECT` of the whole state inside Postgres | p50 4.7–5.5 ms (max 6.3–20.1), event loop max 2.8–3.1 ms | p50 55.0–88.1 ms (max 113–128), loop max 42.2–75.3 ms | Accepted: once per ≥ 10 minutes of editing per page, for −94 % history storage | Event-loop time on the store that takes the snapshot | Replayed page from the snapshot bench (3.08 MB V2 / 4.32 MB V1, 50 versions), snapshot rows aged before each call so every call is due, n = 8, before: 2 runs, after: 2 runs (one with chain stats: 7 diffs, 1 whole, 7–8 rebases) | [ADR 1100](adr/1100-incremental-version-history.md) |
| Other requests during patch_section, 4.5 MB page | Round 2 write path (ADRs 1100–1102) | Production copy: probe p95 304.3–306.3 ms | 426.3–473.3 ms | Not explained; synthetic page unchanged (381.2–387.2 → 381.3–497.7 ms) | Slower small requests while a large-page patch runs | `apps/server/scripts/large-page-bench.ts` (unchanged): in-process test app, MCP over the in-memory transport, Postgres 16 in Docker, Node 22.23.4, Apple-silicon MacBook Air shared with other work. Production copy (4.50 MB) and synthetic log (4.13 MB). Interleaved before, after, before, after; ranges over the 2 runs of each; n = 20 one-line appends (patch_section: to the middle section); probe = GET /backlinks of a small page every 10 ms | [ADR 1102](adr/1102-one-encode-per-store-one-decode-per-index-pass.md) |
| update_page append (small pages) | Write gate around the document edit (ADR 1151): a short transaction with the access row FOR SHARE around the in-memory apply; change rows announced by a separate `pg_notify` after the commit (ADR 1150) | 1 client p50 16.96–17.84 / p95 22.12–25.59 ms; 16 clients p50 113.5–124.7 / p95 163.3–270.4 ms, 130 req/s; 25.5–26.0 commits per request | 17.66–18.65 / 23.07–25.53 ms; 116.6–128.6 / 151.7–174.6 ms, 126–132 req/s; 28.8 commits per request | Accepted: a lock change, agent block or member removal can no longer slip between update_page's check and its edit | +0.7–0.8 ms p50 at 1 client (+4%), +3% at 16 clients; +2.8–3.4 commits per request (BEGIN/gate/COMMIT, the announcement of the change row) | `apps/server/scripts/comment-post-bench.ts`: production builds (tsup) of the v0.5.0 tree without and with the change (the 'with' build = the same snapshot plus only these files, so other unreleased work is in neither); seed made by the script (51 users, 1 workspace, 2,000 shared doc pages created by 50 of them, 3,000 comments; pages start without a document), copied with `CREATE DATABASE … TEMPLATE` before every run; server as its own process (NODE_ENV=production, outbox worker on), Postgres 16.13 in Docker on localhost (`synchronous_commit = on`), Node 22.23.4, Apple-silicon MacBook Air shared with other agents' test runs (load average 4–13; ±30% and more between rounds). `fetch` load generator in another process, X-Forwarded-For rotated past the rate limits; per level 30 warm-up, then 300 requests at 1 and at 16 clients. Commits per request from `pg_stat_database.xact_commit` (11 s wait so idle backends flush; read statements count as commits; the script's own statements subtracted); NOTIFYs counted by a LISTEN on `inkling_outbox`; waits = average number of the app's active connections per wait event, `pg_stat_activity` sampled every 2 ms during the 16-client run; "outbox empty" = time from the last response until no pending row. `pg_stat_statements` is not loaded in this container, so statement counts are not comparable with older rows; mode `--mode append`, per level 20 warm-up then 200 requests (`POST /pages/:id/content`, one paragraph). Rounds interleaved, 2 per build, after first | [ADR 1151](adr/1151-write-gate-on-comments-and-document-edits.md) |
| Query block WHERE / SORT on a relation field | Titles of the visible linked rows as the comparison key (ADR 1352): one pages PK probe per link, for every candidate row before LIMIT | Stored ids: `LIST FROM "Perf" SORT Depends LIMIT 50` median 11.3 ms (p90 12.0); `WHERE Depends = "Perf row 700"` 10.8 (13.2), matched nothing | Titles: 48.7 (50.3); 59.2 (63.8), 3 rows | Accepted: the filter means what the block shows | About +19 to +24 µs per candidate row with a relation key (6,000 probes for 2,000 rows) | 2,000-row collection `Perf` (select, person over 4 members whose id order is the reverse of their name order, 3 relation links per row) + 3,000 plain docs, `FROM "Perf"`; compiled statement only, in-process (`SET LOCAL jit = off` like the route), 0.9.0 compiler and the new one interleaved, 33 runs each, first 3 dropped; Node 22.23.4, Postgres 16.13 in Docker, Apple M4 | [ADR 1352](adr/1352-query-block-compares-people-by-name-and-relations-by-title.md) |
| Query block WHERE / SORT on other collection fields | The same key path (one field-definition lookup shared by value and key, a CASE on its type) for every property WHERE / SORT use, since the type is only known per row | `WHERE Status = "Open" SORT file.name LIMIT 50` (select) median 11.7 ms (p90 12.2) | 13.5 (14.0) | Accepted | +1.8 ms per 2,000 candidate rows | Same runs as the relation row | [ADR 1352](adr/1352-query-block-compares-people-by-name-and-relations-by-title.md) |
| Comment POST at 1 client (v0.11.0) | Author's `thread_follows` row written in the comment statement (ADR 1412) | p50 3.47–3.91 / p95 6.43–8.87 ms, 214–235 req/s | p50 4.07–4.36 / p95 6.93–10.93 ms, 192–208 req/s | Accepted: replies reach the thread's followers, Threads view | +0.4–0.9 ms p50 per comment (+11–26 %, paired by round), ranges do not overlap; 16 clients within the spread (p50 16.07–22.83 → 16.21–17.37 ms), commits per request unchanged | Same runs as the "Comment POST, author auto-follows the thread" row under Server & database (`comment-post-bench.ts`, 4 interleaved rounds) | [ADR 1412](adr/1412-followed-threads-and-the-inbox.md) |
| find_context latency, Korean partial match (0.14) | Group tsqueries with whole-word particle families and split phrases, alias-aware title flags (ADR 1700, 1701) | Interleaved A/B: p50 36.5–36.8 ms, p95 90.5–108.7 ms | p50 40.4–42.3 ms, p95 98.4–98.6 ms | p50 +4–6 ms (+11–15%); p95 within the spread | Accepted for the accuracy gain above | `apps/server/scripts/context-bench.ts --pages 5000`: evaluation wiki padded to 1–2k tokens per page + contest pages + Korean partial-match pages + 5,000 distractors (15,732 chunks), local Postgres 16.13 (Docker, aarch64), Apple Silicon laptop; 0.13 = HEAD a2f5d41 ranking code (`git archive`) with the new evaluation files, 0.14 = the same tree with only rank.ts and retrieve.ts replaced; each run on a freshly created and migrated database; `findContext` called directly, 62 questions × 3 rounds after one warm-up round, the two code trees alternated on the same data (3 pairs, the first disturbed by other load and left out) | [ADR 1700](adr/1700-korean-partial-match-at-query-time.md) |
| find_context, common one-syllable noun with a particle (0.14) | "팀을" searches 팀 as a whole word (팀, 팀에, 팀의 …) instead of only the form "팀을" | "팀을 나눈 방식" 11 ms | 40 ms, the same as "팀 나눈 방식" | 3.6× slower for that query | More candidates for a common noun | Same benchmark, median of 7 | [ADR 1700](adr/1700-korean-partial-match-at-query-time.md) |
| find_context latency (0.15.1) | ADR 1900–1905: thin/title-only slot rule, URL-free matching, cut around best lines, English inflection and Korean double particles, section sizes in the short-anchor statement | p50 39.7 / 40.6 / 40.2 / 41.2 ms, p95 105.4–106.6 ms (0.15, 4 runs) | p50 46.7 / 44.2 / 44.5 / 50.0 / 47.8 ms, p95 117.4–133.2 ms (5 runs) | p50 +3.6 to +8.8 ms per interleaved pair (≈ +5.5 ms, +14%), p95 +11 to +28 ms | A CPU profile of the Node process is idle for > 98% of the run in both trees, so ranking and cutting add no measurable CPU. The query forms add a prefix to 20 of 78 questions and return 9% more candidate rows (mean 171 → 187); with them off p50 was 43.9–44.2 ms. The remaining ≈ 3 ms (same SQL text with the forms off) is unattributed: the section-size sum added to the short-anchor statement costs 0.01 ms (EXPLAIN ANALYZE, 40 pages), and the machine's spread between rounds is of the same size | `find_context` called directly over all 78 questions × 5 rounds (390 calls) at their own budgets, one warm-up, on the final bench workspace (15,806 chunks); 0.15 tree and this tree interleaved (base, new, base, new …; one run of the second series also with the query forms off), Postgres 16 in Docker, Node 22.23.4, Apple-silicon MacBook Air shared with two other agents' test runs; one pair taken under visible load (47.0 / 76.6 ms) left out | [ADR 1905](adr/1905-query-forms-and-rrf-k.md), [1909](adr/1909-evaluation-field-cases-of-0151.md) |
| MCP search, two-character term in one workspace (0.17) | Every match is graded (title/heading/body regex) before the top 10 are cut, instead of an ORDER BY over title-match + updatedAt with LIMIT 20 | 50.59 / 53.36 ms | 72.18 / 74.88 ms | 1.4× slower p50 | A query whose two characters occur in every page (5,000 matches, no trigram index); with 5 or 10 workspaces the same query is faster than before | search-bench.ts, as in "Retrieval & MCP" | [ADR 2183](adr/2183-search-ranking-and-one-agent-search-route.md) |
| Bulk insert of pages under a parent without an ID property (0.17) | The ID trigger of migration 0051 tries one `UPDATE collections … WHERE page_id = parent AND fields @> uniqueId` per inserted page | 2,000 rows 130.3–133.8 ms; 20,000 rows 1,296–1,318 ms | 165.7–169.0 ms; 1,677–1,714 ms | +27% / +30% (≈ 18–20 µs a row) | Not seen in a single row create (4.8 ms); about 0.4 s on a 20,000-row import. Measured with raw `INSERT`s of 1,000 rows, each its own transaction, into a collection that had no fields yet (the bench adds them after the insert); the CSV, Notion and Sheets import paths were not measured. Still the case in 0.18 for parents without an ID (KNOWN-ISSUES COLL17-10). Under a database **with** an ID property, many rows in one transaction were quadratic in 0.17 (50,000 rows 41.1 s), which this row did not measure; migration 0058 fixes that ("Row numbers in bulk inserts (0.18)" under Server & database) | collection017-bench.ts, two interleaved runs per tree | [ADR 2140](adr/2140-automatic-values-email-phone-and-unique-ids.md), [2320](adr/2320-row-numbers-in-bulk-inserts-without-walking-row-versions.md) |
| find_context rare-word rule | A section without the rarest query word keeps ×0.75 | "해커톤 팀 구성 확정" (test): both relevant sections shown | first result unchanged, the checklist section (no 확정) under the floor: recall@5 1.0 → 0.5 | Accepted: soft AND on one word | — | `apps/server/scripts/context-bench.ts --pages 5000 --final` | [ADR 2402](adr/2402-a-chunk-without-the-rare-query-word-keeps-three-quarters.md) |

Under investigation: v0.2.0 vs v0.1.0 comparison.

MCP `search` / `list_pages` (v0.1.0 → v0.2.0): re-measured interleaved on one seed and machine, p50 11.6 → 12.4–13.6 ms (+7–17%) and 49.1–49.4 → 51.5–52.5 ms (+4–7%), one statement more per call (agent-block check). The +56% / +36% of the first comparison were within that run's round-to-round noise. The extra statement is gone with ADR 1071 (row under "Rejected / no effect": latency within noise).

## Measuring tools

These are the scripts and tests that produced the numbers in the tables above; each can be run again
from the repository.

- `apps/server/scripts/context-bench.ts` (find_context vs the old search + read flow, tokens,
  calls, success, latency)
- `apps/server/src/context/context.db.test.ts` (retrieval assertions and token log lines,
  patch_section tokens)
- `apps/server/src/context/sectionPatch.test.ts` (patch_section concurrency and fuzz)
- `apps/server/scripts/section-write-bench.ts` (read_page section / patch_section / update_page
  replace core latency, no database) and `apps/server/src/context/notationRoundTrip.test.ts`
  (element × scenario preservation census)
- `apps/server/src/context/changeFeed.test.ts` (changes_since recall and tokens)
- `apps/server/src/collectionQuery/collectionQuery.db.test.ts` (query_rows tokens)
- `apps/server/src/perf.test.ts` and `apps/web/src/lib/perf.test.ts`
- `apps/server/scripts/snapshot-chain-bench.ts` (version history: a page replayed as N appends, snapshot
  rows raw / on disk, page_docs size, version preview / compare / restore, store and index pass)
- `apps/server/scripts/large-page-bench.ts` (large pages: index coverage, outline/section, append and
  patch_section latency, event-loop stalls and other requests during the call; `--state` for a real page)
- `apps/server/scripts/cache-sim.ts` (cache replacement: LRU, SIEVE, S3-FIFO and the OPT bound on
  the same traces and capacities; add a trace before changing a cache's size or policy)
- `apps/server/src/unionFind.test.ts` (union-find hop counts on worst-case inputs)
- `apps/server/scripts/mcp-token-bench.ts` (tokens an agent receives: 3 agents re-reading with and without
  `known`, list_pages json/lines/compact on 2,000 pages, dated folders, search, patch_sections vs patch_section)
- `apps/server/scripts/multi-query-bench.ts` and `apps/server/src/mcpTools/multiQuery.db.test.ts` (find_context
  with several phrasings vs one call per phrasing: calls, tokens, answer sections)
- `apps/server/src/context/semantic.db.test.ts` with the fake endpoint of `semanticTestServer.ts` (semantic
  search on and off; off must stay at 0 queries and 0 requests)
- `apps/server/src/teamAgents.test.ts` and `apps/server/src/teamAgents.db.test.ts` (inbox hand-off lines and the
  catch_up team group, tokens with `TOKENS=1`)
- `apps/server/src/mcpTools/rowStatus.db.test.ts` (status lines after update_row / create_row / query_rows, tokens
  with `TOKENS=1`)
- `apps/server/scripts/mcp-tools-list-cost.ts [--profile core|full] [--by-tool] [--surface] [--json]` (fixed MCP
  cost per session: tools/list per profile and per tool, server instructions, and with `--surface` the initialize
  result, resource templates and prompts; no database, exact for a build)
- `apps/server/scripts/search-bench.ts` (MCP search latency over 1, 5 and 10 workspaces of 5,000 pages, before and
  after interleaved; scratch database)
- `apps/server/scripts/ai-step-bench.ts [--writes N]` (version rows per agent write: rows, raw and on-disk bytes,
  write latency on a small note and a large log)
- `apps/server/scripts/collection017-bench.ts` (page, row, property and section writes with the 0.17 triggers,
  bulk inserts, query_rows with and without automatic fields)
- `apps/server/src/routes/vaultSyncScale.db.test.ts` with `VSYNC_SCALE_N=1000` (vault sync both ways, rate limiter
  off and on)
- Browser measurements in the existing entries (React commits, long tasks, editor repros) were made
  with out-of-tree Playwright scripts. Describe the script in the ADR precisely enough to repeat it.

The rules for adding a row to this log are in [CONTRIBUTING.md](../CONTRIBUTING.md#performance-changes).
