@stravica-ai/digital-operator-pa 0.1.0

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 (372) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +170 -0
  3. package/bin/desk +9 -0
  4. package/bin/distill +2 -0
  5. package/bin/estate-sync +2 -0
  6. package/bin/launch +2 -0
  7. package/bin/memory-sync +2 -0
  8. package/bin/migrate-inspect +2 -0
  9. package/bin/pa +2 -0
  10. package/bin/pa-coordinator-hook +2 -0
  11. package/bin/pa-init +2 -0
  12. package/bin/research +2 -0
  13. package/bin/scheduler +2 -0
  14. package/bin/secrets +2 -0
  15. package/bin/slice +2 -0
  16. package/bin/smoke +9 -0
  17. package/bin/sync +2 -0
  18. package/dist/engineering-pa-cli/README.md +205 -0
  19. package/dist/engineering-pa-cli/bin/estate-sync +2 -0
  20. package/dist/engineering-pa-cli/bin/launch +2 -0
  21. package/dist/engineering-pa-cli/bin/pa +2 -0
  22. package/dist/engineering-pa-cli/bin/pa-coordinator-hook +12 -0
  23. package/dist/engineering-pa-cli/bin/research +2 -0
  24. package/dist/engineering-pa-cli/bin/scheduler +2 -0
  25. package/dist/engineering-pa-cli/bin/secrets +2 -0
  26. package/dist/engineering-pa-cli/bin/smoke +9 -0
  27. package/dist/engineering-pa-cli/bin/sync +2 -0
  28. package/dist/engineering-pa-cli/config/coordinator-allowlist.json +118 -0
  29. package/dist/engineering-pa-cli/docs/coordinator-hook.md +211 -0
  30. package/dist/engineering-pa-cli/docs/estate-sync.md +412 -0
  31. package/dist/engineering-pa-cli/docs/gsc.md +175 -0
  32. package/dist/engineering-pa-cli/docs/lint-linkedin.md +139 -0
  33. package/dist/engineering-pa-cli/docs/secrets.md +221 -0
  34. package/dist/engineering-pa-cli/docs/smoke.md +113 -0
  35. package/dist/engineering-pa-cli/docs/staging-alias.md +114 -0
  36. package/dist/engineering-pa-cli/index.mjs +17 -0
  37. package/dist/engineering-pa-cli/package.json +37 -0
  38. package/dist/engineering-pa-cli/src/autonomy/cli.mjs +329 -0
  39. package/dist/engineering-pa-cli/src/autonomy/envelope.mjs +301 -0
  40. package/dist/engineering-pa-cli/src/coordinator-hook/cli.mjs +140 -0
  41. package/dist/engineering-pa-cli/src/coordinator-hook/config.mjs +134 -0
  42. package/dist/engineering-pa-cli/src/coordinator-hook/message.mjs +47 -0
  43. package/dist/engineering-pa-cli/src/coordinator-hook/policy.mjs +211 -0
  44. package/dist/engineering-pa-cli/src/coordinator-hook/repo-root.mjs +44 -0
  45. package/dist/engineering-pa-cli/src/coordinator-hook/self.mjs +30 -0
  46. package/dist/engineering-pa-cli/src/environment/cli.mjs +287 -0
  47. package/dist/engineering-pa-cli/src/environment/probes.mjs +302 -0
  48. package/dist/engineering-pa-cli/src/gsc/auth.mjs +148 -0
  49. package/dist/engineering-pa-cli/src/gsc/cli.mjs +93 -0
  50. package/dist/engineering-pa-cli/src/gsc/cloudflare.mjs +318 -0
  51. package/dist/engineering-pa-cli/src/gsc/commands/add-property.mjs +70 -0
  52. package/dist/engineering-pa-cli/src/gsc/commands/list-properties.mjs +33 -0
  53. package/dist/engineering-pa-cli/src/gsc/commands/pull-analytics.mjs +130 -0
  54. package/dist/engineering-pa-cli/src/gsc/commands/submit-sitemap.mjs +41 -0
  55. package/dist/engineering-pa-cli/src/gsc/commands/verify-via-cf-dns.mjs +189 -0
  56. package/dist/engineering-pa-cli/src/knowledge/call-log.mjs +59 -0
  57. package/dist/engineering-pa-cli/src/knowledge/cli.mjs +242 -0
  58. package/dist/engineering-pa-cli/src/knowledge/eval.mjs +446 -0
  59. package/dist/engineering-pa-cli/src/knowledge/formatters.mjs +331 -0
  60. package/dist/engineering-pa-cli/src/knowledge/graph.mjs +710 -0
  61. package/dist/engineering-pa-cli/src/launch/README.md +214 -0
  62. package/dist/engineering-pa-cli/src/launch/cli.mjs +51 -0
  63. package/dist/engineering-pa-cli/src/launch/commands/launch.mjs +106 -0
  64. package/dist/engineering-pa-cli/src/launch/identity.mjs +43 -0
  65. package/dist/engineering-pa-cli/src/launch/planner.mjs +44 -0
  66. package/dist/engineering-pa-cli/src/launch/repo-root.mjs +53 -0
  67. package/dist/engineering-pa-cli/src/launch/runner.mjs +147 -0
  68. package/dist/engineering-pa-cli/src/launch/task-loader.mjs +85 -0
  69. package/dist/engineering-pa-cli/src/lint/cli.mjs +61 -0
  70. package/dist/engineering-pa-cli/src/lint/commands/linkedin.mjs +133 -0
  71. package/dist/engineering-pa-cli/src/lint/detectors.mjs +90 -0
  72. package/dist/engineering-pa-cli/src/lint/linter.mjs +69 -0
  73. package/dist/engineering-pa-cli/src/lint/reporter.mjs +32 -0
  74. package/dist/engineering-pa-cli/src/lint/rules.mjs +132 -0
  75. package/dist/engineering-pa-cli/src/pa/cli.mjs +369 -0
  76. package/dist/engineering-pa-cli/src/pa/doc-groups.mjs +164 -0
  77. package/dist/engineering-pa-cli/src/pa/io.mjs +80 -0
  78. package/dist/engineering-pa-cli/src/pa/project-cli.mjs +385 -0
  79. package/dist/engineering-pa-cli/src/pa/projects.mjs +352 -0
  80. package/dist/engineering-pa-cli/src/pa/repo-root.mjs +64 -0
  81. package/dist/engineering-pa-cli/src/pa/session.mjs +254 -0
  82. package/dist/engineering-pa-cli/src/pa/work-cli.mjs +164 -0
  83. package/dist/engineering-pa-cli/src/pa/work.mjs +196 -0
  84. package/dist/engineering-pa-cli/src/pa/workstreams.mjs +201 -0
  85. package/dist/engineering-pa-cli/src/research/README.md +360 -0
  86. package/dist/engineering-pa-cli/src/research/briefs/extractor.md +103 -0
  87. package/dist/engineering-pa-cli/src/research/briefs/searcher.md +113 -0
  88. package/dist/engineering-pa-cli/src/research/briefs/synthesizer.md +124 -0
  89. package/dist/engineering-pa-cli/src/research/briefs/verifier.md +86 -0
  90. package/dist/engineering-pa-cli/src/research/cli.mjs +141 -0
  91. package/dist/engineering-pa-cli/src/research/commands/gates.mjs +176 -0
  92. package/dist/engineering-pa-cli/src/research/commands/list.mjs +56 -0
  93. package/dist/engineering-pa-cli/src/research/commands/mark.mjs +97 -0
  94. package/dist/engineering-pa-cli/src/research/commands/paths.mjs +69 -0
  95. package/dist/engineering-pa-cli/src/research/commands/prune.mjs +86 -0
  96. package/dist/engineering-pa-cli/src/research/commands/run.mjs +94 -0
  97. package/dist/engineering-pa-cli/src/research/commands/show.mjs +43 -0
  98. package/dist/engineering-pa-cli/src/research/docs/operator-present-flow.md +120 -0
  99. package/dist/engineering-pa-cli/src/research/format.mjs +59 -0
  100. package/dist/engineering-pa-cli/src/research/promote.mjs +260 -0
  101. package/dist/engineering-pa-cli/src/research/schema/finding.schema.json +55 -0
  102. package/dist/engineering-pa-cli/src/research/schema/gates.schema.json +34 -0
  103. package/dist/engineering-pa-cli/src/research/schema/manifest.schema.json +59 -0
  104. package/dist/engineering-pa-cli/src/research/schema/plan.schema.json +41 -0
  105. package/dist/engineering-pa-cli/src/research/schema/sources.schema.json +31 -0
  106. package/dist/engineering-pa-cli/src/research/store/findings.mjs +61 -0
  107. package/dist/engineering-pa-cli/src/research/store/gates.mjs +73 -0
  108. package/dist/engineering-pa-cli/src/research/store/index.mjs +312 -0
  109. package/dist/engineering-pa-cli/src/research/store/manifest.mjs +56 -0
  110. package/dist/engineering-pa-cli/src/research/store/plan.mjs +59 -0
  111. package/dist/engineering-pa-cli/src/research/store/sources.mjs +44 -0
  112. package/dist/engineering-pa-cli/src/research/store/validate.mjs +92 -0
  113. package/dist/engineering-pa-cli/src/research/workflows/research-normal.js +573 -0
  114. package/dist/engineering-pa-cli/src/scheduler/cli.mjs +197 -0
  115. package/dist/engineering-pa-cli/src/secrets/cli.mjs +254 -0
  116. package/dist/engineering-pa-cli/src/secrets/commands/backup-template.mjs +67 -0
  117. package/dist/engineering-pa-cli/src/secrets/commands/backup.mjs +85 -0
  118. package/dist/engineering-pa-cli/src/secrets/commands/delete.mjs +58 -0
  119. package/dist/engineering-pa-cli/src/secrets/commands/find.mjs +36 -0
  120. package/dist/engineering-pa-cli/src/secrets/commands/get.mjs +49 -0
  121. package/dist/engineering-pa-cli/src/secrets/commands/init.mjs +69 -0
  122. package/dist/engineering-pa-cli/src/secrets/commands/list.mjs +37 -0
  123. package/dist/engineering-pa-cli/src/secrets/commands/rotate.mjs +46 -0
  124. package/dist/engineering-pa-cli/src/secrets/commands/set.mjs +123 -0
  125. package/dist/engineering-pa-cli/src/secrets/commands/status.mjs +146 -0
  126. package/dist/engineering-pa-cli/src/secrets/commands/vaults.mjs +57 -0
  127. package/dist/engineering-pa-cli/src/secrets/commands/verify.mjs +143 -0
  128. package/dist/engineering-pa-cli/src/secrets/vault.mjs +766 -0
  129. package/dist/engineering-pa-cli/src/smoke/checks.mjs +199 -0
  130. package/dist/engineering-pa-cli/src/smoke/cli.mjs +108 -0
  131. package/dist/engineering-pa-cli/src/smoke/commands/run.mjs +237 -0
  132. package/dist/engineering-pa-cli/src/smoke/runner.mjs +191 -0
  133. package/dist/engineering-pa-cli/src/staging-alias/cli.mjs +91 -0
  134. package/dist/engineering-pa-cli/src/staging-alias/cloudflare.mjs +380 -0
  135. package/dist/engineering-pa-cli/src/staging-alias/commands/list.mjs +36 -0
  136. package/dist/engineering-pa-cli/src/staging-alias/commands/set.mjs +188 -0
  137. package/dist/engineering-pa-cli/src/staging-alias/commands/status.mjs +113 -0
  138. package/dist/engineering-pa-cli/src/staging-alias/commands/unset.mjs +95 -0
  139. package/dist/engineering-pa-cli/src/staging-alias/sites.mjs +105 -0
  140. package/dist/engineering-pa-cli/src/sync/cli.mjs +151 -0
  141. package/dist/engineering-pa-cli/src/sync/git.mjs +149 -0
  142. package/dist/engineering-pa-cli/src/sync/lock.mjs +30 -0
  143. package/dist/engineering-pa-cli/src/sync/regenerated-artifacts.mjs +114 -0
  144. package/dist/engineering-pa-cli/src/sync/registry-scope.mjs +260 -0
  145. package/dist/engineering-pa-cli/src/sync/run.mjs +531 -0
  146. package/dist/engineering-pa-cli/src/sync/runner.mjs +62 -0
  147. package/dist/engineering-pa-cli/src/sync/runs-digest.mjs +138 -0
  148. package/dist/engineering-pa-core/README.md +60 -0
  149. package/dist/engineering-pa-core/bin/desk +9 -0
  150. package/dist/engineering-pa-core/bin/distill +2 -0
  151. package/dist/engineering-pa-core/bin/memory-sync +2 -0
  152. package/dist/engineering-pa-core/bin/slice +2 -0
  153. package/dist/engineering-pa-core/docs/autonomy-envelope-tracker.md +111 -0
  154. package/dist/engineering-pa-core/docs/blueprints/README.md +45 -0
  155. package/dist/engineering-pa-core/docs/blueprints/docker-services/blueprint.md +168 -0
  156. package/dist/engineering-pa-core/docs/blueprints/git-identity/blueprint.md +116 -0
  157. package/dist/engineering-pa-core/docs/blueprints/ideas/custom-workspace-views.md +9 -0
  158. package/dist/engineering-pa-core/docs/blueprints/ideas/knowledge-domain-patterns.md +15 -0
  159. package/dist/engineering-pa-core/docs/blueprints/ideas/office-integration.md +11 -0
  160. package/dist/engineering-pa-core/docs/blueprints/ideas/team-scaling.md +9 -0
  161. package/dist/engineering-pa-core/docs/blueprints/ideas/work-personal-separation.md +9 -0
  162. package/dist/engineering-pa-core/docs/blueprints/scheduled-distillation/blueprint.md +129 -0
  163. package/dist/engineering-pa-core/docs/blueprints/tool-integration/blueprint.md +110 -0
  164. package/dist/engineering-pa-core/docs/commands/init.md +159 -0
  165. package/dist/engineering-pa-core/docs/commands/schedule.md +98 -0
  166. package/dist/engineering-pa-core/docs/commands/upgrade.md +67 -0
  167. package/dist/engineering-pa-core/docs/entity-location-map.md +93 -0
  168. package/dist/engineering-pa-core/docs/knowledge-scaffold.md +121 -0
  169. package/dist/engineering-pa-core/docs/lock.md +155 -0
  170. package/dist/engineering-pa-core/docs/memory-sync.md +28 -0
  171. package/dist/engineering-pa-core/docs/pa-operating-model.md +457 -0
  172. package/dist/engineering-pa-core/docs/scheduling.md +35 -0
  173. package/dist/engineering-pa-core/docs/standards/README.md +24 -0
  174. package/dist/engineering-pa-core/docs/standards/briefing-contract.md +161 -0
  175. package/dist/engineering-pa-core/docs/standards/tooling.md +240 -0
  176. package/dist/engineering-pa-core/docs/tools/distill.md +230 -0
  177. package/dist/engineering-pa-core/docs/tools/memory-sync.md +98 -0
  178. package/dist/engineering-pa-core/docs/tools/scheduler.md +243 -0
  179. package/dist/engineering-pa-core/docs/tools/slice.md +150 -0
  180. package/dist/engineering-pa-core/docs/upstream-issue-filing.md +88 -0
  181. package/dist/engineering-pa-core/docs/working-directory.md +29 -0
  182. package/dist/engineering-pa-core/docs/workspace-operations.md +46 -0
  183. package/dist/engineering-pa-core/index.mjs +21 -0
  184. package/dist/engineering-pa-core/knowledge/README.md +53 -0
  185. package/dist/engineering-pa-core/knowledge/canonical/.gitkeep +0 -0
  186. package/dist/engineering-pa-core/knowledge/content-voice/README.md +64 -0
  187. package/dist/engineering-pa-core/knowledge/content-voice/banned-ai-tells-baseline.md +133 -0
  188. package/dist/engineering-pa-core/knowledge/content-voice/banned-ai-tells-shape.md +58 -0
  189. package/dist/engineering-pa-core/knowledge/content-voice/banned-ai-tells-taxonomy.md +33 -0
  190. package/dist/engineering-pa-core/knowledge/content-voice/content-pipeline-routing.md +58 -0
  191. package/dist/engineering-pa-core/knowledge/content-voice/new-tell-capture-procedure.md +40 -0
  192. package/dist/engineering-pa-core/knowledge/content-voice/voice-guide-shape.md +43 -0
  193. package/dist/engineering-pa-core/knowledge/delegation-dispatch/README.md +34 -0
  194. package/dist/engineering-pa-core/knowledge/delegation-dispatch/briefing-contract.md +77 -0
  195. package/dist/engineering-pa-core/knowledge/delegation-dispatch/delegation-modes.md +84 -0
  196. package/dist/engineering-pa-core/knowledge/delegation-dispatch/dispatch-envelope.md +238 -0
  197. package/dist/engineering-pa-core/knowledge/delegation-dispatch/task-groups-and-orchestrators.md +62 -0
  198. package/dist/engineering-pa-core/knowledge/delegation-dispatch/team-improvement-loop.md +48 -0
  199. package/dist/engineering-pa-core/knowledge/delegation-dispatch/tool-development-policy.md +48 -0
  200. package/dist/engineering-pa-core/knowledge/engineering-discipline/README.md +33 -0
  201. package/dist/engineering-pa-core/knowledge/engineering-discipline/blast-radius-and-safety.md +50 -0
  202. package/dist/engineering-pa-core/knowledge/engineering-discipline/investigate-root-causes.md +48 -0
  203. package/dist/engineering-pa-core/knowledge/engineering-discipline/role-ladder.md +57 -0
  204. package/dist/engineering-pa-core/knowledge/engineering-discipline/verify-runtime-behaviour.md +53 -0
  205. package/dist/engineering-pa-core/knowledge/engineering-discipline/worktree-isolation.md +50 -0
  206. package/dist/engineering-pa-core/knowledge/knowledge-memory/README.md +33 -0
  207. package/dist/engineering-pa-core/knowledge/knowledge-memory/claude-md-hygiene.md +47 -0
  208. package/dist/engineering-pa-core/knowledge/knowledge-memory/journal-and-self-improvement.md +53 -0
  209. package/dist/engineering-pa-core/knowledge/knowledge-memory/knowledge-retrieval-discipline.md +62 -0
  210. package/dist/engineering-pa-core/knowledge/knowledge-memory/librarian-synthesis-mandate.md +56 -0
  211. package/dist/engineering-pa-core/knowledge/knowledge-memory/staging-and-observations.md +58 -0
  212. package/dist/engineering-pa-core/knowledge/operator-interface/README.md +32 -0
  213. package/dist/engineering-pa-core/knowledge/operator-interface/communication-style.md +33 -0
  214. package/dist/engineering-pa-core/knowledge/operator-interface/escalation-and-correction.md +45 -0
  215. package/dist/engineering-pa-core/knowledge/operator-interface/push-back-discipline.md +42 -0
  216. package/dist/engineering-pa-core/knowledge/operator-interface/session-boot-and-end.md +56 -0
  217. package/dist/engineering-pa-core/knowledge/platform-tooling/README.md +37 -0
  218. package/dist/engineering-pa-core/knowledge/platform-tooling/desk-cli-reference.md +52 -0
  219. package/dist/engineering-pa-core/knowledge/platform-tooling/environment-awareness.md +91 -0
  220. package/dist/engineering-pa-core/knowledge/platform-tooling/mcp-servers-catalogue.md +52 -0
  221. package/dist/engineering-pa-core/knowledge/platform-tooling/pa-cli-reference.md +55 -0
  222. package/dist/engineering-pa-core/knowledge/platform-tooling/scheduling-and-launchd.md +56 -0
  223. package/dist/engineering-pa-core/knowledge/platform-tooling/tool-discovery-discipline.md +49 -0
  224. package/dist/engineering-pa-core/knowledge/platform-tooling/working-directory-vs-project-root.md +43 -0
  225. package/dist/engineering-pa-core/knowledge/platform-tooling/workspace-server.md +51 -0
  226. package/dist/engineering-pa-core/knowledge/raw/.gitkeep +0 -0
  227. package/dist/engineering-pa-core/knowledge/scaffold/domains.json +5 -0
  228. package/dist/engineering-pa-core/knowledge/schema/.gitkeep +0 -0
  229. package/dist/engineering-pa-core/knowledge/work-management/README.md +33 -0
  230. package/dist/engineering-pa-core/knowledge/work-management/desk-cli.md +84 -0
  231. package/dist/engineering-pa-core/knowledge/work-management/progress-md.md +48 -0
  232. package/dist/engineering-pa-core/knowledge/work-management/projects.md +64 -0
  233. package/dist/engineering-pa-core/knowledge/work-management/spawn-log.md +48 -0
  234. package/dist/engineering-pa-core/knowledge/work-management/work-items.md +67 -0
  235. package/dist/engineering-pa-core/package.json +26 -0
  236. package/dist/engineering-pa-core/roles/agent-ops/definition.md +79 -0
  237. package/dist/engineering-pa-core/roles/dispatch-briefer/definition.md +195 -0
  238. package/dist/engineering-pa-core/roles/librarian/definition.md +176 -0
  239. package/dist/engineering-pa-core/roles/pa/definition.md +93 -0
  240. package/dist/engineering-pa-core/roles/system-admin/definition.md +106 -0
  241. package/dist/engineering-pa-core/roles/tool-developer/definition.md +116 -0
  242. package/dist/engineering-pa-core/roles/writer/definition.md +130 -0
  243. package/dist/engineering-pa-core/schema/autonomy-envelope.schema.json +61 -0
  244. package/dist/engineering-pa-core/schema/project.json +114 -0
  245. package/dist/engineering-pa-core/schema/schedule.json +63 -0
  246. package/dist/engineering-pa-core/schema/work-item.json +92 -0
  247. package/dist/engineering-pa-core/src/config/pa-package-name.mjs +30 -0
  248. package/dist/engineering-pa-core/src/desk/cli.mjs +95 -0
  249. package/dist/engineering-pa-core/src/desk/commands.mjs +398 -0
  250. package/dist/engineering-pa-core/src/desk/format.mjs +84 -0
  251. package/dist/engineering-pa-core/src/desk/repo.mjs +172 -0
  252. package/dist/engineering-pa-core/src/desk/team-scope.mjs +142 -0
  253. package/dist/engineering-pa-core/src/distill/cli.mjs +112 -0
  254. package/dist/engineering-pa-core/src/distill/prereqs.mjs +171 -0
  255. package/dist/engineering-pa-core/src/distill/prompt.mjs +74 -0
  256. package/dist/engineering-pa-core/src/distill/run.mjs +230 -0
  257. package/dist/engineering-pa-core/src/distill/runner.mjs +86 -0
  258. package/dist/engineering-pa-core/src/distill/staging.mjs +59 -0
  259. package/dist/engineering-pa-core/src/knowledge/retrieval/backlink-indexer.mjs +154 -0
  260. package/dist/engineering-pa-core/src/knowledge/retrieval/graph-builder.mjs +186 -0
  261. package/dist/engineering-pa-core/src/knowledge/retrieval/index-builder.mjs +225 -0
  262. package/dist/engineering-pa-core/src/knowledge/retrieval/query.mjs +263 -0
  263. package/dist/engineering-pa-core/src/lock/lock.mjs +202 -0
  264. package/dist/engineering-pa-core/src/memory-sync/cli-support.mjs +12 -0
  265. package/dist/engineering-pa-core/src/memory-sync/cli.mjs +56 -0
  266. package/dist/engineering-pa-core/src/memory-sync/commands/pull.mjs +44 -0
  267. package/dist/engineering-pa-core/src/memory-sync/commands/push.mjs +46 -0
  268. package/dist/engineering-pa-core/src/memory-sync/mirror.mjs +114 -0
  269. package/dist/engineering-pa-core/src/memory-sync/repo.mjs +65 -0
  270. package/dist/engineering-pa-core/src/scheduler/detect.mjs +111 -0
  271. package/dist/engineering-pa-core/src/scheduler/host.mjs +38 -0
  272. package/dist/engineering-pa-core/src/scheduler/index.mjs +13 -0
  273. package/dist/engineering-pa-core/src/scheduler/install.mjs +854 -0
  274. package/dist/engineering-pa-core/src/scheduler/list.mjs +168 -0
  275. package/dist/engineering-pa-core/src/scheduler/remove.mjs +176 -0
  276. package/dist/engineering-pa-core/src/scheduler/verify.mjs +435 -0
  277. package/dist/engineering-pa-core/src/session-boot/autonomy-injection.mjs +84 -0
  278. package/dist/engineering-pa-core/src/slice/cli.mjs +139 -0
  279. package/dist/engineering-pa-core/src/slice/inputs.mjs +174 -0
  280. package/dist/engineering-pa-core/src/slice/prompt.mjs +94 -0
  281. package/dist/engineering-pa-core/src/slice/prompts/dave-boot.md +91 -0
  282. package/dist/engineering-pa-core/src/slice/run.mjs +334 -0
  283. package/dist/engineering-pa-core-extensions-atlassian/README.md +31 -0
  284. package/dist/engineering-pa-core-extensions-atlassian/index.mjs +9 -0
  285. package/dist/engineering-pa-core-extensions-atlassian/package.json +19 -0
  286. package/dist/engineering-pa-core-extensions-n8n/README.md +29 -0
  287. package/dist/engineering-pa-core-extensions-n8n/index.mjs +8 -0
  288. package/dist/engineering-pa-core-extensions-n8n/package.json +19 -0
  289. package/dist/engineering-pa-librarian/README.md +38 -0
  290. package/dist/engineering-pa-librarian/index.mjs +12 -0
  291. package/dist/engineering-pa-librarian/package.json +19 -0
  292. package/dist/engineering-pa-migrate-inspect/README.md +131 -0
  293. package/dist/engineering-pa-migrate-inspect/bin/migrate-inspect +2 -0
  294. package/dist/engineering-pa-migrate-inspect/package.json +21 -0
  295. package/dist/engineering-pa-migrate-inspect/src/age-key-migrate.mjs +83 -0
  296. package/dist/engineering-pa-migrate-inspect/src/cli.mjs +97 -0
  297. package/dist/engineering-pa-migrate-inspect/src/inspector.mjs +237 -0
  298. package/dist/engineering-pa-migrate-inspect/src/platforms/linux.mjs +87 -0
  299. package/dist/engineering-pa-migrate-inspect/src/platforms/macos.mjs +105 -0
  300. package/dist/engineering-pa-migrate-inspect/src/runner.mjs +87 -0
  301. package/dist/engineering-pa-runbook/README.md +103 -0
  302. package/dist/engineering-pa-runbook/package.json +18 -0
  303. package/dist/engineering-pa-runbook/reference/dex-template.runbook.json +66 -0
  304. package/dist/engineering-pa-runbook/reference/hq-dave.runbook.json +69 -0
  305. package/dist/engineering-pa-runbook/reference/smarthome01.runbook.json +92 -0
  306. package/dist/engineering-pa-runbook/schema/inspection.schema.json +113 -0
  307. package/dist/engineering-pa-runbook/schema/runbook.schema.json +67 -0
  308. package/dist/engineering-pa-runbook/src/validator.mjs +167 -0
  309. package/dist/engineering-pa-scaffold/README.md +164 -0
  310. package/dist/engineering-pa-scaffold/bin/pa-init +2 -0
  311. package/dist/engineering-pa-scaffold/index.mjs +42 -0
  312. package/dist/engineering-pa-scaffold/package.json +22 -0
  313. package/dist/engineering-pa-scaffold/src/cli.mjs +115 -0
  314. package/dist/engineering-pa-scaffold/src/commands/init.mjs +169 -0
  315. package/dist/engineering-pa-scaffold/src/generator.mjs +354 -0
  316. package/dist/engineering-pa-scaffold/src/prompts.mjs +125 -0
  317. package/dist/engineering-pa-scaffold/src/runner.mjs +142 -0
  318. package/dist/engineering-pa-scaffold/templates/CLAUDE.md.template +196 -0
  319. package/dist/engineering-pa-scaffold/templates/operator-README.md.template +44 -0
  320. package/dist/engineering-pa-types-engineering/README.md +35 -0
  321. package/dist/engineering-pa-types-engineering/docs/commands/product-build.md +120 -0
  322. package/dist/engineering-pa-types-engineering/index.mjs +9 -0
  323. package/dist/engineering-pa-types-engineering/package.json +19 -0
  324. package/dist/engineering-pa-types-engineering/roles/product-engineer/definition.md +650 -0
  325. package/dist/engineering-pa-types-engineering/roles/product-engineer/templates/build-spec.md +82 -0
  326. package/dist/engineering-pa-types-engineering/roles/product-engineer/templates/preflight-checklist.md +158 -0
  327. package/dist/engineering-pa-types-engineering/roles/product-engineer/templates/worker-brief.md +130 -0
  328. package/dist/engineering-pa-workspace/README.md +197 -0
  329. package/dist/engineering-pa-workspace/app/assets/md.js +187 -0
  330. package/dist/engineering-pa-workspace/app/assets/modal.js +120 -0
  331. package/dist/engineering-pa-workspace/app/assets/theme.css +132 -0
  332. package/dist/engineering-pa-workspace/app/assets/theme.js +159 -0
  333. package/dist/engineering-pa-workspace/app/banner.js +320 -0
  334. package/dist/engineering-pa-workspace/app/delegations.html +345 -0
  335. package/dist/engineering-pa-workspace/app/home.html +1060 -0
  336. package/dist/engineering-pa-workspace/app/index.html +361 -0
  337. package/dist/engineering-pa-workspace/app/knowledge-map.html +163 -0
  338. package/dist/engineering-pa-workspace/app/knowledge.html +304 -0
  339. package/dist/engineering-pa-workspace/app/nav.json +75 -0
  340. package/dist/engineering-pa-workspace/app/notes.html +199 -0
  341. package/dist/engineering-pa-workspace/app/onboarding.html +592 -0
  342. package/dist/engineering-pa-workspace/app/profile.html +243 -0
  343. package/dist/engineering-pa-workspace/app/project-detail.html +432 -0
  344. package/dist/engineering-pa-workspace/app/projects.html +297 -0
  345. package/dist/engineering-pa-workspace/app/repos.html +598 -0
  346. package/dist/engineering-pa-workspace/app/schedules.html +486 -0
  347. package/dist/engineering-pa-workspace/app/secrets.html +164 -0
  348. package/dist/engineering-pa-workspace/app/staging.html +319 -0
  349. package/dist/engineering-pa-workspace/app/tasks.html +465 -0
  350. package/dist/engineering-pa-workspace/app/vendor/chart.umd.min.js +21 -0
  351. package/dist/engineering-pa-workspace/app/viewer.html +116 -0
  352. package/dist/engineering-pa-workspace/docs/DAEMON.md +104 -0
  353. package/dist/engineering-pa-workspace/docs/page-blueprint.md +286 -0
  354. package/dist/engineering-pa-workspace/docs/status-mon.md +168 -0
  355. package/dist/engineering-pa-workspace/index.mjs +12 -0
  356. package/dist/engineering-pa-workspace/nav.json.example +8 -0
  357. package/dist/engineering-pa-workspace/package.json +27 -0
  358. package/dist/engineering-pa-workspace/src/api.mjs +2086 -0
  359. package/dist/engineering-pa-workspace/src/install-daemon.mjs +573 -0
  360. package/dist/engineering-pa-workspace/src/nav.mjs +190 -0
  361. package/dist/engineering-pa-workspace/src/secrets-api.mjs +175 -0
  362. package/dist/engineering-pa-workspace/src/server.mjs +516 -0
  363. package/dist/engineering-pa-workspace/src/status-mon/poll.mjs +220 -0
  364. package/dist/engineering-pa-workspace/src/status-mon/poller.mjs +113 -0
  365. package/dist/engineering-pa-workspace/src/status-mon/run.mjs +133 -0
  366. package/dist/engineering-pa-workspace/src/supervisor.mjs +264 -0
  367. package/dist/engineering-pa-workspace/src/ws.mjs +633 -0
  368. package/index.mjs +60 -0
  369. package/package.json +58 -0
  370. package/templates/banned-ai-tells.md +102 -0
  371. package/templates/purpose.md +105 -0
  372. package/templates/voice-guide.md +98 -0
@@ -0,0 +1,360 @@
1
+ # research
2
+
3
+ `ai.stravica.knowledge.research` — deep-research **session store CLI**. Creates,
4
+ validates, inspects and prunes research sessions on disk, and owns the camelCase
5
+ schemas that every downstream research workflow reads and writes.
6
+
7
+ This is the state layer under the `/research` engine (build-spec `deep-research`,
8
+ §3). It is **not** the engine: `run` creates the session shell and prints the plan;
9
+ it does not orchestrate searchers, verifiers, or synthesis. Actual fan-out lands in
10
+ the Workflow scripts (w-017+) which read and write the session dir this tool defines.
11
+
12
+ Built to the platform **tooling standard** (`@stravica-ai/digital-operator-pa` →
13
+ `engineering-pa-core/docs/standards/tooling.md`): zero runtime dependencies,
14
+ hand-rolled validation, a single write chokepoint, `node:test` only, camelCase JSON
15
+ throughout.
16
+
17
+ ---
18
+
19
+ ## Status
20
+
21
+ **v1 — session store.** Implements `run`, `list`, `show`, `gates`, `prune`,
22
+ `mark done`, `--help`. Owns all five schemas (`manifest`, `plan`, `finding`,
23
+ `sources`, `gates`).
24
+
25
+ - `run` creates the session (dir + manifest + skeleton plan), validates inputs,
26
+ prints the plan, and returns. It never spawns workers.
27
+ - `gates --retry` marks eligible gates as `retrying` and prints them; the actual
28
+ re-execution mechanism is workflow-side (**w-018**, out of scope here).
29
+ - `mark done` on a **normal**/**deep** session promotes the answer into the operator
30
+ knowledge library (**w-021**; light never promotes). See
31
+ [Knowledge-library promotion](#knowledge-library-promotion-on-mark-done).
32
+
33
+ Deferred (not this tool): the `/research` skill (w-016), the workflow scripts
34
+ (w-017), gate escalation / worker park-resume (w-018), judge scoring and presets
35
+ (v2/v3). Findings are **written by workers**; this tool only reads and validates them.
36
+
37
+ ## Install / invoke
38
+
39
+ Ships as part of `@stravica-ai/digital-operator-pa`. From an operator repo:
40
+
41
+ ```sh
42
+ pnpm exec research <command>
43
+ # or through the pa umbrella:
44
+ pnpm exec pa research <command>
45
+ ```
46
+
47
+ Path resolution: the CLI walks upward from CWD (or reads `$DAVE_REPO_ROOT` /
48
+ `$PA_REPO_ROOT`) to find the operator repo root, and lands sessions under
49
+ `<repoRoot>/.cache/research/sessions/`. Promoted answers land in
50
+ `<repoRoot>/operator/knowledge/research/`. The four workflow-facing paths
51
+ (sessionsDir, briefsDir, workflowsDir, schemaDir) are emitted by
52
+ `research paths --json` — the `/research` skill uses that to wire Workflow
53
+ dispatches without hard-coding install locations.
54
+
55
+ Zero runtime dependencies; Node 24+ (Node standard library only:
56
+ `node:util`, `node:fs/promises`, `node:path`, `node:crypto`, `node:test`).
57
+
58
+ ## Commands
59
+
60
+ ### `run` — create a session
61
+
62
+ ```
63
+ research run --mode <light|normal|deep> --question "..."
64
+ [--gate <operatorPresent|background|worker>]
65
+ [--intent "..."] [--output <shortAnswer|article|structured>]
66
+ [--dry-run]
67
+ ```
68
+
69
+ Creates `sessions/<sessionId>/` with `manifest.json`, a skeleton `plan.json`
70
+ (mode-derived `deepeningRounds`/`verificationTier`, empty `subQuestions` — the
71
+ workflow fills those), plus empty `sources.json` and `gates.json`. Validates every
72
+ input, prints the manifest + plan, returns.
73
+
74
+ - `--mode` (required): `light` (0 rounds, no verify), `normal` (1 round,
75
+ central-3vote), `deep` (3 rounds, diverse-lens-3vote).
76
+ - `--gate` (default `worker`): human-gate posture recorded in the manifest (§6).
77
+ - `--intent` (optional): clarified intent, recorded on the manifest.
78
+ - `--output` (default `shortAnswer`): synthesis render target.
79
+ - `--dry-run`: validate and print **without persisting** — the only branch that
80
+ does not write to disk.
81
+
82
+ ```sh
83
+ research run --mode normal --question "Compare Postgres vs SQLite for embedded use"
84
+ research run --mode light --question "What is a ULID?" --dry-run
85
+ ```
86
+
87
+ Exit: `0` created (or validated, for `--dry-run`); `1` bad/missing `--mode`,
88
+ `--question`, `--gate`, or `--output`; `3` disk write failure.
89
+
90
+ ### `list` — list sessions
91
+
92
+ ```
93
+ research list [--status <draft|in-progress|done|aborted>] [--all] [--json]
94
+ ```
95
+
96
+ Sessions newest-first (the `sessionId` sorts by creation time). Default: 20 most
97
+ recent. `--all` lists every session; `--status` filters; `--json` emits manifests.
98
+ Malformed session dirs are surfaced (not silently dropped) with a `MALFORMED` marker.
99
+
100
+ ```sh
101
+ research list
102
+ research list --status done --all
103
+ research list --json
104
+ ```
105
+
106
+ Exit: `0` always on success (empty list prints `no sessions`); `1` bad `--status`;
107
+ `3` disk read failure.
108
+
109
+ ### `show` — dump one session
110
+
111
+ ```
112
+ research show <sessionId> [--json]
113
+ ```
114
+
115
+ Prints the manifest, plan, findings summary (per sub-question: confidence,
116
+ `UNSOURCED` flag, verification votes), source count, and gate summary. `--json`
117
+ emits the full assembled `{ manifest, plan, sources, gates, findings }` object.
118
+
119
+ ```sh
120
+ research show 01KWYG…
121
+ research show 01KWYG… --json
122
+ ```
123
+
124
+ Exit: `0` shown; `1` missing/invalid `<sessionId>`; `2` session not found or a
125
+ session file is malformed; `3` disk read failure.
126
+
127
+ ### `gates` — inspect / mark the human-gate queue
128
+
129
+ ```
130
+ research gates --list [<sessionId>] [--json]
131
+ research gates --retry <sessionId> [--json]
132
+ research gates --append <sessionId> [--record '<json>'] [--json]
133
+ ```
134
+
135
+ - `--list`: aggregate the gate queue across all sessions, or one session if a
136
+ `<sessionId>` is given. Prints session, gate id, status, type, url, what-is-needed.
137
+ - `--retry <sessionId>`: mark eligible gates (`pending` or `retrying`) as `retrying`
138
+ and print them. This only **marks** — actual re-fetching is workflow-side (a v2
139
+ resume mechanism; for v1 `retrying` means "queued for an operator to hand-run").
140
+ Nothing eligible is a clean no-op.
141
+ - `--append <sessionId>`: append gate records to the session's `gates.json`. Records
142
+ arrive as a **JSON array on stdin**, or a single object via `--record '<json>'`
143
+ (when `--record` is given, stdin is not read). This is the write path the
144
+ `research-normal.js` workflow's Finalise phase uses to persist each searcher's
145
+ `gatedDropped[]` records (background-posture gates), so a later operator-present
146
+ session can sweep them.
147
+
148
+ Each record supplies the **semantic** fields — `url`, `gateType`, `whatIsNeeded`
149
+ (all required), and an optional `subQuestionId`. The verb owns the rest: it assigns
150
+ a stable id (`g-N`, continuing from the last existing id), sets `blockedAt` from the
151
+ clock, and defaults `status` to `pending`. A record may override `status` (validated
152
+ against `pending|retrying|resolved|failed`). Unknown fields, a bad status enum, or a
153
+ missing required field are usage errors (exit 1). The write goes through the store
154
+ chokepoint (`store.writeGates`), which validates the whole file before persist.
155
+
156
+ ```sh
157
+ research gates --list
158
+ research gates --list 01KWYG…
159
+ research gates --retry 01KWYG…
160
+ echo '[{"url":"https://x","gateType":"cloudflare","whatIsNeeded":"clear the challenge","subQuestionId":"sq-2"}]' \
161
+ | research gates --append 01KWYG…
162
+ research gates --append 01KWYG… --record '{"url":"https://y","gateType":"login","whatIsNeeded":"sign in"}'
163
+ ```
164
+
165
+ Exit: `0` on success (incl. empty queue / nothing eligible); `1` if not exactly one
166
+ of `--list`/`--retry`/`--append` is given, an invalid `<sessionId>`, bad JSON, or an
167
+ invalid record; `2` if an explicitly named session does not exist, or `--append` was
168
+ handed zero records; `3` disk read/write failure.
169
+
170
+ ### `prune` — delete old / matching sessions
171
+
172
+ ```
173
+ research prune [--older-than <days>] [--status <status>] [--dry-run]
174
+ ```
175
+
176
+ Deletes sessions older than N days **and/or** matching a status (filters AND
177
+ together). **At least one filter is required** — a bare `prune` is a usage error, so
178
+ a fat-fingered command can never wipe everything. `--dry-run` previews the deletion.
179
+ Malformed sessions (no readable manifest) are never matched.
180
+
181
+ ```sh
182
+ research prune --older-than 30
183
+ research prune --status aborted --dry-run
184
+ research prune --older-than 7 --status done
185
+ ```
186
+
187
+ Exit: `0` deleted (or previewed); `1` no filter given, or bad `--older-than` /
188
+ `--status`; `2` the explicit filter matched no sessions; `3` disk delete failure.
189
+
190
+ ### `mark` — set a terminal status
191
+
192
+ ```
193
+ research mark <done|aborted> <sessionId> [--no-promote | --promote]
194
+ ```
195
+
196
+ Sets `manifest.status` to a terminal value and bumps `updatedAt`:
197
+
198
+ - **`done`** — the session finalised successfully. A completed research run (light
199
+ recipe or the `research-normal.js` workflow) calls it to move the session out of
200
+ `draft`/`in-progress` so `list --status done` becomes meaningful.
201
+ - **`aborted`** — the session was abandoned before a usable answer. The
202
+ `research-normal.js` workflow's `>10%`-unsourced guardrail (build-spec §8) stamps a
203
+ run `aborted` so it reads correctly in `list`/`show` instead of lingering as
204
+ `in-progress`.
205
+
206
+ This is the one verb that mutates an existing session's status. Both transitions are
207
+ **one-way**: a session already `done` or `aborted` is refused (exit `2`), the same
208
+ posture as a `prune` filter that matches nothing. The write goes through the store
209
+ chokepoint (`store.updateManifestStatus`), which reads, guards the terminal
210
+ transition, validates, and persists.
211
+
212
+ ```sh
213
+ research mark done 01KWYG…
214
+ research mark aborted 01KWYG…
215
+ ```
216
+
217
+ #### Knowledge-library promotion (on `mark done`)
218
+
219
+ `mark done` on a **normal** or **deep** session promotes the session's verbatim
220
+ `answer.md` into the operator knowledge library at
221
+ `operator/knowledge/research/<sessionId>-<slug>.md`, so `pa knowledge` surfaces it
222
+ as a first-class queryable doc instead of leaving it in this tool's local session
223
+ store. The write goes through one dedicated function (`src/promote.mjs`) — the only
224
+ place that writes to `operator/knowledge/`.
225
+
226
+ - **light** — **never** promoted (operator directive; quick lookups don't warrant a
227
+ library entry). The skip is silent. Passing `--promote` on a light session is a
228
+ usage error (exit `1`).
229
+ - **`--no-promote`** (normal/deep) — skip promotion with a one-line note; the status
230
+ still moves to `done`. For sensitive-topic sessions.
231
+ - **`aborted`** — never promoted (incomplete evidence).
232
+ - **idempotent** — the target filename is deterministic; re-promotion is a no-op, and
233
+ `mark done` on an already-`done` session is refused (exit `2`) before promotion runs.
234
+
235
+ Promotion never fails the `mark`: the status is `done` on disk before the library is
236
+ touched, and a missing `answer.md` (a session finalised without one) is a soft note.
237
+ The graph is **not** auto-rebuilt — after promotion, run the knowledge-reindex (the
238
+ 6-hourly cron, or the graph/index builders) so the doc becomes queryable; `mark done`
239
+ prints this hint. Front-matter carries `name`, `title`, `description`, `domain:
240
+ research`, `type: research-session`, `mode`, `sessionId`, `date`, and derived counts
241
+ (`sourceCount`, `verifiedCount`, `refutedCount`, `unverifiedCount`, `gatedCount`); the
242
+ graph builder itself keys off the `#` H1 (the question) and the `research/` path.
243
+
244
+ Exit: `0` marked (promotion outcome printed as a note); `1` missing/invalid
245
+ `<sessionId>`, bad/missing sub-verb, or `--promote` on light; `2` session not found,
246
+ or already `done`/`aborted`; `3` disk read/write failure.
247
+
248
+ ### `--help` / `-h`
249
+
250
+ Prints usage and exits `0`.
251
+
252
+ ## Exit codes
253
+
254
+ Per tooling standard §6. Translation happens **only** in `src/cli.mjs`; domain code
255
+ throws `Error` objects carrying `.exitCode`, and commands return a number.
256
+
257
+ | Code | Meaning |
258
+ |---|---|
259
+ | `0` | OK (incl. `--help`, `--dry-run`, and legitimate no-ops that are not an explicit empty prune) |
260
+ | `1` | Usage error — bad/missing args, unknown verb, bad enum value, missing or invalid `<sessionId>` |
261
+ | `2` | Operational failure — session not found, malformed session file, explicit `prune` filter matched nothing, `mark` on an already-terminal session, `gates --append` handed zero records |
262
+ | `3` | Transport/IO failure — disk read, write, mkdir, or delete error |
263
+
264
+ ## Operational discipline rules
265
+
266
+ - **Single write chokepoint (§7).** Every filesystem mutation for session state —
267
+ `mkdir`, `writeFile`, `rm` — lives in `src/store/index.mjs` and nowhere else.
268
+ There is deliberately no "write arbitrary path" API: callers write whole, validated
269
+ session artifacts. Validators (`src/store/*.mjs`) are pure and never touch disk.
270
+ Reads may fan out (commands read directly), but writes may not.
271
+ - **Validate before persist.** Every artifact is schema-checked before it reaches
272
+ disk; a validation failure leaves the tree untouched.
273
+ - **camelCase everywhere (§11).** Schemas, session files, and `--json` output all use
274
+ camelCase property names. No exceptions.
275
+ - **`sessions/` is gitignored (§16).** Runtime session data is operational and never
276
+ git-tracked. The directory is kept in git via `sessions/.gitkeep`; its contents are
277
+ ignored by the tool-root `.gitignore`.
278
+ - **`run` never orchestrates.** It creates the session shell and prints the plan.
279
+ Any code that spawns research workers belongs in a workflow, not here.
280
+
281
+ ## sessionId scheme
282
+
283
+ ULID-like: a 26-character Crockford base32 string = a 10-char millisecond timestamp
284
+ (48 bits, **lexicographically sortable by creation time**) followed by 16 chars of
285
+ `crypto.randomBytes` entropy (80 bits, **collision-safe**). Uppercase, excludes
286
+ `I L O U`. Sortable ids mean `list` and `prune` can order and age sessions from the
287
+ id alone, and the entropy makes same-millisecond collisions vanishingly unlikely.
288
+
289
+ ## Schemas
290
+
291
+ Machine-readable JSON Schemas (documentation-grade) live in `src/schema/*.schema.json`;
292
+ the authoritative, enforced validators are the hand-rolled ones in `src/store/*.mjs`.
293
+ All camelCase.
294
+
295
+ | File | Location | Written by | Purpose |
296
+ |---|---|---|---|
297
+ | `manifest.json` | session root | this tool (`run`) | session identity, mode, gate policy, status, budget, assumptions |
298
+ | `plan.json` | session root | `run` (skeleton) → workflow (subQuestions) | dependency-classified decomposition, rounds, verification tier |
299
+ | `findings/sq-<id>.json` | `findings/` | **workers** | one finding per sub-question: summary, quotes, sources, confidence, votes |
300
+ | `sources.json` | session root | workflow | aggregated source registry referenced by findings |
301
+ | `gates.json` | session root | `gates --append` / `gates --retry` | human-gate retry queue |
302
+
303
+ Enum values follow the build-spec's own spelling: `gatePolicy` is
304
+ `operatorPresent | background | worker` (build-spec §6), source `kind` is
305
+ `web | playwright | kb | codebase | prior-session`, verification tiers are
306
+ `none | central-3vote | diverse-lens-3vote`.
307
+
308
+ ## Project layout
309
+
310
+ Ships inside `@stravica-ai/engineering-pa-cli` (bundled into `@stravica-ai/digital-operator-pa`).
311
+ Sources at `packages/cli/src/research/`, tests at `packages/cli/test/research/`,
312
+ bin at `packages/cli/bin/research` (also exposed as `packages/engineering-pa/bin/research`
313
+ in the shipped tarball).
314
+
315
+ ```
316
+ packages/cli/src/research/
317
+ cli.mjs # arg parsing, verb routing, the ONLY exit-code translation
318
+ format.mjs # pure string renderers (tables, summaries) — no I/O
319
+ promote.mjs # knowledge-library promotion (mark done → operator/knowledge/research)
320
+ store/
321
+ index.mjs # WRITE CHOKEPOINT: session-dir CRUD, id gen, path resolution, reads
322
+ validate.mjs # shared hand-rolled validation primitives (zero-dep)
323
+ manifest.mjs plan.mjs findings.mjs sources.mjs gates.mjs
324
+ commands/
325
+ run.mjs list.mjs show.mjs gates.mjs prune.mjs mark.mjs paths.mjs
326
+ schema/
327
+ *.schema.json # documentation-grade JSON Schemas (camelCase)
328
+ briefs/ # dispatch briefs the /research skill workflow feeds to subagents
329
+ workflows/ # workflow scripts (research-normal.js et al.)
330
+ docs/ # operator-facing docs (operator-present-flow.md, …)
331
+ ```
332
+
333
+ Runtime data lives under `<repoRoot>/.cache/research/sessions/` — resolved via
334
+ `getRepoRoot()` (env-var override `DAVE_REPO_ROOT` / `PA_REPO_ROOT`, else walks
335
+ upward for a `.git` entry). Promoted answers land in `<repoRoot>/operator/knowledge/research/`.
336
+ The `paths` verb exposes the four workflow-facing paths as JSON.
337
+
338
+ `validate.mjs` and `format.mjs` are internal helpers outside the store/commands
339
+ split — pure, no I/O, added to keep the five validators and the renderers DRY.
340
+
341
+ ## Tests
342
+
343
+ ```sh
344
+ node --test # from the tool root — auto-discovers test/*.test.mjs
345
+ ```
346
+
347
+ (`node --test test/` — the dir-argument form — is broken under Node 24; use bare
348
+ `node --test` or an explicit glob `node --test test/*.test.mjs`.)
349
+
350
+ Dependency injection over mocking (§8): commands take an optional `{ store, now,
351
+ stdout, stderr }` so tests bind a temp-dir store, a fixed clock, and capturing
352
+ streams. Validators and renderers are pure and tested input-to-output. The write
353
+ chokepoint is exercised against a real temp directory.
354
+
355
+ ## The tooling standard
356
+
357
+ This tool is governed by the platform tooling standard. Sections that bind it most
358
+ directly: §3 (zero dependencies), §4 (project structure), §6 (exit codes), §7
359
+ (chokepoint pattern — the store module), §9 (this README as contract), §11 (camelCase
360
+ JSON), §16 (gitignored operational artefacts). See the standard for the full contract.
@@ -0,0 +1,103 @@
1
+ # Brief — extractor (deep-research, mode `normal`)
2
+
3
+ You are an **extractor** in the `research-normal.js` pipeline. One extractor handles
4
+ **one sub-question**, reading the sources the searcher returned for it and pulling
5
+ **falsifiable, quote-grounded claims**. You do not verify and you do not write files —
6
+ you return structured claims for the workflow to rank and verify.
7
+
8
+ The dispatching workflow supplies concrete values for every `{{placeholder}}` below.
9
+
10
+ ## 1. Goal
11
+
12
+ For sub-question **`{{subQuestionId}}`** — *"{{subQuestionText}}"* — read each provided
13
+ source and extract the specific, checkable claims that answer it. Every claim MUST
14
+ carry a **direct verbatim quote** from a named source. A claim without a quote is not
15
+ a claim — drop it or mark it unsourced. Rate each claim's `importance` and its
16
+ source's `sourceQuality`.
17
+
18
+ ## 2. Trace
19
+
20
+ - Parent run: session `{{sessionId}}`, question *"{{sessionQuestion}}"*.
21
+ - You follow the searcher for this sub-question and precede the verifier. Your
22
+ `central` claims are the only ones that get 3-vote verification downstream;
23
+ `supporting`/`incidental` claims pass through as reported-not-verified. So rate
24
+ importance honestly — over-marking `central` wastes the verify budget, under-marking
25
+ it lets a load-bearing claim through unchecked.
26
+ - Sources available to you (searcher output for `{{subQuestionId}}`):
27
+ {{sources}}
28
+ (each is `{ sourceId, url, title }` — cite claims **only** against these ids.)
29
+
30
+ ## 3. Context
31
+
32
+ - **Falsifiable** = a claim that could in principle be shown false: a mechanism, a
33
+ number, a behaviour, a definition, a limit. Not vibes ("X is popular"), not
34
+ unfalsifiable hedges.
35
+ - **Mandatory quote.** `quote` is a verbatim span from the source at `sourceId`,
36
+ copied exactly (including code/output if that is the evidence). Do not paraphrase
37
+ into the quote field. If you cannot find a supporting span, the claim is unsourced.
38
+ - **importance** (matches the finding schema):
39
+ - `central` — directly answers `{{subQuestionId}}`; the finding stands or falls on it.
40
+ - `supporting` — corroborates or contextualises a central claim.
41
+ - `incidental` — true and relevant but minor.
42
+ - **sourceQuality** — carry through the searcher's rating for the cited source
43
+ (`primary | secondary | low`); downgrade if on reading it is weaker than it looked.
44
+ - Merge obvious duplicates: if two sources state the same fact, one claim citing the
45
+ stronger source is enough (note the corroboration in the claim text if useful).
46
+
47
+ ## 4. Tools & sources
48
+
49
+ - `Read` the searcher's snippets and, when a snippet is too thin to ground a quote,
50
+ `WebFetch` the source `url` to read the passage in full. Stay tight — you are
51
+ extracting from a known short list, not searching.
52
+ - Do not go looking for *new* sources; if the provided set cannot support a claim, that
53
+ claim is unsourced. (New searches are the deepen round's job, not yours.)
54
+
55
+ ## 5. Boundaries
56
+
57
+ - No verification (do not judge whether a claim is *true* — only whether the source
58
+ *says* it, with a quote). No file writes. No synthesis.
59
+ - Cite only `sourceId`s from the provided set. Inventing a source id or quoting a URL
60
+ not in the set is a defect.
61
+ - Gated/unreachable source in the set → skip it, note it; do not attempt to bypass.
62
+
63
+ ## 6. Output format — structured return (enforced by the workflow's schema)
64
+
65
+ ```json
66
+ {
67
+ "subQuestionId": "{{subQuestionId}}",
68
+ "claims": [
69
+ {
70
+ "claimId": "c-1",
71
+ "text": "the falsifiable claim, self-contained",
72
+ "quote": "exact verbatim span from the source",
73
+ "sourceId": "s1-1",
74
+ "importance": "central",
75
+ "sourceQuality": "primary"
76
+ }
77
+ ],
78
+ "unsourcedClaims": 0,
79
+ "notes": "anything the synthesizer should know (conflicts between sources, gaps)"
80
+ }
81
+ ```
82
+
83
+ - `importance` ∈ `central | supporting | incidental`.
84
+ - `sourceQuality` ∈ `primary | secondary | low`.
85
+ - `claimId` is stable within your return (`c-1`, `c-2`, …).
86
+ - `unsourcedClaims` = count of answer-relevant assertions you could NOT ground in a
87
+ quote (report the count; do **not** emit them as claims). The workflow tracks the
88
+ unsourced ratio and fails a run that is >10% unsourced.
89
+ - `claims` may be empty (say why in `notes`).
90
+
91
+ ## 7. Done when
92
+
93
+ - Every emitted claim has a verbatim `quote` and a `sourceId` from the provided set,
94
+ an `importance`, and a `sourceQuality`; and `unsourcedClaims` honestly counts what
95
+ you had to leave out.
96
+
97
+ ## 8. Escalation
98
+
99
+ - **A source in the set is unreachable/gated** → skip it, add a `notes` line; extract
100
+ from the rest.
101
+ - **No groundable claims at all** → return `claims: []` with `notes` explaining
102
+ whether the sources were off-topic, too thin, or all gated. Do not manufacture a
103
+ claim to avoid an empty return.
@@ -0,0 +1,113 @@
1
+ # Brief — searcher (deep-research, mode `normal`)
2
+
3
+ You are a **searcher** in the `research-normal.js` pipeline. One searcher handles
4
+ **one sub-question**. Your job is *retrieval only*: find the best sources, tag their
5
+ quality, return citations. You do **not** extract claims — that is the extractor's job.
6
+
7
+ The dispatching workflow supplies concrete values for every `{{placeholder}}` below
8
+ in your dispatch message. Read them there; this file is the contract they fill in.
9
+
10
+ ## 1. Goal
11
+
12
+ For sub-question **`{{subQuestionId}}`** — *"{{subQuestionText}}"* — locate the
13
+ handful of highest-quality sources that would let a downstream extractor pull
14
+ falsifiable, quote-grounded claims. Return a ranked source list with a quality tag
15
+ and a short relevance snippet per source. Prefer few strong sources over many weak
16
+ ones: 3–6 genuinely authoritative hits beats 15 blog reposts.
17
+
18
+ ## 2. Trace
19
+
20
+ - Parent run: session `{{sessionId}}`, question *"{{sessionQuestion}}"*, intent
21
+ *"{{intent}}"*, gate policy `{{gatePolicy}}`.
22
+ - Sibling sub-questions (do **not** research these — another searcher owns each; know
23
+ them only to avoid overlap): {{siblingSubQuestions}}
24
+ - You precede the extractor for this same sub-question. Your `sources[]` become its
25
+ input, so every source you return must be one you actually reached and judged
26
+ relevant — never a guessed or unvisited URL (citation hallucination is the risk
27
+ this whole pipeline exists to prevent).
28
+
29
+ ## 3. Context
30
+
31
+ - **Source-quality bar.** Rate each source `sourceQuality`:
32
+ - `primary` — the authoritative origin: official docs, a spec, the source repo, a
33
+ standards body, primary data, the vendor's own reference. Prefer these.
34
+ - `secondary` — reputable independent coverage: a well-known engineering blog, a
35
+ maintained encyclopedia entry, established technical press.
36
+ - `low` — SEO content farms, listicles, scraped mirrors, undated aggregators,
37
+ answer-farm pages. **Agents systematically over-pick these unless told not to —
38
+ do not.** Include a `low` source only if nothing better exists, and say so.
39
+ - Prefer the newest authoritative version when recency matters (versions, APIs,
40
+ pricing, "current" anything); note the publication/updated date in the snippet.
41
+ - De-duplicate: if two URLs are the same content (e.g. a doc and its raw mirror),
42
+ keep the canonical one.
43
+
44
+ ## 4. Tools & sources
45
+
46
+ - `WebSearch` to locate candidates; `WebFetch` to open and confirm a source actually
47
+ answers the sub-question (a title is not confirmation — fetch before you cite).
48
+ - **Hard tool-call cap: {{toolCallCap}} calls total** (searches + fetches combined).
49
+ This is the guardrail against endless search for sources that do not exist. When you
50
+ hit the cap, stop and return what you have with a note. Reflection stop: if two
51
+ consecutive searches surface nothing new, stop early — the well is dry.
52
+ - Assign each kept source a **stable id** `{{sourceIdPrefix}}-1`, `{{sourceIdPrefix}}-2`,
53
+ … in the order you keep them. The extractor and synthesizer reference these ids, so
54
+ they must be stable within your return.
55
+
56
+ ## 5. Boundaries
57
+
58
+ - Retrieval only. Do **not** extract claims, summarise findings, or write any file.
59
+ - Do **not** touch a headed/Playwright browser or attempt to defeat a gate. Gate
60
+ policy is `{{gatePolicy}}`; in this dispatch you run **background-posture** semantics:
61
+ on a login wall / Cloudflare / captcha, **drop the source**, record it under
62
+ `gatedDropped` (`url`, `gateType`, `whatIsNeeded`), and continue. **The workflow's
63
+ Finalise phase persists these records to `gates.json` via `research gates --append`**
64
+ — you just return them; you never write the queue yourself. You still do not park,
65
+ escalate, or block; worker-posture park+resume automation is deferred to v2.
66
+ - Stay inside your one sub-question. Interesting adjacent facts that belong to a
67
+ sibling sub-question are out of scope — leave them.
68
+
69
+ ## 6. Output format — structured return (enforced by the workflow's schema)
70
+
71
+ Return **only** this object (the workflow validates it):
72
+
73
+ ```json
74
+ {
75
+ "subQuestionId": "{{subQuestionId}}",
76
+ "sources": [
77
+ {
78
+ "sourceId": "{{sourceIdPrefix}}-1",
79
+ "url": "https://…",
80
+ "title": "…",
81
+ "kind": "web",
82
+ "sourceQuality": "primary",
83
+ "snippet": "one line: what this source establishes + its date if relevant"
84
+ }
85
+ ],
86
+ "toolCallsUsed": 4,
87
+ "gatedDropped": [
88
+ { "url": "https://…", "gateType": "cloudflare", "whatIsNeeded": "Clear the challenge." }
89
+ ],
90
+ "notes": "any caveats: thin evidence, dry searches, low-quality fallbacks"
91
+ }
92
+ ```
93
+
94
+ - `kind` ∈ `web | playwright | kb | codebase | prior-session` — for `normal` web
95
+ research it is almost always `web`.
96
+ - `sourceQuality` ∈ `primary | secondary | low`.
97
+ - `sources` may be empty (record why in `notes`); `gatedDropped` may be empty (`[]`).
98
+ - `toolCallsUsed` must reflect real usage and be ≤ {{toolCallCap}}.
99
+
100
+ ## 7. Done when
101
+
102
+ - Every returned source was fetched, is relevant to `{{subQuestionId}}`, has a stable
103
+ id, a quality tag, and a one-line snippet — and you stayed within the tool-call cap.
104
+ - Gated/unreachable sources are in `gatedDropped`, not silently missing.
105
+
106
+ ## 8. Escalation
107
+
108
+ - **No usable source after the cap** → return `sources: []` with a `notes` line saying
109
+ the sub-question may be unanswerable from public web sources. Do not fabricate a URL
110
+ to fill the gap — an empty honest return is correct; a hallucinated citation is a
111
+ defect.
112
+ - **Everything relevant is gated** → return the gated records and an empty/near-empty
113
+ `sources`; the workflow caveats the finding downstream.