You forget โ€” AgentMem remembers. ๐Ÿง 

Simple memory API for AI agents. Pay with USDC or Stripe.
30 seconds to first API call. No signup, no friction.

โœจ NEW Pay with USDC on Base. No signup, no API key. Learn more โ†“

30 seconds to first API call โ€” that's 60x faster than self-hosted solutions. No Docker. No git. No OpenAI keys. Just curl and go.

๐Ÿ’ก Token-efficient by design: Fetch summaries first, full content on demand. Save 65,000+ tokens/day vs loading everything into context.
๐ŸŽ Store 10,000 keys FREE
No credit card. No catch. Just email โ†’ API key โ†’ start storing.
Worth $50/mo elsewhere. Yours free forever.
โœ… Never expires โœ… No usage limits โœ… Upgrade anytime
๐Ÿš€ Get Your Free API Key (10,000 credits)
โœ… No credit card โ€ข โœ… 30 seconds to first API call
Enter your email โ†’ API key sent instantly โ†’ Start storing
or try the playground first (no signup)
Why AgentMem? At a Glance
โœ…
30-second setup
No Docker, no config, just PUT your data
โœ…
Pay as you go
$0.01/10k ops, USDC or card
โœ…
Cloud-native
Works from any device, any language
โœ…
Fast & reliable
Avg 107ms latency, 99.9% uptime
โœ…
No lock-in
Standard HTTP API, export anytime
โœ…
Simple API
Three endpoints: PUT, GET, DELETE. That's it.
๐Ÿ’ก Memory that works everywhere your agent does โ€” not just on one machine
โšก Performance You Can Trust
<50ms
p95 latency
20ms median
99.9%
uptime SLA
Powered by Cloudflare Workers
Unlimited
reads/writes
No rate limits
๐Ÿ“Š Measured, not claimed โ€” real-world performance from production traffic
๐Ÿง  Memory Types: What Goes Where?
๐Ÿ“… Episodic Memory (What Happened)
Time-based event logs. Answers: "What did I do last Tuesday?"
Key pattern: events/{date}/{id}
Example: PUT events/2026-02-05/launched-feature
๐Ÿงฉ Semantic Memory (What I Know)
Facts, concepts, knowledge. Answers: "What do I know about X?"
Key pattern: knowledge/{topic}
Example: PUT knowledge/stripe-validation
๐Ÿ”ง Procedural Memory (How To)
Workflows, patterns, processes. Answers: "How do I launch a skill?"
Key pattern: procedures/{name}
Example: PUT procedures/deployment-checklist
๐Ÿ’ก Research shows: Knowledge graphs beat flat vector retrieval by 18.5% (Zep team findings)
๐Ÿ—๏ธ Hybrid Architecture Pattern
AgentMem is a cloud persistence layer, not a complete memory solution.
๐Ÿ’พ Local Memory (OpenClaw, LanceDB, ChromaDB)
Fast session context. Loads in <20ms. Perfect for conversation history, active tasks, recent decisions.
Use for: Last 100 messages, current session state, working memory
โ˜๏ธ AgentMem (Cloud Persistence Layer)
Durable cross-device facts. Survives sessions. Accessible from any device, any agent in your system.
Use for: User preferences, learned facts, long-term decisions, multi-agent shared context
๐Ÿ“ File System (MEMORY.md, daily logs)
Human-readable workspace documents. Great for curated notes, project knowledge, team wikis.
Use for: Curated memory summaries, project docs, AGENTS.md playbooks
๐ŸŽฏ AgentMem handles what persists BETWEEN sessions and ACROSS devices.
๐Ÿ›ก๏ธ Resilience You Can Trust
Systems fail. AgentMem handles it gracefully.
โœ… 99.9% Uptime SLA
Powered by Cloudflare Workers (global edge network). Your agent's memory is closer than you think.
โšก Automatic Retry with Exponential Backoff
Transient errors? Your client retries automatically. No manual intervention needed.
๐Ÿ”„ Graceful Degradation
If AgentMem is unavailable, your agent continues with local memory. Warns user, doesn't crash.
try {
  await agentmem.get("user:prefs:timezone");
} catch (err) {
  console.warn("AgentMem unavailable, using local cache");
  return localMemory.get("timezone");
}
๐Ÿ’ก Resilience > uptime. Plan for failure, not just success.
๐Ÿ” Search Options (Coming Soon)
Two search tiers. Start simple, scale when needed.
โšก Full-Text Search (Default)
Fast: <50ms average ยท Simple: keyword matching + importance ranking ยท Cost: Free (included in base tier)
Use case: "Find all keys mentioning 'timezone preferences'"
Endpoint: GET /v1/search?q=timezone&importance=high
๐Ÿง  Semantic Search (Premium)
Powerful: understands intent, not just keywords ยท Use case: "Find memories related to X" (fuzzy matching) ยท Cost: $0.01 per search (embedding costs)
Use case: "Find memories about user frustration with checkout" โ†’ matches "unhappy", "confused", "payment failed"
Endpoint: GET /v1/semantic?q=user+frustration+checkout
๐Ÿ’ก Most users need full-text. Start there. Add semantic when you outgrow keywords.
๐Ÿ› ๏ธ CLI Wrapper (DX Improvement)
curl is powerful but verbose. Wrapper scripts = better DX.
# Install wrapper (bash script)
curl -sS https://api.agentmem.io/cli.sh > ~/.local/bin/agentmem
chmod +x ~/.local/bin/agentmem

# Usage examples
agentmem set user:prefs:timezone "America/New_York"
agentmem get user:prefs:timezone
agentmem list user:prefs:*
agentmem delete events:2024-*

# Behind the scenes: just curl
# agentmem set key value โ†’ curl -X PUT -H "Authorization: Bearer $AGENTMEM_API_KEY" -d "value" https://api.agentmem.io/v1/key
๐ŸŽฏ Coming soon. Same API, friendlier UX.
๐Ÿ“ How It Works
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Your Agent   โ”‚
โ”‚ (Any language)โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚ HTTP PUT/GET/DELETE
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ AgentMem API โ”‚  โ† 107ms avg latency
โ”‚ (Cloudflare) โ”‚  โ† 99.9% uptime
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚ Store/Retrieve
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Cloudflare KVโ”‚  โ† Global edge network
โ”‚ (Your data)  โ”‚  โ† Encrypted at rest
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
      
๐Ÿ”’ Your API key = your namespace โ€” Nobody else can read your data
๐Ÿค” Why AgentMem vs Local Memory?
โœ… AgentMem (Cloud)
  • โšก 30-second setup
  • ๐ŸŒ Works on all devices
  • ๐Ÿ’ฐ $0.01/10k ops
  • ๐Ÿ”ง Zero dependencies
  • ๐Ÿ“ฆ No Docker/Ollama/Redis
  • ๐Ÿ”„ Cross-device sync built-in
  • ๐Ÿš€ 99.9% uptime (Cloudflare)
โŒ Local Memory (Self-Hosted)
  • ๐Ÿ• 15-minute config
  • ๐Ÿ’ป Single machine only
  • ๐Ÿ’ธ EC2/VPS bills ($10-50/mo)
  • ๐Ÿ Python + Redis + Ollama
  • ๐Ÿณ Docker Compose setup
  • ๐Ÿ”Œ Sync = custom webhooks
  • โš™๏ธ You manage uptime
