ERINYS

ERINYS

Reflexive Memory for AI Agents - MCP Server. Remembers, forgets, questions, and bites.

Category
Visit Server

README

<p align="center"> <img src="assets/logo.jpg" alt="ERINYS" width="200"> </p>

ERINYS β€” Reflexive Memory for AI Agents

πŸ‡―πŸ‡΅ ζ—₯本θͺžη‰ˆ / Japanese

From memories that existed, it even creates memories that never did.

AI agent memory systems have always mimicked human memory. Short-term, long-term, episodic, semantic β€” textbook categories bolted straight onto implementations.

Something always felt off.

Humans forget. But existing memory systems don't. They grow endlessly, serving stale facts with the same weight as fresh ones. Humans notice "wait, didn't you say something different before?" But memory systems silently overwrite. Humans connect two unrelated experiences and think "oh, I can use that here." But memory systems just store and retrieve.

What needed to be mimicked wasn't the taxonomy of memory. It was the behavior.

That discomfort is what summoned ERINYS.

ERINYS is a guard dog. It remembers, forgets, questions, and bites.

What Makes ERINYS Different

Forgetting. Most memory systems only accumulate. ERINYS decays memories over time following the Ebbinghaus forgetting curve. Old noise sinks. Frequently accessed knowledge floats. Search results stay relevant without manual curation.

Distillation. A specific bugfix ("JWT httpOnly flag was missing") automatically generates three layers: the concrete fact β†’ a reusable pattern ("new endpoints need a security checklist") β†’ a universal principle ("security defaults should be safe without opt-in"). No other memory system does this.

Dream Cycle. Two memories are fed to an LLM: "is there a connection?" Candidate pairs are selected by semantic similarity β€” close enough to be related (cosine > 0.65), far enough to not be redundant (< 0.90). Scheduled overnight via cron, it finds connections you'd never think to look for. No magic β€” just automated note comparison at scale.

Design Philosophy

Memory has layers

Not all memory is equal. ERINYS organizes knowledge by abstraction level:

  • Concrete β€” what happened. "The JWT httpOnly flag was missing on /api/auth."
  • Abstract β€” patterns from facts. "New API endpoints need a security header checklist."
  • Meta β€” principles from patterns. "Security defaults should be safe without manual opt-in."

A single bugfix generates all three through distillation. The meta layer accumulates principles that transfer across projects and tech stacks.

Forgetting is a feature

Every memory has a strength score that decays over time. A memory saved 6 months ago ranks lower than one saved yesterday. Memories accessed frequently resist decay β€” repeated retrieval reinforces them.

When strength drops below a threshold, the memory becomes a pruning candidate. The database stays lean. Search stays relevant.

Facts change. History shouldn't disappear

When information updates β€” "we moved from AWS to GCP" β€” ERINYS doesn't overwrite. It creates a supersede chain: the old fact is marked as replaced but preserved. You can ask "what did we believe in March?" and get the answer that was true then.

Contradictions should be caught

If memory contains both "use PostgreSQL" and "use SQLite", ERINYS detects the conflict. Instead of silently switching, the agent asks: "you previously chose PostgreSQL β€” has the requirement changed?"

Search finds meaning, not just keywords

Two searches run simultaneously and fuse results:

  • Keyword search (FTS5) β€” exact term matching.
  • Vector search (sqlite-vec) β€” semantic similarity. "authentication" finds "login", "JWT", "session tokens".

Results merge via Reciprocal Rank Fusion (RRF). High in both = highest score.

Everything stays local

Single SQLite file. No cloud APIs. No API keys. No subscriptions. Offline-capable. Your agent's memory never leaves your machine.

Use Cases

1. Cross-Session Memory for Coding Agents

# Agent saves a learning after fixing a bug
erinys_save(
  title="Fixed JWT httpOnly flag missing",
  content="Cookie was accessible via JS. Added httpOnly: true, secure: true, sameSite: strict.",
  type="bugfix",
  project="my-app"
)

# Next week, similar task β€” agent searches memory
erinys_search(query="authentication cookie security", project="my-app")
# β†’ Returns the JWT fix with relevance score

2. Contradiction Detection

erinys_save(title="Database choice", content="Using SQLite for simplicity", project="my-app")
erinys_conflict_check(observation_id=42)
# β†’ "⚠️ Conflicts with #18: 'Using PostgreSQL for production reliability'"

3. Dream Cycle β€” Overnight Knowledge Synthesis

erinys_dream(max_collisions=10)
# Picks memory pairs in the "sweet spot" (cosine 0.65–0.90)
# Memory A: "RTK reduces token usage by 60-90%"
# Memory B: "Bootstrap Gate takes 3 seconds due to multiple script calls"
# β†’ Insight: "Apply RTK prefix to Bootstrap Gate scripts to reduce overhead"

