Write an entry
memory_writeRecord or update facts in shared long-term memory, keeping prior versions for undo. Search first to avoid duplicates.
Instructions
Record a new fact, or update an existing one (same scope + name updates it in place).
Search first (memory_search) to avoid creating a duplicate under a
different name. An update keeps the previous version in
memory_history and is logged in memory_events, so it can be undone.
Updating an archived entry is refused: restore it first with
memory_restore. Secret-shaped values in content (API keys, tokens,
password: ... lines) are replaced by [REDACTED] before storage; if
any were, the result includes "redacted": [<codes>].
Returns {"ok": true, "id": ...} on success, or {"ok": false, "error": ...} for an invalid argument, a conflict (stale expected_updated_at or archived entry) or a busy database (retry). Not available on read-only connections.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Short kebab-case slug, unique within the scope. Reusing an existing scope + name updates that entry. | |
| type | Yes | Kind of fact: user (who the user is), feedback (guidance on how to work, with the reason), project (ongoing work, decisions, constraints) or reference (pointers to external resources). | |
| scope | Yes | Project/topic scope the entry belongs to, e.g. a project folder name (list them with memory_scopes). On a scope-locked connection (--scope), this argument is ignored and the connection's own scope is used. | |
| content | Yes | The full memory content, Markdown allowed. Never put secrets here: secret-shaped values are redacted. | |
| description | No | One-line summary of what this entry covers, shown in search results. Truncated beyond 500 characters. | |
| expected_updated_at | No | Optional optimistic lock: the updated_at value you read with memory_get. If the entry changed since, nothing is written and a conflict error is returned. Omit to write unconditionally. |