Agent skill
memory-retrieve
Load only the minimum relevant memory for a task using 3-level progressive disclosure. Activate before context-building — never load full memory dumps. Never substitute summaries for durable memory.
Install this agent skill to your Project
npx add-skill https://github.com/Fr-e-d/GAAI-framework/tree/main/.gaai/core/skills/cross/memory-retrieve
Metadata
Additional technical details for this skill
- id
- SKILL-MEMORY-RETRIEVE-001
- track
- cross-cutting
- author
- gaai-framework
- status
- stable
- version
- 2.2
- category
- cross
- updated at
- 1775347200
SKILL.md
Memory Retrieve
Purpose / When to Activate
Activate before context-building whenever a task requires historical context.
Never load full memory. Always filter by relevance. Never substitute summaries for durable memory (decisions, patterns, project).
3-Level Progressive Disclosure
Level 1 — INDEX SCAN (~5 tokens/entry)
Read index.md → Decision Registry table (DEC | Domain | Level | Title)
Agent identifies relevant decision(s) by domain and/or level
Level 2 — INDIVIDUAL ADR FILES (~300 tokens/file)
Load specific decisions/DEC-{ID}.md files for full entry text
Load other relevant category files (patterns, project, ops)
Optionally traverse `related_to` in loaded files to discover adjacent decisions
Or invoke `memory-search` Mode C for systematic cross-reference discovery
Level 3 — CROSS-DOMAIN SCAN (only for Decision Consistency Gate)
Grep frontmatter across all DEC-*.md files for conflicts
Only triggered when recording a new decision (see Decision Consistency Gate in decision-extraction skill)
Process
-
Read memory index (
contexts/memory/index.md). This contains:- Shared categories table (paths + purpose)
- Decision Registry: one row per DEC-ID with domain, level, and title
If
index.mdis absent or empty, fall back to scanningcontexts/memory/directory structure.
-
Identify relevant decisions for the current task:
- Filter the Decision Registry by domain (e.g.,
billing,matching) - Filter by level if scope is known (e.g., only
architecturalfor implementation tasks) - From story/epic tags or explicit instruction scope
- Filter the Decision Registry by domain (e.g.,
-
Load memory by durability class:
Durable memory (decisions, patterns, project, ops, contacts, domains): → Load individual
decisions/DEC-{ID}.mdfiles directly. Full text, never summaries. → Summaries exist as INDEX-ONLY aids — they list entries for scanning but MUST NOT substitute for the full decision text. → Load only the specific decisions relevant to the task (typically 3-10 files).Ephemeral memory (sessions): → Prefer summaries if available (lower token cost).
-
For Decision Consistency Gate: → Scan the Decision Registry in index.md for ALL entries in the relevant domain → Load the specific
DEC-{ID}.mdfiles to check for conflicts → If uncertain about boundaries, also load decisions from adjacent domains -
Freshness Check (Tier 2 files only)
Pre-condition: verify that
gitis available on the PATH (git --version). Ifgitis unavailable, append the following note to thefreshness_warningssection and skip the remainder of this step — proceed to Step 6 normally:Freshness check skipped: git not available
For each file in the
memory_context_bundle:a. If the file's frontmatter has no
refresh_tierfield, orrefresh_tier≠ 2 → skip (Tier 1 files are proactively refreshed via the post-delivery hook; Tier 3-4 are not checked at read time).b. If
depends_onis absent ordepends_on.code_pathsis empty → skip (treat as Tier 4 — no check, no warning).c. If
updated_atis absent or unparseable → append tofreshness_warnings:Freshness check skipped: no valid updated_at — {file_path} Then skip this file.
d. For each path in
depends_on.code_paths:- If the path does not exist on disk, append to
freshness_warnings:Freshness check skipped: {path} not found — depends_on may be stale Then skip this path.
- Run:
git log --oneline --since="{updated_at}" -- "{path}"(where{updated_at}is the file's frontmatter value, quoted exactly as-is). - Count the lines returned. If the count > 0, the file is
POTENTIALLY_STALEfor this path.
e. If any path produced a non-zero commit count for this file, append one
freshness_warningsentry per changed path in the format below (AC2):⚠ FRESHNESS WARNING — {file_path} refresh_tier: 2 updated_at: {date} changed_dependency: {code_path} ({N} commits since updated_at) action: verify content is still accurate before relying on itIf no warnings are produced, the
freshness_warningssection is omitted from the output (0 tokens). - If the path does not exist on disk, append to
-
Return
memory_context_bundle— curated, minimal set of memory files relevant to the current task, plus anyfreshness_warningsproduced in Step 5.
Output
memory_context_bundle — curated set of memory files relevant to the current task, ready for context-building.
Quality Checks
- No full memory injection
- Context is focused on the task
- Agent loads only the specific DEC-{ID}.md files relevant to the task (typically 3-10)
- Summaries are NEVER substituted for durable memory (decisions, patterns, project)
- Decision Registry enables decision identification WITHOUT opening individual files
- Token budget: index (~1,500) + 3-10 individual decision files (~300 each) = ~4,500 tokens typical;
freshness_warningssection adds ~100-200 tokens when Tier 2 staleness is detected, 0 tokens when all files are clean - Only memory directly relevant to the task is included
- Freshness warnings are emitted for Tier 2 files with changed code dependencies — never silently suppressed.
Non-Goals
This skill must NOT:
- Load all memory files
- Decide what to do with retrieved memory
- Modify memory files
- Substitute summary one-liners for full decision text
Selective retrieval via progressive disclosure. Memory is never auto-loaded. Durable memory is never summarized away.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
ci-watch-and-fix
Watch GitHub Actions CI after PR creation, detect failures, extract logs, apply minimal fixes, and re-push — keeping the delivery session alive until CI resolves or escalating after 3 cycles. Activate immediately after gh pr create and before marking the story done.
qa-review
Validate that implemented code fully satisfies Story acceptance criteria, respects rules, and introduces no regressions. This is the hard quality gate — no pass means no delivery. Activate after implementation is complete.
compose-team
Assemble the context bundles for each sub-agent based on evaluate-story output. Produces spawn-ready packages for Planning, Implementation, QA, or MicroDelivery sub-agents. Activate after evaluate-story, before spawning any sub-agent.
coordinate-handoffs
Validate sub-agent handoff artefacts, sequence phase transitions, and manage retry and escalation logic. Activate after each sub-agent terminates to determine next action.
implement
Generate correct, minimal, maintainable code that satisfies a validated Story's acceptance criteria against an execution plan. Activate when a Story is validated, a plan exists, and all prerequisites are unambiguous.
delivery-high-level-plan
Transform validated Stories into a clear, minimal, governed execution plan. Used by the Planning Sub-Agent as the first planning pass before prepare-execution-plan for Tier 2/3, or as the sole planning output for simple Stories.
Didn't find tool you were looking for?