๐ŸŽฏ The AgentMem Philosophy
Cloud is truth, local cache is convenience.
Your agent should work from your laptop, your phone, and your VPS โ€” not just one machine.
We compete on zero friction, not privacy paranoia.
๐Ÿ’ก Privacy tip: Encrypt sensitive values before storing (we can't decrypt without your key)
๐Ÿงผ Memory Hygiene: What to Store vs Skip
โœ… Store This
  • โœ“ User preferences ("dark mode", "timezone")
  • โœ“ Decisions ("we chose Postgres")
  • โœ“ Important facts ("API key rotated")
  • โœ“ Procedures ("how to deploy")
  • โœ“ Lessons learned ("OAuth2 gotcha")
  • โœ“ Entity relationships ("Alice works on X")
โŒ Skip This
  • โœ— Transient state ("API returned 404")
  • โœ— Thinking-out-loud ("Let me check...")
  • โœ— Raw debug output
  • โœ— Duplicate facts
  • โœ— Obvious information
  • โœ— Unverified web content
๐Ÿ’ก Pro Tip: Importance Levels
Use custom headers to mark priority:
X-AgentMem-Importance: high (critical decisions, urgent facts)
X-AgentMem-Importance: medium (preferences, lessons)
X-AgentMem-Importance: low (background context)
๐Ÿ“– Agent Playbook: Rules for Memory
โœ… DO
  • โœ“ Load context on session start
    Read yesterday's decisions + user preferences
  • โœ“ Flush before session ends
    Save important context before compaction
  • โœ“ Use namespaces
    projects/, users/, config/ for organization
  • โœ“ Version critical data
    config/v2, config/v3 when schema evolves
โŒ DON'T
  • โœ— Store secrets plaintext
    Encrypt before PUT (we can't decrypt for you)
  • โœ— Use GET in loops
    Batch with /v1/keys?prefix= instead
  • โœ— Store huge blobs
    25MB limit โ€” summarize large documents first
  • โœ— Trust external content immediately
    Verify web_search results before storing
๐Ÿ’ก Session lifecycle tip: Read on startup, write on decisions, flush on shutdown
โš™๏ธ Tuning Guide: Optimize for Your Use Case
๐Ÿš€ High-Frequency Trading Bot (10k+ ops/min)
Strategy: Cache frequently accessed keys locally, batch writes
Pattern: Read config/strategy on startup โ†’ cache in RAM โ†’ flush aggregated metrics every 60s
Cost: ~$1/month @ 2.6M ops (2M cached reads, 600k writes)
๐Ÿ’ฌ Customer Support Agent (100 ops/day)
Strategy: Store user preferences + conversation history
Pattern: GET users/{id}/preferences on chat start โ†’ PUT conversation summary on close
Cost: ~$0.03/month @ 3k ops (2 ops/conversation ร— 50/day ร— 30 days)
๐Ÿ› ๏ธ DevOps Agent (1k ops/day)
Strategy: Store procedures + infrastructure state
Pattern: GET procedures/{task} for step-by-step guides โ†’ PUT infrastructure/{service}/status on changes
Cost: ~$0.30/month @ 30k ops
๐Ÿ’ก Cost optimization: Cached reads are free. Only API calls count toward usage.
โš ๏ธ Demo Mode: This uses a shared namespace. Don't store real data. Get your own API key โ†‘
๐ŸŽฎ Live Playground โ€” no signup required
// Results will appear here // This uses a shared demo namespace โ€” your data may be overwritten

๐Ÿ’ก This is a real API call. Connect wallet or get API key for your own namespace.

Mental Model: Cloud Truth vs Local Cache

Understand how AgentMem fits into your agent's memory architecture

๐Ÿง 
Layer 1: Session RAM (Context Window)
Temporary ยท Fast ยท Limited ยท Gone on restart
Your agent's working memory. Conversation history, current task state, loaded files. Lasts one session.
โš ๏ธ Warning: This gets wiped when you restart, context window fills, or session ends.
๐Ÿ“
Layer 2: Daily Logs (Local Files)
Persistent ยท Device-local ยท Manual search ยท `memory/YYYY-MM-DD.md`
Raw session logs. Everything that happened today. Survives restarts but only on this device.
โš ๏ธ Gotcha: If you switch devices, you lose this context. No semantic search.
โ˜๏ธ
Layer 3: AgentMem (Cloud Truth)
Permanent ยท Multi-device ยท Semantic search (coming soon)
Curated knowledge that spans sessions and devices. This is your source of truth. Facts, preferences, decisions, gotchas.
โœ… Rule: If it would still be true next week on a different device, store it in AgentMem.
๐Ÿ“– How Agents Use This
1.
On session start: Fetch core context from AgentMem (GET /v1/bootstrap)
2.
During work: Keep task state in RAM (fast), write raw logs to daily files (backup)
3.
On learning something: Store durable facts to AgentMem (PUT user/preferences/tone)
4.
When something changes: Update the cloud truth (PUT config/active-project)
๐Ÿ’ก Philosophy
"Cloud is truth. Local cache is convenience. Zero friction between them."
Your agent should work seamlessly across devices. AgentMem makes that possible without forcing you to migrate everything. Use local files for raw logs, use AgentMem for knowledge that matters.

What to Store (By Type)

AgentMem is for context that spans sessions. Use these types to organize your memory.

Type Icon Examples When to Use
fact ๐Ÿ“Œ API endpoint changed, server IP, user's email Durable truths that don't change often
decision ๐ŸŸค Use Redis for cache, Cloudflare Pages for hosting Architecture choices, strategic decisions
preference ๐Ÿ’š Prefer TypeScript, use tabs not spaces, email format User settings, style choices, defaults
policy ๐Ÿšจ Never store passwords, always ask before delete Critical rules, security constraints
gotcha ๐Ÿ”ด CLI auth broken use browser, API timeout is 30s Pitfalls, bugs, workarounds to remember
โœ… Store This
  • โ†’ ๐Ÿ’š User preferences
    e.g. "I prefer TypeScript over JavaScript"
  • โ†’ ๐Ÿ“Œ Ongoing context
    e.g. "Currently launching AgentMem v1.0"
  • โ†’ ๐ŸŸค Decisions made
    e.g. "Use Cloudflare Pages for hosting"
  • โ†’ ๐Ÿ“Œ Entity tracking
    e.g. Names, accounts, project IDs, API tokens
  • โ†’ ๐Ÿšจ Facts worth remembering
    e.g. "Email is [email protected]"
โŒ Skip This
  • ร— Temporary state
    e.g. "API request loading..." (session-only)
  • ร— Secrets & credentials
    Use environment variables instead
  • ร— Large blobs
    Images, videos โ†’ use object storage (S3/R2)
  • ร— High-frequency counters
    e.g. Real-time analytics โ†’ use Redis/ClickHouse
  • ร— Full conversation logs
    Use vector search for RAG instead
๐Ÿ’ก Rule of Thumb
If it needs to survive a restart โ†’ AgentMem
If it's session-only โ†’ Context window
If it's structured analytics โ†’ Database

Mental Model: Where Memory Lives

Understanding the difference prevents confusion.

๐Ÿ’ฌ
Session Memory
Lives in the conversation.
Automatically compacted.
Never reliable long-term.
Think: Short-term working memory
TRUTH
๐Ÿง 
AgentMem
Lives in the cloud.
Persistent across sessions.
Source of truth.
Think: Long-term memory storage
๐Ÿ“
Local Files
Lives on disk.
Great for one device.
No cross-device sync.
Think: Local notebook
๐ŸŽฏ Key Insight
Cloud is truth, local is cache.
AgentMem competes on zero friction + multi-device access, not privacy paranoia.

Agent Playbook

Rules for AI agents using AgentMem.

โœ… Do This
  • โ†’ Store decisions explicitly
    Don't assume memory sticks โ€” write it
  • โ†’ Use consistent key structure
    e.g. user:123:preference:timezone
  • โ†’ Check memory before asking
    Search first, then ask user if not found
  • โ†’ Store facts, not speculation
    Only write confirmed information
โŒ Don't Do This
  • ร— Copy chat transcripts
    Store context, not raw messages
  • ร— Store secrets/passwords
    Use environment variables instead
  • ร— Overwrite without checking
    GET first, then update if needed
  • ร— Store temporary state
    Loading indicators belong in session

๐Ÿ—๏ธ How AgentMem Works

Simple cloud-native architecture. No databases, no queues, just fast KV storage.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         AGENTMEM FLOW                            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                  โ”‚
โ”‚  1. Agent Request                                                โ”‚
โ”‚     โ†“                                                            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                             โ”‚
โ”‚  โ”‚  PUT /v1/keys/  โ”‚  โ† Atomic write                            โ”‚
โ”‚  โ”‚  GET /v1/keys/  โ”‚  โ† Fast read                               โ”‚
โ”‚  โ”‚  DELETE         โ”‚  โ† Instant delete                          โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                             โ”‚
โ”‚           โ”‚                                                      โ”‚
โ”‚           โ–ผ                                                      โ”‚
โ”‚  2. Cloudflare Workers Edge                                      โ”‚
โ”‚     โ†“                                                            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                             โ”‚
โ”‚  โ”‚ Auth + Validate โ”‚  โ† API key check                           โ”‚
โ”‚  โ”‚ Rate Limiting   โ”‚  โ† DDoS protection                         โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                             โ”‚
โ”‚           โ”‚                                                      โ”‚
โ”‚           โ–ผ                                                      โ”‚
โ”‚  3. R2 Object Storage (Durable)                                  โ”‚
โ”‚     โ†“                                                            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                             โ”‚
โ”‚  โ”‚ {namespace}/    โ”‚  โ† Isolated per agent                      โ”‚
โ”‚  โ”‚   {key}         โ”‚  โ† Your data                               โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                             โ”‚
โ”‚           โ”‚                                                      โ”‚
โ”‚           โ–ผ                                                      โ”‚
โ”‚  4. Response (<50ms p95)                                         โ”‚
โ”‚     โ†“                                                            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                             โ”‚
โ”‚  โ”‚ 200 OK + value  โ”‚  โ† Success                                 โ”‚
โ”‚  โ”‚ or              โ”‚                                             โ”‚
โ”‚  โ”‚ 404 Not Found   โ”‚  โ† Key doesn't exist                       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                             โ”‚
โ”‚                                                                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Why this architecture?
โœ… No database overhead โ†’ Sub-50ms latency
โœ… R2 eventual consistency โ†’ 99.9% uptime
โœ… Edge compute โ†’ Global low latency
โœ… Namespace isolation โ†’ Multi-agent safe
      

๐Ÿ›ก๏ธ Durability & Reliability

Your memory is too important to lose. Here's how we protect it.

โšก

Atomic Writes

Every PUT is atomic. Either the write succeeds completely, or it fails. No partial updates, no corruption.

๐Ÿ”’

R2 Consistency

Cloudflare R2 eventual consistency guarantees your data persists across multiple datacenters. Strong read-after-write consistency.

๐Ÿ“Š

99.9% Uptime

Backed by Cloudflare's global network. No single point of failure. Automatic failover across regions.

๐Ÿ’ก Best Practice: Write-Ahead Log (WAL)

For critical context, write to AgentMem BEFORE responding to the user.

// โŒ Wrong: respond first, write later (might crash before saving)
await respondToUser("Got it!");
await agentmem.put("user_preference", "dark_mode");

// โœ… Right: write first, then respond
await agentmem.put("user_preference", "dark_mode");
await respondToUser("Got it โ€” saved your preference!");

Inspired by elite-longterm-memory's WAL protocol.

๐ŸŽฏ Use Case Examples

See exactly how to use AgentMem for common scenarios.

๐Ÿ“ˆ Trading Bot

Track portfolio state, risk limits, and recent trades across sessions.

# Store risk limit
curl -X PUT https://api.agentmem.io/v1/keys/risk_limit \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "max_position_5_percent"

# Log trade
curl -X PUT https://api.agentmem.io/v1/keys/trades/$(date +%s) \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "BUY 100 AAPL @ 150.25"

# Retrieve risk limit before trading
RISK=$(curl -s https://api.agentmem.io/v1/keys/risk_limit \
  -H "Authorization: Bearer YOUR_API_KEY")

๐Ÿ’ฌ Support Agent

Remember customer preferences, issue history, and resolution notes.

# Store customer preference
curl -X PUT https://api.agentmem.io/v1/keys/customer/alice/preferences \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "prefers_email_over_phone"

# Log issue resolution
curl -X PUT https://api.agentmem.io/v1/keys/tickets/12345/resolution \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "Reset password + enabled 2FA"

# Bulk retrieve customer context
curl https://api.agentmem.io/v1/keys?prefix=customer/alice/ \
  -H "Authorization: Bearer YOUR_API_KEY"

โš™๏ธ DevOps Agent

Track deployment state, config hashes, and incident notes.

# Store deployment hash
curl -X PUT https://api.agentmem.io/v1/keys/prod/deploy_hash \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "abc123def456"

# Log incident
curl -X PUT https://api.agentmem.io/v1/keys/incidents/$(date +%Y-%m-%d-%H%M) \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "CPU spike 90% resolved by scaling workers"

# Check last deploy before rollback
HASH=$(curl -s https://api.agentmem.io/v1/keys/prod/deploy_hash \
  -H "Authorization: Bearer YOUR_API_KEY")

๐Ÿค– Personal Assistant

Remember user preferences, habits, and important dates.

# Store preference
curl -X PUT https://api.agentmem.io/v1/keys/preferences/communication \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "direct_no_fluff"

# Store important date
curl -X PUT https://api.agentmem.io/v1/keys/dates/anniversary \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "2024-06-15"

# Retrieve all preferences on session start
curl https://api.agentmem.io/v1/keys?prefix=preferences/ \
  -H "Authorization: Bearer YOUR_API_KEY"

๐Ÿ”„ Session Lifecycle

When to use AgentMem during a conversation.

๐ŸŸข On Session Start

  1. Load user preferences: GET /v1/keys?prefix=preferences/
  2. Check for pending tasks: GET /v1/keys?prefix=tasks/pending/
  3. Retrieve recent context: GET /v1/keys/session/last_state

๐Ÿ’ฌ During Conversation

User says Action
Preference expressed PUT preferences/{topic}
Decision made PUT decisions/{date}/{id}
Task created PUT tasks/pending/{id}
Context changed PUT session/current_context

๐Ÿ”ด On Session End

  1. Save final state: PUT session/last_state
  2. Mark completed tasks: DELETE tasks/pending/{id}
  3. Archive important decisions to long-term: PUT archive/{date}

โš ๏ธ Common Pitfalls

Avoid these mistakes when designing your memory keys.

โŒ Flat key namespace

user_pref_1
user_pref_2
task_1
task_2

Problem: Can't bulk retrieve related keys.

โœ… Hierarchical prefixes

preferences/communication
preferences/ui_theme
tasks/pending/deploy
tasks/completed/bugfix

Benefit: GET /v1/keys?prefix=preferences/ returns all preferences.

โŒ Storing large blobs

PUT /v1/keys/full_transcript
Value: [10,000 lines of chat history]

Problem: High latency, expensive storage.

โœ… Store distilled summaries

PUT /v1/keys/session_summary
Value: "Discussed API design, decided on REST, implemented /users endpoint"

Benefit: Fast retrieval, low cost, easier to search.

โŒ No cleanup strategy

Problem: Keys accumulate forever, bloating namespace and costs.

โœ… Regular pruning

# Weekly cleanup of old tasks
curl https://api.agentmem.io/v1/keys?prefix=tasks/completed/ \
  -H "Authorization: Bearer YOUR_API_KEY" | \
  jq -r '.keys[] | select(.lastModified < '$(date -d '30 days ago' +%s)') | .key' | \
  xargs -I {} curl -X DELETE https://api.agentmem.io/v1/keys/{} \
    -H "Authorization: Bearer YOUR_API_KEY"

Benefit: Keep memory lean, reduce costs, faster scans.

๐ŸŽฏ Trigger Words

When your agent hears these, it should automatically use AgentMem.

User Says Action
"Remember this" PUT /v1/keys/{key} immediately
"Don't forget" PUT /v1/keys/{key} with reminder note
"I always..." / "I never..." Store as preference/{topic}
"I prefer..." / "I like..." Store as preference/{topic}
"Save this for later" Store with timestamp in key
"Remind me..." Store with future trigger in value
๐Ÿ’ก Pro Tip
Train your agent to recognize these phrases and automatically store without asking. Reduces cognitive load.

๐Ÿš€ Session Start Routine

What your agent should do when it wakes up.

1
Bootstrap Identity Context
Load who you are, who you're talking to, and what you're currently working on.
curl https://api.agentmem.io/v1/bootstrap \
  -H "Authorization: Bearer $API_KEY"
2
Load User Preferences
Retrieve all stored preferences to personalize the experience.
curl "https://api.agentmem.io/v1/keys?prefix=preference/" \
  -H "Authorization: Bearer $API_KEY"
3
Check Recent Context
Look for anything marked as "active" or "current" to continue where you left off.
curl "https://api.agentmem.io/v1/keys?prefix=session/active/" \
  -H "Authorization: Bearer $API_KEY"
โšก Optimization Tip
Parallel requests save time. Use Promise.all() to fetch all three in parallel instead of sequentially.

๐Ÿ”’ Durability & Persistence

Your data is safe. Here's how we guarantee it.

โš›๏ธ
Atomic Writes
All writes either succeed completely or fail completely. No partial writes, no corruption risk. Data is persisted to disk before returning success.
๐Ÿ”„
Read-After-Write Consistency
You always see your latest write. No stale reads, no eventual consistency surprises. What you write is what you get.
๐Ÿ’พ
Automatic Backups
Backups every 6 hours. 30-day retention for all deleted keys. Point-in-time recovery available on request.
โ˜๏ธ
Cloudflare Durable Objects
Built on Cloudflare's strongly consistent distributed primitives. Data automatically replicated across multiple data centers for fault tolerance.
๐Ÿ›ก๏ธ Zero Data Loss Guarantee
If a PUT returns 200 OK, your data is durable and persistent. Period.

๐Ÿ› ๏ธ Helper Scripts

Convenience wrappers for common operations.

~/.bashrc or ~/.zshrc
# AgentMem convenience functions
export AGENTMEM_API_KEY="your-key-here"

amem-put() {
  curl -s -X PUT "https://api.agentmem.io/v1/keys/$1" \
    -H "Authorization: Bearer $AGENTMEM_API_KEY" \
    -H "Content-Type: text/plain" \
    -d "$2" | jq
}

amem-get() {
  curl -s "https://api.agentmem.io/v1/keys/$1" \
    -H "Authorization: Bearer $AGENTMEM_API_KEY"
}

amem-search() {
  curl -s "https://api.agentmem.io/v1/keys?prefix=$1" \
    -H "Authorization: Bearer $AGENTMEM_API_KEY" \
    | jq -r '.[]'
}

amem-delete() {
  curl -s -X DELETE "https://api.agentmem.io/v1/keys/$1" \
    -H "Authorization: Bearer $AGENTMEM_API_KEY" | jq
}
Usage Examples:
# Store a preference
amem-put "user/preference/theme" "dark"

# Retrieve it
amem-get "user/preference/theme"

# Search all preferences
amem-search "user/preference/"

# Delete a key
amem-delete "user/temp/session-123"
๐Ÿ“ Pro Tip
These are shell functions, not scripts. They run in your current shell, so you can export variables and use pipes seamlessly.

Token Efficiency

Store once, recall many times. Tokens add up fast.

โŒ Without AgentMem
Every session, agent re-learns user preferences, project context, decisions made.

20 API calls/day ร— 500 tokens context = 10,000 tokens/day
Cost: ~$0.15/day (o1-mini)
User frustration: High (keeps forgetting)
โœ… With AgentMem
Store context once. Recall only when needed. Average 50 tokens per GET.

20 API calls/day ร— 50 tokens = 1,000 tokens/day
Cost: ~$0.015/day (o1-mini)
User experience: Seamless continuity
Token Savings Calculator
Scenario Without With AgentMem Savings
20 calls/day 10,000 tok/day 1,000 tok/day 90%
50 calls/day 25,000 tok/day 2,500 tok/day 90%
100 calls/day 50,000 tok/day 5,000 tok/day 90%
๐Ÿ’ก Pro Tip
Store summaries, not raw data. A 50-token fact beats a 500-token conversation dump every time.

Built for agents

Everything your AI needs. Nothing it doesn't.

โš™

Dead Simple

Three endpoints. PUT, GET, DELETE. No SDK required. Just HTTP.

๐Ÿ”—

x402 Payments NEW

Pay with USDC on Base. No signup, no API key. Your wallet is your identity.

โŠ•

Global Edge

Cloudflare's network. Sub-50ms latency worldwide.

โฌข

Agent Native

Built for AI agents. Works with OpenClaw, AutoGPT, LangChain, CrewAI.

โ—Ž

Usage Tracking

Monitor storage and operations via /v1/status. No surprise bills.

๐Ÿ“ฆ

No Lock-In

Export all your data as JSON via GET /v1/export. Switch providers anytime.

Why AgentMem?

Other memory solutions have 6 layers, 5 dependencies, and PhD-level setup.
We have 3 endpoints. That's it.

๐Ÿ”ด Other Memory Solutions
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ 6-LAYER ARCHITECTURE โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ HOT RAM (SESSION-STATE) โ”‚
โ”‚ WARM STORE (LanceDB) โ”‚
โ”‚ COLD STORE (Git-Notes) โ”‚
โ”‚ CURATED ARCHIVE (files) โ”‚
โ”‚ CLOUD BACKUP (API) โ”‚
โ”‚ AUTO-EXTRACTION (Mem0) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • โŒ 6 dependencies to install
  • โŒ 5+ setup steps (Git, LanceDB, etc.)
  • โŒ Vector embeddings = $$$
  • โŒ Local-only or complex sync
โœ… AgentMem
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ DEAD SIMPLE API โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ”‚
โ”‚ PUT /kv/:key โ”‚
โ”‚ GET /kv/:key โ”‚
โ”‚ DELETE /kv/:key โ”‚
โ”‚ โ”‚
โ”‚ (that's the entire API) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • โœ… Zero dependencies
  • โœ… One API key, 30 seconds setup
  • โœ… Pay-as-you-go (no embeddings)
  • โœ… Cloud-native (works everywhere)

Before & After

โŒ Without AgentMem
  • โ€ข Agent forgets everything on restart
  • โ€ข User repeats preferences every session
  • โ€ข No memory across conversations
  • โ€ข Context window fills up fast
  • โ€ข Manual file management
โ†’
โœ… With AgentMem
  • โ€ข Agent remembers across sessions
  • โ€ข One-time preference setting
  • โ€ข Persistent context automatically
  • โ€ข Clean context window
  • โ€ข Zero maintenance

The Numbers Don't Lie

AgentMem vs Self-Hosted Memory Solutions

AgentMem Elite LTM Cognitive ChromaDB
Setup Time 30 seconds 30 minutes 15 minutes 20 minutes
Dependencies Zero Docker + LanceDB + Git Git + Voyage AI ChromaDB + Ollama
Infrastructure None Self-hosted Self-hosted Self-hosted
Cross-Device โœ… Built-in โŒ Manual sync โŒ Manual sync โŒ Local only
Learning Curve 2 minutes 30+ minutes 45+ minutes 30+ minutes
Monthly Cost $5 Server + dev time Voyage AI credits GPU/CPU usage
Maintenance Zero Backups, updates Memory hygiene Database tuning

The simplicity moat: We're the ONLY memory solution that's
zero-dependency, one-line setup, and crypto-native.

How It Works

Three lines of code. Zero setup.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    PUT /kv/:key    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   Encrypted   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Agent  โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ AgentMem โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚  Storage โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚                               โ–ฒ
     โ”‚      GET /kv/:key            โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
      

Store a value

curl -X PUT https://api.agentmem.io/v1/kv/user_prefs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "dark_mode"

Retrieve it

curl https://api.agentmem.io/v1/kv/user_prefs \
  -H "Authorization: Bearer YOUR_API_KEY"

Delete it

curl -X DELETE https://api.agentmem.io/v1/kv/user_prefs \
  -H "Authorization: Bearer YOUR_API_KEY"
๐Ÿ’ก What to store: User preferences, session state, cached API responses, agent configuration, task queues.
Skip: Large files (use S3), secrets (use a vault), temporary chat logs.

Or use the SDK

Install

npm install agentmem

Use

import { AgentMem } from 'agentmem';
const mem = new AgentMem(API_KEY);
await mem.put('key', 'value');
const val = await mem.get('key');

npm version npm downloads

๐Ÿง  Mental Model: Three Layers of Memory

How memory should work in agent systems

โšก Ephemeral
Session memory (chat history)
  • โœ“ Fast access
  • โœ“ Indexed for recall
  • โœ— Lost on compaction
  • โœ— Not durable
Use for: Current conversation context
๐Ÿ“ Operational
Daily logs (work-in-progress)
  • โœ“ Append-only notes
  • โœ“ Survives restarts
  • โœ— Not semantic search
  • โœ— High noise/signal
Use for: Commands run, changes made, blockers
๐Ÿง  Durable
AgentMem (long-term knowledge)
  • โœ“ Survives compaction
  • โœ“ Cross-device sync
  • โœ“ Fast recall (PUT/GET)
  • โœ“ High signal/noise
Use for: Preferences, decisions, facts

๐ŸŽฏ The Rule: If it must survive compaction, store it in AgentMem

Session memory is ephemeral. Daily logs are operational. AgentMem is your source of truth.

Example workflow:

  • User says "I prefer dark mode" โ†’ Store in AgentMem (PUT /kv/user_prefs)
  • Working on a bug โ†’ Log in daily/2026-02-05.md
  • Bug fixed, decision made โ†’ Update AgentMem (PUT /kv/decisions/2026-02-05-01)

๐Ÿ’ก Inspired by: OpenClaw-Mem's three-layer architecture (ephemeral โ†’ operational โ†’ durable)

โŒ Anti-Patterns: Don't Do This

Common mistakes that waste tokens, break things, or leak sensitive data

โŒ
Don't store secrets or credentials
API keys, passwords, private keys โ†’ use environment variables or proper secret storage (not AgentMem).
BAD: PUT secrets/stripe-key "sk_live_..."
GOOD: export STRIPE_KEY="sk_live_..."
โŒ
Don't load all memories on every session start
Fetching 100 keys = 100 API calls = wasted tokens. Use /v1/bootstrap or fetch only what you need.
BAD: for key in all_keys: GET /v1/{key}
GOOD: GET /v1/bootstrap โ†’ only fetch core context
โŒ
Don't store large blobs (images, videos, binaries)
AgentMem is for text context (JSON, strings). Use object storage (S3, R2, Cloudflare Images) for media.
BAD: PUT media/avatar "data:image/png;base64,iVBOR..."
GOOD: PUT media/avatar-url "https://r2.dev/avatar.png"
โŒ
Don't use it for high-frequency counters or real-time state
Page views, analytics, rate limiting โ†’ use Redis/ClickHouse. AgentMem is for knowledge, not counters.
BAD: GET analytics/page-views โ†’ increment โ†’ PUT
GOOD: INCR page_views (in Redis)
โŒ
Don't store temporary session state
"Loading...", "API request in progress" โ†’ these die with the session. Use RAM/context window instead.
BAD: PUT state/loading "true"
GOOD: Keep in local variable (dies with session)
โŒ
Don't use random/unstructured keys
Keys like temp123 or asdf are impossible to recall. Use namespaces: user/preferences/tone
BAD: PUT temp123 "some data"
GOOD: PUT user/settings/timezone "America/Los_Angeles"
๐Ÿ“œ Golden Rule
"If it would still be true next week on a different device, store it in AgentMem. Otherwise, keep it local."

โšก Performance & Reliability

Built for production. Measured, not promised.

~104ms
Average GET latency
Measured over 100 requests
~106ms
Average PUT latency
Measured over 50 requests
~107ms
Average DELETE latency
Measured over 50 requests

๐Ÿš€ Why It's Fast

  • โœ… Cloud-native infrastructure: Cloudflare Workers + Durable Objects (edge computing)
  • โœ… Zero cold starts: Always-on Durable Objects maintain state
  • โœ… Simple API: No complex queries = predictable latency

๐Ÿ“Š Uptime & Monitoring

  • ๐ŸŸข Health endpoint: GET /v1/health for service status
  • ๐Ÿ“ˆ Analytics API: GET /v1/analytics for usage metrics
  • ๐Ÿ” Full audit trail: Every operation logged with timestamp

๐ŸŽฏ Token Cost Impact

AgentMem adds minimal overhead to your token budget. Here's the math:

~50 tokens
Average GET response
4,000 GETs
Per 200K context window
Negligible
Impact on costs

๐Ÿ’ก Pro tip: Use short keys and store only essential data to minimize token usage

๐Ÿ“‹ API Parameters & Limits

Know your constraints before you hit them

Parameter
Limit
Notes
Key length
512 bytes
Use short, hierarchical keys
Value size
1 MB
Use S3/R2 for large files, store refs
Total keys per account
Unlimited
Pay-as-you-go pricing applies
Rate limit (demo)
10/min
For testing; upgrade for production
Rate limit (paid)
1,000/min
Contact for higher limits
Data retention
Indefinite
You control deletion with DELETE
GET latency (avg)
~104ms
Measured from Cloudflare edge
PUT/DELETE latency (avg)
~106ms
Same infrastructure as GET
API uptime SLA
99.9%
Backed by Cloudflare Workers

โš ๏ธ What Happens When You Hit Limits?

  • ๐Ÿšฆ Rate limit: 429 response with Retry-After header
  • ๐Ÿ“ฆ Value too large: 413 Payload Too Large (compress or use S3)
  • ๐Ÿ”‘ Key too long: 400 Bad Request with hint to shorten

When to Use AgentMem

Your agent should call AgentMem when the user says...

User Says
Action
Example Key
"Remember this"
PUT immediately
user:note:20260203
"I prefer..."
PUT as preference
user:pref:theme
"What did I..."
GET relevant keys
user:history:*
"Forget that"
DELETE key
user:note:20260203
"Save my progress"
PUT session state
session:state
โœ… Good to Store
  • โ€ข User preferences (theme, language)
  • โ€ข Decisions made ("chose plan X")
  • โ€ข Important context ("works at Y")
  • โ€ข Session state / progress
  • โ€ข Cached API responses
  • โ€ข Task queues / workflows
โŒ Skip These
  • โ€ข Secrets / API keys (use a vault)
  • โ€ข Large files >1MB (use S3)
  • โ€ข Temporary chat logs
  • โ€ข Debugging / verbose logs
  • โ€ข Duplicate data
  • โ€ข Data that changes every second
NEW Bootstrap Endpoint

Get all your agent's context in a single API call. Perfect for session startup.

curl https://api.agentmem.io/v1/bootstrap \
  -H "Authorization: Bearer YOUR_API_KEY"

# Returns: identity + all memories + stats in ONE call

When NOT to Use AgentMem

These are common misuses. Avoid them to keep your memory fast and clean.

โŒ

Storing Chat Transcripts

Don't dump full conversation logs into AgentMem. They bloat context windows and rarely get retrieved.

โŒ Bad:
PUT chat:transcript:20260203 = "User: Hi\nAgent: Hello\n..."
โœ… Good:
PUT user:decision:plan = "Chose Pro plan on 2026-02-03"
โŒ

Using It as a Logging System

AgentMem is for knowledge that persists across sessions, not debugging logs or transient state.

โŒ Bad:
PUT debug:api_call_1234 = "Status 200, latency 45ms"
โœ… Good:
PUT workflow:last_run = "2026-02-03T14:30:00Z"
โŒ

Storing Secrets or Credentials

Never store API keys, passwords, or tokens. Use a proper secrets vault (Doppler, 1Password, AWS Secrets Manager).

โŒ Bad:
PUT api:openai_key = "sk-..."
โœ… Good:
PUT config:openai = {"model": "gpt-4", "max_tokens": 1000}
โŒ

Treating It as a File System

Don't store large files, images, or binary data. Use S3, Cloudflare R2, or similar object storage.

โŒ Bad:
PUT file:avatar = "<5MB base64 blob>"
โœ… Good:
PUT user:avatar_url = "https://s3.amazonaws.com/..."
โŒ

Writing Duplicate Data

Don't overwrite the same key repeatedly without checking if it changed. Wastes API calls and burns your quota.

โŒ Bad:
PUT user:theme = "dark" // every request, even if unchanged
โœ… Good:
if (theme !== lastTheme) PUT user:theme = theme

Best Practices

Follow these patterns to get the most out of AgentMem

โœ…

Use Structured Key Names

Namespace your keys to organize memories by type. Makes retrieval faster and prevents collisions.

Recommended patterns:
user:pref:theme decision:plan_choice:20260203 episodic:2026_02_03:event_name semantic:topic:fact_name procedural:workflow:step_name
โœ…

Fetch on Demand, Not Up Front

Don't load all memories at startup. Fetch only what's relevant to the current task.

โŒ Bad: Load everything
keys = GET /v1/keys; for k in keys: GET /v1/keys/{k}
โœ… Good: Progressive disclosure
1. GET /v1/bootstrap (identity + core context) 2. Only fetch user:* keys when user asks a question
โœ…

Mark Critical Memories

Use key prefixes to signal importance. Helps agents prioritize what to load first.

critical:rule:no_personal_data high:decision:architecture_choice normal:fact:topic_name low:temp:cache_entry
โœ…

Smart Retrieval Strategy

Load memories in order of importance: critical rules first, contextual facts second, nice-to-haves last.

1. GET critical:* (always load these) 2. GET high:decision:* (if user asks about decisions) 3. GET user:pref:* (when user interacts) 4. Skip low:* unless explicitly needed
โœ…

Consolidate Old Memories

Periodically merge related memories, archive outdated ones, and delete duplicates to keep your store clean.

Weekly cleanup checklist:
โ€ข Merge duplicate facts into one canonical key โ€ข DELETE episodic:* older than 30 days (if not needed) โ€ข Archive low:* to external storage if unused
โš ๏ธ

What NOT to Store in AgentMem

Not everything belongs in long-term memory. Here's what to skip:

โŒ Don't Store
โ€ข Ephemeral chat logs
โ€ข Secrets & credentials
โ€ข Temporary task state
โ€ข Large files (>1MB)
โ€ข High-frequency data
โœ… Store Instead
โ€ข User preferences
โ€ข Session state (cross-device)
โ€ข Configuration
โ€ข Learned patterns
โ€ข Important facts

๐Ÿ”„ Memory Protocol

When to call AgentMem during your agent's lifecycle

๐Ÿš€

On Session Start

1. GET /v1/bootstrap โ†’ Load identity + critical context 2. GET /v1/keys?prefix=critical: โ†’ Load never-forget rules 3. GET /v1/keys?prefix=user:pref: โ†’ Load user preferences

Why: Initialize with essential context so the agent doesn't ask for preferences every time.

๐Ÿ’ฌ

During Conversation

User says "Remember this" โ†’ PUT /v1/user:note:{timestamp} User says "I prefer X" โ†’ PUT /v1/user:pref:{topic} User asks "What did I..." โ†’ GET /v1/keys?prefix=episodic: User says "Forget that" โ†’ DELETE /v1/{key}

Why: Store facts in real-time so they're available in future sessions.

โœ…

After Task Completion

PUT /v1/decision:{topic}:{date} โ†’ "User chose plan B over A" PUT /v1/lesson:{topic} โ†’ "Approach X worked better than Y" PUT /v1/episodic:{date}:{task} โ†’ "Completed migration successfully"

Why: Capture decisions and learnings for future reference ("Why did we pick this?").

โŒ

After Failures

PUT /v1/mistake:{topic} โ†’ "API call failed because X" PUT /v1/lesson:{topic} โ†’ "Always check Y before doing Z"

Why: Don't repeat mistakes. Learn from failures.

๐Ÿ›‘

On Session End

1. Extract durable facts from conversation โ†’ PUT /v1/semantic:{topic} 2. Record any lessons learned โ†’ PUT /v1/lesson:{topic} 3. Update entity information (if tracking) โ†’ PUT /v1/entity:{name}

Why: Consolidate ephemeral chat into durable memories.

๐Ÿ“‹ Copy-Paste for AGENTS.md / HEARTBEAT.md

## Memory Protocol (AgentMem)

On session start:
1. GET /v1/bootstrap (identity + core context)
2. GET /v1/keys?prefix=critical: (never-forget rules)
3. GET /v1/keys?prefix=user:pref: (user preferences)

During conversation:
- User says "remember this" โ†’ PUT immediately
- User says "I prefer X" โ†’ PUT as user:pref:{topic}
- User asks "what did I..." โ†’ GET episodic:*

On session end:
1. Extract durable facts โ†’ PUT semantic:{topic}
2. Record lessons learned โ†’ PUT lesson:{topic}
3. Consolidate decisions โ†’ PUT decision:{topic}

๐Ÿ› ๏ธ Helper Scripts

One-liner convenience wrappers for common operations

๐Ÿ“ฆ Install Helper Script

Download and install the amem helper script for easier CLI usage:

curl -o ~/bin/amem https://agentmem.io/scripts/amem && chmod +x ~/bin/amem

๐Ÿ’ก Set your API key: export AGENTMEM_API_KEY="your-key"

๐Ÿš€ Usage Examples

โœ… Store a value
amem set "user_name" "Alice"
amem set "user:pref:theme" "dark"
๐Ÿ” Retrieve a value
amem get "user_name"
# Output: Alice
๐Ÿ”Ž Search by prefix
amem search "user_*"
amem search "user:pref:*"
๐Ÿ—‘๏ธ Delete a key
amem delete "user_name"
๐Ÿš€ Bootstrap (get all critical context)
amem bootstrap
# Returns: identity, critical:*, user:pref:*
๐Ÿ“œ Show Script Source
#!/bin/bash
# AgentMem Helper Script
# Usage: amem [set|get|search|delete|bootstrap] [args...]

API_KEY="${AGENTMEM_API_KEY:-}"
BASE_URL="https://api.agentmem.io/v1"

if [ -z "$API_KEY" ]; then
  echo "Error: AGENTMEM_API_KEY not set"
  exit 1
fi

case "$1" in
  set)
    curl -X PUT "$BASE_URL/$2" \
      -H "Authorization: Bearer $API_KEY" \
      -H "Content-Type: text/plain" \
      -d "$3"
    ;;
  get)
    curl -X GET "$BASE_URL/$2" \
      -H "Authorization: Bearer $API_KEY"
    ;;
  search)
    curl -X GET "$BASE_URL/keys?prefix=$2" \
      -H "Authorization: Bearer $API_KEY"
    ;;
  delete)
    curl -X DELETE "$BASE_URL/$2" \
      -H "Authorization: Bearer $API_KEY"
    ;;
  bootstrap)
    curl -X GET "$BASE_URL/bootstrap" \
      -H "Authorization: Bearer $API_KEY"
    ;;
  *)
    echo "Usage: amem [set|get|search|delete|bootstrap] [args...]"
    exit 1
    ;;
