refactor(server): read workspace state, briefings and workspaces from the memory contract (P1.5)

- Workspace state, the "Workspace Now" block, the home briefing and the
  proactive handlers read the workspace's memory through server.memory:
  decisions are memories of kind 'decision', critical ones or ones worded
  as decisions; summaries list memories most important first. They no
  longer open workspace .mind files, so the builders are async and
  ProactiveContext carries `memory` instead of `getWorkspaceMindDb`.
- The home briefing counts extracted personal facts that are neither
  confirmed nor archived as awaiting review (memory-status.ts).
- Workspace routes count memories through the contract, seed template
  starter memories with remember() in the background (origin
  'workspace-template'), export memories through list(), and deleting a
  workspace forgets its memory scope and clears its awareness items before
  the directory is removed; the delete is refused if forgetting fails.
  agentState.releaseWorkspace() replaces closeWorkspaceMind for callers.
- The command palette searches personal memory and the active workspace's
  memory (UF-033).
- chat.ts drops the MindDB-flake diagnostics; the mind cache they guarded
  no longer serves chat turns.
This commit is contained in:
shumeiko.it
2026-10-24 12:50:07 +02:00
parent 4a1c4c4c8e
commit e9ed8c0765
23 changed files with 823 additions and 857 deletions

View File

@@ -61,6 +61,7 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`.
| UF-030 | WhatsApp setup hint suggests pairing from the "Message yourself" chat, which is never read | Fixed | Web UI, channels |
| UF-031 | Team sync shares the save_memory confirmation instead of the memory | Open | Team mode, memory |
| UF-032 | Team capability policies are always read from the team "default" | Open | Team mode, governance |
| UF-033 | Command palette memory search uses whichever workspace the Memory app opened last | Fixed | Sidecar, command palette |
## Entries
@@ -324,3 +325,12 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14.
- Cause: the slug is read from `teamServer.teamSlug` in `config.json`, a field `TeamServerConfig` does not have and `POST /api/team/connect` never writes, so it always falls back to `'default'`. The workspace's `teamId` is not used.
- What we did: nothing in the old code. Team mode is postponed in the community edition (ADR-0003) and the lookup was removed with it in P1.1.
- Recommendation: fetch `/api/teams/<workspace teamId>/capability-policies` for the workspace the turn runs in, and cache per team rather than per workspace.
### UF-033. Command palette memory search uses whichever workspace the Memory app opened last
- Status: Fixed
- Found: 2026-10-24
- Where: at commit `b20b138`, `packages/server/src/local/routes/command.ts:111` (`server.multiMind.search(q, searchScope, perFacet)`); the workspace is set only by `ensureWorkspaceMind()` in `packages/server/src/local/routes/memory.ts:184-192`
- Symptom: memory results in the Ctrl+K palette (scope 'all' or 'workspace') come from the workspace last viewed in the Memory app, not from the workspace the user is in; before the Memory app is opened, workspace memory is not searched at all. If the mind cache has evicted that workspace, the memory group is silently empty.
- Cause: `MultiMind` holds one borrowed workspace handle that only the memory routes set; the palette reuses it without choosing a workspace.
- What we did: the palette searches personal memory and the memory of the active workspace (`agentState.activeWorkspaceId`) through the memory contract.
- Recommendation: pass the workspace the palette was opened in (or the active workspace) to the memory search instead of relying on shared `MultiMind` state.