@kontourai/flow-agents 0.1.1

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 (418) hide show
  1. package/.githooks/pre-push +11 -0
  2. package/.github/workflows/ci.yml +210 -0
  3. package/.github/workflows/docs-pages.yml +52 -0
  4. package/.github/workflows/publish-npm.yml +104 -0
  5. package/AGENTS.md +26 -0
  6. package/CHANGELOG.md +66 -0
  7. package/CODE_OF_CONDUCT.md +25 -0
  8. package/CONTEXT.md +300 -0
  9. package/CONTRIBUTING.md +44 -0
  10. package/LICENSE +201 -0
  11. package/README.md +129 -0
  12. package/SECURITY.md +33 -0
  13. package/agent-cards/dev.json +19 -0
  14. package/agents/dev.json +127 -0
  15. package/agents/tool-code-reviewer.json +61 -0
  16. package/agents/tool-dependencies-updater.json +118 -0
  17. package/agents/tool-explore-config.json +92 -0
  18. package/agents/tool-explore-deps.json +92 -0
  19. package/agents/tool-explore-entry.json +92 -0
  20. package/agents/tool-explore-patterns.json +92 -0
  21. package/agents/tool-explore-structure.json +92 -0
  22. package/agents/tool-explore-tests.json +92 -0
  23. package/agents/tool-planner.json +57 -0
  24. package/agents/tool-playwright.json +145 -0
  25. package/agents/tool-security-reviewer.json +56 -0
  26. package/agents/tool-verifier.json +61 -0
  27. package/agents/tool-worker.json +58 -0
  28. package/build/src/cli/console-learning-projection.js +123 -0
  29. package/build/src/cli/docs-preview.js +39 -0
  30. package/build/src/cli/effective-backlog-settings.js +102 -0
  31. package/build/src/cli/export-bookmarks.js +38 -0
  32. package/build/src/cli/fixture-retirement-audit.js +140 -0
  33. package/build/src/cli/flow-kit.js +138 -0
  34. package/build/src/cli/import-bookmarks.js +50 -0
  35. package/build/src/cli/init.js +239 -0
  36. package/build/src/cli/instinct-cli.js +93 -0
  37. package/build/src/cli/promote-workflow-artifact.js +63 -0
  38. package/build/src/cli/publish-change-helper.js +154 -0
  39. package/build/src/cli/pull-work-provider.js +469 -0
  40. package/build/src/cli/runtime-adapter.js +23 -0
  41. package/build/src/cli/telemetry-doctor.js +221 -0
  42. package/build/src/cli/usage-feedback.js +443 -0
  43. package/build/src/cli/validate-hook-influence.js +152 -0
  44. package/build/src/cli/validate-source-tree.js +31 -0
  45. package/build/src/cli/validate-workflow-artifacts.js +486 -0
  46. package/build/src/cli/veritas-governance.js +262 -0
  47. package/build/src/cli/workflow-artifact-cleanup-audit.js +272 -0
  48. package/build/src/cli/workflow-sidecar.js +816 -0
  49. package/build/src/cli.js +89 -0
  50. package/build/src/flow-kit/validate.js +75 -0
  51. package/build/src/lib/args.js +45 -0
  52. package/build/src/lib/fs.js +62 -0
  53. package/build/src/lib/workflow-learning-projection.js +334 -0
  54. package/build/src/runtime-adapters.js +146 -0
  55. package/build/src/tools/build-universal-bundles.js +397 -0
  56. package/build/src/tools/common.js +56 -0
  57. package/build/src/tools/filter-installed-packs.js +132 -0
  58. package/build/src/tools/generate-context-map.js +198 -0
  59. package/build/src/tools/validate-package.js +64 -0
  60. package/build/src/tools/validate-source-tree.js +622 -0
  61. package/console.telemetry.json +176 -0
  62. package/context/base-rules.md +17 -0
  63. package/context/code-review-standards.md +62 -0
  64. package/context/coding-standards.md +42 -0
  65. package/context/common/orchestrators.md +12 -0
  66. package/context/common/subagents.md +28 -0
  67. package/context/contracts/artifact-contract.md +182 -0
  68. package/context/contracts/builder-kit-workflow-state-contract.md +319 -0
  69. package/context/contracts/delivery-contract.md +69 -0
  70. package/context/contracts/execution-contract.md +53 -0
  71. package/context/contracts/governance-adapter-contract.md +67 -0
  72. package/context/contracts/planning-contract.md +85 -0
  73. package/context/contracts/review-contract.md +104 -0
  74. package/context/contracts/sandbox-policy.md +52 -0
  75. package/context/contracts/verification-contract.md +134 -0
  76. package/context/contracts/work-item-contract.md +215 -0
  77. package/context/deferred/demo-mode.md +33 -0
  78. package/context/deferred/languages/go.md +31 -0
  79. package/context/deferred/languages/python.md +31 -0
  80. package/context/deferred/languages/typescript.md +34 -0
  81. package/context/deferred/parallelization.md +35 -0
  82. package/context/deferred/worktree-isolation.md +24 -0
  83. package/context/development-workflow.md +50 -0
  84. package/context/scripts/context-budget/budget-scan.sh +166 -0
  85. package/context/scripts/detect-tools.sh +3 -0
  86. package/context/scripts/discover-agents.sh +28 -0
  87. package/context/scripts/git-status.sh +49 -0
  88. package/context/scripts/hooks/config-protection.js +79 -0
  89. package/context/scripts/hooks/desktop-notify.sh +39 -0
  90. package/context/scripts/hooks/governance-audit.sh +135 -0
  91. package/context/scripts/hooks/lib/audit-transport.sh +40 -0
  92. package/context/scripts/hooks/lib/hook-flags.js +49 -0
  93. package/context/scripts/hooks/lib/patterns.sh +57 -0
  94. package/context/scripts/hooks/lib/resolve-formatter.js +80 -0
  95. package/context/scripts/hooks/post-edit-accumulator.js +66 -0
  96. package/context/scripts/hooks/pre-commit-quality.js +194 -0
  97. package/context/scripts/hooks/quality-gate.js +93 -0
  98. package/context/scripts/hooks/report-only-guard.js +21 -0
  99. package/context/scripts/hooks/run-hook.js +136 -0
  100. package/context/scripts/hooks/stop-format-typecheck.js +141 -0
  101. package/context/scripts/hooks/stop-goal-fit.js +337 -0
  102. package/context/scripts/hooks/workflow-steering.js +250 -0
  103. package/context/scripts/telemetry/console-presets.sh +14 -0
  104. package/context/scripts/telemetry/install-console-config.sh +214 -0
  105. package/context/scripts/telemetry/lib/config.sh +85 -0
  106. package/context/scripts/telemetry/lib/enrich.sh +115 -0
  107. package/context/scripts/telemetry/lib/redact.sh +22 -0
  108. package/context/scripts/telemetry/lib/session.sh +63 -0
  109. package/context/scripts/telemetry/lib/transport.sh +183 -0
  110. package/context/scripts/telemetry/lib/usage.sh +29 -0
  111. package/context/scripts/telemetry/sync-agents.sh +173 -0
  112. package/context/scripts/telemetry/telemetry.conf +23 -0
  113. package/context/scripts/telemetry/telemetry.sh +387 -0
  114. package/context/scripts/validate-package.sh +89 -0
  115. package/context/settings/backlog-provider-settings.json +54 -0
  116. package/context/templates/core/identity.md +26 -0
  117. package/context/templates/core/user.md +15 -0
  118. package/docs/_config.yml +15 -0
  119. package/docs/_layouts/default.html +87 -0
  120. package/docs/adr/0001-flow-agents-consumes-flow.md +77 -0
  121. package/docs/adr/0002-flow-kits-as-extension-unit.md +13 -0
  122. package/docs/adr/0003-flow-agents-coordinates-kits-and-adapters.md +13 -0
  123. package/docs/adr/0004-gates-expect-surface-claims.md +15 -0
  124. package/docs/adr/0005-kubernetes-inspired-resource-contracts.md +48 -0
  125. package/docs/adr/0006-typescript-first-source-policy.md +98 -0
  126. package/docs/agent-system-guidebook.md +391 -0
  127. package/docs/agent-usage-feedback-loop.md +351 -0
  128. package/docs/assets/favicon.svg +13 -0
  129. package/docs/assets/og-image.png +0 -0
  130. package/docs/assets/site.css +774 -0
  131. package/docs/assets/site.js +139 -0
  132. package/docs/configurable-workflow-routing.md +174 -0
  133. package/docs/context-map.md +145 -0
  134. package/docs/developer-architecture.md +145 -0
  135. package/docs/developer-hook-setup.md +61 -0
  136. package/docs/fixture-ownership.md +44 -0
  137. package/docs/flow-kit-repository-contract.md +180 -0
  138. package/docs/index.md +129 -0
  139. package/docs/kontour-resource-contract.md +358 -0
  140. package/docs/migrations.md +64 -0
  141. package/docs/north-star.md +322 -0
  142. package/docs/operating-layers.md +110 -0
  143. package/docs/repository-structure.md +132 -0
  144. package/docs/sandbox-policy.md +56 -0
  145. package/docs/skills-map.md +203 -0
  146. package/docs/standards-register.md +96 -0
  147. package/docs/veritas-integration.md +165 -0
  148. package/docs/work-item-adapters.md +72 -0
  149. package/docs/workflow-artifact-lifecycle.md +141 -0
  150. package/docs/workflow-eval-strategy.md +295 -0
  151. package/docs/workflow-shared-contracts.md +51 -0
  152. package/docs/workflow-usage-guide.md +443 -0
  153. package/evals/ARCHITECTURE.md +143 -0
  154. package/evals/CONVENTIONS.md +58 -0
  155. package/evals/README.md +128 -0
  156. package/evals/acceptance/run.sh +29 -0
  157. package/evals/acceptance/test_claude_harness.sh +242 -0
  158. package/evals/acceptance/test_codex_harness.sh +108 -0
  159. package/evals/acceptance/test_kiro_harness.sh +128 -0
  160. package/evals/cases/dev/404.html +97 -0
  161. package/evals/cases/dev/code-review.yaml +44 -0
  162. package/evals/cases/dev/dashboard.html +300 -0
  163. package/evals/cases/dev/deliver.yaml +66 -0
  164. package/evals/cases/dev/dependency-update.yaml +16 -0
  165. package/evals/cases/dev/explore.yaml +20 -0
  166. package/evals/cases/dev/index.html +370 -0
  167. package/evals/cases/dev/package-lock.json +28 -0
  168. package/evals/cases/dev/package.json +16 -0
  169. package/evals/cases/dev/plan-work.yaml +20 -0
  170. package/evals/cases/dev/promptfooconfig.yaml +666 -0
  171. package/evals/cases/dev/search-first.yaml +20 -0
  172. package/evals/cases/dev/tdd-workflow.yaml +48 -0
  173. package/evals/cases/dev/verify-work.yaml +44 -0
  174. package/evals/cases/dev/workflow.yaml +34 -0
  175. package/evals/ci/run-baseline.sh +283 -0
  176. package/evals/fixtures/backlog-provider-settings/global-default.json +44 -0
  177. package/evals/fixtures/backlog-provider-settings/project-override.json +53 -0
  178. package/evals/fixtures/builder-kit-workflow-state/baseline-freshness-resolution-hint.json +139 -0
  179. package/evals/fixtures/builder-kit-workflow-state/direct-primitive-stop.json +59 -0
  180. package/evals/fixtures/builder-kit-workflow-state/empty-board-route-shape.json +55 -0
  181. package/evals/fixtures/builder-kit-workflow-state/happy-path.json +71 -0
  182. package/evals/fixtures/builder-kit-workflow-state/mid-work-resume.json +80 -0
  183. package/evals/fixtures/builder-kit-workflow-state/missing-prestep-recovery.json +65 -0
  184. package/evals/fixtures/builder-kit-workflow-state/product-build-chaining.json +60 -0
  185. package/evals/fixtures/builder-kit-workflow-state/stale-continuation-requires-new-probe.json +57 -0
  186. package/evals/fixtures/console-learning-projection/artifacts/console-learning-correction/learning.json +50 -0
  187. package/evals/fixtures/console-learning-projection/artifacts/console-learning-open-route/learning.json +41 -0
  188. package/evals/fixtures/flow-kit-repository/invalid-absolute-path/kit.json +8 -0
  189. package/evals/fixtures/flow-kit-repository/invalid-asset-section/flows/review.flow.json +6 -0
  190. package/evals/fixtures/flow-kit-repository/invalid-asset-section/kit.json +11 -0
  191. package/evals/fixtures/flow-kit-repository/invalid-duplicate-flow/flows/review.flow.json +6 -0
  192. package/evals/fixtures/flow-kit-repository/invalid-duplicate-flow/kit.json +9 -0
  193. package/evals/fixtures/flow-kit-repository/invalid-id/flows/review.flow.json +6 -0
  194. package/evals/fixtures/flow-kit-repository/invalid-id/kit.json +8 -0
  195. package/evals/fixtures/flow-kit-repository/invalid-malformed-json/kit.json +8 -0
  196. package/evals/fixtures/flow-kit-repository/invalid-missing-flow/kit.json +8 -0
  197. package/evals/fixtures/flow-kit-repository/invalid-missing-id/flows/review.flow.json +6 -0
  198. package/evals/fixtures/flow-kit-repository/invalid-missing-id/kit.json +7 -0
  199. package/evals/fixtures/flow-kit-repository/invalid-missing-schema-version/flows/review.flow.json +6 -0
  200. package/evals/fixtures/flow-kit-repository/invalid-missing-schema-version/kit.json +7 -0
  201. package/evals/fixtures/flow-kit-repository/invalid-name/flows/review.flow.json +6 -0
  202. package/evals/fixtures/flow-kit-repository/invalid-name/kit.json +8 -0
  203. package/evals/fixtures/flow-kit-repository/invalid-schema-version/flows/review.flow.json +6 -0
  204. package/evals/fixtures/flow-kit-repository/invalid-schema-version/kit.json +8 -0
  205. package/evals/fixtures/flow-kit-repository/invalid-traversal/kit.json +8 -0
  206. package/evals/fixtures/flow-kit-repository/mixed-runtime-kit/adapters/example.json +3 -0
  207. package/evals/fixtures/flow-kit-repository/mixed-runtime-kit/assets/example.txt +1 -0
  208. package/evals/fixtures/flow-kit-repository/mixed-runtime-kit/docs/README.md +3 -0
  209. package/evals/fixtures/flow-kit-repository/mixed-runtime-kit/flows/runtime.flow.json +26 -0
  210. package/evals/fixtures/flow-kit-repository/mixed-runtime-kit/kit-evals/example.json +3 -0
  211. package/evals/fixtures/flow-kit-repository/mixed-runtime-kit/kit-skills/mixed/SKILL.md +3 -0
  212. package/evals/fixtures/flow-kit-repository/mixed-runtime-kit/kit.json +44 -0
  213. package/evals/fixtures/flow-kit-repository/valid-local-kit/docs/README.md +3 -0
  214. package/evals/fixtures/flow-kit-repository/valid-local-kit/flows/review.flow.json +26 -0
  215. package/evals/fixtures/flow-kit-repository/valid-local-kit/kit.json +20 -0
  216. package/evals/fixtures/hook-influence/cases.json +336 -0
  217. package/evals/fixtures/pull-work-provider/github-issues.json +170 -0
  218. package/evals/fixtures/pull-work-wip-shepherding/global-wip-informs.json +43 -0
  219. package/evals/fixtures/pull-work-wip-shepherding/personal-wip-blocks.json +42 -0
  220. package/evals/fixtures/surface-trust/accepted-claim-trust-report.json +31 -0
  221. package/evals/fixtures/surface-trust/artifact-absent.json +19 -0
  222. package/evals/fixtures/surface-trust/integrity-mismatch-trust-report.json +32 -0
  223. package/evals/fixtures/surface-trust/missing-authority-trust-report.json +27 -0
  224. package/evals/fixtures/surface-trust/provider-absent.json +19 -0
  225. package/evals/fixtures/surface-trust/rejected-claim-trust-report.json +30 -0
  226. package/evals/fixtures/surface-trust/stale-claim-trust-snapshot.json +31 -0
  227. package/evals/fixtures/usage-feedback/sample-full.jsonl +11 -0
  228. package/evals/fixtures/usage-feedback/sample-outcomes.jsonl +1 -0
  229. package/evals/fixtures/veritas-governance-adapter/fake-veritas-pass.sh +18 -0
  230. package/evals/fixtures/veritas-governance-adapter/fake-veritas-secret-fail.sh +10 -0
  231. package/evals/fixtures/veritas-governance-adapter/fake-veritas-unconfigured.sh +4 -0
  232. package/evals/integration/test_bundle_install.sh +541 -0
  233. package/evals/integration/test_console_learning_projection.sh +192 -0
  234. package/evals/integration/test_context_map.sh +65 -0
  235. package/evals/integration/test_effective_backlog_settings.sh +58 -0
  236. package/evals/integration/test_fixture_retirement_audit.sh +58 -0
  237. package/evals/integration/test_flow_agents_statusline.sh +93 -0
  238. package/evals/integration/test_flow_kit_repository.sh +90 -0
  239. package/evals/integration/test_goal_fit_hook.sh +482 -0
  240. package/evals/integration/test_hook_category_behaviors.sh +190 -0
  241. package/evals/integration/test_hook_influence_cases.sh +69 -0
  242. package/evals/integration/test_local_flow_kit_install.sh +145 -0
  243. package/evals/integration/test_publish_change_helper.sh +176 -0
  244. package/evals/integration/test_pull_work_provider.sh +140 -0
  245. package/evals/integration/test_runtime_adapter_activation.sh +106 -0
  246. package/evals/integration/test_telemetry.sh +485 -0
  247. package/evals/integration/test_telemetry_doctor.sh +193 -0
  248. package/evals/integration/test_usage_feedback_dashboard.sh +169 -0
  249. package/evals/integration/test_usage_feedback_global.sh +117 -0
  250. package/evals/integration/test_usage_feedback_import.sh +227 -0
  251. package/evals/integration/test_usage_feedback_outcomes.sh +165 -0
  252. package/evals/integration/test_usage_feedback_report.sh +263 -0
  253. package/evals/integration/test_veritas_governance_adapter.sh +235 -0
  254. package/evals/integration/test_workflow_artifact_cleanup_audit.sh +287 -0
  255. package/evals/integration/test_workflow_artifacts.sh +1247 -0
  256. package/evals/integration/test_workflow_sidecar_writer.sh +2112 -0
  257. package/evals/integration/test_workflow_steering_hook.sh +337 -0
  258. package/evals/lib/assertions/delegated-to.js +40 -0
  259. package/evals/lib/assertions/max-tool-calls.js +15 -0
  260. package/evals/lib/assertions/no-write-tools.js +27 -0
  261. package/evals/lib/assertions/pass-at-k.js +39 -0
  262. package/evals/lib/assertions/telemetry-utils.js +105 -0
  263. package/evals/lib/assertions/tool-called.js +39 -0
  264. package/evals/lib/assertions/verify-after-fix.js +61 -0
  265. package/evals/lib/claude-judge.sh +40 -0
  266. package/evals/lib/claude-provider.sh +74 -0
  267. package/evals/lib/codex-judge.sh +39 -0
  268. package/evals/lib/codex-provider.sh +81 -0
  269. package/evals/lib/eval-dev.sh +5 -0
  270. package/evals/lib/eval-judge.sh +22 -0
  271. package/evals/lib/eval-provider.sh +26 -0
  272. package/evals/lib/eval-report.sh +73 -0
  273. package/evals/lib/kiro-dev.sh +4 -0
  274. package/evals/lib/kiro-judge.sh +17 -0
  275. package/evals/lib/kiro-provider.sh +62 -0
  276. package/evals/lib/node.sh +111 -0
  277. package/evals/promptfooconfig.yaml +70 -0
  278. package/evals/run.sh +309 -0
  279. package/evals/static/test_evidence_refs.sh +141 -0
  280. package/evals/static/test_package.sh +407 -0
  281. package/evals/static/test_repo_hooks.sh +68 -0
  282. package/evals/static/test_universal_bundles.sh +274 -0
  283. package/evals/static/test_workflow_skills.sh +1207 -0
  284. package/install.sh +64 -0
  285. package/integrations/veritas/flow-agents.adapter.json +138 -0
  286. package/integrations/veritas/flow-agents.authority-settings.json +26 -0
  287. package/integrations/veritas/flow-agents.repo-standards.json +82 -0
  288. package/kits/builder/flows/build.flow.json +218 -0
  289. package/kits/builder/flows/shape.flow.json +127 -0
  290. package/kits/builder/kit.json +19 -0
  291. package/kits/catalog.json +11 -0
  292. package/package.json +130 -0
  293. package/packaging/README.md +60 -0
  294. package/packaging/manifest.json +173 -0
  295. package/packaging/packs.json +69 -0
  296. package/powers/dependency-checker/POWER.md +20 -0
  297. package/powers/dependency-checker/mcp.json +20 -0
  298. package/powers/playwright/POWER.md +25 -0
  299. package/powers/playwright/mcp.json +12 -0
  300. package/prompts/code-audit.md +123 -0
  301. package/prompts/kcommit.md +88 -0
  302. package/schemas/backlog-provider-settings.schema.json +138 -0
  303. package/schemas/workflow-acceptance.schema.json +216 -0
  304. package/schemas/workflow-critique.schema.json +113 -0
  305. package/schemas/workflow-evidence.schema.json +357 -0
  306. package/schemas/workflow-handoff.schema.json +52 -0
  307. package/schemas/workflow-learning.schema.json +223 -0
  308. package/schemas/workflow-release.schema.json +172 -0
  309. package/schemas/workflow-state.schema.json +80 -0
  310. package/scripts/README.md +111 -0
  311. package/scripts/build-universal-bundles.js +3 -0
  312. package/scripts/check-content-boundary.cjs +99 -0
  313. package/scripts/context-budget/budget-scan.sh +166 -0
  314. package/scripts/detect-tools.sh +3 -0
  315. package/scripts/discover-agents.sh +28 -0
  316. package/scripts/effective-backlog-settings.js +2 -0
  317. package/scripts/filter-installed-packs.js +2 -0
  318. package/scripts/flow-kit.js +2 -0
  319. package/scripts/generate-context-map.js +2 -0
  320. package/scripts/git-status.sh +49 -0
  321. package/scripts/hooks/claude-hook-adapter.js +174 -0
  322. package/scripts/hooks/claude-telemetry-hook.js +115 -0
  323. package/scripts/hooks/codex-hook-adapter.js +176 -0
  324. package/scripts/hooks/codex-telemetry-hook.js +95 -0
  325. package/scripts/hooks/config-protection.js +79 -0
  326. package/scripts/hooks/desktop-notify.sh +39 -0
  327. package/scripts/hooks/governance-audit.sh +135 -0
  328. package/scripts/hooks/lib/audit-transport.sh +40 -0
  329. package/scripts/hooks/lib/hook-flags.js +49 -0
  330. package/scripts/hooks/lib/patterns.sh +57 -0
  331. package/scripts/hooks/lib/resolve-formatter.js +80 -0
  332. package/scripts/hooks/post-edit-accumulator.js +66 -0
  333. package/scripts/hooks/pre-commit-quality.js +194 -0
  334. package/scripts/hooks/quality-gate.js +93 -0
  335. package/scripts/hooks/report-only-guard.js +21 -0
  336. package/scripts/hooks/run-hook.js +136 -0
  337. package/scripts/hooks/stop-format-typecheck.js +141 -0
  338. package/scripts/hooks/stop-goal-fit.js +337 -0
  339. package/scripts/hooks/workflow-steering.js +250 -0
  340. package/scripts/install-codex-home.sh +106 -0
  341. package/scripts/package.json +3 -0
  342. package/scripts/promote-workflow-artifact.js +2 -0
  343. package/scripts/publish-change-helper.js +2 -0
  344. package/scripts/pull-work-provider.js +2 -0
  345. package/scripts/setup-repo-hooks.sh +8 -0
  346. package/scripts/statusline/flow-agents-statusline.js +157 -0
  347. package/scripts/telemetry/console-presets.sh +14 -0
  348. package/scripts/telemetry/install-console-config.sh +214 -0
  349. package/scripts/telemetry/lib/config.sh +85 -0
  350. package/scripts/telemetry/lib/enrich.sh +115 -0
  351. package/scripts/telemetry/lib/redact.sh +22 -0
  352. package/scripts/telemetry/lib/session.sh +63 -0
  353. package/scripts/telemetry/lib/transport.sh +183 -0
  354. package/scripts/telemetry/lib/usage.sh +29 -0
  355. package/scripts/telemetry/sync-agents.sh +173 -0
  356. package/scripts/telemetry/telemetry.conf +23 -0
  357. package/scripts/telemetry/telemetry.sh +387 -0
  358. package/scripts/usage-feedback.js +2 -0
  359. package/scripts/validate-hook-influence-cases.js +2 -0
  360. package/scripts/validate-package.sh +89 -0
  361. package/scripts/validate-source-tree.js +9 -0
  362. package/skills/agentic-engineering/SKILL.md +62 -0
  363. package/skills/browser-test/SKILL.md +51 -0
  364. package/skills/builder-shape/SKILL.md +76 -0
  365. package/skills/context-budget/SKILL.md +40 -0
  366. package/skills/deliver/SKILL.md +241 -0
  367. package/skills/dependency-update/SKILL.md +68 -0
  368. package/skills/design-probe/SKILL.md +107 -0
  369. package/skills/eval-rebuild/SKILL.md +39 -0
  370. package/skills/evidence-gate/SKILL.md +186 -0
  371. package/skills/execute-plan/SKILL.md +110 -0
  372. package/skills/explore/SKILL.md +137 -0
  373. package/skills/feedback-loop/SKILL.md +87 -0
  374. package/skills/fix-bug/SKILL.md +133 -0
  375. package/skills/frontend-design/SKILL.md +80 -0
  376. package/skills/github-cli/SKILL.md +63 -0
  377. package/skills/idea-to-backlog/SKILL.md +267 -0
  378. package/skills/knowledge-capture/SKILL.md +55 -0
  379. package/skills/learning-review/SKILL.md +115 -0
  380. package/skills/pickup-probe/SKILL.md +114 -0
  381. package/skills/plan-work/SKILL.md +176 -0
  382. package/skills/pull-work/SKILL.md +309 -0
  383. package/skills/release-readiness/SKILL.md +121 -0
  384. package/skills/review-work/SKILL.md +161 -0
  385. package/skills/search-first/SKILL.md +66 -0
  386. package/skills/tdd-workflow/SKILL.md +140 -0
  387. package/skills/verify-work/SKILL.md +109 -0
  388. package/src/cli/console-learning-projection.ts +140 -0
  389. package/src/cli/effective-backlog-settings.ts +99 -0
  390. package/src/cli/fixture-retirement-audit.ts +154 -0
  391. package/src/cli/flow-kit.ts +139 -0
  392. package/src/cli/init.ts +248 -0
  393. package/src/cli/promote-workflow-artifact.ts +64 -0
  394. package/src/cli/publish-change-helper.ts +143 -0
  395. package/src/cli/pull-work-provider.ts +481 -0
  396. package/src/cli/runtime-adapter.ts +24 -0
  397. package/src/cli/telemetry-doctor.ts +243 -0
  398. package/src/cli/usage-feedback.ts +418 -0
  399. package/src/cli/validate-hook-influence.ts +119 -0
  400. package/src/cli/validate-source-tree.ts +30 -0
  401. package/src/cli/validate-workflow-artifacts.ts +411 -0
  402. package/src/cli/veritas-governance.ts +322 -0
  403. package/src/cli/workflow-artifact-cleanup-audit.ts +281 -0
  404. package/src/cli/workflow-sidecar.ts +676 -0
  405. package/src/cli.ts +95 -0
  406. package/src/flow-kit/validate.ts +74 -0
  407. package/src/lib/args.ts +43 -0
  408. package/src/lib/fs.ts +62 -0
  409. package/src/lib/workflow-learning-projection.ts +491 -0
  410. package/src/runtime-adapters.ts +154 -0
  411. package/src/tools/build-universal-bundles.ts +366 -0
  412. package/src/tools/common.ts +61 -0
  413. package/src/tools/filter-installed-packs.ts +129 -0
  414. package/src/tools/generate-context-map.ts +199 -0
  415. package/src/tools/validate-package.ts +57 -0
  416. package/src/tools/validate-source-tree.ts +488 -0
  417. package/tsconfig.json +19 -0
  418. package/veritas.claims.json +6 -0
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: "pickup-probe"
3
+ description: "Builder Kit work-item/docs/provider-grounded Probe specialization used at the design-probe flow step before plan-work."
4
+ ---
5
+
6
+ # Pickup Probe
7
+
8
+ Probe selected backlog work before Builder Kit planning starts.
9
+
10
+ ## Contract
11
+
12
+ `pickup-probe` is the Builder Kit pickup specialization of the `design-probe` flow step. It runs after `pull-work` selects work and before `plan-work` creates an execution plan.
13
+
14
+ Direct `pull-work` and direct `plan-work` remain valid standalone primitives. This skill is required when the productized Builder Kit `build` flow has selected work, when a user asks to pick up work and continue into build/delivery, or when `deliver` needs to prove selected-work readiness before planning.
15
+
16
+ This skill is modeled after Matt Pocock's `grill-with-docs`: challenge the selected work against the existing domain model, sharpen terminology, cross-check docs and code, ask one recommended question at a time, update durable glossary terms inline when they crystallize, and offer ADRs only for hard-to-reverse, surprising, trade-off decisions.
17
+
18
+ ## Required Inputs
19
+
20
+ - Selected work item or coherent work item group.
21
+ - Pull-work artifact with board snapshot, WIP assessment, selection rationale, scope, non-goals, pickup gate, and handoff.
22
+ - Provider state, including WorkItemProvider and BoardProvider refs, issue status, labels, milestone/project fields, blockers, PR links, and source artifact refs when available.
23
+ - WIP and conflict scan covering active sessions, open PRs, verification/review/CI remediation queues, expected shared files, and worktree or sandbox mode.
24
+ - Existing acceptance criteria, done criteria, stop-short risks, and known non-goals.
25
+ - Source issue and artifact refs, including issue URLs, source planning or idea artifacts, flow definition refs, and missing-source notes.
26
+ - Repository reality: `CONTEXT.md` when present, relevant docs, ADRs, contracts, skills, schemas, fixtures, and code paths named by the selected work.
27
+ - Domain documentation: root `CONTEXT.md`, `CONTEXT-MAP.md` when present, and relevant `docs/adr/` records. If no durable context file exists, create one lazily only when a resolved project-specific term needs a home.
28
+ - Planned-base drift context: `planned_base_ref`, `planned_base_sha`, current target ref/SHA, `planning_scope_refs`, and a diff summary from the planned/pulled work SHA to current HEAD when available.
29
+
30
+ If a required input is missing, first try to recover it from local artifacts and provider snapshots. Ask one alignment question only when the missing input creates a real decision gap that cannot be resolved from local evidence.
31
+
32
+ If `planned_base_sha` is missing, record that as a `NOT_VERIFIED` drift baseline gap and use current target plus provider history as the best available baseline. Do not invent a planned SHA.
33
+
34
+ For Builder Kit baseline freshness gaps where `planned_base_sha` is missing or inconclusive, record `resolution_hints` in the Builder Kit Probe record when that record shape is available. Use `gap_id: revision_freshness_not_verified`, `claim_id: planning.baseline.current`, and a reason code such as `missing_planned_base_sha`. The hint should name the blocked refs, the required evidence needed to resolve the gap, `resolve_at` pointing back to `pickup-probe`, and any explicit accepted fallback baseline that allows planning to continue.
35
+
36
+ ## Behavior
37
+
38
+ Challenge the selected work against the repository before planning:
39
+
40
+ - Fetch latest for the target ref when available, then compare the current target SHA to `planned_base_sha`. Record current target ref/SHA, planned base ref/SHA, `commits-since`, planned age, changed files reviewed, and changed-file intersections with `planning_scope_refs`.
41
+ - Classify revision freshness as `fresh`, `drifted`, or `stale`. `fresh` may proceed through normal pickup gates. `drifted` prompts alignment and may proceed only when the Probe records accepted decisions or an explicit accepted gap. `stale` routes back to `idea-to-backlog` before implementation planning.
42
+ - If `planned_base_sha` is missing, mark the freshness check `NOT_VERIFIED` and record the concrete fallback baseline, such as current target ref/SHA plus provider history. Treat that as an accepted gap only when the artifact names why planning may continue; do not invent a planned SHA. When using a Builder Kit Probe JSON record, include `resolution_hints` for `revision_freshness_not_verified` so the next planning attempt can see the accepted fallback baseline or route back to `pickup-probe` for missing evidence.
43
+ - Research drift before asking questions: compare the selected work's `planned_base_sha` or pulled-work SHA to current HEAD before running the alignment interview. Inspect changed files, docs, ADRs, contracts, schemas, dependency state, and expected execution areas that overlap `planning_scope_refs` or likely modified files.
44
+ - Classify the diff from planned base to current HEAD as `no_material_drift`, `scope_drift`, `dependency_drift`, `contract_drift`, or `conflict_risk`. Treat material drift as pickup Probe context and ask an alignment question before planning when it changes scope, acceptance criteria, dependency assumptions, terminology, contract expectations, or execution risk.
45
+ - Compare the selected work to `CONTEXT.md`, docs, ADRs, contracts, existing skills, schemas, fixtures, and nearby code.
46
+ - Verify that the acceptance criteria describe an executable outcome rather than only implementation tasks.
47
+ - Sharpen fuzzy domain and workflow terms until the artifact names, scope, gate names, and next step mean one thing.
48
+ - Surface contradictions between issue text, pull-work handoff, provider state, docs, ADRs, contracts, and code reality.
49
+ - Challenge glossary conflicts immediately: if a user or issue uses a term differently than `CONTEXT.md`, ask which meaning is authoritative before planning.
50
+ - Discuss concrete scenarios when boundaries are fuzzy, especially around ownership, provider state, workflow gates, and stop-short behavior.
51
+ - Check whether the selected work is still ready after WIP, conflicts, blockers, dependency freshness, and expected modified files are considered.
52
+ - Keep downstream issues and non-goals out of scope unless they are explicit contract consumers for the selected work.
53
+ - Ask one question at a time when a decision is needed, include a recommended answer, and record the answer immediately.
54
+ - Record unresolved questions as blockers unless the user or orchestrator explicitly accepts proceeding with the gap.
55
+ - Update the active workflow artifact immediately when a decision crystallizes; do not rely on chat memory.
56
+
57
+ For Builder Kit build-flow recovery, a missing or incomplete pickup Probe record routes `decision_gap` back to the `design-probe` step. For pickup/planning gaps, returning to `design-probe` means completing this pickup Probe record before retrying `plan-work`.
58
+
59
+ ## Output
60
+
61
+ Record the pickup Probe result in the pull-work artifact, handoff artifact, or documented Builder Kit Probe record referenced by `state.json` or `handoff.json`. The record must include:
62
+
63
+ - Probe status: `pass`, `needs_decision`, `blocked`, or `accepted_gap`.
64
+ - Decisions made during the Probe, with source refs when relevant.
65
+ - Unresolved questions, each with owner, impact, and whether it blocks planning.
66
+ - Accepted gaps, including who accepted the gap and why planning may continue.
67
+ - Drift research: planned base ref/SHA, current target ref/SHA, command or provider evidence used, changed files reviewed, drift classification, and whether the drift is material.
68
+ - Builder Kit `resolution_hints` when available for baseline freshness `NOT_VERIFIED` gaps, including `planning.baseline.current`, required baseline evidence, and the accepted fallback baseline behavior.
69
+ - Planning readiness: ready/not ready, required handoff target, and readiness evidence.
70
+ - Expected modified files or file areas, including generated/runtime artifact expectations when relevant.
71
+ - Conflict risks with active work, shared files, provider state, or downstream contract consumers.
72
+ - Route reason and next action, such as `continue -> plan-work`, `decision_gap -> design-probe`, `blocked -> pull-work`, or `split_scope -> pull-work`.
73
+
74
+ ## Planning Gate
75
+
76
+ Planning is ready only when:
77
+
78
+ - Selected work and source refs are clear enough for `plan-work`.
79
+ - Acceptance criteria and done criteria are present or explicit accepted gaps exist.
80
+ - Planned-base drift research is recorded, or the missing baseline is explicitly marked `NOT_VERIFIED` with a best-available fallback.
81
+ - Provider state and WIP/conflict scan have been checked or marked `NOT_VERIFIED` with a reason.
82
+ - Scope, non-goals, expected modified files, and conflict risks are recorded.
83
+ - Contradictions are resolved, blocked, or explicitly accepted as gaps.
84
+ - The route reason and next action are recorded in an artifact that can be recovered without chat memory.
85
+
86
+ If the gate fails, stop before `plan-work` and update the artifact with the blocker or decision gap.
87
+
88
+ ## Docs And ADR Policy
89
+
90
+ `pickup-probe` may identify durable terminology and decision gaps, but it must keep documentation changes narrow:
91
+
92
+ - Update `CONTEXT.md` inline only for glossary-style durable terminology decisions, using tight one- or two-sentence definitions and `_Avoid_` terms when useful. Keep implementation details out of `CONTEXT.md`.
93
+ - If a `CONTEXT-MAP.md` exists, update the relevant context instead of assuming the root glossary owns the term.
94
+ - Create a lazy context file only when a resolved term or workflow concept has no existing home.
95
+ - Do not create context files for transient planning notes, open questions, or provider snapshots.
96
+ - Propose or create ADRs sparingly, only when all three are true: the decision is hard to reverse, surprising without context, and the result of a real trade-off.
97
+ - Prefer workflow artifacts for pickup decisions, unresolved questions, accepted gaps, and route reasons until the work is accepted.
98
+
99
+ ## Handoff To Plan Work
100
+
101
+ When the Probe passes, hand off to `plan-work` with:
102
+
103
+ - selected work item refs
104
+ - pull-work artifact path
105
+ - pickup Probe record path or section
106
+ - provider state summary
107
+ - planned-base drift summary and drift classification
108
+ - accepted gaps
109
+ - expected modified files
110
+ - conflict risks
111
+ - sandbox/worktree mode
112
+ - route reason and next action
113
+
114
+ `plan-work` must consume this record for Builder Kit build-flow planning. If the record is absent, contradictory, or lacks an accepted gap for a known decision gap, planning stops and routes back to `design-probe`.
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: "plan-work"
3
+ description: "Code planning primitive — goal + directory to structured execution plan. Delegates to tool-planner. No resume, no ideation."
4
+ ---
5
+
6
+ # Plan
7
+
8
+ Goal + directory in, structured plan artifact out. Pure planning primitive.
9
+
10
+ ## Agents
11
+
12
+ | Agent | Role |
13
+ |---|---|
14
+ | tool-planner | Codebase analysis, structured execution plan, writes plan artifact |
15
+
16
+ ## Orchestrator Rule
17
+
18
+ You do not read source files. You delegate to tool-planner and read the artifact it produces.
19
+
20
+ ## Shared Contracts
21
+
22
+ Follow:
23
+ - `context/contracts/artifact-contract.md`
24
+ - `context/contracts/planning-contract.md`
25
+ - `context/contracts/sandbox-policy.md`
26
+
27
+ This skill owns orchestration. The contracts own the required artifact shape, Definition Of Done, acceptance criteria, sandbox mode, evidence expectations, and stop-short risk rules.
28
+
29
+ ## Pre-Planning: Research
30
+
31
+ Before delegating to tool-planner, check if the goal can be solved with existing tools or libraries:
32
+ 1. Search the current codebase for similar functionality
33
+ 2. If the goal involves adding new capabilities, invoke the search-first skill
34
+ 3. Pass research findings to tool-planner as additional context
35
+
36
+ Skip this step if the goal is purely about modifying existing code (bug fixes, refactors).
37
+
38
+ ## Input
39
+
40
+ The orchestrator (or user) provides:
41
+ - **Goal**: what to build or change
42
+ - **Directory**: working directory for the codebase
43
+ - **Constraints**: from AGENTS.md, user preferences, conversation context
44
+ - **Session file path** (optional): if part of a larger workflow, the orchestrator passes this
45
+
46
+ Direct `plan-work` remains a standalone planning primitive. Do not require Builder Kit pickup Probe state for ordinary direct planning prompts unless the user is trying to pick up provider-backed backlog work or continue a productized build/delivery workflow.
47
+
48
+ When `plan-work` is invoked from the Builder Kit `build` flow, from `deliver`, or from a pick-up-and-build request after `pull-work`, first read the recorded pickup Probe decisions, unresolved questions, accepted gaps, sandbox/worktree mode, expected modified files, and conflict risks from the pull-work or handoff artifact. If the handoff lacks required Probe decisions or explicitly accepted gaps, stop planning and route `decision_gap` back to `design-probe`; for pickup/planning gaps, that means returning to the pickup Probe before retrying planning.
49
+
50
+ Only consume Builder Kit Probe `resolution_hints` in those Builder Kit build/deliver/pickup contexts. Direct primitive `plan-work` remains valid without Builder Kit-specific `resolution_hints`; do not require or synthesize them for ordinary planning requests.
51
+
52
+ Required Builder Kit handoff fields before planning:
53
+
54
+ - `probe_status` is `passed` or `accepted_gap`
55
+ - `probe_artifact_ref` points to the pickup Probe record
56
+ - selected item ids are present
57
+ - grouping decision is `single-item`, `independent-items`, or `justified-bundle`
58
+ - accepted gaps, expected modified files, conflict risks, route reason, and next action are recorded
59
+
60
+ If the handoff came from stale broad continuation language after a previous merge, treat it as missing Probe evidence and route back to `design-probe` / `pickup-probe`. Do not infer permission to plan the next item from a previous continuation instruction.
61
+
62
+ ## Provider-Backed Baseline Preflight
63
+
64
+ For provider-backed backlog work, `plan-work` consumes freshness context; it does not classify revision freshness itself. Before delegating to `tool-planner`, read the pull-work or pickup Probe artifact and carry forward:
65
+
66
+ - `revision_freshness` from the upstream artifact
67
+ - current target ref/SHA confirmed from the latest provider or repository state available to pull-work/pickup Probe
68
+ - `planned_base_ref` and `planned_base_sha` when present
69
+ - accepted gaps, including any accepted-gap baseline for missing historical `planned_base_sha`
70
+ - Builder Kit Probe `resolution_hints` for `revision_freshness_not_verified` when the invocation came through Builder Kit build/deliver/pickup, especially hints for `planning.baseline.current`
71
+ - changed scope intersections with `planning_scope_refs`, contracts, dependencies, expected files, or execution areas
72
+ - dependency freshness and provider state, including blockers, PR links, board/project membership, and any `NOT_VERIFIED` checks
73
+
74
+ If `revision_freshness` is `stale`, unresolved, missing without an accepted gap, or contradicted by dependency/provider state, stop planning. Route pickup/planning gaps back to `pickup-probe`; when `revision_freshness` is `stale`, route stale shaped work back to `idea-to-backlog` instead of handing the item to `tool-planner`.
75
+
76
+ An explicit accepted-gap fallback baseline may allow planning to proceed, but it must name the fallback baseline used. Missing `planned_base_sha` is never fresh by itself. If baseline freshness is missing or `NOT_VERIFIED`, record the gap and stop planning unless it has been explicitly accepted as a fallback baseline naming the current target ref/SHA plus provider history or equivalent.
77
+
78
+ For Builder Kit `resolution_hints` with `gap_id: revision_freshness_not_verified` and `claim_id: planning.baseline.current`, carry the accepted fallback baseline into the plan's baseline section exactly enough for execution and verification to recover it. If the missing baseline evidence does not include an explicit accepted fallback baseline, do not pass the item to `tool-planner`; route back to `pickup-probe` so the Probe can collect evidence or record the accepted gap.
79
+
80
+ The `tool-planner` prompt context must include the latest-base confirmation and acceptance-criteria drift findings:
81
+
82
+ - the current target ref/SHA that planning is based on
83
+ - the source freshness state or accepted-gap baseline
84
+ - each upstream AC id revalidated against drift
85
+ - stale assumptions found during revalidation
86
+ - any route-back decision already taken or still required
87
+
88
+ ## Workflow
89
+
90
+ 1. Create session file in `.flow-agents/<slug>/` if one wasn't provided:
91
+ - Filename: `<slug>--plan-work.md`
92
+ - `status: planning`, `type: plan-work`
93
+ - Create or update `state.json` with phase `planning`
94
+ - use `npm run workflow:sidecar -- ensure-session --source-request ... --summary ... --criterion ...` when the repository provides it; this also writes `.flow-agents/current.json`
95
+ 2. Delegate to `tool-planner`:
96
+ ```
97
+ Goal: <goal>
98
+ Directory: <working directory>
99
+ Constraints: <constraints>
100
+ todo_file: <session file path>
101
+ Workflow artifact root: <path from npm run workflow:sidecar -- current --format path>
102
+ Latest-base confirmation: <current target ref/SHA, revision_freshness, planned base or accepted-gap baseline>
103
+ AC drift findings: <per-AC revalidation, stale assumptions, route-back decisions>
104
+ Evidence expectations: preserve AC ids; require command/test evidence and structured source refs for implementation behavior; require provider/closure `Acceptance Evidence` tables when comments claim behavior
105
+ ```
106
+ 3. tool-planner explores the codebase and writes the plan to the artifact file:
107
+ - `<session-basename>-plan.md`
108
+ - `acceptance.json` with pending criteria from Definition Of Done
109
+ - `handoff.json` with the execution/user-approval next steps
110
+ - use `npm run workflow:sidecar -- init-plan <artifact> --source-request ... --summary ... --next-action ...` when the repository provides it
111
+ - every acceptance criterion should have a stable id, either in Markdown or mirrored in `acceptance.json`
112
+ - every implementation task/wave should list which acceptance criterion ids it supports
113
+ - acceptance criteria for behavior changes should name expected command/test proof and expected source evidence refs or permalink upgrade expectations
114
+ - `acceptance.json` evidence refs must be structured objects, not legacy strings
115
+ - if task-to-acceptance mapping is unclear, send the planner feedback before presenting the plan as ready
116
+ 4. Read the plan artifact
117
+ 5. Update session file: paste plan summary into `## Plan`, set `status: planned`
118
+ 6. Update `state.json` with `status: planned`, phase `planning`, and the next action
119
+ 7. Present the plan to the user
120
+ 8. If the user wants changes, re-delegate to tool-planner with feedback
121
+
122
+ Never rely on conversational memory for the slug. Resolve the active artifact with `npm run workflow:sidecar -- current --format path` and pass that path to delegated agents.
123
+
124
+ ## Definition Of Done Contract
125
+
126
+ Every plan artifact must include the `## Definition Of Done` defined in `context/contracts/planning-contract.md`, including `Stop-short risks` and `Durable docs target`. If the goal is exploratory or uncertain, the plan must still name what the user should be able to take away from the work. Do not let acceptance criteria stop at implementation tasks.
127
+
128
+ Every non-trivial implementation plan must include traceability from requirements to acceptance criteria to execution tasks. At minimum, acceptance criteria need stable ids and each wave/task needs a `Supports:` line referencing those ids. Loose wave names without criterion references are not execution-ready.
129
+
130
+ Every behavior-changing plan must also include evidence traceability expectations. The Definition Of Done should tell workers and verifiers which command/test evidence is expected and which source evidence refs should support claimed behavior. Source refs use the structured evidence ref object from `context/contracts/artifact-contract.md`; before publication they may be local file/line/excerpt refs, and provider-facing comments should upgrade them to immutable GitHub blob permalinks pinned to a commit SHA when available. Plans that expect provider, PR, issue, closure, or final acceptance comments must require an `Acceptance Evidence` table with columns `AC id`, `Status`, `Command/Test Evidence`, `Source Evidence / Permalinks`, and `Gaps`.
131
+
132
+ Every plan artifact must also record `Sandbox mode` using `context/contracts/sandbox-policy.md`. If the needed mode is unclear, choose the smallest safe mode for the plan and list the escalation condition that would require a stronger boundary.
133
+
134
+ ## Structured Sidecars
135
+
136
+ Follow `context/contracts/artifact-contract.md` and `context/contracts/planning-contract.md`.
137
+
138
+ When `npm run workflow:sidecar --` exists, structured sidecars are not optional ceremony. Use the writer commands above, then validate the artifact directory when local validation is available. If the writer is unavailable or blocked, preserve the exact blocker in the Markdown artifact as a `NOT_VERIFIED` gap.
139
+
140
+ Planning owns:
141
+
142
+ - `state.json`: current phase/status and next action
143
+ - `acceptance.json`: criteria from the Definition Of Done, initially `pending`
144
+ - `handoff.json`: summary and execution/user-approval next steps
145
+
146
+ If a target harness cannot write sidecars, record `NOT_VERIFIED` or an explicit gap in the session file instead of pretending the structured state exists.
147
+
148
+ ## Session File Format
149
+
150
+ ```markdown
151
+ # <Goal one-liner>
152
+
153
+ branch: <branch>
154
+ worktree: <worktree>
155
+ created: <date>
156
+ status: planning | planned
157
+ type: plan-work
158
+
159
+ ## Plan
160
+
161
+ Structured plan from tool-planner (pasted from artifact).
162
+
163
+ ## Definition Of Done
164
+
165
+ Copied from the plan artifact. This is the stop condition for delivery.
166
+ ```
167
+
168
+ ## Output
169
+
170
+ - Session file in `.flow-agents/<slug>/` with status `planned`
171
+ - Plan artifact: `<session-basename>-plan.md`
172
+ - Structured sidecars: `state.json`, `acceptance.json`, and `handoff.json`
173
+ - The plan artifact is the source of truth — tool-worker agents read it directly
174
+ - Plan artifact follows `context/contracts/planning-contract.md`
175
+
176
+ {context?}
@@ -0,0 +1,309 @@
1
+ ---
2
+ name: "pull-work"
3
+ description: "Select ready GitHub issues from the executable backlog and prepare them for implementation. Use when choosing what to work on next, reviewing a kanban-style issue board, enforcing WIP limits, grouping issues, deciding worktree isolation, or handing selected work to plan-work."
4
+ ---
5
+
6
+ # Pull Work
7
+
8
+ Select ready backlog work and prepare a bounded execution handoff without implementing it.
9
+
10
+ ## Contract
11
+
12
+ - Use `context/contracts/work-item-contract.md` as the source vocabulary for provider-backed work item shape, provider roles, and capability flags.
13
+ - Read the configured backlog provider dynamically.
14
+ - Select one issue or a coherent issue group.
15
+ - Do not implement code.
16
+ - Do not weaken scope to make execution easier.
17
+ - Do not implement provider settings, provider configuration, or configured-provider discovery; this skill consumes configured provider state and helper outputs when available.
18
+ - Do not reimplement Flow Definition validation or gate expectation semantics. When Flow Definition readiness is relevant, call Flow's validation surface (`flow validate-definition <path> [--json]` or `validateDefinitionWithDiagnostics`) and cite that result.
19
+ - Do not pull unrelated ideas together just because they are nearby in the backlog.
20
+ - Do not invoke `execute-plan`, `review-work`, `verify-work`, `evidence-gate`, or release skills.
21
+ - Hand selected work to `plan-work` only after the pickup gate is satisfied and the user wants planning.
22
+ - When the user wants to pick up work, enforce the full pull-work selection, WIP/shepherding, dependency, grouping, and worktree logic before any planning handoff.
23
+ - Do not hand selected work to `plan-work` until a fresh pickup Probe record exists for the selected item or explicitly bundled group, unless the user is making a direct primitive-only `pull-work` request and explicitly wants the primitive to stop before planning.
24
+ - Every pull-work artifact must correlate to selected backlog refs, shepherding refs for active PRs/sidecars/issues being finished before new work, or `backlog_gap=true` with a route to `idea-to-backlog`; direct audits with no new selection must record `shepherding_item_ids` or `backlog_gap`, not free-floating implementation scope.
25
+ - A stale broad continuation instruction, such as "keep going", "pick up the next two", or "continue after merge", may allow queue inspection but must not bypass per-item pickup Probe evidence.
26
+
27
+ ## Inputs
28
+
29
+ - Repository or working directory.
30
+ - Optional labels, milestone, project board, assignee, or priority filter.
31
+ - Optional WIP limit or current in-progress context.
32
+ - Existing `.flow-agents/<slug>/` artifacts, PRs, and CI/review queues.
33
+
34
+ ## Artifact Contract
35
+
36
+ Create or update `.flow-agents/<slug>/<slug>--pull-work.md` with:
37
+
38
+ - `board_snapshot`: filters, issue list, labels, milestone/provider milestone state, project fields, state, blockers
39
+ - `wip_assessment`: active work, reviews, verification, CI remediation, with personal WIP separated from global conflict context
40
+ - `my_active_work`: local worktrees, dirty branches, open PRs by the current user, active sidecars, and in-flight review/verification/release work owned by the current user
41
+ - `shepherding_candidates`: personal PRs, worktrees, or sidecars that should be reviewed, fixed, published, merged, abandoned, or cleaned before starting more work
42
+ - `stale_worktrees`: worktrees with no open PR, no recent activity, merged/abandoned branches, or unclear ownership that need an explicit keep/remove decision
43
+ - `open_prs_by_me`: open pull requests authored by the current user, including check/review state and whether they need shepherding
44
+ - `global_conflicts`: open PRs, active work, or sidecars by others that overlap selected files, dependencies, release lanes, or provider state
45
+ - `dependency_impacts`: blockers, blocked-by relationships, sequencing constraints, and work that should be prioritized because it unlocks or protects other work
46
+ - `start_new_work_decision`: `proceed`, `shepherd_existing`, `cleanup_required`, `blocked`, or `needs_user`, with the reason and next action
47
+ - `selection`: selected issue(s), rationale, priority, dependencies
48
+ - `selected_item_ids`: provider or local backlog artifact refs selected for pickup, using neutral work item refs when available
49
+ - `shepherding_item_ids`: active PR, sidecar, issue, worktree, or local backlog artifact refs being finished, reviewed, cleaned up, or unblocked before starting new work
50
+ - `backlog_gap`: `true` only when no provider/local backlog item or shepherding item can anchor the artifact, with the gap reason
51
+ - `backlog_gap_route`: route to `idea-to-backlog` or Builder Kit shape, including the prompt/context needed to create a local backlog artifact or provider-backed item
52
+ - `selected_scope`: selected repository, work item refs, whether the selection is single-item, independent-items, or a justified Work Item Group, and the thinnest meaningful slice being handed to planning
53
+ - `priority_rationale`: provider-neutral ranking reason, including delivery outcome, dependency unlocking, urgency, risk, size, readiness, and why higher-visible items were not selected
54
+ - `dependencies`: known blockers, blocked-by items, dependency freshness, cross-repo sequencing constraints, and any dependency checks that are `NOT_VERIFIED`
55
+ - `wip_conflict_notes`: personal WIP gate result, global WIP/conflict notes, file/provider-state/release-lane risks, and whether conflicts block, inform, or require isolation
56
+ - `alignment_questions`: pickup Probe questions asked one at a time, recommended answer, user answer, unresolved question, or reason no question is needed
57
+ - `grouping_check`: thinnest meaningful slice, bundle justification, dependency map, split/keep decision
58
+ - `anchor`: objective, source artifacts, non-goals, done criteria
59
+ - `work_scope`: allowed files/areas, risky areas, coordination notes
60
+ - `worktree_decision`: yes/no, path/branch if known, rationale
61
+ - `worktree_lifecycle`: path, branch, retain-until condition, cleanup owner, cleanup command, and whether cleanup is blocked by an open PR, review, CI, or user decision
62
+ - `handoff`: recommended `plan-work` prompt and acceptance criteria
63
+ - `pickup_gate`: pass/fail/block and reason
64
+ - `pickup_probe`: for Builder Kit build flow only, the recorded Probe decisions, unresolved questions, accepted gaps, planning readiness, expected modified files, sandbox/worktree mode, and conflict risks that `plan-work` must consume
65
+ - `builder_kit_handoff`: when Builder Kit build flow is active, machine-checkable fields `probe_status`, `probe_artifact_ref`, selected item ids, grouping decision, accepted gaps, route reason, and next action
66
+
67
+ ## Workflow
68
+
69
+ ### 1. Read Board State
70
+
71
+ First inspect effective backlog provider settings when the repo provides them:
72
+
73
+ ```bash
74
+ npm run effective-backlog-settings -- --repo-path . --json
75
+ ```
76
+
77
+ If the command returns `status: configured`, use the returned `WorkItemProvider`, `BoardProvider`, filters, and WIP policy as the default board source. Preserve the provider source and settings path in the pull-work artifact. If it returns `status: ask_user` or the helper is unavailable, ask the user which backlog `WorkItemProvider` and `BoardProvider` to use before selecting work. Do not silently assume a repository, project, filters, labels, milestone, or WIP policy.
78
+
79
+ Use `github-cli` / `gh` when available to inspect issues, labels, milestones, project fields, PR links, and blockers.
80
+
81
+ Treat GitHub Issues as a `WorkItemProvider` and GitHub Projects as a `BoardProvider`, mapped through `context/contracts/work-item-contract.md`. Preserve provider-specific values in the artifact when useful, but use the contract's neutral fields for selection, grouping, and handoff.
82
+
83
+ Classify issues:
84
+
85
+ - ready
86
+ - blocked
87
+ - stale
88
+ - in progress
89
+ - related-only
90
+
91
+ When local JSON from `gh issue list/view --json ...` is available, normalize it through the helper before selection:
92
+
93
+ ```bash
94
+ npm run pull-work-provider -- \
95
+ --settings-json context/settings/backlog-provider-settings.json \
96
+ --issues-json /path/to/github-issues.json \
97
+ --resolved-ref kontourai/flow#2=closed
98
+ ```
99
+
100
+ The helper preserves provider refs, project fields, blockers, PR links, and source artifact refs, then emits the work item contract fields plus readiness evidence. Use live provider state for final decisions; fixture output is only test evidence.
101
+
102
+ Before classifying provider-backed work as ready for pickup, fetch the latest target ref when network access and provider credentials are available, then compare the current target SHA to the work item's `planned_base_sha`. Record the current target ref/SHA, planned base ref/SHA, `commits-since`, planned age, changed files since the planned base, and changed-file intersections with `planning_scope_refs` in the pull-work artifact or helper output.
103
+
104
+ Classify revision freshness as:
105
+
106
+ - `fresh`: the planned base matches the current target SHA, or the only newer commits/files are known not to affect the planning scope.
107
+ - `drifted`: the target has moved, but changed files do not materially intersect `planning_scope_refs`; prompt alignment and record accepted decisions before planning may proceed.
108
+ - `stale`: changed files intersect `planning_scope_refs`, contracts, dependencies, or expected execution areas enough that the issue may no longer describe the right slice; route back to `idea-to-backlog` instead of handing directly to `plan-work`.
109
+
110
+ Missing `planned_base_sha` is not fresh. Record it as an explicit `NOT_VERIFIED` or accepted-gap baseline with the concrete fallback baseline used, such as current target ref/SHA plus provider history. Do not invent revision certainty for legacy work items.
111
+
112
+ Return vague work to `idea-to-backlog` instead of inventing scope.
113
+
114
+ ### 2. Enforce WIP And Shepherding
115
+
116
+ Before selecting new work, check whether review, verification, release, or CI remediation is congested. Separate the current user's active work from global conflict context.
117
+
118
+ Personal WIP scan:
119
+
120
+ - Inspect local worktrees and branches for dirty state, unpublished commits, merged branches, abandoned branches, and unclear ownership.
121
+ - Inspect open PRs authored by the current user and record review/check state, requested changes, mergeability, and whether the PR needs shepherding.
122
+ - Inspect active `.flow-agents/<slug>/` sidecars owned by the current user or current session, especially `planning`, `planned`, `in_progress`, `verifying`, `needs_decision`, `not_verified`, `failed`, and `blocked`.
123
+ - Classify personal items into `my_active_work`, `shepherding_candidates`, `stale_worktrees`, and `open_prs_by_me`.
124
+
125
+ Global conflict scan:
126
+
127
+ - Inspect open PRs, active work, and known sidecars from other owners only for file overlap, dependency, sequencing, release-lane, provider-state, or artifact-contract risk.
128
+ - Record those risks in `global_conflicts` and `dependency_impacts`; do not block just because other people have work in progress.
129
+
130
+ Default policy:
131
+
132
+ - Prefer finishing active work over starting new work.
133
+ - Personal WIP may block new work when it exceeds the WIP policy, needs review/CI shepherding, has dirty worktrees, or has unresolved verification/release decisions.
134
+ - Other people's WIP blocks only when it creates concrete file-scope conflict, dependency, sequencing, release, provider-state, or artifact-contract risk for the selected item.
135
+ - Do not pull new implementation work when verification/evidence gates are overloaded.
136
+ - Prefer shepherding an already-open personal PR over starting new implementation when the PR is near merge or needs only checks/review/fixes.
137
+ - Return vague or stale issues to `idea-to-backlog`.
138
+ - Do not select work that conflicts with another active TODO's `modified_files` unless isolation or sequencing is recorded.
139
+ - Always record `start_new_work_decision` before selection handoff. If the decision is not `proceed`, stop with the shepherding, cleanup, blocker, or user-decision next action.
140
+
141
+ ### 3. Select Work
142
+
143
+ Choose one issue or coherent group based on:
144
+
145
+ - priority
146
+ - milestone / delivery outcome alignment
147
+ - dependency unlocking
148
+ - risk
149
+ - size
150
+ - readiness
151
+ - owner / agent availability
152
+ - parallelism opportunity
153
+
154
+ Prefer the smallest coherent unit that can reach evidence and release readiness without leaving dependent half-work.
155
+
156
+ ### Cross-Repo Ranking And Selection
157
+
158
+ When the backlog spans related repositories or product areas, use provider-neutral cross-repo ranking before selection. Compare work items by normalized work item refs from `context/contracts/work-item-contract.md`, not by provider-specific board mechanics. Preserve provider-specific details as evidence, but do not mutate GitHub Projects, provider fields, or cross-repo provider state from this skill.
159
+
160
+ Rank candidates by:
161
+
162
+ - delivery outcome alignment, including milestone, release lane, dogfood target, or explicit user priority
163
+ - dependency unlocking or protection across repositories
164
+ - readiness, acceptance criteria quality, dependency freshness, and provider state
165
+ - risk, size, reversibility, and ability to produce evidence without dependent half-work
166
+ - personal WIP, global conflicts, release-lane conflicts, and file/provider-state overlap
167
+ - owner or agent availability and whether the work is appropriate for the current sandbox/worktree mode
168
+
169
+ The output must make the ranking decision reviewable. Record `selected_scope`, `priority_rationale`, `dependencies`, `wip_conflict_notes`, and `alignment_questions` even when the selection is a single issue. Include why visible alternatives were deferred when they outrank the selected item on one dimension but lose on readiness, dependency, WIP, or scope fit. If ranking cannot be completed from available provider context, ask one alignment question or record the unknown as a blocker or accepted gap before planning.
170
+
171
+ Default to one thinnest meaningful slice. A Work Item Group selection requires explicit justification in `grouping_check` and `selected_scope`; do not group items merely because they share a milestone, label, repository family, or theme.
172
+
173
+ For issue groups, require an explicit grouping check:
174
+
175
+ - the group shares one user outcome and acceptance signal, or
176
+ - one issue hard-blocks another and the dependency sequence is recorded, or
177
+ - splitting would create unsafe or unusable partial delivery.
178
+
179
+ If the relationship is only thematic, split the work and select the thinnest meaningful slice instead.
180
+
181
+ ### Selection Examples
182
+
183
+ Use these compact examples as the expected artifact shape when selecting or rejecting cross-repo work:
184
+
185
+ - **independent docs work**: `selected_scope`: single-item docs update in `kontourai/flow-agents`; `priority_rationale`: small, ready, improves workflow discoverability, and does not block runtime delivery; `dependencies`: none known; `wip_conflict_notes`: no personal WIP block and no global file overlap; `grouping_check`: single-item, no Work Item Group; `alignment_questions`: none needed because scope and docs target are explicit.
186
+ - **Resource Contract audit work**: `selected_scope`: single-item audit of the Resource Contract guidance across the owning repo and referenced docs; `priority_rationale`: selected because it protects later implementation work and resolves contract drift before code changes; `dependencies`: requires current contract docs and provider refs to be fresh, with unknown external repo state recorded as `NOT_VERIFIED` if not checked; `wip_conflict_notes`: block if another active task edits the same contract, otherwise record as global context; `grouping_check`: do not bundle fixes unless the issue explicitly requires audit plus remediation; `alignment_questions`: ask whether to stop at audit evidence or include narrowly scoped doc fixes, with a recommended answer.
187
+ - **dogfood-alpha implementation work**: `selected_scope`: single-item implementation slice in the dogfood-alpha milestone; `priority_rationale`: high delivery alignment and unlocks product dogfood evidence, but only selected if dependencies are closed or explicitly accepted; `dependencies`: list blocked-by issues, required artifacts, and pickup Probe freshness; `wip_conflict_notes`: require worktree isolation when implementation overlaps active files or release lanes; `grouping_check`: Work Item Group only when one item hard-blocks the implementation and the dependency sequence is part of the same acceptance signal; `alignment_questions`: ask the narrow scope question before `plan-work` if the issue could expand into provider adapters or runtime orchestration.
188
+ - **blocked cross-product dependency**: `selected_scope`: no implementation selection; `priority_rationale`: defer because a higher-priority item in another product/repo is blocked by an unresolved dependency or missing provider state; `dependencies`: name the blocker, owner/repo when known, and freshness check; `wip_conflict_notes`: record any release-lane or provider-state conflict as the reason to stop; `grouping_check`: unsafe-group unless explicit dependency sequencing and shared acceptance justify a bundle; `alignment_questions`: ask whether to shepherd/unblock the dependency, return to shaping, or choose the next ready independent item.
189
+
190
+ ### 4. Anchor Check
191
+
192
+ Before planning, restate:
193
+
194
+ - selected issue links
195
+ - objective
196
+ - authoritative artifacts
197
+ - milestone or delivery outcome, including whether it is a real provider milestone, a project field, a label, or intentionally unset
198
+ - non-goals
199
+ - current gate
200
+ - allowed file/work scope
201
+ - done criteria
202
+ - expected verification/evidence/release gates
203
+
204
+ ### 5. Worktree Decision
205
+
206
+ Use `context/contracts/sandbox-policy.md` for the broader execution boundary decision. `pull-work` owns the first `sandbox_mode` recommendation; `execute-plan` may upgrade it if risk increases.
207
+
208
+ Strongly consider isolated worktrees, especially for:
209
+
210
+ - parallel agent execution
211
+ - risky refactors
212
+ - prototype/MVP work
213
+ - multiple agents in one repo
214
+ - large dependency or migration changes
215
+
216
+ Record:
217
+
218
+ - sandbox_mode: `local-read-only`, `local-edit`, `worktree`, `container`, `cloud-sandbox`, or `privileged-integration`
219
+ - worktree used: yes/no
220
+ - path or branch when known
221
+ - rationale
222
+ - worktree lifecycle:
223
+ - `retain_until`: `pr_merged`, `branch_abandoned`, `user_override`, or a documented equivalent
224
+ - `cleanup_owner`: user, orchestrator, or named agent role
225
+ - `cleanup_command`: usually `git worktree remove <path>` after merge/abandonment and optional branch deletion when safe
226
+ - `cleanup_blocked_by`: open PR, pending review, pending CI, dirty files, unpublished commits, or user decision
227
+
228
+ If not using a worktree, state why shared-workspace execution is acceptable.
229
+
230
+ Publishing a branch must retain the worktree for review, CI, and follow-up fixes. Final acceptance, release cleanup, or explicit abandonment owns worktree removal. Do not copy files back into the main checkout by hand; Git is the merge surface.
231
+
232
+ ### 6. Handoff
233
+
234
+ Then invoke or recommend `plan-work` only when the user wants execution planning to begin.
235
+
236
+ ### Builder Kit Pickup Probe Handoff
237
+
238
+ Direct `pull-work` remains a standalone primitive: it may select work, write the pull-work artifact, and stop at a `plan-work` handoff without invoking the productized Builder Kit build flow.
239
+
240
+ For productized pickup, selected work routes through the `design-probe` step as `pickup-probe` before planning. This applies to Builder Kit `build` flow and to "pick up work and build it" requests that intend to continue into delivery. Do not let `plan-work` proceed until the pull-work or plan handoff artifact records the pickup Probe outcome:
241
+
242
+ - goal fit and scope
243
+ - blockers and dependencies
244
+ - dependency freshness
245
+ - acceptance criteria quality
246
+ - provider state
247
+ - risk and stop-short risks
248
+ - sandbox/worktree mode
249
+ - expected modified files and conflict risks
250
+ - planning readiness
251
+ - decisions, unresolved questions, and any accepted gaps
252
+
253
+ Record these machine-checkable handoff fields for every selected productized pickup item or bundle:
254
+
255
+ - `probe_status`: `missing`, `required`, `in_progress`, `passed`, `accepted_gap`, or `blocked`
256
+ - `probe_artifact_ref`: path to the pull-work section or Builder Kit Probe sidecar that contains the pickup Probe evidence
257
+ - `selected_item_ids`: neutral work item refs from `context/contracts/work-item-contract.md`
258
+ - `grouping_decision`: `single-item`, `independent-items`, `justified-bundle`, `unsafe-group`, or `empty-board`
259
+ - `accepted_gaps`: known gaps explicitly accepted for this planning pass
260
+ - `route_reason` and `next_action`
261
+
262
+ Ask one alignment question at a time only when repo/provider context leaves a genuine decision gap. Include a recommended answer with that question. If the user accepts proceeding despite an unresolved question, record the unresolved question as an accepted gap in the handoff artifact before planning.
263
+
264
+ For productized pickup handoff, route `decision_gap` back to `design-probe`; for pickup/planning gaps, that means returning to this pickup Probe record before retrying `plan-work`.
265
+
266
+ If a direct `pull-work` invocation has enough primitive inputs but no productized build intent, stop after the handoff and report the expected next step. If the user then asks to continue into build or delivery, route to `design-probe` / `pickup-probe` before planning.
267
+
268
+ If no ready backlog item exists, route to Builder Kit shape / `idea-to-backlog` instead of inventing implementation work.
269
+
270
+ Direct pull-work audits that inspect WIP, PRs, sidecars, or board state without selecting new implementation work are valid only when the artifact records `shepherding_item_ids` for the active items being finished or `backlog_gap=true` plus `backlog_gap_route` to `idea-to-backlog`. They must stop at shepherding, cleanup, blocker, or shaping guidance and must not create free-floating implementation scope.
271
+
272
+ ## Pickup Gate
273
+
274
+ Selected work is ready when:
275
+
276
+ - `selected_item_ids` records the selected provider/local backlog item refs, or `shepherding_item_ids` records the active PR/sidecar/issue refs being finished before new work, or `backlog_gap=true` records the route to `idea-to-backlog`
277
+ - issue scope is clear
278
+ - acceptance criteria exist
279
+ - dependencies are known
280
+ - selected issue group has explicit bundle justification or is split to one thinnest meaningful slice
281
+ - multi-item selection records independence or bundle justification and expected conflict risks
282
+ - owner/agent path is clear
283
+ - worktree decision is recorded
284
+ - worktree lifecycle is recorded when a worktree is used
285
+ - personal WIP/shepherding scan is recorded
286
+ - global conflicts and dependency impacts are recorded
287
+ - `start_new_work_decision` is `proceed` or an explicit accepted gap allows pickup to continue
288
+ - no higher-priority blocked verification work should be finished first
289
+ - conflict risk with active TODOs is recorded
290
+
291
+ If the gate fails, update the artifact and stop with the blocker.
292
+
293
+ After a merge, automatic continuation may inspect the queue and write a new pull-work artifact, but it cannot enter planning or execution for the next work item until a fresh pickup Probe record exists for that newly selected item or justified group.
294
+
295
+ ## Flow Validation Boundary
296
+
297
+ Flow Agents may need to know whether a Flow Definition referenced by a work item is valid, but Flow owns those semantics. Use one of Flow's published validation surfaces instead of copying checks into this repo:
298
+
299
+ ```bash
300
+ flow validate-definition <path> --json
301
+ ```
302
+
303
+ or, from code that already depends on Flow:
304
+
305
+ ```js
306
+ validateDefinitionWithDiagnostics(definition)
307
+ ```
308
+
309
+ Record the command/API result in the pull-work artifact or evidence sidecar. If Flow is unavailable, mark that readiness subcheck `NOT_VERIFIED` or blocked; do not create a partial validator in Flow Agents.