esac

๐ŸŽฏ When to Call AgentMem

Trigger words and patterns that signal memory operations

User Says Action
"Remember this" PUT /v1/kv/note-{timestamp}
"Don't forget X" PUT /v1/kv/important-{topic}
"I prefer..." PUT /v1/kv/user-prefs
"Store this config" PUT /v1/kv/config
"What did I..." GET /v1/kv/{topic}
"Forget about X" DELETE /v1/kv/{topic}

General Rule:

If it's worth remembering for >1 hour, store it in AgentMem. Use session memory for temporary state.

๐ŸŽฏ Retrieval Best Practices

How to retrieve memories efficiently without bloating your context window

Core Principle: Precision over Quantity

Don't dump all memories into context. Retrieve selectively โ€” load only what's needed for the current task. Fewer tokens = faster responses + lower costs.

1

Start Broad with Prefix Search

GET /v1/keys?prefix=user:pref: โ†’ Returns ["user:pref:theme", "user:pref:language"]

Why: List all keys in a namespace first. Pick the 1-3 most relevant keys before fetching values.

๐Ÿ’ก Pro tip: Use hierarchical prefixes (user:pref:ui:theme) to narrow down quickly.
2

Fetch Only What You Need

โŒ Bad: GET all keys and dump into context โœ… Good: GET user:pref:theme โ†’ "dark" (only 4 bytes)

