agentic-dev-loop 0.2.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 (47) hide show
  1. agentic_dev_loop-0.2.0/LICENSE +201 -0
  2. agentic_dev_loop-0.2.0/PKG-INFO +316 -0
  3. agentic_dev_loop-0.2.0/README.md +278 -0
  4. agentic_dev_loop-0.2.0/pyproject.toml +59 -0
  5. agentic_dev_loop-0.2.0/setup.cfg +4 -0
  6. agentic_dev_loop-0.2.0/src/agentic_dev_loop/__init__.py +1 -0
  7. agentic_dev_loop-0.2.0/src/agentic_dev_loop/actions.py +189 -0
  8. agentic_dev_loop-0.2.0/src/agentic_dev_loop/agents.py +49 -0
  9. agentic_dev_loop-0.2.0/src/agentic_dev_loop/cli.py +82 -0
  10. agentic_dev_loop-0.2.0/src/agentic_dev_loop/config.py +156 -0
  11. agentic_dev_loop-0.2.0/src/agentic_dev_loop/extensions/__init__.py +0 -0
  12. agentic_dev_loop-0.2.0/src/agentic_dev_loop/extensions/aidlc.py +152 -0
  13. agentic_dev_loop-0.2.0/src/agentic_dev_loop/graph.py +275 -0
  14. agentic_dev_loop-0.2.0/src/agentic_dev_loop/llm.py +60 -0
  15. agentic_dev_loop-0.2.0/src/agentic_dev_loop/loaders.py +60 -0
  16. agentic_dev_loop-0.2.0/src/agentic_dev_loop/outputs.py +147 -0
  17. agentic_dev_loop-0.2.0/src/agentic_dev_loop/proc.py +54 -0
  18. agentic_dev_loop-0.2.0/src/agentic_dev_loop/py.typed +0 -0
  19. agentic_dev_loop-0.2.0/src/agentic_dev_loop/registry.py +133 -0
  20. agentic_dev_loop-0.2.0/src/agentic_dev_loop/results.py +41 -0
  21. agentic_dev_loop-0.2.0/src/agentic_dev_loop/stages.py +423 -0
  22. agentic_dev_loop-0.2.0/src/agentic_dev_loop/viz.py +1148 -0
  23. agentic_dev_loop-0.2.0/src/agentic_dev_loop.egg-info/PKG-INFO +316 -0
  24. agentic_dev_loop-0.2.0/src/agentic_dev_loop.egg-info/SOURCES.txt +45 -0
  25. agentic_dev_loop-0.2.0/src/agentic_dev_loop.egg-info/dependency_links.txt +1 -0
  26. agentic_dev_loop-0.2.0/src/agentic_dev_loop.egg-info/entry_points.txt +2 -0
  27. agentic_dev_loop-0.2.0/src/agentic_dev_loop.egg-info/requires.txt +10 -0
  28. agentic_dev_loop-0.2.0/src/agentic_dev_loop.egg-info/top_level.txt +1 -0
  29. agentic_dev_loop-0.2.0/tests/test_actions.py +346 -0
  30. agentic_dev_loop-0.2.0/tests/test_agents.py +88 -0
  31. agentic_dev_loop-0.2.0/tests/test_aidlc.py +289 -0
  32. agentic_dev_loop-0.2.0/tests/test_cli.py +317 -0
  33. agentic_dev_loop-0.2.0/tests/test_config.py +374 -0
  34. agentic_dev_loop-0.2.0/tests/test_e2e_fixtures.py +238 -0
  35. agentic_dev_loop-0.2.0/tests/test_graph.py +454 -0
  36. agentic_dev_loop-0.2.0/tests/test_llm.py +123 -0
  37. agentic_dev_loop-0.2.0/tests/test_loaders.py +118 -0
  38. agentic_dev_loop-0.2.0/tests/test_outputs.py +182 -0
  39. agentic_dev_loop-0.2.0/tests/test_outputs_pbt.py +104 -0
  40. agentic_dev_loop-0.2.0/tests/test_proc.py +115 -0
  41. agentic_dev_loop-0.2.0/tests/test_publish.py +290 -0
  42. agentic_dev_loop-0.2.0/tests/test_registry.py +114 -0
  43. agentic_dev_loop-0.2.0/tests/test_results.py +57 -0
  44. agentic_dev_loop-0.2.0/tests/test_sdk_compat.py +68 -0
  45. agentic_dev_loop-0.2.0/tests/test_stages.py +466 -0
  46. agentic_dev_loop-0.2.0/tests/test_verdict.py +200 -0
  47. agentic_dev_loop-0.2.0/tests/test_viz.py +1203 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,316 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentic-dev-loop
