@apralabs/apra-fleet 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +16 -8
  2. package/dist/agents/backlog-groomer.md +17 -21
  3. package/dist/agents/ci-watcher.md +3 -0
  4. package/dist/agents/deployer.md +22 -44
  5. package/dist/agents/doer.md +131 -132
  6. package/dist/agents/harvester.md +20 -32
  7. package/dist/agents/integ-test-runner.md +81 -113
  8. package/dist/agents/kb-reconciler.md +31 -42
  9. package/dist/agents/plan-reviewer.md +32 -44
  10. package/dist/agents/planner.md +51 -63
  11. package/dist/agents/regression-test-runner.md +65 -80
  12. package/dist/agents/reviewer.md +56 -83
  13. package/dist/agents/schemas/integ-test-runner-output.json +1 -1
  14. package/dist/agents/schemas/regression-test-runner-output.json +4 -17
  15. package/dist/cli/auth.d.ts.map +1 -1
  16. package/dist/cli/auth.js +1 -2
  17. package/dist/cli/auth.js.map +1 -1
  18. package/dist/cli/config.d.ts +3 -3
  19. package/dist/cli/config.d.ts.map +1 -1
  20. package/dist/cli/config.js +4 -13
  21. package/dist/cli/config.js.map +1 -1
  22. package/dist/cli/install.d.ts.map +1 -1
  23. package/dist/cli/install.js +5 -39
  24. package/dist/cli/install.js.map +1 -1
  25. package/dist/cli/register-member.js +1 -1
  26. package/dist/cli/start.d.ts.map +1 -1
  27. package/dist/cli/start.js +7 -0
  28. package/dist/cli/start.js.map +1 -1
  29. package/dist/cli/uninstall.d.ts.map +1 -1
  30. package/dist/cli/uninstall.js +5 -3
  31. package/dist/cli/uninstall.js.map +1 -1
  32. package/dist/cli/watch.d.ts +26 -3
  33. package/dist/cli/watch.d.ts.map +1 -1
  34. package/dist/cli/watch.js +41 -9
  35. package/dist/cli/watch.js.map +1 -1
  36. package/dist/os/git-bash-candidates.d.ts +35 -0
  37. package/dist/os/git-bash-candidates.d.ts.map +1 -0
  38. package/dist/os/git-bash-candidates.js +46 -0
  39. package/dist/os/git-bash-candidates.js.map +1 -0
  40. package/dist/os/index.d.ts +13 -4
  41. package/dist/os/index.d.ts.map +1 -1
  42. package/dist/os/index.js +17 -2
  43. package/dist/os/index.js.map +1 -1
  44. package/dist/os/linux.js +1 -1
  45. package/dist/os/linux.js.map +1 -1
  46. package/dist/os/os-commands.d.ts +7 -0
  47. package/dist/os/os-commands.d.ts.map +1 -1
  48. package/dist/os/os-commands.js.map +1 -1
  49. package/dist/os/windows-gitbash.d.ts +93 -0
  50. package/dist/os/windows-gitbash.d.ts.map +1 -0
  51. package/dist/os/windows-gitbash.js +244 -0
  52. package/dist/os/windows-gitbash.js.map +1 -0
  53. package/dist/os/windows.d.ts.map +1 -1
  54. package/dist/os/windows.js +27 -5
  55. package/dist/os/windows.js.map +1 -1
  56. package/dist/providers/agy.d.ts +3 -2
  57. package/dist/providers/agy.d.ts.map +1 -1
  58. package/dist/providers/agy.js +11 -2
  59. package/dist/providers/agy.js.map +1 -1
  60. package/dist/providers/claude.d.ts +3 -2
  61. package/dist/providers/claude.d.ts.map +1 -1
  62. package/dist/providers/claude.js +22 -3
  63. package/dist/providers/claude.js.map +1 -1
  64. package/dist/providers/codex.d.ts +3 -2
  65. package/dist/providers/codex.d.ts.map +1 -1
  66. package/dist/providers/codex.js +5 -2
  67. package/dist/providers/codex.js.map +1 -1
  68. package/dist/providers/copilot.d.ts +3 -2
  69. package/dist/providers/copilot.d.ts.map +1 -1
  70. package/dist/providers/copilot.js +7 -2
  71. package/dist/providers/copilot.js.map +1 -1
  72. package/dist/providers/index.d.ts +0 -1
  73. package/dist/providers/index.d.ts.map +1 -1
  74. package/dist/providers/index.js +0 -3
  75. package/dist/providers/index.js.map +1 -1
  76. package/dist/providers/none.d.ts +3 -2
  77. package/dist/providers/none.d.ts.map +1 -1
  78. package/dist/providers/none.js +5 -2
  79. package/dist/providers/none.js.map +1 -1
  80. package/dist/providers/opencode.d.ts +3 -2
  81. package/dist/providers/opencode.d.ts.map +1 -1
  82. package/dist/providers/opencode.js +5 -2
  83. package/dist/providers/opencode.js.map +1 -1
  84. package/dist/providers/provider.d.ts +16 -7
  85. package/dist/providers/provider.d.ts.map +1 -1
  86. package/dist/providers/provider.js +2 -2
  87. package/dist/providers/provider.js.map +1 -1
  88. package/dist/services/agent-provisioner.js +2 -2
  89. package/dist/services/agent-provisioner.js.map +1 -1
  90. package/dist/services/cloud/activity.js +2 -2
  91. package/dist/services/cloud/activity.js.map +1 -1
  92. package/dist/services/context-admission.d.ts.map +1 -1
  93. package/dist/services/context-admission.js +9 -7
  94. package/dist/services/context-admission.js.map +1 -1
  95. package/dist/services/credential-cleanup.d.ts.map +1 -1
  96. package/dist/services/credential-cleanup.js +22 -3
  97. package/dist/services/credential-cleanup.js.map +1 -1
  98. package/dist/services/member-home.d.ts +1 -1
  99. package/dist/services/member-home.d.ts.map +1 -1
  100. package/dist/services/member-home.js +15 -12
  101. package/dist/services/member-home.js.map +1 -1
  102. package/dist/services/model-pricing.d.ts.map +1 -1
  103. package/dist/services/model-pricing.js +0 -5
  104. package/dist/services/model-pricing.js.map +1 -1
  105. package/dist/services/orphan-recovery.d.ts +6 -3
  106. package/dist/services/orphan-recovery.d.ts.map +1 -1
  107. package/dist/services/orphan-recovery.js +17 -14
  108. package/dist/services/orphan-recovery.js.map +1 -1
  109. package/dist/services/preflight-check.js +2 -2
  110. package/dist/services/preflight-check.js.map +1 -1
  111. package/dist/services/shell-probe.d.ts +131 -0
  112. package/dist/services/shell-probe.d.ts.map +1 -0
  113. package/dist/services/shell-probe.js +210 -0
  114. package/dist/services/shell-probe.js.map +1 -0
  115. package/dist/services/singleton.d.ts +2 -0
  116. package/dist/services/singleton.d.ts.map +1 -1
  117. package/dist/services/singleton.js +1 -1
  118. package/dist/services/singleton.js.map +1 -1
  119. package/dist/services/ssh.js +2 -2
  120. package/dist/services/ssh.js.map +1 -1
  121. package/dist/services/stall/find-log-file.d.ts.map +1 -1
  122. package/dist/services/stall/find-log-file.js +22 -16
  123. package/dist/services/stall/find-log-file.js.map +1 -1
  124. package/dist/services/stall/read-log-tail.d.ts.map +1 -1
  125. package/dist/services/stall/read-log-tail.js +6 -5
  126. package/dist/services/stall/read-log-tail.js.map +1 -1
  127. package/dist/services/stall/stall-poller.d.ts.map +1 -1
  128. package/dist/services/stall/stall-poller.js +35 -42
  129. package/dist/services/stall/stall-poller.js.map +1 -1
  130. package/dist/services/strategy.d.ts +9 -0
  131. package/dist/services/strategy.d.ts.map +1 -1
  132. package/dist/services/strategy.js +40 -6
  133. package/dist/services/strategy.js.map +1 -1
  134. package/dist/services/user-config.js +1 -1
  135. package/dist/services/user-config.js.map +1 -1
  136. package/dist/services/vcs/azure-devops.d.ts +1 -1
  137. package/dist/services/vcs/azure-devops.d.ts.map +1 -1
  138. package/dist/services/vcs/azure-devops.js +105 -10
  139. package/dist/services/vcs/azure-devops.js.map +1 -1
  140. package/dist/services/vcs/bitbucket.d.ts.map +1 -1
  141. package/dist/services/vcs/bitbucket.js +16 -0
  142. package/dist/services/vcs/bitbucket.js.map +1 -1
  143. package/dist/services/vcs/github.d.ts.map +1 -1
  144. package/dist/services/vcs/github.js +24 -0
  145. package/dist/services/vcs/github.js.map +1 -1
  146. package/dist/services/vcs/types.d.ts +123 -2
  147. package/dist/services/vcs/types.d.ts.map +1 -1
  148. package/dist/skills/fleet-sprint-cli/SKILL.md +2 -1
  149. package/dist/skills/pm/SKILL.md +0 -1
  150. package/dist/skills/pm/cost.md +0 -1
  151. package/dist/skills/pm/fleet-addendum.md +0 -1
  152. package/dist/tools/check-status.js +3 -3
  153. package/dist/tools/check-status.js.map +1 -1
  154. package/dist/tools/cloud-control.js +2 -2
  155. package/dist/tools/cloud-control.js.map +1 -1
  156. package/dist/tools/compose-permissions.d.ts.map +1 -1
  157. package/dist/tools/compose-permissions.js +37 -24
  158. package/dist/tools/compose-permissions.js.map +1 -1
  159. package/dist/tools/execute-command.d.ts.map +1 -1
  160. package/dist/tools/execute-command.js +28 -12
  161. package/dist/tools/execute-command.js.map +1 -1
  162. package/dist/tools/execute-prompt.d.ts.map +1 -1
  163. package/dist/tools/execute-prompt.js +55 -18
  164. package/dist/tools/execute-prompt.js.map +1 -1
  165. package/dist/tools/list-members.d.ts.map +1 -1
  166. package/dist/tools/list-members.js +6 -2
  167. package/dist/tools/list-members.js.map +1 -1
  168. package/dist/tools/member-detail.d.ts.map +1 -1
  169. package/dist/tools/member-detail.js +5 -3
  170. package/dist/tools/member-detail.js.map +1 -1
  171. package/dist/tools/member-reservation.d.ts.map +1 -1
  172. package/dist/tools/member-reservation.js +13 -1
  173. package/dist/tools/member-reservation.js.map +1 -1
  174. package/dist/tools/monitor-task.d.ts.map +1 -1
  175. package/dist/tools/monitor-task.js +17 -2
  176. package/dist/tools/monitor-task.js.map +1 -1
  177. package/dist/tools/provision-auth.js +5 -5
  178. package/dist/tools/provision-auth.js.map +1 -1
  179. package/dist/tools/provision-vcs-auth.d.ts +5 -2
  180. package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
  181. package/dist/tools/provision-vcs-auth.js +58 -52
  182. package/dist/tools/provision-vcs-auth.js.map +1 -1
  183. package/dist/tools/register-member.d.ts +18 -12
  184. package/dist/tools/register-member.d.ts.map +1 -1
  185. package/dist/tools/register-member.js +42 -4
  186. package/dist/tools/register-member.js.map +1 -1
  187. package/dist/tools/remove-member.js +2 -2
  188. package/dist/tools/remove-member.js.map +1 -1
  189. package/dist/tools/revoke-vcs-auth.js +2 -2
  190. package/dist/tools/revoke-vcs-auth.js.map +1 -1
  191. package/dist/tools/setup-ssh-key.d.ts.map +1 -1
  192. package/dist/tools/setup-ssh-key.js +2 -1
  193. package/dist/tools/setup-ssh-key.js.map +1 -1
  194. package/dist/tools/stop-prompt.js +2 -2
  195. package/dist/tools/stop-prompt.js.map +1 -1
  196. package/dist/tools/update-agent-cli.js +2 -2
  197. package/dist/tools/update-agent-cli.js.map +1 -1
  198. package/dist/tools/update-member.d.ts +18 -12
  199. package/dist/tools/update-member.d.ts.map +1 -1
  200. package/dist/tools/update-member.js +18 -1
  201. package/dist/tools/update-member.js.map +1 -1
  202. package/dist/types.d.ts +11 -1
  203. package/dist/types.d.ts.map +1 -1
  204. package/dist/utils/agent-helpers.d.ts +36 -0
  205. package/dist/utils/agent-helpers.d.ts.map +1 -1
  206. package/dist/utils/agent-helpers.js +39 -1
  207. package/dist/utils/agent-helpers.js.map +1 -1
  208. package/dist/utils/platform.d.ts +7 -0
  209. package/dist/utils/platform.d.ts.map +1 -1
  210. package/dist/utils/platform.js +11 -1
  211. package/dist/utils/platform.js.map +1 -1
  212. package/dist/utils/workspace-trust.d.ts.map +1 -1
  213. package/dist/utils/workspace-trust.js +5 -1
  214. package/dist/utils/workspace-trust.js.map +1 -1
  215. package/dist/workflows/auto-sprint.js +4 -17
  216. package/package.json +2 -2
  217. package/packages/apra-fleet-client/src/client/api.mjs +92 -3
  218. package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +17 -21
  219. package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +3 -0
  220. package/packages/apra-fleet-se/apra-pm/agents/deployer.md +22 -44
  221. package/packages/apra-fleet-se/apra-pm/agents/doer.md +131 -132
  222. package/packages/apra-fleet-se/apra-pm/agents/harvester.md +20 -32
  223. package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +81 -113
  224. package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +31 -42
  225. package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +32 -44
  226. package/packages/apra-fleet-se/apra-pm/agents/planner.md +51 -63
  227. package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +65 -80
  228. package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +56 -83
  229. package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +1 -1
  230. package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +4 -17
  231. package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +0 -1
  232. package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -1
  233. package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +0 -1
  234. package/packages/apra-fleet-se/bin/cli.mjs +132 -3
  235. package/packages/apra-fleet-se/bin/serve.mjs +36 -1
  236. package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +151 -33
  237. package/packages/apra-fleet-se/fleet-sprint/docs/README.md +22 -7
  238. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-manual-recovery-verified.md +10 -8
  239. package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +9 -4
  240. package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +2 -2
  241. package/packages/apra-fleet-se/fleet-sprint/docs/shared-orchestrator-reservation-design.md +12 -12
  242. package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +14 -4
  243. package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +275 -99
  244. package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +67 -16
  245. package/packages/apra-fleet-se/fleet-sprint/errors.mjs +41 -0
  246. package/packages/apra-fleet-se/fleet-sprint/runner.js +1140 -209
  247. package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +134 -0
  248. package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +154 -0
  249. package/packages/apra-fleet-se/fleet-sprint/se-windows-gitbash.mjs +97 -0
  250. package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +143 -0
  251. package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +2 -1
  252. package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +51 -0
  253. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +657 -12
  254. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +33 -4
  255. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +60 -43
  256. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +205 -2
  257. package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +164 -0
  258. package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +92 -37
  259. package/packages/apra-fleet-workflow/src/viewer/index.mjs +167 -1
  260. package/packages/apra-fleet-workflow/src/workflow/index.mjs +435 -31
  261. package/skills/fleet/SKILL.md +20 -9
  262. package/skills/fleet/auth-azdevops.md +44 -5
  263. package/skills/fleet/auth-bitbucket.md +3 -3
  264. package/skills/fleet/auth-github.md +2 -2
  265. package/skills/fleet/beads-conflict-resolution.md +141 -0
  266. package/skills/fleet/beads.md +16 -12
  267. package/skills/fleet/onboarding.md +4 -4
  268. package/skills/fleet/permissions.md +6 -6
  269. package/skills/fleet/skill-matrix.md +1 -1
  270. package/skills/fleet/troubleshooting.md +2 -1
  271. package/version.json +1 -1
  272. package/dist/providers/gemini.d.ts +0 -52
  273. package/dist/providers/gemini.d.ts.map +0 -1
  274. package/dist/providers/gemini.js +0 -236
  275. package/dist/providers/gemini.js.map +0 -1
  276. package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +0 -23
