manage-memory
について
このスキルは、MEMORY.mdを簡潔な索引として整理し、詳細なトピックを別ファイルに抽出することで、Claude Codeの永続的メモリを維持します。古くなったエントリを自動検出し、現在のプロジェクトに対して正確性を検証し、200行の制限を適用します。MEMORY.mdが行数制限に近づいたとき、生産的な作業セッション後、またはプロジェクトの変更によりメモリエントリが古くなっている可能性があるときに使用してください。
クイックインストール
Claude Code
推奨npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/manage-memoryこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
Manage Memory
Maintain Claude Code's persistent memory dir → accurate, concise, useful across sessions. MEMORY.md loaded into system prompt every conv — lines after 200 truncated → file must be lean index pointing to topic files for detail.
Use When
- MEMORY.md nearing 200-line limit
- Session produced durable insights worth preserving (new patterns, arch decisions, debugging solutions)
- Topic section in MEMORY.md > 10-15 lines → extract
- Project state changed (renamed files, new domains, updated counts) → entries may be stale
- Starting new work area → check if relevant memory exists
- Periodic maintenance between sessions
In
- Req: Access to memory dir (typically
~/.claude/projects/<project-path>/memory/) - Opt: Specific trigger ("MEMORY.md too long", "just finished major refactor")
- Opt: Topic to add / update / extract
Do
Step 1: Assess Current State
Read MEMORY.md + list all files in memory dir:
wc -l <memory-dir>/MEMORY.md
ls -la <memory-dir>/
Check line count vs 200-line limit. Inventory existing topic files.
→ Clear picture of total lines, # topic files, which sections exist in MEMORY.md.
If err: Memory dir doesn't exist → create. MEMORY.md doesn't exist → minimal one w/ # Project Memory header + ## Topic Files section.
Step 2: ID Stale Entries
Compare memory claims vs current project state. Common staleness:
- Count drift: File counts, skill counts, domain counts changed after additions/removals
- Renamed paths: Files / dirs moved / renamed
- Superseded patterns: Workarounds no longer needed after fixes
- Contradictions: Two entries saying diff things about same topic
Use Grep to spot-check:
# Example: verify a skill count claim
grep -c "^ - id:" skills/_registry.yml
# Example: verify a file still exists
ls path/claimed/in/memory.md
→ List of stale entries w/ correct current vals.
If err: Can't verify claim (refs external state) → leave but add (unverified) note rather than silently preserve potentially wrong info.
Step 3: Decide What to Add
For new entries, apply filters before writing:
- Durability: Will this be true next session? Avoid session-specific (current task, in-progress, temporary).
- Non-duplication: CLAUDE.md / project docs already cover? Don't duplicate — memory for things NOT captured elsewhere.
- Verified: Confirmed across multi interactions, or single obs? Single → verify vs project docs before writing.
- Actionable: Does knowing change behavior? "Sky blue" ≠ useful. "Exit code 5 = quoting err → use temp files" changes how you work.
Exception: User explicitly asks to remember → save immediately, no multi confirmations needed.
→ Filtered list worth adding, each meeting durability + non-dup + verified + actionable.
If err: Unsure if worth keeping → err toward keeping briefly in MEMORY.md — easier to prune later than rediscover.
Step 4: Extract Oversize Topics
Section > ~10-15 lines → extract to dedicated topic file:
- Create
<memory-dir>/<topic-name>.mdw/ descriptive header - Move detailed content from MEMORY.md → topic file
- Replace section in MEMORY.md w/ 1-2 line summary + link:
## Topic Files
- [topic-name.md](topic-name.md) — Brief description of contents
Naming conventions:
- Lowercase kebab-case:
viz-architecture.md, notVizArchitecture.md - Name by topic, not chronology:
patterns.md, notsession-2024-12.md - Group related: combine "R debugging" + "WSL quirks" →
patterns.mdvs one file per fact
→ MEMORY.md stays < 200 lines. Each topic file self-contained + readable w/o MEMORY.md ctx.
If err: Topic file < 5 lines → probably not worth extracting → leave inline.
Step 5: Update MEMORY.md
Apply changes: remove stale, add new, update counts, ensure Topic Files section lists all dedicated files.
MEMORY.md structure:
# Project Memory
## Section 1 — High-level context
- Bullet points, concise
## Section 2 — Another topic
- Key facts only
## Topic Files
- [file.md](file.md) — What it covers
Guidelines:
- Each bullet 1-2 lines max
- Inline formatting (
code, bold) for scanability - Most frequently needed ctx first
- Topic Files section always last
→ MEMORY.md < 200 lines, accurate, working links to all topic files.
If err: Can't get < 200 after extraction → ID least-freq-used section + extract. Every section candidate — even project structure overview can go to topic file if needed, leaving 1-line summary.
Step 6: Verify Integrity
Final check:
- Line count: MEMORY.md < 200
- Links: Every topic file referenced exists
- Orphans: Topic files not referenced in MEMORY.md
- Accuracy: Spot-check 2-3 factual claims vs project state
wc -l <memory-dir>/MEMORY.md
# Check for broken links
for f in $(grep -oP '\[.*?\]\(\K[^)]+' <memory-dir>/MEMORY.md); do
ls <memory-dir>/$f 2>/dev/null || echo "BROKEN: $f"
done
# Check for orphan files
ls <memory-dir>/*.md | grep -v MEMORY.md
→ Line count < 200, no broken links, no orphans, spot-checked claims accurate.
If err: Fix broken links (update / remove). Orphans → add ref in MEMORY.md / delete if no longer relevant.
Check
- MEMORY.md < 200 lines
- All referenced topic files exist on disk
- No orphan
.mdin memory dir (every file linked from MEMORY.md) - No stale counts / renamed paths
- New entries meet durability / non-dup / verified / actionable
- Topic files have descriptive headers + self-contained
- MEMORY.md reads as quick-ref, not changelog
Traps
- Memory file pollution: Writing every session obs to memory. Most findings session-specific + don't need persisting. Apply 4 filters (Step 3) before writing.
- Stale counts: Updating code but not memory. Counts (skills, agents, domains, files) drift silently. Always verify vs source of truth before trusting memory.
- Chronological organization: "When I learned" vs "what it's about". Topic-based (
patterns.md,viz-architecture.md) > date-based files. - Duplicate CLAUDE.md: CLAUDE.md = authoritative project instructions. Memory captures things NOT in CLAUDE.md — debugging insights, arch decisions, workflow prefs, cross-project patterns.
- Over-extraction: Topic file for every 3-line section. Only extract when > ~10-15 lines. Small sections inline.
- Forget 200-line limit: MEMORY.md loaded every system prompt. Lines after 200 silently truncated. Grows past → bottom content effectively invisible.
→
write-claude-md— CLAUDE.md captures project instructions; memory captures cross-session learningprune-agent-memory— inverse of manage-memory: auditing, classifying, selectively forgetting storedwrite-continue-here— structured continuation file for session handoff; complements memory as short-term bridgeread-continue-here— read + act on continuation at session start; consumption side of handoffcreate-skill— new skills may produce memory-worthy patternsheal— self-healing may update memory as part of integration stepmeditate— meditation sessions may surface insights worth persisting
GitHub リポジトリ
関連スキル
qmd
開発qmdは、BM25、ベクトル埋め込み、およびリランキングを組み合わせたハイブリッド検索を用いて、ローカルファイルのインデックス作成と検索を可能にするローカル検索・インデックス作成CLIツールです。コマンドラインでの使用と、Claudeとの統合のためのMCP(Model Context Protocol)モードの両方をサポートしています。このツールは埋め込みにOllamaを使用し、インデックスをローカルに保存するため、ターミナルから直接ドキュメントやコードベースを検索するのに最適です。
subagent-driven-development
開発このスキルは、各独立したタスクに対して新規のサブエージェントを起動し、タスク間でコードレビューを実施しながら実装計画を実行します。レビュープロセスを通じて品質基準を維持しつつ、迅速な反復を可能にします。同一セッション内で主に独立したタスクに取り組む際に本スキルをご利用いただくことで、組み込まれた品質チェックを伴う継続的な進捗を確保できます。
mcporter
開発mcporterスキルは、開発者がClaudeから直接Model Context Protocol(MCP)サーバーを管理および呼び出せるようにします。このスキルは、利用可能なサーバーの一覧表示、引数を指定したツールの呼び出し、認証およびデーモンのライフサイクル管理を行うコマンドを提供します。開発ワークフローにおいてMCPサーバーの機能を統合およびテストする際に、このスキルをご利用ください。
adk-deployment-specialist
開発このスキルは、A2Aプロトコルを使用してVertex AI ADKエージェントをデプロイおよびオーケストレーションし、AgentCardの発見、タスク送信、およびコード実行サンドボックスやメモリバンクなどのサポートツールを管理します。Python、Java、またはGoで、順次、並列、またはループのオーケストレーションパターンを用いたマルチエージェントシステムの構築を可能にします。Google Cloud上でADKエージェントのデプロイやエージェントワークフローのオーケストレーションを求められた際にご利用ください。
