refactor: rename to openclaw

This commit is contained in:
Peter Steinberger
2026-01-30 03:15:10 +01:00
parent 4583f88626
commit 9a7160786a
2357 changed files with 16688 additions and 16788 deletions

View File

@@ -7,7 +7,7 @@ read_when:
---
# Session Management & Compaction (Deep Dive)
This document explains how Moltbot manages sessions end-to-end:
This document explains how OpenClaw manages sessions end-to-end:
- **Session routing** (how inbound messages map to a `sessionKey`)
- **Session store** (`sessions.json`) and what it tracks
@@ -27,7 +27,7 @@ If you want a higher-level overview first, start with:
## Source of truth: the Gateway
Moltbot is designed around a single **Gateway process** that owns session state.
OpenClaw is designed around a single **Gateway process** that owns session state.
- UIs (macOS app, web Control UI, TUI) should query the Gateway for session lists and token counts.
- In remote mode, session files are on the remote host; “checking your local Mac files” wont reflect what the Gateway is using.
@@ -36,7 +36,7 @@ Moltbot is designed around a single **Gateway process** that owns session state.
## Two persistence layers
Moltbot persists sessions in two layers:
OpenClaw persists sessions in two layers:
1) **Session store (`sessions.json`)**
- Key/value map: `sessionKey -> SessionEntry`
@@ -54,11 +54,11 @@ Moltbot persists sessions in two layers:
Per agent, on the Gateway host:
- Store: `~/.clawdbot/agents/<agentId>/sessions/sessions.json`
- Transcripts: `~/.clawdbot/agents/<agentId>/sessions/<sessionId>.jsonl`
- Store: `~/.openclaw/agents/<agentId>/sessions/sessions.json`
- Transcripts: `~/.openclaw/agents/<agentId>/sessions/<sessionId>.jsonl`
- Telegram topic sessions: `.../<sessionId>-topic-<threadId>.jsonl`
Moltbot resolves these via `src/config/sessions.ts`.
OpenClaw resolves these via `src/config/sessions.ts`.
---
@@ -132,7 +132,7 @@ Notable entry types:
- `compaction`: persisted compaction summary with `firstKeptEntryId` and `tokensBefore`
- `branch_summary`: persisted summary when navigating a tree branch
Moltbot intentionally does **not** “fix up” transcripts; the Gateway uses `SessionManager` to read/write them.
OpenClaw intentionally does **not** “fix up” transcripts; the Gateway uses `SessionManager` to read/write them.
---
@@ -176,7 +176,7 @@ Where:
- `contextWindow` is the models context window
- `reserveTokens` is headroom reserved for prompts + the next model output
These are Pi runtime semantics (Moltbot consumes the events, but Pi decides when to compact).
These are Pi runtime semantics (OpenClaw consumes the events, but Pi decides when to compact).
---
@@ -194,12 +194,12 @@ Pis compaction settings live in Pi settings:
}
```
Moltbot also enforces a safety floor for embedded runs:
OpenClaw also enforces a safety floor for embedded runs:
- If `compaction.reserveTokens < reserveTokensFloor`, Moltbot bumps it.
- If `compaction.reserveTokens < reserveTokensFloor`, OpenClaw bumps it.
- Default floor is `20000` tokens.
- Set `agents.defaults.compaction.reserveTokensFloor: 0` to disable the floor.
- If its already higher, Moltbot leaves it alone.
- If its already higher, OpenClaw leaves it alone.
Why: leave enough headroom for multi-turn “housekeeping” (like memory writes) before compaction becomes unavoidable.
@@ -213,21 +213,21 @@ Implementation: `ensurePiCompactionReserveTokens()` in `src/agents/pi-settings.t
You can observe compaction and session state via:
- `/status` (in any chat session)
- `moltbot status` (CLI)
- `moltbot sessions` / `sessions --json`
- `openclaw status` (CLI)
- `openclaw sessions` / `sessions --json`
- Verbose mode: `🧹 Auto-compaction complete` + compaction count
---
## Silent housekeeping (`NO_REPLY`)
Moltbot supports “silent” turns for background tasks where the user should not see intermediate output.
OpenClaw supports “silent” turns for background tasks where the user should not see intermediate output.
Convention:
- The assistant starts its output with `NO_REPLY` to indicate “do not deliver a reply to the user”.
- Moltbot strips/suppresses this in the delivery layer.
- OpenClaw strips/suppresses this in the delivery layer.
As of `2026.1.10`, Moltbot also suppresses **draft/typing streaming** when a partial chunk begins with `NO_REPLY`, so silent operations dont leak partial output mid-turn.
As of `2026.1.10`, OpenClaw also suppresses **draft/typing streaming** when a partial chunk begins with `NO_REPLY`, so silent operations dont leak partial output mid-turn.
---
@@ -237,7 +237,7 @@ Goal: before auto-compaction happens, run a silent agentic turn that writes dura
state to disk (e.g. `memory/YYYY-MM-DD.md` in the agent workspace) so compaction cant
erase critical context.
Moltbot uses the **pre-threshold flush** approach:
OpenClaw uses the **pre-threshold flush** approach:
1) Monitor session context usage.
2) When it crosses a “soft threshold” (below Pis compaction threshold), run a silent
@@ -257,7 +257,7 @@ Notes:
- The flush is skipped when the session workspace is read-only (`workspaceAccess: "ro"` or `"none"`).
- See [Memory](/concepts/memory) for the workspace file layout and write patterns.
Pi also exposes a `session_before_compact` hook in the extension API, but Moltbots
Pi also exposes a `session_before_compact` hook in the extension API, but OpenClaws
flush logic lives on the Gateway side today.
---
@@ -265,7 +265,7 @@ flush logic lives on the Gateway side today.
## Troubleshooting checklist
- Session key wrong? Start with [/concepts/session](/concepts/session) and confirm the `sessionKey` in `/status`.
- Store vs transcript mismatch? Confirm the Gateway host and the store path from `moltbot status`.
- Store vs transcript mismatch? Confirm the Gateway host and the store path from `openclaw status`.
- Compaction spam? Check:
- model context window (too small)
- compaction settings (`reserveTokens` too high for the model window can cause earlier compaction)