3
+ Version: 0.2.0
4
+ Summary: Opinionated LangGraph engine for OpenHands agent pipelines
5
+ Author: Luke Wilson
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/lukedawilson/agentic-dev-loop
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Topic :: Security
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.12
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: openhands-sdk~=1.17.0
29
+ Requires-Dist: openhands-tools~=1.17.0
30
+ Requires-Dist: langgraph>=1.2
31
+ Requires-Dist: langgraph-checkpoint-sqlite>=3.0
32
+ Requires-Dist: pydantic>=2.0
33
+ Requires-Dist: PyYAML>=6.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: hypothesis>=6.0; extra == "dev"
36
+ Requires-Dist: pytest>=8.0; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # agentic-dev-loop
40
+
41
+ An opinionated library for building **stage-gated autonomous dev pipelines**.
42
+ A pipeline is a YAML file of steps; each step runs an OpenHands agent (with a
43
+ file-artifact verdict protocol), a deterministic Python action, or a
44
+ mechanical shell command (exit code = verdict); LangGraph drives routing,
45
+ retries, checkpoints and resume. The fixed policies — artifact hygiene,
46
+ attempt-bounded retries, fail-fast on empty context, a single gated commit
47
+ point — are the product.
48
+
49
+ Publicly depends on [OpenHands SDK](https://github.com/OpenHands/software-agent-sdk)
50
+ for agent execution and [LangGraph](https://github.com/langchain-ai/langgraph)
51
+ (+ `langgraph-checkpoint-sqlite`) for the state graph.
52
+
53
+ ## Install & test
54
+
55
+ ```bash
56
+ pip install agentic-dev-loop # published release
57
+ pip install -e . # from this repo (development)
58
+ python -m pytest tests/ -q
59
+ ```
60
+
61
+ Requires Python ≥ 3.12.
62
+
63
+ ## Quick start
64
+
65
+ ```bash
66
+ export OPENAI_API_KEY=... # whatever env var your pipeline's api_key_env names
67
+ agentic-dev-loop agentic-dev-loop/pipeline.yaml --plan plan.md
68
+ agentic-dev-loop agentic-dev-loop/pipeline.yaml --ai-dlc-unit U2
69
+ agentic-dev-loop agentic-dev-loop/pipeline.yaml --resume <thread-id> --max-attempts 5
70
+ ./trigger-agentic-dev-loop.sh --plan plan.md # same thing, from the repo root
71
+ ```
72
+
73
+ Exit code is `0` on pipeline success, `1` otherwise. Each run prints its
74
+ thread id; `--resume` continues the latest checkpoint of a previous thread
75
+ (crash, Ctrl-C, exhaustion) with all accumulated notes intact. A live graph
76
+ view is served on localhost by default (browser auto-opens; `--viz-port`
77
+ sets a preferred port, default 8321) — pass `--no-viz` to suppress it. A
78
+ stale viz server from a crashed run of the same repo is swept automatically
79
+ at startup; if another repo's run holds the port, the engine prints a notice
80
+ and serves on a free port. The sidebar
81
+ nests each stage's console output (ANSI colours preserved) under a
82
+ collapsible section: completed stages auto-collapse, the running stage stays
83
+ expanded and live-tails its console. To eyeball the viz page without
84
+ running a pipeline, `.venv/bin/python viz_demo.py` serves the real topology
85
+ and replays a scripted run (every node state, verdict badges, retry cycle).
86
+
87
+ `--ai-dlc-unit` accepts any unambiguous spelling of a unit number — `U2`,
88
+ `2`, `U002`, `002` — or the full unit slug (`U002-custom-configuration`).
89
+ If multiple unit directories match one id, the run fails loudly naming
90
+ every candidate; pass the full slug to disambiguate.
91
+
92
+ ## What a run looks like
93
+
94
+ The shipped self-loop example (`agentic-dev-loop/`, launched from the repo root
95
+ so the pipeline constructs this library itself) is:
96
+
97
+ ```
98
+ dev ──▶ test ──▶ review ──▶ qa ──▶ commit
99
+ ▲ │ │ │
100
+ └──────────┴─────────┴─────────┘ fail verdicts / a failing test gate
101
+ retry to dev (attempt-bounded)
102
+ ```
103
+
104
+ 1. **dev** runs the `dev` agent with full context (selected docs +
105
+ `additional_files:` + auto-generated expected-output paths). Its writes
106
+ are untracked; the pipeline only cares about declared `produces:` files.
107
+ 2. **test** is a mechanical command step: it runs the suite
108
+ (`.venv/bin/python -m pytest tests/ -q`) in the workspace shell. Exit 0
109
+ passes and moves on; anything else (including no exit by `timeout`) fails
110
+ and rewinds to `dev` with the failing output in the retry note.
111
+ 3. **review / qa** are verdict agents: each must write its declared
112
+ artifact (e.g. `.pr/qa-report.md`) whose **last** `VERDICT: <word>` line
113
+ decides routing. `pass` follows `on_pass`, `fail` follows `on_fail` —
114
+ here `{goto: dev, retry: true}`, which consumes an attempt and feeds the
115
+ artifact back to the dev agent as a retry note.
116
+ 4. **commit** is the single commit point: `git add -A` + templated message,
117
+ but only when the worktree was clean at run start (your in-progress edits
118
+ are never swept into a loop commit).
119
+ 5. Attempts are bounded by `max_attempts` (YAML or `--max-attempts`).
120
+ Exhaustion or a `failure` route ends the run; `success` commits and exits.
121
+
122
+ Every stage boundary is checkpointed to `<state_dir>/loop-checkpoints.sqlite`
123
+ — resume loses nothing but the in-flight stage.
124
+
125
+ ## pipeline.yaml reference
126
+
127
+ Verbatim from `agentic-dev-loop/pipeline.yaml` (comments added):
128
+
129
+ ```yaml
130
+ name: agentic-dev-loop-construction
131
+ extensions:
132
+ - agentic_dev_loop.extensions.aidlc:AidlcExtension
133
+ additional_files:
134
+ - ../README.md # shared context for every agent step
135
+
136
+ llm:
137
+ model: openai/deepseek-v4-pro
138
+ base_url: https://api.deepseek.com
139
+ api_key_env: OPENAI_API_KEY # missing env var → run fails fast, naming it
140
+ # timeout: null # default = no client timeout (long agent runs)
141
+
142
+ state_dir: .pr # artifacts + checkpoints live here
143
+ max_attempts: 10 # retries across the whole graph
144
+ agents_dir: sdk_agents # consumer-owned <name>.agent.md files
145
+
146
+ steps:
147
+ - name: dev
148
+ agent: dev # → sdk_agents/dev.agent.md
149
+ produces: implementation-summary.md # written under state_dir (str or list)
150
+ on_pass: test # explicit; omitted → next step in order
151
+
152
+ - name: test
153
+ command: .venv/bin/python -m pytest tests/ -q # mechanical: exit code is the verdict
154
+ timeout: 600 # seconds; SIGKILLs the process group
155
+ on_pass: review
156
+ on_fail: {goto: dev, retry: true}
157
+
158
+ - name: review
159
+ agent: review
160
+ artifact: review-findings.md
161
+ verdicts: {pass: APPROVED, fail: NEEDS CHANGES}
162
+ on_pass: qa
163
+ on_fail: {goto: dev, retry: true}
164
+
165
+ - name: qa
166
+ agent: qa
167
+ artifact: qa-report.md
168
+ max_iterations: 200 # per-run agent iteration cap
169
+ verdicts: {pass: PASS, fail: FAIL}
170
+ on_pass: commit
171
+ on_fail: {goto: dev, retry: true}
172
+
173
+ - name: commit
174
+ action: commit # built-in action
175
+ on_pass: success # terminal (also the default for the last step)
176
+ params:
177
+ message: "feat: construct {subject} (agent dev loop)" # {subject} templated
178
+ ```
179
+
180
+ ### Step types
181
+
182
+ How a step behaves is determined solely by which of three mutually-exclusive
183
+ keys it carries — exactly one of `agent:`, `command:`, or `action:` is
184
+ required, an empty value does not count, and zero or several keys fail to
185
+ load. Graph-building dispatches on this `kind` (see `StepConfig.kind` in
186
+ `config.py`).
187
+
188
+ - **`agent: <name>`** — an *agent step*: loads `sdk_agents/<name>.agent.md`
189
+ and runs it via the OpenHands SDK against the accumulated context. May
190
+ declare `produces:` (hygiene-tracked outputs, no verdict parsing) or
191
+ `artifact:` + `verdicts:` (verdict-parsed routing). `max_iterations` caps
192
+ the agent's own loop.
193
+ - **`command: <shell>`** — a *command step*: mechanical, never an LLM call.
194
+ The command runs in the workspace shell; exit 0 passes, anything else
195
+ (including no exit by `timeout`) fails. `timeout:` is its only extra field.
196
+ - **`action: <name>`** — an *action step*: invokes a registered node-shaped
197
+ function `(state, params) -> state update` with the step's `params:`. The
198
+ built-in is `commit`; extensions register more via `registry.add_action`.
199
+ Unknown action names fail at graph build time, not mid-run.
200
+
201
+ - `agent`, `action`, and `command` are mutually exclusive; exactly one is
202
+ required — an empty value does not count.
203
+
204
+ ### Step semantics
205
+
206
+ - A `command` step is **mechanical** — the command runs in the workspace
207
+ shell; exit 0 passes, anything else (including no exit by `timeout`,
208
+ default 600s) fails and follows `on_fail` with the output tail in the
209
+ retry note. The kind is the `command:` key, never the step's name.
210
+ - `artifact` + `verdicts` mark a **verdict step**. `on_pass`/`on_fail` may be
211
+ a step name, the terminal `success`/`failure`, or `{goto: X, retry: true}`.
212
+ `on_pass` omitted → next step in list order. `on_fail` omitted → `failure`.
213
+ No loops happen unless you write them.
214
+ - A verdict agent that writes nothing, or writes an artifact with no
215
+ parseable verdict, triggers an attempt-bounded retry with a note — verdicts
216
+ are never silently routable, and the **last** verdict line wins (markdown
217
+ decoration like `**VERDICT: PASS**` is tolerated).
218
+ - `produces:` / `artifact` files are deleted at every attempt start, so a
219
+ retry can never re-read a stale artifact from the previous attempt.
220
+ - `params` on the `commit` action support `{subject}` templating
221
+ (e.g. `"feat: {subject} (agent dev loop)"`).
222
+
223
+ ## Extension points
224
+
225
+ Extensions are plain Python classes referenced by `extensions:` entries as
226
+ `module:Class` (the module must be importable — e.g. on `PYTHONPATH`):
227
+
228
+ ```python
229
+ class MyExtension:
230
+ name = "mine"
231
+ def register(self, registry) -> None:
232
+ registry.add_action("run_conformance", run_conformance) # step actions
233
+ registry.add_tool("figma", FigmaTool) # OpenHands tools
234
+ registry.add_document_loader(MyLoader()) # context sources
235
+ ```
236
+
237
+ Working samples of all three kinds ship as the test fixture
238
+ `tests/sample_ext.py` (actions, tools, a document loader — plus constructor-
239
+ failure coverage).
240
+
241
+ **Actions** receive `(state, params)`; returning continues the pipeline,
242
+ raising fails the run. Actions have no verdict channel — for retry-driven
243
+ fixing, prefer a verdict agent step.
244
+
245
+ **Document loaders** decide which docs enter the run context:
246
+
247
+ ```python
248
+ class MyLoader:
249
+ name = "wiki"
250
+ defaultable = False # may autodetect when no flag is given?
251
+ def add_cli_args(self, parser): # flag defaults MUST be None
252
+ parser.add_argument("--wiki-page", default=None)
253
+ def resolve(self, args): # -> (docs: dict[str, str], subject: str)
254
+ return fetch_docs(args.wiki_page), f"wiki {args.wiki_page}"
255
+ ```
256
+
257
+ Loader-selection flow: a loader's flag in argv selects it; flags from two
258
+ loaders in one invocation error out; with no flag, the sole `defaultable`
259
+ loader autoruns (the bundled `ai-dlc` loader autodetects the current unit
260
+ from `aidlc-docs/aidlc-state.md`), otherwise the run proceeds with no
261
+ injected docs and the pipeline `name:` as subject. Unit ids resolve by
262
+ exact directory name or by numeric prefix (`unit-004-preset-management`
263
+ answers to `4`, `004`, `U4`, `U004`, or its full slug); ambiguous ids fail
264
+ loud listing all matches. A selected loader that
265
+ yields zero docs **fails fast** — context is never silently degraded.
266
+ Duplicate CLI option strings across loaders are a load-time error naming both.
267
+
268
+ ## Fixed policies (intentionally not configurable)
269
+
270
+ - **Fail fast on missing config/secrets** — no silent fallbacks.
271
+ - **Verdicts are file artifacts under `state_dir`**; the last
272
+ decoration-tolerant `VERDICT: X` line wins.
273
+ - **Attempt-bounded retries** with full retry-note accumulation.
274
+ - **Per-attempt artifact hygiene** — stale artifacts are deleted, never
275
+ re-parsed.
276
+ - **Single commit point**, gated on a clean-at-start worktree; the commit
277
+ action no-ops rather than sweep up your unrelated edits.
278
+ - **Unclear verdicts are never routable** — always an attempt-bounded retry.
279
+ - **Command steps are mechanical** — never an LLM call; the exit code is the
280
+ verdict; a timeout kills the process group.
281
+ - **Port sweeps are explicit actions** with required `port`, optional
282
+ `match` substring filter — the startup sweep of the engine's own viz
283
+ server (cwd-scoped, best-effort) is the one built-in exception.
284
+ - **No client-side LLM timeout by default** (`timeout: null`) — agent runs
285
+ are long; set `timeout` if your provider needs one.
286
+ - **Crash-safe resume** — every stage boundary is a checkpoint.
287
+
288
+ ## The example consumer
289
+
290
+ `agentic-dev-loop/` is a complete, runnable consumer that turns the library on
291
+ its own repo: the pipeline above, its three agent definitions (`sdk_agents/`),
292
+ and this README wired in as shared context. Run it from the repo root with
293
+ `./trigger-agentic-dev-loop.sh --plan plan.md`. The e2e suite
294
+ (`tests/test_e2e_fixtures.py`) replays historical failure fixtures against
295
+ it — markdown-decorated verdicts, stale-artifact hygiene, verdict-first
296
+ truncation, unclear-verdict retry, dirty-worktree commit skip, and
297
+ empty-context fail-fast.
298
+
299
+ ## AI-DLC
300
+
301
+ The development lifecycle workflow lives in
302
+ `.aidlc/aidlc-rules/aws-aidlc-rules/core-workflow.md` (the entry point;
303
+ phase details under `aws-aidlc-rule-details/`). Working docs — plans, user
304
+ stories, units of work, state — live in `aidlc-docs/`, created as the
305
+ workflow runs. The bundled `ai-dlc` document loader (see Extension points)
306
+ wires the pipeline's `--ai-dlc-unit` flag to those docs.
307
+
308
+ OpenCode commands over the workflow: `/epic-status`, `/ticket-details`,
309
+ `/unit-status`, `/update-subtask` (ticket boards over `aidlc-docs/`),
310
+ `/apply-aidlc-patches` (numbered `.patch` files under `.aidlc/aidlc-patches/`,
311
+ applied by `apply-patches.sh`), `/load-backend-rules`
312
+ (`coding-standards-ddd.yaml`), `/software-selection`, `/postmortem`,
313
+ `/figma`, and `/export-opencode-tools-to-claude` (syncs commands and skills
314
+ into `.claude-local/` for the Claude CLI).
315
+
316
+ Skills: `brainstorming`, `hypothesis-generation`, `writing-plans`.