zob-harness 0.2.0 → 0.3.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 (214) 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 +3 -3
  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 +3 -3
  38. package/.pi/extensions/zob-harness/src/{mission-control.ts → domains/coms/mission-control.ts} +8 -8
  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 +49 -27
  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 +52 -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 +25 -8
  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 +145 -0
  149. package/.pi/skills/zob-split-refactor/SKILL.md +1 -1
  150. package/.pi/skills/zob-zagent-creator/SKILL.md +256 -12
  151. package/.pi/zagents/bdd-writer.json +20 -0
  152. package/.pi/zagents/data-profile-analyst.json +20 -0
  153. package/.pi/zagents/domain-modeler.json +20 -0
  154. package/.pi/zagents/planner-handoff-writer.json +20 -0
  155. package/.pi/zagents/prompts/agentic-spec-run-role.md +30 -0
  156. package/.pi/zagents/source-intake-steward.json +20 -0
  157. package/.pi/zagents/spec-chief.json +21 -0
  158. package/.pi/zagents/spec-oracle.json +20 -0
  159. package/.pi/zagents/spec-writer.json +20 -0
  160. package/.pi/zagents/ux-flow-analyst.json +20 -0
  161. package/.pi/zteams/agentic-spec-run.json +42 -0
  162. package/.pi/zteams/agentic-spec-run.tmux.sh +134 -0
  163. package/SOURCE_INDEX.md +1 -1
  164. package/package.json +9 -1
  165. package/scripts/README.md +1 -1
  166. package/scripts/agentic-spec-team/validate-bdd.mjs +13 -0
  167. package/scripts/agentic-spec-team/validate-final-report.mjs +14 -0
  168. package/scripts/agentic-spec-team/validate-manifest.mjs +14 -0
  169. package/scripts/agentic-spec-team/validate-oracle-ready.mjs +13 -0
  170. package/scripts/agentic-spec-team/validate-question-loop.mjs +15 -0
  171. package/scripts/agentic-spec-team/validate-run.mjs +11 -0
  172. package/scripts/agentic-spec-team/validate-source-register.mjs +17 -0
  173. package/scripts/agentic-spec-team/validate-traceability.mjs +20 -0
  174. package/scripts/agentic-spec-team/validate-workgraph.mjs +13 -0
  175. package/scripts/autonomy/mission-readiness-secret-smoke.mjs +5 -5
  176. package/scripts/git-ops/commit-policy-smoke.mjs +5 -4
  177. package/scripts/goal-todo/child-goal-ref-smoke.mjs +2 -2
  178. package/scripts/path-policy/validate-smoke.mjs +3 -3
  179. package/scripts/project-dna/AGENTS.md +39 -0
  180. package/scripts/project-dna/{validate-scaffold.mjs → validation/validate-scaffold.mjs} +7 -7
  181. package/scripts/spec-run.mjs +365 -0
  182. package/scripts/worker-pool/static-smoke.mjs +5 -5
  183. package/scripts/zagent-static-smoke.mjs +35 -6
  184. package/scripts/zpeer-local-e2e-smoke.mjs +6 -5
  185. package/scripts/zpeer-static-smoke.mjs +17 -17
  186. /package/.pi/extensions/zob-harness/src/{types → core/types}/core.ts +0 -0
  187. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/hashing.ts +0 -0
  188. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/json.ts +0 -0
  189. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/paths.ts +0 -0
  190. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/AGENTS.md +0 -0
  191. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/pending-replies.ts +0 -0
  192. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/types.ts +0 -0
  193. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/ledger.ts +0 -0
  194. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/types.ts +0 -0
  195. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/validate.ts +0 -0
  196. /package/.pi/extensions/zob-harness/src/{schemas-project-dna.ts → runtime/schemas-project-dna.ts} +0 -0
  197. /package/.pi/extensions/zob-harness/src/{schemas.ts → runtime/schemas.ts} +0 -0
  198. /package/scripts/project-dna/{bench-smoke.mjs → benchmark/bench-smoke.mjs} +0 -0
  199. /package/scripts/project-dna/{build-capsules.mjs → capsules/build-capsules.mjs} +0 -0
  200. /package/scripts/project-dna/{emit-golden-cases.mjs → emit/emit-golden-cases.mjs} +0 -0
  201. /package/scripts/project-dna/{emit-ontology.mjs → emit/emit-ontology.mjs} +0 -0
  202. /package/scripts/project-dna/{oracle-review-smoke.mjs → oracle/oracle-review-smoke.mjs} +0 -0
  203. /package/scripts/project-dna/{query-context.mjs → query/query-context.mjs} +0 -0
  204. /package/scripts/project-dna/{query-steward.mjs → query/query-steward.mjs} +0 -0
  205. /package/scripts/project-dna/{build-sample-spec.mjs → sample/build-sample-spec.mjs} +0 -0
  206. /package/scripts/project-dna/{generate-sample.mjs → sample/generate-sample.mjs} +0 -0
  207. /package/scripts/project-dna/{validate-sample-project.mjs → sample/validate-sample-project.mjs} +0 -0
  208. /package/scripts/project-dna/{scan.mjs → scan/scan.mjs} +0 -0
  209. /package/scripts/project-dna/{validate-scan-artifacts.mjs → scan/validate-scan-artifacts.mjs} +0 -0
  210. /package/scripts/project-dna/{validate-5of5.mjs → validation/validate-5of5.mjs} +0 -0
  211. /package/scripts/project-dna/{validate-golden-cases.mjs → validation/validate-golden-cases.mjs} +0 -0
  212. /package/scripts/project-dna/{validate-ontology.mjs → validation/validate-ontology.mjs} +0 -0
  213. /package/scripts/project-dna/{plan-workflow.mjs → workflow/plan-workflow.mjs} +0 -0
  214. /package/scripts/project-dna/{validate-workflow.mjs → workflow/validate-workflow.mjs} +0 -0