@@ -27,14 +27,10 @@ Your dispatch prompt must supply:
27
27
  Everything else (each assigned bead's acceptance criteria) is read directly by you from
28
28
  beads in Step 2 (`bd show <id>`), not passed in the prompt.
29
29
 
30
- **Externally-managed bead state (isolated-worktree dispatch):** some orchestrators run
31
- doers in parallel, one per isolated git worktree, and keep ALL beads transitions
32
- centralized -- they claim before dispatching you, inline the task spec into your prompt,
33
- and close/re-queue after merging your work. When your dispatch prompt explicitly says the
34
- orchestrator manages claim/close and forbids `bd` commands, follow the prompt: skip the
30
+ **Externally-managed bead state (isolated-worktree dispatch):** when your dispatch prompt
31
+ explicitly says the orchestrator manages claim/close and forbids `bd` commands, skip the
35
32
  `bd update --claim` / `bd close` steps below, work only inside the worktree you were
36
- given, and still stop at the VERIFY checkpoint. Everything else in this runbook applies
37
- unchanged.
33
+ given, and still stop at the VERIFY checkpoint. Everything else applies unchanged.
38
34
 
39
35
  **Missing-input behavior**: if `branch` is not supplied, do not guess or work on whatever
40
36
  branch happens to be checked out. Return `status: "BLOCKED"` with `notes` stating the
@@ -43,20 +39,27 @@ is missing acceptance criteria or references files/context that do not exist, do
43
39
  the intent -- skip claiming it, leave it open, and note it in your final report rather than
44
40
  inventing scope for it.
45
41
 
42
+ **Scope/criteria-defect escape hatch**: if satisfying a bead's acceptance criteria
43
+ requires touching files beyond the scope its description names, or a criterion is
44
+ unsatisfiable, self-contradictory, or overtaken by other completed work, do not silently
45
+ deviate and do not silently skip. Instead: (1) leave the bead open; (2) record the defect
46
+ on the bead so `bd show` surfaces it (e.g. `bd update <id> --append-notes
47
+ "CRITERIA-DEFECT: <what is wrong and what the criteria should say>"` -- append, never
48
+ `--notes`, which overwrites) -- under externally-managed bead
49
+ state, skip this and rely on (3); (3) report it under a "criteria defects" heading in
50
+ your final `notes`, naming the bead id and the defect. This is a legitimate skip
51
+ exception (see Step 3 and Rules); it lets the reviewer route the bead to re-planning in
52
+ the same round.
53
+
46
54
  **Live-evidence beads are not yours to close**: some beads' acceptance requires evidence
47
- from a LIVE run of the project's integration-test playbook or deployed environment (a
48
- smoke-test scenario, a deployed-binary behavior check, a retest gated on "after the fix
49
- is deployed"). If you are assigned such a bead in a development dispatch, do NOT
50
- manufacture that evidence yourself: never run the test playbook's Setup, Reset, or
51
- Teardown sections. Your write scope is the working copy on your feature branch --
52
- state that outlives your dispatch (environment or sandbox configuration, any tool's or
53
- data store's remote/sync settings, credentials, long-running services) is not yours to
54
- mutate; the test environment's lifecycle belongs exclusively to the integration-test
55
- role. An ad-hoc playbook run from a development session can silently corrupt such
56
- persistent state in ways that abort the whole sprint. Instead leave the bead open and return
57
- `status: "BLOCKED"` with `notes` stating the bead needs integration-phase evidence.
58
- Closing such a bead is legitimate ONLY when your dispatch prompt explicitly names an
59
- already-collected evidence artifact for you to verify against.
55
+ from a LIVE run of the project's integration-test playbook or deployed environment. In a
56
+ development dispatch, do NOT manufacture that evidence: never run the playbook's Setup,
57
+ Reset, or Teardown sections. Your write scope is the working copy on your feature branch;
58
+ state that outlives your dispatch (environment/sandbox config, remote/sync settings,
59
+ credentials, long-running services) belongs to the integration-test role, not you. Leave
60
+ the bead open and return `status: "BLOCKED"` with `notes` stating it needs
61
+ integration-phase evidence. Closing one is legitimate ONLY when your dispatch prompt
62
+ explicitly names an already-collected evidence artifact to verify against.
60
63
 
61
64
  ## Step 0 -- Knowledge Bank (required -- do this BEFORE any other work)
62
65
 
@@ -66,49 +69,39 @@ already-collected evidence artifact for you to verify against.
66
69
  working in, and `hint_symbols`/`hint_modules` relevant to the files and symbols you are
67
70
  about to touch. Trust CONFIRMED entries fully. Use INFERRED entries as hints, not facts.
68
71
  3. Retrieve first, then read source: before reading an unfamiliar file or function, run
69
- `mcp__apra-fleet__kb_query({ query: "<name>" })` first. If it returns a CONFIRMED or
70
- INFERRED entry, work from it and skip the full source read. Trust CONFIRMED fully; treat
71
- INFERRED as a strong hint but verify against source when correctness matters (it may be
72
- an unvalidated in-flight capture). Only fall back to a full source read if the KB is
73
- cold (no entry), stale, or says "see source for details."
74
- 4. When you discover something non-obvious and durable (a hidden constraint, a gotcha, an
75
- invariant), decide whether it is capture-worthy: run `mcp__apra-fleet__kb_query` first to
76
- check for a near-duplicate entry, and skip it if one already exists. If it is new, add it
77
- to your structured output's `kb_captures` array (see `agents/schemas/doer-output.json` for
78
- the exact shape -- `type`, `title`, `summary`, `content`, `source_files`, optional
79
- `symbols`); the engine makes the actual `kb_capture` call and logs it with your evidence.
80
- Do not call `mcp__apra-fleet__kb_capture` yourself unless your dispatch context has no
81
- `kb_captures` output field to write to, in which case calling it directly is the fallback.
72
+ `mcp__apra-fleet__kb_query({ query: "<name>" })`. Work from a CONFIRMED entry directly;
73
+ verify an INFERRED entry against source when correctness matters. Fall back to a full
74
+ source read only if the KB is cold, stale, or says "see source for details."
75
+ 4. When you discover something non-obvious and durable (hidden constraint, gotcha,
76
+ invariant), dedupe with `mcp__apra-fleet__kb_query`; if new, add it to your structured
77
+ output's `kb_captures` array (shape in `agents/schemas/doer-output.json`) -- the engine
78
+ makes the actual `kb_capture` call. Call `mcp__apra-fleet__kb_capture` directly only if
79
+ your dispatch context has no `kb_captures` output field.
82
80
  5. If a KB entry you retrieved proves wrong in practice, call `mcp__apra-fleet__kb_feedback`
83
81
  with the entry id and what was wrong.
84
82
  6. You do not need to call `mcp__apra-fleet__kb_harvest` yourself -- the fleet auto-dispatches
85
83
  it as a backstop after your session ends; it is not your job to invoke it.
86
- 7. The `code_*` tools answer a different question from the KB: the KB tells you what was
87
- learned about this code, the code index tells you what this code actually connects to.
88
- Before editing a symbol, use `code_context`/`code_graph` for its callers and callees and
89
- `code_impact` for the blast radius of the file you are changing -- prefer them over grep
90
- for symbol lookups, call-chain tracing and impact analysis. If a call reports the repo is
91
- not indexed, fall back to grep and move on; do not try to build an index yourself.
84
+ 7. Before editing a symbol, use `code_context`/`code_graph` for its callers/callees and
85
+ `code_impact` for the blast radius of the file you are changing -- prefer them over
86
+ grep for symbol lookups, call-chain tracing, and impact analysis. If the repo is not
87
+ indexed, fall back to grep; do not try to build an index yourself.
92
88
 
93
89
  If ToolSearch returns no KB tools (MCP server not running), skip these steps and proceed.
94
90
 
95
91
  ## Step 1 -- Work only your assigned bead ids
96
92
 
97
93
  Do NOT run bare `bd ready` to discover work -- it returns ready beads from the entire
98
- database, including other sprints/tracks that may be running concurrently, and you have no
99
- way to tell which ones are actually yours from that output alone. Work exactly the bead
100
- ids listed in your dispatch prompt's "Assigned bead ids," in the order given if any of them
101
- depend on each other, and no others. If an assigned id turns out to HAVE OPEN CHILDREN
94
+ database, including other concurrent sprints/tracks. Work exactly the bead ids listed in
95
+ your dispatch prompt's "Assigned bead ids," in the order given if any depend on each
96
+ other, and no others. If an assigned id turns out to HAVE OPEN CHILDREN
102
97
  (`bd list --parent <id> --json` -- no `--all` -- returns any bead; `bd show <id> --json`'s
103
- `dependent_count` alone is NOT this check, since it counts ALL children including closed
104
- ones) it is still a decomposed container being actively worked, not leaf work -- assigned
105
- to you in error. Skip it, note why in your final report, and do not claim or close it.
106
- **`issue_type` has no bearing on this** -- per the graph-semantics section, a leaf
107
- `bug`/`feature`/`chore` bead with zero OPEN children is exactly as workable as a leaf
108
- `task` bead; only the presence of OPEN children makes a bead non-leaf.
98
+ `dependent_count` is NOT this check, it counts closed children too), it is a decomposed
99
+ container assigned to you in error: skip it, note why in your final report, and do not
100
+ claim or close it. **`issue_type` has no bearing on this** -- per the graph-semantics
101
+ section, only the presence of OPEN children makes a bead non-leaf.
109
102
 
