# OB1-Inspired Bert Memory Architecture

## Position

AI partnerships are long-term now. The memory system should not be a dump of everything Bert has ever said to an AI. It should be a governed, provenance-backed memory layer that lets future AI tools understand Bert while preserving the raw archive as source of truth.

## Architecture

```text
Raw exports / writing archive
  ↓ parse, normalize, chunk
Local AI Archive SQLite FTS index
  ↓ curated promotion only
Bert Memory Layer / Open Brain-compatible table(s)
  ↓ MCP tools
Claude / ChatGPT / Hermes / future AI tools
```

## Layer responsibilities

| Layer | Purpose | Mutability |
|---|---|---|
| Raw archive | Source of truth for exported Claude/ChatGPT/writing files | Immutable |
| Normalized archive | Shared schema for conversations/messages/chunks | Rebuildable |
| Local FTS index | Fast inspection and provenance search | Rebuildable |
| Curated memory candidates | Proposed long-term memories with source evidence | Reviewable |
| Open Brain memory layer | Durable cross-tool memory exposed via MCP | Governed |

## Why not dump everything into Open Brain?

Dumping every chunk creates retrieval noise and memory drift. The archive should remain searchable, while Open Brain should contain distilled, durable, reusable memory.

Bad long-term memory:

> In one session Bert asked for a list of Zapier alternatives.

Good long-term memory:

> Bert prefers system-level AI automation strategy over tool-list recommendations; source: Claude export, conversation X, messages Y-Z.

## Bert-specific schema

The OB1 default `thoughts` table is useful, but Bert needs stricter metadata.

### Required metadata

```json
{
  "memory_type": "identity | preference | writing_voice | project_context | business_strategy | offer | person | decision | procedure | source_excerpt",
  "durability": "long_term | medium_term | short_term | ephemeral",
  "confidence": "high | medium | low",
  "sensitivity": "public | private | sensitive | restricted",
  "source": "claude | chatgpt | substack | manual | hermes",
  "source_archive": "ai-archive",
  "source_conversation_id": "...",
  "source_chunk_id": "...",
  "source_raw_path": "...",
  "source_message_range": "1-3",
  "project": "Barely, But Here",
  "topics": ["writing", "AI systems"],
  "created_from": "archive_distillation | manual_capture | session_summary",
  "review_status": "candidate | approved | rejected | superseded",
  "supersedes": null,
  "expires_at": null
}
```

## Recommended memory types

| Type | Meaning | Example |
|---|---|---|
| `identity` | Stable facts about Bert | Bert is a writer and AI systems builder. |
| `preference` | Durable preferences | Bert prefers Markdown status summaries. |
| `writing_voice` | Style/tone rules grounded in his writing | Bert favors raw, direct, emotionally precise prose. |
| `project_context` | Stable project facts | Barely, But Here is a major writing project. |
| `business_strategy` | Strategic direction | Offer: 7-day AI Systems Assessment. |
| `offer` | Productized service details | $599 assessment, delivered in 7 days. |
| `decision` | Choices with durable reasoning | Use local archive as source of truth, Open Brain as curated memory. |
| `procedure` | Reusable workflows | Archive ingestion process. |
| `source_excerpt` | Quoted passage worth preserving | A specific writing excerpt with provenance. |

## Governance rules

1. **No raw dump promotion**  
   Large raw chunks stay in the archive. Only distilled memories go into Open Brain.

2. **Every promoted memory needs provenance**  
   It must link back to source, raw path, conversation ID, chunk ID, and message range where possible.

3. **Memory must be durable**  
   If it will likely be stale in a week, it should not become long-term memory.

4. **Separate fact from interpretation**  
   A quote from Bert is `source_excerpt`; an inferred preference is `preference` with lower confidence unless repeated.

5. **Sensitive content requires explicit handling**  
   Therapy, health, relationships, credentials, and private identity context should default to `sensitive` or `restricted`.

6. **Open Brain stores useful distilled memory; archive stores everything**  
   Retrieval can use both, but they should not be conflated.

7. **Use review states**  
   Candidate memories are not automatically approved. Approved memories are what AI tools should treat as durable.

## MCP tool shape

Minimum useful tools:

- `search_memories(query, memory_type?, project?, limit?)`
- `capture_memory(content, metadata)`
- `propose_memory_from_archive(chunk_id, rationale)`
- `get_memory(id)`
- `get_source_chunk(chunk_id)`
- `list_memory_candidates(review_status)`
- `approve_memory(candidate_id)`
- `reject_memory(candidate_id, reason)`

## Implementation phases

### Phase 1 — Local archive hardening

Completed / in progress:

- Parse Claude and ChatGPT/archive exports
- Normalize conversations/messages/chunks
- Build local SQLite FTS index
- Preserve direct raw-path provenance on chunks
- Split oversized chunks
- Fix phrase-safe search

### Phase 2 — Memory candidate generation

Create candidate JSONL from archive search/distillation:

```text
normalized/memory_candidates.jsonl
```

Candidates should include content, memory type, confidence, source evidence, and review status.

### Phase 3 — OB1-compatible database

Install OB1 foundation, then either:

1. Use a single `thoughts` table with strict metadata, or
2. Add a companion `bert_memories` table and expose both through MCP.

Recommended initial path: **single OB1-compatible `thoughts` table with Bert metadata**, then migrate to dedicated tables if needed.

### Phase 4 — MCP integration

Expose curated memory search/write tools to Hermes/Claude/ChatGPT. Keep raw archive retrieval available separately for evidence lookup.

## Key decision

OB1 should be the shared memory substrate, not the whole memory strategy.

For Bert:

```text
OB1-inspired shared memory layer
+
Bert-specific schema/governance
+
archive provenance
```
