self-evolving-workflow 0.0.0-stage → 0.1.4

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 (375) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +195 -2
  3. package/dist/agent-memory-prompts.d.ts +13 -0
  4. package/dist/agent-memory-prompts.js +55 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +6 -0
  7. package/dist/closeout.d.ts +105 -0
  8. package/dist/closeout.js +473 -0
  9. package/dist/code.d.ts +39 -0
  10. package/dist/code.js +124 -0
  11. package/dist/codex-memory.d.ts +24 -0
  12. package/dist/codex-memory.js +217 -0
  13. package/dist/common.d.ts +16 -0
  14. package/dist/common.js +52 -0
  15. package/dist/context-envelope.d.ts +59 -0
  16. package/dist/context-envelope.js +23 -0
  17. package/dist/host-adapters.d.ts +34 -0
  18. package/dist/host-adapters.js +151 -0
  19. package/dist/http.d.ts +3 -0
  20. package/dist/http.js +90 -0
  21. package/dist/index.d.ts +16 -0
  22. package/dist/index.js +13 -0
  23. package/dist/knowledge-cli.d.ts +198 -0
  24. package/dist/knowledge-cli.js +761 -0
  25. package/dist/knowledge-reads.d.ts +72 -0
  26. package/dist/knowledge-reads.js +201 -0
  27. package/dist/memory-config.d.ts +44 -0
  28. package/dist/memory-config.js +204 -0
  29. package/dist/memory-evidence.d.ts +13 -0
  30. package/dist/memory-evidence.js +40 -0
  31. package/dist/memory-history.d.ts +46 -0
  32. package/dist/memory-history.js +432 -0
  33. package/dist/memory.d.ts +96 -0
  34. package/dist/memory.js +362 -0
  35. package/dist/retrospective.d.ts +57 -0
  36. package/dist/retrospective.js +240 -0
  37. package/dist/search.d.ts +36 -0
  38. package/dist/search.js +112 -0
  39. package/dist/skill-addition.d.ts +25 -0
  40. package/dist/skill-addition.js +89 -0
  41. package/dist/skill-design.d.ts +96 -0
  42. package/dist/skill-design.js +226 -0
  43. package/dist/skill-replay.d.ts +55 -0
  44. package/dist/skill-replay.js +448 -0
  45. package/dist/skill-route.d.ts +30 -0
  46. package/dist/skill-route.js +75 -0
  47. package/dist/transcript-evidence.d.ts +3 -0
  48. package/dist/transcript-evidence.js +58 -0
  49. package/dist/upstream/chunker.d.ts +24 -0
  50. package/dist/upstream/chunker.js +96 -0
  51. package/dist/upstream/file-protocol.d.ts +45 -0
  52. package/dist/upstream/file-protocol.js +117 -0
  53. package/dist/upstream/frontmatter.d.ts +47 -0
  54. package/dist/upstream/frontmatter.js +86 -0
  55. package/dist/upstream/graph-search.d.ts +33 -0
  56. package/dist/upstream/graph-search.js +67 -0
  57. package/dist/upstream/l1-extraction.d.ts +26 -0
  58. package/dist/upstream/l1-extraction.js +405 -0
  59. package/dist/upstream/llm.d.ts +8 -0
  60. package/dist/upstream/llm.js +1 -0
  61. package/dist/upstream/merge.d.ts +50 -0
  62. package/dist/upstream/merge.js +153 -0
  63. package/dist/upstream/prompts.d.ts +53 -0
  64. package/dist/upstream/prompts.js +181 -0
  65. package/dist/upstream/search-utils.d.ts +34 -0
  66. package/dist/upstream/search-utils.js +55 -0
  67. package/dist/upstream/slug.d.ts +26 -0
  68. package/dist/upstream/slug.js +103 -0
  69. package/dist/upstream/template.d.ts +29 -0
  70. package/dist/upstream/template.js +80 -0
  71. package/dist/upstream/tokenize.d.ts +4 -0
  72. package/dist/upstream/tokenize.js +29 -0
  73. package/dist/wiki-change.d.ts +76 -0
  74. package/dist/wiki-change.js +299 -0
  75. package/dist/wiki-entry.d.ts +26 -0
  76. package/dist/wiki-entry.js +93 -0
  77. package/dist/wiki-ingest.d.ts +12 -0
  78. package/dist/wiki-ingest.js +126 -0
  79. package/dist/wiki-migration.d.ts +16 -0
  80. package/dist/wiki-migration.js +268 -0
  81. package/dist/wiki-tokens.d.ts +1 -0
  82. package/dist/wiki-tokens.js +46 -0
  83. package/dist/wiki.d.ts +103 -0
  84. package/dist/wiki.js +330 -0
  85. package/dist/workflow-cli.d.ts +2 -0
  86. package/dist/workflow-cli.js +319 -0
  87. package/dist/workflow-install.d.ts +37 -0
  88. package/dist/workflow-install.js +148 -0
  89. package/dist/workflow-knowledge.d.ts +18 -0
  90. package/dist/workflow-knowledge.js +32 -0
  91. package/dist/workflow-mcp.d.ts +2 -0
  92. package/dist/workflow-mcp.js +137 -0
  93. package/dist/workflow-names.d.ts +4 -0
  94. package/dist/workflow-names.js +31 -0
  95. package/dist/workflow-runtime.d.ts +735 -0
  96. package/dist/workflow-runtime.js +747 -0
  97. package/dist/workflow-skills.d.ts +48 -0
  98. package/dist/workflow-skills.js +141 -0
  99. package/docs/images/impeccable-skill.png +0 -0
  100. package/docs/images/workflow-overview.png +0 -0
  101. package/docs/images/workflow-skills.png +0 -0
  102. package/package.json +77 -4
  103. package/skills/ew-impeccable/LICENSE +191 -0
  104. package/skills/ew-impeccable/NOTICE.md +19 -0
  105. package/skills/ew-impeccable/SKILL.md +91 -0
  106. package/skills/ew-impeccable/UPSTREAM.md +23 -0
  107. package/skills/ew-impeccable/reference/adapt.md +314 -0
  108. package/skills/ew-impeccable/reference/adapt.native.md +60 -0
  109. package/skills/ew-impeccable/reference/android.md +46 -0
  110. package/skills/ew-impeccable/reference/animate.md +91 -0
  111. package/skills/ew-impeccable/reference/audit.md +138 -0
  112. package/skills/ew-impeccable/reference/audit.native.md +141 -0
  113. package/skills/ew-impeccable/reference/bolder.md +35 -0
  114. package/skills/ew-impeccable/reference/clarify.md +96 -0
  115. package/skills/ew-impeccable/reference/colorize.md +88 -0
  116. package/skills/ew-impeccable/reference/craft-floor.md +44 -0
  117. package/skills/ew-impeccable/reference/craft.md +5 -0
  118. package/skills/ew-impeccable/reference/critique.md +808 -0
  119. package/skills/ew-impeccable/reference/degraded/asset-producer.md +36 -0
  120. package/skills/ew-impeccable/reference/degraded/documenter.md +23 -0
  121. package/skills/ew-impeccable/reference/degraded/finish-reviewer.md +72 -0
  122. package/skills/ew-impeccable/reference/degraded/manual-edit-applier.md +91 -0
  123. package/skills/ew-impeccable/reference/delight.md +72 -0
  124. package/skills/ew-impeccable/reference/distill.md +113 -0
  125. package/skills/ew-impeccable/reference/doctor.md +56 -0
  126. package/skills/ew-impeccable/reference/document.md +418 -0
  127. package/skills/ew-impeccable/reference/extract.md +68 -0
  128. package/skills/ew-impeccable/reference/harden.md +338 -0
  129. package/skills/ew-impeccable/reference/hooks.md +113 -0
  130. package/skills/ew-impeccable/reference/init.md +133 -0
  131. package/skills/ew-impeccable/reference/ios.md +51 -0
  132. package/skills/ew-impeccable/reference/layout.md +86 -0
  133. package/skills/ew-impeccable/reference/live-setup.md +102 -0
  134. package/skills/ew-impeccable/reference/live.md +326 -0
  135. package/skills/ew-impeccable/reference/new-work.md +209 -0
  136. package/skills/ew-impeccable/reference/onboard.md +236 -0
  137. package/skills/ew-impeccable/reference/operate.md +61 -0
  138. package/skills/ew-impeccable/reference/optimize.md +260 -0
  139. package/skills/ew-impeccable/reference/overdrive.md +127 -0
  140. package/skills/ew-impeccable/reference/polish.md +105 -0
  141. package/skills/ew-impeccable/reference/quieter.md +101 -0
  142. package/skills/ew-impeccable/reference/routing.md +20 -0
  143. package/skills/ew-impeccable/reference/shape.md +59 -0
  144. package/skills/ew-impeccable/reference/typeset.md +82 -0
  145. package/skills/ew-impeccable/reference/visualize.md +46 -0
  146. package/skills/ew-impeccable/scripts/build-phase.mjs +1022 -0
  147. package/skills/ew-impeccable/scripts/command-metadata.json +94 -0
  148. package/skills/ew-impeccable/scripts/comp-diff.mjs +391 -0
  149. package/skills/ew-impeccable/scripts/comp-spec.mjs +513 -0
  150. package/skills/ew-impeccable/scripts/concept-seed.mjs +814 -0
  151. package/skills/ew-impeccable/scripts/context-signals.mjs +325 -0
  152. package/skills/ew-impeccable/scripts/context.mjs +1521 -0
  153. package/skills/ew-impeccable/scripts/critique-storage.mjs +473 -0
  154. package/skills/ew-impeccable/scripts/data/font-index-failures.json +121 -0
  155. package/skills/ew-impeccable/scripts/data/font-index.json +1 -0
  156. package/skills/ew-impeccable/scripts/detect-csp.mjs +246 -0
  157. package/skills/ew-impeccable/scripts/detect.mjs +30 -0
  158. package/skills/ew-impeccable/scripts/detector/browser/injected/index.mjs +2580 -0
  159. package/skills/ew-impeccable/scripts/detector/cli/main.mjs +498 -0
  160. package/skills/ew-impeccable/scripts/detector/design-system.mjs +1311 -0
  161. package/skills/ew-impeccable/scripts/detector/detect-antipatterns-browser.js +9486 -0
  162. package/skills/ew-impeccable/scripts/detector/detect-antipatterns.mjs +51 -0
  163. package/skills/ew-impeccable/scripts/detector/engines/browser/detect-url.mjs +434 -0
  164. package/skills/ew-impeccable/scripts/detector/engines/regex/detect-text.mjs +1439 -0
  165. package/skills/ew-impeccable/scripts/detector/engines/static-html/css-cascade.mjs +1242 -0
  166. package/skills/ew-impeccable/scripts/detector/engines/static-html/detect-html.mjs +263 -0
  167. package/skills/ew-impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
  168. package/skills/ew-impeccable/scripts/detector/findings.mjs +23 -0
  169. package/skills/ew-impeccable/scripts/detector/node/file-system.mjs +225 -0
  170. package/skills/ew-impeccable/scripts/detector/profile/profiler.mjs +166 -0
  171. package/skills/ew-impeccable/scripts/detector/registry/antipatterns.mjs +636 -0
  172. package/skills/ew-impeccable/scripts/detector/rules/checks.mjs +5750 -0
  173. package/skills/ew-impeccable/scripts/detector/shared/color.mjs +596 -0
  174. package/skills/ew-impeccable/scripts/detector/shared/constants.mjs +127 -0
  175. package/skills/ew-impeccable/scripts/detector/shared/fonts.mjs +30 -0
  176. package/skills/ew-impeccable/scripts/detector/shared/inline-ignores.mjs +148 -0
  177. package/skills/ew-impeccable/scripts/detector/shared/page.mjs +7 -0
  178. package/skills/ew-impeccable/scripts/detector/vendor/MDN-DATA-LICENSE +116 -0
  179. package/skills/ew-impeccable/scripts/detector/vendor/THIRD_PARTY_LICENSES.md +227 -0
  180. package/skills/ew-impeccable/scripts/detector/vendor/static-html-parser.build-entry.txt +11 -0
  181. package/skills/ew-impeccable/scripts/detector/vendor/static-html-parser.bundle.mjs +9121 -0
  182. package/skills/ew-impeccable/scripts/doctor.mjs +330 -0
  183. package/skills/ew-impeccable/scripts/embed-prompt.mjs +166 -0
  184. package/skills/ew-impeccable/scripts/font-match.mjs +457 -0
  185. package/skills/ew-impeccable/scripts/generate-image.mjs +447 -0
  186. package/skills/ew-impeccable/scripts/hook-admin.mjs +829 -0
  187. package/skills/ew-impeccable/scripts/hook-before-edit.mjs +538 -0
  188. package/skills/ew-impeccable/scripts/hook-lib.mjs +2493 -0
  189. package/skills/ew-impeccable/scripts/hook.mjs +79 -0
  190. package/skills/ew-impeccable/scripts/lib/artifact-schema.mjs +93 -0
  191. package/skills/ew-impeccable/scripts/lib/composition-catalog.mjs +200 -0
  192. package/skills/ew-impeccable/scripts/lib/concept-catalog.mjs +395 -0
  193. package/skills/ew-impeccable/scripts/lib/design-parser.mjs +880 -0
  194. package/skills/ew-impeccable/scripts/lib/font-fingerprint.mjs +564 -0
  195. package/skills/ew-impeccable/scripts/lib/font-index.mjs +130 -0
  196. package/skills/ew-impeccable/scripts/lib/hero-checks.mjs +246 -0
  197. package/skills/ew-impeccable/scripts/lib/image-metrics.mjs +306 -0
  198. package/skills/ew-impeccable/scripts/lib/impeccable-config.mjs +640 -0
  199. package/skills/ew-impeccable/scripts/lib/impeccable-paths.mjs +137 -0
  200. package/skills/ew-impeccable/scripts/lib/is-generated.mjs +72 -0
  201. package/skills/ew-impeccable/scripts/lib/live-path-globs.mjs +37 -0
  202. package/skills/ew-impeccable/scripts/lib/open-system-browser.mjs +26 -0
  203. package/skills/ew-impeccable/scripts/lib/png.mjs +281 -0
  204. package/skills/ew-impeccable/scripts/lib/provider.mjs +5 -0
  205. package/skills/ew-impeccable/scripts/lib/raster.mjs +194 -0
  206. package/skills/ew-impeccable/scripts/lib/roll-selection.mjs +369 -0
  207. package/skills/ew-impeccable/scripts/lib/staleness-deep.mjs +491 -0
  208. package/skills/ew-impeccable/scripts/lib/staleness-notice.mjs +169 -0
  209. package/skills/ew-impeccable/scripts/lib/staleness.mjs +532 -0
  210. package/skills/ew-impeccable/scripts/lib/surface-briefs.mjs +149 -0
  211. package/skills/ew-impeccable/scripts/lib/target-args.mjs +42 -0
  212. package/skills/ew-impeccable/scripts/lib/target-slug.mjs +33 -0
  213. package/skills/ew-impeccable/scripts/lib/template-extensions.mjs +146 -0
  214. package/skills/ew-impeccable/scripts/live/accept-css.mjs +617 -0
  215. package/skills/ew-impeccable/scripts/live/accept-verify.mjs +60 -0
  216. package/skills/ew-impeccable/scripts/live/browser-script-parts.mjs +84 -0
  217. package/skills/ew-impeccable/scripts/live/completion.mjs +28 -0
  218. package/skills/ew-impeccable/scripts/live/event-validation.mjs +199 -0
  219. package/skills/ew-impeccable/scripts/live/frameworks/astro.mjs +47 -0
  220. package/skills/ew-impeccable/scripts/live/frameworks/detect-utils.mjs +73 -0
  221. package/skills/ew-impeccable/scripts/live/frameworks/index.mjs +143 -0
  222. package/skills/ew-impeccable/scripts/live/frameworks/journal.mjs +197 -0
  223. package/skills/ew-impeccable/scripts/live/frameworks/nextjs.mjs +49 -0
  224. package/skills/ew-impeccable/scripts/live/frameworks/nuxt.mjs +161 -0
  225. package/skills/ew-impeccable/scripts/live/frameworks/script-src.mjs +17 -0
  226. package/skills/ew-impeccable/scripts/live/frameworks/static-html.mjs +26 -0
  227. package/skills/ew-impeccable/scripts/live/frameworks/sveltekit.mjs +71 -0
  228. package/skills/ew-impeccable/scripts/live/frameworks/tag-strategy.mjs +247 -0
  229. package/skills/ew-impeccable/scripts/live/frameworks/tanstack-start.mjs +70 -0
  230. package/skills/ew-impeccable/scripts/live/frameworks/vite-generic.mjs +42 -0
  231. package/skills/ew-impeccable/scripts/live/generation-preflight.mjs +149 -0
  232. package/skills/ew-impeccable/scripts/live/insert-ui.mjs +458 -0
  233. package/skills/ew-impeccable/scripts/live/instructions.mjs +142 -0
  234. package/skills/ew-impeccable/scripts/live/manual-apply.mjs +939 -0
  235. package/skills/ew-impeccable/scripts/live/manual-edit-routes.mjs +357 -0
  236. package/skills/ew-impeccable/scripts/live/manual-edits-buffer.mjs +152 -0
  237. package/skills/ew-impeccable/scripts/live/poll-lanes.mjs +14 -0
  238. package/skills/ew-impeccable/scripts/live/project-ignores.mjs +139 -0
  239. package/skills/ew-impeccable/scripts/live/roots.mjs +508 -0
  240. package/skills/ew-impeccable/scripts/live/session-store.mjs +563 -0
  241. package/skills/ew-impeccable/scripts/live/source-lock.mjs +105 -0
  242. package/skills/ew-impeccable/scripts/live/source-search.mjs +105 -0
  243. package/skills/ew-impeccable/scripts/live/svelte-ast.mjs +969 -0
  244. package/skills/ew-impeccable/scripts/live/svelte-component.mjs +1366 -0
  245. package/skills/ew-impeccable/scripts/live/sveltekit-adapter.mjs +304 -0
  246. package/skills/ew-impeccable/scripts/live/tanstack-adapter.mjs +259 -0
  247. package/skills/ew-impeccable/scripts/live/ui-surfaces.mjs +75 -0
  248. package/skills/ew-impeccable/scripts/live/vocabulary.mjs +171 -0
  249. package/skills/ew-impeccable/scripts/live-accept.mjs +938 -0
  250. package/skills/ew-impeccable/scripts/live-browser-dom.js +167 -0
  251. package/skills/ew-impeccable/scripts/live-browser-ignores.js +242 -0
  252. package/skills/ew-impeccable/scripts/live-browser-session.js +144 -0
  253. package/skills/ew-impeccable/scripts/live-browser.js +12851 -0
  254. package/skills/ew-impeccable/scripts/live-commit-manual-edits.mjs +1200 -0
  255. package/skills/ew-impeccable/scripts/live-complete.mjs +107 -0
  256. package/skills/ew-impeccable/scripts/live-copy-edit-agent.mjs +800 -0
  257. package/skills/ew-impeccable/scripts/live-discard-manual-edits.mjs +51 -0
  258. package/skills/ew-impeccable/scripts/live-inject.mjs +463 -0
  259. package/skills/ew-impeccable/scripts/live-insert.mjs +292 -0
  260. package/skills/ew-impeccable/scripts/live-manual-edit-evidence.mjs +368 -0
  261. package/skills/ew-impeccable/scripts/live-poll.mjs +430 -0
  262. package/skills/ew-impeccable/scripts/live-resume.mjs +123 -0
  263. package/skills/ew-impeccable/scripts/live-server.mjs +1698 -0
  264. package/skills/ew-impeccable/scripts/live-status.mjs +71 -0
  265. package/skills/ew-impeccable/scripts/live-target.mjs +30 -0
  266. package/skills/ew-impeccable/scripts/live-wrap.mjs +927 -0
  267. package/skills/ew-impeccable/scripts/live.mjs +334 -0
  268. package/skills/ew-impeccable/scripts/modern-screenshot.umd.js +14 -0
  269. package/skills/ew-impeccable/scripts/palette.mjs +628 -0
  270. package/skills/ew-impeccable/scripts/pin.mjs +352 -0
  271. package/skills/ew-impeccable/scripts/serve-question.mjs +1783 -0
  272. package/skills/ew-impeccable/scripts/surface-brief.mjs +74 -0
  273. package/skills/ew-knowledge/SKILL.md +35 -0
  274. package/skills/ew-knowledge/references/closeout-protocol.md +68 -0
  275. package/skills/ew-knowledge/references/knowledge-route.md +73 -0
  276. package/skills/ew-knowledge/references/wiki-maintenance.md +27 -0
  277. package/skills/ew-odyssey/SKILL.md +106 -0
  278. package/skills/ew-odyssey/references/audit-artifacts.md +7 -0
  279. package/skills/ew-odyssey/references/odyssey-base.md +104 -0
  280. package/skills/ew-odyssey/references/odyssey-debug.md +264 -0
  281. package/skills/ew-odyssey/references/odyssey-defensive.md +351 -0
  282. package/skills/ew-odyssey/references/odyssey-improve.md +230 -0
  283. package/skills/ew-odyssey/references/odyssey-planex.md +294 -0
  284. package/skills/ew-odyssey/references/odyssey-review.md +233 -0
  285. package/skills/ew-odyssey/references/odyssey-security.md +231 -0
  286. package/skills/ew-odyssey/references/odyssey-ui.md +232 -0
  287. package/skills/ew-odyssey/references/prepare/odyssey-debug.md +102 -0
  288. package/skills/ew-odyssey/references/prepare/odyssey-defensive.md +117 -0
  289. package/skills/ew-odyssey/references/prepare/odyssey-improve.md +95 -0
  290. package/skills/ew-odyssey/references/prepare/odyssey-planex.md +105 -0
  291. package/skills/ew-odyssey/references/prepare/odyssey-review.md +105 -0
  292. package/skills/ew-odyssey/references/prepare/odyssey-security.md +91 -0
  293. package/skills/ew-odyssey/references/prepare/odyssey-ui.md +88 -0
  294. package/skills/ew-odyssey/references/runtime-adapters.md +31 -0
  295. package/skills/ew-orchestrate/SKILL.md +89 -0
  296. package/skills/ew-orchestrate/references/auto-policy.md +66 -0
  297. package/skills/ew-orchestrate/references/boundary-grill.md +51 -0
  298. package/skills/ew-orchestrate/references/companion-route.md +40 -0
  299. package/skills/ew-orchestrate/references/ew-orchestrate.md +44 -0
  300. package/skills/ew-orchestrate/references/goal.md +51 -0
  301. package/skills/ew-orchestrate/references/orchestrator-run-loop.md +33 -0
  302. package/skills/ew-orchestrate/references/planning.md +54 -0
  303. package/skills/ew-orchestrate/steps/ew-analyze/SKILL.md +70 -0
  304. package/skills/ew-orchestrate/steps/ew-analyze/references/issue-gaps-analyze.md +24 -0
  305. package/skills/ew-orchestrate/steps/ew-analyze/references/prepare.md +8 -0
  306. package/skills/ew-orchestrate/steps/ew-analyze/references/workflow.md +138 -0
  307. package/skills/ew-orchestrate/steps/ew-auto-test/SKILL.md +80 -0
  308. package/skills/ew-orchestrate/steps/ew-auto-test/references/prepare.md +23 -0
  309. package/skills/ew-orchestrate/steps/ew-auto-test/references/workflow.md +31 -0
  310. package/skills/ew-orchestrate/steps/ew-blueprint/SKILL.md +122 -0
  311. package/skills/ew-orchestrate/steps/ew-blueprint/references/prepare.md +21 -0
  312. package/skills/ew-orchestrate/steps/ew-blueprint/references/workflow.md +28 -0
  313. package/skills/ew-orchestrate/steps/ew-brainstorm/SKILL.md +49 -0
  314. package/skills/ew-orchestrate/steps/ew-companion/SKILL.md +50 -0
  315. package/skills/ew-orchestrate/steps/ew-debug/SKILL.md +85 -0
  316. package/skills/ew-orchestrate/steps/ew-debug/references/prepare.md +27 -0
  317. package/skills/ew-orchestrate/steps/ew-debug/references/workflow.md +31 -0
  318. package/skills/ew-orchestrate/steps/ew-execute/SKILL.md +74 -0
  319. package/skills/ew-orchestrate/steps/ew-execute/references/prepare.md +27 -0
  320. package/skills/ew-orchestrate/steps/ew-execute/references/workflow.md +87 -0
  321. package/skills/ew-orchestrate/steps/ew-grill/SKILL.md +62 -0
  322. package/skills/ew-orchestrate/steps/ew-grill/references/prepare.md +26 -0
  323. package/skills/ew-orchestrate/steps/ew-grill/references/workflow.md +31 -0
  324. package/skills/ew-orchestrate/steps/ew-init/SKILL.md +56 -0
  325. package/skills/ew-orchestrate/steps/ew-init/references/prepare.md +25 -0
  326. package/skills/ew-orchestrate/steps/ew-init/references/workflow.md +28 -0
  327. package/skills/ew-orchestrate/steps/ew-plan/SKILL.md +131 -0
  328. package/skills/ew-orchestrate/steps/ew-plan/references/prepare.md +8 -0
  329. package/skills/ew-orchestrate/steps/ew-plan/references/tdd.md +53 -0
  330. package/skills/ew-orchestrate/steps/ew-plan/references/workflow.md +100 -0
  331. package/skills/ew-orchestrate/steps/ew-retrospective/SKILL.md +68 -0
  332. package/skills/ew-orchestrate/steps/ew-retrospective/references/prepare.md +18 -0
  333. package/skills/ew-orchestrate/steps/ew-retrospective/references/workflow.md +34 -0
  334. package/skills/ew-orchestrate/steps/ew-review/SKILL.md +45 -0
  335. package/skills/ew-orchestrate/steps/ew-review/references/prepare.md +17 -0
  336. package/skills/ew-orchestrate/steps/ew-review/references/workflow.md +116 -0
  337. package/skills/ew-orchestrate/steps/ew-roadmap/SKILL.md +62 -0
  338. package/skills/ew-orchestrate/steps/ew-roadmap/references/prepare.md +27 -0
  339. package/skills/ew-orchestrate/steps/ew-roadmap/references/workflow.md +28 -0
  340. package/skills/ew-orchestrate/steps/ew-test/SKILL.md +99 -0
  341. package/skills/ew-orchestrate/steps/ew-test/references/prepare.md +23 -0
  342. package/skills/ew-orchestrate/steps/ew-test/references/workflow.md +23 -0
  343. package/skills/ew-orchestrate/steps/ew-verify/SKILL.md +73 -0
  344. package/skills/ew-orchestrate/steps/ew-verify/references/prepare.md +21 -0
  345. package/skills/ew-orchestrate/steps/ew-verify/references/workflow.md +29 -0
  346. package/skills/ew-skill-design/SKILL.md +30 -0
  347. package/skills/ew-skill-design/references/package-contract.md +40 -0
  348. package/skills/ew-skill-design/references/validation.md +21 -0
  349. package/skills/team-swarm/SKILL.md +68 -0
  350. package/skills/team-swarm/references/mcp-coordination.md +14 -0
  351. package/skills/team-swarm/roles/analyst/role.md +181 -0
  352. package/skills/team-swarm/roles/ant/role.md +149 -0
  353. package/skills/team-swarm/roles/coordinator/commands/converge.md +112 -0
  354. package/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  355. package/skills/team-swarm/roles/coordinator/commands/iterate.md +171 -0
  356. package/skills/team-swarm/roles/coordinator/role.md +170 -0
  357. package/skills/team-swarm/roles/scorer/role.md +150 -0
  358. package/skills/team-swarm/scripts/aco.py +646 -0
  359. package/skills/team-swarm/scripts/pheromone.py +144 -0
  360. package/skills/team-swarm/scripts/scoring.py +111 -0
  361. package/skills/team-swarm/scripts/test_aco.py +606 -0
  362. package/skills/team-swarm/specs/ant-output-schema.md +127 -0
  363. package/skills/team-swarm/specs/convergence-criteria.md +108 -0
  364. package/skills/team-swarm/specs/pheromone-schema.md +125 -0
  365. package/skills/team-swarm/specs/swarm-config-template.json +71 -0
  366. package/skills/team-swarm/specs/swarm-protocol.md +119 -0
  367. package/skills/workflow-evolve/SKILL.md +64 -0
  368. package/skills/workflow-evolve/references/agy-gate.md +27 -0
  369. package/skills/workflow-evolve/references/auto-loop.md +23 -0
  370. package/skills/workflow-evolve/references/history-review.md +15 -0
  371. package/skills/workflow-evolve/scripts/codex-memory-replay.mjs +86 -0
  372. package/skills/workflow-evolve/scripts/codex-replay.mjs +1 -0
  373. package/skills/workflow-evolve/scripts/evolve-loop.mjs +260 -0
  374. package/skills/workflow-evolve/scripts/memory-codex-mcp.mjs +124 -0
  375. package/workflows/index.json +33 -0
@@ -0,0 +1,127 @@
1
+
2
+
3
+ # Ant Output Schema
4
+
5
+ **The critical contract.** Every ant MUST write a JSON file matching this schema. Pheromone updates depend on it. Schema violation = ant output discarded + worker error reported.
6
+
7
+ ## File Path
8
+
9
+ ```
10
+ {run_dir}/outputs/ant-<iteration>-<ant_id>.json
11
+ ```
12
+
13
+ Example: `{run_dir}/outputs/ant-3-2.json` (ant id 2 in iteration 3)
14
+
15
+ ## Schema
16
+
17
+ ```json
18
+ {
19
+ "_meta": {
20
+ "kind": "swarm-ant-result",
21
+ "schema": "swarm-ant-result/1.0",
22
+ "role": "evidence"
23
+ },
24
+ "schema_version": "1.0",
25
+ "ant_id": "ANT-3-2",
26
+ "iteration": 3,
27
+ "assignment": {
28
+ "start_node": "node_a",
29
+ "max_path_length": 5
30
+ },
31
+ "path": ["node_a", "node_c", "node_f"],
32
+ "path_decisions": [
33
+ {
34
+ "from": "node_a",
35
+ "to": "node_c",
36
+ "rationale": "<one-line reason>",
37
+ "guided_by": "pheromone | heuristic | evidence",
38
+ "pheromone_weight": 0.30,
39
+ "deviation_from_hint": false
40
+ },
41
+ {
42
+ "from": "node_c",
43
+ "to": "node_f",
44
+ "rationale": "<one-line reason>",
45
+ "guided_by": "evidence",
46
+ "deviation_from_hint": true
47
+ }
48
+ ],
49
+ "self_score": 0.78,
50
+ "self_confidence": 0.6,
51
+ "cost_tokens": 1200,
52
+ "cost_seconds": 18,
53
+ "evidence": [
54
+ "src/foo.ts:42",
55
+ "tests/foo.spec.ts:18"
56
+ ],
57
+ "candidate_solution": {
58
+ "type": "<string|object|file_ref>",
59
+ "summary": "<one-line>",
60
+ "content": "<actual artifact content OR a path>"
61
+ },
62
+ "blockers": [],
63
+ "notes": "<optional free text, NOT used by pheromone update>"
64
+ }
65
+ ```
66
+
67
+ ## Required Fields (Validation)
68
+
69
+ | Field | Type | Required | Constraint |
70
+ |-------|------|----------|------------|
71
+ | `_meta` | object | yes | complete artifact metadata; `kind` = `swarm-ant-result`, `schema` = `swarm-ant-result/1.0` |
72
+ | `schema_version` | string | yes | must be `"1.0"` |
73
+ | `ant_id` | string | yes | matches assignment |
74
+ | `iteration` | int | yes | matches assignment |
75
+ | `path` | array of string | yes | len >= 1, all nodes ∈ task_space.nodes |
76
+ | `path_decisions` | array | yes | len = len(path) - 1 |
77
+ | `self_score` | float | yes | 0.0 ≤ x ≤ 1.0 |
78
+ | `self_confidence` | float | yes | 0.0 ≤ x ≤ 1.0 |
79
+ | `cost_tokens` | int | no | recommended for budget tracking |
80
+ | `evidence` | array of string | yes | min 1 entry (forces grounding) |
81
+ | `candidate_solution` | object | yes | non-empty `summary` |
82
+
83
+ ## Two-Layer Scoring
84
+
85
+ | Score | Source | Purpose |
86
+ |-------|--------|---------|
87
+ | `self_score` | Ant LLM self-report | Cheap early-stop signal; tracked but NOT used for pheromone update |
88
+ | `self_confidence` | Ant LLM self-report | Used to weight self_score when no verified_score is available |
89
+ | `verified_score` | scoring.py OR scorer role | **Authoritative input to pheromone update.** Written to separate file: `{run_dir}/work/team/scores/iter-k-scores.json` |
90
+
91
+ If `verified_score` is missing for an ant (scorer disabled), pheromone update falls back to:
92
+ ```
93
+ effective_score = self_score * self_confidence * config.scoring.self_score_discount # default 0.5
94
+ ```
95
+
96
+ ## verified_scores File
97
+
98
+ When scorer runs (script or LLM), produces:
99
+
100
+ ```json
101
+ {
102
+ "iteration": 3,
103
+ "scorer_type": "script | llm",
104
+ "scores": {
105
+ "ANT-3-1": { "verified_score": 0.82, "rationale": "..." },
106
+ "ANT-3-2": { "verified_score": 0.45, "rationale": "..." }
107
+ },
108
+ "computed_at": "2026-05-25T14:30:00Z"
109
+ }
110
+ ```
111
+
112
+ ## Hallucination Detection
113
+
114
+ `aco.py update` compares `self_score` vs `verified_score` per ant:
115
+ - `|self_score - verified_score| > 0.4` → flagged as `hallucination_suspected`
116
+ - Repeat offenders (≥ 3 across iterations) → `aco.py` reduces deposit on their paths by 50%
117
+
118
+ ## Validation in Ant's Phase 4
119
+
120
+ Ant MUST self-validate before writing:
121
+ 1. JSON parses cleanly
122
+ 2. All required fields present
123
+ 3. `path` nodes exist in task-space.json
124
+ 4. `path_decisions` length = `len(path) - 1`
125
+ 5. Numeric ranges within bounds
126
+
127
+ Validation failure → retry once → if still failing, report `partial_completion` to coordinator.
@@ -0,0 +1,108 @@
1
+
2
+
3
+ # Convergence Criteria
4
+
5
+ When does the swarm stop iterating? Defines stop conditions computed by `aco.py converged`.
6
+
7
+ ## Stop Conditions (any-of)
8
+
9
+ The swarm stops when **any** of the configured criteria triggers:
10
+
11
+ | Criterion | Default | Description |
12
+ |-----------|---------|-------------|
13
+ | `max_iterations` | 5 | Hard cap on iteration count |
14
+ | `stagnation` | patience = 2 | Best score unchanged for N iterations |
15
+ | `entropy_floor` | 0.5 | Pheromone Shannon entropy drops below threshold (matrix highly concentrated) |
16
+ | `budget_tokens` | 100000 | Total token cost exceeds budget |
17
+ | `target_score` | 0.95 | Best verified_score crosses target |
18
+
19
+ ## Configuration
20
+
21
+ ```json
22
+ {
23
+ "convergence": {
24
+ "max_iterations": 5,
25
+ "stagnation": { "enabled": true, "patience": 2, "min_delta": 0.01 },
26
+ "entropy_floor": { "enabled": true, "threshold": 0.5 },
27
+ "budget_tokens": { "enabled": false, "max": 100000 },
28
+ "target_score": { "enabled": true, "value": 0.95 }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## Output Schema (aco.py converged)
34
+
35
+ ```json
36
+ {
37
+ "converged": true,
38
+ "iteration": 4,
39
+ "reason": "stagnation",
40
+ "metrics": {
41
+ "best_score": 0.78,
42
+ "mean_score": 0.62,
43
+ "entropy": 1.85,
44
+ "iterations_completed": 4,
45
+ "iterations_since_best_change": 2,
46
+ "total_tokens_used": 42000
47
+ },
48
+ "triggered_by": ["stagnation"],
49
+ "recommendation": "best solution is stable; recommend report"
50
+ }
51
+ ```
52
+
53
+ ## Selection Logic
54
+
55
+ ```
56
+ def check_convergence(history, config):
57
+ triggered = []
58
+
59
+ if iteration >= config.max_iterations:
60
+ triggered.append("max_iterations")
61
+
62
+ if config.stagnation.enabled:
63
+ recent = history[-config.stagnation.patience-1:]
64
+ if len(recent) > config.stagnation.patience:
65
+ deltas = [abs(recent[i].best - recent[i-1].best)
66
+ for i in range(1, len(recent))]
67
+ if all(d < config.stagnation.min_delta for d in deltas):
68
+ triggered.append("stagnation")
69
+
70
+ if config.entropy_floor.enabled and current_entropy < threshold:
71
+ triggered.append("entropy_floor")
72
+
73
+ if config.budget_tokens.enabled and total_tokens > config.budget_tokens.max:
74
+ triggered.append("budget_tokens")
75
+
76
+ if config.target_score.enabled and best_score >= config.target_score.value:
77
+ triggered.append("target_score")
78
+
79
+ return {"converged": len(triggered) > 0, "triggered_by": triggered}
80
+ ```
81
+
82
+ ## Entropy Calculation
83
+
84
+ Shannon entropy of normalized pheromone distribution:
85
+
86
+ ```
87
+ p_i = tau_i / sum(tau) for each active edge
88
+ H = -sum(p_i * log2(p_i))
89
+ ```
90
+
91
+ - High H → diverse exploration (early stage)
92
+ - Low H → concentrated on few paths (converging)
93
+ - H < threshold + best score plateau → safe to stop
94
+
95
+ ## Why Multi-Criterion
96
+
97
+ Single criterion is fragile:
98
+ - `max_iterations` alone wastes budget if converged early
99
+ - `stagnation` alone may stop too early on noisy scoring
100
+ - `entropy_floor` alone may trigger before useful solutions emerge
101
+
102
+ Combination = early termination when safe, but always bounded by `max_iterations`.
103
+
104
+ ## Anti-Patterns
105
+
106
+ - DO NOT use `stagnation` with `patience < 2` — noise will trigger false stops
107
+ - DO NOT disable `max_iterations` — runaway risk
108
+ - DO NOT set `target_score` without verified scoring — self_score is too optimistic
@@ -0,0 +1,125 @@
1
+
2
+
3
+ # Pheromone Schema
4
+
5
+ Pheromone matrix structure, update formula, evaporation rule. Authoritative spec for `pheromone/current.json` and history snapshots.
6
+
7
+ ## File Layout
8
+
9
+ ```
10
+ {run_dir}/work/team/pheromone/
11
+ ├── current.json # latest state, overwritten each iteration
12
+ ├── history/
13
+ │ ├── 1.json # snapshot after iteration 1
14
+ │ ├── 2.json
15
+ │ └── ...
16
+ └── init.json # snapshot of initial state (immutable)
17
+ ```
18
+
19
+ ## Schema (pheromone/current.json)
20
+
21
+ ```json
22
+ {
23
+ "version": "1.0",
24
+ "iteration": 3,
25
+ "n_nodes": 42,
26
+ "matrix_type": "edge_weighted_sparse",
27
+ "tau": {
28
+ "<node_a>::<node_b>": 0.85,
29
+ "<node_a>::<node_c>": 1.20,
30
+ "<node_x>::<node_y>": 0.13
31
+ },
32
+ "node_tau": {
33
+ "<node_a>": 0.92,
34
+ "<node_b>": 1.05
35
+ },
36
+ "metadata": {
37
+ "alpha": 1.0,
38
+ "beta": 2.0,
39
+ "rho": 0.2,
40
+ "q": 1.0,
41
+ "tau_init": 1.0,
42
+ "tau_min": 0.01,
43
+ "tau_max": 10.0
44
+ },
45
+ "stats": {
46
+ "mean": 0.91,
47
+ "max": 2.34,
48
+ "min": 0.05,
49
+ "entropy": 3.21,
50
+ "n_edges_active": 87
51
+ }
52
+ }
53
+ ```
54
+
55
+ ### Field Semantics
56
+
57
+ | Field | Type | Meaning |
58
+ |-------|------|---------|
59
+ | `matrix_type` | enum | `edge_weighted_sparse` (default), `node_weighted`, `full_dense` |
60
+ | `tau` | dict | Edge pheromone, key `"a::b"` (undirected uses lexical order) |
61
+ | `node_tau` | dict | Node-level pheromone (used when matrix_type = node_weighted) |
62
+ | `metadata.alpha` | float | Pheromone weight in selection probability |
63
+ | `metadata.beta` | float | Heuristic weight in selection probability |
64
+ | `metadata.rho` | float | Evaporation rate (0..1), applied each iteration |
65
+ | `metadata.q` | float | Deposit constant |
66
+ | `metadata.tau_min/max` | float | MMAS bounds — prevents premature convergence/explosion |
67
+ | `stats.entropy` | float | Shannon entropy of normalized tau — convergence signal |
68
+
69
+ ## Update Formula
70
+
71
+ After iteration k completes, for each ant a in iteration:
72
+
73
+ ```
74
+ delta_tau_a(edge) = q * verified_score_a if edge in path_a, else 0
75
+ ```
76
+
77
+ Then:
78
+
79
+ ```
80
+ tau(edge) = (1 - rho) * tau(edge) + sum_over_ants(delta_tau_a(edge))
81
+ tau(edge) = clip(tau(edge), tau_min, tau_max)
82
+ ```
83
+
84
+ **Elitist strategy** (always on): the best path of all time deposits extra `q * best_score` on its edges before clipping.
85
+
86
+ ## Selection Probability (used in `aco.py select`)
87
+
88
+ For ant at node i choosing neighbor j from candidate set N(i):
89
+
90
+ ```
91
+ p(i -> j) = (tau(i,j)^alpha * eta(i,j)^beta) / sum_{k in N(i)}(tau(i,k)^alpha * eta(i,k)^beta)
92
+ ```
93
+
94
+ where `eta` is a heuristic value from config (e.g., inverse-distance, prior knowledge). Default `eta = 1.0` if not provided.
95
+
96
+ ## Path-Hints vs Full-Path
97
+
98
+ `aco.py select` does NOT prescribe a complete path — it returns **path-hints**: weighted starting nodes + edge probabilities. The ant (LLM) then makes the actual node-by-node choices, with freedom to deviate based on its own evidence. This preserves LLM judgment while keeping search guided.
99
+
100
+ ```json
101
+ {
102
+ "ant_id": "ANT-3-2",
103
+ "start_node": "node_a",
104
+ "edge_preferences": {
105
+ "node_a::node_b": 0.45,
106
+ "node_a::node_c": 0.30,
107
+ "node_a::node_d": 0.25
108
+ },
109
+ "max_path_length": 5
110
+ }
111
+ ```
112
+
113
+ ## Initialization
114
+
115
+ ```
116
+ tau_init for all edges = config.aco.tau_init (default 1.0)
117
+ ```
118
+
119
+ If `task_space.nodes` is `auto_discover_from: <glob>`, init.py discovers nodes by globbing and initializes a full uniform matrix.
120
+
121
+ ## History & Reproducibility
122
+
123
+ - `init.json` — frozen snapshot of initial state (never overwritten)
124
+ - `history/k.json` — full pheromone state after iteration k (for convergence-curve analysis)
125
+ - All updates are deterministic given (prior state + ant artifacts + config)
@@ -0,0 +1,71 @@
1
+ {
2
+ "_comment": "User-facing config template. Coordinator generates this from task description in Phase 1. Fields prefixed with _ are documentation, omit from real config.",
3
+
4
+ "swarm": {
5
+ "_comment": "Top-level swarm parameters",
6
+ "n_ants": 5,
7
+ "max_iterations": 5,
8
+ "elite_keep": 3
9
+ },
10
+
11
+ "aco": {
12
+ "_comment": "ACO algorithm hyperparameters - defaults are sane",
13
+ "alpha": 1.0,
14
+ "beta": 2.0,
15
+ "rho": 0.2,
16
+ "q": 1.0,
17
+ "tau_init": 1.0,
18
+ "tau_min": 0.01,
19
+ "tau_max": 10.0
20
+ },
21
+
22
+ "task_space": {
23
+ "_comment": "Define the search space. Use EITHER 'nodes' (explicit) OR 'auto_discover_from' (glob).",
24
+ "type": "graph",
25
+ "nodes": ["node_a", "node_b", "node_c"],
26
+ "_alt_auto_discover": "auto_discover_from: 'src/**/*.ts'",
27
+ "max_path_length": 5,
28
+ "start_nodes": "any",
29
+ "edges": "complete"
30
+ },
31
+
32
+ "scoring": {
33
+ "_comment": "How verified_score is computed. mode = script | llm | fallback",
34
+ "mode": "fallback",
35
+ "_alt_script": "script_path: '../my-scoring-rule.py' (file must define def score(ant_artifact) -> float)",
36
+ "_alt_llm": "rubric: 'custom scoring rubric text for scorer role'",
37
+ "self_score_discount": 0.5
38
+ },
39
+
40
+ "ant_prompt": {
41
+ "_comment": "What the ant actually tries to achieve. This is the bridge between task semantics and ACO mechanics.",
42
+ "objective": "Find the file with the highest density of suspicious code patterns",
43
+ "evidence_requirements": [
44
+ "At least 1 file:line reference per node visited",
45
+ "Concrete code snippet showing the suspicious pattern"
46
+ ],
47
+ "tools_hint": "Use Grep + Read for code-based exploration"
48
+ },
49
+
50
+ "convergence": {
51
+ "_comment": "Stop conditions - any-of triggers convergence",
52
+ "max_iterations": 5,
53
+ "stagnation": {
54
+ "enabled": true,
55
+ "patience": 2,
56
+ "min_delta": 0.01
57
+ },
58
+ "entropy_floor": {
59
+ "enabled": true,
60
+ "threshold": 0.5
61
+ },
62
+ "budget_tokens": {
63
+ "enabled": false,
64
+ "max": 100000
65
+ },
66
+ "target_score": {
67
+ "enabled": true,
68
+ "value": 0.95
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,119 @@
1
+ # Swarm Protocol
2
+
3
+ Master protocol document for team-swarm: defines how the LLM coordinator and Python ACO controller interface, how ants explore the task space, and how exploration results flow back to update pheromone state.
4
+
5
+ ## Design Philosophy
6
+
7
+ | Principle | Rationale |
8
+ |-----------|-----------|
9
+ | **Outer loop = script, inner loop = LLM** | Optimization math is cheap and deterministic; LLM evaluation is expensive and noisy. Separate them. |
10
+ | **Coordinator is a hybrid** | LLM coordinator translates user intent + dispatches workers; Python script makes all numeric decisions (selection, update, convergence). |
11
+ | **Schema-locked ant output** | LLM output → algorithm input bridge demands strict JSON contract. Free-text outputs cannot feed pheromone updates. |
12
+ | **Two-layer scoring** | `self_score` (LLM self-report) is fast but optimistic. `verified_score` (script or LLM scorer) is the only authoritative input to pheromone update. |
13
+ | **Universal task space** | Coordinator does not bake in any domain. User provides `swarm-config.json` with task space + scoring rule. |
14
+
15
+ ## Three-Component Architecture
16
+
17
+ ```
18
+ +-----------------------------------------------------+
19
+ | LLM Coordinator (roles/coordinator/role.md) |
20
+ | - Parses user task → emits swarm-config.json |
21
+ | - Phase 3 main loop: calls script, dispatches |
22
+ | - Translates worker results back into script ops |
23
+ +--------+--------------------------------------------+
24
+ | CLI subprocess (run_command / Bash)
25
+ v
26
+ +-----------------------------------------------------+
27
+ | Python ACO Controller (scripts/aco.py) |
28
+ | - CLI subcommands: init/select/update/converged |
29
+ | - Owns pheromone matrix + elite tracker |
30
+ | - Pure functions of session state files |
31
+ +-----------------------------------------------------+
32
+ ^ |
33
+ | reads {run_dir}/outputs/ant-*.json | writes pheromone/*.json
34
+ | v
35
+ +-----------------------------------------------------+
36
+ | LLM Workers (team-worker agents) |
37
+ | - ant: explores assigned path, writes JSON |
38
+ | - scorer: assigns verified_score (optional) |
39
+ | - analyst: final synthesis of elite solutions |
40
+ +-----------------------------------------------------+
41
+ ```
42
+
43
+ ## Iteration Lifecycle
44
+
45
+ ```
46
+ [Coordinator] init phase
47
+ └─> python aco.py --session {run_dir}/work/team --run-dir <run_dir> init
48
+ └─> writes pheromone/current.json + task-space.json
49
+
50
+ [Coordinator] iteration k (k = 1..K):
51
+ ├─> python aco.py --session {run_dir}/work/team --run-dir <run_dir> select --iter k
52
+ │ └─> returns N ant assignments (paths to explore)
53
+ ├─> register N ant assignments in Evolve roster
54
+ ├─> dispatch N × ant workers in parallel and wait/join
55
+ └─> advance when all N ants report
56
+
57
+ [Callback] all ants done → handleIterationComplete
58
+ ├─> (optional) dispatch scorer worker → verified_scores.json
59
+ ├─> python aco.py --session {run_dir}/work/team --run-dir <run_dir> update --iter k
60
+ │ └─> reads {run_dir}/outputs/ant-k-*.json + verified_scores
61
+ │ └─> updates pheromone + elite + history
62
+ ├─> python aco.py --session {run_dir}/work/team --run-dir <run_dir> converged
63
+ │ └─> {converged: true|false, reason: ...}
64
+ └─> converged → Phase 4; else → iteration k+1
65
+
66
+ [Coordinator] Phase 4: converge
67
+ ├─> python aco.py --session {run_dir}/work/team --run-dir <run_dir> report → stdout JSON saved as outputs/swarm-report.json
68
+ ├─> dispatch analyst worker → best-solution.md
69
+ └─> completion action (Archive/Keep/Export)
70
+ ```
71
+
72
+ ## Script ↔ Coordinator Contract
73
+
74
+ All scripts MUST:
75
+ - Read from `{run_dir}/work/team/...` (session path passed via `--session` flag)
76
+ - Write JSON to stdout for coordinator parsing (no prose)
77
+ - Use exit code 0 = success, 1 = error, 2 = config invalid
78
+ - Commit each update with its input digest before writing the derived pheromone, best result, history and trails. Replaying the same iteration with identical inputs returns the stored result. A changed replay fails. The next controller invocation restores an interrupted projection from the committed receipt.
79
+
80
+ | Subcommand | Input | Output (stdout JSON) | Side effects |
81
+ |------------|-------|---------------------|--------------|
82
+ | `init` | swarm-config.json | `{status, pheromone_path, n_nodes}` | writes pheromone/current.json, task-space.json |
83
+ | `select --iter k` | pheromone/current.json, swarm-config.json | `{iteration, assignments: [{ant_id, start_node, ...}]}` | saves `assignments/k.json` for a Run |
84
+ | `update --iter k` | {run_dir}/outputs/ant-k-*.json, saved assignment batch when available, `scores/iter-k-scores.json` in LLM mode | `{iteration, mean_score, best_score, delta, elite_updated}` | commits an iteration receipt and projects state, history, trails and best solution |
85
+ | `converged` | history/, best.json, config | `{converged: bool, reason: str, metrics: {...}}` | none |
86
+ | `report` | best.json, history/ | full JSON: `{_meta: {kind: swarm-report, schema: swarm-report/1.0, role: attachment}, best, top_k, convergence_curve, ...}` | none |
87
+
88
+ Run-scoped `select` saves `assignments/k.json` and returns the same batch on replay. An LLM score file covers the accepted artifacts for the same iteration. `update --allow-score-fallback` uses discounted self-scores for the entire LLM iteration. The fallback choice is part of the replay inputs.
89
+
90
+ ## Data Flow Boundaries
91
+
92
+ | Boundary | Owner | Format |
93
+ |----------|-------|--------|
94
+ | User intent → config | LLM coordinator | swarm-config.json |
95
+ | Pheromone state | Python script | pheromone/current.json |
96
+ | Ant assignment → ant prompt | LLM coordinator (templated) | injected into role-spec at spawn |
97
+ | Ant exploration → artifact | LLM ant | {run_dir}/outputs/ant-k-id.json (schema-locked) |
98
+ | Artifact → pheromone update | Python script | reads artifacts, computes delta tau |
99
+ | Elite solutions → human report | LLM analyst | {run_dir}/outputs/best-solution.md |
100
+
101
+ ## Why Hybrid Coordinator (Not Pure Script)
102
+
103
+ - User input is natural language → needs LLM to map to swarm-config
104
+ - Worker spawning, message routing, session management → all framework-bound to LLM coordinator
105
+ - Script as a sub-tool keeps the same team-* lifecycle (spawn-and-stop, callback-driven)
106
+ - Same pattern as `evolve delegate` — Bash-callable subprocess from inside an LLM role
107
+
108
+ ## Universality
109
+
110
+ `team-swarm` is task-agnostic. Specialization happens via:
111
+ 1. `swarm-config.json#task_space` — defines what nodes/edges/paths mean
112
+ 2. `swarm-config.json#scoring` — defines how to compute verified_score
113
+ 3. `swarm-config.json#ant_prompt` — defines what ant should actually do at each node
114
+
115
+ Example domains the same skill handles:
116
+ - Code exploration (nodes = files/modules, score = suspicious code density)
117
+ - Test case generation (nodes = code paths, score = coverage delta)
118
+ - Refactor strategy search (nodes = refactor moves, score = complexity reduction)
119
+ - Hyperparameter tuning (nodes = param choices, score = metric improvement)
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: workflow-evolve
3
+ description: Analyze a Skill execution history, run a real Codex plus Agent Memory regression, and iteratively improve the Skill through an Agy-confirmed replay loop.
4
+ argument-hint: <skill-entry> --iterations <n> --scenarios <file> [--session <id>|--execution <id>] [--auto]
5
+ session-mode: run
6
+ required_links:
7
+ - references/auto-loop.md
8
+ contract:
9
+ contract_version: 2.1
10
+ consumes: []
11
+ produces:
12
+ - path: outputs/evolution-report.json
13
+ kind: workflow-evolution-report
14
+ schema: workflow-evolution/1.0
15
+ role: primary
16
+ alias: latest-workflow-evolution
17
+ required: true
18
+ gates:
19
+ entry:
20
+ - explicit iteration count is a positive integer
21
+ - target Skill package is committed and replayable
22
+ exit:
23
+ - every applied round has an Agy confirmation receipt
24
+ - baseline and candidate scenarios pass
25
+ - failed applications are rolled back
26
+ version: 0.3.0
27
+ ---
28
+
29
+ # Workflow Evolution
30
+
31
+ Use this Skill for single-evidence behavioral fixes grounded in a completed Session/Run or standalone execution (new Skills or contract/multi-file restructuring route to `ew-skill-design` instead). `--iterations <n>` is required; `--auto` enables unattended `apply` and rollback after the Agy confirmation gate.
32
+
33
+ - Read [the automatic loop](references/auto-loop.md) for argument parsing, state, retries, and stop conditions.
34
+ - Read [history review](references/history-review.md) when reconstructing execution evidence or building a transcript fixture.
35
+ - Read [the Agy gate](references/agy-gate.md) when preparing or validating Agy discussion and confirmation payloads.
36
+
37
+ ## Entry Contract
38
+
39
+ ```text
40
+ workflow-evolve <skill-entry>
41
+ --iterations <positive integer>
42
+ --scenarios <JSON file with >=1 baseline failure and >=1 baseline pass>
43
+ [--runner <replay runner>]
44
+ --session <Session ID> | --execution <Skill execution ID> | --history <JSON transcript>
45
+ [--project <project ID>] [--max-retries <n>] [--auto]
46
+ ```
47
+
48
+ - **Default runner**: `scripts/codex-memory-replay.mjs` (runs `codex exec` read-only against the target Git commit and returns loaded document hashes + `knowledge-reads/1.0`). Set `AGENT_MEMORY_DB` to an absolute path when replay should query existing memories.
49
+ - **Clean commit required**: Commit target Skill changes before replay (`evolve skills replay` creates isolated worktrees under `<git-dir>/evolve-replay/`).
50
+ - **Agy receipts**: Preserve both discussion and confirmation JSON per round; apply only when `approved: true`.
51
+
52
+ ## Automatic Invocation
53
+
54
+ ```powershell
55
+ # PowerShell (use `\` line continuation on POSIX shells)
56
+ node skills/workflow-evolve/scripts/evolve-loop.mjs `
57
+ --skill skills/workflow-evolve/SKILL.md `
58
+ --iterations 3 `
59
+ --scenarios .agent-memory/evolution/scenarios.json `
60
+ --session <session-id> `
61
+ --auto
62
+ ```
63
+
64
+ Writes round state under `.agent-memory/evolution/<timestamp>/` (and `outputs/evolution-report.json` when `--run-dir <run_dir>` is passed).
@@ -0,0 +1,27 @@
1
+ # Agy gate
2
+
3
+ Every round has two Agy calls.
4
+
5
+ ## Discussion response
6
+
7
+ The first call receives the baseline observations and history review. It must return JSON with this shape.
8
+
9
+ ```json
10
+ {
11
+ "approved": true,
12
+ "priority": "high|normal|low",
13
+ "instruction": "one concise Skill instruction",
14
+ "when": "optional trigger for normal or low priority guidance",
15
+ "evidence": ["receipt or verification reference"],
16
+ "rationale": "why the change is attributable and minimal",
17
+ "needs_revision": []
18
+ }
19
+ ```
20
+
21
+ `approved` means the suggestion is ready to turn into a draft. Agy must set it to `false` when the evidence is missing, the change is broader than the observed failure, or the request needs a new Skill contract. Contract changes route to `ew-skill-design` after the loop.
22
+
23
+ ## Confirmation response
24
+
25
+ The second call receives the draft and the complete replay receipt. It must return `approved`, `reason` and `required_changes`. It approves only when every baseline pass remains green, every requested failure is fixed, the candidate loaded the expected Skill documents, and the evidence is traceable to the reviewed execution.
26
+
27
+ The loop stores both responses under the round directory. `--auto` applies a receipt after this second call returns `approved: true`. Agy owns the evaluation decision for each proposed change.
@@ -0,0 +1,23 @@
1
+ # Automatic Loop
2
+
3
+ The loop orchestrates four steps per round: baseline/candidate runner execution, history review, Agy discussion/confirmation, and isolated Git worktree replay.
4
+
5
+ ## Round Order
6
+
7
+ 1. **Preflight**: Read `HEAD` and verify the target Skill package has no uncommitted changes.
8
+ 2. **Baseline**: Run all scenarios against the current Skill (must include >= 1 failing case and >= 1 passing case).
9
+ 3. **History review**:
10
+ - In Evolve Runs/Sessions, `evolve-loop.mjs` invokes `node dist/cli.js session review <id>` (or `evolve session review <id>`).
11
+ - For standalone executions without a Session, pass `--execution <id> --project <id>` or `--history <transcript-evidence/1.0 JSON>`.
12
+ - Record returned signals, Skill reference, Skill reads, and `knowledge_reads` in the round directory.
13
+ 4. **Draft via Agy**: Request one minimal, evidence-linked change (`approved`, `priority`, `instruction`, `when`, `evidence`, `needs_revision`). Reject drafts lacking a traceable source or altering unrelated behavior; retry up to `--max-retries`.
14
+ 5. **Replay**: Create the draft and replay it against the accumulated scenarios (`evolve skills draft` / `evolve skills replay`, or `dist/cli.js evolve draft` / `replay` inside `evolve-loop.mjs`). All baseline passes must stay green and baseline failures must pass.
15
+ 6. **Confirm via Agy**: Submit draft ID, candidate commit, scenario results, and loaded Skill documents. `approved: false` halts without applying.
16
+ 7. **Apply & Verify**: With `--auto`, apply the confirmed receipt and re-run scenarios on the applied commit; on any failure, immediately `rollback` and record the failure. Without `--auto`, leave the confirmed receipt pending.
17
+ 8. **Persist & Loop**: Save round state and continue until `--iterations` completes or a stop condition triggers.
18
+
19
+ ## State and Stop Conditions
20
+
21
+ - `state.json` is the single machine state source per run (`base`, `draft`, `replay`, `history`, Agy responses, apply status, verification results).
22
+ - Terminal statuses: `completed`, `agy_rejected`, `confirmation_rejected`, `rolled_back`, or `failed` (keeps round directory for recovery).
23
+ - History evidence is mandatory (`--allow-empty-history` is reserved for explicitly history-free test fixtures and recorded in `state.json`).