memory_add
Store team-wide standing preferences, constraints, and directives that get injected into every dispatched agent's prompt, so cross-task rules no longer need to be copied into each prompt by hand.
Instructions
Add a direction-layer memory — the team's shared, cross-task standing preferences.
The direction layer = low-frequency, high value-density, cross-task long-lived preferences/corrections/constraints/design intent. Every dispatched agent is injected with the direction layer at birth, so preferences like "everything in Chinese" and "report as soon as done" no longer need to be hand-copied into prompts.
Write test (soft threshold): how many future tasks can this entry affect? One that affects only a single task → goes to task_memo_add (the episodic layer); do not write it here.
The volume red line is a single axis: storage cap = injection budget. The direction layer counts character quotas per bucket — global 1200 characters + each project 1500 characters + user 300 characters; one session actually inherits 3000 characters; a single entry is still ≤ 400 characters. Whatever fits in storage is guaranteed to be delivered, and what cannot be written truly has no room: when over the limit, this tool returns that bucket's full set of valid entries (id / kind / character count / full text) + the usage gap, requiring you to first, in the same round, memory_invalidate (locatable via a content_match substring) or memory_reconcile_apply to free space, then retry this write. Rewrite over-long content into a pointer entry of the form "trigger condition + pointer to the authoritative file" (e.g. "When production/clusters/DB are involved, follow the read-only iron rule; see ~/.claude/CLAUDE.md"), with the body externalized.
Write-side safety scan: direction-layer entries enter every dispatched agent's system prompt, so invisible Unicode, prompt-injection phrasings (overriding existing instructions / extracting the system prompt / forging conversation roles), and credential shapes are uniformly refused storage.
The four kinds (which determine the injection truncation priority constraint>design>directive>preference):
constraint (prohibitions/guardrails): one sentence, machine-checkable, valid for life. E.g. "All output in Chinese", "Never automatically add an agent signature to git commits".
design (value ordering/design intent): the basis for trade-offs when no explicit instruction exists. E.g. "Technical decisions favor quality/simplicity/robustness/long-term maintainability, with little weight on development cost".
directive (methodology/working style): answers "how to do it". E.g. "On completion, report by problem → root cause → solution → verification; do not batch things up".
preference (format preferences): optional, e.g. "One sentence per line for easy diffing".
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"content": "<content>"
},
"name": "memory_add"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | constraint / design / directive / preference | preference |
| scope | No | global / project (the current project) / user (user level). Before writing to global, ask yourself: **does this hold for any session in any directory?** Anything mentioning a specific project/repo/manuscript/task is uniformly scope=project — an unregistered directory falls into this directory's fingerprint temporary bucket ("dir:..."), inherited only by this directory's sessions and never broadcast as a global memory. | global |
| content | Yes | the memory content (a single entry ≤ 400 characters, and it must fit this bucket's character | |
| supersedes | No | optional, the old memory id this entry replaces and invalidates (a changed preference = the | |
| source_refs | No | optional, a list of provenance ids (pointing back to memos/reports/meetings; used at |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||