Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
show on this site's /mcp
CLI
abso show 234 --json
JSON
/christopher/abso-core/versions/234?format=json

The view cache holds up to 128 views, still within its byte budget (disk-first 2; abso Capacity).

of shared·capacity··Not checked

where visits every agent's draft view in turn. abso has more agents with drafts than the cache's 32 views, so each visit evicted the view the next call would need, and a kept writer laid every view out again on every call. Testing measured where at 5.5 s warm on abso with 232.

VIEW_COUNT is now 128. The byte budget (VIEW_BUDGET, 24 MB) still bounds what the views hold.

On abso adopted fresh, one kept writer: where's first call takes 3.7 to 4.5 s, then 0.31 to 0.37 s with about 1,700 reads (4.6 to 5.5 s each time at 32 views). 64 views was already enough on abso today; heap after the run is 32 MB either way.

Tests: view-cache's two count tests now use VIEW_COUNT. Named tests: view-cache, where-many-agents, draft-reads-stored, project, membership-cache, files-reads, collision-streaming, authors-stored (42 of 42); tsc and biome clean.

Version 233 · Files at version 234

2 files, 17 lines added, 10 removed.

--- a/worker/project/test/view-cache.test.ts
+++ b/worker/project/test/view-cache.test.ts
@@ -4,7 +4,7 @@
44import { buildBase, Graph, View } from "../../../src/engine/index.ts";
55import { StableOverlaySet } from "../../../src/engine/state-source.ts";
66import type { AtomId } from "../../../src/engine/types.ts";
7−import { ViewCache } from "../views.ts";
7+import { VIEW_COUNT, ViewCache } from "../views.ts";
88
99const VIEW_BUDGET = 24_000_000;
1010
@@ -25,7 +25,7 @@
2525 assert.equal(cache.view(set), view);
2626 assert.equal(set.iterations, 1, "cache hit must not construct a full-history key");
2727 assert.equal(view.text("a.txt"), "one\n");
28− for (let i = 0; i < 33; i++) cache.view(new Counted(["a0"]));
28+ for (let i = 0; i < VIEW_COUNT + 1; i++) cache.view(new Counted(["a0"]));
2929 assert.notEqual(cache.view(set), view, "indexed identities obey the same cache eviction limit");
3030 assert.equal(set.iterations, 2);
3131});
@@ -76,16 +76,16 @@
7676 });
7777});
7878
79−test("the cache retains exactly 32 views and evicts the least recently used one", () => {
79+test("the cache retains exactly VIEW_COUNT views and evicts the least recently used one", () => {
8080 withControlledWeights((control) => {
8181 const cache = new ViewCache(new Graph());
82− control.setIncomingWeights(Array(33).fill(0));
82+ control.setIncomingWeights(Array(VIEW_COUNT + 1).fill(0));
8383 const first = get(cache, "key-0");
84− const retained = Array.from({ length: 31 }, (_, i) => get(cache, `key-${i + 1}`));
84+ const retained = Array.from({ length: VIEW_COUNT - 1 }, (_, i) => get(cache, `key-${i + 1}`));
8585 assert.equal(get(cache, "key-0"), first);
86− const last = get(cache, "key-32");
86+ const last = get(cache, `key-${VIEW_COUNT}`);
8787 assert.equal(get(cache, "key-0"), first);
88− assert.equal(get(cache, "key-32"), last);
88+ assert.equal(get(cache, `key-${VIEW_COUNT}`), last);
8989 for (let i = 1; i < retained.length; i++) assert.equal(get(cache, `key-${i + 1}`), retained[i]);
9090 assert.notEqual(get(cache, "key-1"), retained[0]);
9191 });
--- a/worker/project/views.ts
+++ b/worker/project/views.ts
@@ -12,12 +12,19 @@
1212 */
1313const VIEW_BUDGET = 24_000_000;
1414
15+/**
16+ * At most this many views (abso Capacity). where visits every agent's draft view in turn: with more agents than views,
17+ * each visit evicted the next one, and a warm where on abso laid every view out again (4.5 s against 0.33 s). The byte
18+ * budget still bounds what they hold.
19+ */
20+export const VIEW_COUNT = 128;
1522/** Internal opt-in. The owner validates identity and lifetime on every returned reader. */
1623export interface ReadViewProvider {
1724 keyed(key: string): ReadView;
1825}
1926
20−/** Views by key, most recently used last, held under VIEW_BUDGET bytes and 32 views. */
27+/** Views by key, most recently used last, held under VIEW_BUDGET bytes and VIEW_COUNT views. */
2128export class ViewCache {
2229 readonly #graph: Graph;
2330 readonly #provider?: ReadViewProvider;
@@ -34,13 +41,13 @@
3441 /**
3542 * Keep the cached views under VIEW_BUDGET bytes (the website project, #43,
3643 * #46): each view holds every line its files ever had, so a few views of a
37− * large generated file add up. At most 32.
44+ * large generated file add up. At most VIEW_COUNT.
3845 */
3946 #trim(): void {
4047 let total = 0;
4148 for (const v of this.#cache.values()) total += v.weight();
4249 for (const [key, v] of this.#cache) {
43− if (total <= VIEW_BUDGET && this.#cache.size <= 32) break;
50+ if (total <= VIEW_BUDGET && this.#cache.size <= VIEW_COUNT) break;
4451 total -= v.weight();
4552 this.#cache.delete(key);
4653 }