GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - ambushalgorithm/agent-memory-mcp: A portable, Dockerized, Obsidian-backed memory system for AI agents โ€” MCP server, HTTP API, CLI, and hybrid search

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
brain
brain
 
 
clients
clients
 
 
data
data
 
 
docker
docker
 
 
docs
docs
 
 
examples
examples
 
 
mcp_server
mcp_server
 
 
memory_core
memory_core
 
 
scripts
scripts
 
 
templates/memory-adoption
templates/memory-adoption
 
 
tests
tests
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
config.memory_rules.yaml
config.memory_rules.yaml
 
 
docker-compose.yml
docker-compose.yml
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

Agent Memory MCP

A portable, Dockerized, Obsidian-backed memory system for AI agents.

MIT License Docker Python >=3.11

๐Ÿš€ Quick Start

Prerequisites: Docker, Make, curl.

  1. Clone the repository:

    git clone https://github.com/ambushalgorithm/agent-memory-mcp.git
    cd agent-memory-mcp
  2. Initialize data directories:

    make setup

    This creates ~/.agent-memory/brain/ and ~/.agent-memory/data/ with the required subdirectory structure. If you have existing data in the old ./brain/ or ./data/ locations (from a previous checkout), make setup migrates it automatically.

  3. Configure environment:

    cp .env.example .env
  4. Build and start:

    docker compose up --build
  5. Verify it's running:

    curl http://localhost:8787/v1/health

โœจ Features

  • ๐Ÿณ Dockerized โ€” One-command setup with docker compose up. No profile selection required.
  • ๐Ÿ” Hybrid Search โ€” FTS5 BM25 keyword search + vector ANN + RRF fusion for best results.
  • ๐Ÿง  Markdown Brain โ€” Human-readable markdown files as the source of truth in ~/.agent-memory/brain/.
  • ๐Ÿ“ฅ Proposal Inbox โ€” Agents write to inbox/, not directly to canon. Safety first.
  • ๐Ÿ”Œ API Interfaces โ€” MCP-style JSON-RPC over stdio for agents, HTTP API for apps, CLI for maintenance.
  • ๐Ÿ’พ Backup Ready โ€” Git versioned backups and Rsync file sync modes.
  • ๐Ÿ“ Obsidian-Compatible โ€” Browse and edit brain files with any markdown editor.
  • ๐Ÿ‘๏ธ Audit Events โ€” Full event log for all memory operations.
  • ๐Ÿ—๏ธ Context Pack Builder โ€” Build rich context packs for AI agents.
  • โšก Zero External Dependencies โ€” Local ONNX embeddings via fastembed.

๐Ÿง  Architecture

The system has three storage layers:

  1. ๐Ÿ“ Filesystem Brain โ€” Markdown files in ~/.agent-memory/brain/ organized by domain (agents, identity, projects, decisions, knowledge, etc.). This is the human-readable source of truth.
  2. ๐Ÿ—„๏ธ SQLite Database โ€” ~/.agent-memory/data/memory.sqlite stores metadata, FTS5 keyword index, vector embeddings, and the audit log.
  3. ๐ŸŒ API / Interface Layer โ€” MCP-style JSON-RPC over stdio (for agents), HTTP API (for apps/bots), and CLI (for maintenance).

Data Flow

query โ”€โ”€โ–บ SQLite FTS5 (BM25) โ”€โ”€โ”
                                โ”œโ”€โ–บ RRF fusion โ”€โ”€โ–บ ranked results
query โ”€โ”€โ–บ embed() โ†’ vec0 ANN  โ”€โ”€โ”˜

Hybrid Search Pipeline: When a query arrives, it runs two parallel searches โ€” keyword (FTS5 BM25) and semantic (vector ANN via sqlite-vec). Results are fused using Reciprocal Rank Fusion (RRF) to produce a single ranked list. The RRF constant (RRF_K, default 60) controls how aggressively low-ranked results from one method are boosted.

Safety Model

By default, agents do not overwrite canonical memory. They write proposals to ~/.agent-memory/brain/inbox/. A human or trusted process reviews and merges proposals into the appropriate domain directories.

Brain Directory Structure

~/.agent-memory/brain/
โ”œโ”€โ”€ inbox/         # Agent proposals (pending review)
โ”œโ”€โ”€ agents/        # Agent-specific rules and context
โ”œโ”€โ”€ identity/      # Core identity documents
โ”œโ”€โ”€ preferences/   # User preferences
โ”œโ”€โ”€ projects/      # Project memory
โ”œโ”€โ”€ _templates/    # Note templates
โ”œโ”€โ”€ decisions/     # Decision records
โ”œโ”€โ”€ knowledge/     # Knowledge base
โ”œโ”€โ”€ logs/          # Activity logs
โ””โ”€โ”€ systems/       # System-level memory

โš™๏ธ Configuration

