Skip to main content
Glama

agentmem

Claude Code、Cursor、Codex向けの共有メモリで、何が現在も有効かを把握します。セッションを保存し、陳腐化や競合するルールを検出し、エージェントが過去の過ちを繰り返さないようにします。

PyPI Python License: MIT Tests

問題点

AIコーディングアシスタントはセッション間で全てを忘れてしまいます。過去の過ちを繰り返し、現在のルールと古いルールを区別できません。コンテキストは圧縮され、復旧は困難です。

ほとんどのメモリツールはストレージを解決しますが、agentmemは信頼を解決します。

Related MCP server: mcp-ai-brain

はじめに (Claude Code / Cursor / Codex)

pip install quilmem[mcp]
agentmem init --tool claude --project myapp

以上です。エディタを再起動してください。エージェントが13個のメモリツールを使えるようになりました。memory_healthを実行して確認してください。

Pythonのみですか? pip install quilmem はMCPエクストラなしでも動作します。以下の Python API を参照してください。

60秒デモ

from agentmem import Memory

mem = Memory()

# Store typed memories
mem.add(type="bug", title="loudnorm undoes SFX levels",
        content="Never apply loudnorm to final mix. It re-normalizes everything.",
        status="validated")

mem.add(type="decision", title="Use per-line atempo",
        content="Bake speed into per-line TTS. No global pass.",
        status="active")

# Something you're not sure about yet
hypothesis = mem.add(type="decision", title="Maybe try 2-second gaps before CTA",
        content="Hypothesis from last session. Needs testing.",
        status="hypothesis")

# Search — validated and active memories rank highest.
# Deprecated and superseded memories are excluded automatically.
results = mem.search("audio mixing")

# Context-budgeted recall — fits the best memories into your token limit
context = mem.recall("building a narration track", max_tokens=2000)

# Lifecycle — promote what's proven, deprecate what's not
mem.promote(hypothesis.id)                # hypothesis -> active -> validated
mem.deprecate(hypothesis.id, reason="Disproven by data")

# Supersede: replace an outdated memory with a newer one
replacement = mem.add(type="decision", title="Use 1-second gaps before CTA",
        content="Confirmed by A/B test.", status="active")
mem.supersede(hypothesis.id, replacement.id)  # old points to replacement

# Health check — is your memory system trustworthy?
from agentmem import health_check
report = health_check(mem._conn)
# Health: 85/100 | Conflicts: 0 | Stale: 2 | Validated: 14

何が違うのか

他のメモリツールは単に保存するだけです。 agentmemは、何が現在も有効かを知っています。

Mem0

Letta

Mengram

agentmem

メモリ保存

Yes

Yes

Yes

Yes

全文検索

ベクトル

エージェント駆動

ナレッジグラフ

FTS5

メモリライフサイクル状態

No

部分的

No

仮説 -> アクティブ -> 検証済み -> 非推奨 -> 置き換え済み

競合検出

No

No

部分的

組み込み

陳腐化検出

No

No

No

組み込み

健全性スコアリング

No

No

No

組み込み

出所追跡

No

No

No

source_path + source_hash

信頼度順の呼び出し

No

No

No

検証済み > アクティブ > 仮説

人間が読めるソースファイル

No

No

No

標準Markdown

ローカルファースト、インフラ不要

No

セルフホスト可

セルフホスト可

Yes, 常時

MCPサーバー

別途

別途

Yes

組み込み

真実のガバナンス

核となる考え方:すべてのメモリには、どれだけ信頼すべきかを追跡するステータスがあります。

hypothesis    New observation. Not yet confirmed. Lowest trust in recall.
    |
  active      Default. Currently believed true. Normal trust.
    |
 validated    Explicitly confirmed. Highest trust in recall.

 deprecated   Was true, no longer. Excluded from recall. Kept for history.
 superseded   Replaced by a newer memory. Points to replacement.

なぜこれが重要なのか: ガバナンスがなければ、エージェントのメモリには陳腐化したルール、矛盾、古い決定が蓄積されます。1月の音声設定が3月に上書きされたことを知りません。両方を検索し、LLMはランダムに選択してしまいます。ガバナンス付きメモリはこれを解決します。

競合検出

from agentmem import detect_conflicts

conflicts = detect_conflicts(mem._conn)
# Found 2 conflict(s):
#   !! [decision] "Always apply loudnorm to voice"
#      vs [decision] "NEVER apply loudnorm to voice"
#      Contradiction on shared topic (voice, loudnorm, audio)

agentmemは互いに矛盾するメモリを見つけ出します:

  • トピックの重複を検出 (Jaccard類似度)

  • 重複矛盾を分離

  • 文レベルの否定マッチング (キーワードスキャンだけでなく)

  • 重大度: critical (両方アクティブ) vs warning (一方が非推奨)

陳腐化検出

from agentmem import detect_stale

stale = detect_stale(mem._conn, stale_days=30)
# [decision] "Use atempo 0.90" — Source changed since import (hash mismatch)
# [bug] "Firewall blocks port" — Not updated in 45 days

以下の方法で古いメモリを見つけます:

  • 年齢 (N日間更新されていない)

  • ソースファイルが存在しない (参照されたファイルが削除された)

  • ハッシュのずれ (ソースファイルの内容は変わったがメモリが更新されていない)

健全性チェック

from agentmem import health_check

report = health_check(mem._conn)
print(f"Health: {report.health_score}/100")
print(f"Conflicts: {len(report.conflicts)}")
print(f"Stale: {len(report.stale)}")

競合、陳腐化率、孤立した参照、非推奨の重み、検証済みメモリの有無に基づいて、メモリシステムを0〜100でスコアリングします。

出所を意識した同期

標準Markdownファイルをソース追跡付きでDBに同期します:

# Each memory tracks where it came from
mem.add(type="bug", title="loudnorm lifts noise",
        content="...",
        source_path="/docs/errors.md",
        source_section="Audio Bugs",
        source_hash="a1b2c3d4e5f6")

同期エンジン:

  • ハッシュが同じ = スキップ (冪等性、再実行しても何も変わらない)

  • ハッシュが異なる = 更新 (ソースファイルが変更された)

  • セクションが削除された = 非推奨にする (理由付き)

  • セクションが復元された = 復活させる (非推奨メモリを再アクティブ化)

3つのインターフェース

Python API

from agentmem import Memory

mem = Memory("./my-agent.db", project="frontend")

# CRUD
record = mem.add(type="decision", title="Use TypeScript", content="...")
mem.get(record.id)
mem.update(record.id, content="Updated reasoning.")
mem.delete(record.id)
mem.list(type="bug", limit=20)

# Search + recall
results = mem.search("typescript migration", type="decision")
context = mem.recall("setting up the build", max_tokens=3000)

# Governance
mem.promote(record.id)              # hypothesis -> active -> validated
mem.deprecate(record.id, reason="No longer relevant")
replacement = mem.add(type="decision", title="Use v2 approach", content="...")
mem.supersede(record.id, replacement.id)  # links old to replacement

# Session persistence
mem.save_session("Working on auth refactor. Blocked on token refresh.")
mem.load_session()                  # picks up where last instance left off

# Health
mem.stats()

CLI

# Get started in 30 seconds
agentmem init --tool claude --project myapp

# Check if everything's working
agentmem doctor

# Core
agentmem add --type bug --title "CSS grid issue" "Flexbox fallback needed"
agentmem search "grid layout"
agentmem recall "frontend styling" --tokens 2000

# Governance
agentmem promote <id>
agentmem deprecate <id> --reason "Fixed in v2.3"
agentmem health
agentmem conflicts
agentmem stale --days 14

# Import + sessions
agentmem import ./errors.md --type bug
agentmem save-session "Finished auth module, starting tests"
agentmem load-session

# MCP server
agentmem serve

MCPサーバー

Claude Code、Cursor、および任意のMCPクライアント向けの組み込み Model Context Protocol サーバー。

pip install quilmem[mcp]

Claude Code設定 (.claude/settings.json):

{
  "mcpServers": {
    "agentmem": {
      "command": "agentmem",
      "args": ["--db", "./memory.db", "--project", "myproject", "serve"],
      "type": "stdio"
    }
  }
}

