agentleFS
patonkikhpatonkikh/APES/skills/ai/agent-memory-designer/skill.md

agent-memory-designer

Skill3 starsChanged 4 months agoMITView on GitHub

Design agent memory architecture: short-term context, long-term vector store, episodic logs, and retention policies with privacy controls. Use when building persistent agents, chatbots with memory, or multi-session AI assistants.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Document read/write latency and cost per tier.

    line 46
  2. Distinctive:

    Start with session + explicit user profile.

    line 128
  3. Distinctive:

    Run memory hygiene audits monthly.

    line 130

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

Agent Memory Designer

Purpose

Design agent memory architecture: what to remember, where to store it, how to retrieve it, and when to forget — with privacy and cost controls.

Input: Agent use case, session patterns, data sensitivity, latency/cost budget
Output: Memory Architecture document with tiers, schemas, retrieval flows, and hygiene rules
Examples: See examples.md for worked input/output.


Workflow

Step 1: Classify memory needs

Memory typeScopeTypical TTLExample
WorkingCurrent turn / taskMinutesTool results in context
SessionSingle conversationHoursUser preferences stated today
EpisodicPast interactionsDays–months"User fixed bug X last week"
SemanticFacts about user/domainLong-termProfile, project context
ProceduralHow agent should behaveVersionedLearned corrections

Map each user story to required memory types.

Step 2: Choose storage tiers

TierTechnology patternWhen to use
Context windowIn-prompt assemblyHot working memory
Key-value / session storeRedis, DynamoDBFast session state
Vector storepgvector, Pinecone, LanceDBSemantic recall
Document storePostgres JSONBStructured user profiles
Append-only logEvent streamAudit and episodic replay

Document read/write latency and cost per tier.

Step 3: Design write path

Define what gets written after each agent turn:

  • Extract — entities, decisions, user corrections, task outcomes
  • Summarize — compress verbose turns into durable facts
  • Dedupe — merge with existing memories (same key → update, not duplicate)
  • Score — importance / confidence before persistence

Include triggers: user correction always writes; routine chit-chat may not.

Step 4: Design read path (recall)

Query → Intent classifier → Retrieve from tiers → Rank → Budget trim → Inject into context
Recall strategyUse when
Similarity searchOpen-ended "what did we discuss about X?"
Key lookupKnown profile fields
Recency-weightedSession continuity
HybridProduction agents (default)

Set top-k, similarity threshold, and max tokens injected.

Step 5: Define hygiene and governance

PolicyRule
RetentionTTL per memory class
DeletionUser request, account close, GDPR erasure
PIINever store secrets; redact before write
StalenessRe-validate facts older than N days
CompactionWeekly summarize episodic → semantic

Step 6: Validate

Run Validation checklist.


Decision Rules

ConditionAction
High-sensitivity data (health, finance)Stop; require encryption at rest + minimal retention
No user identitySession-only memory; no cross-session semantic store
Memory bloat / high recall costAdd compaction job and relevance threshold
User says "forget that"Delete matching memories + confirm
Multi-agent systemShared memory bus with namespace per agent
Contradictory memoriesPrefer newest high-confidence; flag for user

Validation

  • Memory types mapped to user stories
  • Storage tier per type with TTL documented
  • Write path: extract, summarize, dedupe rules defined
  • Read path: retrieval strategy and token budget set
  • PII and secrets exclusion enforced at write
  • User deletion and retention policies specified
  • Cost estimate per 1k sessions (storage + embedding + recall)
  • Failure mode: empty recall falls back gracefully

Anti-patterns

  • Remember everything — unbounded logs inflate cost and inject noise.
  • Vector-only memory — losing structured keys makes profile lookup unreliable.
  • No TTL — stale facts poison agent behavior months later.
  • Recall without ranking — dumping top-20 chunks floods context.
  • Cross-user leakage — missing tenant isolation in shared vector index.

Best Practices

  • Start with session + explicit user profile; add episodic memory when needed.
  • Store memories as atomic facts with source turn ID and timestamp.
  • Run memory hygiene audits monthly; prune low-relevance episodic entries.
  • Pair with context-engineering for assembly order and budget.
  • Log recall hits/misses for tuning thresholds.

Output Structure

# Memory Architecture: [Agent Name]

## Requirements
| Story | Memory types needed |
|-------|---------------------|

## Storage Tiers
| Type | Store | TTL | Est. cost |
|------|-------|-----|-----------|

## Write Pipeline
[Extract → Summarize → Dedupe → Persist]

## Read Pipeline
[Query → Retrieve → Rank → Inject]

## Schemas
[Memory record JSON examples]

## Hygiene Policies
| Policy | Rule |
|--------|------|

## Security
[PII, encryption, tenant isolation]

Next Skills

OutcomeRecommended Skill
Assemble recalled contextai/context-engineering
Multi-agent shared memoryai/multi-agent-planner
Privacy / compliance reviewsecurity/ai-governance-advisor
Evaluate memory impact on qualityai/ai-evaluation-builder
RAG corpus vs agent memory boundaryrag/rag-architecture-designer

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.