Skip to Content

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 TypePriorityStrategy
Atomic BlocksCritical100% Verbatim; wrap in [KEEP] tags.
System RulesCritical100% Verbatim; never sent to API.
Active GoalHighFull fidelity retention of user intent.
Recent TurnsHighVerbatim retention of last 3-5 turns.
Logic BlocksMediumSemantic compression via Trunkate API.
Large LogsLowSummary transformation (error extraction).

Environment Variables

VariableRequirementPurpose
TRUNKATE_API_KEYRequiredAuthentication for the API.
TRUNKATE_AUTO_BUDGETOptionalTarget for history (e.g., 2000 or "20%").
TRUNKATE_DEBUGOptionalEnable verbose logging of hook execution.

Note: For manual optimization or focus pivoting, use the standard openclaw bridge: openclaw "Optimize my current context for [task]".

Last updated on