{
  "schemaVersion": "1.0",
  "item": {
    "slug": "trunkate-ai",
    "name": "Trunkate AI",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/titus-choi/trunkate-ai",
    "canonicalUrl": "https://clawhub.ai/titus-choi/trunkate-ai",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/trunkate-ai",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=trunkate-ai",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "CHANGELOG.md",
      "SKILL.md",
      "assets/TRUNKATE_RULES.md",
      "hooks/openclaw/HOOK.md",
      "hooks/openclaw/pre_request.py",
      "references/examples.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "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."
        },
        {
          "label": "Upgrade existing",
          "body": "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."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/trunkate-ai"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/trunkate-ai",
    "agentPageUrl": "https://openagent3.xyz/skills/trunkate-ai/agent",
    "manifestUrl": "https://openagent3.xyz/skills/trunkate-ai/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/trunkate-ai/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "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."
      },
      {
        "label": "Upgrade existing",
        "body": "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."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Trunkate AI Skill",
        "body": "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."
      },
      {
        "title": "Quick Reference",
        "body": "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"
      },
      {
        "title": "OpenClaw Setup (Recommended)",
        "body": "OpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automated lifecycle hooks for silent memory management."
      },
      {
        "title": "Installation",
        "body": "Via ClawdHub (recommended):\n\nclawdhub install trunkate-ai\n\nManual:\n\ngit clone https://github.com/titus-choi/trunkate-ai.git ~/.openclaw/skills/trunkate-ai"
      },
      {
        "title": "Skill Structure",
        "body": "Trunkate AI follows a standardized event-driven architecture to ensure high reliability and low latency:\n\ntrunkate-ai/\n├── assets/                     # Project initialization templates\n│   └── TRUNKATE_RULES.md       # User rules for \"Never-Prune\" blocks\n├── hooks/                      # Active lifecycle hooks\n│   └── openclaw/\n│       ├── HOOK.md             # Technical documentation for hooks\n│       └── pre_request.py      # THE HOOK: Intercepts outgoing LLM calls\n├── references/                 # Technical standards and guides\n│   ├── examples.md             # API usage examples (Before/After)\n│   ├── hooks-setup.md          # Integration guide for Python hooks\n│   └── openclaw-integration.md # Mapping of OpenClaw variables\n├── scripts/                    # Core executable logic\n│   ├── activator.py            # Main entry point (Proactive Systematic Hook)\n│   ├── error_detector.py       # Reactive hook for context failures\n│   └── trunkate.py             # Core API client (Python Native)\n├── SKILL.md                    # This file\n├── requirements.txt            # Dependencies (requests)\n└── version.txt                 # Version tracking"
      },
      {
        "title": "Initialize Optimization Rules",
        "body": "To protect specific files or data blocks from being sent to the API, customize the local rules template:\n\ncp assets/TRUNKATE_RULES.md assets/MY_PROJECT_RULES.md"
      },
      {
        "title": "Optimization Strategy",
        "body": "Trunkate AI applies a semantic preservation hierarchy to ensure you never lose critical project requirements during compression."
      },
      {
        "title": "Preservation Hierarchy (Protected Context)",
        "body": "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"
      },
      {
        "title": "Hook Integration",
        "body": "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."
      },
      {
        "title": "Proactive Trigger (PreRequest)",
        "body": "Configure this in .openclaw/config.json to prune history BEFORE every LLM call. This is the primary method for maintaining \"Always-On\" context efficiency.\n\nHook Config:\n\n{\n  \"hooks\": {\n    \"PreRequest\": [\n      {\n        \"type\": \"command\",\n        \"command\": \"python3 hooks/openclaw/pre_request.py\"\n      }\n    ]\n  }\n}"
      },
      {
        "title": "Error Detector (OnError)",
        "body": "Triggers on context failures (e.g., 429 or 400 errors from the model) to perform emergency history wipes.\n\nError Config:\n\n{\n  \"hooks\": {\n    \"OnError\": [\n      {\n        \"type\": \"command\",\n        \"command\": \"python3 scripts/error_detector.py\"\n      }\n    ]\n  }\n}"
      },
      {
        "title": "Logging & ROI Tracking",
        "body": "When manual or proactive pruning occurs, a summary of the action should be logged to ensure traceability."
      },
      {
        "title": "Optimization Log Entry",
        "body": "Append significant optimizations to a local tracking file for review:"
      },
      {
        "title": "[TRK-YYYYMMDD-XXX] Category (e.g., proactive_prune | manual_summarization)",
        "body": "Logged: ISO-8601 timestamp\nOriginal Size: Token count before optimization\nOptimized Size: Token count after optimization\nROI: Percentage reduction (e.g., 85%)\nTrigger: Proactive threshold | Context Error | Manual Call"
      },
      {
        "title": "Summary",
        "body": "One-line description of the optimized content (e.g., \"Pruned 15 turns of build logs\")"
      },
      {
        "title": "Preserved State",
        "body": "List of critical facts or logic blocks that were protected via [KEEP] or Rules."
      },
      {
        "title": "suggested_budget_update",
        "body": "If reasoning quality dropped, suggest increasing TRUNKATE_AUTO_BUDGET."
      },
      {
        "title": "Detection Triggers",
        "body": "Automatically trigger trunkate or advise the user to adjust the TRUNKATE_THRESHOLD when you notice these signals."
      },
      {
        "title": "Cognitive Load (Internal Signals)",
        "body": "\"I am repeating previous mistakes despite direct user corrections...\"\n\"I've forgotten primary project facts (e.g., which package manager to use)...\"\n\"The conversation history is 90% repetitive logs or stack traces...\"\n\"I'm having trouble focusing on the core logic due to context noise...\"\n\"I am hallucinating file paths or variable names that do not exist...\""
      },
      {
        "title": "Massive Ingestion (External Signals)",
        "body": "Reading a 10,000-line stack trace from a build failure.\nAnalyzing a full npm install or pip install output.\nParsing a large database schema or raw SQL dump.\nProcessing raw data exports or multi-megabyte JSON payloads."
      },
      {
        "title": "Environment Variables",
        "body": "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."
      },
      {
        "title": "Best Practices",
        "body": "Silent Operation: Do not announce truncation to the user; it is an infrastructure task. Transparency is maintained via log files.\nContextual Tasking: When calling manually, use --task to guide the semantic summarizer (e.g. \"Focus on the auth handler logic\").\nProtect Critical Files: Update TRUNKATE_RULES.md whenever you add a new foundational file or secret environment variables.\nLog Immediately: If a large tool output is generated, trunkate it before it gets buried and degrades the next reasoning step.\nRecursive Handling: If a block remains too large, truncate sub-modules individually before a final consolidation.\nTask Pivoting: Use trunkate with a new task description to clear your \"mental workspace\" when shifting from backend to frontend."
      },
      {
        "title": "Integration with Multi-Agent Workflows",
        "body": "When spawning sub-agents (e.g., via OpenClaw sessions_spawn), use Trunkate to optimize the hand-off context:\n\nRun trunkate on the primary context with a task specific to the sub-agent's goal.\nPass the high-density optimized context as the initial prompt to the sub-agent.\nThis ensures the sub-agent has the maximum possible token space for its specialized task."
      },
      {
        "title": "Periodic Review",
        "body": "Review the performance metrics and technical standards at natural breakpoints:\n\nBefore major tasks: Check if history is too stale or noisy via references/examples.md.\nAfter feature completion: Evaluate the token efficiency ROI in your logs.\nWeekly: Tune the TRUNKATE_THRESHOLD based on your model's recent reasoning performance."
      },
      {
        "title": "Safety Boundaries & Permissions",
        "body": "To comply with OpenClaw automated health/safety grades:\n\nSafety 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.\nPermissions: 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.\n\nTrunkate AI: Ensuring your context window is always lean, dense, and effective."
      }
    ],
    "body": "Trunkate AI Skill\n\nSemantic 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.\n\nQuick Reference\nSituation\tAction\nSystematic Precision\tPreRequest hook triggers scripts/activator.py on every call\nMassive file/log ingestion\tRun: trunkate --text \"$(cat log.txt)\" --budget \"20%\"\nContext overflow error\tSystem triggers scripts/error-detector.py for emergency wipe\nHigh token costs / Latency\tProactive \"Smart Buffer\" maintains constant context density\nCritical facts preservation\tWrap blocks in [KEEP] ... [/KEEP] tags for 100% fidelity\nReview performance ROI\tCheck references/examples.md for semantic fidelity metrics\nMulti-agent context handoff\tCondense context before spawning sub-agents via sessions_spawn\nFocus pivoting\tUse manual prune with --task to reset reasoning attention\nOpenClaw Setup (Recommended)\n\nOpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automated lifecycle hooks for silent memory management.\n\nInstallation\n\nVia ClawdHub (recommended):\n\nclawdhub install trunkate-ai\n\n\nManual:\n\ngit clone https://github.com/titus-choi/trunkate-ai.git ~/.openclaw/skills/trunkate-ai\n\nSkill Structure\n\nTrunkate AI follows a standardized event-driven architecture to ensure high reliability and low latency:\n\ntrunkate-ai/\n├── assets/                     # Project initialization templates\n│   └── TRUNKATE_RULES.md       # User rules for \"Never-Prune\" blocks\n├── hooks/                      # Active lifecycle hooks\n│   └── openclaw/\n│       ├── HOOK.md             # Technical documentation for hooks\n│       └── pre_request.py      # THE HOOK: Intercepts outgoing LLM calls\n├── references/                 # Technical standards and guides\n│   ├── examples.md             # API usage examples (Before/After)\n│   ├── hooks-setup.md          # Integration guide for Python hooks\n│   └── openclaw-integration.md # Mapping of OpenClaw variables\n├── scripts/                    # Core executable logic\n│   ├── activator.py            # Main entry point (Proactive Systematic Hook)\n│   ├── error_detector.py       # Reactive hook for context failures\n│   └── trunkate.py             # Core API client (Python Native)\n├── SKILL.md                    # This file\n├── requirements.txt            # Dependencies (requests)\n└── version.txt                 # Version tracking\n\nInitialize Optimization Rules\n\nTo protect specific files or data blocks from being sent to the API, customize the local rules template:\n\ncp assets/TRUNKATE_RULES.md assets/MY_PROJECT_RULES.md\n\nOptimization Strategy\n\nTrunkate AI applies a semantic preservation hierarchy to ensure you never lose critical project requirements during compression.\n\nPreservation Hierarchy (Protected Context)\nContent Type\tPreservation Priority\tStrategy\nAtomic Blocks\tCritical\t100% Verbatim; wrap in [KEEP] ... [/KEEP] tags\nSystem Instructions\tCritical\t100% Verbatim [KEEP]; never send to API\nActive Task/Goal\tHigh\tFull fidelity retention of current user intent\nProject Facts\tHigh\tCore conventions and facts (e.g. from CLAUDE.md)\nRecent Turns\tHigh\tVerbatim retention of the last 3-5 conversation turns\nLogic Blocks\tMedium\tSemantic compression via Trunkate API\nLarge Logs/Dumps\tLow\tSummary transformation (extracting error patterns)\nBoilerplate\tNone\tAggressive pruning of license headers and noise\nHook Integration\n\nTrunkate AI is designed for \"Invisible Operation\" via automated triggers. Configure these in your OpenClaw settings to ensure memory is managed as a background utility.\n\nProactive Trigger (PreRequest)\n\nConfigure this in .openclaw/config.json to prune history BEFORE every LLM call. This is the primary method for maintaining \"Always-On\" context efficiency.\n\nHook Config:\n\n{\n  \"hooks\": {\n    \"PreRequest\": [\n      {\n        \"type\": \"command\",\n        \"command\": \"python3 hooks/openclaw/pre_request.py\"\n      }\n    ]\n  }\n}\n\nError Detector (OnError)\n\nTriggers on context failures (e.g., 429 or 400 errors from the model) to perform emergency history wipes.\n\nError Config:\n\n{\n  \"hooks\": {\n    \"OnError\": [\n      {\n        \"type\": \"command\",\n        \"command\": \"python3 scripts/error_detector.py\"\n      }\n    ]\n  }\n}\n\nLogging & ROI Tracking\n\nWhen manual or proactive pruning occurs, a summary of the action should be logged to ensure traceability.\n\nOptimization Log Entry\n\nAppend significant optimizations to a local tracking file for review:\n\n[TRK-YYYYMMDD-XXX] Category (e.g., proactive_prune | manual_summarization)\n\nLogged: 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\n\nSummary\n\nOne-line description of the optimized content (e.g., \"Pruned 15 turns of build logs\")\n\nPreserved State\n\nList of critical facts or logic blocks that were protected via [KEEP] or Rules.\n\nsuggested_budget_update\n\nIf reasoning quality dropped, suggest increasing TRUNKATE_AUTO_BUDGET.\n\nDetection Triggers\n\nAutomatically trigger trunkate or advise the user to adjust the TRUNKATE_THRESHOLD when you notice these signals.\n\nCognitive Load (Internal Signals)\n\"I am repeating previous mistakes despite direct user corrections...\"\n\"I've forgotten primary project facts (e.g., which package manager to use)...\"\n\"The conversation history is 90% repetitive logs or stack traces...\"\n\"I'm having trouble focusing on the core logic due to context noise...\"\n\"I am hallucinating file paths or variable names that do not exist...\"\nMassive Ingestion (External Signals)\nReading a 10,000-line stack trace from a build failure.\nAnalyzing a full npm install or pip install output.\nParsing a large database schema or raw SQL dump.\nProcessing raw data exports or multi-megabyte JSON payloads.\nEnvironment Variables\nVariable\tRequirement\tPurpose\nTRUNKATE_API_KEY\tREQUIRED\tAuthentication for api.trunkate.ai.\nTRUNKATE_AUTO_BUDGET\tOptional\tTarget for optimized history (e.g., 2000 or \"20%\").\nTRUNKATE_API_URL\tOptional\tOverride default for local testing or dev environments.\nTRUNKATE_DEBUG\tOptional\tEnable verbose logging of hook execution to console.\nBest Practices\nSilent Operation: Do not announce truncation to the user; it is an infrastructure task. Transparency is maintained via log files.\nContextual Tasking: When calling manually, use --task to guide the semantic summarizer (e.g. \"Focus on the auth handler logic\").\nProtect Critical Files: Update TRUNKATE_RULES.md whenever you add a new foundational file or secret environment variables.\nLog Immediately: If a large tool output is generated, trunkate it before it gets buried and degrades the next reasoning step.\nRecursive Handling: If a block remains too large, truncate sub-modules individually before a final consolidation.\nTask Pivoting: Use trunkate with a new task description to clear your \"mental workspace\" when shifting from backend to frontend.\nIntegration with Multi-Agent Workflows\n\nWhen spawning sub-agents (e.g., via OpenClaw sessions_spawn), use Trunkate to optimize the hand-off context:\n\nRun trunkate on the primary context with a task specific to the sub-agent's goal.\nPass the high-density optimized context as the initial prompt to the sub-agent.\nThis ensures the sub-agent has the maximum possible token space for its specialized task.\nPeriodic Review\n\nReview the performance metrics and technical standards at natural breakpoints:\n\nBefore major tasks: Check if history is too stale or noisy via references/examples.md.\nAfter feature completion: Evaluate the token efficiency ROI in your logs.\nWeekly: Tune the TRUNKATE_THRESHOLD based on your model's recent reasoning performance.\nSafety Boundaries & Permissions\n\nTo comply with OpenClaw automated health/safety grades:\n\nSafety 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.\nPermissions: 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.\n\nTrunkate AI: Ensuring your context window is always lean, dense, and effective."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/titus-choi/trunkate-ai",
    "publisherUrl": "https://clawhub.ai/titus-choi/trunkate-ai",
    "owner": "titus-choi",
    "version": "0.20.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/trunkate-ai",
    "downloadUrl": "https://openagent3.xyz/downloads/trunkate-ai",
    "agentUrl": "https://openagent3.xyz/skills/trunkate-ai/agent",
    "manifestUrl": "https://openagent3.xyz/skills/trunkate-ai/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/trunkate-ai/agent.md"
  }
}