GAAI-framework memory-delta-triage
Apply three deterministic heuristics to a single memory-delta file to produce a structured verdict block; invoke memory-ingest on ACCEPTED candidates only in validate mode. Activate when Discovery processes a raw memory-delta from contexts/artefacts/memory-deltas/.
git clone https://github.com/Fr-e-d/GAAI-framework
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-delta-triage" ~/.claude/skills/fr-e-d-gaai-framework-memory-delta-triage && rm -rf "$T"
.gaai/core/skills/cross/memory-delta-triage/SKILL.mdMemory Delta Triage
Purpose / When to Activate
Activate when Discovery holds a raw memory-delta file (produced by
memory-alignment-check
after QA PASS) and needs a governed, auditable verdict before deciding whether to invoke
memory-ingest.
This skill applies exactly three heuristics to each candidate in the delta. It produces a
## Triage Verdict block. All judgment is attributed to the invoking Discovery agent — this
skill is a deterministic procedure, not a decision maker.
Two modes:
-
— triage without writing memory. Writes the Triage Verdict block inline and leaves the delta file in its original location. Does NOT invokedraft
. Use when Discovery wants to review verdicts before committing.memory-ingest -
— triage with write authority. For every candidate withvalidate
, instructs Discovery to invokeverdict: ACCEPT
. After all ACCEPTED candidates are processed, moves the delta file tomemory-ingest
.contexts/artefacts/memory-deltas/processed/
Process
Step 0 — Single-delta scope check
Verify exactly one
delta_id argument is provided.
- If zero delta paths provided → exit immediately: "ERROR: memory-delta-triage requires exactly one delta_id. Received: 0."
- If multiple delta paths provided → exit immediately: "ERROR: memory-delta-triage requires exactly one delta_id. Received: N. Process deltas one at a time."
Step 0b — Processed-delta collision check (base.rules.md §6)
Check whether a file already exists at
contexts/artefacts/memory-deltas/processed/{delta_id}.memory-delta.md.
- If it exists → STOP. Emit: "ESCALATE: delta {delta_id} already exists in processed/. Re-processing a processed delta is forbidden (base.rules.md §6). Verify intent before proceeding."
- Do NOT continue.
Step 0c — Schema check
Read
contexts/artefacts/memory-deltas/{delta_id}.memory-delta.md.
Verify the file contains:
in YAML frontmatterartefact_type: memory-delta- At least one of the required structural sections:
,## Confirmed Entries
,## Contradicted Entries## New Knowledge Candidates
On FAIL (either check fails):
- Emit Triage Verdict block with
, all candidates set toschema_check: FAILverdict: ESCALATE - STOP — do not proceed to heuristics
On PASS: continue to Step 1.
Step 1 — Extract candidates
From the delta file, collect all items under
## New Knowledge Candidates and
## Contradicted Entries. Each item is a candidate for triage. Confirmed-only entries
with no contradiction and no new candidate are noted in the verdict as informational
but receive no heuristic evaluation.
Step 2 — Apply Heuristic 1: Invariant test
Reference:
contexts/rules/memory-architecture.rules.md §1 (Content Principle — refactor test).
For each candidate, apply the test literally as stated in that section:
"If the codebase is refactored tomorrow without changing the design intent, does this content still read correctly?"
Do NOT restate the rule content here. The rule file is the authoritative source.
- PASS → content is a conceptual invariant
- FAIL → content is a code snapshot; candidate is not suitable for memory ingestion
Step 3 — Apply Heuristic 2: Dedup vs index check
Reference:
contexts/memory/index.md (check for existing coverage) and
memory-ingest Anti-Collision Guard (.gaai/core/skills/cross/memory-ingest/SKILL.md,
Process section — Anti-Collision Guard paragraph).
For each candidate:
- Check
for entries whose category and tags match the candidatecontexts/memory/index.md - If a matching entry exists, read it and assess: same topic/entity → FAIL (duplicate); different topic/entity → PASS (new knowledge)
- If no matching entry exists → PASS
Do NOT restate the Anti-Collision Guard logic here. The skill file is the authoritative source.
- PASS → no duplicate detected
- FAIL → duplicate or collision risk; candidate requires escalation
Step 4 — Apply Heuristic 3: Scope test
Reference:
contexts/rules/memory-architecture.rules.md §1 "What does NOT belong".
For each candidate, verify it is a cross-module / durable concern and NOT story-specific transient state. Specifically:
- If the content would be stale after the story branch is merged → FAIL (story-specific)
- If the content applies only to the transient state of a single story → FAIL
- If the content is a cross-cutting invariant relevant beyond this story → PASS
Do NOT restate the rule content here. The rule file is the authoritative source.
- PASS → cross-module durable concern
- FAIL → story-specific; does not belong in long-term memory
Step 5 — Unanimity gate and verdict per candidate
For each candidate:
if and only if ALL THREE heuristics return PASSverdict: ACCEPT
if ANY heuristic returns FAIL (unanimity: MIXED)verdict: ESCALATE
This gate is hard-coded. No partial acceptance. No override.
Step 6 — Produce Triage Verdict block
Emit the block in the schema defined in the
## Triage Verdict Block Schema section below.
- In
mode: append the block inline to the response. Leave the delta file indraft
(do not move it).contexts/artefacts/memory-deltas/ - In
mode: append the block to the delta file, then proceed to Step 7.validate
Step 7 (validate mode only) — Invoke memory-ingest and move delta
For each candidate with
verdict: ACCEPT:
- Instruct Discovery to invoke
with the candidate content as input. The skill itself does NOT callmemory-ingest
directly — it issues an explicit instruction to the invoking Discovery agent, including the exact candidate content and the target memory category derived from the candidate metadata.memory-ingest
After all ACCEPTED candidates are processed by
memory-ingest (confirmed by Discovery):
- Move the delta file from
tocontexts/artefacts/memory-deltas/{delta_id}.memory-delta.mdcontexts/artefacts/memory-deltas/processed/{delta_id}.memory-delta.md
Triage Verdict Block Schema
## Triage Verdict triaged_by: "[agent identity — e.g. Discovery Agent, autonomous draft mode]" triaged_at: "YYYY-MM-DD" mode: draft | validate delta_id: "{delta_id}" schema_check: PASS | FAIL candidates: - candidate_id: "{CANDIDATE-NNN or memory_id}" verdict: ACCEPT | ESCALATE heuristic_1_invariant: PASS | FAIL heuristic_2_dedup: PASS | FAIL heuristic_3_scope: PASS | FAIL unanimity: ALL_PASS | MIXED rationale: "{one sentence — specific finding, not vague}" overall: ACCEPTED | ESCALATED | MIXED | SCHEMA_FAIL # validate mode only — added after memory-ingest is complete: validated_by: "[agent identity]" validated_at: "YYYY-MM-DD"
Field rules:
only when all three heuristics are PASS;unanimity: ALL_PASS
otherwiseMIXED
only whenverdict: ACCEPTunanimity: ALL_PASS
when all candidates are ACCEPToverall: ACCEPTED
when all candidates are ESCALATEoverall: ESCALATED
when at least one ACCEPT and at least one ESCALATEoverall: MIXED
when schema check failed (Step 0c)overall: SCHEMA_FAIL
andvalidated_by
are present ONLY invalidated_at
mode and only aftervalidate
has been invoked; absent inmemory-ingest
modedraft
Quality Checks
- Exactly one delta_id was provided — Step 0 enforces this
- Processed-delta collision was checked before any writes — Step 0b
- Schema check was performed and recorded in verdict block — Step 0c
- All three heuristics applied to every candidate — Steps 2–4
- Unanimity gate not bypassed — Step 5
- Verdict block matches schema above — Step 6
- In validate mode:
instruction is explicit (candidate content + target category) — Step 7memory-ingest - In validate mode: delta moved to
only after Discovery confirmsprocessed/
is complete — Step 7memory-ingest - All content in this file is OSS-generic — zero project names (per AC13)
Outputs
block (YAML) — inline in## Triage Verdict
mode; appended to delta file indraft
modevalidate- In
mode: explicitvalidate
instruction per ACCEPTED candidatememory-ingest - In
mode: delta file moved tovalidatecontexts/artefacts/memory-deltas/processed/{delta_id}.memory-delta.md
No memory is written by this skill. Memory is written only by
memory-ingest, invoked by
Discovery on explicit instruction from this skill in validate mode only.
Non-Goals
This skill must NOT:
- Invoke
directly inmemory-ingest
mode — in draft mode, the skill writes the verdict block and stops. Only Discovery may decide to invokedraft
, and only after the verdict is reviewed (AC8).memory-ingest - Process more than one delta at a time — single-delta scope is enforced at Step 0 (AC14).
- Perform architecture-file verify-before-update — that protocol is the responsibility of
(governed bymemory-ingest
§2). This skill evaluates suitability only; it does not verify code paths or populate attestation fields (AC15).contexts/rules/memory-architecture.rules.md - Make product or architectural decisions — it applies heuristics and returns verdicts. All judgment is attributed to the invoking Discovery agent.
- Write or update any memory file directly.
- Scan the full codebase or all memory files.
- Process memory-deltas that have already been processed (checked at Step 0b).