{
  "markdown": "# wiff\n\n**Harness-agnostic, deterministic, resumable multi-agent workflows — written as plain JavaScript. Like `wf`, but wiff.**\n\n[![npm](https://img.shields.io/npm/v/%40xxxoooxoxo%2Fwiff?label=npm&color=cb3837)](https://www.npmjs.com/package/@xxxoooxoxo/wiff) [![MCP Registry](https://img.shields.io/badge/MCP_Registry-io.github.xxxoooxoxo%2Fwiff-6b46c1)](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.xxxoooxoxo/wiff) ![MIT License](https://img.shields.io/badge/license-MIT-blue) ![Node >= 22](https://img.shields.io/badge/node-%3E%3D22-brightgreen)\n\nFan a task out to a fleet of agents with a small script instead of a prayer. You write ordinary JavaScript with `agent()`, `/goal` stages, `parallel()`, and `pipeline()`; the runtime executes it in the background, journals every step, and — when a run dies halfway through — resumes it without re-paying for a single completed agent. A disposable MCP bridge talks to a persistent local daemon, so active workflows outlive the Codex, Claude Code, Cursor, or cron process that launched them while each child runs on Codex, Claude, Cursor, or Kimi.\n\n<picture>\n  <source media=\"(prefers-color-scheme: light)\" srcset=\"docs/screenshots/run-light.png\">\n  <img alt=\"A live wiff run in the viewer: a three-phase accessibility audit with one inventory agent completed and three audit agents running in parallel, each with a live status line, a gantt timeline, and per-agent model/effort/sandbox/token badges.\" src=\"docs/screenshots/run-dark.png\">\n</picture>\n\n```js\nexport const meta = {\n  name: \"audit\",\n  description: \"Audit files in parallel, fix confirmed issues in isolation\",\n  phases: [{ title: \"Audit\" }, { title: \"Fix\" }],\n};\n\nphase(\"Audit\");\nconst findings = await parallel(\n  args.files.map((file) => () =>\n    agent(`Audit ${file} for auth bugs`, {\n      key: `audit:${file}`,          // stable key → free replay on resume\n      sandbox: \"read-only\",\n      schema: findingSchema,          // structured JSON output\n    }),\n  ),\n);\n\nphase(\"Fix\");\nreturn await parallel(\n  findings.filter((f) => f.real).map((f) => () =>\n    agent(`Fix: ${f.summary}`, {\n      key: `fix:${f.file}`,\n      agentType: \"surgeon\",           // persona from .codex/agents/surgeon.md\n      isolation: \"worktree\",          // own git worktree — parallel writes can't collide\n      sandbox: \"workspace-write\",\n    }),\n  ),\n);\n```\n\nWhen one stage must keep working until a condition is genuinely satisfied, make it a native Codex\ngoal:\n\n```js\nphase(\"Verify and repair\");\nawait agent(\"/goal Make the unit tests pass and verify the final run.\", {\n  key: \"tests-green\",\n  sandbox: \"workspace-write\",\n  timeoutMs: 30 * 60 * 1_000,\n});\n```\n\nWiff holds the workflow at that statement and continues the same Codex thread while its goal is\nactive. The next stage starts only after the worker marks the goal complete; blocked, paused, or\nlimited goals fail explicitly.\n\nPut durable preferences in `~/.wiff/config.json`, with optional project overrides in\n`<cwd>/.wiff/config.json`:\n\n```json\n{\n  \"version\": 1,\n  \"instructions\": \"Verify before reporting success.\",\n  \"defaults\": {\n    \"model\": \"claude-sonnet-5\",\n    \"fallbackModels\": [\"gpt-5.6-sol\"]\n  },\n  \"rules\": [\n    {\n      \"name\": \"fix-until-green\",\n      \"when\": { \"phase\": [\"Fix\", \"Repair\"] },\n      \"goal\": \"Relevant tests must pass.\",\n      \"options\": {\n        \"model\": \"gpt-5.6-sol\",\n        \"effort\": \"high\"\n      }\n    }\n  ]\n}\n```\n\nDefaults fill missing agent options; matching rules are explicit user policy and override generated\nworkflow options. Instructions are injected alongside the task, ordered fallback models may cross\nbackends, and applicable preference changes invalidate cached results on resume.\n\n## Why\n\n**There is no harness-agnostic workflow orchestration system.** Every coding harness has some\nmulti-agent story — Claude Code has its Workflow tool, Codex has subagents, Cursor has its own\nagents — but each one is welded to its harness: its runs live and die with that app, its state is\ninvisible to everything else, and none of them can be driven from anywhere but their own chat\nwindow. wiff pulls orchestration out of the harness: a persistent local daemon owns execution and\ndurable on-disk state while each harness gets a disposable stdio MCP bridge. **Any** MCP client —\nCodex, Claude Code, Cursor, a cron job — can start, disconnect from, watch, resume, or cancel the\nsame runs, and the orchestration itself is a script rather than a conversation.\n\nAd-hoc multi-agent orchestration (\"spawn some subagents for this\") is also great until the run is\n40 agents deep and something dies. Workflows-as-code give you:\n\n- **Determinism** — the orchestration is a script, not vibes. No time, randomness, filesystem, or network inside workflow code; agents do the external work.\n- **Outlive the parent** — closing or killing the launching MCP bridge does not interrupt a run. The detached daemon keeps executing, and another harness can reconnect with the run id.\n- **Resume, not retry** — every agent call is journaled with a stable key and an input hash. A graceful daemon restart automatically resumes durable active runs. After an abrupt daemon or machine crash, explicitly resume the safely interrupted run: unchanged completed agents replay from cache instantly and for free. Agents that were interrupted **mid-turn** re-run with a digest of their previous attempt's transcript injected (\"here's what you already did — continue\"), and worktree agents inherit their partial checkout instead of starting over.\n\n  <img alt=\"A resumed run: attempt 2, with the inventory agent and all three audit agents replayed from cache in 0ms and only the interrupted synthesis agent re-running.\" src=\"docs/screenshots/resume-dark.png\">\n\n  That screenshot is the feature: the host was killed mid-synthesis, and on resume the four finished agents came back from the journal in 0ms — only the interrupted one re-ran.\n- **Fail-hard semantics** — a rejected agent fails the workflow loudly (`parallelSettled()` is the explicit opt-out). No silent `null`s masquerading as success.\n- **Visible scheduling** — agents are journaled as queued before they acquire a runtime slot and\n  running only when backend execution starts. Queue and execution durations stay separate, while\n  owner heartbeats make a live-but-stalled workflow visible.\n- **Isolation where it matters** — `isolation: \"worktree\"` gives each writing agent a fresh detached git worktree. Clean ones vanish; dirty ones are kept and listed on the run for you to inspect or merge.\n- **Personas** — `agentType: \"reviewer\"` injects a markdown persona as the child's developer instructions, with frontmatter defaults for model/effort/sandbox.\n\n## Install\n\n**Codex** (plugin: MCP tools + the `$workflow` authoring skill):\n\n```sh\ncodex plugin marketplace add https://github.com/xxxoooxoxo/wiff.git\ncodex plugin add wiff@wiff\n```\n\n**Claude Code** (plugin: MCP tools + skill):\n\n```sh\nclaude plugin marketplace add xxxoooxoxo/wiff\nclaude plugin install wiff@wiff\n```\n\n**Anything else** — the server is on npm ([`@xxxoooxoxo/wiff`](https://www.npmjs.com/package/@xxxoooxoxo/wiff)) and the [official MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.xxxoooxoxo/wiff) (`io.github.xxxoooxoxo/wiff`), so registry-aware clients can install it by name, and everything else runs it with npx:\n\n```sh\nnpx -y @xxxoooxoxo/wiff        # stdio MCP server\n```\n\nOr from a local checkout:\n\n```sh\ngit clone https://github.com/xxxoooxoxo/wiff.git\ncodex plugin marketplace add ./wiff\ncodex plugin add wiff@wiff\n```\n\nThen start a new Codex session and either invoke the bundled skill with `$workflow` or just ask: *\"run this as a resumable workflow.\"*\n\nInstalling the plugin auto-approves its five workflow-controller tools so headless and desktop runs don't stop at an MCP approval prompt. Agent filesystem access is still governed per-call by `sandbox`.\n\n## Using from other harnesses (Claude Code, Cursor, any MCP client)\n\nThe Codex *plugin* is just packaging. The engine underneath is a plain stdio MCP server, so any\nMCP-speaking harness can orchestrate wiff workflows. The mental model: **both the orchestrator\nand the workers are pluggable** — whoever drives, each `agent()` child runs on a backend chosen\nfrom its model name: `gpt-*`/`o*` models run as native Codex threads via a local\n`codex app-server`; current `claude-fable-5`, `claude-opus-5`, `claude-sonnet-5`, and\n`claude-haiku-4-5` models—or the moving `fable`/`opus`/`sonnet`/`haiku` aliases—run as headless `claude`\nagents, `composer-*` and `grok-*` models (including `cursor-grok-*` slugs) run through the official Cursor SDK (`@cursor/sdk`) in-process, and\n`kimi-code/*` models run as headless `kimi` processes. A workflow can mix them freely\n(`provider: \"codex\" | \"claude\" | \"cursor\" | \"kimi\"` overrides the inference, `WIFF_BACKEND`\nsets the fallback for unrecognized models). On the Claude, Cursor, and Kimi backends,\n`workspace-write` requires `isolation: \"worktree\"`; Kimi's `read-only` mode is advisory because\nprint mode auto-approves tools and has no OS sandbox.\n\nRequirements on the machine, regardless of harness: Node >= 22, git if you use\n`isolation: \"worktree\"`, and the runtime of whichever backend your agents use — Codex CLI\n>= 0.144.6\nand/or `claude` CLI installed and authenticated, `CURSOR_API_KEY` for Cursor agents, or the\n`kimi` CLI configured with the requested full model alias (for example `kimi-code/k3`).\n\n**Claude Code** — the plugin install above is the easy path. To wire just the server manually:\n\n```sh\nclaude mcp add wiff -- npx -y @xxxoooxoxo/wiff\n```\n\nTool calls go through Claude Code's own permission system; to skip per-call prompts, allow the\nfive tools in `.claude/settings.json`:\n\n```json\n{ \"permissions\": { \"allow\": [\n  \"mcp__wiff__workflow_start\", \"mcp__wiff__workflow_status\",\n  \"mcp__wiff__workflow_wait\", \"mcp__wiff__workflow_cancel\",\n  \"mcp__wiff__workflow_models\"\n] } }\n```\n\n**Cursor / Windsurf / Claude Desktop** — add the server to the client's `mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"wiff\": { \"command\": \"npx\", \"args\": [\"-y\", \"@xxxoooxoxo/wiff\"] }\n  }\n}\n```\n\nNotes for non-Codex hosts:\n\n- **State is shared.** Every harness reads and writes the same `~/.wiff/runs/`, so a run started\n  from Codex can be watched, cancelled, or resumed from Claude Code (and vice versa), and the\n  live viewer sees everything.\n- **Execution is daemon-owned.** The first controller call starts one detached daemon per Wiff\n  state root. MCP bridges may exit without affecting active work. The daemon exits after 15 idle\n  minutes by default (`WIFF_DAEMON_IDLE_MS` overrides this) and writes its pid, socket, and log to\n  `~/.wiff/daemon.json` and `~/.wiff/daemon.log`.\n- **Controllers authenticate before sending work.** A 0600 secret under `~/.wiff/control/` drives\n  a challenge-response handshake. The bridge proves daemon identity before transmitting workflow\n  scripts or arguments; the daemon also authenticates every controller request.\n- **Ownership is an OS lease, not a stale file.** A secret-derived loopback port is held for the\n  daemon's complete lifetime. The operating system grants it to exactly one owner and releases it\n  automatically on crash; only that owner may replace the control socket or lock metadata. If the\n  derived port conflicts with unrelated local software, set `WIFF_DAEMON_OWNERSHIP_PORT` to an\n  available loopback port; Wiff reports the exact conflict rather than treating it as a live owner.\n- **The first controller supplies the daemon environment.** `PATH`, backend credentials,\n  `CODEX_HOME`, persona paths, and Wiff defaults remain those of the bridge that started the daemon.\n  If they change, gracefully terminate the pid recorded in `~/.wiff/daemon.json` (active durable\n  runs resume when the next bridge starts) or wait for the 15-minute idle shutdown.\n- **Bring the script contract into context.** The `$workflow` skill only auto-loads inside Codex.\n  From other harnesses, point the model at\n  [`plugins/wiff/skills/workflow/references/api.md`](plugins/wiff/skills/workflow/references/api.md)\n  (or copy the skill into your harness's skill/rules directory, e.g. `.claude/skills/` or Cursor\n  rules) so it authors valid scripts.\n- **Personas** resolve from `<cwd>/.codex/agents/` then `~/.codex/agents/` on every harness; set\n  `CODEX_WORKFLOW_AGENTS_DIR` in the server's env to point somewhere else (e.g. a shared\n  `~/.claude/agents`).\n- `workflow_start` requires an explicit absolute `cwd`, so the server's own working directory\n  doesn't matter to results.\n\n## For agents\n\nIf you are a coding agent — driving wiff over MCP or hacking on this repo — read [AGENTS.md](AGENTS.md). It covers the five workflow tools, the script-authoring rules that actually catch agents out (stable `key`s, thunks not promises, no I/O in workflow code, worktree isolation for concurrent writers), where run state lives on disk, and how to verify changes to the runtime. The full script contract is in [the API reference](plugins/wiff/skills/workflow/references/api.md).\n\n## How it works\n\nThe plugin exposes five tools through a stdio MCP bridge: `workflow_start`, `workflow_status`, `workflow_wait`, `workflow_cancel`, and `workflow_models`. The bridge connects over an authenticated local socket to an on-demand detached daemon. The daemon owns the workflow manager, backends, heartbeats, and journals, so closing the bridge cannot kill active work. A secret-derived loopback lease gives exactly one process OS-level ownership for its full lifetime; only that owner may replace socket and lock metadata. A challenge-response handshake proves daemon identity before scripts or arguments cross the connection. A started workflow runs its script inside a locked-down Node `vm` (no imports, filesystem, shell, network, time, or randomness — those all throw). Each `agent()` call is routed to the Codex, Claude, Cursor, or Kimi backend from its model name or explicit `provider`; recursive orchestration is disabled inside children.\n\nEverything about a run persists under `~/.wiff/runs/<runId>/`:\n\n```\nrun.json         status, phase, counters, failures, kept worktrees\nscript.js        the exact source (reread on resume)\njournal.jsonl    every phase/log/agent event, with input hashes and token usage\nagents/*.jsonl   full per-child transcripts\nworktrees/       isolated checkouts for agents that asked for them\n```\n\nStatus, waits, and cancellation work while the launching host is gone. Graceful daemon restarts resume active durable runs automatically. An abrupt daemon crash is deliberately conservative: the next daemon marks the run `interrupted` rather than risking duplicate side effects, and any client can resume it from the journal.\n\nSee [the API reference](plugins/wiff/skills/workflow/references/api.md) for the full script contract and [`examples/verify-and-fix.js`](plugins/wiff/examples/verify-and-fix.js) for a staged example.\n\n## Live viewer\n\nWatch every run — and every agent inside it — in a local web UI:\n\n```sh\nnpx -p @xxxoooxoxo/wiff wiff-viewer    # http://127.0.0.1:4979  (--port / --root to override)\n# or from a checkout: cd plugins/wiff && npm run viewer\n```\n\nZero dependencies, read-only over the run files, so it can watch runs owned by any process. A live strip across the top shows **every queued or running agent in every run**, including queue time and what executing agents are doing now (their latest command, file edit, or thought, tailed from the transcript). Owner heartbeats flag stalled hosts. Below that: per-phase agent cards with live status lines, a gantt timeline, token counts, kept worktrees, and a click-through live-tailing transcript drawer. Goal nodes are called out as queued, active, met, failed, or replayed. Light and dark themes.\n\n<img alt=\"The transcript drawer open over a completed run, live-tailing one agent's transcript: its final findings report followed by raw token-usage and turn-completion events.\" src=\"docs/screenshots/transcript-dark.png\">\n\n## Related projects\n\n- [robzilla1738/Codex-Workflows](https://github.com/robzilla1738/Codex-Workflows) — workflow-as-code runtime for Codex focused on review fan-out. Convergent design, independent implementation.\n- [scasella/claude-dynamic-workflows-codex](https://github.com/scasella/claude-dynamic-workflows-codex) — Claude Code's dynamic-workflows DSL re-hosted on GPT agents, with sessionful workers and a browser run viewer.\n- Codex's native subagents — great for interactive, human-supervised fan-out; this plugin is for the automated, resumable, journaled kind.\n\n## Development\n\n```sh\ncd plugins/wiff\nnpm test        # unit tests (fake backend, no tokens spent)\nnpm run check   # syntax check\nnpm run smoke   # one real Codex child, end to end\n```\n\nPass a completed smoke run id to verify cross-process resume without another model call:\n\n```sh\nnpm run smoke -- wf_<run-id>\n```\n\nCodex runs installed plugins from a versioned cache — after editing source, bump the version in `.codex-plugin/plugin.json` and re-run `codex plugin add wiff@wiff` to pick up changes.\n\n### Releasing\n\nMerging a version bump to `main` automatically publishes the package to npm and then registers the same version with the MCP Registry. Keep the version aligned in:\n\n- `plugins/wiff/package.json`\n- `plugins/wiff/.codex-plugin/plugin.json`\n- `plugins/wiff/.claude-plugin/plugin.json`\n- `server.json` and its npm package entry\n\nThe release workflow fails before publishing if those values or the npm/MCP package names disagree. It is safe to re-run: versions that already exist in either registry are skipped.\n\nnpm publishing uses a trusted GitHub Actions publisher rather than a long-lived token. The one-time npm configuration for `@xxxoooxoxo/wiff` is repository `xxxoooxoxo/wiff`, workflow `release.yml`, with `npm publish` allowed. The MCP Registry also authenticates with GitHub OIDC and needs no repository secret.\n\n## License\n\n[MIT](LICENSE)\n",
  "bytes": 17955,
  "sha": "6dcbe963cb91e71fa450e964fdd62e33817efda7a0f61b0f00679c348afc876f",
  "repo_slug": "xxxoooxoxo/wiff",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_xxxoooxoxo_wiff_b22e03b2/readme"
}