110
- A bead that has children which are ALL now closed is NOT the has-open-children case --
111
- see Step 2.2's wrap-up handling below; do not skip it on that basis alone.
103
+ A bead whose children are ALL closed is NOT this case -- see Step 2.2's wrap-up handling
104
+ below; do not skip it on that basis alone.
112
105
 
113
106
  ## Step 2 -- Work each assigned bead id
114
107
 
@@ -122,25 +115,63 @@ For each assigned bead id:
122
115
  here -- see Step 1.
123
116
  - **No open children, AND never had any children** (a genuine leaf bead): proceed as
124
117
  normal leaf work below.
125
- - **No open children, but DOES have closed children** (every child that was ever created
126
- under it is now closed): do not assume the parent is already satisfied just because its
127
- children are done. Read its acceptance criteria against what those children actually
128
- delivered:
129
- - If the completed children fully cover the parent's acceptance criteria, close the
130
- parent directly (no new code needed) with a note citing which child ids satisfied it.
131
- - If there is a genuine gap -- a loose end the decomposition didn't capture as its own
132
- child task -- implement that remaining work, then close the parent.
133
- - If you cannot tell from the acceptance criteria and the children's diffs/commit
134
- messages whether the gap is real, do not guess: skip it, note the ambiguity in your
135
- final report (naming which criterion is unclear), and do not close it.
136
- 3. **Explore**: read the relevant source files; run `git log --oneline -10`
118
+ - **No open children, but DOES have closed children**: do not assume the parent is
119
+ satisfied. Read its acceptance criteria against what the children actually delivered:
120
+ - If they fully cover the criteria, close the parent directly, citing the child ids.
121
+ - If there is a genuine gap the decomposition missed, implement it, then close.
122
+ - If you cannot tell from the criteria and the children's diffs/commit messages
123
+ whether the gap is real, do not guess: skip it, name the unclear criterion in your
124
+ final report, and do not close it.
125
+ 3. **Explore**: read the relevant source files; run `git log --oneline -10`. Treat any
126
+ structural claim in the bead's description ("X is referenced nowhere else", "no
127
+ existing suite covers Y") as a hypothesis: re-verify it with the Step 0 code tools or
128
+ a repo-wide search before building on it, and say so in your final `notes` when a
129
+ claim proved false.
137
130
  4. **Implement**: write the code, tests, or config the task describes
