Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

This project follows [Semantic Versioning](https://semver.org/). Release notes describe user-visible behavior; implementation details remain in the technical specification and commit history.

## [1.1.0] - 2026-09-15

### Added

- **Injection face mode `configured` (`injection.mode`)** — a third shell-injection mode that narrows the per-request task-tool description to exactly what can actually dispatch: when a favorites/visible set is configured, runtime dispatch is already gated by activation (configured ∪ session models) ∩ pool selection, so off-configured chain picks are dead context. `configured` skips the six-lane chain picks and injects only the configured models' shells, plus custom-lane and pool-config force-keeps (both stay dispatch-capable). With no favorites/visible set configured it behaves identically to `chain` (fail-open). Startup-level: restart to apply.
- **Shell subagent soft tiers with inline HANDOFF relay (shared absolute thresholds)** — shell subagents previously jumped straight from "no signal" to the hard-cap termination. Two graceful advisories now precede it, reusing the MAIN session's absolute soft/hard thresholds (soft 50k conserve / hard 90k hand-off by default — subagent context is equally token-expensive as main-session context), so there are no user-facing fraction coefficients: a conserve advisory (stop batch reads and long pastes, switch to targeted grep, keep outputs compact) and a hand-off advisory (finish the current unit, then end the final message with a compact handover block followed by the marker line `HANDOFF: inline · progress: n/m · next: <one sentence>`; that final message returns to the delegating session as the task result). The window-clamped effective cap still pulls the tiers down proportionally, so a tier can never exceed the real termination line and small-window shells keep headroom before it. Both report the measured numbers in absolute k, fire at most once per tier per shell session (in-memory dedup, cleared on session deletion; a restart re-arms), and ride the same per-turn system-prompt surface as the session watermark — the hard cap stays the termination backstop, and `subagentCap: false` disables the advisories together with it. The dispatcher side ships in the same release: the bundled protocol §2 gains the shell-handoff-relay rule (treat the handover block as the authoritative remaining-work state; start a fresh re-seeded dispatch, never resume the spent session). Config surface: the tiers follow the session's `softTokens`/`hardTokens`; the shell's termination line follows `forceTokens` by default, overridable via the now-optional `context.subagentForceTokens` (validated 20k..1M; invalid → deleted, falling back to `forceTokens`, fail-open). Restart to apply.
- **Per-turn `[ROUTE]` routing-discipline line** — main sessions now get one `[ROUTE]` line per turn, pushed after `[WATERMARK:SESSION]`/`[TODO]` under the same rules/banner visibility switch (both off = no line, respecting the zero-injection wish). It carries only what the injected lines lack today: the token cost model (hands-on spends and grows this session's context on every later turn; a dispatch spends a fresh shell context and returns a summary) and the declaration discipline, which protocol §6 widens from "before a major action" to "before each substantive action (the enumeration below is the minimum set, not the ceiling)". The line renders from a single pure module, so the text can never drift between surfaces. Restart to apply.
- **Language-preference ask follows the UI locale** — the first-run ask's three question texts are now localized into all 11 candidate tags (en, zh-CN, zh-TW, ja, ko, es, fr, de, it, pt, ru), detected at ask time from the environment (`LC_ALL` → `LANG`, env-style values like `zh_CN.UTF-8` normalized — `zh-HK` maps to `zh-TW` — with an English fallback when nothing matches) and surfaced once per ask activation in the status log (`lang ask locale=…`). Only the question texts localize: the `switchman-lang n/3:` marker prefix, the directive body and the gate's deny copy stay byte-stable English, so the plugin-side answer capture works identically in every locale. Restart to apply.
- **`dispatch: "off"` project opt-out** — a project can now stand down all dispatch governance by setting the top-level `"dispatch": "off"` in `.switchman/settings.json` (the same file the lang config lives in; read per call, so toggling takes effect on the next task call without a restart). Only the exact string `"off"` opts out — anything else (or an absent field) keeps fleet behavior, and a present-but-different value gets a one-time status-log note. When off, task calls are allowed ungoverned: the whole task path stands down (uninjected-shell and built-in-agent denies with their auto-redirects, all six gates including the breaker deny and the ROUTE_META/semantics checks). Deliberately still on: the subagent hard cap and its resume deny, the language gate, read/watermark gates, auto-handover, breaker failure recording, and the banner/watermark/TODO/`[LANG]` lines — the per-turn `[ROUTE]` line is the only prompt surface that hides. A `.switchman/settings.json` that is not valid JSON at all now warns once per process in the status log (`… is not valid JSON — ignored (lang config falls back to the AGENTS.md marker; "dispatch":"off" not applied)`); the "exists but no valid lang block" case stays silent as before. Restart to apply.

### Changed

- **Default context watermarks retuned 60/80/120k → 50/90/130k** — `context.softTokens` drops to 50,000 (the conserve/scan signal fires earlier), `context.hardTokens` rises to 90,000 (more wrap-up room before reads close) and `context.forceTokens` to 130,000 (longer auto-handover runway). Shell subagent advisories and the shared hard cap follow automatically: the conserve/hand-off tiers now sit at the 50k/90k lines and the default termination line is 130k (still clamped to 90% of the model's context window when known). Explicit `context.*` values in user jsonc are untouched. Restart to apply.
- **Read-only shells gain a read-only bash allowlist** — `ro` shells (the review/observe capability faces) previously denied **all** bash (`permission: { edit: "deny", bash: "deny" }`), so a reviewer could not even run `git diff` on the code it was auditing. `edit: "deny"` stays, and `bash` becomes an opencode permission object: a catch-all `"*": "deny"` first, then `allow` entries (opencode semantics: last matching rule wins, wildcard = zero-or-more chars, compound commands judged per segment) for read-only git subcommands with arbitrary arguments (`git status/diff/log/show/blame/rev-parse/ls-files/grep/shortlog/describe/merge-base`, `git stash list`), listing-only forms of the mutable git commands (`git branch`/`git tag`/`git remote` bare and listing flags, `git worktree list`, `git config --get/--list/-l`), and search/inspect utilities (`rg`, `grep`, `ls`, `fd`, `cat`, `head`, `tail`, `wc`, `tree`, `stat`, `file`, `du`, `df`, `pwd`, `which`, `sort`, `uniq`, `basename`, `dirname`, `realpath`, `date`, `whoami`). `find`/`sed`/`awk`/`echo` stay disallowed (they carry mutation forms: `-delete`/`-exec`, `-i`, `>` redirection); a parsed `git diff … > out` redirect may still pass its pattern — accepted, since `edit: "deny"` covers the edit/write/patch tools; compound commands are judged per segment, so `git diff && rm …` falls to the catch-all deny. The ro shell prompt gains a one-line note stating the restriction so review shells report findings instead of attempting writes. Restart to apply.
- **ROUTE_META gate downgraded from deny to synthesize-and-observe** — a delegation prompt with a missing or unparseable ROUTE_META line is no longer hard-denied: the gate synthesizes a lane-default META (lane from the shell's lane, the lane's default role, matching capability/modality, `source: auto`) and lets the dispatch through to the semantic checks with a status-log note. This also removes the three inconsistent corners where the old deny still bit (auto-redirect off, the review lane, synthesis failure) and collapses the prompt-rewriting synthesis retries into the gate itself — redirected dispatches now carry the prompt as-is. Behavior change on upgrade: projects that relied on the missing-META deny as a discipline prod lose it (the `[ROUTE]` line's declaration discipline is the replacement surface); a **present-but-wrong** META (an illegal field value, or a parseable line missing required fields) still denies with the sample attached — only absence is synthesized. Declaring META remains the contract that unlocks cross-family review ranking and `source: user` pinning. Restart to apply.

## [1.0.4] - 2026-09-11

### Added
Expand Down
7 changes: 4 additions & 3 deletions docs/2026-08-28-opencode-switchman-technical-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
> - v1.0: design finalized (shell matrix / six gates / ROUTE_META / breaker / quota awareness / cost awareness).
> - v1.1: implementation-stage verification errata — banner hook moved to `experimental.chat.system.transform`; shell landing changed to config-hook injection (no file generation); the `tools` field deprecated in favor of `permission`; thinking efforts moved to agent `options`; task argument name confirmed as `subagent_type`; failure bookkeeping main path moved to `event`; the Copilot usage endpoint and model catalog were field-tested, closing two pending items; added the three-pool quota switches, cost tiebreaker, and the token read-only red line.
> - v1.2: full-matrix shape established — enabled models × all declared thinking efforts; the enabled surface takes the model-management pin list as its first source of truth; the effort source of truth moved to models.dev `reasoning_options`.
> - v1.3 ([2026-09-15]): ro-shell permission errata — bare `bash: "deny"` blocked even `git diff` for review shells; `permission.bash` is now a read-only allowlist object (catch-all `"*": "deny"` first, specific allows after — opencode judges the last matching rule, per compound segment), covering git view subcommands, listing-only git forms, and search/inspect utilities; the ro prompt appends a one-line restriction note (§2.2, §2.3).

## 1. Requirements Overview

Expand Down Expand Up @@ -80,8 +81,8 @@ cfg.agent["copilot-mx-luna-low"] = {
mode: "subagent",
model: "github-copilot/gpt-5.6-luna",
options: { reasoningEffort: "low" }, // thinking effort mapped per family (§3.6)
permission: { edit: "deny", bash: "deny" }, // ro shells are read-only; rw shells omit this key
prompt: "<body of the 5 general rules>", // role contract / trust stated facts without re-checking / minimal necessity with file:line / verify before delivery / report honestly
permission: { edit: "deny", bash: { "*": "deny", "git diff*": "allow", "rg*": "allow", … } }, // [2026-09-15] ro shells: edit denied + read-only bash allowlist (git view subcommands, search/inspect utilities); rw shells omit this key
prompt: "<body of the 5 general rules>", // role contract / trust stated facts without re-checking / minimal necessity with file:line / verify before delivery / report honestly — ro shells append a one-line bash-restriction note
}
```

Expand Down Expand Up @@ -212,7 +213,7 @@ The plugin **stores no keys of its own and goes through no proxy**: credentials
### 3.3 Shells = Config-Hook Injection

- The plugin's `config(cfg)` hook loads `shells.json` and injects `cfg.agent[shell name]` for every enabled shell (shape in §2.3); user-defined agents are never overwritten.
- Frontmatter mapping: the `tools` field is deprecated → `permission` (ro shells deny `edit`/`bash`); `thoughtLevel` has no corresponding field → `options` (§2.9).
- Frontmatter mapping: the `tools` field is deprecated → `permission` (ro shells deny `edit` and use a read-only bash allowlist — [2026-09-15], see the v1.3 errata above); `thoughtLevel` has no corresponding field → `options` (§2.9).
- Global AGENTS.md injection has no per-agent switch; the fixed token cost is accepted.
- Risk fallback: if config injection does not take effect, degrade to writing `~/.config/opencode/agent/*.md` at startup (dual-track alternative, isolated behind a single switch in shells.ts).

Expand Down
Loading