spec-orca 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.
Files changed (65) hide show
  1. spec_orca-0.1.0/LICENSE +21 -0
  2. spec_orca-0.1.0/PKG-INFO +355 -0
  3. spec_orca-0.1.0/README.md +319 -0
  4. spec_orca-0.1.0/pyproject.toml +111 -0
  5. spec_orca-0.1.0/setup.cfg +4 -0
  6. spec_orca-0.1.0/src/spec_orca/__init__.py +3 -0
  7. spec_orca-0.1.0/src/spec_orca/_deprecated_cli.py +25 -0
  8. spec_orca-0.1.0/src/spec_orca/agent.py +31 -0
  9. spec_orca-0.1.0/src/spec_orca/architect.py +132 -0
  10. spec_orca-0.1.0/src/spec_orca/backend.py +27 -0
  11. spec_orca-0.1.0/src/spec_orca/backends/__init__.py +61 -0
  12. spec_orca-0.1.0/src/spec_orca/backends/claude.py +396 -0
  13. spec_orca-0.1.0/src/spec_orca/backends/claude_schema.py +71 -0
  14. spec_orca-0.1.0/src/spec_orca/backends/codex.py +315 -0
  15. spec_orca-0.1.0/src/spec_orca/backends/codex_schema.py +17 -0
  16. spec_orca-0.1.0/src/spec_orca/backends/mock.py +106 -0
  17. spec_orca-0.1.0/src/spec_orca/cli.py +1148 -0
  18. spec_orca-0.1.0/src/spec_orca/dev/__init__.py +1 -0
  19. spec_orca-0.1.0/src/spec_orca/dev/git.py +166 -0
  20. spec_orca-0.1.0/src/spec_orca/git_ops.py +67 -0
  21. spec_orca-0.1.0/src/spec_orca/init.py +59 -0
  22. spec_orca-0.1.0/src/spec_orca/interview.py +276 -0
  23. spec_orca-0.1.0/src/spec_orca/loader.py +62 -0
  24. spec_orca-0.1.0/src/spec_orca/models.py +183 -0
  25. spec_orca-0.1.0/src/spec_orca/orchestrator.py +146 -0
  26. spec_orca-0.1.0/src/spec_orca/protocols.py +36 -0
  27. spec_orca-0.1.0/src/spec_orca/py.typed +0 -0
  28. spec_orca-0.1.0/src/spec_orca/report.py +115 -0
  29. spec_orca-0.1.0/src/spec_orca/spec.py +294 -0
  30. spec_orca-0.1.0/src/spec_orca/state.py +204 -0
  31. spec_orca-0.1.0/src/spec_orca/stubs.py +40 -0
  32. spec_orca-0.1.0/src/spec_orca.egg-info/PKG-INFO +355 -0
  33. spec_orca-0.1.0/src/spec_orca.egg-info/SOURCES.txt +63 -0
  34. spec_orca-0.1.0/src/spec_orca.egg-info/dependency_links.txt +1 -0
  35. spec_orca-0.1.0/src/spec_orca.egg-info/entry_points.txt +3 -0
  36. spec_orca-0.1.0/src/spec_orca.egg-info/requires.txt +13 -0
  37. spec_orca-0.1.0/src/spec_orca.egg-info/top_level.txt +2 -0
  38. spec_orca-0.1.0/src/spec_orchestrator/__init__.py +73 -0
  39. spec_orca-0.1.0/src/spec_orchestrator/backends.py +29 -0
  40. spec_orca-0.1.0/src/spec_orchestrator/cli.py +17 -0
  41. spec_orca-0.1.0/src/spec_orchestrator/dev/__init__.py +12 -0
  42. spec_orca-0.1.0/src/spec_orchestrator/dev/git.py +22 -0
  43. spec_orca-0.1.0/src/spec_orchestrator/loader.py +17 -0
  44. spec_orca-0.1.0/src/spec_orchestrator/models.py +39 -0
  45. spec_orca-0.1.0/src/spec_orchestrator/orchestrator.py +17 -0
  46. spec_orca-0.1.0/src/spec_orchestrator/protocols.py +17 -0
  47. spec_orca-0.1.0/src/spec_orchestrator/stubs.py +17 -0
  48. spec_orca-0.1.0/tests/test_backends.py +605 -0
  49. spec_orca-0.1.0/tests/test_cli.py +556 -0
  50. spec_orca-0.1.0/tests/test_codex_backend.py +243 -0
  51. spec_orca-0.1.0/tests/test_deprecated_aliases.py +226 -0
  52. spec_orca-0.1.0/tests/test_dev_git.py +215 -0
  53. spec_orca-0.1.0/tests/test_e2e.py +227 -0
  54. spec_orca-0.1.0/tests/test_git_ops.py +36 -0
  55. spec_orca-0.1.0/tests/test_init.py +82 -0
  56. spec_orca-0.1.0/tests/test_interview.py +420 -0
  57. spec_orca-0.1.0/tests/test_loader.py +60 -0
  58. spec_orca-0.1.0/tests/test_models.py +302 -0
  59. spec_orca-0.1.0/tests/test_orchestrator.py +246 -0
  60. spec_orca-0.1.0/tests/test_protocols.py +19 -0
  61. spec_orca-0.1.0/tests/test_report.py +313 -0
  62. spec_orca-0.1.0/tests/test_roles.py +200 -0
  63. spec_orca-0.1.0/tests/test_spec.py +62 -0
  64. spec_orca-0.1.0/tests/test_state.py +148 -0
  65. spec_orca-0.1.0/tests/test_stubs.py +102 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 spec-orchestrator contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,355 @@
