Procedural memory
Stable in docs/STATUS.md. Mnemosyne is alpha, on the 3.6.x line, and the
API can still change within 3.x.
Facts and decisions store what an agent knows. Procedural memory stores how it acts.
Three procedural kinds
| Kind | What it holds | Routes | MCP tool |
|---|---|---|---|
strategy | A trigger → action rule, with optional context | /strategies | memory_strategy |
workflow | A multi-step process with ordered steps | /workflows | memory_workflow |
skill | A stored prompt template for a repeatable task | /skills | memory_skill |
All three are searched by default recall. Their worth evidence decays with a
173-day half-life when unused, the slowest of any kind. A strategy is rated
with POST /strategies/{id}/rate and a body of {"outcome": "success"} or
{"outcome": "failure"}.
Prompt evolution
The second half of procedural memory is a loop that proposes changes to an
agent’s system prompt from how its sessions went
(packages/core/src/cognitive/procedural.ts):
- Budget gate. If the workspace’s monthly LLM spend is below
skipIfBudgetBelow, the pass is skipped, so an inactive workspace does not trigger LLM calls. - Collect the last
topKscored sessions for the agent and split them: high (score above 0.8) and low (score below 0.4). - One LLM call describes what separates the two groups and proposes a change to the prompt.
- Validate the proposal against a token budget.
- Store it as a candidate prompt version.
- A/B test over ten sessions, then activate the candidate or roll it back.
Session scores come from POST /session/{id}/feedback.
curl -X POST http://localhost:3939/procedural/optimize \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{"agentId": "agent_support"}'| Field | Default | Meaning |
|---|---|---|
agentId | Required. The agent whose prompt to evolve | |
topK | 20 | Sessions to read |
highThreshold | 0.8 | Minimum score for the high group |
lowThreshold | 0.4 | Maximum score for the low group |
skipIfBudgetBelow | 0.01 | Monthly spend, in USD, below which the pass is skipped |
The response says what happened:
{
"outcome": "created",
"promptVersionId": "...",
"transitionResult": { "action": "noop", "reason": "..." }
}outcome is created or skipped, with a reason when skipped.
transitionResult.action is activated, rolled_back or noop. The route
answers 503 when no LLM is configured. A weekly job
(mnemo.procedural.evaluate, Mondays at 03:00 UTC) runs the same evaluation.
Reading prompt versions
GET /procedural/prompt/:agent The active or candidate version, or null
GET /procedural/versions/:agent Every version, newest firstA version carries id, agentId, status, promptText, diffFromPrevious,
algorithm, trajectoriesUsed, avgScoreBefore, avgScoreAfter,
activatedAt and createdAt.
Mnemosyne stores and versions the prompt. Your agent decides whether to load the active version into its system prompt.