Skip to content

Latest commit

 

History

History
91 lines (62 loc) · 1.8 KB

File metadata and controls

91 lines (62 loc) · 1.8 KB

@tuanhung303/opencode-acp

Installation

npm install @tuanhung303/opencode-acp

Quick Start

Add to your OpenCode configuration:

// opencode.jsonc
{
    "plugin": ["@tuanhung303/opencode-acp@latest"],
}

Restart OpenCode to activate.

Usage

Manual Pruning

Use the context_prune tool to manage conversation context:

// Discard tool outputs
context_prune({ action: "discard", targets: [["44136f"]] })

// Distill with summary
context_prune({
    action: "distill",
    targets: [["01cb91", "Found 8 TypeScript files"]],
})

// Discard multiple by hash
context_prune({ action: "discard", targets: [["a1b2c3"], ["d4e5f6"], ["789abc"]] })

Configuration

Create .opencode/acp.jsonc:

{
    "$schema": "https://raw.githubusercontent.com/tuanhung303/opencode-agent-context-pruning/master/acp.schema.json",
    "enabled": true,
    "autoPruneAfterTool": false,

    "tools": {
        "discard": { "enabled": true },
        "distill": { "enabled": true },
    },
}

Features

  • Auto-Supersede: Automatic deduplication of tool calls, file operations, and todo updates
  • Manual Pruning: Explicit discard and distill tools for agent control
  • Protected Tools: Critical tools exempt from pruning
  • Token Savings: Up to 50% reduction in context size

API Reference

context_prune(options)

Main pruning interface.

Parameters:

  • action: "discard" | "distill"
  • targets: Array of [hash] or [hash, summary] tuples

Target Types:

  • Tool outputs: 6 hex chars (e.g., 44136f)
  • Thinking blocks: 6 hex chars
  • Messages: 6 hex chars
  • Multiple targets: Array of [hash] or [hash, summary] tuples

Commands

  • /acp - Show ACP statistics and version
  • /acp stats - Show ACP statistics and version

License

MIT