Memory Index Compact
Purpose / When to Activate
Activate when:
- A registry file (
index.md, index-*.md, archive index) breaches its file-size budget (typically 40k chars). The post-commit hook surfaces this.
- An index row has accreted substance that duplicates the target file body (Tier 2 cycle trails, commit SHAs, §-numbered substance dumps, validation ceremony, drift-heal forensic prose). Detection : any row > 200 chars in a registry table is suspect.
- Scheduled hygiene pass during
memory-index-sync or post-DEC-activation cleanup.
Distinct from other memory skills:
memory-compact — compacts memory CONTENT (sessions, domains) into summaries. NOT for index files.
memory-archive-superseded — migrates superseded DEC rows to archive. Adjacent but separate.
memory-index-sync — heals drift between filesystem and registry (missing rows). Detects bloat ; compaction is THIS skill's job.
Core principle — index = pointer
Every row in a registry must answer one question : « Does an agent reading this row for relevance assessment need this word? »
- Keep : file path, ID, category, level, status, ≤30-word topic essence, relation to other entities (amends, supersedes, related).
- Dégage : Tier 2 cycle trails, finding counts (F-C1, REFINE 2C+7H+4M+4L), commit SHAs, validation ceremony ("Fred ratified post Tier 2 + Compliance 11/11 PASS"), §-numbered substance dumps duplicating DEC body, drift-heal forensic prose, self-referential pointers without payload.
Substance lives in:
- DEC body (
decisions/DEC-XX.md) — for substantive design rationale
_log.md — for forensic governance trail (cycle history, status flips, drift heals)
git log — for commit history
- artefact files (
contexts/artefacts/research/*.md) — for deep dives
Index rows duplicating any of these are anti-pattern.
Process
Identify target file. Read the registry. Confirm it is an index (rows = pointers, not content). Skip if file is substantive content with embedded tables (those follow memory-compact flow).
Measure baseline. Record current size in chars. Note the budget (typically 40k for memory index files — check hooks/post-commit.d/03-memory-size-budget.sh BUDGETS array). Calculate target reduction.
Triage rows. For each row > 200 chars, classify content per the « keep / dégage » heuristic:
- Keep : metadata (path, ID, status, date) + ≤30-word topic + key relations (amends/supersedes).
- Dégage : everything else, mapping each cut to its source-of-truth file (DEC body /
_log.md / git / artefact).
Compact the row. Rewrite in the target form:
- Active Files table row:
| path | category | ID | YYYY-MM-DD (status) |
- Decision registry row:
| DEC-XX | domain | level | ≤30-word topic. Amends/supersedes X. | status YYYY-MM-DD |
- Changelog row:
| YYYY-MM-DD | ≤15-word event. Detail → _log.md / DEC-XX. |
- External artefacts row:
| path | ≤15-word topic | referenced-by IDs |
Compact narrative sections. Same principle for non-table prose:
- Navigation / TL;DR blocks: keep only actionable pointers, no philosophy.
- Section preambles ("How agents read this section") : ≤2 sentences max.
- Cascade summaries (paragraphs duplicating registry data) : delete outright.
- Frontmatter
updated_at with embedded change history : reduce to date only.
Verify no information loss. Before any cut, confirm the dropped content lives in another source-of-truth file. If a row's content does NOT live elsewhere, the substance must move TO the appropriate target file FIRST (then cut from index).
Update budget tracking. If the post-commit hook flagged the breach, verify new size is ≤ budget. Re-run the hook locally if available.
Outputs
- Updated index file(s) — pointer-only rows, all substance preserved in source-of-truth files
- No new files (this skill compacts in place ; for extract-to-sibling pattern, see precedent §7.4 in
strategy/strategic-frame.md)
- No deletions of source-of-truth files
Quality Checks
- Every row is ≤200 chars unless an explicit relation chain justifies more (e.g. multi-DEC amends)
- No row contains : commit SHAs, Tier 2 finding counts, §-numbered substance dumps, validation ceremony prose
- All metadata fields preserved : path, ID, category, level, status, date
- Target file size ≤ budget (per hook
BUDGETS array)
memory-index-lint passes post-compaction (no broken row symmetry vs filesystem)
- Spot-check : pick 3 random compacted rows ; can an agent decide relevance from them ? If yes, PASS.
Non-Goals
This skill must NOT:
- Move or delete source-of-truth files (
decisions/DEC-XX.md, _log.md, artefacts)
- Extract content into sibling files (that is the §7.4 file-extraction pattern, separate concern)
- Archive superseded rows (use
memory-archive-superseded)
- Compact memory CONTENT — sessions, domains, patterns body (use
memory-compact)
- Add new metadata to rows (drift-heal new fields belongs in
memory-index-sync)
- Modify DEC bodies,
_log.md, or any source-of-truth file as part of compaction (substance must already live there before the cut — verify in step 6)
Relationship with other skills
file-size budget breach → memory-index-compact (this skill)
filesystem-vs-registry drift → memory-index-sync
DEC superseded → memory-archive-superseded
content categories oversized → memory-compact
validation invariants → memory-index-lint
If unsure which skill applies, the failure mode of each is well-bounded :
memory-index-compact cuts text but never moves files. Reverse via git revert.
memory-compact archives ephemeral content. Reverse via archive restore.
memory-archive-superseded migrates rows + sets archived_to: frontmatter. Reverse via git revert.
Pointer principle is invariant. Even if other skills create or amend rows, those new rows MUST be in pointer-only form per this skill's heuristic. Substance-duplication in any row is a defect.
1---2name: memory-index-compact3description: Compact verbose memory index / registry files to pointer-only form. Activate when an index file (index.md, index-decisions.md, or any sibling registry table) breaches the file-size budget OR shows substance-duplication drift. Distinct from memory-compact (which targets content categories) and memory-archive-superseded (which migrates superseded rows to archive).4license: ELv25compatibility: Works with any filesystem-based AI coding agent6metadata:7 author: gaai-framework8 version: "1.0"9 category: cross10 track: cross-cutting11 id: SKILL-MEMORY-INDEX-COMPACT-00112 updated_at: 2026-05-2813 status: stable14inputs:15 - contexts/memory/index.md16 - contexts/memory/index-*.md17 - any sibling registry table (archive/*.archive.md indexes)18outputs:19 - contexts/memory/index.md (updated — pointer-only rows)20 - contexts/memory/index-*.md (updated)21related_skills:22 - memory-compact23 - memory-archive-superseded24 - memory-index-sync25 - memory-index-lint26---2728# Memory Index Compact2930## Purpose / When to Activate3132Activate when:33- A registry file (`index.md`, `index-*.md`, archive index) breaches its file-size budget (typically 40k chars). The `post-commit` hook surfaces this.34- An index row has accreted substance that duplicates the target file body (Tier 2 cycle trails, commit SHAs, §-numbered substance dumps, validation ceremony, drift-heal forensic prose). Detection : any row > 200 chars in a registry table is suspect.35- Scheduled hygiene pass during `memory-index-sync` or post-DEC-activation cleanup.3637**Distinct from other memory skills:**38- `memory-compact` — compacts memory CONTENT (sessions, domains) into summaries. NOT for index files.39- `memory-archive-superseded` — migrates superseded DEC rows to archive. Adjacent but separate.40- `memory-index-sync` — heals drift between filesystem and registry (missing rows). Detects bloat ; compaction is THIS skill's job.4142## Core principle — index = pointer4344Every row in a registry must answer one question : *« Does an agent reading this row for relevance assessment need this word? »*4546- **Keep** : file path, ID, category, level, status, ≤30-word topic essence, relation to other entities (amends, supersedes, related).47- **Dégage** : Tier 2 cycle trails, finding counts (F-C1, REFINE 2C+7H+4M+4L), commit SHAs, validation ceremony ("Fred ratified post Tier 2 + Compliance 11/11 PASS"), §-numbered substance dumps duplicating DEC body, drift-heal forensic prose, self-referential pointers without payload.4849**Substance lives in:**50- DEC body (`decisions/DEC-XX.md`) — for substantive design rationale51- `_log.md` — for forensic governance trail (cycle history, status flips, drift heals)52- `git log` — for commit history53- artefact files (`contexts/artefacts/research/*.md`) — for deep dives5455Index rows duplicating any of these are anti-pattern.5657---5859## Process60611. **Identify target file.** Read the registry. Confirm it is an index (rows = pointers, not content). Skip if file is substantive content with embedded tables (those follow `memory-compact` flow).62632. **Measure baseline.** Record current size in chars. Note the budget (typically 40k for memory index files — check `hooks/post-commit.d/03-memory-size-budget.sh` `BUDGETS` array). Calculate target reduction.64653. **Triage rows.** For each row > 200 chars, classify content per the « keep / dégage » heuristic:66 - Keep : metadata (path, ID, status, date) + ≤30-word topic + key relations (amends/supersedes).67 - Dégage : everything else, mapping each cut to its source-of-truth file (DEC body / `_log.md` / git / artefact).68694. **Compact the row.** Rewrite in the target form:70 - **Active Files table row:** `| path | category | ID | YYYY-MM-DD (status) |`71 - **Decision registry row:** `| DEC-XX | domain | level | ≤30-word topic. Amends/supersedes X. | status YYYY-MM-DD |`72 - **Changelog row:** `| YYYY-MM-DD | ≤15-word event. Detail → _log.md / DEC-XX. |`73 - **External artefacts row:** `| path | ≤15-word topic | referenced-by IDs |`74755. **Compact narrative sections.** Same principle for non-table prose:76 - **Navigation / TL;DR blocks:** keep only actionable pointers, no philosophy.77 - **Section preambles** ("How agents read this section") : ≤2 sentences max.78 - **Cascade summaries** (paragraphs duplicating registry data) : delete outright.79 - **Frontmatter `updated_at`** with embedded change history : reduce to date only.80816. **Verify no information loss.** Before any cut, confirm the dropped content lives in another source-of-truth file. If a row's content does NOT live elsewhere, the substance must move TO the appropriate target file FIRST (then cut from index).82837. **Update budget tracking.** If the post-commit hook flagged the breach, verify new size is ≤ budget. Re-run the hook locally if available.8485---8687## Outputs8889- Updated index file(s) — pointer-only rows, all substance preserved in source-of-truth files90- No new files (this skill compacts in place ; for extract-to-sibling pattern, see precedent §7.4 in `strategy/strategic-frame.md`)91- No deletions of source-of-truth files9293---9495## Quality Checks9697- Every row is ≤200 chars unless an explicit relation chain justifies more (e.g. multi-DEC amends)98- No row contains : commit SHAs, Tier 2 finding counts, §-numbered substance dumps, validation ceremony prose99- All metadata fields preserved : path, ID, category, level, status, date100- Target file size ≤ budget (per hook `BUDGETS` array)101- `memory-index-lint` passes post-compaction (no broken row symmetry vs filesystem)102- Spot-check : pick 3 random compacted rows ; can an agent decide relevance from them ? If yes, PASS.103104---105106## Non-Goals107108This skill must NOT:109- Move or delete source-of-truth files (`decisions/DEC-XX.md`, `_log.md`, artefacts)110- Extract content into sibling files (that is the §7.4 file-extraction pattern, separate concern)111- Archive superseded rows (use `memory-archive-superseded`)112- Compact memory CONTENT — sessions, domains, patterns body (use `memory-compact`)113- Add new metadata to rows (drift-heal new fields belongs in `memory-index-sync`)114- Modify DEC bodies, `_log.md`, or any source-of-truth file as part of compaction (substance must already live there before the cut — verify in step 6)115116---117118## Relationship with other skills119120```121file-size budget breach → memory-index-compact (this skill)122filesystem-vs-registry drift → memory-index-sync123DEC superseded → memory-archive-superseded124content categories oversized → memory-compact125validation invariants → memory-index-lint126```127128If unsure which skill applies, the failure mode of each is well-bounded :129- `memory-index-compact` cuts text but never moves files. Reverse via `git revert`.130- `memory-compact` archives ephemeral content. Reverse via archive restore.131- `memory-archive-superseded` migrates rows + sets `archived_to:` frontmatter. Reverse via `git revert`.132133**Pointer principle is invariant.** Even if other skills create or amend rows, those new rows MUST be in pointer-only form per this skill's heuristic. Substance-duplication in any row is a defect.