Skip to content

opencode 2.0.16: context event tools have no execute() — plugin inert; port to tool.hook execute.before (+ snip is a wrapper, not a pipe filter) #4

Closed

Description

@famewolf

opencode 2.0.16: context event tools have no execute() — plugin inert; port to ctx.tool.hook("execute.before") (+ snip is a command wrapper, not a pipe filter)

Summary. On opencode 2.0.16 (verified on the OpenChamber 2.0.16 AppImage's bundled binary), the session.context event's tools are bare {description, input} definitions — no execute — so the plugin's execute wrapping loads but wraps nothing. Separately, the "append | snip" design is dead regardless of version: the current snip binary (edouard-claude/tap) is a command wrapper (snip <cmd> / snip run -- <cmd>), does not read stdin, and piping into it just prints help.

2.0.16 plugin API facts (probe-verified, 2026-09-25):

  • ctx.tool.hook("execute.before", fn) exists and mutates what executes: fn({tool, input}), assign a.input.command. Present in both 2.0.12 and 2.0.16.
  • event.tools[...].execute in the session.context hook: absent in 2.0.16 (present in 2.0.12) — the old wrapping pattern no-ops.
  • ctx.session.context({sessionID}) returns minimal entries (id/time/type/text; types user/idle/synthetic) — no assistant entries, no tokens; do not build token accounting on it.
  • No chat.message/chat.transform hooks in 2.0.16.
  • Plugin modules must export {id, setup}; a bare default function fails to load (SchemaError).

Working rewrite strategy (verified local port). Wrap the first pipe segment as a prefix:

ps aux | head -5   →   snip ps aux | head -5

(snip filters segment 1; downstream segments run normally.) Required guards, all verified by unit test (10/10 pass):

  • skip multi-line commands (newlines are command separators — snip SID=$(...) → fork/exec SID=...: no such file or directory in practice);
  • skip leading variable assignments (VAR=... is not runnable as a command);
  • skip compounds (;, &&, ||), redirects in the first segment (>), snip/lowfat-prefixed commands, and no-output builtins (cd, echo, mkdir, ...);
  • skip if snip is not on PATH (resolve via command -v at setup).

Evidence from the live 2.0.16 server: before the guard fix, a multi-line SID=$(...)+curl command was wrapped and failed with snip: passthrough: fork/exec SID=...: no such file or directory; after the fix the same shape passes through unwrapped. Simple commands execute as snip <cmd> as intended.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions