โ† All skills
Tencent SkillHub ยท Developer Tools

Trunkate AI

Semantically optimizes context history and large text blocks via the Trunkate AI API. Use when: (1) Conversation history approaches token limits, (2) Reading...

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

Semantically optimizes context history and large text blocks via the Trunkate AI API. Use when: (1) Conversation history approaches token limits, (2) Reading...

โฌ‡ 0 downloads โ˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
CHANGELOG.md, SKILL.md, assets/TRUNKATE_RULES.md, hooks/openclaw/HOOK.md, hooks/openclaw/pre_request.py, references/examples.md

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.

Upgrade existing

I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
0.20.0

Documentation

ClawHub primary doc Primary doc: SKILL.md 25 sections Open source page

Trunkate AI Skill

Semantic context optimization and automated history pruning. Trunkate AI ensures high-density reasoning by semantically compressing text via the private Trunkate API, preserving core logic and project facts while stripping redundant boilerplate, repetitive logs, and low-signal conversation turns.

Quick Reference

SituationActionSystematic PrecisionPreRequest hook triggers scripts/activator.py on every callMassive file/log ingestionRun: trunkate --text "$(cat log.txt)" --budget "20%"Context overflow errorSystem triggers scripts/error-detector.py for emergency wipeHigh token costs / LatencyProactive "Smart Buffer" maintains constant context densityCritical facts preservationWrap blocks in [KEEP] ... [/KEEP] tags for 100% fidelityReview performance ROICheck references/examples.md for semantic fidelity metricsMulti-agent context handoffCondense context before spawning sub-agents via sessions_spawnFocus pivotingUse manual prune with --task to reset reasoning attention

OpenClaw Setup (Recommended)

OpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automated lifecycle hooks for silent memory management.

Installation

Via ClawdHub (recommended): clawdhub install trunkate-ai Manual: git clone https://github.com/titus-choi/trunkate-ai.git ~/.openclaw/skills/trunkate-ai

Skill Structure

Trunkate AI follows a standardized event-driven architecture to ensure high reliability and low latency: trunkate-ai/ โ”œโ”€โ”€ assets/ # Project initialization templates โ”‚ โ””โ”€โ”€ TRUNKATE_RULES.md # User rules for "Never-Prune" blocks โ”œโ”€โ”€ hooks/ # Active lifecycle hooks โ”‚ โ””โ”€โ”€ openclaw/ โ”‚ โ”œโ”€โ”€ HOOK.md # Technical documentation for hooks โ”‚ โ””โ”€โ”€ pre_request.py # THE HOOK: Intercepts outgoing LLM calls โ”œโ”€โ”€ references/ # Technical standards and guides โ”‚ โ”œโ”€โ”€ examples.md # API usage examples (Before/After) โ”‚ โ”œโ”€โ”€ hooks-setup.md # Integration guide for Python hooks โ”‚ โ””โ”€โ”€ openclaw-integration.md # Mapping of OpenClaw variables โ”œโ”€โ”€ scripts/ # Core executable logic โ”‚ โ”œโ”€โ”€ activator.py # Main entry point (Proactive Systematic Hook) โ”‚ โ”œโ”€โ”€ error_detector.py # Reactive hook for context failures โ”‚ โ””โ”€โ”€ trunkate.py # Core API client (Python Native) โ”œโ”€โ”€ SKILL.md # This file โ”œโ”€โ”€ requirements.txt # Dependencies (requests) โ””โ”€โ”€ version.txt # Version tracking

Initialize Optimization Rules

To protect specific files or data blocks from being sent to the API, customize the local rules template: cp assets/TRUNKATE_RULES.md assets/MY_PROJECT_RULES.md

Optimization Strategy

Trunkate AI applies a semantic preservation hierarchy to ensure you never lose critical project requirements during compression.

Preservation Hierarchy (Protected Context)

Content TypePreservation PriorityStrategyAtomic BlocksCritical100% Verbatim; wrap in [KEEP] ... [/KEEP] tagsSystem InstructionsCritical100% Verbatim [KEEP]; never send to APIActive Task/GoalHighFull fidelity retention of current user intentProject FactsHighCore conventions and facts (e.g. from CLAUDE.md)Recent TurnsHighVerbatim retention of the last 3-5 conversation turnsLogic BlocksMediumSemantic compression via Trunkate APILarge Logs/DumpsLowSummary transformation (extracting error patterns)BoilerplateNoneAggressive pruning of license headers and noise

Hook Integration

Trunkate AI is designed for "Invisible Operation" via automated triggers. Configure these in your OpenClaw settings to ensure memory is managed as a background utility.

Proactive Trigger (PreRequest)

