sophie-optimizer
Automated context health management for OpenClaw. Monitors token usage, snapshots memory, and resets sessions to maintain performance. Authored by Sophie.
Why use this skill?
Optimize your OpenClaw agent performance with Sophie Optimizer. Automatically manage token usage, snapshot context, and maintain memory.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/zayresz/sophie-optimizerWhat This Skill Does
The Sophie Optimizer is a specialized, autonomous maintenance utility designed for OpenClaw agents to manage long-term cognitive health. As AI sessions progress, token accumulation can lead to degradation in performance, context window overflow, and latency. This skill provides a systematic approach to context management by implementing a multi-stage lifecycle protocol: monitoring, archiving, distilling, and clearing. By automating the transition of ephemeral session data into long-term memory structures (MEMORY.md) and creating historical JSON snapshots, the skill ensures the agent remains responsive and accurate without human intervention. It serves as a digital garbage collection mechanism that preserves critical user context while discarding obsolete interaction noise.
Installation
To integrate this utility into your OpenClaw environment, ensure you have the necessary system permissions to execute scripts in the skill directory. Use the following command in your terminal:
clawhub install openclaw/skills/skills/zayresz/sophie-optimizer
Once installed, verify the file permissions for reset.sh to ensure it has execute access, as it interacts directly with the OpenClaw gateway service. It is recommended to schedule this script using a cron job (e.g., every 6 hours) to maintain consistent system hygiene.
Use Cases
- Long-term Project Management: Maintains context across weeks of work by compressing past discussions into summarized memory files.
- Agent Performance Optimization: Prevents sluggishness and high latency caused by bloated session files during extended coding or research sessions.
- Automated Logging: Creates an audit trail of session state in the archives folder for historical reference or troubleshooting purposes.
Example Prompts
- "Sophie, run the optimizer manual scan now; my context feels a bit cluttered."
- "Check the current MEMORY.md status and tell me the date of the last snapshot archived by the optimizer."
- "Execute a hard reset using the sophie-optimizer protocol to clear the current gateway session."
Tips & Limitations
- Token Threshold: The default threshold is set to 80k tokens. You can adjust this in
optimizer.pyif your specific hardware configuration supports larger context windows. - File Integrity: Ensure that
MEMORY.mdremains in a clean Markdown format; improper manual edits to this file may cause parsing errors during the distillation phase. - Critical Data: Because this tool performs a hard reset of session files, ensure all critical data you wish to keep long-term is properly summarized in the memory file before the script runs, as ephemeral chat data will be wiped.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-zayresz-sophie-optimizer": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-write, file-read, code-execution