zob-harness 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/.pi/capabilities/zob-public-runtime-capabilities.json +4 -4
  2. package/.pi/extensions/zob-child-safety/AGENTS.md +12 -0
  3. package/.pi/extensions/zob-child-safety/index.ts +4 -105
  4. package/.pi/extensions/zob-child-safety/src/AGENTS.md +10 -0
  5. package/.pi/extensions/zob-child-safety/src/policy.ts +106 -0
  6. package/.pi/extensions/zob-harness/AGENTS.md +2 -0
  7. package/.pi/extensions/zob-harness/index.ts +94 -94
  8. package/.pi/extensions/zob-harness/src/AGENTS.md +4 -0
  9. package/.pi/extensions/zob-harness/src/core/AGENTS.md +24 -0
  10. package/.pi/extensions/zob-harness/src/{constants.ts → core/constants.ts} +10 -1
  11. package/.pi/extensions/zob-harness/src/core/utils/AGENTS.md +23 -0
  12. package/.pi/extensions/zob-harness/src/{utils → core/utils}/formatting.ts +1 -1
  13. package/.pi/extensions/zob-harness/src/{utils → core/utils}/records.ts +1 -1
  14. package/.pi/extensions/zob-harness/src/{utils → core/utils}/resources.ts +1 -1
  15. package/.pi/extensions/zob-harness/src/domains/AGENTS.md +23 -0
  16. package/.pi/extensions/zob-harness/src/domains/autonomy/AGENTS.md +21 -0
  17. package/.pi/extensions/zob-harness/src/{autonomous-runtime.ts → domains/autonomy/autonomous-runtime.ts} +22 -22
  18. package/.pi/extensions/zob-harness/src/{autonomy-readiness.ts → domains/autonomy/autonomy-readiness.ts} +18 -18
  19. package/.pi/extensions/zob-harness/src/{daemon-policy.ts → domains/autonomy/daemon-policy.ts} +6 -6
  20. package/.pi/extensions/zob-harness/src/{daemon-readiness.ts → domains/autonomy/daemon-readiness.ts} +7 -7
  21. package/.pi/extensions/zob-harness/src/{daemon-runtime.ts → domains/autonomy/daemon-runtime.ts} +2 -2
  22. package/.pi/extensions/zob-harness/src/{full-autonomy-test.ts → domains/autonomy/full-autonomy-test.ts} +4 -4
  23. package/.pi/extensions/zob-harness/src/{interactive-autonomy.ts → domains/autonomy/interactive-autonomy.ts} +2 -2
  24. package/.pi/extensions/zob-harness/src/{compute-profile.ts → domains/compute/compute-profile.ts} +3 -3
  25. package/.pi/extensions/zob-harness/src/{compute-workflow-shape.ts → domains/compute/compute-workflow-shape.ts} +3 -3
  26. package/.pi/extensions/zob-harness/src/domains/coms/AGENTS.md +21 -0
  27. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/envelope.ts +2 -2
  28. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/identity.ts +3 -3
  29. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/ledger-bridge.ts +2 -2
  30. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/local-transport.ts +1 -1
  31. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/policy.ts +3 -3
  32. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/presence.ts +1 -1
  33. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/registry.ts +47 -4
  34. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/response-capture.ts +1 -1
  35. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/transcript-capture.ts +2 -2
  36. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/zpeer-profile.ts +3 -3
  37. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/zpeer.ts +35 -7
  38. package/.pi/extensions/zob-harness/src/{mission-control.ts → domains/coms/mission-control.ts} +12 -9
  39. package/.pi/extensions/zob-harness/src/{zagents.ts → domains/coms/zagents.ts} +86 -4
  40. package/.pi/extensions/zob-harness/src/domains/context/AGENTS.md +20 -0
  41. package/.pi/extensions/zob-harness/src/{context-gbrain.ts → domains/context/context-gbrain.ts} +4 -4
  42. package/.pi/extensions/zob-harness/src/domains/delegation/AGENTS.md +21 -0
  43. package/.pi/extensions/zob-harness/src/{agents.ts → domains/delegation/agents.ts} +2 -2
  44. package/.pi/extensions/zob-harness/src/{capabilities.ts → domains/delegation/capabilities.ts} +6 -6
  45. package/.pi/extensions/zob-harness/src/{child-runner.ts → domains/delegation/child-runner.ts} +8 -8
  46. package/.pi/extensions/zob-harness/src/{output-contracts.ts → domains/delegation/output-contracts.ts} +1 -1
  47. package/.pi/extensions/zob-harness/src/{prompt-packs.ts → domains/delegation/prompt-packs.ts} +4 -4
  48. package/.pi/extensions/zob-harness/src/domains/factory/AGENTS.md +21 -0
  49. package/.pi/extensions/zob-harness/src/{factory → domains/factory}/agentic-plan.ts +1 -1
  50. package/.pi/extensions/zob-harness/src/{factory-selector.ts → domains/factory/factory-selector.ts} +4 -4
  51. package/.pi/extensions/zob-harness/src/{factory → domains/factory}/quarantine.ts +5 -5
  52. package/.pi/extensions/zob-harness/src/{factory → domains/factory}/run.ts +5 -5
  53. package/.pi/extensions/zob-harness/src/{factory → domains/factory}/validation.ts +10 -10
  54. package/.pi/extensions/zob-harness/src/domains/git/AGENTS.md +20 -0
  55. package/.pi/extensions/zob-harness/src/{git-ops.ts → domains/git/git-ops.ts} +3 -3
  56. package/.pi/extensions/zob-harness/src/domains/goal/AGENTS.md +22 -0
  57. package/.pi/extensions/zob-harness/src/{goal-room.ts → domains/goal/goal-room.ts} +7 -7
  58. package/.pi/extensions/zob-harness/src/{goal-todo-imports.ts → domains/goal/goal-todo-imports.ts} +1 -1
  59. package/.pi/extensions/zob-harness/src/{goal-todo-types.ts → domains/goal/goal-todo-types.ts} +1 -1
  60. package/.pi/extensions/zob-harness/src/{goal-todos.ts → domains/goal/goal-todos.ts} +4 -4
  61. package/.pi/extensions/zob-harness/src/{goal.ts → domains/goal/goal.ts} +1 -1
  62. package/.pi/extensions/zob-harness/src/domains/governance/AGENTS.md +21 -0
  63. package/.pi/extensions/zob-harness/src/{budget-policy.ts → domains/governance/budget-policy.ts} +6 -6
  64. package/.pi/extensions/zob-harness/src/{governed-requests.ts → domains/governance/governed-requests.ts} +7 -7
  65. package/.pi/extensions/zob-harness/src/{launch-apply.ts → domains/governance/launch-apply.ts} +4 -4
  66. package/.pi/extensions/zob-harness/src/{merge-queue.ts → domains/governance/merge-queue.ts} +6 -6
  67. package/.pi/extensions/zob-harness/src/{rules.ts → domains/governance/rules.ts} +7 -7
  68. package/.pi/extensions/zob-harness/src/{safety.ts → domains/governance/safety.ts} +3 -3
  69. package/.pi/extensions/zob-harness/src/{sandbox.ts → domains/governance/sandbox.ts} +5 -5
  70. package/.pi/extensions/zob-harness/src/{worker-pool.ts → domains/governance/worker-pool.ts} +7 -7
  71. package/.pi/extensions/zob-harness/src/{workspace-claims.ts → domains/governance/workspace-claims.ts} +6 -6
  72. package/.pi/extensions/zob-harness/src/domains/models/AGENTS.md +20 -0
  73. package/.pi/extensions/zob-harness/src/{model-availability.ts → domains/models/model-availability.ts} +1 -1
  74. package/.pi/extensions/zob-harness/src/{model-routing.ts → domains/models/model-routing.ts} +6 -6
  75. package/.pi/extensions/zob-harness/src/domains/orchestration/AGENTS.md +21 -0
  76. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/adaptive-delegation.ts +8 -8
  77. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/adaptive-workflow.ts +4 -4
  78. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/lead-plan.ts +5 -5
  79. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/plan.ts +5 -5
  80. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/room.ts +4 -4
  81. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/run.ts +6 -6
  82. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/supervised-readonly.ts +6 -6
  83. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/widget-readers.ts +2 -2
  84. package/.pi/extensions/zob-harness/src/domains/project-dna/AGENTS.md +19 -0
  85. package/.pi/extensions/zob-harness/src/{project-dna.ts → domains/project-dna/project-dna.ts} +4 -4
  86. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/candidate.ts +5 -5
  87. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/coms.ts +3 -3
  88. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/documentation.ts +4 -4
  89. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/factory.ts +2 -2
  90. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/temp-agent.ts +4 -4
  91. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/write-lane.ts +3 -3
  92. package/.pi/extensions/zob-harness/src/domains/telemetry/AGENTS.md +19 -0
  93. package/.pi/extensions/zob-harness/src/{chronicle.ts → domains/telemetry/chronicle.ts} +3 -3
  94. package/.pi/extensions/zob-harness/src/{queue.ts → domains/telemetry/queue.ts} +7 -7
  95. package/.pi/extensions/zob-harness/src/{telemetry.ts → domains/telemetry/telemetry.ts} +4 -4
  96. package/.pi/extensions/zob-harness/src/{topology → domains/topology}/chains.ts +10 -10
  97. package/.pi/extensions/zob-harness/src/{topology → domains/topology}/coms.ts +3 -3
  98. package/.pi/extensions/zob-harness/src/{topology → domains/topology}/orchestration-profiles.ts +8 -8
  99. package/.pi/extensions/zob-harness/src/{topology → domains/topology}/teams.ts +8 -8
  100. package/.pi/extensions/zob-harness/src/runtime/adaptive-zmode.ts +2 -2
  101. package/.pi/extensions/zob-harness/src/runtime/auto-compaction.ts +2 -2
  102. package/.pi/extensions/zob-harness/src/runtime/commands.ts +51 -29
  103. package/.pi/extensions/zob-harness/src/runtime/compaction-policy.ts +2 -2
  104. package/.pi/extensions/zob-harness/src/runtime/delegation-feed.ts +1 -1
  105. package/.pi/extensions/zob-harness/src/runtime/delegation-monitor.ts +1 -1
  106. package/.pi/extensions/zob-harness/src/runtime/events.ts +53 -37
  107. package/.pi/extensions/zob-harness/src/{goal-runtime.ts → runtime/goal-runtime.ts} +9 -9
  108. package/.pi/extensions/zob-harness/src/runtime/goal-todo-overlay.ts +1 -1
  109. package/.pi/extensions/zob-harness/src/runtime/plan-capture.ts +2 -2
  110. package/.pi/extensions/zob-harness/src/runtime/state.ts +15 -13
  111. package/.pi/extensions/zob-harness/src/runtime/tools-autonomous.ts +2 -2
  112. package/.pi/extensions/zob-harness/src/runtime/tools-compute.ts +3 -3
  113. package/.pi/extensions/zob-harness/src/runtime/tools-coms.ts +15 -12
  114. package/.pi/extensions/zob-harness/src/runtime/tools-context.ts +2 -2
  115. package/.pi/extensions/zob-harness/src/runtime/tools-delegation.ts +13 -13
  116. package/.pi/extensions/zob-harness/src/runtime/tools-factory.ts +19 -19
  117. package/.pi/extensions/zob-harness/src/runtime/tools-goal-room.ts +3 -3
  118. package/.pi/extensions/zob-harness/src/runtime/tools-governed-requests.ts +3 -3
  119. package/.pi/extensions/zob-harness/src/runtime/tools-merge-queue.ts +3 -3
  120. package/.pi/extensions/zob-harness/src/runtime/tools-mission-control.ts +3 -3
  121. package/.pi/extensions/zob-harness/src/runtime/tools-orchestration.ts +9 -9
  122. package/.pi/extensions/zob-harness/src/runtime/tools-project-dna.ts +2 -2
  123. package/.pi/extensions/zob-harness/src/runtime/tools-worker-pool.ts +3 -3
  124. package/.pi/extensions/zob-harness/src/runtime/tools-workspace-claims.ts +3 -3
  125. package/.pi/extensions/zob-harness/src/runtime/tools-zcommit.ts +3 -3
  126. package/.pi/extensions/zob-harness/src/runtime/widget.ts +27 -10
  127. package/.pi/extensions/zob-harness/src/runtime/zobHarness.ts +1 -1
  128. package/.pi/extensions/zob-harness/src/types.ts +2 -2
  129. package/.pi/extensions/zob-switch/AGENTS.md +9 -0
  130. package/.pi/extensions/zob-switch/index.ts +9 -121
  131. package/.pi/extensions/zob-switch/src/AGENTS.md +8 -0
  132. package/.pi/extensions/zob-switch/src/autocomplete.ts +12 -0
  133. package/.pi/extensions/zob-switch/src/paths.ts +8 -0
  134. package/.pi/extensions/zob-switch/src/settings.ts +25 -0
  135. package/.pi/extensions/zob-switch/src/snapshot.ts +34 -0
  136. package/.pi/extensions/zob-switch/src/state.ts +57 -0
  137. package/.pi/factories/agentic-spec-team/README.md +35 -0
  138. package/.pi/factories/agentic-spec-team/batch-manifest.json +11 -0
  139. package/.pi/factories/agentic-spec-team/example-agentic-spec-manifest.json +19 -0
  140. package/.pi/factories/agentic-spec-team/factory.json +98 -0
  141. package/.pi/factories/agentic-spec-team/pilot-manifest.json +11 -0
  142. package/.pi/factories/agentic-spec-team/schemas/final-report.schema.json +15 -0
  143. package/.pi/factories/agentic-spec-team/schemas/manifest.schema.json +14 -0
  144. package/.pi/factories/agentic-spec-team/schemas/question.schema.json +18 -0
  145. package/.pi/factories/agentic-spec-team/schemas/source-register.schema.json +11 -0
  146. package/.pi/factories/agentic-spec-team/schemas/traceability.schema.json +11 -0
  147. package/.pi/factories/agentic-spec-team/smoke-manifest.json +11 -0
  148. package/.pi/skills/zob-agentic-spec-team/SKILL.md +148 -0
  149. package/.pi/skills/zob-coms-safety/SKILL.md +13 -0
  150. package/.pi/skills/zob-coms-v2-live/SKILL.md +11 -0
  151. package/.pi/skills/zob-factory/SKILL.md +21 -0
  152. package/.pi/skills/zob-harness/SKILL.md +14 -0
  153. package/.pi/skills/zob-split-refactor/SKILL.md +1 -1
  154. package/.pi/skills/zob-zagent-creator/SKILL.md +266 -12
  155. package/.pi/zagents/agent-factory-pacman-chief.json +22 -0
  156. package/.pi/zagents/agent-factory-pacman-engine-builder.json +21 -0
  157. package/.pi/zagents/agent-factory-pacman-frontend-builder.json +21 -0
  158. package/.pi/zagents/agent-factory-pacman-game-architect.json +21 -0
  159. package/.pi/zagents/agent-factory-pacman-game-designer.json +21 -0
  160. package/.pi/zagents/agent-factory-pacman-qa-oracle.json +21 -0
  161. package/.pi/zagents/bdd-writer.json +20 -0
  162. package/.pi/zagents/data-profile-analyst.json +20 -0
  163. package/.pi/zagents/domain-modeler.json +20 -0
  164. package/.pi/zagents/planner-handoff-writer.json +20 -0
  165. package/.pi/zagents/prompts/agent-factory-pacman-chief.md +53 -0
  166. package/.pi/zagents/prompts/agent-factory-pacman-engine-builder.md +41 -0
  167. package/.pi/zagents/prompts/agent-factory-pacman-frontend-builder.md +40 -0
  168. package/.pi/zagents/prompts/agent-factory-pacman-game-architect.md +41 -0
  169. package/.pi/zagents/prompts/agent-factory-pacman-game-designer.md +43 -0
  170. package/.pi/zagents/prompts/agent-factory-pacman-qa-oracle.md +51 -0
  171. package/.pi/zagents/prompts/agentic-spec-run-role.md +30 -0
  172. package/.pi/zagents/source-intake-steward.json +20 -0
  173. package/.pi/zagents/spec-chief.json +21 -0
  174. package/.pi/zagents/spec-oracle.json +20 -0
  175. package/.pi/zagents/spec-writer.json +20 -0
  176. package/.pi/zagents/ux-flow-analyst.json +20 -0
  177. package/.pi/zteams/agent-factory-pacman-multiplayer-runtime.mjs +384 -0
  178. package/.pi/zteams/agent-factory-pacman-multiplayer.json +42 -0
  179. package/.pi/zteams/agent-factory-pacman-multiplayer.tmux.sh +256 -0
  180. package/.pi/zteams/agentic-spec-run.json +42 -0
  181. package/.pi/zteams/agentic-spec-run.tmux.sh +134 -0
  182. package/.pi/zteams/templates/agent-factory-pacman-chief-kickoff.template.md +71 -0
  183. package/.pi/zteams/templates/agent-factory-pacman-worker-kickoff.template.md +59 -0
  184. package/README.md +183 -110
  185. package/SOURCE_INDEX.md +5 -1
  186. package/examples/agent-factory-mission-control/AGENTS.md +10 -0
  187. package/examples/agent-factory-mission-control/README.md +17 -0
  188. package/examples/agent-factory-mission-control/apps/api/AGENTS.md +3 -0
  189. package/examples/agent-factory-mission-control/apps/dashboard/AGENTS.md +3 -0
  190. package/examples/agent-factory-mission-control/mission.md +3 -0
  191. package/examples/agent-factory-mission-control/output-contract.md +3 -0
  192. package/examples/agent-factory-mission-control/packages/domain/AGENTS.md +3 -0
  193. package/examples/agent-factory-mission-control/packages/snapshot-reader/AGENTS.md +3 -0
  194. package/examples/agent-factory-pacman-multiplayer/AGENTS.md +27 -0
  195. package/examples/agent-factory-pacman-multiplayer/README.md +84 -0
  196. package/examples/agent-factory-pacman-multiplayer/mission.md +43 -0
  197. package/examples/agent-factory-pacman-multiplayer/output-contract.md +58 -0
  198. package/examples/agent-factory-tmux-comms/README.md +146 -0
  199. package/examples/agent-factory-tmux-comms/chief-kickoff.template.md +54 -0
  200. package/examples/agent-factory-tmux-comms/simple-agent-factory.team.json +92 -0
  201. package/examples/agent-factory-tmux-comms/simple-agent-factory.tmux.sh +248 -0
  202. package/examples/agent-factory-tmux-comms/worker-kickoff.template.md +43 -0
  203. package/package.json +17 -3
  204. package/scripts/README.md +1 -1
  205. package/scripts/agentic-spec-team/validate-bdd.mjs +13 -0
  206. package/scripts/agentic-spec-team/validate-final-report.mjs +14 -0
  207. package/scripts/agentic-spec-team/validate-manifest.mjs +14 -0
  208. package/scripts/agentic-spec-team/validate-oracle-ready.mjs +13 -0
  209. package/scripts/agentic-spec-team/validate-question-loop.mjs +15 -0
  210. package/scripts/agentic-spec-team/validate-run.mjs +11 -0
  211. package/scripts/agentic-spec-team/validate-source-register.mjs +17 -0
  212. package/scripts/agentic-spec-team/validate-traceability.mjs +20 -0
  213. package/scripts/agentic-spec-team/validate-workgraph.mjs +13 -0
  214. package/scripts/autonomy/mission-readiness-secret-smoke.mjs +5 -5
  215. package/scripts/git-ops/commit-policy-smoke.mjs +5 -4
  216. package/scripts/goal-todo/child-goal-ref-smoke.mjs +2 -2
  217. package/scripts/path-policy/validate-smoke.mjs +3 -3
  218. package/scripts/project-dna/AGENTS.md +39 -0
  219. package/scripts/project-dna/{validate-scaffold.mjs → validation/validate-scaffold.mjs} +7 -7
  220. package/scripts/spec-run.mjs +365 -0
  221. package/scripts/worker-pool/static-smoke.mjs +5 -5
  222. package/scripts/zagent-static-smoke.mjs +35 -6
  223. package/scripts/zpeer-local-e2e-smoke.mjs +12 -5
  224. package/scripts/zpeer-static-smoke.mjs +17 -17
  225. /package/.pi/extensions/zob-harness/src/{types → core/types}/core.ts +0 -0
  226. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/hashing.ts +0 -0
  227. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/json.ts +0 -0
  228. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/paths.ts +0 -0
  229. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/AGENTS.md +0 -0
  230. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/pending-replies.ts +0 -0
  231. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/types.ts +0 -0
  232. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/ledger.ts +0 -0
  233. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/types.ts +0 -0
  234. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/validate.ts +0 -0
  235. /package/.pi/extensions/zob-harness/src/{schemas-project-dna.ts → runtime/schemas-project-dna.ts} +0 -0
  236. /package/.pi/extensions/zob-harness/src/{schemas.ts → runtime/schemas.ts} +0 -0
  237. /package/scripts/project-dna/{bench-smoke.mjs → benchmark/bench-smoke.mjs} +0 -0
  238. /package/scripts/project-dna/{build-capsules.mjs → capsules/build-capsules.mjs} +0 -0
  239. /package/scripts/project-dna/{emit-golden-cases.mjs → emit/emit-golden-cases.mjs} +0 -0
  240. /package/scripts/project-dna/{emit-ontology.mjs → emit/emit-ontology.mjs} +0 -0
  241. /package/scripts/project-dna/{oracle-review-smoke.mjs → oracle/oracle-review-smoke.mjs} +0 -0
  242. /package/scripts/project-dna/{query-context.mjs → query/query-context.mjs} +0 -0
  243. /package/scripts/project-dna/{query-steward.mjs → query/query-steward.mjs} +0 -0
  244. /package/scripts/project-dna/{build-sample-spec.mjs → sample/build-sample-spec.mjs} +0 -0
  245. /package/scripts/project-dna/{generate-sample.mjs → sample/generate-sample.mjs} +0 -0
  246. /package/scripts/project-dna/{validate-sample-project.mjs → sample/validate-sample-project.mjs} +0 -0
  247. /package/scripts/project-dna/{scan.mjs → scan/scan.mjs} +0 -0
  248. /package/scripts/project-dna/{validate-scan-artifacts.mjs → scan/validate-scan-artifacts.mjs} +0 -0
  249. /package/scripts/project-dna/{validate-5of5.mjs → validation/validate-5of5.mjs} +0 -0
  250. /package/scripts/project-dna/{validate-golden-cases.mjs → validation/validate-golden-cases.mjs} +0 -0
  251. /package/scripts/project-dna/{validate-ontology.mjs → validation/validate-ontology.mjs} +0 -0
  252. /package/scripts/project-dna/{plan-workflow.mjs → workflow/plan-workflow.mjs} +0 -0
  253. /package/scripts/project-dna/{validate-workflow.mjs → workflow/validate-workflow.mjs} +0 -0
