feat(bridge): persist reflection docs to workspace for cross-session learning

Replaces InMemoryStore with HybridStore:
- Ephemeral data (threads, steps, events, leases) stays in-memory
- MemoryDocs (lessons, specs, playbooks from reflection) persist to
  the workspace at engine/docs/{type}/{id}.json

On engine init, load_docs_from_workspace() reads existing docs back
into the in-memory cache. This means:
- Lessons learned in session 1 are available in session 2
- The RetrievalEngine injects relevant past lessons into new threads
- The engine genuinely improves over time as reflection accumulates

Workspace paths:
  engine/docs/lessons/{uuid}.json
  engine/docs/specs/{uuid}.json
  engine/docs/playbooks/{uuid}.json
  engine/docs/summaries/{uuid}.json
  engine/docs/issues/{uuid}.json

No new database tables. Uses existing workspace write/read/list.
workspace() accessor widened to pub(crate).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
2026-03-23 22:11:03 -07:00
co-authored by Claude Opus 4.6
parent 20b258aeea
commit 3b309ccbc8
3 changed files with 113 additions and 30 deletions
+1 -1
View File
@@ -300,7 +300,7 @@ impl Agent {
&self.deps.tools
}
pub(super) fn workspace(&self) -> Option<&Arc<Workspace>> {
pub(crate) fn workspace(&self) -> Option<&Arc<Workspace>> {
self.deps.workspace.as_ref()
}