Brand Memory
The shared nervous system between all of Anomalia's AI subsystems. Every fact the chatbot has learned, every constraint the user has stated, every insight from competitor research — they all live here, and every future prompt reads them.
Memory entry structure
| Field | What it is |
|---|---|
| category | voice · constraint · fact · preference · insight |
| key | Short snake_case identifier (e.g. brand_tone) |
| value | One-sentence fact |
| source | chat · research · onboarding · user · analysis |
| confidence | 0.0 — 1.0 |
| times_reinforced | How many times confirmed |
| layer | session · project · global |
buildMemoryContext() loads all entries with confidence ≥ 0.4, groups by category, and formats as a ## BRAND MEMORY section appended to every profile's ai_context.
Who writes to memory
| Source | When | Confidence |
|---|---|---|
| User (chat tool / Studio) | Explicit instruction | 1.0 |
| Chat auto-extraction | Every chat turn (fire-and-forget) | 0.5–0.9 |
| Caption edit learning | User edits an AI caption before approving | 0.8–1.0 |
| Competitor research | After strategy report | 0.7–0.8 |
| Weekly reflection | Monday retrospective | 0.6 |
| Onboarding | After context synthesis | 0.8 |
Write behaviour: upsert on (brand_id, key). Same key = reinforce (bump confidence +0.05, increment counter). New key = insert.
Conflicts: when two sources register contradictory info, both coexist. The chatbot surfaces the conflict to the user for resolution.
Dream: weekly maintenance
A weekly cron runs runDream() across all brands:
- Decay — entries not reinforced in 30 days lose confidence (−0.1, floor 0.3)
- Archive — entries below 0.3 confidence or expired are deleted
- Promote — session-layer entries reinforced 3+ times become project-level
This is how Anomalia gets better week after week instead of staying frozen. The user experiences it as "Anomalia knows me" — it remembers their voice preferences, constraints, and what works.