OpenClaw Skill
Trunkate AI partners directly with OpenClaw to offer an officially maintained Skill. This integration provides workspace-based prompt injection with automated lifecycle hooks for silent, “invisible” memory management.
Installation
The recommended method is via ClawdHub, which automatically manages dependencies and hook registration.
# Install the Trunkate AI skill
clawdhub install trunkate-ai
# Set your API key
export TRUNKATE_API_KEY="tk_live_1234..."Lifecycle Hooks
Trunkate operates primarily via automated triggers. Configure these in your .openclaw/config.json to ensure memory is managed as a background utility.
Proactive Pruning (PreRequest)
Prunes history before every LLM call to maintain constant context density.
{
"hooks": {
"PreRequest": [
{
"type": "command",
"command": "python3 hooks/openclaw/pre_request.py"
}
]
}
}Emergency Recovery (OnError)
Triggers on context failures (e.g., 400/429 errors) to perform emergency history stabilization.
{
"hooks": {
"OnError": [
{
"type": "command",
"command": "python3 scripts/error_detector.py"
}
]
}
}Preservation Hierarchy
To protect critical project requirements, Trunkate follows a strict semantic preservation hierarchy:
| Content Type | Priority | Strategy |
|---|---|---|
| Atomic Blocks | Critical | 100% Verbatim; wrap in [KEEP] tags. |
| System Rules | Critical | 100% Verbatim; never sent to API. |
| Active Goal | High | Full fidelity retention of user intent. |
| Recent Turns | High | Verbatim retention of last 3-5 turns. |
| Logic Blocks | Medium | Semantic compression via Trunkate API. |
| Large Logs | Low | Summary transformation (error extraction). |
Environment Variables
| Variable | Requirement | Purpose |
|---|---|---|
TRUNKATE_API_KEY | Required | Authentication for the API. |
TRUNKATE_AUTO_BUDGET | Optional | Target for history (e.g., 2000 or "20%"). |
TRUNKATE_DEBUG | Optional | Enable verbose logging of hook execution. |
Note: For manual optimization or focus pivoting, use the standard openclaw bridge: openclaw "Optimize my current context for [task]".