@@ -1,10 +1,11 @@
1
1
  import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import { basename, join, relative, resolve } from "node:path";
3
3
 
4
+ import type { ModeName } from "../../core/types/core.js";
4
5
  import { safeZpeerAlias, safeZpeerRoomId } from "./coms-v2/zpeer.js";
5
- import { parseJsonFile } from "./utils/json.js";
6
- import { isSafeArtifactName } from "./utils/paths.js";
7
- import { isRecord } from "./utils/records.js";
6
+ import { parseJsonFile } from "../../core/utils/json.js";
7
+ import { isSafeArtifactName } from "../../core/utils/paths.js";
8
+ import { isRecord } from "../../core/utils/records.js";
8
9
 
9
10
  const ZAGENTS_DIR = ".pi/zagents";
10
11
  const ZTEAMS_DIR = ".pi/zteams";
@@ -12,6 +13,7 @@ const ZAGENT_PROMPTS_DIR = ".pi/zagents/prompts";
12
13
  const ZAGENT_SCHEMA_ID = "zob.zagent.v1";
13
14
  const ZTEAM_SCHEMA_ID = "zob.zteam.v1";
14
15
  const SAFE_ID_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,79}$/;
16
+ const ZAGENT_MODE_NAMES = new Set<ModeName>(["explore", "plan", "implement", "oracle", "factory", "orchestrator", "vanilla"]);
15
17
 
