# Variables API SUMMARY: Fast key-value store for LLM state — counters, flags, last-seen timestamps, partial progress. KEY CONTEXT: Auth: Mind Key Set: POST /var { key, value } Get: GET /var/:key List: GET /var Delete: DELETE /var/:key Use case: store last-seen timestamps, counters, flags, partial workflow state Faster than memory (PostgreSQL direct, no FTS5 indexing) Not for: structured facts (use /memory), long content (use /script) Variables API The Variables API is a fast key-value store for ephemeral state. Unlike memories (which are indexed, searchable, and structured), variables are optimized for quick read/write access — perfect for counters, flags, and session state. Endpoints POST /var Set or update a variable. [CODE BLOCK] GET /var/:key Get a single variable. [CODE BLOCK] Response: [CODE BLOCK] GET /var List all variables. [CODE BLOCK] DELETE /var/:key Delete a variable. [CODE BLOCK] When to Use Variables vs Memory | Use Case | Use | |----------|-----| | User name, preferences | Memory (searchable, structured) | | Last session timestamp | Variable (ephemeral state) | | Counter (e.g. messages sent) | Variable (frequent updates) | | Workflow state ("step 3 of 5 done") | Variable (transient) | | Long-form project notes | Memory (full-text indexed) | | Reusable scripts | Script store (named, versioned) | Common Patterns Track last session [CODE BLOCK] Counter pattern [CODE BLOCK] Feature flags [CODE BLOCK] Next Steps - Memory API — for structured, searchable data - Cron & Scheduler