Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

add Kilo Code and OpenChamber as first-class agent harnesses

[._.]/ Adam Eivyd1b09bdc527f
diff --git a/README.md b/README.md
index 3fe439a806..c1d83a651e 100644
--- a/README.md
+++ b/README.md
@@ -84,7 +84,7 @@ Bring your entire portfolio of projects under one roof.
An autonomous AI agent orchestrator that manages your development workflow. Submit a task, and CoS dispatches the right AI agent to handle it — then learns from the result. ([Full docs](./docs/features/chief-of-staff.md))
-- **Multi-Agent Orchestration** — Run Claude Code, Codex, Antigravity, Grok Build, Kimi Code, Cursor Agent, OpenCode, Ollama, and LM Studio concurrently with global and per-project limits, capacity management, and fair scheduling. Each CLI agent has a headless (`cli`) and an interactive terminal (`tui`) provider variant ([Agent Runner docs](./docs/features/cos-agent-runner.md))
+- **Multi-Agent Orchestration** — Run Claude Code, Codex, Antigravity, Grok Build, Kimi Code, Cursor Agent, OpenCode, Kilo Code, OpenChamber, Ollama, and LM Studio concurrently with global and per-project limits, capacity management, and fair scheduling. Each CLI agent has a headless (`cli`) and an interactive terminal (`tui`) provider variant ([Agent Runner docs](./docs/features/cos-agent-runner.md))
- **Intelligent Routing** — 7 agent skill templates (bug-fix, feature, feature-agent, security-audit, refactor, documentation, mobile-responsive) route tasks to the best model based on complexity ([Agent Skills docs](./docs/features/agent-skills.md))
- **Task Learning** — Tracks success rates, error patterns, and model performance to dynamically improve routing decisions ([Memory System docs](./docs/features/memory-system.md))
- **Goal Tracking** — Define goals and track progress across hundreds of completed tasks with success rate metrics
@@ -361,7 +361,7 @@ PortOS binds to `0.0.0.0` so you can access it from any device on your Tailscale
| **Frontend** | React 19, Vite 8, Tailwind CSS 4, Three.js, xterm.js |
| **Backend** | Express 5, Socket.IO, PM2, Zod validation |
| **Data** | PostgreSQL + pgvector (primary datastore — mandatory), JSON files for binary assets and synced/ephemeral state ([storage contract](./docs/STORAGE.md)) |
-| **AI** | Claude Code, Codex, Antigravity, Grok Build, Kimi Code, Cursor Agent, OpenCode, Ollama, LM Studio (via the in-tree AI toolkit, `server/lib/aiToolkit/`) |
+| **AI** | Claude Code, Codex, Antigravity, Grok Build, Kimi Code, Cursor Agent, OpenCode, Kilo Code, OpenChamber, Ollama, LM Studio (via the in-tree AI toolkit, `server/lib/aiToolkit/`) |
## Project Structure
@@ -404,7 +404,7 @@ Each registered app includes:
### AI Providers (`data/providers.json`)
Configure AI providers for the runner and Chief of Staff:
-- **CLI-based** (headless): Claude Code (incl. Bedrock), Codex, Antigravity, Grok Build, Kimi Code, Cursor Agent, OpenCode
+- **CLI-based** (headless): Claude Code (incl. Bedrock), Codex, Antigravity, Grok Build, Kimi Code, Cursor Agent, OpenCode, Kilo Code, OpenChamber (drives your running OpenChamber workspace through its control CLI)
- **TUI-based**: the same agents driven through a real terminal session, for the ones whose interactive mode does more than their headless mode
- **API-based**: OpenAI, Anthropic, Google, xAI, Cerebras, NVIDIA (with model tier management)
- **Local models**: Ollama, LM Studio (OpenAI-compatible endpoints)
diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.js
index adbf0bce28..38e994ddf1 100644
--- a/client/src/components/cos/constants.js
+++ b/client/src/components/cos/constants.js
@@ -285,7 +285,7 @@ export function pinnedPrCompletion(metadata) {
// UI copy for each reviewer in the Review Loop picker. `copilot` requests a
// GitHub Copilot review via the native reviewer API; CLI reviewers
-// (claude/antigravity/codex/grok/cursor/opencode/kimi) instruct the follow-up agent
+// (claude/antigravity/codex/grok/cursor/opencode/kilo/kimi) instruct the follow-up agent
// to invoke the named CLI; local-LLM reviewers (lmstudio/ollama/mtplx) route the
// diff through
// PortOS's `POST /api/code-review/local` endpoint, which runs the model
@@ -296,6 +296,7 @@ export function pinnedPrCompletion(metadata) {
const CODE_REVIEWERS_PAGE = getNavPageForPath('/models/code-reviewers')?.breadcrumb || 'its management page';
const REVIEWER_COPY = {
pi: { label: 'Pi', description: 'Pi Coding Agent CLI reviews the supplied diff without tools' },
+ kilo: { label: 'Kilo Code', description: `Kilo Code CLI (an OpenCode fork) reviews the PR diff (optional provider/model on ${CODE_REVIEWERS_PAGE})` },
copilot: { label: 'Copilot', description: 'GitHub Copilot (GitHub-only)' },
claude: { label: 'Claude', description: `Claude CLI reviews the PR diff (optional model on ${CODE_REVIEWERS_PAGE}; supports an Ollama-backed Claude for local-only setups)` },
antigravity: { label: 'Antigravity', description: 'Antigravity CLI (agy) reviews the PR diff' },
diff --git a/client/src/components/models/HarnessesTab.jsx b/client/src/components/models/HarnessesTab.jsx
index 9fc91646c7..d6bf4740d3 100644
--- a/client/src/components/models/HarnessesTab.jsx
+++ b/client/src/components/models/HarnessesTab.jsx
@@ -19,8 +19,9 @@ import InlineConfirmRow from '../ui/InlineConfirmRow';
/**
* Models → Harnesses: the coding-agent CLIs/TUIs this install drives.
*
- * A harness is one binary — `opencode`, `claude`, `codex`, `agy`, `grok`,
- * `kimi`, `cursor-agent` — that several provider records share. The Providers
+ * A harness is one binary — `opencode`, `kilo`, `openchamber`, `claude`,
+ * `codex`, `agy`, `grok`, `kimi`, `cursor-agent` — that several provider
+ * records share. The Providers
* page could already install a MISSING one from its card, but nothing showed
* which version was installed, whether it was stale, how to update it, or which
* models this install of it actually knows about. So an OpenCode months behind
diff --git a/client/src/hooks/useReviewerModelOptions.js b/client/src/hooks/useReviewerModelOptions.js
index cf1ddeef7c..33db8b3127 100644
--- a/client/src/hooks/useReviewerModelOptions.js
+++ b/client/src/hooks/useReviewerModelOptions.js
@@ -165,6 +165,10 @@ export default function useReviewerModelOptions() {
// text input it used to be. Still free-text underneath: `opencode -m` takes
// any `provider/model` the user's own config resolves.
opencode: providerTiers('opencode'),
+ // Kilo forks OpenCode's `provider/model` ids and its `models` subcommand,
+ // so this is whatever the Harnesses page last refreshed onto the shipped
+ // records — empty until then, with free-text keeping the cell usable.
+ kilo: providerTiers('kilo'),
mtplx: providerTiers('mtplx'),
};
@@ -185,6 +189,9 @@ export default function useReviewerModelOptions() {
// config names — not to the PortOS record's default. Naming a model here
// would claim a default the run won't use.
opencode: null,
+ // Same reasoning as `opencode`: the reviewer spawns a bare `kilo`, which
+ // falls back to the model the user's own Kilo config names.
+ kilo: null,
mtplx: providerDefault('mtplx'),
};
diff --git a/client/src/hooks/useReviewerModelOptions.test.jsx b/client/src/hooks/useReviewerModelOptions.test.jsx
index b35108a9eb..365f7c936f 100644
--- a/client/src/hooks/useReviewerModelOptions.test.jsx
+++ b/client/src/hooks/useReviewerModelOptions.test.jsx
@@ -40,6 +40,9 @@ const providers = [
// the config PortOS injects, so the reviewer (a BARE `opencode`) must not
// offer them.
{ id: 'opencode-ollama', type: 'cli', command: 'opencode', ollamaBacked: true, models: ['qwen3-coder:30b'] },
+ // Kilo forks OpenCode's `provider/model` ids; its shipped records carry no
+ // backend marker, so the Harnesses refresh fills them from `kilo models`.
+ { id: 'kilo-cli', type: 'cli', command: 'kilo', models: ['anthropic/claude-opus-5'], defaultModel: 'anthropic/claude-opus-5' },
];
describe('useReviewerModelOptions', () => {
@@ -53,6 +56,10 @@ describe('useReviewerModelOptions', () => {
const { result } = renderHook(() => useReviewerModelOptions());
await waitFor(() => expect(result.current.loaded).toBe(true));
expect(result.current.optionsByReviewer.pi).toEqual(['example/model-a']);
+ expect(result.current.optionsByReviewer.kilo).toEqual(['anthropic/claude-opus-5']);
+ // A bare `kilo` falls back to the user's own configured model, so naming a
+ // default here would claim one the run will not use.
+ expect(result.current.defaultModels.kilo).toBeNull();
for (const reviewer of MODEL_SELECTABLE_REVIEWERS) {
expect(Array.isArray(result.current.optionsByReviewer[reviewer])).toBe(true);
}
diff --git a/client/src/lib/reviewerPins.js b/client/src/lib/reviewerPins.js
index 6ff8aa2933..9b1ba8b38b 100644
--- a/client/src/lib/reviewerPins.js
+++ b/client/src/lib/reviewerPins.js
@@ -38,7 +38,7 @@ import { codexEffortLevelsForModel } from '../../../server/lib/providerModels.js
// EFFORT_SELECTABLE_REVIEWERS below: `grok`/`opencode`/`kimi` take a model but no
// pickable effort, and Cursor takes both while carrying its effort INSIDE the
// model id rather than as a separate flag.
-export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kimi'];
+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kilo', 'kimi'];
// The local-LLM backends, which take both a model and an effort.
export const LOCAL_LLM_REVIEWERS = ['lmstudio', 'ollama', 'mtplx'];
@@ -149,7 +149,7 @@ export const sanitizeReviewerModelInput = (raw) =>
// never offer a slug the server's enum would reject. Mirror of REVIEWER_VALUES —
// a reviewer listed here but unknown to the server leaves the user configuring a
// review-loop reviewer that never runs; the reverse hides one their install has.
-export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'cursor', 'pi', 'opencode', 'kimi', 'lmstudio', 'ollama', 'mtplx'];
+export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'cursor', 'pi', 'opencode', 'kilo', 'kimi', 'lmstudio', 'ollama', 'mtplx'];
// The reviewer identity used for Copilot-specific handling. An empty default
// reviewer list keeps code review opt-in on a fresh install.
diff --git a/data.reference/providers.json b/data.reference/providers.json
index 58371d2964..9ea72ac90a 100644
--- a/data.reference/providers.json
+++ b/data.reference/providers.json
@@ -1,6 +1,57 @@
{
"activeProvider": "claude-code-tui",
"providers": {
+ "kilo-cli": {
+ "id": "kilo-cli",
+ "name": "Kilo Code CLI",
+ "type": "cli",
+ "command": "kilo",
+ "args": [
+ "run",
+ "--auto"
+ ],
+ "models": [],
+ "defaultModel": null,
+ "timeout": 600000,
+ "enabled": false,
+ "envVars": {},
+ "secretEnvVars": []
+ },
+ "kilo-tui": {
+ "id": "kilo-tui",
+ "name": "Kilo Code TUI",
+ "type": "tui",
+ "command": "kilo",
+ "args": [
+ "--auto"
+ ],
+ "models": [],
+ "defaultModel": null,
+ "timeout": 600000,
+ "enabled": false,
+ "envVars": {},
+ "secretEnvVars": [],
+ "tuiPromptDelayMs": 2500
+ },
+ "openchamber-cli": {
+ "id": "openchamber-cli",
+ "name": "OpenChamber",
+ "type": "cli",
+ "command": "openchamber",
+ "args": [
+ "session",
+ "create",
+ "--wait",
+ "--last-assistant",
+ "--quiet"
+ ],
+ "models": [],
+ "defaultModel": null,
+ "timeout": 600000,
+ "enabled": false,
+ "envVars": {},
+ "secretEnvVars": []
+ },
"pi-cli": {
"id": "pi-cli",
"name": "Pi Coding Agent CLI",
diff --git a/docs/API.md b/docs/API.md
index d878d2aef3..a924512b95 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -123,7 +123,7 @@ legacy list for local Apps/Dashboard views.
| DELETE | `/providers/:id` | Delete provider |
| POST | `/providers/:id/test` | Test provider connectivity |
| PUT | `/providers/active` | Set active provider |
-| GET | `/providers/runtimes` | Per-runtime install status (`claude`, `codex`, `opencode`, `grok`, `kimi`, `agy`, `cursor-agent`): is the binary runnable here, and can PortOS install it? Booleans and labels only — never resolved filesystem paths. 60s TTL cache. Ollama / LM Studio are absent on purpose — Models → LLMs owns their install. |
+| GET | `/providers/runtimes` | Per-runtime install status (`claude`, `codex`, `opencode`, `kilo`, `openchamber`, `grok`, `kimi`, `agy`, `cursor-agent`): is the binary runnable here, and can PortOS install it? Booleans and labels only — never resolved filesystem paths. 60s TTL cache. Ollama / LM Studio are absent on purpose — Models → LLMs owns their install. |
| POST | `/providers/runtimes/install?runtime=<id>` | Install one runtime from the installer's fixed table, streaming installer output as SSE. Rejects any id not in the table. |
| GET | `/providers/readiness` | Requirements checklist per provider backed by a LOCAL daemon (llama.cpp / Ollama / LM Studio / MTPLX), keyed by provider id: is the daemon installed, is it answering at the endpoint THIS provider points at, and is it serving the provider's default model. Each entry also carries `setup` — what the one-click fix below can do about the unmet checks (`null` when nothing is auto-fixable here). Each entry also carries `contextWindows` — what the daemon is SERVING right now, keyed by every spelling the provider could dispatch under, or `null` when it is down or silent about them; the provider card budgets its meter with it so the number matches what the pre-dispatch gate enforces, and it is never written back to the stored provider record. Providers with no local dependency are absent from the map. Complements `/providers/runtimes` (which answers "can PortOS run this CLI?"). Booleans, labels, and the provider's own endpoint only — never a resolved binary path. Skips disabled providers; 15s endpoint-probe cache (one probe per distinct endpoint), 60s binary-PATH cache, both dropped by the llama-server start/stop/install routes. |
| POST | `/providers/readiness/setup?provider=<id>` | Install and/or start the LOCAL DAEMON that provider points at (llama.cpp / Ollama / LM Studio / MTPLX), streaming progress as SSE — the "do it for me" half of `/providers/readiness`, so an unmet requirement is fixed from the card instead of from a vendor setup doc. The request names a PROVIDER only: the runtime kind and endpoint are re-derived server-side from the stored record, so no query value reaches a spawn argument (an optional `runtime=` is cross-checked and 409s on a mismatch). Every command comes from a fixed per-runtime table. Never downloads model weights, never starts llama-server (it needs a checkpoint you choose), and never runs MTPLX's privileged fan-control helper. Single-flight. |
@@ -140,13 +140,13 @@ legacy list for local Apps/Dashboard views.
### Harnesses
-The coding-agent CLIs/TUIs PortOS drives (`opencode`, `claude`, `codex`, `agy`, `grok`, `kimi`, `cursor-agent`), managed as things in their own right rather than as a footnote on a provider card. Backs **Models → Harnesses**. Every response carries booleans, versions, and labels — never a resolved filesystem path, which would disclose the host account name.
+The coding-agent CLIs/TUIs PortOS drives (`opencode`, `kilo`, `openchamber`, `claude`, `codex`, `agy`, `grok`, `kimi`, `cursor-agent`), managed as things in their own right rather than as a footnote on a provider card. Backs **Models → Harnesses**. Every response carries booleans, versions, and labels — never a resolved filesystem path, which would disclose the host account name.
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/harnesses?fresh=1` | Every harness with its installed version, the latest published version (npm-backed rows only), whether an update is available, which lifecycle actions it supports, and the provider records riding on it. `version`/`latestVersion` are `null` for NOT KNOWN, never `0.0.0` — `updateAvailable` is set only on a definite "installed < latest", so an offline host shows no false staleness badge. `fresh=1` bypasses both the 60s runtime-status TTL and the 6h registry cache. |
| POST | `/harnesses/action?runtime=<id>&action=install\|update\|uninstall` | Run one lifecycle action, streaming the child's output as SSE. `action` defaults to `install`. Update prefers the vendor's OWN updater (`opencode upgrade`, `claude update`) — the only path that refreshes the copy actually on PATH when the user installed it from Homebrew or a vendor script. Remove is offered only for npm-installed rows, and reports an error rather than success if the binary is still runnable afterwards. One action at a time process-wide (npm's global prefix is one directory); closing the stream cancels the child. Both values are table keys — nothing from the request reaches a shell word. |
-| POST | `/harnesses/models/refresh?runtime=<id>` | Re-read a harness's own model catalog (`opencode models`, `agy models`, `grok models`) and write it to every provider that draws from that catalog — i.e. a wrapper with no local-runtime marker and no `gatewayBacked`, since a gateway- or Ollama-backed wrapper serves ids the harness never lists. Answers `{ ok, models, updated }`. A probe that runs but parses to nothing is a **409**, not an empty write: a signed-out CLI must not blank every picker. |
+| POST | `/harnesses/models/refresh?runtime=<id>` | Re-read a harness's own model catalog (`opencode models`, `kilo models`, `agy models`, `grok models`) and write it to every provider that draws from that catalog — i.e. a wrapper with no local-runtime marker and no `gatewayBacked`, since a gateway- or Ollama-backed wrapper serves ids the harness never lists. Answers `{ ok, models, updated }`. A probe that runs but parses to nothing is a **409**, not an empty write: a signed-out CLI must not blank every picker. |
### AI Runs
diff --git a/scripts/migrations/390-kilo-openchamber-providers.js b/scripts/migrations/390-kilo-openchamber-providers.js
new file mode 100644
index 0000000000..5d0dbc70fc
--- /dev/null
+++ b/scripts/migrations/390-kilo-openchamber-providers.js
@@ -0,0 +1,75 @@
+/**
+ * Ship the disabled Kilo Code and OpenChamber harness presets to existing
+ * installs, so the two new harnesses are reachable without a hand-typed record.
+ *
+ * Both are DISABLED and this migration installs nothing: it downloads no CLI,
+ * starts no server, and contacts no provider (AGENTS.md, "No cold-bootstrap LLM
+ * calls"). `models` ships EMPTY and `defaultModel` null — Kilo serves whatever
+ * the user's own `/connect` credentials reach, and OpenChamber serves whatever
+ * its runtime is signed in to, so neither list can be guessed here. Kilo's is
+ * filled by an explicit refresh (`kilo models`, via Models → Harnesses).
+ *
+ * The argv each preset ships is the one the vendor rows build, so a user who
+ * never touches these records runs the same command line PortOS would inject:
+ *
+ * - `kilo run --auto` / `kilo --auto` — `--auto` is what lets an unattended
+ * run get past Kilo's permission prompts (see `server/lib/kilo.js`).
+ * - `openchamber session create --wait --last-assistant --quiet` — the
+ * control-plane action that runs a prompt and prints the answer. `--dir`
+ * and `--prompt` are deliberately ABSENT: they are spliced in at spawn time
+ * from the run's real working directory (see `server/lib/openchamber.js`).
+ *
+ * There is no OpenChamber `tui` preset. Its interactive surface is a web app and
+ * the bare binary starts its SERVER, so a PTY record would launch a daemon and
+ * call it an agent.
+ *
+ * An install that already owns one of these ids is left untouched, so a user who
+ * renamed or disabled the row keeps their record.
+ */
+import { makeProviderSeedMigration } from './_lib.js';
+
+export default makeProviderSeedMigration({
+ label: 'Kilo Code and OpenChamber',
+ defs: [
+ {
+ id: 'kilo-cli',
+ name: 'Kilo Code CLI',
+ type: 'cli',
+ command: 'kilo',
+ args: ['run', '--auto'],
+ models: [],
+ defaultModel: null,
+ timeout: 600000,
+ enabled: false,
+ envVars: {},
+ secretEnvVars: [],
+ },
+ {
+ id: 'kilo-tui',
+ name: 'Kilo Code TUI',
+ type: 'tui',
+ command: 'kilo',
+ args: ['--auto'],
+ models: [],
+ defaultModel: null,
+ timeout: 600000,
+ enabled: false,
+ envVars: {},
+ secretEnvVars: [],
+ tuiPromptDelayMs: 2500,
+ },
+ {
+ id: 'openchamber-cli',
+ name: 'OpenChamber',
+ type: 'cli',
+ command: 'openchamber',
+ args: ['session', 'create', '--wait', '--last-assistant', '--quiet'],
+ models: [],
+ defaultModel: null,
+ timeout: 600000,
+ enabled: false,
+ envVars: {},
+ secretEnvVars: [],
+ },
+ ],
+});
diff --git a/scripts/migrations/390-kilo-openchamber-providers.test.js b/scripts/migrations/390-kilo-openchamber-providers.test.js
new file mode 100644
index 0000000000..3c5506ecd2
--- /dev/null
+++ b/scripts/migrations/390-kilo-openchamber-providers.test.js
@@ -0,0 +1,35 @@
+import { it, expect } from 'vitest';
+import { mkdtemp, mkdir, writeFile, readFile, rm } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import migration from './390-kilo-openchamber-providers.js';
+
+it('adds the disabled presets idempotently without replacing local configuration', async () => {
+ const rootDir = await mkdtemp(join(tmpdir(), 'kilo-openchamber-seed-'));
+ await mkdir(join(rootDir, 'data'));
+ const path = join(rootDir, 'data/providers.json');
+ const custom = { id: 'kilo-cli', command: '/opt/bin/kilo', enabled: true };
+ await writeFile(path, JSON.stringify({ activeProvider: 'kilo-cli', providers: { 'kilo-cli': custom } }));
+
+ await migration.up({ rootDir });
+ const once = await readFile(path, 'utf8');
+ await migration.up({ rootDir });
+ expect(await readFile(path, 'utf8')).toBe(once);
+
+ const state = JSON.parse(once);
+ expect(state.activeProvider).toBe('kilo-cli');
+ expect(state.providers['kilo-cli']).toEqual(custom);
+ expect(state.providers['kilo-tui']).toMatchObject({
+ enabled: false, models: [], defaultModel: null, command: 'kilo', args: ['--auto'],
+ });
+ // `--dir`/`--prompt` are supplied at spawn time from the run's real cwd, so a
+ // seeded record that baked either would pin the wrong directory forever.
+ expect(state.providers['openchamber-cli'].args).toEqual(
+ ['session', 'create', '--wait', '--last-assistant', '--quiet'],
+ );
+ expect(state.providers['openchamber-cli']).toMatchObject({ type: 'cli', enabled: false });
+ // OpenChamber's interactive surface is a web app — no PTY record may ship.
+ expect(state.providers['openchamber-tui']).toBeUndefined();
+
+ await rm(rootDir, { recursive: true });
+});
diff --git a/server/cos-runner/allowedCommands.js b/server/cos-runner/allowedCommands.js
index 5603c74b30..cd727f78a7 100644
--- a/server/cos-runner/allowedCommands.js
+++ b/server/cos-runner/allowedCommands.js
@@ -20,9 +20,15 @@ import { PROVIDER_VENDORS, EXTRA_ALLOWED_COMMANDS } from '../lib/providerVendors
* becomes spawnable here without a second hand-maintained list, plus
* EXTRA_ALLOWED_COMMANDS for legacy/custom commands with no vendor row
* (aider, copilot).
+ *
+ * `commandAliases` matters as much as `inferredCommand`: a vendor whose
+ * `matchCommand` accepts a second spelling (`kilocode` for `kilo`,
+ * `antigravity` for `agy`) classifies such a record everywhere else in PortOS,
+ * so omitting it here made the record spawnable nowhere — a 400 at /spawn-tui
+ * with the agent dead before it got a shell.
*/
export const ALLOWED_COMMANDS = new Set([
- ...PROVIDER_VENDORS.map((vendor) => vendor.inferredCommand),
+ ...PROVIDER_VENDORS.flatMap((vendor) => [vendor.inferredCommand, ...(vendor.commandAliases || [])]),
...EXTRA_ALLOWED_COMMANDS,
]);
diff --git a/server/cos-runner/index.js b/server/cos-runner/index.js
index a79704bfa5..8d035e7353 100644
--- a/server/cos-runner/index.js
+++ b/server/cos-runner/index.js
@@ -449,7 +449,7 @@ app.post('/spawn', async (req, res) => {
// and the trailing --print marker swallows the next flag as its "prompt".
// - Grok on Windows: `/dev/stdin` rewritten to a temp file → useStdin=false.
// - Every other provider: unchanged, prompt over stdin → useStdin=true.
- const { args: deliveredArgs, useStdin, cleanup: cleanupPromptFile } = prepareCliPrompt(command, spawnArgs, prompt);
+ const { args: deliveredArgs, useStdin, cleanup: cleanupPromptFile } = prepareCliPrompt(command, spawnArgs, prompt, { cwd });
const { command: spawnCommand, args: finalSpawnArgs } = prepareCliSpawn(command, deliveredArgs, childEnv);
// Spawn the CLI process
diff --git a/server/cos-runner/index.test.js b/server/cos-runner/index.test.js
index c996bba0d2..646658711c 100644
--- a/server/cos-runner/index.test.js
+++ b/server/cos-runner/index.test.js
@@ -57,9 +57,12 @@ describe('cos-runner spawn — per-provider prompt delivery (antigravity --print
// Antigravity (`agy`) takes the prompt as the --print VALUE and does NOT read
// stdin; without this the prompt never reaches the model. prepareCliPrompt
// rewrites the argv (and returns useStdin=false for agy) before the resolve.
- const prepareIdx = RUNNER_SRC.indexOf('prepareCliPrompt(command, spawnArgs, prompt)');
+ // The trailing options object carries the run's `cwd`, which OpenChamber
+ // needs as the `--dir` its control plane cannot infer — pinned here so a
+ // refactor cannot drop it and leave that harness running in the wrong tree.
+ const prepareIdx = RUNNER_SRC.indexOf('prepareCliPrompt(command, spawnArgs, prompt, { cwd })');
const resolveIdx = RUNNER_SRC.indexOf('prepareCliSpawn(command, deliveredArgs, childEnv)');
- expect(prepareIdx, 'must call prepareCliPrompt(command, spawnArgs, prompt)').toBeGreaterThan(-1);
+ expect(prepareIdx, 'must call prepareCliPrompt(command, spawnArgs, prompt, { cwd })').toBeGreaterThan(-1);
expect(resolveIdx, 'must resolve the delivered argv').toBeGreaterThan(-1);
expect(prepareIdx, 'prompt delivery runs before the spawn resolve').toBeLessThan(resolveIdx);
});
diff --git a/server/lib/README.md b/server/lib/README.md
index f1b78b006c..31f48b9c15 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -673,3 +673,5 @@ pm` default, `NPM_CONFIG_PREFIX`, nvm/Volta) installed `codex` successfully and
| `mindToolRecipes.js` | Closed recipe schemas, current semantic-contract validation, and safe JSON field binding resolution. |
| `deckTemplates.js` | Decks (playing cards / tarot): kind alphabet, per-kind card roster (`deckCardRoster`), shared layout clause, render prompt composition (`composeCardRenderPrompt`), per-card status and `deckCompletion`, plus `deckCardSize` / `deckCardAspectStyle` (persisted trim → thumbnail box). Pure — re-exported by `client/src/lib/decks.js`. |
| `deckValidation.js` | Zod schemas + limits for the `/api/decks` routes (create/update deck, card patch, sample analysis, prompt generation, render). |
+| `kilo.js` | Kilo Code command identity (`kilo`/`kilocode`), `run` headless argv, `--auto` approval posture, and TUI arguments. |
+| `openchamber.js` | OpenChamber control-CLI identity, `session create` headless argv, `provider/model` gate, and `--dir`/`--prompt` spawn-time delivery. |
diff --git a/server/lib/aiToolkit/defaults/providers.sample.json b/server/lib/aiToolkit/defaults/providers.sample.json
index 81d0626cce..adbb8547a2 100644
--- a/server/lib/aiToolkit/defaults/providers.sample.json
+++ b/server/lib/aiToolkit/defaults/providers.sample.json
@@ -1,6 +1,57 @@
{
"activeProvider": "claude-code-tui",
"providers": {
+ "kilo-cli": {
+ "id": "kilo-cli",
+ "name": "Kilo Code CLI",
+ "type": "cli",
+ "command": "kilo",
+ "args": [
+ "run",
+ "--auto"
+ ],
+ "models": [],
+ "defaultModel": null,
+ "timeout": 600000,
+ "enabled": false,
+ "envVars": {},
+ "secretEnvVars": []
+ },
+ "kilo-tui": {
+ "id": "kilo-tui",
+ "name": "Kilo Code TUI",
+ "type": "tui",
+ "command": "kilo",
+ "args": [
+ "--auto"
+ ],
+ "models": [],
+ "defaultModel": null,
+ "timeout": 600000,
+ "enabled": false,
+ "envVars": {},
+ "secretEnvVars": [],
+ "tuiPromptDelayMs": 2500
+ },
+ "openchamber-cli": {
+ "id": "openchamber-cli",
+ "name": "OpenChamber",
+ "type": "cli",
+ "command": "openchamber",
+ "args": [
+ "session",
+ "create",
+ "--wait",
+ "--last-assistant",
+ "--quiet"
+ ],
+ "models": [],
+ "defaultModel": null,
+ "timeout": 600000,
+ "enabled": false,
+ "envVars": {},
+ "secretEnvVars": []
+ },
"pi-cli": {
"id": "pi-cli",
"name": "Pi Coding Agent CLI",
diff --git a/server/lib/aiToolkit/internal/modelFetchers.test.js b/server/lib/aiToolkit/internal/modelFetchers.test.js
index fe7a4817f2..c46b5dc5e0 100644
--- a/server/lib/aiToolkit/internal/modelFetchers.test.js
+++ b/server/lib/aiToolkit/internal/modelFetchers.test.js
@@ -55,6 +55,14 @@ const SHIPPED_NOT_REFRESHABLE = [
'claude-code-tui', 'claude-code-tui-bedrock',
'grok-cli', 'grok-tui', 'kimi-cli', 'kimi-tui',
'opencode-zen-cli', 'opencode-zen-tui',
+ // Kilo is an OpenCode fork and follows the same split as the Zen wrappers
+ // above: its catalog comes from the binary's own `kilo models`, which is the
+ // Models → Harnesses "Refresh models" path, not a card-side endpoint probe.
+ 'kilo-cli', 'kilo-tui',
+ // OpenChamber's catalog belongs to the runtime the user signed in to, and its
+ // `models` subcommand prints that runtime's SETTINGS, not a catalog — nothing
+ // here or on the Harnesses page can enumerate it.
+ 'openchamber-cli',
];
describe('MODEL_FETCHERS — shipped catalog visibility is unchanged', () => {
diff --git a/server/lib/cliProviderRun.js b/server/lib/cliProviderRun.js
index f5ffb15370..52ae22ea5b 100644
--- a/server/lib/cliProviderRun.js
+++ b/server/lib/cliProviderRun.js
@@ -132,7 +132,7 @@ export function runCliProviderPrompt(args = {}) {
// past the trailing `--print` marker. prepareAntigravityPrompt relocates the
// `--print <prompt>` pair to the very end to absorb that (#4110) — don't
// "fix" it by re-ordering the concatenation above.
- const { args: spawnArgs, useStdin, cleanup: cleanupPromptFile } = prepareCliPrompt(provider.command, builtArgs, prompt);
+ const { args: spawnArgs, useStdin, cleanup: cleanupPromptFile } = prepareCliPrompt(provider.command, builtArgs, prompt, { cwd });
return new Promise((resolve) => {
let stdout = '';
diff --git a/server/lib/harnessOutput.js b/server/lib/harnessOutput.js
index ce3679a7ea..c1a87fe203 100644
--- a/server/lib/harnessOutput.js
+++ b/server/lib/harnessOutput.js
@@ -4,8 +4,8 @@ import { parsePiModelList } from './aiToolkit/internal/pi.js';
* banner and its model catalog.
*
* A harness is the CLI/TUI binary a provider shells out to (`opencode`,
- * `claude`, `codex`, `agy`, `grok`, `kimi`, `cursor-agent`). PortOS could
- * already answer "is it on PATH?" (`services/providerRuntimeInstaller.js`); the
+ * `kilo`, `openchamber`, `claude`, `codex`, `agy`, `grok`, `kimi`,
+ * `cursor-agent`). PortOS could already answer "is it on PATH?" (`services/providerRuntimeInstaller.js`); the
* Harnesses page also needs "which version, and which models does THIS install
* of it know about?" — and every vendor answers both in its own shape.
*
@@ -115,6 +115,9 @@ const parseGrokModels = (lines) => lines
const MODEL_PARSERS = {
pi: (lines) => parsePiModelList(lines.join('\n')),
opencode: parseOpencodeModels,
+ // Kilo is an OpenCode fork and `kilo models` prints the same one
+ // `provider/model` per line, which is also what its `--model` takes.
+ kilo: parseOpencodeModels,
grok: parseGrokModels,
// Delegated — these two vendors' stdout shapes are already owned elsewhere.
// Both take the raw stdout rather than the pre-split lines, so they are
diff --git a/server/lib/importScoping.test.js b/server/lib/importScoping.test.js
index 3ca139092a..01933874ab 100644
--- a/server/lib/importScoping.test.js
+++ b/server/lib/importScoping.test.js
@@ -641,7 +641,24 @@ describe('deferred imports stay deferred (#6156)', () => {
// raise restores the ~1.5k of headroom this is meant to carry — the previous
// number had drifted back to three above the measured total, the same
// zero-headroom state #6305 raised it out of, where any addition at all fails.
-const MAX_STATIC_INSTANTIATIONS = 107700;
+//
+// Raised to 109,200 for the Kilo Code and OpenChamber harnesses. Measured after
+// the change: 107,699, so their own cost is +816 against the 106,883 this stood
+// at beforehand. There is no new edge into a heavy subtree: `lib/kilo.js` and
+// `lib/openchamber.js` are browser-safe leaves whose whole closure is
+// `providerModels.js`, and almost all of the cost is those two nodes appearing
+// on each of the ~375 closures that already reach `lib/providerVendors.js` —
+// adding a vendor to that registry is what makes it one row instead of N call
+// sites, and this is the price of the row. The rest is three new suites
+// (`lib/kilo.test.js`, `lib/openchamber.test.js`, `lib/providerHarnesses.test.js`)
+// and the mandatory `lib/` barrel rows. Two leaves rather than one is
+// deliberate: OpenChamber is not a fork of Kilo or of OpenCode's argv — it is a
+// control plane with a different prompt-delivery contract — and the "one file
+// per vendor" split is what has kept each of these readable.
+// The remainder of the raise restores the ~1.5k of headroom this is meant to
+// carry: the previous number had drifted to ONE above the measured total, the
+// zero-headroom state #6305 raised it out of, where any addition at all fails.
+const MAX_STATIC_INSTANTIATIONS = 109200;
const SKIP_DIRS = new Set(['node_modules', 'coverage', 'dist', 'data']);
diff --git a/server/lib/index.js b/server/lib/index.js
index 8179092e81..f4b2eab1f7 100644
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@ -655,3 +655,5 @@ export * from './mindToolRecipes.js';
export * from './deckTemplates.js';
export * from './deckValidation.js';
export * from './ecosystemProcessPorts.js';
+export * from './kilo.js';
+export * from './openchamber.js';
diff --git a/server/lib/kilo.js b/server/lib/kilo.js
new file mode 100644
index 0000000000..bbe32ba805
--- /dev/null
+++ b/server/lib/kilo.js
@@ -0,0 +1,121 @@
+/**
+ * Per-CLI conventions for Kilo Code's coding agent (binary: `kilo`).
+ *
+ * Kilo CLI (`@kilocode/cli`, MIT) is a FORK of OpenCode, and its argv is
+ * OpenCode's with one addition, so PortOS drives it the same way:
+ * - `kilo-cli` (type `cli`) — headless one-shot via `kilo run`, prompt on stdin.
+ * - `kilo-tui` (type `tui`) — the interactive Kilo TUI over a PTY.
+ *
+ * Flags this file relies on, taken verbatim from Kilo's own CLI reference —
+ * both the `run` subcommand and the bare (TUI) entry point accept all three:
+ * - `-m, --model model to use in the format of provider/model [string]`
+ * - `--agent agent to use [string]`
+ * - `--auto auto-approve permissions that are not explicitly denied`
+ *
+ * `--auto` is the piece that makes an unattended run possible at all: without
+ * it Kilo stops at the first permission prompt with nobody to answer, burning
+ * the whole provider timeout. It is the same posture claude's
+ * `--dangerously-skip-permissions` / codex's
+ * `--dangerously-bypass-approvals-and-sandbox` / kimi's `--yolo` supply, and —
+ * unlike OpenCode, whose permissions live only in its config — Kilo exposes it
+ * as an argv flag on BOTH the headless and interactive entry points.
+ *
+ * **No `--agent` is injected**, deliberately, and this is where Kilo and
+ * OpenCode part company: PortOS pins OpenCode's `build` agent because a bare
+ * `opencode run` opens in whatever agent that install defaults to (#7405). Kilo
+ * ships a different agent roster (Architect / Ask / Debug / Orchestrator / …),
+ * so a hardcoded `build` would name an agent the binary may not have and fail
+ * the run at argv parsing. A user who wants one pins it in the provider's saved
+ * `args`, and `argvHasFlag` keeps that pin.
+ *
+ * Model ids are Kilo's `provider/model` form, which is exactly what `--model`
+ * takes — no namespacing adapter is involved (that is an OpenCode-config
+ * concern PortOS does not write for Kilo; see `providerHarnesses.js` on why
+ * Kilo carries no mintable route recipe).
+ *
+ * Dependency-light on purpose: imports only `providerModels.js` helpers,
+ * mirroring `grok.js`/`kimi.js`/`cursor.js`/`pi.js` so it stays importable from
+ * the standalone autofixer process.
+ */
+
+import { argvHasFlag, commandBasename, ensureLeadingSubcommand, hasModelFlag } from './providerModels.js';
+
+/** The canonical binary basename. */
+export const KILO_COMMAND = 'kilo';
+
+/**
+ * `@kilocode/cli` installs TWO bin names for one program (`kilo` and
+ * `kilocode`), so a provider configured with either spelling is the same
+ * harness. Published so the runtime registry can alias its install row rather
+ * than probing the same binary twice.
+ */
+export const KILO_COMMAND_ALIASES = Object.freeze(['kilocode']);
+
+const KILO_COMMANDS = Object.freeze([KILO_COMMAND, ...KILO_COMMAND_ALIASES]);
+
+/** The headless subcommand — `kilo run [message..]`, prompt read from stdin. */
+const RUN_SUBCOMMAND = 'run';
+
+/**
+ * Auto-approval postures. `--auto` is Kilo's own spelling; a user who already
+ * pinned it (or its `--no-auto` opposite) has chosen a posture PortOS must not
+ * override.
+ */
+const APPROVAL_FLAGS = ['--auto', '--no-auto'];
+
+/**
+ * True when a provider command points at the Kilo binary — the bare `kilo` /
+ * `kilocode` on PATH, an absolute/relative path to either, or an optional
+ * Windows `.exe` suffix (same matching rules as `isOpencodeCommand`).
+ * @param {string|null|undefined} command
+ * @returns {boolean}
+ */
+export function isKiloCommand(command) {
+ return KILO_COMMANDS.includes(commandBasename(command));
+}
+
+/**
+ * True when a PROVIDER is Kilo-flavored — the shipped `kilo-cli`/`kilo-tui`
+ * ids or any provider whose launch command is the Kilo binary. The
+ * provider-shaped companion to {@link isKiloCommand}, matching the shape of
+ * `isKimiProvider` / `isOpencodeProvider` in `providerModels.js`; it lives here
+ * rather than there so the accepted binary spellings stay in ONE list.
+ * @param {{id?:string, command?:string}|null|undefined} provider
+ * @returns {boolean}
+ */
+export function isKiloProvider(provider) {
+ const id = String(provider?.id || '').toLowerCase();
+ return id === 'kilo-cli' || id === 'kilo-tui' || isKiloCommand(provider?.command);
+}
+
+/**
+ * Add `--auto` unless the argv already pins an approval posture. Shared by the
+ * headless and TUI builders so the two cannot drift.
+ * @param {string[]} args
+ * @returns {string[]}
+ */
+export function ensureKiloTuiArgs(args = []) {
+ const out = [...args];
+ if (!argvHasFlag(out, APPROVAL_FLAGS)) out.push('--auto');
+ return out;
+}
+
+/**
+ * Build the headless (one-shot) argv for the Kilo CLI: `run`, the approval
+ * posture, and `--model <provider/model>` when a model is pinned and the user
+ * baked no model flag of their own.
+ *
+ * A leading `run` already present in the saved args is detected rather than
+ * duplicated (the same guard `opencodeCliArgs` applies), so a legacy record
+ * that pinned the subcommand does not end up as `kilo run run`.
+ *
+ * The prompt itself is NOT added here — it rides on stdin at spawn time.
+ * @param {string[]} baseArgs - user/legacy args (already model-flag-sanitized)
+ * @param {string|null|undefined} model - defaultModel to pin, or null to omit
+ * @returns {string[]}
+ */
+export function ensureKiloHeadlessArgs(baseArgs = [], model) {
+ const out = ensureKiloTuiArgs(ensureLeadingSubcommand(baseArgs, RUN_SUBCOMMAND));
+ if (model && !hasModelFlag(out)) out.push('--model', model);
+ return out;
+}
diff --git a/server/lib/kilo.test.js b/server/lib/kilo.test.js
new file mode 100644
index 0000000000..82646bfa8e
--- /dev/null
+++ b/server/lib/kilo.test.js
@@ -0,0 +1,51 @@
+import { describe, it, expect } from 'vitest';
+import { buildCliArgs, prepareCliPrompt } from './cliProviderArgs.js';
+import { isKiloCommand, ensureKiloHeadlessArgs, ensureKiloTuiArgs } from './kilo.js';
+import { applyCommandDefaults, inferTuiCommand } from './providerVendors.js';
+import { harnessForProvider, harnessSupportsMode } from './providerHarnesses.js';
+import { parseHarnessModels } from './harnessOutput.js';
+import { isAllowedCommand } from '../cos-runner/allowedCommands.js';
+
+describe('Kilo provider boundaries', () => {
+ it('builds the headless run argv with an approval posture and a namespaced model', () => {
+ const provider = { id: 'kilo-cli', type: 'cli', command: 'kilo', args: [], defaultModel: 'anthropic/claude-opus-5' };
+ expect(buildCliArgs(provider)).toEqual(['run', '--auto', '--model', 'anthropic/claude-opus-5']);
+ // The prompt rides stdin, like OpenCode's `run` that Kilo forks.
+ const prepared = prepareCliPrompt('kilo', buildCliArgs(provider), 'review this');
+ expect(prepared.useStdin).toBe(true);
+ expect(prepared.args).toEqual(buildCliArgs(provider));
+ });
+
+ it('never duplicates a pinned subcommand, approval posture or model flag', () => {
+ expect(ensureKiloHeadlessArgs(['run', '--no-auto', '-m', 'openai/gpt-5.6-sol'], 'anthropic/other'))
+ .toEqual(['run', '--no-auto', '-m', 'openai/gpt-5.6-sol']);
+ expect(ensureKiloTuiArgs(['--auto'])).toEqual(['--auto']);
+ expect(ensureKiloTuiArgs([])).toEqual(['--auto']);
+ // Both TUI spawn paths go through `applyCommandDefaults`, so the posture a
+ // headless run gets is the one an attached session gets.
+ expect(applyCommandDefaults('kilo', [])).toEqual(['--auto']);
+ });
+
+ it('identifies both shipped bin names and nothing that merely starts with them', () => {
+ expect(isKiloCommand('kilo')).toBe(true);
+ expect(isKiloCommand('/opt/bin/kilocode.exe')).toBe(true);
+ expect(isKiloCommand('kilobyte')).toBe(false);
+ expect(isKiloCommand('opencode')).toBe(false);
+ expect(inferTuiCommand('kilo-tui')).toBe('kilo');
+ // A vendor row is what makes the binary spawnable by the CoS runner.
+ expect(isAllowedCommand('kilo')).toBe(true);
+ });
+
+ it('classifies as a CLI/TUI harness that cannot be minted from a connection', () => {
+ const harness = harnessForProvider({ id: 'kilo-tui', type: 'tui', command: 'kilo' });
+ expect(harness.id).toBe('kilo');
+ expect(harnessSupportsMode('kilo', 'tui')).toBe(true);
+ // No config surface PortOS writes, so no route recipe — see providerHarnesses.js.
+ expect(harness.recipe ?? null).toBeNull();
+ });
+
+ it('parses `kilo models` output in the same `provider/model` shape as OpenCode', () => {
+ expect(parseHarnessModels('kilo', 'anthropic/claude-opus-5\nopenai/gpt-5.6-sol\nFetching models...'))
+ .toEqual(['anthropic/claude-opus-5', 'openai/gpt-5.6-sol']);
+ });
+});
diff --git a/server/lib/openchamber.js b/server/lib/openchamber.js
new file mode 100644
index 0000000000..3c6ffca1cc
--- /dev/null
+++ b/server/lib/openchamber.js
@@ -0,0 +1,160 @@
+/**
+ * Per-CLI conventions for OpenChamber's control CLI (binary: `openchamber`).
+ *
+ * OpenChamber (`@openchamber/web`, MIT) is an agentic development environment
+ * built ON TOP of OpenCode: a long-running workspace server with desktop, web,
+ * VS Code and mobile surfaces. That makes it a different SHAPE of harness from
+ * every other vendor here, and the differences are the whole content of this
+ * file:
+ *
+ * - **It is a control plane, not a one-shot binary.** `openchamber session
+ * create` posts an action to an already-running OpenChamber runtime (the
+ * CLI discovers its port) instead of doing the work in the child PortOS
+ * spawned. The user starts that runtime once (`openchamber`, or
+ * `openchamber startup enable`); an install with nothing running gets a
+ * clear CLI error, the same posture as a local-LLM provider whose daemon is
+ * down. PortOS deliberately does NOT start it — that is a server the user
+ * owns, with its own port, password and network exposure.
+ *
+ * - **CLI only, no TUI.** OpenChamber's interactive surface is a web app, not
+ * a terminal UI, so there is nothing for a PTY to attach to and the harness
+ * registry declares `modes: ['cli']`. `openchamber` with no subcommand
+ * starts the SERVER, which is why no TUI argv builder exists here: emitting
+ * one would have PortOS launch a daemon in a PTY and call it an agent.
+ *
+ * - **The prompt and the working directory are both argv.** `session create`
+ * requires `--dir <path>` (it has no cwd default — the directory is sent to
+ * the runtime, which may not share the child's) and takes the prompt as the
+ * VALUE of `--prompt`. Both are supplied by `prepareOpenchamberPrompt` at
+ * spawn time, which is the only point where the child's real cwd is known.
+ *
+ * The headless invocation, from OpenChamber's own `session` help:
+ *
+ * openchamber session create --dir <path> --prompt <text> \
+ * [--model <provider/model>] --wait --last-assistant --quiet
+ *
+ * `--wait` blocks until the dispatched activity goes idle (default timeout 600
+ * seconds, which is also every shipped PortOS harness timeout), `--last-assistant`
+ * appends the final assistant text, and `--quiet` reduces stdout to the session
+ * id followed by that text — the closest thing this CLI has to `--print`.
+ *
+ * Dependency-light on purpose: imports only `providerModels.js` helpers,
+ * mirroring `grok.js`/`kimi.js`/`cursor.js`/`pi.js`/`kilo.js` so it stays
+ * importable from the standalone autofixer process.
+ */
+
+import { argvHasFlag, commandBasename, ensureLeadingSubcommand, hasModelFlag } from './providerModels.js';
+
+/** The binary basename. */
+export const OPENCHAMBER_COMMAND = 'openchamber';
+
+/** The control action that runs a prompt: `openchamber session create`. */
+const SESSION_CREATE = Object.freeze(['session', 'create']);
+
+/**
+ * Flags that make `session create` behave like every other headless harness:
+ * block until the work is done, and print the model's answer.
+ */
+const HEADLESS_FLAGS = Object.freeze(['--wait', '--last-assistant', '--quiet']);
+
+/** The two spellings that address a session's working directory. */
+const DIR_FLAGS = ['--dir', '--project'];
+
+/**
+ * True when a provider command points at the OpenChamber binary — the bare
+ * `openchamber` on PATH, an absolute/relative path to it, or an optional
+ * Windows `.exe` suffix (same matching rules as `isOpencodeCommand`).
+ *
+ * Note it can never collide with OpenCode's own matcher despite the shared
+ * prefix: both compare the WHOLE basename, not a prefix.
+ * @param {string|null|undefined} command
+ * @returns {boolean}
+ */
+export function isOpenchamberCommand(command) {
+ return commandBasename(command) === OPENCHAMBER_COMMAND;
+}
+
+/**
+ * True when a PROVIDER is OpenChamber-flavored — the shipped `openchamber-cli`
+ * id or any provider whose launch command is the OpenChamber binary. The
+ * provider-shaped companion to {@link isOpenchamberCommand}, matching the shape
+ * of `isKimiProvider` / `isOpencodeProvider` in `providerModels.js`.
+ * @param {{id?:string, command?:string}|null|undefined} provider
+ * @returns {boolean}
+ */
+export function isOpenchamberProvider(provider) {
+ return String(provider?.id || '').toLowerCase() === 'openchamber-cli'
+ || isOpenchamberCommand(provider?.command);
+}
+
+/**
+ * True for a model string OpenChamber will accept.
+ *
+ * `--model` is validated by the CLI as `provider/model` and a value failing
+ * that exits with a usage error BEFORE any work — so a bare id (the shape most
+ * other harnesses take) must be dropped rather than passed through, or pinning
+ * a model would turn every run into an argv failure. Mirrors the CLI's own
+ * check: one `/`, with something on each side.
+ * @param {string|null|undefined} model
+ * @returns {boolean}
+ */
+export function isOpenchamberModelId(model) {
+ if (typeof model !== 'string') return false;
+ const slash = model.indexOf('/');
+ return slash > 0 && slash < model.length - 1;
+}
+
+/**
+ * Build the headless argv for an OpenChamber run. Adds the `session create`
+ * action and the wait/print flags unless the saved args already pin them, plus
+ * `--model <provider/model>` when a usable model id is pinned and the user
+ * baked no model flag of their own.
+ *
+ * Neither `--dir` nor `--prompt` is added here — both are spliced in by
+ * {@link prepareOpenchamberPrompt} at spawn time, where the child's real
+ * working directory is known.
+ *
+ * @param {string[]} baseArgs - user/legacy args (already model-flag-sanitized)
+ * @param {string|null|undefined} model - defaultModel to pin, or null to omit
+ * @returns {string[]}
+ */
+export function ensureOpenchamberHeadlessArgs(baseArgs = [], model) {
+ // `ensureLeadingSubcommand` keys on `session`, so a record pinned to
+ // `session send` keeps the subcommand the user chose deliberately.
+ const out = ensureLeadingSubcommand(baseArgs, SESSION_CREATE);
+ for (const flag of HEADLESS_FLAGS) {
+ if (!argvHasFlag(out, [flag])) out.push(flag);
+ }
+ if (isOpenchamberModelId(model) && !hasModelFlag(out)) out.push('--model', model);
+ return out;
+}
+
+/**
+ * Spawn-time prompt delivery: splice in the working directory and the prompt,
+ * neither of which the argv builder can know.
+ *
+ * `--dir` is the directory the session runs in. OpenChamber sends it to its
+ * runtime rather than resolving it locally, so a relative path or an omitted
+ * flag does NOT fall back to the child's cwd — it fails (`Missing required
+ * --dir or --project`) or, worse, runs the agent wherever the runtime happens
+ * to be. `cwd` is therefore the directory PortOS is about to hand `spawn()`,
+ * and `process.cwd()` only when a call site genuinely spawns without one.
+ *
+ * Both flags are skipped when the saved args already carry them, so a record
+ * pinned to `--project <id>` keeps addressing its project.
+ *
+ * Mirrors the `{ args, useStdin, cleanup }` shape of
+ * `kimi.js#prepareKimiPrompt` so the shared `prepareCliPrompt` dispatcher can
+ * handle it uniformly.
+ *
+ * @param {string[]} args - argv as built by ensureOpenchamberHeadlessArgs
+ * @param {string} prompt - the full prompt text
+ * @param {{cwd?: string|null}} [options] - the cwd the child will be spawned in
+ * @returns {{ args: string[], useStdin: false, cleanup: () => void }}
+ */
+export function prepareOpenchamberPrompt(args = [], prompt = '', { cwd = null } = {}) {
+ const out = [...args];
+ if (!argvHasFlag(out, DIR_FLAGS)) out.push('--dir', cwd || process.cwd());
+ if (!argvHasFlag(out, ['--prompt'])) out.push('--prompt', prompt);
+ return { args: out, useStdin: false, cleanup: () => {} };
+}
diff --git a/server/lib/openchamber.test.js b/server/lib/openchamber.test.js
new file mode 100644
index 0000000000..d10df3664d
--- /dev/null
+++ b/server/lib/openchamber.test.js
@@ -0,0 +1,65 @@
+import { describe, it, expect } from 'vitest';
+import { buildCliArgs, prepareCliPrompt } from './cliProviderArgs.js';
+import { isOpenchamberCommand, isOpenchamberModelId, ensureOpenchamberHeadlessArgs } from './openchamber.js';
+import { applyCommandDefaults } from './providerVendors.js';
+import { harnessForProvider, harnessSupportsMode } from './providerHarnesses.js';
+import { isAllowedCommand } from '../cos-runner/allowedCommands.js';
+
+const HEADLESS = ['session', 'create', '--wait', '--last-assistant', '--quiet'];
+
+describe('OpenChamber provider boundaries', () => {
+ it('builds the session-create argv and leaves the directory and prompt to spawn time', () => {
+ const provider = {
+ id: 'openchamber-cli', type: 'cli', command: 'openchamber', args: [],
+ defaultModel: 'anthropic/claude-opus-5',
+ };
+ const args = buildCliArgs(provider);
+ expect(args).toEqual([...HEADLESS, '--model', 'anthropic/claude-opus-5']);
+ expect(args).not.toContain('--dir');
+ expect(args).not.toContain('--prompt');
+ });
+
+ it('delivers the prompt and the run cwd as argv, never stdin', () => {
+ const prepared = prepareCliPrompt('openchamber', [...HEADLESS], 'review this', { cwd: '/example/worktree' });
+ expect(prepared.useStdin).toBe(false);
+ expect(prepared.args).toEqual([...HEADLESS, '--dir', '/example/worktree', '--prompt', 'review this']);
+ });
+
+ it('honors a record already addressing a project instead of a directory', () => {
+ const pinned = ['session', 'create', '--project', 'proj-1', '--prompt', 'pinned'];
+ const prepared = prepareCliPrompt('openchamber', pinned, 'ignored', { cwd: '/example/worktree' });
+ expect(prepared.args).toEqual(pinned);
+ });
+
+ it('drops a model id the control CLI would reject before doing any work', () => {
+ // `--model` is validated as `provider/model`; a bare id exits with a usage
+ // error, so pinning one must omit the flag rather than fail the run.
+ expect(isOpenchamberModelId('claude-opus-5')).toBe(false);
+ expect(isOpenchamberModelId('anthropic/claude-opus-5')).toBe(true);
+ expect(ensureOpenchamberHeadlessArgs([], 'claude-opus-5')).toEqual(HEADLESS);
+ });
+
+ it('adds nothing twice when the saved args already pin the action and flags', () => {
+ expect(ensureOpenchamberHeadlessArgs(HEADLESS, null)).toEqual(HEADLESS);
+ expect(ensureOpenchamberHeadlessArgs(['session', 'send', '--session', 's1'], null))
+ .toEqual(['session', 'send', '--session', 's1', '--wait', '--last-assistant', '--quiet']);
+ });
+
+ it('is a headless-only harness with no interactive argv to spawn in a PTY', () => {
+ const provider = { id: 'openchamber-cli', type: 'cli', command: 'openchamber' };
+ expect(harnessForProvider(provider).id).toBe('openchamber');
+ expect(harnessSupportsMode('openchamber', 'cli')).toBe(true);
+ expect(harnessSupportsMode('openchamber', 'tui')).toBe(false);
+ // No `tuiArgs` row: `applyCommandDefaults` must not invent an argv that
+ // would launch the OpenChamber SERVER inside a PTY and call it an agent.
+ expect(applyCommandDefaults('openchamber', ['session'])).toEqual(['session']);
+ });
+
+ it('never collides with OpenCode despite the shared prefix', () => {
+ expect(isOpenchamberCommand('openchamber')).toBe(true);
+ expect(isOpenchamberCommand('/opt/bin/openchamber.exe')).toBe(true);
+ expect(isOpenchamberCommand('opencode')).toBe(false);
+ expect(harnessForProvider({ type: 'cli', command: 'opencode' }).id).toBe('opencode');
+ expect(isAllowedCommand('openchamber')).toBe(true);
+ });
+});
diff --git a/server/lib/providerHarnesses.js b/server/lib/providerHarnesses.js
index 5abf91300c..4dc1701fa3 100644
--- a/server/lib/providerHarnesses.js
+++ b/server/lib/providerHarnesses.js
@@ -10,6 +10,8 @@ import {
isOpencodeProvider,
prefixOpencodeModel,
} from './providerModels.js';
+import { isKiloProvider } from './kilo.js';
+import { isOpenchamberProvider } from './openchamber.js';
/**
* The HARNESS half of the provider-connection graph proposed in
@@ -38,6 +40,33 @@ export const ROUTE_MODES = Object.freeze(['cli', 'tui', 'api']);
/** Modes every CLI/TUI harness supports. Direct API bindings carry no harness. */
const CLI_TUI_MODES = Object.freeze(['cli', 'tui']);
+/**
+ * Headless only. A harness whose interactive surface is not a terminal — today
+ * OpenChamber, whose UI is a web app and whose bare binary starts a server —
+ * has no TUI to attach a PTY to, so it must not be offered one.
+ */
+const CLI_ONLY_MODES = Object.freeze(['cli']);
+
+/**
+ * Why a harness carries no command recipe, as the clause the create endpoint
+ * refuses with (`bindingBlocker` in `providerRouteRecipes.js`).
+ *
+ * This is DATA on the row rather than prose in a comment because the refusal
+ * quotes it. Until three reasons existed, `bindingBlocker` hardcoded the first
+ * one — so adding a `recipe: null` row for either of the others would have told
+ * the user their harness "reaches only its own vendor service", which is both
+ * wrong and points at the wrong remedy. `noRecipe` is set on exactly the rows
+ * whose `recipe` is `null`, an invariant `providerHarnesses.test.js` pins.
+ */
+const NO_RECIPE = Object.freeze({
+ /** A `native`-protocol program: there is no user-supplied backend to name. */
+ VENDOR_SERVICE: 'reaches only its own vendor service',
+ /** The backend lives in a config file PortOS does not write (Kilo). */
+ UNWRITTEN_CONFIG: 'resolves its backend from its own config file, which PortOS does not write',
+ /** The backend belongs to a separate runtime the user configures (OpenChamber). */
+ EXTERNAL_RUNTIME: 'runs against a workspace runtime you sign in to separately',
+});
+
/**
* The COMMAND RECIPE half of a harness row (#6369).
*
@@ -65,9 +94,9 @@ const CLI_TUI_MODES = Object.freeze(['cli', 'tui']);
* Anthropic auth token even to a local daemon that ignores it), which is why
* the create endpoint refuses rather than minting a route that cannot run.
*
- * A harness with **no** recipe is not an oversight: `native`-protocol programs
- * talk only to their own vendor service, so there is no user-supplied backend to
- * point one at. Adding one of those stays `/ai/new`.
+ * A harness with **no** recipe is not an oversight — it means this program has
+ * no backend PortOS can point at from a connection, and its row says WHICH of
+ * the {@link NO_RECIPE} reasons applies. Adding one of those stays `/ai/new`.
*/
/** Claude Code's headless argv, shared by every Claude recipe mode. */
@@ -121,6 +150,34 @@ export const PROVIDER_HARNESSES = Object.freeze([
}),
matches: isOpencodeProvider,
}),
+ Object.freeze({
+ id: 'kilo',
+ label: 'Kilo Code',
+ modes: CLI_TUI_MODES,
+ protocol: 'openai',
+ // Kilo is an OpenCode fork, so its backend is declared in a config file
+ // rather than an environment variable — and PortOS has not verified which
+ // config surface this fork reads (OpenCode's own `OPENCODE_CONFIG_CONTENT`
+ // is the one PortOS writes, and Kilo renames its environment under
+ // `KILO_*`). Minting a route on a guess would produce one that points at
+ // nothing while reporting a backend, so Kilo stays classifiable and
+ // installable but not creatable from a connection.
+ recipe: null,
+ noRecipe: NO_RECIPE.UNWRITTEN_CONFIG,
+ matches: isKiloProvider,
+ }),
+ Object.freeze({
+ id: 'openchamber',
+ label: 'OpenChamber',
+ modes: CLI_ONLY_MODES,
+ protocol: 'openai',
+ // OpenChamber is a control plane in front of a runtime the USER starts and
+ // configures (its providers are signed in through its own web UI), so there
+ // is no PortOS-supplied backend for a minted route to carry.
+ recipe: null,
+ noRecipe: NO_RECIPE.EXTERNAL_RUNTIME,
+ matches: isOpenchamberProvider,
+ }),
Object.freeze({
id: 'codex',
label: 'Codex',
@@ -143,9 +200,10 @@ export const PROVIDER_HARNESSES = Object.freeze([
label: 'Antigravity',
modes: CLI_TUI_MODES,
protocol: 'native',
- // No recipe: this program reaches only its own vendor service, so
- // there is no connection to point a freshly minted route at.
+ // This program reaches only its own vendor service, so there is no
+ // connection to point a freshly minted route at.
recipe: null,
+ noRecipe: NO_RECIPE.VENDOR_SERVICE,
matches: isAntigravityProvider,
}),
Object.freeze({
@@ -153,9 +211,10 @@ export const PROVIDER_HARNESSES = Object.freeze([
label: 'Cursor Agent',
modes: CLI_TUI_MODES,
protocol: 'native',
- // No recipe: this program reaches only its own vendor service, so
- // there is no connection to point a freshly minted route at.
+ // This program reaches only its own vendor service, so there is no
+ // connection to point a freshly minted route at.
recipe: null,
+ noRecipe: NO_RECIPE.VENDOR_SERVICE,
matches: isCursorProvider,
}),
Object.freeze({
@@ -163,9 +222,10 @@ export const PROVIDER_HARNESSES = Object.freeze([
label: 'Grok',
modes: CLI_TUI_MODES,
protocol: 'native',
- // No recipe: this program reaches only its own vendor service, so
- // there is no connection to point a freshly minted route at.
+ // This program reaches only its own vendor service, so there is no
+ // connection to point a freshly minted route at.
recipe: null,
+ noRecipe: NO_RECIPE.VENDOR_SERVICE,
matches: isGrokProvider,
}),
Object.freeze({
@@ -173,9 +233,10 @@ export const PROVIDER_HARNESSES = Object.freeze([
label: 'Kimi Code',
modes: CLI_TUI_MODES,
protocol: 'native',
- // No recipe: this program reaches only its own vendor service, so
- // there is no connection to point a freshly minted route at.
+ // This program reaches only its own vendor service, so there is no
+ // connection to point a freshly minted route at.
recipe: null,
+ noRecipe: NO_RECIPE.VENDOR_SERVICE,
matches: isKimiProvider,
}),
Object.freeze({
@@ -183,9 +244,10 @@ export const PROVIDER_HARNESSES = Object.freeze([
label: 'Pi',
modes: CLI_TUI_MODES,
protocol: 'native',
- // No recipe: this program reaches only its own vendor service, so
- // there is no connection to point a freshly minted route at.
+ // This program reaches only its own vendor service, so there is no
+ // connection to point a freshly minted route at.
recipe: null,
+ noRecipe: NO_RECIPE.VENDOR_SERVICE,
// No `isPiProvider` predicate exists — `pi` has no vendor module of its own
// beyond `aiToolkit/internal/pi.js`, so match its binary basename directly.
matches: (provider) => commandBasename(provider?.command) === 'pi',
diff --git a/server/lib/providerHarnesses.test.js b/server/lib/providerHarnesses.test.js
new file mode 100644
index 0000000000..66bffc3559
--- /dev/null
+++ b/server/lib/providerHarnesses.test.js
@@ -0,0 +1,93 @@
+/**
+ * Cross-registry invariants for the harness table.
+ *
+ * `providerRouteRecipes.sampleParity.test.js` already pins each CREATABLE
+ * harness against the argv PortOS ships for it. What was unpinned is everything
+ * a NON-creatable row asserts, and the places where the same fact about one
+ * program is written in two registries — the drift `PROVIDER_VENDORS` was
+ * extracted to stop (#3618), reappearing one table over.
+ */
+
+import { describe, expect, it } from 'vitest';
+import { readFileSync } from 'node:fs';
+import { dirname, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { PROVIDER_HARNESSES, harnessById, harnessForProvider } from './providerHarnesses.js';
+import { PROVIDER_VENDORS } from './providerVendors.js';
+import { bindingBlocker } from './providerRouteRecipes.js';
+
+/**
+ * The legacy Gemini CLI row is a vendor with no harness on purpose: it exists
+ * so an old stored config still resolves, and ships no binary of its own.
+ */
+const VENDOR_WITHOUT_HARNESS = 'gemini-legacy';
+
+const spawnableVendors = PROVIDER_VENDORS.filter((vendor) => vendor.id !== VENDOR_WITHOUT_HARNESS);
+
+describe('harness rows say why they carry no recipe', () => {
+ // The refusal quotes this field. While `bindingBlocker` hardcoded one reason,
+ // a row added for a different one told the user their harness "reaches only
+ // its own vendor service" — wrong, and it points at the wrong remedy.
+ it('sets noRecipe on exactly the rows with no recipe', () => {
+ for (const harness of PROVIDER_HARNESSES) {
+ expect(Boolean(harness.noRecipe), `${harness.id}: noRecipe must accompany a null recipe`)
+ .toBe(harness.recipe === null);
+ }
+ });
+
+ it('refuses each uncreatable harness with its own reason, not a shared guess', () => {
+ const connection = { kind: 'ollama', transports: { openai: { baseUrl: 'http://localhost:11434/v1' } }, credentials: {} };
+ const messages = PROVIDER_HARNESSES
+ .filter((harness) => harness.recipe === null)
+ .map((harness) => bindingBlocker({ harnessId: harness.id, modes: ['cli'], connection }).message);
+
+ // Kilo and OpenChamber are `openai`-protocol rows that still cannot be
+ // minted — the case that makes "reaches only its own vendor service" false.
+ expect(messages).toContain(`${harnessById('kilo').label} ${harnessById('kilo').noRecipe}, so it cannot be pointed at a backend connection. Add it from the provider editor instead.`);
+ expect(new Set(messages).size).toBeGreaterThan(1);
+ for (const message of messages) expect(message).not.toMatch(/undefined|has no command recipe/);
+ });
+});
+
+describe('a harness and its vendor agree about what can be driven', () => {
+ // Two registries hold "OpenChamber has no TUI": the vendor row by omitting
+ // `tuiArgs`, the harness row by declaring `modes: ['cli']`. Nothing joined
+ // them, so an edit to either alone would have `applyCommandDefaults` build an
+ // interactive argv for a mode the harness says does not exist — which for
+ // OpenChamber means launching its SERVER in a PTY and calling it an agent.
+ //
+ // Deliberately ONE-DIRECTIONAL. The converse is false and must stay allowed:
+ // `claude` declares a `tui` mode with no `tuiArgs`, because its interactive
+ // posture flag ships on the seeded record rather than being injected. So
+ // `tuiArgs` proves a TUI exists, while its absence proves nothing.
+ it('never lets a vendor build interactive argv for a harness with no tui mode', () => {
+ for (const vendor of spawnableVendors) {
+ const harness = harnessById(vendor.id);
+ expect(harness, `${vendor.id}: every spawnable vendor needs a harness row`).not.toBeNull();
+ if (harness.modes.includes('tui')) continue;
+ expect(vendor.tuiArgs, `${vendor.id}: harness declares no tui mode, so the vendor must build no interactive argv`)
+ .toBeUndefined();
+ }
+ });
+
+ // The third copy of the same fact is the shipped catalog. A `tui` record whose
+ // harness has no `tui` mode is a row the spawner would happily put in a PTY.
+ it('ships no tui provider for a harness that has no tui mode', () => {
+ const seeded = Object.values(JSON.parse(readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../../data.reference/providers.json'), 'utf8',
+ )).providers);
+ expect(seeded.length).toBeGreaterThan(20);
+ for (const provider of seeded.filter((row) => row.type === 'tui')) {
+ const harness = harnessForProvider(provider);
+ if (!harness) continue;
+ expect(harness.modes, `${provider.id}: seeded as tui, but ${harness.id} declares no tui mode`).toContain('tui');
+ }
+ });
+
+ it('gives every spawnable vendor a harness that classifies its own binary', () => {
+ for (const vendor of spawnableVendors) {
+ const provider = { id: `${vendor.id}-cli`, type: 'cli', command: vendor.inferredCommand };
+ expect(harnessById(vendor.id).matches(provider), `${vendor.id}: harness does not match its own command`).toBe(true);
+ }
+ });
+});
diff --git a/server/lib/providerModels.js b/server/lib/providerModels.js
index c49e99827b..07bc7b18a7 100644
--- a/server/lib/providerModels.js
+++ b/server/lib/providerModels.js
@@ -70,6 +70,29 @@ export function argvHasFlag(args = [], flags = []) {
return args.some((a) => typeof a === 'string' && flags.some((f) => a === f || a.startsWith(`${f}=`)));
}
+/**
+ * Put a POSITIONAL subcommand at the head of an argv unless it is already
+ * there. Several vendors select headless mode with a bare word rather than a
+ * flag — `opencode run`, `kilo run`, `openchamber session create` — and every
+ * one of them has the same failure when it is missing: the bare binary opens an
+ * interactive session that never consumes the piped prompt and hangs until the
+ * provider timeout fires (issue #2190's shape for OpenCode).
+ *
+ * Presence is tested on the FIRST token only, so a record that pinned
+ * `session send` keeps the subcommand the user chose instead of being rewritten
+ * to `session create`. The check is `includes` rather than `args[0] ===` to
+ * match what the three hand-written copies of this did before it became a rule:
+ * a legacy record may carry a leading global flag ahead of the subcommand.
+ *
+ * @param {unknown[]} args
+ * @param {string|string[]} subcommand - one word, or the words of a nested one
+ * @returns {string[]} a new array; `args` is never mutated
+ */
+export function ensureLeadingSubcommand(args = [], subcommand) {
+ const words = Array.isArray(subcommand) ? subcommand : [subcommand];
+ return args.includes(words[0]) ? [...args] : [...words, ...args];
+}
+
/**
* Returns the model string to pass to a CLI's --model flag, or null if the
* caller should omit --model entirely (configured-default sentinels — the CLI
diff --git a/server/lib/providerRouteRecipes.js b/server/lib/providerRouteRecipes.js
index 98e6f22284..2f006eeb68 100644
--- a/server/lib/providerRouteRecipes.js
+++ b/server/lib/providerRouteRecipes.js
@@ -134,7 +134,12 @@ export function bindingBlocker({ harnessId, modes, connection }) {
if (harnessId !== null && !CREATABLE_HARNESS_IDS.includes(harnessId)) {
return {
code: 'PROVIDER_HARNESS_NOT_CREATABLE',
- message: `${harnessById(harnessId)?.label || harnessId} reaches only its own vendor service, so it cannot be pointed at a backend connection. Add it from the provider editor instead.`,
+ // The REASON is the row's (`noRecipe` in providerHarnesses.js), not this
+ // string's: three different things make a harness uncreatable, and a
+ // hardcoded clause here told two of them the wrong one — sending a user
+ // looking for a vendor service when the real remedy is their own config
+ // file or a runtime they have to start.
+ message: `${harnessById(harnessId)?.label || harnessId} ${harnessById(harnessId)?.noRecipe || 'has no command recipe'}, so it cannot be pointed at a backend connection. Add it from the provider editor instead.`,
};
}
const harness = harnessId ? harnessById(harnessId) : null;
diff --git a/server/lib/providerVendors.js b/server/lib/providerVendors.js
index 3a38e2f857..4d2abc6436 100644
--- a/server/lib/providerVendors.js
+++ b/server/lib/providerVendors.js
@@ -72,6 +72,7 @@ import {
buildCodexAgentThreadArgs,
buildEffortArgs,
isOpencodeCommand,
+ ensureLeadingSubcommand,
prefixOpencodeModel,
localRuntimeNamespace,
opencodeProviderIsLocalOnly,
@@ -109,6 +110,13 @@ import {
ensureCursorHeadlessArgs,
} from './cursor.js';
import { PI_COMMAND, isPiCommand, ensurePiTuiArgs, ensurePiHeadlessArgs, preparePiPrompt } from './pi.js';
+import { KILO_COMMAND, KILO_COMMAND_ALIASES, isKiloCommand, ensureKiloTuiArgs, ensureKiloHeadlessArgs } from './kilo.js';
+import {
+ OPENCHAMBER_COMMAND,
+ isOpenchamberCommand,
+ ensureOpenchamberHeadlessArgs,
+ prepareOpenchamberPrompt,
+} from './openchamber.js';
import { PROVIDER_TYPES } from './aiToolkit/constants.js';
import {
publicReviewPostureForProfile,
@@ -321,6 +329,9 @@ function antigravityCliArgs(baseArgs, { model, effort, provider }) {
const ANTIGRAVITY = {
id: 'antigravity',
+ // `isAntigravityCommand` has always accepted this spelling beside `agy`; the
+ // allowlist did not, so such a record 400'd at /spawn-tui.
+ commandAliases: ['antigravity'],
idFragment: 'antigravity',
inferredCommand: ANTIGRAVITY_COMMAND,
matchCommand: isAntigravityCommand,
@@ -374,7 +385,7 @@ const ensureOpencodeAgent = (args) =>
argvHasFlag(args, ['--agent']) ? args : [...args, '--agent', OPENCODE_BUILD_AGENT];
function opencodeCliArgs(baseArgs, { model, provider }) {
- const args = baseArgs.includes('run') ? [...baseArgs] : ['run', ...baseArgs];
+ const args = ensureLeadingSubcommand(baseArgs, 'run');
return ensureOpencodeAgent(appendOpencodeModel(args, provider, model));
}
@@ -479,6 +490,51 @@ const OPENCODE = {
},
};
+// ─── kilo ───────────────────────────────────────────────────────────────────
+
+function kiloCliArgs(baseArgs, { model }) {
+ return ensureKiloHeadlessArgs(baseArgs, model);
+}
+
+const KILO = {
+ id: 'kilo',
+ idFragment: 'kilo',
+ inferredCommand: KILO_COMMAND,
+ // `@kilocode/cli` installs two bin names for one program, and `isKiloCommand`
+ // accepts both — so the runner's allowlist has to as well, or a provider
+ // configured as `kilocode` is classified everywhere and spawnable nowhere.
+ commandAliases: KILO_COMMAND_ALIASES,
+ matchCommand: isKiloCommand,
+ // No dedicated matchCliProvider — matches by command, same as matchCommand.
+ tuiArgs: ensureKiloTuiArgs,
+ cliArgs: kiloCliArgs,
+ spawnArgs: defaultSpawnArgs(kiloCliArgs, KILO_COMMAND),
+ // No publicReview recipe: Kilo is an OpenCode fork whose tool posture lives in
+ // its config rather than argv, and PortOS writes no Kilo config (see
+ // providerHarnesses.js) — so there is nothing here that could ENFORCE a
+ // tool-free stage, and declaring one would make the gate decorative.
+};
+
+// ─── openchamber ────────────────────────────────────────────────────────────
+
+function openchamberCliArgs(baseArgs, { model }) {
+ return ensureOpenchamberHeadlessArgs(baseArgs, model);
+}
+
+const OPENCHAMBER = {
+ id: 'openchamber',
+ idFragment: 'openchamber',
+ inferredCommand: OPENCHAMBER_COMMAND,
+ matchCommand: isOpenchamberCommand,
+ // No dedicated matchCliProvider — matches by command, same as matchCommand.
+ // No `tuiArgs`: OpenChamber's interactive surface is a web app, and the bare
+ // binary starts its SERVER — there is nothing for a PTY to attach to, and an
+ // argv builder here would exist only to be misused (see openchamber.js).
+ cliArgs: openchamberCliArgs,
+ preparePrompt: prepareOpenchamberPrompt,
+ spawnArgs: defaultSpawnArgs(openchamberCliArgs, OPENCHAMBER_COMMAND),
+};
+
// ─── grok ───────────────────────────────────────────────────────────────────
function grokCliArgs(baseArgs, { model }) {
@@ -799,7 +855,7 @@ const CLAUDE = {
* exclusive by construction (distinct binary basenames, or a provider-id
* check that doesn't overlap with a command-basename check).
*/
-export const PROVIDER_VENDORS = [CODEX, ANTIGRAVITY, CURSOR, GEMINI_LEGACY, KIMI, GROK, OPENCODE, PI, CLAUDE];
+export const PROVIDER_VENDORS = [CODEX, ANTIGRAVITY, CURSOR, GEMINI_LEGACY, KIMI, GROK, OPENCODE, KILO, OPENCHAMBER, PI, CLAUDE];
/**
* A row's `matchCliProvider` may be absent when it's identical to
@@ -877,10 +933,15 @@ export function applyCommandDefaults(command, args, provider = null) {
* own doc comment — it's a no-op for any argv that isn't its own /dev/stdin
* sentinel, so calling it unconditionally as the fallback is safe and matches
* the original `prepareCliPrompt` body exactly).
+ *
+ * `options` carries the spawn facts an argv BUILDER cannot know because they
+ * are decided per run rather than per provider — today just `cwd`, which
+ * OpenChamber needs as the `--dir` its control plane cannot infer (see
+ * openchamber.js). Every other vendor ignores it.
*/
-export function prepareCliPrompt(command, args, prompt) {
+export function prepareCliPrompt(command, args, prompt, options = {}) {
const vendor = PROVIDER_VENDORS.find((v) => v.preparePrompt && v.matchCommand(command));
- return vendor ? vendor.preparePrompt(args, prompt) : prepareGrokPromptFile(args, prompt);
+ return vendor ? vendor.preparePrompt(args, prompt, options) : prepareGrokPromptFile(args, prompt);
}
/** `buildCliArgs` (cliProviderArgs.js): headless one-shot argv per vendor. */
diff --git a/server/lib/reviewerConfig.js b/server/lib/reviewerConfig.js
index 2966fe5dc8..077de784e4 100644
--- a/server/lib/reviewerConfig.js
+++ b/server/lib/reviewerConfig.js
@@ -23,20 +23,41 @@ import { PR_COMPLETIONS } from './prDisposition.js';
// code-review endpoint (`POST /api/code-review/local`) which runs the configured
// local LLM model.
//
-// The roster deliberately covers EVERY coding-agent vendor PortOS can already
+// The roster deliberately covers every coding-agent vendor PortOS can already
// spawn (`PROVIDER_VENDORS` in providerVendors.js) plus every OpenAI-compatible
// local backend it manages, so the provider a user is told is their best local
// coding agent is also selectable as their reviewer. `opencode` is the one CLI
// whose model flag is `-m` rather than `--model` (see REVIEWER_MODEL_FLAGS), and
-// `opencode`/`kimi`/`mtplx` — like `lmstudio` — have no slashdo counterpart, so
-// they are PORTOS_ONLY_REVIEWERS.
+// `opencode`/`kilo`/`kimi`/`mtplx` — like `lmstudio` — have no slashdo
+// counterpart, so they are PORTOS_ONLY_REVIEWERS.
+//
+// A vendor left OUT of the roster is declared in NON_REVIEWER_VENDORS below, so
+// "covers every vendor" is an invariant a test can check rather than a sentence
+// that quietly stops being true.
// Mirrored in client/src/components/cos/constants.js → REVIEWER_OPTIONS.
-export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'cursor', 'pi', 'opencode', 'kimi', 'lmstudio', 'ollama', 'mtplx'];
+export const REVIEWER_VALUES = ['copilot', 'claude', 'antigravity', 'codex', 'grok', 'cursor', 'pi', 'opencode', 'kilo', 'kimi', 'lmstudio', 'ollama', 'mtplx'];
// Provider records retain their own identity instead of collapsing to a harness.
export const isProviderReviewer = (value) => typeof value === 'string' && /^provider:[a-z0-9][a-z0-9-]{0,79}$/.test(value);
export const isReviewer = (value) => REVIEWER_VALUES.includes(value) || isProviderReviewer(value);
export const isToolFreeReviewer = (value) => LOCAL_LLM_REVIEWERS.includes(value) || isProviderReviewer(value);
+/**
+ * Vendors PortOS can spawn that are deliberately NOT reviewers, each mapped to
+ * the reason. The roster above claims to cover every spawnable vendor; this is
+ * the other half of that claim, and `reviewerConfig.test.js` fails on a
+ * `PROVIDER_VENDORS` id that appears in neither — so a future vendor is either
+ * offered as a reviewer or has its exclusion written down, instead of being
+ * silently missing from ten hand-maintained lists.
+ *
+ * Kept as data here rather than imported from `providerVendors.js`: this module
+ * is pure reviewer vocabulary reached by ~280 suites, and the cross-registry
+ * comparison belongs in the test, not in this file's import closure.
+ */
+export const NON_REVIEWER_VENDORS = Object.freeze({
+ 'gemini-legacy': 'a retired row kept only so an old stored config still resolves — Gemini CLI was migrated to Antigravity and ships no binary of its own',
+ openchamber: "a reviewer is a one-shot critique of a diff, and OpenChamber's only prompt path creates a persistent session inside a running workspace runtime the user owns — a review round would leave a session behind per reviewer per PR, and cannot run at all when that runtime is down",
+});
+
export const REVIEWER_ALIASES = { gemini: 'antigravity', 'cursor-agent': 'cursor' };
export const DEFAULT_REVIEWER = 'copilot';
export const DEFAULT_REVIEWERS = [];
@@ -53,7 +74,7 @@ export const LOCAL_LLM_REVIEWERS = ['lmstudio', 'ollama', 'mtplx'];
// command). One constant so a future addition can't be fixed in one of those two
// places and missed in the other — `splitSlashdoReviewerTokens` is the shared
// partition every emitter goes through.
-export const PORTOS_ONLY_REVIEWERS = ['lmstudio', 'mtplx', 'opencode', 'kimi'];
+export const PORTOS_ONLY_REVIEWERS = ['lmstudio', 'mtplx', 'opencode', 'kilo', 'kimi'];
// CLI reviewers whose binary accepts a `--model <id>` tier the user can pin on
// the Code Review Defaults panel (stored as a `<reviewer>Model` settings scalar,
// e.g. `codexModel` / `claudeModel` / `antigravityModel`). The review-loop
@@ -69,15 +90,16 @@ export const PORTOS_ONLY_REVIEWERS = ['lmstudio', 'mtplx', 'opencode', 'kimi'];
// for one list. `cursor` runs `cursor-agent --model <id>` and DOES take an
// effort — but as a parameter of the model id (`gpt-5[effort=max]`), not a flag,
// so its pin rides this roster's `--model` rather than an `--effort` argv.
-// `opencode` runs `opencode run -m <provider/model>` and `kimi` runs
-// `kimi --model <id>`; neither offers a pickable effort, so they widen this roster
-// past EFFORT_SELECTABLE_REVIEWERS the same way `grok` does. `reviewerModelFlag`
+// `opencode` runs `opencode run -m <provider/model>`, `kilo` (its fork) runs
+// `kilo run --model <provider/model>`, and `kimi` runs `kimi --model <id>`; none
+// offers a pickable effort, so they widen this roster past
+// EFFORT_SELECTABLE_REVIEWERS the same way `grok` does. `reviewerModelFlag`
// owns which of `--model`/`-m` each one spells.
// Copilot/local-LLM reviewers are excluded — the former has no CLI, the latter
// get their model injected server-side by `POST /api/code-review/local`. Add a
// reviewer here when its CLI gains model selection; the `<reviewer>Model`
// settings scalar is generated from this roster (codeReviewSettingsSchema).
-export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kimi'];
+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kilo', 'kimi'];
// Every reviewer whose model the user can PICK in the UI: the model-capable CLIs
// above (threaded into the follow-up prompt as `<reviewer> --model <id>`) plus the
// local-LLM backends (whose id is injected server-side by
@@ -104,6 +126,7 @@ export const REVIEWER_CLI_BINARIES = {
cursor: CURSOR_COMMAND,
pi: 'pi',
opencode: 'opencode',
+ kilo: 'kilo',
kimi: 'kimi',
};
diff --git a/server/lib/reviewerConfig.test.js b/server/lib/reviewerConfig.test.js
index 33ed9565c9..0f625a21fb 100644
--- a/server/lib/reviewerConfig.test.js
+++ b/server/lib/reviewerConfig.test.js
@@ -12,6 +12,7 @@ import {
EFFORT_SELECTABLE_REVIEWERS,
MODEL_CAPABLE_CLI_REVIEWERS,
MODEL_SELECTABLE_REVIEWERS,
+ NON_REVIEWER_VENDORS,
pairReviewerModelsAndEfforts,
reviewerModelsFromDefaults,
buildReviewWithArgs,
@@ -44,6 +45,7 @@ import {
MAX_REVIEWER_MAX_ROUNDS,
normalizeReviewUsernames,
} from './reviewerConfig.js';
+import { PROVIDER_VENDORS } from './providerVendors.js';
// The Zod half of the old cosValidation.js — these cases assert that a reviewer
// pin survives the schema that persists it, so they need both modules.
import { createCosTaskSchema, sanitizeTaskMetadata, codeReviewSettingsSchema, reviewerConfigMetadata } from './cosValidation.js';
@@ -84,6 +86,28 @@ describe('reviewerConfig reviewer CLI binaries', () => {
expect(describeReviewerCli(undefined)).toBe('');
});
+ // The roster's stated invariant — it covers every coding-agent vendor PortOS
+ // can spawn — was a sentence in a comment, and adding one vendor means editing
+ // ten hand-maintained lists. A vendor missed here ships a reviewer the server's
+ // own enum rejects, or hides one the install actually has. Excluding a vendor
+ // stays legal; it just has to be written down with its reason.
+ it('offers every spawnable vendor as a reviewer, or declares why not', () => {
+ const vendorIds = PROVIDER_VENDORS.map((vendor) => vendor.id);
+ expect(vendorIds.length).toBeGreaterThan(5);
+ for (const id of vendorIds) {
+ expect(
+ REVIEWER_VALUES.includes(id) || Object.hasOwn(NON_REVIEWER_VENDORS, id),
+ `vendor '${id}' is neither a reviewer nor listed in NON_REVIEWER_VENDORS`,
+ ).toBe(true);
+ }
+ // An exclusion for a vendor that no longer exists is stale prose again.
+ for (const id of Object.keys(NON_REVIEWER_VENDORS)) {
+ expect(vendorIds, `NON_REVIEWER_VENDORS names '${id}', which is not a vendor`).toContain(id);
+ expect(REVIEWER_VALUES, `'${id}' is both excluded and offered`).not.toContain(id);
+ expect(NON_REVIEWER_VENDORS[id].length, `'${id}' needs a real reason`).toBeGreaterThan(20);
+ }
+ });
+
// Guard the guard: a NEW CLI reviewer added to REVIEWER_VALUES without a
// binary mapping must be caught here rather than shipping another slug an
// agent will fruitlessly probe for. Aliases resolve first, so `gemini` is not
@@ -141,12 +165,12 @@ describe('reviewerConfig reviewer CLI binaries', () => {
// ollama/@login. Anything else aborts the command, so PortOS's own reviewers
// must never reach that flag.
it('classifies every reviewer slashdo cannot parse as PortOS-only', () => {
- expect([...PORTOS_ONLY_REVIEWERS].sort()).toEqual(['kimi', 'lmstudio', 'mtplx', 'opencode']);
+ expect([...PORTOS_ONLY_REVIEWERS].sort()).toEqual(['kilo', 'kimi', 'lmstudio', 'mtplx', 'opencode']);
const { flagTokens, portosOnly } = splitSlashdoReviewerTokens([
- 'ollama[qwen2.5:7b]~max=1', 'opencode', '@octocat', 'mtplx~effort=high', 'codex',
+ 'ollama[qwen2.5:7b]~max=1', 'opencode', '@octocat', 'mtplx~effort=high', 'codex', 'kilo',
]);
expect(flagTokens).toEqual(['ollama[qwen2.5:7b]~max=1', '@octocat', 'codex']);
- expect(portosOnly).toEqual(['opencode', 'mtplx']);
+ expect(portosOnly).toEqual(['opencode', 'mtplx', 'kilo']);
});
// slashdoInvocation keeps its own copy of the roster to decide which slashdo
diff --git a/server/lib/reviewerProviderMatchers.js b/server/lib/reviewerProviderMatchers.js
index bedc6e3341..71d7af034a 100644
--- a/server/lib/reviewerProviderMatchers.js
+++ b/server/lib/reviewerProviderMatchers.js
@@ -41,7 +41,8 @@
* resolve.
*
* Pure leaf (`providerModels.js` + `providerTypes.js`, both already browser-
- * imported) so `client/src/hooks/useReviewerModelOptions.js` takes it verbatim.
+ * imported, and `kilo.js`, which imports nothing but the first) so
+ * `client/src/hooks/useReviewerModelOptions.js` takes it verbatim.
* Deliberately does NOT import `reviewerConfig.js`: the coverage rule — every
* MODEL_SELECTABLE_REVIEWERS slug has a row — is a test
* (`reviewerProviderMatchers.test.js`), not a runtime dependency, which keeps
@@ -55,6 +56,7 @@ import {
isKimiProvider,
} from './providerModels.js';
import { isGrokBuildCli, isProcessProvider } from './providerTypes.js';
+import { isKiloProvider } from './kilo.js';
import { dedupeByKey } from './arrayUtils.js';
/** Reviewer slug → the provider-record predicates that front its binary, in preference order. */
@@ -68,6 +70,10 @@ export const REVIEWER_PROVIDER_MATCHERS = Object.freeze({
grok: [(p) => p.id === 'grok-cli', isGrokBuildCli],
cursor: [(p) => p.id === 'cursor-cli', isCursorProvider],
pi: [(p) => p.id === 'pi-cli', (p) => isProcessProvider(p) && commandBasename(p.command) === 'pi'],
+ // Kilo's shipped records front the user's OWN `/connect` credentials — there
+ // is no local-backend preset whose ids resolve only under an injected config
+ // (the OpenCode carve-out below), so the broad predicate is safe here.
+ kilo: [(p) => p.id === 'kilo-cli', isKiloProvider],
kimi: [(p) => p.id === 'kimi-cli', isKimiProvider],
opencode: [(p) => p.id === 'opencode-zen-cli', (p) => p.id === 'opencode-zen-tui'],
mtplx: [(p) => p.id === 'mtplx'],
diff --git a/server/lib/slashdoInvocation.js b/server/lib/slashdoInvocation.js
index 5e65dca1b7..8ffb7ac6d2 100644
--- a/server/lib/slashdoInvocation.js
+++ b/server/lib/slashdoInvocation.js
@@ -61,7 +61,7 @@ export const SLASHDO_REVIEWER_INCLUDE_NAMES = Object.freeze(Object.values(SLASHD
/**
* Reviewer slugs that drive slashdo's shared local-agent (spawnable CLI) loop.
*
- * PortOS-only CLI reviewers (`opencode`, `kimi`) are members too: slashdo has no
+ * PortOS-only CLI reviewers (`opencode`, `kilo`, `kimi`) are members too: slashdo has no
* slug for them, but the include they'd need is the same generic spawn-a-CLI
* review procedure, and pruning it would leave PortOS's own inlined CLI Reviewer
* Procedure with nothing to point at. `lmstudio`/`mtplx` sit in
@@ -73,7 +73,7 @@ export const SLASHDO_REVIEWER_INCLUDE_NAMES = Object.freeze(Object.values(SLASHD
* (whose keys are the same roster); a reviewer added to one and not the other
* is a drift the test catches.
*/
-export const LOCAL_AGENT_REVIEWERS = new Set(['claude', 'codex', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kimi']);
+export const LOCAL_AGENT_REVIEWERS = new Set(['claude', 'codex', 'antigravity', 'grok', 'cursor', 'pi', 'opencode', 'kilo', 'kimi']);
/** Reviewer slugs that drive slashdo's local-model (Ollama-style) loop. */
const LOCAL_MODEL_REVIEWERS = new Set(['ollama', 'lmstudio', 'mtplx']);
/**
@@ -87,7 +87,7 @@ const LOCAL_MODEL_REVIEWERS = new Set(['ollama', 'lmstudio', 'mtplx']);
* imports THIS one, so the arrow can only point one way.
*
* Deliberately NOT the full `REVIEWER_VALUES` roster — a `PORTOS_ONLY_REVIEWERS`
- * slug (`lmstudio`/`mtplx`/`opencode`/`kimi`) has no slashdo counterpart and
+ * slug (`lmstudio`/`mtplx`/`opencode`/`kilo`/`kimi`) has no slashdo counterpart and
* aborts the command, so seeing one in an explicit flag means the argument was
* hand-written against a grammar we don't own. That falls through to the
* unresolvable branch, which prunes nothing.
diff --git a/server/services/agentCliSpawning.js b/server/services/agentCliSpawning.js
index 5bc5c758a5..150ebcfa72 100644
--- a/server/services/agentCliSpawning.js
+++ b/server/services/agentCliSpawning.js
@@ -229,7 +229,7 @@ export async function spawnDirectly({
// VALUE and kimi as the --prompt VALUE (no stdin); grok's `--prompt-file
// /dev/stdin` via stdin (POSIX) / temp file (Windows); every other provider via
// stdin (writePromptToStdin=true).
- const { args: deliveredArgs, useStdin: writePromptToStdin, cleanup: cleanupPromptFile } = prepareCliPrompt(cliConfig.command, cliConfig.args, prompt);
+ const { args: deliveredArgs, useStdin: writePromptToStdin, cleanup: cleanupPromptFile } = prepareCliPrompt(cliConfig.command, cliConfig.args, prompt, { cwd });
const preparedSpawn = prepareCliSpawn(cliConfig.command, deliveredArgs, childEnv);
const isolatedSpawn = isPrivateSecurityTask(task)
? await import('../lib/privateSecuritySandbox.js')
diff --git a/server/services/askService.js b/server/services/askService.js
index 315823f89c..be87d2e2f6 100644
--- a/server/services/askService.js
+++ b/server/services/askService.js
@@ -31,7 +31,9 @@ import { getCharacter } from './character.js';
import { getEvents as getCalendarEvents } from './calendarSync.js';
import { tokenize as bm25Tokenize, STOP_WORDS } from '../lib/bm25.js';
import { VALID_MODES as STORAGE_VALID_MODES } from './askConversations.js';
-import { resolveCliModel, prefixOpencodeModel, hasModelFlag, isOpencodeCommand } from '../lib/providerModels.js';
+import { resolveCliModel, prefixOpencodeModel, ensureLeadingSubcommand, hasModelFlag, isOpencodeCommand } from '../lib/providerModels.js';
+import { isKiloCommand, ensureKiloHeadlessArgs } from '../lib/kilo.js';
+import { isOpenchamberCommand, ensureOpenchamberHeadlessArgs } from '../lib/openchamber.js';
import { ensureAntigravityPrintArgs, isAntigravityCliProvider } from '../lib/antigravity.js';
import { isGrokCommand, ensureGrokHeadlessArgs } from '../lib/grok.js';
import { prepareCliPrompt } from '../lib/cliProviderArgs.js';
@@ -491,7 +493,7 @@ async function* streamCompletion(provider, model, prompt, signal) {
// stdin); ensure it leads the argv even if a customized/TUI provider config
// omitted it — a bare `opencode` launches the interactive TUI, which never
// consumes the piped prompt and hangs until the provider timeout fires.
- if (isOpencodeCommand(provider?.command) && !args.includes('run')) args.unshift('run');
+ if (isOpencodeCommand(provider?.command)) args = ensureLeadingSubcommand(args, 'run');
if (provider.headlessArgs?.length) args.push(...provider.headlessArgs);
const cliModel = resolveCliModel(model);
if (isAntigravityCliProvider(provider)) {
@@ -511,6 +513,16 @@ async function* streamCompletion(provider, model, prompt, signal) {
// Grok reads its prompt from --prompt-file /dev/stdin and needs plain output
// + permission bypass; ensureGrokHeadlessArgs adds them (gated on user pins).
args = ensureGrokHeadlessArgs(args, cliModel);
+ } else if (isKiloCommand(provider?.command)) {
+ // Kilo forks OpenCode's `run`, and adds the `--auto` approval posture an
+ // unattended answer needs — without it the run stalls on the first
+ // permission prompt with nobody to answer it.
+ args = ensureKiloHeadlessArgs(args, cliModel);
+ } else if (isOpenchamberCommand(provider?.command)) {
+ // OpenChamber's prompt path is a control-plane action, not a flag: without
+ // `session create` the bare binary starts its SERVER. The builder also drops
+ // a model id that is not `provider/model`, which its CLI rejects outright.
+ args = ensureOpenchamberHeadlessArgs(args, cliModel);
} else if (cliModel) {
args.push('--model', cliModel);
}
diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.js
index fd498821c5..94d15f4ade 100644
--- a/server/services/codeReview.test.js
+++ b/server/services/codeReview.test.js
@@ -192,6 +192,7 @@ describe('codeReview helpers', () => {
piModel: 'example/model',
cursorModel: null,
opencodeModel: null,
+ kiloModel: null,
kimiModel: null,
mtplxModel: null,
...NO_EFFORTS,
@@ -238,8 +239,8 @@ describe('codeReview helpers', () => {
const probed = []
commandExistsMock.impl = async (binary) => { probed.push(binary); return binary !== 'agy' }
const out = await getReviewerCliInstalled()
- expect(out).toEqual({ claude: true, antigravity: false, codex: true, grok: true, cursor: true, opencode: true, kimi: true, pi: true })
- expect(probed.sort()).toEqual(['agy', 'claude', 'codex', 'cursor-agent', 'grok', 'kimi', 'opencode', 'pi'])
+ expect(out).toEqual({ claude: true, antigravity: false, codex: true, grok: true, cursor: true, opencode: true, kilo: true, kimi: true, pi: true })
+ expect(probed.sort()).toEqual(['agy', 'claude', 'codex', 'cursor-agent', 'grok', 'kilo', 'kimi', 'opencode', 'pi'])
})
it('caches the result within the TTL — a second call does not re-probe', async () => {
diff --git a/server/services/harnesses.js b/server/services/harnesses.js
index 36cc97c1c3..e063ac67c9 100644
--- a/server/services/harnesses.js
+++ b/server/services/harnesses.js
@@ -2,8 +2,9 @@
* Harnesses — the coding-agent CLIs/TUIs PortOS drives, seen as things you
* MANAGE rather than as a footnote on a provider card.
*
- * A harness is one binary (`opencode`, `claude`, `codex`, `agy`, `grok`,
- * `kimi`, `cursor-agent`) that several provider records share. Availability and
+ * A harness is one binary (`opencode`, `kilo`, `openchamber`, `claude`,
+ * `codex`, `agy`, `grok`, `kimi`, `cursor-agent`) that several provider
+ * records share. Availability and
* the fixed install/update/remove invocations live in
* `providerRuntimeInstaller.js`; this module answers the two questions that
* need the provider records too:
@@ -208,7 +209,15 @@ export async function listHarnesses({ fresh = false, run = commandOutput, ...pro
return Promise.all(PROVIDER_RUNTIMES.map(async (runtime) => {
const status = statuses[runtime.id] || {};
const linked = providersForHarness(providers, runtime);
- const latestVersion = runtime.npmPackage
+ // Gated on `installed`, not just on the row being npm-backed: for a harness
+ // that is not here, the registry answer cannot change anything. Nothing
+ // renders `latestVersion` for an uninstalled row, and `updateAvailable`
+ // needs a definite "installed < latest", so a `null` installed version
+ // already makes it false. Ungated, every shipped-but-uninstalled harness
+ // cost an `npm view` child plus a registry round trip on each cache-cold
+ // page load — and the Kilo and OpenChamber rows, which ship disabled on
+ // every existing install, would have made that the common case.
+ const latestVersion = runtime.npmPackage && status.installed
? await getLatestPublishedVersion(runtime.npmPackage, { fresh, run })
: null;
return {
diff --git a/server/services/harnesses.test.js b/server/services/harnesses.test.js
index 48e1937b61..f328178d22 100644
--- a/server/services/harnesses.test.js
+++ b/server/services/harnesses.test.js
@@ -79,12 +79,18 @@ describe('the shipped records a harness refresh may rewrite', () => {
.sort();
expect(rewritable).toEqual([
- // The four harnesses that can enumerate their own models, crossed with
- // the wrappers that run those models natively. Every OpenCode wrapper
- // pointed at a local daemon or a hosted gateway is correctly absent.
+ // The harnesses that can enumerate their own models, crossed with the
+ // wrappers that run those models natively. Every OpenCode wrapper pointed
+ // at a local daemon or a hosted gateway is correctly absent — and so is
+ // `openchamber-cli`, whose `models` subcommand prints its runtime's
+ // SETTINGS rather than a catalog, so its row declares no `modelsArgs`.
'antigravity-cli', 'antigravity-tui',
'cursor-cli', 'cursor-tui',
'grok-cli', 'grok-tui',
+ // Kilo serves whatever the user's own `/connect` credentials reach, which
+ // is exactly what `kilo models` prints — no backend marker, so a refresh
+ // is correct here.
+ 'kilo-cli', 'kilo-tui',
'opencode-zen-cli', 'opencode-zen-tui',
'pi-cli', 'pi-tui',
]);
diff --git a/server/services/providerRuntimeInstaller.js b/server/services/providerRuntimeInstaller.js
index 1859dfb380..a8477fe78d 100644
--- a/server/services/providerRuntimeInstaller.js
+++ b/server/services/providerRuntimeInstaller.js
@@ -120,6 +120,26 @@ const RUNTIME_ROWS = [
modelsArgs: ['models'],
docsUrl: 'https://opencode.ai/docs',
},
+ {
+ vendor: 'kilo',
+ label: 'Kilo Code CLI',
+ install: { kind: 'npm', package: '@kilocode/cli@latest' },
+ // An OpenCode fork, down to the updater subcommand.
+ selfUpdate: ['upgrade'],
+ modelsArgs: ['models'],
+ docsUrl: 'https://kilo.ai/docs/code-with-ai/platforms/cli',
+ },
+ {
+ vendor: 'openchamber',
+ label: 'OpenChamber',
+ install: { kind: 'npm', package: '@openchamber/web@latest' },
+ selfUpdate: ['update'],
+ // No `modelsArgs`: `openchamber models` prints the runtime's default,
+ // favorite and recent model SETTINGS, not the catalog a picker needs — so
+ // this row must not claim it can enumerate models (a claim with no parser
+ // in harnessOutput.js would report an empty catalog and refuse forever).
+ docsUrl: 'https://openchamber.dev/',
+ },
{
vendor: 'grok',
label: 'Grok Build CLI',
@@ -138,10 +158,6 @@ const RUNTIME_ROWS = [
{
vendor: 'antigravity',
label: 'Antigravity CLI',
- // `agy` is the canonical binary, but `isAntigravityCommand` also accepts a
- // provider configured as `antigravity` — publish that spelling too so such a
- // card still finds its runtime. Pinned by the alias test.
- aliases: ['antigravity'],
// Antigravity ships a single compiled binary, not an npm package.
install: { kind: 'script', url: 'https://antigravity.google/cli/install.sh' },
selfUpdate: ['update'],
@@ -161,12 +177,12 @@ const RUNTIME_ROWS = [
},
];
-const vendorCommand = (vendorId) => {
- const command = PROVIDER_VENDORS.find((vendor) => vendor.id === vendorId)?.inferredCommand;
+const vendorRow = (vendorId) => {
+ const vendor = PROVIDER_VENDORS.find((row) => row.id === vendorId);
// A renamed vendor row must fail loudly at boot, not silently drop a card's
// install button.
- if (!command) throw new Error(`providerRuntimeInstaller: no PROVIDER_VENDORS row for "${vendorId}"`);
- return command;
+ if (!vendor?.inferredCommand) throw new Error(`providerRuntimeInstaller: no PROVIDER_VENDORS row for "${vendorId}"`);
+ return vendor;
};
/**
@@ -183,15 +199,19 @@ const vendorCommand = (vendorId) => {
* script-installed binary has no vendor-published uninstall PortOS can run.
*/
export const PROVIDER_RUNTIMES = Object.freeze(RUNTIME_ROWS.map((row) => Object.freeze({
- aliases: [],
selfUpdate: null,
modelsArgs: null,
...row,
+ // The accepted binary spellings come from the VENDOR row, the same list
+ // `matchCommand` and the runner's allowlist read — a card looks its runtime up
+ // by the command the provider is configured with, which may be an alias, and
+ // a second hand-typed copy here is how that silently stops matching.
+ aliases: [...(vendorRow(row.vendor).commandAliases || [])],
// `@latest` is an install-time tag, not part of the package identity, and
// `npm view`/`npm uninstall` both want it gone.
npmPackage: row.install.kind === 'npm' ? row.install.package.replace(/@latest$/, '') : null,
- id: vendorCommand(row.vendor),
- command: vendorCommand(row.vendor),
+ id: vendorRow(row.vendor).inferredCommand,
+ command: vendorRow(row.vendor).inferredCommand,
})));
// Keyed by the canonical id AND by every accepted alias spelling of the same
diff --git a/server/services/runner.js b/server/services/runner.js
index 6698ced111..659c0097c0 100644
--- a/server/services/runner.js
+++ b/server/services/runner.js
@@ -381,7 +381,7 @@ export async function executeCliRun({ runId, provider, prompt, workspacePath, sc
const promptInput = vision ? vision.invocation.stdin : prompt;
const { args, useStdin, cleanup: cleanupPromptFile } = vision
? { args: builtArgs, useStdin: promptInput != null, cleanup: () => {} }
- : prepareCliPrompt(provider.command, builtArgs, promptInput);
+ : prepareCliPrompt(provider.command, builtArgs, promptInput, { cwd: effectiveCwd });
console.log(`🚀 Executing CLI: ${provider.command} (${prompt.length} chars via ${useStdin ? 'stdin' : 'argv'}${vision ? `, ${screenshots.length} images` : ''})`);
// Ollama-backed CLIs (claude-ollama, opencode-ollama) reach the daemon
diff --git a/server/services/visionCli.js b/server/services/visionCli.js
index 7d38093608..4395c7d53a 100644
--- a/server/services/visionCli.js
+++ b/server/services/visionCli.js
@@ -216,7 +216,7 @@ async function runCliVisionSpawn({ provider, model, invocation, timeout, spawnIm
// Deliver the prompt per provider convention: antigravity as the --print
// VALUE (agy doesn't read stdin); grok's --prompt-file /dev/stdin via stdin
// (POSIX) / temp file (Windows); every other provider via stdin.
- const { args: deliveredArgs, useStdin: writePromptToStdin, cleanup } = prepareCliPrompt(command, args, stdin);
+ const { args: deliveredArgs, useStdin: writePromptToStdin, cleanup } = prepareCliPrompt(command, args, stdin, { cwd });
setCleanup?.(cleanup);
// Shared composition (provider.envVars + OpenCode models map + PWD pin +