跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    johnny0120

    User Predictor

    v0.2.2模型接入
    @johnny0120/opencode-user-predictor

    OpenCode plugin that predicts your next message and shows it as ghost text — role-plays as you using your conversation history. /pred-on to enable.

    GitHub 星标

    1

    月装机量

    146

    近 7 天 29

    综合评分SCORE

    34.3

    生态多维模型

    最近提交

    1 个月前

    2026-07-18

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@johnny0120/opencode-user-predictor@0.2.2"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    English | 中文

    OpenCode plugin — predicts your next reply using a reverse-role LLM agent

    npm license

    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
    

    Why

    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.

    Install

    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 command entries above to opencode.json, then restart OpenCode. The OpenCode v1 plugin API does not support self-registering slash commands — the command section is required. In OpenCode v2+, the plugin auto-registers commands via ctx.command.transform(), and the manual command entries can be removed.

    Usage

    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)

    How It Works

    1. session.idle fires → conversation text extracted
    2. Messages role-flipped: AI → others, human → self
    3. Fresh session with _predictor agent role-plays as you
    4. 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.

    Personalize

    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.

    License

    MIT