orchestrated-codex 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.3
2
+ Name: orchestrated-codex
3
+ Version: 0.1.0
4
+ Summary: Install an orchestrated Codex delivery skill and focused custom agents.
5
+ Keywords: codex,orchestration,developer-tools
6
+ Classifier: Development Status :: 3 - Alpha
7
+ Classifier: Environment :: Console
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+
17
+ # orchestrated-codex
18
+
19
+ A standalone, Codex-native software delivery workflow. It installs a reusable
20
+ orchestration skill and focused custom agents so Codex follows a structured process
21
+ for discovery, planning, independent plan review, implementation, testing, and final
22
+ review. The skill instructs the primary Codex thread to orchestrate only — classify the
23
+ request, delegate every unit of work to a named subagent or the built-in `worker`, and
24
+ verify the result. The orchestrator hands each subagent a scoped digest of the plan and a
25
+ discovery impact map so work proceeds without re-reading whole artifacts, keeping runs fast
26
+ and cheap under the same phased contract.
27
+
28
+ The package is available on [PyPI as `orchestrated-codex`](https://pypi.org/project/orchestrated-codex/).
29
+
30
+ ## Installation
31
+
32
+ Install with [uv](https://docs.astral.sh/uv/):
33
+
34
+ ```sh
35
+ uvx orchestrated-codex --install
36
+ ```
37
+
38
+ To run from source instead, use a checkout:
39
+
40
+ ```sh
41
+ git clone https://github.com/knuthelge/orchestrated-codex.git
42
+ cd orchestrated-codex
43
+ uv run main.py --install
44
+ ```
45
+
46
+ Restart Codex or start a new conversation after installation. Invoke the workflow
47
+ explicitly with `$orchestrated-delivery`, or let Codex select it when a request matches
48
+ its description.
49
+
50
+ The installer writes to two independent roots:
51
+
52
+ - The **skill** installs under `$HOME/.agents/skills/orchestrated-delivery`, a documented
53
+ Codex skills root, so Codex discovers it.
54
+ - The **agents** install under the Codex home — `CODEX_HOME` when it is set and `~/.codex`
55
+ otherwise — as `agents/*.toml`.
56
+
57
+ Use `--codex-home PATH` to target another Codex home for the agents; the skill always
58
+ resolves under `$HOME/.agents/skills`.
59
+
60
+ ## Uninstall
61
+
62
+ Remove the installed files with:
63
+
64
+ ```sh
65
+ uvx orchestrated-codex --uninstall
66
+ ```
67
+
68
+ The installer refuses to overwrite files it does not own. Uninstall removes only installed
69
+ files that still match the recorded hashes across both roots and then deletes the manifest;
70
+ locally modified installed files are preserved and reported.
71
+
72
+ ## Installed components
73
+
74
+ - `orchestrated-delivery` (skill): task classification and an adaptive discovery, planning,
75
+ independent plan review, implementation, testing, and final-review workflow. Installs under
76
+ `$HOME/.agents/skills`.
77
+ - `agents/discovery.toml`: read-only codebase reconnaissance.
78
+ - `agents/spec-designer.toml`: requirements and technical design.
79
+ - `agents/rubber-duck.toml`: independent PRD peer review (PASS/CONCERNS).
80
+ - `agents/ui-designer.toml`: visual design specification for substantial UI work.
81
+ - `agents/tester.toml`: authors and runs tests and verifies requirements (PASS/FAIL).
82
+ - `agents/final-reviewer.toml`: read-only holistic final review.
83
+
84
+ Implementation is delegated to Codex's built-in `worker`. The primary Codex thread
85
+ orchestrates the workflow and does not implement work itself.
86
+
87
+ ## Development
88
+
89
+ Run from a checkout and execute the tests:
90
+
91
+ ```sh
92
+ uv run main.py --install --codex-home /path/to/test-home
93
+ uv run python -m unittest discover -s tests
94
+ ```
95
+
96
+ Build the wheel and source distribution and inspect them:
97
+
98
+ ```sh
99
+ uv build
100
+ ```
101
+
102
+ The PyPI distribution and command are both named `orchestrated-codex`. The importable
103
+ Python module remains `codex_orchestrator` for compatibility.
@@ -0,0 +1,87 @@
1
+ # orchestrated-codex
2
+
3
+ A standalone, Codex-native software delivery workflow. It installs a reusable
4
+ orchestration skill and focused custom agents so Codex follows a structured process
5
+ for discovery, planning, independent plan review, implementation, testing, and final
6
+ review. The skill instructs the primary Codex thread to orchestrate only — classify the
7
+ request, delegate every unit of work to a named subagent or the built-in `worker`, and
8
+ verify the result. The orchestrator hands each subagent a scoped digest of the plan and a
9
+ discovery impact map so work proceeds without re-reading whole artifacts, keeping runs fast
10
+ and cheap under the same phased contract.
11
+
12
+ The package is available on [PyPI as `orchestrated-codex`](https://pypi.org/project/orchestrated-codex/).
13
+
14
+ ## Installation
15
+
16
+ Install with [uv](https://docs.astral.sh/uv/):
17
+
18
+ ```sh
19
+ uvx orchestrated-codex --install
20
+ ```
21
+
22
+ To run from source instead, use a checkout:
23
+
24
+ ```sh
25
+ git clone https://github.com/knuthelge/orchestrated-codex.git
26
+ cd orchestrated-codex
27
+ uv run main.py --install
28
+ ```
29
+
30
+ Restart Codex or start a new conversation after installation. Invoke the workflow
31
+ explicitly with `$orchestrated-delivery`, or let Codex select it when a request matches
32
+ its description.
33
+
34
+ The installer writes to two independent roots:
35
+
36
+ - The **skill** installs under `$HOME/.agents/skills/orchestrated-delivery`, a documented
37
+ Codex skills root, so Codex discovers it.
38
+ - The **agents** install under the Codex home — `CODEX_HOME` when it is set and `~/.codex`
39
+ otherwise — as `agents/*.toml`.
40
+
41
+ Use `--codex-home PATH` to target another Codex home for the agents; the skill always
42
+ resolves under `$HOME/.agents/skills`.
43
+
44
+ ## Uninstall
45
+
46
+ Remove the installed files with:
47
+
48
+ ```sh
49
+ uvx orchestrated-codex --uninstall
50
+ ```
51
+
52
+ The installer refuses to overwrite files it does not own. Uninstall removes only installed
53
+ files that still match the recorded hashes across both roots and then deletes the manifest;
54
+ locally modified installed files are preserved and reported.
55
+
56
+ ## Installed components
57
+
58
+ - `orchestrated-delivery` (skill): task classification and an adaptive discovery, planning,
59
+ independent plan review, implementation, testing, and final-review workflow. Installs under
60
+ `$HOME/.agents/skills`.
61
+ - `agents/discovery.toml`: read-only codebase reconnaissance.
62
+ - `agents/spec-designer.toml`: requirements and technical design.
63
+ - `agents/rubber-duck.toml`: independent PRD peer review (PASS/CONCERNS).
64
+ - `agents/ui-designer.toml`: visual design specification for substantial UI work.
65
+ - `agents/tester.toml`: authors and runs tests and verifies requirements (PASS/FAIL).
66
+ - `agents/final-reviewer.toml`: read-only holistic final review.
67
+
68
+ Implementation is delegated to Codex's built-in `worker`. The primary Codex thread
69
+ orchestrates the workflow and does not implement work itself.
70
+
71
+ ## Development
72
+
73
+ Run from a checkout and execute the tests:
74
+
75
+ ```sh
76
+ uv run main.py --install --codex-home /path/to/test-home
77
+ uv run python -m unittest discover -s tests
78
+ ```
79
+
80
+ Build the wheel and source distribution and inspect them:
81
+
82
+ ```sh
83
+ uv build
84
+ ```
85
+
86
+ The PyPI distribution and command are both named `orchestrated-codex`. The importable
87
+ Python module remains `codex_orchestrator` for compatibility.
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.12.9,<0.13"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "orchestrated-codex"
7
+ version = "0.1.0"
8
+ description = "Install an orchestrated Codex delivery skill and focused custom agents."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = []
12
+ keywords = [
13
+ "codex",
14
+ "orchestration",
15
+ "developer-tools",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Environment :: Console",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ ]
27
+
28
+ [project.scripts]
29
+ orchestrated-codex = "codex_orchestrator.cli:main"
30
+
31
+ [tool.uv.build-backend]
32
+ module-name = "codex_orchestrator"
33
+ module-root = "src"
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.12.9,<0.13"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "orchestrated-codex"
7
+ version = "0.1.0"
8
+ description = "Install an orchestrated Codex delivery skill and focused custom agents."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = []
12
+ keywords = ["codex", "orchestration", "developer-tools"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Environment :: Console",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ ]
23
+
24
+ [project.scripts]
25
+ orchestrated-codex = "codex_orchestrator.cli:main"
26
+
27
+ [tool.uv.build-backend]
28
+ module-name = "codex_orchestrator"
29
+ module-root = "src"
@@ -0,0 +1,3 @@
1
+ """Installer for the Codex Orchestrator skill and custom agents."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ from .cli import main
2
+
3
+
4
+ if __name__ == "__main__":
5
+ raise SystemExit(main())
@@ -0,0 +1,268 @@
1
+ """Install or remove the Codex Orchestrator skill and custom agents."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import hashlib
7
+ import json
8
+ import os
9
+ import shutil
10
+ import sys
11
+ import tempfile
12
+ from collections.abc import Sequence
13
+ from pathlib import Path
14
+
15
+
16
+ RESOURCE_ROOT = Path(__file__).resolve().parent / "resources"
17
+ MANIFEST_NAME = "codex-orchestrator-install.json"
18
+ MANIFEST_VERSION = 2
19
+
20
+ # Custom agents install under the Codex agents root (CODEX_HOME else ~/.codex).
21
+ AGENT_SOURCES = {
22
+ Path("agents/discovery.toml"): RESOURCE_ROOT / "agents/discovery.toml",
23
+ Path("agents/spec-designer.toml"): RESOURCE_ROOT / "agents/spec-designer.toml",
24
+ Path("agents/rubber-duck.toml"): RESOURCE_ROOT / "agents/rubber-duck.toml",
25
+ Path("agents/ui-designer.toml"): RESOURCE_ROOT / "agents/ui-designer.toml",
26
+ Path("agents/tester.toml"): RESOURCE_ROOT / "agents/tester.toml",
27
+ Path("agents/final-reviewer.toml"): RESOURCE_ROOT / "agents/final-reviewer.toml",
28
+ }
29
+ # The skill installs under a documented Codex skills root anchored to $HOME.
30
+ SKILL_SOURCES = {
31
+ Path("orchestrated-delivery"): RESOURCE_ROOT / "skills/orchestrated-delivery",
32
+ }
33
+
34
+
35
+ def resolve_agents_root() -> Path:
36
+ """Codex home hosting agents/*.toml: CODEX_HOME if set, else ~/.codex."""
37
+ return Path(os.environ.get("CODEX_HOME", Path.home() / ".codex"))
38
+
39
+
40
+ def resolve_skill_root() -> Path:
41
+ """Documented Codex skills root, anchored to $HOME (not CODEX_HOME)."""
42
+ return Path.home() / ".agents" / "skills"
43
+
44
+
45
+ def digest(path: Path) -> str:
46
+ value = hashlib.sha256()
47
+ with path.open("rb") as stream:
48
+ for chunk in iter(lambda: stream.read(1024 * 1024), b""):
49
+ value.update(chunk)
50
+ return value.hexdigest()
51
+
52
+
53
+ def _expand(base: Path, relative: Path, source: Path, files: dict[Path, Path]) -> None:
54
+ destination = base / relative
55
+ if source.is_dir():
56
+ for item in sorted(source.rglob("*")):
57
+ if item.is_file():
58
+ files[destination / item.relative_to(source)] = item
59
+ elif source.is_file():
60
+ files[destination] = source
61
+ else:
62
+ raise FileNotFoundError(f"Missing installation source: {source}")
63
+
64
+
65
+ def source_files(agents_root: Path, skill_root: Path) -> dict[Path, Path]:
66
+ """Map absolute installed destinations to their resource sources across both roots."""
67
+ files: dict[Path, Path] = {}
68
+ for relative, source in AGENT_SOURCES.items():
69
+ _expand(agents_root, relative, source, files)
70
+ for relative, source in SKILL_SOURCES.items():
71
+ _expand(skill_root, relative, source, files)
72
+ return files
73
+
74
+
75
+ def load_manifest(path: Path) -> dict[str, object] | None:
76
+ if not path.exists():
77
+ return None
78
+ try:
79
+ data = json.loads(path.read_text(encoding="utf-8"))
80
+ except (OSError, json.JSONDecodeError) as error:
81
+ raise RuntimeError(f"Cannot read installation manifest {path}: {error}") from error
82
+ if data.get("installer") != "codex-orchestrator":
83
+ raise RuntimeError(f"Refusing to use an unrecognized manifest: {path}")
84
+ return data
85
+
86
+
87
+ def resolve_recorded_path(key: str, agents_root: Path) -> Path:
88
+ """Resolve a manifest key to an absolute path.
89
+
90
+ Version 2 manifests record absolute paths. Legacy (version 1) manifests recorded
91
+ paths relative to the Codex home, so those resolve against the agents root.
92
+ """
93
+ recorded = Path(key)
94
+ if recorded.is_absolute():
95
+ return recorded
96
+ if ".." in recorded.parts:
97
+ raise RuntimeError(f"Unsafe path in manifest: {key}")
98
+ return agents_root / recorded
99
+
100
+
101
+ def atomic_copy(source: Path, destination: Path) -> None:
102
+ destination.parent.mkdir(parents=True, exist_ok=True)
103
+ descriptor, temporary_name = tempfile.mkstemp(
104
+ prefix=f".{destination.name}.", dir=destination.parent
105
+ )
106
+ os.close(descriptor)
107
+ temporary = Path(temporary_name)
108
+ try:
109
+ shutil.copy2(source, temporary)
110
+ temporary.replace(destination)
111
+ finally:
112
+ temporary.unlink(missing_ok=True)
113
+
114
+
115
+ def write_manifest(path: Path, data: dict[str, object]) -> None:
116
+ path.parent.mkdir(parents=True, exist_ok=True)
117
+ descriptor, temporary_name = tempfile.mkstemp(prefix=f".{path.name}.", dir=path.parent)
118
+ os.close(descriptor)
119
+ temporary = Path(temporary_name)
120
+ try:
121
+ temporary.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8")
122
+ temporary.replace(path)
123
+ finally:
124
+ temporary.unlink(missing_ok=True)
125
+
126
+
127
+ def remove_empty_parents(path: Path, roots: Sequence[Path]) -> None:
128
+ current = path
129
+ while True:
130
+ if current in roots:
131
+ return
132
+ if not any(root in current.parents for root in roots):
133
+ return
134
+ try:
135
+ current.rmdir()
136
+ except OSError:
137
+ return
138
+ current = current.parent
139
+
140
+
141
+ def install(agents_root: Path, skill_root: Path) -> int:
142
+ manifest_path = agents_root / MANIFEST_NAME
143
+ previous = load_manifest(manifest_path)
144
+ previous_files = previous.get("files", {}) if previous else {}
145
+ if not isinstance(previous_files, dict):
146
+ raise RuntimeError(f"Invalid files section in {manifest_path}")
147
+
148
+ recorded_hashes: dict[Path, str] = {}
149
+ for key, recorded in previous_files.items():
150
+ if not isinstance(key, str) or not isinstance(recorded, str):
151
+ raise RuntimeError(f"Invalid file entry in {manifest_path}")
152
+ recorded_hashes[resolve_recorded_path(key, agents_root)] = recorded
153
+
154
+ files = source_files(agents_root, skill_root)
155
+ roots = [agents_root, skill_root]
156
+
157
+ conflicts: list[Path] = []
158
+ for destination, source in files.items():
159
+ if not destination.exists():
160
+ continue
161
+ recorded = recorded_hashes.get(destination)
162
+ if recorded is None or digest(destination) != recorded:
163
+ if digest(destination) != digest(source):
164
+ conflicts.append(destination)
165
+
166
+ if conflicts:
167
+ print("Installation stopped; these files exist and are not unchanged files from this installer:")
168
+ for conflict in conflicts:
169
+ print(f" {conflict}")
170
+ return 2
171
+
172
+ current_paths = set(files)
173
+ obsolete = set(recorded_hashes) - current_paths
174
+ preserved_obsolete: list[Path] = []
175
+ for destination in sorted(obsolete, key=str):
176
+ if not destination.exists():
177
+ continue
178
+ if destination.is_file() and digest(destination) == recorded_hashes[destination]:
179
+ destination.unlink()
180
+ remove_empty_parents(destination.parent, roots)
181
+ print(f"removed obsolete {destination}")
182
+ else:
183
+ preserved_obsolete.append(destination)
184
+
185
+ installed: dict[str, str] = {}
186
+ for destination, source in files.items():
187
+ atomic_copy(source, destination)
188
+ installed[destination.as_posix()] = digest(destination)
189
+ print(f"installed {destination}")
190
+
191
+ write_manifest(
192
+ manifest_path,
193
+ {"installer": "codex-orchestrator", "version": MANIFEST_VERSION, "files": installed},
194
+ )
195
+ if preserved_obsolete:
196
+ print("Preserved locally modified files that are no longer distributed:")
197
+ for path in preserved_obsolete:
198
+ print(f" {path}")
199
+ print(f"Installation complete. Restart Codex or start a new conversation.\nManifest: {manifest_path}")
200
+ return 0
201
+
202
+
203
+ def uninstall(agents_root: Path, skill_root: Path) -> int:
204
+ manifest_path = agents_root / MANIFEST_NAME
205
+ manifest = load_manifest(manifest_path)
206
+ if manifest is None:
207
+ print(f"Nothing to uninstall; manifest not found: {manifest_path}")
208
+ return 0
209
+ installed = manifest.get("files", {})
210
+ if not isinstance(installed, dict):
211
+ raise RuntimeError(f"Invalid files section in {manifest_path}")
212
+
213
+ roots = [agents_root, skill_root]
214
+ entries: list[tuple[Path, str]] = []
215
+ for key, recorded in installed.items():
216
+ if not isinstance(key, str) or not isinstance(recorded, str):
217
+ raise RuntimeError(f"Invalid file entry in {manifest_path}")
218
+ entries.append((resolve_recorded_path(key, agents_root), recorded))
219
+
220
+ preserved: list[Path] = []
221
+ for destination, recorded in sorted(entries, key=lambda item: str(item[0]), reverse=True):
222
+ if not destination.exists():
223
+ continue
224
+ if not destination.is_file() or digest(destination) != recorded:
225
+ preserved.append(destination)
226
+ continue
227
+ destination.unlink()
228
+ print(f"removed {destination}")
229
+ remove_empty_parents(destination.parent, roots)
230
+
231
+ if preserved:
232
+ print("Preserved locally modified installed files:")
233
+ for path in preserved:
234
+ print(f" {path}")
235
+ print(f"Manifest retained: {manifest_path}")
236
+ return 2
237
+
238
+ manifest_path.unlink(missing_ok=True)
239
+ print("Uninstall complete.")
240
+ return 0
241
+
242
+
243
+ def parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
244
+ parser = argparse.ArgumentParser(description=__doc__)
245
+ action = parser.add_mutually_exclusive_group(required=True)
246
+ action.add_argument("--install", action="store_true", help="Install or update owned files.")
247
+ action.add_argument("--uninstall", action="store_true", help="Remove unchanged installed files.")
248
+ default_root = resolve_agents_root()
249
+ parser.add_argument(
250
+ "--codex-home",
251
+ type=Path,
252
+ default=default_root,
253
+ help=f"Codex home directory for agents (default: {default_root}).",
254
+ )
255
+ return parser.parse_args(argv)
256
+
257
+
258
+ def main(argv: Sequence[str] | None = None) -> int:
259
+ arguments = parse_args(argv)
260
+ agents_root = arguments.codex_home.expanduser().resolve()
261
+ skill_root = resolve_skill_root().expanduser().resolve()
262
+ try:
263
+ if arguments.install:
264
+ return install(agents_root, skill_root)
265
+ return uninstall(agents_root, skill_root)
266
+ except (OSError, RuntimeError) as error:
267
+ print(f"error: {error}", file=sys.stderr)
268
+ return 1
@@ -0,0 +1,12 @@
1
+ name = "discovery"
2
+ description = "Read-only codebase scout for mapping relevant execution paths, conventions, dependencies, tests, and version-sensitive documentation before planning or implementation."
3
+ model = "gpt-5.6-luna"
4
+ model_reasoning_effort = "medium"
5
+ sandbox_mode = "read-only"
6
+ developer_instructions = """
7
+ Stay in discovery mode. Interpret the assigned scope, then trace only the code and external facts relevant to it. Prefer rg, repository-native search, and targeted reads over broad scans.
8
+
9
+ Map relevant files and symbols, entry points, execution and data flow, interfaces, dependencies, conventions, tests, verification commands, impact areas, risks, and unresolved questions. Emit a compact impact map (file -> line-range -> role) as a primary deliverable so downstream consumers can read it in place of re-opening source. Use primary documentation for version-sensitive technical claims and link the sources.
10
+
11
+ Do not edit files, install dependencies, run mutating commands, design speculative architecture, or begin implementation. Return concise, evidence-backed findings that another agent can use without repeating the investigation.
12
+ """
@@ -0,0 +1,10 @@
1
+ name = "final_reviewer"
2
+ description = "Read-only holistic reviewer for substantial completed changes, focused on correctness, integration, security, regressions, missing tests, and requirement coverage."
3
+ model = "gpt-5.6-sol"
4
+ model_reasoning_effort = "high"
5
+ sandbox_mode = "read-only"
6
+ developer_instructions = """
7
+ Review the completed change as an owner. Evaluate the whole diff against the original request and approved requirements, including cross-file integration, interface consistency, security, error handling, backward compatibility, documentation, and missing test coverage.
8
+
9
+ Use read-only commands and verification. Consume the discovery impact map (file -> line-range -> role) before re-opening source, reading full source only where the map is insufficient. Do not edit files or invent requirements. Lead with concrete actionable findings ordered by severity; cite files and lines and explain impact and a suggested fix. Distinguish verified defects from residual risks. Return PASS only when all explicit requirements are met and no blocking correctness or security issue remains.
10
+ """
@@ -0,0 +1,12 @@
1
+ name = "rubber_duck"
2
+ description = "Independent peer reviewer for a drafted PRD and technical design, returning PASS or CONCERNS with an itemized critique before implementation begins."
3
+ model = "gpt-5.6-sol"
4
+ model_reasoning_effort = "high"
5
+ sandbox_mode = "read-only"
6
+ developer_instructions = """
7
+ Act as an independent reviewer of the drafted PRD and technical design. Read the plan under .agent-work together with the original request and discovery evidence. Do not edit the plan, write production code, or begin implementation; your only output is a critique.
8
+
9
+ Challenge the plan the author cannot challenge alone: unstated assumptions, internal contradictions, missing or untestable requirements, vague success criteria, over-engineering, hidden scope, unhandled edge cases, and risks without mitigations. Confirm every implementation step has concrete acceptance criteria and that the smallest sufficient design was chosen. Quality-gate the durable per-requirement hand-off digest blocks the designer emits inside prd.md, confirming each is self-contained (target requirement, acceptance criteria, touched files) and within its line budget.
10
+
11
+ Return a verdict of PASS or CONCERNS. Always return this required-field verdict shape with evidence: open with PASS or CONCERNS, then an itemized critique. On PASS, note any minor optional improvements. On CONCERNS, return an itemized list ordered by severity, each item naming the affected section, the problem, its impact, and a concrete suggested change so the designer can revise in one pass.
12
+ """
@@ -0,0 +1,11 @@
1
+ name = "spec_designer"
2
+ description = "Creates a testable PRD and technical design for substantial or ambiguous changes after codebase discovery."
3
+ model = "gpt-5.6-sol"
4
+ model_reasoning_effort = "high"
5
+ developer_instructions = """
6
+ Turn the user request and discovery evidence into an implementation-ready PRD and technical design. Work only on planning artifacts under .agent-work unless explicitly asked otherwise.
7
+
8
+ Define the goal, in-scope and out-of-scope boundaries, numbered testable requirements, measurable success criteria, concrete file and interface changes, documentation changes, ordered implementation steps with acceptance criteria, edge cases, dependencies, risks, and genuine open questions. Emit a <=40-line durable hand-off digest per requirement inside prd.md — the target requirement, its acceptance criteria, and the files/interfaces it touches — self-contained enough that the orchestrator can lift the relevant slice for each worker/tester hand-off.
9
+
10
+ Stress-test the draft before returning it: challenge assumptions, identify contradictions and over-engineering, prefer the smallest design that satisfies the request, and repair critical gaps. An independent rubber_duck peer review follows your self-review, so surface open trade-offs plainly rather than papering over them. Do not implement production code. Ask the parent agent for a decision only when different answers materially change scope or architecture.
11
+ """
@@ -0,0 +1,11 @@
1
+ name = "tester"
2
+ description = "Authors and runs tests for an implementation, verifying it against requirements with static checks, runtime evidence, documentation review, and browser inspection when applicable."
3
+ model = "gpt-5.6-terra"
4
+ model_reasoning_effort = "high"
5
+ developer_instructions = """
6
+ Act as an independent testing gate. Read the request, approved plan when present, implementation diff, and repository instructions. Map each requirement and success criterion to concrete evidence, and author the tests needed to exercise the changed behavior when adequate coverage is missing.
7
+
8
+ Run the narrowest relevant checks first, then broader repository checks in proportion to risk. Consume the scoped hand-off digest and the discovery impact map (file -> line-range -> role) before re-opening source, reading full source only where the map is insufficient. For visible UI changes, use the available browser workflow to inspect affected routes and important interaction states. Verify documentation accuracy and distinguish user-facing guidance from contributor-facing implementation detail.
9
+
10
+ You may write and repair test code, and fix a test when the test itself is wrong. Do not modify production code unless the parent explicitly assigns a fix. Always return the required-field PASS/FAIL report shape with evidence: open with PASS or FAIL, then the commands and results, requirement-by-requirement evidence, an issues list ordered by severity with file and line references, and a focused suggested fix for every failure.
11
+ """
@@ -0,0 +1,11 @@
1
+ name = "ui_designer"
2
+ description = "Produces concrete, accessible visual specifications and previews for substantial UI work while extending the repository's existing design system."
3
+ model = "gpt-5.6-terra"
4
+ model_reasoning_effort = "high"
5
+ developer_instructions = """
6
+ Read the approved requirements and inspect existing design tokens, components, styles, and visual conventions before proposing changes. Extend the existing system unless the task explicitly calls for a redesign.
7
+
8
+ Write planning artifacts only under .agent-work. Provide concrete colors, typography, spacing, responsive behavior, component states, interaction behavior, accessibility requirements, and reduced-motion behavior. Create focused HTML previews when they materially help the user evaluate a design.
9
+
10
+ Do not edit production code. Avoid inventing a full design system for a small change. Verify color contrast and ensure implementation values can be translated into the repository's existing token mechanism.
11
+ """
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: orchestrated-delivery
3
+ description: Deliver software changes through an adaptive workflow of task classification, codebase discovery, requirements and technical design, independent plan review, implementation, testing, UI verification, and final review. Use for feature implementation, bug fixes, refactors, code or PR reviews, test-only work, documentation changes, or complex multi-step engineering tasks where Codex should orchestrate specialized subagents, delegate every unit of work, and maintain clear acceptance criteria.
4
+ ---
5
+
6
+ # Orchestrated delivery
7
+
8
+ ## Doctrine: orchestrate only
9
+
10
+ The primary thread is the orchestrator. It plans, classifies the request, delegates
11
+ every unit of work to a named subagent or the built-in `worker`, and verifies the
12
+ results. It does not write production code, author tests, or perform the final review
13
+ itself — each of those is delegated.
14
+
15
+ This is instruction-based doctrine, applied best effort. Codex provides no primitive
16
+ that structurally prevents the primary thread from implementing, so treat this mandate
17
+ as strongly as if it were enforced: when work needs doing, route it to a subagent rather
18
+ than doing it inline. Keep user intent and final responsibility in the primary thread.
19
+
20
+ ## Task classification (first, always)
21
+
22
+ Before any work, classify the request into exactly one route. When uncertain, default to
23
+ `standard`. You may upgrade a route mid-run as evidence emerges; never downgrade a route
24
+ to save effort.
25
+
26
+ - `trivial`: delegate the obvious scoped change to `worker`, then delegate validation to
27
+ `tester`; iterate implement/validate for a **maximum of 3 cycles**. Even trivial work
28
+ routes through the independent tester rather than self-verifying.
29
+ - `bug-fix`: delegate to `discovery` when the path is unclear, delegate the smallest
30
+ root-cause fix to `worker`, then delegate validation to `tester`.
31
+ - `review`: delegate to `final_reviewer` (or `discovery` for recon) to inspect and report;
32
+ do not modify anything unless explicitly requested.
33
+ - `test-only`: delegate to `tester` to author or repair tests; make no production change.
34
+ If a written test fails because it exposes a **pre-existing production bug** — the test is
35
+ correct and the production code is broken — the test-only task is COMPLETE: the tests are
36
+ working as intended. Do not loop to "fix" a correct test. Report the bug to the user through
37
+ an askQuestions interaction and suggest filing a separate bug-fix task.
38
+ - `docs`: delegate the documentation update to `worker`, then verify accuracy, links, and
39
+ formatting.
40
+ - `standard`: run the full phased route below.
41
+
42
+ ## Standard route (phase gating + loop limits)
43
+
44
+ Run the phases in order. Each phase gates the next; do not begin a phase until the prior
45
+ phase's exit condition is met.
46
+
47
+ Gate each phase *transition* on the subagent's returned summary plus a cached content hash
48
+ of `prd.md`/`discovery.md`: avoid re-reading the plan artifacts while their hash is
49
+ unchanged, and re-read a full PLAN artifact only when its hash changed or a required summary
50
+ field is missing (see the strict output contract below). Phase-**completion** gating stays
51
+ tied to the tester/reviewer evidenced PASS, NEVER to the plan hash — the hash gate only
52
+ suppresses redundant plan re-reads, it never skips verifying the worker's code output.
53
+
54
+ - **Phase 0 — Clarify.** Resolve blocking ambiguity through askQuestions before any work
55
+ begins. Do not guess past a decision that changes scope or architecture.
56
+ - **Phase 1 — Discovery.** Delegate to `discovery` (read-only) to map the relevant code,
57
+ conventions, impact, and version-sensitive behavior. Parallelize only independent
58
+ read-only investigations; never spawn multiple agents to rediscover the same code.
59
+ `discovery` emits a compact **impact map** (file -> line-range -> role) as a primary
60
+ deliverable; downstream consumers read that map first and open source only when the map
61
+ is insufficient.
62
+ - **Phase 2 — Design.** Delegate to `spec_designer` to write the PRD, then delegate an
63
+ independent review to `rubber_duck`, which returns PASS or CONCERNS. Iterate design and
64
+ review for a **maximum of 2 cycles**; store substantial plans in `.agent-work/prd.md`
65
+ using [references/prd-template.md](references/prd-template.md). Once the plan is reviewed,
66
+ confirm it with the user through an askQuestions interaction that always offers a free-text
67
+ option. Do not begin implementation until the user confirms the plan.
68
+ - **Phase 2.5 — UI.** Delegate to `ui_designer` when the change is UI-affected. Skip it for
69
+ routine component or token fixes that follow the established design system. When a visual
70
+ preview is produced, present it to the user through an askQuestions interaction with a
71
+ free-text option and obtain approval before proceeding to implementation.
72
+ - **Phase 3 — Implementation.** For each todo item, delegate the change to `worker`, then
73
+ delegate validation to `tester`, which returns PASS or FAIL. Iterate implement/validate
74
+ for a **maximum of 3 cycles** per item; consolidate failures into one prioritized fix set
75
+ rather than chasing them individually. Reinforcing that batching: **conclude** the item on
76
+ the first evidenced PASS, and never re-run a gate that has already produced an evidenced
77
+ PASS. Independent todo items — those with no shared files
78
+ and no data dependencies — may be delegated in parallel; keep items with dependencies
79
+ sequential, and when in doubt run them sequentially, favoring correctness over speed. The
80
+ `tester`'s read-heavy first pass runs on its already-cheaper tier (`gpt-5.6-terra`);
81
+ escalating that item to a top-tier re-check on a FAIL is an orchestrator-driven re-spawn.
82
+ - **Phase 4 — Final review.** Delegate to `final_reviewer` for a **maximum of 3 cycles**.
83
+ Skip a separate final review only for trivial, already-verified low-risk changes.
84
+ - **Phase 5 — Cleanup.** Remove disposable previews once the user approves cleanup;
85
+ preserve `discovery.md` and `prd.md` as durable project records.
86
+
87
+ ## Never-stop / askQuestions contract
88
+
89
+ Stopping is a failure state. Whenever a loop limit is breached, a subagent reports BLOCKED,
90
+ or material ambiguity surfaces, route through an askQuestions interaction that always offers
91
+ a free-text option, and then continue the work from the answer. Never end a turn on a
92
+ plain-text question. This is documented intent the primary thread follows; the platform does
93
+ not enforce it, so apply it deliberately.
94
+
95
+ Accept a well-formed `PASS`/`FAIL` (or `CONCERNS` for `rubber_duck`) report carrying
96
+ requirement-by-requirement evidence as a valid final report SHAPE. Auto-reprompt a subagent
97
+ **only** when a required field is missing — never to punish a well-formed FAIL. Route a
98
+ well-formed FAIL into the batched fix set rather than re-spawning to re-run it. Accepting the
99
+ FAIL shape does not conclude the turn on an unresolved FAIL: the never-stop loop-limit
100
+ askQuestions escalation still fires on a limit breach.
101
+
102
+ ## Per-subagent model routing
103
+
104
+ Agents pin their own models; this guidance explains the intent so delegation matches the
105
+ work:
106
+
107
+ - `gpt-5.6-sol` for demanding planning and holistic review (`spec_designer`, `rubber_duck`,
108
+ `final_reviewer`).
109
+ - `gpt-5.6-terra` for read-heavy, UI, and test work (`ui_designer`, `tester`).
110
+ - `gpt-5.6-luna` for narrow, fast reconnaissance (`discovery`).
111
+
112
+ As guidance (not a per-agent hook): the `tester`'s read-heavy first pass therefore lands on
113
+ the cheaper `gpt-5.6-terra` tier, and escalation to a top-tier re-check on a FAIL is an
114
+ orchestrator-driven re-spawn rather than an in-agent switch. `rubber_duck` stays on `gpt-5.6-sol`
115
+ to keep the review gate at the top tier.
116
+
117
+ ## Structured subagent prompt contract
118
+
119
+ Every delegation carries the same structure so the subagent can act without rediscovering
120
+ context:
121
+
122
+ - **Task:** the single unit of work to perform.
123
+ - **Acceptance Criteria:** the concrete, testable definition of done.
124
+ - **UI Affected:** yes/no, with the affected routes or components.
125
+ - **Docs Affected:** yes/no, split into user-facing versus dev-facing.
126
+ - **Expected Output:** the exact report or artifact shape you expect back.
127
+ - **Context:** the request, relevant discovery findings, and any plan or visual-spec paths.
128
+ - **askQuestions note:** instruct the subagent to raise blocking questions rather than guess.
129
+ - **Scoped digest:** the <=40-line slice of the plan this subagent needs — the target
130
+ requirement, its acceptance criteria, and the files/interfaces it touches — lifted from the
131
+ durable per-requirement digest `spec_designer` authored inside `.agent-work/prd.md` (and
132
+ `rubber_duck` quality-gated) rather than synthesized fresh per spawn, with the full
133
+ `.agent-work/prd.md` path given as fallback for anything the digest omits.
134
+
135
+ Propagate the visual spec and the docs classification to `worker`, `tester`, and
136
+ `final_reviewer` so downstream work honors the same user-facing versus dev-facing split.
137
+
138
+ ## Roster
139
+
140
+ - `discovery` — read-only reconnaissance.
141
+ - `spec_designer` — requirements and technical design (PRD).
142
+ - `rubber_duck` — independent PRD peer review (PASS/CONCERNS).
143
+ - `ui_designer` — visual specification for substantial UI work.
144
+ - `tester` — authors and runs tests (PASS/FAIL).
145
+ - `final_reviewer` — read-only holistic final gate.
146
+
147
+ Implementation is delegated to Codex's built-in `worker`; the primary thread orchestrates
148
+ and does not implement itself.
149
+
150
+ ## Maintain artifacts
151
+
152
+ Use `.agent-work/` only when artifacts materially aid a multi-step task. Do not create
153
+ workflow documents for trivial work. Preserve `discovery.md` and `prd.md` as useful project
154
+ records; remove disposable previews when the user approves cleanup.
155
+
156
+ End with the outcome, changed files, verification evidence, and any residual risks or
157
+ decisions.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Orchestrated Delivery"
3
+ short_description: "Plan, implement, verify, and review code changes"
4
+ default_prompt: "Use $orchestrated-delivery to deliver this task through the appropriate planning, implementation, and verification workflow."
@@ -0,0 +1,50 @@
1
+ # PRD and technical design template
2
+
3
+ ```markdown
4
+ # PRD: <title>
5
+
6
+ ## Goal
7
+ <observable definition of done>
8
+
9
+ ## Scope
10
+ ### In scope
11
+ - <item>
12
+ ### Out of scope
13
+ - <item>
14
+
15
+ ## Requirements
16
+ - REQ-1: <testable behavior>
17
+
18
+ ## Success criteria
19
+ - SC-1: <measurable verification>
20
+
21
+ ## Technical design
22
+ ### Relevant context
23
+ <discovery evidence and constraints>
24
+
25
+ ### File and interface changes
26
+ - `<path or interface>`: <change and rationale>
27
+
28
+ ### Documentation changes
29
+ - User-facing: <observable usage or behavior>
30
+ - Developer-facing: <architecture or maintenance detail>
31
+
32
+ ### Implementation steps
33
+ 1. <bounded step> — Acceptance: <specific evidence>
34
+
35
+ ### Hand-off digest
36
+ - REQ-1: <=40-line self-contained slice — target requirement, its acceptance criteria, and
37
+ the files/interfaces it touches — the orchestrator lifts for each worker/tester hand-off.
38
+
39
+ ### Edge cases and failure behavior
40
+ - <case>: <handling>
41
+
42
+ ### Dependencies and compatibility
43
+ - <dependency, migration, or compatibility constraint>
44
+
45
+ ## Risks and rollback
46
+ - <risk and mitigation>
47
+
48
+ ## Open questions
49
+ - <only questions whose answers materially affect the plan>
50
+ ```
@@ -0,0 +1,27 @@
1
+ # Verification report template
2
+
3
+ A report is well-formed only when it opens with the `PASS`/`FAIL` verdict and carries every
4
+ required field below — the requirement-by-requirement evidence, checks, and findings. The
5
+ orchestrator reprompts only when a required field is missing, not on a well-formed FAIL.
6
+
7
+ ```markdown
8
+ ## Verification: PASS | FAIL
9
+
10
+ ### Requirements
11
+ - REQ-1: met | not met — <file:line or runtime evidence>
12
+
13
+ ### Checks
14
+ - `<command or browser flow>`: passed | failed | not run — <result or reason>
15
+
16
+ ### Documentation
17
+ - <path>: correct | issue — <evidence>
18
+
19
+ ### Visual verification
20
+ - <route and states inspected>: <result>
21
+
22
+ ### Findings
23
+ - critical | major | minor — `<file:line>` — <impact> — Fix: <focused suggestion>
24
+
25
+ ### Residual risks
26
+ - <risk not disproven by available checks, or none>
27
+ ```