@headsdown/opencode
v0.1.3
Published
HeadsDown availability and focus-mode gating plugin for OpenCode.
Maintainers
Readme
@headsdown/opencode
HeadsDown availability-awareness and task-gating plugin for OpenCode.
What it does
- Adds
headsdown_policy,headsdown_approve,headsdown_digest,headsdown_outcome, andheadsdown_authtools to OpenCode - Injects HeadsDown execution guidance into system prompts on every turn
- Enforces policy through both permission mediation and pre-tool hard gates
- Applies mode-aware model shaping via
chat.params,chat.headers, andshell.env - Shapes tool definitions with mode-aware HeadsDown constraints
- Persists policy context during session compaction and can disable auto-continue in strict Wrap-Up windows
- Tracks approved proposals and reports outcomes for calibration
Install
npm install @headsdown/opencodeThen configure OpenCode in opencode.json (published npm mode):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@headsdown/opencode", "@headsdown/opencode/tui"]
}@headsdown/opencode loads server-side policy hooks and tools.
@headsdown/opencode/tui adds TUI-only status toasts and command palette actions.
Why two plugins?
- OpenCode uses separate plugin surfaces for runtime/server behavior and TUI behavior.
- This package exports both surfaces (
@headsdown/opencodeand@headsdown/opencode/tui) so each can be loaded in the correct place.
First-time auth
Inside OpenCode, run the headsdown_auth tool and complete the Device Flow.
After auth, use headsdown_policy to confirm your current mode, schedule state, and execution guidance.
Proposal and outcome workflow
When the user is in busy or limited mode and the agent needs to modify files:
- Call
headsdown_approve - If approved, continue the task
- If deferred, summarize and ask the user whether to postpone or reduce scope
- After completion/failure, call
headsdown_outcomewith the outcome
Use headsdown_digest at session start or when asked "what did I miss?" to review updates that arrived during focus mode.
TUI features
The TUI plugin adds:
HeadsDown: Refresh policycommand (/headsdown-policy-refresh)HeadsDown: Show policycommand (/headsdown-policy)- Transition toasts when mode changes or Wrap-Up/lock state becomes active
- Note: this plugin currently does not add a persistent sidebar panel.
Development
cd headsdown-opencode
npm install
npm run build
npm testLocal plugin toggle helper
Use scripts/toggle-headsdown-plugin.sh from a target OpenCode project to switch between:
local: loads this repo's built files through local shims (.opencode/plugins)published: loads@headsdown/opencodeand@headsdown/opencode/tuifrom npm inopencode.json
In local mode, opencode.json may keep an empty plugin array while local shims are used.
Example:
./scripts/toggle-headsdown-plugin.sh localLicense
MIT
