Skip to main content

Persistent memory graph for AI coding agents — semantic search, knowledge graph, and time-based decay over MCP

Project description

Synapto

CI Python 3.11+ License: MIT PyPI version

Your AI agent forgets everything between sessions. Synapto fixes that.

Flat-file memory (MEMORY.md) doesn't scale — no search, no structure, no decay. Synapto gives any MCP-compatible agent a real memory: store once, recall by meaning, watch bad memories fade and good ones persist.

# remember
"Hermes uses the outbox relay pattern for Kafka"

# recall — weeks later, different session
"How does Hermes handle messaging?" [stable] Hermes uses the outbox relay pattern for Kafka (score=0.94, trust=0.65)

Works with Claude Code, Cursor, Windsurf, Codex, LangGraph, Agno, or any MCP client.

Try it in 60 seconds

Docker:

git clone https://github.com/ramonlimaramos/synapto.git && cd synapto
docker compose up -d
docker compose exec synapto synapto search "hello world"

Local:

pip install synapto
createdb synapto && psql -d synapto -c "CREATE EXTENSION vector;"
synapto init
synapto search "hello world"

What it does

Search — Ask a question, get the best memory. Behind the scenes, three signals (vector similarity, full-text, and compositional algebra) are fused into one score. You just call recall.

Graph — Entities are auto-extracted and linked. Ask "what depends on Kafka?" and get an answer via graph traversal, not keyword guessing.

Decay — Core memories live forever. Ephemeral notes fade in hours. Working context lasts about a week. Memories that get used stay alive; unused ones sink.

Trust — Mark memories as helpful or not. Bad info gets demoted 2x faster than good info gets promoted. Over time, your memory self-cleans.

Quickstart

Prerequisites

  • Python 3.11+
  • PostgreSQL 14+ with pgvector
  • Redis 7+

Install and initialize

pip install synapto
createdb synapto && psql -d synapto -c "CREATE EXTENSION vector;"
synapto init            # or: synapto init --interactive

Connect to your agent

The recommended way is uvx — it auto-updates on every launch, no manual upgrades:

Claude Code (~/.claude/.mcp.json):

{
  "mcpServers": {
    "synapto": {
      "command": "uvx",
      "args": ["synapto", "serve"]
    }
  }
}

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "synapto": {
      "command": "uvx",
      "args": ["synapto", "serve"]
    }
  }
}

Why uvx? It resolves the latest version from PyPI each time your agent starts. No pip install --upgrade needed — you always get the latest features and fixes automatically.

Restart your agent. Synapto tools appear automatically.

MCP Tools

Tool What it does
remember Store a memory (entities and search vectors are created automatically)
recall Search memories by meaning
relate Link two entities ("Hermes" --[produces]--> "agent.messages")
forget Soft-delete a memory
trust_feedback Mark a memory as helpful or unhelpful
find_contradictions Find memory pairs that disagree
graph_query Walk the knowledge graph (N-hop)
list_entities Browse known entities
memory_stats View counts and distribution
maintain Run decay and cleanup

CLI

synapto serve                   # start MCP server
synapto search "kafka topics"   # search from terminal
synapto doctor                  # check postgres, redis, embeddings health
synapto stats                   # memory statistics
synapto migrate status          # show applied/pending migrations
synapto export -o backup.json   # export memories
synapto import MEMORY.md --format markdown  # migrate from flat files

Depth Layers

Layer Half-life Example
core Forever "Our API uses REST, never GraphQL"
stable ~6 months "Auth service is in Go, everything else is Python"
working ~1 week "Currently refactoring the payment module"
ephemeral ~6 hours "Debugging: the timeout was 30s, changed to 60s"

How it works under the hood

When you call recall("kafka patterns"), Synapto runs three searches in parallel and fuses the results:

  1. Vector similarity (pgvector HNSW) — finds semantically close memories
  2. Full-text search (tsvector + BM25) — finds keyword matches
  3. HRR compositional algebra — detects if "kafka" plays a structural role in the memory, not just appears as a word

The scores are combined via Reciprocal Rank Fusion, then weighted by decay, trust, and depth layer.

HRR (Holographic Reduced Representations) also enables queries that no vector database can do:

  • probe("kafka") — find memories where Kafka is structurally involved (not just mentioned)
  • reason(["kafka", "hermes"]) — find memories about both entities simultaneously (vector-space AND)
  • contradict() — find memory pairs that share entities but say different things

More in docs/hrr.md.

Configuration

Config file: ~/.synapto/config.toml

[postgresql]
dsn = "postgresql://localhost/synapto"

[redis]
url = "redis://localhost:6379/0"

[embeddings]
provider = ""  # auto-select (sentence-transformers on CPU, openai if API key set)
model = ""

[defaults]
tenant = "default"

[decay]
ephemeral_max_age_hours = 24
purge_after_days = 30

All values can be overridden with environment variables: SYNAPTO_PG_DSN, SYNAPTO_REDIS_URL, SYNAPTO_EMBEDDING_PROVIDER, SYNAPTO_DEFAULT_TENANT.

Using as a Python library

from synapto.db.postgres import PostgresClient
from synapto.db.migrations import run_migrations, ensure_hnsw_index
from synapto.embeddings.registry import get_provider
from synapto.search.hybrid import hybrid_search

pg = PostgresClient("postgresql://localhost/synapto")
await pg.connect()
await run_migrations(pg)

provider = get_provider()
await ensure_hnsw_index(pg, provider.dimension)

results = await hybrid_search(pg, provider, "outbox pattern", tenant="myproject")
for r in results:
    print(f"[{r.depth_layer}] trust={r.trust_score:.2f} {r.content}")

Documentation

HRR deep dive Compositional algebra, probe, reason, contradict
Trust scoring Feedback loop and contradiction workflow
Migrations Versioned SQL files with rollback
Claude Code Setup and usage with Claude Code
Cursor Setup and usage with Cursor
LangGraph Using Synapto as a LangGraph tool
Agno Using Synapto with Agno agents

Development

git clone https://github.com/ramonlimaramos/synapto.git
cd synapto
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
synapto init
pytest                          # 83 tests

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

synapto-0.2.0.tar.gz (229.4 kB view details)

Uploaded Source

Built Distribution

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

synapto-0.2.0-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file synapto-0.2.0.tar.gz.

File metadata

  • Download URL: synapto-0.2.0.tar.gz
  • Upload date:
  • Size: 229.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for synapto-0.2.0.tar.gz
Algorithm Hash digest
SHA256 28c9079333d670f7b929f6f5cedb511b29ab9aa5b2ad384d675dabe116349d30
MD5 193b6752487c0493c97f717ba8e190cf
BLAKE2b-256 317b0507f5c7d266af9dba720ef53f99893a77b4d7ebe8d78904cf9835c1d904

See more details on using hashes here.

Provenance

The following attestation bundles were made for synapto-0.2.0.tar.gz:

Publisher: release.yml on ramonlimaramos/synapto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file synapto-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: synapto-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for synapto-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a9f837dd039f97d7e449f1c246c1dd0c5fb93b962173bb8511616adbc539a0d
MD5 304028c37b840d916f4010834662470a
BLAKE2b-256 3f26042dbb88b94910fb0c542253350808f0c92e5499e6d3714cb3a850e99014

See more details on using hashes here.

Provenance

The following attestation bundles were made for synapto-0.2.0-py3-none-any.whl:

Publisher: release.yml on ramonlimaramos/synapto

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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