What is Procedural Memory?
Procedural memory is “how-to” knowledge — the steps an agent followed to complete a task. When you send agent session traces to Hyperspell, we automatically extract reusable step-by-step procedures from them. Later, when your agent encounters a similar task, it can query for relevant procedures and follow the same steps instead of figuring things out from scratch. Think of it as muscle memory for your agent. A human customer support rep doesn’t re-learn how to process a refund every time — they remember the steps. Procedural memory gives your agent the same capability.Why not just use regular memories?
Regular memories store what happened — facts, documents, conversations. Procedural memories store how to do things — the sequence of tool calls, decision points, and arguments needed to accomplish a task. When your agent asks “how do I send an email with an attachment?”, you want a step-by-step guide, not a transcript.- Wasted tokens re-discovering workflows that worked before
- Inconsistent behavior across sessions — the agent might solve the same task differently each time
- Slower responses because the agent reasons from scratch instead of following a known procedure
Adding Traces
To build procedural memory, send your agent’s session traces to Hyperspell using the/trace/add endpoint. Hyperspell will analyze the trace, identify completed multi-step tasks, and extract generalized procedures from them.
extract parameter defaults to ["procedure"], so you can omit it if procedure extraction is all you need.
Request parameters
Response
Trace formats
Hyperspell accepts traces in three formats. The format is auto-detected, but you can specify it explicitly with theformat parameter.
- Vercel AI SDK
- OpenClaw JSONL
- Hyperdoc (native)
If you’re using the Vercel AI SDK, pass the message history directly:
When to Add Traces
There are two natural moments to send traces to Hyperspell:At the end of a session
The simplest approach. When the user’s session ends (or after a timeout), send the full conversation history. This captures the complete context of what happened.At context compaction
Many agent frameworks compact or summarize the conversation when it gets too long. This is a natural point to flush the trace to Hyperspell — you’re already processing the history, and the pre-compaction trace contains the richest detail.You can send multiple traces for the same session. Each trace is processed independently, so procedures from different segments won’t be duplicated — the extractor only captures completed tasks within each trace.
Querying Procedures
To retrieve procedural memories, use the standard search endpoint with thememory_types filter set to ["procedure"]:
- A title — a short imperative sentence describing the task (e.g., “Find a file and email it to a team”)
- A body — numbered step-by-step instructions with tool names, arguments, and decision points
Combining with regular memories
You can search both regular memories and procedures at once by passing multiple types:memory_types, only regular memories are returned — procedures require an explicit opt-in.
Using Procedures in Your Agent
The most common pattern is to query for relevant procedures at the start of a task and inject them into the agent’s system prompt:What Gets Extracted
Not every trace produces procedures. The extraction is selective:
Procedures are also generalized — specific names, IDs, and file paths are replaced with descriptive placeholders so the procedure is reusable for similar future tasks.
Example: A trace where the agent found “Q4-2025-Sales.pdf” and emailed it to “sales-team@acme.com” produces a procedure titled “Find a file and email it to a team” with generic steps that work for any file and any recipient.