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,21 @@
1
+ # Pre-flight: ew-verify
2
+
3
+ Confirm verification sources, Knowledge Gate constraints, and the Iron Law before executing [workflow](workflow.md).
4
+
5
+ ## Input & Flags
6
+
7
+ - **Bound sources (required)**: `current-plan` (criteria contract; for `pi-markdown` plans preserve every prose criterion without requiring `task_ids`) and `current-execution` (changed files & self-check claims).
8
+ - **`--strict`**: elevate bar so any `UNCERTAIN` item blocks pass and all error/boundary paths must carry explicit proof.
9
+ - **`--skip-tests`**: skip automated test coverage matrix and perform goal-backward structural + wiring verification only.
10
+ - **`--skip-antipattern`**: omit static anti-pattern scanning.
11
+
12
+ ## Knowledge Gate
13
+
14
+ Reuse bound `session-priors` (`review`/`coding`); query `wiki_context` + `wiki_reference` (or CLI `--reads` + `--from-search`) when verifying files or tech-stack constraints outside `session-priors`.
15
+
16
+ ## Iron Law & Boundaries
17
+
18
+ - **Read-only on repository source**: never edit production code or relax assertions to turn failures green; fixing gaps belongs to `ew-plan --gaps` -> `ew-execute`.
19
+ - **No claim without live evidence**: follow `IDENTIFY -> EVIDENCE (fresh run or still-valid uninvalidated run on the exact revision) -> READ (full output + exit code + failure count) -> VERIFY -> conclude`. Execution self-check claims alone are supporting hints, never final verification proof.
20
+ - **No silent omissions**: every requirement and criterion must resolve to `VERIFIED`, `FAILED`, or `UNCERTAIN` with explicit `file:line` or command evidence.
21
+ - **Exit gates**: `goal-backward-verified` (Truths, Artifacts L1/L2/L3, and Key Links verified) and `nyquist-covered` (automated test / check proof complete or explicitly `--skip-tests`).
@@ -0,0 +1,29 @@
1
+ # Workflow: ew-verify
2
+
3
+ Independent goal-backward verification: `Constraint Pre-check -> Must-Haves Breakdown (Truths / Artifacts / Key Links) -> Anti-Pattern & Regression Coverage -> Seal`.
4
+
5
+ ## Step 1: Load Artifacts & Constraint Pre-check
6
+
7
+ 1. Read bound `current-plan` and `current-execution` (`read_artifact` / `evolve run artifact-read`). Complete the Knowledge Gate for applicable coding/review constraints.
8
+ 2. Check changed files against any active Wiki tech-stack constraints (`allowed_libs`, `disallowed_imports`, `required_patterns`). Record violations as `CV-N` (`disallowed_import`, `unlisted_dependency`, `missing_required_pattern`).
9
+
10
+ ## Step 2: Goal-Backward Structural Verification (`goal-backward-verified` gate)
11
+
12
+ Normalize every criterion from `current-plan` (plus any UAT human gaps) into three verification layers:
13
+ 1. **Truths** (observable behaviors): locate implementation + wiring, mark `VERIFIED`, `FAILED`, or `UNCERTAIN` (`--strict` rejects `UNCERTAIN`).
14
+ 2. **Artifacts** (on-disk modules & deliverables): inspect across 3 levels:
15
+ - `L1 Existence`: file exists (`MISSING` on fail)
16
+ - `L2 Substance`: real implementation rather than stub/placeholder/`TODO: implement` (`STUB` on fail)
17
+ - `L3 Wiring`: imported and invoked by callers via `evolve code callers` / ripgrep (`ORPHANED` on fail)
18
+ 3. **Key Links**: verify live wiring for critical boundaries (`Component -> API`, `API -> DB`, `Form -> Handler`, `State -> Render`, `Event -> Handler`) with `file:line` proof (`WIRED` / `PARTIAL` / `NOT_WIRED`).
19
+
20
+ ## Step 3: Anti-Pattern & Test Coverage (`nyquist-covered` gate)
21
+
22
+ 1. **Anti-pattern scan** (unless `--skip-antipattern`): scan changed files for `TODO`/`FIXME`/`HACK`, stub returns, skipped/disabled tests (`skip`/`@ts-ignore`/`as any`), and dead imports -> write `outputs/antipattern-report.json`.
23
+ 2. **Narrowest live verification** (unless `--skip-tests`): execute the targeted test/typecheck/build commands covering modified modules and their direct importers, recording exact commands, exit codes, and pass/fail counts -> write `outputs/requirement-coverage.json`.
24
+
25
+ ## Step 4: Write `outputs/verification.json` & Seal
26
+
27
+ 1. Write `{run_dir}/outputs/verification.json` (`verification/1.0`: `status: passed|gaps_found|blocked`, `truths[]`, `artifacts[]`, `key_links[]`, `constraint_violations[]`, `gaps[]` (`GAP-N` with `severity` and `fix_direction`), `commands_run[]`).
28
+ 2. Write `{run_dir}/report.md` (`next` routing to `ew-test` when passed, or `ew-plan --gaps` / `ew-debug` when gaps remain).
29
+ 3. Seal via fenced `evolve run complete <run_id> --session <session> --actor <actor> --expected-orchestration-revision <rev> --expected-run-revision <rev> --gate goal-backward-verified --gate nyquist-covered --summary "<summary>" --verdict done|done_with_concerns`. Stage reusable verification lessons afterward through `ew-knowledge`.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: ew-skill-design
3
+ disable-model-invocation: true
4
+ description: Design, migrate, or validate an Evolve project Skill with linked Markdown, a Session/Run contract where needed, and reproducible host cases.
5
+ session-mode: none
6
+ version: 0.6.0
7
+ ---
8
+
9
+ # Evolve Skill Design
10
+
11
+ Use this Skill when `evolve closeout` / knowledge routing classifies a structural or multi-file candidate as `skill-design`, or when authoring/migrating `skills/<id>/SKILL.md`. Single-evidence behavioral fixes route to `workflow-evolve` instead.
12
+
13
+ ## Workflow
14
+
15
+ 1. **Resolve context & lifecycle**:
16
+ - Run the project Knowledge Gate (`evolve context` / `node dist/workflow-cli.js context`).
17
+ - Inventory existing entry points, flags, inputs, outputs, and recovery paths when migrating a Skill.
18
+ - Choose `session-mode: run` when durable progression, coordinator decisions, or artifact handoff is needed; otherwise use `session-mode: none`.
19
+ 2. **Enforce Progressive Disclosure (`SKILL.md` vs `references/`)**:
20
+ - Keep `SKILL.md` focused on: frontmatter (`name`, `description`, `session-mode`, `contract`, `required_links`), trigger/routing table, non-negotiable invariants, and short common steps.
21
+ - Move mode details, schemas, checklists, and examples into package-relative `.md` links (see [the package contract guide](references/package-contract.md)). Never use cross-package `../` links.
22
+ - Keep every entry in `required_links` minimal and literally linked in `SKILL.md`.
23
+ 3. **Validate & verify**:
24
+ - Follow [the replay and release procedure](references/validation.md) to validate the committed Git revision and exercise the main flow, one passing case, and affected recovery paths.
25
+
26
+ ## Evolve design-task handoff
27
+
28
+ - When entered from `evolve closeout route`, inspect the task with `evolve skill-design task <task-id>` and run `evolve skill-design run <task-id>` (or `node dist/workflow-cli.js` in this checkout).
29
+ - Return a `skill-design/1.0` envelope (`task_id` + replayable `draft` naming the target entry, evidence sources, baseline hash, priority, and conditional links).
30
+ - Do not edit the target Skill during draft generation; the caller runs `evolve skill-design review <design-id>`, `replay`, and `apply`.
@@ -0,0 +1,40 @@
1
+ # Project Skill Package Contract
2
+
3
+ ## Frontmatter & Links
4
+
5
+ - **`name`**: Must match the package directory name (except `ew-odyssey-*`, where `name` is `ew-odyssey` and `src/workflow-skills.ts` binds per-mode `contract` and `required_links` from `references/prepare/odyssey-<mode>.md`).
6
+ - **`description`**: State exact invocation triggers and boundaries.
7
+ - **`session-mode`**: `none` for standalone Skills; `run` for stateful Skills with `contract` (`contract_version: 2.1`).
8
+ - **`required_links`**:
9
+ - Include ONLY documents that every invocation must preload. Keep conditional/mode guides as standard body links without putting them in `required_links`.
10
+ - Every item in `required_links` MUST appear as a literal relative Markdown link inside `SKILL.md` (for `ew-odyssey-*`, inside `ew-odyssey/SKILL.md`), resolve to a committed regular `.md` file inside the same package (no `..` segments), and any `#heading` fragment must match an actual heading.
11
+ - **Host portability**: Avoid hardcoding host-specific tool names (`Bash`, `AskUserQuestion`, `spawn_agent`, etc.) in shared rules; describe capabilities neutrally or isolate host mappings in a dedicated adapter reference.
12
+
13
+ ## Session/Run Contract (`contract_version: 2.1`)
14
+
15
+ ```yaml
16
+ session-mode: run
17
+ required_links:
18
+ - references/check.md
19
+ contract:
20
+ contract_version: 2.1
21
+ consumes:
22
+ - kind: findings
23
+ alias: current-analysis
24
+ schema: findings/1.0
25
+ role: primary
26
+ required: true
27
+ produces:
28
+ - path: outputs/verification.json
29
+ kind: verification
30
+ schema: verification/1.0
31
+ role: primary
32
+ alias: latest-verification
33
+ required: true
34
+ ```
35
+
36
+ ## Output & Boundary Rules
37
+
38
+ - Put all typed outputs under the Run's `outputs/` directory with matching `_meta` / frontmatter (`kind`, `schema`, `role`, optional `alias`).
39
+ - Use `report.md` for execution narrative and `evidence/` for verification traces; keep scratch files outside `outputs/`.
40
+ - Define observable pass conditions, blocked states, and next authorized actions at each phase boundary. The coordinator drives progression via Session/Run commands and receipts.
@@ -0,0 +1,21 @@
1
+ # Validate and Release a Project Skill
2
+
3
+ ## Static & Contract Validation
4
+
5
+ - Run `evolve skills validate <id> --root <repo>` (or `node dist/workflow-cli.js skills validate <id>` in this checkout).
6
+ - Note that Evolve binds the **committed Git revision (`HEAD^{commit}`)** — working-tree edits are ignored until committed (use a test commit in an isolated worktree to test unpublished changes).
7
+ - Fix any broken link, cross-package `..` path, unsupported lifecycle, or output schema mismatch at the source.
8
+
9
+ ## Runtime & Replay Verification
10
+
11
+ - **Stateful Skills (`session-mode: run`)**:
12
+ - Verify a fresh Run binds the expected commit and `contract`.
13
+ - Read `SKILL.md` and exercised links via `evolve run skill-read`, confirm input aliases and output schemas, and run `evolve run check` before `evolve run complete`.
14
+ - When migrating existing guidance, also resume a Run bound to the prior commit and replay one historically successful case.
15
+ - **Standalone Skills (`session-mode: none`)**:
16
+ - Verify the actual host entry, expected outputs, and completion receipt.
17
+
18
+ ## Routing: `ew-skill-design` vs `workflow-evolve`
19
+
20
+ - Use **`workflow-evolve`** for single-evidence behavioral fixes (short inline addition <= 280 chars, conditional link, or `references/learnings/` entry) via `evolve session review <session-id>` -> `draft` -> `replay` -> `apply` / `rollback`.
21
+ - Use **`ew-skill-design`** for new Skills, multi-file restructuring, or `contract` / lifecycle changes.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: team-swarm
3
+ disable-model-invocation: true
4
+ description: Swarm intelligence team skill — ACO-driven multi-agent exploration with hybrid LLM coordinator and Python optimization controller. Coordinator translates the task into swarm-config.json and runs K iterations of N parallel ants guided by pheromone state. Triggers on "team swarm", "swarm intelligence", "蚁群".
5
+ session-mode: run
6
+ required_links:
7
+ - references/mcp-coordination.md
8
+ contract:
9
+ contract_version: 2.1
10
+ consumes: []
11
+ produces:
12
+ - path: outputs/best-solution.md
13
+ kind: swarm-best-solution
14
+ schema: swarm-best-solution/1.0
15
+ role: primary
16
+ required: true
17
+ - path: outputs/swarm-report.json
18
+ kind: swarm-report
19
+ schema: swarm-report/1.0
20
+ role: attachment
21
+ required: true
22
+ - path: outputs/ant-{iteration}-{ant_id}.json
23
+ kind: swarm-ant-result
24
+ schema: swarm-ant-result/1.0
25
+ role: evidence
26
+ required: false
27
+ gates:
28
+ entry: []
29
+ exit: []
30
+ version: 0.6.0
31
+ ---
32
+
33
+ # Team Swarm
34
+
35
+ Orchestrate ant-colony-style exploration over a user-defined task space (`swarm-config.json`). **Hybrid model**: LLM handles task translation, worker dispatch, and synthesis; Python (`scripts/aco.py`) owns all numeric decisions (selection, pheromone update, convergence).
36
+
37
+ ## Role Router
38
+
39
+ - **No `--role` flag** -> Load [roles/coordinator/role.md](roles/coordinator/role.md) and execute Phase 0–4.
40
+ - **`--role <name>`** -> Load the assigned role only:
41
+ - `ant` -> [roles/ant/role.md](roles/ant/role.md) (`ANT-*`)
42
+ - `scorer` -> [roles/scorer/role.md](roles/scorer/role.md) (`SCORE-*`)
43
+ - `analyst` -> [roles/analyst/role.md](roles/analyst/role.md) (`ANALYST-*`)
44
+
45
+ ## Shared Constants & Host Mapping
46
+
47
+ - **Coordination state**: `{run_dir}/work/team/` (never register as formal Run outputs).
48
+ - **Formal outputs**: `{run_dir}/outputs/` (`ant-<iter>-<id>.json`, `swarm-report.json`, `best-solution.md`).
49
+ - **Controller CLI**: `<skill_root>/scripts/aco.py` (Python 3.10+). For version-bound Runs, run `evolve team controller` / `evolve run skill-read` to materialize scripts from the pinned commit.
50
+ - **Roster**: `evolve team list --session <session> --run <run>`. Always read [MCP coordination](references/mcp-coordination.md) before dispatching or reporting assignments.
51
+ - **Host dispatch**: Use the host's parallel subagent mechanism (`invoke_subagent` or `swarm` in Antigravity, joining/closing all spawned workers before finishing; `spawn_agent` + `wait_agent` in Codex) and structured user prompt (`ask_question` in Antigravity; `request_user_input` in Codex).
52
+
53
+ ## User Commands
54
+
55
+ | Command | Action |
56
+ |---------|--------|
57
+ | `check` / `status` | View iteration progress and convergence curve |
58
+ | `resume` / `continue` | Resume interrupted iteration (Phase 0) |
59
+ | `feedback <text>` | Append to `work/team/wisdom/learnings.md` for next iteration |
60
+ | `revise <ITER>` | Re-run a specific iteration |
61
+
62
+ ## References
63
+
64
+ - [specs/swarm-protocol.md](specs/swarm-protocol.md) — Master architecture, script <-> coordinator interface, lifecycle
65
+ - [specs/pheromone-schema.md](specs/pheromone-schema.md) — Pheromone JSON structure, update formula, evaporation
66
+ - [specs/ant-output-schema.md](specs/ant-output-schema.md) — Ant & scorer JSON contracts
67
+ - [specs/convergence-criteria.md](specs/convergence-criteria.md) — Stop conditions and multi-criterion logic
68
+ - `specs/swarm-config-template.json` — Config template (`scripts/aco.py`, `scripts/pheromone.py`, `scripts/scoring.py`)
@@ -0,0 +1,14 @@
1
+ # Evolve Swarm Coordination
2
+
3
+ Use the exact `session` and `run` returned by Evolve. The Evolve database holds the roster and result receipts; Python owns ACO assignments, history, pheromone updates, and convergence under `{run_dir}/work/team/`.
4
+
5
+ 1. **Materialize & initialize**: Call `evolve team controller --session <session> --run <run>` to materialize the committed Python scripts. Prepare `swarm-config.json` in `work/team`, run `aco.py init`, then run `aco.py select --iter <k>` and retain the assigned ant IDs, start nodes, and preferences.
6
+ 2. **Assign & dispatch**: Register each assignment with:
7
+ `evolve team assign --session <session> --run <run> --id <assignment-id> --role <worker-id> --path outputs/ant-<iteration>-<id>.json --actor <coordinator> --expected-orchestration-revision <revision>`
8
+ Dispatch host workers with their assignment, role document, work boundary, and Run MCP connection (if supported by the host), and join/wait for all dispatched workers.
9
+ 3. **Worker reporting**: Each worker reads its role from the bound revision, writes and validates its JSON, then runs:
10
+ `evolve team report --session <session> --run <run> --id <assignment-id> --actor <worker-id> --summary "<result>" --expected-orchestration-revision <revision>`
11
+ On a revision conflict, fetch the current revision and replay with a new request ID. Retrying an uncertain response reuses the original request ID and payload.
12
+ 4. **Verify & score**: Check `evolve team list --session <session> --run <run>` against the controller batch. For LLM scoring, register a scorer against `work/team/scores/`, dispatch and wait for it, then run `aco.py update`. If accepting ACO score fallback, cancel the failed scorer via `evolve team cancel` (with assignment ID, current revision, and reason) before passing `--allow-score-fallback`.
13
+ 5. **Resume**: Use `evolve run brief` together with saved `team-session.json`, controller assignments, and roster. Reuse completed jobs, retry unfinished assignments under original IDs, and re-run `aco.py select --iter <k>` for the persisted batch.
14
+ 6. **Seal & harvest**: Run `aco.py converged` and `aco.py report`, synthesize declared artifacts, then seal via the Evolve controller guide (`evolve workflows show session-run` / `skills/ew-orchestrate/references/orchestrator-run-loop.md`) and harvest reusable findings via `ew-knowledge` (`evolve workflows show knowledge` / `skills/ew-knowledge/SKILL.md`).
@@ -0,0 +1,181 @@
1
+ ---
2
+ role: analyst
3
+ prefix: ANALYST
4
+ inner_loop: false
5
+ output_tag: "[analyst]"
6
+ message_types:
7
+ ---
8
+
9
+ # Analyst Role — Phase 2-4
10
+
11
+ ## Boundaries
12
+
13
+ ### MUST
14
+ - Read `{run_dir}/work/team/best.json`, `{run_dir}/outputs/swarm-report.json`, all `{run_dir}/work/team/trails/*.jsonl`
15
+ - Produce `{run_dir}/outputs/best-solution.md` as the final deliverable
16
+ - Explain WHY the best path won (which decisions mattered, evidence chain)
17
+ - Compare best vs runner-ups to surface stability vs luck
18
+ - Document convergence story (entropy curve, when stagnation hit)
19
+
20
+ ### MUST NOT
21
+ - Re-score solutions (that is scorer's job — analyst takes verified_score as given)
22
+ - Modify best.json, trails, or pheromone state
23
+ - Generate solutions of its own — analyst synthesizes existing ant outputs
24
+ - Pad best-solution.md with prose — every section must earn its place
25
+
26
+ ## Phase 2: Context Loading
27
+
28
+ | Input | Source | Required |
29
+ |-------|--------|----------|
30
+ | Original objective | `{run_dir}/work/team/swarm-config.json#ant_prompt.objective` | Yes |
31
+ | Best solution | `{run_dir}/work/team/best.json` | Yes |
32
+ | Full swarm report | `{run_dir}/outputs/swarm-report.json` | Yes |
33
+ | All trails | `{run_dir}/work/team/trails/*.jsonl` | Yes |
34
+ | Convergence reason | swarm-report.json or `aco.py converged` output | Yes |
35
+ | Best ant artifact | `{run_dir}/outputs/ant-<best.iteration>-<best.id>.json` (full evidence) | Yes |
36
+ | Issues log | `{run_dir}/work/team/wisdom/issues.md` | Optional |
37
+
38
+ Workflow:
39
+ 1. Extract session path from task description
40
+ 2. Read swarm-config.json -> capture objective
41
+ 3. Read best.json -> identify best ant
42
+ 4. Read full swarm-report.json -> get top_k + convergence_curve
43
+ 5. Read the best ant's full artifact for evidence chain
44
+ 6. Read all trails/*.jsonl into a list (chronological)
45
+
46
+ ## Phase 3: Synthesis
47
+
48
+ ### 3.1 Structure the report
49
+
50
+ Layout for `best-solution.md` (the frontmatter is required by the Run output contract; keep it at byte 0):
51
+
52
+ ```markdown
53
+ ---
54
+ kind: swarm-best-solution
55
+ schema: swarm-best-solution/1.0
56
+ role: primary
57
+ ---
58
+ # Swarm Result — <objective_short_form>
59
+
60
+ ## Best Solution
61
+
62
+ **Path**: node_a → node_c → node_f
63
+ **Verified Score**: 0.82
64
+ **Iteration**: 3 of 5
65
+ **Ant**: ANT-3-2
66
+
67
+ ### Summary
68
+ <one paragraph — what the best solution proposes and why it answers the objective>
69
+
70
+ ### Evidence Chain
71
+ - `src/foo.ts:42` — <how this evidence supports the decision>
72
+ - `tests/foo.spec.ts:18` — <...>
73
+
74
+ ### Candidate Artifact
75
+ <extract from best.candidate_solution — quote or summarize, link to file if file_ref>
76
+
77
+ ## Why This Path Won
78
+
79
+ | Decision | Pheromone-guided? | Why it mattered |
80
+ |----------|-------------------|-----------------|
81
+ | start = node_a | weighted | <reason> |
82
+ | a → c | yes (0.45 hint) | <reason> |
83
+ | c → f | NO (deviation) | <reason> — this was the key call |
84
+
85
+ ## Runner-Up Solutions
86
+
87
+ | Rank | Ant | Path | Score | Diff from best |
88
+ |------|-----|------|-------|----------------|
89
+ | 2 | ANT-2-1 | a → b → e | 0.74 | -0.08; weaker evidence at e |
90
+ | 3 | ANT-4-3 | a → c → g | 0.71 | -0.11; valid but less specific |
91
+
92
+ ## Convergence Story
93
+
94
+ Iterations: 4 of 5 max
95
+ Trigger: stagnation (best unchanged for 2 iterations)
96
+
97
+ Entropy curve:
98
+ - iter 1: 3.21 (broad exploration)
99
+ - iter 2: 2.45 (narrowing on node_a region)
100
+ - iter 3: 1.85 (best emerges at ANT-3-2)
101
+ - iter 4: 1.72 (consensus around best, no improvement)
102
+
103
+ Interpretation: <2-3 sentences on whether the swarm converged on a genuine optimum or got stuck>
104
+
105
+ ## Caveats
106
+
107
+ - <e.g., 40% of ants in iter 2 flagged as hallucinations>
108
+ - <e.g., evidence for node_f is single-source — recommend manual verification>
109
+ - <e.g., search space had only N nodes — larger space may surface better solutions>
110
+
111
+ ## Reproducibility
112
+
113
+ - Config: `swarm-config.json` (pinned)
114
+ - Best path: `best.json`
115
+ - Full trails: `trails/<iter>.jsonl`
116
+ - Random seed: <if used>
117
+ ```
118
+
119
+ ### 3.2 Interpretation rules
120
+
121
+ - **Why-it-won analysis** is the highest-value content. Don't just describe the path — explain which decisions were pivotal.
122
+ - **Pheromone vs deviation**: track which steps followed pheromone hints vs deviated. Deviations that produced higher scores are the most interesting signal.
123
+ - **Runner-up diff**: surface why #2 lost — was it a weaker path or just unlucky evidence?
124
+ - **Caveats are mandatory**: every swarm result has limitations. List them honestly.
125
+
126
+ ### 3.3 Constraints
127
+
128
+ - No prose padding — every section earns its place
129
+ - Quote evidence verbatim where possible (file:line refs)
130
+ - Don't editorialize beyond what evidence supports
131
+
132
+ ## Phase 4: Verify + Publish
133
+
134
+ ### Behavioral Traits
135
+
136
+ #### Accuracy
137
+ - Every cited path/score MUST match best.json or trails source
138
+ - Every evidence reference MUST be verifiable (Read to confirm if file_ref)
139
+ - Convergence curve numbers MUST match swarm-report.json#convergence_curve
140
+
141
+ #### Feedback Contract
142
+ | Field | Required | Content |
143
+ |-------|----------|---------|
144
+ | artifacts_written | Always | `{run_dir}/outputs/best-solution.md` |
145
+ | line_count | Always | int (informational) |
146
+ | verification_method | Always | "cross_ref_with_best.json + evidence_verified" |
147
+
148
+ #### Quality Gate
149
+ - Final report file exists and parses as markdown
150
+ - All sections present (Best Solution / Why Won / Runner-Ups / Convergence / Caveats / Reproducibility)
151
+
152
+ ### Verification Steps
153
+
154
+ 1. Read written best-solution.md back
155
+ 2. Cross-check best.score against best.json
156
+ 3. Confirm runner-up scores against trails
157
+ 4. If file_ref evidence in best.candidate_solution -> Read to confirm file exists
158
+
159
+ ### State Update
160
+
161
+ ```json
162
+ {
163
+ "task_id": "ANALYST-1",
164
+ "role": "analyst",
165
+ "status": "completed",
166
+ "artifact_path": "{run_dir}/outputs/best-solution.md",
167
+ "best_score": <float>,
168
+ "best_ant_id": "<id>",
169
+ "line_count": <int>,
170
+ "verification": "cross_ref_pass + evidence_verified"
171
+ }
172
+ ```
173
+
174
+ ## Error Handling
175
+
176
+ | Scenario | Resolution |
177
+ |----------|------------|
178
+ | best.json missing | Pipeline produced no valid ant — write minimal report with `status: no_solution` |
179
+ | Trails empty | Same as above — no exploration data to analyze |
180
+ | Best ant artifact missing | Use only best.json fields; note as caveat |
181
+ | Cross-ref mismatch (score discrepancy) | Trust best.json; note discrepancy in caveats |
@@ -0,0 +1,149 @@
1
+ ---
2
+ role: ant
3
+ prefix: ANT
4
+ inner_loop: false
5
+ output_tag: "[ant]"
6
+ message_types:
7
+ ---
8
+
9
+ # Ant Role — Phase 2-4
10
+
11
+ ## Boundaries
12
+
13
+ ### MUST
14
+ - Read assignment JSON from task description (start_node, edge_preferences, max_path_length)
15
+ - Load swarm-config.json to understand objective + task semantics
16
+ - Build a path of length 1..max_path_length starting from start_node
17
+ - Bias choices using `edge_preferences` (pheromone-derived) BUT may deviate when evidence supports it
18
+ - Output strict-schema JSON to `{run_dir}/outputs/ant-<iter>-<id>.json` (see specs/ant-output-schema.md)
19
+ - Self-validate output before reporting (JSON parses + required fields + node validity)
20
+ - Provide ≥ 1 evidence anchor per path
21
+
22
+ ### MUST NOT
23
+ - Modify pheromone state, best.json, trails/, or other ants' artifacts
24
+ - Skip path_decisions array (one entry per edge traversed)
25
+ - Report self_score > 0.9 without strong evidence (≥ 3 evidence anchors)
26
+ - Visit a node outside the task-space.json nodes list
27
+ - Loop back to a previously visited node in the same path (no cycles)
28
+
29
+ ## Phase 2: Context Loading
30
+
31
+ | Input | Source | Required |
32
+ |-------|--------|----------|
33
+ | Assignment | Task description (parse JSON block) | Yes |
34
+ | Objective | `{run_dir}/work/team/swarm-config.json#ant_prompt.objective` | Yes |
35
+ | Task semantics | `{run_dir}/work/team/swarm-config.json#ant_prompt` (full block) | Yes |
36
+ | Task space | `{run_dir}/work/team/task-space.json` (valid nodes list) | Yes |
37
+ | Pheromone hints | `assignment.edge_preferences` (already passed in) | Yes |
38
+ | Wisdom from prior iters | `{run_dir}/work/team/wisdom/learnings.md` (if exists) | Optional |
39
+
40
+ Workflow:
41
+ 1. Extract session path from task description
42
+ 2. Parse assignment JSON block from task description
43
+ 3. Read swarm-config.json -> capture `ant_prompt.objective`, `ant_prompt.evidence_requirements`, `task_space.max_path_length`
44
+ 4. Read task-space.json -> build valid_nodes set
45
+ 5. If `{run_dir}/work/team/wisdom/learnings.md` exists -> read for prior-iteration insights
46
+
47
+ ## Phase 3: Exploration
48
+
49
+ **Goal**: Build a path of nodes that maximizes likelihood of achieving the objective. The objective is task-defined (find buggy code, find best refactor target, etc.); ant is task-agnostic infrastructure.
50
+
51
+ Workflow:
52
+
53
+ ### 3.1 Initialize path
54
+ - `path = [assignment.start_node]`
55
+ - `path_decisions = []`
56
+ - `visited = {start_node}`
57
+ - `current = start_node`
58
+
59
+ ### 3.2 Per-step exploration loop (until len(path) reaches max_path_length OR ant decides to stop early)
60
+
61
+ For each step:
62
+
63
+ 1. **Compute candidate neighbors**: all nodes in task_space NOT in `visited`
64
+ 2. **Build choice weights**:
65
+ - For each candidate c: `weight = edge_preferences.get("<current>::<c>", baseline) * heuristic(c)`
66
+ - `heuristic(c)` = ant's own evidence-based judgment (1.0 if no opinion)
67
+ 3. **Investigate top candidates** using available tools:
68
+ - Tool selection: use host file-read and search tools (`read_file` / `run_command` or `evolve code search`) for code-based task spaces, or dispatch a read-only subagent (`invoke_subagent` in Antigravity, or `evolve delegate "<prompt>" --to codex --mode analysis` externally) for deeper inspection.
69
+ - Gather evidence about each top candidate before committing
70
+ 4. **Choose next node**: weighted-random OR argmax (when high confidence)
71
+ 5. **Record decision**:
72
+ ```json
73
+ {
74
+ "from": "<current>",
75
+ "to": "<chosen>",
76
+ "rationale": "<one-line>",
77
+ "guided_by": "pheromone | heuristic | evidence",
78
+ "pheromone_weight": <edge_preferences value>,
79
+ "deviation_from_hint": <bool — true if chosen != argmax(edge_preferences)>
80
+ }
81
+ ```
82
+ 6. **Append to path**, update `visited`, `current = chosen`
83
+ 7. **Early-stop check**: if evidence shows objective achieved OR no productive next step exists -> stop
84
+
85
+ ### 3.3 Self-evaluate
86
+
87
+ After path is built:
88
+
89
+ 1. **self_score** (0..1): how well does this path satisfy the objective?
90
+ - Use `ant_prompt.evidence_requirements` as rubric
91
+ - Be conservative — penalize for missing evidence, weak rationale
92
+ 2. **self_confidence** (0..1): how sure of the self_score?
93
+ - Low confidence if evidence is sparse or contradictory
94
+ 3. **candidate_solution**: extract the actual deliverable along the path
95
+ - `type` ∈ {string, object, file_ref}
96
+ - `summary` — one-line
97
+ - `content` — actual artifact OR a path to a file written by the ant
98
+
99
+ ### 3.4 Compose artifact JSON
100
+
101
+ Build the full artifact matching specs/ant-output-schema.md. All required fields populated.
102
+
103
+ ## Phase 4: Verify + Publish
104
+
105
+ ### Behavioral Traits
106
+
107
+ #### Accuracy — outputs must be verifiable
108
+ - Every node in `path` MUST exist in task-space.json
109
+ - Every `path_decisions[i].from` MUST equal `path[i]` and `to` MUST equal `path[i+1]`
110
+ - Evidence references (e.g., `file:line`) MUST be valid (Read to confirm if file_ref)
111
+
112
+ #### Feedback Contract
113
+ | Field | Required | Content |
114
+ |-------|----------|---------|
115
+ | files_produced | If ant wrote any | `[artifact_path]` at minimum |
116
+ | artifacts_written | Always | `{run_dir}/outputs/ant-<iter>-<id>.json` |
117
+ | verification_method | Always | "schema_validated + node_validity_checked" |
118
+
119
+ #### Quality Gate
120
+ - Schema validation pass = REQUIRED before reporting completed
121
+ - Fails -> retry Phase 3 once (max 1 retry to bound cost)
122
+ - Still fails -> report `partial_completion` with `validation_errors` in state data
123
+
124
+ ### Verification Steps
125
+
126
+ 1. **Schema validation**:
127
+ - Parse the JSON via Read
128
+ - Confirm all required fields from specs/ant-output-schema.md
129
+ - Confirm numeric ranges (self_score, self_confidence ∈ [0,1])
130
+ - Confirm `len(path_decisions) == len(path) - 1`
131
+ 2. **Node validity**: every node in path ∈ task_space.json#nodes
132
+ 3. **Evidence check**: at least 1 evidence anchor present; if file_ref, Read to confirm existence
133
+ 4. **Write artifact**: `Write({run_dir}/outputs/ant-<iter>-<id>.json, <json_string>)`
134
+ 5. **Re-read to confirm write**: Read it back, parse, sanity check
135
+
136
+ ### State Update
137
+
138
+ Report the completed assignment with evolve team report after re-reading the artifact. See the coordination guide for the exact flags.
139
+
140
+ ## Error Handling
141
+
142
+ | Scenario | Resolution |
143
+ |----------|------------|
144
+ | Assignment JSON malformed | Report error to coordinator via send_message, STOP |
145
+ | start_node not in task_space | Report error (config mismatch), STOP |
146
+ | No valid neighbors at step 1 | Build single-node path, self_score = 0, report |
147
+ | Schema validation fails twice | Report `partial_completion` with errors list |
148
+ | Evidence requirements unsatisfiable | Lower self_score; document blocker in artifact `notes` field |
149
+ | Tool calls fail (Read/Grep) | Note in artifact `notes`; reduce self_confidence; proceed with available info |