Skip to main content
Glama

wasurenagusa

AIコーディングエージェントに、失敗から学ぶ方法を教えましょう。

npm version License: MIT Node.js Ko-fi

wasurenagusa(忘れな草) — 「私を忘れないで」という花言葉を持つ日本の花。


課題

AIコーディングエージェントは強力ですが、記憶力がありません。セッションが終わるたびに、プロジェクトの慣習や過去の決定事項、苦労して学んだ教訓はすべて消えてしまいます。

既存の解決策は、手動での作業が必要か、あるいはコンテキストウィンドウを圧迫するまで生の記憶を蓄積し続けるかのどちらかです。

Related MCP server: memory-bank-mcp

解決策

wasurenagusaは、単に「記憶」するだけでなく、**「学習」**するMCPサーバーです。

  1. 失敗を自動検出 — 再試行パターン、ユーザーのフラストレーション、繰り返される失敗をキャッチします。

  2. 教訓を原則に要約 — LLMが数百の生の記録を、実行可能な少数のルールに圧縮します。

  3. ネガティブをポジティブに変換 — 各原則と並行して positiveRule を生成します。「Xをするな」を「代わりにYをせよ」に変換します。LLMは禁止事項よりも肯定的な指示に従う方がはるかに優れていることが研究で示されています(ピンクエレファント問題)。

  4. 設定をテーマに圧縮 — LLMが散らばった設定を首尾一貫した要約にグループ化し、ポートやパスなどの事実を保持します。

  5. 重要なものだけを注入 — 統合された知恵とアクティブな設定のみを注入します。テンプレートの肥大化や重複したエントリはありません。

  6. ハイブリッド検索(全文検索 + セマンティック検索) — SQLiteベースのストレージとローカルでの埋め込み推論(外部API不要)。日本語対応の全文検索とベクトルセマンティック検索を統合・重複排除します。完全にオフラインで動作します。

  7. スマートタグ検索 — LLMが生成した重み付きタグと複合スコアリング(鮮度、タグの重み、アクセス頻度)により、データを破棄することなく検索優先度を最適化します。

  8. メモリの退避/復元 — メモリをアクティブなコンテキストから一時的に退避させてコンテキストウィンドウのスペースを節約し、必要な時に復元します。サブエージェントを伴う長期セッションに最適です。

Claude Codeフックにより完全に自動化 — セットアップ後の設定は不要です。

実世界での影響

作者が8つの本番プロジェクトで日常的に使用した結果(プロジェクト間での記憶共有を含む):

1,581 "dont" entries   →  5-9 principles per project    (LLM consolidation)
  each with positiveRule  →  affirmative-only injection  (Pink Elephant fix)
29 config entries      →  4-5 thematic summaries        (LLM consolidation)
21,800 chars raw data  →  6,200 chars injected           (71% reduction)

デモ

  1. セッション1: Claudeがポート3000を使用 — ユーザーが8080に修正

  2. 停止フック: wasurenagusaが会話を自動分析し、失敗を記録

  3. セッション2: Claudeが指示されることなく、正しくポート8080を使用


なぜwasurenagusaなのか

ほとんどのメモリツールは「何が起きたか」を保存します。wasurenagusaはAIに**「なぜうまくいかなかったのか」**を教え、同じ失敗を二度と繰り返さないようにします。

これは単なるメモリバンクではありません。学習システムです。

wasurenagusa

claude-mem

mcp-memory-service

CLAUDE.md

失敗の自動検出

あり (再試行 + 感情)

なし

なし

なし

自動統合 (LLM)

あり (dont→原則, 設定→テーマ)

なし

あり (減衰ベース)

なし

ベクトルセマンティック検索

あり (ローカル推論, オフライン)

あり (ChromaDB)

あり (SQLite-vec / ChromaDB)

なし

メモリ階層 (短/中/長)

あり (コサイン距離閾値)

なし

なし

なし

自動昇格 (強度)

あり (アクセス数 → 強度5)

なし

なし

なし

フックによるゼロ作業

あり

あり

部分的

なし

人間が読めるストレージ

なし (SQLite — v1 Markdownから自動移行)

なし (SQLite)

なし (SQLite-vec)

あり

マルチLLMサポート

Gemini / OpenAI / Anthropic (埋め込みはローカル — APIキー不要)

Claudeのみ

ローカル (MiniLM-L6-v2)

N/A

トークン効率の良い検索

あり (インデックス → 詳細, 70-90%削減)

あり (3層)

N/A

なし

プロジェクト間メモリ

あり (アクティブな上位5プロジェクト)

なし

なし

なし

ライセンス

MIT

AGPL-3.0

Apache-2.0

N/A


仕組み

Session Start (Hook) — injection mode
  → Checks if consolidation is stale
  → Spawns background LLM worker if needed (non-blocking)
  → Spawns background embedding backfill worker (non-blocking)
  → Injects consolidated config + principles (layer 1) + recent 30-day entries (layer 2) + owner profile
  → Vector search injects semantically related short-term memories (layer 3)
  → Cross-project vector search injects related memories from other active projects (layer 4)
  → Only customized settings injected (defaults stripped)

Session Start (Hook) — agent mode
  → Injects dont summary + config index + owner profile (minimal footprint)
  → No vector search at startup (deferred to on-demand recall)

User Prompt (Hook) — agent mode
  → Injects 1-line reminder: "search memory if relevant"
  → Main agent spawns memory-recall sub-agent as needed
  → Sub-agent runs memory_search → returns summary only (no raw data in main context)
  → Survives compaction (re-injected on every user message)

During Session
  → memory_save auto-generates embedding via local inference (no API call)
  → memory_save enriches tags with LLM-assigned weights (0.0-1.0) (when API key available)
  → Theme shift triggers background re-tagging of related past entries
  → memory_search merges keyword + vector semantic + tag-weighted results
  → Vector hits increment access counts → auto-promote to intensity 5 at threshold

Session End (Hook)
  → LLM analyzes the conversation
  → Detects mistakes, frustration, retry patterns
  → Auto-saves lessons learned (with embedding)
  → Deduplicates against existing entries before saving
  → Updates active projects tracker (top 5 recent projects)

Background (async workers)
  → Consolidates "dont" entries → behavioral principles
  → Consolidates "config" entries → thematic summaries
  → Backfills embeddings for entries created before vector layer (20/run)
  → Results used in next session start

クイックスタート

💡 推奨: このREADMEをClaude Codeに貼り付け、wasurenagusaのセットアップを依頼してください。以下のすべてを自動的に処理します。

前提条件

  • Node.js 18+

  • Claude Code (CLI)

  • コアメモリ機能には外部APIキー不要(埋め込みはローカルで実行)

  • オプション: LLM統合/分析用APIキー — Gemini / OpenAI / Anthropic

1. インストール

npm install -g wasurenagusa-mcp

またはソースから:

git clone https://github.com/tsutushi0628/wasurenagusa-mcp.git
cd wasurenagusa-mcp
npm install && npm run build
npm link

npm run build はCLIエントリーポイントに対して自動的に chmod +x を実行します。手動での権限設定は不要です。

2. 設定

~/.wasurenagusa/.env を作成します:

# Set at least one API key
GEMINI_API_KEY=your-key-here
# OPENAI_API_KEY=your-key-here
# ANTHROPIC_API_KEY=your-key-here

変数

必須

説明

GEMINI_API_KEY

3つのうち1つ

Google Gemini APIキー

OPENAI_API_KEY

3つのうち1つ

OpenAI APIキー

ANTHROPIC_API_KEY

3つのうち1つ

Anthropic APIキー

LLM_PROVIDER

なし

gemini (デフォルト), openai, または anthropic

LLM_MODEL

なし

プロバイダーのデフォルトモデルを上書き

MEMORY_DIR

なし

メモリディレクトリ (デフォルト: .wasurenagusa)

MAX_ENTRIES_PER_CATEGORY

なし

自動アーカイブ前のカテゴリごとのエントリ制限 (デフォルト: 100)

LOG_RETENTION_DAYS

なし

ログ保持期間(日数) (デフォルト: 30)

SLACK_WEBHOOK_URL

なし

自律タスクのSlack通知

3. MCPサーバーの登録

claude mcp add wasurenagusa -- wasurenagusa-mcp

4. フックの設定

⚠️ 必須 — この手順を行わないと、セッション開始時にメモリが注入されません。最も見落とされやすい設定手順です。

~/.claude/settings.json (フックを分離したい場合は settings.local.json) に追加します:

