# Plan: Background Memory Evaluation & Idea Generation **Goal:** Maven periodically reviews her own memory stores (facts, notes, events, nudges), evaluates coherence and gaps, and generates proactive proposals — new routines, configuration tweaks, observations she can share with the user. **Done when:** - `internal/memory/eval.go` — periodic evaluation loop runs on a slow cadence (1h) - Evaluation reads `RecentFacts`, `RecentNotes`, `RecentNudges`, `RecentEvents` via `store.Store` or `ipc.CoreAPI` - LLM summarizes state, detects anomalies (e.g. "you haven't recorded a meal in 3 days — is your routine broken?"), proposes new care rules - Generated proposals are written as notes (kind `note`, source `infer:memory-eval`) and/or trigger nudges through the dispatcher - Evaluation trace visible on `/history` page in mavweb **Scope:** - New `internal/memory/eval.go` — evaluator struct calling `internal/llm.Client` with a summarization prompt - Reuses `internal/delivery.Dispatcher` for surfacing insights as care nudges (sev1) - Reuses `internal/store` for reading memory state and writing evaluation notes - Daemon wiring: new evaluation goroutine in `cmd/mavend/main.go` - Config: `memory_eval_interval` in `config.Config` (default 1h, 0 to disable) **Steps:** 1. Create `internal/memory/eval.go` — `Evaluator` struct holding `*store.Store`, `*llm.Client`, `*delivery.Dispatcher` 2. Implement `Evaluate(ctx)` — reads last N facts, notes, nudges, events, builds a prompt summarizing patterns, anomalies, gaps 3. LLM call returns structured observations: `{"observation":"...","confidence":0.8,"suggested_action":"remind|propose|notify"}` 4. High-confidence observations written as notes (`source:infer:memory-eval`) or dispatched as care nudges (sev1) through `dispatcher.DispatchNudge` 5. Wire evaluator goroutine in `cmd/mavend/main.go` — separate ticker, not on the main tick loop 6. Add `/eval` API method to `ipc.CoreAPI` (or reuse `Chat` with system context) so mavweb can show evaluation history 7. Add `memory_eval` block to `deploy/mavend.json` 8. Test with synthetic store state — verify observations match expected patterns