Memories and Chat Commands
Store, fetch, and search durable JSON records from the terminal with primitive memories, and use the interactive primitive chat REPL for testing conversational flows against your account.
The primitive memories command group reads and writes Primitive Memories, the durable JSON key-value record store, directly from the terminal. primitive chat opens an interactive REPL for testing conversational flows against your account without writing a script first.
Use memories when you're debugging what a function or agent has stored, seeding state before a test run, or clearing stale keys. Use chat when you want a quick interactive session without standing up a client.
Values must be valid JSON, and memories search matches key prefixes only, not free text.
Prerequisites#
- The CLI installed and authenticated. See Authentication: login, signup, logout, whoami.
- A Primitive API key, either from
primitive logincredentials orPRIMITIVE_API_KEY.
Store and retrieve memories#
Use primitive memories set, get, search, and delete to manage durable JSON records from the terminal. Memories default to org scope. Pass --function <function-id> to read or write the same key under a function's scope instead; the value must be the function's id UUID, not its name.
- 1
Set a memory value#
Values must be valid JSON. Quote plain strings as JSON strings.
primitive memories set thread:latest '{"email_id":"em_123"}' primitive memories set greeting '"hello"'Values must be valid JSON, so a plain string has to be quoted as a JSON string: use
'"hello"', nothello. - 2
Get a memory value#
primitive memories get thread:latest - 3
Search memories by key prefix#
memories searchis key-prefix search, not free-text or semantic search. For free-text mail search useprimitive searchorprimitive semantic-searchinstead.primitive memories search thread:Pass
--metadata-onlyto list matching keys without fetching each value, useful for a quick inventory scan:primitive memories search thread: --metadata-only - 4
Delete a memory#
primitive memories delete thread:latest
Function-scoped memories#
Pass --function <function-id> on any of the four subcommands to read or write the same key under a specific function's scope instead of the org's:
primitive memories set state '{"step":2}' --function <function-id>
primitive memories get state --function <function-id>
The --function value is the function's id UUID, not its name. If you only have the name, look the id up with primitive functions list.
primitive memories delete is permanent. There is no undo and no trash/recovery period for a deleted key.
Interactive chat REPL#
primitive chat opens an interactive REPL against your account, so you can exercise a conversational flow without writing a throwaway script.
primitive chat
Inside the REPL, reply to the active thread the same way the SDK's client.reply would, including attachments:
primitive chat reply "See attached" --attachment ./report.pdf
primitive logout --force clears local CLI credentials, pending email-code auth state, and stale credential locks without contacting Primitive. Reach for it when an interrupted auth command leaves the CLI reporting that another credential operation is already in progress. See Authentication: login, signup, logout, whoami.
Next steps#
See the Node SDK's client.memories API that the CLI wraps, including org vs. function scope semantics.
Direct API Access and Generic CommandsCall the raw memories operations directly through the CLI's generic api-command shortcut.
Primitive Functions: Deploy, Route, and ManageDeploy the functions whose function-id you'll pass to --function when scoping memories.
Sending, Replying, and Searching Email from the CLIUse primitive search or semantic-search for free-text mail search instead of memories search.
Was this page helpful?