39 KiB
Task Orchestration, Bounded Parallelism, and Curated CCGS Adaptation Implementation Plan
For Hermes: Use subagent-driven-development skill to implement this plan task-by-task.
Goal: Add explicit local task orchestration with bounded parallel execution, and adapt the useful Claude Code Game Studios (CCGS) role/skill/workflow surface into Open Game Studio without importing Claude-specific machinery or unbounded orchestration.
Architecture: Keep Open Game Studio local-first and Codex-native. Extend the existing .codex/tasks.json, .codex/runs/**, role packages, workflow registry, template registry, approvals, and validation systems. Orchestration is a foreground CLI command that plans, locks, executes, verifies, reviews, and records bounded task runs; it is not a daemon, hosted scheduler, hidden planner, or generic workflow DAG engine.
Tech Stack: TypeScript ESM on Node 24, Commander CLI, Vitest, existing Codex runtime, existing project validation, Truthmark-backed docs.
1. Product Boundary Decisions
1.1 In scope
opengamestudio task orchestrate --project <path>as the primary orchestration entrypoint.- Bounded task DAG execution using explicit task dependencies.
- Bounded parallelism with an explicit
--max-concurrencyflag and a hard product cap. - Local reviewable state in
.codex/tasks.json,.codex/locks/**, and.codex/runs/<run-id>/**. - Existing Codex role execution, approval gates, sandbox/write policy, verification, review, and fix-pass behavior reused per task.
- Curated CCGS adaptation as Codex-native roles, workflow recipes, templates, and optional project-local
custom-*overlays.
1.2 Out of scope
- Hosted orchestration, accounts, remote queues, remote artifact storage, billing, or server-side scheduling.
- Background autonomous loops or daemon workers.
- Unbounded parallelism.
- Hidden planner/
nextcommand behavior. - Generated
CODEX.md,.gamestudio/**,project_orchestrator.md, or Claude hook/skill runtime compatibility. - General workflow DAGs unrelated to game-studio tasks.
1.3 Closed decisions
- Default concurrency is serial.
task orchestratedefaults to--max-concurrency 1. - Parallelism is opt-in and capped. The first implementation allows
--max-concurrency 1..3; values above3fail with a clear error. - Parallel mutating tasks require declared write sets. A task without declared
writeFilesuses a conservative project-wide write lock when file edits are allowed. - No separate scheduler process. Orchestration runs in the current foreground CLI process and exits when the bounded run completes.
- No hidden task generation. CCGS workflow adaptation may create task graphs only through explicit commands that show the planned tasks before writing or executing them.
- CCGS adaptation is curated, not mirrored. Use CCGS as source material, but translate into existing Codex-native IDs, bounded context selection, and Open Game Studio's role/workflow/template contracts.
1.4 Review follow-up constraints
- Orchestration planning/preflight must be side-effect-free. Do not call any API path that writes
.codex/runs/**,.codex/tasks.json, or.codex/locks/**before approvals, dependency validation, and lock planning pass. - The orchestrator must serialize all
.codex/tasks.jsonwrites during parallel execution. - In the first implementation,
writeFilesare normalized literal project-relative file paths only. Reject globs, directories,.git, escaping paths, and control characters. - Approval matching for mutating task runs is based on
writeFiles;filesare read/context inputs only.
2. Current Repository Baseline
Relevant existing files:
src/tasks.tsowns.codex/tasks.json, task creation, task status updates, andtask runintegration.src/runner.tsowns role-run preparation, prompt cache metadata, Codex execution, verification, review, and fix passes.src/codex-runtime.tsowns Codex CLI command construction and availability checks.src/cli.tsexposesrun,task create,task run, workflow shortcuts, approvals, templates, and validation.src/roles.tscontains built-in Codex role packages.src/workflows.tscontains prompt-only workflow registry entries.src/templates.tscontains package template registry and selection.src/customization.tsvalidates extend-only project-localcustom-*roles, workflows, and templates.src/validation.tsvalidates repo/package/project behavior and future-only surfaces.tests/tasks.test.ts,tests/runner.test.ts,tests/codex-runtime.test.ts,tests/functionality-gap-pass.test.ts,tests/customization.test.ts, andtests/validation.test.tsare the main test anchors.
Current constraints to preserve:
- Every relative TypeScript import must use emitted
.jsspecifiers. run <role>remains the primary single-role Codex execution path.--dry-runand--print-promptremain inspection-only.- Workflow shortcuts remain render-only unless explicitly converted into task-graph creation commands.
- Unknown legacy CCGS underscore role IDs remain invalid public role IDs.
3. Task Data Model
3.1 Upgrade .codex/tasks.json to schema version 2
Modify src/tasks.ts types and parser so schema v1 stores still read and normalize into schema v2 in memory.
export type StudioTaskStatus = "ready" | "running" | "blocked" | "done" | "cancelled" | "skipped";
export type StudioTaskDependency = {
taskId: string;
requiredStatus: "done";
};
export type StudioTaskRunPolicy = {
maxFixPasses?: number;
review?: boolean;
constrainedSandbox?: boolean;
};
export type StudioTask = {
id: string;
title: string;
role: StudioRoleId;
status: StudioTaskStatus;
files: string[];
writeFiles: string[];
dependencies: StudioTaskDependency[];
workflowId?: string;
groupId?: string;
priority: number;
verification?: VerificationCommand;
runPolicy?: StudioTaskRunPolicy;
notes: string[];
createdAt: string;
updatedAt: string;
lastRunId?: string;
};
export type TaskStore = {
schemaVersion: 2;
tasks: StudioTask[];
};
3.2 Migration behavior
- Existing schema v1 task fields map as:
filesremains selected read/context files.writeFilesbecomes[].dependenciesbecomes[].prioritybecomes0.createdAtandupdatedAtbecome a deterministic migration timestamp only when the store is rewritten.
readTaskStore()may return normalized v2 data without rewriting.writeTaskStore()always writes schema v2.- Missing
writeFilesmeans parallel mutating execution falls back to project-wide lock, not unsafe optimism.
3.3 Task creation CLI additions
Extend task create:
opengamestudio task create --project projects/demo \
--role gameplay-programmer \
--file documentation/design/gdd.md \
--write-file source/project-demo/player.gd \
--depends-on task-001 \
--workflow vertical-slice \
--priority 10 \
--verify-command npm --verify-arg run --verify-arg validate --verify-arg -- --verify-arg --project --verify-arg projects/demo \
"Implement player jump"
Rules:
--fileis context/read input.--write-fileis declared mutation scope and lock input.--depends-onmay repeat.--workflowrecords source workflow ID but does not imply hidden execution.- Unknown dependencies fail before writing.
- Cycles are checked when orchestrating, not when creating one task, so users can assemble a graph incrementally.
4. Orchestration State and Locking
4.1 Run directory
Each orchestration invocation creates:
.codex/runs/<orchestration-run-id>/
orchestration.json
events.jsonl
tasks/<task-id>/
prompt.md
metadata.json
output.txt
orchestration.json records:
type OrchestrationRunMetadata = {
schemaVersion: 1;
product: "codex-game-studio";
runId: string;
startedAt: string;
finishedAt?: string;
projectRoot: string;
maxConcurrency: number;
requestedTaskIds: string[];
selectedTaskIds: string[];
dryRun: boolean;
review: boolean;
fix: boolean;
status: "planned" | "running" | "done" | "blocked" | "cancelled";
summary: Array<{ taskId: string; status: StudioTaskStatus; runPath?: string; reason?: string }>;
};
events.jsonl appends deterministic event records:
orchestration.startedtask.eligibletask.lockedtask.startedtask.finishedtask.blockedtask.skippedtask.unlockedorchestration.finished
4.2 Lock files
Use a reviewable lock directory:
.codex/locks/
<lock-key>.json
Lock file shape:
type TaskLock = {
schemaVersion: 1;
lockKey: string;
taskId: string;
orchestrationRunId: string;
role: string;
writeFile: string;
acquiredAt: string;
expiresAt: string;
releasedAt?: string;
};
Implementation details:
- Derive
lockKeyfrom canonical project-relative write path or conservative key__project_write__. - Acquire with exclusive create (
fs.openSync(path, "wx")) so concurrent CLI processes cannot silently share a write lock. - Release by rewriting the lock with
releasedAtand then removing it. - If a stale lock exists past
expiresAt, fail closed first; add a later explicittask lock cleanupcommand only after the basic orchestrator is stable. - Read-only tasks do not acquire write locks.
- Mutating tasks with no
writeFilesacquire__project_write__, making them serial with all other mutating tasks.
4.3 Conflict rules
Two tasks may run together only when all are true:
- Both have all dependencies satisfied.
- Neither is
running,done,cancelled, orskipped. - Their required approval/write-policy checks pass.
- Their lock sets do not conflict.
- The current running count is below
maxConcurrency. - They do not require the conservative project-wide write lock at the same time as any other mutating task.
5. Orchestration Engine
Create src/orchestrator.ts.
Core API:
export type OrchestrateOptions = {
project: string;
taskIds?: string[];
workflowId?: string;
maxConcurrency?: number;
dryRun?: boolean;
review?: boolean;
fix?: boolean;
maxFixPasses?: number;
approvedByUser?: boolean;
constrainedSandbox?: boolean;
approvalScope?: string[];
codexBin?: string;
};
export type OrchestrationResult = {
runId: string;
status: "planned" | "done" | "blocked";
selectedTaskIds: string[];
startedTaskIds: string[];
blockedTaskIds: string[];
skippedTaskIds: string[];
output: string;
};
export async function orchestrateTasks(options: OrchestrateOptions): Promise<OrchestrationResult>;
Algorithm:
- Resolve project root.
- Read and normalize task store.
- Select tasks:
- explicit
taskIdsif provided; - else tasks matching
workflowIdif provided; - else all
readytasks.
- explicit
- Validate graph:
- no unknown dependencies;
- no cycles among selected tasks and their required dependencies;
- no selected task depends on a
blocked,cancelled, orskippedtask unless user explicitly selected only downstream dry-run inspection; - no concurrency above hard cap.
- Prepare every selected task using
prepareRun()before starting any non-dry run. - In strict/guided modes, fail closed before starting any task if required approvals are missing.
- For dry-run, print planned waves, lock sets, selected context, Codex command previews, and approval diagnostics; write no task/runs/locks state.
- For execution:
- mark orchestrator run as
running; - compute ready wave;
- acquire locks for up to
maxConcurrencytasks; - start Codex lifecycle for each task;
- stream or buffer task output into per-task run output;
- update task status to
doneorblocked; - release locks;
- recompute ready wave until no runnable tasks remain.
- mark orchestrator run as
- Tasks whose dependencies cannot be satisfied because another task blocked become
skippedwith a note naming the blocker. - Final orchestrator status is
doneonly if every selected task isdone; otherwiseblocked.
6. Codex Runtime Changes for Parallelism
Current executeRunLifecycle() is async but calls synchronous Codex spawning. Parallel orchestration needs real asynchronous execution.
Modify src/codex-runtime.ts to add:
export async function executeCodexCommand(
command: { command: string; args: string[] },
input: string,
options: { cwd: string; timeoutMs?: number }
): Promise<CodexExecutionResult>;
Modify src/runner.ts:
- Keep sync helpers only for tests or deprecate them internally.
- Update implementation, review, and fix pass execution to use the async function.
- Preserve existing output formatting and final status semantics.
- Add timeout support later only if a concrete test requires it; do not add global scheduler timeouts in the first pass.
Testing requirement:
- Use fake Codex binaries that sleep and write deterministic output to prove
--max-concurrency 2completes faster than serial without relying on real Codex. - Do not call hosted LLMs in tests.
7. CLI Design
7.1 New command
opengamestudio task orchestrate --project <path> [task-id...]
Options:
--workflow <workflow-id> select ready tasks from one workflow/group
--max-concurrency <count> default 1, allowed 1..3
--dry-run show plan, locks, approvals, and commands; no mutation
--review run per-task review pass
--fix run bounded per-task fix passes
--max-fix-passes <count> reuse existing task run behavior
--approval-scope <glob> repeatable diagnostic/approval scope
--approved-by-user guided-studio local override
--constrained-sandbox use workspace-write instead of full-access sandbox
Examples:
opengamestudio task orchestrate --project projects/demo --dry-run
opengamestudio task orchestrate --project projects/demo --max-concurrency 2 --review --fix
opengamestudio task orchestrate --project projects/demo --workflow vertical-slice --max-concurrency 2
opengamestudio task orchestrate --project projects/demo task-001 task-002 task-003 --dry-run
7.2 Help surface guardrails
- Help may mention
orchestrateand--max-concurrency. - Help must not expose
next,telemetry, hosted orchestration, daemon mode, or unbounded parallel options. - Existing future-surface guard tests should be updated from "no parallel at all" to "no unbounded/hosted/background parallelism".
8. Workflow-to-Task Recipes
Prompt-only workflows should remain prompt-only. Add explicit recipe commands for workflows that should produce task graphs.
Create src/workflow-recipes.ts.
export type WorkflowTaskRecipe = {
workflowId: WorkflowId | string;
title: string;
tasks: Array<{
title: string;
role: StudioRoleId;
files: string[];
writeFiles: string[];
dependencies: string[]; // local recipe keys, not final task IDs
verification?: VerificationCommand;
}>;
};
Add CLI:
opengamestudio workflow create-tasks <workflow-id> --project <path> --dry-run
opengamestudio workflow create-tasks <workflow-id> --project <path>
Rules:
--dry-runprints proposed tasks and dependency graph, writes nothing.- Non-dry writes tasks to
.codex/tasks.jsonwithworkflowIdandgroupId. - Recipe-local dependency keys are resolved to real task IDs after creation.
- The command does not run Codex. Users run
task orchestrateexplicitly.
Initial recipe set:
vertical-slice- producer plans slice
- game-designer writes acceptance/spec detail
- gameplay-programmer implements core loop
- technical-artist or sound-designer handles asset/audio hook if declared
- qa-playtester reviews and verifies
bugfix- qa-playtester reproduces/records expected behavior
- gameplay-programmer fixes
- qa-playtester verifies
ui-ux-review- ui-ux-designer reviews flow
- ui-programmer implements bounded UI fix if needed
- accessibility-specialist reviews accessibility gaps
release-checklist- qa-playtester validates evidence
- performance-analyst checks performance risks
- security-engineer checks release/security risks
- release-manager synthesizes ship/no-ship
Do not create all CCGS team workflows in the first pass. Add recipes only when their lock/dependency/write-set behavior is obvious and testable.
9. Curated CCGS Adaptation Design
9.1 Source inventory
Reference source inspected for this design:
Donchitos/Claude-Code-Game-Studios.claude/agents: 49 Claude agents.claude/skills: 73 Claude skills.claude/hooks: Claude hook runtime files.claude/rules: Claude-specific rule files
Important translation principle: CCGS is a rich reference library, not an implementation contract. Open Game Studio adapts outcomes into local Codex-native primitives.
9.2 Role adaptation policy
Role decisions use four categories:
| Decision | Meaning |
|---|---|
built-in-existing |
Already represented by an Open Game Studio role package. Improve prompt depth only if tests show a gap. |
built-in-add |
Add a new canonical hyphenated Open Game Studio role. |
specialty-context |
Do not add a role; adapt as engine/module/plugin reference context selected by task keywords. |
custom-pack-example |
Keep as project-local custom-* example or docs, not built-in product surface. |
9.3 CCGS role mapping
| CCGS role | Open Game Studio target | Decision |
|---|---|---|
producer |
producer |
built-in-existing |
creative-director |
creative-director |
built-in-existing |
game-designer |
game-designer / senior-game-designer |
built-in-existing |
systems-designer |
systems-designer |
built-in-existing |
economy-designer |
economy-designer |
built-in-existing |
level-designer |
level-designer |
built-in-existing |
world-builder |
world-builder |
built-in-existing |
writer |
writer |
built-in-existing |
gameplay-programmer |
gameplay-programmer |
built-in-existing |
ai-programmer |
ai-programmer |
built-in-existing |
network-programmer |
network-programmer |
built-in-existing |
ui-programmer |
ui-programmer |
built-in-existing |
engine-programmer |
engine-programmer |
built-in-existing |
tools-programmer |
tools-programmer |
built-in-existing |
technical-director |
technical-director |
built-in-existing |
devops-engineer |
devops-engineer |
built-in-existing |
security-engineer |
security-engineer |
built-in-existing |
performance-analyst |
performance-analyst |
built-in-existing |
technical-artist |
technical-artist |
built-in-existing |
audio-director |
audio-director |
built-in-existing |
sound-designer |
sound-designer |
built-in-existing |
accessibility-specialist |
accessibility-specialist |
built-in-existing |
localization-lead |
localization-lead |
built-in-existing |
live-ops-designer |
live-ops-designer |
built-in-existing |
community-manager |
community-manager |
built-in-existing |
release-manager |
release-manager |
built-in-existing |
godot-specialist |
active-engine godot-specialist |
built-in-existing |
unity-specialist |
active-engine unity-specialist |
built-in-existing |
unreal-specialist |
active-engine unreal-specialist |
built-in-existing |
analytics-engineer |
data-scientist plus analytics templates |
built-in-existing, prompt-depth improvement |
art-director |
senior-game-artist plus art-direction workflow |
built-in-existing, maybe rename not needed |
narrative-director |
narrative-designer plus world-builder |
built-in-existing, prompt-depth improvement |
ux-designer |
ui-ux-designer |
built-in-existing |
qa-lead |
add qa-lead only if QA planning/release strategy needs a separate owner |
built-in-add candidate |
qa-tester |
qa-playtester; maybe add qa-tester later for test-case execution |
defer unless tests show split needed |
lead-programmer |
add lead-programmer if technical-director is too broad for code review/refactor ownership |
built-in-add candidate |
prototyper |
keep as prototype workflow/recipe, not role |
specialty workflow |
| Godot sub-specialists | engine references selected by task keywords | specialty-context |
| Unity sub-specialists | engine references selected by task keywords | specialty-context |
| Unreal sub-specialists | engine references selected by task keywords | specialty-context |
First role additions, if any, should be only:
lead-programmer— code architecture, code review, refactor strategy, programming work assignment.qa-lead— QA strategy, bug triage, test plan ownership, release quality gates.
Do not add every engine sub-specialist as a first-class role. Use active-engine references and templates instead.
9.4 CCGS skill adaptation policy
Do not generate .claude/skills or implement a Claude skill runtime. Convert CCGS skills into one of these Open Game Studio surfaces:
| CCGS skill kind | Open Game Studio surface |
|---|---|
| Planning or review skill | built-in workflow prompt or workflow task recipe |
| Structured output document | package template |
| Team coordination skill | explicit workflow task recipe with dependencies |
| Maintenance skill for Claude skills/hooks | out of scope or project-local example only |
| Hook/rule-driven behavior | explicit CLI option, validation check, or docs; never hidden hook behavior |
9.5 Initial CCGS skill decisions
Already covered or mostly covered:
architecture-decision→ existing workflow/template.architecture-review→ existing workflow/template.brainstorm→ existing workflow.bug-triage/bug-report→bugfixworkflow plus future bug-report template if needed.create-epics→ existing workflow.create-stories→ existing workflow.hotfix→ existing workflow.onboard/start→ existing workflow aliases.perf-profile→ existing workflow.playtest-report→playtestworkflow/template.prototype→ existing workflow, future task recipe.qa-plan→ existing workflow/template.regression-suite→ existing workflow.release-checklist/launch-checklist→ existing release workflow; add alias if needed.security-audit→ existing workflow.sprint-plan→ existing workflow.sprint-status→ existing workflow.story-readiness→ existing workflow.story-done→ existing workflow.ux-review→ui-ux-reviewworkflow.vertical-slice→ existing workflow, future task recipe.
High-value additions:
gate-check→ new workflow for stage readiness verdict.project-stage-detect→ new read-only workflow for repo state audit and recommended next action.scope-check→ new workflow/template for scope risk and feature cut decisions.estimate→ new producer workflow/template for rough schedule/complexity estimates.tech-debt→ new lead-programmer or technical-director workflow/template.smoke-check→ new QA/release workflow with minimal validation checklist.test-evidence-review→ new QA workflow for evidence completeness.asset-audit→ new technical-artist/senior-game-artist workflow/template.asset-spec→ new art-direction template/workflow.balance-check→ new systems/economy design workflow.map-systems→ new systems-design workflow/template.reverse-document→ new documentation workflow that derives missing docs from implementation.propagate-design-change→ new architecture/design impact workflow using traceability docs.create-control-manifest→ new technical-director workflow/template after ADRs are accepted.ux-design→ new UI/UX design workflow distinct from review.
Team skills become recipes, not prompt-only aliases:
team-combat→ game-designer → gameplay-programmer/ai-programmer/sound-designer → qa-playtester.team-ui→ ui-ux-designer → ui-programmer → accessibility-specialist → qa-playtester.team-audio→ audio-director → sound-designer/technical-artist → gameplay-programmer integration → qa-playtester.team-qa→ qa-lead/qa-playtester split, ifqa-leadis added.team-release→ release-manager with QA/perf/security dependencies.team-polish→ producer/creative-director triage plus focused UI/audio/perf/QA tasks.team-live-ops→ live-ops-designer/community-manager/data-scientist/release-manager sequence.team-narrative→ narrative-designer/world-builder/writer/localization-lead sequence.team-level→ level-designer/gameplay-programmer/technical-artist/qa-playtester sequence.
Defer or keep out of product:
adopt,help,skill-improve,skill-test,test-helpersas Claude-skill maintenance concepts.- Claude hook/rule-only mechanics unless translated into explicit validation or CLI flags.
- Any CCGS skill that depends on persistent Claude memory or hidden hooks.
10. Implementation Tasks
Task 1: Add task schema v2 tests
Objective: Lock the task-store migration contract before changing implementation.
Files:
- Modify:
tests/tasks.test.ts - Later modify:
src/tasks.ts
Steps:
- Add a test that writes a schema v1
.codex/tasks.jsonand expectsreadTaskStore()to return schema v2 with empty dependencies/writeFiles and valid timestamps. - Add a test that
writeTaskStore()writesschemaVersion: 2. - Run:
npx vitest run tests/tasks.test.ts -t "task store" - Expected before implementation: failure because schema v2 is not implemented.
Task 2: Implement task schema v2 normalization
Objective: Support old task stores while writing the new shape.
Files:
- Modify:
src/tasks.ts - Modify:
tests/tasks.test.ts
Steps:
- Update task types.
- Add normalization helpers.
- Preserve v1 parsing behavior.
- Ensure status validation accepts
cancelledandskipped. - Run:
npx vitest run tests/tasks.test.ts - Expected: pass.
Task 3: Extend task creation CLI
Objective: Let users declare dependencies, context files, write files, workflow/group metadata, and priority.
Files:
- Modify:
src/tasks.ts - Modify:
src/cli.ts - Modify:
tests/tasks.test.ts - Modify:
tests/cli-prompt-surface.test.tsif CLI help assertions need updates.
Steps:
- Add
createTask()input fields. - Add
--file,--write-file,--depends-on,--workflow, and--priorityoptions. - Validate project-safe relative paths using the same path rules used by customizations/context selection.
- Test duplicate dependencies and unknown dependency IDs.
- Run:
npx vitest run tests/tasks.test.ts tests/cli-prompt-surface.test.ts
Task 4: Add asynchronous Codex execution
Objective: Make parallel execution possible without blocking the event loop on spawnSync.
Files:
- Modify:
src/codex-runtime.ts - Modify:
src/runner.ts - Modify:
tests/codex-runtime.test.ts - Modify:
tests/runner.test.ts
Steps:
- Add
executeCodexCommand()usingnode:child_processspawn. - Preserve
CodexExecutionResultshape. - Update implementation/review/fix passes to await async execution.
- Keep current output formatting unchanged.
- Run:
npx vitest run tests/codex-runtime.test.ts tests/runner.test.ts
Task 5: Add lock acquisition tests
Objective: Define lock behavior before implementation.
Files:
- Create:
tests/orchestrator-locks.test.ts - Create later:
src/orchestrator-locks.ts
Steps:
- Test two tasks with disjoint
writeFilescan both acquire locks. - Test overlapping write file lock acquisition fails for the second task.
- Test missing
writeFilesuses__project_write__. - Test released locks are removed or marked released according to final implementation choice.
- Run:
npx vitest run tests/orchestrator-locks.test.ts - Expected before implementation: failure because module does not exist.
Task 6: Implement lock store
Objective: Provide atomic file-backed locks for bounded parallel execution.
Files:
- Create:
src/orchestrator-locks.ts - Modify:
tests/orchestrator-locks.test.ts
Steps:
- Implement canonical lock key generation.
- Implement exclusive lock creation with
fs.openSync(path, "wx"). - Implement release cleanup.
- Implement stale lock diagnostics but do not auto-clean stale locks yet.
- Run:
npx vitest run tests/orchestrator-locks.test.ts
Task 7: Add orchestration graph tests
Objective: Define dependency selection, cycle detection, and skipped-task behavior.
Files:
- Create:
tests/orchestrator.test.ts - Create later:
src/orchestrator.ts
Steps:
- Test ready tasks with dependencies are ordered in waves.
- Test cycle detection fails before mutation.
- Test a blocked dependency causes downstream tasks to become
skipped. - Test
--max-concurrency 4fails because first cap is 3. - Run:
npx vitest run tests/orchestrator.test.ts
Task 8: Implement dry-run orchestration planning
Objective: Add orchestrateTasks() dry-run mode without mutation.
Files:
- Create:
src/orchestrator.ts - Modify:
src/tasks.tsif helper exports are needed. - Modify:
tests/orchestrator.test.ts
Steps:
- Implement task selection.
- Implement dependency graph validation.
- Implement wave planning.
- Reuse
prepareRun()to show eligibility and commands. - Assert dry-run writes no
.codex/runs/**, locks, or task status changes. - Run:
npx vitest run tests/orchestrator.test.ts
Task 9: Implement serial orchestration execution
Objective: Make maxConcurrency: 1 execute selected tasks safely.
Files:
- Modify:
src/orchestrator.ts - Modify:
tests/orchestrator.test.ts
Steps:
- Create orchestration run directory.
- Write
orchestration.jsonand appendevents.jsonl. - Execute tasks one at a time using
executeTaskRun()or a shared lower-level lifecycle helper. - Update task status and
lastRunId. - Mark downstream tasks skipped when blockers occur.
- Run:
npx vitest run tests/orchestrator.test.ts tests/tasks.test.ts
Task 10: Implement bounded parallel orchestration
Objective: Execute non-conflicting ready tasks concurrently up to the cap.
Files:
- Modify:
src/orchestrator.ts - Modify:
tests/orchestrator.test.ts
Steps:
- Start ready tasks in batches constrained by lock availability and
maxConcurrency. - Await task promises with failure isolation.
- Release locks in
finallyblocks. - Add fake Codex sleep tests proving concurrency without hosted calls.
- Run:
npx vitest run tests/orchestrator.test.ts
Task 11: Add CLI command
Objective: Expose orchestration through opengamestudio task orchestrate.
Files:
- Modify:
src/cli.ts - Modify:
tests/cli-prompt-surface.test.ts - Modify:
tests/functionality-gap-pass.test.ts
Steps:
- Add command and options.
- Print dry-run wave plan and execution summary.
- Set nonzero exit code when orchestrator status is blocked.
- Update future-surface tests so
parallelis not blanket-forbidden, but hosted/unbounded/background surfaces remain forbidden. - Run:
npx vitest run tests/cli-prompt-surface.test.ts tests/functionality-gap-pass.test.ts
Task 12: Add workflow recipe tests
Objective: Define explicit workflow-to-task creation without hidden execution.
Files:
- Create:
tests/workflow-recipes.test.ts - Create later:
src/workflow-recipes.ts
Steps:
- Test
vertical-slicedry-run prints proposed tasks and dependencies without writing. - Test non-dry creates tasks with
workflowId,groupId, dependencies, files, and writeFiles. - Test recipe creation does not call Codex.
- Run:
npx vitest run tests/workflow-recipes.test.ts
Task 13: Implement initial workflow recipes
Objective: Add task graph creation for a small high-value workflow set.
Files:
- Create:
src/workflow-recipes.ts - Modify:
src/cli.ts - Modify:
tests/workflow-recipes.test.ts
Steps:
- Implement
vertical-slice,bugfix,ui-ux-review, andrelease-checklistrecipes. - Add
workflow create-tasks <workflow-id>CLI. - Keep workflow shortcut commands render-only.
- Run:
npx vitest run tests/workflow-recipes.test.ts tests/functionality-gap-pass.test.ts
Task 14: Add CCGS adaptation registry tests
Objective: Make the curated CCGS adaptation decisions executable and reviewable.
Files:
- Create:
tests/ccgs-adaptation.test.ts - Create later:
src/ccgs-adaptation.ts
Steps:
- Test every listed CCGS role has an adaptation decision.
- Test no legacy underscore role IDs become built-in role IDs.
- Test high-value skill additions are categorized as workflow/template/recipe/deferred.
- Run:
npx vitest run tests/ccgs-adaptation.test.ts
Task 15: Implement CCGS adaptation registry
Objective: Record curated adaptation decisions in code, not only docs.
Files:
- Create:
src/ccgs-adaptation.ts - Modify:
tests/ccgs-adaptation.test.ts - Modify:
src/validation.tsif validation should report registry coverage.
Steps:
- Add role decision table.
- Add skill decision table.
- Add helper functions for reporting unmapped/high-value candidates.
- Optionally add validation diagnostics for registry consistency.
- Run:
npx vitest run tests/ccgs-adaptation.test.ts tests/validation.test.ts
Task 16: Add first curated roles only if justified
Objective: Add no more than lead-programmer and qa-lead as built-ins if tests show current roles cannot own those workflows cleanly.
Files:
- Modify:
src/roles.ts - Modify:
src/config.ts - Modify:
src/agents.tsif generated prompt coverage changes. - Modify:
tests/roles.test.ts - Modify:
tests/functionality-gap-pass.test.ts
Steps:
- Add failing tests for role package presence and active-role selection.
- Add role packages with concise responsibilities, expected outputs, quality gates, and handoff templates.
- Do not add engine sub-specialist roles.
- Run:
npx vitest run tests/roles.test.ts tests/functionality-gap-pass.test.ts
Task 17: Add high-value CCGS-derived workflows/templates
Objective: Fill real workflow gaps without importing all CCGS skills.
Files:
- Modify:
src/workflows.ts - Modify:
src/templates.ts - Add package templates under
templates/only where structured output is needed. - Modify:
tests/functionality-gap-pass.test.ts - Modify:
tests/agents-templates.test.ts
Steps:
- Add only the first batch:
gate-check,project-stage-detect,scope-check,estimate,tech-debt,smoke-check,test-evidence-review,asset-audit,balance-check,map-systems,ux-design. - Add templates only for workflows that need durable structured artifacts.
- Keep template selection bounded.
- Run:
npx vitest run tests/functionality-gap-pass.test.ts tests/agents-templates.test.ts
Task 18: Update validation and future-surface guards
Objective: Validate orchestration without allowing hosted/unbounded drift.
Files:
- Modify:
src/validation.ts - Modify:
src/behavioral-evaluation.ts - Modify:
tests/validation.test.ts - Modify:
tests/behavioral-evaluation.test.ts
Steps:
- Add validation checks for task schema v2, orchestration command availability, lock directory safety, and recipe registry consistency.
- Update forbidden drift phrases to forbid hosted/background/unbounded orchestration, not explicit local bounded orchestration.
- Add absence checks for daemon/hosted/unbounded CLI/help/config surfaces.
- Run:
npx vitest run tests/validation.test.ts tests/behavioral-evaluation.test.ts
Task 19: Update docs and generated truth surfaces
Objective: Keep product docs, architecture docs, and Truthmark docs in sync with implemented behavior.
Files:
- Modify:
README.md - Modify:
docs/development-rules.md - Modify:
docs/known-upstream-differences.md - Modify:
docs/migration-from-claude.md - Modify:
docs/workflow-validation.md - Modify:
docs/architecture/flows/role-run-lifecycle.md - Create:
docs/architecture/flows/task-orchestration.md - Modify relevant
docs/truthmark/**docs after code behavior lands.
Steps:
- Document
task orchestrateandworkflow create-tasksexamples. - Document bounded parallelism cap and lock behavior.
- Document CCGS adaptation as curated translation, not parity-by-copying.
- Run Truthmark refresh only if
truthmark checkreports stale surfaces:npx truthmark check npx truthmark index
Task 20: Full verification
Objective: Prove the feature works and product boundaries remain intact.
Run:
npm run typecheck
npm run build
npm test
npm run validate
npx truthmark check
npx truthmark index
git diff --check
Expected:
- Typecheck passes.
- Build passes.
- Tests pass.
- Validation reports bounded local orchestration as implemented.
- Validation still reports hosted/background/unbounded orchestration surfaces absent.
- Truthmark check/index pass.
- Diff has no whitespace errors.
11. Acceptance Criteria
Implementation is complete when all are true:
- Existing
task runbehavior remains compatible. - Schema v1 task stores still read correctly.
task createsupports dependencies, read files, write files, workflow IDs, and priority.task orchestrate --dry-runwrites no files and prints task waves, lock sets, approvals, and commands.task orchestrateserial mode runs ready tasks in dependency order.task orchestrate --max-concurrency 2runs non-conflicting tasks concurrently in tests.- Conflicting write sets do not run concurrently.
- Tasks without write sets do not run concurrently with mutating tasks.
- Strict-studio approvals are checked before any non-dry orchestration side effects.
- Blocked tasks cause dependent tasks to become
skippedwith readable notes. - Orchestration run metadata and task outputs are persisted under
.codex/runs/**. - Locks are released on success, failure, and thrown exceptions.
- Help/validation exposes no hosted, daemon, background loop, or unbounded parallelism surface.
- CCGS roles and skills have a curated adaptation registry with explicit keep/add/defer decisions.
- Initial high-value CCGS additions improve OGS coverage without copying Claude-specific hooks/rules/skills wholesale.
- Docs and Truthmark-backed behavior claims match code.
12. Explicit Non-Goals for This Implementation
- No hosted service.
- No remote worker.
- No background daemon.
- No auto-cleaning stale locks in the first pass.
- No generalized arbitrary DAG language.
- No unbounded
--max-concurrency 0or--max-concurrency unlimitedbehavior. - No automatic task generation from free-form LLM output without showing/writing reviewable task specs first.
- No import of
.claude/**files into generated projects. - No engine sub-specialist role explosion until selected-context references prove insufficient.
13. Recommended Implementation Order
- Task schema v2.
- CLI task creation enhancements.
- Async Codex runtime.
- Lock store.
- Dry-run orchestration planner.
- Serial orchestration execution.
- Bounded parallel execution.
- CLI command.
- Workflow recipe creation.
- CCGS adaptation registry.
- First curated role/workflow/template additions.
- Validation and docs.
This order keeps each step testable and avoids shipping a broad orchestration surface before locking, approvals, and failure behavior are explicit.