Skip to main content
Glama
toozuuu
by toozuuu

コア原則

MemoryAIは、大量の永続的知識をローカルに保存し、LLMコンテキストには制限付きで関連性の高いサブセットのみを取得することで、事実上無制限の永続メモリを提供します。

従来のAIワークフローは、生の会話ログ(80,000+トークン)をコンテキストウィンドウにそのまま流し込むため、APIコストの高騰、注意力の低下、プロンプトの逸脱を引き起こします。MemoryAIは自律的な認知レイヤーとして動作し、会話イベントを捕捉して永続的な決定を抽出し、厳格なトークン予算の下でコンテキストを動的に階層化します:

User Request / IDE Event
          ↓
  Event Normalizer (session.*, task.*, file.*, decision.*)
          ↓
  Policy Evaluator (ignore, observe, capture, review, immediate)
          ↓
  Memory Orchestrator (Two-Phase Writes & Privacy Redaction)
          ↓
  SQLite Engine (FTS5 BM25 + Dense Vectors + Version Ledger)
          ↓
  Hybrid Retrieval & Multi-Factor Reranking
          ↓
  Progressive Disclosure Context (Level 1 → Level 2 → Level 3 → Level 4)
          ↓
  Strict Token Budget (300 / 500 / 1,000 / 2,000 tokens)
          ↓
       LLM

Related MCP server: ClawMem MCP Server

主な特長

  • 手動操作ゼロ: MemoryAIは、Git/パッケージマニフェストを介してプロジェクトの識別情報を自動検出し、関連するコンテキストを想起して、永続的な決定を捕捉し、セッションの引き継ぎを生成します。

  • ユニバーサルなクロスクライアント互換性: 正規化された会話イベント(MemoryAIConversationEvent)が、Claude Code、Cursor、Codex、Gemini CLI、ChatGPT、MCPクライアントをシームレスに橋渡しします。

  • MCP 2026ステートレスコアとTasks拡張: ステートレス実行、明示的なアプリケーションハンドル(memoryContextId、taskId、handoffId、snapshotId)、バックグラウンドタスク管理を備えたMCP 2026仕様に完全準拠。

  • 4段階のプログレッシブ開示: レベル1(150トークンの要約) とレベル2(正準的事実) から、レベル3(裏付けとなる根拠) とレベル4(会話トレース) へと、コンテキストが段階的に構築されます。

  • メモリスナップショットと履歴差分: 特定時点のプロジェクトスナップショット(memoryai snapshot create)を取得し、アーキテクチャ上の意思決定をまたぐ履歴差分(memoryai diff)を確認できます。

  • プロジェクトメモリヘルス診断: 鮮度、信頼度、競合率、出所、引き継ぎの完全性を評価するリアルタイムの0〜100ヘルススコア(memoryai health)。

  • プライバシーと2相書き込み: RSA秘密鍵、AWSアクセスキー、JWTトークン、接続文字列、PIIを、永続保存前に自動検出して墨消しします。

  • 無停止の埋め込みマイグレーション: 安全なロールバック機能を備えたアトミックなシャドウテーブル・ベクターインデックス化(memoryai embeddings migrate)。

  • ポータブルな.memorypack形式: SHA-256整合性チェックにより、永続メモリのエクスポート、バックアップ、リストアが可能。


クイックスタート

1. インストール

# Clone the repository
git clone https://github.com/memoryai/memoryai.git
cd memoryai

# Install dependencies and build monorepo packages
npm install
npm run build

2. 14項目の診断ドクターを実行

# Verify database, vector indexes, encryption, SSRF protection, and MCP tools
node cli/dist/bin.js doctor

3. 基本的な使い方(記憶と想起)

# Store a durable architectural decision
node cli/dist/bin.js remember "Architectural decision: Standardized on Fastify v4 and SQLite with WAL mode" --type decision --importance 0.95

# Recall bounded context with a 500 token budget
node cli/dist/bin.js recall "Fastify and SQLite database decisions" --max-tokens 500