@@ -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";
@@ -1,7 +1,7 @@
1
- import { DEFAULT_RULES } from "./constants.js";
2
- import { sha256 } from "./utils/hashing.js";
3
- import { pathMatches, resolveRepoPath, safeFileStem } from "./utils/paths.js";
4
- import { isRecord } from "./utils/records.js";
1
+ import { DEFAULT_RULES } from "../../core/constants.js";
2
+ import { sha256 } from "../../core/utils/hashing.js";
3
+ import { pathMatches, resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
4
+ import { isRecord } from "../../core/utils/records.js";
5
5
 
6
6
  export type WorkerPoolLaneKind = "context" | "factory" | "implement" | "qa" | "oracle";
7
7
  export type ApplyGateStatus = "eligible_not_applied" | "blocked";
@@ -1,12 +1,12 @@
1
1
  import { appendFileSync, mkdirSync, writeFileSync } 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, resolveRepoPath, safeFileStem } from "./utils/paths.js";
9
- 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, resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
9
+ import { isRecord } from "../../core/utils/records.js";
10
10
 
11
11
  export type MergeCandidatePriority = "low" | "normal" | "high" | "critical";
12
12
  export type MergeCandidateRisk = "low" | "medium" | "high";
@@ -1,9 +1,9 @@
1
1
  import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import { basename, join } from "node:path";
3
3
 
4
- import type { ModeName, RuleEnforcementLevel, RuleOracleRequirement, RulePack, RuleResolution, RuleResolverInput } from "./types.js";
5
- import { pathMatches, safeFileStem } from "./utils/paths.js";
6
- import { isRecord } from "./utils/records.js";
4
+ import type { ModeName, RuleEnforcementLevel, RuleOracleRequirement, RulePack, RuleResolution, RuleResolverInput } from "../../types.js";
5
+ import { pathMatches, safeFileStem } from "../../core/utils/paths.js";
6
+ import { isRecord } from "../../core/utils/records.js";
7
7
 
8
8
  const RULE_PACK_SCHEMA = "zob.rule-pack.v1";
9
9
  const RULE_RESOLUTION_SCHEMA = "zob.rule-resolution.v1";
