46 lines
2.9 KiB
Markdown
46 lines
2.9 KiB
Markdown
# Memory
|
|
|
|
## memory_remember
|
|
|
|
Persist a fact that would otherwise be lost when the session ends.
|
|
|
|
**Trigger condition**: the user states a preference, constraint, or decision affecting future work; you discover a non-obvious fact about the codebase, system, or environment through any means (reading code, running commands, web searches, debugging, research); a debugging session surfaces a root cause worth keeping; the user explicitly asks you to remember something. Autonomously remember architectural patterns, service relationships, API behaviors, configuration quirks, and other structural knowledge as you encounter it — do not wait for the user to ask. Do not remember ephemeral task state or trivially re-discoverable facts (e.g., a single file path with no context). Only remember environment facts that are stable, non-obvious, and would change your approach in a future session — not transient events (e.g., a host going down, a one-time error, a resource being reclaimed).
|
|
|
|
**Calling convention**:
|
|
```
|
|
call_tool: calls=[{tool: "memory_remember", args: ["<title>", "<tags_csv>", "<body>"]}]
|
|
```
|
|
- `title`: short noun phrase
|
|
- `tags_csv`: comma-separated tags; pick specific and reusable terms
|
|
- `body`: the fact, written so it stands alone without session context
|
|
|
|
**Returns**: confirmation.
|
|
|
|
**Constraints**:
|
|
- One memory per distinct fact.
|
|
- Before writing, recall on the same topic to avoid duplicates. If a closely related memory exists, update it with `file_edit` rather than creating a new one.
|
|
- Do not store stale facts. If you learn that a previously stored fact is wrong or outdated, update it with `file_edit` on the memory file path returned by `memory_recall`.
|
|
- Never delete (forget) a memory without explicit user instruction.
|
|
- There is no length limit on memory bodies. Store as much detail as needed for the fact to be useful in a future session.
|
|
- **Act autonomously.** Do not ask the user whether to remember something — if the trigger condition is met, remember it.
|
|
|
|
---
|
|
|
|
## memory_recall
|
|
|
|
Search stored memories for relevant context.
|
|
|
|
**Trigger condition**: ALWAYS recall before exploring code or starting work on a task. Memory is a first-class source of context — check it before reading files or running commands.
|
|
|
|
**Calling convention**:
|
|
```
|
|
call_tool: calls=[{tool: "memory_recall", args: ["<query>"]}]
|
|
```
|
|
- `query`: single keyword or short term — searches both filenames and body content. The underlying search is `grep -ri` with the query as a single substring, so multi-word phrases only match verbatim. Prefer single keywords over phrases to avoid missing results due to slightly different wording. For broader recall, make multiple single-keyword calls or use regex alternation (`word1\|word2`).
|
|
|
|
**Returns**: matching memory files.
|
|
|
|
**Constraints**:
|
|
- Recall at the start of a topic, not mid-task.
|
|
- If recall returns nothing relevant, proceed without it — do not tell the user that no memories were found unless they asked.
|