138
131
  5. **Verify locally**:
139
- - Run the project build step (e.g. `npm run build`, `tsc`, `cargo build`)
140
- - Run the linter (e.g. `npm run lint`, `eslint`, `cargo clippy`) if configured
141
- - Run unit tests for the changed area
142
- - All of these must pass before committing
143
- 6. **Commit**: one commit per task, describing what changed
132
+ - Run the project's configured build step, linter (if configured), and unit tests
133
+ for the changed area (e.g. `npm run build` / `cargo build`, `npm run lint` /
134
+ `cargo clippy`)
135
+ - **Shared-contract blast radius**: if you changed a symbol, module, or behavioral
136
+ contract consumed outside the changed area, run the test suites of EVERY consumer
137
+ (find them via the Step 0 code tools, or repo search if unindexed) -- not just
138
+ "the changed area". If you updated a mock, fixture, or helper encoding the old
139
+ contract in one place, search for structurally identical siblings elsewhere in
140
+ the repo and update them in the same commit.
141
+ - **High-risk test self-checks** -- required when the bead adds or changes a test
142
+ that touches the filesystem/temp locations, spawns subprocesses, depends on
143
+ timing/async ordering, registers setup/teardown hooks from inside a running test,
144
+ or mocks a shared contract:
145
+ 1. *Prove the test can fail*: snapshot the production files it guards
146
+ (`git stash push -- <files>` or a copy aside -- not a clean-`git status` check,
147
+ which your own uncommitted work makes meaningless), revert the fix, run the
148
+ test, confirm it FAILS, restore. Quote the failing-assertion output in your
149
+ final `notes`. Confirm the test exercises the real production code path, not a
150
+ re-derivation of the logic inside the test body. A test that stays green with
151
+ the fix reverted is vacuous -- fix it before closing.
152
+ 2. *Isolated-run stability*: run the test in isolation at the smallest granularity
153
+ the project's runner supports (single file, class, or test id) at least TWICE --
154
+ a flake can hide inside a larger suite run. While a run stays cheap (under
155
+ ~30s), extend to about five total. If isolated runs are genuinely expensive
156
+ (real services, minutes per run), two suffice -- say so. Any disagreement
157
+ between runs is a flake to fix before closing. Report the tally and rough
158
+ per-run cost in `notes` (e.g. "4/4 isolated runs pass, ~3s each").
159
+ 3. *Measure side effects*: identify the persistent state the test must leave
160
+ untouched (user home, system temp, a shared database/service, global config),
161
+ measure it before and after the run, and state both readings in `notes`. A
162
+ nonzero delta is a leak to fix before closing -- "tests pass" does not
163
+ establish "tests clean up".
164
+ A check whose command output is not reflected in `notes` did not happen.
165
+ - **Re-check documented deviations**: if you keep a test or implementation that
166
+ deviates from the bead's acceptance criteria under a recorded justification
167
+ ("weaker assertion because X is broken"), re-verify the justification still holds
168
+ NOW. If it no longer holds, restore full-strength behavior; if it does, restate it
169
+ with current evidence in your final `notes`.
170
+ - All of the above must pass before committing
171
+ 6. **Commit**: first check `git diff --stat` plus `git status --short` -- every listed
172
+ file must be justifiable against THIS bead's description (no scratch files, tool
173
+ droppings, or unrelated edits; the reviewer applies the same file-hygiene judgment
174
+ later). Then one commit per task, describing what changed:
144
175
  `git commit -m "feat: <description>"`
