xtrm-tools 0.7.16 → 0.7.18

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 (264) hide show
  1. package/.xtrm/config/hooks.json +2 -0
  2. package/.xtrm/config/instructions/agents-top.md +2 -1
  3. package/.xtrm/registry.json +432 -707
  4. package/.xtrm/skills/default/creating-service-skills/scripts/bootstrap.py +82 -156
  5. package/.xtrm/skills/default/creating-service-skills/scripts/scaffolder.py +73 -121
  6. package/.xtrm/skills/default/hook-development/references/patterns.md +1 -1
  7. package/.xtrm/skills/default/last30days/scripts/test-v1-vs-v2.sh +2 -2
  8. package/.xtrm/skills/default/planning/SKILL.md +75 -29
  9. package/.xtrm/skills/default/releasing/SKILL.md +163 -57
  10. package/.xtrm/skills/default/security-pipeline/SKILL.md +192 -0
  11. package/.xtrm/skills/default/security-pipeline/scripts/security-bootstrap.sh +294 -0
  12. package/.xtrm/skills/default/security-pipeline/templates/.githooks/pre-push.template +39 -0
  13. package/.xtrm/skills/default/security-pipeline/templates/.github/workflows/gitleaks.yml +33 -0
  14. package/.xtrm/skills/default/security-pipeline/templates/.github/workflows/osv-scanner.yml +33 -0
  15. package/.xtrm/skills/default/security-pipeline/templates/.github/workflows/semgrep.yml +41 -0
  16. package/.xtrm/skills/default/security-pipeline/templates/.gitleaks.toml +44 -0
  17. package/.xtrm/skills/default/security-pipeline/templates/.pre-commit-config.yaml +67 -0
  18. package/.xtrm/skills/default/security-pipeline/templates/.semgrepignore +46 -0
  19. package/.xtrm/skills/default/security-pipeline/templates/scripts/security-scan.sh +57 -0
  20. package/.xtrm/skills/default/security-pipeline/templates/scripts/semgrep-diff.sh +68 -0
  21. package/.xtrm/skills/default/session-close-report/SKILL.md +167 -6
  22. package/.xtrm/skills/default/sync-docs/SKILL.md +1 -1
  23. package/.xtrm/skills/default/update-specialists/SKILL.md +204 -77
  24. package/.xtrm/skills/default/update-xt/SKILL.md +270 -4
  25. package/.xtrm/skills/default/updating-service-skills/scripts/drift_detector.py +22 -0
  26. package/.xtrm/skills/default/using-kpi/SKILL.md +47 -5
  27. package/.xtrm/skills/default/using-script-specialists/SKILL.md +7 -5
  28. package/.xtrm/skills/default/using-specialists/SKILL.md +13 -12
  29. package/.xtrm/skills/default/using-specialists-auto/SKILL.md +137 -0
  30. package/.xtrm/skills/default/using-specialists-v2/SKILL.md +15 -22
  31. package/.xtrm/skills/default/using-specialists-v3/SKILL.md +1074 -0
  32. package/.xtrm/skills/default/vaultctl/SKILL.md +2 -2
  33. package/CHANGELOG.md +91 -3
  34. package/cli/dist/index.cjs +12425 -3770
  35. package/cli/dist/index.cjs.map +1 -1
  36. package/cli/package.json +9 -3
  37. package/package.json +27 -7
  38. package/packages/pi-extensions/extensions/xtrm-ui/index.ts +76 -1
  39. package/packages/pi-extensions/package.json +1 -1
  40. package/.xtrm/config/pi/extensions/custom-footer/.pi/structured-returns/83051fe4-97da-4e2c-bdaa-343b32f4e714.combined.log +0 -7
  41. package/.xtrm/config/pi/extensions/custom-footer/.pi/structured-returns/83051fe4-97da-4e2c-bdaa-343b32f4e714.stderr.log +0 -0
  42. package/.xtrm/config/pi/extensions/custom-footer/.pi/structured-returns/83051fe4-97da-4e2c-bdaa-343b32f4e714.stdout.log +0 -7
  43. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/LICENSE +0 -22
  44. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/README.md +0 -29
  45. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.d.ts +0 -3
  46. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.d.ts.map +0 -1
  47. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.js +0 -2
  48. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/index.js.map +0 -1
  49. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.d.ts +0 -8
  50. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.d.ts.map +0 -1
  51. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.js +0 -27
  52. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chrome.js.map +0 -1
  53. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.d.ts +0 -11
  54. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.d.ts.map +0 -1
  55. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.js +0 -100
  56. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/crypto.js.map +0 -1
  57. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.d.ts +0 -25
  58. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.d.ts.map +0 -1
  59. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.js +0 -104
  60. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/linuxKeyring.js.map +0 -1
  61. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.d.ts +0 -10
  62. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.d.ts.map +0 -1
  63. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.js +0 -293
  64. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/shared.js.map +0 -1
  65. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.d.ts +0 -10
  66. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.d.ts.map +0 -1
  67. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.js +0 -26
  68. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqlite/windowsDpapi.js.map +0 -1
  69. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.d.ts +0 -7
  70. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.d.ts.map +0 -1
  71. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.js +0 -51
  72. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteLinux.js.map +0 -1
  73. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.d.ts +0 -7
  74. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.d.ts.map +0 -1
  75. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.js +0 -60
  76. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteMac.js.map +0 -1
  77. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.d.ts +0 -7
  78. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.d.ts.map +0 -1
  79. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.js +0 -38
  80. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromeSqliteWindows.js.map +0 -1
  81. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.d.ts +0 -5
  82. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.d.ts.map +0 -1
  83. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.js +0 -33
  84. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/linuxPaths.js.map +0 -1
  85. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.d.ts +0 -24
  86. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.d.ts.map +0 -1
  87. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.js +0 -30
  88. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/macosKeychain.js.map +0 -1
  89. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.d.ts +0 -11
  90. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.d.ts.map +0 -1
  91. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.js +0 -43
  92. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/paths.js.map +0 -1
  93. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.d.ts +0 -8
  94. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.d.ts.map +0 -1
  95. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.js +0 -41
  96. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsMasterKey.js.map +0 -1
  97. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.d.ts +0 -8
  98. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.d.ts.map +0 -1
  99. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.js +0 -53
  100. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/chromium/windowsPaths.js.map +0 -1
  101. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.d.ts +0 -8
  102. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.d.ts.map +0 -1
  103. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.js +0 -27
  104. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edge.js.map +0 -1
  105. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.d.ts +0 -7
  106. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.d.ts.map +0 -1
  107. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.js +0 -53
  108. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteLinux.js.map +0 -1
  109. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.d.ts +0 -8
  110. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.d.ts.map +0 -1
  111. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.js +0 -60
  112. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteMac.js.map +0 -1
  113. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.d.ts +0 -7
  114. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.d.ts.map +0 -1
  115. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.js +0 -38
  116. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/edgeSqliteWindows.js.map +0 -1
  117. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.d.ts +0 -6
  118. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.d.ts.map +0 -1
  119. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.js +0 -257
  120. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/firefoxSqlite.js.map +0 -1
  121. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.d.ts +0 -8
  122. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.d.ts.map +0 -1
  123. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.js +0 -71
  124. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/inline.js.map +0 -1
  125. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.d.ts +0 -6
  126. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.d.ts.map +0 -1
  127. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.js +0 -173
  128. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/providers/safariBinaryCookies.js.map +0 -1
  129. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.d.ts +0 -26
  130. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.d.ts.map +0 -1
  131. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.js +0 -195
  132. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/public.js.map +0 -1
  133. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.d.ts +0 -121
  134. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.d.ts.map +0 -1
  135. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.js +0 -2
  136. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/types.js.map +0 -1
  137. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.d.ts +0 -2
  138. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.d.ts.map +0 -1
  139. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.js +0 -18
  140. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/base64.js.map +0 -1
  141. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.d.ts +0 -8
  142. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.d.ts.map +0 -1
  143. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.js +0 -110
  144. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/exec.js.map +0 -1
  145. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.d.ts +0 -2
  146. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.d.ts.map +0 -1
  147. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.js +0 -32
  148. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/expire.js.map +0 -1
  149. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.d.ts +0 -2
  150. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.d.ts.map +0 -1
  151. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.js +0 -13
  152. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/fs.js.map +0 -1
  153. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.d.ts +0 -2
  154. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.d.ts.map +0 -1
  155. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.js +0 -7
  156. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/hostMatch.js.map +0 -1
  157. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.d.ts +0 -5
  158. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.d.ts.map +0 -1
  159. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.js +0 -58
  160. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/nodeSqlite.js.map +0 -1
  161. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.d.ts +0 -2
  162. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.d.ts.map +0 -1
  163. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.js +0 -27
  164. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/origins.js.map +0 -1
  165. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.d.ts +0 -2
  166. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.d.ts.map +0 -1
  167. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.js +0 -8
  168. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/dist/util/runtime.js.map +0 -1
  169. package/.xtrm/skills/default/last30days/scripts/lib/vendor/bird-search/node_modules/@steipete/sweet-cookie/package.json +0 -40
  170. package/.xtrm/skills/default/planning/evals/evals.json +0 -19
  171. package/.xtrm/skills/default/quality-gates/evals/evals.json +0 -181
  172. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/FINAL-EVAL-SUMMARY.md +0 -75
  173. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/edge-case-auto-fix-verification/with_skill/outputs/response.md +0 -59
  174. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/edge-case-mixed-language-project/with_skill/outputs/response.md +0 -60
  175. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/eval-summary.md +0 -105
  176. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/partial-install-python-only/with_skill/outputs/response.md +0 -93
  177. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/python-refactor-request/with_skill/outputs/response.md +0 -104
  178. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/quality-gate-error-fix/with_skill/outputs/response.md +0 -74
  179. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-general-chat/with_skill/outputs/response.md +0 -18
  180. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-math-question/with_skill/outputs/response.md +0 -18
  181. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/should-not-trigger-unrelated-coding/with_skill/outputs/response.md +0 -56
  182. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/tdd-guard-blocking-confusion/with_skill/outputs/response.md +0 -67
  183. package/.xtrm/skills/default/quality-gates/workspace/iteration-1/typescript-feature-with-tests/with_skill/outputs/response.md +0 -97
  184. package/.xtrm/skills/default/sync-docs/evals/evals.json +0 -89
  185. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/benchmark.json +0 -293
  186. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/benchmark.md +0 -13
  187. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/eval_metadata.json +0 -27
  188. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/outputs/result.md +0 -210
  189. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/run-1/grading.json +0 -28
  190. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/run-1/timing.json +0 -1
  191. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/outputs/result.md +0 -101
  192. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/run-1/grading.json +0 -28
  193. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/run-1/timing.json +0 -5
  194. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/timing.json +0 -5
  195. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/eval_metadata.json +0 -27
  196. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/outputs/result.md +0 -198
  197. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/run-1/grading.json +0 -28
  198. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/run-1/timing.json +0 -1
  199. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/outputs/result.md +0 -94
  200. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/run-1/grading.json +0 -28
  201. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/run-1/timing.json +0 -1
  202. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/eval_metadata.json +0 -27
  203. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/outputs/result.md +0 -237
  204. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/run-1/grading.json +0 -28
  205. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/run-1/timing.json +0 -1
  206. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/outputs/result.md +0 -134
  207. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/run-1/grading.json +0 -28
  208. package/.xtrm/skills/default/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/run-1/timing.json +0 -1
  209. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/benchmark.json +0 -297
  210. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/benchmark.md +0 -13
  211. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/eval_metadata.json +0 -27
  212. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/outputs/result.md +0 -137
  213. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/run-1/grading.json +0 -92
  214. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/run-1/timing.json +0 -1
  215. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/outputs/result.md +0 -134
  216. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/run-1/grading.json +0 -86
  217. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/run-1/timing.json +0 -1
  218. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/eval_metadata.json +0 -27
  219. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/outputs/result.md +0 -193
  220. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/run-1/grading.json +0 -72
  221. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/run-1/timing.json +0 -1
  222. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/outputs/result.md +0 -211
  223. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/run-1/grading.json +0 -91
  224. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/run-1/timing.json +0 -5
  225. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/eval_metadata.json +0 -27
  226. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/outputs/result.md +0 -182
  227. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/run-1/grading.json +0 -95
  228. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/run-1/timing.json +0 -1
  229. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/outputs/result.md +0 -222
  230. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/run-1/grading.json +0 -88
  231. package/.xtrm/skills/default/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/run-1/timing.json +0 -5
  232. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/benchmark.json +0 -298
  233. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/benchmark.md +0 -13
  234. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/eval_metadata.json +0 -27
  235. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/outputs/result.md +0 -125
  236. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/run-1/grading.json +0 -97
  237. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/run-1/timing.json +0 -5
  238. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/outputs/result.md +0 -144
  239. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/run-1/grading.json +0 -78
  240. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/run-1/timing.json +0 -5
  241. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/eval_metadata.json +0 -27
  242. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/outputs/result.md +0 -104
  243. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/run-1/grading.json +0 -91
  244. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/run-1/timing.json +0 -5
  245. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/outputs/result.md +0 -79
  246. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/run-1/grading.json +0 -82
  247. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/run-1/timing.json +0 -5
  248. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/eval_metadata.json +0 -27
  249. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase1_context.json +0 -302
  250. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase2_drift.txt +0 -33
  251. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase3_analysis.json +0 -114
  252. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase4_fix.txt +0 -118
  253. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase5_validate.txt +0 -38
  254. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/result.md +0 -158
  255. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/run-1/grading.json +0 -95
  256. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/run-1/timing.json +0 -5
  257. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/outputs/result.md +0 -71
  258. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/run-1/grading.json +0 -90
  259. package/.xtrm/skills/default/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/run-1/timing.json +0 -5
  260. package/.xtrm/skills/default/test-planning/evals/evals.json +0 -23
  261. package/.xtrm/skills/default/using-specialists/SKILL.safe.md +0 -1082
  262. package/.xtrm/skills/default/using-specialists/SKILL.ultra.md +0 -1082
  263. package/.xtrm/skills/default/using-specialists/evals/evals.json +0 -68
  264. package/packages/pi-extensions/.serena/project.yml +0 -130
