# memory > Agentic memory for AI agents: free to store, free to search (30/day). > $0.01 USDC on Base over x402. First 30 searches/day free per agent. ## Service Details - Service URL: https://memory.node01.org - GitHub: https://github.com/geco (submitting account) - X/Twitter: none (no official account) - Operator: node01.org (individual, Italy) ## Call POST https://memory.node01.org/api/memory/store Body: {"agent_id": "your-agent", "key": "pref", "value": "dark mode", "session_id": "my-project" (optional)} -> 200 {"ok": true, "stored": true, "write_token": "abc123...", "message": "Save this write_token!"} First call returns a write_token. Save it! All future operations require it. POST https://memory.node01.org/api/memory/store Body: {"agent_id": "your-agent", "write_token": "abc123...", "key": "lang", "value": "Italian"} POST https://memory.node01.org/api/memory/search Body: {"agent_id": "your-agent", "write_token": "abc123...", "query": "user preferences", "top_k": 5, "session_id": "my-project" (optional, omit for global search)} -> 402 with x402 payment terms ($0.01 USDC on Base) -> First 30 searches/day free (no payment needed) -> 200 {"results": [...], "free_tier": true/false, "tier": "free|starter|pro|enterprise"} POST https://memory.node01.org/api/memory/subscribe Body: {"agent_id": "your-agent", "write_token": "abc123...", "plan": "starter|pro|enterprise"} -> 402 with x402 payment terms - GET /api/health - free - GET /api/memory/stats - free (global counters) ## Payment Details - x402 version: 2 - Scheme: exact - Network: eip155:8453 (Base mainnet) - Asset: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (USDC, 6 decimals) - Facilitator: https://facilitator.payai.network (keyless, no authentication required) - payTo: 0xe9a827d9453e9b18040c25bb492a568ddd827549 ### Payment headers - Request (current, canonical): **PAYMENT-SIGNATURE** header with the signed payment proof (x402 v2). - Request (legacy alias, still accepted): **X-Payment**. Same value, both work. Prefer PAYMENT-SIGNATURE. - Response 402: **PAYMENT-REQUIRED** header with base64-encoded x402 payment terms (also present as a JSON body with the same `accepts[]` array). - Response 200: **PAYMENT-RESPONSE** header with the settlement confirmation (base64-encoded). ### Paid endpoints - POST /api/memory/search - $0.01 USDC (after 30 free/day) - POST /api/memory/subscribe - $2.00 (starter) / $9.00 (pro) / $20.00 (enterprise) ## Security - write_token is your private key to your memories. Treat it like a password. - One write_token per (IP, agent_id) pair. Tokens are bound to the IP and agent_id that created them. - Multiple agents can share the same IP (NAT, serverless, office, VPN): each agent_id gets its own token. No collision. - Without a write_token, you cannot store new memories. You can still create a token on the first store for a new (IP, agent_id) pair. - Memories are isolated per agent_id. No one can read your memories without your token. ### Token/IP-binding recovery - Tokens are bound to the (IP, agent_id) pair that created them. - First store returns a write_token AND a recovery_code (rc_...). Save both offline (chmod 600). The recovery code is shown ONCE. - If your IP changes: POST /api/memory/recover with {agent_id, recovery_code} -> issues a new write_token for the new IP. Old token still works on the original IP. Rate-limited: 5 attempts/hour. - If you lost the recovery code but still have the original IP: POST /api/memory/recovery/regenerate with {write_token} -> issues a new recovery code (old one invalidated). - If you lose both the original IP and the recovery code, memories are unrecoverable (no signup, no email). Back up the recovery code. - Key-bound auth (recommended for cloud agents): register an Ed25519 public key once from the IP that owns the token: POST /api/memory/register-key with {agent_id, write_token, public_key}. Then sign requests with headers X-Agent-Id, X-Agent-Timestamp, X-Agent-Nonce, X-Agent-Signature (canonical: METHOD\nPATH\nTIMESTAMP\nNONCE\nsha256hex(body)). The token then works from any IP. Check status: GET /api/memory/key?agent_id=... . Invalid/expired/replayed signatures -> 403 invalid_signature. The mem-mcp client does this automatically (init / register_key, key at ~/.memory01_key, chmod 600). - Base memory pattern: store a pointer (never secrets). Standard paths: Linux/macOS ~/.memory01_token, ~/.memory01_recovery and ~/.memory01_key; Windows %USERPROFILE%\.memory01_token, %USERPROFILE%\.memory01_recovery and %USERPROFILE%\.memory01_key (chmod 600). e.g. key='credentials-location', value='Token at ~/.memory01_token, recovery at ~/.memory01_recovery (chmod 600).' - If you call store without a token for an (IP, agent_id) pair that already has one, you get 403 token_required with a hint. Include the token you saved. - Retention: memories are retained indefinitely (no automatic deletion). Data persists as long as the service runs. ### Handling settled purchase with lost result - If a payment is settled but the response is lost (network error, timeout), the payment is NOT refunded. - The search was executed server-side; the result is cached for 10 seconds (cursor TTL). - Retry the same request with the same payment header within 10 seconds to get the cached result. - After 10 seconds the cursor expires (HTTP 410 `cursor_expired`): the cached page is gone and you must pay again. No partial credit is issued. - If the payer's IP changes between payment and retry, the cursor is still bound to the original write_token (not the IP), so it keeps working within the 10-second window. ### Lost write_token / subscription token after settlement - A settled subscription is credited to the **write_token** used in the purchase request. If that token is lost, the credits are recovered the same way as the token itself: - `POST /api/memory/recover` with `{agent_id, recovery_code}` -> issues a new write_token bound to the current IP, **keeping the same agent_id**. Credits and subscriptions are stored per agent_id, so they follow the agent, not the token. - If you still have the original IP: `POST /api/memory/recovery/regenerate` with `{write_token}` -> issues a fresh recovery code (old one invalidated). - If both the original IP and the recovery code are lost, the credits cannot be recovered (no signup, no email). Keep the recovery code offline in `~/.memory01_recovery` (chmod 600). ## Plans - Free: 30 searches/day (no payment needed) - Starter: $2 for 500 search credits (never expire, 200/day rate limit) - Pro: $9/month, unlimited searches (500/day rate limit, slowdown after 100) - Enterprise: $20/month, unlimited+priority (2000/day rate limit, slowdown after 500) ## Rate limits - Free tier: 30 searches/day (soft slowdown after 10, hard block after 30) - Starter: 200/day (soft slowdown after 50, hard block after 200) - Pro: 500/day (soft slowdown after 100, hard block after 500) - Enterprise: 2000/day (soft slowdown after 500, hard block after 2000) ## Best practices - Init once: POST /api/memory/init (or MCP init). Creates token, recovery code, base memories, credentials-location pointer. - Save credentials offline: ~/.memory01_token and ~/.memory01_recovery (chmod 600). Never store secrets in memory. - Upsert: re-store same key updates in place. - Base memories (max 2KB) for context; excluded from normal search, include_base=true to load. - Bootstrap conventional keys: credentials-location (sensitive), user-preferences, user-details, code-style. - Recovery: POST /api/memory/recover with recovery code on IP change. - Free tier: 30 searches/day, then $0.01 USDC. Store always free. ## Notes - Store is always free. Search is paid after 30 free/day. - Memories are scoped per write_token. - Optional session_id: scope memories to a session (e.g. "opencode-js-project1"). Omit for global search. - Session-only search: omit query to get all memories in a session, sorted chronologically (most recent first). - Cursor pagination: if results exceed top_k, a next_cursor is returned. Use cursor param to fetch next page. Cursors expire after 10 seconds. - Semantic search: 50+ languages, cross-lingual (Italian query finds English memories). Powered by multilingual embeddings. - All results include timestamps (stored_at, updated_at, searched_at). - Base memories: store with base=true (max 2KB). Excluded from normal search unless include_base=true. Sensitive base (credentials-location) never searchable; retrieve via POST /api/memory/get. - Bootstrap base memories: POST /api/memory/bootstrap {agent_id, write_token, keys?} creates conventional base memories if missing (idempotent). Default keys: credentials-location (sensitive), user-preferences, user-details, code-style. - POST /api/memory/get {agent_id, write_token, key} retrieves a single memory by key (useful for sensitive base memories). - Semantic search (v3) with multilingual embeddings. 50+ languages supported. Cross-lingual: Italian query finds English memories. Powered by paraphrase-multilingual-MiniLM-L12-v2 (384-dim, CPU-only, ~50ms/query). - Disclaimer: Not financial advice. Memory service for AI agents. ## Example The following example is an operator test (self-pay). No external settlement for memory has occurred yet. Operator test transaction (Base mainnet): - Service: memory - Endpoint: POST /api/memory/search - Price: $0.01 USDC - payTo: 0xe9a827d9453e9b18040c25bb492a568ddd827549 - Status: self-pay (operator testing) ## Data Usage Free to use. We may use anonymized, aggregated data to improve the service. ## Discovery - OpenAPI: https://memory.node01.org/openapi.json - agents.md: https://memory.node01.org/agents.md - llms.txt: https://memory.node01.org/llms.txt - x402: https://memory.node01.org/.well-known/x402 - Health: https://memory.node01.org/api/health - MCP: npm install -g mem-mcp ## Portable schema + export/import/forget - Schema: **mem01-memory@1**. One JSON object per memory; human-readable; no `_embedding`/`ip` in export. - Fields: agent_id,key,value,metadata,session_id,base,searchable,stored_at,updated_at,recorded_at,valid_from,valid_to,version,(history),(relations),(category). No secrets; `credentials-location` not searchable. - `GET/POST /api/memory/export` {agent_id, write_token|X-Agent-*, format=json|jsonl} -> mem01-memory@1. - `POST /api/memory/import` {agent_id, write_token, memories[]|jsonl} upsert per key. - `POST /api/memory/forget` {agent_id, write_token, key}. `forget dream:*` for dreams. `POST /api/memory/invalidate` {key, valid_to?} temporal invalidation not delete (keep history, bump version). `POST /api/memory/restore` {key, version?} restore from history. `min_score`,`scope`,`mode=hybrid`,`as_of`. {key, version?} restore from history. ,,,. - Temporal bi-temporal: `recorded_at`,`valid_from`,`valid_to`,`version`; `as_of` read filter in search (`POST /api/memory/search {as_of}`); invalidation vs delete; no blind overwrite. ## Dreaming — `dream=ideate` ONLY (optional, default OFF) - `POST /api/memory/dream` {agent_id, write_token|X-Agent-*, dream=ideate, since?, context?, n?}. - NOT consolidate/riorganizza. Produces a NEW idea (not already present). Does NOT modify memory. Stored in `dreams` slot `dream:`. - Slot **mem01-dream@1**: dream_id,dream=ideate,kind=idea,dream_date,dream_time,recorded_at,context,since,origins,memories_linked,category,idea,why,connection,question,next_step,llm,llm_url,llm_error,raw,schema. - Recall by `dream:*`,`dream_date`,`as_of`,`context`,`category`,`dream_id`; `POST /api/memory/search`; `POST /api/memory/forget {key: dream:}`; `category` e.g. `bad-dream`,custom. - Scheduling optional `0 7 * * *`; notify; no secrets; no external send by default. - LLM optional, **default OpenRouter `nvidia/nemotron-3-ultra-550b-a55b:free` if key configured** (key from opencode auth, not printed); else explicit `DREAM_LLM_URL`/`DREAM_LLM_MODEL`/`DREAM_LLM_KEY`; else local `llama.cpp` (:8081, not touched); else rough fallback. Nessun requisito. ## Payment headers (reconciled) - canonical `PAYMENT-SIGNATURE`; legacy `X-Payment`; `PAYMENT-REQUIRED`; `PAYMENT-RESPONSE`; no blind second payment; retained correlation. Free 30/g; Starter 500 non-expiring; Pro 9/mo 500; Enterprise 20/mo 2000. `mem-mcp`. ## Typed KG + hybrid RRF + rerank - `relations` on memories; `POST /api/memory/relate` {key,type,target}; `POST /api/memory/relations` {key}. Types: causes,contradicts,refers,owns,related,part_of,... - `POST /api/memory/search` {mode=keyword|hybrid, as_of, top_k, include_base, session_id}. `mode=hybrid`: keyword+semantic+graph in parallel, **RRF (K=60)** + rerank. keyword default unchanged. `as_of` temporal filter. ## Scheduled dreaming (optional) - Cron on host: `0 7 * * * curl -s -X POST https://memory.node01.org/api/memory/dream -H "Content-Type: application/json" -d '{"agent_id":"YOUR_AGENT","write_token":"TOKEN","dream":"ideate"}' >> /var/log/memory-dream.log 2>&1` - LLM optional, default OpenRouter free if key configured (DREAM_LLM_* overrides). No secrets in cron: use `X-Agent-*` key-bound signature or token from `~/.memory01_token` (chmod 600). Dreams saved in `dreams` slot `dream:`; recall `POST /api/memory/search {query, scope?}` or `GET export`; `POST /api/memory/forget {key: dream:}`.