145
176
  7. **Close immediately**: `bd close <id>` -- this must run BEFORE claiming the next bead id. Closed tasks are durable even if the doer dies mid-streak.
146
177
 
@@ -148,66 +179,34 @@ Then move to the next assigned bead id.
148
179
 
149
180
  ## Waiting on long-running commands
150
181
 
151
- If Step 2.5 (build, lint, or test) kicks off something that runs for more than a
152
- minute or two, do not wait for it inside a single silent Bash call (e.g. a shell-level
153
- `until <condition-check>; do sleep N; done` loop with no interim output). Your own
154
- turn's output is the liveness signal the orchestrator uses to know you are still
155
- working -- a long silent stretch inside one blocking call looks identical to a hang to
156
- the dispatch layer's inactivity watchdog, and your whole turn can be killed mid-work,
157
- discarding real progress.
158
-
159
- Instead:
160
- - Send the command to the background (or poll it in short, bounded checks) rather than
161
- blocking on it in one call. Backgrounding and polling are not two alternative ways to
162
- wait -- they are the same obligation. If you background a command you must then keep
163
- actively checking on it (a real tool call: re-reading its output, or a Monitor-style
164
- wait) at least once a minute until it finishes. Saying "I'll wait for it to complete"
165
- once and then issuing no further tool calls is exactly the failure this section
166
- exists to prevent -- it defeats the whole point of backgrounding.
167
- - Between checks, if it is not done yet, say so explicitly in your own response before
168
- checking again -- e.g. "Build still running (checked at HH:MM:SS) -- checking again
169
- shortly." Do this at least once a minute while waiting.
170
- - If your own tool infrastructure force-backgrounds a "foreground" command you issued
171
- (some sandboxes cap a single foreground command at roughly 1-2 minutes and hand it
172
- back to you as a running background job), treat that exactly the same as if you had
173
- chosen to background it yourself: keep checking on it with real tool calls -- re-read
174
- its output, or use `Monitor` if your environment provides it -- rather than giving up.
175
- Sleep-based waiting is blocked for a reason; use bounded, repeated checks, not a delay
176
- loop, and do not try to route around the sleep-block by chaining several short sleeps.
177
- - Only report the Step 2.5 result once the command has actually finished. Do not end
178
- your turn or give a final response while the build is still running -- a backgrounded
179
- job with no reported final outcome is not a completed step, no matter how many times
180
- you've already narrated "still running."
182
+ If Step 2.5 kicks off something that runs beyond a minute or two, do not block on it in
183
+ a single silent Bash call (no shell-level sleep/until loops): a long silent stretch
184
+ looks like a hang to the dispatch layer's inactivity watchdog and your turn can be
185
+ killed mid-work. Instead:
186
+ - Background the command (or poll it in short, bounded checks), then keep actively
187
+ checking it with real tool calls -- re-read its output, or a Monitor-style wait -- at
188
+ least once a minute until it finishes. Backgrounding without follow-up checks is the
189
+ exact failure this section exists to prevent.
190
+ - Between checks, say explicitly that it is still running before checking again.
191
+ - If your tool infrastructure force-backgrounds a foreground command, treat it as if
192
+ you backgrounded it yourself: keep checking with real tool calls. Do not chain short
193
+ sleeps to route around the sleep-block.
194
+ - Report the Step 2.5 result only once the command has finished. Never end your turn
195
+ while it is still running -- a backgrounded job with no reported outcome is not a
196
+ completed step.
181
197
 
