Skip to content

ClintMoody/ObsidianBrain

Repository files navigation

ObsidianBrain — Your AI's Memory, Visualized

Turn your AI's memory into a visual, browsable, editable knowledge graph.

Install MIT License 4 Sync Modes 10 Commands 5 Thought Types


The Problem

Open Brain stores your thoughts, ideas, observations, and references in a Supabase database. AI tools like Claude, ChatGPT, and Cursor can read and write to it through MCP. But there's a gap: you can't easily browse, organize, or visually explore your own thoughts. The data lives in a database table, not a place designed for human navigation.

The Solution

ObsidianBrain bridges that gap. It syncs every thought from your Open Brain database into an Obsidian vault as individual Markdown files. Each thought gets its own note with structured metadata, and topics and people become linked index notes.

The result: Obsidian becomes a local visual frontend for Open Brain, where you can browse your knowledge graph, click between connected ideas, and edit thoughts that sync back to the cloud.

In one sentence: ObsidianBrain turns your AI's memory database into a visual, browsable, editable knowledge graph on your computer.


How It Works

┌──────────────────┐     pull      ┌──────────────────┐     write     ┌──────────────────┐
│     Supabase     │ ───────────── │   ObsidianBrain  │ ───────────── │  Obsidian Vault  │
│  Cloud Database  │               │    CLI Engine     │               │  Local Markdown  │
│ (PostgreSQL +    │ ───────────── │  (Node.js / TS)   │ ───────────── │ (Graph + Links)  │
│  pgvector)       │     push      │                   │     read      │                  │
└──────────────────┘               └──────────────────┘               └──────────────────┘

Three layers:

  1. Supabase — Your Open Brain database with thoughts, embeddings, and metadata
  2. ObsidianBrain CLI — The sync engine that transforms and transfers data
  3. Obsidian Vault — Local Markdown files with wikilinks, graph view, and canvases

What You Get

Every Thought as a Note

Each thought becomes a Markdown file with YAML frontmatter (type, status, topics, people, action items, timestamps) and a colored callout banner showing its type.

Auto-Generated Index Notes

Every topic and person mentioned in your thoughts gets an index note that links back to all related thoughts. Click any [[Topic]] or [[Person]] link to see everything connected to it.

Visual Knowledge Graph

Obsidian's graph view renders your entire thought network. Nodes are color-coded by type — blue for observations, green for ideas, orange for tasks, purple for references, gold for person notes.

Bidirectional Sync

Edit thoughts in Obsidian and push changes back to Supabase. Create new notes locally and they get ingested with full embedding and metadata extraction via the Edge Function.

Document Import

Import .md and .docx files from any folder into the vault as browsable notes with change detection — only new or modified files get re-imported.

Canvas Diagrams

Auto-generated JSON Canvas files for topic and people networks. Open them in Obsidian for visual node-and-edge diagrams.


Installation

Prerequisites

Setup

# Clone and install
git clone https://github.com/ClintMoody/ObsidianBrain.git
cd ObsidianBrain
npm install

# Configure credentials
cp .env.example .env
# Edit .env with your Supabase URL and service role key

# Configure vault path
# Edit .obsidianbrain.yaml — set vault.path to your desired location

# Initialize and sync
npm run init        # Create vault directory structure
npm run full        # Pull thoughts + documents + generate links

Then open the vault folder in Obsidian.


Commands

Command What It Does
npm run init Create vault directory structure, Obsidian config, color system
npm run full The one you'll use most. Pull + documents + relink in one shot
npm run pull Pull new/updated thoughts from Supabase
npm run push Push vault edits back to Supabase
npm run mirror Bidirectional sync — deletions ignored (safest)
npm run sync Bidirectional sync — deletions propagate
npm run documents Import external documents into the vault
npm run relink Regenerate all topic/people index notes and canvases
npm run status Show sync state and counts
npm run stats Show Open Brain thought statistics

Add -- --dry-run to any sync command to preview changes without writing.


Sync Modes

PULL
Supabase → Vault

Remote is truth.
Safe starting point.
PUSH
Vault → Supabase

Local is truth.
Send edits back.
MIRROR
Both ways

Deletions ignored.
Recommended default.
SYNC
Both ways

Deletions propagate.
Use with care.

Conflict Resolution

When both sides change the same thought, ObsidianBrain supports four strategies:

Strategy Behavior
ask Pause and prompt (default)
prefer-local Always keep the Obsidian version
prefer-remote Always keep the Supabase version
skip Skip conflicting thoughts

Configure in .obsidianbrain.yaml under sync.conflict_strategy.


Vault Structure

your-vault/
├── Thoughts/
│   ├── Observations/     # What you've noticed or learned
│   ├── Tasks/             # Action items and to-dos
│   ├── Ideas/             # Creative sparks and proposals
│   ├── References/        # Facts, locations, specs
│   └── PersonNotes/       # Notes about specific people
├── Topics/                # Auto-generated index notes (one per topic)
├── People/                # Auto-generated index notes (one per person)
├── Documents/             # Imported external files
├── Canvas/                # Visual network diagrams
├── _sync/                 # Sync state (hidden from Obsidian)
└── .obsidian/             # Obsidian config, snippets, graph colors

Color System

Every note gets a colored callout banner showing its type. The same colors appear in the graph view, file explorer sidebar, and search results.

Type Color Graph Callout Icon
Observation Blue Eye
Task Orange-red Check circle
Idea Green Lightbulb
Reference Purple Bookmark
Person Note Gold User
Topic Index Indigo Hash
Person Index Warm orange User
Document Slate

Colors are applied automatically via a CSS snippet and graph color groups installed during npm run init.


Configuration

.env

SUPABASE_URL=https://YOUR_PROJECT_REF.supabase.co
SUPABASE_SERVICE_KEY=your-service-role-key-here
SUPABASE_INGEST_URL=https://YOUR_PROJECT_REF.supabase.co/functions/v1/ingest-thought

.obsidianbrain.yaml

supabase:
  url: "${SUPABASE_URL}"
  service_key: "${SUPABASE_SERVICE_KEY}"

edge_functions:
  ingest_url: "${SUPABASE_INGEST_URL}"

vault:
  path: "./vault"          # Where your Obsidian vault lives

documents:
  source_path: "./documents"  # Folder of .md/.docx files to import

sync:
  mode: "mirror"           # pull | push | sync | mirror
  conflict_strategy: "ask" # ask | prefer-local | prefer-remote | skip
  batch_size: 50
  dry_run: false

How Thoughts Become Notes

Each Open Brain thought is transformed into a Markdown file:

---
id: "724bd31e-2e34-4070-bd44-ebc80856ea4d"
type: observation
status: active
topics:
  - "DSP"
  - "product design"
people:
  - "Alice"
action_items: []
version: 1
created: 2026-03-04T05:07:34.922682+00:00
updated: 2026-03-04T05:07:34.922682+00:00
tags:
  - thought
  - observation
---

> [!observation] Observation

Your thought content appears here as the note body.

---
## Links
- Topics: [[DSP]], [[product design]]
- People: [[Alice]]

Frontmatter makes thoughts searchable and filterable. Wikilinks connect thoughts to topic and people index notes. Callout banners provide instant visual type identification.


Technical Details

  • Runtime: Node.js + TypeScript (via tsx)
  • Database: Supabase (PostgreSQL + pgvector)
  • Change detection: SHA-256 content hashing on both sides
  • Sync state: JSON file in _sync/.sync-state.json
  • Document conversion: Mammoth for .docx, passthrough for .md
  • Metadata mapping: type, topics, people, action_items are stored in the Supabase metadata JSON column and unpacked during sync

Tips

  • Don't edit files in Topics/, People/, or Canvas/ — they're regenerated on every relink
  • Edit thoughts freely in Thoughts/ — your changes persist through syncs
  • Don't delete _sync/ — it tracks sync state; removing it triggers a full re-sync
  • Use --dry-run if you're unsure what a command will do
  • Graph view filters: Filter by path:Thoughts/ to focus on your actual thoughts

Requirements

This tool is designed to work with the Open Brain Supabase schema. Your thoughts table should have:

Column Type Description
id uuid Primary key
content text Thought text
metadata jsonb Contains type, topics, people, action_items
status text active, deprecated, or superseded
version integer Version number
embedding vector pgvector embedding
created_at timestamptz Creation time
updated_at timestamptz Last update time
last_validated timestamptz Last validation time

License

MIT


Built to make your AI's memory yours to explore.

About

Bidirectional sync between Open Brain (Supabase) and Obsidian — turn your AI's memory into a visual knowledge graph

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages