Procedural Memory
Detected workflows and step-by-step procedures. Automatically learned from repeated patterns or explicitly defined for agent task execution.
What Is Procedural Memory?
Procedural memory stores ordered sequences of steps that represent how to do something. Each procedure consists of steps with an order, optional conditions, and actions. Procedures can be explicitly created or automatically detected when Rekall identifies repeated patterns in your agent's behavior.
Think of it as the agent's playbook: deployment checklists, code review workflows, onboarding flows, and any multi-step process that should be consistent and repeatable.
When to Use
- •Defining repeatable workflows (CI/CD pipelines, review processes)
- •Capturing institutional knowledge about how things are done
- •Auto-detecting repeated behavioral patterns
- •Standardizing multi-step agent tasks
- •Creating checklists that agents can follow and verify
Quick Example
import Rekall from '@rekall/sdk';const rekall = new Rekall({ apiKey: 'rk_your_api_key' });const procedure = await rekall.procedural.create({name: 'Production Deployment',description: 'Standard deployment pipeline for production releases',steps: [{order: 1,action: 'Run the full test suite',condition: null,},{order: 2,action: 'Build production artifacts',condition: 'All tests pass',},{order: 3,action: 'Deploy to staging environment',condition: 'Build succeeds',},{order: 4,action: 'Run smoke tests against staging',condition: 'Staging deployment healthy',},{order: 5,action: 'Promote to production',condition: 'Smoke tests pass and manual approval received',},{order: 6,action: 'Monitor error rates for 30 minutes',condition: 'Production deployment complete',},],metadata: {team: 'platform',frequency: 'weekly',},});
Fields Reference
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Human-readable name for the procedure. |
| description | string | No | What this procedure accomplishes. |
| steps | Step[] | Yes | Ordered list of steps, each with order, action, and optional condition. |
| steps[].order | number | Yes | Position in the sequence (1-based). |
| steps[].action | string | Yes | Description of what to do at this step. |
| steps[].condition | string | null | No | Prerequisite condition for this step to execute. |
| metadata | object | No | Custom key-value pairs. |
Advanced Usage
Auto-Detection
Rekall can automatically detect procedural patterns from repeated episodic memories. When your agent performs similar sequences of actions multiple times, Rekall identifies the pattern and suggests creating a procedure.
// Enable pattern detection for a contextawait rekall.procedural.enableAutoDetection({minOccurrences: 3, // Minimum times a pattern must repeatminSteps: 2, // Minimum steps in the patternsimilarityThreshold: 0.85,});// List detected patterns awaiting confirmationconst detected = await rekall.procedural.listDetected();for (const pattern of detected) {console.log(pattern.suggestedName, pattern.steps.length, 'steps');// Confirm and save as a procedureawait rekall.procedural.confirmDetected(pattern.id);}
Conditional Steps
Steps can include conditions that must be met before execution. Conditions can reference previous step results, external state, or custom logic.
Condition evaluation
Conditions are stored as human-readable strings. When using the execution engine, the agent evaluates conditions based on context and previous step outcomes. For automated pipelines, pair with execution memory for checkpoint-based flow control.
Use Cases
Deployment Pipelines
Define the exact sequence of steps for deploying to production: test, build, stage, verify, promote, monitor. The agent follows these steps consistently.
Code Review Checklists
Create a code review procedure: check tests, verify types, review security implications, check documentation, validate performance. Ensures nothing is missed.
Onboarding Flows
Define new user onboarding steps: create account, configure preferences, connect integrations, complete tutorial. Track progress through the flow.
Incident Response
Capture incident response procedures: assess severity, notify stakeholders, investigate root cause, apply fix, write postmortem. Auto-detected from past incident handling patterns.
Best Practices
Keep steps atomic
Each step should represent a single, clear action. If a step feels like it contains multiple actions, break it into separate steps with conditions.
- 1.Write clear action descriptions. Steps should be unambiguous enough for an agent to execute without human interpretation.
- 2.Include conditions for gating. Use conditions to create decision points and prevent steps from executing prematurely.
- 3.Review auto-detected procedures. Automatic detection is a suggestion. Always review and refine before confirming.
- 4.Version your procedures. When updating a procedure, consider creating a new version rather than modifying in place.
- 5.Pair with execution memory. For long-running procedures, use execution memory to track progress and handle restarts.