Variable Default Description Required
EMBEDDING_PROVIDER fastembed Embedding provider: fastembed (local ONNX) or openai No
EMBEDDING_MODEL BAAI/bge-base-en-v1.5 Embedding model name No
OPENAI_API_KEY โ€” OpenAI API key Only when EMBEDDING_PROVIDER=openai
RRF_K 60 RRF constant for Reciprocal Rank Fusion No
EMBEDDING_DIM 768 Embedding vector dimension No

๐Ÿ“ See .env.example for the full list of available environment variables.

Key Dependencies

  • fastembed โ€” Local ONNX embedding generation (default provider)
  • sqlite-vec โ€” Vector ANN search inside SQLite

๐Ÿ“ก API

Health Check

curl -X GET http://localhost:8787/v1/health \
  -H 'Content-Type: application/json'

Response:

{"status": "ok", "timestamp": "2026-06-11T12:00:00Z"}

Search Memory

curl -X POST http://localhost:8787/v1/memory/search \
  -H 'Content-Type: application/json' \
  -d '{"query": "communication preferences"}'

Response:

{
  "results": [
    {"id": "pref-001", "content": "User prefers best answer first, then steps.", "score": 0.89}
  ]
}

Propose Memory

curl -X POST http://localhost:8787/v1/memory/propose \
  -H 'Content-Type: application/json' \
  -d '{
    "type": "preference",
    "tags": ["communication"],
    "content": "User prefers best answer first, then steps."
  }'

Response:

{"id": "proposal-042", "status": "accepted", "path": "inbox/proposal-042.md"}

CLI Examples

# Search from inside the container
docker compose exec memory python -m scripts.memory_cli search "preferences"

# Reindex the database from brain files
docker compose exec memory python -m scripts.memory_cli reindex

๐Ÿ”„ Reset

Two tiers of reset are available, depending on how much you want to clean up.

Quick Reset (database only)

Delete the SQLite database to start fresh. Brain files (Markdown source of truth) are preserved โ€” just run reindex afterward to repopulate.

Use this for: Daily resets when you want to keep your brain files.

# Via Makefile (recommended)
make reset
make up

# Via CLI (from inside a running container)
docker compose exec memory python -m scripts.memory_cli reset --force

# Manual
rm -f ~/.agent-memory/data/memory.sqlite*

After resetting, rebuild the database:

docker compose exec memory python -m scripts.memory_cli reindex

Full Wipe (removes everything)

Stops containers, deletes ALL data including brain files, and reinitializes from scratch.

Use this for: A completely clean slate โ€” all brain files, database, and directory structure are destroyed and recreated.

# Via Makefile (recommended)
make reset-full
make up

# Via CLI (from inside a running container)
docker compose exec memory python -m scripts.memory_cli reset --force --all

๐Ÿ’พ Backup

Git mode (versioned)

Creates a local git commit of all changes in ~/.agent-memory/ with a timestamp. Optionally push to a remote.

# Local timestamped commit
make backup

# With remote push
export [email protected]:user/agent-memory-backup.git
make backup

Rsync mode (file sync)

Syncs ~/.agent-memory/ to a configured destination.

# Default destination (~/pCloud/agent-memory-backup)
make backup-sync

# Custom destination
export AGENT_MEMORY_SYNC_DEST=/path/to/backup
make backup-sync

๐Ÿ“‹ See .env.example for backup configuration variables.

๐Ÿ—“๏ธ Scheduling Automated Backups

macOS (launchd)

scripts/install-backup-launchd.sh

Installs a launchd agent that runs make backup daily at 02:00. Logs are written to ~/Library/Logs/agent-memory-backup.log.

Linux (systemd)

scripts/install-backup-systemd.sh

Installs a systemd user timer that runs make backup daily (OnCalendar=daily).

Both installers check prerequisites, copy the unit files with the correct repository path, and verify the installation. Run them with no arguments for the default setup.

โœ… Project Status

This is a working v1 production scaffold โ€” actively developed and ready for use.

  • ๐Ÿณ Fully Dockerized with docker compose
  • โšก FastAPI HTTP server with OpenAPI docs
  • ๐Ÿ”Œ MCP-style JSON-RPC stdio server
  • ๐Ÿ—„๏ธ SQLite schema with FTS5 full-text search
  • ๐Ÿ” sqlite-vec vector ANN search
  • ๐Ÿงช Hybrid search (FTS5 BM25 + semantic vectors + RRF fusion)
  • ๐Ÿ“ Markdown parser with YAML frontmatter
  • ๐Ÿ—๏ธ Context pack builder
  • ๐Ÿ“ฅ Proposal inbox safety model
  • ๐Ÿ‘๏ธ Audit event logging
  • ๐Ÿ“– OpenAPI and MCP schema files

License

This project is licensed under the MIT License.

Contributing

Have a suggestion or found a bug? Open an issue or submit a pull request.

About

A portable, Dockerized, Obsidian-backed memory system for AI agents โ€” MCP server, HTTP API, CLI, and hybrid search

Topics

ai-agentsdockerfastapihybrid-searchmarkdownmcpmemory-systemobsidiansqlitevector-search

Resources

Readme
MIT license

Security policy

Security policy
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.