@@ -12,11 +12,11 @@ const MODE_NAMES = new Set<ModeName>(["explore", "plan", "implement", "oracle",
12
12
  const ENFORCEMENT_LEVELS = new Set<RuleEnforcementLevel>(["advisory", "warn", "preflight_fail", "block", "no_ship", "human_approval"]);
13
13
 
14
14
  const PROFILE_PATHS: Array<{ profile: string; patterns: string[] }> = [
15
- { profile: "factory-engineer", patterns: [".pi/extensions/zob-harness/src/factory/**", ".pi/factories/**", "reports/factory-runs/**"] },
16
- { profile: "orchestration-engineer", patterns: [".pi/extensions/zob-harness/src/orchestration/**", ".pi/extensions/zob-harness/src/topology/**", ".pi/teams/**", ".pi/orchestrations/**", "reports/orchestrations/**"] },
15
+ { profile: "factory-engineer", patterns: [".pi/extensions/zob-harness/src/domains/factory/**", ".pi/factories/**", "reports/factory-runs/**"] },
16
+ { profile: "orchestration-engineer", patterns: [".pi/extensions/zob-harness/src/domains/orchestration/**", ".pi/extensions/zob-harness/src/domains/topology/**", ".pi/teams/**", ".pi/orchestrations/**", "reports/orchestrations/**"] },
17
17
  { profile: "prompt-ops", patterns: [".pi/agents/**", ".pi/prompts/**", ".pi/skills/**", ".pi/output-contracts/**", ".pi/chains/**"] },
18
- { profile: "sandbox-engineer", patterns: ["reports/sandbox-runs/**", ".pi/extensions/zob-harness/src/safety.ts", ".pi/extensions/zob-harness/src/child-runner.ts"] },
19
- { profile: "runtime-maintainer", patterns: [".pi/extensions/zob-harness/index.ts", ".pi/extensions/zob-harness/src/runtime/**", ".pi/extensions/zob-harness/src/schemas.ts", ".pi/extensions/zob-harness/src/types.ts", ".pi/extensions/zob-harness/src/rules.ts"] },
18
+ { profile: "sandbox-engineer", patterns: ["reports/sandbox-runs/**", ".pi/extensions/zob-harness/src/domains/governance/safety.ts", ".pi/extensions/zob-harness/src/domains/delegation/child-runner.ts"] },
19
+ { profile: "runtime-maintainer", patterns: [".pi/extensions/zob-harness/index.ts", ".pi/extensions/zob-harness/src/runtime/**", ".pi/extensions/zob-harness/src/runtime/schemas.ts", ".pi/extensions/zob-harness/src/types.ts", ".pi/extensions/zob-harness/src/domains/governance/rules.ts"] },
20
20
  { profile: "docs-maintainer", patterns: ["docs/**", "README.md", "AGENTS.md"] },
21
21
  ];
22
22
 
@@ -2,9 +2,9 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
3
  import { getAgentDir } from "@earendil-works/pi-coding-agent";
4
4
 
5
- import { DEFAULT_RULES } from "./constants.js";
6
- import type { BudgetSidecar, DamageRules, HarnessAgent } from "./types.js";
7
- import { expandHome, pathMatches } from "./utils/paths.js";
5
+ import { DEFAULT_RULES } from "../../core/constants.js";
6
+ import type { BudgetSidecar, DamageRules, HarnessAgent } from "../../types.js";
7
+ import { expandHome, pathMatches } from "../../core/utils/paths.js";
8
8
 
9
9
  function loadDamageRules(cwd: string): DamageRules {
10
10
  const candidates = [join(cwd, ".pi", "damage-control-rules.json"), join(getAgentDir(), "damage-control-rules.json")];
@@ -1,12 +1,12 @@
1
1
  import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
2
2
  import { dirname, join, resolve } from "node:path";
3
3
 
4
- import { DEFAULT_RULES } from "./constants.js";
4
+ import { DEFAULT_RULES } from "../../core/constants.js";
5
5
  import { createDiffGateResult, createRollbackMetadata, createSandboxMetadata, validateRuntimeWritePolicy } from "./safety.js";
6
- import { sha256 } from "./utils/hashing.js";
7
- import { parseJsonFile } from "./utils/json.js";
8
- import { pathMatches, resolveRepoPath, safeFileStem, safeRunId } from "./utils/paths.js";
9
- import { isRecord } from "./utils/records.js";
6
+ import { sha256 } from "../../core/utils/hashing.js";
7
+ import { parseJsonFile } from "../../core/utils/json.js";
8
+ import { pathMatches, resolveRepoPath, safeFileStem, safeRunId } from "../../core/utils/paths.js";
9
+ import { isRecord } from "../../core/utils/records.js";
10
10
 
11
11
  export type SandboxWriteAction = "create" | "update";
12
12
 
@@ -1,13 +1,13 @@
1
1
  import { appendFileSync, existsSync, mkdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { DEFAULT_RULES } from "./constants.js";
5
- import { appendGoalRoomMessage } from "./goal-room.js";
6
- import type { TeamDefinition } from "./types.js";
7
- import { sha256 } from "./utils/hashing.js";
8
- import { readJsonl } from "./utils/json.js";
9
- import { newRunId, pathMatches, resolveRepoPath, safeFileStem } from "./utils/paths.js";
10
- import { isRecord } from "./utils/records.js";
4
+ import { DEFAULT_RULES } from "../../core/constants.js";
5
+ import { appendGoalRoomMessage } from "../goal/goal-room.js";
6
+ import type { TeamDefinition } from "../../types.js";
7
+ import { sha256 } from "../../core/utils/hashing.js";
8
+ import { readJsonl } from "../../core/utils/json.js";
9
+ import { newRunId, pathMatches, resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
10
+ import { isRecord } from "../../core/utils/records.js";
11
11
  import { listWorkspaceClaims, type WorkspaceClaimRecord } from "./workspace-claims.js";
12
12
 
13
13
  export type WorkerPoolCommunicationPolicyMode = "goal_room_only" | "goal_room_with_optional_live";
@@ -1,12 +1,12 @@
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, resolveRepoPath, safeFileStem } from "./utils/paths.js";
9
- 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, resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
9
+ import { isRecord } from "../../core/utils/records.js";
10
10
 
11
11
  export type WorkspaceClaimMode = "read" | "write";
12
12
  export type WorkspaceClaimStatus = "active" | "blocked_conflict";
@@ -0,0 +1,20 @@
1
+ # Models domain guardrail
2
+
3
+ ## Scope
4
+
5
+ - Model routing, model availability validation, model catalog/economy helpers.
6
+
7
+ ## MUST DO
8
+
9
+ - Preserve explicit model override validation and configured/runtime availability distinctions.
10
+ - Keep budget and routing decisions evidence-backed.
11
+
12
+ ## MUST NOT
13
+
14
+ - Do not treat desired/configured/catalogued models as runtime availability proof.
15
+ - Do not import from `index.ts` or `index.js`.
16
+
17
+ ## Validation
18
+
19
+ - `npm run check -- --pretty false`.
20
+ - Run model catalog validation scripts when model policy files or helpers move.
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { isRecord } from "./utils/records.js";
4
+ import { isRecord } from "../../core/utils/records.js";
5
5
 
6
6
  export type ExplicitModelOverrideValidation = {
7
7
  ok: boolean;
@@ -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, FactoryRunModelRoutingInput, ModeName } 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, FactoryRunModelRoutingInput, ModeName } 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
  export type ModelRiskLevel = "low" | "medium" | "high";
12
12
  export type ModelClass = "cheap_scout" | "balanced_worker" | "strong_reasoning" | "strong_oracle" | "high_context";
@@ -0,0 +1,21 @@
1
+ # Orchestration domain compatibility guardrail
2
+
3
+ ## Scope
4
+
5
+ - Future home for orchestration domain files and compatibility wrappers around `src/orchestration/**`.
6
+ - Existing `src/orchestration/AGENTS.md` remains authoritative for current internals until moved.
7
+
8
+ ## MUST DO
9
+
10
+ - Preserve plan-only/read-only supervised semantics, parent-owned dispatch, room artifact names, and no child-spawns-child policy.
11
+
12
+ ## MUST NOT
13
+
14
+ - Do not make plan-only flows produce completion sentinels.
15
+ - Do not launch live children from supervised_readonly by moving code.
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 orchestration moves.
@@ -1,10 +1,10 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { discoverAgents } from "../agents.js";
5
- import { DEFAULT_RULES, SUPERVISED_READONLY_CHILD_TOOLS } from "../constants.js";
6
- import { validateOutputContractId } from "../output-contracts.js";
7
- import { validateAllowedPathPolicy } from "../safety.js";
4
+ import { discoverAgents } from "../delegation/agents.js";
5
+ import { DEFAULT_RULES, SUPERVISED_READONLY_CHILD_TOOLS } from "../../core/constants.js";
6
+ import { validateOutputContractId } from "../delegation/output-contracts.js";
7
+ import { validateAllowedPathPolicy } from "../governance/safety.js";
8
8
  import type {
9
9
  AdaptiveDelegationGovernorState,
10
10
  AdaptiveDelegationPolicy,
@@ -17,10 +17,10 @@ import type {
17
17
  DelegationScore,
18
18
  GovernorDecision,
19
19
  ParentDispatchContract,
20
- } from "../types.js";
21
- import { sha256 } from "../utils/hashing.js";
22
- import { pathMatches } from "../utils/paths.js";
23
- import { isRecord } from "../utils/records.js";
20
+ } from "../../types.js";
21
+ import { sha256 } from "../../core/utils/hashing.js";
22
+ import { pathMatches } from "../../core/utils/paths.js";
23
+ import { isRecord } from "../../core/utils/records.js";
24
24
 
25
25
  const ADAPTIVE_DELEGATION_SCHEMA = "zob.adaptive-delegation-policy.v1" as const;
26
26
  const GOVERNOR_STATE_SCHEMA = "zob.adaptive-delegation-governor-state.v1" as const;
@@ -1,10 +1,10 @@
1
1
  import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
 
4
- import type { AdaptiveDelegationPolicy, OrchestrateExecutionMode, OrchestrateRunInput, OrchestrationProfileDefinition, TeamDefinition, TeamRoleBase, TeamLead, TeamWorker } from "../types.js";
5
- import { sha256 } from "../utils/hashing.js";
6
- import { safeFileStem } from "../utils/paths.js";
7
- import { isRecord } from "../utils/records.js";
4
+ import type { AdaptiveDelegationPolicy, OrchestrateExecutionMode, OrchestrateRunInput, OrchestrationProfileDefinition, TeamDefinition, TeamRoleBase, TeamLead, TeamWorker } from "../../types.js";
5
+ import { sha256 } from "../../core/utils/hashing.js";
6
+ import { safeFileStem } from "../../core/utils/paths.js";
7
+ import { isRecord } from "../../core/utils/records.js";
8
8
 
9
9
  const BODY_FREE_SCHEMA_VERSION = "v1";
10
10
  const GUIDANCE_SCAN_LIMIT = 200;
@@ -1,8 +1,8 @@
1
- import { loadProjectAgents } from "../agents.js";
2
- import { validateOutputContractId } from "../output-contracts.js";
3
- import { validateAllowedPathPolicy, validateDelegateTaskWriteScope, validateForbiddenPathPolicy, validateToolList } from "../safety.js";
4
- import { sha256 } from "../utils/hashing.js";
5
- import { isRecord } from "../utils/records.js";
1
+ import { loadProjectAgents } from "../delegation/agents.js";
2
+ import { validateOutputContractId } from "../delegation/output-contracts.js";
3
+ import { validateAllowedPathPolicy, validateDelegateTaskWriteScope, validateForbiddenPathPolicy, validateToolList } from "../governance/safety.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { isRecord } from "../../core/utils/records.js";
6
6
 
7
7
  export interface LeadPlanWorkerContract {
8
8
  worker_id: string;