2.3k Downloads
Overview
Automated context-health maintenance for an OpenClaw "main" session: monitors token usage, snapshots state, distills to long‑term memory, and performs hard resets of session storage to keep the assistant performant over long runs.
Key Advantages
1.Automates context cleanup based on token usage thresholds instead of requiring manual resets.
2.Creates JSON archives of conversation summaries, preserving historical context before wiping active session logs.
3.Maintains a structured long-term memory file (MEMORY.md) with recent summaries and an index of older ones.
4.Integrates with system-level controls (reset.sh) to fully clear session JSONL files and restart the openclaw-gateway service.
5.Simple to schedule via cron or another heartbeat mechanism for hands-off operation.
Use Cases
- Single-user or small self-hosted OpenClaw deployments that run a persistent "main" assistant session for long periods.
- Environments where context windows are frequently exhausted and need automated pruning to avoid degraded model performance.
- Workflows that benefit from periodic summarization and archiving of conversation state into long-term memory before resets.
- Dev/test installations where frequent hard resets of session storage are acceptable and desirable for cleanliness.
- Ops setups that want a low-overhead watchdog to keep token usage under control without manually monitoring logs.
Evaluation Scores
7.4
/ 10
Reliability
7.5
Functionality
8.0
Usability
7.0
Safety
6.5
Performance
8.5
Compatibility
7.0
Based on 1 evaluation · Latest: 3/19/2026
Download Trend
Loading...
Evaluation History (1)
7.4/103/19/2026▼
OS: win32-x64LLM: anthropic/claude-sonnet-4.5
**Judgment:** A focused, pragmatic optimizer for a single OpenClaw "main" session that trades aggressiveness (hard resets) for simplicity and sustained performance. Well-suited to self-hosted or low-stakes environments where occasional disruptive resets are acceptable.
**What it does well**
- Monitors token usage and only intervenes when a threshold is exceeded (if tokens < ~80k it exits without action).
- On trigger, follows a clear protocol: snapshot → distill → reset.
- **Snapshot:** saves a JSON summary of the current context to `archives/YYYY-MM-DD_HH-MM.json`.
- **Distill:** updates `MEMORY.md`, keeping the top 3 recent summaries and indexing older ones for long-term reference.
- **Reset:** runs `reset.sh` to wipe session JSONL files and restart the `openclaw-gateway` service.
- Simple operational model: run manually or via cron/heartbeat; minimal moving parts (Python script + shell script + archive directory).
**Key risks / caveats**
- **Data loss / disruption risk:** Hard resets wipe session JSONL files and restart the gateway. If run too frequently or at the wrong time, it can:
- Destroy in-progress conversations or ephemeral state.
- Cause brief service downtime or flapping in production.
- **Configuration sensitivity:** Paths and assumptions appear tailored to a specific OpenClaw layout (`/home/lucas/openclaw/...`, `main` session, `openclaw-gateway`). Non-matching deployments may require careful adaptation and testing.
- **Archival privacy:** JSON snapshots and `MEMORY.md` may contain sensitive user data. They need proper filesystem permissions, rotation, and possibly encryption in real deployments.
- **Limited granularity:** The reset mechanism is coarse (wipe & restart) rather than selectively trimming or compressing context, which may be too heavy-handed for multi-tenant or high-availability systems.
**Recommended scenarios**
- Self-hosted or lab/dev OpenClaw instances where:
- There is a single or primary long-lived session that tends to hit token limits.
- Occasional short downtime and session resets are acceptable.
- The operator wants an automated way to preserve high-level summaries before context is cleared.
- Power users running a personal assistant who value a clean, performant context over preserving every conversational detail.
**Use with caution** in:
- Production, multi-user, or high-availability environments where service restarts and session wipes can disrupt users.
- Regulated or sensitive domains unless archival and memory files are handled with strict security and retention policies.
Comments (0)
No comments yet. Be the first!