PRD 4 of 25 · Memory + Dashboard (combined)

Persistent Vector Memory Architecture

Post-Barman 2026 tiered memory for Claude Code — Qdrant (hot/warm), pgvector + tsvector + pg_trgm cold tier, Memgraph link graph, Ollama embeddings, two-layer plugin hooks, 34 n8n workflows, and an integrated FastAPI + HTMX visualization dashboard. Zero cloud dependency.

Install

Checkout and configuration validated from a clean container; the service was not booted:

git clone https://github.com/bulletproofsoftware-ai/bulletproof-memory.git
cd bulletproof-memory
./install.sh                  # present and executable; not run end-to-end
Persistent Vector Memory architecture infographic
Architecture infographic — from bulletproof-memory/docs/media/
74
MCP Tools
34
n8n Workflows
67
Live Collections
2
Hook Layers
Persistent Vector Memory Architecture

1. Problem Statement

AI coding agents lose all context between sessions. Every new conversation starts from zero — no memory of past decisions, solved problems, learned patterns, infrastructure knowledge, or operational procedures. This makes agents structurally incapable of improvement.

But memory isn't just storage. Raw session data needs consolidation into knowledge. Knowledge needs to decay when outdated. Contradictions need detection and resolution. Agent identities need provenance tracking. Sensitive content needs classification and access control. Tool usage patterns need to reinforce successful workflows and let failed patterns fade. And all of this needs to happen automatically.

The deeper architectural challenge is that Claude Code reads hooks from settings.json, not from plugin manifests. Hooks defined only in plugin.json don't fire reliably for PostToolUse or Stop events. This means the hook architecture must be two-layer: settings.json for the hooks CC actually executes, and plugin hooks.json for the plugin lifecycle management that CC does read. Both layers reference the same idempotent scripts.

A second challenge surfaced in 2026: a single Qdrant pool degrades as memory volume grows. Recall quality drops because the active vector pool becomes dense with competitors (the n_near problem). The Barman 2026 paper showed that the non-geometric escape is to tier: keep a small active Qdrant pool (hot/warm), demote everything else to a Postgres cold tier with tsvector + pg_trgm hybrid search, and let the link graph live in Memgraph. This PRD describes the tiered system as actually deployed.

2. Architecture Overview

Hot Path vs Cold Path

Two Complementary Data Paths

The hot path handles real-time session interaction via MCP tools. The cold path handles background maintenance via n8n. They never block each other. The hot path is fail-open — if Qdrant is down, sessions continue with flat-file memory.

Hot Path (Real-Time)

Trigger: Claude calls MCP tools (74 registered in src/index.ts)

Flow: MCP Server (Node.js) → Ollama (nomic-embed-text, 768-dim) → Qdrant (hot/warm)

Latency: <500ms p95 recall, <1s p95 store

Also: Tool Facade scripts intercept Grep/Glob and serve memory content directly — Claude doesn't need to "decide" to check memory.

Cold Path (Maintenance)

Trigger: 34 scheduled n8n workflows + 1 webhook

Flow: n8n → Qdrant + pgvector APIs → batch operations (only 2 use LLM inference)

Cadence: every 4h (extraction), daily (01:00–06:30), weekly (Sun–Sat 02:00–07:30), monthly (1st 09:00 EST), webhook (gateway).

Full inventory in §9 Workflow Inventory below.

Tiered Storage (post-Barman 2026)

HOT · WARM

Live in Qdrant. Small active pool keeps competitor density (n_near) low, so every recall stays sharp. Promotions are managed by the daily Hippocampal Consolidation + weekly Hot Rehydration workflows.

COLD

Lives in claude-memory-postgres (pgvector/pgvector:pg16, port 5438). Hybrid tsvector + pg_trgm search escapes the geometric collapse that pure-vector cold tiers suffer at scale. Also holds operational audit data and the memory.migration_tracker.

LINK GRAPH

Lives in Memgraph (bolt://localhost:7687). RELATED edges between memory nodes power the graph_* MCP tools, knowledge graph rendering in the dashboard, and contradiction-resolution queries.

Two-Layer Hook Architecture

Critical Implementation Detail

Claude Code only reads hooks from settings.json reliably for PostToolUse and Stop events. Plugin hooks.json works for SessionStart and PreToolUse but not reliably for all event types. The solution: wire critical hooks in both places — the scripts are idempotent. Full enumeration in §8 Hook Inventory.

Container Infrastructure

ServiceContainerImageHost portPurpose
Qdrantqdrantqdrant/qdrant:latest6334Hot + warm + long-term + short-term vector tiers
Cold tierclaude-memory-postgrespgvector/pgvector:pg16127.0.0.1:5438tsvector + pg_trgm hybrid search, operational audit
n8n stateclaude-postgrespostgres:16-alpine5436Backs n8n workflow state
n8nn8nn8nio/n8n:latest567934 scheduled workflows + 1 webhook
Dashboardmemory-dashboardlocal build127.0.0.1:8092FastAPI + HTMX visualization (see §7)
Ollamahost-native11434nomic-embed-text 768-dim embeddings
Memgraphmemgraphmemgraph/memgraph-platformbolt://localhost:7687Link graph for RELATED edges

3. Key Components

3.1 MCP Tools (74 registered, 14 categories)

Measured live from ~/Code/claude-memory-mcp/src/index.ts — the published count is current.

Core Memory CRUD

memory_store (temporal classes, sensitivity, decay halflife), memory_recall, memory_forget (two-step), memory_scratch (ephemeral TTL), memory_verify (reset decay), memory_boost (Noguchi), pin_memory (defend against consolidation drain)

Lifecycle & Organization

memory_promote, memory_consolidate, memory_prune, memory_organize, memory_summarize, memory_impact, hippocampal_consolidation

Provenance & Causality

memory_provenance, memory_trace, contradiction_check, session_recalled

Episodic & Procedural

episode, learning, procedure, trajectory

Graph (Memgraph-backed)

graph_store, graph_query, graph_traverse, graph_path, graph_neighbors, graph_time_travel

Governance & Compliance

governance_report, governance_gap_analysis, compliance_dashboard, constitutional_contract, constitutional_monitor, guardrail_proof, data_sovereignty

Agent Identity & Coordination

agent_identity, nhi_lifecycle, parl_coordinator, a2a_protocol, task_specialization, bft_consensus, federation

Agent Ecosystem

agent_marketplace, agent_dev_env, meta_agent, digital_twin

Debugging & Analysis

causal_debug, flow_debug, time_travel, semantic_diff, self_assess

Performance & Cost

benchmark, benchmark_suite, cost_router, stigmergy

Search, Planning & Swarm

rag_search, predictive_preload, context_budget, temporal_planner, workflow_author, workflow_optimizer, micro_swarm, skill_discovery

Verification & Security

formal_verify, red_team (6 attack categories: goal hijacking, tool misuse, privilege escalation, memory poisoning, prompt injection, data exfiltration)

World Model & Multimodal

world_model (predict outcomes, observe actuals, update service models), multimodal_input (images, audio, diagrams → structured text)

3.2 Live Qdrant Collections (67)

The PRD originally listed 7 named collections. As more capabilities have been added, the count has grown to 67 live in Qdrant today. The principal ones:

CollectionPurposeRetention
memories_hotActive vector pool (Barman tier)Small, frequent rebalancing
memories_warmRecently active but coolingDaily transfer eligible
memories_coldDemoted to Postgres tsvector tierLong-term, search-only
claude_memoriesLong-term persistent knowledgePermanent (protected)
short_term_memory / working_memorySession + task scratchTTL / 60-min
learnings / proceduresDomain knowledge + reusable workflowsProtected (never pruned)
trajectories / episodesTool sequences + task execution recordsDecay / consolidation-eligible
heuristicsTask outcome metrics from task_outcome.pyFeeds self-assessment
pheromone_trailsStigmergy — successful tool chainsDaily decay + evaporation
causal_analysisFailure→fix patternsLong-term
constitutional_assessmentsAlignment drift observationsSession-scoped, flushed at Stop

3.3 Key Hook Behaviors

Tool Facade (memory-first-gate.sh)

Intercepts Grep and Glob calls. Before the tool executes, the facade embeds the search query, queries Qdrant, and if memory has the answer, serves it directly as the tool result. Claude never needs to "decide" to check memory.

Constitutional Observer

Fires on every tool call. Checks actions against session objectives for scope drift, target drift, and destructive operations. Flags are buffered to JSONL and flushed to constitutional_assessments by flush_insights.py at Stop. No LLM calls — must complete in <2s.

Task Outcome (heuristics)

Stop hook. Reads the tool chain buffer, classifies the task type, calculates success metrics, stores in heuristics. Feeds the self-assessment system and dashboard. Must run before flush_insights.py.

Self-Assessment (session_start.py)

Extended SessionStart hook. Beyond auto-recall, runs self-assessment against the heuristics collection and sets constitutional objectives for the session. Those objectives are what the observer checks against on every subsequent tool call.

4. Requirements

REQ-MEM-001 The MCP server shall expose 74 tools across 14 categories covering memory CRUD, lifecycle, provenance, episodic/procedural, governance, agent identity, ecosystem, debugging, performance, search, planning, swarm, verification, world model, and graph operations.
REQ-MEM-002 Qdrant collections shall implement tiered memory lifecycle (hot, warm, long-term, short-term) with differentiated retention. The cold tier shall live in pgvector + tsvector + pg_trgm Postgres, not in Qdrant.
REQ-MEM-003 A two-layer hook architecture shall wire critical hooks in both settings.json (what CC reads) and plugin hooks.json (plugin lifecycle), ensuring PostToolUse and Stop hooks fire reliably. Scripts must be idempotent.
REQ-MEM-004 Tool Facade scripts shall intercept exploratory searches (Grep, Glob) and serve memory content directly as tool results, removing the need for Claude to decide when to check memory.
REQ-MEM-005 The constitutional observer shall check every tool call against session objectives for scope drift, target drift, and destructive operations, buffering flags to JSONL with <2s latency.
REQ-MEM-006 Task outcome recording shall classify completed tasks, calculate success metrics, and store to a heuristics collection that feeds self-assessment at next session start.
REQ-MEM-007 34 n8n workflows shall automate the cold path across 6 cadences: every 4h (extraction), daily (01:00–06:30 consolidation/TTL/transfer/decay), weekly (Sun–Sat 02:00–07:30 pruning/abstraction/identity/security), monthly (governance), webhook (gateway), and on-demand utility.
REQ-MEM-008 Brain-inspired hippocampal consolidation shall implement 5-phase processing — replay, extraction, integration, pruning, reorganization — with hot/warm/cold tiering.
REQ-MEM-009 Stigmergy (pheromone trail) coordination shall reinforce successful tool chains, apply daily decay, evaporate trails below threshold, and provide guidance for future task routing.
REQ-MEM-010 Constitutional contracts shall enforce monotonically decreasing privileges in delegation chains with behavioral rules, data classification ceilings, and permitted/prohibited action lists.
REQ-MEM-011 Data sovereignty shall support per-memory jurisdiction tagging across 8 jurisdictions with GDPR cascading deletion and jurisdiction-filtered recall.
REQ-MEM-012 Agent identities shall be PQC-ready with Ed25519 key rotation, revocation, delegation token signing/verification, and C-BOM generation.
REQ-MEM-013 BFT consensus shall enable multi-agent weighted voting with evidence hashes and critical-decision escalation.
REQ-MEM-014 Time-travel debugging shall support session recording, frozen-state replay, step modification for what-if analysis, and execution comparison.
REQ-MEM-015 Red team self-testing shall support adversarial campaigns across 6 attack categories with severity tracking and trend reporting.
REQ-MEM-016 The system shall fail-open: if Qdrant or Ollama is down, sessions continue using flat-file MEMORY.md for context.
REQ-MEM-017 Multi-framework compliance shall cover ISO 42001, EU AI Act, and OWASP Agentic Top 10 with evidence packages, gap analysis, and scoring dashboards.
REQ-MEM-018 Local Ollama embeddings (nomic-embed-text, 768-dim) shall provide all vectorization with zero cloud dependency.
REQ-MEM-019 A DRM canary workflow shall write a known canary memory, attempt recall, and log results to audit.memory_health weekly to detect silent recall regressions.
REQ-MEM-020 A visualization dashboard (see §7) shall query Qdrant + the cold-tier Postgres directly and provide read-only inspection plus minimal mutation endpoints, with authentication, session cookies, and 127.0.0.1-only binding.

5. Prompt to Build It

Build a tiered persistent vector memory system for Claude Code (post-Barman 2026):

1. STORAGE TIERS:
   - HOT + WARM in Qdrant (port 6334): small active vector pools to keep
     competitor density low so every recall stays sharp
   - COLD in claude-memory-postgres (pgvector/pgvector:pg16 on 127.0.0.1:5438)
     using tsvector + pg_trgm hybrid search (NOT vectors) to escape geometric
     collapse at scale
   - LINK GRAPH in Memgraph (bolt://localhost:7687) for RELATED edges between
     memory nodes; powers graph_* MCP tools and dashboard graph view

2. MCP SERVER (Node.js, 74 tools across 14 categories):
   - Core CRUD: store (temporal classes, sensitivity, decay halflife), recall,
     forget (two-step), scratch (ephemeral TTL), verify (reset decay),
     boost (Noguchi self-organizing relevance), pin_memory (defend from drain)
   - Lifecycle: promote, consolidate, prune, organize, summarize,
     impact assess, hippocampal_consolidation (5-phase brain-inspired)
   - Graph: graph_store, graph_query, graph_traverse, graph_path,
     graph_neighbors, graph_time_travel
   - Provenance + episodic + procedural + governance + identity + ecosystem +
     debugging + performance + search-planning-swarm + verify-security +
     world-model + multimodal (see §3.1 for full enumeration)

3. TWO-LAYER HOOK ARCHITECTURE (both mandatory):
   - Layer 1 (settings.json — what CC reads directly):
     SessionStart   → load-project-memory.sh
     PreToolUse     → block_manual_memory_writes.sh
     PostToolUse    → post_tool_failure.py, tool_chain_tracker.py,
                       world_model_observer.py, auto_linker.py
     Stop           → notify-on-stop.sh
     SessionEnd     → capture-session.py, session-daily-note.sh,
                       session-to-text.sh, session-summarize.py
   - Layer 2 (claude-memory-plugin/hooks/hooks.json — auto-discovered):
     SessionStart        → session_start.py (self-assess + objectives)
     UserPromptSubmit    → user_prompt_capture.py
     PreToolUse          → pre_store, subagent_memory_inject,
                            plan_memory_inject, pre_action_recall,
                            constitutional_observer
     PostToolUse         → (mirrors of Layer 1, idempotent)
     PreCompact          → pre_compact.py
     Stop                → assistant_response_capture, task_outcome,
                            auto_trajectory, flush_insights,
                            auto_skill_generator, user_model_updater

4. N8N WORKFLOWS (34 total, see §9 for full schedule):
   - 1 every-4h LLM workflow (session transcript extraction)
   - 12 daily cron (01:00–06:30): contradiction check, conflict resolver,
     predictive patterns, TTL sweep, hippocampal consolidation, tier transfer,
     stigmergy decay, stigmergy reinforce, world model sync, causal patterns,
     session recording sync, memory verify sweep
   - 13 weekly cron (Sun–Sat 02:00–07:30): hot rehydration, organize
     clusters, active pruning, benchmark auto-record, DRM canary, permission
     review, identity auto-register, NHI lifecycle, self-assessment,
     red team scan, semantic diff, compliance dashboard, formal verify
   - 1 monthly (1st 09:00 EST): governance review → Obsidian
   - 1 webhook (claude-memory-gateway)
   - 6 utility / on-demand (compaction, hierarchical abstraction LLM,
     benchmark regression, compliance report, skill discovery,
     agent output visual formatter)
   - Only 2 use LLM inference (session extraction + hierarchical abstraction)

5. VISUALIZATION DASHBOARD (FastAPI + HTMX + Jinja2 + asyncpg):
   - 24 routes including login/logout, /memories, /search, /graph, /contacts,
     /decisions, /analytics, mutation endpoints (PUT/DELETE on memories),
     and /api/audit
   - Reads Qdrant + cold-tier Postgres directly (bypasses MCP)
   - Authenticated session cookies (SHA-256 password hash, signed cookies,
     7-day session), bound to 127.0.0.1 only
   - D3 force-directed graph for memory relationships, Chart.js analytics

6. DOCKER COMPOSE: qdrant, claude-postgres (n8n state), claude-memory-postgres
   (cold tier, pgvector image), n8n, memory-dashboard, memgraph.
   Ollama runs native on host (not containerized).

Build as MCP server (TypeScript) + Claude Code plugin (Python stdlib only)
+ n8n workflow definitions (JSON imports) + FastAPI dashboard (Python).
Wire hooks in BOTH settings.json and plugin hooks.json.

6. Design Decisions

Tiered storage over single Qdrant pool

A single growing Qdrant pool degrades recall quality — the n_near problem from Barman 2026. Keeping the active vector pool small and demoting cold entries to Postgres tsvector + pg_trgm escapes geometric collapse without losing searchability.

Two-Layer Hooks over Plugin-Only

Claude Code's plugin-manifest hook loading has a gap for PostToolUse and Stop. Wiring critical hooks in settings.json guarantees execution. The plugin layer adds richer behavior. Scripts are idempotent so the duplication is safe.

Tool Facade over Explicit Memory Checks

Requiring Claude to "decide" to check memory is fragile — it often skips under context pressure. The Tool Facade intercepts Grep/Glob and serves memory results directly. Claude gets the answer without needing to make the right decision.

Constitutional Observer over Post-Hoc Review

Checking alignment after the session is too late. The constitutional observer runs on every tool call in <2s, buffering drift flags. Stop flushes them to Qdrant for trend analysis. Real-time detection, batch storage.

34 workflows over a few monolithic ones

Each workflow runs independently at the right frequency. A slow LLM synthesis (weekly) never blocks a fast TTL sweep (daily). Each can fail without affecting the others. Sub-minute individual run times once volumes hit five figures.

Stigmergy over Explicit Routing Rules

Pheromone trails encode successful tool chains through observation, not programming. Daily decay prevents stale patterns from dominating. Agents get probabilistic guidance ("87% success rate for this pattern") instead of rigid rules.

Dashboard bypasses MCP

The dashboard queries Qdrant + Postgres directly rather than going through the MCP server. This keeps it independent of any Claude Code session, lets it run even if Claude isn't, and lets it inspect both hot and cold tiers in one view.

Memgraph for the link graph

Qdrant does vector similarity well; it does not do graph traversal. Memgraph handles RELATED edges natively with Bolt protocol, which is what powers the D3 knowledge graph in the dashboard and the graph_* MCP tools.

7. Visualization Dashboard

A vector store with 67 collections and thousands of entries is opaque by default. The dashboard makes the invisible visible — a lightweight FastAPI + HTMX + Jinja2 web application that queries Qdrant and the cold-tier Postgres directly, with no SPA build step and no node_modules.

Previously a separate PRD (Memory Dashboard). Now Section 7 of this combined document. The old memory-dashboard.html URL is preserved as a redirect stub pointing to this section.

Stack

Browser ↔ FastAPI (Python 3.11, uvicorn)
              └ Jinja2 templates + HTMX partials
              └ D3.js (force-directed knowledge graph)
              └ Chart.js (analytics dashboards)
              └ asyncpg → claude-memory-postgres (cold tier, tsvector + pg_trgm)
              └ httpx  → Qdrant REST API (hot + warm tiers)
              └ itsdangerous-signed session cookies, SHA-256 password hash

Container: memory-dashboard on 127.0.0.1:8092 (healthy)

Six Views

Overview

Collection stats, storage size, last backup, system health indicators. Landing view.

Knowledge Graph

D3 force-directed. Nodes sized by access frequency, colored by collection. Edges at cosine similarity > 0.7. Click to inspect, drag to rearrange, scroll to zoom.

Collection Browser

Paginated table per collection. Search, sort, filter by tags. Memory detail view with metadata, history, linked memories. Bulk tag/delete operations.

Analytics

Chart.js dashboards — growth over time, type distribution, access heatmap, dedup effectiveness, collection size comparison.

Semantic Search

Cross-collection query. Results ranked by similarity score with source collection and metadata. Bridges hot Qdrant and cold Postgres tiers.

Contacts & Decisions

Relational views over the cold-tier Postgres — contacts/household graph and decision log alongside vector memories.

API Surface

# Authenticated session required (7-day signed cookie)
GET    /login                 GET    /logout            GET   /health
GET    /                      GET    /memories         GET   /search
GET    /graph                 GET    /contacts         GET   /decisions
GET    /analytics             GET    /api/stats        GET   /api/recent
GET    /api/memories          POST   /api/search       GET   /api/graph-data
GET    /api/projects          GET    /api/tags         GET   /api/contacts
GET    /api/household         GET    /api/decisions    GET   /api/audit
PUT    /api/memories/{id}     DELETE /api/memories/{id}

Design Decisions

HTMX over React/Vue

Server-rendered fragments. No build step, no bundler, no hydration. The dashboard is a visualization tool, not an app.

Direct datastore queries

Reads Qdrant and Postgres directly instead of going through the MCP server. Operates independently of any Claude Code session.

Hybrid tier visibility

Surfaces hot (Qdrant), warm (Qdrant), and cold (Postgres tsvector + pg_trgm) tiers in one view so the Barman 2026 architecture is observable end-to-end.

Authenticated by default

Login flow with SHA-256 password hash and signed session cookies. Bound to 127.0.0.1 — never exposed to the public network.

8. Hook Inventory (both layers)

The complete set of hooks the running system wires. Layer 1 lives in ~/.claude/settings.json — Claude Code reads it directly, and it is mandatory for PostToolUse and Stop reliability. Layer 2 lives in ~/.claude/plugins/local/claude-memory-plugin/hooks/hooks.json — Claude Code auto-discovers it when the plugin is installed. Several scripts are referenced from both layers on purpose: this is the redundancy that protects against the plugin-loading gap.

Layer 1 — ~/.claude/settings.json

EventMatcherScriptPurpose
SessionStart*load-project-memory.shQdrant auto-recall + flat MEMORY.md load
PreToolUseWrite|Edit|NotebookEditblock_manual_memory_writes.shReject direct edits to MEMORY.md files
PostToolUse*post_tool_failure.pyLookup prior error→fix pattern
PostToolUse*tool_chain_tracker.pyBuffer chain for task-outcome heuristics
PostToolUseBashworld_model_observer.pyUpdate service-model predictions
PostToolUsemcp__claude-memory__memory_storeauto_linker.pyAuto-link new memory to related nodes
Notification*(cmux notify inline)Surface CC notifications to cmux
Stop*(cmux notify inline)"Task complete" cmux ping
Stop*notify-on-stop.shTelegram bridge for long-running tasks
SessionEnd*capture-session.pyArchive full transcript
SessionEnd*session-daily-note.shObsidian breadcrumb
SessionEnd*session-to-text.shPlain-text export for grep
SessionEnd*session-summarize.pyLLM summary into memory

Layer 2 — claude-memory-plugin/hooks/hooks.json

EventMatcherScriptPurpose
SessionStart*session_start.pySelf-assessment + constitutional objectives
UserPromptSubmit*user_prompt_capture.pyEmbed prompt → Qdrant search → inject context
PreToolUsemcp__claude-memory__memory_storepre_store.pyDedup + classification before write
PreToolUseAgentsubagent_memory_inject.pyPre-load memory into subagent context
PreToolUseEnterPlanModeplan_memory_inject.pyInject memories into plan context
PreToolUseWrite|Edit|Bash|NotebookEditpre_action_recall.pyPre-action recall on mutating tools
PreToolUseWrite|Edit|Bash|Read|Globconstitutional_observer.pyDrift check <2s/call, buffer flags
PostToolUse*post_tool_failure.py(mirrors Layer 1)
PostToolUse*tool_chain_tracker.py(mirrors Layer 1)
PostToolUseBashworld_model_observer.py(mirrors Layer 1)
PostToolUsemcp__claude-memory__memory_storeauto_linker.py(mirrors Layer 1)
PreCompact*pre_compact.pyEmergency state save before compression
Stop*assistant_response_capture.pyPersist final assistant response
Stop*task_outcome.pyClassify task → heuristics collection
Stop*auto_trajectory.pyRecord tool sequence as trajectory
Stop*flush_insights.pyFlush constitutional + stigmergy buffers
Stop*auto_skill_generator.pySynthesize emergent skills from trajectories
Stop*user_model_updater.pyUpdate user-model from session signals

Why PostToolUse scripts appear in both layers

Claude Code's PostToolUse and Stop hook loading from plugin manifests is not reliable in every release. Wiring the same scripts in settings.json guarantees execution. The scripts themselves are idempotent — running them twice produces the same result — so the redundancy is safe. If Claude Code closes the plugin-loading gap in the future, the Layer 1 entries can be removed without losing functionality.

9. n8n Workflow Inventory

The cold path is operated by 34 n8n workflows in ~/Code/claude-memory-mcp/workflows/. The MCP server (hot path) never blocks on these; they run on cron or fire on webhooks. Only 2 workflows use LLM inference (call Claude via the Anthropic API) — everything else is pure HTTP + Qdrant + Postgres operations.

Every 4 hours (1)

WorkflowPurpose
Session Transcript Extraction LLMLLM call extracts structured memories from raw session transcripts. First of the two LLM workflows.

Daily cron (12)

TimeWorkflowPurpose
01:00Contradiction CheckScan memories for semantic contradictions, mark for resolution.
01:30Daily Conflict ResolverApply resolution rules to the contradictions flagged by 01:00.
02:00Predictive Pattern ExtractionMine trajectories for recurring tool-chain patterns; feed predictive preload.
03:00 UTCTTL SweepUniversal GC: expire points whose TTL has passed across all collections.
03:00Hippocampal Consolidation5-phase consolidation: replay → extraction → integration → pruning → reorganization. Hot → warm with cycle audit.
03:30Tier TransferPromote warm → long-term; delete expired cold-tier entries.
04:00Stigmergy DecayPheromone-trail decay + evaporation below threshold. Pairs with Auto-Reinforce.
04:30Stigmergy Auto-ReinforceStrengthen pheromone trails for successful tool chains in the last 24h.
05:00World Model SyncReconcile predicted-vs-observed outcomes; update service models in world_model.
05:30Causal Pattern ExtractionBuild failure→fix edges into causal_analysis from recent post-tool failures.
06:00Session Recording SyncArchive previous day's session recordings to cold tier; index for time-travel debug.
06:30Memory Verify SweepReset decay clock on memories proven still-relevant by recent recalls.

Weekly cron (13)

Day/TimeWorkflowPurpose
Sun 02:00Hot RehydrationRe-warm the hot tier with high-relevance entries from warm/long-term. Counters HOT drain.
Sun 02:30Memory Organize ClustersCluster similar memories, merge near-duplicates above 0.92 cosine, archive originals.
Sun 05:00Active PruningDemote underused memories to cold tier with audit trail.
Sun 06:00Benchmark Auto-RecordRun 7-dim benchmark suite; record to benchmark_runs for regression detection.
Mon 03:00DRM CanaryWrite a canary, attempt recall, log to audit.memory_health. Detects silent recall regressions.
Mon 06:00Permission ReviewAudit NHI lifecycle for stale permissions; flag for revocation.
Mon 07:00Identity Auto-RegisterDiscover new agent identities, register in agent_identities with Ed25519 key.
Mon 07:30NHI Lifecycle TrackerTrack spawn/escalate/terminate transitions across non-human identities.
Tue 06:00Self-Assessment ReportAggregate the week's heuristics into a self-assessment digest for SessionStart.
Wed 02:00Red Team ScanRun adversarial campaigns across 6 attack categories; persist to red_team_campaigns.
Thu 03:00Semantic DiffCompare behavioral diffs between agent versions; persist to semantic_diffs.
Fri 07:00Compliance DashboardRefresh ISO 42001 + EU AI Act + OWASP Agentic Top 10 scorecards.
Sat 04:00Formal VerifyRun safety / liveness / invariant checks; emit Ed25519-signed verification certificates.

Monthly · Webhook · Utility

Monthly (1)

Monthly Review — 1st of month 09:00 EST. 4-way governance report → Obsidian: expiring, never-accessed, sensitive, redactions.

Webhook (1)

Claude Memory Gateway — the single webhook-triggered workflow. Real-time store/recall/rag API surface with auth routing. Everything else runs on cron.

Utility / on-demand (6)

Memory Compaction, Hierarchical Abstraction LLM, Benchmark Regression, Compliance Report, Skill Discovery, Agent Output Visual Formatter. Triggered manually or by other workflows.

Why so many separate workflows?

Each workflow runs independently at the right frequency. A slow LLM synthesis (weekly) never blocks a fast TTL sweep (daily). Each can fail without affecting the others. The original 2-workflow approach (organize + forget) didn't scale — once memory volume hit five figures the operations needed to be separated to keep individual run times under a minute.

10. Integration Points

→ Conductor

Conductor stores trajectories, learnings, and task outcomes through MCP tools. Agent identity, NHI lifecycle, BFT consensus, and task specialization tools support the conductor's bundled agent workforce. The conductor state schema references governance manifests stored in memory. See the Conductor PRD.

→ Governance

7 governance tools connect memory to the governance framework. Constitutional contracts and monitor tools enforce delegation chain privileges. Data sovereignty and guardrail proofs provide compliance evidence. The governance plugin's policy engine evaluates memory writes via memory_integrity_hook.py. See the Governance PRD.

→ Context-Guard

Context budget management (5 compartments) bridges memory and context window management. PreCompact hooks coordinate — context-guard records the compaction event, the memory plugin saves state. Predictive preloading reduces recall latency. See the Context-Guard PRD.

→ Plugin ecosystem

The memory system is a Claude Code plugin with both settings.json and plugin hooks.json wiring. 6 slash commands (/memory-search, /memory-save, /memory-resume, /forget, /memory-stats, /exit) provide user-facing interfaces. MCP server registered via .mcp.json.

11. Operations

Backup & Recovery

Failure Modes

Component DownImpactFallback
OllamaCannot embed new contentSession continues with flat MEMORY.md
QdrantCannot store/recall hot/warmEmpty results; MEMORY.md still loads
claude-memory-postgresCold tier unreadableRecalls degrade gracefully to hot/warm Qdrant only
n8nMaintenance stopsVectors accumulate; run workflows manually after restore
MemgraphGraph queries failgraph_* tools return empty; vector recall unaffected
DashboardUI unavailableMemory operations continue (dashboard is read-only inspection)

SLOs

MetricTarget
memory_recall latency<500ms p95
memory_store latency<1s p95
Dedup false positive rate<1%
Constitutional observer latency<2s per tool call
Weekly prune coverage100% of collections scanned
Backup freshness<7 days
DRM canary success rate100% (weekly)

Monitoring

The debug-memory diagnostic checks all hops: Ollama process + API + model, Qdrant container + API + all 67 collections, cold-tier Postgres, MCP server + hooks, n8n container + API, hook pipeline integrity, Memgraph reachability, and the Memory Dashboard container.