Why: Most tasks only need 1-3 memories. Load the minimum required data.

๐Ÿ’ก Pro tip: For decisions, just load the conclusion (decision:{topic}), not the entire reasoning chain.
3

Cache in Session Memory

On session start: GET /v1/bootstrap โ†’ cache identity + core prefs During session: Refer to cached values, don't re-fetch

Why: Reduce API calls. Load critical context once at session start, reuse throughout.

๐Ÿ’ก Pro tip: Use /v1/bootstrap to load identity + all critical context in ONE call.
4

Don't Guess โ€” Ask First

โŒ Bad: Fetch episodic:* and scan all events โœ… Good: "Do you remember when you last...?" โ†’ targeted GET

Why: If you don't know what to retrieve, ask the user instead of scanning everything.

5

Prune Outdated Memories

DELETE /v1/session:2026-01-01 โ†’ Remove old session data after 30 days

Why: Dead keys clutter your namespace. Periodically delete stale data (old sessions, expired cache, etc.).

๐Ÿ’ก Pro tip: Use timestamp-based keys (cache:{date}) so you can DELETE by prefix when they expire.

โšก Quick Reference

โœ… Do This
  • โ€ข Load critical context on session start
  • โ€ข Use prefix search before fetching
  • โ€ข Cache frequently-used values
  • โ€ข Fetch minimal data per request
  • โ€ข Delete stale keys periodically
โŒ Avoid This
  • โ€ข Fetching all keys every turn
  • โ€ข Loading values you won't use
  • โ€ข Re-fetching cached data
  • โ€ข Scanning full namespaces
  • โ€ข Hoarding dead keys forever

๐Ÿ’ป CLI Helper Script

Make AgentMem easier to use from the command line

For easier usage, create ~/bin/agentmem:

#!/bin/bash
# AgentMem CLI Helper
KEY="${AGENTMEM_KEY:?Set AGENTMEM_KEY env var}"
ACTION=$1
KEYNAME=$2
shift 2

case $ACTION in
  put)
    echo "$*" | curl -X PUT "https://api.agentmem.io/v1/kv/$KEYNAME" \
      -H "Authorization: Bearer $KEY" \
      -H "Content-Type: application/text" \
      --data-binary @-
    ;;
  get)
    curl -s "https://api.agentmem.io/v1/kv/$KEYNAME" \
      -H "Authorization: Bearer $KEY"
    ;;
  delete)
    curl -X DELETE "https://api.agentmem.io/v1/kv/$KEYNAME" \
      -H "Authorization: Bearer $KEY"
    ;;
  *)
    echo "Usage: agentmem [put|get|delete] <key> [value]"
    exit 1
    ;;
esac

Install:

chmod +x ~/bin/agentmem
export AGENTMEM_KEY="your_api_key_here"

Usage:

