Write down the outcome you want. Workflow Studio turns it into a visible, reviewable workflow graph of focused Codex stages, reusable skills, typed handoffs, revision loops, and human approval gates. Then it runs that workflow against your real local projects and keeps a full audit trail.
Quick start · How it works · Architecture · Commands · Docs
Running Codex directly works well for a one-off task. Teams need more than that when the same process has to run many times, on many projects, under the same rules. Workflow Studio wraps Codex in that lifecycle:
| 🧭 Plan from plain language | Describe a goal in your own words. Codex drafts a full workflow plan: nodes, prompts, skills, input/output contracts, and open questions to answer. |
| 🕸️ See and edit the graph | Workflows are typed directed graphs (codex, agent, tool, validation, approval, loop, fork, join, success, failure) that you can review and change before anything runs. |
| 🔁 Bounded revision loops | draft → review → revise → validate → approve cycles with explicit exit conditions and maximum iteration counts. |
| 🛂 Human gates that can't be skipped | Four separate lifecycle gates (draft, definition approval, project assignment, in-run approvals), so generated output never bypasses review. |
| 🧩 Reusable skills | Pinned skill instructions are matched to nodes, and missing skills are drafted per workflow for you to review. |
| ⚡ Parallel where it's safe | Explicit fork/join nodes and a concurrency budget run read-only branches side by side. Steps that write to the project always run alone. |
| 🔐 Your machine, your login | In paired mode a local companion runs Codex with your ChatGPT Codex login, inside allowed project roots. The server never collects an OpenAI API key or touches your files. |
| 🧾 Evidence for every run | Durable events, artifacts, transactional receipts, signed exports, and an immutable audit trail in PostgreSQL. |
It is domain-neutral: product planning is one editable example, not a built-in path.
- Node.js 24.15.x (pinned in
.nvmrc/.node-version) - PostgreSQL, either local or managed (for example Aiven). Workflow Studio creates its own schema on startup.
- A ChatGPT account with Codex access
npm install
Copy-Item .env.example .env.local # then set your PG* values
npm run db:check # confirm the database is reachablenpm run runtime:login
npm run devOpen http://localhost:3000 and describe your first workflow. 🎉
Tip:
npm run devruns in direct local mode: the server starts Codex App Server on the same machine. To try the per-user setup a deployed installation uses, setCODEX_RUNTIME_MODE=pairedand follow the companion guide.
PostgreSQL 17 and the app, in paired mode:
$env:PGPASSWORD = "choose-a-strong-password"
docker compose up --buildEvery workflow moves through four separate gates. Each one is a deliberate human decision.
flowchart LR
A["💬 Describe<br/>the outcome"] --> B["🧭 Codex drafts<br/>a workflow plan"]
B --> G1{{"Gate 1<br/>Save draft"}}
G1 --> C["🕸️ Review & edit<br/>the graph"]
C --> G2{{"Gate 2<br/>Approve definition"}}
G2 --> D["📁 Assign to a<br/>local project"]
D --> G3{{"Gate 3<br/>Approve assignment"}}
G3 --> E["⚙️ Durable run<br/>on Mastra"]
E --> G4{{"Gate 4<br/>In-run approvals"}}
G4 --> F["🧾 Artifacts, receipts<br/>& audit trail"]
- Plan. You describe what you want, with no project needed. A read-only Codex planning thread returns a structured
WorkflowPlanand drafts any skills that are missing. - Shape. You answer open questions, then edit nodes, edges, schemas, and skills in the graph editor.
- Approve and assign. You approve a reusable definition, then bind it to a specific project root with its own inputs, permissions, and overrides.
- Run. The assignment compiles into an immutable
CompiledWorkflowplus aHarnessV2Contract. Mastra runs it with durable checkpoints, route selection, retries, bounded loops, and approval pauses.
flowchart TB
subgraph Browser["🌐 Browser"]
UI["Workflow Studio UI<br/>(Next.js 16 · React 19)"]
end
subgraph CP["☁️ Control plane"]
API["REST + SSE API"]
Gov["Planning · Validation · Harness v2<br/>Auth · RBAC · Orgs"]
Mastra["Mastra workflow engine"]
end
PG[("🐘 PostgreSQL<br/>state · snapshots · audit")]
subgraph Local["💻 Your workstation"]
Comp["Local runtime companion"]
Codex["Codex App Server"]
Home["~/WorkflowStudio<br/>projects · skills · Codex login"]
end
UI <-->|HTTPS + SSE| API
API --> Gov <--> Mastra
Mastra <--> PG
API <--> PG
Comp <-->|outbound HTTPS only| API
Comp <-->|JSON-RPC over stdio| Codex
Codex <-->|sandboxed access| Home
| Mode | Set with | What happens |
|---|---|---|
| Direct local | CODEX_RUNTIME_MODE=local (dev default) |
The Next.js server starts Codex App Server itself and falls back to the Codex CLI if the provider fails. |
| Paired companion | CODEX_RUNTIME_MODE=paired (production default) |
Each user pairs their own computer with a single-use code. The companion takes only that user's jobs, runs Codex locally, keeps file access inside allowed project roots, and sends action approval requests back to the UI. |
Harness v2 wraps every run in six layers of governance: identity, runtime sandboxing, observability, verification contracts, human-approved adaptation, and security/audit.
Full details are in ARCHITECTURE.md.
| Layer | Technology |
|---|---|
| Web app and API | Next.js 16 (App Router), React 19, TypeScript |
| Orchestration | Mastra (@mastra/core, @mastra/pg) |
| Agent runtime | OpenAI Codex (@openai/codex): App Server over stdio, CLI fallback |
| Persistence | PostgreSQL (local, or Aiven with TLS) |
| Contracts | Zod + JSON Schema |
| Local companion | Standalone Next.js app with bundled portable Node |
| Quality | Vitest, PGlite (in-memory Postgres), ESLint |
| Command | What it does |
|---|---|
npm run dev |
Start the dev server on localhost:3000 |
npm run runtime:login |
Sign the local Codex runtime in to your ChatGPT account |
npm run typecheck · lint · test · build |
The full verification suite |
npm run db:check · db:verify |
Check connectivity · check schema, indexes, migrations, and audit triggers |
npm run db:backup · db:restore |
Back up or restore with pg_dump (db:restore -- --file <dump> --confirm) |
npm run companion:build · companion:package |
Build the companion · bundle it with portable Node into a release ZIP |
npm run launch:check |
Launch preflight checks |
npm run load:smoke · qualify:runtime |
Load smoke test · runtime reliability qualification |
npm run retention:check · retention:enforce |
Preview or apply data retention schedules |
Run these before every change:
npm run typecheck; npm run lint; npm test; npm run buildEnd users get a ZIP with portable Node and npm included, so there's nothing to install system-wide. Extract it, open PowerShell in the folder, and run:
& ".\app\tools\node\node.exe" ".\start.cjs"Setup runs automatically, and the BAT launchers are optional. Companion 0.2.0 saves results durably before delivery and replays them after interruptions. More in companion distribution and runtime reliability and parallel execution.
All settings are documented in .env.example. The ones you'll touch most:
| Variable | Purpose |
|---|---|
PGHOST · PGPORT · PGUSER · PGPASSWORD · PGDATABASE |
PostgreSQL connection (or use DATABASE_URL instead) |
PGSSL_MODE · PGSSL_CA_FILE |
TLS: disable locally, verify-ca plus a CA file for Aiven |
CODEX_RUNTIME_MODE |
local (direct) or paired (companion) |
WORKFLOW_STUDIO_HOME |
Dedicated folder for projects, skills, and Codex login (the global CODEX_HOME is ignored) |
WORKFLOW_STUDIO_ENFORCE_ROLE_GATES |
Turn on role-based governance in production |
WORKFLOW_STUDIO_BOOTSTRAP_ADMIN_EMAILS |
Addresses that get administrator rights on signup |
WORKFLOW_STUDIO_COMPANION_CONCURRENCY |
Local worker capacity (maximum 10) |
src/
app/ Next.js pages and API routes (workflows, runs, skills, studio, auth)
domain/ Planning, graph validation, lifecycle policy, runtime engine, parallel runner
adapters/ Codex App Server / CLI, Mastra, and paired-runtime adapters
auth/ Sessions, RBAC, organizations
server/ Event streams, run coordinator, rate limits, redaction
storage/ PostgreSQL persistence
companion/ Standalone local runtime companion
scripts/ Database, packaging, qualification, and runtime CLIs
tests/ Vitest suite
docs/ Operations, deployment, and security guides
plan/ Phase-by-phase delivery plan and reports
| Guide | Covers |
|---|---|
| ARCHITECTURE.md | Complete system and architecture reference |
| Database setup | Local PostgreSQL and Aiven |
| Local runtime companion | Paired mode and pairing flow |
| Companion distribution | Building, signing, and shipping the companion ZIP |
| Runtime reliability and parallel execution | Fork/join, concurrency, recovery, upgrades |
| Deployment | Running the control plane in production |
| Company launch runbook | Roles, production settings, load tests, launch gates |
| Operations runbook | Day-two operations |
| Security threat model | Trust boundaries and mitigations |
| requirements.md · plan/ | Product requirements and delivery status |
Proprietary. All rights reserved. See LICENSE.
Workflow Studio keeps agent work repeatable, reviewable, and auditable.