jpskill.com
🛠️ 開発・MCP コミュニティ

mnemos

Task-scoped memory lifecycle — typed MnemoGraph prevents lossy context compaction by treating facts/decisions/code-refs/handoffs as distinct node types with per-type eviction policies

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o mnemos.zip https://jpskill.com/download/21646.zip && unzip -o mnemos.zip && rm mnemos.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/21646.zip -OutFile "$d\mnemos.zip"; Expand-Archive "$d\mnemos.zip" -DestinationPath $d -Force; ri "$d\mnemos.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して mnemos.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → mnemos フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

Mnemos — Task-Scoped Memory Lifecycle

What It Does

Mnemos prevents lossy context compaction from destroying the structured knowledge you need most. It treats your working memory as a typed graph (MnemoGraph) where different types of knowledge have different eviction policies:

  • GoalNodes and ConstraintNodes are NEVER evicted — they survive all compaction
  • ResultNodes are compressed (summary kept) before eviction
  • ContextNodes are evictable when their activation weight drops
  • CheckpointNodes persist to disk for session resume

Fatigue Model

Mnemos monitors 4 dimensions of "agent fatigue" — all passively observed from hook data, no manual input needed:

Dimension Weight Signal Source What It Measures
Token utilization 0.40 Statusline JSON How full the context window is
Scope scatter 0.25 PreToolUse file paths How many directories the agent is bouncing between
Re-read ratio 0.20 PreToolUse Read calls How often the agent re-reads files it already read (context loss)
Error density 0.15 PostToolUse outcomes What fraction of tool calls are failing (agent struggling)

Fatigue states and actions:

State Score Action
FLOW 0.0–0.4 Normal operation
COMPRESS 0.4–0.6 Micro-consolidation runs (compress 3 ResultNodes, evict 1 cold ContextNode)
PRE-SLEEP 0.6–0.75 Checkpoint written, consolidation runs
REM 0.75–0.9 Emergency checkpoint, consider wrapping up
EMERGENCY 0.9+ Checkpoint written, hand off immediately

How To Use

Automatic (hooks handle everything):

  1. Statusline writes fatigue.json on every API call
  2. PreToolUse hook reads fatigue before every edit, auto-checkpoints at 0.60+
  3. PreCompact hook writes emergency checkpoint, compaction marker, and tells summarizer what to preserve
  4. SessionStart "compact" fires immediately after compaction, re-injects full checkpoint (primary restore)
  5. SessionStart "startup|resume" loads last checkpoint on new/resumed sessions
  6. PreToolUse fallback (no matcher) detects compaction marker if SessionStart didn't fire
  7. Stop hook writes final checkpoint for next session

Post-Compaction Recovery (Three-Layer Defense):

When Claude Code compacts the context (~83% full), Mnemos uses three layers:

  • Layer 1 (PreCompact): Outputs strong preservation instructions with inline checkpoint content for the summarizer. Writes .mnemos/just-compacted marker.
  • Layer 2 (SessionStart "compact"): PRIMARY re-injection. Fires immediately when Claude resumes after compaction — before any agent action. Consumes the marker and injects the full checkpoint into the fresh context. This is the recommended approach per the RFC (Wake State Reconstruction).
  • Layer 3 (PreToolUse fallback): If SessionStart doesn't fire (older versions, edge cases), the first tool call triggers mnemos-post-compact-inject.sh which detects the marker and injects. Safety net only.

The result: after compaction, you'll see a "CONTEXT RESTORED AFTER COMPACTION" block with your goal, constraints, what you were working on, and progress. Resume from there.

Manual CLI:

mnemos init                    # Initialize .mnemos/
mnemos status                  # Show node counts + fatigue
mnemos fatigue                 # Detailed fatigue breakdown
mnemos checkpoint --force      # Write checkpoint now
mnemos resume                  # Output checkpoint for context
mnemos consolidate             # Run micro-consolidation
mnemos nodes --type goal       # List active GoalNodes
mnemos add goal "Build auth"   # Add a GoalNode
mnemos bridge-icpg             # Import iCPG ReasonNodes

Agent Instructions

When working on a task:

  1. Create a GoalNode at the start: mnemos add goal "what you're trying to achieve" --task-id session-1
  2. Add ConstraintNodes for invariants: mnemos add constraint "API backward compatibility" --scope src/api/
  3. Check fatigue before long operations: mnemos fatigue
  4. Checkpoint at sub-goal boundaries: mnemos checkpoint
  5. On session resume: the SessionStart hook automatically loads your checkpoint

iCPG Integration

Mnemos bridges with iCPG (Intent-Augmented Code Property Graph):

  • mnemos bridge-icpg imports active ReasonNodes as GoalNodes
  • Postconditions/invariants become ConstraintNodes
  • Checkpoint includes iCPG state (active intent, unresolved drift)

Storage

Everything lives in .mnemos/ (gitignored):

  • mnemo.db — SQLite MnemoGraph
  • fatigue.json — Live token metrics (updated per API call by statusline)
  • signals.jsonl — Behavioral signal log (appended by PreToolUse + PostToolUse hooks)
  • checkpoint-latest.json — Most recent checkpoint
  • checkpoints/ — Archived checkpoints