Memory index sync

From Fr-e-d/GAAI-framework · View interactive version

Memory index sync is an AI agent skill from the GitHub repository Fr-e-d/GAAI-framework. 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.

How to use this skill

Skill file

Memory Index Sync

Purpose / When to Activate

Activate when:

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

  1. Read all registry files at contexts/memory/ root (index.md + any index-*.md siblings such as index-decisions.md when Decision Registry has been extracted per file-size budget) — extract all registered DEC IDs from any of them
  2. Read archive/superseded-decisions.archive.md "Superseded DEC entries" table — extract all archived DEC IDs (column 1)
  3. Glob decisions/DEC-*.md — list all files on disk, extract IDs from filenames
  4. For each DEC file on disk:
  1. For each registered DEC with no file on disk: flag ⚠️ MISSING FILE in the sync report — do NOT delete registry rows (possible archive situation)

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

  1. Read index.md Summaries section — extract registered summary filenames
  2. Glob summaries/*.summary.md — list all files on disk
  3. For each summary on disk not registered in index.md: read its frontmatter, add entry to Summaries section
  4. For each registered summary with no file on disk: flag ⚠️ MISSING FILE — update pointer or delete entry in sync report

Step 4 — Supersession Reconciliation

  1. For each DEC file on disk with status: superseded in frontmatter:
  1. Verify the Superseded/Retracted table in index.md is consistent with the Decision Registry (no contradictions)

Step 5 — Index Frontmatter Update

Update index.md frontmatter updated_at field:

Step 6 — Archive Index Symmetry Check

  1. For every DEC ID in archive/superseded-decisions.archive.md "Superseded DEC entries" table : verify there is exactly one matching pointer row in index.md § "Superseded (archived)" pointer table. Dangling archive row (no active pointer) = anomaly.
  2. For every pointer row in index.md § "Superseded (archived)" : verify there is exactly one matching archive row. Orphan pointer (no archive backing) = anomaly.
  3. Hand off to memory-index-lint for full discoverability invariant validation. If memory-index-lint is invokable (shell available), run python3 scripts/validate-memory-index.py and require CLEAN exit before declaring DRIFT_HEALED ; otherwise perform the L3 prompt-based check from memory-index-lint/SKILL.md.

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


Non-Goals

This skill must NOT:

Memory-index-sync heals the registry. It does not create or delete knowledge.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.