-
Notifications
You must be signed in to change notification settings - Fork 14
sync: upstream 195f59264 (between v1.14.50 and v1.14.51) #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
379 commits
Select commit
Hold shift + click to select a range
71040c5
test(plugin): migrate loader shared tests to Effect runner (#27129)
kitlangton 1d46130
test(project): migrate instance tests to Effect runner (#27130)
kitlangton e46ab34
chore: generate
opencode-agent[bot] c5849e5
test(project): migrate project tests to Effect runner (#27134)
kitlangton f7dbb4d
chore: generate
opencode-agent[bot] e0d0fe1
test(bus): migrate integration tests to Effect runner (#27132)
kitlangton 3f74abc
test: simplify Effect migration follow-ups (#27136)
kitlangton b9e7cbf
sync
fwang dd14413
Preserve native LLM tool context (#27116)
kitlangton af4ab01
test(session): migrate structured output integration test (#27143)
kitlangton dc9d6a0
test: migrate agent color config tests (#27139)
kitlangton 2017dc1
test: migrate negative tokens regression to Effect runner (#27141)
kitlangton ca28dd0
fix(compaction): restore tail turns after summarization (#27145)
rekram1-node 4cf088a
test: migrate instance bootstrap to Effect runner (#27144)
kitlangton 3c34f67
test: migrate auth override plugin test (#27140)
kitlangton 0fb55b4
test(project): migrate global project tests to Effect runner (#27142)
kitlangton d9f9f15
test: use Effect file services in migrated tests (#27154)
kitlangton 159964b
feat(plugin): add DigitalOcean OAuth + Inference Routers (#26095)
Spherrrical cb511f7
fix(plugin): preserve tool attachments (#27157)
rekram1-node 2cb697b
chore: generate
opencode-agent[bot] 65368f6
fix: preserve permission ordering by accepting a layered array (#23214)
asuffield baef5cd
chore: generate
opencode-agent[bot] 81dd46a
test: migrate websearch tests to effect runner (#27170)
kitlangton 2c334d9
Migrate schema error body tests to Effect runner (#27172)
kitlangton ded4da7
test: migrate webfetch tool tests to effect runner (#27171)
kitlangton b0674b4
test: migrate session action route to effect runner (#27174)
kitlangton 9c54255
fix: migrate sync http api test to effect runner (#27175)
kitlangton 3301fad
test: migrate app runtime logger effect tests (#27176)
kitlangton 72ce24c
test: migrate effect cmd ALS test (#27173)
kitlangton 937a3c1
chore: generate
opencode-agent[bot] 1b6599f
test(plugin): use noop dependency boundaries (#27148)
kitlangton d8c8322
test: migrate worktree tests to effect runner (#27177)
kitlangton 1d243ce
harden cache usage
thdxr d0844c6
test(worktree): use timeoutOrElse for ready wait (#27180)
kitlangton 17d4c36
test(worktree): dispose created instances before removal (#27182)
kitlangton d1640c0
fix(app): use session status for busy state (#27166)
Hona 59b976b
Remove TUI logo sound effects (#27183)
kitlangton d0b8ff0
chore: update nix node_modules hashes
opencode-agent[bot] b7c6fa6
effect: add RuntimeFlags service (#27181)
kitlangton 31e2d72
test(worktree): scope created worktree cleanup (#27191)
kitlangton b6d3fa0
effect(core): add AppProcess service (Phase 1) (#27178)
kitlangton adccab5
chore: generate
opencode-agent[bot] d636785
Add TUI notifications and attention sounds (disabled by default) (#26…
kommander 4564952
fix(httpapi): drop redundant InstanceRef/WorkspaceRef in session prom…
kitlangton c2c40b5
chore: generate
opencode-agent[bot] c4e676b
fix(task): preserve subagent self permissions (#27201)
kitlangton 8310e7d
test(server): migrate missing patch diff test (#27202)
kitlangton 005e64e
zen: stat worker
fwang 2447f42
test(server): migrate session select to effect runner (#27203)
kitlangton 673226d
chore: generate
opencode-agent[bot] 604de70
test(server): migrate experimental HttpApi test to Effect (#27204)
kitlangton 4d9c675
test(server): migrate httpapi session test to effect runner (#27207)
kitlangton 7d9ac71
test(config): migrate TUI config tests to Effect runner (#27206)
kitlangton 69feb22
chore: update nix node_modules hashes
opencode-agent[bot] d1356f5
test(server): migrate HTTP API SDK test to Effect runner (#27208)
kitlangton c2b1ebd
feat: update pricing schema for models to ensure more accurate cost t…
rekram1-node c9df833
chore: generate
opencode-agent[bot] da689d7
effect: move tool flags into RuntimeFlags (#27198)
kitlangton 911b2ac
test(session): migrate prompt tests to effect runner (#27209)
kitlangton 5c7af68
test(server): migrate MCP HTTP API test to Effect runner (#27213)
kitlangton 7f9268f
test(server): migrate global bus helper to Effect (#27214)
kitlangton a26a2a9
test(server): migrate provider httpapi test to effect runner (#27216)
kitlangton 6fbb08b
test(project): migrate instance tests to effect runner (#27215)
kitlangton e16f4b6
test(permission): migrate next tests to effect runner (#27217)
kitlangton 16333b5
chore: generate
opencode-agent[bot] 0879f5e
test(server): migrate project init git test to Effect runner (#27218)
kitlangton 0f85172
perf(app): unmount closed review panel (#27221)
Hona 6cd2a74
chore: generate
opencode-agent[bot] c96a77c
test(pty): migrate session tests to Effect runner (#27222)
kitlangton b431474
chore: generate
opencode-agent[bot] 2f4dce7
app: use session_working helper to simplify loading states (#27212)
Brendonovich 91a9514
test(server): use AppFileSystem in provider tests (#27227)
kitlangton ff16eb8
test(project): use Deferred for dispose handoff (#27225)
kitlangton 80543fb
fix(desktop): resolve login shell when loading env (#26449)
qwq202 588b524
test(server): migrate worktree endpoint repro to effect runner (#27220)
kitlangton 13fbc9a
docs(effect): add cleanup roadmap (#27228)
kitlangton e3684f3
chore: delete unused util/abort module + orphaned leak test (#27230)
kitlangton 03cf833
test(provider): migrate DigitalOcean provider test to Effect runner (…
kitlangton 485ecbd
test(server): migrate global session list to effect runner (#27233)
kitlangton 0b67e1a
test(server): migrate session messages to Effect runner (#27234)
kitlangton 8370d0c
test(server): migrate httpapi ui tests to effect runner (#27236)
kitlangton d88cef6
test(mcp): migrate headers tests to Effect runner (#27237)
kitlangton 6d3b2fe
test(server): stabilize SDK project skill prompt test (#27239)
kitlangton 68c4951
test(mcp): migrate lifecycle tests to Effect runner (#27205)
kitlangton 913ea36
test(server): scope MCP HttpApi handler (#27226)
kitlangton 784796e
chore: generate
opencode-agent[bot] 77e51b0
zen: stat worker
fwang 8249bae
test(pty): migrate shell tests to Effect runner (#27238)
kitlangton 46daede
test(pty): migrate output isolation to Effect runner (#27235)
kitlangton ad6a8a1
fix: use htmlrewriter2 instead of HTMLRewriter for node compat (#26309)
Brendonovich c596120
chore: update nix node_modules hashes
opencode-agent[bot] 3be65df
fix: add optional chaining to session_status access (#27247)
Brendonovich 67e6408
fix: disable image module for now (#27248)
rekram1-node 90c13d9
fix(server): hide unknown 500 details (#27251)
nexxeln 10b99b2
build(ci): use native arm64 runner for desktop linux arm64 builds (#2…
Brendonovich 2820472
temporarily revert: preserve permission ordering by accepting a layer…
rekram1-node bed88ce
chore: generate
opencode-agent[bot] 4aaece2
feat(desktop): reintroduce AppStream MetaInfo for Linux desktop build…
Brendonovich 367665d
fix(cli): render tagged config errors (#27256)
nexxeln d3d7b44
chore: generate
opencode-agent[bot] dd46fdd
test(cli): cover config json diagnostics (#27257)
nexxeln 9fe9124
chore: generate
opencode-agent[bot] d93a064
refactor(app): clarify session_working logic in child-store (#27267)
Brendonovich e9a29e4
fix(storage): type not found errors (#27265)
nexxeln fed043a
fix(session): add typed message lookup wrappers (#27269)
nexxeln f01c6b3
fix(session): type message list not found errors (#27275)
nexxeln e5af7ab
chore: generate
opencode-agent[bot] 3a810fc
perf(ui): render icons through an svg sprite (#26950)
Hona 596f241
fix(app): enhance error handling by unwrapping SDK-wrapped errors in …
OpeOginni b0dc8e4
fix(session): use typed message reads in tools (#27280)
nexxeln 4b04171
fix(server): remove storage not found defect fallback (#27287)
nexxeln ccf93f3
fix(session): make message reads effectful (#27291)
nexxeln 2e7cf92
fix(worktree): type expected errors (#27296)
nexxeln 4498fc9
chore: generate
opencode-agent[bot] 2e94f50
chore: add low tps model alerts (#27055)
vimtor 374951b
chore: generate
opencode-agent[bot] 733bd3c
chore: activate low tps alerts
vimtor 809af5c
fix(provider): type auth errors (#27301)
nexxeln d488e3f
chore: generate
opencode-agent[bot] 5b2b300
fix(session): tighten http error contracts (#27308)
nexxeln 5975547
chore: generate
opencode-agent[bot] 4d20502
refactor(flags): route scout through runtime flags (#27318)
nexxeln 098bdd8
refactor(flags): route plan mode through runtime flags (#27320)
nexxeln f13fc5a
refactor(flags): route event system through runtime flags (#27323)
nexxeln 762020f
chore: delete unused util/network module (#27329)
kitlangton bc25342
chore: delete util/scrap module (#27330)
kitlangton bebe544
chore: delete unused util/color module (#27331)
kitlangton 8345152
core: expose v2 model listing API (#25821)
thdxr eed0edd
refactor(flags): route session workspaces through runtime flags (#27335)
nexxeln 8d5aa58
test(workspace): effectify sync start coverage (#27338)
kitlangton 766318a
effect(snapshot): migrate to AppProcess.run (#27189)
kitlangton 5b5376a
chore: generate
opencode-agent[bot] e28ef7b
refactor(flags): route sync workspaces through runtime flags (#27336)
nexxeln 72acdf0
chore: generate
opencode-agent[bot] 268d758
refactor(flags): route control-plane workspaces through runtime flags…
nexxeln 0b112e5
test: migrate permission task config tests (#27343)
kitlangton 7404664
refactor: migrate installation tests to testEffect (#27342)
kitlangton d43124a
ignore: notes
thdxr e7aed64
chore: generate
opencode-agent[bot] ca17ca8
chore: update nix node_modules hashes
opencode-agent[bot] 76c91c6
test: migrate mcp oauth browser tests (#27345)
kitlangton 02b8b0f
test: migrate file watcher test to Effect (#27346)
kitlangton 50dccac
chore: generate
opencode-agent[bot] 650f67a
chore: delete unused util/lock module (#27223)
kitlangton ca723f1
effect(core): add stdin option to AppProcess.run; migrate snapshot+cl…
kitlangton 6e25720
test(tool): use Effect sleep in edit concurrency test (#27349)
kitlangton 6c7f35b
effect(format): migrate to AppProcess (#27185)
kitlangton 832aa94
effect(worktree): migrate to AppProcess.run (#27186)
kitlangton e531984
test(server): migrate pty websocket input test (#27348)
kitlangton 5cdbb75
effect(installation): migrate to AppProcess.run (#27188)
kitlangton e5d13d9
effect(git): migrate to AppProcess.run (#27190)
kitlangton 655b25b
sync
fwang 25de3e4
test(acp): use shared instance fixture for event tests (#27351)
kitlangton f0635e3
test(session): use Effect polling in processor tests (#27354)
kitlangton 533495a
test(mcp): migrate OAuth auto-connect tests (#27356)
kitlangton 8ad3a4b
test(util): migrate log cleanup test to Effect (#27357)
kitlangton fa077b9
zen: update sticky session logic
fwang 7cc968b
chore: generate
opencode-agent[bot] a4ebb07
refactor(flags): route llm client through runtime flags (#27368)
nexxeln 52f9bcb
refactor(flags): route installation client through runtime flags (#27…
nexxeln 22a5e6c
fix(run): restore non-interactive exit behavior (#27371)
rekram1-node 20cec91
fix(provider): restore model suggestions (#27372)
nexxeln 9ee1f6c
fix(server): map busy sessions in http handlers (#27375)
nexxeln c197fd9
sync
fwang 3b7a5e7
fix keymap fallback priority and TUI config diagnostics (#27384)
kommander 0d07449
chore: update nix node_modules hashes
opencode-agent[bot] 0d8c9f3
docs: add LayerMap example (#27388)
kitlangton 44b432c
sync
fwang 73e1de4
sync release versions for v1.14.49
5182a36
test(workspace): use Effect for local session warp cases (#27393)
kitlangton 55e0af1
fix(provider): type model not found errors (#27334)
kitlangton df3895d
cleanup: make smallOptions rely on variants (#27390)
rekram1-node de1e0b5
test(workspace): effectify sync state cases (#27400)
kitlangton ccb207f
effect(util): migrate filesystem callers to AppFileSystem.Service (#2…
kitlangton 42e6b7d
effect(core): track stderr truncation; polish AppProcess callers (#27…
kitlangton 3f33be1
effect(server): typed errors in session/sync handlers, fix concurrenc…
kitlangton aa8a41d
effect(patch,tool): migrate patch/index and tool/read to AppFileSyste…
kitlangton 10c90eb
chore: generate
opencode-agent[bot] ba5c8d3
fix(llm): preserve tool error defects (#27403)
kitlangton 5e41dbb
test(effect): use Effect sleep in instance state tests (#27404)
kitlangton 9818c9e
fix(provider): make small model fallback optional (#27405)
kitlangton 16c457e
refactor(core): move models.dev into core (#27347)
thdxr faf8713
chore: generate
opencode-agent[bot] 5c35ea2
notification docs (#27406)
kommander 8e35358
test(format): remove formatter check sleeps (#27407)
kitlangton 3fc7486
test(session): fix shell-cancel race when trap hasn't installed yet (…
kitlangton edf7649
fix(session): type busy errors (#27410)
kitlangton 681594b
refactor(storage): remove not found wire serializer (#27416)
kitlangton b0ade40
flip back to markdown renderable (#27421)
kommander 33bb33b
chore: generate
opencode-agent[bot] 04286d0
docs(effect): plan Instance deletion path (#27424)
kitlangton b928a1f
fix(httpapi): preserve event stream context (#27425)
kitlangton cda8cc7
test(httpapi): simplify event stream regression coverage (#27427)
kitlangton ddad098
sync release versions for v1.14.50
c50d2b3
Refactor event HTTP API route modules (#27441)
rekram1-node 981e009
fix: image resizer wasm loading, reenable image resizing (#26805)
rekram1-node bfd707a
chore: generate
opencode-agent[bot] 2a7af6a
fix(tui): preserve text selection on question prompt options (#24988)
nikhil-patel-whatnot 4d83689
chore: update nix node_modules hashes
opencode-agent[bot] 9675579
fix: bug encountered when using azure gpt-5.5 w/ completions api (#26…
frederiknsgo c2723b5
chore: generate
opencode-agent[bot] e76cf96
fix(session): finalize interrupted assistant messages (#27254)
rekram1-node 7801557
refactor(server): centralize session busy mapping (#27473)
nexxeln 27ac53a
fix(server): stop exposing named defects (#27471)
nexxeln 0af2429
deps: Upgrade OpenTUI to 0.2.10 (#27491)
simonklee be6e7b3
refactor(provider): type init errors (#27484)
nexxeln 52db7a7
chore: update nix node_modules hashes
opencode-agent[bot] 7e43d3e
refactor(lsp): type initialize errors (#27494)
nexxeln f8c3f56
fix(desktop): await execFilePromise and read stdout properly (#27499)
Brendonovich 8c1ce0b
refactor(flags): simplify tui plugin runtime flags (#27506)
nexxeln e26abd8
fix(tool): close shell truncation stream (#27517)
nexxeln 337993d
feat(desktop): add mcp client registration status and authentication …
OpeOginni 9f8d8f5
chore: generate
opencode-agent[bot] 3c81326
docs(effect): refresh TODO with shipped P0 and RF work (#27536)
kitlangton 17af25d
chore: generate
opencode-agent[bot] 8f90697
chore: generate
opencode-agent[bot] e15fd0b
chore: generate
opencode-agent[bot] 7f7eb2e
fix(provider): remove LiteLLM workarounds ported upstream, requires L…
Sameerlite bdb0c16
chore: update web stats
adamdotdevin 22de34c
feat: add experimental background subagents (#27084)
nexxeln 756488d
chore: generate
opencode-agent[bot] 855bda8
test(question): wait on question events (#27124)
kitlangton 94564f3
fix(session): prevent double auto-compaction from filterCompacted reo…
kitlangton f6c8e35
chore: generate
opencode-agent[bot] b4fc5ef
refactor(http-recorder): tighten cassette safety, fix WS leaks + docs…
kitlangton 6039b89
chore: generate
opencode-agent[bot] d25cc42
docs(app): stale reference to removed multi-edit tool (#27579)
bo-tato d353a6b
fix(worktree): accept missing create payload (#27582)
kitlangton 83c145f
fix(plugin): scope digitalocean oauth to genai (#27599)
Spherrrical cccdeef
refactor(flags): migrate claude code skills flag to RuntimeFlags (#27…
nexxeln 34198f4
refactor(provider): use runtime flag for experimental models (#27606)
nexxeln f202226
refactor(flags): move bash timeout to runtime flags (#27607)
nexxeln 9914c9a
chore: generate
opencode-agent[bot] 76ff18a
refactor(format): move oxfmt flag to runtime flags (#27608)
nexxeln faca2b9
refactor(flags): migrate icon discovery runtime flag (#27609)
nexxeln 93b1ccc
chore: generate
opencode-agent[bot] e22cfa4
refactor(lsp): move ty flag to runtime flags (#27610)
nexxeln 43310f4
refactor(flags): move embedded web ui flag to runtime flags (#27613)
nexxeln d34a019
feat(provider): add NVIDIA endpoints origin header (#27394)
nv-kasikritc cb4f5cd
refactor(flags): move auto share to runtime flags (#27611)
nexxeln fc34c74
refactor(flags): move channel db flag to runtime flags (#27615)
nexxeln d35e09f
test(workspace): use runtime flags in workspace tests (#27612)
nexxeln 302ba0c
test(session): de-flake shell-cancel tests by waiting for busy state …
kitlangton 273ab56
test(bus): fix flaky subscriber races with readiness latch (#27625)
kitlangton 9d35b04
test(acp): replace fixed sleeps with pollUntil in event-subscription …
kitlangton dab567a
chore: generate
opencode-agent[bot] 4e143e3
test(lib): promote pollWithTimeout/awaitWithTimeout helpers (#27626)
kitlangton 7876901
chore: generate
opencode-agent[bot] 195f592
refactor(server): simplify listener lifecycle (#27413)
kitlangton 22e180b
sync: upstream 195f59264 (between v1.14.50 and v1.14.51)
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
.opencode/skills/improve-codebase-architecture/DEEPENING.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Deepening | ||
|
|
||
| How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [LANGUAGE.md](LANGUAGE.md) — **module**, **interface**, **seam**, **adapter**. | ||
|
|
||
| ## Dependency categories | ||
|
|
||
| When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam. | ||
|
|
||
| ### 1. In-process | ||
|
|
||
| Pure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed. | ||
|
|
||
| ### 2. Local-substitutable | ||
|
|
||
| Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface. | ||
|
|
||
| ### 3. Remote but owned (Ports & Adapters) | ||
|
|
||
| Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter. | ||
|
|
||
| Recommendation shape: _"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."_ | ||
|
|
||
| ### 4. True external (Mock) | ||
|
|
||
| Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter. | ||
|
|
||
| ## Seam discipline | ||
|
|
||
| - **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection. | ||
| - **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them. | ||
|
|
||
| ## Testing strategy: replace, don't layer | ||
|
|
||
| - Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them. | ||
| - Write new tests at the deepened module's interface. The **interface is the test surface**. | ||
| - Tests assert on observable outcomes through the interface, not internal state. | ||
| - Tests should survive internal refactors — they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface. |
44 changes: 44 additions & 0 deletions
44
.opencode/skills/improve-codebase-architecture/INTERFACE-DESIGN.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Interface Design | ||
|
|
||
| When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout) — your first idea is unlikely to be the best. | ||
|
|
||
| Uses the vocabulary in [LANGUAGE.md](LANGUAGE.md) — **module**, **interface**, **seam**, **adapter**, **leverage**. | ||
|
|
||
| ## Process | ||
|
|
||
| ### 1. Frame the problem space | ||
|
|
||
| Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate: | ||
|
|
||
| - The constraints any new interface would need to satisfy | ||
| - The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md)) | ||
| - A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete | ||
|
|
||
| Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel. | ||
|
|
||
| ### 2. Spawn sub-agents | ||
|
|
||
| Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module. | ||
|
|
||
| Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint: | ||
|
|
||
| - Agent 1: "Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point." | ||
| - Agent 2: "Maximise flexibility — support many use cases and extension." | ||
| - Agent 3: "Optimise for the most common caller — make the default case trivial." | ||
| - Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies." | ||
|
|
||
| Include both [LANGUAGE.md](LANGUAGE.md) vocabulary and CONTEXT.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language. | ||
|
|
||
| Each sub-agent outputs: | ||
|
|
||
| 1. Interface (types, methods, params — plus invariants, ordering, error modes) | ||
| 2. Usage example showing how callers use it | ||
| 3. What the implementation hides behind the seam | ||
| 4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md)) | ||
| 5. Trade-offs — where leverage is high, where it's thin | ||
|
|
||
| ### 3. Present and compare | ||
|
|
||
| Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**. | ||
|
|
||
| After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated — the user wants a strong read, not a menu. |
53 changes: 53 additions & 0 deletions
53
.opencode/skills/improve-codebase-architecture/LANGUAGE.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Language | ||
|
|
||
| Shared vocabulary for every suggestion this skill makes. Use these terms exactly — don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point. | ||
|
|
||
| ## Terms | ||
|
|
||
| **Module** | ||
| Anything with an interface and an implementation. Deliberately scale-agnostic — applies equally to a function, class, package, or tier-spanning slice. | ||
| _Avoid_: unit, component, service. | ||
|
|
||
| **Interface** | ||
| Everything a caller must know to use the module correctly. Includes the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. | ||
| _Avoid_: API, signature (too narrow — those refer only to the type-level surface). | ||
|
|
||
| **Implementation** | ||
| What's inside a module — its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise. | ||
|
|
||
| **Depth** | ||
| Leverage at the interface — the amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface. A module is **shallow** when the interface is nearly as complex as the implementation. | ||
|
|
||
| **Seam** _(from Michael Feathers)_ | ||
| A place where you can alter behaviour without editing in that place. The _location_ at which a module's interface lives. Choosing where to put the seam is its own design decision, distinct from what goes behind it. | ||
| _Avoid_: boundary (overloaded with DDD's bounded context). | ||
|
|
||
| **Adapter** | ||
| A concrete thing that satisfies an interface at a seam. Describes _role_ (what slot it fills), not substance (what's inside). | ||
|
|
||
| **Leverage** | ||
| What callers get from depth. More capability per unit of interface they have to learn. One implementation pays back across N call sites and M tests. | ||
|
|
||
| **Locality** | ||
| What maintainers get from depth. Change, bugs, knowledge, and verification concentrate at one place rather than spreading across callers. Fix once, fixed everywhere. | ||
|
|
||
| ## Principles | ||
|
|
||
| - **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts — they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface. | ||
| - **The deletion test.** Imagine deleting the module. If complexity vanishes, the module wasn't hiding anything (it was a pass-through). If complexity reappears across N callers, the module was earning its keep. | ||
| - **The interface is the test surface.** Callers and tests cross the same seam. If you want to test _past_ the interface, the module is probably the wrong shape. | ||
| - **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it. | ||
|
|
||
| ## Relationships | ||
|
|
||
| - A **Module** has exactly one **Interface** (the surface it presents to callers and tests). | ||
| - **Depth** is a property of a **Module**, measured against its **Interface**. | ||
| - A **Seam** is where a **Module**'s **Interface** lives. | ||
| - An **Adapter** sits at a **Seam** and satisfies the **Interface**. | ||
| - **Depth** produces **Leverage** for callers and **Locality** for maintainers. | ||
|
|
||
| ## Rejected framings | ||
|
|
||
| - **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead. | ||
| - **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know. | ||
| - **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| name: improve-codebase-architecture | ||
| description: Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable. | ||
| --- | ||
|
|
||
| # Improve Codebase Architecture | ||
|
|
||
| Surface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability. | ||
|
|
||
| ## Glossary | ||
|
|
||
| Use these terms exactly in every suggestion. Consistent language is the point — don't drift into "component," "service," "API," or "boundary." Full definitions in [LANGUAGE.md](LANGUAGE.md). | ||
|
|
||
| - **Module** — anything with an interface and an implementation (function, class, package, slice). | ||
| - **Interface** — everything a caller must know to use the module: types, invariants, error modes, ordering, config. Not just the type signature. | ||
| - **Implementation** — the code inside. | ||
| - **Depth** — leverage at the interface: a lot of behaviour behind a small interface. **Deep** = high leverage. **Shallow** = interface nearly as complex as the implementation. | ||
| - **Seam** — where an interface lives; a place behaviour can be altered without editing in place. (Use this, not "boundary.") | ||
| - **Adapter** — a concrete thing satisfying an interface at a seam. | ||
| - **Leverage** — what callers get from depth. | ||
| - **Locality** — what maintainers get from depth: change, bugs, knowledge concentrated in one place. | ||
|
|
||
| Key principles (see [LANGUAGE.md](LANGUAGE.md) for the full list): | ||
|
|
||
| - **Deletion test**: imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep. | ||
| - **The interface is the test surface.** | ||
| - **One adapter = hypothetical seam. Two adapters = real seam.** | ||
|
|
||
| This skill is _informed_ by the project's domain model. The domain language gives names to good seams; ADRs record decisions the skill should not re-litigate. | ||
|
|
||
| ## Process | ||
|
|
||
| ### 1. Explore | ||
|
|
||
| Read the project's domain glossary and any ADRs in the area you're touching first. | ||
|
|
||
| Then use the Agent tool with `subagent_type=Explore` to walk the codebase. Don't follow rigid heuristics — explore organically and note where you experience friction: | ||
|
|
||
| - Where does understanding one concept require bouncing between many small modules? | ||
| - Where are modules **shallow** — interface nearly as complex as the implementation? | ||
| - Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)? | ||
| - Where do tightly-coupled modules leak across their seams? | ||
| - Which parts of the codebase are untested, or hard to test through their current interface? | ||
|
|
||
| Apply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want. | ||
|
|
||
| ### 2. Present candidates | ||
|
|
||
| Present a numbered list of deepening opportunities. For each candidate: | ||
|
|
||
| - **Files** — which files/modules are involved | ||
| - **Problem** — why the current architecture is causing friction | ||
| - **Solution** — plain English description of what would change | ||
| - **Benefits** — explained in terms of locality and leverage, and also in how tests would improve | ||
|
|
||
| **Use CONTEXT.md vocabulary for the domain, and [LANGUAGE.md](LANGUAGE.md) vocabulary for the architecture.** If `CONTEXT.md` defines "Order," talk about "the Order intake module" — not "the FooBarHandler," and not "the Order service." | ||
|
|
||
| **ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly (e.g. _"contradicts ADR-0007 — but worth reopening because…"_). Don't list every theoretical refactor an ADR forbids. | ||
|
|
||
| Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?" | ||
|
|
||
| ### 3. Grilling loop | ||
|
|
||
| Once the user picks a candidate, drop into a grilling conversation. Walk the design tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive. | ||
|
|
||
| Side effects happen inline as decisions crystallize: | ||
|
|
||
| - **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md` — same discipline as `/grill-with-docs` (see [CONTEXT-FORMAT.md](../grill-with-docs/CONTEXT-FORMAT.md)). Create the file lazily if it doesn't exist. | ||
| - **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there. | ||
| - **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing — skip ephemeral reasons ("not worth it right now") and self-evident ones. See [ADR-FORMAT.md](../grill-with-docs/ADR-FORMAT.md). | ||
| - **Want to explore alternative interfaces for the deepened module?** See [INTERFACE-DESIGN.md](INTERFACE-DESIGN.md). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: This removes the migration-path edit approval guard; with default-permissive permissions, edits in
packages/opencode/migration/*will no longer require confirmation.Prompt for AI agents