1
+ Metadata-Version: 2.4
2
+ Name: spec-orca
3
+ Version: 0.1.0
4
+ Summary: SpecOrca — a spec-driven two-role orchestrator (Architect / Agent) with swappable coding backends.
5
+ Author: SpecOrca contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/dudujuju828/SpecOrca
8
+ Project-URL: Repository, https://github.com/dudujuju828/SpecOrca
9
+ Project-URL: Changelog, https://github.com/dudujuju828/SpecOrca/blob/master/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/dudujuju828/SpecOrca/issues
11
+ Keywords: orchestrator,architect,agent,cli,specorca
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: PyYAML>=6.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: ruff>=0.8; extra == "dev"
26
+ Requires-Dist: mypy>=1.13; extra == "dev"
27
+ Requires-Dist: pytest>=8.0; extra == "dev"
28
+ Requires-Dist: pytest-cov>=6.0; extra == "dev"
29
+ Requires-Dist: coverage[toml]>=7.4; extra == "dev"
30
+ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
31
+ Requires-Dist: pre-commit>=4.0; extra == "dev"
32
+ Requires-Dist: nox>=2024.4; extra == "dev"
33
+ Requires-Dist: build>=1.0; extra == "dev"
34
+ Requires-Dist: twine>=6.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ <p align="center">
38
+ <img src="assets/specorca.png" alt="SpecOrca logo" width="200">
39
+ </p>
40
+
41
+ # SpecOrca
42
+
43
+ [![CI](https://github.com/anthropics/spec-orchestrator/actions/workflows/ci.yml/badge.svg)](https://github.com/anthropics/spec-orchestrator/actions/workflows/ci.yml)
44
+
45
+ A spec-driven, two-role orchestration CLI for software tasks.
46
+ An **Architect** decomposes work into precise specifications; an **Agent**
47
+ executes each spec using a swappable coding backend (mock by default).
48
+
49
+ | | |
50
+ |---|---|
51
+ | **Package** | `spec_orca` |
52
+ | **CLI** | `spec-orca` |
53
+ | **Python** | >= 3.11 |
54
+ | **License** | [MIT](LICENSE) |
55
+
56
+ ## What it does
57
+
58
+ SpecOrca runs an iterative loop:
59
+
60
+ 1. The **Architect** reads a project state and produces a prioritised list of
61
+ specifications (small, verifiable units of work).
62
+ 2. The **Agent** picks the next spec, executes it through a coding backend, and
63
+ reports the result.
64
+ 3. The loop repeats until every spec is resolved or the Architect decides to
65
+ stop.
66
+
67
+ The coding backend is an interface. SpecOrca ships with deterministic `mock`,
68
+ [Claude Code](https://docs.anthropic.com/en/docs/claude-code), and OpenAI
69
+ Codex backends, but any backend that satisfies the `Backend` protocol can be
70
+ substituted.
71
+
72
+ ## Prerequisites
73
+
74
+ - Python >= 3.11
75
+ - (Optional) [Claude Code](https://docs.anthropic.com/en/docs/claude-code)
76
+ installed and on `PATH` if using the default backend.
77
+
78
+ ## Installation
79
+
80
+ ```bash
81
+ # From a local clone (editable / development)
82
+ pip install -e ".[dev]"
83
+
84
+ # Production install (once published)
85
+ pip install spec-orca
86
+ ```
87
+
88
+ ## Quickstart
89
+
90
+ ```bash
91
+ # Verify the install
92
+ spec-orca --version
93
+
94
+ # Show available commands
95
+ spec-orca --help
96
+
97
+ # Create a minimal spec
98
+ spec-orca init --goal "Ship a greeting"
99
+
100
+ # Validate and print ordered specs
101
+ spec-orca plan --spec spec.yaml
102
+
103
+ # Run with the mock backend (no AI, deterministic)
104
+ spec-orca run --spec spec.yaml --backend mock --max-steps 1
105
+
106
+ # Run with Claude Code (requires claude CLI on PATH)
107
+ spec-orca run --spec spec.yaml --backend claude --max-steps 1 --allow-all
108
+
109
+ # Check environment health
110
+ spec-orca doctor --spec spec.yaml --backend claude
111
+ ```
112
+
113
+ ## CLI reference
114
+
115
+ ```
116
+ $ spec-orca --help
117
+ usage: spec-orca [-h] [--version] {run,plan,doctor,init,interview} ...
118
+
119
+ SpecOrca — a spec-driven two-role orchestrator (Architect / Agent).
120
+
121
+ options:
122
+ -h, --help show this help message and exit
123
+ --version show program's version number and exit
124
+
125
+ commands:
126
+ run Run the orchestration loop.
127
+ plan Validate and print the spec plan.
128
+ doctor Check environment health.
129
+ init Scaffold a new spec YAML file.
130
+ interview Start an interactive interview session.
131
+ ```
132
+
133
+ ## Spec format
134
+
135
+ Spec files are YAML documents with the following schema:
136
+
137
+ | Field | Type | Description |
138
+ |---|---|---|
139
+ | `goal` | string | High-level objective for the run. |
140
+ | `specs` | list | Ordered list of spec objects. |
141
+
142
+ Each spec object contains:
143
+
144
+ | Field | Type | Required | Description |
145
+ |---|---|---|---|
146
+ | `id` | string | yes | Unique identifier for the spec. |
147
+ | `title` | string | yes | Short human-readable title. |
148
+ | `description` | string | no | Longer explanation of the work. |
149
+ | `acceptance_criteria` | list[string] | yes | Conditions that must be met. |
150
+ | `dependencies` | list[string] | no | IDs of specs that must complete first. |
151
+
152
+ Example:
153
+
154
+ ```yaml
155
+ goal: "Ship a greeting"
156
+ specs:
157
+ - id: "greet"
158
+ title: "Print hello"
159
+ description: "Create a script that prints a greeting."
160
+ acceptance_criteria:
161
+ - "Program prints 'hello'."
162
+ dependencies: []
163
+ ```
164
+
165
+ ## Backend notes
166
+
167
+ The default backend is `mock` for deterministic execution. To use Claude Code,
168
+ run with `--backend claude` and ensure the `claude` executable is available.
169
+ To use a different backend, implement the `Backend` protocol defined in the
170
+ package and pass it to the orchestrator at construction time.
171
+ Backend documentation will expand as the interface stabilises.
172
+
173
+ ## Claude Code backend
174
+
175
+ Prerequisites:
176
+ - Install [Claude Code](https://docs.anthropic.com/en/docs/claude-code).
177
+ - Ensure the CLI is on `PATH` and responding to `claude -v`.
178
+
179
+ Verify the environment:
180
+ ```bash
181
+ claude -v
182
+ spec-orca doctor --backend claude --spec spec.yaml
183
+ ```
184
+
185
+ Minimal run:
186
+ ```bash
187
+ spec-orca run --backend claude --spec spec.yaml --max-steps 1 --allow-all
188
+ ```
189
+
190
+ Tool permissions:
191
+
192
+ Claude Code runs in non-interactive (`-p`) mode, which denies all tool use
193
+ by default. You **must** grant permissions or the agent will not be able to
194
+ read, write, or execute anything.
195
+
196
+ The quickest way to get started is `--allow-all`, which grants access to
197
+ every standard Claude Code tool (Bash, Read, Write, Edit, Glob, Grep,
198
+ WebFetch, WebSearch, NotebookEdit):
199
+
200
+ ```bash
201
+ spec-orca run --backend claude --spec spec.yaml --max-steps 3 --allow-all
202
+ ```
203
+
204
+ For tighter control, pass an explicit allowlist instead:
205
+
206
+ ```bash
207
+ spec-orca run --backend claude --spec spec.yaml \
208
+ --claude-allowed-tools "Read(*)" \
209
+ --claude-allowed-tools "Write(*)" \
210
+ --claude-allowed-tools "Edit(*)" \
211
+ --claude-disallowed-tools "Bash(*)"
212
+ ```
213
+
214
+ You can also block specific tools with `--claude-disallowed-tools` or
215
+ restrict to an exact set with `--claude-tools`.
216
+
217
+ Claude configuration precedence (highest to lowest):
218
+ 1) CLI flags
219
+ 2) Config file (`spec-orca.toml` or `[tool.spec_orca]` in `pyproject.toml`)
220
+ 3) Environment variables (`CLAUDE_CODE_*`)
221
+ 4) Defaults
222
+
223
+ Config example:
224
+ ```toml
225
+ [tool.spec_orca]
226
+ claude_bin = "claude"
227
+ claude_allowed_tools = ["read:*", "write:*"]
228
+ claude_disallowed_tools = ["rm:*"]
229
+ claude_tools = ["edit", "read"]
230
+ claude_max_turns = 4
231
+ claude_max_budget_usd = 2.5
232
+ claude_timeout_seconds = 300
233
+ claude_no_session_persistence = true
234
+ ```
235
+
236
+ ## Codex backend
237
+
238
+ Prerequisites:
239
+ - Install the OpenAI Codex CLI and ensure `codex` is on `PATH`.
240
+ - Verify the binary and doctor checks:
241
+
242
+ ```bash
243
+ codex --version
244
+ spec-orca doctor --backend codex --spec spec.yaml
245
+ ```
246
+
247
+ Minimal run:
248
+ ```bash
249
+ spec-orca run --backend codex --spec spec.yaml --max-steps 1
250
+ ```
251
+
252
+ Model and timeout options:
253
+ ```bash
254
+ spec-orca run --backend codex --spec spec.yaml \
255
+ --codex-model gpt-5-codex \
256
+ --codex-timeout-seconds 1800
257
+ ```
258
+
259
+ Execution notes:
260
+ - SpecOrca invokes Codex as `codex exec --full-auto --json "<prompt>"`.
261
+ - `--full-auto` enables unattended tool execution. Use it only in trusted repos.
262
+ - Codex configuration precedence (highest to lowest):
263
+ 1) CLI flags (`--codex-bin`, `--codex-model`, `--codex-timeout-seconds`)
264
+ 2) Config file (`spec-orca.toml` or `[tool.spec_orca]` in `pyproject.toml`)
265
+ 3) Environment variables (`CODEX_EXECUTABLE`, `CODEX_MODEL`, `CODEX_TIMEOUT`)
266
+ 4) Defaults
267
+
268
+ ## Interactive interview
269
+
270
+ The `interview` command starts a guided requirements-gathering session. An AI
271
+ interviewer helps you articulate goals, constraints, and acceptance criteria
272
+ through a structured conversation flow:
273
+
274
+ 1. **Scoping** — the interviewer asks what you want to achieve.
275
+ 2. **Choice** — you pick between an improvement analysis or your own specific path.
276
+ 3. **Follow-up** — the conversation continues with clarifying questions until
277
+ requirements are clear.
278
+
279
+ At the end of the session the gathered requirements are compiled into a valid
280
+ spec YAML file that can be fed directly into `spec-orca run`.
281
+
282
+ ```bash
283
+ # Start an interview with the mock backend
284
+ spec-orca interview
285
+
286
+ # Use a real backend for smarter follow-up questions
287
+ spec-orca interview --backend claude
288
+
289
+ # Save the generated spec to a file automatically
290
+ spec-orca interview --backend claude --output spec.yaml
291
+ ```
292
+
293
+ ## Development
294
+
295
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for full details.
296
+
297
+ ```bash
298
+ # Install with dev dependencies
299
+ pip install -e ".[dev]"
300
+
301
+ # Run all checks (format, lint, typecheck, tests)
302
+ nox
303
+
304
+ # Run individual sessions
305
+ nox -s fmt # auto-format
306
+ nox -s lint # ruff lint
307
+ nox -s typecheck # mypy strict
308
+ nox -s tests # pytest + coverage
309
+
310
+ # Install pre-commit hooks
311
+ pre-commit install
312
+ ```
313
+
314
+ ### Auto-commit (opt-in)
315
+
316
+ When iterating on this repository you can let SpecOrca commit
317
+ changes automatically after each successful run:
318
+
319
+ ```bash
320
+ # Commit with an auto-generated message
321
+ spec-orca run --spec spec.yaml --auto-commit
322
+
323
+ # Add a Conventional Commit prefix
324
+ spec-orca run --spec spec.yaml --auto-commit --commit-prefix feat
325
+
326
+ # Multi-step run with auto-commit
327
+ spec-orca run --spec spec.yaml --max-steps 3 --auto-commit --commit-prefix chore
328
+ ```
329
+
330
+ Behaviour:
331
+ - **Off by default** - auto-commit only runs when `--auto-commit` is passed.
332
+ - Only **tracked files** are staged (`git add -u`).
333
+ - **No commit on a clean tree** - if nothing changed, the commit is skipped.
334
+ - **No commit on failed runs** - runs that exit non-zero never auto-commit.
335
+ - Commit messages are single-line, normalized, and include the prefix when
336
+ provided (e.g. `feat: spec-orca run: Add widgets`).
337
+ - The git helper lives in `spec_orca/dev/git.py` and does not affect
338
+ the core orchestration logic.
339
+
340
+ ## Project layout
341
+
342
+ ```
343
+ src/spec_orca/ # installable package
344
+ tests/ # pytest test suite
345
+ noxfile.py # dev task runner
346
+ pyproject.toml # PEP 621 metadata + tool config
347
+ ```
348
+
349
+ ## Documentation
350
+
351
+ - [ARCHITECTURE.md](ARCHITECTURE.md) — system design and module map
352
+ - [CHANGELOG.md](CHANGELOG.md) — release history (Keep a Changelog)
353
+ - [CONTRIBUTING.md](CONTRIBUTING.md) — how to contribute
354
+ - [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) — community standards
355
+ - [SECURITY.md](SECURITY.md) — vulnerability reporting
@@ -0,0 +1,319 @@
1
+ <p align="center">
2
+ <img src="assets/specorca.png" alt="SpecOrca logo" width="200">
3
+ </p>
4
+
5
+ # SpecOrca
6
+
7
+ [![CI](https://github.com/anthropics/spec-orchestrator/actions/workflows/ci.yml/badge.svg)](https://github.com/anthropics/spec-orchestrator/actions/workflows/ci.yml)
8
+
9
+ A spec-driven, two-role orchestration CLI for software tasks.
10
+ An **Architect** decomposes work into precise specifications; an **Agent**
11
+ executes each spec using a swappable coding backend (mock by default).
12
+
13
+ | | |
14
+ |---|---|
15
+ | **Package** | `spec_orca` |
16
+ | **CLI** | `spec-orca` |
17
+ | **Python** | >= 3.11 |
18
+ | **License** | [MIT](LICENSE) |
19
+
20
+ ## What it does
21
+
22
+ SpecOrca runs an iterative loop:
23
+
24
+ 1. The **Architect** reads a project state and produces a prioritised list of
25
+ specifications (small, verifiable units of work).
26
+ 2. The **Agent** picks the next spec, executes it through a coding backend, and
27
+ reports the result.
28
+ 3. The loop repeats until every spec is resolved or the Architect decides to
29
+ stop.
30
+
31
+ The coding backend is an interface. SpecOrca ships with deterministic `mock`,
32
+ [Claude Code](https://docs.anthropic.com/en/docs/claude-code), and OpenAI
33
+ Codex backends, but any backend that satisfies the `Backend` protocol can be
34
+ substituted.
35
+
36
+ ## Prerequisites
37
+
38
+ - Python >= 3.11
39
+ - (Optional) [Claude Code](https://docs.anthropic.com/en/docs/claude-code)
40
+ installed and on `PATH` if using the default backend.
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ # From a local clone (editable / development)
46
+ pip install -e ".[dev]"
47
+
48
+ # Production install (once published)
49
+ pip install spec-orca
50
+ ```
51
+
52
+ ## Quickstart
53
+
54
+ ```bash
55
+ # Verify the install
56
+ spec-orca --version
57
+
58
+ # Show available commands
59
+ spec-orca --help
60
+
61
+ # Create a minimal spec
62
+ spec-orca init --goal "Ship a greeting"
63
+
64
+ # Validate and print ordered specs
65
+ spec-orca plan --spec spec.yaml
66
+
67
+ # Run with the mock backend (no AI, deterministic)
68
+ spec-orca run --spec spec.yaml --backend mock --max-steps 1
69
+
70
+ # Run with Claude Code (requires claude CLI on PATH)
71
+ spec-orca run --spec spec.yaml --backend claude --max-steps 1 --allow-all
72
+
73
+ # Check environment health
74
+ spec-orca doctor --spec spec.yaml --backend claude
75
+ ```
76
+
77
+ ## CLI reference
78
+
79
+ ```
80
+ $ spec-orca --help
81
+ usage: spec-orca [-h] [--version] {run,plan,doctor,init,interview} ...
82
+
83
+ SpecOrca — a spec-driven two-role orchestrator (Architect / Agent).
84
+
85
+ options:
86
+ -h, --help show this help message and exit
87
+ --version show program's version number and exit
88
+
89
+ commands:
90
+ run Run the orchestration loop.
91
+ plan Validate and print the spec plan.
92
+ doctor Check environment health.
93
+ init Scaffold a new spec YAML file.
94
+ interview Start an interactive interview session.
95
+ ```
96
+
97
+ ## Spec format
98
+
99
+ Spec files are YAML documents with the following schema:
100
+
101
+ | Field | Type | Description |
102
+ |---|---|---|
103
+ | `goal` | string | High-level objective for the run. |
104
+ | `specs` | list | Ordered list of spec objects. |
105
+
106
+ Each spec object contains:
107
+
108
+ | Field | Type | Required | Description |
109
+ |---|---|---|---|
110
+ | `id` | string | yes | Unique identifier for the spec. |
111
+ | `title` | string | yes | Short human-readable title. |
112
+ | `description` | string | no | Longer explanation of the work. |
113
+ | `acceptance_criteria` | list[string] | yes | Conditions that must be met. |
114
+ | `dependencies` | list[string] | no | IDs of specs that must complete first. |
115
+
116
+ Example:
117
+
118
+ ```yaml
119
+ goal: "Ship a greeting"
120
+ specs:
121
+ - id: "greet"
122
+ title: "Print hello"
123
+ description: "Create a script that prints a greeting."
124
+ acceptance_criteria:
125
+ - "Program prints 'hello'."
126
+ dependencies: []
127
+ ```
128
+
129
+ ## Backend notes
130
+
131
+ The default backend is `mock` for deterministic execution. To use Claude Code,
132
+ run with `--backend claude` and ensure the `claude` executable is available.
133
+ To use a different backend, implement the `Backend` protocol defined in the
134
+ package and pass it to the orchestrator at construction time.
135
+ Backend documentation will expand as the interface stabilises.
136
+
137
+ ## Claude Code backend
138
+
139
+ Prerequisites:
140
+ - Install [Claude Code](https://docs.anthropic.com/en/docs/claude-code).
141
+ - Ensure the CLI is on `PATH` and responding to `claude -v`.
142
+
143
+ Verify the environment:
144
+ ```bash
145
+ claude -v
146
+ spec-orca doctor --backend claude --spec spec.yaml
147
+ ```
148
+
149
+ Minimal run:
150
+ ```bash
151
+ spec-orca run --backend claude --spec spec.yaml --max-steps 1 --allow-all
152
+ ```
153
+
154
+ Tool permissions:
155
+
156
+ Claude Code runs in non-interactive (`-p`) mode, which denies all tool use
157
+ by default. You **must** grant permissions or the agent will not be able to
158
+ read, write, or execute anything.
159
+
160
+ The quickest way to get started is `--allow-all`, which grants access to
161
+ every standard Claude Code tool (Bash, Read, Write, Edit, Glob, Grep,
162
+ WebFetch, WebSearch, NotebookEdit):
163
+
164
+ ```bash
165
+ spec-orca run --backend claude --spec spec.yaml --max-steps 3 --allow-all
166
+ ```
167
+
168
+ For tighter control, pass an explicit allowlist instead:
169
+
170
+ ```bash
171
+ spec-orca run --backend claude --spec spec.yaml \
172
+ --claude-allowed-tools "Read(*)" \
173
+ --claude-allowed-tools "Write(*)" \
174
+ --claude-allowed-tools "Edit(*)" \
175
+ --claude-disallowed-tools "Bash(*)"
176
+ ```
177
+
178
+ You can also block specific tools with `--claude-disallowed-tools` or
179
+ restrict to an exact set with `--claude-tools`.
180
+
181
+ Claude configuration precedence (highest to lowest):
182
+ 1) CLI flags
183
+ 2) Config file (`spec-orca.toml` or `[tool.spec_orca]` in `pyproject.toml`)
184
+ 3) Environment variables (`CLAUDE_CODE_*`)
185
+ 4) Defaults
186
+
187
+ Config example:
188
+ ```toml
189
+ [tool.spec_orca]
190
+ claude_bin = "claude"
191
+ claude_allowed_tools = ["read:*", "write:*"]
192
+ claude_disallowed_tools = ["rm:*"]
193
+ claude_tools = ["edit", "read"]
194
+ claude_max_turns = 4
195
+ claude_max_budget_usd = 2.5
196
+ claude_timeout_seconds = 300
197
+ claude_no_session_persistence = true
198
+ ```
199
+
200
+ ## Codex backend
201
+
202
+ Prerequisites:
203
+ - Install the OpenAI Codex CLI and ensure `codex` is on `PATH`.
204
+ - Verify the binary and doctor checks:
205
+
206
+ ```bash
207
+ codex --version
208
+ spec-orca doctor --backend codex --spec spec.yaml
209
+ ```
210
+
211
+ Minimal run:
212
+ ```bash
213
+ spec-orca run --backend codex --spec spec.yaml --max-steps 1
214
+ ```
215
+
216
+ Model and timeout options:
217
+ ```bash
218
+ spec-orca run --backend codex --spec spec.yaml \
219
+ --codex-model gpt-5-codex \
220
+ --codex-timeout-seconds 1800
221
+ ```
222
+
223
+ Execution notes:
224
+ - SpecOrca invokes Codex as `codex exec --full-auto --json "<prompt>"`.
225
+ - `--full-auto` enables unattended tool execution. Use it only in trusted repos.
226
+ - Codex configuration precedence (highest to lowest):
227
+ 1) CLI flags (`--codex-bin`, `--codex-model`, `--codex-timeout-seconds`)
228
+ 2) Config file (`spec-orca.toml` or `[tool.spec_orca]` in `pyproject.toml`)
229
+ 3) Environment variables (`CODEX_EXECUTABLE`, `CODEX_MODEL`, `CODEX_TIMEOUT`)
230
+ 4) Defaults
231
+
232
+ ## Interactive interview
233
+
234
+ The `interview` command starts a guided requirements-gathering session. An AI
235
+ interviewer helps you articulate goals, constraints, and acceptance criteria
236
+ through a structured conversation flow:
237
+
238
+ 1. **Scoping** — the interviewer asks what you want to achieve.
239
+ 2. **Choice** — you pick between an improvement analysis or your own specific path.
240
+ 3. **Follow-up** — the conversation continues with clarifying questions until
241
+ requirements are clear.
242
+
243
+ At the end of the session the gathered requirements are compiled into a valid
244
+ spec YAML file that can be fed directly into `spec-orca run`.
245
+
246
+ ```bash
247
+ # Start an interview with the mock backend
248
+ spec-orca interview
249
+
250
+ # Use a real backend for smarter follow-up questions
251
+ spec-orca interview --backend claude
252
+
253
+ # Save the generated spec to a file automatically
254
+ spec-orca interview --backend claude --output spec.yaml
255
+ ```
256
+
257
+ ## Development
258
+
259
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for full details.
260
+
261
+ ```bash
262
+ # Install with dev dependencies
263
+ pip install -e ".[dev]"
264
+
265
+ # Run all checks (format, lint, typecheck, tests)
266
+ nox
267
+
268
+ # Run individual sessions
269
+ nox -s fmt # auto-format
270
+ nox -s lint # ruff lint
271
+ nox -s typecheck # mypy strict
272
+ nox -s tests # pytest + coverage
273
+
274
+ # Install pre-commit hooks
275
+ pre-commit install
276
+ ```
277
+
278
+ ### Auto-commit (opt-in)
279
+
280
+ When iterating on this repository you can let SpecOrca commit
281
+ changes automatically after each successful run:
282
+
283
+ ```bash
284
+ # Commit with an auto-generated message
285
+ spec-orca run --spec spec.yaml --auto-commit
286
+
287
+ # Add a Conventional Commit prefix
288
+ spec-orca run --spec spec.yaml --auto-commit --commit-prefix feat
289
+
290
+ # Multi-step run with auto-commit
291
+ spec-orca run --spec spec.yaml --max-steps 3 --auto-commit --commit-prefix chore
292
+ ```
293
+
294
+ Behaviour:
295
+ - **Off by default** - auto-commit only runs when `--auto-commit` is passed.
296
+ - Only **tracked files** are staged (`git add -u`).
297
+ - **No commit on a clean tree** - if nothing changed, the commit is skipped.
298
+ - **No commit on failed runs** - runs that exit non-zero never auto-commit.
299
+ - Commit messages are single-line, normalized, and include the prefix when
300
+ provided (e.g. `feat: spec-orca run: Add widgets`).
301
+ - The git helper lives in `spec_orca/dev/git.py` and does not affect
302
+ the core orchestration logic.
303
+
304
+ ## Project layout
305
+
306
+ ```
307
+ src/spec_orca/ # installable package
308
+ tests/ # pytest test suite
309
+ noxfile.py # dev task runner
310
+ pyproject.toml # PEP 621 metadata + tool config
311
+ ```
312
+
313
+ ## Documentation
314
+
315
+ - [ARCHITECTURE.md](ARCHITECTURE.md) — system design and module map
316
+ - [CHANGELOG.md](CHANGELOG.md) — release history (Keep a Changelog)
317
+ - [CONTRIBUTING.md](CONTRIBUTING.md) — how to contribute
318
+ - [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) — community standards
319
+ - [SECURITY.md](SECURITY.md) — vulnerability reporting