Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
docs: correct context compaction behavior and document compact command
chengyongrudc996aba2d7e
diff --git a/docs/chat-commands.md b/docs/chat-commands.mdindex c0419dae6..fc043c31f 100644--- a/docs/chat-commands.md+++ b/docs/chat-commands.md@@ -5,6 +5,7 @@ These commands work inside chat channels and interactive agent sessions:| Command | Description ||---------|-------------|| `/new` | Stop current task and start a new conversation |+| `/compact` | Summarize the current conversation context while keeping saved chat history || `/stop` | Stop the current task || `/restart` | Restart the bot || `/status` | Show bot status |diff --git a/docs/configuration.md b/docs/configuration.mdindex c5f433fda..78d2d8645 100644--- a/docs/configuration.md+++ b/docs/configuration.md@@ -2273,7 +2273,7 @@ The deprecated `agents.defaults.failOnToolError` field is silently ignored when## Auto Compact-When a user is idle for longer than a configured threshold, nanobot **proactively** compresses the older part of the session context into a summary while keeping a recent legal suffix of live messages. This reduces token cost and first-token latency when the user returns — instead of re-processing a long stale context with an expired KV cache, the model receives a compact summary, the most recent live context, and fresh input.+When a session is idle for longer than a configured threshold, nanobot summarizes its conversation context. When you return, the model receives that summary and new messages instead of replaying the messages covered by the summary. The original conversation remains in your saved chat history, but even its most recent messages are no longer included verbatim in the model's context after idle compaction.```json{@@ -2295,13 +2295,15 @@ When a user is idle for longer than a configured threshold, nanobot **proactivelHow it works:1. **Idle detection**: On each idle tick (~1 s), checks whether an idle-session scan is due. By default, the full scan runs at most once per minute.-2. **Background compaction**: Older context is summarized while the most recent messages remain available.+2. **Background compaction**: The conversation so far is summarized for the next turn.3. **Session preservation**: The complete session history remains stored for later inspection and reuse.4. **Restart-safe resume**: The compacted context remains available after a process restart.> [!NOTE]> Auto compact shortens the context sent to the model without deleting the session's structured message history.+Use `/compact` in chat to compact the current session without waiting for the idle threshold.+## TimezoneTime is context. Context should be precise.diff --git a/docs/memory.md b/docs/memory.mdindex f62187909..a39c3ca2a 100644--- a/docs/memory.md+++ b/docs/memory.md@@ -29,7 +29,9 @@ Memory moves through nanobot in two stages.### Stage 1: Consolidator-When a conversation grows large, the `Consolidator` summarizes older turns and appends the result to `memory/history.jsonl`, while keeping recent conversation available. Each summary preserves useful long-term facts and a short handoff for active work.+When a conversation grows large, nanobot summarizes the conversation covered by compaction and appends the result to `memory/history.jsonl`. The model continues with the summary and any messages after it. The original messages remain in your saved chat history, but messages covered by the summary are no longer sent to the model verbatim. Each summary preserves useful long-term facts and a short handoff for active work.++Compaction also runs after a configured period of inactivity, or when you send `/compact`. See [Auto Compact](./configuration.md#auto-compact) for idle timing and how to disable automatic idle compaction.This file is:@@ -130,6 +132,7 @@ Memory is not hidden behind the curtain. Users can inspect and guide it.| Command | What it does ||---------|--------------|+| `/compact` | Summarize the current conversation context while keeping saved chat history || `/dream` | Run Dream immediately || `/dream-log` | Show the latest Dream memory change || `/dream-log <sha>` | Show a specific Dream change |diff --git a/docs/webui.md b/docs/webui.mdindex b475d3a4a..fd6a1a7c7 100644--- a/docs/webui.md+++ b/docs/webui.md@@ -148,8 +148,10 @@ rate when reported. Provider usage may be estimated or unavailable; thesefigures are not a billing statement.When nanobot compacts context, the timeline shows its progress and outcome.-The compacted summary keeps earlier work available while recent messages remain-in context. See [Memory](./memory.md) for compaction and Dream consolidation.+The model continues with a summary and any messages after it; messages covered+by the summary remain in your chat history but are no longer sent to the model+verbatim. Use `/compact` to compact the current topic's context manually.+See [Memory](./memory.md) for compaction and Dream consolidation.## Temporary Chats