Skip to main content
Glama

ERINYS — AIエージェントのための再帰的メモリ

🇯🇵 日本語版 / Japanese

かつて存在した記憶から、存在しなかった記憶さえも作り出す。

AIエージェントのメモリシステムは、常に人間の記憶を模倣してきました。短期、長期、エピソード記憶、意味記憶といった教科書的な分類が、そのまま実装に組み込まれてきました。

何かがおかしいと感じていました。

人間は忘れます。しかし、既存のメモリシステムは忘れません。それらは際限なく肥大化し、古い事実を新しい事実と同じ重みで提供し続けます。人間は「あれ、前と言っていることが違わない?」と気づきますが、メモリシステムは静かに上書きしてしまいます。人間は無関係な二つの経験を結びつけて「おっ、ここで使えるかも」と考えますが、メモリシステムはただ保存して取り出すだけです。

模倣すべきだったのは、記憶の分類学ではありません。その「振る舞い」でした。

その違和感こそが、ERINYSを呼び起こしたのです。

ERINYSは番犬です。記憶し、忘れ、問いかけ、そして噛みつきます。

ERINYSが他と違う理由

忘却。 ほとんどのメモリシステムは蓄積する一方です。ERINYSはエビングハウスの忘却曲線に従い、時間の経過とともに記憶を減衰させます。古いノイズは沈み、頻繁にアクセスされる知識は浮上します。検索結果は手動で整理しなくても関連性を保ちます。

蒸留。 特定のバグ修正(「JWTのhttpOnlyフラグが欠落していた」)は、自動的に3つのレイヤーを生成します。具体的な事実 → 再利用可能なパターン(「新しいエンドポイントにはセキュリティチェックリストが必要」) → 普遍的な原則(「セキュリティのデフォルトはオプトインなしで安全であるべき」)。これを行うメモリシステムは他にありません。

ドリームサイクル。 2つの記憶がLLMに送られ、「関連性はあるか?」が判断されます。候補となるペアは意味的類似性によって選択されます(関連性があるほど近く、冗長にならないほど遠い:コサイン類似度 > 0.65 かつ < 0.90)。cronを通じて夜間にスケジュールされ、自分では思いつかないようなつながりを見つけ出します。魔法ではありません。単なる大規模な自動ノート比較です。

Related MCP server: cell-mem

設計哲学

記憶には階層がある

すべての記憶が平等ではありません。ERINYSは知識を抽象度で整理します:

  • 具体的 (Concrete) — 何が起きたか。「/api/authでJWTのhttpOnlyフラグが欠落していた。」

  • 抽象的 (Abstract) — 事実からのパターン。「新しいAPIエンドポイントにはセキュリティヘッダーのチェックリストが必要。」

  • メタ (Meta) — パターンからの原則。「セキュリティのデフォルトは手動のオプトインなしで安全であるべき。」

一つのバグ修正が、蒸留を通じてこれらすべてを生成します。メタレイヤーは、プロジェクトや技術スタックを超えて転用可能な原則を蓄積します。

忘却は機能である

すべての記憶には、時間とともに減衰する強度スコアがあります。6ヶ月前に保存された記憶は、昨日保存された記憶よりもランクが低くなります。頻繁にアクセスされる記憶は減衰に抵抗します。繰り返し取り出すことで強化されるのです。

強度が閾値を下回ると、その記憶は削除候補となります。データベースは軽量に保たれ、検索は関連性を維持します。

事実は変わる。歴史は消えるべきではない

情報が更新されたとき(「AWSからGCPへ移行した」)も、ERINYSは上書きしません。置換チェーンを作成します。古い事実は「置換済み」とマークされますが、保存はされます。「3月時点ではどう考えていた?」と尋ねれば、当時正しかった答えが得られます。

矛盾は捉えられるべきである

メモリに「PostgreSQLを使う」と「SQLiteを使う」の両方が含まれている場合、ERINYSはその矛盾を検知します。黙って切り替えるのではなく、エージェントはこう尋ねます。「以前はPostgreSQLを選択していましたが、要件が変わりましたか?」

検索はキーワードではなく意味を見つける

2つの検索が同時に実行され、結果が融合されます:

  • キーワード検索 (FTS5) — 完全一致。

  • ベクトル検索 (sqlite-vec) — 意味的類似性。「認証」で「ログイン」「JWT」「セッション・トークン」が見つかります。

結果はReciprocal Rank Fusion (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 score

2. 矛盾検知

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/ -v

MCP設定

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"
    }
  }
}

環境変数

変数

デフォルト

説明

ERINYS_DB_PATH

~/.erinys/memory.db

SQLiteデータベースのパス

ERINYS_EMBEDDING_MODEL

BAAI/bge-small-en-v1.5

fastembedモデル

ツール (25)

コア

  • erinys_save — 観測結果を保存 (topic_keyによるアップサート)

  • erinys_get — IDで取得 (全文、切り捨てなし)

  • erinys_update — 部分更新

  • erinys_delete — FKカスケードによる削除

  • 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を介して2つの観測結果を衝突させる

  • erinys_dream — バッチ衝突サイクル

蒸留

  • erinys_distill — 3段階の抽象化 (具体的 → 抽象的 → メタ)

バッチ & 評価

  • erinys_batch_save — 自動リンク付きの一括保存

  • erinys_eval — LOCOMOに触発された品質メトリクス

セッション

  • erinys_session_start — セッション開始

  • erinys_session_end — 要約付きでセッション終了

  • erinys_session_summary — 構造化された要約の保存

ERINYSの比較

機能

ERINYS

Mem0

公式MCPメモリ

ハイブリッド検索 (キーワード + ベクトル)

✅ FTS5 + sqlite-vec RRF

✅ ベクトル + グラフ

❌ ナレッジグラフのみ

時間減衰による忘却

✅ エビングハウス曲線

⚠️ 優先度スコアリング

❌

3段階の蒸留 (具体的 → 抽象的 → メタ)

✅

❌

❌

ドリームサイクル (衝突ベースの洞察)

✅

❌

❌

矛盾検知

✅

⚠️ リゾルバーによる上書き

❌

時間的クエリ ("3月時点ではどう考えていた?")

✅ 置換チェーン

⚠️ グラフ無効化

❌

ローカルファースト (クラウドAPIなし)

✅ SQLite単一ファイル

❌ クラウドデフォルト

✅

Obsidianエクスポート

✅ [[wikilinks]]

❌

❌

保存時の自動蒸留

✅

❌

❌

MCPネイティブ

✅ 25ツール

✅

✅

自己評価 (LOCOMOメトリクス)

✅

❌

❌

TL;DR — ほとんどのメモリサーバーは保存と取り出しを行うだけです。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段階の蒸留をトリガー

  • [ ] 自動剪定 — DBがサイズ閾値を超えた際に減衰した観測結果をGC

  • [ ] Cron対応CLI — 定期的な夜間合成のための erinys dream --max 10

  • [ ] PyPIパッケージ — pip install erinys-memory

  • [ ] マルチエージェントサポート — エージェントIDごとのスコープ付きメモリ

ライセンス

MIT

Available Tools

29 tools
erinys_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_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_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

    C2.7/5.0

    Scored across 29 tools

    Disambiguation3/5

    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.

    Naming Consistency4/5

    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.

    Tool Count2/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers