Memory index lint

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

Memory index lint is an AI agent skill from the GitHub repository Fr-e-d/GAAI-framework. Validate discoverability invariants of memory `index.md` and `archive/superseded-decisions.archive.md`. Tool-agnostic L3 prompt + capability-dependent L4 script. Detects table corruption, dangling/orphan supersession pointers, frontmatter inconsistencies, missing affordance signals.

How to use this skill

Skill file

Memory Index Lint

Purpose / When to Activate

Validate that index.md and archive/superseded-decisions.archive.md satisfy the discoverability invariants required for AI agents to reliably navigate the memory corpus without missing context.

Activate when:


Two execution paths

L4 — Capability-dependent script (preferred when shell available)

When the agent has Bash/shell access (Claude Code, Cursor with terminal, daemon claude -p) :

python3 scripts/validate-memory-index.py
# Exit 0 = CLEAN
# Exit 1 = VIOLATIONS (printed to stderr/stdout)
# Exit 2 = USAGE / IO error

# Strict mode: treat soft warnings as failures (use post-migration)
python3 scripts/validate-memory-index.py --strict

# Quiet mode: print only final summary line
python3 scripts/validate-memory-index.py --quiet

Pre-commit hook invokes the script automatically — no manual invocation needed in most flows.

L3 — Tool-agnostic in-session prompt (fallback when no shell)

When the agent is on a surface without shell access, or when invoking the script is not appropriate, perform these checks manually by reading the files :

Invariant checks (mandatory)
  1. Table column consistency. For every Markdown table in index.md and the archive, every row has the same number of |-delimited cells. If a row has different cell count → format corruption, FAIL. (This catches the kind of manual-edit corruption where two table rows get concatenated into one — empirically observed in earlier index revisions.)
  1. Active ↔ archive symmetry. Every DEC ID in the "Superseded (archived)" pointer table of index.md MUST have exactly one matching row (column 1) in archive/superseded-decisions.archive.md § "Superseded DEC entries", and vice versa. Dangling pointer (active claims archived but no archive row) = FAIL. Orphan archive row (archive has DEC but active doesn't reference it) = FAIL.
  1. DEC frontmatter source-of-truth. For every DEC referenced in the archive index, read decisions/DEC-XX.md frontmatter and verify :
  1. Path stability. Every DEC referenced in active index OR archive index has its file at decisions/DEC-XX.md on disk. Exception: a DEC ID may be reserved-no-file (declared in the index as such — e.g. a contingency pivot reservation that intentionally holds a slot without a body file).
  1. Supersedeur backlink (V2 — soft check V1). For every supersession edge DEC-X → DEC-Y, the supersedeur DEC-Y's frontmatter should declare supersedes: [DEC-X, ...]. Missing or asymmetric backlink = WARN (not FAIL in V1 ; promotes to FAIL in V2).
Affordance signal check (soft)
  1. "How agents read" section present. If index.md references "Superseded" or has a "Superseded (archived)" section, it MUST contain an affordance block telling agents :

Missing this block = soft warning (non-blocking) in V1. Promotes to hard fail post full-migration.

Reporting

After running all checks, produce an inline report :

# Memory Index Lint — {date}

## Hard violations
- [<category>] <description> ... (or "none")

## Soft warnings
- [<category>] <description> ... (or "none")

## Result: CLEAN | VIOLATIONS_FOUND | SOFT_ONLY

If hard violations found, the operation that triggered the lint should be reverted or escalated. Soft warnings are informational and do not block.


Worktree + parallel safety


Quality Checks


Non-Goals

This skill must NOT :

memory-index-lint validates structural invariants. It does not enforce policy.


Related skills

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.