Configure this in .openclaw/config.json to prune history BEFORE every LLM call. This is the primary method for maintaining "Always-On" context efficiency. Hook Config: { "hooks": { "PreRequest": [ { "type": "command", "command": "python3 hooks/openclaw/pre_request.py" } ] } }

Error Detector (OnError)

Triggers on context failures (e.g., 429 or 400 errors from the model) to perform emergency history wipes. Error Config: { "hooks": { "OnError": [ { "type": "command", "command": "python3 scripts/error_detector.py" } ] } }

Logging & ROI Tracking

When manual or proactive pruning occurs, a summary of the action should be logged to ensure traceability.

Optimization Log Entry

Append significant optimizations to a local tracking file for review:

[TRK-YYYYMMDD-XXX] Category (e.g., proactive_prune | manual_summarization)

Logged: ISO-8601 timestamp Original Size: Token count before optimization Optimized Size: Token count after optimization ROI: Percentage reduction (e.g., 85%) Trigger: Proactive threshold | Context Error | Manual Call

Summary

One-line description of the optimized content (e.g., "Pruned 15 turns of build logs")

Preserved State

List of critical facts or logic blocks that were protected via [KEEP] or Rules.

suggested_budget_update

If reasoning quality dropped, suggest increasing TRUNKATE_AUTO_BUDGET.

Detection Triggers

Automatically trigger trunkate or advise the user to adjust the TRUNKATE_THRESHOLD when you notice these signals.

Cognitive Load (Internal Signals)

"I am repeating previous mistakes despite direct user corrections..." "I've forgotten primary project facts (e.g., which package manager to use)..." "The conversation history is 90% repetitive logs or stack traces..." "I'm having trouble focusing on the core logic due to context noise..." "I am hallucinating file paths or variable names that do not exist..."

Massive Ingestion (External Signals)

Reading a 10,000-line stack trace from a build failure. Analyzing a full npm install or pip install output. Parsing a large database schema or raw SQL dump. Processing raw data exports or multi-megabyte JSON payloads.

Environment Variables

VariableRequirementPurposeTRUNKATE_API_KEYREQUIREDAuthentication for api.trunkate.ai.TRUNKATE_AUTO_BUDGETOptionalTarget for optimized history (e.g., 2000 or "20%").TRUNKATE_API_URLOptionalOverride default for local testing or dev environments.TRUNKATE_DEBUGOptionalEnable verbose logging of hook execution to console.

Best Practices

Silent Operation: Do not announce truncation to the user; it is an infrastructure task. Transparency is maintained via log files. Contextual Tasking: When calling manually, use --task to guide the semantic summarizer (e.g. "Focus on the auth handler logic"). Protect Critical Files: Update TRUNKATE_RULES.md whenever you add a new foundational file or secret environment variables. Log Immediately: If a large tool output is generated, trunkate it before it gets buried and degrades the next reasoning step. Recursive Handling: If a block remains too large, truncate sub-modules individually before a final consolidation. Task Pivoting: Use trunkate with a new task description to clear your "mental workspace" when shifting from backend to frontend.

Integration with Multi-Agent Workflows

When spawning sub-agents (e.g., via OpenClaw sessions_spawn), use Trunkate to optimize the hand-off context: Run trunkate on the primary context with a task specific to the sub-agent's goal. Pass the high-density optimized context as the initial prompt to the sub-agent. This ensures the sub-agent has the maximum possible token space for its specialized task.

Periodic Review

Review the performance metrics and technical standards at natural breakpoints: Before major tasks: Check if history is too stale or noisy via references/examples.md. After feature completion: Evaluate the token efficiency ROI in your logs. Weekly: Tune the TRUNKATE_THRESHOLD based on your model's recent reasoning performance.

Safety Boundaries & Permissions

To comply with OpenClaw automated health/safety grades: Safety Boundaries: When performing shell execution (exec) to run local Python scripts (such as activator.py or .openclaw hooks), the skill is strictly restricted to semantic compression and logging. It contains safety boundaries to ensure it does not execute unknown payloads, access external network resources (other than api.trunkate.ai for optimization), or execute arbitrary code. Permissions: This skill does not require "Human-in-the-loop" approval because it does not perform destructive actions (like deleting tickets or pushing code). It operates purely on localized context and data streams. Trunkate AI: Ensuring your context window is always lean, dense, and effective.

Category context

Code helpers, APIs, CLIs, browser automation, testing, and developer operations.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
5 Docs1 Scripts
  • SKILL.md Primary doc
  • assets/TRUNKATE_RULES.md Docs
  • CHANGELOG.md Docs
  • hooks/openclaw/HOOK.md Docs
  • references/examples.md Docs
  • hooks/openclaw/pre_request.py Scripts