|
4 | 4 | > include the generic research `openai_compatible` backend, Sleep handoff, |
5 | 5 | > Sleep support for non-Azure OpenAI-compatible endpoints, the Sleep |
6 | 6 | > `--preferences` flag, the research `cursor_exec` target harness, or Cursor |
7 | | -> source/backend/plugin support, Pi source/backend support, or VS Code Copilot |
8 | | -> transcript harvesting; use a source install from `main` for those features |
9 | | -> until the next release. |
| 7 | +> source/backend/plugin support, Pi source/backend support, the OpenCode Sleep |
| 8 | +> backend, or VS Code Copilot transcript harvesting; use a source install from |
| 9 | +> `main` for those features until the next release. |
10 | 10 |
|
11 | 11 | ## Training |
12 | 12 |
|
@@ -130,13 +130,14 @@ Actions are `run`, `dry-run`, `status`, `adopt`, `harvest`, `schedule`, and |
130 | 130 | | `--project PATH` | Project used for transcript scope, targets, state, and staging (default: current directory) | |
131 | 131 | | `--scope invoked\|all` | Harvest this project or all projects | |
132 | 132 | | `--source claude\|codex\|copilot\|cursor\|pi\|auto` | Transcript source; `auto` keeps Codex-then-Claude precedence and does not select Copilot, Cursor, or Pi | |
133 | | -| `--backend mock\|claude\|codex\|copilot\|cursor\|pi\|handoff\|azure_openai` | Replay/optimizer backend | |
| 133 | +| `--backend mock\|claude\|codex\|copilot\|cursor\|pi\|opencode\|handoff\|azure_openai` | Replay/optimizer backend | |
134 | 134 | | `--model NAME` | Backend-specific model override | |
135 | 135 | | `--cursor-home PATH` | Override `~/.cursor` for Cursor transcript harvesting | |
136 | 136 | | `--pi-home PATH` | Parent directory containing Pi's `agent/sessions` tree (default: `~/.pi`) | |
137 | 137 | | `--vscode-workspace-storage PATH` | Override VS Code's `User/workspaceStorage` root for Copilot transcript harvesting | |
138 | 138 | | `--cursor-path PATH` | Path to the installed Cursor Agent CLI | |
139 | 139 | | `--pi-path PATH` | Path to the installed Pi coding-agent CLI | |
| 140 | +| `--opencode-path PATH` | Path to the installed OpenCode CLI | |
140 | 141 | | `--preferences TEXT` | House rules supplied to reflection | |
141 | 142 | | `--lookback-hours N` | Initial transcript lookback; `0` scans all history | |
142 | 143 | | `--max-sessions N` / `--max-tasks N` | Bound the harvested workload | |
@@ -213,6 +214,54 @@ The managed `schedule` command preserves the backend but not `--source`, |
213 | 214 | `~/.skillopt-sleep/config.json`; use an absolute `pi_path` and verify |
214 | 215 | authentication for the scheduled account. |
215 | 216 |
|
| 217 | +### OpenCode backend |
| 218 | + |
| 219 | +Install and configure OpenCode using its |
| 220 | +[official documentation](https://opencode.ai/docs/), then confirm the CLI is |
| 221 | +available with `opencode --version`. |
| 222 | + |
| 223 | +`--backend opencode` runs SkillOpt's model calls for mining, plain task replay, |
| 224 | +judging, and reflection through an installed OpenCode CLI. It uses the user's |
| 225 | +existing OpenCode login, provider environment variables, and file-based global |
| 226 | +configuration; SkillOpt does not manage OpenCode accounts or provider |
| 227 | +credentials. Transcript sources remain independent, and there is not yet a |
| 228 | +`--source opencode` harvester. |
| 229 | + |
| 230 | +If OpenCode is on `PATH`, no path option is needed. Otherwise use |
| 231 | +`--opencode-path`, the `opencode_path` config key, or |
| 232 | +`SKILLOPT_SLEEP_OPENCODE_PATH`. Use `--model`, the `model` config key, or |
| 233 | +`SKILLOPT_SLEEP_OPENCODE_MODEL` to override OpenCode's configured model: |
| 234 | + |
| 235 | +```bash |
| 236 | +skillopt-sleep run --project "$(pwd)" \ |
| 237 | + --source codex --backend opencode \ |
| 238 | + --opencode-path /absolute/path/to/opencode \ |
| 239 | + --model provider/model --max-sessions 5 --max-tasks 3 --progress |
| 240 | +``` |
| 241 | + |
| 242 | +Plain calls run from a temporary directory with project configuration, tool |
| 243 | +use, and external plugins disabled. Before contacting the model, SkillOpt |
| 244 | +discovers the resolved MCP configuration, disables every |
| 245 | +configured MCP server for the call, and verifies that none remains enabled. If |
| 246 | +that check fails, the model call is not made. Tool-aware replay is not yet |
| 247 | +supported. |
| 248 | + |
| 249 | +The child process keeps normal OpenCode file-based global configuration and |
| 250 | +data directories. SkillOpt sets `OPENCODE_CONFIG_CONTENT` for the child process |
| 251 | +to define the temporary agent and disable configured MCP servers. This replaces |
| 252 | +the user's existing value in that child process, so settings supplied only |
| 253 | +through that value are unavailable. Because `--pure` skips external plugins, |
| 254 | +authentication or provider setup that depends on one of those plugins is also |
| 255 | +unavailable. Calls may appear in the user's normal OpenCode session history; |
| 256 | +these controls are invocation settings, not complete account or process |
| 257 | +isolation. |
| 258 | + |
| 259 | +The managed scheduler stores the backend but not `--opencode-path`, `--model`, |
| 260 | +or the transcript source. Before scheduling OpenCode, put `opencode_path`, |
| 261 | +`model`, and `transcript_source` in `~/.skillopt-sleep/config.json` as needed. |
| 262 | +Prefer an absolute executable path and verify OpenCode access for the account |
| 263 | +that runs the scheduled job. |
| 264 | + |
216 | 265 | ### Cursor source and backend |
217 | 266 |
|
218 | 267 | `--source cursor` reads local Cursor JSONL transcripts from |
|
0 commit comments