Skip to main content

AI memory as a typed knowledge graph in Obsidian. Like Mem0, but you own your data.

Project description

๐Ÿง  ObsidianMem

AI memory as a typed knowledge graph in Obsidian.

Every conversation with your AI builds a structured second brain โ€” people, projects, technologies, companies โ€” all as .md files with [[wikilinks]] you can browse in Obsidian.

Like Mem0, but you own your data.


Why ObsidianMem?

Mem0 Basic Memory ObsidianMem
Storage Cloud vectors Flat markdown Typed knowledge graph in .md
Entity types โŒ Flat facts โŒ One note per chat โœ… Person, Project, Technology, Company
Relations โŒ โŒ โœ… works_at, uses, depends_on
Obsidian graph โŒ Partial โœ… Full [[wikilinks]] + graph view
Semantic search โœ… Cloud โŒ โœ… Local embeddings (384D)
Own your data โŒ Cloud lock-in โœ… โœ… Plain .md files
LLM agnostic โŒ Partial โœ… Claude / GPT / Ollama
Pricing $24/mo+ $14/mo Free & open source

What it actually does

You chat with Claude (or any LLM). ObsidianMem automatically:

  1. Extracts entities, facts, and relationships from your conversations
  2. Creates typed .md files in your Obsidian vault
  3. Links everything with [[wikilinks]] and YAML frontmatter
  4. Indexes with local vector embeddings for semantic search
  5. Recalls relevant context when you need it โ€” by meaning, not just keywords
You: "I work at Uzum Bank, backend developer on Spring Boot"
                    โ†“ LLM extracts knowledge
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚  vault/Ali.md               โ”‚
         โ”‚  type: person               โ”‚
         โ”‚  - backend developer        โ”‚
         โ”‚  - โ†’ works_at [[Uzum Bank]] โ”‚
         โ”‚  - โ†’ uses [[Spring Boot]]   โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚  vault/Uzum Bank.md          โ”‚
         โ”‚  type: company               โ”‚
         โ”‚  - โ† works_at [[Ali]]        โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Open in Obsidian โ†’ see your knowledge graph growing from every conversation.


Quick Start

1. Install

pip install obsidian-mem[all]

2. Setup (one command)

obsidian-mem init

This will:

  • Ask for your LLM provider and API key
  • Create ~/.obsidian-mem/config.yaml and vault
  • Auto-configure Claude Desktop MCP integration
  • Tell you to restart Claude Desktop

That's it. Talk to Claude โ€” it remembers and recalls automatically.

Non-interactive:

obsidian-mem init --provider anthropic --api-key sk-ant-...

Other commands:

obsidian-mem status    # Check setup
obsidian-mem stats     # Vault statistics
obsidian-mem server    # Start MCP server manually

Python SDK (Mem0-compatible API)

from obsidian_mem import Memory

m = Memory(
    vault_path="./my-brain",
    llm_provider="anthropic",
    api_key="sk-ant-..."
)

# Remember
m.add("I work at Uzum Bank, backend on Spring Boot and PostgreSQL", user_id="ali")

# Semantic search (finds by MEANING, not just keywords)
results = m.search("database issues", user_id="ali")
for r in results:
    print(f"{r.memory.name} (score={r.score:.2f})")
    print(r.memory.facts)

# Get everything
all_memories = m.get_all(user_id="ali")

# Stats
print(m.stats(user_id="ali"))

MCP Server (Claude Desktop)

obsidian-mem init sets this up automatically. Manual setup:

obsidian-mem server --config ~/.obsidian-mem/config.yaml

Auto-Memory Middleware

Drop-in wrapper that automatically remembers and recalls:

from obsidian_mem import Memory
from obsidian_mem_middleware import AutoMemory

m = Memory(vault_path="./vault", llm_provider="anthropic", api_key="sk-ant-...")
auto = AutoMemory(memory=m, user_id="ali")

# Automatically: recall โ†’ inject context โ†’ LLM โ†’ remember
response = auto.chat("Help me fix the PostgreSQL connection pool issue")

How It Works

Conversation โ†’ Extractor (LLM) โ†’ Entities + Facts + Relations
                                          โ†“
                                   Vault Manager โ†’ .md files (Obsidian)
                                          โ†“
                                   Vector Index โ†’ embeddings (SQLite)
                                          โ†“
                                   Recall: Vector Search + Graph Expansion

Semantic Search (Hybrid)

3-level search strategy:

  1. Vector Search โ€” all-MiniLM-L6-v2 (80MB, runs locally). Finds "database" when you search "PostgreSQL" โ€” by meaning, not keywords.
  2. Graph Expansion โ€” follows [[wikilinks]] from top results. Found PostgreSQL? Also returns linked Project Alpha.
  3. Text Fallback โ€” substring match for edge cases.

Entity Types

Type Examples
person Team members, contacts
project Services, repos, products
technology PostgreSQL, Spring Boot, Kafka
company Employers, clients, partners
concept Patterns, strategies, ideas

File Format

---
type: technology
created: 2024-02-10 15:30
updated: 2024-02-11 09:15
tags: [technology]
---

# PostgreSQL

## Facts

- Main database, version 15
- Connection pool issue in [[Project Alpha]]

## Relations

- โ† uses [[Project Alpha]]: Main DB
- โ† uses [[Ali]]: Primary expertise

Configuration

# config.yaml
vault_path: "./vault"

llm:
  provider: "anthropic"  # anthropic | openai | ollama | mock
  anthropic:
    api_key: "sk-ant-..."
    model: "claude-sonnet-4-20250514"

semantic_search:
  enabled: true
Provider Install Cost
Anthropic (Claude) pip install obsidian-mem[anthropic] API pricing
OpenAI (GPT) pip install obsidian-mem[openai] API pricing
Ollama (local) Install ollama Free

Roadmap

  • Typed entity extraction (person, project, technology, company)
  • Obsidian vault with [[wikilinks]] + YAML frontmatter
  • MCP Server for Claude Desktop
  • Semantic search with local embeddings
  • Hybrid retrieval (vector + graph)
  • Mem0-compatible Python SDK
  • Auto-memory middleware
  • Entity deduplication
  • Obsidian plugin (TypeScript)
  • Web dashboard
  • REST API

Contributing

git clone https://github.com/alibaizhanov/obsidian-mem
cd obsidian-mem
pip install -e ".[all,dev]"
pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obsidian_mem-0.4.0.tar.gz (45.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obsidian_mem-0.4.0-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file obsidian_mem-0.4.0.tar.gz.

File metadata

  • Download URL: obsidian_mem-0.4.0.tar.gz
  • Upload date:
  • Size: 45.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for obsidian_mem-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4990ee6407e429515decd5fd57506476670ced320b50be94d3219645d7fca917
MD5 e80bb65fbf412779a3cda375230bb57b
BLAKE2b-256 10569602e68b12c32c7332f3451d3ce14119ad1d6b210fc8c0e8d989cfe0c6c5

See more details on using hashes here.

File details

Details for the file obsidian_mem-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: obsidian_mem-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 49.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for obsidian_mem-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 578b096de0a743a8d0b53fc0eb8ac46187a7dc9d1e155565856ecd5007b717d1
MD5 51a34490e3f40c722e8f7d1c9025229f
BLAKE2b-256 84782a7c831f26d3bb6ced90b5011fb674a25b2f482a2ca71819faaa5ccc8ddd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page