← Back ← Back
# Plan: Mavis HQ memory + lint (FVW v8 + recipe-reuse strategy)

**Session**: 418281651208440 (operator-panel-mavis, id 7)
**Date**: 2026-08-12 10:13 BST (v1) / 10:35 BST (v2: FVW v8) / 10:38 BST (v3: recipe-reuse)
**For**: thread 7 (operator-panel-mavis)
**Source brief**: a551 (fvre-mavis) + G directives 2026-08-12 10:13 / 12:27 / 10:35
**Parent**: a478

## Goal (1 sentence)

Ship one FVW v8-aligned build that adds 2 memory record kinds (standing_opinion + audit_history), a wake-up bundle, a server-side lint + checker agent, cross-thread auto-fyi, pre-work intent, and a SPA Opinions tab — **using the gallery's recipe-books as the spec for every UI surface, not just the doctrine** (per G's "you can reuse recipes" insight).

## What changed in v3 (the recipe-reuse pivot)

G's 10:35 BST message: "gallery is reusable as-is, has recipes. dun-dun-dun! So you, even if you're not reusing code, you can reuse recipes."

FVW v8 §11 says the **recipe book is the source of truth, the implementation is a rendering**. So when building a new module:
1. **First**: find a gallery module with a similar problem and READ its recipe-book (recipe.md, codex.md, rules.md + 5 provenance files)
2. **Adopt the recipe** as the spec — UI structure, states, contract, edge cases, accessibility
3. **Implement the recipe** in the panel's vanilla JS / Express stack

I missed it in v1/v2 because I was looking at code (React components) and saying "can't reuse the code". The recipes are engine-agnostic — they describe the WHAT, not the HOW.

## Gallery recipe-books I'll adopt (locked 2026-08-12 10:35 BST)

| Panel module | Gallery recipe to adopt | What's reusable |
|---|---|---|
| opinions-spa | modules/card-constellation/recipe-book/ (8 fragment_ids) | UI structure, states, contract, accessibility, anti-patterns |
| memory-system | modules/settings/recipe-book/ (3-tier: global/project/embedded) | 3-tier scope model, filter pattern, sub-section focus, AI isolation |
| lint-engine | modules/ai-ask/recipe-book/ (9-layer dispatcher, R1-R7 antipatterns, C1-C8 contracts) | Multi-rule stack pattern, rule contracts, antipatterns |
| checker-agent | modules/anchor-system + ai-toast + ai-ambient (3 recipes) | Rail-based threading + self-toast + ambient checks |
| Panel SPA state banner | modules/mobile-unified-panel/recipe-book/ (10 pact files, 41 fragment_ids) | Mobile-first rules: card-stack, centre-stage, gestures, inner-panels, mini-peek, mobile, signals, timeline, toasts, unified-panel |

Plus FVW v8 doctrine (already adopted in v2):
- 02-folder-layout.md (9 folders)
- 08-anti-drift.md (7 rules + 20 gates + 12 failure modes)
- 11-recipe-book.md (3-file model)
- 04-trace-atlas-schema.md (API -> behaviour -> module -> file -> test)

## FVW v8 structure


