diff --git a/docs/architecture/COMPANION_BRAIN_ARCHITECTURE.md b/docs/architecture/COMPANION_BRAIN_ARCHITECTURE.md index be53af9ba..ba699e349 100644 --- a/docs/architecture/COMPANION_BRAIN_ARCHITECTURE.md +++ b/docs/architecture/COMPANION_BRAIN_ARCHITECTURE.md @@ -1804,9 +1804,14 @@ Code: - Webapp-Staging-Effect (`server-iteration-staging.ts`) übersetzt eingehende `source:'server'` Iterationen in lokale Proposals pro PlanStep mit AI-Actor-Attribution; idempotent via proposalId-Marker - - **Offen für Future Work**: Server-side Input-Resolver (notes/kontext - Projections), Contract-Test zwischen `AI_AVAILABLE_TOOLS` und Webapp- - Policy, Materialized View bei >100 Usern + - Server-side Input-Resolver (`db/resolvers/`) für plaintext Tabellen + (goals); encrypted Tables bleiben privacy-by-design browser-only + - Contract-Test via `@mana/shared-ai`'s `AI_PROPOSABLE_TOOL_NAMES` + + Runtime-Drift-Guard im Service + - `mana_ai.mission_snapshots` — inkrementeller Snapshot, `listDueMissions` + ist ein indexed SELECT statt O(N) LWW-Replay + +**Die Workbench-Roadmap ist damit funktional abgeschlossen.** ### 20.5a Symmetrische Registries: Resolver vs. Indexer diff --git a/services/mana-ai/CLAUDE.md b/services/mana-ai/CLAUDE.md index e59ce3a87..a30dd1f89 100644 --- a/services/mana-ai/CLAUDE.md +++ b/services/mana-ai/CLAUDE.md @@ -18,9 +18,12 @@ What works end-to-end: - [x] **Write-back**: `db/iteration-writer.ts` appends the server-produced iteration to `Mission.iterations[]` via a `sync_changes` INSERT under an RLS-scoped `withUser` transaction. Row is attributed with actor `{kind:'system', source:'mission-runner'}`. - [x] Webapp staging effect (`server-iteration-staging.ts`) picks up the synced iteration and translates each PlanStep into a local Proposal with full AI-actor attribution (missionId + iterationId + rationale). Idempotent via durable `proposalId` markers. - [x] **Server-side input resolvers** for plaintext tables — `db/resolvers/` with a pluggable registry + single-record LWW replay (`record-replay.ts`). `goals` resolver ships by default. Encrypted tables (notes, kontext, tasks, events, journal, …) are intentionally **not** resolved server-side; those missions depend on the foreground runner which decrypts client-side. See `resolvers/types.ts` for the privacy rationale. +- [x] **Materialized mission snapshots** — `mana_ai.mission_snapshots` table with per-tick incremental refresh (`db/snapshot-refresh.ts`). `listDueMissions` is now a single indexed SELECT; the prior O(N changes) LWW replay stays only in `mergeAndFilter` for tests. Idempotent `migrate()` on boot creates the schema. -Intentionally **not yet** implemented (future work): -- [ ] Materialized mission snapshot — full LWW replay per tick is O(N changes). Fine pre-launch; revisit when user count grows. +All roadmap items shipped. Future polish (not blockers): +- Multi-instance deploy with advisory locks on snapshot refresh (today single-process) +- Read-only `/internal/missions/:userId` endpoint for ops inspection +- Metrics endpoint for Prometheus (tick latency, plans/hour, parse-failure rate) ## Port: 3066