memorix icon indicating copy to clipboard operation
memorix copied to clipboard

OpenCode plugin: console.log spam pollutes TUI input area

Open RaviTharuma opened this issue 8 months ago • 2 comments

Problem

The OpenCode plugin file (.opencode/plugins/memorix.js) contains console.log calls that output directly to the OpenCode TUI, polluting the area near the input field on every tool execution:

[memorix] plugin loaded, directory: /Users/...
[memorix] hook fired: tool.execute.after
[memorix] hook fired: tool.execute.after
[memorix] hook fired: tool.execute.after

This fires on every single tool call, making the TUI unusable during active sessions.

Root Cause

The generated plugin template (pre-v1.0.3) included debug-level console.log calls:

  • Line 11: console.log('[memorix] plugin loaded, directory:', directory); — on session start
  • Line 22: console.log('[memorix] hook fired:', payload.hook_event_name); — on every hook fire
  • Line 24: console.log('[memorix] hook error:', err?.message ?? err); — on errors (should be console.error)

OpenCode's plugin runtime routes plugin console.log output to the TUI status area. The logLevel config setting only controls Go-level slog, not JS plugin console output, so there's no way to suppress these messages via configuration.

Current State

The generateOpenCodePlugin() function in src/hooks/installers/index.ts has already been fixed on main — it produces a silent template with catch {}. However:

  1. The static file .opencode/plugins/memorix.js in the repo root still has the old noisy version
  2. Users who installed hooks with v1.0.3 or earlier still have the noisy file locally and need to reinstall hooks or manually remove the console.log calls

Suggested Fix

  1. Update .opencode/plugins/memorix.js to match the output of generateOpenCodePlugin()
  2. Consider adding a note in release notes that users should run memorix hooks install --agent opencode to regenerate the plugin

RaviTharuma avatar Mar 16 '26 05:03 RaviTharuma

Thanks for reporting this — I confirmed the OpenCode TUI pollution is a real issue. The static .opencode/plugins/memorix.js file in the repo is still on the older noisy version, even though the generator had already moved in the right direction.

I'm reviewing PR #17 now. The console.log cleanup is the correct fix, but I'm asking for a small scope adjustment before merge so we only land the log-spam fix without changing session lifecycle behavior in the compaction prompt.

Appreciate the clear report and reproduction details.

AVIDS2 avatar Mar 16 '26 12:03 AVIDS2

@AVIDS2 let's celebrate my first contribution to the project! 🥳

RaviTharuma avatar Mar 16 '26 14:03 RaviTharuma