4. Temporal Queries

erinys_timeline(query="deployment target", as_of="2026-03-01")
# β†’ "AWS EC2 (decided 2026-02-15)"

erinys_timeline(query="deployment target", as_of="2026-04-01")
# β†’ "GCP Cloud Run (superseded AWS on 2026-03-20)"

5. Knowledge Distillation

erinys_save(title="Forgot CORS headers on new endpoint", type="bugfix", ...)
erinys_distill(observation_id=50, level="meta")
# β†’ concrete: "CORS headers missing on /api/v2/users endpoint"
# β†’ abstract: "New API endpoints need a CORS review checklist"
# β†’ meta:     "Security concerns should be opt-out, not opt-in"

6. Obsidian Export

erinys_export(format="markdown")
# β†’ Generates .md files with [[wikilinks]]
# Drop into Obsidian β†’ instant knowledge graph

Quick Start

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# Run as MCP server (stdio)
python -m erinys_memory.server

# Run tests
PYTHONPATH=src pytest tests/ -v

MCP Configuration

Claude Desktop / Claude Code

{
  "mcpServers": {
    "erinys": {
      "command": "/path/to/ERINYS-mem/.venv/bin/python3",
      "args": ["-m", "erinys_memory.server"],
      "env": {
        "ERINYS_DB_PATH": "~/.erinys/memory.db"
      }
    }
  }
}

Gemini (Antigravity)

Add to ~/.gemini/antigravity/settings.json under mcpServers:

{
  "erinys": {
    "command": "/path/to/ERINYS-mem/.venv/bin/python3",
    "args": ["-m", "erinys_memory.server"],
    "env": {
      "ERINYS_DB_PATH": "~/.erinys/memory.db"
    }
  }
}

Environment Variables

Variable Default Description
ERINYS_DB_PATH ~/.erinys/memory.db SQLite database path
ERINYS_EMBEDDING_MODEL BAAI/bge-small-en-v1.5 fastembed model

Tools (25)

Core

  • erinys_save β€” Save observation (with topic_key upsert)
  • erinys_get β€” Get by ID (full content, untruncated)
  • erinys_update β€” Partial update
  • erinys_delete β€” Delete with FK cascade
  • erinys_search β€” RRF hybrid search (FTS5 + vector)
  • erinys_save_prompt β€” Save user prompt
  • erinys_recall β€” Recent observations
  • erinys_context β€” Session context recall
  • erinys_export β€” Obsidian-compatible markdown export
  • erinys_backup β€” SQLite backup
  • erinys_stats β€” Database statistics

Graph

  • erinys_link β€” Create typed edge
  • erinys_traverse β€” BFS graph traversal
  • erinys_prune β€” Prune weak/decayed edges

Temporal

  • erinys_reinforce β€” Boost observation strength
  • erinys_supersede β€” Version an observation
  • erinys_timeline β€” Query as-of timestamp
  • erinys_conflict_check β€” Detect contradictions

Dream Cycle

  • erinys_collide β€” Collide two observations via LLM
  • erinys_dream β€” Batch collision cycle

Distillation

  • erinys_distill β€” 3-granularity abstraction (concrete β†’ abstract β†’ meta)

Batch & Eval

  • erinys_batch_save β€” Bulk save with auto-linking
  • erinys_eval β€” LOCOMO-inspired quality metrics

Session

  • erinys_session_start β€” Start session
  • erinys_session_end β€” End session with summary
  • erinys_session_summary β€” Save structured summary

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     FastMCP Server       β”‚  25 tools, unified envelope
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  search.py  β”‚ graph.py   β”‚  RRF hybrid β”‚ typed edges
β”‚  decay.py   β”‚ session.py β”‚  Ebbinghaus β”‚ lifecycle
β”‚  temporal.pyβ”‚collider.py β”‚  versioning β”‚ cross-pollination
β”‚  distill.py β”‚ db.py      β”‚  abstractionβ”‚ SQLite + vec
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  embedding.py            β”‚  fastembed (BAAI/bge-small-en-v1.5)
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  SQLite + FTS5 + vec0    β”‚  Local-first, no network at runtime
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Roadmap

  • [ ] Dream Daemon β€” Background auto-execution of Dream Cycle
  • [x] Auto-Distill on Save β€” Trigger 3-granularity distillation on every save
  • [ ] Auto-Prune β€” GC decayed observations when DB exceeds size threshold
  • [ ] Cron-ready CLI β€” erinys dream --max 10 for scheduled overnight synthesis
  • [ ] PyPI package β€” pip install erinys-memory
  • [ ] Multi-agent support β€” Scoped memory per agent identity

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured