Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript

feat(byoa): add native Fast Mode for Codex and Claude Code

bingqilinweimaotaid6e616012be1
diff --git a/docs/BYOA.md b/docs/BYOA.md
index 3b83593..b45a66c 100644
--- a/docs/BYOA.md
+++ b/docs/BYOA.md
@@ -448,6 +448,33 @@ disabled may send `high` even when `xhigh` is saved. To request deeper
reasoning, enable thinking as well as setting effort. See
[Claude model configuration](https://code.claude.com/docs/en/model-config#adjust-effort-level).
+### Native Fast Mode
+
+The Agent editor offers **Fast mode** below the main model for Codex and
+Claude Code. It defaults to off, is saved per Agent, and leaves the main model,
+auxiliary model and reasoning effort unchanged. Saving a changed preference
+replaces the runner and resumes its existing engine session where supported.
+
+Codex receives `serviceTier: "fast"` on thread start/resume and
+`-c service_tier="fast" -c features.fast_mode=true` on one-shot execution,
+including Windows and transport fallback. Off explicitly selects `default` so
+local configuration or a resumed thread cannot re-enable Fast Mode. The model
+picker honors Fast Mode capabilities advertised by Codex's local model catalog.
+
+Claude receives `fastMode: true/false` merged into the existing inline
+`--settings` policy. Only the `opus` alias and currently supported Opus 4.8,
+5 and 5.5 model IDs are accepted; unknown provider aliases must use a supported
+explicit model ID. The daemon also checks Opus alias remapping before launch
+to prevent Claude from silently changing an unsupported model. Native Fast
+Mode requires removing a `CUMORA_CLAUDE_ARGS` whole-argv override.
+
+Model and account eligibility still come from the provider. Codex Fast Mode
+increases quota consumption or cost; Claude subscription users need paid usage
+credits and organization permission where applicable. See
+[Codex speed](https://learn.chatgpt.com/docs/agent-configuration/speed) and
+[Claude Fast Mode](https://code.claude.com/docs/en/fast-mode) for current
+availability and billing. Triage and doctor calls keep Fast Mode disabled.
+
### Running against a custom provider
Custom providers (CC Switch and friends) often store their endpoint,
diff --git a/server/docker/cumora-server.Dockerfile b/server/docker/cumora-server.Dockerfile
index b1eb9e9..afe4e9c 100644
--- a/server/docker/cumora-server.Dockerfile
+++ b/server/docker/cumora-server.Dockerfile
@@ -63,6 +63,7 @@ COPY package.json package-lock.json ./
# scripts is safe in this stage AND faster than apt-get'ing bzip2.
RUN npm ci --no-audit --no-fund --prefer-offline --ignore-scripts
COPY src ./src
+COPY shared ./shared
COPY public ./public
COPY index.html ./
COPY vite.config.ts ./
@@ -98,6 +99,7 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY package.json package-lock.json ./
COPY server ./server
+COPY shared ./shared
# Keep `bin/cumora` available for any in-process CLI calls the server
# itself might make (e.g. from the test endpoints).
COPY bin ./bin
diff --git a/server/docker/cumora-server.Dockerfile.dockerignore b/server/docker/cumora-server.Dockerfile.dockerignore
index bd36115..2b792cf 100644
--- a/server/docker/cumora-server.Dockerfile.dockerignore
+++ b/server/docker/cumora-server.Dockerfile.dockerignore
@@ -8,6 +8,7 @@
!package.json
!package-lock.json
!server/**
+!shared/**
!bin/**
# Frontend sources needed to build the SPA bundle inside the image.
!src/**
diff --git a/server/src/__integration__/agent-creation.test.ts b/server/src/__integration__/agent-creation.test.ts
index 7bdf774..edbe7a1 100644
--- a/server/src/__integration__/agent-creation.test.ts
+++ b/server/src/__integration__/agent-creation.test.ts
@@ -1,8 +1,10 @@
import { after, before, beforeEach, test } from 'node:test'
import assert from 'node:assert/strict'
+import { createServer } from 'node:http'
import { pool } from '../db/pool.js'
import { AgentCreationError, createAgentRecord } from '../agents/create.js'
-import { ensureSchemaOnce, resetAllTables, seedUserMembership, teardownAll } from './_helpers.js'
+import { assignAgentToComputer, listAgentsForComputer } from '../agents/computer/registry.js'
+import { buildApiTestApp, ensureSchemaOnce, resetAllTables, seedUserMembership, teardownAll } from './_helpers.js'
const COMPANY_ID = 'co-agent-create'
const OWNER_ID = 'u-agent-create'
@@ -82,6 +84,43 @@ test('[integration] concurrent Agent-create retries return one atomically assign
}])
})
+test('[integration] native Fast Mode persists across creation, discovery and reassignment', async () => {
+ const createInput = input({ nativeFastMode: true })
+ const created = await createAgentRecord(createInput)
+ assert.equal((await createAgentRecord(createInput)).id, created.id)
+ await assert.rejects(createAgentRecord({ ...createInput, nativeFastMode: false }), /different agent data/)
+ assert.equal((await listAgentsForComputer(COMPUTER_ID)).find((agent) => agent.id === created.id)?.nativeFastMode, true)
+ await assignAgentToComputer({ companyId: COMPANY_ID, computerId: COMPUTER_ID, agentId: created.id, engine: 'codex', nativeFastMode: false })
+ assert.equal((await listAgentsForComputer(COMPUTER_ID)).find((agent) => agent.id === created.id)?.nativeFastMode, false)
+ const standard = await createAgentRecord(input({ requestId: 'fast-mode-default' }))
+ assert.equal((await listAgentsForComputer(COMPUTER_ID)).find((agent) => agent.id === standard.id)?.nativeFastMode, false)
+})
+
+test('[integration] the Agent API validates, updates and returns the native Fast Mode flag', async () => {
+ const created = await createAgentRecord(input())
+ const server = createServer(await buildApiTestApp(OWNER_ID))
+ await new Promise<void>((resolve) => { server.listen(0, '127.0.0.1', resolve) })
+ const address = server.address()
+ assert.ok(address && typeof address === 'object')
+ const endpoint = `http://127.0.0.1:${address.port}/api`
+ const headers = { 'content-type': 'application/json', 'x-company-id': COMPANY_ID }
+ try {
+ for (const nativeFastMode of [true, false]) {
+ const saved = await fetch(`${endpoint}/agents/${created.id}`, { method: 'PUT', headers, body: JSON.stringify({ nativeFastMode }) })
+ assert.equal(saved.status, 200)
+ const listed = await fetch(`${endpoint}/participants`, { headers })
+ const participants = await listed.json() as Array<{ id: string; nativeFastMode: boolean }>
+ assert.equal(participants.find((agent) => agent.id === created.id)?.nativeFastMode, nativeFastMode)
+ }
+ for (const invalid of ['true', 1, null]) {
+ const rejected = await fetch(`${endpoint}/agents/${created.id}`, { method: 'PUT', headers, body: JSON.stringify({ nativeFastMode: invalid }) })
+ assert.equal(rejected.status, 400)
+ }
+ } finally {
+ await new Promise<void>((resolve, reject) => server.close((error) => error ? reject(error) : resolve()))
+ }
+})
+
test('[integration] invalid placement rolls back without creating an Agent', async () => {
await pool.query(
'UPDATE computers SET available_engines = $2::jsonb WHERE id = $1',
diff --git a/server/src/__tests__/agents-computer-engine-detect.test.ts b/server/src/__tests__/agents-computer-engine-detect.test.ts
index 156b628..30f17d2 100644
--- a/server/src/__tests__/agents-computer-engine-detect.test.ts
+++ b/server/src/__tests__/agents-computer-engine-detect.test.ts
@@ -45,6 +45,19 @@ after(async () => {
} catch { /* ignore */ }
})
+test('model capability sanitization preserves explicit Fast Mode support', () => {
+ const detected = registry.sanitizeDetectedEngines([{
+ id: 'codex', modelCatalog: {
+ models: [
+ { id: 'fast', supportsFastMode: true },
+ { id: 'standard', supportsFastMode: false },
+ { id: 'unknown', supportsFastMode: 'true' },
+ ],
+ },
+ }], ['codex'])
+ assert.deepEqual(detected[0].modelCatalog?.models.map((model) => model.supportsFastMode), [true, false, undefined])
+})
+
test('sanitizeDetectedEngines drops unknown ids and fills missing bins', () => {
const out = registry.sanitizeDetectedEngines(
[{ id: 'claude', bin: 'claude', path: '/usr/bin/claude' }, { id: 'bogus', bin: 'x', path: null }],
@@ -238,13 +251,14 @@ test('assignAgentToComputer persists model pins in the host assignment update',
})
const out = await registry.assignAgentToComputer({
agentId: 'bram', companyId: 'co-1', computerId: 'comp-1', engine: 'codex', inherit: false,
- model: 'gpt-5.6-sol', fastModel: null,
+ model: 'gpt-5.6-sol', fastModel: null, nativeFastMode: true,
})
assert.deepEqual(out, { kind: 'local', engine: 'codex', inherit: false })
const update = calls.find((call) => /UPDATE participants SET computer_id/.test(call.sql))
assert.match(update?.sql ?? '', /model = \$4/)
assert.match(update?.sql ?? '', /fast_model = \$5/)
+ assert.match(update?.sql ?? '', /native_fast_mode = \$6/)
assert.deepEqual(update?.params, [
- 'comp-1', 'codex', false, 'gpt-5.6-sol', null, null, 'bram', 'co-1',
+ 'comp-1', 'codex', false, 'gpt-5.6-sol', null, true, null, 'bram', 'co-1',
])
})
diff --git a/server/src/__tests__/agents-computer-engine.test.ts b/server/src/__tests__/agents-computer-engine.test.ts
index 6244f31..de26c8f 100644
--- a/server/src/__tests__/agents-computer-engine.test.ts
+++ b/server/src/__tests__/agents-computer-engine.test.ts
@@ -413,6 +413,74 @@ if (argv.includes('--input-format')) {
assert.equal(cheap.argv.includes('--settings'), false)
})
+test('Claude Fast Mode preserves the model, preferences, sandbox and resume on both transports', async () => {
+ const root = await mkdtemp(join(tmpdir(), 'cumora-claude-fast-'))
+ tempDirs.push(root)
+ const binDir = join(root, 'bin')
+ const home = join(root, 'home')
+ const configDir = join(root, 'config')
+ await Promise.all([mkdir(binDir), mkdir(home), mkdir(configDir)])
+ await writeFile(join(configDir, 'settings.json'), JSON.stringify({ fastMode: true, effortLevel: 'xhigh' }))
+ await writeFakeCli(binDir, 'claude', `
+const argv = process.argv.slice(2)
+const reply = () => {
+ const capture = { argv, small: process.env.ANTHROPIC_SMALL_FAST_MODEL, disabled: process.env.CLAUDE_CODE_DISABLE_FAST_MODE }
+ const format = argv[argv.indexOf('--output-format') + 1]
+ if (format === 'json') process.stdout.write(JSON.stringify({ result: JSON.stringify(capture) }))
+ else if (format === 'text') process.stdout.write(JSON.stringify(capture))
+ else {
+ process.stderr.write(JSON.stringify(capture) + '\\n')
+ process.stdout.write(JSON.stringify({ type: 'result', subtype: 'success', result: 'OK', session_id: 'prior-session' }) + '\\n')
+ }
+}
+if (argv.includes('--input-format')) require('node:readline').createInterface({ input: process.stdin }).on('line', reply)
+else { process.stdin.resume(); process.stdin.on('end', reply) }
+`)
+ useFakeCliPath(binDir)
+ for (const compatibility of [false, true]) {
+ if (compatibility) process.env.CUMORA_BYOA_ALLOW_UNSANDBOXED = '1'
+ else delete process.env.CUMORA_BYOA_ALLOW_UNSANDBOXED
+ for (const nativeFastMode of [true, false]) {
+ for (const persistent of [false, true]) {
+ const logs: string[] = []
+ const args = {
+ home, env: secureClaudeEnv(root, { CLAUDE_CONFIG_DIR: configDir, CLAUDE_CODE_DISABLE_FAST_MODE: '0' }),
+ model: 'claude-opus-5', fastModel: 'auxiliary', nativeFastMode, resumeSessionId: 'prior-session',
+ onLog: (line: string) => logs.push(line),
+ }
+ if (persistent) {
+ const session = getAdapter('claude').startSession?.(args)
+ assert.ok(session)
+ liveSessions.push(session)
+ assert.equal((await session.send('wake')).exitCode, 0)
+ await session.stop()
+ } else {
+ assert.equal((await getAdapter('claude').run({ ...args, prompt: 'wake', signal: new AbortController().signal })).exitCode, 0)
+ }
+ const captured = JSON.parse(logs.find((line) => line.startsWith('{')) ?? '{}')
+ const argv: string[] = captured.argv
+ const settings = JSON.parse(argv[argv.indexOf('--settings') + 1])
+ assert.equal(settings.fastMode, nativeFastMode)
+ assert.equal(argv.filter((arg) => arg === '--settings').length, 1)
+ assert.equal(argv[argv.indexOf('--model') + 1], 'claude-opus-5')
+ assert.equal(argv[argv.indexOf('--resume') + 1], 'prior-session')
+ assert.equal(captured.small, 'auxiliary')
+ assert.equal(argv.includes('--effort'), false)
+ if (!compatibility) {
+ assert.equal(settings.effortLevel, 'xhigh')
+ assert.equal(settings.sandbox.enabled, true)
+ assert.equal(settings.permissions.defaultMode, 'dontAsk')
+ }
+ }
+ }
+ const env = secureClaudeEnv(root, { CLAUDE_CONFIG_DIR: configDir })
+ const triage = await getAdapter('claude').classify({ cwd: home, env, model: 'haiku', prompt: 'classify', signal: new AbortController().signal })
+ assert.equal(JSON.parse(triage.text).disabled, '1')
+ const doctor = await getAdapter('claude').probe({ cwd: home, env, tier: 'small', signal: new AbortController().signal })
+ assert.equal(JSON.parse(doctor.text).disabled, '1')
+ }
+})
+
test('persistent Claude startup failure keeps stderr for first send', async () => {
const root = await mkdtemp(join(tmpdir(), 'cumora-engine-session-'))
tempDirs.push(root)
@@ -650,6 +718,20 @@ test('Codex one-shot paths send prompts through stdin', async () => {
assert.equal(runCapture.argv?.some((arg) => arg.includes('dangerously')), false)
assert.equal(runCapture.argv?.some((arg) => arg.includes('must-not-reach-tools')), false)
assert.equal(runCapture.stdin, longPrompt)
+ assert.ok(runCapture.argv?.includes('service_tier="default"'))
+ for (const nativeFastMode of [true, false]) {
+ const speedLogs: string[] = []
+ await adapter.run({
+ home, prompt: 'wake', model: 'test-model', fastModel: 'auxiliary', nativeFastMode,
+ env: { ...process.env, CUMORA_AGENT_IPC_DIR: join(root, 'private-ipc'), CUMORA_AGENT_MCP_SHIM: mcpShim },
+ onLog: (line) => speedLogs.push(line), signal: new AbortController().signal,
+ })
+ const captured = JSON.parse(speedLogs.at(-1) ?? '{}') as { argv: string[] }
+ assert.ok(captured.argv.includes(`service_tier="${nativeFastMode ? 'fast' : 'default'}"`))
+ assert.equal(captured.argv.includes('features.fast_mode=true'), nativeFastMode)
+ assert.equal(captured.argv[captured.argv.indexOf('--model') + 1], 'test-model')
+ assert.ok(captured.argv.includes('--ignore-user-config'))
+ }
const triagePrompt = 'triage prompt with spaces\nand a second line'
const triage = await adapter.classify({
@@ -666,6 +748,7 @@ test('Codex one-shot paths send prompts through stdin', async () => {
assert.ok(triageCapture.argv?.includes('triage-model'))
assert.equal(triageCapture.argv?.at(-1), '-')
assert.equal(triageCapture.stdin, triagePrompt)
+ assert.ok(triageCapture.argv?.includes('service_tier="default"'))
const probe = await adapter.probe({
tier: 'big',
@@ -678,6 +761,7 @@ test('Codex one-shot paths send prompts through stdin', async () => {
assert.ok(probeCapture.argv?.includes('--ignore-user-config'))
assert.equal(probeCapture.argv?.at(-1), '-')
assert.equal(probeCapture.stdin, 'Connectivity check. Reply with exactly: OK')
+ assert.ok(probeCapture.argv?.includes('service_tier="default"'))
})
test('Claude and Codex one-shot adapters return structured engine failures', async () => {
@@ -781,6 +865,54 @@ async function startFakeCodexSession(opts: { resume?: string } = {}) {
return { session: session!, logs }
}
+test('Codex Fast Mode reaches fresh, resumed and fallback threads without changing the model', { skip: IS_WIN }, async () => {
+ const root = await mkdtemp(join(tmpdir(), 'cumora-codex-fast-'))
+ tempDirs.push(root)
+ const binDir = join(root, 'bin')
+ const home = join(root, 'home')
+ await Promise.all([mkdir(binDir), mkdir(home)])
+ await writeFakeCli(binDir, 'codex', `
+require('node:readline').createInterface({ input: process.stdin }).on('line', line => {
+ const msg = JSON.parse(line)
+ const emit = result => process.stdout.write(JSON.stringify({ id: msg.id, result }) + '\\n')
+ if (msg.method === 'initialize') emit({})
+ if (msg.method === 'thread/start' || msg.method === 'thread/resume') {
+ process.stderr.write(JSON.stringify({ method: msg.method, params: msg.params, argv: process.argv.slice(2) }) + '\\n')
+ if (msg.params.threadId === 'missing-thread') process.stdout.write(JSON.stringify({ id: msg.id, error: { message: 'session not found' } }) + '\\n')
+ else emit({ thread: { id: 'fixture-thread' } })
+ }
+ if (msg.method === 'turn/start') {
+ emit({ turn: { id: 'fixture-turn' } })
+ process.stdout.write(JSON.stringify({ method: 'turn/completed', params: { turn: { id: 'fixture-turn', status: 'completed' } } }) + '\\n')
+ }
+})
+`)
+ useFakeCliPath(binDir)
+ for (const nativeFastMode of [true, false]) {
+ for (const resumeSessionId of [null, 'prior-thread', 'missing-thread']) {
+ const logs: string[] = []
+ const session = getAdapter('codex').startSession?.({
+ home, env: secureClaudeEnv(root), model: 'main-model', nativeFastMode, resumeSessionId,
+ onLog: (line) => logs.push(line),
+ })
+ assert.ok(session)
+ liveSessions.push(session)
+ assert.equal((await session.send('wake')).exitCode, 0)
+ await session.stop()
+ const requests = logs.filter((line) => line.startsWith('{')).map((line) => JSON.parse(line))
+ assert.deepEqual(requests.map((request) => request.method), resumeSessionId === 'missing-thread'
+ ? ['thread/resume', 'thread/start'] : [resumeSessionId ? 'thread/resume' : 'thread/start'])
+ for (const request of requests) {
+ assert.equal(request.params.serviceTier, nativeFastMode ? 'fast' : 'default')
+ assert.equal(request.params.model, 'main-model')
+ assert.equal(request.params.sandbox, 'workspace-write')
+ assert.equal(request.params.reasoningEffort, undefined)
+ assert.ok(request.argv.includes(`service_tier="${nativeFastMode ? 'fast' : 'default'}"`))
+ }
+ }
+ }
+})
+
test('a Codex session whose thread never opens dies instead of wedging', { skip: IS_WIN }, async () => {
const { session } = await startFakeCodexSession()
diff --git a/server/src/__tests__/agents-computer-model-catalog.test.ts b/server/src/__tests__/agents-computer-model-catalog.test.ts
index 6cc1394..220d4a9 100644
--- a/server/src/__tests__/agents-computer-model-catalog.test.ts
+++ b/server/src/__tests__/agents-computer-model-catalog.test.ts
@@ -11,6 +11,35 @@ import { join } from 'node:path'
import { readClaudeUserSettings, withClaudeUserSettingsEnv } from '../agents/computer/claude-user-settings.js'
import { clearModelCatalogCache, discoverEngineModelCatalog, parseListedModels } from '../agents/computer/model-catalog.js'
+test('Codex discovers Fast Mode support from advertised service tiers', async () => {
+ const root = await mkdtemp(join(tmpdir(), 'cumora-codex-tiers-'))
+ const script = join(root, 'catalog.cjs')
+ const bin = join(root, process.platform === 'win32' ? 'codex.cmd' : 'codex')
+ const rows = [
+ { model: 'fast-model', serviceTiers: [{ id: 'fast' }], isDefault: true },
+ { model: 'priority-model', serviceTiers: [{ id: 'priority' }] },
+ { model: 'standard-model', serviceTiers: [] },
+ { model: 'legacy-model' },
+ ]
+ await writeFile(script, `
+require('node:readline').createInterface({ input: process.stdin }).on('line', line => {
+ const msg = JSON.parse(line)
+ if (msg.id) process.stdout.write(JSON.stringify({ id: msg.id, result: msg.method === 'model/list' ? { data: ${JSON.stringify(rows)} } : {} }) + '\\n')
+})
+`)
+ await writeFile(bin, process.platform === 'win32'
+ ? `@echo off\r\n"${process.execPath}" "%~dp0catalog.cjs" %*\r\n`
+ : `#!/bin/sh\nexec node "${script}" "$@"\n`, { mode: 0o755 })
+ try {
+ const catalog = await discoverEngineModelCatalog('codex', bin, true)
+ assert.equal(catalog.source, 'protocol')
+ assert.deepEqual(rows.map((row) => catalog.models.find((model) => model.id === row.model)?.supportsFastMode), [true, true, false, undefined])
+ } finally {
+ clearModelCatalogCache()
+ await rm(root, { recursive: true, force: true })
+ }
+})
+
test('OpenCode catalog keeps provider-qualified model ids and deduplicates them', () => {
assert.deepEqual(
parseListedModels('anthropic/claude-sonnet-4-6\nopenai/gpt-5.5\nanthropic/claude-sonnet-4-6\n', 'provider'),
diff --git a/server/src/__tests__/native-fast-mode.test.ts b/server/src/__tests__/native-fast-mode.test.ts
new file mode 100644
index 0000000..43d71b2
--- /dev/null
+++ b/server/src/__tests__/native-fast-mode.test.ts
@@ -0,0 +1,47 @@
+import assert from 'node:assert/strict'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { test } from 'node:test'
+import { supportsNativeFastMode } from '../../../shared/native-fast-mode.js'
+import { AgentRunner } from '../agents/computer/daemon.js'
+import { getAdapter } from '../agents/computer/engine.js'
+
+test('native Fast Mode only allows Claude models that will not be switched to Opus', () => {
+ for (const model of ['opus', 'opus[1m]', 'claude-opus-4-8', 'claude-opus-5', 'claude-opus-5-5-20261001']) {
+ assert.equal(supportsNativeFastMode('claude', model), true, model)
+ }
+ for (const model of [null, '', 'sonnet', 'haiku', 'opusplan', 'claude-opus-4-7', 'provider/opus']) {
+ assert.equal(supportsNativeFastMode('claude', model), false, String(model))
+ }
+ assert.equal(supportsNativeFastMode('codex', 'custom-model'), true)
+ assert.equal(supportsNativeFastMode('managed', 'opus'), false)
+ assert.equal(supportsNativeFastMode('cursor', 'opus'), false)
+})
+
+test('Claude refuses Fast Mode before spawning when its model or alias is unsupported', async () => {
+ const adapter = getAdapter('claude')
+ const env = { CLAUDE_CONFIG_DIR: join(tmpdir(), 'cumora-no-fast-mode-settings') }
+ for (const pin of [
+ { model: 'sonnet', env },
+ { model: 'claude-opus-4-7', env },
+ { model: 'opus', env: { ...env, ANTHROPIC_DEFAULT_OPUS_MODEL: 'provider/other-model' } },
+ { model: 'opus', env: { ...env, CLAUDE_CODE_DISABLE_FAST_MODE: '1' } },
+ ]) {
+ const args = { home: tmpdir(), ...pin, nativeFastMode: true, onLog: () => {} }
+ assert.equal(adapter.startSession?.(args), null)
+ const result = await adapter.run({ ...args, prompt: 'unused', signal: new AbortController().signal })
+ assert.equal(result.exitCode, 1)
+ assert.match(result.error ?? '', /Fast mode/)
+ }
+})
+
+test('changing Fast Mode replaces the runner while omitted and false settings match', () => {
+ const agent = { id: 'fast-mode-fixture', name: 'Fixture', role: null, systemPrompt: null, engine: 'codex' as const, model: 'main', fastModel: 'auxiliary' }
+ const cfg = { serverUrl: 'https://server.example.test', computerId: 'fixture', deviceToken: 'fixture' }
+ const standard = new AgentRunner(cfg, agent, 'codex')
+ const fast = new AgentRunner(cfg, { ...agent, nativeFastMode: true }, 'codex')
+ assert.equal(standard.configMatches({ ...agent, nativeFastMode: false }, 'codex'), true)
+ assert.equal(standard.configMatches({ ...agent, nativeFastMode: true }, 'codex'), false)
+ assert.equal(fast.configMatches({ ...agent, nativeFastMode: true }, 'codex'), true)
+ assert.equal(fast.configMatches({ ...agent, nativeFastMode: false }, 'codex'), false)
+})
diff --git a/server/src/__tests__/schema-migrations.test.ts b/server/src/__tests__/schema-migrations.test.ts
index f0f77c8..806337d 100644
--- a/server/src/__tests__/schema-migrations.test.ts
+++ b/server/src/__tests__/schema-migrations.test.ts
@@ -22,6 +22,7 @@ const { engineDefaultsChecksum } = await import('../db/migrations/0007-engine-de
const { agentProviderProfileChecksum } = await import('../db/migrations/0008-agent-provider-profile.js')
const { agentRoutingClaimsChecksum } = await import('../db/migrations/0009-agent-routing-claims.js')
const { boardCardDueOnChecksum } = await import('../db/migrations/0010-board-card-due-on.js')
+const { agentNativeFastModeChecksum } = await import('../db/migrations/0011-agent-native-fast-mode.js')
const { verifySchemaCompatibility } = await import('../db/schema-version.js')
type SchemaVersionQueryable = import('../db/schema-version.js').SchemaVersionQueryable
@@ -67,6 +68,10 @@ test('the board card due date migration matches its immutable manifest checksum'
assert.equal(boardCardDueOnChecksum(), SCHEMA_MIGRATIONS[9].checksum)
})
+test('the native Fast Mode migration matches its immutable manifest checksum', () => {
+ assert.equal(agentNativeFastModeChecksum(), SCHEMA_MIGRATIONS[10].checksum)
+})
+
test('the migration owner accepts an exact prefix and reports its pending suffix', () => {
const empty = validateMigrationHistory([], { allowPending: true })
assert.equal(empty.currentVersion, 0)
diff --git a/server/src/agents/computer/daemon.ts b/server/src/agents/computer/daemon.ts
index 4fedba9..0f5598a 100644
--- a/server/src/agents/computer/daemon.ts
+++ b/server/src/agents/computer/daemon.ts
@@ -454,6 +454,7 @@ interface AgentInfo {
engine: EngineId | null
model: string | null
fastModel: string | null
+ nativeFastMode?: boolean
}
/** One line's worth of "there is a file on this message".
@@ -2028,6 +2029,7 @@ export class AgentRunner {
env: this.engineEnv(),
model: this.engineModel(),
fastModel: this.engineFastModel(),
+ nativeFastMode: this.agent.nativeFastMode ?? false,
resumeSessionId,
onLog: (line) => this.logEngineLine(line),
onHopUsage: (r) => this.onEngineHop(r, 'agent-turn'),
@@ -2041,6 +2043,7 @@ export class AgentRunner {
env: this.engineEnv(),
model: this.engineModel(),
fastModel: this.engineFastModel(),
+ nativeFastMode: this.agent.nativeFastMode ?? false,
resumeSessionId,
onLog: (line) => this.logEngineLine(line),
onHopUsage: (r) => this.onEngineHop(r, 'agent-turn'),
@@ -2173,6 +2176,7 @@ export class AgentRunner {
&& this.agent.systemPrompt === agent.systemPrompt
&& this.agent.model === agent.model
&& this.agent.fastModel === agent.fastModel
+ && (this.agent.nativeFastMode ?? false) === (agent.nativeFastMode ?? false)
}
private async ensureToken(signal?: AbortSignal): Promise<string> {
@@ -2281,6 +2285,7 @@ export class AgentRunner {
env: this.engineEnv(),
model: this.engineModel(),
fastModel: this.engineFastModel(),
+ nativeFastMode: this.agent.nativeFastMode ?? false,
resumeSessionId,
standingPrompt: this.standingPrompt(),
onLog: (line) => this.logEngineLine(line),
diff --git a/server/src/agents/computer/engine.ts b/server/src/agents/computer/engine.ts
index a533434..96d2607 100644
--- a/server/src/agents/computer/engine.ts
+++ b/server/src/agents/computer/engine.ts
@@ -34,6 +34,7 @@ import { isCustomAnthropicEndpoint, readClaudeUserSettings, withClaudeUserSettin
import { isCliVersionAtLeast, probeEngineVersion, probeLocalEngineVersionWithRetry, versionCommandInvocation } from './cli-version.js'
import { discoverEngineModelCatalog, type EngineModelCatalog } from './model-catalog.js'
import { CODEX_RUNTIME_CONFIG_ARGS, codexAuthFingerprint, codexRuntimeEnv } from './codex-runtime.js'
+import { supportsNativeFastMode } from '../../../../shared/native-fast-mode.js'
const IS_WIN = process.platform === 'win32'
@@ -559,6 +560,7 @@ export interface EngineRunArgs {
/** Small-brain (cheap auxiliary) model. Claude: ANTHROPIC_SMALL_FAST_MODEL.
* Codex has no general fast-model knob, so it's ignored there for now. */
fastModel?: string | null
+ nativeFastMode?: boolean
/** Resume a prior engine session so the agent keeps continuous context
* across wakes (Claude: `--resume <id>`). Null/undefined → fresh session.
* This is what lets a BYOA agent remember its place in a running task
@@ -780,6 +782,7 @@ export interface EngineSessionArgs {
env: NodeJS.ProcessEnv
model?: string | null
fastModel?: string | null
+ nativeFastMode?: boolean
/** Resume a prior session on the FIRST spawn / after a restart (Claude:
* `--resume <id>`). Within a live process the session continues on its own. */
resumeSessionId?: string | null
@@ -1538,7 +1541,7 @@ const TOOL_ENV_ALLOWLIST = new Set([
'SYSTEMROOT', 'COMSPEC', 'PATHEXT', 'WINDIR',
])
-function claudeSecureSettings(agentHome: string, env: NodeJS.ProcessEnv): string {
+function claudeSecureSettings(agentHome: string, env: NodeJS.ProcessEnv, nativeFastMode = false): string {
const deniedEnv = Object.keys(env)
.filter((name) => !TOOL_ENV_ALLOWLIST.has(name.toUpperCase()) && !name.toUpperCase().startsWith('LC_'))
.sort()
@@ -1557,6 +1560,7 @@ function claudeSecureSettings(agentHome: string, env: NodeJS.ProcessEnv): string
const allowRead = [...new Set([agentHome, ...pathDirs])]
return JSON.stringify({
...readClaudeUserSettings(env).turnSettings,
+ fastMode: nativeFastMode,
permissions: {
defaultMode: 'dontAsk',
// Restricted mode confines file tools to the working directory. Keep the
@@ -1598,13 +1602,13 @@ function claudeSecureMcpConfig(env: NodeJS.ProcessEnv): string {
})
}
-function claudeSecureFlags(agentHome: string, env: NodeJS.ProcessEnv): string[] {
+function claudeSecureFlags(agentHome: string, env: NodeJS.ProcessEnv, nativeFastMode = false): string[] {
return [
'--restricted',
'--permission-mode', 'dontAsk',
'--tools', 'Read,Write,Edit,Glob,Grep,mcp__cumora__cli',
'--disallowedTools', 'Bash,PowerShell,WebFetch,WebSearch',
- '--settings', claudeSecureSettings(agentHome, env),
+ '--settings', claudeSecureSettings(agentHome, env, nativeFastMode),
'--mcp-config', claudeSecureMcpConfig(env),
'--strict-mcp-config',
]
@@ -1654,6 +1658,17 @@ function claudeTurnEnv(env: NodeJS.ProcessEnv, fastModel?: string | null): NodeJ
return turnEnv
}
+function claudeFastModeError(model: string | null | undefined, env: NodeJS.ProcessEnv, enabled: boolean): string | null {
+ if (!enabled) return null
+ let resolved = model || readClaudeUserSettings(env).defaultModel
+ if (/^opus(?:\[1m\])?$/i.test(resolved ?? '')) resolved = env.ANTHROPIC_DEFAULT_OPUS_MODEL || resolved
+ if (!supportsNativeFastMode('claude', resolved)) {
+ return 'Fast mode requires a supported Opus model; select one explicitly to avoid changing the selected model.'
+ }
+ if (env.CLAUDE_CODE_DISABLE_FAST_MODE === '1') return 'Fast mode is disabled by CLAUDE_CODE_DISABLE_FAST_MODE.'
+ return null
+}
+
class ClaudeAdapter implements EngineAdapter {
readonly id = 'claude' as const
readonly bin = 'claude'
@@ -1685,7 +1700,7 @@ class ClaudeAdapter implements EngineAdapter {
const argv = wantsStdinPrompt ? base : (flags.length ? [...base, args.prompt] : ['-p', args.prompt, ...base.slice(1)])
const res = await spawnCapture(command, argv, {
cwd: args.cwd,
- env: { ...env, MAX_THINKING_TOKENS: '0' },
+ env: { ...env, MAX_THINKING_TOKENS: '0', CLAUDE_CODE_DISABLE_FAST_MODE: '1' },
signal: args.signal,
onLog: args.onLog,
shell,
@@ -1717,7 +1732,7 @@ class ClaudeAdapter implements EngineAdapter {
const argv = wantsStdinPrompt ? base : ['-p', DOCTOR_PROMPT, ...base.slice(1)]
return spawnCapture(command, argv, {
cwd: args.cwd,
- env: { ...env, MAX_THINKING_TOKENS: '0' },
+ env: { ...env, MAX_THINKING_TOKENS: '0', CLAUDE_CODE_DISABLE_FAST_MODE: '1' },
signal: args.signal,
shell,
stdinText: wantsStdinPrompt ? DOCTOR_PROMPT : undefined,
@@ -1752,7 +1767,7 @@ class ClaudeAdapter implements EngineAdapter {
const argv = wantsStdinPrompt ? base : ['-p', DOCTOR_PROMPT, ...base.slice(1)]
const r = await spawnCapture(command, argv, {
cwd: args.cwd,
- env: { ...env, MAX_THINKING_TOKENS: '0' },
+ env: { ...env, MAX_THINKING_TOKENS: '0', CLAUDE_CODE_DISABLE_FAST_MODE: '1' },
signal: args.signal,
shell,
stdinText: wantsStdinPrompt ? DOCTOR_PROMPT : undefined,
@@ -1790,6 +1805,12 @@ class ClaudeAdapter implements EngineAdapter {
const flags = unsafeEngineArgs('CUMORA_CLAUDE_ARGS')
const model = args.model ? ['--model', args.model] : []
const env = claudeTurnEnv(args.env, args.fastModel)
+ const fastMode = args.nativeFastMode ?? false
+ if (fastMode && flags.length) return Promise.resolve({ exitCode: 1, error: 'Fast mode requires removing the CUMORA_CLAUDE_ARGS override so Cumora can preserve the selected model and settings.' })
+ if (!fastMode) env.CLAUDE_CODE_DISABLE_FAST_MODE = '1'
+ const fastModeError = claudeFastModeError(args.model, env, fastMode)
+ if (fastModeError) return Promise.resolve({ exitCode: 1, error: fastModeError })
+ const speed = ['--settings', JSON.stringify({ fastMode })]
// Continuous context across wakes: resume the agent's prior session so it
// remembers the running task (its place in a counting relay, what it already
// said) instead of re-deriving from a frozen inbox snapshot each time.
@@ -1800,8 +1821,8 @@ class ClaudeAdapter implements EngineAdapter {
const base = flags.length
? [...flags, ...resume, '-p']
: allowUnsandboxedByoa(env)
- ? ['-p', ...resume, ...model, '--output-format', 'stream-json', '--verbose', '--dangerously-skip-permissions']
- : ['-p', ...resume, ...model, '--output-format', 'stream-json', '--verbose', ...claudeSecureFlags(args.home, env)]
+ ? ['-p', ...resume, ...model, ...speed, '--output-format', 'stream-json', '--verbose', '--dangerously-skip-permissions']
+ : ['-p', ...resume, ...model, '--output-format', 'stream-json', '--verbose', ...claudeSecureFlags(args.home, env, fastMode)]
const argv = wantsStdinPrompt ? base : (flags.length ? [...base, args.prompt] : ['-p', args.prompt, ...base.slice(1)])
// Agent turns can be substantial engineering/design work. Preserve the
// operator's reasoning preferences; only triage/doctor force thinking off.
@@ -1815,6 +1836,8 @@ class ClaudeAdapter implements EngineAdapter {
if (unsafeEngineArgs('CUMORA_CLAUDE_ARGS').length) return null
const model = args.model ? ['--model', args.model] : []
const env = claudeTurnEnv(args.env, args.fastModel)
+ const fastMode = args.nativeFastMode ?? false
+ if (claudeFastModeError(args.model, env, fastMode)) return null
// --resume only on the FIRST spawn / after a restart, to continue a prior
// session; inside a live process the session continues on its own.
const resume = args.resumeSessionId ? ['--resume', args.resumeSessionId] : []
@@ -1831,11 +1854,11 @@ class ClaudeAdapter implements EngineAdapter {
const argv = allowUnsandboxedByoa(env)
? [
'-p', '--input-format', 'stream-json', '--output-format', 'stream-json', '--verbose',
- ...resume, ...sys, ...model, '--dangerously-skip-permissions',
+ ...resume, ...sys, ...model, '--settings', JSON.stringify({ fastMode }), '--dangerously-skip-permissions',
]
: [
'-p', '--input-format', 'stream-json', '--output-format', 'stream-json', '--verbose',
- ...resume, ...sys, ...model, ...claudeSecureFlags(args.home, env),
+ ...resume, ...sys, ...model, ...claudeSecureFlags(args.home, env, fastMode),
]
return new ClaudeSession(this.bin, argv, { ...args, env }, carriesStanding)
}
@@ -1873,6 +1896,10 @@ const CODEX_SECURE_CONFIG_ARGS = [
'-c', 'shell_environment_policy.ignore_default_excludes=false',
]
+function codexServiceTierArgs(enabled: boolean): string[] {
+ return ['-c', `service_tier="${enabled ? 'fast' : 'default'}"`, ...(enabled ? ['-c', 'features.fast_mode=true'] : [])]
+}
+
function codexThreadSecurityParams(): Record<string, unknown> {
return allowUnsandboxedByoa()
? { approvalPolicy: 'never', sandbox: 'danger-full-access' }
@@ -2049,6 +2076,7 @@ class CodexSession implements EngineSession {
}
if (opts.standingPrompt) params.developerInstructions = opts.standingPrompt
if (opts.model) params.model = opts.model
+ params.serviceTier = opts.nativeFastMode ? 'fast' : 'default'
this.baseThreadParams = params
this.threadWasResume = !!opts.resumeSessionId
this.threadReq = opts.resumeSessionId
@@ -2308,7 +2336,7 @@ class CodexAdapter implements EngineAdapter {
const env = codexRuntimeEnv(args.env)
const { command, shell, argsPrefix } = resolveCodexSpawn()
const exec = allowUnsandboxedByoa() ? ['exec'] : codexSecureExecArgs({ home: args.cwd, env }, true)
- return spawnCapture(command, [...argsPrefix, ...exec, '--ephemeral', ...flags, ...CODEX_RUNTIME_CONFIG_ARGS, '-'], {
+ return spawnCapture(command, [...argsPrefix, ...exec, '--ephemeral', ...flags, ...CODEX_RUNTIME_CONFIG_ARGS, ...codexServiceTierArgs(false), '-'], {
cwd: args.cwd, env, signal: args.signal, onLog: args.onLog, shell, stdinText: args.prompt,
})
}
@@ -2437,7 +2465,7 @@ class CodexAdapter implements EngineAdapter {
let usage: EngineUsage | undefined
let turnError: string | undefined
const started = Date.now()
- return spawnEngine(command, [...argsPrefix, ...base, ...model, ...CODEX_RUNTIME_CONFIG_ARGS, ...resume, '-'], args, {
+ return spawnEngine(command, [...argsPrefix, ...base, ...model, ...CODEX_RUNTIME_CONFIG_ARGS, ...codexServiceTierArgs(args.nativeFastMode ?? false), ...resume, '-'], args, {
shell, stdinText: args.prompt,
onStdoutLine(line) {
let event
@@ -2478,7 +2506,7 @@ class CodexAdapter implements EngineAdapter {
const secure = allowUnsandboxedByoa()
? []
: codexSecureConfigOverrides({ home: args.home, env: args.env })
- return new CodexSession(command, [...argsPrefix, ...secure, ...CODEX_RUNTIME_CONFIG_ARGS, 'app-server', '--listen', 'stdio://'], args.home, args.env, args)
+ return new CodexSession(command, [...argsPrefix, ...secure, ...CODEX_RUNTIME_CONFIG_ARGS, ...codexServiceTierArgs(args.nativeFastMode ?? false), 'app-server', '--listen', 'stdio://'], args.home, args.env, args)
}
}
diff --git a/server/src/agents/computer/model-catalog.ts b/server/src/agents/computer/model-catalog.ts
index 7297a30..0d8d52d 100644
--- a/server/src/agents/computer/model-catalog.ts
+++ b/server/src/agents/computer/model-catalog.ts
@@ -12,6 +12,7 @@ export interface EngineModelOption {
label: string
description?: string | null
recommendedFor?: Array<'big' | 'small'>
+ supportsFastMode?: boolean
}
/** Model choices advertised by the daemon that actually owns the CLI login.
@@ -169,6 +170,7 @@ function mergeModels(discovered: EngineModelOption[], fallback: EngineModelOptio
label: clean(model.label, 160) ?? id,
description: clean(model.description, 320),
recommendedFor: model.recommendedFor?.filter((tier): tier is 'big' | 'small' => tier === 'big' || tier === 'small'),
+ ...(typeof model.supportsFastMode === 'boolean' ? { supportsFastMode: model.supportsFastMode } : {}),
})
if (out.length >= 128) break
}
@@ -319,6 +321,7 @@ interface CodexListItem {
displayName?: unknown
description?: unknown
isDefault?: unknown
+ serviceTiers?: unknown
}
function discoverCodex(command: string, env: NodeJS.ProcessEnv): Promise<{ models: EngineModelOption[]; defaultModel: string | null } | null> {
@@ -378,6 +381,9 @@ function discoverCodex(command: string, env: NodeJS.ProcessEnv): Promise<{ model
label: clean(row.displayName, 160) ?? id,
description: clean(row.description, 320),
recommendedFor: row.isDefault === true ? ['big'] : undefined,
+ ...(Array.isArray(row.serviceTiers) ? {
+ supportsFastMode: row.serviceTiers.some((tier) => tier?.id === 'fast' || tier?.id === 'priority'),
+ } : {}),
}
}).filter((row): row is EngineModelOption => row !== null)
const defaultModel = rows.find((row) => row.isDefault === true)
diff --git a/server/src/agents/computer/registry.ts b/server/src/agents/computer/registry.ts
index cb535f4..745ae60 100644
--- a/server/src/agents/computer/registry.ts
+++ b/server/src/agents/computer/registry.ts
@@ -200,6 +200,7 @@ function sanitizeModelCatalog(raw: unknown): EngineModelCatalog | undefined {
label: displayString(model.label, 160) ?? id,
description: displayString(model.description, 320),
...(recommendedFor?.length ? { recommendedFor } : {}),
+ ...(typeof model.supportsFastMode === 'boolean' ? { supportsFastMode: model.supportsFastMode } : {}),
})
}
}
@@ -756,16 +757,17 @@ export async function mintAgentRuntimeToken(args: {
* provider can explicitly make its unnamed local default authoritative so a
* vendor-specific deploy pin never crosses into the wrong namespace. */
export async function listAgentsForComputer(computerId: string, supportsProviderProfiles = false): Promise<
- Array<{ id: string; name: string; role: string | null; systemPrompt: string | null; engine: EngineId | null; model: string | null; fastModel: string | null; providerProfile: string | null }>
+ Array<{ id: string; name: string; role: string | null; systemPrompt: string | null; engine: EngineId | null; model: string | null; fastModel: string | null; providerProfile: string | null; nativeFastMode: boolean }>
> {
const { rows } = await pool.query<{
id: string; name: string; role: string | null; systemPrompt: string | null
engine: EngineId | null; model: string | null; fastModel: string | null
providerProfile: string | null
+ nativeFastMode: boolean
availableEngines?: string[]; detectedEngines?: unknown; engineDefaults?: unknown
}>(
`SELECT p.id, p.name, p.role, p.system_prompt AS "systemPrompt", p.engine, p.model,
- p.fast_model AS "fastModel", p.provider_profile AS "providerProfile", c.available_engines AS "availableEngines",
+ p.fast_model AS "fastModel", p.provider_profile AS "providerProfile", p.native_fast_mode AS "nativeFastMode", c.available_engines AS "availableEngines",
COALESCE(c.detected_engines, '[]'::jsonb) AS "detectedEngines",
COALESCE(c.engine_defaults, '{}'::jsonb) AS "engineDefaults"
FROM participants p
@@ -1130,6 +1132,7 @@ export async function assignAgentToComputer(args: {
* host/engine assignment. undefined leaves the value untouched; null clears it. */
model?: string | null
fastModel?: string | null
+ nativeFastMode?: boolean
}): Promise<{ kind: ComputerKind; engine: EngineId; inherit: boolean } | null> {
const placement = await resolveComputerAssignment({ ...args, strictEngine: true })
if (!placement) return null
@@ -1144,6 +1147,10 @@ export async function assignAgentToComputer(args: {
params.push(args.fastModel)
sets.push(`fast_model = $${params.length}`)
}
+ if (args.nativeFastMode !== undefined) {
+ params.push(args.nativeFastMode)
+ sets.push(`native_fast_mode = $${params.length}`)
+ }
params.push(args.providerProfile ?? null)
sets.push(`provider_profile = $${params.length}`)
params.push(args.agentId, args.companyId)
diff --git a/server/src/agents/create.ts b/server/src/agents/create.ts
index 0c06f73..b5b493b 100644
--- a/server/src/agents/create.ts
+++ b/server/src/agents/create.ts
@@ -32,6 +32,7 @@ export interface CreateAgentRecordInput {
avatarBg?: string
model?: string | null
fastModel?: string | null
+ nativeFastMode?: boolean
providerProfile?: string | null
tools?: string[]
computerId?: string | null
@@ -94,6 +95,7 @@ function creationRequestHash(input: CreateAgentRecordInput): string {
avatarBg: input.avatarBg ?? '',
model: input.model ?? null,
fastModel: input.fastModel ?? null,
+ ...(input.nativeFastMode ? { nativeFastMode: true } : {}),
...(input.providerProfile ? { providerProfile: input.providerProfile } : {}),
tools: input.tools ?? ['bash'],
computerId: input.computerId ?? null,
@@ -205,10 +207,10 @@ export async function createAgentRecord(
`INSERT INTO participants
(id, kind, name, role, initial, avatar_bg, status, bio, tools,
system_prompt, model, fast_model, company_id, computer_id, engine,
- engine_inherit, creation_request_id, creation_request_hash, provider_profile)
+ engine_inherit, creation_request_id, creation_request_hash, provider_profile, native_fast_mode)
VALUES
($1, 'agent', $2, $3, $4, $5, 'avail', $6, $7::jsonb,
- $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
+ $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)
ON CONFLICT DO NOTHING
RETURNING id`,
[
@@ -216,7 +218,7 @@ export async function createAgentRecord(
JSON.stringify(tools), input.systemPrompt, input.model ?? null,
input.fastModel ?? null, input.companyId, computerId,
placement?.engine ?? null, placement?.inherit ?? true,
- requestId, requestHash, input.providerProfile ?? null,
+ requestId, requestHash, input.providerProfile ?? null, input.nativeFastMode ?? false,
],
)
if (rows[0]) {
diff --git a/server/src/api/router.ts b/server/src/api/router.ts
index fcf1311..89e2be5 100644
--- a/server/src/api/router.ts
+++ b/server/src/api/router.ts
@@ -1257,7 +1257,7 @@ api.post('/agents/:id/computer', safe(async (req, res) => {
const modelPins = readAgentBody(req.body ?? {})
const out = await assignAgentToComputer({
agentId: String(req.params.id), companyId, computerId, engine, inherit: inherit || !engine,
- model: modelPins.model, fastModel: modelPins.fastModel,
+ model: modelPins.model, fastModel: modelPins.fastModel, nativeFastMode: modelPins.nativeFastMode,
providerProfile: readProviderProfile(req.body?.providerProfile),
})
if (!out) throw new HttpError(400, 'invalid computer, agent, engine, or provider profile for this company')
@@ -2495,14 +2495,14 @@ api.get('/participants', async (req, res) => {
systemPrompt: string | null; model: string | null
email: string | null; companySlug: string | null
departedAt: string | null
- computerId: string | null; engine: string | null; fastModel: string | null; providerProfile: string | null
+ computerId: string | null; engine: string | null; fastModel: string | null; providerProfile: string | null; nativeFastMode: boolean
engineInherit: boolean | null
}>(
`SELECT p.id, p.kind, p.name, p.role, p.initial,
p.avatar_bg AS "avatarBg", p.avatar_url AS "avatarUrl",
p.status, p.status_updated_at AS "statusUpdatedAt",
p.bio, p.tools, p.system_prompt AS "systemPrompt", p.model,
- p.computer_id AS "computerId", p.engine, p.fast_model AS "fastModel", p.provider_profile AS "providerProfile",
+ p.computer_id AS "computerId", p.engine, p.fast_model AS "fastModel", p.provider_profile AS "providerProfile", p.native_fast_mode AS "nativeFastMode",
p.engine_inherit AS "engineInherit",
-- Email resolution differs by kind:
-- - agents carry their own minted address on participants.email
@@ -2938,7 +2938,7 @@ interface AgentBody {
id?: unknown; name?: unknown; role?: unknown
systemPrompt?: unknown; bio?: unknown
initial?: unknown; avatarBg?: unknown; avatarUrl?: unknown
- model?: unknown; fastModel?: unknown
+ model?: unknown; fastModel?: unknown; nativeFastMode?: unknown
tools?: unknown
}
function readAgentBody(b: AgentBody): {
@@ -2951,9 +2951,14 @@ function readAgentBody(b: AgentBody): {
model?: string | null
/** small-brain model override; same semantics as `model` */
fastModel?: string | null
+ nativeFastMode?: boolean
tools?: string[] | null
} {
const out: Record<string, unknown> = {}
+ if (b.nativeFastMode !== undefined) {
+ if (typeof b.nativeFastMode !== 'boolean') throw new HttpError(400, 'nativeFastMode must be a boolean')
+ out.nativeFastMode = b.nativeFastMode
+ }
if (typeof b.id === 'string') out.id = b.id.trim()
if (typeof b.name === 'string') out.name = b.name.trim()
if (typeof b.role === 'string') out.role = b.role.trim()
@@ -3013,6 +3018,7 @@ api.post('/agents', async (req, res) => {
avatarBg: data.avatarBg,
model: data.model,
fastModel: data.fastModel,
+ nativeFastMode: data.nativeFastMode,
providerProfile,
tools: data.tools ?? undefined,
computerId,
@@ -3128,6 +3134,7 @@ api.put('/agents/:id', async (req, res) => {
if (data.avatarUrl !== undefined) push('avatar_url', data.avatarUrl) // null clears it
if (data.model !== undefined) push('model', data.model) // null clears it (use default)
if (data.fastModel !== undefined) push('fast_model', data.fastModel) // small-brain model; null clears
+ if (data.nativeFastMode !== undefined) push('native_fast_mode', data.nativeFastMode)
if (data.tools !== undefined) push('tools', JSON.stringify(data.tools))
if (sets.length === 0) { res.status(400).json({ error: 'nothing to update' }); return }
params.push(id, tenant)
diff --git a/server/src/db/migrate.ts b/server/src/db/migrate.ts
index 16dd5f9..06a237c 100644
--- a/server/src/db/migrate.ts
+++ b/server/src/db/migrate.ts
@@ -52,6 +52,7 @@ import {
BOARD_CARD_DUE_ON_INDEX_SQL,
boardCardDueOnChecksum,
} from './migrations/0010-board-card-due-on.js'
+import { AGENT_NATIVE_FAST_MODE_SQL, agentNativeFastModeChecksum } from './migrations/0011-agent-native-fast-mode.js'
/** Frozen data backfill embedded in migration 0001. Exported so its behavior
* can be exercised against PostgreSQL without replaying the whole migration. */
@@ -2635,6 +2636,12 @@ const VERSIONED_MIGRATIONS: readonly VersionedMigration[] = [
await ensureConcurrentIndex(client, BOARD_CARD_DUE_ON_INDEX_NAME, BOARD_CARD_DUE_ON_INDEX_SQL)
},
},
+ {
+ ...SCHEMA_MIGRATIONS[10],
+ sourceChecksum: agentNativeFastModeChecksum(),
+ transactional: true,
+ up: async (client) => { await client.query(AGENT_NATIVE_FAST_MODE_SQL) },
+ },
]
/** How many times a transactional migration may lose a lock race before the
diff --git a/server/src/db/migrations/0011-agent-native-fast-mode.ts b/server/src/db/migrations/0011-agent-native-fast-mode.ts
new file mode 100644
index 0000000..c5b7c83
--- /dev/null
+++ b/server/src/db/migrations/0011-agent-native-fast-mode.ts
@@ -0,0 +1,9 @@
+import { createHash } from 'node:crypto'
+
+export const AGENT_NATIVE_FAST_MODE_SQL = `
+ALTER TABLE participants ADD COLUMN native_fast_mode BOOLEAN NOT NULL DEFAULT false;
+`
+
+export function agentNativeFastModeChecksum(): string {
+ return createHash('sha256').update(AGENT_NATIVE_FAST_MODE_SQL).digest('hex')
+}
diff --git a/server/src/db/migrations/manifest.ts b/server/src/db/migrations/manifest.ts
index 6f0b495..20afe61 100644
--- a/server/src/db/migrations/manifest.ts
+++ b/server/src/db/migrations/manifest.ts
@@ -67,12 +67,17 @@ export const SCHEMA_MIGRATIONS = [
name: '0010_board_card_due_on',
checksum: 'd07af706ca94ea26c789f7103d94bf8af00b174034f2fd9b817c8bde3e45560a',
},
+ {
+ version: 11,
+ name: '0011_agent_native_fast_mode',
+ checksum: '18ef047d7ee5ad254918f95f8b8320a2c0395401ee7354769763773ebd43ab41',
+ },
] as const satisfies readonly MigrationMetadata[]
/** This build intentionally supports one exact schema range. Expand/contract
* releases may widen the range, but both bounds must remain explicit. */
-export const MIN_SUPPORTED_SCHEMA_VERSION = 10
-export const MAX_SUPPORTED_SCHEMA_VERSION = 10
+export const MIN_SUPPORTED_SCHEMA_VERSION = 11
+export const MAX_SUPPORTED_SCHEMA_VERSION = 11
function assertManifestShape(): void {
for (let i = 0; i < SCHEMA_MIGRATIONS.length; i++) {
diff --git a/server/src/db/schema.ts b/server/src/db/schema.ts
index ba35fbb..260ddb7 100644
--- a/server/src/db/schema.ts
+++ b/server/src/db/schema.ts
@@ -62,6 +62,7 @@ export const participants = pgTable('participants', {
bio: text('bio'),
tools: jsonb('tools').$type<string[] | null>(),
systemPrompt: text('system_prompt'),
+ nativeFastMode: boolean('native_fast_mode').default(false).notNull(),
})
export const conversationCounters = pgTable(
diff --git a/shared/native-fast-mode.ts b/shared/native-fast-mode.ts
new file mode 100644
index 0000000..4e77b6f
--- /dev/null
+++ b/shared/native-fast-mode.ts
@@ -0,0 +1,7 @@
+/** Claude can switch unsupported models to Opus when Fast Mode is enabled. */
+export function supportsNativeFastMode(engine: string, model?: string | null): boolean {
+ if (engine === 'codex') return true
+ if (engine !== 'claude') return false
+ // shortcut: Claude's catalog does not advertise Fast Mode; update when supported Opus models change.
+ return /^(?:opus|claude-opus-(?:4-8|5(?:-5)?)(?:-\d{8})?)(?:\[1m\])?$/i.test(model?.trim() ?? '')
+}
diff --git a/src/api/client.ts b/src/api/client.ts
index 594f8ba..c45418b 100644
--- a/src/api/client.ts
+++ b/src/api/client.ts
@@ -227,6 +227,7 @@ export interface ApiParticipant {
engineInherit?: boolean | null
providerProfile?: string | null
fastModel?: string | null
+ nativeFastMode?: boolean
}
/** A Computer (agent host) as returned by GET /api/computers. */
@@ -311,6 +312,8 @@ export interface AgentInput {
model?: string | null
/** per-agent small-brain (fast) model override; null clears it */
fastModel?: string | null
+ /** Native provider speed setting, independent of either model choice. */
+ nativeFastMode?: boolean
tools?: string[]
}
@@ -1019,10 +1022,11 @@ export const api = {
model?: string | null,
fastModel?: string | null,
providerProfile?: string | null,
+ nativeFastMode?: boolean,
) =>
http<{ ok: boolean; kind: ComputerKind; engine: EngineId; inherit?: boolean }>(
`/agents/${encodeURIComponent(agentId)}/computer`,
- { method: 'POST', body: JSON.stringify({ computerId, engine, inherit, model, fastModel, providerProfile }) }),
+ { method: 'POST', body: JSON.stringify({ computerId, engine, inherit, model, fastModel, providerProfile, nativeFastMode }) }),
createAgent: (input: AgentCreateInput) =>
http<{
id: string
diff --git a/src/components/AgentEditor.tsx b/src/components/AgentEditor.tsx
index d797f91..3ff0898 100644
--- a/src/components/AgentEditor.tsx
+++ b/src/components/AgentEditor.tsx
@@ -9,6 +9,8 @@ import { Input } from '@/components/Input'
import { TextArea } from '@/components/TextArea'
import { Select } from '@/components/Select'
import { Combobox, type ComboboxOption } from '@/components/Combobox'
+import { Checkbox } from '@/components/Checkbox'
+import { supportsNativeFastMode } from '../../shared/native-fast-mode'
import type { Participant, EngineId } from '@/types'
import { useT } from '@/lib/i18n'
import { engineLabel } from '@/lib/engines'
@@ -60,6 +62,7 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {
const [providerProfile, setProviderProfile] = useState(agent?.providerProfile ?? '')
const [model, setModel] = useState(agent?.model ?? '')
const [fastModel, setFastModel] = useState(agent?.fastModel ?? '')
+ const [nativeFastMode, setNativeFastMode] = useState(agent?.nativeFastMode ?? false)
const [busy, setBusy] = useState(false)
const [err, setErr] = useState<string | null>(null)
const [avatarUrl, setAvatarUrl] = useState<string | null>(agent?.avatarUrl ?? null)
@@ -111,6 +114,10 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {
const engineDefaults = providerProfile ? undefined : selectedComputer?.engineDefaults?.[selectedEngineId]
const engineDefaultModel = engineDefaults?.model ?? undefined
const engineDefaultFastModel = engineDefaults?.fastModel ?? undefined
+ const effectiveModel = model.trim() || engineDefaultModel || modelCatalog?.defaultModel
+ const showNativeFastMode = isByoa && (selectedEngineId === 'codex' || selectedEngineId === 'claude')
+ const nativeFastModeSupported = supportsNativeFastMode(selectedEngineId, effectiveModel)
+ && modelCatalog?.models.find((option) => option.id === effectiveModel)?.supportsFastMode !== false
const modelOptions: Array<ComboboxOption<string>> = [
{
value: '',
@@ -180,11 +187,11 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {
else if (!isFreeTier && cloud) { setComputerId(cloud.id); setEngineChoice(INHERIT_ENGINE) }
}, [cloud, firstByoa, computerId, isFreeTier])
- // Model ids belong to the selected local engine/account. Do not carry a pin
- // across a host or engine switch where the new CLI may reject it.
+ // Model pins and paid speed preferences belong to the selected engine/account.
const clearModelPins = (): void => {
setModel('')
setFastModel('')
+ setNativeFastMode(false)
}
const changeComputer = (id: string): void => {
@@ -221,11 +228,12 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {
name, role, systemPrompt, bio, avatarBg,
model: model.trim() || null,
fastModel: fastModel.trim() || null,
+ nativeFastMode: showNativeFastMode && nativeFastModeSupported && nativeFastMode,
}
// A host/engine change persists these pins in the assignment's single
// SQL UPDATE. Do not clear them earlier if that assignment may fail.
const profilePayload = assignmentChanged
- ? { ...payload, model: undefined, fastModel: undefined }
+ ? { ...payload, model: undefined, fastModel: undefined, nativeFastMode: undefined }
: payload
let agentId = agent?.id
if (editing) {
@@ -261,6 +269,7 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {
model.trim() || null,
fastModel.trim() || null,
providerProfile || null,
+ payload.nativeFastMode,
)
if (isByoaTarget && pinned && out.engine !== pinned) {
throw new Error(t('agent.enginePinRejected', { engine: engineLabel(pinned) }))
@@ -420,6 +429,18 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {
)}
</Field>
+ {showNativeFastMode && (
+ <Checkbox
+ checked={nativeFastModeSupported && nativeFastMode}
+ onCheckedChange={setNativeFastMode}
+ disabled={!nativeFastModeSupported}
+ label={t('agent.nativeFastModeLabel')}
+ description={!nativeFastModeSupported
+ ? t(selectedEngineId === 'claude' ? 'agent.nativeFastModeClaudeUnsupported' : 'agent.nativeFastModeUnsupported')
+ : t(selectedEngineId === 'claude' ? 'agent.nativeFastModeClaudeHint' : 'agent.nativeFastModeCodexHint')}
+ />
+ )}
+
{isByoa && (!modelCatalog || modelCatalog.fastModelScope === 'agent') && (
<Field
label={t('agent.fastLabelByoa')}
diff --git a/src/locales/en.ts b/src/locales/en.ts
index 9b7c1bc..88df358 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -493,6 +493,11 @@ export const en = {
'agent.modelHintByoaSuffix': 'Blank = engine default.',
'agent.modelHintCloud': 'Optional — leave blank to use the system default. Any OpenAI model name works (e.g. gpt-5.5, gpt-5.5-pro, gpt-5.5-mini). Prefix with novita/ to run this agent on Novita instead (e.g. novita/deepseek/deepseek-v3.2).',
'agent.fastLabelByoa': 'Small-brain model (小脑)',
+ 'agent.nativeFastModeLabel': 'Fast mode',
+ 'agent.nativeFastModeCodexHint': 'Keep the selected model and reasoning effort with faster service. Uses more quota or costs more; availability depends on your model and account.',
+ 'agent.nativeFastModeClaudeHint': 'Keep the selected model and reasoning effort with faster service. Requires a supported Opus model and account access; subscription users pay from usage credits.',
+ 'agent.nativeFastModeClaudeUnsupported': 'Select a supported Opus model to enable Fast mode without changing models.',
+ 'agent.nativeFastModeUnsupported': 'The local engine does not advertise Fast mode for this model.',
'agent.fastHintByoaCodex': 'Cheaper model for light auxiliary tasks (e.g. gpt-5.4-mini). Blank = same as big-brain.',
'agent.fastHintByoaGrok': 'Cheaper/faster Grok model for light auxiliary tasks (e.g. grok-4.5). Blank = engine default.',
'agent.fastHintByoaCursor': 'Not used by Cursor; triage follows CUMORA_TRIAGE_MODEL on the computer. Blank = Auto.',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index b0b9e34..be13a38 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -495,6 +495,11 @@ export const zhCN: Partial<Record<keyof typeof en, string>> = {
'agent.modelHintByoaSuffix': '留空 = 使用引擎默认。',
'agent.modelHintCloud': '可选 — 留空使用系统默认。任意 OpenAI 模型名都可以(例如 gpt-5.5、gpt-5.5-pro、gpt-5.5-mini)。加 novita/ 前缀可改走 Novita(例如 novita/deepseek/deepseek-v3.2)。',
'agent.fastLabelByoa': '轻量模型(小脑)',
+ 'agent.nativeFastModeLabel': '快速模式(Fast Mode)',
+ 'agent.nativeFastModeCodexHint': '保持所选模型与推理强度,加快响应;会增加额度消耗或费用,能否使用取决于模型与账号。',
+ 'agent.nativeFastModeClaudeHint': '保持所选模型与推理强度,加快响应;需要支持的 Opus 模型和账号权限,订阅用户会使用额外付费额度。',
+ 'agent.nativeFastModeClaudeUnsupported': '请选择支持快速模式的 Opus 模型,避免开启后自动切换模型。',
+ 'agent.nativeFastModeUnsupported': '本地引擎未声明此模型支持快速模式。',
'agent.fastHintByoaCodex': '处理轻量辅助任务的便宜模型(例如 gpt-5.4-mini)。留空 = 与主力模型相同。',
'agent.fastHintByoaGrok': '处理轻量辅助任务的更快更便宜的 Grok 模型(例如 grok-4.5)。留空 = 引擎默认。',
'agent.fastHintByoaCursor': 'Cursor 用不到这一项;分流跟随该计算机上的 CUMORA_TRIAGE_MODEL。留空 = Auto。',
diff --git a/src/stores/participants.ts b/src/stores/participants.ts
index df89954..daf2663 100644
--- a/src/stores/participants.ts
+++ b/src/stores/participants.ts
@@ -70,6 +70,7 @@ function fromApi(p: ApiParticipant): Participant {
model: p.model ?? null,
providerProfile: p.providerProfile ?? null,
fastModel: p.fastModel ?? null,
+ nativeFastMode: p.nativeFastMode ?? false,
email: p.email ?? null,
departedAt: p.departedAt ?? null,
computerId: p.computerId ?? null,
diff --git a/src/types.ts b/src/types.ts
index 592be2d..ffe8d82 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -14,6 +14,7 @@ export interface EngineModelOption {
label: string
description?: string | null
recommendedFor?: Array<'big' | 'small'>
+ supportsFastMode?: boolean
}
export interface EngineModelCatalog {
@@ -102,6 +103,7 @@ export interface Participant {
/** small-brain (fast/auxiliary) model override */
providerProfile?: string | null
fastModel?: string | null
+ nativeFastMode?: boolean
/** id of the Computer this agent runs on (null/undefined = Cumora Cloud) */
computerId?: string | null
/** engine the agent's host runs it on ('managed' for cloud agents) */