YourMemory
YourMemory
LoCoMoにおいてMem0より16pp優れた想起率。100%の古いメモリ精度。AIエージェントのための生物学に着想を得たメモリ減衰。
ClaudeおよびあらゆるMCP互換AIのための永続メモリ — 人間の記憶のように機能します。重要なことは残り、忘れられたことは薄れ、古い事実は自動的に整理されます。関連する記憶は、それらの間のつながりを理解するグラフ層を通じて、より長く維持されます。
初期段階です — フィードバックやアイデアを歓迎します。
ベンチマーク
公開されているLoCoMoデータセット(Snap Research)でMem0(無料版)と比較評価 — 会話ペア10組、合計200のQAペア。
指標 | YourMemory | Mem0 | マージン |
LoCoMo Recall@5 (200 QAペア) | 34% | 18% | +16pp |
古いメモリの精度 (矛盾ペア5組) | 100% | 0% | +100pp |
整理されたメモリ (ノイズ低減) | 20% | 0% | — |
完全な手法とサンプルごとの結果はBENCHMARKS.mdを参照してください。 解説記事を読む: I built memory decay for AI agents using the Ebbinghaus forgetting curve
仕組み
エビングハウスの忘却曲線
base_λ = DECAY_RATES[category]
effective_λ = base_λ × (1 - importance × 0.8)
strength = importance × e^(-effective_λ × days) × (1 + recall_count × 0.2)
score = cosine_similarity × strength減衰率はカテゴリによって異なります — 失敗の記憶はすぐに薄れ、戦略はより長く持続します:
カテゴリ | 基本 λ | 想起なしでの生存期間 | ユースケース |
| 0.10 | 約38日 | うまくいったこと — 成功したパターン |
| 0.16 | 約24日 | ユーザーの好み、アイデンティティ |
| 0.20 | 約19日 | 推論されたコンテキスト |
| 0.35 | 約11日 | うまくいかなかったこと — 環境固有のエラー |
重要度は、各カテゴリ内の減衰率をさらに調整します。頻繁に想起される記憶は、減衰を打ち消すrecall_countのブーストを得ます。強度が0.05を下回る記憶は自動的に整理されます。
ハイブリッドベクトル + グラフエンジン (v1.3.0)
検索は2ラウンドで実行されます:
ラウンド1 — ベクトル検索: すべてのメモリに対するコサイン類似度。類似度しきい値を超える上位k件を返します。
ラウンド2 — グラフ拡張: ラウンド1のシードからのBFSトラバーサル。上位結果と関連しているが、類似度のカットオフを下回ったメモリ(語彙は共有していないがコンテキストを共有しているメモリ)を表面化させます。
recall("Python backend")
Round 1 → [1] Python/MongoDB (sim=0.61), [2] DuckDB/spaCy (sim=0.19)
Round 2 → [5] Docker/Kubernetes (sim=0.29, below cut-off but graph neighbour of [1])
surfaced via graph even though vector search missed itチェーン認識型の整理: グラフの隣接ノードのいずれかが整理しきい値を超えている場合、そのメモリは維持されます。関連する記憶は一緒に古くなります — 1つの強力な記憶が、接続されたクラスター全体を削除から保護します。
想起の伝播: メモリを想起すると、そのグラフ隣接ノードのrecall_countが自動的にブーストされます。頻繁にアクセスされるメモリは、関連するコンテキストを新鮮に保ちます。
セマンティックエッジ: グラフのエッジは、挿入順序ではなく、コサイン類似度(しきい値 ≥ 0.4)に基づいて作成されます。エッジの重み = spaCyによって抽出されたSVO述語からのsimilarity × verb_weightです。
セットアップ
インフラストラクチャ不要 — 箱から出してすぐにDuckDBを使用します。2つのコマンドで完了します。
Python 3.11, 3.12, 3.13, 3.14をサポートしています。
1. インストール
pip install yourmemoryすべての依存関係が自動的にインストールされます。クローンもDockerもデータベースのセットアップも不要です。
2. セットアップの実行(1回のみ)
yourmemory-setupspaCy言語モデルをダウンロードし、データベースを初期化します。インストール後に1回実行してください。
3. 設定の取得
yourmemory-path完全な実行可能パスと、MCPクライアント用の貼り付け可能な設定を出力します。コピーしてください。
4. AIクライアントへの組み込み
データベースは初回使用時に~/.yourmemory/memories.duckdbに自動的に作成されます。
Claude Code
~/.claude/settings.jsonに追加します:
{
"mcpServers": {
"yourmemory": {
"command": "yourmemory"
}
}
}Claude Codeをリロードします(Cmd+Shift+P → Developer: Reload Window)。
Cline (VS Code)
VS CodeはシェルのPATHを継承しません。ターミナルで以下を実行して、貼り付けるための正確な設定を取得してください:
yourmemory-path次に、Cline → MCP Servers → Edit MCP Settingsで、出力を貼り付けます。以下のようになります:
{
"mcpServers": {
"yourmemory": {
"command": "/full/path/to/yourmemory",
"args": [],
"env": {
"YOURMEMORY_USER": "your_name",
"DATABASE_URL": ""
}
}
}
}保存後にClineを再起動してください。
Cursor
~/.cursor/mcp.jsonに追加します:
{
"mcpServers": {
"yourmemory": {
"command": "/full/path/to/yourmemory",
"args": [],
"env": {
"YOURMEMORY_USER": "your_name",
"DATABASE_URL": ""
}
}
}
}Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) または %APPDATA%\Claude\claude_desktop_config.json (Windows) に追加します:
{
"mcpServers": {
"yourmemory": {
"command": "yourmemory"
}
}
}Claude Desktopを再起動してください。
MCP互換クライアント
YourMemoryは標準的なstdio MCPサーバーです。Claude Code、Claude Desktop、Cline、Cursor、Windsurf、Continue、Zedで動作します。クライアントがシェルPATHを継承しない場合は、yourmemory-pathからのフルパスを使用してください。
5. プロジェクトへのメモリ指示の追加
sample_CLAUDE.mdをプロジェクトルートにCLAUDE.mdとしてコピーし、以下を置き換えてください:
YOUR_NAME— あなたの名前 (例:Alice)YOUR_USER_ID— メモリの名前空間に使用 (例:alice)
これで、Claudeはすべてのタスクで想起 → 保存 → 更新のワークフローを自動的に実行します。
マルチエージェントの共有およびプライベートメモリ
複数のAIエージェントが同じYourMemoryインスタンスを共有できます。それぞれが独自のアイデンティティ、分離されたプライベートメモリ、および共有コンテキストへの制御されたアクセス権を持ちます。
仕組み
すべてのメモリには、可視性を制御する2つのフィールドがあります:
フィールド | 値 | 意味 |
|
| どのエージェント(またはユーザー)もこのメモリを想起可能 |
|
| 保存したエージェントのみが想起可能 |
| 例: | このメモリを所有するエージェント |
エージェントはAPIキー(プレフィックス ym_)で認証します。キーがない場合、呼び出し元はユーザーとして扱われ、sharedメモリのみを読み書きできます。
エージェントの登録
from src.services.api_keys import register_agent
result = register_agent(
agent_id="coding-agent",
user_id="sachit",
description="Handles code review and refactoring tasks",
can_read=["shared", "private"], # what this agent can read
can_write=["shared", "private"], # what it can write
)
print(result["api_key"]) # ym_xxxx — save this, shown once onlyキーは保存前にSHA-256でハッシュ化されます。プレーンテキストは保存されません。紛失した場合は、取り消して再登録してください。
MCP呼び出しでのAPIキーの使用
MCPツール呼び出しにapi_keyを渡します:
# Store a private memory — only this agent can recall it
store_memory(
content="The auth service on staging uses a self-signed cert — skip SSL verify",
importance=0.7,
category="failure",
api_key="ym_xxxx",
visibility="private"
)
# Store shared context — any agent can recall it
store_memory(
content="Production database is on PostgreSQL 16, us-east-1",
importance=0.8,
category="fact",
api_key="ym_xxxx",
visibility="shared"
)
# Recall — returns shared memories + this agent's private memories
recall_memory(
query="database production",
api_key="ym_xxxx"
)api_keyがない場合、想起は共有メモリのみを返します。
アクセス制御
エージェントを登録する際、can_readでエージェントがアクセスできる可視性階層を制御します:
# Read-only agent — can see shared context but cannot store private memories
register_agent(
agent_id="readonly-summarizer",
user_id="sachit",
can_read=["shared"],
can_write=["shared"],
)
# Isolated agent — private memory only, cannot read shared context
register_agent(
agent_id="isolated-agent",
user_id="sachit",
can_read=["private"],
can_write=["private"],
)例: コンテキストを共有する2つのエージェント
coding-agent stores:
→ "Sachit uses pytest for all Python tests" (shared, importance=0.8)
→ "Staging API key is sk-staging-xxx" (private, importance=0.9)
review-agent recalls "Python testing":
← "Sachit uses pytest for all Python tests" ✓ (shared — visible)
← "Staging API key is sk-staging-xxx" ✗ (private — hidden)
coding-agent recalls "Python testing":
← "Sachit uses pytest for all Python tests" ✓ (shared)
← "Staging API key is sk-staging-xxx" ✓ (private — owns it)エージェントの取り消し
from src.services.api_keys import revoke_agent
revoke_agent(agent_id="coding-agent", user_id="sachit")
# Key is invalidated immediately — all future calls with it return 401MCPツール
ツール | 呼び出しタイミング |
| すべてのタスクの開始時 — 関連するコンテキストを表面化 |
| 新しい好み、事実、失敗、戦略を学習した後 |
| 想起されたメモリが古くなった、またはマージが必要な場合 |
store_memoryは、減衰率を制御するためのオプションのcategoryパラメータを受け入れます:
# Failure — decays in ~11 days (environment changes fast)
store_memory(
content="OAuth for client X fails — redirect URI must be app.example.com",
importance=0.6,
category="failure"
)
# Strategy — decays in ~38 days (successful patterns stay relevant)
store_memory(
content="Cursor pagination fixed the 30s timeout on large user queries",
importance=0.7,
category="strategy"
)セッション例
User: "I prefer tabs over spaces in all my Python projects"
Claude:
→ recall_memory("tabs spaces Python preferences") # nothing found
→ store_memory("Sachit prefers tabs over spaces in Python", importance=0.9, category="fact")
Next session:
→ recall_memory("Python formatting")
← {"content": "Sachit prefers tabs over spaces in Python", "strength": 0.87}
→ Claude now knows without being told again減衰ジョブ
起動時に24時間ごとに自動的に実行されます — cronは不要です。強度が0.05を下回るメモリは整理されます。
チェーン認識型の整理 (v1.3.0): 減衰したメモリを削除する前に、減衰ジョブはグラフの隣接ノードを確認します。隣接ノードのいずれかが整理しきい値を超えている場合、そのメモリは維持されます。これにより、関連するクラスターの一部である事実が孤立して削除されるのを防ぎます。
スタック
DuckDB — デフォルトのバックエンド、セットアップ不要、ネイティブベクトル類似度(pgvectorと同等の品質)
NetworkX — デフォルトのグラフバックエンド、セットアップ不要、
~/.yourmemory/graph.pklに永続化Neo4j — スケール用のオプトイングラフバックエンド:
pip install 'yourmemory[neo4j]',GRAPH_BACKEND=neo4jを設定sentence-transformers — ローカル埋め込み (
all-mpnet-base-v2, 768次元、外部サービス不要)spaCy 3.8.13+ — 重複排除、分類、SVOトリプル抽出のためのローカルNLP (Python 3.11–3.14互換)
APScheduler — 自動24時間減衰ジョブ
MCP — Model Context ProtocolによるClaude統合
PostgreSQL + pgvector — オプション、チーム/大規模データセット用
アーキテクチャ
Claude / Cline / Cursor / Any MCP client
│
├── recall_memory(query, api_key?)
│ └── embed → cosine similarity (Round 1)
│ → graph BFS expansion (Round 2)
│ → score = sim × strength → top-k
│ → recall propagation → boost graph neighbours
│
├── store_memory(content, importance, category?, api_key?, visibility?)
│ └── is_question? → reject
│ contradiction check → update existing if conflict
│ embed() → INSERT memories
│ → index_memory() → upsert graph node + semantic edges
│
└── update_memory(id, new_content, importance)
└── embed(new_content) → UPDATE memories
→ update graph node strength
Vector DB (Round 1) Graph DB (Round 2)
DuckDB (default) NetworkX (default)
memories.duckdb graph.pkl
├── embedding FLOAT[768] ├── nodes: memory_id, strength
├── importance FLOAT └── edges: sim × verb_weight ≥ 0.4
├── recall_count INTEGER
├── visibility VARCHAR Neo4j (opt-in, GRAPH_BACKEND=neo4j)
└── agent_id VARCHAR └── bolt://localhost:7687
Agent Registry
agent_registrations
├── agent_id VARCHAR
├── api_key_hash VARCHAR ← SHA-256, plaintext never stored
├── can_read [] ← ["shared"] | ["private"] | both
├── can_write []
└── revoked_at TIMESTAMPPostgreSQL (オプション — チームまたは大規模データセット用)
Postgresサポート付きでインストール:
pip install yourmemory[postgres]次に.envファイルを作成します:
DATABASE_URL=postgresql://YOUR_USER@localhost:5432/yourmemoryバックエンドは自動的に選択されます — DATABASE_URLがpostgresql://ならPostgres + pgvector、それ以外ならDuckDB。
macOS
brew install postgresql@16 pgvector && brew services start postgresql@16
createdb yourmemoryUbuntu / Debian
sudo apt install postgresql postgresql-contrib postgresql-16-pgvector
createdb yourmemoryデータセット参照
ベンチマークは、Snap ResearchによるLoCoMoデータセットを使用しています。これは、マルチセッション対話のための公開された長文脈メモリベンチマークです。
Maharana et al. (2024). LoCoMo: Long Context Multimodal Benchmark for Dialogue. Snap Research.
ライセンス
Copyright 2026 Sachit Misra
CC-BY-NC-4.0 (Creative Commons Attribution-NonCommercial 4.0) の下でライセンスされています。
無料対象: 個人の使用、教育、学術研究、オープンソースプロジェクト。
許可されないこと: SaaS、営利企業の内部ツール、有料サービスなど、いかなる種類の商用利用も、別途書面による合意がない限り許可されません。
商用ライセンスについては: mishrasachit1@gmail.com
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sachitrafa/YourMemory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server