RETRIEVAL.md — Memory Scan Protocol
Defines a five-step internal memory retrieval protocol that surfaces results only in LiveHud gauges, never as visible logs.
What this file does
Defines a five-step internal memory retrieval protocol that surfaces results only in LiveHud gauges, never as visible logs.
When to use it
- Building an AI agent that needs silent memory recall before output
- Implementing a relevance-scored memory selection with minimum and maximum file counts
- Adding a LiveHud dashboard that displays memory load and context summary
- Handling edge cases like empty memory folders or inaccessible storage
RETRIEVAL.md — Memory Scan Protocol
REQUIRED: Memory retrieval is internal. Results surface in LiveHud gauges, not as pre-output logs.
Memory Location
brain/memory/allmemories/
🚨 REQUIRED PROTOCOL STEPS (Internal)
All retrieval steps happen silently before LiveHud is printed.
Step 1: Scan Memory Index
List all files in brain/memory/allmemories/ to build memory index.
(No visible output — this is internal)
Step 2: Relevance Assessment
For each memory file, score relevance (0-100) based on:
| Factor | Weight |
|---|---|
| Topic match to current session context | 40% |
| Recency (newer = higher) | 25% |
| User correction flag | 20% |
| Project reference (active project match) | 15% |
Step 3: Selection
Select 5-35+ files for retrieval:
- Minimum 5 files for baseline context
- Maximum based on relevance threshold (score > 30)
- Always include files tagged as
[CRITICAL]or[USER_CORRECTION]
Step 4: Retrieval
Read selected files into working memory.
Step 5: Surface in LiveHud
Populate LiveHud gauges with retrieval results:
📂 Memory: X files loaded🧠 Past: [Key retrieved context summary]
⚠️ IMPORTANT: Do NOT output scan confirmation blocks before LiveHud. The results are reflected via the Memory Protocol section of LiveHud.
Edge Cases
| Scenario | Handling |
|---|---|
| No memory files exist | Skip retrieval, set 🧠 Past: Fresh session |
| Too many relevant files (>35) | Cap at 35, prioritize by score |
| Memory folder inaccessible | Set 📂 Memory: Inaccessible in LiveHud, proceed |
| No tool access | Set 📂 Memory: No tool access in LiveHud |
Remember to remember before you begin.
What's inside
5 protocol steps, 4 relevance factors with weights, 4 edge case scenarios
Change this for your project
- Replace
brain/memory/allmemories/with your own memory directory path - Replace
LiveHudwith your own output dashboard or display mechanism - Replace
📂 Memory: X files loadedand🧠 Past: [Key retrieved context summary]with your own gauge labels
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Related Documents
Data Retrieval
Downloads UK electricity generation and pricing data from Electric Insights and Energy Charts APIs using the moepy library, then visualises fuel-mix time-series.
Lesson 4: Information Retrieval
Guides building a Flask app that fetches Bitcoin exchange rates from multiple APIs, stores them in SQLite, and displays best rates and historical trends.
Retrieval
Fits linear and nonlinear ephemerides to exoplanet transit times using nested sampling, then compares Bayesian evidence to detect hidden planets.