Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@tarquinen/opencode-dynamic-context-pruning

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@tarquinen/opencode-dynamic-context-pruning

OpenCode plugin that optimizes token usage by pruning obsolete tool outputs from conversation context

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Dynamic Context Pruning Plugin

OpenCode plugin that optimizes token usage by analyzing conversation history and pruning obsolete tool outputs from requests.

Features

  • Zero Configuration: Uses the free opencode/big-pickle model - no API keys required
  • Automatic Optimization: Runs in the background when sessions become idle
  • Smart Analysis: Uses AI to identify truly obsolete context
  • Debug Logging: Optional file-based logging for troubleshooting

How It Works

  • When a session becomes idle, the Janitor analyzes the conversation using shadow inference
  • It identifies tool call outputs that are no longer relevant to the conversation
  • These IDs are stored in memory for that session
  • On subsequent requests, a custom fetch function filters out the obsolete tool responses
  • Result: Fewer tokens sent to the LLM, lower costs, faster responses

Installation

This plugin is in development. Once complete, it will be installable via:

opencode plugin install dynamic-context-pruning

Configuration

Edit lib/config.ts to enable debug logging:

const defaultConfig: PluginConfig = {
  debug: true, // Set to true to enable debug logging
}

Debug logs are written to logs/YYYY-MM-DD.log files.

Architecture

  • Janitor: Background process that analyzes sessions using opencode/big-pickle model
  • State Manager: In-memory store for pruned tool call IDs per session
  • Fetch Injector: Injects custom fetch via chat.params hook
  • Pruning Fetch Wrapper: Filters request bodies based on session state
  • Logger: File-based debug logging system

Development Status

Current implementation status: Step 1 - Project Scaffolding

See @notes/dynamic-context-pruning/IMPLEMENTATION-PLAN.md for full implementation details.

License

MIT

Keywords

opencode

FAQs

Package last updated on 20 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts