Self-editing memory
Beta in docs/STATUS.md. Mnemosyne is alpha, on the 3.6.x line, and the API
can still change within 3.x.
An agent can edit what it remembers: fix a statement, reinforce a strategy that worked, weaken a fact that misled it. Every edit goes through a policy.
The call
curl -X POST http://localhost:3939/self/edit \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{
"action": "replace",
"target": "FACT_ID",
"content": "The Larkspur Robotics warehouse fleet runs firmware 4.2.1.",
"reason": "4.2.0 was rolled back and replaced by 4.2.1 on 2026-11-18."
}'The key needs the memory:self_edit scope. The body takes action, target,
content, reason and, optionally, agentId and sessionId.
| Action | Effect |
|---|---|
append | Adds content to the target |
replace | Replaces the target’s content |
strengthen | Raises the target’s worth |
weaken | Lowers the target’s worth |
link | Joins facts in a hyperedge: target is the anchor fact and content is a comma-separated list of at least two other ids |
reflect | Runs a reflection cycle |
target is a fact id, the word profile, or strategy:{id}.
forget is accepted by the route’s schema but is not supported under the
default policy: it answers 422 with the code self_edit_forget_unsupported.
To close a fact or a strategy, use memory_forget or
DELETE /forget/{kind}/{id}.
The policy
Defaults are DEFAULT_SELF_EDIT_POLICY in
packages/core/src/cognitive/self-edit.ts.
| Setting | Default |
|---|---|
maxEditsPerSession | 5 |
maxDeletesPerDay | 3 |
maxStrengthensPerDay | 3 |
maxWeakensPerDay | 5 |
requireReason | true |
editCooldown | 300 seconds between edits of the same target |
allowEdit | own_facts, own_strategies, own_profile |
requireApproval | delete_fact, edit_entity, change_decision |
An edit over a limit is refused as rate-limited. An edit that needs approval is
not applied and the response says so:
{"applied": false, "approvalRequired": true, ...}.
reason is mandatory and is checked by the policy. It is not written to a
durable audit log yet.
Reflection
curl -X POST http://localhost:3939/self/reflect \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{"agentId": "agent_support"}'A reflection cycle (packages/core/src/cognitive/self-reflect.ts):
- Reads the agent’s most recent episodes.
- Reads which strategies each episode used and how it ended.
- Strengthens the strategies of successful episodes and weakens those of failed ones.
- Rewrites the agent profile.
- Logs the reflection as an episode.
It also runs on its own after every ten session collapses.
GET /self/profile returns the agent profile.
From MCP
memory_self_edit takes action (append, replace, strengthen, weaken,
reflect or link), target, content, reason and, optionally,
sessionId and idempotencyKey. memory_update is a shortcut for replace
on a fact: it takes factId, statement and an optional reason.