GAAI-framework memory-search
Search memory by frontmatter fields, full-text keywords, or cross-reference graph. Returns ranked file list — never loads full content. Use when the agent needs to find relevant memory without knowing exact paths.
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-search" ~/.claude/skills/fr-e-d-gaai-framework-memory-search && rm -rf "$T"
.gaai/core/skills/cross/memory-search/SKILL.mdMemory Search
Purpose / When to Activate
Activate when an agent needs to find relevant memory but does not know the exact file path, domain, or DEC ID.
This skill locates memory — it does not load it. After results are returned, the agent invokes
memory-retrieve to load the specific files.
Use cases:
- "Which decisions relate to database connection pooling?" → Mode A (frontmatter: domain=infrastructure, tags contains database)
- "Where did we discuss pool exhaustion?" → Mode B (full-text keyword: "pool exhaustion")
- "What decisions are related to DEC-42?" → Mode C (cross-reference: DEC-42 → related_to + mentions)
Process
Mode A — Frontmatter Search
Search YAML frontmatter fields across
decisions/DEC-*.md files.
- Accept query as field-value pairs:
and/or{domain: "infrastructure", level: "operational"}
and/or{tags: ["connection-pooling"]}
and/or{related_to: ["DEC-5"]}{status: "active"} - Grep frontmatter blocks (between
delimiters) of all---
filesdecisions/DEC-*.md - Match files where ALL specified fields match (AND logic)
- Extract
,id
, and matched field values from each hittitle - Rank by: exact tag match > domain match > level match
- Return top 10 results
Mode B — Content Search
Full-text keyword search across ALL memory files.
- Accept query as 1-3 keywords (e.g.,
,"pool exhaustion"
)"scoring formula" - Grep all files under
for keyword matchescontexts/memory/ - For each hit, extract:
(relative tofile_path
)contexts/memory/
from frontmatter (if present)id
from firsttitle
heading#
— the matching line ± 1 line of context (~50 tokens)excerpt
- Rank by: number of keyword matches > file recency (
)updated_at - Return top 10 results
- Never return more than ~2,000 tokens total
Mode C — Cross-Reference Search
For a given DEC ID, find all files that reference it + traverse
related_to (depth 1).
- Accept query as a single DEC ID (e.g.,
)DEC-42 - Direct mentions: grep all files under
for the literal stringcontexts/memory/DEC-42 - Frontmatter
: greprelated_to
lines inrelated_to:
for the target IDdecisions/DEC-*.md - Outbound relations: read the target file's own
field → list those DEC IDsrelated_to - Deduplicate and merge results into a single list
- For each result, extract:
,file_path
,id
,title
(direct_mention | related_to_inbound | related_to_outbound)relevance - Rank: related_to_inbound > related_to_outbound > direct_mention
- Return all results (typically <15 files)
Quality Checks
- Never loads full file content — only returns paths, IDs, titles, and short excerpts
- Total output stays under ~2,000 tokens
- Mode A searches frontmatter only (fast, structured)
- Mode B searches content (slower, broader — use sparingly)
- Mode C is bounded to depth 1 (no recursive graph traversal)
- Results are always ranked by relevance
- Never modifies any file
Outputs
— ranked list of memory file references:search_results
- file_path: decisions/DEC-42.md id: DEC-42 title: "Use connection pooling for database access" relevance: related_to_inbound # or: frontmatter_match | content_match | direct_mention | related_to_outbound excerpt: "prevents connection exhaustion under load" # ~50 tokens max, absent in Mode A
Agent receives this list and decides which files to load via
memory-retrieve.
Non-Goals
This skill must NOT:
- Load full file contents (that is
)memory-retrieve - Modify any memory files (that is
)memory-ingest - Make decisions about which results to act on (that is the agent's job)
- Perform recursive graph traversal beyond depth 1
- Search outside
contexts/memory/
Memory-search finds. Memory-retrieve loads. The agent decides.