agentmem put user-prefs "dark mode preferred" agentmem get user-prefs agentmem delete user-prefs

๐ŸŽฏ Auto-Capture Triggers

Natural language patterns that should trigger memory storage

Silent operation: When users say these phrases, store immediately and continue โ€” don't announce "I'll remember that!" Just do it.

โค๏ธ

User Preferences

๐Ÿ’ฌ "I prefer..."
๐Ÿ’ฌ "I like / I hate..."
๐Ÿ’ฌ "My favorite..."
๐Ÿ’ฌ "Always / Never do X"
๐Ÿ’ฌ "I want / I don't want..."
Example: PUT /v1/user:pref:communication โ†’ {"style": "direct, no fluff"}
๐Ÿชช

Identity & Facts

๐Ÿ’ฌ "My name is..."
๐Ÿ’ฌ "I live in..."
๐Ÿ’ฌ "My X is Y"
๐Ÿ’ฌ "Call me..."
๐Ÿ’ฌ "I work at / I'm a..."
Example: PUT /v1/user:identity โ†’ {"name": "Alex", "timezone": "PST"}
๐Ÿง 

Explicit Memory Commands

๐Ÿ’ฌ "Remember this..."
๐Ÿ’ฌ "Don't forget..."
๐Ÿ’ฌ "Keep this in mind..."
๐Ÿ’ฌ "For next time..."
๐Ÿ’ฌ "Note that..."
Example: PUT /v1/user:note:2026-02-05 โ†’ {"text": "API keys in 1Password"}
โœ…

Decisions & Choices

๐Ÿ’ฌ "We decided to..."
๐Ÿ’ฌ "I chose X over Y because..."
๐Ÿ’ฌ "Let's go with..."
๐Ÿ’ฌ "The plan is..."
๐Ÿ’ฌ "We're going with..."
Example: PUT /v1/decision:tech-stack โ†’ {"choice": "PostgreSQL", "reason": "team expertise"}
๐Ÿ’ก

Lessons & Learnings

๐Ÿ’ฌ "X worked better than Y"
๐Ÿ’ฌ "Next time, do Z first"
๐Ÿ’ฌ "Don't do X because..."
๐Ÿ’ฌ "What worked: ..."
๐Ÿ’ฌ "What failed: ..."
Example: PUT /v1/lesson:deployment โ†’ {"learned": "Always run migrations before code"}
๐Ÿ—‘๏ธ

Deletion Triggers

๐Ÿ’ฌ "Forget that..."
๐Ÿ’ฌ "Delete X from memory"
๐Ÿ’ฌ "Don't remember..."
๐Ÿ’ฌ "Remove that note"
๐Ÿ’ฌ "Clear my X"
Example: DELETE /v1/{key} (use prefix search to find the right key)

๐Ÿ“‹ Python Implementation Example

import re
import requests

TRIGGER_PATTERNS = {
    'preference': r'I (prefer|like|want|hate)',
    'identity': r'My (name|timezone|email) is',
    'explicit': r'(remember|don\'t forget|note that)',
    'decision': r'(we decided|I chose|let\'s go with)',
    'lesson': r'(worked better|next time|what failed)',
    'delete': r'(forget that|delete|remove|clear)'
}

def detect_trigger(user_message):
    for category, pattern in TRIGGER_PATTERNS.items():
        if re.search(pattern, user_message, re.IGNORECASE):
            return category
    return None

def auto_capture(user_message, api_key):
    trigger = detect_trigger(user_message)
    if not trigger:
        return  # No trigger, skip
    
    # Extract key/value (simplified - use NER in production)
    key = f"{trigger}:{int(time.time())}"
    value = {"text": user_message, "category": trigger}
    
    # Store silently
    requests.put(
        f"https://api.agentmem.io/v1/{key}",
        headers={"Authorization": f"Bearer {api_key}"},
        json=value
    )

โœ… Best Practices for Auto-Capture

1. Silent operation: Never announce "I'll remember that!" โ€” just store and continue
2. Extract entities: Use NER (spaCy, Hugging Face) to extract structured data from natural language
3. Deduplicate: Check if similar keys exist before creating new ones
4. Namespace properly: Use prefixes like user:pref:, decision:, etc.
5. Timestamp everything: Add timestamps to keys for chronological sorting

๐ŸŽฏ What Can You Build?

Real-world use cases from the agent economy

๐Ÿค–

Personal Assistant Memory

Remember user preferences, past decisions, and ongoing tasks. Your agent gets smarter over time, not goldfish-brained every conversation.

user:pref:communication_style user:decision:tech_stack user:task:project_status
๐Ÿง 

Multi-Agent Knowledge Sharing

Share context across specialized agents. One agent learns, all agents benefit. Perfect for agent swarms and delegation workflows.

team:learnings:deployment_patterns team:rules:code_standards team:facts:api_endpoints
๐Ÿ’ฌ

Customer Context Persistence

Customer support agents that remember prior tickets, preferences, and history. No more "let me look that up" โ€” instant context retrieval.

customer:123:history customer:123:preferences customer:123:last_interaction
โš™๏ธ

Agentic Workflow State

Pause and resume complex workflows. Your agent can checkpoint progress, survive restarts, and pick up where it left off.

workflow:deploy:step workflow:deploy:state workflow:deploy:rollback_point

All use cases share one pattern: Your agent stores context while working, retrieves it when needed. Simple.

๐Ÿ”— Integration with Existing Tools

AgentMem complements your current setup โ€” it doesn't replace it

๐Ÿ“

vs MEMORY.md

Use AgentMem for: Structured key-value data (preferences, config, session state)
Use MEMORY.md for: Long-form notes, journal entries, human-readable logs

๐Ÿ”

vs LanceDB / Vector DBs

Use AgentMem for: Simple facts, configuration, exact-match lookups
Use Vector DBs for: Semantic search, similarity matching, large corpora

๐ŸŒฟ

vs Git Notes

Use AgentMem for: Live data that changes frequently (session state, prefs)
Use Git for: Versioned history, audit trails, collaborative editing

โšก

vs Redis

Use AgentMem for: Persistent storage that survives restarts
Use Redis for: High-speed cache, pub/sub, ephemeral data (<1 hour)

Rule of Thumb:

If it needs to survive restarts โ†’ AgentMem
If it's <1 hour lifespan โ†’ Session memory

FAQ

How is this different from a database?

AgentMem is key-value only. No SQL, no schemas, no migrations, no setup. Just PUT and GET. Perfect for agent memory that doesn't need relational queries.

What happens if I hit my key limit?

Writes fail with a 402 error. Your existing data stays accessible. Upgrade or delete old keys to continue writing.

Can I upgrade or downgrade?

Yes! Change your plan anytime via the Stripe portal or crypto payment. Prorated billing for paid plans.

Is my data encrypted?

Yes. Encrypted at rest (AES-256) and in transit (TLS 1.3). Only you have access to your keys.

What's the SLA and uptime?

99.9% uptime target. Built on Cloudflare Workers (globally distributed, edge-deployed worldwide).

Can I export my data?

Yes! GET /v1/export returns all your keys as JSON. You can switch providers anytime.

How does crypto payment work?

Pay with USDC on Base (Ethereum L2). Connect your wallet, approve the payment, and your API key activates instantly. No email, no signup.

What if I lose my API key?

For Stripe users: Log in via your email link. For crypto users: Your wallet address is your account โ€” check the blockchain for your payment tx, then contact support.

โš ๏ธ Limitations & Roadmap

Honest about what we don't do (yet)

๐Ÿšง What AgentMem v1.0 Doesn't Do

  • โŒ No semantic search: You can GET by key prefix, but no vector embeddings or similarity search (yet). Use client-side filtering for now.
  • โŒ No built-in search API: GET /v1/keys returns all keys, then you filter client-side. Fast enough for <10k keys.
  • โŒ No relational queries: It's key-value only. No JOINs, no complex queries. Simple by design.
  • โŒ No automatic backups: Use GET /v1/export to download your data manually (GDPR-compliant).
  • โŒ No multi-user collaboration: One API key = one namespace. Share keys carefully.

๐Ÿš€ Coming Soon (Based on Demand)

HIGH PRIORITY
Semantic search: Vector embeddings for similarity search (e.g., "find memories about deployment")
v1.1
Query API: GET /v1/search?q=term for server-side filtering
v1.2
Scheduled backups: Optional auto-export to S3/Cloudflare R2
v1.3
Real-time webhooks: Notify your agent when keys change (pub/sub pattern)
v2.0
Multi-agent namespaces: Shared memory with permission controls

Vote on features: Open an issue on GitHub or email [email protected]. We ship based on user demand.

๐Ÿšซ Anti-Patterns (What NOT to Store)

Learn from others' mistakes

  • โŒ Don't store transient API errors
    Bad: {"error": "503 Service Unavailable"}
    Why: Errors are temporary. If you need to track failures, store patterns, not raw errors.
  • โŒ Don't store massive payloads (>1MB)
    Bad: Storing entire API responses, large JSON blobs, base64-encoded images
    Why: AgentMem is for memory, not file storage. Use S3/R2 for large data, store references in AgentMem.
  • โŒ Don't use AgentMem as a database
    Bad: Relational data with JOINs, complex queries, transactional data
    Why: AgentMem is key-value only. For structured data, use Postgres/MySQL. Store summaries in AgentMem.
  • โŒ Don't store secrets in plain text
    Bad: {"github_token": "ghp_abc123..."}
    Why: Use environment variables or proper secret managers. AgentMem is for context, not credentials.

Rule of thumb: If it would still be useful next week, it's worth storing. If it's only relevant right now, skip it.

๐Ÿ’ฐ Token Efficiency Calculator

See how much you save with on-demand memory

โŒ Without AgentMem

๐Ÿ“ Load full context every session
๐Ÿ’พ 3,500 tokens per session start
๐Ÿ”„ 20 sessions/day
๐Ÿ“Š 70,000 tokens/day
๐Ÿ’ธ ~$10.50/month
at $0.005/1k tokens (GPT-4 input)

โœ… With AgentMem

๐Ÿ” Fetch only what you need
๐Ÿ’พ 200 tokens per session start
๐Ÿ”„ 20 sessions/day
๐Ÿ“Š 4,000 tokens/day
๐Ÿ’ธ ~$0.60/month
at $0.005/1k tokens (GPT-4 input)
๐Ÿ’ฐ $9.90/month saved
That's 94% token reduction โ€” pay for AgentMem ($5/mo) and still save money

The math: Traditional memory loads 3,500 tokens of context (6% relevant, 94% noise). AgentMem lets you fetch only the 200 tokens you need on-demand. That's 17.5ร— more efficient.

๐Ÿ”„ Memory Lifecycle

Understand where AgentMem fits in your agent's memory architecture

๐Ÿง 
Working Memory
RAM / Context Window
Transient, compacted
โ†’
โ˜๏ธ
AgentMem
Cloud Storage
Durable, searchable
โ†’
๐Ÿ’พ
Local Backup
S3 / R2 / Disk
Optional archive
๐Ÿง 
Working Memory (RAM)
Your agent's current context window. Fast but transient โ€” gets compacted/cleared between sessions. Use for short-term thinking.
โ˜๏ธ
AgentMem (Cloud)
Durable memory that survives sessions. Fetch on-demand, not always loaded. Use for facts, preferences, decisions that need to persist.
๐Ÿ’พ
Local Backup (Optional)
Long-term archive for compliance or disaster recovery. Use GET /v1/export to download your data anytime (GDPR-compliant).

Key principle: Working memory is for thinking. AgentMem is for remembering. Local backup is for never losing data.

๐Ÿท๏ธ Metadata & Tagging Guide

Structure your memories for powerful retrieval

AgentMem is key-value only โ€” no built-in tagging. But you can use key prefixes and JSON metadata to create your own tagging system.

Key Prefix Strategy

# Organize by type
user:preferences:language
user:preferences:timezone
project:agentmem:api_key
project:agentmem:last_deploy

# Query by prefix
GET /v1/keys?prefix=user:preferences:
โ†’ Returns all user preferences

GET /v1/keys?prefix=project:
โ†’ Returns all project-related memories

JSON Metadata Pattern

{
  "key": "decision:2026-02-05:use-agentmem",
  "value": {
    "type": "decision",
    "priority": "high",
    "category": "architecture",
    "decision": "Use AgentMem for persistent memory",
    "reason": "Simple API, cloud-native, pay-as-you-go",
    "updated": "2026-02-05T03:58:00Z",
    "tags": ["memory", "architecture", "cloud"]
  }
}

Recommended Tag Taxonomy

๐Ÿ”ด Gotchas
Pitfalls to avoid
๐Ÿ”ต How-To
Technical explanations
๐ŸŸข Changes
What was deployed
๐ŸŸฃ Insights
Learnings, discoveries
๐ŸŸ  Decisions
Architecture choices
โš–๏ธ Tradeoffs
Deliberate compromises

