codebase-memory-mcp icon indicating copy to clipboard operation
codebase-memory-mcp copied to clipboard

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

Open qtchen-vault opened this issue 3 months ago • 0 comments

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 output — output 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.

qtchen-vault avatar Aug 19 '26 12:08 qtchen-vault