Skill.md
Agent Memory Implementation Guide
Claude Code's memory system has a hard ceiling: MEMORY.md only loads the first 200 lines (from src/memdir/memdir.ts: MAX_ENTRYPOINT_LINES = 200). On long-running projects, the index tends to bloat past this limit — and when it does, Claude silently forgets everything beyond line 200. No error, no warning. The tech stack choices you taught it, the workflow preferences, the architectural decisions — they vanish until you restructure.
This skill is grounded in Claude Code's source code (services/autoDream/, services/extractMemories/, src/memdir/) and restructures a chaotic memory directory into the 2-layer architecture that autoDream actually expects.
Core Architecture
| Layer | File | Role |
|---|---|---|
| Layer 1 | MEMORY.md | Always-loaded pointer index, ≤200 lines, one - [Title](file.md) — hook per entry |
| Layer 2 | *.md topic files | On-demand knowledge, with YAML frontmatter (name, description, type) |
No third layer. autoDream does not maintain an archive/ directory — stale facts are corrected or deleted in place. The memory directory is always the current truth, not a history log.
Supported Use Cases
- MEMORY.md exceeds 200 lines and tail entries are being silently truncated
- The index contains inline content (paragraphs, code blocks, historical decisions) instead of pointers
- Topic files are missing frontmatter or have vague descriptions, causing autoDream to create duplicate files
- Taking over a project with stale memory facts (old library versions, deprecated dependencies)
- autoDream created near-duplicate files after a long session
How to Use It
Say to Claude:
- "Clean up my MEMORY.md"
- "My memory files are a mess — restructure them"
- "MEMORY.md is almost 200 lines, prune it"
- "These description fields are too vague, fix them"
Included Tool
scripts/memory_audit.py — scans your memory directory and prints a health report: line count, broken pointers, missing frontmatter, invalid type fields, and files not updated in over 30 days.
Limitations
This skill is based on observed behavior from Claude Code's source code. autoDream is an evolving feature — Anthropic may change internal implementation details. If you're on an older Claude Code version, some specifics (like the exact MAX_ENTRYPOINT_LINES value) may differ. Run the audit script first to measure your actual state before restructuring.