@@ -0,0 +1,1074 @@
1
+ ---
2
+ name: using-specialists-v3
3
+ description: >
4
+ Canonical specialist orchestration skill. Use proactively for substantial work
5
+ that should be delegated, tracked, reviewed, fixed, tested, or merged through
6
+ specialists: code review, debugging, implementation, planning, doc sync,
7
+ security checks, multi-step chains, integration-phase reconciliation,
8
+ debugger-restitch on conflicting chains, pre-dispatch conflict-cluster
9
+ mapping, test-failure-map epics, and questions about specialist workflow.
10
+ version: 3.3
11
+ ---
12
+
13
+ # Using Specialists v3
14
+
15
+ You are the orchestrator. Turn user intent into a strong bead contract, choose right specialist from live registry, launch chain, monitor it, consume results, drive fixes, and publish through specialist merge path.
16
+
17
+ Keep skill practical. Core behavior belongs here; volatile detail stays in live commands.
18
+
19
+ > **MANDATORY — Run on skill load and before every new substantial task or epic:**
20
+ > ```bash
21
+ > specialists list --full
22
+ > ```
23
+ > Do not rely on remembered roles, models, or permissions. The registry is the source of truth.
24
+ > Run it again before dispatching any new chain or starting any epic — specialists change between sessions.
25
+
26
+ ## Specialist File Locations
27
+
28
+ Specialists live in three layers. Know which layer you are reading or editing:
29
+
30
+ | Layer | Path | Purpose |
31
+ |-------|------|---------|
32
+ | Package (shipped) | `config/specialists/*.specialist.json` | Canonical role definitions; versioned with the repo |
33
+ | User override | `.specialists/user/*.specialist.json` | Per-project customizations; wins over package layer for same name |
34
+ | Default mirror | `.specialists/default/*.specialist.json` | Repo-managed mirror of package defaults; overrides package fallback |
35
+
36
+ The loader resolves in priority order: user → default-mirror → package. A same-name file in `.specialists/user/` fully replaces the package version for that specialist. When creating or editing a specialist, use `config/specialists/` for shipped roles and `.specialists/user/` for project-specific overrides. Never edit `.specialists/default/` by hand — it is managed by `update-specialists`.
37
+
38
+ `specialists list --full` shows the resolved set (which layer each specialist comes from) so you always know what will actually run.
39
+
40
+ ### Editing Specialist Fields: `sp edit` Is Required
41
+
42
+ Direct JSON editing is error-prone and bypasses schema validation. Use `sp edit` for all field changes — it validates dot-paths, handles array append/remove, and writes to the correct layer.
43
+
44
+ ```bash
45
+ # Read a field
46
+ sp edit executor --get specialist.execution.model
47
+
48
+ # Set a field (schema-validated)
49
+ sp edit executor specialist.execution.model <model-id>
50
+
51
+ # Set prompt.system or task_template from a file (required for multi-line content)
52
+ sp edit executor --set specialist.prompt.system _ --file ./my-system-prompt.txt
53
+
54
+ # Append or remove tags
55
+ sp edit executor --set specialist.metadata.tags review,security --append
56
+ sp edit executor --set specialist.metadata.tags old-tag --remove
57
+
58
+ # Apply a named preset (run sp edit --list-presets for current options)
59
+ sp edit executor --preset power
60
+ sp edit executor --preset cheap --dry-run # preview first
61
+
62
+ # Target a specific scope when name exists in multiple layers
63
+ sp edit executor --scope user --set specialist.execution.model <model-id>
64
+
65
+ # Bulk read across all specialists
66
+ sp edit --all --get specialist.execution.model
67
+ ```
68
+
69
+ **When `sp edit` is required vs. direct JSON edit:**
70
+ - Model, thinking level, timeout, tags, permission, description → always `sp edit`
71
+ - `prompt.system` or `task_template` longer than one line → `sp edit --file`
72
+ - Structural schema fields (execution flags, output_schema) → `sp edit` with dot-path
73
+ - Net-new specialist creation → `specialists-creator` skill, then `sp edit` for tuning
74
+ - Bulk cross-specialist reads → `sp edit --all --get <path>`
75
+ - Available presets → `sp edit --list-presets` (do not hardcode; varies by install)
76
+
77
+ ## Orchestration Discipline (Paranoid Mode)
78
+
79
+ You are an orchestrator, not a hero. Move slowly enough to be correct.
80
+
81
+ - Run `specialists list --full` and `sp help` again at the start of every new substantial task. Do not skip because "you remember." Roles, models, and flags drift between sessions.
82
+ - Re-read the bead before dispatch. If you cannot defend each contract field out loud, the bead is not ready.
83
+ - Never dispatch a chain you cannot describe end-to-end (which specialist, which bead, which workspace, which merge target).
84
+ - Verify worktree and job state before and after each dispatch with `sp ps` and `git worktree list`. Drift is silent until merge.
85
+ - Treat reviewer `PARTIAL` and code-sanity `FINDINGS` as mandatory fix loops, not advisory noise.
86
+ - When unsure, prefer extra explorer/debugger passes over an over-eager executor. Wrong code merged is more expensive than slow research.
87
+
88
+ ## Project-Specific Specialists
89
+
90
+ Users define their own specialists in `.specialists/user/*.specialist.json` to fit project shape (domain knowledge, language, framework, conventions). These override package defaults and may not match generic role descriptions.
91
+
92
+ - Always run `specialists list --full` to see the resolved set, including project-specific roles, before choosing.
93
+ - Read `sp help` and the specialist's description/tags to confirm fit. Do not assume a name maps to its package-default behavior — a `.specialists/user/` override may have a different prompt, model, or scope.
94
+ - Pick the project-specific specialist when its role matches the task shape. Do not fall back to a generic role just because it is more familiar.
95
+ - If the task does not match any project-specific role, use the package default and consider whether a new project-specific specialist would help (use `specialists-creator` skill).
96
+
97
+ ## Advisory Passes Are Part Of Every Chain
98
+
99
+ For any substantive diff, the chain shape is:
100
+
101
+ ```
102
+ executor → code-sanity (if smell) → security-auditor (if risk surface) → reviewer → merge
103
+ ```
104
+
105
+ Triggers:
106
+
107
+ - `code-sanity` — cheap simplification and type-safety screen. Run when diff smells overcomplicated, brittle, or duplicates logic. Output is advisory; reviewer still gates merge.
108
+ - `security-auditor` — scan-only risk surface review. Run when diff touches auth, secrets, input handling (user/network/file), dependency lockfiles, agent/MCP/config surfaces, or token-storage paths. Output is advisory; executor applies fixes.
109
+ - Both run with their own bead and `--job <exec-job>` so they enter the executor workspace.
110
+
111
+ Routing patterns (cross-referenced from Integration / Restitch / E2E sections):
112
+
113
+ - **Cherry-pick integration**: advisory passes run on the last executor job in each chain BEFORE the squash-commit step.
114
+ - **Debugger-restitch**: advisory passes run on the debugger's job AFTER the restitch turn, BEFORE reviewer.
115
+ - **E2E smoke phase**: security-auditor runs on the cumulative integrated diff if any landed chain touched a sensitive surface, BEFORE smoke completes.
116
+ - **Reviewer rebuttal**: code-sanity / security-auditor findings count as legitimate evidence to support or rebut a reviewer verdict.
117
+
118
+ Skipping triggers:
119
+
120
+ - Diff is purely additive (new files only, no existing-symbol modifications) → advisory passes optional; note new-file scope in the chain handoff.
121
+ - Test-only diffs (entirely under `test/` or `tests/`) → skip security-auditor by default; still run code-sanity if test logic is non-trivial.
122
+ - Anything else, skipping is an escalation event — never skip security-auditor on auth/secrets/input changes "because the diff looks small." Small diffs hide the worst regressions.
123
+
124
+ ## Monitoring Long-Running Jobs: Sleep Timers Are Mandatory
125
+
126
+ Specialists run async. You will lose the chain if you do not actively monitor it.
127
+
128
+ **Required pattern after every dispatch:**
129
+
130
+ ```bash
131
+ sp run <role> --bead <id> --background ... # dispatch
132
+ sleep 10 && sp ps # confirm started
133
+ ```
134
+
135
+ Then cycle sleeps based on average completion time per role, checking `sp ps` each cycle:
136
+
137
+ | Role | Typical duration | Initial sleep cycle |
138
+ |------|------------------|---------------------|
139
+ | sync-docs, changelog-keeper | 60–180s | `sleep 60` then `sleep 60` |
140
+ | code-sanity, security-auditor | 60–180s | `sleep 60` then `sleep 60` |
141
+ | reviewer | 90–240s | `sleep 90` then `sleep 60` |
142
+ | explorer, debugger, planner, overthinker | 120–300s | `sleep 120` then `sleep 90` |
143
+ | executor | 180–600s+ | `sleep 180` then `sleep 120` |
144
+ | test-runner | varies with suite | start at `sleep 120`, adjust |
145
+
146
+ Rules:
147
+ - After dispatch, **always** `sleep 10 && sp ps` first to confirm the job is `running`, not stuck in `queued` or already `failed`.
148
+ - Then sleep again per the table; check `sp ps` each cycle.
149
+ - Do not poll faster than every 30s after the initial check — it wastes context.
150
+ - When status flips to `completed`, run `sp result <job-id>` immediately to consume output before context grows.
151
+ - If a job exceeds 2× its typical duration without completing, inspect with `sp feed <job-id>` before assuming hang.
152
+
153
+ You are not "done" until every dispatched job is `completed` or `failed` and consumed.
154
+
155
+ ## Worktree Cleanup After Merge
156
+
157
+ `sp merge` and `sp epic merge` clean up automatically when they succeed. If you fall back to manual `git merge` (e.g., doc-only chains), you own cleanup.
158
+
159
+ After every merge, verify:
160
+
161
+ ```bash
162
+ git worktree list # any orphaned worktrees from this session?
163
+ sp ps # any leftover jobs?
164
+ git worktree prune # drop stale worktree metadata
165
+ ```
166
+
167
+ If a feature/epic worktree remains after merge, remove it explicitly:
168
+
169
+ ```bash
170
+ git worktree remove <path>
171
+ git branch -d <merged-branch> # only after confirming merged
172
+ ```
173
+
174
+ `sp ps` must have no active jobs and no unresolved terminal problems before session close. If it only shows old terminal history that you have intentionally acknowledged, run `sp clean --ps --dry-run` and then `sp clean --ps` to soft-hide those rows from the default dashboard. This does not delete SQLite history or change job status; use `sp ps --include-cleaned` or `sp ps --all` for audit visibility. Stale worktrees and stale jobs both block future dispatches via the stale-base guard.
175
+
176
+ ## When To Delegate
177
+
178
+ Use specialists for substantial work: codebase exploration, debugging, implementation, review, test execution, planning, documentation sync, security/config audit, release publication, and multi-chain epics.
179
+
180
+ Do small deterministic edits directly when scope is already obvious and delegation would add ceremony. Do not self-investigate or self-implement a substantial task just because you can read files faster; audit trail and specialist review are part of workflow.
181
+
182
+ ## Non-Negotiable Rules
183
+
184
+ 1. `--bead` is prompt for tracked work.
185
+ 2. Do not dispatch until bead is usable task contract.
186
+ 3. Never use `--prompt` to supplement tracked work. Update bead instead.
187
+ 4. Choose by task shape, not habit. Check `specialists list --full` when roles may have changed.
188
+ 5. Explorer/debugger answer uncertainty before executor writes code.
189
+ 6. Executor starts only when scope, constraints, and validation are clear.
190
+ 7. Reviewer uses its own bead and executor workspace via `--job <exec-job>`.
191
+ 8. Keep executor/debugger jobs alive through review so they can be resumed.
192
+ 9. Merge specialist-owned work with `sp merge` or `sp epic merge`, not manual `git merge`.
193
+ 10. Specialists must not perform destructive or irreversible operations.
194
+ 11. Treat tests as evidence: classify failures as in-scope, pre-existing, or infrastructure before starting fix loop.
195
+ 12. Drive routine stages autonomously once task is clear. Escalate only for human judgment, destructive actions, repeated crashes, or reviewer `FAIL`.
196
+ 13. The orchestrator NEVER edits code directly. Conflict resolution, even mechanical, goes through a debugger or executor specialist. Manual conflict resolution always escalates to the operator.
197
+
198
+ ## Escalation Matrix
199
+
200
+ | Action | Default | Always escalate to operator |
201
+ |---|---|---|
202
+ | Code edit | Specialist only | (never orchestrator-direct) |
203
+ | Cherry-pick onto integration branch | Auto if non-overlapping | Conflict requiring manual edits |
204
+ | Manual conflict resolution | Never | Always |
205
+ | Force push | Never | Always |
206
+ | Branch delete | Never | Always |
207
+ | Stash pop where conflict expected | Auto | Stash conflict that destroys session-start state |
208
+ | `bd dolt fsck --revive-journal-with-data-loss` | Never | Always — explicit data-loss warning |
209
+ | `sp epic merge` | Auto if all children PASSed | Skip if any child reviewer-FAILed |
210
+ | Skip `code-sanity` on substantive diff | Auto-skip only on test-only or new-file-only diffs | Always escalate before skipping on multi-file production diff |
211
+ | Skip `security-auditor` on diff touching auth/secrets/input/agent-config | Never | Always — sensitive-surface diffs always get the pass |
212
+ | `sp stop <job>` | Auto when job is done/stale | Never on actively-running unless context blown |
213
+ | `git push origin <branch>` | Auto for chain branches | Force-push or delete-remote always |
214
+ | `npm publish` | Never | Always |
215
+ | Dependency bump | Auto for security-patch bumps | Major/minor bumps escalate |
216
+ | Config file schema-changing edit | Never | Always |
217
+
218
+ ## Live Registry And Help
219
+
220
+ Use live registry for role details, permissions, current models, and skills:
221
+
222
+ ```bash
223
+ specialists list --full
224
+ ```
225
+
226
+ Use help for command flags and subcommands:
227
+
228
+ ```bash
229
+ sp help
230
+ sp run --help
231
+ sp ps --help
232
+ sp feed --help
233
+ sp result --help
234
+ sp resume --help
235
+ sp steer --help
236
+ sp stop --help
237
+ sp finalize --help
238
+ sp merge --help
239
+ sp epic --help
240
+ ```
241
+
242
+ Do not rely on stale remembered flags when help is available.
243
+
244
+ ## Writing Bead Contracts Well
245
+
246
+ Bead quality controls specialist quality. A title-only bead produces wandering output because specialist has no contract to optimize against. Write contract before dispatch. Tighten vague scope before launch.
247
+
248
+ Bad bead:
249
+
250
+ ```text
251
+ TITLE: Fix bug
252
+ PROBLEM: Something is broken.
253
+ SUCCESS: It works.
254
+ SCOPE: src/
255
+ NON_GOALS: N/A
256
+ CONSTRAINTS: Be careful.
257
+ VALIDATION: Tests pass.
258
+ OUTPUT: Done.
259
+ ```
260
+
261
+ Good bead:
262
+
263
+ ```text
264
+ TITLE: Fix feed cursor regression in sp result
265
+ PROBLEM: specialists feed follow skips events after restart because cursor tracks count, not last seq.
266
+ SUCCESS: feed follow resumes from last seen seq; result still reads terminal output.
267
+ SCOPE: src/cli/feed.ts, src/cli/result.ts, tests/unit/cli/feed.test.ts
268
+ NON_GOALS: No new runtime format, no DB schema change, no unrelated poll changes.
269
+ CONSTRAINTS: Preserve existing job IDs, keep backwards-compatible CLI output, avoid file-based fallback drift.
270
+ VALIDATION: Add regression test for restart resume; run targeted CLI tests.
271
+ OUTPUT: Changed files, test evidence, residual risks.
272
+ ```
273
+
274
+ Fix three bad smells fast:
275
+
276
+ - Title-only bead. Add problem, scope, validation, output.
277
+ - Vague SCOPE like `src/`. Name files, symbols, or bounded docs.
278
+ - Missing VALIDATION. Say what proves done, not just that work is “finished.”
279
+
280
+ What differs: orchestrator writes contract before dispatch, so specialist does less guessing and more useful work.
281
+
282
+ ## Dependency Linking
283
+
284
+ Link beads with correct edge shape. The edge tells orchestrator what blocks what, what is only related, and what should auto-nest.
285
+
286
+ - `bd dep add <issue> <depends-on>`: issue depends on depends-on; depends-on blocks issue. Use this for hard sequencing. [source: bd dep --help]
287
+ - `bd dep <blocker> --blocks <blocked>`: reverse phrasing of same edge; blocker-first reads better when thinking in blockers. [source: bd dep --help; CLAUDE.md lines 62-64]
288
+ - `bd dep relate <a> <b>`: non-blocking `relates_to` link. Use for context, not order. [source: bd dep --help; CLAUDE.md lines 64, 200-204]
289
+ - `bd create --parent <epic-id>`: epic-child edge; auto-names child `.1`, `.2`, … and adds parent edge. Use for chain members that must live under epic. [source: CLAUDE.md lines 49-50, 154-156; bd create --help]
290
+ - `bd create --deps discovered-from:<id>`: follow-up work discovered from source bead. Use when one bead reveals new tracked work. [source: CLAUDE.md lines 50, 62-65; bd create --help]
291
+
292
+ Use each form for a different reason:
293
+
294
+ - `add` / `--blocks` for must-happen-before dependency.
295
+ - `relate` for soft linkage with no schedule effect.
296
+ - `--parent` for epic ownership and child naming.
297
+ - `discovered-from:` for spawned follow-up beads.
298
+
299
+ What differs: orchestrator chooses edge type deliberately, so graph stays correct for chain execution, epic publish, and follow-up traceability.
300
+
301
+ ## Bead Contract By Bead Type
302
+
303
+ Use shape that fits specialist.
304
+
305
+ Task/epic bead:
306
+
307
+ ```text
308
+ PROBLEM: User-facing or project-facing objective.
309
+ SUCCESS: End-state across all child beads.
310
+ SCOPE: Area of project affected.
311
+ REFERENCES: Optional files, skills, or docs specialist reads only if work needs them.
312
+ NON_GOALS: Boundaries for entire effort.
313
+ CONSTRAINTS: Sequencing, compatibility, branch/merge rules.
314
+ VALIDATION: Final checks before close.
315
+ OUTPUT: What orchestrator reports back.
316
+ ```
317
+
318
+ `SCOPE` is always loaded as context. `REFERENCES` is progressive disclosure: name what exists, but do not force load unless task needs it. Use this when a file would bloat payload today, like citing a huge skill file in scope and dragging in all lines before specialist even knows it must read them.
319
+
320
+ Example:
321
+
322
+ ```text
323
+ SCOPE: config/skills/using-specialists-v3/SKILL.md, docs/specialists/handoff-schema.md
324
+ REFERENCES: config/skills/prompt-improving/SKILL.md (xml_core conventions), sibling beads per-turn-handoff-schema and bead-id-verbatim once landed
325
+ ```
326
+
327
+ Explorer bead:
328
+
329
+ ```text
330
+ PROBLEM: What is unknown.
331
+ SUCCESS: Questions answered with evidence.
332
+ SCOPE: Code areas, docs, commands, or symbols to inspect.
333
+ NON_GOALS: No implementation, no broad audit outside scope.
334
+ CONSTRAINTS: READ_ONLY, cite files/symbols/flows.
335
+ VALIDATION: Findings cite evidence.
336
+ OUTPUT: Findings, risks, recommended implementation track, stop condition.
337
+ ```
338
+
339
+ Debugger bead:
340
+
341
+ ```text
342
+ PROBLEM: Symptom, regression, or failing test.
343
+ SUCCESS: Root cause plus minimal fix path.
344
+ SCOPE: Logs, reproduction, code paths, and related tests.
345
+ NON_GOALS: No broad refactor.
346
+ CONSTRAINTS: Preserve behavior outside fault line.
347
+ VALIDATION: Repro steps and diagnosis.
348
+ OUTPUT: Root cause, fix options, confidence, remaining unknowns.
349
+ ```
350
+
351
+ Executor bead:
352
+
353
+ ```text
354
+ PROBLEM: Exact behavior or artifact to change.
355
+ SUCCESS: Observable acceptance criteria.
356
+ SCOPE: Target files/symbols; include do-not-touch boundaries.
357
+ NON_GOALS: Related improvements explicitly excluded.
358
+ CONSTRAINTS: API compatibility, style, migrations, safety.
359
+ VALIDATION: Lint/typecheck/tests or manual checks.
360
+ OUTPUT: Changed files, verification, residual risks.
361
+ ```
362
+
363
+ Reviewer bead:
364
+
365
+ ```text
366
+ PROBLEM: Verify executor output against requirements.
367
+ SUCCESS: PASS only if requirements and validation are satisfied.
368
+ SCOPE: Executor job, diff, task bead, acceptance criteria.
369
+ NON_GOALS: Do not rewrite unless explicitly asked.
370
+ CONSTRAINTS: Code-review mindset; findings first.
371
+ VALIDATION: Run or inspect required checks where feasible.
372
+ OUTPUT: PASS/PARTIAL/FAIL with file/line findings.
373
+ ```
374
+
375
+ Test bead:
376
+
377
+ ```text
378
+ PROBLEM: Validate one or more implementation chains.
379
+ SUCCESS: Relevant tests/checks pass or failures are diagnosed.
380
+ SCOPE: Commands and implementation beads covered.
381
+ NON_GOALS: No broad unrelated suite expansion unless requested.
382
+ CONSTRAINTS: Avoid destructive cleanup; report flaky/infra failures separately.
383
+ VALIDATION: Command output and failure interpretation.
384
+ OUTPUT: Pass/fail summary, failing tests, likely owner.
385
+ ```
386
+
387
+ Sync-docs bead:
388
+
389
+ ```text
390
+ PROBLEM: Exactly one doc drifted from source truth.
391
+ SUCCESS: One doc updated and drift checked clean.
392
+ SCOPE: One doc only.
393
+ NON_GOALS: No source-code rewrite.
394
+ CONSTRAINTS: Keep doc and source aligned.
395
+ VALIDATION: Drift scan or bounded source cross-check.
396
+ OUTPUT: Updated doc, drift evidence, remaining doc gaps.
397
+ ```
398
+
399
+ What differs: orchestrator gives each specialist a contract shape that matches job, so role stays narrow and reviewable.
400
+
401
+ For evidence-heavy or multi-item beads, let `SCOPE`, `CONSTRAINTS`, and `EXAMPLES` carry opt-in XML tags. Follow prompt-improving `xml_core` style: wrap only the subpart that needs structure, not whole bead. Example: a debugger bead can put stack trace lines in `<evidence>` and do-not-touch items in `<constraints>`, so specialist can scan facts fast without turning every field into markup.
402
+
403
+ ## Choosing The Specialist
404
+
405
+ Run `specialists list` if you need live registry. Choose by task, not habit.
406
+
407
+ | Need | Specialist | Use when |
408
+ | --- | --- | --- |
409
+ | Architecture/code mapping | `explorer` | Need evidence and scoped implementation track |
410
+ | Root-cause analysis | `debugger` | Symptom, stack trace, failing test, or regression |
411
+ | Planning/decomposition | `planner` | Need beads, dependencies, file scopes, sequencing |
412
+ | Design/tradeoffs | `overthinker` | Approach is risky, ambiguous, or needs critique |
413
+ | Implementation | `executor` | Contract is clear enough to write code or docs |
414
+ | Compliance/code review | `reviewer` | Executor/debugger produced changes that need final PASS/PARTIAL/FAIL |
415
+ | Implementation sanity | `code-sanity` | Diff smells overcomplicated, brittle, or type-risky |
416
+ | Security/dependency audit | `security-auditor` | Need threat modeling, secure-code review, or agent/config security scan |
417
+ | Multiple review perspectives | `parallel-review` | Critical diff needs independent review passes |
418
+ | Test execution | `test-runner` | Need suites run and failures interpreted |
419
+ | Docs audit/sync | `sync-docs` | Docs may be stale or need targeted synchronization |
420
+ | External/live research | `researcher` | Any library/API/framework/CLI question — dispatch BEFORE answering from training data |
421
+ | Specialist config | `specialists-creator` | Creating or changing specialist JSON/config |
422
+ | Release publication | `changelog-keeper` | New tag is being cut |
423
+
424
+ Selection rules:
425
+
426
+ - Explorer is READ_ONLY and should answer specific questions.
427
+ - Debugger beats explorer for failures because it traces causes and remediation.
428
+ - Planner shapes epic/task graph before executor starts.
429
+ - Overthinker defends risky design before code locks in. It is CoT specialist by design, so thinking-heavy turns and `<thinking>` tags fit there.
430
+ - Reviewer already uses structured evidence/gap matrices, which is CoT in disguise; keep that structure, do not add freeform `<thinking>` blocks.
431
+ - Executor, debugger, changelog-keeper, sync-docs, and test-runner should not carry mandatory `<thinking>` blocks. That bloats output without payoff and hides the real contract.
432
+ - Executor does not own full test validation; use reviewer/test-runner for that phase.
433
+ - Sync-docs is for audit/sync; executor is for heavy doc rewrites.
434
+ - Researcher is for current external info, not repo archaeology. **Dispatch BEFORE answering any library/API/framework/CLI question from training data** — your knowledge is stale by months and APIs drift silently. The cost is one CLI call; the alternative is shipping wrong API usage.
435
+ - Specialists-creator should precede specialist config/schema edits.
436
+
437
+ ## Bug Diagnosis Chain
438
+
439
+ For symptoms, errors, regressions, flakes, or failing tests where cause is unknown, start with diagnosis — not implementation. Do not dispatch executor while cause is unknown; executor is for clear implementation scope only.
440
+
441
+ Default chain:
442
+
443
+ 1. **test-runner** or **debugger** establishes a fast deterministic feedback loop. If no loop can be built, debugger reports the blocker — do not patch in the dark.
444
+ 2. **debugger** reproduces the symptom, writes 3–5 falsifiable hypotheses, and tests one variable at a time. Any temporary instrumentation must be tagged `[DEBUG-<id>]` and removed before completion.
445
+ 3. **debugger** applies the minimal root-cause fix on the fault line and verifies via targeted lint/typecheck plus the focused repro.
446
+ 4. **test-runner** reruns the original repro/regression command (full-suite validation is its job, not debugger's).
447
+ 5. **code-sanity** runs if the fix smells brittle, overcomplicated, or type-risky. **security-auditor** runs if the fix touches auth/session/secrets/input handling, dependency logic, or agent/MCP/hook config.
448
+ 6. **reviewer** gates the final diff against the bead contract.
449
+ 7. If no correct regression-test seam exists, route the architecture/testability finding to **overthinker** or **planner** — do not force a brittle test just to close the loop.
450
+
451
+ Explorer is useful before diagnosis only when no concrete symptom exists and architecture is unknown. For real bugs with a symptom, use debugger.
452
+
453
+ ## Code-sanity
454
+
455
+ Use code-sanity when diff smells overcomplicated, brittle, or type-risky, but not yet broken enough for debugger. Use it before final review when you want cheap simplification check without blocking merge.
456
+
457
+ Bead shape:
458
+
459
+ ```text
460
+ PROBLEM: Diff has complexity, duplication, or type-safety smell that could hide bugs.
461
+ SUCCESS: Findings isolate concrete smell or confirm clean shape.
462
+ SCOPE: Executor diff, risky files, and any nearby helpers.
463
+ NON_GOALS: No edits, no broad refactor, no merge gate decision.
464
+ CONSTRAINTS: READ_ONLY, keep feedback cheap, cite exact lines or symbols.
465
+ VALIDATION: Findings name concrete improvement or say OK.
466
+ OUTPUT: FINDINGS with severity, or OK with caveats.
467
+ ```
468
+
469
+ Use `sp resume <exec-job> "Code-sanity findings: ..."` or `sp resume <exec-job> "Code-sanity OK; continue to reviewer."` to hand findings back.
470
+
471
+ OK is not reviewer PASS. It is advisory only.
472
+
473
+ What differs: orchestrator uses code-sanity as cheap smell screen, not as merge gate.
474
+
475
+ ## Security-auditor
476
+
477
+ Use security-auditor when diff touches auth, secrets, input handling, dependency logic, or agent/config surfaces. Keep it advisory and scan-only.
478
+
479
+ Bead shape:
480
+
481
+ ```text
482
+ PROBLEM: Diff may open auth, secrets, input, dependency, or agent-config risk.
483
+ SUCCESS: Findings isolate real security concern or confirm no obvious issue.
484
+ SCOPE: Executor diff, touched configs, and security-relevant paths.
485
+ NON_GOALS: No edits, no package updates, no destructive scans, no live exploit tests.
486
+ CONSTRAINTS: LOW permissions, scan-only, recommendations only.
487
+ VALIDATION: Findings cite risk surface and why it matters.
488
+ OUTPUT: Recommendations for executor to apply in a separate bead.
489
+ ```
490
+
491
+ Use `sp resume <exec-job> "Security findings: ..."` or `sp resume <exec-job> "Security scan clean; continue to reviewer."`.
492
+
493
+ No findings is not reviewer PASS. Executor still applies fixes if any, then reviewer decides publish.
494
+
495
+ What differs: orchestrator uses security-auditor to surface risk early, not to bless merge.
496
+
497
+ ## Dependency Graph Shapes
498
+
499
+ Draw graph before dispatch.
500
+
501
+ Simple chain:
502
+
503
+ ```text
504
+ task -> explore -> impl -> review
505
+ ```
506
+
507
+ Fix loop:
508
+
509
+ ```text
510
+ debug -> exec -> code-sanity? -> security-auditor? -> reviewer
511
+ ^ |
512
+ |------ resume PARTIAL --------------|
513
+ ```
514
+
515
+ Epic:
516
+
517
+ ```text
518
+ epic
519
+ ├─ prep/planner
520
+ ├─ impl-a
521
+ ├─ impl-b
522
+ ├─ test-batch
523
+ └─ merge/review chain(s)
524
+ ```
525
+
526
+ What differs: orchestrator sees edge shape up front, so can pick sequential chain, fix loop, or multi-chain epic without graph drift.
527
+
528
+ ## Pre-Dispatch: Conflict Cluster Identification
529
+
530
+ Before dispatching N parallel chains, build the file-overlap matrix:
531
+
532
+ | Chain | Touches | Overlap with |
533
+ |-------|---------|--------------|
534
+ | chain-A | src/cli/update.ts | chain-B, chain-C |
535
+ | chain-B | src/cli/update.ts, src/cli/install.ts | chain-A, chain-C, chain-D |
536
+ | chain-C | src/cli/update.ts, src/cli/install.ts, src/cli/doctor.ts | chain-A, chain-B |
537
+
538
+ For each cluster of overlapping chains, choose **one** of:
539
+
540
+ 1. **Serial dispatch** — execute chains in dependency order, each waits for previous to land. Slowest but cleanest.
541
+ 2. **Unified bead** — collapse all chains into one bead/executor pass. Larger reviewer scope but no merge conflicts.
542
+ 3. **Parallel dispatch + debugger restitch at integration** — dispatch in parallel, plan for ~40% conflict rate (empirical), budget debugger-restitch passes during integration.
543
+
544
+ Default heuristic: if 3+ chains touch the same file, **serial-dispatch them**. Conflict-resolution time at integration usually exceeds the time saved by parallel dispatch.
545
+
546
+ ## Pre-Epic: Test-Failure-Map Pattern
547
+
548
+ Use when:
549
+ - A test suite shows ≥ ~5 failures and the operator says "fix all"
550
+ - The failures span multiple files / subsystems
551
+ - Root causes are not yet attributed per failure
552
+
553
+ ### Step-by-step
554
+
555
+ 1. **Run the suite once**, save the full log. Do not interpret yet.
556
+ 2. **File one mapping bead** (e.g., `test-runner: refresh <epic> failure map`) with contract:
557
+ - `PROBLEM:` exact command + exit status + raw failure count.
558
+ - `SUCCESS:` cluster table grouping every failure by **likely shared root cause and file scope**, plus recommended fix-chain order.
559
+ - `SCOPE:` the log file path + bounded test files involved.
560
+ - `CONSTRAINTS:` READ_ONLY, no source/test edits, no fix attempts.
561
+ 3. **Dispatch test-runner / explorer / debugger** for this bead READ_ONLY (or fill inline by reading the log).
562
+ 4. **Build the cluster table**: cluster name | files (counts) | representative error | root-cause hypothesis | likely-owner area | targeted validation command. Save in bead notes.
563
+ 5. **Plan fix chains** off the cluster table:
564
+ - One chain per cluster, file scopes disjoint where possible.
565
+ - Order by leverage (largest cluster first), then by simplicity.
566
+ - Debugger when root cause unclear; executor when bead constraint is concrete.
567
+ 6. **Save the topology insight as `bd remember`** — patterns about where a codebase's test fragility concentrates are reusable.
568
+
569
+ ### Why this beats dispatch-blind
570
+
571
+ When 34 failures collapsed under 5 clusters in one observed run, 56% of failures shared a single root cause. A blind parallel dispatch would have over-dispatched 19 fixes instead of 1. Net specialist spend ~3× higher without the mapping pass.
572
+
573
+ ### Failure modes to watch for
574
+
575
+ - Clusters that look shared but aren't — same error string in unrelated tests may hide different root causes. Confirm via stack traces, not error text alone.
576
+ - One cluster's fix introduces another's regression — each chain's VALIDATION must span all known-failing areas with "no regressions in other clusters."
577
+ - Pre-existing failures vs new regressions — name pre-existing failures explicitly in each chain's NON_GOALS so reviewers don't FAIL on them.
578
+
579
+ ## Canonical Single-Chain Flow
580
+
581
+ Use for one implementation branch.
582
+
583
+ ```bash
584
+ # 1. Create or claim root task bead with complete contract
585
+ bd create --title "Fix token refresh retry" --type task --priority 2 --description "PROBLEM: login and refresh flow have a retry bug when transient token refresh fails before backoff clears stale state. SUCCESS: token refresh retries once, login survives transient failure, and terminal failure stays clear. SCOPE: src/auth/refresh.ts, src/cli/login.ts, tests/unit/auth/refresh.test.ts. NON_GOALS: no auth provider redesign, no storage migration, no UI changes. CONSTRAINTS: preserve token format, keep error text backward-compatible, avoid broad retry changes outside auth flow. VALIDATION: add regression test for fail-then-succeed path and run targeted auth tests. OUTPUT: changed files, test proof, residual risks."
586
+ bd update <task> --claim
587
+
588
+ # 2. Optional discovery when path is unknown
589
+ bd create --title "Explore auth refresh path" --type task --priority 2 --description "PROBLEM: token refresh retry path is undocumented and likely drifts on failure handling. SUCCESS: evidence-backed plan names exact files, symbols, and risk. SCOPE: src/auth/refresh.ts, src/cli/login.ts, tests/unit/auth/*.test.ts. NON_GOALS: no implementation, no broad audit. CONSTRAINTS: READ_ONLY, cite files/symbols/flows, stay within live repo evidence. VALIDATION: findings cite code path and recommended sequence. OUTPUT: tracked discovery plan with stop condition."
590
+ bd dep add <explore> <task>
591
+ specialists run explorer --bead <explore> --context-depth 3
592
+ specialists result <explore-job>
593
+
594
+ # 3. Implementation
595
+ bd create --title "Implement token refresh retry" --type task --priority 2 --description "PROBLEM: login fails after transient token refresh error because retry path returns before backoff and clear error state. SUCCESS: retry waits once, preserves session on success, and surfaces final failure clearly. SCOPE: src/auth/refresh.ts, src/cli/login.ts, tests/unit/auth/refresh.test.ts. NON_GOALS: no auth redesign, no storage migration, no UI refresh. CONSTRAINTS: preserve existing token format, keep backward-compatible error text, avoid broad retry changes elsewhere. VALIDATION: add regression test for transient failure then success; run targeted auth tests. OUTPUT: changed files, test evidence, residual risks."
596
+ bd dep add <impl> <explore-or-task>
597
+ specialists run executor --bead <impl> --context-depth 3
598
+ specialists result <exec-job>
599
+
600
+ # 4. Advisory passes when diff smells risky
601
+ bd create --title "Sanity check token retry diff" --type task --priority 2 --description "PROBLEM: auth retry diff has control-flow and state-handling smell that could hide bug. SUCCESS: findings identify concrete simplification or confirm clean shape. SCOPE: executor diff in auth refresh and login flow. NON_GOALS: no edits, no merge gate decision. CONSTRAINTS: READ_ONLY, keep feedback cheap, cite exact lines or symbols. VALIDATION: findings name concrete improvement or say OK. OUTPUT: FINDINGS with severity or OK with caveats."
602
+ specialists run code-sanity --bead <sanity-bead> --job <exec-job> --context-depth 3
603
+
604
+ bd create --title "Security scan token retry diff" --type task --priority 2 --description "PROBLEM: auth refresh code touches secrets and session handling, so security regression is possible. SUCCESS: findings isolate real risk surface or confirm no obvious issue. SCOPE: executor diff in auth, token storage, and login path. NON_GOALS: no edits, no package updates, no destructive scans, no live exploit tests. CONSTRAINTS: LOW permissions, scan-only, recommendations only. VALIDATION: findings cite auth/secrets/input surface and why it matters. OUTPUT: recommendations for executor to apply in separate bead."
605
+ specialists run security-auditor --bead <security-bead> --job <exec-job> --context-depth 3
606
+
607
+ # 5. Final review
608
+ bd create --title "Review token refresh retry" --type task --priority 2 --description "PROBLEM: verify executor output against auth retry requirements. SUCCESS: PASS only if retry behavior, error handling, and tests satisfy contract. SCOPE: executor job, diff, acceptance criteria, and target auth files. NON_GOALS: do not rewrite unless explicitly asked. CONSTRAINTS: code-review mindset; findings first; verify security and sanity findings were handled. VALIDATION: inspect targeted checks and regression coverage. OUTPUT: PASS/PARTIAL/FAIL with file/line findings."
609
+ bd dep add <review> <impl>
610
+ specialists run reviewer --bead <review> --job <exec-job> --context-depth 3
611
+ specialists result <review-job>
612
+
613
+ # 6. Cascade-finalize the chain after reviewer PASS
614
+ # (auto-finalize fires automatically when reviewer PASS appears in
615
+ # streaming output. PASS delivered via `sp resume` does not stream —
616
+ # run sp finalize to close any waiting keep-alive members.)
617
+ sp finalize <review-job> # accepts any chain member; cascades to all waiting members
618
+
619
+ # 7. Publish
620
+ sp merge <impl>
621
+ bd close <task> --reason "Reviewer PASS; merged."
622
+ ```
623
+
624
+ Edit-capable specialists with `--bead` auto-provision a worktree. `--worktree` is accepted for clarity but usually unnecessary. Use `--job <exec-job>` for reviewer/fix passes that must enter existing executor workspace.
625
+
626
+ What differs: orchestrator carries full bead contract inline, so downstream specialists inherit the actual job shape, not a title.
627
+
628
+ ## Multi-Chain Epic Flow
629
+
630
+ Use epic when multiple implementation chains publish together.
631
+
632
+ ```bash
633
+ # Epic bead
634
+ bd create --title "Epic: auth refresh hardening" --type epic --priority 2 --description "PROBLEM: login and refresh flow have retry drift, weak error surfacing, and unclear follow-up ownership. SUCCESS: epic closes with stable retry behavior, tests, docs, and clean publish. SCOPE: src/auth/*, src/cli/login.ts, tests/unit/auth/*, docs/auth-refresh.md. NON_GOALS: no auth provider swap, no storage migration, no unrelated session revamp. CONSTRAINTS: preserve token format, keep login compatible, sequence risky fixes before merge, use child beads for parallelizable slices. VALIDATION: targeted tests, code-sanity or security pass if risk appears, final reviewer PASS. OUTPUT: merged chain set with notes on remaining gaps."
635
+
636
+ # Planner bead
637
+ bd create --title "Plan auth refresh split" --type task --priority 2 --description "PROBLEM: epic needs disjoint chains before executor starts. SUCCESS: child beads, dependency edges, and file ownership split are explicit. SCOPE: auth refresh epic area. NON_GOALS: no code changes. CONSTRAINTS: keep chains disjoint, identify security-sensitive slice, name review order. VALIDATION: plan names beads and edges. OUTPUT: parallel-ready plan with risk notes."
638
+ bd dep add <plan> <epic>
639
+ specialists run planner --bead <plan> --context-depth 3
640
+
641
+ # Parallel impl beads
642
+ bd create --parent <epic> --title "Impl auth retry" --type task --priority 2 --description "PROBLEM: transient refresh failure breaks login flow. SUCCESS: retry path succeeds after one transient failure and preserves session state. SCOPE: src/auth/refresh.ts, tests/unit/auth/refresh.test.ts. NON_GOALS: no UI changes, no storage migration, no unrelated retry framework edits. CONSTRAINTS: preserve error text, keep backoff bounded, avoid side effects outside auth flow. VALIDATION: regression test for fail-then-succeed path. OUTPUT: code diff, test proof, residual risk list."
643
+ bd create --parent <epic> --title "Impl login handoff" --type task --priority 2 --description "PROBLEM: login CLI does not surface refresh outcome clearly enough for operators. SUCCESS: login shows clear success/failure handoff and no stale token state. SCOPE: src/cli/login.ts, tests/unit/cli/login.test.ts. NON_GOALS: no auth protocol redesign. CONSTRAINTS: preserve CLI flags and error codes, keep output terse. VALIDATION: CLI regression test. OUTPUT: login diff and test evidence."
644
+
645
+ specialists run executor --bead <impl-a> --context-depth 3
646
+ specialists run executor --bead <impl-b> --context-depth 3
647
+
648
+ # Per-chain review
649
+ specialists run reviewer --bead <review-a> --job <exec-a-job> --context-depth 3
650
+ specialists run reviewer --bead <review-b> --job <exec-b-job> --context-depth 3
651
+
652
+ # Per-chain cascade-finalize (only needed if PASS arrived via sp resume;
653
+ # auto-finalize handles the streaming case automatically)
654
+ sp finalize <review-a-job>
655
+ sp finalize <review-b-job>
656
+
657
+ # Publish
658
+ sp epic status <epic> # verify derived state shows merge_ready
659
+ sp epic merge <epic> # batch publish all chains in dependency order with tsc gate per merge
660
+ ```
661
+
662
+ Use `--epic <id>` when job belongs to epic but bead is not direct child. Avoid parallel executors on same file; sequence them or consolidate work.
663
+
664
+ What differs: orchestrator splits graph first, then launches parallel work only when file scopes are provably disjoint.
665
+
666
+ ## Review And Fix Loop
667
+
668
+ A chain stays alive until merged or abandoned.
669
+
670
+ ```text
671
+ executor/debugger -> waiting
672
+ optional code-sanity/security-auditor -> advisory findings
673
+ reviewer -> PASS | PARTIAL | FAIL
674
+ ```
675
+
676
+ - `PASS`: verify expected commit/diff. If reviewer's PASS appeared in its streaming output, auto-finalize already closed the chain — go straight to `sp merge` / `sp epic merge`. If PASS arrived via `sp resume`, run `sp finalize <any-chain-job-id>` first to cascade-close any waiting keep-alive members, then publish.
677
+ - `PARTIAL`: resume same executor/debugger with exact findings, then re-review (`sp resume <reviewer-job>`).
678
+ - `FAIL`: stop and decide whether to replace chain, re-scope bead, or ask operator if judgment is required.
679
+
680
+ Prefer resume over new fix executor when original job is waiting and context is healthy:
681
+
682
+ ```bash
683
+ sp resume <exec-job> "Reviewer PARTIAL. Fix only these findings: ..."
684
+ ```
685
+
686
+ Do not treat job completion, code-sanity OK, security no-findings, or test-runner pass as equivalent to reviewer PASS.
687
+
688
+ What differs: orchestrator uses PASS/PARTIAL/FAIL as real control flow, not just status labels.
689
+
690
+ ## Mini-Flows For Under-Promoted Specialists
691
+
692
+ Planner:
693
+ - Use when epic needs bead split, dependency graph, or file ownership before code starts.
694
+ - Bead shape: task/epic contract with clear success criteria, child beads, and edge plan.
695
+ - Chain position: first or pre-impl.
696
+
697
+ Debugger:
698
+ - Use when symptom exists and root cause is unclear.
699
+ - Bead shape: reproduction, logs, expected vs actual, scope to investigate.
700
+ - Chain position: before executor, or after a failing review when cause is unclear.
701
+
702
+ Overthinker:
703
+ - Use for risky design, cross-cutting tradeoffs, or premortem before lock-in.
704
+ - Bead shape: options, risks, constraint conflicts, decision asked for.
705
+ - Chain position: before planner/executor when design uncertainty is high.
706
+
707
+ Researcher:
708
+ - Dispatch **BEFORE** answering any library/API/framework/CLI question from training data. Training is months stale; APIs change; cheap CLI lookups (`ctx7`, `deepwiki`, `ghgrep`) replace the guess.
709
+ - Use for: API syntax checks, config options, version migrations, library-specific debugging, "how do others implement X", recent releases, public repo internals.
710
+ - Anti-pattern to break: "I think Library X works like Y…" → instead dispatch researcher with the exact question. The cost (~30s, `openai-codex/gpt-5.4-mini` via tool mode) is far less than shipping wrong API usage.
711
+ - Bead shape: source list (which libraries/repos), question set, required citations (library ID or `npx ctx7 docs /org/project "..."` output).
712
+ - Chain position: before executor when outside facts matter; alongside explorer when a question mixes local code with external behavior.
713
+ - Keep-alive: ask follow-ups in the same job rather than re-dispatching — researcher stays in waiting state after each turn.
714
+
715
+ Three modes — researcher picks automatically based on bead shape; you write the bead, not the mode:
716
+
717
+ - **Targeted lookup** (most common): "How do I configure X in library Y v1.2?" / "What does Z.method() return now?" / "Are foo and bar still the canonical replacements for baz?" → researcher resolves library ID via `ctx7 library`, then `ctx7 docs /org/project "<intent-rich query>"`. For repo-specific internals (e.g. "How does Vite handle X internally?"), `deepwiki ask <owner/repo> "..."`.
718
+ - **Discovery**: "How do production codebases handle X?" / "Find good examples of pattern Y" / "What does the ecosystem do for Z?" → `ghgrep "<literal pattern>" --lang <langs> --repo <maybe>`, scan results, drill into the best repos with `deepwiki toc` + `deepwiki ask`.
719
+ - **Media / discussion-recency** (rare): YouTube transcripts, social-media trends. Triggers on URLs or "what are people saying about X right now". Researcher loads `last30days` skill on-demand for this — don't fold its setup into the bead.
720
+
721
+ ### Dispatch triggers — when the orchestrator should reach for researcher
722
+
723
+ Concrete agent thoughts that MUST be replaced with a researcher dispatch:
724
+
725
+ | Agent thought | Researcher bead |
726
+ |---|---|
727
+ | "I think `useEffect` cleanup works like…" | `ctx7 docs /facebook/react "useEffect cleanup with async operations"` |
728
+ | "Next.js app router middleware should be…" | `ctx7 docs /vercel/next.js "app router middleware patterns"` |
729
+ | "Let me check if `--target` is a valid flag for tool X" | `ctx7 docs /org/tool-x "--target flag"` or `tool-x --help` (orchestrator-side if it's installed) |
730
+ | "Production code probably handles X by…" | `ghgrep "<X-pattern>" --lang TypeScript --limit 5` then `deepwiki ask <best-repo> "<design question>"` |
731
+ | "Library Y added feature Z in v3 (I think)" | `ctx7 library <Y> "Z"` → `ctx7 docs /org/Y/<version> "Z"` to verify version + behavior |
732
+ | "Repo X's authentication architecture is…" | `deepwiki ask owner/X "How does the auth middleware work? What stores tokens? What controls expiry?"` |
733
+ | "Cross-library: do A and B compose like Z?" | `deepwiki ask repo-A repo-B "How do these interact for use-case Z?"` |
734
+
735
+ If you catch yourself making any of these claims without first dispatching researcher, you are about to ship stale information. Stop and dispatch.
736
+
737
+ ### Cost framing
738
+
739
+ Researcher runs on `openai-codex/gpt-5.4-mini` via tool mode, keep-alive. Typical turn: 20-40s wall clock, ~$0.005-0.02 per call. The cost of shipping a wrong API call (debugger turn + executor fix + reviewer re-run, or worse, production regression) is orders of magnitude higher. Default to dispatch.
740
+
741
+ ### What researcher does NOT do
742
+
743
+ - Local code mapping → use `explorer` (READ_ONLY, traces project code without external CLI cost).
744
+ - Bug root-cause when symptoms are local → use `debugger`.
745
+ - Reading internal docs already in this repo → use direct file read or `explorer`.
746
+ - Security audit of third-party packages → use `security-auditor`; researcher's job is the API surface, not the threat model.
747
+
748
+ Test-runner:
749
+ - Use when commands need to run and failures need classification, not fixes.
750
+ - Bead shape: exact command list, suites, and expected failure taxonomy.
751
+ - Chain position: after executor or between fix loops.
752
+
753
+ Sync-docs:
754
+ - Use when one doc drifts and must be synced to source truth.
755
+ - Bead shape: one-doc scope, source cross-check, drift checks.
756
+ - Chain position: parallel to code only when doc scope is isolated; otherwise after code settles.
757
+
758
+ What differs: orchestrator uses specialists beyond the common trio, so planning, diagnosis, research, tests, and docs do not collapse into executor work.
759
+
760
+ ## Specialist Rebuttal As Routine
761
+
762
+ Several specialists default to over-cautious verdicts when an evidence gate looks unsatisfied. The orchestrator's job is to challenge that verdict with cited evidence, not to accept it. Common rebuttal-worthy patterns:
763
+
764
+ ### Overthinker
765
+
766
+ - "Hold for operator decision" without specifying what decision is needed → push: "Cite file/line evidence for why this is a product decision rather than a mechanical resolution."
767
+ - "Close as superseded by X" without verification → push: "Read the current state of `<file>` and check whether feature Y from this bead is actually present."
768
+ - "Run separate small beads" or "run one big bead" without rationale → push: "Pick one and explain operationally — cost difference, conflict expectations, reviewer scope."
769
+
770
+ ### Reviewer
771
+
772
+ - "PARTIAL — missing `gitnexus_impact` evidence" on a test-only diff → rebut: "Diff is entirely under `test/` (N files). `gitnexus_impact` analyzes runtime call graphs; test fixture mocks have no callers in the production graph. Bead's impact-gate constraint is conditional on modifying a runtime entrypoint, which did not happen here."
773
+ - "PARTIAL — missing `gitnexus_impact`" on a small LOW-blast-radius production diff where executor used `gitnexus_detect_changes` instead → rebut: cite the executor's `impact_report.highest_risk: LOW`, the LOC count, single helper / single consumer scope. The reviewer prompt accepts `gitnexus_impact` OR `$gitnexus_summary` OR `gitnexus_detect_changes` OR LOW `impact_report` as evidence.
774
+ - "FAIL — full suite shows N+1 fails" where one is a known concurrent-run flake → rebut: rerun the suspect test in isolation, paste clean output, resume reviewer with "Isolated rerun: P/P. Re-evaluate."
775
+
776
+ ### General rule
777
+
778
+ Resume with explicit ammunition: file/line refs, exact rerun output, link to the bead memory documenting the rebuttal pattern. Don't argue from authority; argue from new evidence. **Findings from code-sanity / security-auditor are legitimate rebuttal evidence** — a clean code-sanity OK or a security-auditor "no findings" is concrete proof against a reviewer's "looks too complex" or "may have security risk" gate. Cite the advisory job id when rebutting on this axis.
779
+
780
+ **One rebuttal per reviewer is the limit.** Second FAIL after rebuttal means stop and report. After a successful rebuttal, save the rebuttal text to `bd remember "<key>"` so the next session inherits it.
781
+
782
+ ## Monitoring And Steering
783
+
784
+ Use `sp ps` for state and `sp result` for completed turns.
785
+
786
+ ```bash
787
+ sp ps # active jobs + unresolved terminal problems
788
+ sp ps --active # active jobs only
789
+ sp ps --health # include detailed process tables
790
+ sp ps --include-terminal # include uncleaned terminal history
791
+ sp ps --include-cleaned # include rows hidden by sp clean --ps
792
+ sp ps --all # full audit view, including cleaned/dead/history
793
+ sp feed <job-id>
794
+ sp result <job-id>
795
+ ```
796
+
797
+ Default `sp ps` is the actionable dashboard, not raw history. Error/cancelled terminal rows stay visible until an operator acknowledges them with `sp clean --ps`; cleaned rows remain in SQLite and are visible via `--include-cleaned`/`--all`.
798
+
799
+ If job is running, use `sp feed`. If it is waiting, use `sp result` and decide whether to resume, review, merge, or stop. Avoid tight polling; sleep based on task size, then check once.
800
+
801
+ Use `steer` for running jobs and `resume` for waiting jobs:
802
+
803
+ ```bash
804
+ sp steer <job-id> "Stop broad audit. Answer only the three bead questions."
805
+ sp resume <job-id> "Continue with the next scoped fix. Do not refactor."
806
+ ```
807
+
808
+ Context usage is an action signal when available:
809
+
810
+ - 0-40%: healthy.
811
+ - 40-65%: monitor.
812
+ - 65-80%: steer toward conclusion.
813
+ - Above 80%: finish, summarize, or replace job.
814
+
815
+ Raw token totals are not context percentages.
816
+
817
+ ### Long autonomous runs — dual-mechanism monitoring
818
+
819
+ For sessions where the operator is offline (overnight, async windows), use both:
820
+
821
+ 1. **Bash sleep timers per dispatch**, sized per role (see Monitoring Long-Running Jobs above). Bash sleep waits for an expected completion.
822
+ 2. **External cron loop** (Claude Code: `/loop 180s sp ps`) as a heartbeat at fixed cadence regardless of orchestrator's bash sleeps. Cron catches specialists that finished while the orchestrator was busy reading other results, and catches stalls.
823
+
824
+ The two complement: bash sleep waits for an expected completion; cron catches unexpected completions and stalls. Without the cron, the orchestrator can miss specialists that completed during a long bash poll cycle and waste turns re-polling.
825
+
826
+ ## Bead Lifecycle And Parallel Commit Ordering
827
+
828
+ The bd commit-gate is **project-wide**, not per-worktree. While **any** bead in the project is `in_progress`, **no** worktree can commit. Practical consequences for parallel-chain epics:
829
+
830
+ - You CAN dispatch two executors in parallel — they work in separate worktrees, no commit-time collision.
831
+ - But once executor A returns and executor B is still running, you CANNOT commit A's worktree until B's bead is closed (or vice versa).
832
+ - Workflow: close the finished chain's executor bead FIRST (memory-ack + `bd close`), THEN commit that chain's worktree, THEN wait on the other chain.
833
+ - This forces a serial-tail on the commit step. Plan for it: parallel-dispatch saves time on the *thinking* step, not the commit step.
834
+
835
+ If the commit-gate blocks unexpectedly mid-orchestration, `bd query "status=in_progress"` reveals which claim is holding it open.
836
+
837
+ ### Memory-gate batch close
838
+
839
+ `bd close` is blocked until `memory-acked:<id>` exists. For batch-closing many orchestrator-internal beads (sanity beads, reviewer beads, decomposition trackers), use:
840
+
841
+ ```bash
842
+ for id in <impl> <sanity?> <review>; do
843
+ bd kv set "memory-acked:$id" "saved:<chain-memory-key>" # OR "nothing novel: <reason>"
844
+ done
845
+ bd close <impl> <sanity?> <review> <parent> --reason "..."
846
+ ```
847
+
848
+ The chain memory key holds the actual durable insight (one per real fix). Sanity/review beads get "nothing novel" — the parent insight covers them.
849
+
850
+ ## What Stays Out
851
+
852
+ - `memory-processor` — memory synthesis specialist; see `/documenting`.
853
+ - `xt-merge`: deferred to xt-merge skill; this skill names specialist flow, not merge-wrapper internals.
854
+ - Session-close reporting (report skeleton, CHANGELOG sync, push) — see `/session-close-report` skill; this skill mandates running it at session end but does not duplicate its content.
855
+ - Release publication (version bump, build, tag, npm publish) — see `/releasing` skill.
856
+
857
+ ## At Session End — Mandatory Handoff
858
+
859
+ Before declaring the session done:
860
+
861
+ 1. Run the `/session-close-report` skill.
862
+ 2. Fill every `<!-- FILL -->` marker in the generated skeleton.
863
+ 3. Sync `CHANGELOG.md` for user-facing changes (the report skill drives this).
864
+ 4. Re-run cleanup checks: `sp ps`, `git worktree list`, `ps -ef` for stale serena/gitnexus, `tmux ls` for `sp-*`.
865
+ 5. Commit the report (and CHANGELOG if updated) before push.
866
+
867
+ A session that lands code but skips the close-report leaves the next agent cold-starting blind. That cost compounds across sessions.
868
+
869
+ ## Adjacent xt commands
870
+
871
+ Source: latest xt report + `xt --help`; keep commands here, not full CLI surface.
872
+ - `xt report` — session report input for release synthesis; see `/session-close-report`.
873
+ - `xt end` — close worktree session: push, PR, merge, cleanup; see `/xt-end`.
874
+ - `xt claude` — launch Claude in sandboxed worktree; see `/using-xtrm`.
875
+ - `xt update` — refresh xtrm-managed files in one repo or many; see `/update-xt`.
876
+ - `xt doctor` — diagnose xtrm drift in current project; see `/update-xt`.
877
+ - `xt init` — bootstrap xtrm in project; see xtrm-tools docs.
878
+ - `xt release prepare/publish` — legacy release path; canonical flow is `/releasing`.
879
+ - `bd prime` — refresh beads workflow context; see `CLAUDE.md`.
880
+ - `memory-processor` — memory synthesis specialist; see `/documenting`.
881
+ - `xt-merge` — defer merge-queue internals to `/xt-merge`.
882
+
883
+ ## Merge And Publication
884
+
885
+ Per-chain merge (works for standalone chains AND for any PASS chain inside an active epic):
886
+
887
+ ```bash
888
+ sp merge <chain-root-bead>
889
+ ```
890
+
891
+ Batch publish all chains in an epic in dependency order with tsc gate between each:
892
+
893
+ ```bash
894
+ sp epic status <epic-id>
895
+ sp epic merge <epic-id>
896
+ ```
897
+
898
+ Manual finalizer fallback when reviewer PASS arrived via resume (auto-finalize only fires on streaming output):
899
+
900
+ ```bash
901
+ sp finalize <any-chain-job-id> # cascades: closes ALL waiting keep-alive members of the chain
902
+ ```
903
+
904
+ Rules:
905
+
906
+ - Merge only after reviewer PASS unless operator explicitly accepts draft for follow-up work.
907
+ - Per-chain `sp merge` is allowed for any PASS chain regardless of sibling-epic state. Use `sp epic merge` only when batching all epic chains together (atomic publish, topological order, tsc gate per merge).
908
+ - Do not manually `git merge` specialist branches — the redesign removed the conditions that previously forced manual fallback (sticky FAILED, inverted merge gates, missing PASS finalizer).
909
+ - If merge refuses because a chain job is still `waiting`, run `sp finalize <any-job-in-chain>` — it cascades to close every waiting keep-alive member of that chain via `supervisor.finalizeWaitingJob()`.
910
+ - If a previous `sp epic merge` failed (rebase conflict, dirty worktree) and persisted a soft `failed` marker, the next attempt retries fresh — only `merged` and `abandoned` are truly terminal. Just clear the conflict source.
911
+ - If merge reports dirty worktree, inspect that worktree. Revert generated noise only when clearly unrelated; otherwise ask or re-dispatch.
912
+ - Run or confirm required gates before closing root bead or epic.
913
+
914
+ ## Integration Phase — Cherry-Pick Playbook
915
+
916
+ Use when `sp merge` / `sp epic merge` is not the right path: chains forked from a non-`origin/HEAD` baseline (pass `--target-branch` first if it's a known integration branch), operator wants visibility before publish, or multiple chains must land into an integration branch before main.
917
+
918
+ ### Step-by-step
919
+
920
+ 1. Stash uncommitted state on working branch: `git stash push -u -m "pre-integration"`.
921
+ 2. Create integration branch off the working branch: `git checkout -b integration/<date>-orchestrator`.
922
+ 3. For each non-overlapping chain (security/critical first, then test-baseline, then features):
923
+ - `git merge --squash <chain-branch>`
924
+ - Restore noise files (see "Chain noise filter checklist" below)
925
+ - **Advisory passes** before commit: if the staged diff smells overcomplicated/duplicative/type-risky, dispatch `code-sanity --job <last-exec-job-of-chain>`; if it touches auth/secrets/input/agent-config, dispatch `security-auditor --job <last-exec-job-of-chain>`. Apply findings or document why skipped.
926
+ - `git commit -m "<type>(<scope>): <summary> (<bead-id>)"` — one squash commit per chain.
927
+ 4. For each overlapping chain, switch to the **debugger-restitch** pattern (next section).
928
+ 5. After all chains land, run E2E smoke phase (below) before declaring done.
929
+ 6. Operator FF-merges integration → main when satisfied.
930
+
931
+ ### Chain noise filter checklist
932
+
933
+ `sp merge` ignores `.beads/` and `.xtrm/skills/active/**` via `MERGE_DIRTY_IGNORE_PREFIXES`. For manual cherry-pick / squash flows, additionally unstage these before committing:
934
+
935
+ - `.pi/npm` — accidentally created by xt commands inside worktrees
936
+ - `cli/pnpm-lock.yaml`, `cli/pnpm-workspace.yaml` — pnpm side-effects
937
+ - `AGENTS.md`, `CLAUDE.md` — gitnexus stat-refresh hook noise
938
+ - `.beads/issues.jsonl`, `.beads/interactions.jsonl` — bd state churn
939
+ - `.specialists/executor-result.md` — transient specialist output
940
+
941
+ ```bash
942
+ git restore --staged .beads .pi AGENTS.md CLAUDE.md
943
+ git checkout HEAD -- .beads AGENTS.md CLAUDE.md
944
+ rm -f .pi/npm
945
+ ```
946
+
947
+ If a chain commits its own `.beads` symlink (older bd-in-worktree behavior), `rm -f .beads` then `git checkout HEAD -- .beads` to restore the real directory.
948
+
949
+ ## Debugger-Restitch Pattern
950
+
951
+ When chain X conflicts with already-landed chain Y on shared files, raw `git cherry-pick` will revert Y's work. The debugger-restitch pattern preserves both, but only when the debugger gets an explicit "preserve already-landed work" contract.
952
+
953
+ 1. **Reopen X**: `bd reopen <X> --reason="integration stitch onto post-Y state"`.
954
+ 2. **Strengthen the bead contract** with these fields:
955
+ - `## CRITICAL CONSTRAINTS:` heading at the top.
956
+ - "Fork off `integration/<date>-orchestrator`. Verify with `git log integration/...$..HEAD` empty before any commits."
957
+ - List the symbols/lines from Y that MUST be preserved verbatim (with file paths).
958
+ - "ADD X's intent ON TOP" with a numbered list of the additions.
959
+ - "Reference original `feature/<X>-executor` for symbol shapes only — do NOT cherry-pick or merge. Re-implement on integration's current state."
960
+ - `## VALIDATION:` includes both Y's tests passing AND X's new tests passing.
961
+ - `## OUTPUT:` mandates a 5-line code excerpt showing both Y and X features coexisting.
962
+ 3. **Dispatch debugger** with `--force-stale-base` if X is an epic child:
963
+ ```bash
964
+ sp run debugger --bead <X> --force-stale-base --keep-alive --background
965
+ ```
966
+ 4. **Sanity check the result**: when debugger reports back:
967
+ ```bash
968
+ git log integration/<date>..feature/<X>-debugger --oneline
969
+ git diff integration/<date>...feature/<X>-debugger -- <key-files>
970
+ ```
971
+ Confirm the debugger's diff is **additive** — no reverts of Y's lines.
972
+ 5. **Advisory passes**: before landing the restitch, dispatch `code-sanity --job <debugger-job>` if the restitch added control-flow complexity, and `security-auditor --job <debugger-job>` if it touched a sensitive surface. Restitched diffs are higher-risk than fresh executor diffs because the debugger had to thread around already-landed work.
973
+ 6. **Land via FF or cherry-pick the named commit** (NOT the checkpoint commit). Look for the commit with the proper `<type>(<scope>):` message; ignore `checkpoint(debugger):` commits above it.
974
+ 7. **Verify tests** before marking done.
975
+
976
+ ### Failure mode to watch for
977
+
978
+ If the debugger forks off the OLD baseline (pre-Y) instead of integration, its commit will revert Y. Symptom: `git diff integration..feature/<X>-debugger -- <Y's-file>` shows DELETIONS of Y's symbols. Fix: resume the debugger with explicit "cd to a fresh worktree forked from `integration/<date>-orchestrator`" instruction. Re-verify with `git log integration..HEAD` empty.
979
+
980
+ ## E2E Smoke Phase
981
+
982
+ Run **every** npm script + entry point that any chain added or modified. The smoke phase is the only way to catch missed chains, false-positive CI gates, missing intermediate files, and runtime regressions invisible to unit tests.
983
+
984
+ ### Procedure
985
+
986
+ ```bash
987
+ # Build sanity
988
+ bun run build # or equivalent
989
+
990
+ # Test sanity — record PRE-baseline first
991
+ git checkout <baseline-branch>
992
+ bun test 2>&1 | tail -5 # record N failed / M passed
993
+
994
+ # Switch back and re-run
995
+ git checkout integration/<date>-orchestrator
996
+ bun test 2>&1 | tail -5 # MUST be ≥ baseline. Net regression is a stop-the-line.
997
+
998
+ # Run every check:* script the integration added
999
+ for s in $(jq -r '.scripts | keys[] | select(startswith("check:"))' package.json); do
1000
+ echo "=== $s ==="
1001
+ npm run "$s" 2>&1 | tail -10
1002
+ done
1003
+
1004
+ # Targeted unit tests for chains touching the same files
1005
+ bunx vitest run <chain-test-files>
1006
+ ```
1007
+
1008
+ For each smoke that fails, decide before continuing:
1009
+ - False positive (script flags itself) → file follow-up bead, document, continue
1010
+ - Missing dependency (vendor not run) → expected gate, document
1011
+ - Real regression → stop, dispatch debugger to fix, re-smoke
1012
+
1013
+ ### Cross-cutting security-auditor pass
1014
+
1015
+ If any landed chain in this integration touched auth, secrets, input handling, dependency lockfiles, or agent/MCP/config surfaces, dispatch one `security-auditor` on the cumulative integration diff BEFORE declaring smoke done:
1016
+
1017
+ ```bash
1018
+ git diff <baseline>..integration/<date>-orchestrator > /tmp/integration-diff.patch
1019
+ sp run security-auditor --bead <sec-bead> --context-depth 3 --background
1020
+ ```
1021
+
1022
+ Per-chain security-auditor passes catch chain-local risks; this cross-cutting pass catches interaction risks that only appear once all chains coexist (e.g. one chain weakens an input validator that another newly relies on). Skipping this on a sensitive-surface integration is an escalation event.
1023
+
1024
+ Record all smoke results in the session-close-report under a `## Smoke test results` table (see `/session-close-report` skill).
1025
+
1026
+ ## Failure Recovery
1027
+
1028
+ When something fails:
1029
+
1030
+ ```bash
1031
+ sp ps <job-id>
1032
+ sp feed <job-id>
1033
+ sp result <job-id>
1034
+ sp doctor
1035
+ ```
1036
+
1037
+ Then choose one action:
1038
+
1039
+ - Resume waiting executor/debugger with exact findings.
1040
+ - Re-run with better bead if contract was weak.
1041
+ - Re-scope bead if scope was wrong.
1042
+ - Escalate if human decision is needed.
1043
+ - Replace specialist only if failure mode repeats.
1044
+
1045
+ ### Common failure patterns (and the canonical fix)
1046
+
1047
+ | Symptom | Cause | Fix |
1048
+ |---|---|---|
1049
+ | `sp merge` refuses with "non-terminal chain jobs" after reviewer PASS | Auto-finalize did not fire (PASS arrived via `sp resume`, not streaming) | `sp finalize <any-chain-job-id>` — cascades to close every waiting keep-alive member |
1050
+ | `sp epic merge` says epic is "in terminal state 'failed'" | Prior `sp epic merge` hit a transient error (rebase conflict, dirty worktree) and persisted a soft `failed` marker | Clear the original conflict source, then re-run `sp epic merge` — it retries fresh, only `merged`/`abandoned` truly block |
1051
+ | `sp epic merge` says "rebase failed: unstaged changes" in a worktree | bd auto-export or other tooling left uncommitted changes inside the worktree | `cd .worktrees/<bead>/<bead>-executor && git stash push -u -m epic-merge-prep`, then re-run from main repo |
1052
+ | `sp ps` shows old terminal jobs after a session | Default dashboard keeps unresolved terminal problems visible until acknowledged | `sp clean --ps --dry-run`, then `sp clean --ps` to soft-hide from default ps; use `sp ps --include-cleaned`/`--all` for audit history |
1053
+ | Reviewer keeps returning PARTIAL on functional contracts already met | Reviewer demanding tool-event evidence — typically obsoleted after the gate relaxation, but if it persists check the executor's `gitnexus_detect_changes` ran and use the rebuttal pattern (see Specialist Rebuttal As Routine) | Rebut with cited evidence; second FAIL = escalate |
1054
+ | Multiple `sp run` background launches drop silently under shell parallelism | Known launch-ceremony race | Re-check `sp ps` after each dispatch and retry the missing one; serialize when reliability matters |
1055
+ | `sp run` returns `Warning: job started but ID not yet available` and nothing appears in `sp ps --bead <id>` after 30s | Dispatch was refused by epic guard or base-staleness check; stderr now surfaces the refusal reason (see `sp run --background` post-fix) | Read the surfaced reason; retry with `--force-stale-base` if intentional, or fix the bead/lineage |
1056
+ | `sp feed <job-id>` returns short tail with no tool events | Confirms DB-backed replay is active; if you see ≤10 lines on a real run, the DB is missing events for that job — verify with raw SQL on observability.db | If DB truly lacks events: re-run job; if DB has events but feed truncates: file bug bead — should not happen on current build |
1057
+ | bd "database not found" or per-project Dolt server respawn | bd has spawned a per-project Dolt instead of routing to the shared server | `ps aux \| grep "<repo>/.beads/dolt" \| awk '{print $2}' \| xargs -r kill -9`; ensure `.beads/config.yaml` contains `dolt.shared-server: true`; `bd ready` should now route to `~/.beads/shared-server/` |
1058
+ | Dolt journal corruption (`possible data loss detected at offset N`) | bd-internal | Operator-only — do NOT auto-recover. Stop bd writes, snapshot `~/.beads/shared-server/dolt`, run `dolt fsck` (read-only) first. Operator decides on `--revive-journal-with-data-loss` after reviewing the warning |
1059
+
1060
+ ## What Orchestrator Does Differently Because Of This Skill
1061
+
1062
+ - Writes bead contract before dispatch.
1063
+ - Chooses edge type before creating chain.
1064
+ - Uses specialist role by job shape, not by habit.
1065
+ - Keeps fix loops alive with resume, not re-spawn.
1066
+ - Treats reviewer PASS as only publish gate.
1067
+ - Maps file-overlap surface BEFORE dispatching parallel waves.
1068
+ - Files one READ_ONLY test-failure-map bead before fix chains when ≥5 failures span subsystems.
1069
+ - Uses overthinker and reviewer as conversation, not one-shot oracles — rebuts with cited evidence once, then escalates.
1070
+ - Smokes every npm script and entry point before declaring integration done; runs cross-cutting security-auditor on cumulative diff when sensitive surfaces were touched.
1071
+ - Commits debugger-restitch results via FF or cherry-pick of the named commit, not the checkpoint commit above it.
1072
+ - Closes finished chain's bead BEFORE committing that worktree when other chains still in_progress (project-wide commit-gate).
1073
+ - Runs `/session-close-report` at session end and only then declares done.
1074
+ - Keeps memory-processor, xt-merge, session-close-report, and releasing out of this skill on purpose — each has its own.