๐Ÿ’ก Client-Side Filtering

Since AgentMem doesn't have built-in search (yet), fetch keys by prefix and filter client-side:

# Fetch all memories
memories = api.get('/v1/keys?prefix=memory:')

# Filter by tag in JSON value
high_priority = [m for m in memories 
                 if m['value']['priority'] == 'high']

# Filter by date
recent = [m for m in memories 
          if m['value']['updated'] > '2026-02-01']

๐Ÿ”’ Security & Privacy

Your data, your control

๐Ÿ”
End-to-End Encryption (HTTPS)
All data in transit is encrypted via TLS 1.3. Your API key is the only credential โ€” keep it safe.
๐Ÿšซ
No Training on Your Data
Your memories are yours. We never use them to train models or share them with third parties.
๐Ÿ—‘๏ธ
GDPR-Compliant Deletion
Use DELETE /v1/keys?prefix=* to wipe all data. Export first with GET /v1/export.
๐ŸŒ
Data Sovereignty
Hosted on Cloudflare Workers (global edge network). Data stored in Cloudflare's distributed KV store. No single data center.
๐Ÿ”‘
Selective Access Control
One API key = one namespace. Share keys carefully. Multi-agent namespaces coming in v2.0 (shared read, gated write).

Security roadmap: SOC 2 compliance (Q2 2026), client-side encryption (Q3 2026), multi-region replication (Q4 2026). Vote on priorities via email.

โ˜๏ธ Why Cloud vs Local?

AgentMem is cloud-first by design โ€” here's why that matters

๐ŸŒ

Multi-Device Sync

Access your memories from anywhere โ€” laptop, phone, cloud server. Local-only solutions lock you to one machine.

โœ… Cloud: Instant sync across devices
โŒ Local: Manual sync with git/rsync
โšก

Zero Setup

30 seconds from signup to first API call. No Docker, no config files, no dependency hell.

โœ… Cloud: Email โ†’ API key โ†’ curl
โŒ Local: 5-15min Docker + embeddings + config
๐Ÿ’พ

Automatic Backups

Your data is replicated across Cloudflare's global network. No manual backups, no data loss from disk failures.

โœ… Cloud: Auto-replicated, always safe
โŒ Local: Manual backups or lose everything
๐Ÿ’ฐ

Pay Per Use

10,000 free keys, then $5/mo for 1M. Local solutions need dedicated servers, even when idle.

โœ… Cloud: $0-$5/mo (scales with usage)
โŒ Local: $10-$20/mo server costs (always on)
๐Ÿ”ง

Zero Maintenance

We handle updates, scaling, monitoring. You focus on building agents, not managing infrastructure.

โœ… Cloud: We handle it
โŒ Local: You're on your own
๐Ÿ”

Privacy + Convenience

HTTPS encryption, GDPR compliance, no training on your data. Get privacy without running your own infrastructure.

โœ… Cloud: Encrypted + compliant by default
โŒ Local: You configure security yourself

When to choose local: If you have strict data residency requirements, or need complete air-gap isolation, local-first solutions like elite-longterm-memory or openclaw-mem are better fits. AgentMem prioritizes speed + convenience + multi-device access over maximum control.

๐Ÿ” Staging Area: Unverified Content

Don't pollute long-term memory with unverified facts

The Problem

Agents often fetch external content (web_search, web_fetch, API calls) during conversations. Not all of it is verified truth. Storing unverified data directly pollutes long-term memory.

โŒ Bad: Store Everything
result = web_search("crypto news")
PUT /v1/fact:crypto_trends โ† DANGER: unverified source

The Solution: Pending Namespace

Use a pending: prefix for external content. Review before promoting to long-term memory.

โœ… Good: Staging Area
result = web_search("crypto news")
PUT /v1/pending:crypto_trends โ† staged, not verified

# Later: review + promote if true
GET /v1/pending:crypto_trends
IF verified:
  PUT /v1/fact:crypto_trends โ† now it's truth
  DELETE /v1/pending:crypto_trends

โœ… Verification Checklist (Before Promoting)

1๏ธโƒฃ Trust Check
  • โœ“ Source is authoritative?
  • โœ“ Cross-referenced with another source?
  • โœ“ Matches existing knowledge?
2๏ธโƒฃ Consistency Check
  • โœ“ No contradictions with existing facts?
  • โœ“ Timestamp/version is current?
  • โœ“ Not temporary/speculative?
3๏ธโƒฃ Value Check
  • โœ“ Durable (not transient news)?
  • โœ“ Will be useful long-term?
  • โœ“ Worth the storage cost?
4๏ธโƒฃ Category Decision
  • โœ“ fact: / decision: / preference: ?
  • โœ“ Importance level (critical/high/normal)?
  • โœ“ Expiration date (if time-sensitive)?
๐Ÿ’ก Example: Heartbeat Review Script
# Daily heartbeat: Review pending memories
pending = GET /v1/keys?prefix=pending:

if pending.count > 10:
  alert("โš ๏ธ 10+ unverified memories in staging. Review needed.")

for key in pending.keys:
  value = GET /v1/{key}
  if verify(value):  # run your verification logic
    promote_to_longterm(key, value)
  elif age(key) > 7_days:
    DELETE /v1/{key}  # stale, discard

๐Ÿ”ด๐ŸŸกโšช Importance Levels: Visual Memory Hierarchy

Not all memories deserve equal attention

Four-Tier Importance System

๐Ÿ”ด
Critical (๐Ÿ”ด)
Load EVERY session. Never forget these.
Examples: Security policies, never-delete rules, authentication gotchas, critical bugs/workarounds
Key pattern: critical:rule:no_personal_data
๐ŸŸก
High (๐ŸŸก)
Scan first. Likely needed.
Examples: Architecture decisions, major learnings, important user preferences, active project state
Key pattern: high:decision:use_cloudflare_pages
โšช
Normal (โšช)
Load on demand. Background context.
Examples: General facts, entity info, historical events, minor preferences
Key pattern: normal:fact:user_timezone
๐Ÿ“
Low (๐Ÿ“)
Archive candidate. Rarely accessed.
Examples: Temporary caches, experimental data, one-time events, stale logs
Key pattern: low:cache:temp_result

๐Ÿ“‹ Retrieval Strategy by Importance

## Session Start Protocol (Prioritized Loading)

1. Load critical:* (always)
   GET /v1/keys?prefix=critical:
   โ†’ MUST load before any user interaction

2. Load high:* (very likely needed)
   GET /v1/keys?prefix=high:decision:
   GET /v1/keys?prefix=high:lesson:
   โ†’ Scan on startup or first user message

3. Load normal:* (on demand)
   IF user asks about topic:
     GET /v1/keys?prefix=normal:{topic}
   โ†’ Fetch only when contextually relevant

4. Skip low:* (unless explicitly requested)
   Only load if user specifically asks
   โ†’ Consider archiving after 30 days
โšก
Faster Recall
Load ๐Ÿ”ด critical first (10 keys) vs scanning all 1000 keys. 90% token reduction on session start.
๐Ÿ‘๏ธ
Visual Scanning
Icons (๐Ÿ”ด๐ŸŸกโšช๐Ÿ“) let agents/humans instantly identify priority without reading full content.

โœ… Pre-Session Health Check

Ensure clean state before agent startup

๐Ÿš€ Startup Checklist (Run Before Every Session)

1๏ธโƒฃ
Check Bootstrap Endpoint
GET /v1/bootstrap
Loads identity + critical context in one call. Verify identity fields are populated.
2๏ธโƒฃ
Verify Critical Rules Exist
GET /v1/keys?prefix=critical:
If count == 0: โš ๏ธ WARNING โ€” no critical rules set. Agent may behave unexpectedly.
3๏ธโƒฃ
Review Pending Memories
GET /v1/keys?prefix=pending:
If count > 10: โš ๏ธ Review backlog. Unverified content piling up.
4๏ธโƒฃ
Load User Preferences
GET /v1/keys?prefix=user:pref:
Personalization context. If empty: agent will ask preferences every session (bad UX).
5๏ธโƒฃ
Check Stale Keys (Optional)
GET /v1/keys?prefix=low:
If low:* keys > 100: consider archiving. Bloat slows retrieval.

๐Ÿค– Automated Health Check Script

Add this to your AGENTS.md or run it in heartbeat.

#!/bin/bash
# AgentMem Health Check

echo "๐Ÿ” Running pre-session health check..."

# 1. Bootstrap
bootstrap=$(curl -s -H "Authorization: Bearer $API_KEY" \
  https://api.agentmem.io/v1/bootstrap)
if [ -z "$bootstrap" ]; then
  echo "โŒ Bootstrap failed"
  exit 1
fi

# 2. Critical rules
critical=$(curl -s -H "Authorization: Bearer $API_KEY" \
  "https://api.agentmem.io/v1/keys?prefix=critical:")
critical_count=$(echo "$critical" | jq '.keys | length')
if [ "$critical_count" -eq 0 ]; then
  echo "โš ๏ธ  No critical rules set"
fi

# 3. Pending memories
pending=$(curl -s -H "Authorization: Bearer $API_KEY" \
  "https://api.agentmem.io/v1/keys?prefix=pending:")
pending_count=$(echo "$pending" | jq '.keys | length')
if [ "$pending_count" -gt 10 ]; then
  echo "โš ๏ธ  $pending_count pending memories โ€” review backlog"
fi

# 4. User preferences
prefs=$(curl -s -H "Authorization: Bearer $API_KEY" \
  "https://api.agentmem.io/v1/keys?prefix=user:pref:")
prefs_count=$(echo "$prefs" | jq '.keys | length')
echo "โœ… $prefs_count user preferences loaded"

# 5. Low-priority cleanup
low=$(curl -s -H "Authorization: Bearer $API_KEY" \
  "https://api.agentmem.io/v1/keys?prefix=low:")
low_count=$(echo "$low" | jq '.keys | length')
if [ "$low_count" -gt 100 ]; then
  echo "โš ๏ธ  $low_count low-priority keys โ€” consider archiving"
fi

echo "โœ… Health check complete"

Simple pricing

Pay with card or crypto โ€” your choice

๐Ÿ›ก๏ธ 7-Day Money-Back Guarantee โ€” Not satisfied? Full refund, no questions asked.
Free
$0/mo

For getting started

  • Store 10,000 memories free
  • 1,000 API calls/month
  • All features included
Scale
Usage

Beyond limits

  • $0.50/GB additional
  • $0.10/10k operations
  • Unlimited scale
Pay-per-use
$0.0001/op

No commitment

  • Pay per operation
  • No signup required
  • Wallet = Identity
Pro Pack
$20 USDC

500,000 credits

  • Credits never expire
  • $0.00004 per op
  • 1 GB storage

Documentation & Integrations

๐Ÿงน Memory Hygiene

Keep your memories clean and valuable

๐Ÿ—‘๏ธ When to Delete

โŒ
Outdated facts
Old API keys, expired tokens, previous addresses
โŒ
Temporary state
Session IDs, timestamps, one-time codes
โŒ
Duplicates
Same fact stored multiple times with slight variations
โŒ
Debugging logs
Raw API responses, stack traces, test data

โœ‚๏ธ How to Prune

Delete by prefix:
curl -X DELETE "https://api.agentmem.io/v1/keys?prefix=temp_" \
  -H "Authorization: Bearer $KEY"
Export โ†’ Review โ†’ Reimport:
# Export all memories
curl -H "Authorization: Bearer $KEY" \
  https://api.agentmem.io/v1/export > backup.json

# Review backup.json, remove junk
# Reimport clean memories (write script to PUT each entry)
๐Ÿ’ก Pro Tip:
Use prefixes to organize memories by type: user_pref/theme, session/2026-02-05, fact/apis โ€” makes bulk deletion easy.

๐Ÿ”ง Error Handling & Troubleshooting

Common errors and how to fix them โ€” fast

Still stuck? All API errors include "hint" and "docs" fields. Check the error response first โ€” it usually tells you how to fix it.

๐Ÿ”’

401 Unauthorized

{"error": "Invalid API key", "hint": "Check Authorization header format"}

Cause: Missing or incorrect API key.

โœ… Fix:
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.agentmem.io/v1/test-key
Forgot your key? Request a new one via email.
โ“

404 Not Found

{"error": "Key not found", "hint": "Check key name for typos"}

Cause: Key doesn't exist, or you're GETting before PUTting.

โœ… Fix:
1. Check key spelling (keys are case-sensitive)
2. Use GET /v1/keys?prefix=your:prefix to list all keys
3. Ensure you PUT the key before trying to GET it
๐Ÿšฆ

429 Too Many Requests

{"error": "Rate limit exceeded", "hint": "Wait 60s or upgrade plan"}

Cause: Too many API calls in a short time window.

โœ… Fix:
1. Implement exponential backoff (retry after 1s, 2s, 4s...)
2. Batch requests: Use GET /v1/keys?prefix=* instead of individual GETs
3. Upgrade plan: Pro tier has 10x higher limits
๐Ÿ“ฆ

413 Payload Too Large

{"error": "Value exceeds max size (1MB)", "hint": "Split into smaller chunks"}

Cause: Single value exceeds 1MB limit.

โœ… Fix:
// Split large values into chunks PUT /v1/data:part1 โ†’ {...} PUT /v1/data:part2 โ†’ {...} PUT /v1/data:index โ†’ ["data:part1", "data:part2"]
โฑ๏ธ

Connection Timeout

Error: ETIMEDOUT / Read timed out

Cause: Network issue or API temporarily unavailable.

โœ… Fix:
// Implement retry logic with exponential backoff max_retries = 3 for attempt in range(max_retries): time.sleep(2 ** attempt) # 1s, 2s, 4s
Check status.agentmem.io for service status.
๐Ÿฉบ

Health Check & Diagnostics

Test your API connection and key validity:

curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.agentmem.io/v1/health
{"status": "ok", "latency_ms": 12, "tier": "free"}

Still having issues? Email [email protected] with your API key (last 4 chars) and error details. We respond within 24h.

โšก Performance Benchmarks

Real numbers. Not marketing fluff.

10-20ms
GET Latency
p95
20-40ms
PUT Latency
p95
99.9%
Uptime
30-day avg

Why We're Faster

โœ… AgentMem
  • โ€ข Simple key-value store
  • โ€ข Optimized Go backend
  • โ€ข Minimal overhead
  • โ€ข Direct disk access
โฑ๏ธ Competitors
  • โ€ข Vector embeddings (50-500ms)
  • โ€ข Complex queries
  • โ€ข Database joins
  • โ€ข Semantic search overhead
When speed matters: Real-time chat, workflow orchestration, session state. When you need fast, not fancy.

๐Ÿ”’ Privacy & Security

Your data. Your wallet. Your control.

๐Ÿ” Encrypted at Rest

All data encrypted with your API key. We can't read your memories โ€” only you can.

๐ŸŒ Cross-Device

Cloud-hosted by design. Your agent has memory anywhere โ€” laptop, phone, server.

๐Ÿ’พ GDPR-Compliant

Export all your data anytime (GET /v1/export). Delete on demand. Full transparency.

๐Ÿ‘› Wallet = Identity

Pay with USDC โ€” no email, no signup forms, no KYC. Your wallet is your account.

What We Don't Do

  • โŒ No training on your data โ€” Your memories stay yours
  • โŒ No third-party sharing โ€” We don't sell, rent, or leak data
  • โŒ No analytics tracking โ€” We don't know what you store (encrypted)
  • โŒ No vendor lock-in โ€” Export anytime, host yourself if needed

Questions about security? [email protected]

๐Ÿ’ฐ Token & Cost Savings

AgentMem saves tokens by fetching memories on-demand instead of loading everything at startup

โŒ Before (No AgentMem)
  • ๐Ÿ“„ Load all 3,500 tokens of MEMORY.md
  • ๐Ÿ“„ Load all daily logs (500 tokens)
  • ๐Ÿ“„ Load full conversation history (2,000 tokens)
  • Total: ~6,000 tokens loaded
  • Only ~200 tokens relevant (3% efficiency)
โ†’
โœ… After (With AgentMem)
  • ๐Ÿ“‹ Fetch bootstrap endpoint (~100 tokens)
  • ๐Ÿ” Search for relevant keys (50 tokens)
  • โœ… Fetch only needed memories (200 tokens)
  • Total: ~350 tokens loaded
  • All 350 tokens are relevant (100% efficiency)

๐Ÿ’ธ Cost Savings (gpt-4o example)

6,000
Tokens per request
(without AgentMem)
350
Tokens per request
(with AgentMem)
94%
Token reduction
(saved waste)

๐Ÿ“Š Monthly Cost (1,000 agent requests/month)

Without AgentMem
$18.00
(6M tokens ร— $3/1M)
โ†’
With AgentMem
$1.05
(350K tokens ร— $3/1M)
Savings
$16.95/mo
(pays for itself instantly)
๐Ÿ’ก Real savings: AgentMem's $0.10/month storage cost is 160ร— cheaper than the token waste it eliminates

๐Ÿ”„ Memory Lifecycle

Where AgentMem fits in your agent's memory architecture

๐Ÿง 
1. Working Memory
Conversation context, current task state, temporary variables
Lifespan: Session only
Lost after restart/compression
โ˜๏ธ
2. AgentMem (Durable)
User preferences, learned facts, decisions, important context
Lifespan: Permanent
Survives restarts, migrations, failures
๐Ÿ’พ
3. Local Archive
Daily logs, raw transcripts, long-term cold storage
Lifespan: Optional
For compliance, audit trails, backups

๐Ÿ“Š Data Flow

1
Session start: Agent calls GET /v1/bootstrap โ†’ loads identity + core context into working memory
2
During conversation: Agent fetches specific memories on-demand (GET /v1/kv/:key) when user asks about a topic
3
After learning: Agent stores new facts/preferences (PUT /v1/kv/:key) immediately to AgentMem
4
Session end: (Optional) Archive full transcript to local storage, keep only durable insights in AgentMem
๐ŸŽฏ Key Principle
Working Memory = Transient. Cleared on restart/compression.
AgentMem = Durable. Survives everything.
Local Archive = Optional. For compliance, not retrieval.

๐Ÿ“ฆ Switching from LanceDB/ChromaDB?

Migration in 3 steps. No data loss.

1

Export your existing data

Use your current DB's export tool. Save as JSON or CSV.

2

Bulk upload to AgentMem

Use the bulk upload script or loop through your data:

# Bash example
for key in $(jq -r '.[] | .key' data.json); do
  value=$(jq -r --arg k "$key" '.[] | select(.key==$k) | .value' data.json)
  curl -X PUT "https://api.agentmem.io/v1/kv/$key" \
    -H "Authorization: Bearer YOUR_KEY" \
    -d "$value"
done
3

Update your code

Replace your DB client with AgentMem SDK (npm install agentmem). Drop-in replacement for most use cases.

Need migration help? [email protected] (we respond fast)

๐Ÿ”„ Automation & Integration

Cron jobs, heartbeats, and framework examples

โฐ Periodic Memory Cleanup (OpenClaw Cron)

Set up a monthly cleanup job to prune old temporary keys and keep your namespace lean:

cron action=add job='{
  "name": "memory-cleanup",
  "schedule": { "kind": "cron", "expr": "0 4 1 * *" },
  "payload": {
    "kind": "agentTurn",
    "message": "Clean up AgentMem: 1) GET /v1/keys?prefix=temp: 2) DELETE keys older than 30d 3) Log completion"
  },
  "sessionTarget": "isolated"
}'

Runs monthly at 4 AM, removes stale temp:* keys, keeps your memory fresh.

๐Ÿ’“ Heartbeat Integration (Proactive Context Loading)

Load critical memories during heartbeat polls to keep context fresh:

# In HEARTBEAT.md
## Memory Sync (every 30 min)
1. GET /v1/bootstrap (identity + core context)
2. If user:* keys updated_at > last_heartbeat:
   - Fetch new user:pref:* keys
   - Update local context
3. Log sync completion

Keeps your agent in sync with user preferences without explicit fetches.

๐Ÿ› ๏ธ Framework Integration Examples

๐Ÿฆœ LangChain

from langchain.memory import ConversationBufferMemory
import requests

class AgentMemMemory(ConversationBufferMemory):
    def save_context(self, inputs, outputs):
        r = requests.put(
            f"https://api.agentmem.io/v1/chat:history",
            headers={"Authorization": f"Bearer {api_key}"},
            data=f"{inputs}\n{outputs}"
        )
    
    def load_memory_variables(self):
        r = requests.get(
            "https://api.agentmem.io/v1/chat:history",
            headers={"Authorization": f"Bearer {api_key}"}
        )
        return {"history": r.text}

๐Ÿค– AutoGPT

// In AutoGPT config.yaml:
memory:
  type: "agentmem"
  api_key: "your_api_key"
  base_url: "https://api.agentmem.io/v1"
  
# Agent will store goals, plans, learnings:
# - goals:current
# - plan:steps
# - learnings:mistakes
# - learnings:successes

โšก OpenClaw

# Install skill: clawdhub install agentmem
# In AGENTS.md:
## Memory Persistence
Before responding, GET /v1/bootstrap for:
- user:pref:* (preferences)
- user:decision:* (past decisions)
- critical:rule:* (never-forget rules)

After learning something:
PUT /v1/learnings:{topic} "what I learned"

๐ŸŒ Raw HTTP (Any Framework)

# Bootstrap (get identity + core context)
curl -H "Authorization: Bearer $KEY" \
  https://api.agentmem.io/v1/bootstrap

# Store a preference
curl -X PUT \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: text/plain" \
  -d "dark mode" \
  https://api.agentmem.io/v1/user:pref:theme

Need a full integration guide? Open an issue on GitHub and we'll write it.

๐Ÿ”„ Migration Guide

Switching from local files, LanceDB, or other memory systems

๐Ÿ“„

From MEMORY.md / Daily Logs

If you currently store memories in MEMORY.md or daily log files:

# 1. Extract key facts from MEMORY.md
grep "^- " MEMORY.md > facts.txt

# 2. Upload to AgentMem with structured keys
while read line; do
  key="semantic:$(echo $line | md5sum | cut -c1-8)"
  curl -X PUT "https://api.agentmem.io/v1/$key" \
    -H "Authorization: Bearer $API_KEY" \
    -d "$line"
done < facts.txt

# 3. Keep MEMORY.md as canonical source (for now)
# 4. Gradually shift to AgentMem as primary
โš ๏ธ Don't delete local files immediately!

Keep local backups for 30 days while you validate AgentMem works for your workflow.

๐Ÿ”

From LanceDB / Vector Memory

If you use vector search (LanceDB, ChromaDB, Pinecone):

# Python migration script
import lancedb
import requests

db = lancedb.connect("~/.agent-memory/lance")
table = db.open_table("memories")

API_KEY = "your_api_key"
BASE = "https://api.agentmem.io/v1"

# Export all vectors to AgentMem
for row in table.to_pandas().itertuples():
    key = f"semantic:{row.topic}:{row.id}"
    requests.put(f"{BASE}/{key}",
        headers={"Authorization": f"Bearer {API_KEY}"},
        data=row.text
    )

print("Migration complete! Test AgentMem, then archive LanceDB.")
๐Ÿ’ก Note on Semantic Search

AgentMem doesn't have vector search yet (coming Q2 2026). For now, use prefix-based keys and bootstrap endpoint for retrieval. If you need vector search, keep LanceDB running in parallel until we ship it.

๐ŸŒณ

From Git Notes / Multi-Store Memory

If you use Git-backed memory stores (episodic, semantic, procedural):

# Sync episodic memories
for file in memory/episodes/*.md; do
  date=$(basename $file .md)
  curl -X PUT "https://api.agentmem.io/v1/episodic:$date" \
    -H "Authorization: Bearer $API_KEY" \
    --data-binary @$file
done

# Sync semantic graph
for entity in memory/graph/entities/*.md; do
  name=$(basename $entity .md)
  curl -X PUT "https://api.agentmem.io/v1/entity:$name" \
    -H "Authorization: Bearer $API_KEY" \
    --data-binary @$entity
done

# Sync procedural workflows
for workflow in memory/procedures/*.md; do
  name=$(basename $workflow .md)
  curl -X PUT "https://api.agentmem.io/v1/workflow:$name" \
    -H "Authorization: Bearer $API_KEY" \
    --data-binary @$workflow
done
๐Ÿ”€

Recommended: Hybrid Approach

You don't have to migrate everything. Use AgentMem for what it's best at:

โœ… AgentMem For:
  • โ€ข User preferences
  • โ€ข Session state
  • โ€ข Cross-device sync
  • โ€ข Cached API responses
  • โ€ข Task queues
๐Ÿ”ต Keep Local For:
  • โ€ข Full conversation transcripts
  • โ€ข Large files / media
  • โ€ข Git audit trail
  • โ€ข Vector search (until we ship it)
  • โ€ข Private / sensitive data

Best practice: Use AgentMem as your "hot" memory (frequently accessed), and keep local files as your "cold" archive (rarely accessed, but permanent).

๐Ÿ“š Practice Guide: When to Use AgentMem

Decision framework for agent memory operations

Decision Matrix

Scenario Use AgentMem When... Keep Local When...
User Preferences โœ… Needs cross-device sync
โœ… Changes frequently
โœ… Used in multiple sessions
๐Ÿ”ต Device-specific settings
๐Ÿ”ต Rarely accessed
Conversations โœ… Recent context (<7 days)
โœ… Summaries/key decisions
โœ… Cross-session state
๐Ÿ”ต Full transcripts (>7 days)
๐Ÿ”ต Audit trail
๐Ÿ”ต Large files
Facts & Decisions โœ… Frequently recalled
โœ… Shared across agents
โœ… Needs real-time access
๐Ÿ”ต Historical archive
๐Ÿ”ต Git-backed audit
๐Ÿ”ต Rarely queried
Procedural Memory โœ… Common workflows
โœ… Quick reference needed
โœ… Frequently updated
๐Ÿ”ต Long-form documentation
๐Ÿ”ต Stable procedures
๐Ÿ”ต Large code samples
Sensitive Data โš ๏ธ Never โœ… Always keep local
โœ… Use encrypted storage
โœ… Audit access carefully
๐Ÿ”

Recall Pattern

On session start, load critical context in this order:

# 1. Bootstrap (identity + usage stats)
curl https://api.agentmem.io/v1/bootstrap \
  -H "Authorization: Bearer $KEY"

# 2. User preferences (frequently accessed)
curl https://api.agentmem.io/v1/user:prefs

# 3. Recent session state
curl https://api.agentmem.io/v1/session:last_context

# 4. Active tasks (current work)
curl https://api.agentmem.io/v1/tasks:active

Tip: Add this to your AGENTS.md or HEARTBEAT.md as a startup routine.

๐Ÿ’พ

Storage Strategy

Use this guideline to decide what goes where:

๐Ÿ”ฅ Hot Memory (AgentMem)

Frequently accessed (multiple times per session). Examples: user preferences, session state, active tasks, recent decisions.

โ„๏ธ Cold Memory (Local Files)

Rarely accessed (once a week or less). Examples: full conversation transcripts, historical logs, large documentation.

๐Ÿ”’ Sensitive Data (Encrypted Local)

Never send to cloud. Examples: API keys, passwords, private notes, financial data. Use encrypted local storage.

๐Ÿ“– Procedural Memory: Storing "How-To" Knowledge

Teach your agent how to do things, not just what happened

What is Procedural Memory?

Unlike facts (episodic memory) or preferences (semantic memory), procedural memory stores how to do things. Think of it as "muscle memory" for agents โ€” workflows, debugging steps, API patterns, deployment procedures.

The Rule: Always capture the HOW, not just the WHAT. Future-you needs the steps.

Example: Fact vs Procedure

โŒ Fact (not helpful later):
"Fixed database connection timeout bug"
โœ… Procedure (reusable):
"How to debug DB timeouts: 1) Check pool size, 2) Enable query logging, 3) Profile slow queries, 4) Adjust timeout config"

Procedure Template

Use this structure when storing workflows in AgentMem:

# How to [Task Name]

**What it is:** One-sentence purpose
**When to use:** Triggering conditions
**Complexity:** Trivial | Easy | Medium | Hard

## Procedure
1. Step 1 with specific command/action
2. Step 2 with expected output
3. Step 3 with validation check

## Gotchas
- Common mistake 1 (and how to avoid it)
- Common mistake 2 (and recovery steps)

## References
- Related procedure: [[other-workflow]]
- Documentation: [URL]

**Last updated:** YYYY-MM-DD

Storage example: PUT procedure:debug_db_timeout with the full template as the value.

Example: Deploy API Service

# How to Deploy API Service

**What it is:** Deploy backend to production
**When to use:** After tests pass on staging
**Complexity:** Medium

## Procedure
1. Run tests: npm test
2. Build: npm run build
3. Push Docker image: docker push repo/api:latest
4. Update k8s: kubectl apply -f k8s/deployment.yaml
5. Verify: curl https://api.example.com/health

## Gotchas
- Check env vars match production (.env.prod)
- Wait 30s for health check before routing traffic
- If rollback needed: kubectl rollout undo deployment/api

**Last updated:** 2026-02-04

Example: Resolve Merge Conflict

# How to Resolve Merge Conflicts

**What it is:** Manual merge conflict resolution
**When to use:** git merge fails with conflicts
**Complexity:** Easy

## Procedure
1. See conflicts: git status
2. Open file with <<<<<<< markers in editor
3. Choose: keep ours, theirs, or blend both
4. Remove markers (<<< === >>>)
5. Stage: git add [file]
6. Commit: git commit (no -m, keep auto message)

## Gotchas
- Don't commit with markers still present (breaks syntax)
- Test after resolving (conflicts may break logic)

**Last updated:** 2026-01-30

Why This Matters

Agents with procedural memory don't need to re-learn workflows every session. They can:

Recommendation: Start with your 3 most common workflows. Store them as procedure:* keys. Update after every time you refine the process.

๐Ÿ”„ Session Lifecycle: When to Flush Memory

Critical moments to save context before it's lost

The Problem: Context Loss

Agent sessions have limited context windows. When the window fills up, older messages get "compressed" or dropped. Important decisions, preferences, and learnings can be lost forever.

Critical insight: Memory operations aren't just about storing data โ€” they're about when you store it. Save too late, and it's already compressed.

Session Lifecycle

1. Session Start โ€” Load critical context from AgentMem
2. Working Phase โ€” Accumulate context in RAM
3. Pre-Compaction โ€” CRITICAL: Flush to AgentMem
4. Compaction โ€” Older context compressed/dropped
5. Resume โ€” Re-load from AgentMem if needed

When to Flush to AgentMem

๐ŸŽฏ

After Important Decisions

When user makes a strategic choice, immediately flush to memory:

PUT decision:plan_choice = "Chose Pro plan, wants crypto payments"
๐Ÿ“š

After Learning New Workflow

Solved a problem? Document the steps before context compacts:

PUT procedure:fix_cors = "1) Check headers, 2) Update nginx config..."
โฐ

Before Long-Running Tasks

If agent will be idle for hours (compiling, deploying), flush state first:

PUT session:context = "Building v2.1.0, deploy in progress..."
๐ŸŒ™

End of Session

Before agent sleeps, checkpoint all learnings from today:

PUT episodic:2026-02-05 = "Learned X, fixed Y, decided Z"
๐Ÿ”

Context Window >80%

If context usage is high, proactively flush important items:

# Check: count messages, flush if >50
๐ŸŽ“

After Mistakes

Document failures so future-you doesn't repeat them:

PUT gotcha:jwt_expiry = "Always check exp claim, not iat"

Implementation: Add to AGENTS.md

Teach your agent when to flush memory with this workflow:

## Memory Flush Protocol

**When to flush to AgentMem:**
1. After important decisions โ†’ PUT decision:*
2. After solving problems โ†’ PUT procedure:*
3. Before long-running tasks โ†’ PUT session:context
4. End of day โ†’ PUT episodic:YYYY-MM-DD
5. After mistakes โ†’ PUT gotcha:*

**Example bash helper:**
#!/bin/bash
# flush-memory.sh โ€” Save current session context to AgentMem

SUMMARY="$1"
DATE=$(date +%Y-%m-%d)
KEY="episodic:$DATE"

curl -X PUT "https://api.agentmem.io/v1/$KEY" \
  -H "Authorization: Bearer $AGENTMEM_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"value\": \"$SUMMARY\"}"

echo "Flushed to AgentMem: $KEY"

**Usage:** ./flush-memory.sh "Deployed v2.1.0, fixed CORS bug"

Troubleshooting

Common issues and quick fixes

๐Ÿ”‘ 401 Unauthorized

If you get a 401 error, check your Authorization header format:

Authorization: Bearer your_api_key_here

Common mistake: Missing "Bearer " prefix or extra whitespace.

๐Ÿ” 404 Not Found

Keys must exist before you can GET them. Use PUT to create:

curl -X PUT https://api.agentmem.io/v1/my-key \
-H "Authorization: Bearer $KEY" \
-d '{"value": "..."}'

โฑ๏ธ 429 Rate Limited

Current limit: 10 requests/second per API key. Add a small delay between requests:

time.sleep(0.1) # Python
await new Promise(r => setTimeout(r, 100)) // JS

๐Ÿ“ฆ 400 Bad Request

Common causes:

  • Key contains invalid characters (use a-zA-Z0-9_- only)
  • Value exceeds 1MB size limit
  • Missing Content-Type header for binary data
Content-Type: application/json # for JSON
Content-Type: text/plain # for text

๐ŸŒ CORS / Browser Issues

If making requests from a browser:

  • AgentMem API supports CORS for all origins
  • Don't expose API keys in client-side code
  • Use a backend proxy for production apps

โšก Check API Health

Verify the API is responding and check your account status:

curl https://api.agentmem.io/v1/bootstrap -H "Authorization: Bearer YOUR_KEY"

Returns account limits, usage stats, and operational status.

๐Ÿ”„ Migration Issues

If bulk migration fails:

  • Use batch uploads with delays to avoid rate limits
  • Verify each key before DELETE on old system
  • Keep old data until migration is verified

โ˜๏ธ Why Cloud?

Local-first has its place. Here's why cloud memory wins for AI agents.

๐Ÿค

Multi-Agent Coordination

Local memory = isolated silos. Your Slack bot and Discord bot can't share context. Cloud memory lets all your agents stay in sync.

โšก

Zero Setup

No Docker. No databases. No embedding models. No OpenAI keys. Just curl. First API call in 30 seconds.

๐Ÿ›ก๏ธ

Durability

Your laptop crashes? Memory survives. Distributed storage with automatic backups. Not dependent on your machine's SSD.

๐Ÿ’ฐ

Cost Efficiency

Pay per use. No dedicated infrastructure. No idle VMs. No database licenses. Shared infrastructure = shared costs.

๐ŸŒ

Access Anywhere

Desktop, mobile, server โ€” same memory. No syncing, no conflicts. Works from any device, any location.

๐Ÿ“ˆ

Scales Effortlessly

100 keys or 1 million โ€” same performance. No capacity planning. No sharding. Infrastructure scales with you.

๐Ÿค” When Local Makes Sense
Privacy-critical data, air-gapped systems, offline requirements. For most AI agents? Cloud wins.

๐Ÿ–ฅ๏ธ CLI Helper

Because typing curl commands gets old fast.

~/bin/agentmem (executable wrapper)
#!/bin/bash
# AgentMem CLI Helper
# Install: curl -o ~/bin/agentmem https://agentmem.io/agentmem.sh && chmod +x ~/bin/agentmem

API_KEY="${AGENTMEM_API_KEY}"
BASE_URL="https://api.agentmem.io/v1"

if [ -z "$API_KEY" ]; then
  echo "Error: AGENTMEM_API_KEY not set"
  exit 1
fi

case "$1" in
  put)
    curl -s -X PUT "$BASE_URL/keys/$2" \
      -H "Authorization: Bearer $API_KEY" \
      -H "Content-Type: text/plain" \
      -d "$3" | jq
    ;;
  get)
    curl -s "$BASE_URL/keys/$2" \
      -H "Authorization: Bearer $API_KEY"
    ;;
  delete)
    curl -s -X DELETE "$BASE_URL/keys/$2" \
      -H "Authorization: Bearer $API_KEY" | jq
    ;;
  list)
    curl -s "$BASE_URL/keys?prefix=${2:-}" \
      -H "Authorization: Bearer $API_KEY" | jq -r '.[]'
    ;;
  *)
    echo "Usage: agentmem [put|get|delete|list]  [value]"
    exit 1
    ;;
esac
Usage Examples:
# Store a preference
agentmem put user/theme dark

# Retrieve it
agentmem get user/theme

# List all user keys
agentmem list user/

# Delete temporary data
agentmem delete temp/session-123
๐Ÿ“ฅ Download agentmem.sh

๐Ÿ› Common Failure Modes

Understanding why memory fails helps you fix it.

Symptom Root Cause Fix
Agent forgets mid-conversation Not storing in AgentMem, using context window only PUT important facts immediately
Data disappears after restart API key not persisted in environment export AGENTMEM_API_KEY in shell rc file
Agent doesn't recall stored data No GET on session start Add pre-session check to agent instructions
Sub-agents lack context Parent doesn't pass API key or namespace Include key context in spawn task prompt
Repeats same mistakes Lessons not logged to memory Store failures in lessons/ namespace
Slow retrieval (>500ms) Network latency or large values Use smaller values, batch requests, check CDN edge proximity
๐Ÿ” Still Stuck?
Check Troubleshooting section above or reach out on Twitter.

Ready to give your agent memory?

Get started in 30 seconds. Try the playground above โ€” no signup needed.