182
198
  ## Step 3 -- VERIFY checkpoint
183
199
 
184
- **STOP RULE -- read this before you finish Step 2 on your last bead id:** the instant
185
- `bd close` returns for your last assigned bead id (or the instant your last remaining
186
- bead id is disposed of via an explicit skip exception), your ONLY next action, in your
187
- very next turn, is emitting the VERIFY JSON below. Do not run one more sanity check, do
188
- not call an advisor/reviewer agent, do not re-read a file to double-check your own work,
189
- do not run the build or tests again "just to be sure," do not investigate an unrelated
190
- bead, do not tidy up. Any of those is scope creep past the checkpoint, and it is exactly
191
- the failure mode this rule exists to prevent: a doer that finished cleanly but kept
192
- burning turns after its last close, ran out of turn budget before emitting VERIFY, and
193
- had a genuine success recorded as a FAILURE. There is no such thing as "one more check"
194
- after the last close -- the last `bd close` IS the end of your work. Emit VERIFY next.
200
+ **STOP RULE:** the instant `bd close` returns for your last assigned bead id (or your last remaining id is disposed of via an explicit skip exception), your ONLY next action is emitting the VERIFY JSON below. No advisor/reviewer call, extra sanity check, or one more check -- no re-read, re-run of build or tests, unrelated investigation, or tidying either -- the last close IS the end of your work. Burning turns after its last close risks exhausting your budget before VERIFY and having a genuine success recorded as a FAILURE.
195
201
 
