From agent-almanac
Organizes, extracts, prunes, and verifies Claude Code persistent memory files: MEMORY.md index, topic extraction, staleness detection, accuracy checks. Use near 200-line limit, after insights, or project changes.
npx claudepluginhub pjt222/agent-almanacThis skill uses the workspace's default tool permissions.
---
Provides stable principles, keyword registry, and navigation for Claude Code memory system (CLAUDE.md, static memory, hierarchy, imports). Delegates details to docs-management skill.
Loads, saves, and applies durable project memory from MEMORY.md at repo root. Activates on 'remember this' commands, session starts with file, or mistake corrections.
Manages persistent project memory using MEMORY.md index, .oma/memory topic files, and .oma/rules packages. Audits memory, activates matching rules, reports outdated entries for long sessions with context drift.
Share bugs, ideas, or general feedback.
Maintain Claude Code's persistent memory directory so it stays accurate, concise, and useful across sessions. MEMORY.md is loaded into the system prompt on every conversation — lines after 200 are truncated, so this file must be a lean index pointing to topic files for detail.
~/.claude/projects/<project-path>/memory/)Read MEMORY.md and list all files in the memory directory:
wc -l <memory-dir>/MEMORY.md
ls -la <memory-dir>/
Check the line count against the 200-line limit. Inventory existing topic files.
Expected: Clear picture of total lines, number of topic files, and which sections exist in MEMORY.md.
On failure: If the memory directory doesn't exist, create it. If MEMORY.md doesn't exist, create a minimal one with a # Project Memory header and a ## Topic Files section.
Compare memory claims against current project state. Common staleness patterns:
Use Grep to spot-check key claims:
# Example: verify a skill count claim
grep -c "^ - id:" skills/_registry.yml
# Example: verify a file still exists
ls path/claimed/in/memory.md
Expected: A list of entries that are stale, with the correct current values.
On failure: If you can't verify a claim (e.g., it references external state you can't check), leave it but add a (unverified) note rather than silently preserving potentially wrong information.
For new entries, apply these filters before writing:
Exception: If the user explicitly asks to remember something, save it immediately — no need to wait for multiple confirmations.
Expected: A filtered list of entries worth adding, each meeting durability + non-duplication + verification + actionability criteria.
On failure: If unsure whether an entry is worth keeping, err toward keeping it briefly in MEMORY.md — it's easier to prune later than to rediscover.
When a section in MEMORY.md exceeds ~10-15 lines, extract it to a dedicated topic file:
<memory-dir>/<topic-name>.md with a descriptive header## Topic Files
- [topic-name.md](topic-name.md) — Brief description of contents
Naming conventions for topic files:
viz-architecture.md, not VizArchitecture.mdpatterns.md, not session-2024-12.mdpatterns.md rather than creating one file per factExpected: MEMORY.md stays under 200 lines. Each topic file is self-contained and readable without MEMORY.md context.
On failure: If a topic file would be fewer than 5 lines, it's probably not worth extracting — leave it inline in MEMORY.md.
Apply all changes: remove stale entries, add new entries, update counts, and ensure the Topic Files section lists all dedicated files.
MEMORY.md structure should follow this pattern:
# 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:
code, bold) for scanabilityExpected: MEMORY.md is under 200 lines, accurate, and has working links to all topic files.
On failure: If you can't get under 200 lines after extraction, identify the least-frequently-used section and extract it. Every section is a candidate — even the project structure overview can go to a topic file if needed, leaving just a 1-line summary.
Run a final check:
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
Expected: Line count under 200, no broken links, no orphan files, spot-checked claims are accurate.
On failure: Fix broken links (update or remove). For orphan files, either add a reference in MEMORY.md or delete them if they're no longer relevant.
.md files in memory directory (every file is linked from MEMORY.md)patterns.md, viz-architecture.md) is far more useful for retrieval than date-based files.write-claude-md — CLAUDE.md captures project instructions; memory captures cross-session learningprune-agent-memory — the inverse of manage-memory: auditing, classifying, and selectively forgetting stored memorieswrite-continue-here — write a structured continuation file for session handoff; complements memory as a short-term context bridgeread-continue-here — read and act on a continuation file at session start; the consumption side of the 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