ERINYS
ERINYS — AI 代理的反射式记忆
它不仅能创造曾经存在的记忆,甚至能创造从未发生过的记忆。
AI 代理的记忆系统一直都在模仿人类记忆。短期、长期、情景、语义——这些教科书式的分类直接被生搬硬套到了实现中。
总觉得哪里不对劲。
人类会遗忘,但现有的记忆系统不会。它们无休止地增长,用陈旧的事实与新鲜的事实同等对待。人类会注意到“等等,你之前不是这么说的吗?”,但记忆系统会悄无声息地覆盖。人类会将两个不相关的经历联系起来并思考“哦,我可以在这里用上它”,但记忆系统只会存储和检索。
需要模仿的不是记忆的分类学,而是其行为。
正是这种不适感召唤了 ERINYS。
ERINYS 是一条看门狗。它会记忆、遗忘、质疑并反击。
ERINYS 的独特之处
遗忘。 大多数记忆系统只会累积。ERINYS 遵循艾宾浩斯遗忘曲线,让记忆随时间衰减。旧的噪音会沉淀,频繁访问的知识会浮现。搜索结果无需手动整理也能保持相关性。
提炼。 一个具体的 Bug 修复(“缺少 JWT httpOnly 标志”)会自动生成三个层级:具体事实 → 可重用的模式(“新端点需要安全检查清单”)→ 通用原则(“安全默认设置应在无需选择的情况下保持安全”)。没有其他记忆系统能做到这一点。
梦境循环 (Dream Cycle)。 将两条记忆输入给 LLM:“它们之间有联系吗?”候选对通过语义相似度进行选择——足够接近以至于相关(余弦相似度 > 0.65),又足够遥远以至于不冗余(< 0.90)。通过 cron 定时在夜间运行,它能发现你从未想过要寻找的联系。没有魔法,只是大规模的自动化笔记比对。
Related MCP server: cell-mem
设计哲学
记忆具有层级
并非所有记忆都是平等的。ERINYS 按抽象级别组织知识:
具体 (Concrete) — 发生了什么。“
/api/auth缺少 JWT httpOnly 标志。”抽象 (Abstract) — 从事实中提取的模式。“新的 API 端点需要安全标头检查清单。”
元 (Meta) — 从模式中提取的原则。“安全默认设置应在无需手动选择的情况下保持安全。”
单个 Bug 修复通过提炼生成所有这三个层级。元层级积累了可在不同项目和技术栈之间迁移的原则。
遗忘是一种特性
每条记忆都有一个随时间衰减的强度分数。6 个月前保存的记忆排名低于昨天保存的记忆。频繁访问的记忆会抵抗衰减——重复检索会强化它们。
当强度降至阈值以下时,该记忆就成为修剪候选对象。数据库保持精简,搜索保持相关性。
事实会变,历史不应消失
当信息更新时——“我们从 AWS 迁移到了 GCP”——ERINYS 不会覆盖。它会创建一个替代链:旧事实被标记为已替换但被保留。你可以问“我们在三月份时认为是什么?”,并得到当时正确答案。
矛盾应被捕捉
如果记忆中同时包含“使用 PostgreSQL”和“使用 SQLite”,ERINYS 会检测到冲突。代理不会悄悄切换,而是会询问:“你之前选择了 PostgreSQL——需求发生变化了吗?”
搜索寻找的是意义,而非仅仅是关键词
同时运行两次搜索并融合结果:
关键词搜索 (FTS5) — 精确术语匹配。
向量搜索 (sqlite-vec) — 语义相似度。“authentication”可以找到“login”、“JWT”、“session tokens”。
结果通过倒数排名融合 (RRF) 合并。两者排名都高 = 最高分。
一切保持本地
单个 SQLite 文件。没有云 API。没有 API 密钥。没有订阅。支持离线。你代理的记忆永远不会离开你的机器。
使用场景
1. 编码代理的跨会话记忆
# 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 score2. 矛盾检测
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. 梦境循环 — 夜间知识合成
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. 时间查询
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. 知识提炼
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 导出
erinys_export(format="markdown")
# → Generates .md files with [[wikilinks]]
# Drop into Obsidian → instant knowledge graph快速开始
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/ -vMCP 配置
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)
添加到 ~/.gemini/antigravity/settings.json 中的 mcpServers 下:
{
"erinys": {
"command": "/path/to/ERINYS-mem/.venv/bin/python3",
"args": ["-m", "erinys_memory.server"],
"env": {
"ERINYS_DB_PATH": "~/.erinys/memory.db"
}
}
}环境变量
变量 | 默认值 | 描述 |
|
| SQLite 数据库路径 |
|
| fastembed 模型 |
工具 (25)
核心
erinys_save— 保存观察结果(带有 topic_key 更新插入)erinys_get— 按 ID 获取(完整内容,不截断)erinys_update— 部分更新erinys_delete— 删除(带有外键级联)erinys_search— RRF 混合搜索 (FTS5 + 向量)erinys_save_prompt— 保存用户提示词erinys_recall— 最近的观察结果erinys_context— 会话上下文回顾erinys_export— 兼容 Obsidian 的 Markdown 导出erinys_backup— SQLite 备份erinys_stats— 数据库统计信息
图谱
erinys_link— 创建类型化边erinys_traverse— BFS 图遍历erinys_prune— 修剪弱/衰减的边
时间
erinys_reinforce— 增强观察强度erinys_supersede— 对观察结果进行版本控制erinys_timeline— 按时间戳查询erinys_conflict_check— 检测矛盾
梦境循环
erinys_collide— 通过 LLM 碰撞两条观察结果erinys_dream— 批量碰撞循环
提炼
erinys_distill— 3 粒度抽象(具体 → 抽象 → 元)
批处理与评估
erinys_batch_save— 批量保存(带自动链接)erinys_eval— 受 LOCOMO 启发的质量指标
会话
erinys_session_start— 开始会话erinys_session_end— 结束会话(带摘要)erinys_session_summary— 保存结构化摘要
ERINYS 的对比
特性 | ERINYS | Mem0 | 官方 MCP Memory |
混合搜索 (关键词 + 向量) | ✅ FTS5 + sqlite-vec RRF | ✅ 向量 + 图谱 | ❌ 仅知识图谱 |
时间衰减遗忘 | ✅ 艾宾浩斯曲线 | ⚠️ 优先级评分 | ❌ |
3 级提炼 (具体 → 抽象 → 元) | ✅ | ❌ | ❌ |
梦境循环 (基于碰撞的洞察) | ✅ | ❌ | ❌ |
矛盾检测 | ✅ | ⚠️ 通过解析器覆盖 | ❌ |
时间查询 (“我们在三月份时认为是什么?”) | ✅ 替代链 | ⚠️ 图谱失效 | ❌ |
本地优先 (无云 API) | ✅ SQLite 单文件 | ❌ 默认云端 | ✅ |
Obsidian 导出 | ✅ [[wikilinks]] | ❌ | ❌ |
保存时自动提炼 | ✅ | ❌ | ❌ |
MCP 原生 | ✅ 25 个工具 | ✅ | ✅ |
自我评估 (LOCOMO 指标) | ✅ | ❌ | ❌ |
简而言之 — 大多数记忆服务器只是存储和检索。ERINYS 还会遗忘、提炼和做梦。
架构
┌──────────────────────────┐
│ 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
└──────────────────────────┘路线图
[ ] 梦境守护进程 (Dream Daemon) — 后台自动执行梦境循环
[x] 保存时自动提炼 — 每次保存时触发 3 粒度提炼
[ ] 自动修剪 — 当数据库超过大小阈值时进行 GC 衰减观察
[ ] 支持 Cron 的 CLI —
erinys dream --max 10用于定时夜间合成[ ] PyPI 包 —
pip install erinys-memory[ ] 多代理支持 — 每个代理身份的范围化记忆
许可证
MIT
Available Tools
29 toolserinys_backfillErinys BackfillC
Plan or apply bounded historical records with event-ledger idempotency.
Inputs: items (required), run_key (required), mode, expected_plan_digest, +1 more. Returns: object
erinys_backupErinys BackupC
Create a consistent SQLite backup and return backup metadata.
Inputs: path. Returns: object
erinys_batch_saveErinys Batch SaveC
Bulk-add observations with automatic similarity linking.
Inputs: items (required), auto_link. Returns: object
erinys_collideErinys CollideC
Manually collide two observations to generate insight.
Inputs: obs_a_id (required), obs_b_id (required). Returns: object
erinys_conflict_checkErinys Conflict CheckC
Detect contradicting observations.
Inputs: observation_id (required). Returns: object
erinys_contextErinys ContextC
Get recent session context for a project.
Inputs: project (required), limit, intended_use. Returns: object
erinys_deleteErinys DeleteB
Delete an observation and cascade dependent rows via FK rules.
Inputs: id (required). Returns: object
erinys_distillErinys DistillC
Distill observation to higher abstraction level.
Inputs: observation_id (required), level. Returns: object
erinys_dreamErinys DreamC
Run Dream Cycle: batch collision of candidate memory pairs.
Inputs: max_collisions. Returns: object
erinys_evalErinys EvalC
Self-evaluate memory quality (LOCOMO-inspired metrics).
Inputs: project. Returns: object
erinys_exportErinys ExportC
Export observations as markdown payload (Obsidian-compatible [[wikilinks]]).
Inputs: format, project. Returns: object
erinys_forgetErinys ForgetA
VMG Verified Forgetting: 観測とその distilled 派生物を全 DB substrate から 削除し、不在を membership test で実証する。
forgetting は派生物に伝播する: distilled 子孫を含む closure ごと忘れる (子に親の情報が残るのを防ぐ)。closure を leaf-first で単一Txで削除し、 observations/vec/FTS(トリガ)/edges/collisions(CASCADE) を消す。 erinys_delete と違い、子を持つ親も忘れられる(NO ACTION FK を closure で解消)。 dry_run(既定)では削除せず closure と現在の在席のみ返す。
範囲外(正直な明示): Obsidian 書庫は次回 export の orphan 掃除で遅延除去、 .bak バックアップは復元用に設計上保持するため、この DB 検証の対象外。
Inputs: id (required), dry_run. Returns: object
erinys_getErinys GetB
Get a single observation by ID (full content, untruncated).
Inputs: id (required), intended_use. Returns: object
erinys_lineageErinys LineageB
VMG Provenance Visibility: 記憶の出自系譜を祖先方向に辿って返す。
各ノードの provenance.parents(無ければ distilled_from)を辿り、 どの記憶からどう派生したかの lineage-complete な鎖を構成する。
Inputs: id (required), max_depth. Returns: object
erinys_linkErinys LinkC
Create typed edge between observations.
Inputs: relation (required), source_id (required), target_id (required), weight. Returns: object
erinys_pruneErinys PruneC
Prune decayed observations below threshold.
Inputs: dry_run, threshold. Returns: object
erinys_recallErinys RecallC
Recall recent observations for context.
Inputs: limit, project, intended_use. Returns: object
erinys_reinforceErinys ReinforceC
Reinforce an observation by updating access_count and last_accessed.
Inputs: observation_id (required). Returns: object
erinys_saveErinys SaveB
Save a structured observation to ERINYS memory.
principal: この記憶を書いた主体(例 claude-opus-4-8 / codex)。省略時は env ERINYS_PRINCIPAL → "unknown"。VMG provenance に記録される。
P0-7 (opt-in): allowed_projects / allowed_scopes は書き込み許可の access gate。明示引数 > env(ERINYS_ALLOWED_PROJECTS / ERINYS_ALLOWED_SCOPES)> 無効(None)。どれも設定されなければ従来どおり無条件に保存する。許可外の project/scope への書き込みは POLICY_DENIED で拒否する。
Inputs: title (required), content (required), type, scope, +8 more. Returns: object
erinys_save_promptErinys Save PromptC
Save a user prompt to track intent and goals.
Inputs: content (required), project, session_id. Returns: object
erinys_searchErinys SearchC
RRF hybrid search (FTS5 keyword + vector similarity).
P0-7 (opt-in): allowed_projects / allowed_scopes は取得許可の access gate。 明示引数 > env(ERINYS_ALLOWED_PROJECTS / ERINYS_ALLOWED_SCOPES)> 無効 (None)。設定時は、許可外の project/scope の行を結果から除外する(global scope は常に可視)。どれも設定されなければ従来どおり全件返す。
Inputs: query (required), limit, project, principal, +6 more. Returns: object
erinys_session_endErinys Session EndC
End a session with optional summary.
Inputs: id (required), summary. Returns: object
erinys_session_startErinys Session StartC
Start a new session.
Inputs: id (required), project (required), directory. Returns: object
erinys_session_summaryErinys Session SummaryC
Save comprehensive end-of-session summary (Goal/Discoveries/Accomplished).
Inputs: content (required), project (required), session_id. Returns: object
erinys_statsErinys StatsC
Database statistics: observation count, project breakdown, health.
Inputs: project. Returns: object
erinys_supersedeErinys SupersedeC
Supersede an old observation with updated fact.
Inputs: old_id (required), reason (required), new_content (required). Returns: object
erinys_timelineErinys TimelineC
Query facts valid at a specific point in time.
Inputs: query (required), as_of. Returns: object
erinys_traverseErinys TraverseC
Traverse graph from a starting observation.
Inputs: start_id (required), max_depth, relation_filter. Returns: object
erinys_updateErinys UpdateB
Update an existing observation. Only provided fields are changed.
Inputs: id (required), type, scope, title, +3 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 29 tools
Several tools have overlapping memory-access purposes: erinys_recall vs erinys_context vs erinys_search, erinys_save vs erinys_batch_save, erinys_delete vs erinys_forget, and erinys_session_summary vs erinys_session_end. The descriptions clarify nuances, but an agent may still hesitate between near-duplicate operations.
All tools consistently use snake_case with the erinys_ prefix. However, the naming mixes verb-only forms (recall, export, link, prune), noun forms (context, stats, timeline, lineage), and compound forms (batch_save, conflict_check), so the pattern is mostly but not fully predictable.
With 29 tools, the surface is heavy for a memory server and exceeds the typical well-scoped range. Some operations could likely be consolidated or made optional groups, especially the near-duplicate save/read/delete/session variants.
The server covers observation CRUD, search, sessions, graph linking/traversal, temporal/provenance operations, export, backup, stats, and advanced maintenance such as dreaming and forgetting. Minor gaps exist, such as backup without restore/import and link creation without an explicit unlink operation.
Maintenance
Related MCP Connectors
Cloud-hosted MCP server for durable AI memory
Cloudflare Workers MCP server: agent-memory
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Graph-native persistent memory for AI agents — 33 MCP tools, zero-LLM writes.
Related MCP Servers
AlicenseNot gradedqualityAmaintenanceMCP server providing cognitive memory tools (remember, recall, think, etc.) for AI agents, enabling forgetting, consolidation, and contradiction detection.179Apache 2.0- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides AI agents with persistent, multi-layered memory inspired by the human brain, including consolidation, self-reflection, and generative replay.1MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI agents persistent, forgetting memory with layered decay, semantic search via token overlap, and zero external dependencies.MIT
- AlicenseAqualityBmaintenanceAn MCP server providing long-term memory for AI agents with forgetting curves, consolidation, and graph-based retrieval.1014 npmMIT