Token导航 LogoToken导航TokenDH.com
开发敏感数据clawhub未标认证来源可访问clear审计提醒

trunkate-ai树干艾

Agent Skill

trunkate-ai 用于补充开发相关能力,适合在 OpenClaw 中需要让 Agent 承接开发相关任务时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

9,361

周安装

398

GitHub Stars

1

下载量

3,280
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:trunkate-ai(树干艾)
来源仓库:https://github.com/titus-choi/trunkate-ai
安装命令:
openclaw skills install trunkate-ai
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install trunkate-ai

简介

压缩长文本上下文以提升大语言模型处理效率与成本控制。

  • 适用于对话历史接近 token 上限时的语义精简需求。
  • 采用 Trunkate AI 的 API 对输入进行向量空间优化重排。
  • 压缩过程可能丢失细节信息,关键内容建议提前备份。trunkate-ai 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 需配置有效 API key 并监控调用频次以防超额。

SKILL.md

name
trunkate-ai
description
Semantically optimizes context history and large text blocks via the Trunkate AI API. Use when: (1) Conversation history approaches token limits, (2) Reading files or logs exceeding 5,000 lines, (3) Reducing noise in complex document summaries while maintaining logic, (4) An operation returns a 'context_length_exceeded' error, (5) You need to 'reset' focus on a specific task without losing project state. Includes proactive PreRequest hooks for automated, silent context management.
version
1.0.0
author
Trunkate
bins
["python3"]
os
["macOS", "linux"]
metadata
clawdbot
emoji
✂️
os
["linux", "darwin"]
requires
bins
["python3"]
env
["TRUNKATE_API_KEY"]
install
kind
shell
command
pip install -r requirements.txt
bins
["python3"]
label
Install Python dependencies

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

SituationAction
Systematic PrecisionPreRequest hook triggers scripts/activator.py on every call
Massive file/log ingestionRun: trunkate --text "$(cat log.txt)" --budget "20%"
Context overflow errorSystem triggers scripts/error-detector.py for emergency wipe
High token costs / LatencyProactive "Smart Buffer" maintains constant context density
Critical facts preservationWrap blocks in [KEEP] ... [/KEEP] tags for 100% fidelity
Review performance ROICheck references/examples.md for semantic fidelity metrics
Multi-agent context handoffCondense context before spawning sub-agents via sessions_spawn
Focus 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 PriorityStrategy
Atomic BlocksCritical100% Verbatim; wrap in [KEEP] ... [/KEEP] tags
System InstructionsCritical100% Verbatim [KEEP]; never send to API
Active Task/GoalHighFull fidelity retention of current user intent
Project FactsHighCore conventions and facts (e.g. from CLAUDE.md)
Recent TurnsHighVerbatim retention of the last 3-5 conversation turns
Logic BlocksMediumSemantic compression via Trunkate API
Large 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

VariableRequirementPurpose
TRUNKATE_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

  1. Silent Operation: Do not announce truncation to the user; it is an infrastructure task. Transparency is maintained via log files.
  2. Contextual Tasking: When calling manually, use --task to guide the semantic summarizer (e.g. "Focus on the auth handler logic").
  3. Protect Critical Files: Update TRUNKATE_RULES.md whenever you add a new foundational file or secret environment variables.
  4. Log Immediately: If a large tool output is generated, trunkate it before it gets buried and degrades the next reasoning step.
  5. Recursive Handling: If a block remains too large, truncate sub-modules individually before a final consolidation.
  6. 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:

  1. Run trunkate on the primary context with a task specific to the sub-agent's goal.
  2. Pass the high-density optimized context as the initial prompt to the sub-agent.
  3. 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.*

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

94.83%
按下载量换算3,110

安全审计

VirusTotal

可疑

ClawScan

通过

Static analysis

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills