Building Custom AI Skills with InstructLab Taxonomy
Create domain-specific AI capabilities using InstructLab's taxonomy system—from writing skill definitions to generating synthetic training data and validating fine-tuned models.
AI agents running through OpenClaw process long conversations that eventually hit token limits. When that happens, the gateway performs context compaction — trimming older messages to free up token budget. Without memory flush, any knowledge from those trimmed messages is lost forever.
OpenClaw’s memory flush feature intercepts the compaction cycle to give the agent a final chance to write important information to durable storage before old context is discarded. Think of it as the agent’s opportunity to take notes before the whiteboard is erased.
Long conversation → Token threshold reached → Memory flush fires
→ Agent writes notes → Context compacted → Conversation continuesThe flush happens at a soft threshold — before the hard token limit forces an immediate truncation. This gives the agent adequate space to generate a meaningful summary or store key facts.
All memory flush settings live under agents.defaults.compaction.memoryFlush in the OpenClaw config. Use the CLI to configure each setting:
docker compose run --rm openclaw-cli config set \
agents.defaults.compaction.memoryFlush.enabled trueOutput confirms the config change:
Config overwrite: /home/node/.openclaw/openclaw.json
(sha256 d6d04328... -> dd9c4954..., backup=openclaw.json.bak)
Updated agents.defaults.compaction.memoryFlush.enabled.
Restart the gateway to apply.The softThresholdTokens value determines how many tokens remain before the flush fires. Set it high enough that the agent has room to write its notes:
docker compose run --rm openclaw-cli config set \
agents.defaults.compaction.memoryFlush.softThresholdTokens 4000With 4000, the agent gets approximately 4,000 tokens of breathing room — enough for a detailed summary or several memory notes.
The system prompt is injected when the memory flush fires, giving the agent its instructions:
docker compose run --rm openclaw-cli config set \
agents.defaults.compaction.memoryFlush.systemPrompt \
"Session nearing compaction. Store durable memories now."Keep this concise — it consumes tokens from the agent’s remaining budget.
The prompt field is the actual user-turn message sent to the agent during the flush:
docker compose run --rm openclaw-cli config set \
agents.defaults.compaction.memoryFlush.prompt \
"Write any lasting notes to memory/YYYY-MM-DD.md; reply with NO_REPLY if nothing to store."The NO_REPLY convention prevents the agent from generating unnecessary output when there’s nothing worth saving.
docker compose restart openclaw-gatewayEach CLI config set command modifies the JSON config file at /home/node/.openclaw/openclaw.json. OpenClaw tracks changes via SHA-256 hashes and creates .bak files:
sha256 d6d04328... -> dd9c4954... (enabled)
sha256 dd9c4954... -> 00585ebf... (softThresholdTokens)
sha256 00585ebf... -> 77d13c91... (systemPrompt)
sha256 77d13c91... -> 8cd96c63... (prompt)This creates an audit trail — you can always diff .bak files to see what changed.
After all four commands, the relevant section in openclaw.json looks like:
{
"agents": {
"defaults": {
"compaction": {
"memoryFlush": {
"enabled": true,
"softThresholdTokens": 4000,
"systemPrompt": "Session nearing compaction. Store durable memories now.",
"prompt": "Write any lasting notes to memory/YYYY-MM-DD.md; reply with NO_REPLY if nothing to store."
}
}
}
}
}| Setting | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Activates memory flush before compaction |
softThresholdTokens | number | — | Token count that triggers pre-compaction flush |
systemPrompt | string | — | System instruction injected during flush |
prompt | string | — | User-turn message sent to agent during flush |
Your flush prompt should tell the agent:
Structured notes:
Write key decisions and context to memory/YYYY-MM-DD.md using bullet points.
Include: user preferences, project state, open questions.
Reply NO_REPLY if nothing significant to record.Minimal footprint:
Save essential context to memory/session-notes.md. Be brief. NO_REPLY if empty.Project-specific:
Update memory/project-status.md with: current task, blockers, next steps.
Append rather than overwrite. NO_REPLY if no changes.After configuration, trigger a compaction by running a long conversation and check the gateway logs:
docker logs openclaw-openclaw-gateway-1 | grep -i "memoryFlush\|compaction\|flush"You should see config change detection in the logs:
[reload] config change detected; evaluating reload
(meta.lastTouchedAt, agents.defaults.compaction.memoryFlush)
[reload] config change applied
(dynamic reads: meta.lastTouchedAt, agents.defaults.compaction.memoryFlush)Flush not firing:
enabled is true — run docker compose run --rm openclaw-cli config get agents.defaults.compaction.memoryFlush.enabledsoftThresholdTokens is set to a reasonable valueAgent not writing files:
docker exec -it openclaw-openclaw-gateway-1 sh -lc 'ls -la /home/node/.openclaw/memory'Empty or unhelpful notes:
prompt to be more specific about what to savesoftThresholdTokens to give the agent more roomAI & Cloud Advisor with 18+ years experience. Author of 8 technical books, creator of Ansible Pilot. Speaker at KubeCon EU & Red Hat Summit 2026.
Create domain-specific AI capabilities using InstructLab's taxonomy system—from writing skill definitions to generating synthetic training data and validating fine-tuned models.
How to access the OpenClaw Control UI dashboard from an Azure VM — via SSH tunnel (secure) or public IP. Covers device pairing, dashboard authentication, and the browser-based management interface.
End-to-end guide to building a complete persistent memory system for your OpenClaw AI agent. Combine memory flush, hybrid search, file-backed notes, SQLite indexing, and session hooks into a cohesive knowledge architecture.