thehood 0.1.0-preview.0

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 (274) hide show
  1. package/CODE_OF_CONDUCT.md +21 -0
  2. package/CONTRIBUTING.md +58 -0
  3. package/LICENSE +21 -0
  4. package/PRIVACY.md +49 -0
  5. package/README.md +264 -0
  6. package/SECURITY.md +31 -0
  7. package/dist/bridges/chatgptWebBridge.d.ts +2 -0
  8. package/dist/bridges/chatgptWebBridge.js +981 -0
  9. package/dist/bridges/chatgptWebBridge.js.map +1 -0
  10. package/dist/cli/args.d.ts +9 -0
  11. package/dist/cli/args.js +82 -0
  12. package/dist/cli/args.js.map +1 -0
  13. package/dist/cli/format.d.ts +56 -0
  14. package/dist/cli/format.js +752 -0
  15. package/dist/cli/format.js.map +1 -0
  16. package/dist/cli/main.d.ts +2 -0
  17. package/dist/cli/main.js +996 -0
  18. package/dist/cli/main.js.map +1 -0
  19. package/dist/cli/mcpConfig.d.ts +36 -0
  20. package/dist/cli/mcpConfig.js +98 -0
  21. package/dist/cli/mcpConfig.js.map +1 -0
  22. package/dist/index.d.ts +37 -0
  23. package/dist/index.js +38 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/mcp/protocol.d.ts +44 -0
  26. package/dist/mcp/protocol.js +33 -0
  27. package/dist/mcp/protocol.js.map +1 -0
  28. package/dist/mcp/server.d.ts +1 -0
  29. package/dist/mcp/server.js +106 -0
  30. package/dist/mcp/server.js.map +1 -0
  31. package/dist/mcp/tools.d.ts +10 -0
  32. package/dist/mcp/tools.js +2200 -0
  33. package/dist/mcp/tools.js.map +1 -0
  34. package/dist/mcp/validation.d.ts +8 -0
  35. package/dist/mcp/validation.js +67 -0
  36. package/dist/mcp/validation.js.map +1 -0
  37. package/dist/providers/chatgptWeb.d.ts +2 -0
  38. package/dist/providers/chatgptWeb.js +26 -0
  39. package/dist/providers/chatgptWeb.js.map +1 -0
  40. package/dist/providers/claudeCode.d.ts +4 -0
  41. package/dist/providers/claudeCode.js +32 -0
  42. package/dist/providers/claudeCode.js.map +1 -0
  43. package/dist/providers/codexCli.d.ts +6 -0
  44. package/dist/providers/codexCli.js +25 -0
  45. package/dist/providers/codexCli.js.map +1 -0
  46. package/dist/providers/codexCliModels.d.ts +23 -0
  47. package/dist/providers/codexCliModels.js +147 -0
  48. package/dist/providers/codexCliModels.js.map +1 -0
  49. package/dist/providers/localCommand.d.ts +26 -0
  50. package/dist/providers/localCommand.js +614 -0
  51. package/dist/providers/localCommand.js.map +1 -0
  52. package/dist/providers/markdownPayload.d.ts +7 -0
  53. package/dist/providers/markdownPayload.js +29 -0
  54. package/dist/providers/markdownPayload.js.map +1 -0
  55. package/dist/providers/responseSchema.d.ts +3 -0
  56. package/dist/providers/responseSchema.js +187 -0
  57. package/dist/providers/responseSchema.js.map +1 -0
  58. package/dist/providers/router.d.ts +3 -0
  59. package/dist/providers/router.js +21 -0
  60. package/dist/providers/router.js.map +1 -0
  61. package/dist/providers/stub.d.ts +2 -0
  62. package/dist/providers/stub.js +177 -0
  63. package/dist/providers/stub.js.map +1 -0
  64. package/dist/providers/types.d.ts +37 -0
  65. package/dist/providers/types.js +2 -0
  66. package/dist/providers/types.js.map +1 -0
  67. package/dist/runtime/agentBoard.d.ts +79 -0
  68. package/dist/runtime/agentBoard.js +166 -0
  69. package/dist/runtime/agentBoard.js.map +1 -0
  70. package/dist/runtime/agentBoardArtifact.d.ts +9 -0
  71. package/dist/runtime/agentBoardArtifact.js +171 -0
  72. package/dist/runtime/agentBoardArtifact.js.map +1 -0
  73. package/dist/runtime/agentRunner.d.ts +17 -0
  74. package/dist/runtime/agentRunner.js +92 -0
  75. package/dist/runtime/agentRunner.js.map +1 -0
  76. package/dist/runtime/approvalInbox.d.ts +54 -0
  77. package/dist/runtime/approvalInbox.js +143 -0
  78. package/dist/runtime/approvalInbox.js.map +1 -0
  79. package/dist/runtime/approvalPolicy.d.ts +11 -0
  80. package/dist/runtime/approvalPolicy.js +58 -0
  81. package/dist/runtime/approvalPolicy.js.map +1 -0
  82. package/dist/runtime/artifacts.d.ts +23 -0
  83. package/dist/runtime/artifacts.js +48 -0
  84. package/dist/runtime/artifacts.js.map +1 -0
  85. package/dist/runtime/browserManager.d.ts +37 -0
  86. package/dist/runtime/browserManager.js +356 -0
  87. package/dist/runtime/browserManager.js.map +1 -0
  88. package/dist/runtime/canonicalMemory.d.ts +23 -0
  89. package/dist/runtime/canonicalMemory.js +134 -0
  90. package/dist/runtime/canonicalMemory.js.map +1 -0
  91. package/dist/runtime/chatGptPageReadiness.d.ts +16 -0
  92. package/dist/runtime/chatGptPageReadiness.js +74 -0
  93. package/dist/runtime/chatGptPageReadiness.js.map +1 -0
  94. package/dist/runtime/commandRunner.d.ts +18 -0
  95. package/dist/runtime/commandRunner.js +115 -0
  96. package/dist/runtime/commandRunner.js.map +1 -0
  97. package/dist/runtime/commandSafety.d.ts +7 -0
  98. package/dist/runtime/commandSafety.js +61 -0
  99. package/dist/runtime/commandSafety.js.map +1 -0
  100. package/dist/runtime/config.d.ts +10 -0
  101. package/dist/runtime/config.js +107 -0
  102. package/dist/runtime/config.js.map +1 -0
  103. package/dist/runtime/crewLanes.d.ts +2 -0
  104. package/dist/runtime/crewLanes.js +123 -0
  105. package/dist/runtime/crewLanes.js.map +1 -0
  106. package/dist/runtime/criticPolicy.d.ts +17 -0
  107. package/dist/runtime/criticPolicy.js +50 -0
  108. package/dist/runtime/criticPolicy.js.map +1 -0
  109. package/dist/runtime/defaults.d.ts +5 -0
  110. package/dist/runtime/defaults.js +100 -0
  111. package/dist/runtime/defaults.js.map +1 -0
  112. package/dist/runtime/directives.d.ts +3 -0
  113. package/dist/runtime/directives.js +218 -0
  114. package/dist/runtime/directives.js.map +1 -0
  115. package/dist/runtime/doctor.d.ts +36 -0
  116. package/dist/runtime/doctor.js +185 -0
  117. package/dist/runtime/doctor.js.map +1 -0
  118. package/dist/runtime/errors.d.ts +20 -0
  119. package/dist/runtime/errors.js +41 -0
  120. package/dist/runtime/errors.js.map +1 -0
  121. package/dist/runtime/externalTransfer.d.ts +20 -0
  122. package/dist/runtime/externalTransfer.js +156 -0
  123. package/dist/runtime/externalTransfer.js.map +1 -0
  124. package/dist/runtime/fanout.d.ts +64 -0
  125. package/dist/runtime/fanout.js +263 -0
  126. package/dist/runtime/fanout.js.map +1 -0
  127. package/dist/runtime/gitEvidence.d.ts +10 -0
  128. package/dist/runtime/gitEvidence.js +80 -0
  129. package/dist/runtime/gitEvidence.js.map +1 -0
  130. package/dist/runtime/handoffs.d.ts +32 -0
  131. package/dist/runtime/handoffs.js +100 -0
  132. package/dist/runtime/handoffs.js.map +1 -0
  133. package/dist/runtime/ids.d.ts +2 -0
  134. package/dist/runtime/ids.js +4 -0
  135. package/dist/runtime/ids.js.map +1 -0
  136. package/dist/runtime/localStateIgnore.d.ts +9 -0
  137. package/dist/runtime/localStateIgnore.js +98 -0
  138. package/dist/runtime/localStateIgnore.js.map +1 -0
  139. package/dist/runtime/loop.d.ts +14 -0
  140. package/dist/runtime/loop.js +1863 -0
  141. package/dist/runtime/loop.js.map +1 -0
  142. package/dist/runtime/loopRecommendation.d.ts +109 -0
  143. package/dist/runtime/loopRecommendation.js +566 -0
  144. package/dist/runtime/loopRecommendation.js.map +1 -0
  145. package/dist/runtime/loopResponsibilities.d.ts +2 -0
  146. package/dist/runtime/loopResponsibilities.js +395 -0
  147. package/dist/runtime/loopResponsibilities.js.map +1 -0
  148. package/dist/runtime/loopRunner.d.ts +28 -0
  149. package/dist/runtime/loopRunner.js +81 -0
  150. package/dist/runtime/loopRunner.js.map +1 -0
  151. package/dist/runtime/operatorNextActions.d.ts +2 -0
  152. package/dist/runtime/operatorNextActions.js +344 -0
  153. package/dist/runtime/operatorNextActions.js.map +1 -0
  154. package/dist/runtime/paths.d.ts +9 -0
  155. package/dist/runtime/paths.js +14 -0
  156. package/dist/runtime/paths.js.map +1 -0
  157. package/dist/runtime/permissions.d.ts +9 -0
  158. package/dist/runtime/permissions.js +73 -0
  159. package/dist/runtime/permissions.js.map +1 -0
  160. package/dist/runtime/progressPacket.d.ts +12 -0
  161. package/dist/runtime/progressPacket.js +512 -0
  162. package/dist/runtime/progressPacket.js.map +1 -0
  163. package/dist/runtime/protectedPaths.d.ts +6 -0
  164. package/dist/runtime/protectedPaths.js +48 -0
  165. package/dist/runtime/protectedPaths.js.map +1 -0
  166. package/dist/runtime/providers.d.ts +13 -0
  167. package/dist/runtime/providers.js +60 -0
  168. package/dist/runtime/providers.js.map +1 -0
  169. package/dist/runtime/reconciliation.d.ts +17 -0
  170. package/dist/runtime/reconciliation.js +283 -0
  171. package/dist/runtime/reconciliation.js.map +1 -0
  172. package/dist/runtime/redaction.d.ts +1 -0
  173. package/dist/runtime/redaction.js +5 -0
  174. package/dist/runtime/redaction.js.map +1 -0
  175. package/dist/runtime/remoteRepoContext.d.ts +77 -0
  176. package/dist/runtime/remoteRepoContext.js +316 -0
  177. package/dist/runtime/remoteRepoContext.js.map +1 -0
  178. package/dist/runtime/repoContext.d.ts +50 -0
  179. package/dist/runtime/repoContext.js +399 -0
  180. package/dist/runtime/repoContext.js.map +1 -0
  181. package/dist/runtime/repoGateway.d.ts +64 -0
  182. package/dist/runtime/repoGateway.js +308 -0
  183. package/dist/runtime/repoGateway.js.map +1 -0
  184. package/dist/runtime/responseContracts.d.ts +3 -0
  185. package/dist/runtime/responseContracts.js +86 -0
  186. package/dist/runtime/responseContracts.js.map +1 -0
  187. package/dist/runtime/reviewLanes.d.ts +2 -0
  188. package/dist/runtime/reviewLanes.js +343 -0
  189. package/dist/runtime/reviewLanes.js.map +1 -0
  190. package/dist/runtime/reviewRouting.d.ts +51 -0
  191. package/dist/runtime/reviewRouting.js +152 -0
  192. package/dist/runtime/reviewRouting.js.map +1 -0
  193. package/dist/runtime/revisionPacket.d.ts +38 -0
  194. package/dist/runtime/revisionPacket.js +144 -0
  195. package/dist/runtime/revisionPacket.js.map +1 -0
  196. package/dist/runtime/revisionTrail.d.ts +2 -0
  197. package/dist/runtime/revisionTrail.js +162 -0
  198. package/dist/runtime/revisionTrail.js.map +1 -0
  199. package/dist/runtime/role-assignment.d.ts +4 -0
  200. package/dist/runtime/role-assignment.js +21 -0
  201. package/dist/runtime/role-assignment.js.map +1 -0
  202. package/dist/runtime/roleRoster.d.ts +28 -0
  203. package/dist/runtime/roleRoster.js +96 -0
  204. package/dist/runtime/roleRoster.js.map +1 -0
  205. package/dist/runtime/runInsights.d.ts +121 -0
  206. package/dist/runtime/runInsights.js +305 -0
  207. package/dist/runtime/runInsights.js.map +1 -0
  208. package/dist/runtime/runMonitor.d.ts +33 -0
  209. package/dist/runtime/runMonitor.js +143 -0
  210. package/dist/runtime/runMonitor.js.map +1 -0
  211. package/dist/runtime/runtime.d.ts +15 -0
  212. package/dist/runtime/runtime.js +199 -0
  213. package/dist/runtime/runtime.js.map +1 -0
  214. package/dist/runtime/runtimeInfo.d.ts +9 -0
  215. package/dist/runtime/runtimeInfo.js +76 -0
  216. package/dist/runtime/runtimeInfo.js.map +1 -0
  217. package/dist/runtime/store.d.ts +4 -0
  218. package/dist/runtime/store.js +48 -0
  219. package/dist/runtime/store.js.map +1 -0
  220. package/dist/runtime/summons.d.ts +25 -0
  221. package/dist/runtime/summons.js +403 -0
  222. package/dist/runtime/summons.js.map +1 -0
  223. package/dist/runtime/teamPresets.d.ts +14 -0
  224. package/dist/runtime/teamPresets.js +153 -0
  225. package/dist/runtime/teamPresets.js.map +1 -0
  226. package/dist/runtime/types.d.ts +505 -0
  227. package/dist/runtime/types.js +28 -0
  228. package/dist/runtime/types.js.map +1 -0
  229. package/dist/runtime/validationCommands.d.ts +18 -0
  230. package/dist/runtime/validationCommands.js +106 -0
  231. package/dist/runtime/validationCommands.js.map +1 -0
  232. package/dist/tui/dashboard.d.ts +41 -0
  233. package/dist/tui/dashboard.js +1115 -0
  234. package/dist/tui/dashboard.js.map +1 -0
  235. package/docs/ARCHITECTURE.md +277 -0
  236. package/docs/CLI_SPEC.md +396 -0
  237. package/docs/CODEX_SETUP.md +288 -0
  238. package/docs/COMPLETION_CONTRACT.md +52 -0
  239. package/docs/CONTRIBUTOR_GUIDE.md +70 -0
  240. package/docs/DEMO.md +62 -0
  241. package/docs/GLOSSARY.md +46 -0
  242. package/docs/GOAL_LOOP_SCHEDULE.md +50 -0
  243. package/docs/KNOWN_LIMITATIONS.md +29 -0
  244. package/docs/LICENSING.md +21 -0
  245. package/docs/LOOP_RECIPES.md +290 -0
  246. package/docs/LOOP_SELECTION_UX.md +118 -0
  247. package/docs/MCP_SPEC.md +689 -0
  248. package/docs/MEMORY_AND_RECONCILIATION.md +222 -0
  249. package/docs/NPM_PUBLISHING.md +51 -0
  250. package/docs/OPEN_DECISIONS.md +81 -0
  251. package/docs/PROMPT_SCHEMAS.md +411 -0
  252. package/docs/PROVIDER_ADAPTERS.md +323 -0
  253. package/docs/PROVIDER_MATRIX.md +21 -0
  254. package/docs/PUBLIC_REPO_READINESS.md +49 -0
  255. package/docs/RESEARCH_NOTES.md +92 -0
  256. package/docs/ROADMAP.md +94 -0
  257. package/docs/ROLE_CONTRACTS.md +252 -0
  258. package/docs/RUNTIME_LOOP.md +240 -0
  259. package/docs/SECURITY_AND_PRIVACY.md +161 -0
  260. package/docs/TESTING_AND_VERIFICATION.md +180 -0
  261. package/docs/TRUST_MODEL.md +65 -0
  262. package/docs/decisions/0001-runtime-first-cli-and-mcp.md +23 -0
  263. package/docs/decisions/0002-provider-neutral-role-mapping.md +43 -0
  264. package/docs/decisions/0003-separate-implementation-and-verification.md +27 -0
  265. package/docs/product/README.md +14 -0
  266. package/docs/product/model-selection.md +88 -0
  267. package/docs/product/positioning.md +37 -0
  268. package/docs/product/pro-usage-modes.md +70 -0
  269. package/docs/product/roadmap.md +57 -0
  270. package/docs/product/role-policy.md +89 -0
  271. package/docs/product/runtime-invariants.md +44 -0
  272. package/docs/release/v0.1.0-preview.0.md +48 -0
  273. package/examples/stub-demo/README.md +25 -0
  274. package/package.json +55 -0
@@ -0,0 +1,290 @@
1
+ # Loop Recipes
2
+
3
+ Loop recipes are repeatable patterns over roles, validation, budgets, and stop conditions. They are not a separate scheduler and they do not grant new authority.
4
+
5
+ Users should not have to choose a recipe ID first. Use `thehood recommend-loop` or the MCP `thehood_recommend_loop` tool to route a plain-language goal into one of these recipes, draft a completion contract, and show alternatives.
6
+
7
+ ## Build, Test, Fix
8
+
9
+ Status: available through the existing goal loop.
10
+
11
+ Use when a code change has a clear acceptance test.
12
+
13
+ Command shape:
14
+
15
+ ```bash
16
+ thehood goal "fix the failing checkout test" --repo . --max-iterations 5
17
+ ```
18
+
19
+ Roles involved:
20
+
21
+ - Planner or orchestrator defines the scoped implementation.
22
+ - Implementer edits only allowed paths.
23
+ - Runtime captures diff and validation logs.
24
+ - QA tester is advisory when routing requires it.
25
+ - Verifier approves or returns fixable findings.
26
+
27
+ Required evidence:
28
+
29
+ - scoped diff
30
+ - runtime-captured validation command logs
31
+ - review routing artifact
32
+ - verifier verdict
33
+
34
+ Stop conditions:
35
+
36
+ - verifier approves
37
+ - manual approval is required
38
+ - max iterations reached
39
+ - unsafe or unresolved blocker
40
+
41
+ Risks:
42
+
43
+ - scope grows beyond the goal
44
+ - validation command is missing
45
+ - protected test, fixture, snapshot, or eval changes appear without approval
46
+
47
+ ## Verifier Loop
48
+
49
+ Status: available through the existing verification lane.
50
+
51
+ Use when correctness matters more than speed.
52
+
53
+ Command shape:
54
+
55
+ ```bash
56
+ thehood goal "prove the release metadata is correct" --repo . --max-iterations 5
57
+ ```
58
+
59
+ Roles involved:
60
+
61
+ - Runtime captures validation evidence.
62
+ - Verifier reviews independently from the implementer.
63
+ - Verifier can approve, revise, abort, or ask the user.
64
+
65
+ Required evidence:
66
+
67
+ - acceptance criteria
68
+ - runtime-captured command evidence
69
+ - diff evidence
70
+ - verifier verdict
71
+
72
+ Stop conditions:
73
+
74
+ - verifier approves
75
+ - verifier asks the user
76
+ - verifier aborts
77
+ - max iterations reached
78
+
79
+ Risks:
80
+
81
+ - accepting model summaries instead of raw evidence
82
+ - letting the same authority implement and verify
83
+
84
+ ## Anti-Spin
85
+
86
+ Status: partial. Max-iteration enforcement exists; richer spin detection is future work.
87
+
88
+ Use when a task is prone to endless model retries.
89
+
90
+ Command shape:
91
+
92
+ ```bash
93
+ thehood goal "repair the flaky smoke test" --repo . --max-iterations 3
94
+ ```
95
+
96
+ Roles involved:
97
+
98
+ - Runtime enforces budgets and provider response state.
99
+ - Orchestrator must request concrete evidence instead of vague retries.
100
+ - Verifier or operator decides when repeated failure needs a human.
101
+
102
+ Required evidence:
103
+
104
+ - last failed evidence
105
+ - repeated-failure signal
106
+ - budget state
107
+ - stop reason
108
+
109
+ Stop conditions:
110
+
111
+ - max iterations reached
112
+ - same validation failure repeated
113
+ - same verifier rejection repeated
114
+ - no diff change after repair attempt
115
+ - flip-flop between two approaches
116
+ - duplicate evidence request
117
+ - provider response blocked or failed
118
+ - schema validation repeatedly fails
119
+ - protected-path approval required
120
+ - unsafe critic finding
121
+
122
+ Risks:
123
+
124
+ - stopping too late
125
+ - reporting exhaustion as success
126
+ - repeatedly asking for the same context
127
+
128
+ ## Completion Contract
129
+
130
+ Status: partial. Contract docs and recommendation drafts exist; first-class contract artifacts are future work.
131
+
132
+ Use before public release, packaging, security, privacy, docs, or risky repo tasks where "done" must be explicit.
133
+
134
+ Command shape:
135
+
136
+ ```bash
137
+ thehood recommend-loop "prepare public preview release" --repo . --max-iterations 5
138
+ ```
139
+
140
+ Roles involved:
141
+
142
+ - Orchestrator or planner defines the contract.
143
+ - Implementer follows allowed paths and forbidden changes.
144
+ - Runtime captures validation evidence.
145
+ - QA tester and critic can provide advisory evidence.
146
+ - Verifier checks the contract against runtime evidence.
147
+
148
+ Required evidence:
149
+
150
+ - goal
151
+ - acceptance criteria
152
+ - allowed paths
153
+ - forbidden changes
154
+ - validation commands
155
+ - required evidence
156
+ - reviewer roles
157
+ - iteration budget
158
+ - stop conditions
159
+
160
+ Stop conditions:
161
+
162
+ - all required evidence is proved
163
+ - required evidence is weak or missing
164
+ - approval boundary
165
+ - max iterations reached
166
+
167
+ Risks:
168
+
169
+ - vague acceptance criteria
170
+ - missing forbidden changes
171
+ - partial completion reported as done
172
+
173
+ ## Quality Streak
174
+
175
+ Status: planned. For `v0.1.0-preview.0`, represent this as manual repeated goals or explicit validation, not an automatic streak runner.
176
+
177
+ Use when one green validation run is not enough, especially for flaky or stability-sensitive work.
178
+
179
+ Future command shape:
180
+
181
+ ```bash
182
+ thehood goal "stabilize checkout flow" --repo . --recipe quality-streak --streak 10
183
+ ```
184
+
185
+ Required evidence:
186
+
187
+ - same validation command repeated under recorded conditions
188
+ - streak count
189
+ - failure reset evidence
190
+
191
+ Stop conditions:
192
+
193
+ - target streak reached
194
+ - failure resets streak
195
+ - budget exhausted
196
+ - approval required
197
+
198
+ Risks:
199
+
200
+ - expensive repeated validation
201
+ - overfitting to one scenario
202
+ - claiming streak support before it is implemented
203
+
204
+ ## Adversarial Review
205
+
206
+ Status: partial. Same-run summons and fan-out exist as advisory sidecar evidence; recipe presets are future work.
207
+
208
+ Use when product, architecture, security, UX, or release risk is high.
209
+
210
+ Command shape:
211
+
212
+ ```bash
213
+ thehood summon <run-id> --role critic --brief "Challenge this plan"
214
+ ```
215
+
216
+ Roles involved:
217
+
218
+ - Critic challenges the plan or patch.
219
+ - QA tester may look for missed cases.
220
+ - Verifier remains the required acceptance lane.
221
+
222
+ Required evidence:
223
+
224
+ - critic response
225
+ - runtime validation evidence
226
+ - verifier verdict
227
+
228
+ Stop conditions:
229
+
230
+ - critic finds no blocking concern and verifier approves
231
+ - fixable critique becomes revision packet
232
+ - unsafe critic finding
233
+ - approval required
234
+
235
+ Risks:
236
+
237
+ - treating sidecar critique as acceptance
238
+ - reviewing an old version after edits
239
+ - claiming multi-model consensus without genuinely separate model families
240
+
241
+ Important rule:
242
+
243
+ ```text
244
+ Adversarial review is evidence, not acceptance.
245
+ Only runtime validation plus verifier review can satisfy completion.
246
+ ```
247
+
248
+ ## Human Approval Queue
249
+
250
+ Status: available through existing approval gates.
251
+
252
+ Use when work crosses data, permission, protected-path, external-transfer, dependency, network, or integration boundaries.
253
+
254
+ Command shape:
255
+
256
+ ```bash
257
+ thehood approvals policy show --repo .
258
+ ```
259
+
260
+ Loop shape:
261
+
262
+ ```text
263
+ Run task
264
+ Pause at approval gate
265
+ User chooses approve / revise / reject / abort
266
+ On revise, create a revision packet when appropriate
267
+ On approve, integrate or continue
268
+ On reject or abort, stop safely
269
+ ```
270
+
271
+ Required evidence:
272
+
273
+ - approval reason
274
+ - relevant artifact refs
275
+ - operator decision
276
+ - resume event
277
+
278
+ Stop conditions:
279
+
280
+ - user approves
281
+ - user revises
282
+ - user rejects
283
+ - user aborts
284
+ - approval remains pending
285
+
286
+ Risks:
287
+
288
+ - approval fatigue
289
+ - unclear reason copy
290
+ - manual copy-paste loops
@@ -0,0 +1,118 @@
1
+ # Loop Selection UX
2
+
3
+ Users should not need to know recipe IDs before asking TheHood for a loop. The product should accept an outcome, recommend a loop shape, draft a completion contract, and make the next action explicit.
4
+
5
+ ## Codex App Flow
6
+
7
+ When a user says something like:
8
+
9
+ ```text
10
+ Use Hood loops to fix flaky checkout tests.
11
+ ```
12
+
13
+ Codex should call `thehood_recommend_loop` first. The tool is read-only. It does not call model providers, start a run, edit files, create schedules, or send external context.
14
+
15
+ The response contains:
16
+
17
+ - recommended recipe
18
+ - confidence
19
+ - plain-English reason
20
+ - recommended stack
21
+ - completion contract draft
22
+ - alternatives
23
+ - `runAction` for the existing runtime tool
24
+ - card actions
25
+ - renderer-facing `card`
26
+ - dashboard-shaped `artifact` for a Codex card
27
+
28
+ Codex should render `card` directly when present. `artifact.manifest` and `artifact.snapshot` are the dashboard/table fallback for hosts that do not understand the card shape.
29
+
30
+ The card should read like this:
31
+
32
+ ```text
33
+ Recommended loop: Build, Test, Fix
34
+ Why: scoped code task with validation and likely repair cycles.
35
+
36
+ Stack:
37
+ - Build, Test, Fix
38
+ - Verifier Loop
39
+
40
+ Completion contract:
41
+ - Goal
42
+ - Evidence
43
+ - Validation
44
+ - Stop conditions
45
+ - Iteration budget
46
+
47
+ Actions:
48
+ - Run loop
49
+ - Edit contract
50
+ - Show alternatives
51
+ ```
52
+
53
+ The "Run loop" action should invoke the existing runtime path from `runAction`, usually `thehood_orchestrate` with `auto_loop: true`. Runtime approvals, provider calls, edit gates, evidence capture, verifier review, and stop conditions still happen inside TheHood. The card is guidance, not authority.
54
+
55
+ The "Edit contract" action should keep the user inside the recommendation step. The edited acceptance criteria, validation commands, allowed paths, forbidden changes, and iteration budget are passed back into `thehood_recommend_loop`; Codex should not mutate orchestration state or start a provider call while the user is still editing the contract.
56
+
57
+ ## Codex MCP Refresh
58
+
59
+ After local development changes, a fresh MCP server launch should expose `thehood_recommend_loop`. Existing Codex threads may keep the tool schema they already loaded, so a thread can still look stale even after `npm run build` succeeds.
60
+
61
+ Validate the fresh server path with:
62
+
63
+ ```bash
64
+ npm run build
65
+ npm run smoke:codex-config
66
+ ```
67
+
68
+ If the smoke passes but the current Codex conversation still lacks `thehood_recommend_loop`, start a new Codex thread or reload the app/session so Codex reconnects to the MCP server.
69
+
70
+ ## Terminal Flow
71
+
72
+ The equivalent terminal inspection command is:
73
+
74
+ ```bash
75
+ thehood recommend-loop "fix flaky checkout tests" --repo . --max-iterations 5
76
+ ```
77
+
78
+ This prints the same recommendation, stack, contract draft, and actions. Contract edits can be supplied before the run starts:
79
+
80
+ ```bash
81
+ thehood recommend-loop "prepare hood for public release" \
82
+ --repo . \
83
+ --acceptance "README claims match implemented behavior" \
84
+ --validation "npm run smoke:mcp" \
85
+ --allowed-path README.md \
86
+ --forbidden-change "Do not publish private run logs" \
87
+ --max-iterations 8
88
+ ```
89
+
90
+ Users can still run the normal goal command:
91
+
92
+ ```bash
93
+ thehood goal "fix flaky checkout tests" --repo . --max-iterations 5
94
+ ```
95
+
96
+ ## Selection Rules
97
+
98
+ The router uses the user's goal and constraints to choose among the public recipes:
99
+
100
+ - `build-test-fix`: scoped implementation with validation and repair.
101
+ - `verifier-loop`: correctness-sensitive work where independent proof matters.
102
+ - `anti-spin`: ambiguous or repeated-failure work that needs hard stops.
103
+ - `completion-contract`: release, package, public, or high-trust work where "done" must be explicit.
104
+ - `quality-streak`: flaky or stability-sensitive work that should require repeated clean validation. This is planned as execution behavior and should be labeled accordingly.
105
+ - `adversarial-review`: risky architecture, product, security, UX, or strategy work that needs critique.
106
+ - `human-approval-queue`: work expected to pause at explicit approval gates.
107
+
108
+ If confidence is high, show the single recommended loop plus alternatives. If confidence is medium or low, show the top choices and ask one plain-language question only when the missing answer changes safety or proof.
109
+
110
+ ## Boundaries
111
+
112
+ - Recommendation is read-only.
113
+ - Recipe names are product vocabulary, not new permissions.
114
+ - Recommendation does not schedule work.
115
+ - Recommendation does not approve provider calls.
116
+ - Recommendation does not replace completion evidence.
117
+ - Sidecar critique remains advisory.
118
+ - Runtime validation plus verifier review still decide completion for implementation runs.