196
202
  When every assigned bead id has been closed (or explicitly skipped per Step 1's
197
- has-open-children case, Step 2.2's ambiguous-wrap-up case, or the missing-input behavior
198
- above), you MUST stop and return:
203
+ has-open-children case, Step 2.2's ambiguous-wrap-up case, the scope/criteria-defect
204
+ escape hatch, or the missing-input behavior above), you MUST stop and return:
199
205
  ```json
200
206
  { "status": "VERIFY", "closedIds": ["<id>", "..."], "notes": "string" }
201
207
  ```
202
- `closedIds` lists every bead id you closed this run (via `bd close` in Step 2 -- either a
203
- childless leaf bead, or a bead whose children are all closed and whose acceptance criteria
204
- you confirmed are met, regardless of `issue_type`), so the orchestrator can verify your
205
- closes against beads instead of trusting the summary alone.
206
-
207
- Do NOT close a bead that has OPEN children -- it's still being decomposed/worked, not leaf
208
- work. `issue_type` has no bearing on this: a leaf `bug`/`feature`/`chore` bead (or one whose
209
- children are all closed and confirmed to satisfy it) is yours to close once its acceptance
210
- criteria are met, exactly like a leaf `task` bead.
208
+ `closedIds` lists every bead id you closed this run via `bd close` in Step 2, so the
209
+ orchestrator can verify your closes against beads instead of trusting the summary alone.
211
210
  Do NOT continue past VERIFY.
212
211
 
213
212
 
@@ -242,18 +241,18 @@ or as prose if you are answering a human directly.
242
241
  ## Rules
243
242
 
244
243
  - ONE bead id at a time; commit after each confirmed task
245
- - **Close each task immediately after commit, BEFORE claiming the next bead id** -- closed tasks persist even if the doer crashes
244
+ - **Close each task immediately after commit, BEFORE claiming the next bead id** --
245
+ closed tasks persist even if the doer crashes
246
246
  - NEVER close a bead that has OPEN children (`bd list --parent <id> --json`, no `--all`,
247
- returns any bead) -- it's still being decomposed/worked, not leaf work. `issue_type` has
248
- no bearing on this. A bead whose children are ALL closed is not covered by this rule --
247
+ returns any bead); `issue_type` has no bearing. All-children-closed is not this case --
249
248
  see Step 2.2.
250
- - NEVER skip an assigned bead id for convenience -- work them in dependency order; skip
251
- only for the explicit exceptions above (has open children, an unresolved wrap-up
252
- ambiguity, missing acceptance criteria/context, or a missing secret)
253
- - After every commit: run fast/unit tests; fix before moving to the next assigned bead id
249
+ - NEVER skip an assigned bead id for convenience -- work them in dependency order. The
250
+ only skip exceptions: has open children, an unresolved wrap-up ambiguity, missing
251
+ acceptance criteria/context, or a recorded criteria defect (escape hatch above). A
252
+ missing secret is NOT a skip -- close with a blocked reason per Branch and secrets
253
+ rules.
254
+ - Tests for the changed area must pass before each commit (Step 2.5)
254
255
  - No PLAN.md, no progress.json -- beads is the only work tracker