アーキテクチャ

                         MemoryAI Platform
                                │
       ┌────────────────────────┼────────────────────────┐
       ▼                        ▼                        ▼
   AI Clients             MCP 2026 Layer           Local SDK & CLI
 (Claude, Cursor,       (Stateless HTTP/Stdio,    (Node, Shell, API)
  Gemini, Codex, GPT)     Explicit Handles)
       │                        │                        │
       └────────────────────────┼────────────────────────┘
                                ▼
                         Event Normalizer
               (session.*, task.*, file.*, memory.*)
                                │
                                ▼
                       Event Policy Engine
            (ignore, observe, capture, review, immediate)
                                │
                                ▼
                       Memory Orchestrator
       ┌────────────────────────┼────────────────────────┐
       ▼                        ▼                        ▼
Memory Brain &           Memory Job & Tasks       Progressive Context
Two-Phase Write Engine   (Async Long-Running)     (Level 1 - 4 Layers)
       │                        │                        │
       ▼                        ▼                        ▼
Privacy Classifier &     Integrity Checker &      Semantic Cache &
Selective Encryption     Health Monitor (0-100)   Model Router
       │                        │                        │
       └────────────────────────┼────────────────────────┘
                                ▼
                      SQLite Storage Engine
     (Memories, Vectors, Versions, Snapshots, Tasks, Events, Sync Queue)

イベント駆動メモリ

MemoryAIは、手動での操作を必要とせず、IDEおよびエージェントのライフサイクルイベントに自動的に反応します:

# Emit an event to the MemoryAI pipeline
node cli/dist/bin.js remember "Project migrated to Angular 21 with standalone components" --type decision

イベント種別

ポリシーアクション

デフォルトの処理

architecture.changed

immediate

重要度が高いものとして即座に永続化

decision.created

capture

Memory Brainの評価を経て処理

dependency.changed

immediate

以前の依存関係バージョンを置き換える

handoff.created

capture

構造化されたセッション継続レコードとして保存

error.detected

review

信頼度が低い場合はレビューキューに隔離

file.changed

observe

コンテキストを増やさずローカルイベントログに記録

session.started

observe

プロジェクトの識別情報を自動検出し、引き継ぎを準備


プログレッシブ開示コンテキスト

現在のプロンプトに必要な深さの情報だけを取得します:

  • レベル1(要約): 目的と主要な事実を150トークン以内に収めたエグゼクティブサマリー。

  • レベル2(正準的): 重複排除された重要度の高いメモリレコードを、安全な<MEMORY_DATA>コンテナに整形したもの。

  • レベル3(根拠): 正準的レコードに、ソースの出所、フアイルリンク、タイムスタンプのメタデータを付随させたもの。

  • レベル4(会話): 明示的な要求に応じて、生のセグメントを深くトレースしたもの。

# Recall Level 1 summary context
node cli/dist/bin.js recall "OAuth architecture" --max-tokens 300

MCP 2026 とTasks拡張

MemoryAIは、Claude Desktop、Claude Code、Cursor、Codex、およびあらゆるMCPクライアント向けに、stdio上で完全準拠のMCPサーバーを提供します。

コアMCPツール(30のアクティブツール):

  • memory_auto_context: プロジェクトの自動検出、意図の評価、制限付きメモリの想起。

  • memory_recall: トークン制限付きハイブリッド検索。

  • memory_progressive_recall: 多段階のプログレッシブ・コンテキスト開示。

  • memory_remember: 自律的な永続メモリの捕捉。

  • task_create、task_get、task_cancel、task_list: バックグラウンドジョブ向けのノンブロッキングなMCP 2026 Tasks拡張。

  • memory_snapshot_create、memory_snapshot_list、memory_snapshot_compare: 特定時点の状態管理。

  • memory_diff: メモリの履歴バージョン比較。

  • memory_health: 0〜100のプロジェクトヘルススコア。

  • memory_review_queue: 隔離されたメモリの検査とレビュー。

  • memory_handoff_create、memory_handoff_get: 複数日にわたるセッション継続。

  • memory_share: スコープと権限チェック付きの共有。

  • memory_explain、memory_explain_capture: 検索と捕捉の診断的説明。


スナップショットとバージョン管理

# Create a point-in-time milestone snapshot
node cli/dist/bin.js snapshot create v1.0.0-release "Production release snapshot"

