OpenCode Plugin
nexus-headroom-intercept
v0.1.0PublishedPre-injection context compression for Nexus MCP tool outputs via the tool.execute.after hook.
Overview
Intercepts large Nexus MCP tool responses before they enter the agent context window. Uses policy-based deterministic compression (no LLM summarization) to reduce token consumption while preserving retrieval semantics. Supports three compression profiles: reference-data, structured-list, and search-results. Originals are stored in-memory and on disk for retrieval via headroom_retrieve. The plugin checks the Nexus backend at startup and only activates transform mode when headroom is enabled for the project.
Key Features
- Pre-injection MCP output compression
- Deterministic profiles (no LLM calls)
- Project-context-aware activation
Registered Hooks
Events this plugin listens to in the OpenCode runtime.
tool.execute.afterIntercepts all tool outputs after execution. Applies policy-based compression for Nexus MCP tools that exceed configured token thresholds.
event (session.idle)Logs compression metrics summary to the project activity log.