Bug Description
The @vectorize-io/opencode-hindsight plugin (tested on v0.2.5 and v0.2.7) registers three hooks that are not part of the @opencode-ai/plugin public Plugin API in OpenCode 1.16.2. OpenCode silently ignores unknown hook names — no error, no warning — so the following features are completely non-functional:
experimental.chat.system.transform → autoRecall never fires
experimental.session.compacting → memory injection during compaction never fires
- (The
event hook for session.idle autoRetain does work, as it's a supported hook)
This is distinct from the execution-ordering issue described in #1758 item #2 (which was about session.created vs system.transform firing order). The code in v0.2.5+ already implements the #1758 fix (it doesn't depend on session.created), but it doesn't matter — the hook itself is never called.
Environment
| Component |
Version |
| OpenCode |
1.16.2 |
@vectorize-io/opencode-hindsight |
0.2.5 (also confirmed on 0.2.7) |
@opencode-ai/plugin |
^1.3.13 |
| OS |
Windows 11 |
Root Cause
The plugin registers hooks using the "experimental." prefix namespace in hindsight-integrations/opencode/src/hooks.ts. These hooks (experimental.chat.system.transform, experimental.session.compacting) are not defined in the @opencode-ai/plugin type definitions.
The Hooks type in @opencode-ai/plugin only exposes: tool, auth, event, config, chat.message, chat.params, permission.ask, tool.execute.before, tool.execute.after. There are no experimental.* entries.
The plugin's own HindsightHooks interface defines these names locally (not imported from the Plugin SDK) and returns them in the hooks object. OpenCode silently discards any hook key it doesn't recognize — these hooks are registered but never invoked.
Impact
| Feature |
Hook |
Status |
| autoRecall — injects relevant memories at session start |
experimental.chat.system.transform |
Never called |
| memory injection during compaction |
experimental.session.compacting |
Never called |
| autoRetain — saves conversation on idle events |
event (session.idle) |
Works (supported hook) |
Users are not notified that autoRecall is broken. The plugin loads without errors, logs nothing unusual, and appears to be working — but the hindsight_memories context block never appears in the system prompt.
Steps to Reproduce
- Install
@vectorize-io/opencode-hindsight v0.2.5+ in OpenCode 1.16.2
- Enable
autoRecall: true in plugin config
- Start a session and chat — no
<hindsight_memories> context appears in the system prompt
- Check plugin logs — no errors or warnings about unrecognized hooks
- Inspect
@opencode-ai/plugin type definitions — confirm experimental.* hooks are absent
Evidence
Related Issues
Suggested Fixes
- Add
experimental.chat.system.transform and experimental.session.compacting to the OpenCode Plugin API — these hooks appear to have been designed but never shipped in the public interface
- Alternative for autoRecall: Use the supported
event hook to detect session creation and trigger initial recall from there
- Fallback: At minimum, the plugin should detect at startup whether the hooks it depends on are actually available and log a clear warning
Bug Description
The
@vectorize-io/opencode-hindsightplugin (tested on v0.2.5 and v0.2.7) registers three hooks that are not part of the@opencode-ai/pluginpublic Plugin API in OpenCode 1.16.2. OpenCode silently ignores unknown hook names — no error, no warning — so the following features are completely non-functional:experimental.chat.system.transform→ autoRecall never firesexperimental.session.compacting→ memory injection during compaction never fireseventhook forsession.idleautoRetain does work, as it's a supported hook)This is distinct from the execution-ordering issue described in #1758 item #2 (which was about
session.createdvssystem.transformfiring order). The code in v0.2.5+ already implements the #1758 fix (it doesn't depend onsession.created), but it doesn't matter — the hook itself is never called.Environment
@vectorize-io/opencode-hindsight@opencode-ai/pluginRoot Cause
The plugin registers hooks using the
"experimental."prefix namespace inhindsight-integrations/opencode/src/hooks.ts. These hooks (experimental.chat.system.transform,experimental.session.compacting) are not defined in the@opencode-ai/plugintype definitions.The
Hookstype in@opencode-ai/pluginonly exposes:tool,auth,event,config,chat.message,chat.params,permission.ask,tool.execute.before,tool.execute.after. There are noexperimental.*entries.The plugin's own
HindsightHooksinterface defines these names locally (not imported from the Plugin SDK) and returns them in the hooks object. OpenCode silently discards any hook key it doesn't recognize — these hooks are registered but never invoked.Impact
experimental.chat.system.transformexperimental.session.compactingevent(session.idle)Users are not notified that autoRecall is broken. The plugin loads without errors, logs nothing unusual, and appears to be working — but the
hindsight_memoriescontext block never appears in the system prompt.Steps to Reproduce
@vectorize-io/opencode-hindsightv0.2.5+ in OpenCode 1.16.2autoRecall: truein plugin config<hindsight_memories>context appears in the system prompt@opencode-ai/plugintype definitions — confirmexperimental.*hooks are absentEvidence
@opencode-ai/pluginHookstype defines only:tool,auth,event,config,chat.message,chat.params,permission.ask,tool.execute.before,tool.execute.afterHindsightHooksinterface (hooks.ts lines 71-80) is self-defined, not derived from the Plugin SDKRelated Issues
session.createdvssystem.transform(assumes hooks exist but fire in wrong order). The hook-absence issue is a distinct and more fundamental problem.Suggested Fixes
experimental.chat.system.transformandexperimental.session.compactingto the OpenCode Plugin API — these hooks appear to have been designed but never shipped in the public interfaceeventhook to detect session creation and trigger initial recall from there