[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-92779":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":19,"topics":21,"createdAt":10,"pushedAt":10,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":15,"starSnapshotCount":15,"syncStatus":37,"lastSyncTime":38,"discoverSource":39},92779,"ultracodex","YuanpingSong\u002Fultracodex","YuanpingSong","Run Claude Code workflow scripts, unmodified, on the OpenAI Codex CLI — fable plans, codex executes, fable verifies. Parallel agent fleets, builder–verifier loops, token budgets, full-screen TUI.","https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fultracodex",null,"TypeScript",54,4,51,0,3,42.4,"Apache License 2.0",false,"main",[22,23,24,25,26,27,28,29,30,31,32,33],"agent-orchestration","ai-agents","anthropic","claude-code","cli","codex","llm","multi-agent","openai","tui","typescrip-","workflow-engine","2026-07-22 04:02:07","# ultracodex\n\n[![ci](https:\u002F\u002Fgithub.com\u002FYuanpingSong\u002Fultracodex\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FYuanpingSong\u002Fultracodex\u002Factions\u002Fworkflows\u002Fci.yml)\n[![npm](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fultracodex)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fultracodex)\n[![license](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache--2.0-blue)](LICENSE)\n\n**Run Claude Code workflow scripts, unmodified, on the OpenAI Codex CLI — and on OpenCode.**\n\nUltracode too expensive? **ultracodex** is ultracode — Claude Code's one-prompt-becomes-a-fleet-of-agents mode — on Codex: the same workflow scripts, running on your Codex subscription, on OpenCode (any provider it speaks, local models included), or on both at once: one `[route]` table sends implementation to one vendor and adversarial review to another, in the same run.\n\n> **Fable plans, Codex executes, Fable verifies**\n\nYour best model plans and judges; the subscription you're not rationing does the work. Verified results land back in the session that asked. Quit the terminal — runs are detached processes over plain files, nothing dies. And any model can write these workflows: the [authoring skill](skills\u002Fagent-script-authoring\u002FSKILL.md) and a [nine-shape example gallery](examples\u002F) ship in the box.\n\n\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F4a7366cd-429c-4581-9703-7c28a9605c0e\n\n\n*One prompt: \"Write an essay on the meaning of life — actor–critic loop, 3 rounds. Run it with ultracodex.\" Claude (left) authors the workflow, Codex executes it, the TUI (right) watches live, and the result lands back in Claude. ([HD video](https:\u002F\u002Fgithub.com\u002FYuanpingSong\u002Fultracodex\u002Freleases\u002Fdownload\u002Fv0.1.1\u002Fultracodex-demo-v0.1.mp4))*\n\n## Quickstart\n\nPrerequisites: Node ≥ 20 and the [Codex CLI](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fcodex) installed and authenticated (`codex login`; tested against codex-cli 0.142.4). [OpenCode](https:\u002F\u002Fopencode.ai) is optional (tested against 1.16.2) — one `[route]` line turns it on.\n\n```bash\nnpm install -g ultracodex      # or: pnpm add -g ultracodex\nultracodex doctor              # checks node, codex, auth, config — with actionable next steps\nultracodex sync-skills         # teaches Claude Code (and opencode) the whole contract\n```\n\nThen, in Claude Code, the prompt is just the task:\n\n> Write a haiku that survives three rounds of adversarial critique. Run it with ultracodex.\n\nClaude authors the workflow, the loop executes on Codex (watch it live with `ultracodex ls` \u002F `attach \u003CrunId>`, or bare `ultracodex` for the TUI), and the verified result lands back in your Claude session. That's the demo video, reproduced at haiku prices.\n\nNo Claude session handy? Drive it from the CLI directly — the examples ship with the package:\n\n```bash\nultracodex run examples\u002Factor-critic-loop\u002Fworkflow.js --watch --budget 200k\n```\n\nUsing codex, opencode, or another agent as the driver instead? The same skills install everywhere — see [docs\u002Fskills.md](docs\u002Fskills.md). For real work, run from **your project's root** — agents work in your cwd. `--json` blocks and prints the result (the machine path a driving LLM calls); `--watch` streams events; `--detach` prints the runId and exits; `--budget` takes output tokens (`500k`, `1m`).\n\nNext steps: climb the [examples ladder](examples\u002F) — nine orchestration shapes ordered by complexity, each with a problem statement, a topology diagram, and a validated reference script. From source instead of npm:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FYuanpingSong\u002Fultracodex && cd ultracodex\npnpm install && pnpm build && pnpm link --global\n```\n\n## Agent Script in 60 seconds\n\nA script is an ES module: a pure-literal `meta` export, then a plain-JS async body over eight injected globals. No imports, no TypeScript.\n\n```js\nexport const meta = {\n  name: 'review-files',\n  description: 'Fan out reviewers, verify findings, report',\n  phases: [{ title: 'Review' }, { title: 'Verify' }],\n}\n\nconst FILES = args?.files ?? ['src\u002Fauth.ts', 'src\u002Fapi.ts']\n\nphase('Review')\nconst findings = (await parallel(FILES.map(f => () =>\n  agent(`Review ${f} for bugs. Return via the schema.`, {\n    label: `review:${f}`,\n    schema: { type: 'object', properties: { bugs: { type: 'array', items: { type: 'string' } } }, required: ['bugs'] },\n  })\n))).filter(Boolean)                    \u002F\u002F failed agents are null, never throws\n\nphase('Verify')\nconst verified = await pipeline(       \u002F\u002F no barrier — each item flows independently\n  findings.flatMap(f => f.bugs),\n  (bug) => agent(`Try to refute: ${bug}`, { label: 'verify' }),\n  (verdict, bug) => ({ bug, verdict }), \u002F\u002F verdict may be null (failed verifier) — check it\n)\n\nreturn { verified: verified.filter(v => v && v.verdict) }\n```\n\n| global | what it does |\n|---|---|\n| `agent(prompt, opts?)` | run one agent; resolves final text, a schema-validated object, or `null` on failure (never rejects — except budget\u002Fcaps, which throw) |\n| `parallel(thunks)` | barrier over concurrent thunks; a thrown thunk becomes `null` |\n| `pipeline(items, ...stages)` | per-item stage chains, no cross-item barrier; stages get `(prev, item, index)`; a stage that **throws** drops its item, a stage that **resolves `null`** flows onward — null-check `prev` |\n| `phase(title)` | progress grouping for subsequent agents |\n| `log(msg)` | narrator line in the TUI \u002F `--watch` output |\n| `args` | the run's `--args` input, verbatim |\n| `budget` | `{ total, spent(), remaining() }` — output-token ceiling; exceeding it makes further `agent()` calls throw |\n| `workflow(name, args?)` | run a saved workflow inline (one nesting level) |\n\n`agent()` opts: `label` (display + routing), `phase`, `schema` (JSON Schema), `model` \u002F `effort` (advisory tiers, mapped in config), `isolation: 'worktree'`, `agentType` (config profile, e.g. read-only explorer).\n\nThree axes, one format: `parallel()` is breadth, `pipeline()` is flow, **loops are depth** — plain-JS `while`\u002F`for` that iterate until verified good, with `budget` as the governor and live pause\u002Fskip\u002Fstop as the brakes. The canonical loop, its three safety rails, and the verifier-calibration lesson live in [examples\u002Factor-critic-loop\u002F](examples\u002Factor-critic-loop\u002F). The full normative definition is [docs\u002Fagent-script-spec.md](docs\u002Fagent-script-spec.md); `ultracodex validate --strict` checks a script stays in the portable subset that runs identically under Claude Code's Workflow tool and ultracodex.\n\n## Write your own workflows\n\nEverything needed to author Agent Scripts — or to teach **any** model to author them — ships with the package:\n\n- **[skills\u002Fagent-script-authoring\u002FSKILL.md](skills\u002Fagent-script-authoring\u002FSKILL.md)** — the authoring skill: one self-contained document (~4.7k tokens; core contract up front, craft reference behind), hardened across three evidence rounds against three model families. Given only this file plus a problem statement, GPT-5.5 authored scripts judged comparable-or-stronger than the Claude-written references on 7\u002F7 problems; a 31B open model reached parity after one strengthening round.\n- **[examples\u002F](examples\u002F)** — the shape gallery: nine orchestration shapes ordered as a complexity ladder, distilled from a census of 58 real production workflows. Each entry is a self-contained problem statement, a mermaid diagram of the topology, and a reference script that passes `validate --strict`.\n\nInstalling the skills into Claude Code, codex, opencode, or a raw prompt: [docs\u002Fskills.md](docs\u002Fskills.md). Whatever authors the script, gate it mechanically: `ultracodex validate --strict workflow.js` must print `ok: no issues`.\n\n## Configuration & routing\n\n**Zero config required** — the values below are the shipped defaults (`ultracodex doctor` prints the resolved profile). Create `.ultracodex\u002Fconfig.toml` (project) or `~\u002F.ultracodex\u002Fconfig.toml` (global) only to override:\n\n```toml\n[route]                        # first match wins: label, then phase\n\"*\"          = \"codex\"         # default: everything runs on Codex\n# \"impl:*\"   = \"opencode\"      # mixed routing: implementation on OpenCode…\n# \"review:*\" = \"claude\"        # …adversarial review on a third vendor\n\n[backends.codex]\nsandbox        = \"workspace-write\"\ndefault_model  = \"gpt-5.5\"\ndefault_effort = \"xhigh\"\n\n[backends.opencode]\nmodel = \"deepseek\u002Fdeepseek-chat\"   # any provider\u002Fmodel your opencode knows\n```\n\nRouting lives in config, never in scripts — that's what keeps scripts portable across runtimes and backends. Full reference (backends, model maps, sandbox\u002Fnetwork escalation ladder, concurrency): [docs\u002Foperations.md](docs\u002Foperations.md).\n\n## CLI\n\n```\nultracodex                        TUI home: saved workflows + recent runs\nultracodex run \u003Cscript|name>      [--args JSON] [--budget 500k] [--watch|--json|--detach] [--strict]\nultracodex ls | show \u003Cref> | attach \u003Cref>       inspect runs (ref = unique runId prefix)\nultracodex pause|resume|skip|kill \u003Cref>         live controls\nultracodex logs \u003Cref> [n]         raw runner \u002F per-agent event logs\nultracodex validate \u003Cscript>      dual-runnability lint (--strict = portable subset)\nultracodex sync-skills            static + per-workflow skills → .claude\u002Fskills\u002F\nultracodex doctor                 env, auth, execution profile, interactive-config divergences\n```\n\nEvery run directory (`.ultracodex\u002Fruns\u002F\u003CrunId>\u002F`) is plain files — journal, per-agent events, `result.json` — and any agent's Codex session can be resumed interactively (`codex resume \u003CthreadId>`, surfaced in the TUI).\n\n## How it works\n\n```\nscript.js ──▶ loader (acorn meta parse + vm) ──▶ runtime (semantics, caps,\n              budget, semaphore) ──▶ executors per [route]:\n                codex    → `codex app-server` JSON-RPC, one process per slot\n                opencode → `opencode serve` HTTP + SSE, one server per call\n                claude   → headless `claude -p`\n              journal.jsonl ◀── every event        control.jsonl ◀── pause\u002Fstop\u002Fskip\n              TUI \u002F show \u002F --json = pure folds over the journal\n```\n\nEvery backend implements one documented seam — the [Executor Contract](docs\u002Fexecutor-contract.md): a capability descriptor (schema\u002Fresume\u002Finterrupt\u002Fusage\u002Factivity\u002Fsandbox) plus a 10-assertion conformance kit that all three adapters pass. Structured output is belt-and-suspenders: schemas ride the wire where the backend supports it (Codex strict mode, OpenCode `json_schema`), degrade to a prompt contract mid-call when a provider rejects them, and are always enforced on our side (ajv validation + repair turns on the same session). The entire test suite (460+ tests) runs hermetically against scripted fakes of all three harnesses — no API keys in CI.\n\nDeeper reading: [docs\u002Farchitecture.md](docs\u002Farchitecture.md) · [docs\u002Foperations.md](docs\u002Foperations.md) · [docs\u002Fskills.md](docs\u002Fskills.md) · [docs\u002Fagent-script-spec.md](docs\u002Fagent-script-spec.md) · [docs\u002Fexecutor-contract.md](docs\u002Fexecutor-contract.md) (write your own backend) · [docs\u002Finternal\u002Fagent-script-plan.md](docs\u002Finternal\u002Fagent-script-plan.md) (roadmap: approvals aggregator, packaged loop workflows).\n\n## Status\n\nM1–M3 shipped: runner core, app-server executor, TUI, CLI, claude backend, validate, sync-skills. Validated end-to-end on live Codex, including a clean-room rebuild of this project by Codex agents orchestrated through ultracodex itself.\n\nM4 shipped (v0.4.0): the executor seam is a versioned contract with a conformance kit, and OpenCode is the third backend to pass it. The acceptance test was recursive — one run on this repo where OpenCode implemented a feature, Codex gated it, and Claude adversarially reviewed it, green in a single journal. Every build wave of M4 was itself executed by ultracodex fleets.\n\n## License\n\n[Apache-2.0](LICENSE). The app-server turn state machine adapts patterns from OpenAI's Codex plugin for Claude Code (Apache-2.0) — see [NOTICE](NOTICE).\n","ultracodex 是一个将 Claude Code 工作流脚本无缝迁移至 OpenAI Codex CLI 及 OpenCode 平台的命令行工具。它支持原生运行 agent 编排脚本，实现 builder–verifier（构建–验证）多轮协作循环、跨模型路由（如规划用 Claude、执行用 Codex、验证用另一模型）、token 预算控制，并提供全屏终端界面（TUI）实时监控。基于 TypeScript 构建，兼容本地模型与任意 OpenCode 兼容后端。适用于需低成本复用 Claude Code 工作流、在自有 LLM 订阅下执行多智能体协同任务、或进行模型间分工验证的研发与工程场景。",2,"2026-07-10 02:30:27","CREATED_QUERY"]