docs: clarify memory flush behavior

This commit is contained in:
Peter Steinberger
2026-01-12 07:39:44 +00:00
parent e1150f1b93
commit 414ad72d17
4 changed files with 15 additions and 5 deletions

View File

@@ -31,10 +31,10 @@ These files live under the workspace (`agents.defaults.workspace`, default
## Automatic memory flush (pre-compaction ping)
When a session is **close to auto-compaction**, Clawdbot triggers a **silent
When a session is **close to auto-compaction**, Clawdbot triggers a **silent,
agentic turn** that reminds the model to write durable memory **before** the
context is compacted. The default prompt encourages the model to respond with
`NO_REPLY` when there's nothing to store, so the user never sees this turn.
context is compacted. The default prompts explicitly say the model *may reply*,
but usually `NO_REPLY` is the correct response so the user never sees this turn.
This is controlled by `agents.defaults.compaction.memoryFlush`:
@@ -60,6 +60,7 @@ Details:
- **Soft threshold**: flush triggers when the session token estimate crosses
`contextWindow - reserveTokensFloor - softThresholdTokens`.
- **Silent** by default: prompts include `NO_REPLY` so nothing is delivered.
- **Two prompts**: a user prompt plus a system prompt append the reminder.
- **One flush per compaction cycle** (tracked in `sessions.json`).
- **Workspace must be writable**: if the session runs sandboxed with
`workspaceAccess: "ro"` or `"none"`, the flush is skipped.

View File

@@ -25,6 +25,12 @@ All session state is **owned by the gateway** (the “master” Clawdbot). UI cl
Clawdbot trims **old tool results** from the in-memory context right before LLM calls by default.
This does **not** rewrite JSONL history. See [/concepts/session-pruning](/concepts/session-pruning).
## Pre-compaction memory flush
When a session nears auto-compaction, Clawdbot can run a **silent memory flush**
turn that reminds the model to write durable notes to disk. This only runs when
the workspace is writable. See [Memory](/concepts/memory) and
[Compaction](/concepts/compaction).
## Mapping transports → session keys
- Direct chats collapse to the per-agent primary key: `agent:<agentId>:<mainKey>`.
- Multiple phone numbers and providers can map to the same agent main key; they act as transports into one conversation.