{"draft":null,"from":54,"to":55,"files":[{"path":"worker/project/project.ts","added":23,"removed":5,"diff":"--- a/worker/project/project.ts\n+++ b/worker/project/project.ts\n@@ -225,6 +225,8 @@\n \treadonly #graph: Graph;\n \t/** Views laid out from atom sets, cached under a byte budget (views.ts). */\n \treadonly #views: ViewCache;\n+\t/** Each agent's draft files, under the key they were worked out for (#draftFiles). */\n+\treadonly #draftFilesKept = new Map<string, { key: string; files: Set<string> }>();\n \t/** Each version's files and each path's history (pathindex.ts). */\n \treadonly #paths: PathIndex;\n \t/** For each atom (by seq) that wrote lines, the log position of the entry that recorded it (#46). */\n@@ -992,9 +994,20 @@\n \t\t}\n \t}\n \n-\t/** The files the agent's unpublished changes touch, in its own view. */\n-\t#draftFiles(...args: Tail<Parameters<typeof hostedDraftFiles>>): ReturnType<typeof hostedDraftFiles> {\n-\t\treturn hostedDraftFiles(this.#overlapHost, ...args);\n+\t/**\n+\t * The files the agent's unpublished changes touch, in its own view. Kept per agent under what they're\n+\t * made of (abso-core issue 6): its view's key and its draft. Most agents haven't moved since the last\n+\t * status, and the view cache holds fewer views than a big project has agents, so working them out again\n+\t * on every call cost about 0.5 s on abso. A copy goes out, so no caller can change what's kept.\n+\t */\n+\t#draftFiles(agent: AgentState): Set<string> {\n+\t\tconst key = `${this.#agentViewKey(agent)}|${this.#draft(agent).join(\",\")}`;\n+\t\tlet kept = this.#draftFilesKept.get(agent.name);\n+\t\tif (kept?.key !== key) {\n+\t\t\tkept = { key, files: hostedDraftFiles(this.#overlapHost, agent) };\n+\t\t\tthis.#draftFilesKept.set(agent.name, kept);\n+\t\t}\n+\t\treturn new Set(kept.files);\n \t}\n \n \t/** Other agents in the agent's space whose unpublished changes or starting note meet `patterns`. */\n@@ -2028,6 +2041,7 @@\n \t\t\tagents: this.#agents,\n \t\t\tagentView: (agent) => this.#agentView(agent),\n \t\t\tdraft: (agent) => this.#draft(agent),\n+\t\t\tdraftFiles: (agent) => this.#draftFiles(agent),\n \t\t\tliveNote: (agent) => this.#liveNote(agent),\n \t\t\tqueueNews: (agent, items, entries) => this.#queueNews(agent, items, entries),\n \t\t};\n@@ -2217,10 +2231,14 @@\n \t}\n \n \t#agentView(agent: AgentState): View {\n-\t\t// Keyed by what the set is made of, not by sorting every atom in it (#46): that cost more than the work.\n-\t\treturn this.#viewKeyed(`a ${agent.space}@${agent.base}+${agent.mine.join(\",\")}`, () => this.#agentSet(agent));\n+\t\treturn this.#viewKeyed(this.#agentViewKey(agent), () => this.#agentSet(agent));\n \t}\n \n+\t/** An agent's view, keyed by what the set is made of, not by sorting every atom in it (#46): that cost more than the work. */\n+\t#agentViewKey(agent: AgentState): string {\n+\t\treturn `a ${agent.space}@${agent.base}+${agent.mine.join(\",\")}`;\n+\t}\n+\n \t/** A space at a version: published versions never change, so the key is just their names (#46). */\n \t#viewAt(space: Space, version: number): View {\n \t\treturn this.#viewKeyed(`v ${space.name}@${version}`, () => this.#at(space, version));"}],"unmatched":[]}