Memory Graph Builderのロゴ

Memory Graph Builder

コミュニティ
ArchieIndian
memory-graph-builder

OpenClawのフラットなMEMORY.mdを解析して、構造化されたナレッジグラフを作成します。重複、矛盾、古い項目を検出し、システムプロンプトへの挿入に最適化された圧縮メモリダイジェストを生成します。

概要

公開者ArchieIndian
リポジトリopenclaw-superpowers
スキル名memory-graph-builder
スター
74
フォーク
14
同梱ファイル
3
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 3個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    ArchieIndianがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Memory Graph Builder」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/ArchieIndian/openclaw-superpowers/tree/main/skills/openclaw-native/memory-graph-builder
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ArchieIndian/openclaw-superpowers.git /tmp/openclaw-superpowers
mkdir -p .claude/skills
cp -r /tmp/openclaw-superpowers/skills/openclaw-native/memory-graph-builder .claude/skills/memory-graph-builder
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでMemory Graph Builderを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にMemory Graph Builderを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Memory Graph Builderは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Memory Graph Builder

What it does

OpenClaw stores agent memory in a flat MEMORY.md file — one line per fact, no structure, no relationships. This works until your agent has 200+ memories and half of them are duplicates, three contradict each other, and the whole file costs 4,000 tokens every session.

Memory Graph Builder treats MEMORY.md as a raw data source and builds a structured knowledge graph on top of it. Each memory becomes a node with typed relationships to other nodes. The graph enables:

  • Duplicate detection — "User prefers dark mode" and "User likes dark theme" are the same fact
  • Contradiction detection — "User uses Python 3.8" vs "User uses Python 3.12"
  • Staleness detection — Facts older than a configurable threshold that haven't been referenced
  • Memory digest — A compressed, relationship-aware summary that replaces raw MEMORY.md in the system prompt, saving 30-60% tokens

Inspired by OpenLobster's Neo4j-backed graph memory system, adapted to work on top of OpenClaw's existing MEMORY.md without requiring a database.

When to invoke

  • Automatically, nightly at 10pm (cron)
  • After bulk memory additions (e.g., after project-onboarding)
  • When the agent's context initialisation feels slow (memory bloat)
  • Manually to audit memory quality

Graph structure

Each memory line becomes a node:

yaml
nodes:
  - id: "mem_001"
    text: "User prefers Python for backend work"
    category: preference    # preference | fact | project | person | tool | config
    entities: ["user", "python", "backend"]
    added_at: "2026-03-01"
    last_referenced: "2026-03-15"
    confidence: 0.9
edges:
  - from: "mem_001"
    to: "mem_014"
    relation: related_to    # related_to | contradicts | supersedes | depends_on

How to use

bash
python3 graph.py --build                    # Parse MEMORY.md, build graph
python3 graph.py --duplicates               # Show duplicate clusters
python3 graph.py --contradictions           # Show contradicting pairs
python3 graph.py --stale --days 30          # Show memories not referenced in 30 days
python3 graph.py --digest                   # Generate compressed memory digest
python3 graph.py --digest --max-tokens 1500 # Digest with token budget
python3 graph.py --prune --dry-run          # Show what would be removed
python3 graph.py --prune                    # Remove duplicates + stale entries
python3 graph.py --stats                    # Graph statistics
python3 graph.py --status                   # Last build summary
python3 graph.py --format json

Cron wakeup behaviour

Nightly at 10pm:

  1. Read MEMORY.md
  2. Rebuild graph (incremental — only re-processes new/changed lines)
  3. Detect duplicates and contradictions
  4. Flag stale entries (>30 days unreferenced by default)
  5. Generate fresh memory digest
  6. Write digest to ~/.openclaw/workspace/memory-digest.md
  7. Log summary to state

Memory digest

The digest is a compressed representation of the knowledge graph optimized for LLM consumption. Instead of dumping every raw line, it:

  • Groups related memories by category
  • Merges duplicate facts into single entries
  • Marks contradictions with [CONFLICT] so the agent can resolve them
  • Omits stale entries below a confidence threshold
  • Respects a configurable max-token budget

Example digest output:

markdown
## Preferences
- Prefers Python for backend, TypeScript for frontend
- Dark mode everywhere; compact UI layouts
- Commit messages: imperative mood, max 72 chars

## Active Projects
- openclaw-superpowers: skill library, 40 skills, MIT license
- personal-site: Next.js 14, deployed on Vercel

## People
- Alice (teammate): works on auth, prefers Go

## Conflicts (needs resolution)
- [CONFLICT] Python version: "3.8" vs "3.12" — ask user to clarify

Procedure

Step 1 — Build the graph

bash
python3 graph.py --build

Step 2 — Review duplicates and contradictions

bash
python3 graph.py --duplicates
python3 graph.py --contradictions

Fix contradictions by editing MEMORY.md directly or asking the agent to clarify.

Step 3 — Prune stale entries

bash
python3 graph.py --prune --dry-run
python3 graph.py --prune

Step 4 — Generate and use the digest

bash
python3 graph.py --digest --max-tokens 1500

Point OpenClaw's memory injection at ~/.openclaw/workspace/memory-digest.md instead of raw MEMORY.md.

State

Graph structure, digest cache, and audit history stored in ~/.openclaw/skill-state/memory-graph-builder/state.yaml.

Fields: last_build_at, node_count, edge_count, duplicate_count, contradiction_count, stale_count, digest_tokens, build_history.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Memory Graph Builder」では何ができますか?

OpenClawのフラットなMEMORY.mdを解析して、構造化されたナレッジグラフを作成します。重複、矛盾、古い項目を検出し、システムプロンプトへの挿入に最適化された圧縮メモリダイジェストを生成します。

TypingMindでMemory Graph Builderを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Memory Graph Builderはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにMemory Graph Builderをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/ArchieIndian/openclaw-superpowers/tree/main/skills/openclaw-native/memory-graph-builderを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Memory Graph Builderを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Memory Graph Builderで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもMemory Graph Builderを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Memory Graph Builder」は無料ですか?

ArchieIndianがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