Repository navigation
feat(agents): keep each agent's core memory in one host-owned cache - #1155
Merged
Merged
Conversation
wpfleger96
marked this pull request as ready for review
October 15, 2026 14:41
wpfleger96
marked this pull request as draft
October 15, 2026 14:57
wpfleger96
force-pushed
the
duncan/core-memory-cache
branch
from
October 15, 2026 15:09
0844afd to
7517482
Compare
wpfleger96
force-pushed
the
duncan/core-memory-cache
branch
from
October 15, 2026 17:26
301eec6 to
e5906e7
Compare
wpfleger96
force-pushed
the
duncan/core-memory-cache
branch
4 times, most recently
from
October 15, 2026 18:19
fa4dd21 to
80242f2
Compare
wpfleger96
marked this pull request as ready for review
October 15, 2026 18:25
kalvinnchau
reviewed
Oct 15, 2026
kalvinnchau
left a comment
Contributor
There was a problem hiding this comment.
🤖 Two findings remain: unencrypted core-memory persistence and contradictory lifetime documentation.
wpfleger96
force-pushed
the
duncan/core-memory-cache
branch
from
October 15, 2026 18:56
80242f2 to
b3d3120
Compare
wpfleger96
marked this pull request as draft
October 15, 2026 18:59
wpfleger96
force-pushed
the
duncan/core-memory-cache
branch
3 times, most recently
from
October 15, 2026 19:48
356f70b to
ce878d8
Compare
wpfleger96
marked this pull request as ready for review
October 15, 2026 20:09
kalvinnchau
approved these changes
Oct 15, 2026
kalvinnchau
left a comment
Contributor
There was a problem hiding this comment.
🤖 Approved. Both prior findings are resolved; no new actionable defects found. Native validation remains unverified, and one unchanged test timed out in the full local suite. Recheck reconnect ordering after resolving the merge conflicts.
wpfleger96
force-pushed
the
duncan/core-memory-cache
branch
from
October 15, 2026 20:40
7986724 to
5a7e595
Compare
added 8 commits
October 15, 2026 16:55
Claude Code, Codex and Goose each read core memory from the relay when a session or turn started, and Goose kept its own five-minute copy. The agents service now holds one copy per community and agent and keeps it current on connect, socket recovery, memory writes through the agent handle, and the end of each run, so plugins read it with `agents.core()` and no relay request once this device has read it. Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
A start waiting on its first read now answers with what a later write kept. Leaving a community with device-data purge forgets its cached core memory, on disk and in memory, and no held read restores it. The browser fake relay answers the owner's memory read, and its local agent uses a real curve point. Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
The purge test asserted before the held refresh finished, and the rejoin's connection swap discarded the late read on its own, so it passed without the forget() writer fence. refresh() now settles when done so the test awaits it on the same connection. The page-wide cache set holds caches weakly, since nothing tears a cache down. Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
The cache now asks for core alone instead of picking it out of the full listing, which fails once an agent's memory passes the listing caps. Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Goose no longer reads core itself; the host cache's partial-listing tests cover not treating a partial miss as no core memory. Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
The cache saved each agent's decrypted core memory to localStorage, where anyone reading web storage or its backups could recover it without the owner's key, against the documented RAM-only promise. A restart now starts empty and reads core again on connect. Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
The cache-level privacy tests built the cache without storage, which the old cache also tolerated silently, so they could not catch persistence returning. This drives the service as the app wires it, with working storage. Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
wpfleger96
force-pushed
the
duncan/core-memory-cache
branch
from
October 15, 2026 20:56
5a7e595 to
b1b6343
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Each agent's
corememory now lives in one host-owned cache in the agents service, shared by Claude Code, Codex and Goose. The cache is held in memory only, so decrypted memory never reaches web storage or disk. Plugins get it withagents.core(pubkey): it returns the cached copy with no relay request, or waits once (up to 5 seconds) when nothing has been read yet. That wait, and every refresh, readscorealone by its slug (the#daddress read from #1200), so the size of the rest of an agent's memory never affects it. No plugin keeps any refresh logic.Where it lives
src/features/agents/core-memory-cache.ts:CoreMemoryCache, one in-memory entry per community and agent.coreagain when the community connects.corenever replaces a known copy or declares core missing.src/features/agents/service.ts:Agents.core(), and refreshes when a community connects and when its live socket returns toconnectedin the same session. These use the service's existing binding subscriptions, so the cache owns no listeners and leaving a community stops its refreshes.src/features/agents/runner.ts: two newRunnerHostcallbacks.rememberedfires from the agent handle'sremember, so acorewrite is kept at once.finishedfires when a run and everything it passed toworkingUntilhave ended, including watch and timer turns, and refreshes in the background.src/features/communities/device-state.ts: the leave-community purge clears the cache.docs/agent-memories.md: describes whencoreis read, that the copy lives only in memory, and what leaving a community clears.Plugins
Related: #1185 (the host-owned store for agent instructions and settings, which agent config will use once it lives on the relay)
buzz-review-completed