Chain-of-thought distillation
Beta in docs/STATUS.md. Mnemosyne is alpha, on the 3.6.x line, and the API
can still change within 3.x.
A reasoning memory stores a question, the steps taken and the conclusion.
Distillation is three calls around that kind: resolve before reasoning,
record after, and feedback when a cached chain was reused.
Resolve
curl -X POST http://localhost:3939/reasoning/resolve \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{"query": "Why does robot 14 miss its dock after a firmware update?", "topicKey": "larkspur/docking-drift"}'The server looks for a chain in two steps (packages/server/src/routes/reasoning.ts):
- If
topicKeyis given, an exact lookup by topic key. - Otherwise, or on a miss, it embeds the query and searches the five nearest chains.
A chain is served only when all of these hold (resolveDecision in
packages/core/src/cognitive/reasoning.ts):
- its status is
activeorgolden, - its worth is above 0.5,
- the Wilson lower bound of its success and failure counts is above 0.3,
- and, for the vector path, its cosine with the query is at least 0.88.
A hit returns the chain:
{
"action": "hit",
"reasoning_id": "...",
"cached_cot": [{ "step": 0, "reasoning": "...", "conclusion": "..." }],
"conclusion": "...",
"suggested_model": "haiku"
}A miss returns {"action": "execute", "similar_attempts": [...]} with up to
three near chains and their cosine. Without an embedding provider, a topic-key
miss returns execute with an empty list.
Record
curl -X POST http://localhost:3939/reasoning/record \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{
"question": "Why does robot 14 miss its dock after a firmware update?",
"chain": [
{"step": 0, "reasoning": "The miss started the day firmware 4.2.0 shipped."},
{"step": 1, "reasoning": "4.2.0 changed the default docking offset.", "conclusion": "The offset is the cause."}
],
"conclusion": "Restore the docking offset from 4.1 after the update.",
"topicKey": "larkspur/docking-drift",
"outcome": "success"
}'outcome is success (the default) or fail. If a stored chain has a cosine
of at least 0.95 with the new one, the server updates that chain’s worth and
use count; otherwise it stores a new chain.
Feedback
curl -X POST http://localhost:3939/reasoning/feedback \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{"reasoning_id": "REASONING_ID", "outcome": "fail"}'Feedback moves the chain’s worth and can change its status
(lifecycleTransition):
| Condition | Status |
|---|---|
| Worth below 0.3 | quarantined; never served |
| Worth above 0.8 with at least 50 uses | golden |
| Quarantined and worth back to 0.3 or more | active |
An unused chain loses evidence over time, with a 90-day half-life, and a weekly job prunes the library.
Not in default recall
POST /recall does not return reasoning chains unless you pass
"kinds": ["reasoning"]. A discarded line of reasoning reads like a
conclusion, so it is kept out of ordinary recall.
See also
- Memory Worth
- MCP
memory_reasoning: actionscreate,get,list,patch,archive,resolve,recordandfeedback