16
18
  export const ZAGENT_MANIFEST_SCHEMA = {
17
19
  schema: ZAGENT_SCHEMA_ID,
@@ -65,6 +67,7 @@ export interface ZAgentManifest {
65
67
  communicationPolicy?: ZAgentCommunicationPolicy;
66
68
  contextRefs?: ZAgentContextRefInput[];
67
69
  model?: string;
70
+ defaultMode?: ModeName;
68
71
  tools?: string[];
69
72
  metadata?: Record<string, unknown>;
70
73
  localOnly: true;
@@ -269,6 +272,19 @@ function validateRoomBindings(rooms: ZAgentRoomRef[] | undefined, label: string)
269
272
  return errors;
270
273
  }
271
274
 
275
+
276
+ function safePiModelPattern(value: string | undefined): string | undefined {
277
+ const trimmed = value?.trim();
278
+ if (!trimmed || trimmed.length > 160) return undefined;
279
+ if (trimmed.includes("\0") || trimmed.includes("\n") || trimmed.includes("\r") || trimmed.includes("..")) return undefined;
280
+ if (trimmed.startsWith("/") || trimmed.startsWith("~")) return undefined;
281
+ return /^[a-zA-Z0-9._:/+@-]+$/.test(trimmed) ? trimmed : undefined;
282
+ }
283
+
284
+ function isZagentModeName(value: unknown): value is ModeName {
285
+ return typeof value === "string" && ZAGENT_MODE_NAMES.has(value as ModeName);
286
+ }
287
+
272
288
  function validateCommunicationPolicy(policy: unknown, label: string): string[] {
273
289
  const errors: string[] = [];
274
290
  if (policy === undefined) return errors;
@@ -305,6 +321,7 @@ function isZAgentManifest(value: unknown): value is ZAgentManifest {
305
321
  && isCommunicationPolicy(value.communicationPolicy)
306
322
  && (value.contextRefs === undefined || (Array.isArray(value.contextRefs) && value.contextRefs.every(isContextRef)))
307
323
  && (value.model === undefined || typeof value.model === "string")
324
+ && (value.defaultMode === undefined || isZagentModeName(value.defaultMode))
308
325
  && (value.tools === undefined || isStringArray(value.tools))
309
326
  && (value.metadata === undefined || isRecord(value.metadata))
310
327
  && value.localOnly === true
@@ -371,6 +388,12 @@ export function validateZagentManifest(repoRoot: string, manifest: unknown, mani
371
388
  errors.push(...validateRoomBindings(rooms, "zagent.rooms"));
372
389
  errors.push(...validateActiveRoom(manifest.activeRoom, bindings, "zagent"));
373
390
  errors.push(...validateCommunicationPolicy(manifest.communicationPolicy, "zagent.communicationPolicy"));
391
+ if (typeof manifest.model === "string" && safePiModelPattern(manifest.model) !== manifest.model.trim()) {
392
+ errors.push(`zagent.model must be a safe Pi --model pattern: ${manifest.model}`);
393
+ }
394
+ if (manifest.defaultMode !== undefined && !isZagentModeName(manifest.defaultMode)) {
395
+ errors.push(`zagent.defaultMode must be one of ${[...ZAGENT_MODE_NAMES].join(",")}: ${String(manifest.defaultMode)}`);
396
+ }
374
397
  if (typeof manifest.promptRef === "string") {
375
398
  const prompt = resolveZagentPromptRef(repoRoot, manifest.promptRef);
376
399
  errors.push(...prompt.errors);
@@ -476,6 +499,64 @@ export function listZteamManifests(repoRoot: string): ZTeamLoaded[] {
476
499
  return listJsonFiles(projectZteamsDir(repoRoot)).map((path) => loadZteamManifest(repoRoot, basename(path, ".json")));
477
500
  }
478
501
 
502
+ export interface ZAgentResolvedTeamMembership {
503
+ teamId: string;
504
+ alias?: string;
505
+ role?: string;
506
+ rooms: ZAgentRoomBinding[];
507
+ }
508
+
509
+ function zteamMemberMatchesZagent(member: ZTeamMemberManifest | ZTeamAgentManifest, zagentId: string): boolean {
510
+ return zteamMemberAgentId(member) === zagentId;
511
+ }
512
+
513
+ export function resolveZagentTeamMemberships(repoRoot: string, zagentId: string): ZAgentResolvedTeamMembership[] {
514
+ const memberships: ZAgentResolvedTeamMembership[] = [];
515
+ for (const loaded of listZteamManifests(repoRoot)) {
516
+ if (loaded.errors.length > 0) continue;
517
+ const teamRooms = normalizeZagentRoomBindings(loaded.manifest.rooms, loaded.manifest.defaultRoom, loaded.manifest.activeRoom);
518
+ const members = [...(loaded.manifest.members ?? []), ...(loaded.manifest.agents ?? [])];
519
+ for (const member of members) {
520
+ if (!zteamMemberMatchesZagent(member, zagentId)) continue;
521
+ const memberRooms = zteamMemberRooms(member, loaded.manifest.defaultRoom);
522
+ const rooms = memberRooms.length > 0 ? memberRooms : teamRooms;
523
+ memberships.push({
524
+ teamId: loaded.manifest.id,
525
+ alias: member.alias,
526
+ role: member.role,
527
+ rooms,
528
+ });
529
+ }
530
+ }
531
+ return memberships;
532
+ }
533
+
534
+ export function resolveZagentRuntimeRoomBindings(repoRoot: string, manifest: ZAgentManifest): { rooms: ZAgentRoomBinding[]; teamIds: string[] } {
535
+ const byRoom = new Map<string, ZAgentRoomBinding>();
536
+ const pushRoom = (room: ZAgentRoomBinding, defaults: { alias?: string; role?: string } = {}): void => {
537
+ const id = safeZpeerRoomId(room.id);
538
+ if (!id) return;
539
+ const existing = byRoom.get(id);
540
+ byRoom.set(id, {
541
+ ...existing,
542
+ ...room,
543
+ id,
544
+ alias: existing?.alias ?? room.alias ?? defaults.alias,
545
+ role: existing?.role ?? room.role ?? defaults.role,
546
+ active: existing?.active === true || room.active === true,
547
+ });
548
+ };
549
+
550
+ for (const room of normalizeZagentRoomBindings(manifest.rooms, manifest.defaultRoom, manifest.activeRoom)) pushRoom(room, { alias: manifest.alias });
551
+ const teamIds = new Set<string>(manifest.team ? [manifest.team] : []);
552
+ for (const membership of resolveZagentTeamMemberships(repoRoot, manifest.id)) {
553
+ teamIds.add(membership.teamId);
554
+ for (const room of membership.rooms) pushRoom(room, { alias: membership.alias ?? manifest.alias, role: membership.role });
555
+ }
556
+ const rooms = [...byRoom.values()];
557
+ return { rooms, teamIds: [...teamIds] };
558
+ }
559
+
479
560
  function policyAllowsZpeerContact(policy: ZAgentCommunicationPolicy | undefined, roomId?: string, alias?: string): boolean {
480
561
  if (!policy) return true;
481
562
  if (policy.zpeerContact === false || policy.allowZpeerContact === false) return false;
@@ -507,10 +588,11 @@ export function formatZagentList(agents: ZAgentLoaded[]): string {
507
588
  const alias = manifest.alias ? ` @${manifest.alias}` : "";
508
589
  const role = manifest.role ? ` role=${manifest.role}` : "";
509
590
  const team = manifest.team ? ` team=${manifest.team}` : "";
591
+ const mode = manifest.defaultMode ? ` defaultMode=${manifest.defaultMode}` : "";
510
592
  const rooms = normalizeZagentRoomBindings(manifest.rooms, manifest.defaultRoom, manifest.activeRoom);
511
593
  const roomText = rooms.length ? ` rooms=${rooms.map((room) => `${room.id}${room.active ? "*" : ""}`).join(",")}` : "";
512
594
  const status = errors.length === 0 ? "ok" : `errors=${errors.length}`;
513
- return `- ${manifest.id}${alias} [${status}]${team}${role}${roomText}${relPrompt} path=${relPath}`;
595
+ return `- ${manifest.id}${alias} [${status}]${team}${role}${mode}${roomText}${relPrompt} path=${relPath}`;
514
596
  }).join("\n");
515
597
  }
516
598
 
@@ -0,0 +1,20 @@
1
+ # Context domain guardrail
2
+
3
+ ## Scope
4
+
5
+ - Context/GBrain readiness, context scope validation, and writeback proposal helpers.
6
+
7
+ ## MUST DO
8
+
9
+ - Preserve bounded context, citations, forbidden-source checks, and proposal-only writeback semantics.
10
+ - Keep raw conversation/prompt bodies out of persisted metadata.
11
+
12
+ ## MUST NOT
13
+
14
+ - Do not import/embed/sync/write to external knowledge backends by moving code.
15
+ - Do not import from `index.ts` or `index.js`.
16
+
17
+ ## Validation
18
+
19
+ - `npm run check -- --pretty false`.
20
+ - Run context readiness checks when context behavior moves.
@@ -1,9 +1,9 @@
1
1
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { sha256 } from "./utils/hashing.js";
5
- import { safeFileStem } from "./utils/paths.js";
6
- import { isRecord } from "./utils/records.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { safeFileStem } from "../../core/utils/paths.js";
6
+ import { isRecord } from "../../core/utils/records.js";
7
7
 
8
8
  const FORBIDDEN_CONTEXT_BODY_KEYS = new Set(["body", "task", "prompt", "output", "content", "message", "diff", "patch", "rawConversation", "conversationHistory"]);
9
9
  const CONTEXT_SCOPE_MAX_TOKENS_CAP = 8000;
@@ -416,7 +416,7 @@ export function buildContextGbrainReadinessAudit(repoRoot: string, input: { runI
416
416
  runId: String(scope.runId),
417
417
  observedProblemHash: sha256("context readiness observed problem"),
418
418
  newPatternHash: sha256("context readiness writeback pattern"),
419
- evidenceRefs: ["docs/AUTONOMOUS_SUPER_FACTORY_GOAL.md", ".pi/extensions/zob-harness/src/context-gbrain.ts"],
419
+ evidenceRefs: ["docs/AUTONOMOUS_SUPER_FACTORY_GOAL.md", ".pi/extensions/zob-harness/src/domains/context/context-gbrain.ts"],
420
420
  recommendedArtifact: ".pi/context/writeback-proposals.jsonl",
421
421
  });
422
422
  const forbiddenScope = { ...scope, allowedSources: ["zob-harness-docs", "raw-conversation-history"], forbiddenSources: ["raw-conversation-history", ".env"] };
@@ -0,0 +1,21 @@
1
+ # Delegation domain guardrail
2
+
3
+ ## Scope
4
+
5
+ - Agent discovery, child runner support, output contracts, delegation schemas, and child-output gates.
6
+
7
+ ## MUST DO
8
+
9
+ - Preserve six-part contract validation, child output contract ids, output gate behavior, model override checks, and path policy enforcement.
10
+ - Keep child prompt/output bodies out of persisted ledgers unless existing policy explicitly allows a redacted/hash-only artifact.
11
+
12
+ ## MUST NOT
13
+
14
+ - Do not rename specialist agents, output contract ids, gate markers, or failure-kind strings.
15
+ - Do not loosen write-scope, cwd, allowed_paths, forbidden_paths, or secret protections.
16
+ - Do not import from `index.ts` or `index.js`.
17
+
18
+ ## Validation
19
+
20
+ - `npm run check -- --pretty false`.
21
+ - `npm run smoke:harness` after child-runner, output-contract, safety-adjacent, or runtime-facing moves.
@@ -1,8 +1,8 @@
1
1
  import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import { basename, join } from "node:path";
3
3
  import { getAgentDir } from "@earendil-works/pi-coding-agent";
4
- import type { AgentScope, HarnessAgent } from "./types.js";
5
- import { readableZobResourcePaths } from "./utils/resources.js";
4
+ import type { AgentScope, HarnessAgent } from "../../types.js";
5
+ import { readableZobResourcePaths } from "../../core/utils/resources.js";
6
6
 
7
7
  function parseFrontmatter(raw: string): { frontmatter: Record<string, string>; body: string } {
8
8
  if (!raw.startsWith("---\n")) return { frontmatter: {}, body: raw };
@@ -3,12 +3,12 @@ import { basename, join, relative } from "node:path";
3
3
 
4
4
  import { discoverAgents } from "./agents.js";
5
5
  import { getOutputContractDefinitions } from "./output-contracts.js";
6
- import { loadChainDefinition, listChainDefinitions } from "./topology/chains.js";
7
- import { sha256 } from "./utils/hashing.js";
8
- import { parseJsonFile } from "./utils/json.js";
9
- import { safeFileStem } from "./utils/paths.js";
10
- import { isRecord } from "./utils/records.js";
11
- import { readableZobResourcePath, readableZobResourcePaths } from "./utils/resources.js";
6
+ import { loadChainDefinition, listChainDefinitions } from "../topology/chains.js";
7
+ import { sha256 } from "../../core/utils/hashing.js";
8
+ import { parseJsonFile } from "../../core/utils/json.js";
9
+ import { safeFileStem } from "../../core/utils/paths.js";
10
+ import { isRecord } from "../../core/utils/records.js";
11
+ import { readableZobResourcePath, readableZobResourcePaths } from "../../core/utils/resources.js";
12
12
 
13
13
  export interface ReuseScoutInput {
14
14
  query: string;
@@ -6,15 +6,15 @@ import { join } from "node:path";
6
6
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
7
7
 
8
8
  import { discoverAgents } from "./agents.js";
9
- import { SUPERVISED_READONLY_CHILD_TOOLS } from "./constants.js";
10
- import { validateExplicitModelOverride } from "./model-availability.js";
9
+ import { SUPERVISED_READONLY_CHILD_TOOLS } from "../../core/constants.js";
10
+ import { validateExplicitModelOverride } from "../models/model-availability.js";
11
11
  import { applyChildGates } from "./output-contracts.js";
12
- import { buildChildEnv } from "./safety.js";
13
- import { updateUsage, usageEmpty } from "./telemetry.js";
14
- import type { ChildResult, ChildThinkingLevel, HarnessAgent, SupervisedReadonlyDispatchContract, SupervisedReadonlyDispatcher } from "./types.js";
15
- import { sha256 } from "./utils/hashing.js";
16
- import { safeFileStem } from "./utils/paths.js";
17
- import { parseJsonLine, textFromMessage } from "./utils/records.js";
12
+ import { buildChildEnv } from "../governance/safety.js";
13
+ import { updateUsage, usageEmpty } from "../telemetry/telemetry.js";
14
+ import type { ChildResult, ChildThinkingLevel, HarnessAgent, SupervisedReadonlyDispatchContract, SupervisedReadonlyDispatcher } from "../../types.js";
15
+ import { sha256 } from "../../core/utils/hashing.js";
16
+ import { safeFileStem } from "../../core/utils/paths.js";
17
+ import { parseJsonLine, textFromMessage } from "../../core/utils/records.js";
18
18
 
19
19
  function getPiInvocation(args: string[]): { command: string; args: string[] } {
20
20
  const currentScript = process.argv[1];
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync, statSync } from "node:fs";
2
2
  import { extname, resolve, sep } from "node:path";
3
3
 
4
- import type { ChildResult, OutputContract, OutputRequirement } from "./types.js";
4
+ import type { ChildResult, OutputContract, OutputRequirement } from "../../types.js";
5
5
 
6
6
  const COMMON_OUTPUT_REQUIREMENTS: OutputRequirement[] = [
7
7
  {
@@ -1,10 +1,10 @@
1
1
  import { existsSync } from "node:fs";
2
2
 
3
- import { DEFAULT_RULES } from "./constants.js";
3
+ import { DEFAULT_RULES } from "../../core/constants.js";
4
4
  import { validateOutputContractId } from "./output-contracts.js";
5
- import { sha256 } from "./utils/hashing.js";
6
- import { pathMatches, resolveRepoPath } from "./utils/paths.js";
7
- import { isRecord } from "./utils/records.js";
5
+ import { sha256 } from "../../core/utils/hashing.js";
6
+ import { pathMatches, resolveRepoPath } from "../../core/utils/paths.js";
7
+ import { isRecord } from "../../core/utils/records.js";
8
8
 
9
9
  export type PromptPackRole = "orchestrator" | "factory-selector" | "worker-implementer" | "oracle";
10
10
 
@@ -0,0 +1,21 @@
1
+ # Factory domain compatibility guardrail
2
+
3
+ ## Scope
4
+
5
+ - Future home for factory selector and compatibility wrappers around `src/factory/**`.
6
+ - Existing `src/factory/AGENTS.md` remains authoritative for factory run/quarantine internals until those files move.
7
+
8
+ ## MUST DO
9
+
10
+ - Preserve smoke/pilot/batch/DONE sentinel behavior, plan-only posture, oracle review requirements, and artifact names.
11
+ - Keep factory runtime registration in `src/runtime/**`.
12
+
13
+ ## MUST NOT
14
+
15
+ - Do not auto-activate factory quarantine or skip oracle gates.
16
+ - Do not import from `index.ts` or `index.js`.
17
+
18
+ ## Validation
19
+
20
+ - `npm run check -- --pretty false`.
21
+ - `npm run smoke:harness` after factory moves.
@@ -1,4 +1,4 @@
1
- import type { FactoryDefinition, FactoryInputManifest, FactoryManifestItem } from "../types.js";
1
+ import type { FactoryDefinition, FactoryInputManifest, FactoryManifestItem } from "../../types.js";
2
2
 
3
3
  function detectCanonicalPatterns(text: string): string[] {
4
4
  const patterns = new Set<string>();
@@ -1,10 +1,10 @@
1
1
  import { existsSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { basename, join } from "node:path";
3
3
 
4
- import { sha256 } from "./utils/hashing.js";
5
- import { safeFileStem } from "./utils/paths.js";
6
- import { isRecord } from "./utils/records.js";
7
- import { readableZobResourcePaths } from "./utils/resources.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { safeFileStem } from "../../core/utils/paths.js";
6
+ import { isRecord } from "../../core/utils/records.js";
7
+ import { readableZobResourcePaths } from "../../core/utils/resources.js";
8
8
 
9
9
  export type FactoryDemandSignal = "code_review" | "budget_preflight" | "roadmap_lots" | "opencode_patterns" | "project_dna" | "factory_forge";
10
10
  export type FactorySelectionStatus = "existing_factory_selected" | "factory_forge_quarantine_recommended" | "no_factory_available";
@@ -1,11 +1,11 @@
1
1
  import { appendFileSync, copyFileSync, existsSync, lstatSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import type { FactoryQuarantineActivateInput, FactoryQuarantineActivateResult, FactoryQuarantineReviewInput, FactoryQuarantineReviewResult, FactoryQuarantineVerifyActivationInput, FactoryQuarantineVerifyActivationResult, FactoryRunResult } from "../types.js";
5
- import { sha256Hex } from "../utils/hashing.js";
6
- import { parseJsonFile, readJsonlRecords } from "../utils/json.js";
7
- import { safeFileStem } from "../utils/paths.js";
8
- import { isRecord } from "../utils/records.js";
4
+ import type { FactoryQuarantineActivateInput, FactoryQuarantineActivateResult, FactoryQuarantineReviewInput, FactoryQuarantineReviewResult, FactoryQuarantineVerifyActivationInput, FactoryQuarantineVerifyActivationResult, FactoryRunResult } from "../../types.js";
5
+ import { sha256Hex } from "../../core/utils/hashing.js";
6
+ import { parseJsonFile, readJsonlRecords } from "../../core/utils/json.js";
7
+ import { safeFileStem } from "../../core/utils/paths.js";
8
+ import { isRecord } from "../../core/utils/records.js";
9
9
  import { runFactoryRun } from "./run.js";
10
10
 
11
11
  export function runFactoryQuarantineReview(repoRoot: string, input: FactoryQuarantineReviewInput): FactoryQuarantineReviewResult {
@@ -1,11 +1,11 @@
1
1
  import { appendFileSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { resolveComputeProfile } from "../compute-profile.js";
5
- import { writeFactoryTelemetrySummary } from "../telemetry.js";
6
- import type { FactoryAdaptiveDispatchGate, FactoryDefinition, FactoryInputManifest, FactoryManifestItem, FactoryRunInput, FactoryRunResult } from "../types.js";
7
- import { sha256 } from "../utils/hashing.js";
8
- import { resolveRepoPath, safeFileStem, safeRunId } from "../utils/paths.js";
4
+ import { resolveComputeProfile } from "../compute/compute-profile.js";
5
+ import { writeFactoryTelemetrySummary } from "../telemetry/telemetry.js";
6
+ import type { FactoryAdaptiveDispatchGate, FactoryDefinition, FactoryInputManifest, FactoryManifestItem, FactoryRunInput, FactoryRunResult } from "../../types.js";
7
+ import { sha256 } from "../../core/utils/hashing.js";
8
+ import { resolveRepoPath, safeFileStem, safeRunId } from "../../core/utils/paths.js";
9
9
  import { buildFactoryAgenticPlan, detectCanonicalPatterns } from "./agentic-plan.js";
10
10
  import { buildInitialAdaptiveDelegationGovernorState, normalizeAdaptiveDelegationPolicy } from "../orchestration/adaptive-delegation.js";
11
11
  import { FACTORY_PHASE_SENTINELS, factoryPhaseSentinelForMode, loadFactoryDefinition, loadFactoryInputManifest, loadFactoryOracleReview, normalizeFactoryAdaptiveDispatchGate, summarizeFactoryOracleReview, validateFactoryRunInputs } from "./validation.js";
@@ -1,17 +1,17 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { loadProjectAgents } from "../agents.js";
5
- import { DEFAULT_RULES } from "../constants.js";
6
- import { validateOutputContractId } from "../output-contracts.js";
4
+ import { loadProjectAgents } from "../delegation/agents.js";
5
+ import { DEFAULT_RULES } from "../../core/constants.js";
6
+ import { validateOutputContractId } from "../delegation/output-contracts.js";
7
7
  import { normalizeAdaptiveDelegationPolicy, validateAdaptiveDelegationPolicy } from "../orchestration/adaptive-delegation.js";
8
- import { validateToolList } from "../safety.js";
9
- import type { FactoryAdaptiveDispatchGate, FactoryAdaptiveDispatchGateInput, FactoryDefinition, FactoryExecutionMode, FactoryInputManifest, FactoryManifestItem, FactoryOracleReview, FactoryRunInput, FactoryStage } from "../types.js";
10
- import { sha256 } from "../utils/hashing.js";
11
- import { parseJsonFile } from "../utils/json.js";
12
- import { isSafeArtifactName, pathMatches, resolveRepoPath, safeFileStem } from "../utils/paths.js";
13
- import { isRecord } from "../utils/records.js";
14
- import { readableZobResourcePath } from "../utils/resources.js";
8
+ import { validateToolList } from "../governance/safety.js";
9
+ import type { FactoryAdaptiveDispatchGate, FactoryAdaptiveDispatchGateInput, FactoryDefinition, FactoryExecutionMode, FactoryInputManifest, FactoryManifestItem, FactoryOracleReview, FactoryRunInput, FactoryStage } from "../../types.js";
10
+ import { sha256 } from "../../core/utils/hashing.js";
11
+ import { parseJsonFile } from "../../core/utils/json.js";
12
+ import { isSafeArtifactName, pathMatches, resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
13
+ import { isRecord } from "../../core/utils/records.js";
14
+ import { readableZobResourcePath } from "../../core/utils/resources.js";
15
15
 
16
16
  function isFactoryManifestItem(value: unknown): value is FactoryManifestItem {
17
17
  return isRecord(value) && typeof value.id === "string" && typeof value.path === "string";
@@ -0,0 +1,20 @@
1
+ # Git domain guardrail
2
+
3
+ ## Scope
4
+
5
+ - Governed zcommit/git policy helpers and child dirty-path tracking.
6
+
7
+ ## MUST DO
8
+
9
+ - Preserve `/zcommit` governance, explicit user-request requirement, no direct global staging, owned-path tracking, and policy smoke expectations.
10
+
11
+ ## MUST NOT
12
+
13
+ - Do not introduce direct `git commit`, `git push`, `git tag`, force push, `git add .`, or `git add -A` behavior.
14
+ - Do not import from `index.ts` or `index.js`.
15
+
16
+ ## Validation
17
+
18
+ - `npm run check -- --pretty false`.
19
+ - `npm run smoke:git-ops` after git helper moves.
20
+ - `npm run smoke:harness` if runtime-facing behavior moves.
@@ -3,7 +3,7 @@ import { relative, resolve } from "node:path";
3
3
  import { createHash } from "node:crypto";
4
4
  import { execFileSync } from "node:child_process";
5
5
 
6
- import { pathMatches } from "./utils/paths.js";
6
+ import { pathMatches } from "../../core/utils/paths.js";
7
7
 
8
8
  export type ZcommitToggleState = "on" | "off";
9
9
 
@@ -665,13 +665,13 @@ export function formatZcommitPlan(plan: ZcommitPlan): string {
665
665
  }
666
666
 
667
667
  function cachedNames(repoRoot: string): string[] {
668
- const stdout = runGit(repoRoot, ["diff", "--cached", "--name-only", "-z"]);
668
+ const stdout = runGit(repoRoot, ["diff", "--cached", "--no-renames", "--name-only", "-z"]);
669
669
  return stdout.split("\0").filter(Boolean).sort();
670
670
  }
671
671
 
672
672
  function cachedPatch(repoRoot: string, paths: string[]): string {
673
673
  if (paths.length === 0) return "";
674
- return runGit(repoRoot, ["diff", "--cached", "--binary", "--", ...paths]);
674
+ return runGit(repoRoot, ["diff", "--cached", "--no-renames", "--binary", "--", ...paths]);
675
675
  }
676
676
 
677
677
  function restoreCachedPaths(repoRoot: string, paths: string[], preAddPatch: string): void {
@@ -0,0 +1,22 @@
1
+ # Goal domain guardrail
2
+
3
+ ## Scope
4
+
5
+ - Goal parsing, runtime goal state, goal TODO graph, TODO imports, and goal-room reducer logic.
6
+
7
+ ## MUST DO
8
+
9
+ - Preserve parent-owned TODO claim semantics, oracle/no_ship gates, TODO statuses, action names, diagnostics, and evidence refs.
10
+ - Preserve runtime goal statuses, activation mode defaults, continuation semantics, and branch restore behavior.
11
+ - Keep public exports reachable from `index.ts`.
12
+
13
+ ## MUST NOT
14
+
15
+ - Do not accept delegated claims without parent-owned evidence/oracle gates.
16
+ - Do not bypass goal completion proposal or oracle requirements.
17
+ - Do not import from `index.ts` or `index.js`.
18
+
19
+ ## Validation
20
+
21
+ - `npm run check -- --pretty false`.
22
+ - `npm run smoke:harness` after TODO or runtime-goal moves.
@@ -1,13 +1,13 @@
1
1
  import { appendFileSync, mkdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { DEFAULT_RULES } from "./constants.js";
5
- import type { TeamDefinition } from "./types.js";
6
- import { sha256 } from "./utils/hashing.js";
7
- import { readJsonl } from "./utils/json.js";
8
- import { pathMatches } from "./utils/paths.js";
9
- import { newRunId, resolveRepoPath, safeFileStem } from "./utils/paths.js";
10
- import { isRecord } from "./utils/records.js";
4
+ import { DEFAULT_RULES } from "../../core/constants.js";
5
+ import type { TeamDefinition } from "../../types.js";
6
+ import { sha256 } from "../../core/utils/hashing.js";
7
+ import { readJsonl } from "../../core/utils/json.js";
8
+ import { pathMatches } from "../../core/utils/paths.js";
9
+ import { newRunId, resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
10
+ import { isRecord } from "../../core/utils/records.js";
11
11
 
12
12
  export type GoalRoomMessageKind = "QUESTION" | "ANSWER" | "FINDING" | "ACTION_TAKEN" | "ARTIFACT_READY" | "TODO_CLAIM" | "BLOCKER" | "RISK" | "NO_SHIP_ALERT" | "CONTEXT_REQUEST" | "SPLIT_REQUEST" | "DELEGATION_REQUEST" | "ORACLE_REQUEST" | "OWNER_CHANGE_REQUEST" | "OWNER_CHANGE_DECISION" | "HANDOFF" | "DECISION" | "STATUS_UPDATE";
13
13
  export type GoalRoomAudience = "all" | "parent" | "lead" | "oracle" | "worker";
@@ -3,7 +3,7 @@ import { join } from "node:path";
3
3
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
4
4
 
5
5
  import { addGoalTodo, completeGoalTodo, type GoalTodoNode, type GoalTodoOwner } from "./goal-todos.js";
6
- import type { HarnessRuntimeState } from "./runtime/state.js";
6
+ import type { HarnessRuntimeState } from "../../runtime/state.js";
7
7
 
8
8
  export interface GoalTodoImportResult {
9
9
  kind: "factory" | "orchestration" | "chain";
@@ -1,4 +1,4 @@
1
- import type { ZcommitChildChangedPathRef } from "./git-ops.js";
1
+ import type { ZcommitChildChangedPathRef } from "../git/git-ops.js";
2
2
 
3
3
  export type GoalTodoStatus = "planned" | "ready" | "in_progress" | "delegated" | "claim_returned" | "needs_review" | "needs_oracle" | "needs_user" | "blocked" | "done" | "skipped";
4
4
  export type GoalTodoOwner = "agent" | "user" | "oracle" | "subagent" | "factory" | "orchestration";
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
3
 
4
- import type { HarnessRuntimeState } from "./runtime/state.js";
4
+ import type { HarnessRuntimeState } from "../../runtime/state.js";
5
5
  import type {
6
6
  AddGoalTodoInput,
7
7
  GoalRoomTodoReducerDecision,
@@ -32,9 +32,9 @@ import type {
32
32
  TodoClaimValidationResult,
33
33
  TodoSplitRequest,
34
34
  } from "./goal-todo-types.js";
35
- import { recordZcommitOwnedPaths, type ZcommitChildChangedPathRef } from "./git-ops.js";
36
- import { sha256 } from "./utils/hashing.js";
37
- import { isRecord } from "./utils/records.js";
35
+ import { recordZcommitOwnedPaths, type ZcommitChildChangedPathRef } from "../git/git-ops.js";
36
+ import { sha256 } from "../../core/utils/hashing.js";
37
+ import { isRecord } from "../../core/utils/records.js";
38
38
 
39
39
  export const ZOB_GOAL_TODO_ENTRY_TYPE = "zob-goal-todo";
40
40
 
@@ -1,4 +1,4 @@
1
- import type { BillableJobIntake, BudgetSidecar, GoalState } from "./types.js";
1
+ import type { BillableJobIntake, BudgetSidecar, GoalState } from "../../types.js";
2
2
 
3
3
  export type StrictGoalSpecAnchorKind = "active_goal" | "orchestrate_run" | "factory_run" | "delegate_write" | "quarantine";
4
4
 
@@ -0,0 +1,21 @@
1
+ # Governance domain guardrail
2
+
3
+ ## Scope
4
+
5
+ - Safety policy, rules, budget gates, sandbox metadata, workspace claims, worker pools, and merge queue records.
6
+
7
+ ## MUST DO
8
+
9
+ - Preserve path policy, secret protection, no destructive behavior, parent-owned merge/apply semantics, and hash-only metadata.
10
+ - Keep sandbox/apply helpers proposal-only unless the original gated path explicitly required approval.
11
+
12
+ ## MUST NOT
13
+
14
+ - Do not introduce auto-apply, direct git commit/push, hidden worker chat, or raw body persistence.
15
+ - Do not weaken allowed_paths/forbidden_paths validation.
16
+ - Do not import from `index.ts` or `index.js`.
17
+
18
+ ## Validation
19
+
20
+ - `npm run check -- --pretty false`.
21
+ - `npm run smoke:harness` after safety, sandbox, workspace, worker-pool, or merge-queue moves.
@@ -1,12 +1,12 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { evaluateBudgetPreflightDryRun } from "./chronicle.js";
5
- import type { BudgetPreflightDryRunCaps, FactoryRunBudgetInput } from "./types.js";
6
- import { sha256 } from "./utils/hashing.js";
7
- import { parseJsonFile } from "./utils/json.js";
8
- import { safeFileStem } from "./utils/paths.js";
9
- import { isRecord } from "./utils/records.js";
4
+ import { evaluateBudgetPreflightDryRun } from "../telemetry/chronicle.js";
5
+ import type { BudgetPreflightDryRunCaps, FactoryRunBudgetInput } from "../../types.js";
6
+ import { sha256 } from "../../core/utils/hashing.js";
7
+ import { parseJsonFile } from "../../core/utils/json.js";
8
+ import { safeFileStem } from "../../core/utils/paths.js";
9
+ import { isRecord } from "../../core/utils/records.js";
10
10
 
11
11
  const FORBIDDEN_BUDGET_BODY_KEYS = new Set(["task", "prompt", "output", "body", "content"]);
12
12
  const REQUIRED_CAP_KEYS: Array<keyof BudgetPreflightDryRunCaps> = ["maxCostUsd", "maxRuns", "maxDurationMs", "maxParallelChildren"];
@@ -1,10 +1,10 @@
1
- import { DEFAULT_RULES } from "./constants.js";
2
- import { appendGoalRoomMessage } from "./goal-room.js";
3
- import type { TeamDefinition } from "./types.js";
4
- import { sha256 } from "./utils/hashing.js";
5
- import { pathMatches } from "./utils/paths.js";
6
- import { resolveRepoPath, safeFileStem } from "./utils/paths.js";
7
- import { isRecord } from "./utils/records.js";
1
+ import { DEFAULT_RULES } from "../../core/constants.js";
2
+ import { appendGoalRoomMessage } from "../goal/goal-room.js";
3
+ import type { TeamDefinition } from "../../types.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { pathMatches } from "../../core/utils/paths.js";
6
+ import { resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
7
+ import { isRecord } from "../../core/utils/records.js";
8
8
 
9
9
  export type GovernedRequestKind = "DELEGATION_REQUEST" | "ORACLE_REQUEST" | "CONTEXT_REQUEST" | "OWNER_CHANGE_REQUEST";
10
10
  export type GovernedRequestPriority = "low" | "normal" | "high" | "critical";