-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Description
When opencode-supermemory detects a memory keyword like remember, it injects a synthetic text part into the message. The injected part uses an id like supermemory-nudge-..., which does not satisfy OpenCode's part ID schema requirement that id must start with prt.
This causes message creation to fail with:
ZodError: [
{
"origin": "string",
"code": "invalid_format",
"format": "starts_with",
"prefix": "prt",
"path": ["id"],
"message": "Invalid string: must start with \"prt\""
}
]
I also found the same problem in the injected context part on first-message context injection: it uses supermemory-context-..., which also does not start with prt.
Reproduction
Environment:
- OpenCode
1.2.25 opencode-supermemorycached install2.0.4
Steps:
- Enable the plugin in OpenCode config
- Start OpenCode
- Send a prompt containing
remember, for example:
remember this preference: detailed progress updates
Actual
OpenCode fails while creating the user message with schema validation:
schema validation failure stack trace:
at createUserMessage ...
ZodError: Invalid string: must start with "prt"
Expected
The plugin should inject valid synthetic parts and the prompt should continue normally, allowing the agent to call the supermemory tool.
Root Cause
In src/index.ts, the plugin constructs synthetic Part objects with invalid IDs:
id: `supermemory-nudge-${Date.now()}`
id: `supermemory-context-${Date.now()}`These should use the prt prefix expected by OpenCode.
Minimal Fix
- id: `supermemory-nudge-${Date.now()}`,
+ id: `prt_supermemory_nudge_${Date.now()}`,
- id: `supermemory-context-${Date.now()}`,
+ id: `prt_supermemory_context_${Date.now()}`,Verification
After applying the patch locally, this succeeds:
opencode run "remember this preference: detailed progress updates"and the plugin correctly triggers:
supermemory {"mode":"add","scope":"user","type":"preference",...}