{"version":222,"agent":"capacity","message":"A stored writer's read cache holds 4 MB and 16,384 rows (disk-first 2; abso Capacity).\n\nAgent VCS's first disk-first reads on staging (commonmark-ts) found diff 9.7 s on the first call, against 1.8 s replayed. On typescript-rs, with one opened writer, an agent's diff made 59,000 row reads. It touches more rows than the old cache's 4,096, so it read the same rows many times: the membership and closure events of each atom it checks, and the list of atoms that move lines.\n\nAt 4 MB and 16,384 rows, the same diff makes 22,000 reads and takes 1.1-2.8 s locally instead of 1.7-2.4 s. Locally a row read is cheap; in a Durable Object each one costs more, which is where staging's 9.7 s comes from. 8 MB saves only another 1,800. show is unchanged (5,000-8,500 reads, all distinct).\n\nNamed tests: project-writer-storage, membership-cache, view-cache, draft-reads-stored, packed-crossings (19 of 19); tsc and biome clean.","time":1792049583239,"timeIso":"2026-10-15T07:33:03.239Z","changes":3,"change":3605,"files":["worker/project/project.ts"],"draft":null,"diff":[{"path":"worker/project/project.ts","added":9,"removed":1,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -238,6 +238,12 @@\n /** A start note lasts this long after the agent's last activity (#44). */\n const NOTE_IDLE = 2 * 60 * 60 * 1000;\n const WRITER_REOPEN = Symbol(\"verified writer checkpoint\");\n+/**\n+ * The stored writer's read cache (abso Capacity). An agent's diff on typescript-rs touches more rows than the old\n+ * 4,096 held, so it read many of them again: 59,000 reads cold, against 22,000 at this size.\n+ */\n+const WRITER_CACHE_BYTES = 4 * 1_048_576;\n+const WRITER_CACHE_ROWS = 16_384;\n export interface WriterSource {\n \treadonly generation: number;\n \treadonly logLength: number;\n@@ -385,7 +391,9 @@\n \t\tif (options.indexAcceptedAtom && !options.writerStorage)\n \t\t\tthrow Error(\"accepted atom indexing requires writer storage\");\n \t\tthis.#store = store;\n-\t\tthis.#writerStorage = options.writerStorage ? new CachedStateStorage(options.writerStorage) : undefined;\n+\t\tthis.#writerStorage = options.writerStorage\n+\t\t\t? new CachedStateStorage(options.writerStorage, WRITER_CACHE_BYTES, WRITER_CACHE_ROWS)\n+\t\t\t: undefined;\n \t\tif (this.#writerStorage) {\n \t\t\tconst storage = this.#writerStorage;\n \t\t\t// A stored Graph cannot be replayed over itself. Check before any"}],"ci":null}