> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linksee.app/llms.txt
> Use this file to discover all available pages before exploring further.

# remember

> Save, update, or delete memories — and, in the same call, enforce a decision

The unified write tool. `content` is the only required field for a new memory; everything an agent used to have to invent — entity, kind, layer — is defaulted. Add `anchor` and the memory is also declared as a drift anchor the guard re-injects before Edit/Write/Bash and on session start.

Memories are readable from **any** agent the user connects — Claude Code, Cursor, Windsurf, Codex, Gemini CLI.

## Modes

### Create (default)

```json theme={null}
{ "content": "Postgres is the primary store. MongoDB rejected: it does not meet the strong-consistency requirement." }
```

Defaults: `entity_name` = the project you are in (workspace roots, else the files edited recently), `entity_kind` = `project`, `layer` = `context` (or `learning` when `anchor` is set). The response reports `entity_inferred_from` when the entity was defaulted.

### Create + enforce

```json theme={null}
{
  "content": "Postgres is the primary store. MongoDB rejected: it does not meet the strong-consistency requirement.",
  "anchor": { "violation_signal": ["mongoose", "MongoClient"], "affects": ["src/db/**"] }
}
```

Stores the memory **and** declares a drift anchor from it, linked both ways (`content.anchor_id` ↔ the anchor's `source_memory_id`). With `violation_signal` the anchor is a `decision` the gate can contradict; without, it is an honest `constraint` — re-injected on boot and when its scope is touched, and the response says so. An invalid anchor spec never loses the memory (`anchor_error` is returned alongside the saved `memory_id`).

`anchor` accepts `true`, `{}`, or `{ kind?, violation_signal?, affects?, detect_terms?, domain?, rationale? }`.

### Update

```json theme={null}
{ "memory_id": 512, "content": "…", "importance": 0.9 }
```

Only `content`, `layer` and `importance` change. Used by the distill loop: rewrite a raw auto-captured memory into a clean what/why and include `"distilled": true` in the content JSON.

### Delete

```json theme={null}
{ "memory_id": 512, "forget": true }
```

Caveat-layer and pinned memories cannot be deleted. Update them instead.

## Parameters

| Name          | Type             | Description                                                                                                                                                                      |
| ------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `content`     | string           | **Required for create.** Plain text, or structured JSON with `altitude` / `type` / `state` / `what` / `why`. Plain text is wrapped automatically.                                |
| `anchor`      | boolean · object | Also declare an enforceable decision. See above.                                                                                                                                 |
| `entity_name` | string           | What the memory is about. Optional — defaults to the current project.                                                                                                            |
| `entity_kind` | string           | `person` · `company` · `project` · `concept` · `file` · `other`. Defaults to `project`.                                                                                          |
| `layer`       | string           | `goal` · `context` · `emotion` · `implementation` · `caveat` · `learning`. Aliases accepted (`decisions` → learning, `warnings` → caveat, `why` → goal, `how` → implementation). |
| `importance`  | number           | 0–1. ≥ 0.9 pins the memory (protected from forgetting).                                                                                                                          |
| `thread_id`   | string           | Group related memories (decision chains).                                                                                                                                        |
| `memory_id`   | number           | Update or delete an existing memory.                                                                                                                                             |
| `forget`      | boolean          | With `memory_id`: delete.                                                                                                                                                        |
| `force`       | boolean          | Bypass the paste-back quality check.                                                                                                                                             |

## Response

```json theme={null}
{
  "ok": true,
  "memory_id": 512,
  "entity_id": 7,
  "layer": "learning",
  "pinned": false,
  "entity_inferred_from": "workspace_root",
  "anchor_id": 12,
  "anchor_kind": "decision",
  "enforced": "contradictions are detected at the gate; re-injected on boot and in scope"
}
```

## Quality check

Content that looks like pasted assistant output, a CI log, or an external paste is rejected with `rejected: "quality_check"`. Summarise it in your own words, or pass `force: true` if it really is original.

## When to call

* The moment an error or failure occurs → `layer: "caveat"`
* When a decision is made or approved → `content` + `anchor: {}`
* When a goal is set → `layer: "goal"`
* When the user says "remember this" / 「覚えておいて」
