Let’s say you just made a decision to switch from session cookies to JWT authentication. Save this for future sessions:
memory save \ --title "Switched to JWT auth" \ --what "Replaced session cookies with JWT" \ --why "Needed stateless auth for API" \ --impact "All endpoints now require Bearer token" \ --tags "auth,jwt" \ --category "decision" \ --details "Context:We had session cookies tied to server state. API clients needed auth without cookies.Options considered:- Keep session cookies (requires sticky sessions)- Move to JWT (stateless, works everywhere)Decision:JWT with 1h expiry, refresh tokens for long-lived sessions.Tradeoffs:- Pro: stateless, scales horizontally- Con: can't revoke tokens until expiryFollow-up:Implement refresh token rotation for security."
You’ll see:
Saved: Switched to JWT auth (id: 20260301a1b2)File: ~/.memory/vault/my-project/2026-03-01-session.md
Use --details-file notes.md to load details from a file, or --details-template to scaffold a structured template automatically.
Once set up, your agent uses memory via MCP tools:
1
Session start
The agent calls memory_context to load prior decisions and context for the current project.
{ "total": 5, "showing": 5, "memories": [ { "id": "20260301a1b2", "title": "Switched to JWT auth", "category": "decision", "tags": ["auth", "jwt"], "date": "Mar 01" } ], "message": "Use memory_search for specific topics. IMPORTANT: You MUST call memory_save before this session ends if you make any changes, decisions, or discoveries."}
The agent now knows about your JWT decision before doing any work.
2
During work
When working on related topics, the agent calls memory_search to find relevant memories:
// Agent searches: "authentication"[ { "id": "20260301a1b2", "title": "Switched to JWT auth", "what": "Replaced session cookies with JWT", "why": "Needed stateless auth for API", "impact": "All endpoints now require Bearer token", "category": "decision", "tags": ["auth", "jwt"], "project": "my-project", "created_at": "2026-03-01", "score": 0.95, "has_details": true }]
The agent can fetch full details if needed using the memory ID.
3
Session end
When the agent makes changes, fixes bugs, or learns something, it calls memory_save to persist the knowledge:
This memory is now available for the next session.
The MCP tool descriptions instruct agents to save and retrieve automatically. In most cases, no manual prompting is needed. However, you can always use the CLI directly for manual memory management.
You don’t need to wait for your agent. Search memories directly:
memory search "authentication"
Output:
Results (1 found)[1] Switched to JWT auth (score: 0.95) decision | 2026-03-01 | my-project What: Replaced session cookies with JWT Why: Needed stateless auth for API Impact: All endpoints now require Bearer token Details: available (use `memory details 20260301a1b2`)