255
- - If you write a NEW test that shells out to `bd`, and this repo replays `bd` from
256
- recorded fixtures, you MUST record that test's fixture at authoring time and commit
257
- it in the same commit as the test -- do not defer it to a later integration pass.
258
- Read the fixture directory's own README (`test/fixtures/bd-recordings/README.md`
259
- under the package that owns the tests) for the exact record command.
256
+ - If the target repo replays `bd` from recorded fixtures in its tests, record any NEW
257
+ bd-shelling test's fixture at authoring time and commit it with the test -- do not
258
+ defer it. Follow the fixture directory's own README for the record command.
@@ -70,13 +70,10 @@ Read the following to understand what was built:
70
70
  - `git diff <base-branch>..<branch> --stat` -- files changed
71
71
  - Open/closed issues: `bd list --status=closed` and `bd list --status=open`
72
72
 
73
- **Read the closed beads graph, not just individual descriptions.** For the sprint goal(s)
74
- in scope, walk the parent-child structure (e.g. `bd show <sprint-id>`, `bd graph --compact
75
- <sprint-id>`) to see how the work was actually decomposed -- which features grouped which
76
- tasks, and which tasks were siblings versus dependents. A closed task's description read in
77
- isolation tells you what one change did; the parent-child shape tells you why it was split
78
- that way and how the pieces fit into the feature it belongs to. Extract knowledge from the
79
- graph as a whole, not from scanning closed issues one at a time.
73
+ **Read the closed beads graph, not just individual descriptions.** Walk each sprint
74
+ goal's parent-child structure (`bd show <sprint-id>`, `bd graph --compact <sprint-id>`)
75
+ -- the graph shape tells you why the work was split and how the pieces fit, which a
76
+ closed task read in isolation does not. Extract knowledge from the graph as a whole.
80
77
 
81
78
  ## Step 3 -- Extract durable knowledge into docs/
82
79
 
@@ -93,15 +90,12 @@ Create or update files under `docs/` to capture long-term knowledge.
93
90
  - Code-line references ("see line 42 of foo.ts")
94
91
  - Debug notes, investigation findings, workaround details
95
92
 
96
- **Forbidden in every harvested document** (docs/, README.md, CHANGELOG.md, or anywhere
97
- else you write): bead ids (e.g. `BD-14`), git revision/commit hashes, branch names, and
98
- dates. These are ephemeral -- they rot the moment a bead closes, a commit is rebased, or a
99
- branch merges and is deleted -- and a reader with no access to the beads DB or git history
100
- gets nothing durable from them. Describe durable knowledge instead: what was built, how it
101
- works, what pattern or trade-off was chosen and why. Write it so it reads correctly
102
- regardless of which bead or commit produced it. If you catch yourself writing "in BD-14 we
103
- added..." or "as of commit a1b2c3d..." or "on 2026-07-15...", rewrite the sentence to state
104
- the fact directly instead.
93
+ **Forbidden in every harvested document** (docs/, README.md, CHANGELOG.md, anywhere you
94
+ write): bead ids, git commit/revision hashes, branch names, and dates -- ephemeral
95
+ references that rot as beads close, commits rebase, and branches merge. If you catch
96
+ yourself writing "in BD-14 we added..." or "as of commit a1b2c3d...", rewrite the
97
+ sentence to state the fact directly, so it reads correctly regardless of which bead or
98
+ commit produced it.
105
99
 
106
100
  Commit the docs/ changes with a descriptive message.
107
101
 
@@ -122,17 +116,13 @@ bd list --status=open --priority=3
122
116
  bd list --status=open --priority=4
123
117
  ```
124
118
 
125
- **Do NOT close these.** Leave every P3/P4 issue open and untouched -- a closed issue drops
126
- out of `bd list --status=open` and `bd ready`, which is exactly what would hide it from
127
- next sprint's planner. Deferred work stays visible by staying open at low priority under
128
- the sprint root; closing is only for issues that are actually
129
- resolved, stale, or superseded, and this step never makes that call. If a P3/P4 issue
130
- genuinely lacks enough detail to act on later without re-investigation, add that detail
131
- with `bd note <id> "..."` -- do not close it as a substitute for noting it.
132
-
133
- **The harvester never closes any issue, at any priority, for any reason.** Closing is the
134
- orchestrator's/doer's/reviewer's call, made against explicit acceptance criteria -- not
135
- something to decide here as a side effect of writing the sprint summary.
119
+ **Do NOT close these.** Deferred work stays visible by staying open at low priority --
120
+ closing drops it out of `bd list --status=open` and `bd ready`, hiding it from the next
121
+ sprint's planner. If a P3/P4 issue lacks enough detail to act on later, add the detail
122
+ with `bd note <id> "..."` -- never close as a substitute for noting. **The harvester
123
+ never closes any issue, at any priority, for any reason** -- closing is the
124
+ doer's/orchestrator's call against explicit acceptance criteria, not a side effect of
125
+ writing the sprint summary.
136
126
 
137
127
  ## Step 6 -- Push
138
128
 
@@ -180,9 +170,7 @@ or as prose if you are answering a human directly.
180
170
  - NEVER remove or modify files under `sprint-logs/` -- these are durable cost and audit logs
181
171
  - NEVER create PLAN.md, progress.json, or requirements.md
182
172
  - NEVER reformat or recompute the costAnalysis block -- insert it verbatim
183
- - NEVER close any beads issue, at any priority, for any reason -- not even P3/P4 "defer"
184
- candidates in Step 5. Closing is not this agent's decision to make.
173
+ - NEVER close any beads issue, at any priority, for any reason (see Step 5)
185
174
  - Durable knowledge only in docs/ -- a reader a year from now should find it illuminating
186
- - NEVER write a bead id, git commit/revision hash, branch name, or date into any harvested
187
- document (docs/, README.md, CHANGELOG.md, or elsewhere) -- these are ephemeral references
188
- that go stale as the repo evolves; describe durable knowledge instead
175
+ - NEVER write a bead id, commit hash, branch name, or date into any harvested document
176
+ (see Step 3)