compact-directory-memory
Skill2 starsChanged 45 days agoMITView on GitHub
Manage paired MEMORY.md/CHANGELOG.md and runtime/ execution-state formats in flat or nested directory contexts.
In this repository15 other files it gives its agents.
- task-archaeologySkill
- task-artifact-integritySkill
- task-aware-project-workSkill
- task-context-storageSkill
- task-cross-machine-syncSkill
- task-external-repos-patternSkill
- task-frameworkSkill
- task-lifecycle-disciplineSkill
- task-lifecycle-edge-casesSkill
- task-lifecycle-portabilitySkill
- task-nested-subtask-lifecycleSkill
- task-requirement-intakeSkill
- task-root-git-operationsSkill
- task-timestamp-conventionSkill
- task-trackerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 13 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 68
No headings, tables, tags, or frontmatter.
- Distinctive: line 69
Use declarative facts, not instructions.
- Very specific: line 70
Use 🔴 only for enforced invariants.
- Distinctive: line 71
Remove or replace stale facts instead of retaining historical versions.
- Distinctive: line 72
Prefer expected configuration over transient observations.
- Distinctive: line 73
Keep reusable procedures in skills, not MEMORY.md.
- Distinctive: line 77
Use chronological entries with the newest entry appended at the bottom:
- Distinctive: line 100
Use for one project, one task, or one cohesive entity.
- Distinctive: line 104
Use when multiple sessions modify distinct subsystems under one long-running task or project:
- Distinctive: line 171
Every status change (completed, blocked) must be written back to this table in the same working session.
- Distinctive: line 175
Before changing a hierarchical entity:
- Very specific: line 177
Read root MEMORY.md completely.
- Very specific: line 178
Read recent relevant root CHANGELOG.md entries.
- Very specific: line 180
Read its MEMORY.md completely.
- Very specific: line 181
Read recent relevant entries from its CHANGELOG.md.
- Distinctive: line 185
After a verified change:
- Very specific: line 187
Update subsystem MEMORY.md only if stable facts changed.
- Very specific: line 189
Update root MEMORY.md only if the subsystem index or cross-subsystem facts changed.
- Distinctive: line 194
Create or extend a hierarchical context:
- Distinctive: line 200
Verify required files and naming:
- Very specific: line 212
Create root MEMORY.md and CHANGELOG.md.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Compact Directory Memory
The authoritative format and maintenance skill for paired MEMORY.md and CHANGELOG.md files — and for runtime/ execution-state file formats — inside projects, tasks, and other directory-managed entities.
task-framework decides when task context must be loaded. This skill owns how directory context is structured, formatted, created, read, updated, and verified.
Context pair
| File | Meaning | Update mode |
MEMORY.md | Stable expected-state facts, constraints, paths, interfaces, and conventions | Replace stale facts; keep compact |
CHANGELOG.md | Chronological operations, decisions, verification, failures, and next steps | Append; never rewrite history |
Transient runtime status never belongs in MEMORY.md. Record observed execution results in CHANGELOG.md.
MEMORY.md format
<one declarative fact paragraph>
§
<another declarative fact paragraph>
§
🔴 <critical invariant>Rules:
- One fact per paragraph, separated by
§on its own line. - No headings, tables, tags, or frontmatter.
- Use declarative facts, not instructions.
- Use
🔴only for enforced invariants. - Remove or replace stale facts instead of retaining historical versions.
- Prefer expected configuration over transient observations.
- Keep reusable procedures in skills, not MEMORY.md.
CHANGELOG.md format
Use chronological entries with the newest entry appended at the bottom:
## YYYY-MM-DD HH:MM:SS
**Operation:** What happened.
**Reason:** Why this approach was selected.
**Artifacts:** Files, repositories, or outputs changed.
**Verification:** Commands/checks and real results.
**Blockers:** Unresolved problems, if any.
**Next step:** Exact continuation point for another session.Raw command output belongs in output/logs/ or another log directory, not in CHANGELOG.md.
Flat layout
<entity>/
├── MEMORY.md
└── CHANGELOG.mdUse for one project, one task, or one cohesive entity.
Hierarchical layout
Use when multiple sessions modify distinct subsystems under one long-running task or project:
<entity>/
├── MEMORY.md # root index and cross-subsystem facts
├── CHANGELOG.md # cross-subsystem chronological summaries
└── memories/
└── <sub-system>/
├── MEMORY.md # subsystem-owned stable facts
└── CHANGELOG.md # subsystem operations and verificationSubsystem names are lowercase kebab-case. Every subsystem directory must contain both files.
Root versus subsystem ownership
- Root
MEMORY.md: entity identity, subsystem index, cross-subsystem invariants, shared interfaces. - Root
CHANGELOG.md: concise cross-subsystem summary with references to affected subsystem logs. - Subsystem
MEMORY.md: facts owned only by that subsystem. - Subsystem
CHANGELOG.md: detailed work history for that subsystem.
Root files are indexes and syntheses, not copies of subsystem files.
Runtime execution state (runtime/)
A task (or any directory-managed entity) may carry a runtime/ directory of resumable execution state. Ownership is split: task-framework owns the item lifecycle (when to create a runtime/<item>/, when to mark it done or blocked, how subtasks nest their own runtime/); this skill owns the file formats below.
<entity>/
└── runtime/
├── INDEX.md # master index — one row per item
└── <item>/ # one dir per requirement / bugfix / phase
├── TODO.md # items to complete
├── LOG.md # append-only execution log
└── MEMORY.md # discoveries made during executionruntime/ is not a delivery directory; it exists so a machine restart or context compression can resume from disk instead of chat history.
TODO.md
Checklist of items, each phrased with its acceptance criterion:
- [ ] <item>(<验收标准>)
- [x] <completed item>LOG.md
Append-only execution log — same semantics as CHANGELOG.md: append entries, never rewrite history. Entries are short lines of time + action + result (commands, commits, verification outcomes). Raw command output goes to output/logs/, not here.
item MEMORY.md
Discoveries made during execution: paths, root causes, pitfalls, constraints. Follows the MEMORY.md format section above — compact §-separated declarative facts. Transient progress status belongs in LOG.md or INDEX.md, never here.
INDEX.md
Master index and recovery snapshot — the first entry point after restart or context compression. One row per runtime/<item>/:
| item | status | notes / blocked reason | last updated |
|------|--------|------------------------|--------------|- Status values:
done/todo/blocked. blockedrows must state the reason.- Every status change (completed, blocked) must be written back to this table in the same working session.
Read protocol
Before changing a hierarchical entity:
- Read root
MEMORY.mdcompletely. - Read recent relevant root
CHANGELOG.mdentries. - Identify the target subsystem.
- Read its
MEMORY.mdcompletely. - Read recent relevant entries from its
CHANGELOG.md.
Write protocol
After a verified change:
- Update subsystem
MEMORY.mdonly if stable facts changed. - Append subsystem
CHANGELOG.mdwith operation, reason, artifacts, verification, blockers, and next step. - Update root
MEMORY.mdonly if the subsystem index or cross-subsystem facts changed. - Append a concise root
CHANGELOG.mdsummary naming affected subsystem logs.
Tooling
Create or extend a hierarchical context:
python3 scripts/manage_directory_context.py init <entity-dir> <sub-system> [<sub-system> ...]Verify required files and naming:
python3 scripts/manage_directory_context.py verify <entity-dir>The script never overwrites existing context files.
Relationship to task-framework
task-framework owns task creation, status, checklist, indexes, and lifecycle. For task context it must:
- Create root
MEMORY.mdandCHANGELOG.md. - Load this skill when hierarchical directory context is requested or detected.
- Delegate nested creation, format rules, and validation to this skill.
- Preserve
MEMORY.md,CHANGELOG.md, andmemories/during reset and cleanup.
Relationship to changelog skill
The continuous CHANGELOG.md in this skill preserves cross-session context. The separate changelog skill creates immutable changelog/<timestamp>.<topic>.md delivery records. They are complementary and must not replace each other.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

