Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
docs(cli_agent): describe the pool-only Claude path, UUID resume, and the CLI pin
trohitga913f04f7631
diff --git a/CLAUDE.md b/CLAUDE.mdindex e41331a8..4f27fcaa 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -64,8 +64,8 @@ This is a React Flow-based workflow automation platform implementing n8n-inspire| **[Status Broadcaster](./docs-internal/status_broadcaster.md)** | WebSocket-first communication: StatusBroadcaster singleton, live count via `len(MESSAGE_HANDLERS) + len(get_ws_handlers())`, broadcast message types, Android two-state model || **[RLM Service](./docs-internal/rlm_service.md)** | Recursive Language Model agent with REPL-based execution (llm_query, rlm_query, FINAL) || **[Claude Code Agent](./docs-internal/claude_code_agent.md)** | Hub for the Claude Code agent — routes to architecture, interactive mode, CLI framework, canonical-patterns RFC, and the 5 CLI snapshot references. |-| **[CLI Agent Framework](./docs-internal/cli_agent_framework.md)** | Multi-provider CLI runtime (Claude Code / Codex / Gemini): `AICliService.run_batch`, per-task worktree isolation, FastMCP bridge, **memory bridge** (`--continue` for first run + intra-process stream-json multi-turn + `--resume <UUID>` for crash recovery, all on a stable `cwd=repo_root`; `node_parameters_updated` broadcast on every successful turn). **Plugin-folder layout** (post-cutover): all claude-specific code lives in [`server/nodes/agent/claude_code_agent/`](./server/nodes/agent/claude_code_agent/) — `_provider.py`, `_pool.py`, `_skills.py`, `_oauth.py`, `_handlers.py` — and self-registers via three `factory.py` registries (`register_provider` / `register_session_pool` / `register_skill_materialiser`) plus `register_ws_handlers`. The generic framework at `services/cli_agent/` imports nothing from `nodes/`. |-| **[Claude Code Interactive Mode](./docs-internal/claude_code_interactive_mode.md)** | The interactive-mode cutover: OpenCompany no longer uses `claude -p` headless. `ClaudeSessionPool` (keyed by `simpleMemory.node_id`) spawns `claude` as a plain subprocess with stdio pipes — **no PTY** — and drives it over the VSCode-extension protocol: `--output-format stream-json --input-format stream-json --verbose --ide`. User prompts written as JSON to `proc.stdin` (`{"type":"user","message":{"role":"user","content":"..."}}\n`); `system/init` / `assistant` / `result` / `system/compact_boundary` events stream back on `proc.stdout` (parsed by a background `stdout_reader_task` — the on-disk JSONL is persistence-only, not the runtime contract, because `result` events are stdout-only in stream-json mode). Cross-platform via plain pipes (the earlier PTY pattern was broken on Windows because pywinpty/ConPTY's emulated stdin never reached claude's Ink TUI keystroke handler). Stays in interactive billing — entrypoint `claude-vscode`, NOT `sdk-cli`. Multi-turn within one warm subprocess preserves the session UUID (verified end-to-end); cross-batch continuity via `--continue` (first run) or `--resume <UUID>` (crash recovery). Four typed CloudEvents (`claude.session.{spawned,cleared,terminated,usage}`) fire from the pool. `/compact` events forward to `CompactionService`. The non-pooled `AICliSession` path (one-shot prompt-in-argv runs) still uses PTY (out of scope for this refactor; works on POSIX). |+| **[CLI Agent Framework](./docs-internal/cli_agent_framework.md)** | Multi-provider CLI runtime (Claude Code / Codex / Gemini): `AICliService.run_batch`, per-task worktree isolation, FastMCP bridge, **memory bridge** (host-minted `--session-id` on cold spawn + intra-process stream-json multi-turn + `--resume <last_session_id>` for memory-bound runs and crash recovery — never `--continue`, which the CLI resolves only against interactive sessions — all on a stable `cwd=repo_root`; `node_parameters_updated` broadcast on every successful turn). **Plugin-folder layout** (post-cutover): all claude-specific code lives in [`server/nodes/agent/claude_code_agent/`](./server/nodes/agent/claude_code_agent/) — `_provider.py`, `_pool.py`, `_skills.py`, `_oauth.py`, `_handlers.py` — and self-registers via three `factory.py` registries (`register_provider` / `register_session_pool` / `register_skill_materialiser`) plus `register_ws_handlers`. The generic framework at `services/cli_agent/` imports nothing from `nodes/`. |+| **[Claude Code Interactive Mode](./docs-internal/claude_code_interactive_mode.md)** | The interactive-mode cutover: OpenCompany no longer uses `claude -p` headless. `ClaudeSessionPool` (keyed by `simpleMemory.node_id`) spawns `claude` as a plain subprocess with stdio pipes — **no PTY** — and drives it over the VSCode-extension protocol: `--output-format stream-json --input-format stream-json --verbose --ide`. User prompts written as JSON to `proc.stdin` (`{"type":"user","message":{"role":"user","content":"..."}}\n`); `system/init` / `assistant` / `result` / `system/compact_boundary` events stream back on `proc.stdout` (parsed by a background `stdout_reader_task` — the on-disk JSONL is persistence-only, not the runtime contract, because `result` events are stdout-only in stream-json mode). Cross-platform via plain pipes (the earlier PTY pattern was broken on Windows because pywinpty/ConPTY's emulated stdin never reached claude's Ink TUI keystroke handler). Stays in interactive billing — entrypoint `claude-vscode`, NOT `sdk-cli`. Multi-turn within one warm subprocess preserves the session UUID (verified end-to-end); cross-batch continuity via `--continue` (first run) or `--resume <UUID>` (crash recovery). Four typed CloudEvents (`claude.session.{spawned,cleared,terminated,usage}`) fire from the pool. `/compact` events forward to `CompactionService`. Every Claude run routes through the pool (unbound runs get an ephemeral session per task, terminated after the batch); `AICliSession` (PTY + JSONL watcher) is no longer used for Claude because a PTY stdin makes the CLI reject stream-json input and that path never delivered the prompt (GitHub #133 / #134). A child exiting without a `result` wakes `send_turn` on stdout EOF with the exit code instead of burning the turn timeout. The CLI version is pinned via `package_version` in `config/ai_cli_providers.json`. || **[CLI Agent Canonical Patterns RFC](./docs-internal/cli_agent_canonical_patterns_rfc.md)** | Audit of OpenCompany's `services/cli_agent` against the official Claude Code spec — six invariants (skills-as-files, MCP-only transport, `list_changed`, deferral, visible-tool filtering, native-session-continuity-via-stable-cwd) with current implementation status. || **[Claude Code CLI Reference (snapshot)](./docs-internal/claude_code_cli_reference.md)** | Verbatim snapshot of [code.claude.com/docs/en/cli-reference](https://code.claude.com/docs/en/cli-reference) — every CLI subcommand + flag + system-prompt-flag matrix + the subset we emit from `nodes/agent/claude_code_agent/_provider.py`. Fetched 2026-05-11. || **[Claude Code Env Vars (snapshot)](./docs-internal/claude_code_env_vars_reference.md)** | Categorised [code.claude.com/docs/en/env-vars](https://code.claude.com/docs/en/env-vars) snapshot — auth, Bedrock/Vertex, model, bash, MCP, telemetry, session/debug, paths. Documents `CLAUDE_CONFIG_DIR`, `MAX_MCP_OUTPUT_TOKENS`, `ENABLE_TOOL_SEARCH` which we touch directly. |diff --git a/docs-internal/claude_code_agent.md b/docs-internal/claude_code_agent.mdindex 1c3d6af1..d52736ab 100644--- a/docs-internal/claude_code_agent.md+++ b/docs-internal/claude_code_agent.md@@ -6,7 +6,7 @@ stream-json protocol — not the `claude -p` headless path. A warm `ClaudeSessio(keyed by the RFC-0002 conversation key when a Context node is connected, or by thelegacy `simpleMemory.node_id` on immutable V1 graphs — `services/cli_agent/service.py:354-358`)preserves the session across turns;-memory continuity is claude-native via `--continue` / `--resume <UUID>` on a stable+memory continuity is claude-native via a host-minted `--session-id` on the first run and `--resume <last_session_id>` afterwards on a stable`cwd=repo_root`. Connected tools and skills reach claude through an MCP bridge; the spawnruns under `--permission-mode dontAsk` with a strict `--allowedTools` allowlist and staysin interactive billing (entrypoint `claude-vscode`, not `sdk-cli`).@@ -19,7 +19,7 @@ This page is a **router**. The detail lives in the documents below — start her|---|---|| How does the whole integration work end-to-end? (architecture, memory & context compaction, sub-agent creation, data structures) | [claude_code_agent_architecture.md](./claude_code_agent_architecture.md) || How does interactive mode work? (stdio pipes vs PTY, stream-json events, `system/init` / `assistant` / `result`, session continuity, the four `claude.session.*` CloudEvents) | [claude_code_interactive_mode.md](./claude_code_interactive_mode.md) |-| The generic multi-provider runtime (`AICliService.run_batch`, worktree isolation, FastMCP bridge, the memory bridge `--continue`/`--resume`, plugin-folder layout) | [cli_agent_framework.md](./cli_agent_framework.md) |+| The generic multi-provider runtime (`AICliService.run_batch`, FastMCP bridge, the memory bridge `--session-id`/`--resume`, plugin-folder layout) | [cli_agent_framework.md](./cli_agent_framework.md) || Does our implementation match the official Claude Code spec? (six invariants + status) | [cli_agent_canonical_patterns_rfc.md](./cli_agent_canonical_patterns_rfc.md) || Which CLI subcommands/flags exist, and which subset we emit | [claude_code_cli_reference.md](./claude_code_cli_reference.md) (snapshot) || Environment variables (`CLAUDE_CONFIG_DIR`, `MAX_MCP_OUTPUT_TOKENS`, `ENABLE_TOOL_SEARCH`, Bedrock/Vertex, telemetry) | [claude_code_env_vars_reference.md](./claude_code_env_vars_reference.md) (snapshot) |@@ -39,7 +39,7 @@ All claude-specific code is self-contained here; the generic framework at| File | Responsibility ||---|---|| `__init__.py` | `ClaudeCodeAgentNode(ActionNode)` (line 238 — it does not go through `SpecializedAgentBase` / the native loop) + `Params`/`Output`; self-registers via `factory.py` (`register_provider` / `register_session_pool` / `register_skill_materialiser`) + `register_ws_handlers`. |-| `_provider.py` | Builds the spawn argv (`--output-format stream-json --input-format stream-json --verbose --ide`, `--permission-mode dontAsk`, `--allowedTools`, `--continue`/`--resume`). |+| `_provider.py` | Builds the spawn argv (`--output-format stream-json --input-format stream-json --verbose --ide`, `--permission-mode dontAsk`, `--allowedTools`, `--resume`/`--session-id`). || `_pool.py` | `ClaudeSessionPool` — warm subprocess keyed by `simpleMemory.node_id`; stdout reader, session-UUID capture, crash-recovery respawn. || `_skills.py` | `materialise_skills` — writes connected SKILL.md trees under `<workspace>/.claude/skills/`, diff-based on warm reuse. || `_oauth.py` | Isolated `CLAUDE_CONFIG_DIR` (`<DATA_DIR>/claude/`), browser-OAuth bridge, binary install. |@@ -47,5 +47,5 @@ All claude-specific code is self-contained here; the generic framework at## See also-- Memory bridge specifics (how `simpleMemory` feeds `--continue`, why `last_session_id` is display-only): [cli_agent_framework.md → Memory bridge](./cli_agent_framework.md).+- Memory bridge specifics (how `simpleMemory.last_session_id` feeds `--resume`, why `--continue` is never used): [cli_agent_framework.md → Memory bridge](./cli_agent_framework.md).- Generic CLI agent runtime shared with Codex / Gemini providers: `server/services/cli_agent/`.diff --git a/docs-internal/claude_code_cli_reference.md b/docs-internal/claude_code_cli_reference.mdindex 2e64a318..ea27ac5a 100644--- a/docs-internal/claude_code_cli_reference.md+++ b/docs-internal/claude_code_cli_reference.md@@ -194,17 +194,21 @@ Quick cross-reference for the OpenCompany `claude_code_agent` integration:| `--mcp-config <json>` | when MCP wired | inline JSON with `{mcpServers: {opencompany: {type: http, url, headers, alwaysLoad: true}}}` || `--strict-mcp-config` | when MCP wired | blocks user-level `~/.claude.json` MCP entries || `--append-system-prompt <text>` | when `system_prompt` is set | append the task prompt to Claude Code's built-in system prompt |-| `--continue` | first spawn for a memory-bound run | let Claude select the latest conversation for the stable working directory |-| `--resume <UUID>` | pooled-process crash or reap recovery | resume the session UUID captured from Claude's stream events |+| `--session-id <UUID>` | cold spawn with no continuity flag | host-minted `uuid4` so the session UUID is known before the first event (must be a valid UUID; rejected if already in use) |+| `--resume <UUID>` | memory-bound runs (`last_session_id` from the memory node) and pooled-process crash or reap recovery | resume by UUID; works from any directory since 2.1.223 |+| `--continue` | never set by the node | the reference says it skips sessions created non-interactively (`-p` / stream-json), i.e. every session the pool creates; kept on `ClaudeTaskSpec` for explicit callers only || `--effort <level>` | optional per-task override | reasoning effort || `--add-dir <path>*` | optional per-task override | grant extra working dirs || `--disallowedTools <csv>` | optional per-task override | remove tools from context || `--agent <name>` | optional per-task override | use a specific subagent |-The interactive subprocess path intentionally does not emit `--print`,-`--include-partial-messages`, `--include-hook-events`, or `--session-id`.-It also retains `max_turns`, `max_budget_usd`, and `fallback_model` on the-task specification only for compatibility; their corresponding flags are-print-mode-only and are not emitted by this path.+The subprocess path intentionally does not emit `--print` (the official+Agent SDKs omit it too; the help text's "only works with --print" note+on the format flags predates that), `--include-partial-messages`, or+`--include-hook-events`. It retains `max_turns`, `max_budget_usd`, and+`fallback_model` on the task specification only for compatibility; their+corresponding flags are print-mode-only and are not emitted by this path.+The CLI version the argv is verified against is pinned in+`server/config/ai_cli_providers.json` (`package_version`).See [`server/nodes/agent/claude_code_agent/_provider.py`](../server/nodes/agent/claude_code_agent/_provider.py) for the argv-construction code.diff --git a/docs-internal/claude_code_interactive_mode.md b/docs-internal/claude_code_interactive_mode.mdindex 0539b566..848534d1 100644--- a/docs-internal/claude_code_interactive_mode.md+++ b/docs-internal/claude_code_interactive_mode.md@@ -8,8 +8,8 @@> --input-format stream-json --verbose --ide`. Multi-turn happens by> writing newline-delimited JSON to `proc.stdin` of the long-lived> subprocess. Events arrive on `proc.stdout`. The on-disk JSONL is no-> longer the runtime contract — claude writes it for `--continue` /-> `--resume` persistence but the `result` event is stdout-only in+> longer the runtime contract — claude writes it for `--resume`+> persistence but the `result` event is stdout-only in> stream-json mode.## Why we cut over from `-p`@@ -66,8 +66,8 @@ server/nodes/agent/claude_code_agent/server/services/cli_agent/ (generic framework — shared by all CLI plugins)├── factory.py # register_provider / register_session_pool / register_skill_materialiser registries-├── service.py # AICliService.run_batch — dispatcher; routes to pool when memory-bound (registry lookup)-├── session.py # AICliSession — one-shot non-pooled path (still PTY on POSIX; out of scope)+├── service.py # AICliService.run_batch — dispatcher; every claude task goes to the pool (registry lookup)+├── session.py # AICliSession — generic PTY + JSONL path; NOT used for claude (GitHub #133 / #134)├── mcp_server.py # BatchContext + FastMCP bridge (shared by every CLI provider)├── workflow_tools.py / lockfile.py / jsonl_watcher.py / config.py / protocol.py / types.py / _cli_auth.py└── _handlers.py # codex WS handlers only (will move once codex_agent migrates)@@ -86,7 +86,7 @@ claude--ide[--mcp-config <json> --strict-mcp-config]--model <name>- [--resume <UUID> | --continue]+ [--resume <UUID> | --continue | --session-id <UUID>]--allowedTools <csv>--permission-mode dontAsk[--append-system-prompt <text>]@@ -102,9 +102,16 @@ Notable absences (intentional):|---|---|| `-p` / `--print` | Drops us into the SDK billing bucket; the whole point of the cutover. || Positional prompt (`-- "<text>"`) | Prompt arrives via stdin in stream-json input mode; an argv positional would double-send the first turn. `interactive_argv`'s `include_prompt` parameter is kept for back-compat but ignored. |-| `--session-id <UUID>` | Rejected by claude in non-headless mode. We discover the UUID from the first event that carries `session_id`. |+| `--continue` | The CLI reference says it skips sessions created non-interactively (`-p` / stream-json input), which is exactly what the pool spawns, so it never found the prior conversation. Memory-bound runs pass `--resume <last_session_id>` instead (the UUID persisted on the memory node by `_persist_memory`). || `--include-partial-messages`, `--include-hook-events`, `--max-turns`, `--max-budget-usd`, `--fallback-model` | All `-p`-only. `ClaudeTaskSpec` keeps the fields for back-compat; they're silently dropped here. External cost / turn caps are a Phase 2 follow-up. |+Emitted for session identity:++| Flag | When |+|---|---|+| `--session-id <UUID>` | Cold spawn with no continuity flag. `ClaudeSessionPool._spawn` mints a `uuid4` so `current_session_uuid` is known before the first stream event; crash-recovery respawns then always have a UUID to `--resume`. The CLI requires a valid UUID and rejects one already in use. |+| `--resume <UUID>` | Crash-recovery respawn of a pooled session, and every memory-bound run that has a persisted `last_session_id`. Works from any directory on the pinned CLI (2.1.223+). |+`--permission-mode dontAsk` is the documented mode for *"onlypre-approved tools, no prompts"* per[`code.claude.com/docs/en/permission-modes`](https://code.claude.com/docs/en/permission-modes).@@ -180,21 +187,24 @@ The pool's continuity model is two-layered:- **Intra-process (warm pool).** Within a live subprocess, every turnwrites to the same `proc.stdin` and claude itself keeps the conversation- in memory. No `--continue` / `--resume` needed — same session UUID- flows across turns. Verified: turn 1 `13ac5819-...`, turn 2 same UUID.-- **Cross-process (cold spawn / crash recovery).** Cold spawns of a- memory-bound run emit `--continue` (claude auto-finds the latest- conversation under the cwd via `project_key`). If `acquire` finds the- pooled subprocess has died, it captures the dead session's UUID- before respawning and splices `--resume <UUID>` into the spec so the- new subprocess continues writing to the same on-disk JSONL.--`ClaudeTaskSpec` carries `continue_session: bool` and-`resume_session_id: Optional[str]`. `resume_session_id` wins if both-are set. `simpleMemory.last_session_id` is display-only metadata —-`_persist_memory` writes it for the UI but the agent doesn't read it-back (continuity rides through `--continue` + the warm pool, not a-ferried UUID).+ in memory. No `--resume` needed — same session UUID flows across turns.+ Verified: turn 1 `13ac5819-...`, turn 2 same UUID.+- **Cross-process (cold spawn / crash recovery).** A cold spawn with no+ continuity flag mints a `uuid4` and emits `--session-id <UUID>`, so+ the UUID is known before the first event. Memory-bound runs emit+ `--resume <last_session_id>` (the UUID `_persist_memory` stored on the+ memory node after the previous successful run). If `acquire` finds the+ pooled subprocess has died, it splices `--resume <current_session_uuid>`+ into the spec so the new subprocess continues the same on-disk JSONL.++`ClaudeTaskSpec` carries `session_id`, `resume_session_id` and+`continue_session`; precedence in argv is resume, then continue, then+session-id. `--continue` is never set by the node: the CLI reference says+it skips sessions created non-interactively (`-p` / stream-json input),+which is every session the pool creates, so it silently started a fresh+conversation each batch. A stale `last_session_id` (claude reports+`No conversation found with session ID`) is cleared by `_persist_memory`+so the next run spawns fresh.## MCP bearer token lifecycle@@ -341,10 +351,10 @@ are copied wholesale via `shutil.copytree` so `scripts/` andthe UI) reconstruct the frontmatter (`name`, `description`,`allowed-tools`, `metadata`) + the markdown body. Failure modesare non-fatal: a skill that fails to load or write logs at WARN-and is skipped — the spawn continues. Same helper is called from-`AICliSession._pre_spawn` (non-pool path) and-`ClaudeSessionPool._spawn` (pool path), so behaviour is uniform-across the two transports.+and is skipped — the spawn continues. The helper is called from+`ClaudeSessionPool._spawn` (cold spawn) and `_prepare_warm_reuse`+(diff on warm reuse); `AICliSession._pre_spawn` still calls it for the+generic path other providers use.**Migration note.** Pre-cutover code wrote SKILL.md trees into`<repo_root>/.claude/skills/` so they accumulated in the user's@@ -370,12 +380,11 @@ splices the per-workflow workspace(`~/.opencompany/workspaces/<workflow_slug>/`, injected into `ctx.raw` by`workflow.py:_get_workspace_dir`) into each task's `add_dir` listright after `task_list` is built — `interactive_argv` already emits-`--add-dir <path>` per entry. Runs BEFORE the pool/non-pool branch-split so both warm-subprocess and one-shot paths get it. Without-this, the workspace is invisible to claude: memory-bound runs spawn-with `cwd=repo_root` (stable for `--continue`'s `project_key`-resolution) and non-memory runs with `cwd=worktree`, neither of which-sees files dropped by upstream nodes (`fileDownloader`,+`--add-dir <path>` per entry. Runs BEFORE the pool branch so every+pooled session gets it. Without this, the workspace is invisible to+claude: sessions spawn with `cwd=repo_root` (stable for `--resume`'s+`project_key` resolution), which does not see files dropped by+upstream nodes (`fileDownloader`,`documentParser`, code executors, etc.). Mirrors the ai_agentpattern ([`services/ai.py:1186`](../server/services/ai.py) in`execute_agent`, `:1924` in `execute_chat_agent` —@@ -409,6 +418,14 @@ on-disk session JSONL via `JsonlWatcher` / `JsonlDirWatcher`. That pathwas abandoned for the pool: `pywinpty`'s ConPTY emulation did notdeliver keystrokes to claude's Ink TUI on Windows (empiricallyconfirmed across four test variants). Stdio pipes + stream-json work-cross-platform and match the Anthropic-blessed pattern. The non-pooled-`AICliSession` still uses a PTY on POSIX for its one-shot-`AICliService.run_batch` path — out of scope for this refactor.+cross-platform and match the pattern the official Agent SDKs use. The+non-pooled `AICliSession` was kept as the plain-run path for a while,+but it never wrote the prompt to the child and a PTY stdin makes the+CLI reject `--input-format stream-json` (GitHub #133 / #134), so+`AICliService.run_batch` now routes every Claude task through the pool:+bound runs get a warm keyed session, unbound runs get an ephemeral+session per task (`<node_id>:<turn_execution_id>:<index>`) terminated+after the batch. A child that exits without a `result` wakes+`send_turn` on stdout EOF with its exit code instead of burning the+turn timeout. The CLI version is pinned via `package_version` in+`config/ai_cli_providers.json` (currently 2.1.258).diff --git a/docs-internal/cli_agent_canonical_patterns_rfc.md b/docs-internal/cli_agent_canonical_patterns_rfc.mdindex aa4051dd..3a1154ca 100644--- a/docs-internal/cli_agent_canonical_patterns_rfc.md+++ b/docs-internal/cli_agent_canonical_patterns_rfc.md@@ -288,8 +288,9 @@ stream-json`, `--verbose`, `--ide`, `--model`, `--permission-mode`,`--allowedTools <csv>`.**Conditional:** `--mcp-config <json>` + `--strict-mcp-config` (when-`mcp_endpoint_url` and `mcp_bearer_token` set), `--continue`/`--resume`-(memory-bound runs, mutually exclusive), `--append-system-prompt`,+`mcp_endpoint_url` and `mcp_bearer_token` set), `--resume` /+`--session-id` (memory-bound runs / cold spawn, mutually exclusive with+each other and with `--continue`), `--append-system-prompt`,`--effort`, `--add-dir`, `--disallowedTools`, `--agent`.**Never emitted** (`_provider.py:316-320`): `--max-turns`,@@ -416,11 +417,13 @@ Either works.### 4.8 Memory bridge — `simpleMemory` → `claude_code_agent` (DONE in `ecbe69b`)**Status:** native claude session continuity works end-to-end. The-mechanism was later simplified from the UUID5 / `--session-id`-round-trip described in this section to `--continue` (first cold spawn-for a memory-wired run) + intra-process stream-json multi-turn against a-warm subprocess + `--resume <UUID>` for crash recovery — all on a stable-`cwd=repo_root`. The entry point is+mechanism is a host-minted `--session-id <uuid4>` on the first cold+spawn + intra-process stream-json multi-turn against a warm subprocess ++`--resume <last_session_id>` on later cold spawns and crash recovery —+all on a stable `cwd=repo_root`. (An interim `--continue` variant was+reverted: the CLI resolves `--continue` only against interactive+sessions, so it never found the pool's non-interactive ones.) The entry+point is[`claude_code_agent/__init__.py::execute_op`](../server/nodes/agent/claude_code_agent/__init__.py)(sets `continue_session = bool(memory_data)`) and the warm-subprocesspool at [`claude_code_agent/_pool.py`](../server/nodes/agent/claude_code_agent/_pool.py).@@ -549,20 +552,20 @@ runs (Closes I-6).** Three coupled mechanisms:skips `git worktree add`; `cleanup` skips `git worktree remove`.Confirms claude's `project_key` is constant across runs.-2. **`--continue` first-run / warm-subprocess multi-turn / `--resume`- crash recovery.**+2. **`--session-id` first-run / warm-subprocess multi-turn / `--resume`+ later runs and crash recovery.**[`claude_code_agent/__init__.py`](../server/nodes/agent/claude_code_agent/__init__.py)- sets `continue_session = bool(memory_data)`; the argv-builder+ sets `resume_session_id` from the memory node's persisted+ `last_session_id`; the argv-builder[`_provider.py::interactive_argv`](../server/nodes/agent/claude_code_agent/_provider.py)- emits `--continue` on the first cold spawn for a memory-wired run- (claude auto-loads the most recent conversation under the stable- cwd's `project_key`). Subsequent turns are written as stream-json to- the same warm subprocess held by+ emits `--resume <UUID>` when present, otherwise the pool mints a+ `uuid4` and emits `--session-id <UUID>` on the cold spawn. Subsequent+ turns are written as stream-json to the same warm subprocess held by[`_pool.py`](../server/nodes/agent/claude_code_agent/_pool.py), whichpreserves the session UUID in-process. If the subprocess dies betweenbatches, the pool respawns with `--resume <current_session_uuid>`.- `--continue` and `--resume` are mutually exclusive in argv emission.- (This supersedes the earlier UUID5 / `--session-id` first-run dance.)+ `--resume`, `--continue` and `--session-id` are mutually exclusive in+ argv emission, in that precedence order.3. **Auto-clear stale `last_session_id`.**[`_persist_memory`](../server/services/cli_agent/service.py)@@ -587,8 +590,8 @@ runs (Closes I-6).** Three coupled mechanisms:origin; locked by `tests/test_cloudevents_node_parameters.py`.5. **Parallel-batch guard.** `len(tasks) > 1` with memory wired raises- `NodeUserError` at handler entry — concurrent `--continue` spawns- against one project_key would race claude's session resolution.+ `NodeUserError` at handler entry — concurrent `--resume` spawns+ against one session would race claude's transcript writes.Markdown is the UI mirror. The `simpleMemory.memory_content` fieldkeeps mirroring conversation turns viadiff --git a/docs-internal/cli_agent_framework.md b/docs-internal/cli_agent_framework.mdindex e818fbb3..cac7bd09 100644--- a/docs-internal/cli_agent_framework.md+++ b/docs-internal/cli_agent_framework.md@@ -124,15 +124,23 @@ back-compat; they're silently dropped in `interactive_argv`.All flags documented at[code.claude.com/docs/en/cli-reference](https://code.claude.com/docs/en/cli-reference).-Worktree, lockfile, and bearer-token MCP server are wired in-`nodes/agent/claude_code_agent/_pool.py:_spawn` (pool path) and-`services/cli_agent/session.py:_pre_spawn` (non-pool path); the `--ide`-flag tells the CLI to discover that lockfile via `CLAUDE_IDE_LOCK`.--The non-pooled `AICliSession` path (one-shot prompt-in-argv runs that-don't need session reuse) still uses PTY (`ptyprocess` POSIX /-`pywinpty>=3.0.3` Windows) and remains out of scope for the-subprocess+stream-json refactor.+Skill materialisation and the bearer-token MCP server are wired in+`nodes/agent/claude_code_agent/_pool.py:_spawn`. **Every Claude run+routes through the pool** (`AICliService.run_batch`): memory- or+Context-bound runs get one warm session keyed by the conversation;+unbound runs get one ephemeral session per task keyed by+`<node_id>:<turn_execution_id>:<index>` and terminated once the batch+settles. `AICliSession` (PTY + on-disk JSONL watcher) is no longer used+for Claude — a PTY stdin makes the CLI reject stream-json input, and+that path never wrote the prompt (GitHub issues #133 / #134).++Session identity follows the CLI reference: a cold spawn mints+`--session-id <uuid4>` so the UUID is known before the first event;+memory-bound runs pass `--resume <last_session_id>` (persisted on the+memory node by `_persist_memory`). `--continue` is not used because the+CLI skips non-interactively created sessions when resolving it. A child+that exits without a `result` event wakes `send_turn` on stdout EOF and+reports the exit code instead of burning the turn timeout.Factory — a registry lookup, not a hardcoded branch per provider. Each plugincalls `register_provider(name, factory)` on import (claude from@@ -228,7 +236,7 @@ Steps:1. Run `claude auth status`. If it exits 0, write the marker + broadcast and return immediately (idempotent re-click).2. Otherwise schedule `_finalize_claude_login()` (in `nodes/agent/claude_code_agent/_handlers.py`), which calls `run_claude_login()` from `_oauth.py`:- - OpenCompany-managed install of `@anthropic-ai/claude-code` into the shared npm tree at `<DATA_DIR>/packages/` via `npm install --prefix <packages_dir>` (same tree as `edgymeow` / `agent-browser`; skipped if already installed). Binary resolves to `<DATA_DIR>/packages/node_modules/.bin/claude[.cmd]`.+ - OpenCompany-managed install of `@anthropic-ai/claude-code` into the shared npm tree at `<DATA_DIR>/packages/` via `npm install <package_name>@<package_version> --prefix <packages_dir>` (same tree as `edgymeow` / `agent-browser`; skipped if already installed). The exact version is pinned in `server/config/ai_cli_providers.json` (`package_version`, the vercel / cloudflare idiom) because the stream-json contract and flag surface are verified against that version only. Binary resolves to `<DATA_DIR>/packages/node_modules/.bin/claude[.cmd]`.- `claude auth login` via `run_cli_command(..., env={..., CLAUDE_CONFIG_DIR=<DATA_DIR>/claude/}, stdin=asyncio.subprocess.PIPE)` — same way the VSCode Claude Code extension delegates to the binary. Anthropic doesn't expose `--print-url` or a programmatic OAuth helper (issue [anthropics/claude-code#7100](https://github.com/anthropics/claude-code/issues/7100), closed "not planned"), so we let the CLI open the user's browser via its own OS-level call. `stdin=PIPE` is **load-bearing** for claude-code >= 2.1.162's native binary: it reads stdin while waiting for the browser callback, and an inherited (closed) stdin EOFs it into an early exit that kills the localhost callback server before the redirect arrives — `stdin=PIPE` (never written) makes the read block so the server stays up.3. Schedule a background task that polls `claude auth status` every 2s up to 600s. On exit-0, write the synthetic `"cli-managed"` marker via `auth_service.store_oauth_tokens("claude_code", ...)` and broadcast `credential_catalogue_updated`. The catalogue's `stored` flag flips and the existing `OAuthConnect.tsx` primitive renders the modal as Connected.@@ -291,13 +299,13 @@ Shared by every CLI provider plugin. Imports nothing from `nodes/`.| `mcp_server.py` | FastMCP sub-app mounted at `/mcp/ide` (JSON-RPC endpoint `/mcp/ide/mcp`) with bearer-token middleware + 7 infrastructure tools (`getWorkspaceFiles`, `listSkills`, `getSkill`, `readSkillResource`, `searchSkillResource`, `getCredential`, `broadcastLog`) + `rebind_batch` for warm-reuse context updates. || `context_bridge.py` | `SpecializedAgentContextBridge` — RFC-0002 Context continuity for specialized providers (`resolve` / `augment_prompt` / `record_turn`); shared with RLM and Vertex. || `workflow_tools.py` | Per-batch MCP tool exposure (`mcp__opencompany__<node_type>`) + handler scope check + `tools/list_changed` notify. |-| `session.py` | `AICliSession(BaseProcessSupervisor)` — generic non-pool path (still PTY on POSIX). |-| `service.py` | `AICliService.run_batch()` — dispatcher; routes to pool when memory-bound via `factory.get_session_pool(provider_name)`. |+| `session.py` | `AICliSession(BaseProcessSupervisor)` — generic PTY + JSONL path for non-claude providers; not used for claude. |+| `service.py` | `AICliService.run_batch()` — dispatcher; every claude task goes to the pool via `factory.get_session_pool(provider_name)` (warm keyed session when bound, ephemeral per-task session otherwise). || `_cli_auth.py` | CLI-agnostic `mark_logged_in` / `mark_logged_out` / `broadcast_credential_event` + `"cli-managed"` marker token. Shared by claude + codex handlers. || `_handlers.py` | Codex WS handlers (`codex_cli_login` / `codex_cli_logout`). Claude's moved to the plugin folder. || `providers/openai_codex.py` | Codex provider — sandbox-first, no session continuity. Will move when codex_agent adopts the per-folder layout. || `providers/google_gemini.py` | v2 stub. |-| `jsonl_watcher.py` | Still used by the non-pooled `AICliSession` (out-of-scope path). |+| `jsonl_watcher.py` | Used only by `AICliSession`; no claude caller. |### Claude plugin — `server/nodes/agent/claude_code_agent/`@@ -398,7 +406,8 @@ finds its own JSONL.| Run state | Argv emitted | Why ||---|---|---|-| First cold spawn under a memory-wired node | `--continue` | Claude auto-loads the most recent conversation under cwd's `project_key` (per [code.claude.com/docs/en/cli-reference](https://code.claude.com/docs/en/cli-reference)). No UUID round-trip needed — claude tracks its own latest session per cwd on disk. |+| First cold spawn, no stored session | `--session-id <uuid4>` | `ClaudeSessionPool._spawn` mints the UUID so it is known before the first event; `_persist_memory` stores it on the memory node as `last_session_id`. |+| Cold spawn under a memory-wired node with a stored session | `--resume <last_session_id>` | Resume by UUID, never `--continue`: per [code.claude.com/docs/en/cli-reference](https://code.claude.com/docs/en/cli-reference) `--continue` skips sessions created non-interactively (`-p` / stream-json), which is every session the pool creates. || Subsequent turn, SAME warm subprocess | nothing argv-level — stream-json line on `proc.stdin` | The pool keeps the subprocess alive between turns. Claude maintains the conversation in-process; same `session_id` across turns (verified end-to-end). || Crash recovery (subprocess died between batches) | `--resume <captured_uuid>` | `ClaudeSessionPool.acquire` detects `process.returncode is not None`, captures the dead session's `current_session_uuid`, and respawns with `--resume`. Same `cwd=repo_root` → same `project_key` → claude finds the same JSONL it was writing before the crash. Mutually exclusive with `--continue`. |@@ -438,7 +447,7 @@ ClaudeCodeAgentNode.execute_op (__init__.py:291-330)│ connected_memory["node_id"]│ ├─ cold: spawn `claude --output-format stream-json│ │ --input-format stream-json --verbose --ide- │ │ --continue ...` as subprocess with stdio pipes;+ │ │ --session-id <uuid> | --resume <uuid> ...` as subprocess with stdio pipes;│ │ no PTY. stdout_reader_task parses each event line│ │ and dispatches to _handle_stream_event.│ └─ warm reuse: return the existing PooledClaudeSession;@@ -481,9 +490,9 @@ ClaudeCodeAgentNode.execute_op (__init__.py:291-330)### Parallel-batch guard-Memory continuity requires serial execution — N concurrent `--continue`-spawns against the same `project_key` would race claude's-session-resolution. When `memory_data` is wired AND `len(tasks) > 1`,+Memory continuity requires serial execution — N concurrent `--resume`+spawns against the same session would race claude's transcript+writes. When `memory_data` is wired AND `len(tasks) > 1`,`claude_code_agent` raises `NodeUserError("Memory-bound batches mustrun one task at a time. ...")` at handler entry.@@ -491,7 +500,8 @@ run one task at a time. ...")` at handler entry.`memory_content` (the markdown surface the simpleMemory UI shows) isa **display mirror**, not the resume channel. Claude's own JSONL on-disk is what `--continue` and `--resume` load from. `_persist_memory`+disk is what `--resume` loads from; `last_session_id` on the memory+node is the resume handle. `_persist_memory`appends each successful run's prompt + response to `memory_content`via `append_to_memory_markdown` so the UI shows the conversation growlive. User edits to `memory_content` do NOT influence claude's next@@ -501,19 +511,19 @@ To reset both: click the simpleMemory's clear button or invoke the`clear_memory` WS handler — backend wipes `memory_content` to thedefault placeholder AND clears `last_session_id` in one DB write.Claude's on-disk JSONL is left alone (orphan, harmless). The next run-spawns fresh with `--continue` against a project_key that has no-matching prior session, and claude assigns a brand-new UUID.+has no `last_session_id`, so the pool mints a new `--session-id` and+claude starts a brand-new session.### Logs to watch```-[Claude Code memory] memory_node=<id> -> --continue- (claude auto-finds latest session under cwd)+[Claude Code memory] memory_node=<id> -> --resume <UUID>+ (or "fresh session (no last_session_id yet)" on the first run)[CC-Agent run_batch] enter ... memory=<memory_node_id> ...[ClaudeSessionPool] spawned new session memory_node=<id> pid=<N>- (cold spawn — argv carries --continue or --resume <UUID>)+ (cold spawn — argv carries --session-id <UUID> or --resume <UUID>)[ClaudeSessionPool] warm reuse memory_node=<id> pid=<N> uuid=<UUID>(intra-process turn — stream-json on stdin)diff --git a/docs-internal/errors.md b/docs-internal/errors.mdindex 0468ec31..04b1e953 100644--- a/docs-internal/errors.md+++ b/docs-internal/errors.md@@ -407,7 +407,7 @@ python -c "import ntpath; print(ntpath.join(r'D:\ws\AI_Employee_1', '2:processMa----## 14. `npm install -g` Fails With `externally-managed-environment` (Ubuntu 24.04+)+## 15. `npm install -g` Fails With `externally-managed-environment` (Ubuntu 24.04+)**Symptom**: `npm install -g @zeenie-ai/opencompany` aborts inside the postinstall with:```diff --git a/docs-internal/node-logic-flows/specialized_agents/claude_code_agent.md b/docs-internal/node-logic-flows/specialized_agents/claude_code_agent.mdindex b3bab56b..b9514659 100644--- a/docs-internal/node-logic-flows/specialized_agents/claude_code_agent.md+++ b/docs-internal/node-logic-flows/specialized_agents/claude_code_agent.md@@ -16,8 +16,10 @@ as a plain subprocess driven over the VSCode-extension stream-json protocol(`--output-format stream-json --input-format stream-json --verbose --ide`) —NOT the old headless `claude -p`. The common case is a single visible`prompt` that synthesises a one-task batch. Memory continuity is handled by-claude's own on-disk session JSONL via `--continue` / `--resume` over a-stable `cwd`, not by re-injecting markdown. This is the only+claude's own on-disk session JSONL via a host-minted `--session-id` on the+first run and `--resume <last_session_id>` afterwards (never `--continue`,+which the CLI resolves only against interactive sessions) over a stable+`cwd`, not by re-injecting markdown. This is the onlyspecialized-agent node that shells out; the others stay in-process.## Inputs (handles)@@ -28,7 +30,7 @@ Standard `std_agent_handles()` topology (same as the generic agents).|--------|---------|| `input-main` | Auto-prompt fallback (reads `source.message / text / content / str`) || `input-skill` | Connected skill names collected; SKILL.md trees materialised under `<workspace>/.claude/skills/` and exposed to the CLI (not injected into a system prompt) |-| `input-memory` | When wired, sets `continue_session=True` so claude emits `--continue` and resumes its on-disk session under the stable cwd |+| `input-memory` | When wired, sets `resume_session_id` from the memory node's persisted `last_session_id` so claude emits `--resume <UUID>` and continues its on-disk session; the first run has no UUID yet and the pool mints one via `--session-id` || `input-tools` | Connected tool nodes exposed to the CLI as `mcp__opencompany__<type>` MCP tools || `input-task` | Collected by the edge-walker; `task_data` is unpacked but the 5th element is ignored (`_`) here |@@ -117,11 +119,13 @@ flowchart TD`effort` + `fallback_model` + `continue_session`.- **Batch defaulting**: when `params.tasks` is non-empty, node-level`model`/`system_prompt`/`effort`/`fallback_model` fill any task that- didn't override; `continue_session=True` is auto-set only when memory is- wired AND the task didn't explicitly opt in or pick a resume UUID.-- **Memory bridge**: `continue_session = bool(memory_data)`; the argv builder- emits `--continue` (first run is a benign no-op, later runs resume the- on-disk JSONL). NO markdown re-injection.+ didn't override; `resume_session_id` is auto-set from the memory node's+ `last_session_id` only when memory is wired AND the task didn't explicitly+ opt in/out or pick its own UUID.+- **Memory bridge**: `resume_session_id = memory_data["last_session_id"]`;+ the argv builder emits `--resume <UUID>` (first run has none, so the pool+ mints `--session-id` and `_persist_memory` stores it for next time). NO+ markdown re-injection.- **Serial-memory guard**: memory wired AND `len(tasks) > 1` -> `NodeUserError`(parallel `--resume` against one JSONL would corrupt it).- **Workspace**: `ctx.raw["workspace_dir"]` (injected by workflow.py) ordiff --git a/server/config/model_registry.json b/server/config/model_registry.jsonindex 810f2164..23e1815b 100644--- a/server/config/model_registry.json+++ b/server/config/model_registry.json@@ -1,8 +1,101 @@{- "_generated": "2026-09-05T05:04:06.930651+00:00",+ "_generated": "2026-09-09T07:22:39.821023+00:00","_source": "openrouter","_model_count": 431,"models": {+ "inception/mercury-2.5": {+ "id": "inception/mercury-2.5",+ "name": "Inception: Mercury 2.5",+ "provider": "inception",+ "local_id": "mercury-2.5",+ "context_length": 260000,+ "max_output_tokens": 65536,+ "input_price_per_mtok": 0.04,+ "output_price_per_mtok": 0.15,+ "supports_thinking": false,+ "thinking_type": "none",+ "temperature_range": [+ 0.0,+ 2.0+ ],+ "is_reasoning_model": false,+ "supported_parameters": [+ "include_reasoning",+ "max_tokens",+ "reasoning",+ "reasoning_effort",+ "response_format",+ "stop",+ "structured_outputs",+ "temperature",+ "tool_choice",+ "tools"+ ]+ },+ "nex-agi/nex-n2.5-mini:free": {+ "id": "nex-agi/nex-n2.5-mini:free",+ "name": "Nex AGI: Nex-N2.5-Mini (free)",+ "provider": "nex-agi",+ "local_id": "nex-n2.5-mini:free",+ "context_length": 262144,+ "max_output_tokens": 235929,+ "input_price_per_mtok": 0.0,+ "output_price_per_mtok": 0.0,+ "supports_thinking": false,+ "thinking_type": "none",+ "temperature_range": [+ 0.0,+ 2.0+ ],+ "is_reasoning_model": false,+ "supported_parameters": [+ "include_reasoning",+ "logprobs",+ "max_tokens",+ "reasoning",+ "reasoning_effort",+ "response_format",+ "structured_outputs",+ "temperature",+ "tool_choice",+ "tools",+ "top_k",+ "top_logprobs",+ "top_p"+ ]+ },+ "nex-agi/nex-n2.5-pro:free": {+ "id": "nex-agi/nex-n2.5-pro:free",+ "name": "Nex AGI: Nex-N2.5-Pro (free)",+ "provider": "nex-agi",+ "local_id": "nex-n2.5-pro:free",+ "context_length": 262144,+ "max_output_tokens": 235929,+ "input_price_per_mtok": 0.0,+ "output_price_per_mtok": 0.0,+ "supports_thinking": false,+ "thinking_type": "none",+ "temperature_range": [+ 0.0,+ 2.0+ ],+ "is_reasoning_model": false,+ "supported_parameters": [+ "include_reasoning",+ "logprobs",+ "max_tokens",+ "reasoning",+ "reasoning_effort",+ "response_format",+ "structured_outputs",+ "temperature",+ "tool_choice",+ "tools",+ "top_k",+ "top_logprobs",+ "top_p"+ ]+ },"openai/gpt-6-astra": {"id": "openai/gpt-6-astra","name": "OpenAI: GPT-6 Astra",@@ -367,35 +460,6 @@"verbosity"]},- "inception/mercury-2.5-preview": {- "id": "inception/mercury-2.5-preview",- "name": "Inception: Mercury 2.5 Preview",- "provider": "inception",- "local_id": "mercury-2.5-preview",- "context_length": 260000,- "max_output_tokens": 65536,- "input_price_per_mtok": 0.04,- "output_price_per_mtok": 0.15,- "supports_thinking": false,- "thinking_type": "none",- "temperature_range": [- 0.0,- 2.0- ],- "is_reasoning_model": false,- "supported_parameters": [- "include_reasoning",- "max_tokens",- "reasoning",- "reasoning_effort",- "response_format",- "stop",- "structured_outputs",- "temperature",- "tool_choice",- "tools"- ]- },"ibm-granite/granite-4.2-8b": {"id": "ibm-granite/granite-4.2-8b","name": "IBM: Granite 4.2 8B",@@ -403,8 +467,8 @@"local_id": "granite-4.2-8b","context_length": 131072,"max_output_tokens": 117964,- "input_price_per_mtok": 0.1,- "output_price_per_mtok": 0.15,+ "input_price_per_mtok": 0.06,+ "output_price_per_mtok": 0.25,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -653,10 +717,10 @@"name": "Z.ai: GLM 5.3 Flash (batch)","provider": "z-ai","local_id": "glm-5.3-flash:batch",- "context_length": 1048575,- "max_output_tokens": 943717,- "input_price_per_mtok": 0.15,- "output_price_per_mtok": 0.5,+ "context_length": 1048576,+ "max_output_tokens": 943718,+ "input_price_per_mtok": 0.075,+ "output_price_per_mtok": 0.25,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -723,7 +787,7 @@"provider": "deepseek","local_id": "deepseek-v4-flash-vision-exp","context_length": 1048576,- "max_output_tokens": 384000,+ "max_output_tokens": 943718,"input_price_per_mtok": 0.22,"output_price_per_mtok": 0.66,"supports_thinking": false,@@ -756,6 +820,43 @@"top_p"]},+ "deepseek/deepseek-v4-flash-vision-exp:batch": {+ "id": "deepseek/deepseek-v4-flash-vision-exp:batch",+ "name": "DeepSeek: DeepSeek V4 Flash Vision Exp (batch)",+ "provider": "deepseek",+ "local_id": "deepseek-v4-flash-vision-exp:batch",+ "context_length": 1048576,+ "max_output_tokens": 943718,+ "input_price_per_mtok": 0.11,+ "output_price_per_mtok": 0.33,+ "supports_thinking": false,+ "thinking_type": "none",+ "temperature_range": [+ 0.0,+ 2.0+ ],+ "is_reasoning_model": false,+ "supported_parameters": [+ "frequency_penalty",+ "include_reasoning",+ "logit_bias",+ "logprobs",+ "max_tokens",+ "presence_penalty",+ "reasoning",+ "reasoning_effort",+ "repetition_penalty",+ "response_format",+ "stop",+ "structured_outputs",+ "temperature",+ "tool_choice",+ "tools",+ "top_k",+ "top_logprobs",+ "top_p"+ ]+ },"tencent/hy-mt2-1.8b": {"id": "tencent/hy-mt2-1.8b","name": "Tencent: Hy-MT2-1.8B",@@ -810,9 +911,9 @@"provider": "z-ai","local_id": "glm-latest","context_length": 1310720,- "max_output_tokens": 235929,- "input_price_per_mtok": 1.15,- "output_price_per_mtok": 3.5,+ "max_output_tokens": 128000,+ "input_price_per_mtok": 1.113,+ "output_price_per_mtok": 3.498,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -875,7 +976,7 @@"provider": "z-ai","local_id": "glm-5.3","context_length": 1310720,- "max_output_tokens": 262144,+ "max_output_tokens": 943718,"input_price_per_mtok": 1.4,"output_price_per_mtok": 4.4,"supports_thinking": false,@@ -909,6 +1010,43 @@"top_p"]},+ "z-ai/glm-5.3:batch": {+ "id": "z-ai/glm-5.3:batch",+ "name": "Z.ai: GLM 5.3 (batch)",+ "provider": "z-ai",+ "local_id": "glm-5.3:batch",+ "context_length": 1048576,+ "max_output_tokens": 943718,+ "input_price_per_mtok": 0.7,+ "output_price_per_mtok": 2.2,+ "supports_thinking": false,+ "thinking_type": "none",+ "temperature_range": [+ 0.0,+ 2.0+ ],+ "is_reasoning_model": false,+ "supported_parameters": [+ "frequency_penalty",+ "include_reasoning",+ "logit_bias",+ "logprobs",+ "max_tokens",+ "presence_penalty",+ "reasoning",+ "reasoning_effort",+ "repetition_penalty",+ "response_format",+ "stop",+ "structured_outputs",+ "temperature",+ "tool_choice",+ "tools",+ "top_k",+ "top_logprobs",+ "top_p"+ ]+ },"qwen/qwen3.8-27b": {"id": "qwen/qwen3.8-27b","name": "Qwen: Qwen3.8 27B",@@ -1072,7 +1210,7 @@"provider": "qwen","local_id": "qwen3.8-2.4t-a95b","context_length": 1048576,- "max_output_tokens": 262144,+ "max_output_tokens": 131072,"input_price_per_mtok": 2.0,"output_price_per_mtok": 6.0,"supports_thinking": false,@@ -1180,9 +1318,9 @@"provider": "deepseek","local_id": "deepseek-v4-pro-0813","context_length": 1048576,- "max_output_tokens": 384000,- "input_price_per_mtok": 1.1207,- "output_price_per_mtok": 3.362,+ "max_output_tokens": 393216,+ "input_price_per_mtok": 0.5795,+ "output_price_per_mtok": 1.7384,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -1220,8 +1358,8 @@"local_id": "deepseek-v4-pro-0813:batch","context_length": 1048576,"max_output_tokens": 943718,- "input_price_per_mtok": 1.32,- "output_price_per_mtok": 3.96,+ "input_price_per_mtok": 0.66,+ "output_price_per_mtok": 1.98,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -1233,6 +1371,7 @@"frequency_penalty","include_reasoning","logit_bias",+ "logprobs","max_tokens","min_p","presence_penalty",@@ -1246,6 +1385,7 @@"tool_choice","tools","top_k",+ "top_logprobs","top_p"]},@@ -1489,8 +1629,8 @@"local_id": "muse-glimmer-30b:batch","context_length": 131072,"max_output_tokens": 117964,- "input_price_per_mtok": 0.35,- "output_price_per_mtok": 1.5,+ "input_price_per_mtok": 0.175,+ "output_price_per_mtok": 0.75,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -1502,6 +1642,7 @@"frequency_penalty","include_reasoning","logit_bias",+ "logprobs","max_tokens","min_p","presence_penalty",@@ -1515,6 +1656,7 @@"tool_choice","tools","top_k",+ "top_logprobs","top_p"]},@@ -1555,9 +1697,9 @@"provider": "deepseek","local_id": "deepseek-v4-flash-latest","context_length": 1310720,- "max_output_tokens": 131072,+ "max_output_tokens": 393216,"input_price_per_mtok": 0.05,- "output_price_per_mtok": 0.1,+ "output_price_per_mtok": 0.16,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -1638,8 +1780,8 @@"local_id": "deepseek-v4-flash-0731:batch","context_length": 1048576,"max_output_tokens": 943718,- "input_price_per_mtok": 0.14,- "output_price_per_mtok": 0.28,+ "input_price_per_mtok": 0.11,+ "output_price_per_mtok": 0.33,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -1651,6 +1793,7 @@"frequency_penalty","include_reasoning","logit_bias",+ "logprobs","max_tokens","min_p","presence_penalty",@@ -1664,6 +1807,7 @@"tool_choice","tools","top_k",+ "top_logprobs","top_p"]},@@ -1759,6 +1903,7 @@"supported_parameters": ["frequency_penalty","include_reasoning",+ "logprobs","max_tokens","presence_penalty","reasoning",@@ -1767,6 +1912,7 @@"stop","temperature","tools",+ "top_logprobs","top_p"]},@@ -3020,37 +3166,6 @@"top_p"]},- "nex-agi/nex-n2-mini": {- "id": "nex-agi/nex-n2-mini",- "name": "Nex AGI: Nex-N2-Mini",- "provider": "nex-agi",- "local_id": "nex-n2-mini",- "context_length": 262144,- "max_output_tokens": 235929,- "input_price_per_mtok": 0.025,- "output_price_per_mtok": 0.1,- "supports_thinking": false,- "thinking_type": "none",- "temperature_range": [- 0.0,- 2.0- ],- "is_reasoning_model": false,- "supported_parameters": [- "include_reasoning",- "logprobs",- "max_tokens",- "reasoning",- "response_format",- "structured_outputs",- "temperature",- "tool_choice",- "tools",- "top_k",- "top_logprobs",- "top_p"- ]- },"sakana/fugu-ultra": {"id": "sakana/fugu-ultra","name": "Sakana: Fugu Ultra",@@ -3206,15 +3321,15 @@"top_p"]},- "z-ai/glm-5.2:free": {- "id": "z-ai/glm-5.2:free",- "name": "Z.ai: GLM 5.2 (free)",+ "z-ai/glm-5.2:batch": {+ "id": "z-ai/glm-5.2:batch",+ "name": "Z.ai: GLM 5.2 (batch)","provider": "z-ai",- "local_id": "glm-5.2:free",- "context_length": 256000,- "max_output_tokens": 230400,- "input_price_per_mtok": 0.0,- "output_price_per_mtok": 0.0,+ "local_id": "glm-5.2:batch",+ "context_length": 1048576,+ "max_output_tokens": 943718,+ "input_price_per_mtok": 0.7,+ "output_price_per_mtok": 2.2,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -3225,20 +3340,21 @@"supported_parameters": ["frequency_penalty","include_reasoning",+ "logit_bias",+ "logprobs","max_tokens",- "min_p","presence_penalty","reasoning","reasoning_effort","repetition_penalty","response_format",- "seed","stop","structured_outputs","temperature","tool_choice","tools","top_k",+ "top_logprobs","top_p"]},@@ -3267,8 +3383,8 @@"local_id": "kimi-k2.7-code","context_length": 262144,"max_output_tokens": 235929,- "input_price_per_mtok": 0.66,- "output_price_per_mtok": 3.4,+ "input_price_per_mtok": 0.71,+ "output_price_per_mtok": 3.5,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -3387,36 +3503,6 @@"verbosity"]},- "nex-agi/nex-n2-pro": {- "id": "nex-agi/nex-n2-pro",- "name": "Nex AGI: Nex-N2-Pro",- "provider": "nex-agi",- "local_id": "nex-n2-pro",- "context_length": 262144,- "max_output_tokens": 235929,- "input_price_per_mtok": 0.25,- "output_price_per_mtok": 1.0,- "supports_thinking": false,- "thinking_type": "none",- "temperature_range": [- 0.0,- 2.0- ],- "is_reasoning_model": false,- "supported_parameters": [- "frequency_penalty",- "include_reasoning",- "logprobs",- "max_tokens",- "reasoning",- "temperature",- "tool_choice",- "tools",- "top_k",- "top_logprobs",- "top_p"- ]- },"nvidia/nemotron-3.5-content-safety": {"id": "nvidia/nemotron-3.5-content-safety","name": "NVIDIA: Nemotron 3.5 Content Safety",@@ -3648,34 +3734,6 @@"top_p"]},- "minimax/minimax-m3:free": {- "id": "minimax/minimax-m3:free",- "name": "MiniMax: MiniMax M3 (free)",- "provider": "minimax",- "local_id": "minimax-m3:free",- "context_length": 1048576,- "max_output_tokens": 943718,- "input_price_per_mtok": 0.0,- "output_price_per_mtok": 0.0,- "supports_thinking": false,- "thinking_type": "none",- "temperature_range": [- 0.0,- 2.0- ],- "is_reasoning_model": false,- "supported_parameters": [- "include_reasoning",- "max_tokens",- "reasoning",- "response_format",- "seed",- "temperature",- "tool_choice",- "tools",- "top_p"- ]- },"stepfun/step-3.7-flash": {"id": "stepfun/step-3.7-flash","name": "StepFun: Step 3.7 Flash",@@ -4120,8 +4178,8 @@"name": "Mistral: Mistral Medium 3.5 (batch)","provider": "mistralai","local_id": "mistral-medium-3-5:batch",- "context_length": 32768,- "max_output_tokens": 26214,+ "context_length": 262144,+ "max_output_tokens": 209715,"input_price_per_mtok": 0.75,"output_price_per_mtok": 3.75,"supports_thinking": false,@@ -4273,8 +4331,8 @@"local_id": "kimi-latest","context_length": 1048576,"max_output_tokens": 943718,- "input_price_per_mtok": 2.5,- "output_price_per_mtok": 14.0,+ "input_price_per_mtok": 2.4,+ "output_price_per_mtok": 12.0,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -4696,8 +4754,8 @@"local_id": "deepseek-v4-pro","context_length": 1048576,"max_output_tokens": 384000,- "input_price_per_mtok": 0.9613,- "output_price_per_mtok": 1.9227,+ "input_price_per_mtok": 0.9553,+ "output_price_per_mtok": 1.9105,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -4736,8 +4794,8 @@"local_id": "deepseek-v4-flash","context_length": 1048576,"max_output_tokens": 384000,- "input_price_per_mtok": 0.0867,- "output_price_per_mtok": 0.1733,+ "input_price_per_mtok": 0.0886,+ "output_price_per_mtok": 0.1772,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -5559,34 +5617,6 @@"top_p"]},- "minimax/minimax-m2.7:free": {- "id": "minimax/minimax-m2.7:free",- "name": "MiniMax: MiniMax M2.7 (free)",- "provider": "minimax",- "local_id": "minimax-m2.7:free",- "context_length": 196608,- "max_output_tokens": 176947,- "input_price_per_mtok": 0.0,- "output_price_per_mtok": 0.0,- "supports_thinking": false,- "thinking_type": "none",- "temperature_range": [- 0.0,- 2.0- ],- "is_reasoning_model": false,- "supported_parameters": [- "include_reasoning",- "max_tokens",- "reasoning",- "response_format",- "seed",- "temperature",- "tool_choice",- "tools",- "top_p"- ]- },"openai/gpt-5.4-nano": {"id": "openai/gpt-5.4-nano","name": "OpenAI: GPT-5.4 Nano",@@ -5768,7 +5798,7 @@"name": "NVIDIA: Nemotron 3 Super","provider": "nvidia","local_id": "nemotron-3-super-120b-a12b",- "context_length": 1000000,+ "context_length": 262144,"max_output_tokens": 16384,"input_price_per_mtok": 0.085,"output_price_per_mtok": 0.4,@@ -5783,7 +5813,6 @@"frequency_penalty","include_reasoning","logit_bias",- "logprobs","max_tokens","min_p","presence_penalty",@@ -5793,12 +5822,10 @@"response_format","seed","stop",- "structured_outputs","temperature","tool_choice","tools","top_k",- "top_logprobs","top_p"]},@@ -6175,8 +6202,8 @@"local_id": "qwen3.5-35b-a3b","context_length": 262144,"max_output_tokens": 16384,- "input_price_per_mtok": 0.08,- "output_price_per_mtok": 0.75,+ "input_price_per_mtok": 0.3125,+ "output_price_per_mtok": 1.25,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -7064,8 +7091,8 @@"provider": "z-ai","local_id": "glm-4.7-flash","context_length": 202752,- "max_output_tokens": 16384,- "input_price_per_mtok": 0.06,+ "max_output_tokens": 117964,+ "input_price_per_mtok": 0.0605,"output_price_per_mtok": 0.4,"supports_thinking": false,"thinking_type": "none",@@ -8021,7 +8048,7 @@"provider": "moonshotai","local_id": "kimi-k2-thinking","context_length": 262144,- "max_output_tokens": 100352,+ "max_output_tokens": 235929,"input_price_per_mtok": 0.6,"output_price_per_mtok": 2.5,"supports_thinking": false,@@ -8623,9 +8650,9 @@"provider": "z-ai","local_id": "glm-4.6","context_length": 204800,- "max_output_tokens": 131072,- "input_price_per_mtok": 0.55,- "output_price_per_mtok": 2.2,+ "max_output_tokens": 16384,+ "input_price_per_mtok": 0.43,+ "output_price_per_mtok": 1.75,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -9019,7 +9046,7 @@"provider": "qwen","local_id": "qwen3-next-80b-a3b-thinking","context_length": 262144,- "max_output_tokens": 32768,+ "max_output_tokens": 235929,"input_price_per_mtok": 0.15,"output_price_per_mtok": 1.2,"supports_thinking": false,@@ -9055,8 +9082,8 @@"provider": "qwen","local_id": "qwen3-next-80b-a3b-instruct","context_length": 262144,- "max_output_tokens": 235929,- "input_price_per_mtok": 0.1,+ "max_output_tokens": 16384,+ "input_price_per_mtok": 0.09,"output_price_per_mtok": 1.1,"supports_thinking": false,"thinking_type": "none",@@ -9246,9 +9273,9 @@"provider": "deepseek","local_id": "deepseek-chat-v3.1","context_length": 163840,- "max_output_tokens": 144900,- "input_price_per_mtok": 0.55,- "output_price_per_mtok": 1.65,+ "max_output_tokens": 32768,+ "input_price_per_mtok": 0.25,+ "output_price_per_mtok": 0.95,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -10047,8 +10074,8 @@"local_id": "qwen3-235b-a22b-2507","context_length": 262144,"max_output_tokens": 16384,- "input_price_per_mtok": 0.09,- "output_price_per_mtok": 0.55,+ "input_price_per_mtok": 0.22,+ "output_price_per_mtok": 0.88,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -10696,6 +10723,7 @@"response_format","seed","stop",+ "structured_outputs","temperature","tool_choice","tools",@@ -10741,9 +10769,9 @@"provider": "qwen","local_id": "qwen3-14b","context_length": 131072,- "max_output_tokens": 16384,- "input_price_per_mtok": 0.12,- "output_price_per_mtok": 0.24,+ "max_output_tokens": 8192,+ "input_price_per_mtok": 0.2275,+ "output_price_per_mtok": 0.91,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -11219,8 +11247,8 @@"local_id": "deepseek-chat-v3-0324","context_length": 163840,"max_output_tokens": 147456,- "input_price_per_mtok": 0.25,- "output_price_per_mtok": 1.0,+ "input_price_per_mtok": 0.29,+ "output_price_per_mtok": 1.14,"supports_thinking": false,"thinking_type": "none","temperature_range": [@@ -12292,7 +12320,7 @@"provider": "thedrummer","local_id": "unslopnemo-12b","context_length": 1024000,- "max_output_tokens": 26214,+ "max_output_tokens": 819200,"input_price_per_mtok": 0.4,"output_price_per_mtok": 0.4,"supports_thinking": false,