@mobrienv/autoloop 0.1.2

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 (307) hide show
  1. package/README.md +145 -0
  2. package/bin/autoloop +2 -0
  3. package/dist/backend/index.d.ts +10 -0
  4. package/dist/backend/index.js +59 -0
  5. package/dist/backend/index.js.map +1 -0
  6. package/dist/backend/run-command.d.ts +7 -0
  7. package/dist/backend/run-command.js +50 -0
  8. package/dist/backend/run-command.js.map +1 -0
  9. package/dist/backend/run-mock.d.ts +1 -0
  10. package/dist/backend/run-mock.js +6 -0
  11. package/dist/backend/run-mock.js.map +1 -0
  12. package/dist/backend/run-pi.d.ts +5 -0
  13. package/dist/backend/run-pi.js +5 -0
  14. package/dist/backend/run-pi.js.map +1 -0
  15. package/dist/backend/types.d.ts +21 -0
  16. package/dist/backend/types.js +2 -0
  17. package/dist/backend/types.js.map +1 -0
  18. package/dist/chains/budget.d.ts +7 -0
  19. package/dist/chains/budget.js +42 -0
  20. package/dist/chains/budget.js.map +1 -0
  21. package/dist/chains/load.d.ts +12 -0
  22. package/dist/chains/load.js +80 -0
  23. package/dist/chains/load.js.map +1 -0
  24. package/dist/chains/render.d.ts +2 -0
  25. package/dist/chains/render.js +46 -0
  26. package/dist/chains/render.js.map +1 -0
  27. package/dist/chains/run.d.ts +17 -0
  28. package/dist/chains/run.js +175 -0
  29. package/dist/chains/run.js.map +1 -0
  30. package/dist/chains/types.d.ts +37 -0
  31. package/dist/chains/types.js +2 -0
  32. package/dist/chains/types.js.map +1 -0
  33. package/dist/chains.d.ts +5 -0
  34. package/dist/chains.js +5 -0
  35. package/dist/chains.js.map +1 -0
  36. package/dist/commands/chain.d.ts +1 -0
  37. package/dist/commands/chain.js +51 -0
  38. package/dist/commands/chain.js.map +1 -0
  39. package/dist/commands/inspect.d.ts +1 -0
  40. package/dist/commands/inspect.js +95 -0
  41. package/dist/commands/inspect.js.map +1 -0
  42. package/dist/commands/list.d.ts +1 -0
  43. package/dist/commands/list.js +12 -0
  44. package/dist/commands/list.js.map +1 -0
  45. package/dist/commands/loops.d.ts +1 -0
  46. package/dist/commands/loops.js +72 -0
  47. package/dist/commands/loops.js.map +1 -0
  48. package/dist/commands/memory.d.ts +1 -0
  49. package/dist/commands/memory.js +65 -0
  50. package/dist/commands/memory.js.map +1 -0
  51. package/dist/commands/pi-adapter.d.ts +1 -0
  52. package/dist/commands/pi-adapter.js +6 -0
  53. package/dist/commands/pi-adapter.js.map +1 -0
  54. package/dist/commands/run.d.ts +1 -0
  55. package/dist/commands/run.js +185 -0
  56. package/dist/commands/run.js.map +1 -0
  57. package/dist/config.d.ts +16 -0
  58. package/dist/config.js +169 -0
  59. package/dist/config.js.map +1 -0
  60. package/dist/events/decode.d.ts +2 -0
  61. package/dist/events/decode.js +45 -0
  62. package/dist/events/decode.js.map +1 -0
  63. package/dist/events/encode.d.ts +2 -0
  64. package/dist/events/encode.js +33 -0
  65. package/dist/events/encode.js.map +1 -0
  66. package/dist/events/guards.d.ts +5 -0
  67. package/dist/events/guards.js +42 -0
  68. package/dist/events/guards.js.map +1 -0
  69. package/dist/events/types.d.ts +25 -0
  70. package/dist/events/types.js +2 -0
  71. package/dist/events/types.js.map +1 -0
  72. package/dist/harness/config-helpers.d.ts +24 -0
  73. package/dist/harness/config-helpers.js +231 -0
  74. package/dist/harness/config-helpers.js.map +1 -0
  75. package/dist/harness/coordination.d.ts +1 -0
  76. package/dist/harness/coordination.js +127 -0
  77. package/dist/harness/coordination.js.map +1 -0
  78. package/dist/harness/display.d.ts +20 -0
  79. package/dist/harness/display.js +130 -0
  80. package/dist/harness/display.js.map +1 -0
  81. package/dist/harness/emit.d.ts +15 -0
  82. package/dist/harness/emit.js +220 -0
  83. package/dist/harness/emit.js.map +1 -0
  84. package/dist/harness/index.d.ts +13 -0
  85. package/dist/harness/index.js +124 -0
  86. package/dist/harness/index.js.map +1 -0
  87. package/dist/harness/iteration.d.ts +4 -0
  88. package/dist/harness/iteration.js +129 -0
  89. package/dist/harness/iteration.js.map +1 -0
  90. package/dist/harness/journal.d.ts +13 -0
  91. package/dist/harness/journal.js +106 -0
  92. package/dist/harness/journal.js.map +1 -0
  93. package/dist/harness/metareview.d.ts +4 -0
  94. package/dist/harness/metareview.js +33 -0
  95. package/dist/harness/metareview.js.map +1 -0
  96. package/dist/harness/metrics.d.ts +12 -0
  97. package/dist/harness/metrics.js +180 -0
  98. package/dist/harness/metrics.js.map +1 -0
  99. package/dist/harness/parallel.d.ts +37 -0
  100. package/dist/harness/parallel.js +158 -0
  101. package/dist/harness/parallel.js.map +1 -0
  102. package/dist/harness/prompt.d.ts +35 -0
  103. package/dist/harness/prompt.js +328 -0
  104. package/dist/harness/prompt.js.map +1 -0
  105. package/dist/harness/scratchpad.d.ts +2 -0
  106. package/dist/harness/scratchpad.js +65 -0
  107. package/dist/harness/scratchpad.js.map +1 -0
  108. package/dist/harness/stop.d.ts +5 -0
  109. package/dist/harness/stop.js +63 -0
  110. package/dist/harness/stop.js.map +1 -0
  111. package/dist/harness/tools.d.ts +3 -0
  112. package/dist/harness/tools.js +39 -0
  113. package/dist/harness/tools.js.map +1 -0
  114. package/dist/harness/types.d.ts +81 -0
  115. package/dist/harness/types.js +2 -0
  116. package/dist/harness/types.js.map +1 -0
  117. package/dist/harness/wave/finalize-wave.d.ts +9 -0
  118. package/dist/harness/wave/finalize-wave.js +60 -0
  119. package/dist/harness/wave/finalize-wave.js.map +1 -0
  120. package/dist/harness/wave/launch-branches.d.ts +6 -0
  121. package/dist/harness/wave/launch-branches.js +218 -0
  122. package/dist/harness/wave/launch-branches.js.map +1 -0
  123. package/dist/harness/wave/parse-objectives.d.ts +3 -0
  124. package/dist/harness/wave/parse-objectives.js +29 -0
  125. package/dist/harness/wave/parse-objectives.js.map +1 -0
  126. package/dist/harness/wave/types.d.ts +43 -0
  127. package/dist/harness/wave/types.js +2 -0
  128. package/dist/harness/wave/types.js.map +1 -0
  129. package/dist/harness/wave.d.ts +6 -0
  130. package/dist/harness/wave.js +98 -0
  131. package/dist/harness/wave.js.map +1 -0
  132. package/dist/json.d.ts +8 -0
  133. package/dist/json.js +80 -0
  134. package/dist/json.js.map +1 -0
  135. package/dist/loops/health.d.ts +14 -0
  136. package/dist/loops/health.js +104 -0
  137. package/dist/loops/health.js.map +1 -0
  138. package/dist/loops/list.d.ts +6 -0
  139. package/dist/loops/list.js +21 -0
  140. package/dist/loops/list.js.map +1 -0
  141. package/dist/loops/render.d.ts +18 -0
  142. package/dist/loops/render.js +87 -0
  143. package/dist/loops/render.js.map +1 -0
  144. package/dist/loops/show.d.ts +8 -0
  145. package/dist/loops/show.js +31 -0
  146. package/dist/loops/show.js.map +1 -0
  147. package/dist/loops/watch.d.ts +8 -0
  148. package/dist/loops/watch.js +77 -0
  149. package/dist/loops/watch.js.map +1 -0
  150. package/dist/main.d.ts +1 -0
  151. package/dist/main.js +101 -0
  152. package/dist/main.js.map +1 -0
  153. package/dist/markdown.d.ts +10 -0
  154. package/dist/markdown.js +66 -0
  155. package/dist/markdown.js.map +1 -0
  156. package/dist/memory-render.d.ts +6 -0
  157. package/dist/memory-render.js +81 -0
  158. package/dist/memory-render.js.map +1 -0
  159. package/dist/memory.d.ts +23 -0
  160. package/dist/memory.js +314 -0
  161. package/dist/memory.js.map +1 -0
  162. package/dist/pi-adapter.d.ts +1 -0
  163. package/dist/pi-adapter.js +220 -0
  164. package/dist/pi-adapter.js.map +1 -0
  165. package/dist/registry/derive.d.ts +8 -0
  166. package/dist/registry/derive.js +81 -0
  167. package/dist/registry/derive.js.map +1 -0
  168. package/dist/registry/harness.d.ts +7 -0
  169. package/dist/registry/harness.js +57 -0
  170. package/dist/registry/harness.js.map +1 -0
  171. package/dist/registry/index.d.ts +5 -0
  172. package/dist/registry/index.js +5 -0
  173. package/dist/registry/index.js.map +1 -0
  174. package/dist/registry/read.d.ts +11 -0
  175. package/dist/registry/read.js +50 -0
  176. package/dist/registry/read.js.map +1 -0
  177. package/dist/registry/rebuild.d.ts +5 -0
  178. package/dist/registry/rebuild.js +19 -0
  179. package/dist/registry/rebuild.js.map +1 -0
  180. package/dist/registry/types.d.ts +19 -0
  181. package/dist/registry/types.js +2 -0
  182. package/dist/registry/types.js.map +1 -0
  183. package/dist/registry/update.d.ts +2 -0
  184. package/dist/registry/update.js +7 -0
  185. package/dist/registry/update.js.map +1 -0
  186. package/dist/testing/mock-backend.d.ts +11 -0
  187. package/dist/testing/mock-backend.js +76 -0
  188. package/dist/testing/mock-backend.js.map +1 -0
  189. package/dist/topology.d.ts +25 -0
  190. package/dist/topology.js +188 -0
  191. package/dist/topology.js.map +1 -0
  192. package/dist/usage.d.ts +8 -0
  193. package/dist/usage.js +114 -0
  194. package/dist/usage.js.map +1 -0
  195. package/dist/utils.d.ts +15 -0
  196. package/dist/utils.js +79 -0
  197. package/dist/utils.js.map +1 -0
  198. package/package.json +52 -0
  199. package/presets/autocode/README.md +81 -0
  200. package/presets/autocode/autoloops.toml +22 -0
  201. package/presets/autocode/harness.md +19 -0
  202. package/presets/autocode/miniloops.toml +22 -0
  203. package/presets/autocode/roles/build.md +33 -0
  204. package/presets/autocode/roles/critic.md +40 -0
  205. package/presets/autocode/roles/finalizer.md +43 -0
  206. package/presets/autocode/roles/planner.md +40 -0
  207. package/presets/autocode/topology.toml +32 -0
  208. package/presets/autodoc/README.md +42 -0
  209. package/presets/autodoc/autoloops.toml +21 -0
  210. package/presets/autodoc/harness.md +19 -0
  211. package/presets/autodoc/miniloops.toml +21 -0
  212. package/presets/autodoc/roles/auditor.md +39 -0
  213. package/presets/autodoc/roles/checker.md +43 -0
  214. package/presets/autodoc/roles/publisher.md +51 -0
  215. package/presets/autodoc/roles/writer.md +37 -0
  216. package/presets/autodoc/topology.toml +31 -0
  217. package/presets/autofix/README.md +56 -0
  218. package/presets/autofix/autoloops.toml +21 -0
  219. package/presets/autofix/harness.md +24 -0
  220. package/presets/autofix/miniloops.toml +21 -0
  221. package/presets/autofix/roles/closer.md +48 -0
  222. package/presets/autofix/roles/diagnoser.md +42 -0
  223. package/presets/autofix/roles/fixer.md +28 -0
  224. package/presets/autofix/roles/verifier.md +31 -0
  225. package/presets/autofix/topology.toml +33 -0
  226. package/presets/autoideas/README.md +73 -0
  227. package/presets/autoideas/autoloops.toml +18 -0
  228. package/presets/autoideas/harness.md +31 -0
  229. package/presets/autoideas/miniloops.toml +18 -0
  230. package/presets/autoideas/roles/analyst.md +32 -0
  231. package/presets/autoideas/roles/reviewer.md +36 -0
  232. package/presets/autoideas/roles/scanner.md +26 -0
  233. package/presets/autoideas/roles/synthesizer.md +48 -0
  234. package/presets/autoideas/topology.toml +32 -0
  235. package/presets/autoperf/README.md +56 -0
  236. package/presets/autoperf/autoloops.toml +21 -0
  237. package/presets/autoperf/harness.md +21 -0
  238. package/presets/autoperf/miniloops.toml +21 -0
  239. package/presets/autoperf/roles/judge.md +38 -0
  240. package/presets/autoperf/roles/measurer.md +36 -0
  241. package/presets/autoperf/roles/optimizer.md +35 -0
  242. package/presets/autoperf/roles/profiler.md +38 -0
  243. package/presets/autoperf/topology.toml +32 -0
  244. package/presets/autoqa/README.md +76 -0
  245. package/presets/autoqa/autoloops.toml +21 -0
  246. package/presets/autoqa/harness.md +30 -0
  247. package/presets/autoqa/miniloops.toml +21 -0
  248. package/presets/autoqa/roles/executor.md +43 -0
  249. package/presets/autoqa/roles/inspector.md +45 -0
  250. package/presets/autoqa/roles/planner.md +55 -0
  251. package/presets/autoqa/roles/reporter.md +74 -0
  252. package/presets/autoqa/topology.toml +31 -0
  253. package/presets/autoresearch/README.md +63 -0
  254. package/presets/autoresearch/autoloops.toml +18 -0
  255. package/presets/autoresearch/harness.md +28 -0
  256. package/presets/autoresearch/miniloops.toml +18 -0
  257. package/presets/autoresearch/roles/benchmarker.md +34 -0
  258. package/presets/autoresearch/roles/evaluator.md +33 -0
  259. package/presets/autoresearch/roles/implementer.md +26 -0
  260. package/presets/autoresearch/roles/strategist.md +43 -0
  261. package/presets/autoresearch/topology.toml +31 -0
  262. package/presets/autoreview/README.md +51 -0
  263. package/presets/autoreview/autoloops.toml +21 -0
  264. package/presets/autoreview/harness.md +20 -0
  265. package/presets/autoreview/miniloops.toml +21 -0
  266. package/presets/autoreview/roles/checker.md +36 -0
  267. package/presets/autoreview/roles/reader.md +33 -0
  268. package/presets/autoreview/roles/suggester.md +26 -0
  269. package/presets/autoreview/roles/summarizer.md +57 -0
  270. package/presets/autoreview/topology.toml +31 -0
  271. package/presets/autosec/README.md +51 -0
  272. package/presets/autosec/autoloops.toml +21 -0
  273. package/presets/autosec/harness.md +20 -0
  274. package/presets/autosec/miniloops.toml +21 -0
  275. package/presets/autosec/roles/analyst.md +38 -0
  276. package/presets/autosec/roles/hardener.md +36 -0
  277. package/presets/autosec/roles/reporter.md +63 -0
  278. package/presets/autosec/roles/scanner.md +38 -0
  279. package/presets/autosec/topology.toml +31 -0
  280. package/presets/autosimplify/README.md +83 -0
  281. package/presets/autosimplify/autoloops.toml +22 -0
  282. package/presets/autosimplify/harness.md +25 -0
  283. package/presets/autosimplify/miniloops.toml +22 -0
  284. package/presets/autosimplify/roles/reviewer.md +38 -0
  285. package/presets/autosimplify/roles/scoper.md +42 -0
  286. package/presets/autosimplify/roles/simplifier.md +51 -0
  287. package/presets/autosimplify/roles/verifier.md +40 -0
  288. package/presets/autosimplify/topology.toml +32 -0
  289. package/presets/autospec/README.md +84 -0
  290. package/presets/autospec/autoloops.toml +21 -0
  291. package/presets/autospec/harness.md +23 -0
  292. package/presets/autospec/miniloops.toml +21 -0
  293. package/presets/autospec/roles/clarifier.md +38 -0
  294. package/presets/autospec/roles/critic.md +41 -0
  295. package/presets/autospec/roles/designer.md +37 -0
  296. package/presets/autospec/roles/planner.md +38 -0
  297. package/presets/autospec/roles/researcher.md +33 -0
  298. package/presets/autospec/topology.toml +38 -0
  299. package/presets/autotest/README.md +55 -0
  300. package/presets/autotest/autoloops.toml +21 -0
  301. package/presets/autotest/harness.md +21 -0
  302. package/presets/autotest/miniloops.toml +21 -0
  303. package/presets/autotest/roles/assessor.md +57 -0
  304. package/presets/autotest/roles/runner.md +31 -0
  305. package/presets/autotest/roles/surveyor.md +39 -0
  306. package/presets/autotest/roles/writer.md +37 -0
  307. package/presets/autotest/topology.toml +32 -0
@@ -0,0 +1,38 @@
1
+ You are the scanner.
2
+
3
+ Do not analyze findings. Do not fix code. Do not write reports.
4
+
5
+ Your job:
6
+ 1. Scan the target repo for security vulnerabilities.
7
+ 2. Report raw candidate findings for the analyst to confirm or dismiss.
8
+
9
+ On every activation:
10
+ - Read `.autoloop/sec-findings.md`, `.autoloop/sec-report.md`, and `.autoloop/progress.md` if they exist.
11
+ - Re-read the latest scratchpad/journal context before deciding.
12
+
13
+ On first activation:
14
+ - Survey the repo: identify the language, framework, dependencies, and attack surface.
15
+ - Scan for vulnerabilities across these categories:
16
+ - **Injection**: SQL injection, command injection, XSS, template injection
17
+ - **Authentication/Authorization**: hardcoded credentials, missing auth checks, insecure session handling
18
+ - **Secrets**: API keys, passwords, tokens in source code or config files
19
+ - **Dependencies**: known vulnerable dependencies (check lock files, manifests)
20
+ - **Configuration**: insecure defaults, debug mode in production, permissive CORS
21
+ - **Data exposure**: sensitive data in logs, error messages, or responses
22
+ - **Cryptography**: weak algorithms, hardcoded keys, insecure random
23
+ - Create or refresh:
24
+ - `.autoloop/sec-findings.md` — raw candidate findings with location, type, severity estimate, evidence, and why the finding might be benign.
25
+ - `.autoloop/progress.md` — current phase, first finding to analyze.
26
+ - Emit `findings.reported` with a count and severity breakdown, even if the count is zero.
27
+
28
+ On later activations (`report.updated`):
29
+ - Check for additional vulnerability categories not yet scanned.
30
+ - If all categories are covered, emit `task.complete`.
31
+ - Otherwise, scan the next category and emit `findings.reported`.
32
+
33
+ Rules:
34
+ - Report hypotheses, not conclusions. Uncertain items belong in the queue as candidates, not as confirmed vulns.
35
+ - Include file path, line number, and the vulnerable code snippet as evidence.
36
+ - Estimate severity: critical / high / medium / low.
37
+ - Note why each candidate might be a false positive or mitigated already.
38
+ - Do not scan generated files, vendored dependencies, or test fixtures for secrets.
@@ -0,0 +1,31 @@
1
+ name = "autosec"
2
+ completion = "task.complete"
3
+
4
+ [[role]]
5
+ id = "scanner"
6
+ emits = ["findings.reported", "task.complete"]
7
+ prompt_file = "roles/scanner.md"
8
+
9
+ [[role]]
10
+ id = "analyst"
11
+ emits = ["finding.confirmed", "finding.dismissed"]
12
+ prompt_file = "roles/analyst.md"
13
+
14
+ [[role]]
15
+ id = "hardener"
16
+ emits = ["fix.applied", "fix.blocked"]
17
+ prompt_file = "roles/hardener.md"
18
+
19
+ [[role]]
20
+ id = "reporter"
21
+ emits = ["report.updated", "task.complete"]
22
+ prompt_file = "roles/reporter.md"
23
+
24
+ [handoff]
25
+ "loop.start" = ["scanner"]
26
+ "findings.reported" = ["analyst"]
27
+ "finding.confirmed" = ["hardener"]
28
+ "finding.dismissed" = ["reporter"]
29
+ "fix.applied" = ["reporter"]
30
+ "fix.blocked" = ["reporter"]
31
+ "report.updated" = ["scanner"]
@@ -0,0 +1,83 @@
1
+ # AutoSimplify miniloop
2
+
3
+ An autoloop-native post-implementation cleanup loop inspired by Claude Code's `/simplify` workflow.
4
+
5
+ AutoSimplify inspects recently modified code, identifies reuse/clarity/efficiency improvements, applies behavior-preserving simplifications, and skeptically verifies that the result is actually cleaner.
6
+
7
+ Shape:
8
+ - scoper — identifies the simplification scope and batches it
9
+ - reviewer — finds concrete simplification opportunities in the current batch
10
+ - simplifier — applies the cleanup and runs checks
11
+ - verifier — independently confirms behavior was preserved and the code is simpler
12
+
13
+ ## Fail-closed contract
14
+
15
+ AutoSimplify is not a refactor free-for-all.
16
+
17
+ - Scope defaults to the current diff; if there is no diff, fall back to recently modified files.
18
+ - Behavior preservation is mandatory.
19
+ - Drive-by rewrites outside the scoped files are rejected.
20
+ - Missing validation evidence means reject or retry, not completion.
21
+ - "No simplification needed" is an acceptable result only when it is explicitly checked and justified.
22
+
23
+ ## How it works
24
+
25
+ 1. **Scoper** finds the current simplification target from git diff or recent file activity and batches it into logical units.
26
+ 2. **Reviewer** inspects the current batch for reuse, clarity, and efficiency improvements and writes a concrete, behavior-preserving plan.
27
+ 3. **Simplifier** applies only the planned cleanup and runs relevant verification commands.
28
+ 4. **Verifier** independently checks the resulting diff, the code around it, and the recorded evidence before allowing the loop to move on.
29
+
30
+ ## Files
31
+
32
+ - `autoloops.toml` — loop + backend config
33
+ - `topology.toml` — role deck + handoff graph
34
+ - `harness.md` — shared harness rules loaded every iteration
35
+ - `roles/scoper.md`
36
+ - `roles/reviewer.md`
37
+ - `roles/simplifier.md`
38
+ - `roles/verifier.md`
39
+
40
+ ## Shared working files created by the loop
41
+
42
+ - `.autoloop/simplify-context.md` — scope, batching, affected files, and guardrails
43
+ - `.autoloop/simplify-plan.md` — current batch findings and concrete cleanup plan
44
+ - `.autoloop/progress.md` — batch status, changes made, verification results, and next action
45
+
46
+ ## Backend
47
+
48
+ This preset assumes the built-in Pi adapter:
49
+
50
+ ```toml
51
+ backend.kind = "pi"
52
+ backend.command = "pi"
53
+ ```
54
+
55
+ For deterministic local harness debugging only, switch to the repo mock backend:
56
+
57
+ ```toml
58
+ backend.kind = "command"
59
+ backend.command = "../../examples/mock-backend.sh"
60
+ ```
61
+
62
+ ## Run
63
+
64
+ From the repo root:
65
+
66
+ ```bash
67
+ autoloop run presets/autosimplify "Simplify the current diff"
68
+ ```
69
+
70
+ For a one-off Claude dogfood run without editing config:
71
+
72
+ ```bash
73
+ autoloop -b claude presets/autosimplify "Simplify the current diff"
74
+ ```
75
+
76
+ ## Intended input styles
77
+
78
+ The preset is optimized for post-implementation cleanup:
79
+ - simplify the current git diff
80
+ - simplify recently modified files when there is no staged/unstaged diff
81
+ - simplify an explicitly named file or directory from the user prompt
82
+
83
+ The scoper must normalize that into concrete batches and keep the loop focused on one batch at a time.
@@ -0,0 +1,22 @@
1
+ event_loop.max_iterations = 80
2
+ event_loop.completion_event = "task.complete"
3
+ event_loop.completion_promise = "LOOP_COMPLETE"
4
+ # Require skeptical verification before completion is considered valid.
5
+ event_loop.required_events = ["simplification.verified"]
6
+
7
+ backend.kind = "command"
8
+ backend.command = "/Users/rook/.npm-global/bin/claude"
9
+ backend.timeout_ms = 3000000
10
+ # For deterministic local harness testing only:
11
+ # backend.kind = "command"
12
+ # backend.command = "../../examples/mock-backend.sh"
13
+
14
+ review.enabled = true
15
+ review.timeout_ms = 300000
16
+
17
+ memory.prompt_budget_chars = 8000
18
+ harness.instructions_file = "harness.md"
19
+
20
+ core.state_dir = ".autoloop"
21
+ core.journal_file = ".autoloop/journal.jsonl"
22
+ core.memory_file = ".autoloop/memory.jsonl"
@@ -0,0 +1,25 @@
1
+ This is a autoloops-native autosimplify loop inspired by Claude Code's `/simplify` workflow.
2
+
3
+ Global rules:
4
+ - Shared working files are the source of truth: `.autoloop/simplify-context.md`, `.autoloop/simplify-plan.md`, and `.autoloop/progress.md`.
5
+ - Scope defaults to the current diff. If there is no diff, fall back to recently modified files. If the user explicitly names files or directories, respect that scope.
6
+ - Keep only one simplification batch active at a time.
7
+ - Use the event tool instead of prose-only handoffs.
8
+ - Fresh context every iteration: re-read the shared working files and the relevant source before acting.
9
+ - Preserve behavior exactly. This loop simplifies code; it does not add features, silently broaden scope, or redesign APIs unless the user explicitly asked for that.
10
+ - Prefer deleting code, reusing existing helpers, reducing nesting, and making control flow plainer over introducing new abstractions.
11
+ - Review and simplification should focus on three dimensions: reuse, clarity, and efficiency. Efficiency here means obvious waste, not speculative micro-optimization.
12
+ - The simplifier must record exact files changed and exact verification command(s) with outputs in `.autoloop/progress.md` before claiming success.
13
+ - If a simplification batch changes code, commit that batch before handing off. Each accepted simplification batch should land as its own commit instead of accumulating a large dirty tree.
14
+ - The verifier must independently inspect the actual diff and surrounding code. Another role's summary is not proof.
15
+ - Missing evidence means rejection, retry, or no-op justification — never silent acceptance.
16
+ - `no-op` is valid only when the reviewer and verifier both conclude the scoped code is already appropriately simple.
17
+ - Use `./.autoloop/autoloops memory add learning ...` for durable learnings.
18
+ - Do not invent extra phases. Stay inside scoper → reviewer → simplifier → verifier.
19
+ - Only the scoper may emit `task.complete`.
20
+ - Once `.autoloop/progress.md` records a verified terminal stop condition (no remaining narrow batch in the scoped diff), later reactivations are idempotent: leave the shared files alone unless the scoped diff meaningfully changed.
21
+
22
+ State files:
23
+ - `.autoloop/simplify-context.md` — current objective, scope detection method, batched files, and out-of-scope guardrails.
24
+ - `.autoloop/simplify-plan.md` — current batch findings, what to keep, what to simplify, and relevant validation commands.
25
+ - `.autoloop/progress.md` — active batch, edits made, verification evidence, rejected attempts, and next action.
@@ -0,0 +1,22 @@
1
+ event_loop.max_iterations = 80
2
+ event_loop.completion_event = "task.complete"
3
+ event_loop.completion_promise = "LOOP_COMPLETE"
4
+ # Require skeptical verification before completion is considered valid.
5
+ event_loop.required_events = ["simplification.verified"]
6
+
7
+ backend.kind = "pi"
8
+ backend.command = "pi"
9
+ backend.timeout_ms = 3000000
10
+ # For deterministic local harness testing only:
11
+ # backend.kind = "command"
12
+ # backend.command = "../../examples/mock-backend.sh"
13
+
14
+ review.enabled = true
15
+ review.timeout_ms = 300000
16
+
17
+ memory.prompt_budget_chars = 8000
18
+ harness.instructions_file = "harness.md"
19
+
20
+ core.state_dir = ".miniloop"
21
+ core.journal_file = ".miniloop/journal.jsonl"
22
+ core.memory_file = ".miniloop/memory.jsonl"
@@ -0,0 +1,38 @@
1
+ You are the reviewer.
2
+
3
+ Do not edit code. Do not verify changes.
4
+
5
+ Your job:
6
+ 1. Inspect the current batch for safe simplification opportunities.
7
+ 2. Write a concrete cleanup plan.
8
+ 3. Keep the plan tightly scoped and behavior-preserving.
9
+
10
+ On every activation:
11
+ - Read `.autoloop/simplify-context.md`, `.autoloop/simplify-plan.md`, and `.autoloop/progress.md`.
12
+ - Read the actual code and current diff for the active batch. Treat the shared files as hints, not authority.
13
+
14
+ Process:
15
+ 1. Review the active batch across these dimensions:
16
+ - **Reuse**: duplicated logic, hand-rolled helpers, existing utilities not being used
17
+ - **Clarity**: unnecessary branching, awkward naming, redundant state, needless abstraction, comments that explain obvious code
18
+ - **Efficiency**: obvious waste, repeated work, overly broad file or collection operations, hot-path clutter
19
+ 2. Write or refresh the active batch section in `.autoloop/simplify-plan.md` with:
20
+ - scope
21
+ - keep-as-is notes
22
+ - simplification opportunities
23
+ - exact files to edit
24
+ - exact validation commands the simplifier should run
25
+ - out-of-scope guardrails
26
+ 3. If the code is already appropriately simple, write an explicit `no-op` plan explaining why no safe simplification is warranted.
27
+ 4. Update `.autoloop/progress.md` with the current review status.
28
+ 5. Emit `plan.ready` when the batch has a concrete plan.
29
+
30
+ Emit `review.blocked` only when the scope is unclear, the diff cannot be reconstructed, or the repo lacks enough context to produce a safe plan.
31
+
32
+ Rules:
33
+ - Prefer removal over replacement. Fewer moving parts beats clever consolidation.
34
+ - Do not suggest architecture rewrites for a simplification pass.
35
+ - Preserve behavior exactly. If a change would alter public behavior, record it as out-of-scope.
36
+ - Be concrete. `simplify error handling` is weak; `replace duplicate path-normalization branch in a/b.tn with existing normalize_path/1 helper` is good.
37
+ - If you propose a no-op, say what you checked so the verifier can validate the conclusion.
38
+ - One batch, one plan. Do not smuggle in cleanup from unrelated files.
@@ -0,0 +1,42 @@
1
+ You are the scoper.
2
+
3
+ Do not review code for simplification opportunities. Do not edit code. Do not verify changes.
4
+
5
+ Your job:
6
+ 1. Identify the simplification scope.
7
+ 2. Break the scope into one concrete batch at a time.
8
+ 3. Track which batches are done, rejected, or still pending.
9
+
10
+ On every activation:
11
+ - Read `.autoloop/simplify-context.md`, `.autoloop/simplify-plan.md`, and `.autoloop/progress.md` if they exist.
12
+ - Re-read the latest scratchpad/journal context before deciding.
13
+
14
+ On first activation:
15
+ - Determine scope using this order:
16
+ 1. If the user explicitly named files or directories, use that.
17
+ 2. Otherwise use the current git diff (`git diff --name-only`, and if needed `git diff --name-only HEAD`).
18
+ 3. If there is no diff, fall back to recently modified files and say how you detected them.
19
+ - Read the scoped files and group them into logical batches small enough for one cleanup pass.
20
+ - Create or refresh:
21
+ - `.autoloop/simplify-context.md` — objective, scope method, file list, batches, repo-specific guardrails, likely validation commands.
22
+ - `.autoloop/simplify-plan.md` — skeleton for the active batch.
23
+ - `.autoloop/progress.md` — current phase, active batch, completed batches, blocked batches.
24
+ - Emit `scope.ready` with the first batch description.
25
+
26
+ On later activations (`simplification.verified` or `review.blocked`):
27
+ - Re-read the shared files and check remaining batches.
28
+ - If `.autoloop/progress.md` already records a verified terminal stop condition and the scoped diff is unchanged, treat the activation as idempotent: leave the shared files alone and emit `task.complete` immediately with a concise completion summary.
29
+ - If the active batch is done, advance to the next unfinished batch.
30
+ - If no batches remain, emit `task.complete` with a concise completion summary.
31
+ - Otherwise emit `scope.ready` with the next batch.
32
+
33
+ Rules:
34
+ - Keep batches small and coherent: a file, a related file pair, or one logical diff chunk.
35
+ - Track the scope method explicitly. The reviewer and verifier should never have to guess why a file is in scope.
36
+ - Prefer changed files over opportunistic adjacent cleanup.
37
+ - Record out-of-scope temptations in `.autoloop/progress.md` instead of silently expanding the work.
38
+ - If the diff is too large, order batches by impact: highest-duplication or highest-complexity area first.
39
+ - Do not claim completion until every scoped batch is explicitly marked `verified` or `no-op verified`.
40
+ - Do not treat a dirty uncommitted simplify batch as complete. Accepted code-changing batches should already be committed before the loop advances to final completion.
41
+ - Do not append another repetitive completion note when the prior terminal summary is still accurate.
42
+ - EARLY EXIT: If `.autoloop/progress.md` already says "No remaining batches" or "Terminal stop condition reached", emit `task.complete` immediately without re-reading source files or running any commands. Two consecutive task.complete iterations means the loop leaked — exit, do not cycle again.
@@ -0,0 +1,51 @@
1
+ You are the simplifier.
2
+
3
+ Do not choose scope. Do not verify your own work.
4
+
5
+ Your job:
6
+ 1. Apply the current cleanup plan.
7
+ 2. Preserve behavior while reducing complexity.
8
+ 3. Produce a complete evidence bundle for the verifier.
9
+
10
+ On every activation:
11
+ - Read `.autoloop/simplify-context.md`, `.autoloop/simplify-plan.md`, and `.autoloop/progress.md`.
12
+ - Read the actual code in the active batch before editing.
13
+
14
+ Process:
15
+ 1. Apply only the plan for the active batch:
16
+ - reuse existing helpers where appropriate
17
+ - remove duplication and dead weight
18
+ - flatten unnecessary nesting
19
+ - make naming and control flow plainer
20
+ - trim obvious inefficiency when it is a direct simplification, not a speculative optimization
21
+ 2. Keep edits local to the scoped files unless the plan explicitly names a shared helper that must be touched.
22
+ 3. Run the validation commands listed in `.autoloop/simplify-plan.md`. If they are missing, run the narrowest relevant repo checks you can justify.
23
+ 4. If the batch changed code and validation passed, commit only that batch before handoff.
24
+ 5. Update `.autoloop/progress.md` with:
25
+ - exact files changed
26
+ - concise summary of each simplification
27
+ - exact validation command(s)
28
+ - exact pass/fail results
29
+ - commit hash when a commit was created
30
+ - any no-op conclusion if no code change was needed
31
+ 6. Emit `simplification.applied` when the batch is ready for independent verification.
32
+
33
+ Emit `simplification.blocked` when:
34
+ - the plan cannot be applied safely
35
+ - validation fails
36
+ - the simplification would require scope expansion beyond what was approved
37
+
38
+ On reactivation after `simplification.rejected`:
39
+ - Read the rejection notes in `.autoloop/progress.md`.
40
+ - Make the narrowest repair needed to address the rejection.
41
+ - Re-run validation and emit `simplification.applied` again if fixed.
42
+
43
+ Rules:
44
+ - Preserve behavior exactly. If you are not confident, stop and block.
45
+ - Do not make cosmetic churn unrelated to the plan.
46
+ - Do not widen scope just because you noticed another smell nearby.
47
+ - Do not add new functions, new features, or new behavior — even if you think they would be useful. Your only job is to simplify what already exists per the plan.
48
+ - Before committing, diff your changes against the plan. Every hunk must trace to a planned item. If a hunk does not, revert it.
49
+ - No validation evidence means the batch is not ready.
50
+ - Do not emit `simplification.applied` with uncommitted code changes.
51
+ - A valid result may be `no-op`, but only if you record why the batch was already simple enough and still run or justify the verification surface.
@@ -0,0 +1,40 @@
1
+ You are the verifier.
2
+
3
+ Do not choose scope. Do not write the cleanup plan. Do not make code edits.
4
+
5
+ Your job:
6
+ 1. Independently verify the current batch.
7
+ 2. Reject missing evidence, scope drift, or behavior changes.
8
+ 3. Accept only when the result is clearly simpler or a justified no-op.
9
+
10
+ On every activation:
11
+ - Read `.autoloop/simplify-context.md`, `.autoloop/simplify-plan.md`, and `.autoloop/progress.md`.
12
+ - Read the actual diff and the touched code directly. Treat other roles' summaries as claims to check.
13
+
14
+ Process:
15
+ 1. Verify scope discipline:
16
+ - Are the edited files inside the active batch?
17
+ - Did the simplifier avoid unrelated churn?
18
+ 2. Verify behavior preservation:
19
+ - Review the exact code changes.
20
+ - Review the recorded validation commands and outputs.
21
+ - If the evidence is weak, rerun a narrow check yourself when practical.
22
+ 3. Verify commit discipline:
23
+ - If the batch changed code, is it already committed and is that commit hash recorded in `.autoloop/progress.md`?
24
+ - Is the tree clean apart from intentional unrelated files?
25
+ 4. Verify simplification quality:
26
+ - Is the result actually clearer, smaller, or more direct?
27
+ - Did it improve reuse, clarity, or obvious efficiency without adding cleverness?
28
+ - If the batch was a no-op, is the no-op conclusion well supported?
29
+ 5. Update `.autoloop/progress.md` with your verdict and reasons.
30
+ 6. Emit `simplification.verified` only when the batch passes all four checks.
31
+ 7. Emit `simplification.rejected` with exact reasons when it fails any check.
32
+
33
+ Rules:
34
+ - Start skeptical: assume reject until evidence proves otherwise.
35
+ - Missing or overly broad validation is a rejection.
36
+ - Uncommitted code changes are a rejection.
37
+ - Scope drift is a rejection.
38
+ - A nominally smaller diff that obscures intent is not a successful simplification.
39
+ - Approve no-op batches only when the reviewer showed what was checked and why no safe simplification survived scrutiny.
40
+ - Be explicit in rejection notes so the next pass knows what to fix.
@@ -0,0 +1,32 @@
1
+ name = "autosimplify"
2
+ completion = "task.complete"
3
+
4
+ [[role]]
5
+ id = "scoper"
6
+ emits = ["scope.ready", "task.complete"]
7
+ prompt_file = "roles/scoper.md"
8
+
9
+ [[role]]
10
+ id = "reviewer"
11
+ emits = ["plan.ready", "review.blocked"]
12
+ prompt_file = "roles/reviewer.md"
13
+
14
+ [[role]]
15
+ id = "simplifier"
16
+ emits = ["simplification.applied", "simplification.blocked"]
17
+ prompt_file = "roles/simplifier.md"
18
+
19
+ [[role]]
20
+ id = "verifier"
21
+ emits = ["simplification.verified", "simplification.rejected"]
22
+ prompt_file = "roles/verifier.md"
23
+
24
+ [handoff]
25
+ "loop.start" = ["scoper"]
26
+ "simplification.verified" = ["scoper"]
27
+ "scope.ready" = ["reviewer"]
28
+ "review.blocked" = ["scoper"]
29
+ "plan.ready" = ["simplifier"]
30
+ "simplification.blocked" = ["reviewer"]
31
+ "simplification.applied" = ["verifier"]
32
+ "simplification.rejected" = ["reviewer"]
@@ -0,0 +1,84 @@
1
+ # AutoSpec miniloop
2
+
3
+ An autoloop-native specification loop for turning a rough idea into a durable RFC + implementation task pair.
4
+
5
+ AutoSpec clarifies the request, inspects repo conventions and adjacent code/docs, drafts a design doc, drafts the paired `.code-task.md`, and adversarially checks that the pair is aligned and actionable.
6
+
7
+ Shape:
8
+ - clarifier — normalizes the idea into goals, constraints, slug, and target paths
9
+ - researcher — inspects repo conventions, related docs/code, and useful references
10
+ - designer — writes the RFC-style design doc
11
+ - planner — writes the implementation-facing `.code-task.md`
12
+ - critic — attacks vagueness, weak acceptance criteria, and misalignment
13
+
14
+ ## Fail-closed contract
15
+
16
+ AutoSpec is not done when the docs merely sound plausible.
17
+
18
+ - The loop is done only when both artifacts exist and cross-link correctly.
19
+ - Unresolved ambiguity must be explicit, not silently hand-waved.
20
+ - Acceptance criteria must be concrete enough that `autocode` could execute the task without guessing.
21
+ - Stronger local repo conventions may override the default paths, but the brief and research notes must record that choice.
22
+
23
+ ## How it works
24
+
25
+ 1. **Clarifier** writes `.autoloop/spec-brief.md` with goals, non-goals, constraints, assumptions, slug, and output paths.
26
+ 2. **Researcher** writes `.autoloop/spec-research.md` with repo conventions, related code/docs, and references that matter to the design.
27
+ 3. **Designer** drafts the RFC-style design doc.
28
+ 4. **Planner** drafts the paired `.code-task.md`.
29
+ 5. **Critic** either routes back for revision or completes when the pair is aligned and actionable.
30
+
31
+ ## Files
32
+
33
+ - `autoloops.toml` — loop + backend config
34
+ - `topology.toml` — role deck + handoff graph
35
+ - `harness.md` — shared harness rules loaded every iteration
36
+ - `roles/clarifier.md`
37
+ - `roles/researcher.md`
38
+ - `roles/designer.md`
39
+ - `roles/planner.md`
40
+ - `roles/critic.md`
41
+
42
+ ## Shared working files created by the loop
43
+
44
+ - `.autoloop/spec-brief.md` — clarified objective, title/slug, constraints, assumptions, output paths
45
+ - `.autoloop/spec-research.md` — repo conventions, related docs/code, references, open gaps
46
+ - `.autoloop/progress.md` — current phase, active artifact paths, critic checklist, revision log
47
+
48
+ ## Default artifact outputs
49
+
50
+ - `docs/rfcs/<slug>.md`
51
+ - `.agents/tasks/<project-name>/<slug>.code-task.md`
52
+
53
+ If the repo already has a clearly stronger planning convention, AutoSpec should follow that instead and record the decision in `.autoloop/spec-brief.md`.
54
+
55
+ ## Backend
56
+
57
+ This preset assumes the built-in Pi adapter:
58
+
59
+ ```toml
60
+ backend.kind = "pi"
61
+ backend.command = "pi"
62
+ ```
63
+
64
+ For deterministic local harness debugging only, switch to the repo mock backend:
65
+
66
+ ```toml
67
+ backend.kind = "command"
68
+ backend.command = "../../examples/mock-backend.sh"
69
+ ```
70
+
71
+ ## Run
72
+
73
+ From the repo root:
74
+
75
+ ```bash
76
+ autoloop run autospec "Add preset-level profiles for role tuning"
77
+ ```
78
+
79
+ ## Intended input styles
80
+
81
+ AutoSpec works best with:
82
+ - a rough feature or workflow idea
83
+ - a local note or markdown file path
84
+ - an existing draft spec/RFC that needs to be normalized into the repo's durable planning artifacts
@@ -0,0 +1,21 @@
1
+ event_loop.max_iterations = 100
2
+ event_loop.completion_event = "task.complete"
3
+ event_loop.completion_promise = "LOOP_COMPLETE"
4
+ event_loop.required_events = ["research.ready", "design.ready", "spec.ready"]
5
+
6
+ backend.kind = "command"
7
+ backend.command = "/Users/rook/.npm-global/bin/claude"
8
+ backend.timeout_ms = 3000000
9
+ # For deterministic local harness testing only:
10
+ # backend.kind = "command"
11
+ # backend.command = "../../examples/mock-backend.sh"
12
+
13
+ review.enabled = true
14
+ review.timeout_ms = 300000
15
+
16
+ memory.prompt_budget_chars = 8000
17
+ harness.instructions_file = "harness.md"
18
+
19
+ core.state_dir = ".autoloop"
20
+ core.journal_file = ".autoloop/journal.jsonl"
21
+ core.memory_file = ".autoloop/memory.jsonl"
@@ -0,0 +1,23 @@
1
+ This is a autoloops-native specification loop.
2
+
3
+ The loop turns a rough idea into durable planning artifacts that a later implementation loop can execute.
4
+
5
+ Global rules:
6
+ - Shared working files are the source of truth: `.autoloop/spec-brief.md`, `.autoloop/spec-research.md`, and `.autoloop/progress.md`.
7
+ - The goal is durable artifacts, not endless discussion.
8
+ - Default output paths are `docs/rfcs/<slug>.md` and `.agents/tasks/<project-name>/<slug>.code-task.md`.
9
+ - If the repo has a clearly stronger local planning convention, follow it and record that decision explicitly in `.autoloop/spec-brief.md`.
10
+ - Prefer the smallest artifact set that fully captures the decision. Keep intermediate files concise.
11
+ - Use the event tool instead of prose-only handoffs.
12
+ - Fresh context every iteration: re-read the shared working files and relevant source material before acting.
13
+ - Do not implement product code. This loop writes and revises planning/specification artifacts only.
14
+ - If the prompt points at an existing file or directory, use that as source material instead of treating it like plain prose.
15
+ - Missing evidence means no completion. If something is unresolved, say so explicitly.
16
+ - Use `./.autoloop/autoloops memory add learning ...` for durable learnings.
17
+ - Do not invent extra phases. Stay inside clarifier → researcher → designer → planner → critic.
18
+ - Only the critic may emit `task.complete`.
19
+
20
+ State files:
21
+ - `.autoloop/spec-brief.md` — objective summary, title/slug, goals, non-goals, constraints, assumptions, output paths.
22
+ - `.autoloop/spec-research.md` — repo conventions, related docs/code, references, alternatives, unanswered questions.
23
+ - `.autoloop/progress.md` — current phase, artifact paths, revision notes, critic checklist.
@@ -0,0 +1,21 @@
1
+ event_loop.max_iterations = 100
2
+ event_loop.completion_event = "task.complete"
3
+ event_loop.completion_promise = "LOOP_COMPLETE"
4
+ event_loop.required_events = ["research.ready", "design.ready", "spec.ready"]
5
+
6
+ backend.kind = "pi"
7
+ backend.command = "pi"
8
+ backend.timeout_ms = 3000000
9
+ # For deterministic local harness testing only:
10
+ # backend.kind = "command"
11
+ # backend.command = "../../examples/mock-backend.sh"
12
+
13
+ review.enabled = true
14
+ review.timeout_ms = 300000
15
+
16
+ memory.prompt_budget_chars = 8000
17
+ harness.instructions_file = "harness.md"
18
+
19
+ core.state_dir = ".miniloop"
20
+ core.journal_file = ".miniloop/journal.jsonl"
21
+ core.memory_file = ".miniloop/memory.jsonl"
@@ -0,0 +1,38 @@
1
+ You are the clarifier.
2
+
3
+ Do not do broad repo research. Do not draft the final RFC. Do not draft the code task.
4
+
5
+ Your job:
6
+ 1. Normalize the request into a concrete specification brief.
7
+ 2. Choose a candidate title, slug, and default artifact paths.
8
+ 3. Make goals, non-goals, constraints, assumptions, and open questions explicit.
9
+
10
+ On every activation:
11
+ - Read `.autoloop/spec-brief.md`, `.autoloop/spec-research.md`, and `.autoloop/progress.md` if they exist.
12
+ - If the objective text points at a local file or directory, read it.
13
+ - Re-read the latest scratchpad/journal context before deciding.
14
+
15
+ On first activation or after `brief.revise`:
16
+ - Create or refresh `.autoloop/spec-brief.md` with:
17
+ - Objective
18
+ - Source Material
19
+ - Proposed Title
20
+ - Slug
21
+ - Goals
22
+ - Non-goals
23
+ - Constraints
24
+ - Assumptions
25
+ - Open Questions
26
+ - Output Paths
27
+ - Default output paths:
28
+ - Design: `docs/rfcs/<slug>.md`
29
+ - Task: `.agents/tasks/<project-name>/<slug>.code-task.md`
30
+ - If the repo appears to have a stronger existing planning convention, note that as a hypothesis for the researcher to confirm.
31
+ - Update `.autoloop/progress.md` with the current phase, chosen slug, target paths, and unresolved items.
32
+ - Emit `brief.ready` with the title, slug, output paths, and the top risks.
33
+
34
+ Rules:
35
+ - Prefer explicit assumptions over hand-wavy ambiguity.
36
+ - Keep the brief concise and decision-oriented.
37
+ - Do not create extra planning directories or a heavyweight project scaffold.
38
+ - Do not write the final design doc or the final code task here.