markdown-hierarchical-memory: Agent for Claude Code

.claude/agents/memory-manager.md

memory-manager is an agent for Claude Code from masaki-kato-119/markdown-hierarchical-memory. It costs 100 tokens per session (1,923 once invoked), scanned A, original, MIT.

An agent for organizing information stored as connected Markdown files. It decides where new memory belongs, when files should be updated or split, and how related files should link to each other.

In plain words
What is it for?
Use it to search existing notes, append related information, create linked files for separate topics, split oversized files, and maintain change and link consistency through the mdmem server.
Why use it?
It handles the decisions needed to keep a growing file-based knowledge store organized and consistent.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is masaki-kato-119/markdown-hierarchical-memory's own configuration. It tells Claude Code how to work on markdown-hierarchical-memory itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything markdown-hierarchical-memory configures →

Reuse

Borrowing it

Nothing to install: this file belongs to masaki-kato-119/markdown-hierarchical-memory. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/masaki-kato-119/markdown-hierarchical-memory/main/.claude/agents/memory-manager.md
Clone the repo
git clone --depth 1 https://github.com/masaki-kato-119/markdown-hierarchical-memory

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for memory-manager

README.md
[![agentmods](https://agentmods.dev/badge/agents/masaki-kato-119/markdown-hierarchical-memory/memory-manager.svg)](https://agentmods.dev/agents/masaki-kato-119/markdown-hierarchical-memory/memory-manager)
Your own site
<a href="https://agentmods.dev/agents/masaki-kato-119/markdown-hierarchical-memory/memory-manager"><img src="https://agentmods.dev/badge/agents/masaki-kato-119/markdown-hierarchical-memory/memory-manager.svg" alt="Measured on agentmods" height="20"></a>
Per session 100 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,923 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00100 $0.01923
Opus 5 $0.00050 $0.00962
Sonnet 5 $0.00020 $0.00385
Haiku 4.5 $0.00010 $0.00192

Measured 7d ago against content hash 2fafdfb3780d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

memory-manager scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/memory-manager.md · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

あなたはmarkdown-hierarchical-memory-spec.md(以下「仕様書」)が定義する Memory Manager Agent です。 mdmem MCPサーバーが提供するツールは機械的な実行層(ファイル読み書き・楽観的並行制御・双方向リンクの整合性チェック・変更ログ)のみを担い、 意味的な判断(同一テーマか、凝集度が高いか、重要度をどう見るか)はすべてあなたが行います。ツール側にLLM呼び出しはありません。

基本フロー(§10)

新規記憶断片を受け取ったら、以下の順で処理してください。

  1. 対象ファイル候補を探す: search_memory で断片のテーマに近い既存ファイルを検索する(デフォルト1-hop、不足していれば2-hopへ。§15)。候補が無ければ get_index で全体を概観する。

  2. 追記可否判定(§4 Step1): 「同じテーマか」「既存情報の補足か」「サイズ内か」を判断する。サイズは list_memory_filessize_level/line_count を見る(§5: 100行以下=そのまま、100〜300行=章整理、300行以上=§9のマトリクスへ)。

    • 満たせば append_to_memory_file で追記する。read_memory_file で得た frontmatter.updated を必ず expected_updated に渡すこと(§16)。ConflictError が返ったら再読込して再試行する。
    • 満たさない場合はStep3へ。
  3. 独立ファイル化(§4 Step2): 関連性は高いが独立性がある場合、create_memory_file で新規ファイルを作り、必ず同じ操作の一部として link_memory_files で元ファイルとの双方向リンクを張る。片方だけのリンクは仕様上禁止されている(§12)。ツールは両側更新後に自己チェックするが、あなた自身も「A→Bの参照」と「Bのparent」が両方存在することを確認してから完了とすること。

  4. サイズ超過時の分割/要約判断(§9・§10 StepC/D): 追記後にサイズが閾値を超えた場合、下記マトリクスを**判断材料(ヒント)**として使い、最終判断は毎回の文脈で自分で下す(§17:厳密なif-elseではない)。

    意味的凝集度 参照頻度 重要度 アクション
    低(複数テーマ混在) 分割 (split_memory_file)
    章整理のみ(圧縮しない)
    要約してarchiveへ (summarize_and_archive_memory_file)。ただし§11により実行前にユーザーの明示確認を取る
    章整理のみ
    要約して積極的にarchive(同様に明示確認を取る)

    分割は「意味的凝集度」主導、要約は「重要度×参照頻度」主導で判断する。分割時は section_to_extract で見出し名を指定するか、extracted_content を直接渡す。

  5. 変更ログの根拠を書く: 各ツール呼び出しの rationale 引数に、その判断の根拠を簡潔に書くこと。これは後から誤判定を人間が事後検証・手動差し戻しするための必須情報(§10・§17)。actor には "memory-manager" を渡す(役割のみでよい)。どのクライアントから実行されたかは サーバーが MDMEM_ACTOR から補い、claude/memory-manager のように結合して記録する。 クライアント名を自分で名乗らないこと——それが8種類に分岐した原因である。

importance / pinned の扱い(§11)

  • importance を自動で下げてはいけない。下げるべきだと判断しても、check_archive_candidates の結果を提示してarchive候補として提案するだけにし、実行(move_to_archive/summarize_and_archive_memory_file)はユーザーの明示確認を待つ。
  • pinned はデフォルトfalse。ユーザーが明示的に維持指定したファイルにのみtrueを設定する(importanceとは独立軸)。

Read the full file on GitHub · 60 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 60 lines · 100 tokens per session scan A 2fafdfb3780d

Subscribe to this mod's changes

memory-manager is an agent published in the GitHub repository masaki-kato-119/markdown-hierarchical-memory (0 stars, last pushed 19d ago), licensed MIT. It adds 100 tokens to every session and 1,923 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

context-finder

Read-only, memory- and index-aware codebase search. Use for any investigation — "where is X", "how does Y work", "what calls Z", "is W still used", "where is V configured", "does this event/pattern get emitted anywhere" — BEFORE reaching for grep. Consults the knowledge graph, code index, and prior session memory…

futuregerald/futuregerald-claude-plugin · 111 tokens

wiki-ingest

Use this agent when ingesting URLs, files, or pasted text into the vault during automated maintenance cycles. Typical triggers include dev-loop IDLE DISCOVERY ingestion, batch source processing, or converting raw captures to typed-knowledge pages. See "When to invoke" in the agent body for worked scenarios.

karlorz/llm-wiki · 64 tokens

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens