Architecture Diagram

Open Brain Architecture

How AI agents remember decisions, learn from experience, and improve over time. Persistent memory with user-controlled governance.

Diagram illustrates Open Brain's core concepts and architecture. No actual personal or project data included.

🧠What Open Brain Does

Open Brain (OB1) is a persistent memory system for AI agents. Instead of forgetting everything at the end of each conversation, AI assistants can capture, store, search, and recall structured knowledge across sessions.

  • Memories are reviewed before they become instructions — governance at the point of capture
  • Semantic search finds relevant past context, not just keyword matches
  • Artifacts and sources are tracked for traceability and evidence
  • Multi-workspace and multi-project scoping keeps data organized and private

📝The Memory Capture Loop

At the end of meaningful work, the AI agent calls writeback() with structured memory entries. These are not stored directly — they enter a review queue.

Agent Writes

After completing a task, the AI captures decisions, outputs, lessons, constraints, and next steps.

  • Summarized in natural language
  • Structured with memory_type tags
  • Scoped to workspace + project

Memory Enters Queue

All memories are stored with review_status='pending' and confidence scores (0-1.0).

  • Generated memories require confirmation by default
  • High-confidence memories may auto-approve (configurable)
  • Each memory tagged with source (agent, user, imported)

User Reviews

Via the dashboard (localhost or Vercel), the user sees pending memories with full provenance.

  • Inspect memory source and reasoning
  • View related artifacts and context
  • Approve, reject, flag as evidence-only, or mark stale

Memory Becomes Instruction

Confirmed memories are converted to embedding vectors and stored with use_policy tags.

  • can_use_as_instruction: true/false
  • can_use_as_evidence: true/false
  • Stale dates and revocation timestamps tracked

🔍Recall (The Smart Part)

When starting a new task, the AI system automatically queries for relevant memories using semantic similarity. No hardcoding — it's learned what matters.

query
The task/context is converted to a semantic embedding
search
Vector similarity search finds the top N most relevant memories
filtering
Memories are filtered by: scope (workspace/project), visibility, use_policy, staleness
ranking
Results ranked by similarity + confidence + freshness
injection
Top results injected into the AI's system prompt as 'recent context'
Example:

If you ask the AI about a prior decision, it automatically recalls the exact decision, who made it, when, and the reasoning — without you having to ask it to remember.

🏗️Architecture: The Layers

Three tiers handle capture, storage, recall, and governance.

Agent Layer

Layer 1
Includes
  • OpenClaw AI agent
  • OpenRouter/LLM integration
  • MCP client (talks to Memory API)
Interface

Calls openbrain_writeback() and openbrain_recall() via MCP tools

Memory API (Supabase Edge Function)

Layer 2
Includes
  • Writeback endpoint
  • Recall endpoint
  • Review governance
  • Vector embeddings
  • Access control
Interface

REST API with MCP_ACCESS_KEY authentication

Storage Layer (PostgreSQL + pgvector)

Layer 3
Includes
  • thoughts table (base OB1)
  • agent_memories table (governance)
  • Semantic indexes
  • Full-text search indexes
Interface

SQL via Supabase

Key Features That Matter

🏷️

Structured Memory Types

Memories are tagged as: decision, output, lesson, constraint, next_steps, or failure. The AI knows what kind of memory it's capturing.

📊

Confidence Scores

Every memory has a confidence (0-1.0). High confidence = likely to auto-approve. Low confidence = needs review.

🔒

Governance by Default

New memories start in 'pending' state. They don't become instructions until approved. You stay in control.

🔎

Semantic Search

Find memories by meaning, not keywords. 'Tell me what we learned about REST APIs' returns relevant lessons even if the exact words don't match.

🔗

Artifact Traceability

Memories link to files, repos, URLs, and code. Full audit trail of where insights came from.

🗂️

Multi-Tenant Scoping

Separate workspaces (agents), projects (contexts), and visibility levels. Your AI can have multiple independent memory stores.

📋

Evidence Tagging

Mark memories as 'evidence_only' — useful for context but not actionable as a standalone instruction.

Staleness & Revocation

Memories can be marked as stale, auto-expire after N days, or revoked entirely. Old info doesn't persist forever.

🎯Why This Matters for AI Systems

×

AI forgets between conversations

Persistent memory across sessions. Decisions made yesterday inform work today.

×

AI hallucinates or repeats mistakes

Lessons and constraints are recalled automatically. 'Don't do X' is reinforced every relevant session.

×

AI doesn't know what it doesn't know

Open questions and unresolved failures are captured and revisited. Learning compounds over time.

×

No audit trail for decisions

Full provenance: who decided, when, why, what evidence. Accountability built in.

×

AI can't be trusted with sensitive work

Governance layer: user approves before memory becomes instruction. AI stays in lane, human stays in control.

📊The Dashboard: Governance UI

Memory review happens via a clean, self-hosted dashboard. No sharing data with third parties. Zero public exposure.

Review Queue

Pending memories waiting for approval. Click to inspect, approve, reject, or mark as evidence-only.

Memory Inspector

Full memory details: content, source, confidence, related artifacts, recall history.

Recall Trace Debugger

See exactly what memories were recalled for a specific task. Trace why the AI did what it did.

Memory Browser

Search and browse all confirmed memories. Filter by type, project, or topic.

🔄Example Memory Lifecycle

Here's what actually happens, end to end:

1

Trigger

AI completes a complex task (e.g., tailoring a resume)

2

Capture

AI calls writeback() with: decisions made, resume versions created, Q&A insights, constraints discovered (e.g., 'never ask about PMP again')

3

Storage

Memories stored in database with review_status='pending', confidence=0.85

4

Review

User opens dashboard, sees 3 pending memories. Inspects each one, approves 2, rejects 1 for being too generic

5

Effect

Approved memories converted to embeddings, tagged with confidence and source. Now searchable.

6

Recall

Next time user needs resume help, AI automatically recalls: the prior Q&A responses, the constraint about PMP, the template that worked well

7

Outcome

Better, faster work. AI learns from every interaction.

This diagram illustrates Open Brain's architecture and core concepts.

No actual memory data, AI operations, or personal context from william.castro is represented. This is an educational overview of the system's design and capabilities.