GAAI-framework memory-index-sync
Detect and heal index.md drift — finds memory files on disk not registered in index.md and registers them. Run when /gaai-status reports unregistered files, after batch memory operations, or as a post-delivery gate.
install
source · Clone the upstream repo
git clone https://github.com/Fr-e-d/GAAI-framework
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/Fr-e-d/GAAI-framework "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.gaai/core/skills/cross/memory-index-sync" ~/.claude/skills/fr-e-d-gaai-framework-memory-index-sync && rm -rf "$T"
manifest:
.gaai/core/skills/cross/memory-index-sync/SKILL.mdsource content
Memory Index Sync
Purpose / When to Activate
Activate when:
reports files on disk not registered in/gaai-statusindex.md- After a batch of DEC files were created outside the
skilldecision-extraction - As a lightweight post-delivery gate to confirm index integrity
- Before running
ormemory-refresh
(ensures index accuracy first)memory-compact
This skill heals drift — it does NOT create new knowledge. It only registers things that already exist on disk but are missing from
index.md.
Process
Step 1 — Decision Registry Sync
- Read
Decision Registry table — extract all registered DEC IDsindex.md - Glob
— list all files on disk, extract IDs from filenamesdecisions/DEC-*.md - For each DEC file on disk not in the registry:
- Read its YAML frontmatter:
,id
,domain
,level
,title
,statussuperseded_by - Add one row to the Decision Registry:
| DEC-{N} | {domain} | {level} | {title} | - If frontmatter
andstatus: superseded
is set: appendsuperseded_by
to the description column⚠️ SUPERSEDED by DEC-{M}
- Read its YAML frontmatter:
- For each registered DEC with no file on disk: flag
in the sync report — do NOT delete registry rows (possible archive situation)⚠️ MISSING FILE
Step 2 — File Count Update
Re-count all
DEC-*.md files on disk. Update the Shared Categories table file count in index.md to match.
Step 3 — Summary File Sync
- Read
Summaries section — extract registered summary filenamesindex.md - Glob
— list all files on disksummaries/*.summary.md - For each summary on disk not registered in
: read its frontmatter, add entry to Summaries sectionindex.md - For each registered summary with no file on disk: flag
in sync report⚠️ MISSING FILE — update pointer or delete entry
Step 4 — Supersession Reconciliation
- For each DEC file on disk with
in frontmatter:status: superseded- Check if its registry row carries the
marker⚠️ SUPERSEDED by DEC-{M} - If not: add the marker to the registry row
- Check if its registry row carries the
- Verify the Superseded/Retracted table in
is consistent with the Decision Registry (no contradictions)index.md
Step 5 — Index Frontmatter Update
Update
index.md frontmatter updated_at field:
- Format:
— or{YYYY-MM-DD} ({N} entries synced, {M} anomalies flagged)
if nothing changed(no drift — confirmed clean)
Output: Sync Report (inline, after completion)
# Memory Index Sync — {date} ## Changes Applied - Registered: DEC-{A}, DEC-{B}, ..., DEC-{Z} (10 entries added to registry) - Supersession markers added: DEC-{X} (→ DEC-{Y}) - File count updated: N → M ## Anomalies Flagged (requires human review) - ⚠️ MISSING FILE: DEC-{N} registered but no file on disk - ⚠️ ORPHAN SUMMARY: decisions-80-89.summary.md on disk, not in index ## Result: CLEAN | DRIFT_HEALED | ANOMALIES_FOUND
Quality Checks
- Only registers what exists on disk — never invents registry rows
- Never deletes existing registry rows (only flags anomalies)
- Sync report is always produced, even if no changes needed (
)CLEAN - Idempotent — running twice produces no additional changes
- Does not modify any file except
index.md
Non-Goals
This skill must NOT:
- Create new DEC files (use
)decision-extraction - Ingest new knowledge (use
)memory-ingest - Compact or archive memory (use
ormemory-compact
)memory-refresh - Modify DEC file content
Memory-index-sync heals the registry. It does not create or delete knowledge.