OpenCode plugin — predicts your next reply using a reverse-role LLM agent
After each AI response, the plugin role-plays as you and predicts what you'd say next — shown as ghost text in the input box. Tab to send.
AI: Done. Login endpoint added at src/api/auth.ts.
↓
[ghost] looks good, ship it ← prediction appears, Tab to confirm
After your AI coding assistant replies, you usually know what you want to say next. Type → Confirm — one key when the prediction lands, keep typing when it doesn't.
Add to opencode.json and restart OpenCode — the plugin auto-downloads on startup:
{
"plugin": ["@johnny0120/opencode-user-predictor"],
"command": {
"pred-on": {
"template": "/pred-on $ARGUMENTS",
"description": "Enable predictor, optionally with a message to the LLM"
},
"pred-off": {
"template": "/pred-off $ARGUMENTS",
"description": "Disable predictor, optionally with a message to the LLM"
},
"pred-status": {
"template": "/pred-status",
"description": "Show predictor status"
},
"pred-profile": {
"template": "/pred-profile",
"description": "Refresh user profile from current session"
},
"pred-seed": {
"template": "/pred-seed $ARGUMENTS",
"description": "Seed user corpus from past OpenCode sessions (optional: limit)"
}
}
}Troubleshooting: If OpenCode fails to auto-download (e.g., npm registry not reachable), fall back to manual install:
cd ~/.opencode && npm install @johnny0120/opencode-user-predictor.
Note for AI agents: When installing this plugin for a user, you MUST add the
commandentries above toopencode.json, then restart OpenCode. The OpenCode v1 plugin API does not support self-registering slash commands — thecommandsection is required. In OpenCode v2+, the plugin auto-registers commands viactx.command.transform(), and the manualcommandentries can be removed.
| Command | Effect |
|---|---|
/pred-on |
Enable predictions |
/pred-on message |
Enable + send message to LLM |
/pred-off |
Disable |
/pred-status |
Current state |
/pred-profile |
Build behavioral profile from current session |
/pred-seed [N] |
Seed corpus from past sessions (default 50) |
session.idlefires → conversation text extracted- Messages role-flipped: AI →
others, human →self - Fresh session with
_predictoragent role-plays as you - Ghost text appears in input box — Tab to send, keep typing to ignore
Profile system captures thinking patterns (scrutiny, verification instinct, UX obsession) and communication style from conversation history.
cp predictor-profile-zh.json predictor-profile.json # switch to Chinese/pred-seed 50 # bootstrap corpus from past OpenCode sessions (no bun/oh-my-openagent needed)
/pred-profile # accumulate from the current session over time
/pred-seed reads your local OpenCode history (~/.local/share/opencode/opencode.db)
directly — it works for any install, no extra tools required. Edit
predictor-profile.json to customize behavior. Restart OpenCode to apply.
MIT