Skip to content

Generated OpenCode plugin passes output?.args to hook-augment, so augmentation never fires #1737

Description

@qtchen-vault

Summary

The OpenCode plugin generated by cbm install (~/.config/opencode/plugins/cbm-augment.ts, produced by src/cli/client_adapter.c) never augments Grep/Glob results because it reads the tool arguments from the wrong place.

Version / Reproducible

  • Installed: v0.10.5
  • Confirmed still present in v0.10.8: client_adapter.c is identical (git diff between the v0.10.5 and v0.10.8 tags is empty for this file), and the released v0.10.8 source still has the same line.

Root cause

The generated tool.execute.after hook calls:

const extra = await augment(tool, output?.args);

But the OpenCode plugin tool.execute.after hook signature is:

"tool.execute.after"?: (
  input: { tool: string; sessionID: string; callID: string; args: any },
  output: { title: string; output: string; ... },
) => Promise<void>

The tool arguments live in input.args, not outputoutput is the tool result and has no args field. So output?.args is always undefined, the payload sent to hook-augment is {"tool_input":{}}, the graph lookup matches nothing, and no [codebase-memory] context is ever appended. Real Grep/Glob results are never augmented, even though the hook and daemon are otherwise working.

Fix

Use input?.args instead:

const extra = await augment(tool, input?.args);

This is the location in the generator:

  • src/cli/client_adapter.c — the "tool.execute.after" template (const extra = await augment(tool, output?.args);).

I verified the fix locally: after switching to input?.args, Grep results are augmented with the expected [codebase-memory] N graph symbol(s) match ... block, in both a fresh index and existing indexes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    editor/integrationEditor compatibility and CLI integration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions