Skip to content
This repository was archived by the owner on Apr 26, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
306 commits
Select commit Hold shift + click to select a range
e8f3453
Route MCP tools through proxy
khalilgharbaoui May 13, 2026
398f6d1
v0.4.1
khalilgharbaoui May 13, 2026
5251160
Support parallel proxy tool calls via batched drain
khalilgharbaoui May 13, 2026
248634b
v0.4.2
khalilgharbaoui May 13, 2026
0eb27cc
Substitute opencode {env:VAR} placeholders and guard drain race on re…
khalilgharbaoui May 13, 2026
082c90c
v0.4.3
khalilgharbaoui May 13, 2026
8f2a32a
Nudge model to chain tool calls within a single turn
khalilgharbaoui May 13, 2026
899616d
v0.4.4
khalilgharbaoui May 13, 2026
d178565
Smartly continue incomplete Claude CLI turns
khalilgharbaoui May 13, 2026
433603d
v0.4.5
khalilgharbaoui May 13, 2026
a39dff8
Narrow auto-continue final-answer check to last text block
khalilgharbaoui May 13, 2026
8904574
v0.4.6
khalilgharbaoui May 13, 2026
f8997e8
Treat tool-role tool-result as new user content
khalilgharbaoui May 14, 2026
9bba2b8
Extract tool-results from tool-role messages in getClaudeUserMessage
khalilgharbaoui May 14, 2026
0d33109
v0.4.8
khalilgharbaoui May 14, 2026
38cfb83
Stop log.notice from surfacing as UI warnings
khalilgharbaoui May 14, 2026
e8e670c
v0.4.9
khalilgharbaoui May 14, 2026
a7007f9
Tighten auto-continue heuristic (tweaks 2/3/4/5)
khalilgharbaoui May 14, 2026
2948e4a
v0.4.10
khalilgharbaoui May 14, 2026
d5a9879
Add 'ready when you are' / 'standing by' to question regex (tweak 6)
khalilgharbaoui May 14, 2026
28fb940
v0.4.11
khalilgharbaoui May 14, 2026
883c598
Defensive soft-proceed coverage (tweak 7)
khalilgharbaoui May 14, 2026
9baa271
v0.4.12
khalilgharbaoui May 14, 2026
42e33e9
Demote AFK-pending-timeout logs from WARN to NOTICE
khalilgharbaoui May 14, 2026
0ec6d63
v0.4.13
khalilgharbaoui May 14, 2026
65761cd
Make file logging opt-in via OPENCODE_CLAUDE_CODE_LOG_FILE
khalilgharbaoui May 14, 2026
d4b61cc
v0.4.14
khalilgharbaoui May 14, 2026
cda2ff8
Final-answer regex picks up deploy/ship verbs + strong phrases
khalilgharbaoui May 14, 2026
2a105a3
v0.4.15
khalilgharbaoui May 14, 2026
869b8e7
Trust Claude CLI stop_reason as authoritative; heuristic as null-fall…
khalilgharbaoui May 14, 2026
1cd7968
v0.4.16
khalilgharbaoui May 14, 2026
f995ae7
Rails-style logging config: file, dir, mode, level
khalilgharbaoui May 14, 2026
01e47b4
v0.4.17
khalilgharbaoui May 14, 2026
aa231e3
Dedup LogLevel/LogMode; types.ts re-exports from logger.ts
khalilgharbaoui May 14, 2026
2c5bceb
v0.4.18
khalilgharbaoui May 14, 2026
124894f
Demote orphan-rejection cascade from WARN to NOTICE
khalilgharbaoui May 14, 2026
f4f6b09
v0.4.19
khalilgharbaoui May 14, 2026
67a47d9
Fix /compact routing, gate thinking flag, skip Task* tools
khalilgharbaoui May 16, 2026
588d607
v0.4.20
khalilgharbaoui May 16, 2026
8173313
Bump actions/setup-node to v6 for Node 24 runtime
khalilgharbaoui May 16, 2026
f5035c1
Document missing src/ files and AGENTS.md in README
khalilgharbaoui May 16, 2026
96b8e8f
Fix workspace-switch cwd regression introduced in v0.2.4 (#4)
khalilgharbaoui May 16, 2026
2f59191
v0.4.21
khalilgharbaoui May 16, 2026
9a31ae8
feat(proxy): expose Task as a proxied tool
galvani May 16, 2026
b241d7d
v0.4.22
khalilgharbaoui May 16, 2026
79a4943
feat(todo): route Claude TaskCreate/TaskUpdate to opencode todowrite
khalilgharbaoui May 16, 2026
0f2c651
v0.4.23
khalilgharbaoui May 16, 2026
6c6079d
Document subagent todowrite permission requirement
khalilgharbaoui May 16, 2026
66556b9
Document roadmap priorities
khalilgharbaoui May 16, 2026
d5e1d28
fix(askuserquestion): render full question + options; never auto-allo…
galvani May 18, 2026
ca2f57c
Add star history
khalilgharbaoui May 18, 2026
d4e5088
0.5.0
khalilgharbaoui May 18, 2026
9ee19af
Fix session affinity fallback to opencodeSessionID
khalilgharbaoui May 18, 2026
614cbb1
Forward system-role messages to Claude CLI append-prompt
khalilgharbaoui May 18, 2026
866e333
Prepend Claude CLI runtime context note to system prompt
khalilgharbaoui May 18, 2026
422240d
Append AGENTS maintenance hint after AGENTS.md context
khalilgharbaoui May 18, 2026
948fd76
Fix doGenerate raw path: tool input JSON accumulation and proc cleanup
khalilgharbaoui May 18, 2026
6db92b9
0.5.1
khalilgharbaoui May 18, 2026
d3540cd
Document opencode-dcp compatibility in README
khalilgharbaoui May 18, 2026
d03e33f
fix(provider): inject full model definitions via config hook
May 25, 2026
fb9401f
Add Claude Opus 4.8 model support
khalilgharbaoui May 29, 2026
40e6958
0.6.0
khalilgharbaoui May 29, 2026
bc8205f
Fix Opus 4.8 release date
khalilgharbaoui May 29, 2026
dd62481
0.6.1
khalilgharbaoui May 29, 2026
6770845
Publish via npm OIDC trusted publishing
khalilgharbaoui May 29, 2026
98ae31a
0.6.2
khalilgharbaoui May 29, 2026
b5105f0
Document OIDC trusted publishing
khalilgharbaoui May 29, 2026
9d854bb
Document opencode plugin cache-clear step
khalilgharbaoui May 29, 2026
e129473
Merge pull request #7 from galvani/fix/provider-model-registration
khalilgharbaoui May 30, 2026
644559b
Drop dead variant merge; test config models
khalilgharbaoui May 30, 2026
e6993ea
0.6.3
khalilgharbaoui May 30, 2026
711e451
Stop turn on AskUserQuestion deny (#8)
khalilgharbaoui May 30, 2026
7002649
0.7.0
khalilgharbaoui May 30, 2026
bc73858
feat(transport): in-process Bun ConPTY claude session
Aptul9 Jun 8, 2026
6d76882
feat(transport): wire interactive Bun ConPTY transport into doStream
Aptul9 Jun 8, 2026
416bef0
fix(transport): sum output tokens across tool-loop records
Aptul9 Jun 8, 2026
e13846e
feat(transport): make interactive transport config-driven
Aptul9 Jun 8, 2026
e08bd3c
fix(transport): drain transcript before reacting to exit
Aptul9 Jun 8, 2026
af54105
fix: submit interactive-PTY turns reliably for large pasted prompts
Aptul9 Jun 8, 2026
861c361
Add Fable 5 and Mythos 5 models, fix Opus pricing
khalilgharbaoui Jun 10, 2026
d3c79c0
0.8.0
khalilgharbaoui Jun 10, 2026
35d3b6b
Fix invalid WebSearch rows, add billing docs
khalilgharbaoui Jun 10, 2026
5346d84
0.8.1
khalilgharbaoui Jun 10, 2026
ed13134
Fix unknown tool rows from skipped tool deltas
khalilgharbaoui Jun 10, 2026
44aa5ea
0.8.2
khalilgharbaoui Jun 10, 2026
197928f
Merge branch 'pr-10' into interactive-transport
khalilgharbaoui Jun 10, 2026
1b967ec
Harden interactive transport (PR #10)
khalilgharbaoui Jun 10, 2026
a492346
Omit forwarded opencode prompt in interactive mode
khalilgharbaoui Jun 10, 2026
0c75bfc
Merge interactive transport (v0.9.0)
khalilgharbaoui Jun 10, 2026
4b5e823
0.9.0
khalilgharbaoui Jun 10, 2026
debca89
Document interactive fresh-session hang for next session
khalilgharbaoui Jun 10, 2026
1a57e23
Note cwd-dependent interactive freeze (trust-prompt lead)
khalilgharbaoui Jun 10, 2026
d0c5342
Re-scope freeze: not interactive, opencode startup cwd hang
khalilgharbaoui Jun 10, 2026
a265efe
Drop local-setup freeze note from docs
khalilgharbaoui Jun 10, 2026
a5c99c5
Add npm badge to README
khalilgharbaoui Jun 10, 2026
e5ce4ed
Align Agent SDK credit table with Anthropic article
khalilgharbaoui Jun 10, 2026
432e465
Add ignoreAnthropicApiKey spawn-env guard (#9)
khalilgharbaoui Jun 10, 2026
99dac18
v0.9.1
khalilgharbaoui Jun 10, 2026
d80fb77
Stop self-proceeding after AskUserQuestion
khalilgharbaoui Jun 10, 2026
5e053d0
v0.9.2
khalilgharbaoui Jun 10, 2026
384cd19
Update README.md
khalilgharbaoui Jun 19, 2026
f116a81
Register Claude Sonnet 5 and Opus 5
broskees Jul 24, 2026
2ffee07
Document Sonnet 5 intro pricing and output convention
khalilgharbaoui Jul 25, 2026
e31ce47
0.9.3
khalilgharbaoui Jul 25, 2026
d802d94
Refresh roadmap after fork and PR sweep
khalilgharbaoui Jul 25, 2026
7339c56
Enable reliable OpenCode subagents
broskees Jul 15, 2026
10daacd
Parse OpenCode configs as JSONC
broskees Jul 16, 2026
8cd6b6c
Wait for Claude session handoff
broskees Jul 16, 2026
d3c397a
Resume Claude sessions with --resume instead of --session-id
broskees Jul 16, 2026
e049150
Demote 'proxy MCP server closed' rejections to notice-level logging
broskees Jul 16, 2026
e87b26d
Defer MCP reload while proxy calls are pending
broskees Jul 16, 2026
872bb16
Keep parallel Task results alive for 30 minutes
broskees Jul 21, 2026
eda83a0
Add per-tool proxy call timeouts
jknlsn Jul 5, 2026
2cd4e99
Return MCP results for tools/call failures
khalilgharbaoui Jul 26, 2026
621d561
Respawn reused claude process when silent after envelope write
jknlsn Jul 5, 2026
e40395d
0.10.0
khalilgharbaoui Jul 26, 2026
7e5b6a5
Add startup diagnostics block
khalilgharbaoui Jul 26, 2026
a35f299
0.11.0
khalilgharbaoui Jul 26, 2026
65fa398
Refresh roadmap recommendation
khalilgharbaoui Jul 26, 2026
9a51cce
Detect opencode version for startup diagnostics
khalilgharbaoui Jul 26, 2026
514911a
0.11.1
khalilgharbaoui Jul 26, 2026
98b7d4f
Narrow issue #21 scope in roadmap
khalilgharbaoui Jul 26, 2026
8777251
Steer models to the task proxy for subagent dispatch
jknlsn Jul 4, 2026
4043113
Front-load agent list in task proxy description
khalilgharbaoui Jul 26, 2026
8b6e448
0.11.2
khalilgharbaoui Jul 26, 2026
bc64a5f
Expose question proxy tool for structured operator questions
jknlsn Jul 5, 2026
a1bd6a1
Document question proxy opt-in and subagent todos
khalilgharbaoui Jul 26, 2026
7bb5476
Document upstream question-form breakage
khalilgharbaoui Jul 26, 2026
a4dcb43
Note headless CLI no longer offers AskUserQuestion
khalilgharbaoui Jul 26, 2026
7a742e5
Correct published context and output limits
khalilgharbaoui Jul 26, 2026
8eea128
0.12.0
khalilgharbaoui Jul 26, 2026
2201a4c
Record two deferred outward-facing actions
khalilgharbaoui Jul 26, 2026
5fc0814
Fix ExitPlanMode approval bridge
colliet5 May 26, 2026
0b899a4
Document the opt-in plan-mode approval bridge
khalilgharbaoui Aug 12, 2026
00465e2
Harden plan-mode approval bridge
khalilgharbaoui Aug 19, 2026
c7eeb51
fix(message-builder): read part.image for AI SDK v4 image parts
flupkede May 17, 2026
da48a8c
Cover v4 image parts, record compress verdict
khalilgharbaoui Aug 19, 2026
bedf977
0.12.1
khalilgharbaoui Aug 19, 2026
7a5e8c7
Add opt-in compress proxy tool
khalilgharbaoui Aug 19, 2026
00c783a
Record posted follow-ups and corrected upstream state
khalilgharbaoui Aug 19, 2026
a2e0082
0.13.0
khalilgharbaoui Aug 19, 2026
016efae
Stop TaskOutput from expanding in the shell
khalilgharbaoui Aug 19, 2026
2b4f080
Let operators disallow tools the proxy cannot replace
khalilgharbaoui Aug 19, 2026
c7fe8de
Fix model cost units: dollars per million tokens, not per token
CNQQC Aug 4, 2026
77f8da2
Record cost units, dead auto-continue, closed backlog
khalilgharbaoui Aug 19, 2026
aa4d56b
0.13.1
khalilgharbaoui Aug 19, 2026
037e4d2
Re-check opencode surface against 1.18.18
khalilgharbaoui Aug 19, 2026
515a221
Require a bearer token on the proxy MCP endpoint
Aug 10, 2026
6b4c865
Authenticate the proxy endpoint from the test harness
Aug 10, 2026
5905065
Close rejected connections, and scope the 0600 claim to POSIX
willmcginnis Aug 10, 2026
74c53bb
Log why the proxy rejects a request, and document the auth
khalilgharbaoui Aug 19, 2026
03c87a5
Document proxy endpoint authentication
khalilgharbaoui Aug 19, 2026
dd18f80
0.13.2
khalilgharbaoui Aug 19, 2026
f2d82f3
Note when a release needs written notes
khalilgharbaoui Aug 19, 2026
48d1794
Link the published advisory
khalilgharbaoui Aug 19, 2026
754d3d8
Track the pending CVE request
khalilgharbaoui Aug 20, 2026
63adbd7
Document the restart requirement after upgrade
khalilgharbaoui Aug 20, 2026
cdc1877
Star History
khalilgharbaoui Aug 21, 2026
d9a7376
Add Opus fast mode models
khalilgharbaoui Aug 29, 2026
628a2de
0.14.0
khalilgharbaoui Aug 29, 2026
313d004
Merge remote-tracking branch 'origin/master'
khalilgharbaoui Aug 29, 2026
87217a7
Bump Sonnet 5 to standard pricing
khalilgharbaoui Sep 1, 2026
e4e786d
Add Fable and Mythos 5.1
khalilgharbaoui Sep 1, 2026
affd536
0.14.1
khalilgharbaoui Sep 1, 2026
89d6d77
Let agents choose their model, keep the account
khalilgharbaoui Sep 3, 2026
a149b0b
Pass reasoning effort to the CLI as an env var
khalilgharbaoui Sep 3, 2026
3e28790
Let an agent state its own thinking budget
khalilgharbaoui Sep 3, 2026
173aacc
Recover proxy results and add native /btw
khalilgharbaoui Sep 5, 2026
ccd4ef4
v0.15.0
khalilgharbaoui Sep 5, 2026
54066fb
Clear tool block index on stop
khalilgharbaoui Sep 5, 2026
c36e614
Strip system reminders from btw questions
khalilgharbaoui Sep 6, 2026
c3f1b15
v0.15.1
khalilgharbaoui Sep 6, 2026
aee0e8c
Answer /btw concurrently in a child session
khalilgharbaoui Sep 6, 2026
4c58f84
Keep /btw exchanges in the conversation
khalilgharbaoui Sep 6, 2026
f0d5660
Stop /btw queueing when asked early
khalilgharbaoui Sep 6, 2026
1f26b16
Write /btw answers into the running turn
khalilgharbaoui Sep 6, 2026
5add284
Quote the whole btw block
khalilgharbaoui Sep 6, 2026
09aa34a
Mark the btw block with a bar, not a quote
khalilgharbaoui Sep 6, 2026
0598fb5
Stop toasting the btw answer
khalilgharbaoui Sep 6, 2026
9b65f98
Receipt a btw the moment it is sent
khalilgharbaoui Sep 6, 2026
fab091b
v0.15.2
khalilgharbaoui Sep 6, 2026
13403bd
Name the question in the btw receipt
khalilgharbaoui Sep 6, 2026
dbc6d70
Give the btw receipt the full question
khalilgharbaoui Sep 6, 2026
068b4de
Record why the btw bar stays uncoloured
khalilgharbaoui Sep 6, 2026
6de7cf9
v0.15.3
khalilgharbaoui Sep 6, 2026
06a57cf
Refresh the roadmap against live issue state
khalilgharbaoui Sep 6, 2026
dc3368c
Stop losing subagent output across CLI resume (#29)
khalilgharbaoui Sep 6, 2026
0bab184
Record the live check for #29
khalilgharbaoui Sep 6, 2026
e9d60ec
v0.15.4
khalilgharbaoui Sep 6, 2026
694d3d0
Mark #29 closed in the roadmap
khalilgharbaoui Sep 6, 2026
f95a862
fix(cwd): resolve per-session project directory in opencode serve mode
May 18, 2026
bb21510
fix(system-prompt): dedup AGENTS.md forwarded by opencode vs plugin d…
HeikoAtGitHub Jul 2, 2026
d0b22e9
Add idle timeout for Claude workers
Jul 14, 2026
e760d4a
Interrupt the CLI turn on abort
broskees Sep 6, 2026
e47356b
Bridge opencode skills into Claude's Skill tool
broskees Sep 6, 2026
bc5bf19
Credit and document the fork absorption
khalilgharbaoui Sep 6, 2026
fee8336
v0.16.0
khalilgharbaoui Sep 6, 2026
1ecaa4c
Run subagents concurrently with task_batch
broskees Sep 6, 2026
1a57b9e
v0.17.0
khalilgharbaoui Sep 6, 2026
9105d61
Bundle the plugin configuration skill
khalilgharbaoui Sep 6, 2026
46d785e
v0.18.0
khalilgharbaoui Sep 6, 2026
eb78c9c
Record the question proxy as verified
khalilgharbaoui Sep 6, 2026
55b7323
Drop the idle timeout observation
khalilgharbaoui Sep 6, 2026
2f458cc
Record plan mode findings from live probes
khalilgharbaoui Sep 6, 2026
255565d
Never let plan mode permit edits
khalilgharbaoui Sep 6, 2026
9a0a3db
v0.18.1
khalilgharbaoui Sep 6, 2026
0cde0ed
Note the opencode plan mode alignment idea
khalilgharbaoui Sep 6, 2026
cc85b57
Continue a turn cut off at max_tokens
khalilgharbaoui Sep 6, 2026
74f4c0a
v0.18.2
khalilgharbaoui Sep 6, 2026
5144a7f
Audit the opencode surface at 1.18.29
khalilgharbaoui Sep 6, 2026
4a67a08
Never auto-continue a compaction turn (#30)
khalilgharbaoui Sep 7, 2026
f6bc098
v0.18.3
khalilgharbaoui Sep 7, 2026
450d701
Point the v2 tracker at issue 31
khalilgharbaoui Sep 7, 2026
5cabeaa
Note the account fallback idea
khalilgharbaoui Sep 14, 2026
3af286b
Handle stdin errors, LRU and crashes (#33)
khalilgharbaoui Sep 14, 2026
defea0b
Observability: turn stats, CLI event parsing, doctor command (#34)
khalilgharbaoui Sep 15, 2026
8b10658
Fix README contradictions, add quickstart and missing options (#32)
khalilgharbaoui Sep 15, 2026
0cb899a
v0.19.0
khalilgharbaoui Sep 15, 2026
ff2edf0
Listen for how a proxied call ends instead of timing it out
broskees Sep 19, 2026
4aad4c7
Replay unattended stdout as one text block, not one per delta (#35)
nic-lan Sep 19, 2026
9866f02
Merge PR #36: listen for how a proxied call ends
khalilgharbaoui Sep 19, 2026
dfb82d5
Keep skills, idle timeout and cap defaults as they were
khalilgharbaoui Sep 19, 2026
3b1c122
Record the 2026-09-19 fork sweep
khalilgharbaoui Sep 19, 2026
afb9ab3
v0.20.0
khalilgharbaoui Sep 19, 2026
834b689
Re-audit the opencode surface at 1.18.31
khalilgharbaoui Sep 19, 2026
c31dd3e
Say when a call with no deadline is still waiting (#37)
khalilgharbaoui Sep 19, 2026
8c0da5a
Forward named opencode tools through the proxy (#38)
khalilgharbaoui Sep 19, 2026
89970ee
Record that proxyOpencodeMcpTools routes nothing today
khalilgharbaoui Sep 19, 2026
3b5120b
v0.21.0
khalilgharbaoui Sep 19, 2026
76a4f48
Stop the recovery tests reporting the machine's load
khalilgharbaoui Sep 19, 2026
7f51273
Warn before a deadline takes a proxied call
khalilgharbaoui Sep 19, 2026
61dae03
Discover MCP tools from the model tool set (#39)
khalilgharbaoui Sep 19, 2026
ee917f1
Correct the doStream tools-argument note
khalilgharbaoui Sep 19, 2026
dd62663
Record the five-server routing verification
khalilgharbaoui Sep 19, 2026
56a4cc9
v0.22.0
khalilgharbaoui Sep 19, 2026
8fa9a16
Stop an exclusion losing to a cached bridge file
khalilgharbaoui Sep 20, 2026
1796a24
v0.22.1
khalilgharbaoui Sep 20, 2026
44d48f0
Record open questions where they survive a reset
khalilgharbaoui Sep 20, 2026
aab16c3
Pin the spawned CLI against mid-session autoupdate (#40)
khalilgharbaoui Sep 20, 2026
dad87c2
v0.23.0
khalilgharbaoui Sep 20, 2026
e01dec5
Record the deferred config decisions
khalilgharbaoui Sep 20, 2026
2b0b294
Offer another account when one hits its usage limit (#41)
khalilgharbaoui Sep 20, 2026
bfbda60
Bound the serve-mode session and ledger maps (#42)
khalilgharbaoui Sep 20, 2026
96e7d02
v0.24.0
khalilgharbaoui Sep 20, 2026
fd13edd
Add Claude Opus 5.5 and its fast-mode entry
broskees Sep 22, 2026
113e9dd
Plan opencode V2 support alongside V1
khalilgharbaoui Sep 23, 2026
93f50a1
Add Claude Opus 5.5 and its fast-mode entry (#43)
khalilgharbaoui Sep 23, 2026
339bbc8
Credit broskees for Opus 5.5 and note the price source
khalilgharbaoui Sep 23, 2026
875c521
v0.25.0
khalilgharbaoui Sep 23, 2026
b60fb2a
Note how to verify a publish without a false alarm
khalilgharbaoui Sep 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v4
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org
- run: npm install -g npm@latest
- run: npm install
- run: npm run build
- name: Publish package
Expand Down
245 changes: 245 additions & 0 deletions AGENTS.md

Large diffs are not rendered by default.

1,259 changes: 1,158 additions & 101 deletions README.md

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Deferred Checks

## Ideas

- 2026-09-06, maintainer: "maybe someday we still want to align it with plan mode of opencode maybe".
Deferred, not scheduled. Make `permissionMode: "plan"` follow opencode's own plan/build agent
instead of being a static provider option.

Cheaper than it looks, and the objection that killed it the first time does not apply:
the opencode agent is already part of the session key
(`...::ses_...::context=["claude-code-appical","build"]`), so plan and build turns already
run as separate `claude` processes. A Tab back to build would spawn one without the flag,
so a coupled design is not a one-way door the way the static option is.

What still argues against it, and what to re-check before building:
1. `"plan"` is only a name. Users define their own agents called plan, some of which write
plan documents into the repo, and forcing CLI plan mode would break those silently.
Any implementation needs an explicit opt-in rather than a name match.
2. The two disagree about how you leave. Claude Code expects an `ExitPlanMode` tool call
that headless `--print` never offers (measured on 2.1.258, probes recorded in AGENTS.md),
so the model searches for a tool it cannot find and narrates confusion. Re-run those
probes first: if a newer CLI offers `ExitPlanMode` headless, this objection dies and the
`planModeQuestion` bridge becomes reachable at the same time.
3. It buys little for the common config. opencode's plan mode already denies its own tools,
and `Bash`/`Edit`/`Write` are proxied by default, so the only gap it closes is Claude's
unproxied built-ins.

Shape if built: an explicit option (something like `planModePermission: "follow-agent"`),
never silent coupling. Do not start this without a user asking for it.

- 2026-09-09, maintainer: "pin to appical but if limits hit switch to default is that possible?"
Asked while designing the `dev-support` agent, which must run on the appical account for
its per-profile MCP servers (Linear, Aikido, Sentry) but should survive that account's
spend limit. Today it is not possible: the account is the provider, it is fixed for the
life of the `claude` process, and a `forceModel` agent inherits whoever invoked it. When
the limit error arrives ("You've hit your individual spend limit", resets at a stated
time) the turn simply fails and the human restarts on the other account.

Shape if built: an optional `fallbackAccounts: ["default"]` per agent or per provider.
On a recognised limit error the plugin respawns the session on the next account with
the same model, effort and cwd, and says so in the turn. Things to check first:
1. The failover account may lack the MCP servers the run depends on; the resumed turn
would need to re-announce its tool list, or the option should refuse to fail over when
the tool sets differ.
2. Session key includes the account, so a failover is a new process and loses in-process
state; opencode's own transcript is what carries over, which is probably enough.
3. Detection must match the CLI's limit message exactly, not any 4xx, or a transient
error would silently move billing to another account.

## Dropped

- Dropped 2026-09-06 at the user's request: live observation of `idleProcessTimeoutMs: 900000`. The 15-minute eviction and subsequent resume remain unverified in the user's window; no test is planned.

## Backlog

## Deferred decisions

- 2026-09-20: The maintainer chose "later" for adding the Appical MCP project block
to `Appical.IaC`, `Cl-nica-Aurora---Player-team`, `Manager-toolkit`,
`NOW-player-web` and `workshop-sep-2026`.
- 2026-09-20: The maintainer chose "later" for choosing a Slack authentication
strategy. The current global server can still pay a 30-second 1Password unlock
timeout on startup.
- 2026-09-20: The maintainer chose "later" for completing opencode's separate,
global Linear OAuth authentication.

## Open from you

Questions the maintainer still owes an answer on. Written here the turn they are
raised, so they survive context compaction; removed when answered, done or dropped.

No pending questions.

## Parked

- 2026-09-23: the skill-bridge native-dedup work (expanded discovery roots,
`bridgeSkipNativeSkills`, and the README/SKILL.md/AGENTS.md copy that goes with it)
was parked mid-flight on branch `skill-bridge-native-dedup`, commit `50df301`, so
master could be clean for the V2 lane. It is 9 files and roughly 830 lines, it is
**not gated** (no typecheck, test or build run since the last edits), and AGENTS.md
already describes it as offline-verified only with no live Claude session behind it.
To resume: `git checkout skill-bridge-native-dedup`, run the full gate, then open a PR.
Nothing is lost by leaving it there, but note the maintainer's local `file://` install
builds from the working tree, so master builds no longer carry these changes.

## In progress

- 2026-09-23: opencode **V2 support**. The plan lives in `V2.md` and is the active lane.
Short version: V2 is a new major of opencode, not a second API inside 1.x, and V1
plugin implementations do not run in it at all, so this plugin disappears the day the
maintainer's opencode moves to 2.x. The blocking capability question is answered:
`@opencode/plugin@2.0.11` ships an undocumented `ctx.aisdk` domain whose `language`
hook takes a `LanguageModelV3`, which is exactly what `ClaudeCodeLanguageModel`
already is, against the same `@ai-sdk/provider` major we already depend on. Dual V1
and V2 support from one package is officially supported and our default export is
already the right shape. Next step is phase 0, the six probes listed in `V2.md`.

## Done

- 2026-09-20: two lanes, account failover (PR #41) and small cleanup (PR #42), both
merged and shipped in v0.24.0.
210 changes: 210 additions & 0 deletions V2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# opencode V2 support

Working plan for supporting opencode 1.x (V1) and opencode 2.x (V2) from one package.
Written 2026-09-23 against `@opencode/plugin@2.0.11` and `@opencode-ai/plugin@1.18.31`.
Tracker: issue #31. This file supersedes the "not planned" verdict recorded in AGENTS.md.

## What changed, and why the old verdict is void

AGENTS.md parked V2 on the reasoning that the v2 API was an additive alternative
surface inside opencode 1.x (`@opencode-ai/plugin/v2`), with no reload of the model
implementation path and therefore no payoff. That reading is now wrong on the premise.

**V2 is a new major of opencode itself, not a second plugin API inside 1.x.** From the
migration guide: V1 and V2 both use the `opencode` command, are no longer installed side
by side, and the V2 installer replaces the V1 binary. And, stated as a warning rather
than a footnote:

> V1 plugin implementations do not run in V2. Moving a file or renaming its config entry
> is not enough.

So this is not an optimisation. The day the maintainer's opencode moves to 2.x, this
plugin stops existing for them, along with every account provider, proxy tool and
model id it registers. That is the actual deadline.

Shipped and confirmed on the registry: `@opencode/plugin@2.0.11`, `@opencode/client@2.0.11`,
`@opencode/ai@2.0.11`. V1's latest is `@opencode-ai/plugin@1.18.31`, which is what we
build against today.

## The decisive question, and its answer

This plugin does not *describe* a provider. It *implements* one: `ClaudeCodeLanguageModel`
is a real `LanguageModelV3` that spawns and drives the `claude` CLI. Any migration lives
or dies on whether V2 lets a plugin supply a model implementation.

The published V2 plugin documentation says no. Its provider surface is metadata only:
`ctx.provider.transform` adds `{ info, models }`, where `info.package` names a package
opencode instantiates itself (`"aisdk:@ai-sdk/openai-compatible"`,
`"@opencode/ai/providers/openai-compatible"`). Model transforms "apply restrictions and
overrides". Nothing in the documented API returns a model object. Taken at face value
that would have forced a rewrite into a local HTTP shim speaking the Anthropic Messages
protocol, with the CLI behind it.

**The shipped package says otherwise.** `@opencode/plugin@2.0.11` carries an `aisdk`
domain that the website does not document, and it is exactly the escape hatch needed:

```ts
// package/dist/promise/aisdk.d.ts
import type { LanguageModelV3 } from "@ai-sdk/provider"

export interface AISDKHooks {
sdk: {
readonly model: Model.Info
readonly package: string
readonly options: Record<string, any>
sdk?: any
}
language: {
readonly model: Model.Info
readonly sdk: any
readonly options: Record<string, any>
language?: LanguageModelV3
}
}
export interface AISDKDomain {
readonly hook: ModelHooks<AISDKHooks>
}
```

`ctx.aisdk` is on the plugin context (`dist/promise/context.d.ts`), and `ModelHooks`
takes an optional `{ providerID }` scope, so the hook can be limited to our own
providers rather than intercepting everyone's models.

Two facts make this cheap rather than a rewrite:

1. `@opencode/plugin@2.0.11` depends on `@ai-sdk/provider` at **3.0.8**. This package
already depends on `^3.0.8` and has 3.0.10 installed.
2. `ClaudeCodeLanguageModel.specificationVersion` is already `"v3"`.

So the expensive part of this plugin, the several thousand lines of CLI transport,
session management, proxy MCP broker and stream translation, is already the exact type
V2 asks for. The port is a new entrypoint and a new wiring layer, not a rewrite of the
thing that took a year to get right.

**Not yet verified, and it is the first thing to probe:** whether a provider registered
with no resolvable `package` still reaches the `language` hook, or whether opencode
tries to instantiate the SDK first and fails before we are asked. The `sdk` hook exists
and lets us supply that object too, which suggests the seam is intentional, but a
suggestion is not a measurement.

## Dual support is officially supported, and our entrypoint is already half of it

From the plugin migration guide, verbatim shape:

```ts
export default {
...Plugin.define({
id: "example",
async setup(ctx) { /* v2 */ },
}),
async server() {
return { /* v1 hooks */ }
},
}
```

V1 calls `server()`, V2 calls `setup()`. The two implementations stay separate; nothing
is translated for us. V1 object entrypoints require opencode **>= 1.18.29**, which is
below the 1.18.31 we already verify against, so adopting this costs no V1 users.

We are already at that shape. `src/index.ts:653`:

```ts
export default {
id: "@khalilgharbaoui/opencode-claude-code-plugin",
server,
}
```

Adding V2 is spreading `Plugin.define({...})` into that object. The seam exists; what
has to be built is what goes behind it.

## Hook mapping

| V1 | V2 | Note |
|---|---|---|
| `provider` returning `models()` | `ctx.provider.transform` + `ctx.aisdk.hook("language")` | The load-bearing one. Metadata and implementation split across two calls. |
| `chat.params` (agent tagging) | `ctx.session.hook("context")`, set `event.options` | V2 gives `sessionID` directly instead of the `x-session-affinity` header. |
| `config` (registering `/btw`, `/claude-code-doctor`) | `ctx.command.transform` with a real `execute()` | Strictly better. V1 forces us to inject into the user's config object and guard against clobbering their own command of that name. |
| `event` (`session.deleted`) | `ctx.event.subscribe()` with an `AbortController` | Cleanup moves into the function `setup` returns. |
| MCP bridging (`--mcp-config` on disk) | `ctx.mcp.transform` | May retire a lot of `mcp-bridge.ts`, including the content-addressed scratch file. |
| skill bridge | `ctx.skill.transform` / `ctx.skill.list()` | V2 can register a skill directly instead of staging a throwaway plugin dir. |
| proxy tool discovery | `ctx.tool.list()` | V1's registry deliberately excludes MCP tools, which is why `proxyOpencodeMcpTools` had to read `doStream`'s `tools` argument. Re-measure on V2. |
| `tool.execute.before/after` | `ctx.tool.hook("execute.before"/"after")` | Not used here today. |
| `permission.ask` | `ctx.permission.hook("evaluate")` | Not used here today. |

V2 also adds things V1 never had that this plugin has hand-rolled around: `ctx.storage`
for durable plugin state, `ctx.session.hook("retry")` for provider failure policy (which
is the natural home for account failover), and `ctx.session.hook("compaction")` with a
`result` field that can skip the model call entirely.

## Open questions, in the order they should be probed

Each is cheap, each is a measurement rather than a reasoning step, and none needs
product code.

1. **Does an unresolvable `package` still reach `aisdk.hook("language")`?** Register a
provider with a nonsense package, hook both `sdk` and `language`, log what arrives.
If it does not, the answer is to supply the `sdk` object from the `sdk` hook too.
Everything else in this plan depends on this one.
2. **How does the model learn which session it is serving?** V1 reads the
`x-session-affinity` request header, and session affinity is the key to process reuse,
proxy call routing and the todo ledger. Check what V2 passes into `doStream`; if it
passes nothing, `ctx.session.hook("context")` knows the `sessionID` and can stash it.
3. **Is there a native `question` tool in V2?** Account failover and the plan-mode bridge
both end a turn on a synthetic `question` tool-call and resume from its tool result.
V2 registers tools through plugins, so confirm the tool exists and the round-trip
still works before porting either feature.
4. **Do MCP tools appear in `ctx.tool.list()`?** If yes, `resolveMcpProxyToolDefs` gets
simpler and the `doStream` `tools` argument read can go.
5. **Does the proxy still get permission prompts?** V2 renamed permission actions
(`bash` to `shell`, `task` to `subagent`, `write`/`patch` to `edit`) and replaced the
per-tool map with one ordered array. The proxy exists so Claude's tool calls run under
opencode's permissions; confirm that still holds.
6. **How do we run V2 at all without losing V1?** The installer replaces the V1 binary
and both use the `opencode` command. Testing needs a pinned V2 binary in an isolated
path with its own `XDG_CONFIG_HOME`, the same discipline the live probes already use.

## Phases

**Phase 0, probes.** Answer the six questions above with throwaway plugins against a
sandboxed V2. No changes to this package. Write findings back into this file. Stop here
and re-plan if question 1 comes back negative, because that answer changes the
architecture rather than the schedule.

**Phase 1, separate the transport from the V1 glue.** Nothing under the CLI transport
should know what an opencode plugin API looks like. Today `src/opencode-types.ts` is a
hand-written mirror of V1's types and the V1 wiring lives in `src/index.ts`. Target:
`index.ts` becomes a thin dual entrypoint, `v1.ts` holds today's `server()`, `v2.ts`
holds `setup()`, and everything else is shared and API-agnostic. This phase ships on its
own with zero behaviour change and the full suite green.

**Phase 2, V2 entrypoint, feature by feature.** Order by dependency: provider and models
first (nothing works without a model), then commands, then MCP, then skills, then the
question-dependent features (failover, plan mode) once probe 3 has an answer. V1 stays
the default and stays untouched.

**Phase 3, parity and release.** A parity checklist per feature with its V2 evidence,
the README and the bundled skill updated to say which opencode majors are supported,
and a minor release. Support both until the maintainer's own opencode is on 2.x and has
stayed there.

## Rules for this lane

- **V1 may not regress.** 660 tests green at every step, and no V1 behaviour changed
because V2 would prefer it differently.
- **Every V2 claim gets a measurement**, the same standard the rest of AGENTS.md holds.
The website's provider documentation would have sent this lane down a rewrite; the
shipped `.d.ts` did not. Read the package.
- **Do not convert the maintainer's own opencode config to native V2 shape yet.** V1 and
V2 read the same paths, and the migration guide warns against pointing V1 at converted
files.
- **Do not install V2 over the working V1** until the port runs, because the installer
replaces the binary and there is no plugin on the other side yet.

## Test strategy

The suite drives V1 by calling `server(input)` with a fake plugin input. V2 needs the
same treatment: a fake `Context` with the domains we touch, so `setup(ctx)` can be
asserted offline exactly as the V1 hooks are. Shared code keeps its existing tests. The
probes in phase 0 are live and paid, and stay out of `npm test`.
Loading