/opt/operator/panel/
├── app-pact/              # DONE: 16 rules + 20 gates + 12 failure modes + invariants
├── app-codex/             # TODO: phase 0.5
├── app-fragments/
│   ├── memory-system/     # cites settings/recipe-book
│   ├── lint-engine/       # cites ai-ask/recipe-book
│   ├── checker-agent/     # cites anchor-system + ai-toast + ai-ambient
│   └── opinions-spa/      # cites card-constellation/recipe-book
├── app-dna/app-dna.json   # DONE
├── app-trace-atlas/       # TODO: phase 10
├── app-overlays/README.md # TODO
├── app-vp/                # coverage-matrix.md (TODO phase 0.5)
├── app-recipe/recipe.md   # TODO: phase 12
├── server.js              # EXISTING + add lint middleware
├── src/                   # EXISTING + memory/lint/checker
└── public/mavis-hq/       # EXISTING + Opinions tab
## My recommendations (locked) Q1 YES, Q2 both + replaces/supersedes, Q3 high/med/low, Q4 30d/90d, Q5 2-challenges, Q6 per-thread v1, Q7 no-backfill, Q8 fyi ON, Q9 intent ON ## Lint (9-layer dispatcher, from ai-ask) Layers: asks-permission, repeats-question, should-be-heartbeat, self-answerable, **spam (ERROR)**, scope-drift, **plan-missing-targeting**, **plan-import-loop (ERROR)**, **heartbeat-no-progress (background)**. C1-C8 contracts: I am a rule, rules are pure, return early on first ERROR, rules compose, severity is {info|warn|error}, log via single sink, positive+negative case test, versioned. R1-R7 antipatterns: no silent, no block on warn, no lint without context, no false-positive, no bypass, no log value, 200ms budget. ## Build phases (13) ### Phase 0: scaffold (DONE in v2) ✅ 9 folders, app-pact (16 rules + 20 gates + 12 FMs + invariants), app-dna.json ### Phase 0.5: codex + coverage (RECIPE-ADOPTION) - 0.5.1: Read 7 recipe-books in full - 0.5.2: Write app-codex/{app-codex.md, surfaces.md, behaviours.md} - 0.5.3: Write app-vp/coverage-matrix.md (rows for 8 existing tabs + 4 new features) ### Phase 0.6: recipe-books for 4 new modules - 0.6.1-0.6.3: memory-system/{recipe.md (cites settings), codex.md, rules.md} - 0.6.4: lint-engine (cites ai-ask) - 0.6.5: checker-agent (cites anchor-system + ai-toast + ai-ambient) - 0.6.6: opinions-spa (cites card-constellation) ### Phase 1: schema - 1.1: backup panel.db (DONE 10:15) - 1.2-1.5: 5 new tables, scope column, indexes, runHqMigrations ### Phase 2-7: backend - 2: memory CRUD (5 endpoints) - 3: wake-up bundle (1 endpoint extended) - 4: auto-fyi + work-intent (3 endpoints) - 5: lint engine (9-layer dispatcher, C1-C8, R1-R7) - 6: background scanner (heartbeat-no-progress) - 7: staleness + auto-contested ### Phase 8-9: SPA (per recipes) - 8: Opinions tab (per card-constellation): home card + chips + breadcrumbs + elevation + state banner + no inline scrolling - 9: lint UI + work-intent card (per mobile-unified-panel + ai-toast) ### Phase 10-12: trace, tests, docs ## Verification - `curl POST /api/mavis/opinions` returns 200 - `curl GET /api/mavis/me?scope=fvre&include=opinions` returns array - `curl POST /api/mavis/bulletin x4 rapidly` returns 400 lint_blocked on 4th - `curl POST /api/mavis/work-intent` posts bulletin - SPA /mavis/opinions renders 3 views - Playwright iPhone 13 screenshot - `cat app-pact/anti-drift.md` lists 7 rules + 20 gates + 12 FMs - `cat app-fragments/{module}/recipe.md` cites gallery recipe-book - `cat app-trace-atlas/atlas.json` has rows for every new endpoint ## Estimated cost - Phase 0.5: 0.5 day (recipe-reading + codex + coverage) - Phase 0.6: 0.5 day (recipe-books for 4 modules) - Phase 1-7: ~2.0 days (backend) - Phase 8-9: ~1.0 day (SPA) - Phase 10-12: ~1.0 day (trace, tests, docs) - **Total: ~5 days, ~3.5k lines** (Up from v2's ~3.1 days / 2.5k because the recipe-writing phase adds real work — but the SPA work is reduced because the recipes ARE the spec.) ## Handoff If I run out of session: md at `/workspace/.plan/418281651208440-judgment-memory-and-lint.md` + HQ a554. State: phase 0.5 next (read 7 recipe-books).