MCPツール: add_memory, search_memory, recall_memory, update_memory, delete_memory, list_memories, save_session, load_session, promote_memory, deprecate_memory, supersede_memory, memory_health, memory_conflicts

エージェントにメモリの使い方を教える: エージェントの指示CLAUDE.md.cursorrules、または AGENTS.md にコピーしてください。これにより、セッションプロトコル、信頼階層、検索と追加のタイミングをエージェントに教えることができます。

型付きメモリ

実際のエージェントワークフローをカバーする7つのタイプ:

タイプ

保存内容

setting

設定、パラメータ

"Voice speed: atempo 1.08"

bug

エラーとその修正

"loudnorm lifts noise floor"

decision

ルール、ポリシー、選択

"3rd-person narration banned"

procedure

ワークフロー、パイプライン

"TTS -> speed -> 48kHz -> mix"

context

背景知識

"Project uses FFmpeg + Python 3.11"

feedback

ユーザーの修正

"Always pick, don't ask"

session

現在の作業状態

"Working on auth. Blocked on tokens."

信頼度順の呼び出し

recall() は単に関連するメモリを見つけるだけではありません。最も信頼できる関連メモリを見つけます:

  1. FTS5検索が候補を返す

  2. 各スコア: 関連性 (25%) + 信頼ステータス (20%) + 出所 (20%) + 新しさ (15%) + 頻度 (10%) + 確信度 (10%)

  3. 検証済みの標準メモリは、出所不明の仮説メモリよりも上位にランク付けされる

  4. 非推奨および置き換え済みのメモリは完全に除外される

  5. トークン予算に合わせて貪欲に詰め込まれる

プロジェクトのスコープ設定

frontend = Memory("./shared.db", project="frontend")
backend = Memory("./shared.db", project="backend")

frontend.search("bug")  # Only frontend bugs
backend.search("bug")   # Only backend bugs

実戦テスト済み

これは理論上の話ではありません。agentmemは、2ヶ月以上にわたる毎日の使用という実戦のプレッシャーの中で構築されました:

  • 65本以上のYouTubeショート動画を、繰り返される制作バグゼロで制作

  • 音声生成、FFmpegアセンブリ、画像プロンプト、アップロードワークフローを管理する330以上のメモリ

  • すべてのバグは一度見つけ、一度修正し、二度と繰り返さない

  • ガバナンスエンジンにより、競合を1,848件の誤検知から11件の真の発見に削減

仕組み

  • ストレージ: WALモードのSQLite (同時読み取り、スレッドセーフ)

  • 検索: Porterステミングとunicode61トークナイザーを備えたFTS5

  • ランキング: 複合スコア: テキスト関連性 + 信頼ステータス + 出所 + 新しさ + 頻度 + 確信度

  • ガバナンス: ステータスライフサイクル、競合検出、陳腐化検出、健全性スコアリング

  • 同期: ソースハッシュと復活機能を備えた出所認識型

  • インフラ不要: APIキーなし、クラウドなし、ベクトルDBなし。単なる .db ファイルです。

ライセンス

MIT

Install Server
A
license - permissive license
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Persistent shared memory for AI coding agents. Stores facts as entity/key/value triples with hybrid semantic search, task checkpoints, and conflict resolution — shared across Claude Code, Codex CLI, and GitHub Copilot.
    16
    235
    5
    AGPL 3.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Local-first memory for your AI agent. One SQLite file you own — offline, no API key. Plugs straight into Claude Code.
    Apache 2.0
  • A
    license
    A
    quality
    A
    maintenance
    Durable, local-first memory for AI coding agents over MCP — zero-dependency (pure Python + SQLite/FTS5), curated and semantically de-duped. Works with Claude Code, Codex and any MCP host, and you own the data as plain rows.
    6
    22
    AGPL 3.0

View all related MCP servers

Related MCP Connectors

  • Hosted memory for AI agents that learns and forgets — one key across Claude, Cursor & ChatGPT.

  • Universal memory for AI agents and tools. Save, organize and search context anywhere.

  • Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.

View all MCP Connectors

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/Thezenmonster/agentmem'

If you have feedback or need assistance with the MCP directory API, please join our Discord server