# List project snapshots
node cli/dist/bin.js snapshot list

# Compare two project snapshots
node cli/dist/bin.js snapshot compare snap_abc123 snap_def456

# View historical diff of a memory record
node cli/dist/bin.js diff mem_123 1 2

ヘルスと診断

# Check 0-100 Project Memory Health score and diagnostic breakdown
node cli/dist/bin.js health

# Scan for orphaned vectors, broken provenance, or duplicate hashes
node cli/dist/bin.js verify

# Run automated conservative self-healing repair
node cli/dist/bin.js repair

# Calculate token economics and cloud API cost savings
node cli/dist/bin.js cost

# Run sandbox memory policy simulation
node cli/dist/bin.js simulate balanced

# Disaster recovery mode
node cli/dist/bin.js recovery

セキュリティとプライバシーのアーキテクチャ

セキュリティ管理策

実装

プライバシークラシファイア

秘密鍵、AWS認証情報、JWTトークン、データベースURI、PIIを自動的に拒否/墨消しする

プロンプトインジェクションシールド

厳格な<MEMORY_DATA>非実行サンドボックス化と命令の無力化

テナント・ユーザー分離(IDOR)

すべてのクエリと変更操作に対して、サーバー側でテナント、ユーザー、プロジェクトの認可チェックを強制する

SSRF防御

ループバック(127.0.0.1)、RFC1918プライベートサブネット、クラウドメタデータ(169.254.169.254)をブロックするURL検証

ストレージ暗号化

機密コンテンツフィールドに対するAES-256-GCM認証付き暗号化

レートリミッター

インメモリのスライディングウィンドウ方式トークンバケットレートリミッター

アーカイブセキュリティ

Zipスリップ(ディレクトリトラバーサル)ガードと解凍爆弾の比率制限


CLIリファレンス

コマンド

説明

memoryai init

ローカルの.memoryaiデータベースと暗号化キーを初期化します

memoryai status

ローカルメモリの統計、プロジェクトの識別情報、メトリクスを表示します

memoryai remember <text>

永続的な決定、好み、事実を保存します

memoryai recall <query>

厳格なトークン制限で、制限付きコンテキストを取得します

memoryai search <query>

ハイブリッドFTSとベクターマッチングでメモリを検索します

memoryai handoff <create|show|list>

構造化されたセッション引き継ぎレコードを管理します

memoryai snapshot <create|list|compare>

特定時点のプロジェクトスナップショットを管理します

memoryai diff <id> <v1> <v2>

メモリレコードの履歴バージョンを比較します

memoryai health

プロジェクトメモリのヘルススコア(0〜100)

memoryai verify

データベースに整合性の問題がないかスキャンします

memoryai repair

保守的な自動整合性修復

memoryai cost

クラウドトークンの削減量とコスト削減額を計算します

memoryai simulate [policy]

サンドボックス・ポリシーのシミュレーションを実行します

memoryai doctor

14項目のシステム診断を実行します

memoryai security-check

セキュリティ強化の状態を検証します

memoryai export [file.memorypack]

メモリをポータブルな.memorypackバンドルにエクスポートします

memoryai import <file.memorypack>

.memorypackバンドルからメモリをインポートします


テスティングと検証

# Run all 89 unit, integration, memory, retrieval, MCP, concurrency, and performance tests
npm test

# Run all 22 OWASP API Top 10 and Privacy Security tests
npm run test:security

# Run combined full test suite
npm run test:all

ライセンス

MIT License. Copyright (c) 2026 MemoryAI Contributors.

Maintenance

ActivityStale
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to maintain persistent, local memory with retrieval-augmented search, knowledge graphs, and context surfacing, without any cloud dependencies.
    293 npm
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    Enables AI agents to maintain a local, event-sourced long-term memory with semantic retrieval, decision confidence checks, and proactive recalls, ensuring data never leaves the machine.
    23
    3
    MIT
  • F
    license
    Not graded
    quality
    A
    maintenance
    Gives AI coding agents persistent, local-first memory so they can store, semantically search, and recall decisions, preferences, error patterns, and cross-project guidelines directly during a session. It also optionally queues tasks for autonomous execution against that same memory.
    -