Memory alignment check

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

Memory alignment check is an AI agent skill from the GitHub repository Fr-e-d/GAAI-framework. After QA PASS, compare the Story's implementation footprint against relevant memory entries. Reports confirmed entries, contradictions, and new knowledge candidates. Never writes to memory — produces a delta report for Discovery to action.

How to use this skill

Skill file

Memory Alignment Check

Purpose / When to Activate

Activate after QA verdict is PASS — never before (avoids analysis on code that will change).

This skill checks that long-term memory (decisions, patterns, project context) remains accurate after a Story is delivered. It compares only the Story's implementation footprint against relevant memory entries — not the full codebase.

The codebase is the source of truth for implementation.

Memory is the source of truth for decisions and patterns.

This skill checks that both remain consistent after each delivery.

This skill reports. It never writes to memory.


Process

1. Extract Implementation Footprint

From {id}.impl-report.md:

2. Retrieve Relevant Memory (Selective)

Using contexts/memory/index.md:

3. Compare Footprint Against Memory

For each relevant memory entry, assign one verdict:

→ Record entry ID, suggest last_verified_at update to today, verified_against_story to Story ID

→ Record exact contradiction, affected memory entry ID, severity (high / medium / low)

→ Skip — no verdict needed

4. Identify New Knowledge Not Yet in Memory

From the implementation footprint, extract candidates not present in memory:

These are ingestion candidates — flagged for Discovery to validate and ingest.


Outputs

Written to: contexts/artefacts/memory-deltas/{id}.memory-delta.md

---
artefact_type: memory-delta
skill: memory-alignment-check
story_id: E01S01
generated_at: YYYY-MM-DD
verdict: ALIGNED | DRIFT_DETECTED | NEW_KNOWLEDGE_FOUND | DRIFT_AND_NEW_KNOWLEDGE
---

## Confirmed Entries

- memory_id: PATTERNS-001
  status: CONFIRMED
  suggested_last_verified_at: YYYY-MM-DD
  suggested_verified_against_story: E01S01
  note: Implementation of X is consistent with stated convention.

## Contradicted Entries

- memory_id: DEC-{N}
  status: CONTRADICTED
  severity: high | medium | low
  description: Memory states [X]. Implementation did [Y]. These are incompatible.
  action_required: Update or invalidate memory entry.

## New Knowledge Candidates

- candidate_id: CANDIDATE-001
  category: architecture | decisions | patterns | project | strategy | domains
  description: New retry pattern introduced in services/api/client.ts — not yet in memory.
  suggested_tags: [api, resilience, patterns]
  ingestion_priority: high | medium | low

Downstream consumer: memory-delta-triage (.gaai/core/skills/cross/memory-delta-triage/SKILL.md) processes these delta files to produce a governed triage verdict before Discovery invokes memory-ingest.


Verdict Logic

| Verdict | Condition |

|---|---|

| ALIGNED | No contradictions, no new knowledge candidates |

| DRIFT_DETECTED | One or more memory entries contradicted by the implementation |

| NEW_KNOWLEDGE_FOUND | New knowledge candidates identified, no contradictions |

| DRIFT_AND_NEW_KNOWLEDGE | Both contradictions and new knowledge candidates present |


Quality Checks


Non-Goals

This skill must NOT:


Closed Grandfather List (one-time legacy exemption)

The CI validator (validate-memory-deltas.sh, LEGACY_GRANDFATHERED array) exempts exactly 21 pre-canonical-schema delta files from the canonical-section-header check. These files predate the three canonical headers and use heterogeneous legacy formats with no single rename rule.

Policy (non-negotiable):

Authority: see project audit-intake for the originating finding and grandfathered basenames.

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.