Skip to content

feat: add additional effort levels#1663

Draft
sadpandajoe wants to merge 2 commits into
mainfrom
wire-ultracode-setting
Draft

feat: add additional effort levels#1663
sadpandajoe wants to merge 2 commits into
mainfrom
wire-ultracode-setting

Conversation

@sadpandajoe

Copy link
Copy Markdown
Contributor

Summary

  • minimal effort for Codex — adds 'minimal' as a new EffortLevel, which passes through to the Codex SDK natively (its lowest tier) and clamps to 'low' on both Claude delivery paths (SDK query-builder + CLI spawn-config). The EffortSelector UI gains a 'Minimal' option at the bottom with a note that Claude uses Low instead.

  • ultracode mode for claude-code / claude-code-cli — enables Claude Code's xhigh-effort + standing-workflow-orchestration mode via a per-session Settings file (~/.agor/session-flags/<session-id>.json), not inline Settings JSON. The inline-object path is deliberately avoided: the Claude CLI content-addresses inline JSON to /tmp/claude-settings-<hash>.json mode 0600; identical settings across concurrent sessions (or different Unix users under insulated/strict mode) resolve to the same hash and fail with EACCES. The file-path form (Options.settings = '<path-string>') is unique per session via UUID. A guard in agor_sessions_create rejects ultracode: true with a descriptive error when the agenticTool is not claude-code / claude-code-cli. The settings file is cleaned up after each prompt turn (try/finally in prompt-service.ts); the CLI path mirrors mcpConfigPath (best-effort, lifecycle hook deferred). Mid-session applyFlagSettings delivery is out of scope — ultracode applies from the first turn of a new session.

Q-decisions wired (from spec)

  • Q1: ultracode on model_config
  • Q2: Hard-reject with descriptive error if ultracode: true + non-claude-code tool ✓
  • Q3: Informational tooltip in UI, no auto-set effort ✓
  • Q4: Unique per-session settings file, cleanup mirrored to mcpConfigPath lifecycle ✓
  • Q5: Mid-session applyFlagSettings out of scope ✓

Files changed

File Why
packages/core/src/types/session.ts Add 'minimal' to EffortLevel; add ultracode? to Session.model_config and SpawnConfig.modelConfig
packages/core/src/types/user.ts Add ultracode? to DefaultModelConfig
packages/core/src/models/resolve-config.ts Thread ultracode through ModelConfigInputresolveModelConfig → fallback overrides
packages/core/src/db/schema.{sqlite,postgres}.ts Add ultracode? to inline model config shapes in default_agentic_config
packages/core/src/templates/spawn-subsession-template.ts Surface ultracode in Handlebars display and JSON
packages/core/src/claude-cli/spawn-config.ts Export toClaudeEffort() clamper; add ultracodeSettingsPath? to ClaudeCliSpawnConfig; emit --settings <path>
packages/executor/src/sdk-handlers/claude/model-utils.ts Export toClaudeEffort() clamper (SDK path)
packages/executor/src/sdk-handlers/claude/query-builder.ts Use toClaudeEffort() for effort; write ultracode settings file, set queryOptions.settings = path, return ultracodeSettingsPath
packages/executor/src/sdk-handlers/claude/prompt-service.ts Destructure ultracodeSettingsPath; unlink in finally block
packages/executor/src/sdk-handlers/codex/prompt-service.ts Update toCodexReasoningEffort return type to include 'minimal'
apps/agor-daemon/src/mcp/tools/sessions.ts Add ultracode to modelConfigObjectSchema; update effort enum; add Guard A; reuse explicitModelConfig
apps/agor-daemon/src/mcp/tools/schedules.ts Add ultracode and 'minimal' effort to agenticToolConfigSchema
apps/agor-daemon/src/services/claude-cli-integration.ts writeUltracodeSettingsFileIfNeeded(); use toClaudeEffort() for effort clamp in CLI path
apps/agor-ui/src/components/EffortSelector/EffortSelector.tsx Add 'Minimal' option (shortLabel 'Mn') at bottom with Codex-only note
apps/agor-ui/src/components/ModelSelector/ModelSelector.tsx Add ultracode? to ModelConfig; add handleUltracodeChange; add checkbox in claude-code section
apps/agor-ui/src/components/SessionPanel/SessionPanel.tsx Thread ultracode through modelConfig construction and handleModelConfigChange
PLAN.md Removed (rationale lives in this PR body)

Test plan

  • packages/coreresolveModelConfig ultracode + minimal round-trips; spawn-config --settings arg + toClaudeEffort clamp (5 new assertions)
  • packages/executorquery-builder: ultracode settings path is unique per session + under .agor/session-flags/; minimal clamped to 'low'; codex prompt-service existing tests still green
  • apps/agor-daemonsessions.test.ts: Guard A rejects ultracode+codex; ultracode threads to model_config; minimal effort threads to model_config; all 1293 existing daemon tests pass
  • Typecheck: @agor/core, @agor/executor, @agor/daemon, agor-ui all green
  • Lint: biome clean on all 22 changed files

DRAFT pending Joegor review of ultracode settings-file delivery approach and UI checkbox placement.

🤖 Generated with Claude Code

sadpandajoe and others added 2 commits June 26, 2026 22:10
Maps all advisorModel touch points (= the ultracode change list),
analyses the /tmp collision problem, and recommends a unique per-session
settings file as the delivery mechanism. Includes compatibility guards
and open questions for review before implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wires two new capabilities end-to-end through the Agor stack:

**`minimal` effort for Codex**
- Adds `'minimal'` to `EffortLevel` union (types/session.ts, types/user.ts)
- Passes `minimal` through to Codex SDK unchanged (its native ceiling is `xhigh`; this adds the floor)
- Clamps `minimal → 'low'` in both Claude delivery paths via a shared `toClaudeEffort()` helper:
  - `packages/core/src/claude-cli/spawn-config.ts` (CLI path)
  - `packages/executor/src/sdk-handlers/claude/model-utils.ts` (SDK path)
- MCP schemas updated in `sessions.ts` + `schedules.ts`; UI `EffortSelector` gains a 'Minimal' option at the bottom with a Codex-only note

**ultracode mode for claude-code / claude-code-cli**
- Adds `ultracode?: boolean` to `Session.model_config`, `SpawnConfig.modelConfig`, `DefaultModelConfig`, and the MCP tool schemas
- Delivery via unique per-session settings file (`~/.agor/session-flags/<session-id>.json`) to avoid the /tmp content-addressing collision that causes EACCES when identical inline Settings JSON is shared across concurrent sessions/users
- CLI path: `claude-cli-integration.ts` writes the file before spawn and passes its path via `ClaudeCliSpawnConfig.ultracodeSettingsPath` → `--settings <path>`
- SDK path: `query-builder.ts` writes the file, sets `queryOptions.settings = path`, and returns the path to the caller; `prompt-service.ts` cleans it up in a try/finally
- Guard in `agor_sessions_create`: rejects `ultracode: true` with a descriptive error when `agenticTool` is not claude-code/claude-code-cli
- `spawn-subsession-template.ts` surfaces ultracode in Handlebars context display

Tests: resolve-config round-trips (ultracode + minimal), spawn-config (--settings arg + toClaudeEffort clamp), query-builder (ultracode file path uniqueness + minimal→low), daemon sessions (guard rejection + ultracode thread-through + minimal thread-through)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant