PERF/ARCH: lazy-load persisted chats instead of hydrating every conversation at startup #21
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/a0-symbolics#21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
Agent Zero currently loads every persisted chat into a full live
AgentContextduring startup:initialize.py::initialize_chats()startspersist_chat.load_tmp_chats().load_tmp_chats()enumerates everyusr/chats/<id>/chat.json, reads the complete JSON file, parses it, and calls_deserialize_context()._deserialize_context()initializes agent configuration, reconstructs the log, reconstructs every serialized agent/history chain, and creates a liveAgentContext.LOG_SIZE = 1000entries per chat.This couples startup latency and steady-state RAM to the entire historical chat corpus. It also makes every persisted chat part of
AgentContext.all(), which then expands global state snapshots and frontend roster work.The UI needs metadata for old chats; it does not need every old chat's full history/log/agent state resident in memory.
Direction
Separate a lightweight persistent chat catalog from hydrated execution contexts.
Catalog metadata should be sufficient for navigation/search/grouping without loading the chat body, e.g.:
Hydrate the full context only when selected, resumed, running, or otherwise required. Define safe eviction/dehydration for inactive contexts and preserve provider Responses state/history semantics.
Potential implementation models include a sidecar metadata index, versioned manifest, SQLite catalog, or compact metadata file per chat; choose via ADADR rather than baking the storage choice into this issue.
Acceptance
chat.jsoninto a live AgentContext.