{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "wasurenagusa-context",
            "timeout": 5
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "wasurenagusa-context",
            "timeout": 5
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "wasurenagusa-analyze",
            "timeout": 30
          }
        ]
      }
    ],
    "PreCompact": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "wasurenagusa-context",
            "timeout": 15
          }
        ]
      }
    ]
  }
}

5. 使用開始

Claude Codeを起動します。以上です。

  • 初回セッション: .wasurenagusa/ ディレクトリが自動作成されます

  • 初回会話後: 停止フックが重要なコンテキストを分析・保存します

  • 2回目以降のセッション: 蓄積された知恵が開始時に自動注入されます

.gitignore.wasurenagusa/ を追加してください — プロジェクト固有のメモリデータが含まれています。


メモリカテゴリ

カテゴリ

保存内容

ファイル

config

API URL、ポート、認証場所

memory.db

dont

失敗、アンチパターン、ユーザーのフラストレーション

memory.db

decision

アーキテクチャの決定、技術選定

memory.db

log

実装記録、解決済みのエラー

memory.db

snippet

頻繁に使用するコマンドとクエリ

memory.db


MCPツール

ツール

説明

memory_get_context

設定 + 統合された原則を取得 (セッション開始時に自動呼び出し)

memory_search

軽量インデックス検索 (ID、タイトル、タグのみ)。プロジェクト間検索には project: "active" を使用

memory_get_detail

IDで詳細を取得

memory_save

メモリのエントリを明示的に保存

memory_stash

コンテキストウィンドウを節約するためにメモリを一時退避

memory_restore

退避させたメモリをアクティブなコンテキストに復元

memory_delete

IDでエントリを削除

task_submit

24時間365日実行される自律タスクを送信

task_status

タスクの実行状況を確認

task_action_list

保留中の人間によるアクションを一覧・管理

project_init

プロジェクトの品質基準を初期化


CLIコマンド

コマンド

目的

呼び出し元

wasurenagusa-context

設定 + dont + ベクトルメモリをstdoutに出力

SessionStart / UserPromptSubmit / PreCompactフック

wasurenagusa-analyze

会話をLLM分析し自動保存

停止フック

wasurenagusa-backfill

ベクトルを持たないエントリの埋め込みを生成

バックグラウンド (自動生成)

wasurenagusa-rebuild

破損したメモリデータの修復 (重複排除、ログの再ソート)

手動

wasurenagusa-spec-update

仕様ドキュメントの自動更新

cron / systemdタイマー

wasurenagusa-consolidate-all

すべてのアクティブなプロジェクトで統合を実行

手動 / スケジューラ

wasurenagusa-scheduler

夜間統合スケジューラのインストール/アンインストール/ステータス

手動


出力モード

wasurenagusaはSessionStartフックに対して2つの出力モードをサポートしており、.wasurenagusa/config.json でプロジェクトごとに設定可能です。

モード

説明

最適な用途

injection (デフォルト)

セッション開始時にメモリ全文を注入

サブエージェントがない環境 (Cursor, Windsurfなど)

agent

セッション開始時に最小限のインデックスを注入 + ユーザーメッセージごとにメモリ想起リマインダーを表示。詳細はサブエージェント経由でオンデマンド取得

Claude Code + エージェントチーム

設定

プロジェクトの .wasurenagusa/config.jsonoutputMode を追加します:

{
  "outputMode": "agent"
}

ファイルが存在しない、または outputMode が設定されていない場合、デフォルトは `"injection

Install Server
A
license - permissive license
A
quality
B
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
    Not graded
    quality
    D
    maintenance
    A self-hosted MCP server that provides AI assistants with a shared, persistent SQLite-backed memory for storing and retrieving project context, decisions, and discoveries. It enables cross-session continuity and team-wide knowledge sharing to keep AI coding tools aligned and informed.
    3
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    An MCP server that gives AI assistants persistent memory across sessions. It stores project context, decisions, and progress in structured markdown files as well as a knowledge graph and sequential thinking for better memory storage.
    36
    37
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    A local MCP server that gives AI assistants a long-term memory by capturing sessions verbatim and surfacing relevant context automatically.
    14
    794
    MIT

View all related MCP servers

Related MCP Connectors

  • Cloud-hosted MCP server for durable AI memory

  • Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.

  • An MCP memory server. One memory your agents share — across models, devices and apps.

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/tsutushi0628/wasurenagusa-mcp'

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