agent-memory-design — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited agent-memory-design (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
When designing memory systems for AI agents, implementing context persistence across sessions, building knowledge retrieval mechanisms, or architecting memory consolidation pipelines. Use for any agent that needs to remember information beyond a single context window.
Core principle: Memory is retrieval, not storage — the value of a memory system is measured by: can the agent find the RIGHT information at the RIGHT time? Storage without retrieval is a graveyard.
Layer 1 — Working Memory (context window)
- Scope: current conversation turn
- Capacity: model context limit (8K-200K tokens)
- Persistence: none (gone when context resets)
- Access: immediate (already in context)
- Priority: highest — this is what the agent "sees"
Layer 2 — Short-Term Memory (session scratchpad)
- Scope: current session/task
- Capacity: 10-50 key facts
- Persistence: session duration
- Access: explicit retrieval (agent requests it)
- Format: JSONL scratchpad file
- Use for: intermediate results, task progress, recent user preferences
Layer 3 — Medium-Term Memory (project knowledge)
- Scope: current project/workspace
- Capacity: hundreds of entries
- Persistence: project lifetime
- Access: semantic search + key lookup
- Format: structured markdown files, JSON indexes
- Use for: architectural decisions, user patterns, project conventions
Layer 4 — Long-Term Memory (permanent knowledge)
- Scope: cross-project, cross-session
- Capacity: unbounded
- Persistence: permanent (with decay)
- Access: semantic similarity search + knowledge graph traversal
- Format: vector DB + knowledge graph
- Use for: learned patterns, user preferences, domain expertise Working Memory:
- Already in context — no retrieval needed
- Manage carefully: don't waste on retrievable facts
Short-Term Memory:
- Recency-weighted retrieval (most recent = most relevant)
- Key-based lookup: "what was the last error message?"
- Cleared at session end (or explicit flush)
Medium-Term Memory:
- Keyword + semantic hybrid search
- Structured queries: "what auth pattern does this project use?"
- Indexed by: topic, file path, date, relevance score
Long-Term Memory:
- Semantic similarity search (embedding-based)
- Knowledge graph traversal (entity → relationship → entity)
- Confidence-weighted (higher confidence = higher ranking)
- Decay-adjusted (older unreinforced memories rank lower) When agent needs information:
1. Check working memory (already in context?) → use it
2. Check short-term memory (recent session fact?) → retrieve and inject
3. Check medium-term memory (project knowledge?) → search and inject summary
4. Check long-term memory (learned pattern?) → search, verify relevance, inject
5. If not found anywhere → ask user or research from scratch Session ends → Consolidation triggers:
1. Extract key learnings from session:
- New facts learned (user preferences, project decisions)
- Patterns observed (what worked, what failed)
- Corrections received (mistakes to avoid next time)
2. Classify each learning:
- Short-term only (task-specific, won't matter next session) → discard
- Medium-term (project-relevant) → write to project memory
- Long-term (generalizable pattern) → write to permanent memory
3. Summarize, don't dump:
- Raw conversation → extract 5-10 key facts
- Include WHY something matters, not just WHAT happened
- Link to existing memories (reinforce or update)
4. Update indexes:
- Add new entries to search indexes
- Update confidence scores on existing memories
- Deprecate contradicted memoriesRules:
Each memory entry has a confidence score [0.0 - 1.0]:
Initial confidence:
- User explicitly stated: 1.0
- Inferred from behavior: 0.7
- Assumed from patterns: 0.5
Decay rules:
- Unreinforced memory: confidence -= 0.05 per week
- Reinforced memory (used successfully): confidence = min(1.0, confidence + 0.1)
- Contradicted memory: confidence = 0.0 (deprecated, kept for history)
- Below threshold (confidence < 0.2): excluded from retrieval results
Reinforcement triggers:
- Agent retrieves memory and uses it successfully
- User confirms a remembered fact
- Pattern matches current observation Short-term (JSONL scratchpad):
{"key": "last_error", "value": "TypeError at line 42", "ts": "...", "confidence": 1.0}
{"key": "user_intent", "value": "refactoring auth module", "ts": "...", "confidence": 0.9}
Medium-term (structured markdown):
## Project: MindForge
### Architecture Decisions
- Auth: JWT with refresh tokens (decided 2024-03-15, confidence: 1.0)
- Database: PostgreSQL with Prisma ORM (decided 2024-03-10, confidence: 1.0)
### User Preferences
- Prefers functional style over OOP (confidence: 0.8)
- Wants verbose error messages in dev (confidence: 0.9)
Long-term (vector DB + knowledge graph):
Entry: {id, embedding, content, source, timestamp, confidence, tags, relationships}
Graph: (pattern)--[applies_to]-->(domain)--[learned_from]-->(project) Context window is finite — manage it:
Priority for inclusion in working memory:
1. Current user message and task context (always)
2. Relevant retrieved memories (top-k by relevance)
3. System instructions and constraints (always)
4. Recent conversation history (sliding window)
If context is filling up:
- Summarize older conversation turns (don't drop, compress)
- Move detailed context to short-term memory (retrieve if needed)
- Keep only TOP-5 most relevant retrieved memories in context
- Never sacrifice system instructions for conversation historyBefore marking a task done when this skill was active:
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.