ultimate-pi 0.18.0 → 0.19.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 (314) hide show
  1. package/.agents/skills/harness-debate-plan/SKILL.md +1 -1
  2. package/.agents/skills/harness-decisions/SKILL.md +2 -3
  3. package/.agents/skills/harness-governor/SKILL.md +6 -5
  4. package/.agents/skills/harness-orchestration/SKILL.md +4 -4
  5. package/.agents/skills/harness-review/SKILL.md +7 -7
  6. package/.agents/skills/harness-sentrux-setup/SKILL.md +4 -3
  7. package/.agents/skills/harness-steer/SKILL.md +1 -1
  8. package/.agents/skills/sentrux/SKILL.md +9 -9
  9. package/.pi/PACKAGING.md +4 -4
  10. package/.pi/SYSTEM.md +54 -120
  11. package/.pi/agents/harness/incident-recorder.md +0 -1
  12. package/.pi/agents/harness/planning/decompose.md +1 -3
  13. package/.pi/agents/harness/planning/execution-plan-author.md +0 -2
  14. package/.pi/agents/harness/planning/hypothesis-validator.md +0 -2
  15. package/.pi/agents/harness/planning/hypothesis.md +0 -2
  16. package/.pi/agents/harness/planning/implementation-researcher.md +0 -2
  17. package/.pi/agents/harness/planning/plan-adversary.md +0 -2
  18. package/.pi/agents/harness/planning/plan-evaluator.md +1 -3
  19. package/.pi/agents/harness/planning/planning-context.md +0 -2
  20. package/.pi/agents/harness/planning/review-integrator.md +0 -2
  21. package/.pi/agents/harness/planning/sprint-contract-auditor.md +0 -2
  22. package/.pi/agents/harness/planning/stack-researcher.md +0 -2
  23. package/.pi/agents/harness/{adversary.md → reviewing/adversary.md} +0 -2
  24. package/.pi/agents/harness/{evaluator.md → reviewing/evaluator.md} +0 -2
  25. package/.pi/agents/harness/{tie-breaker.md → reviewing/tie-breaker.md} +0 -2
  26. package/.pi/agents/harness/{executor.md → running/executor.md} +0 -2
  27. package/.pi/agents/harness/sentrux-bootstrap.md +0 -1
  28. package/.pi/agents/harness/sentrux-steward.md +0 -2
  29. package/.pi/agents/harness/trace-librarian.md +0 -1
  30. package/.pi/extensions/00-harness-project-control.ts +133 -0
  31. package/.pi/extensions/00-posthog-network-bootstrap.ts +1 -1
  32. package/.pi/extensions/agt-kill-switch.ts +57 -0
  33. package/.pi/extensions/agt-prompt-guard.ts +32 -0
  34. package/.pi/extensions/budget-guard.ts +2 -0
  35. package/.pi/extensions/custom-footer.ts +46 -145
  36. package/.pi/extensions/custom-header.ts +1 -1
  37. package/.pi/extensions/custom-system-prompt.ts +1 -1
  38. package/.pi/extensions/debate-orchestrator.ts +7 -5
  39. package/.pi/extensions/harness-ask-user.ts +8 -8
  40. package/.pi/extensions/harness-debate-tools.ts +27 -43
  41. package/.pi/extensions/harness-lens.ts +94 -0
  42. package/.pi/extensions/harness-live-widget.ts +33 -2
  43. package/.pi/extensions/harness-plan-approval.ts +12 -12
  44. package/.pi/extensions/harness-run-context.ts +1214 -852
  45. package/.pi/extensions/harness-subagent-governance.ts +8 -0
  46. package/.pi/extensions/harness-subagent-submit.ts +36 -164
  47. package/.pi/extensions/harness-subagents.ts +4 -4
  48. package/.pi/extensions/harness-telemetry.ts +3 -1
  49. package/.pi/extensions/harness-web-tools.ts +3 -3
  50. package/.pi/extensions/observation-bus.ts +2 -0
  51. package/.pi/extensions/policy-gate.ts +27 -5
  52. package/.pi/extensions/review-integrity.ts +91 -10
  53. package/.pi/extensions/sentrux-rules-sync.ts +3 -1
  54. package/.pi/extensions/subagent-governance.ts +92 -0
  55. package/.pi/extensions/test-diff-integrity.ts +1 -0
  56. package/.pi/extensions/trace-recorder.ts +3 -1
  57. package/.pi/extensions/{ultimate-pi-vcc.ts → vcc-compaction.ts} +1 -1
  58. package/.pi/harness/README.md +6 -2
  59. package/.pi/harness/agents.manifest.json +38 -49
  60. package/.pi/harness/agents.policy.yaml +275 -0
  61. package/.pi/harness/corpus/graphify-kb-updater.config.json +55 -0
  62. package/.pi/harness/docs/adrs/0006-sentrux-dual-layer.md +2 -1
  63. package/.pi/harness/docs/adrs/0030-inhouse-vcc-compaction.md +1 -1
  64. package/.pi/harness/docs/adrs/0035-plan-phase-review-gate.md +1 -1
  65. package/.pi/harness/docs/adrs/0044-harness-steer-loop.md +3 -2
  66. package/.pi/harness/docs/adrs/0045-harness-lens-minimal-contract.md +49 -0
  67. package/.pi/harness/docs/adrs/0045-phase-scoped-agent-directories.md +33 -0
  68. package/.pi/harness/docs/adrs/0046-agt-policy-engine.md +51 -0
  69. package/.pi/harness/docs/adrs/0047-agt-layered-security.md +39 -0
  70. package/.pi/harness/docs/adrs/0048-tool-call-hook-order.md +25 -0
  71. package/.pi/harness/docs/adrs/0049-agents-policy-manifest.md +36 -0
  72. package/.pi/harness/docs/adrs/README.md +6 -0
  73. package/.pi/harness/docs/graphify-kb-updater-runbook.md +11 -5
  74. package/.pi/harness/docs/practice-map.md +2 -2
  75. package/.pi/harness/evolution/README.md +1 -2
  76. package/.pi/harness/examples/agents.policy.project.yaml +19 -0
  77. package/.pi/harness/examples/policies/custom-deny-bash.yaml +9 -0
  78. package/.pi/harness/policies/bash-denylists.yaml +5 -0
  79. package/.pi/harness/policies/defaults.yaml +51 -0
  80. package/.pi/harness/policies/orchestrator.yaml +18 -0
  81. package/.pi/harness/policies/phases.yaml +10 -0
  82. package/.pi/harness/policies/roles.yaml +5 -0
  83. package/.pi/harness/policies/web-guard.yaml +5 -0
  84. package/.pi/harness/policies/workflow-sequences.yaml +9 -0
  85. package/.pi/harness/sentrux/architecture.manifest.json +26 -4
  86. package/.pi/harness/specs/harness-spawn-context.schema.json +1 -1
  87. package/.pi/harness/specs/observation.schema.json +2 -1
  88. package/.pi/lib/agents-policy.d.mts +70 -0
  89. package/.pi/lib/agents-policy.mjs +325 -0
  90. package/.pi/lib/agents-policy.ts +19 -0
  91. package/.pi/lib/agt/audit-run-sink.ts +52 -0
  92. package/.pi/lib/agt/build-evaluation-context.ts +285 -0
  93. package/.pi/lib/agt/config.ts +28 -0
  94. package/.pi/lib/agt/delegation.ts +69 -0
  95. package/.pi/lib/agt/evaluate-policy.ts +56 -0
  96. package/.pi/lib/agt/identity-registry.ts +41 -0
  97. package/.pi/lib/agt/index.ts +55 -0
  98. package/.pi/lib/agt/kill-switch-state.ts +11 -0
  99. package/.pi/lib/agt/legacy-evaluate.ts +101 -0
  100. package/.pi/lib/agt/policy-engine.ts +154 -0
  101. package/.pi/lib/agt/rings.ts +21 -0
  102. package/.pi/lib/agt/sre-hooks.ts +45 -0
  103. package/.pi/lib/agt/trust-run-store.ts +26 -0
  104. package/.pi/lib/agt/workflow-history.ts +29 -0
  105. package/.pi/lib/agt-governance-active.ts +14 -0
  106. package/.pi/lib/agt-tool-guard.ts +78 -0
  107. package/.pi/lib/ask-user/dialog.ts +314 -0
  108. package/.pi/{extensions/lib → lib}/debate-bus-core.ts +10 -10
  109. package/.pi/{extensions/lib → lib}/debate-bus-state.ts +1 -1
  110. package/.pi/{extensions/lib → lib}/extension-load-guard.ts +21 -0
  111. package/.pi/lib/harness-agt-tool-guard.ts +5 -0
  112. package/.pi/{extensions/lib → lib}/harness-artifact-gate.ts +6 -16
  113. package/.pi/lib/harness-debate-core-deps.ts +14 -0
  114. package/.pi/lib/harness-debate-workflow-deps.ts +43 -0
  115. package/.pi/lib/harness-lens/.gitattributes +1 -0
  116. package/.pi/lib/harness-lens/clients/edit-autopatch.ts +88 -0
  117. package/.pi/lib/harness-lens/clients/file-kinds.ts +380 -0
  118. package/.pi/lib/harness-lens/clients/file-time.ts +215 -0
  119. package/.pi/lib/harness-lens/clients/file-utils.ts +484 -0
  120. package/.pi/lib/harness-lens/clients/format-service.ts +276 -0
  121. package/.pi/lib/harness-lens/clients/formatters.ts +1000 -0
  122. package/.pi/lib/harness-lens/clients/git-guard.ts +31 -0
  123. package/.pi/lib/harness-lens/clients/indent-retarget.ts +90 -0
  124. package/.pi/lib/harness-lens/clients/installer/index.ts +2368 -0
  125. package/.pi/lib/harness-lens/clients/latency-logger.ts +80 -0
  126. package/.pi/lib/harness-lens/clients/lens-config.ts +43 -0
  127. package/.pi/lib/harness-lens/clients/lens-events.ts +164 -0
  128. package/.pi/lib/harness-lens/clients/lsp/aggregation.ts +91 -0
  129. package/.pi/lib/harness-lens/clients/lsp/client.ts +1466 -0
  130. package/.pi/lib/harness-lens/clients/lsp/config.ts +216 -0
  131. package/.pi/lib/harness-lens/clients/lsp/edits.ts +297 -0
  132. package/.pi/lib/harness-lens/clients/lsp/index.ts +1355 -0
  133. package/.pi/lib/harness-lens/clients/lsp/interactive-install.ts +424 -0
  134. package/.pi/lib/harness-lens/clients/lsp/language.ts +223 -0
  135. package/.pi/lib/harness-lens/clients/lsp/launch.ts +939 -0
  136. package/.pi/lib/harness-lens/clients/lsp/lsp-index.ts +11 -0
  137. package/.pi/lib/harness-lens/clients/lsp/path-utils.ts +12 -0
  138. package/.pi/lib/harness-lens/clients/lsp/server-strategies.ts +81 -0
  139. package/.pi/lib/harness-lens/clients/lsp/server.ts +1971 -0
  140. package/.pi/lib/harness-lens/clients/path-utils.ts +182 -0
  141. package/.pi/lib/harness-lens/clients/pipeline.ts +360 -0
  142. package/.pi/lib/harness-lens/clients/project-profile.ts +117 -0
  143. package/.pi/lib/harness-lens/clients/runtime-agent-end.ts +112 -0
  144. package/.pi/lib/harness-lens/clients/runtime-config.ts +33 -0
  145. package/.pi/lib/harness-lens/clients/runtime-coordinator.ts +186 -0
  146. package/.pi/lib/harness-lens/clients/runtime-tool-result.ts +171 -0
  147. package/.pi/lib/harness-lens/clients/safe-spawn.ts +339 -0
  148. package/.pi/lib/harness-lens/clients/secrets-scanner.ts +214 -0
  149. package/.pi/lib/harness-lens/clients/tool-policy.ts +2072 -0
  150. package/.pi/lib/harness-lens/clients/types.ts +59 -0
  151. package/.pi/lib/harness-lens/clients/widget-state.ts +283 -0
  152. package/.pi/lib/harness-lens/index.ts +532 -0
  153. package/.pi/lib/harness-lens/tools/lsp-diagnostics.ts +706 -0
  154. package/.pi/lib/harness-lens/tools/lsp-navigation.ts +1246 -0
  155. package/.pi/{extensions/lib → lib}/harness-posthog.ts +3 -0
  156. package/.pi/lib/harness-project-config.ts +91 -0
  157. package/.pi/lib/harness-run-context-responses.ts +9 -0
  158. package/.pi/lib/harness-run-context.ts +1 -3
  159. package/.pi/{extensions/lib/spawn-policy.ts → lib/harness-spawn-policy.ts} +4 -3
  160. package/.pi/{extensions/lib → lib}/harness-spawn-topology.ts +5 -28
  161. package/.pi/lib/harness-subagent-auth.ts +51 -0
  162. package/.pi/{extensions/lib → lib}/harness-subagent-precheck.ts +13 -10
  163. package/.pi/{extensions/lib → lib}/harness-subagent-submit-pipeline.ts +3 -3
  164. package/.pi/lib/harness-subagent-submit-register.ts +163 -0
  165. package/.pi/{extensions/lib → lib}/harness-subagent-submit-registry.ts +1 -55
  166. package/.pi/{extensions/lib → lib}/harness-subagents-bridge.ts +53 -14
  167. package/.pi/{extensions/lib → lib}/harness-subprocess-bootstrap.ts +1 -1
  168. package/.pi/lib/harness-ui-state.ts +27 -12
  169. package/.pi/{extensions/lib → lib}/plan-approval/create-plan.ts +2 -2
  170. package/.pi/{extensions/lib → lib}/plan-approval/format-plan.ts +2 -2
  171. package/.pi/{extensions/lib → lib}/plan-approval/plan-review.ts +162 -201
  172. package/.pi/{extensions/lib → lib}/plan-approval/render.ts +1 -1
  173. package/.pi/{extensions/lib → lib}/plan-approval/resolve-disk.ts +2 -2
  174. package/.pi/{extensions/lib → lib}/plan-approval/types.ts +1 -1
  175. package/.pi/{extensions/lib → lib}/plan-approval/validate.ts +3 -3
  176. package/.pi/{extensions/lib → lib}/plan-approval-readiness.ts +3 -52
  177. package/.pi/{extensions/lib → lib}/plan-debate-envelope.ts +1 -1
  178. package/.pi/{extensions/lib → lib}/plan-debate-gate.ts +1 -1
  179. package/.pi/{extensions/lib → lib}/plan-debate-lane.ts +1 -4
  180. package/.pi/{extensions/lib → lib}/plan-messenger.ts +1 -1
  181. package/.pi/prompts/harness-auto.md +2 -2
  182. package/.pi/prompts/harness-plan.md +4 -6
  183. package/.pi/prompts/harness-review.md +9 -9
  184. package/.pi/prompts/harness-run.md +7 -7
  185. package/.pi/prompts/harness-setup.md +42 -68
  186. package/.pi/prompts/harness-steer.md +2 -2
  187. package/.pi/scripts/README.md +3 -5
  188. package/.pi/scripts/generate-agents-policy-yaml.mjs +148 -0
  189. package/.pi/scripts/graphify-kb-updater.mjs +48 -8
  190. package/.pi/scripts/harness-agents-manifest.mjs +61 -4
  191. package/.pi/scripts/harness-agt-doctor.ts +36 -0
  192. package/.pi/scripts/harness-cli-verify.sh +9 -2
  193. package/.pi/scripts/harness-project-toggle.mjs +129 -0
  194. package/.pi/scripts/harness-sentrux-cli.mjs +142 -0
  195. package/.pi/scripts/harness-verify.mjs +113 -39
  196. package/.pi/scripts/harness-web-policy-guard.mjs +2 -2
  197. package/.pi/scripts/validate-plan-dag.mjs +65 -74
  198. package/.pi/scripts/vendor-pi-vcc-settings.stub.ts +2 -2
  199. package/.pi/scripts/vendor-sync-pi-vcc.sh +1 -1
  200. package/.pi/skills/architecture/broker-domain/SKILL.md +65 -0
  201. package/.pi/skills/architecture/cqrs/SKILL.md +63 -0
  202. package/.pi/skills/architecture/event-driven/SKILL.md +60 -0
  203. package/.pi/skills/architecture/hexagonal-ports-adapters/SKILL.md +66 -0
  204. package/.pi/skills/architecture/layered/SKILL.md +68 -0
  205. package/.pi/skills/architecture/microkernel/SKILL.md +62 -0
  206. package/.pi/skills/architecture/microservices/SKILL.md +64 -0
  207. package/.pi/skills/architecture/modular-monolith/SKILL.md +65 -0
  208. package/.pi/skills/architecture/orchestration-driven-soa/SKILL.md +61 -0
  209. package/.pi/skills/architecture/pipeline/SKILL.md +63 -0
  210. package/.pi/skills/architecture/service-based/SKILL.md +64 -0
  211. package/.pi/skills/architecture/service-mesh/SKILL.md +60 -0
  212. package/.pi/skills/architecture/space-based/SKILL.md +60 -0
  213. package/.pi/skills/ast-grep/SKILL.md +40 -321
  214. package/.pi/skills/delivery/debugging-discipline/SKILL.md +36 -0
  215. package/.pi/skills/delivery/documentation-update/SKILL.md +33 -0
  216. package/.pi/skills/delivery/requirements-to-implementation/SKILL.md +34 -0
  217. package/.pi/skills/delivery/risk-based-verification/SKILL.md +43 -0
  218. package/.pi/skills/delivery/tradeoff-analysis/SKILL.md +34 -0
  219. package/.pi/skills/engineering/api-contract-design/SKILL.md +38 -0
  220. package/.pi/skills/engineering/cohesion-coupling/SKILL.md +43 -0
  221. package/.pi/skills/engineering/complexity-control/SKILL.md +31 -0
  222. package/.pi/skills/engineering/defensive-programming/SKILL.md +38 -0
  223. package/.pi/skills/engineering/dependency-management/SKILL.md +29 -0
  224. package/.pi/skills/engineering/domain-modeling/SKILL.md +32 -0
  225. package/.pi/skills/engineering/error-handling/SKILL.md +37 -0
  226. package/.pi/skills/engineering/legacy-code-seams/SKILL.md +35 -0
  227. package/.pi/skills/engineering/naming-and-intent/SKILL.md +29 -0
  228. package/.pi/skills/engineering/refactoring-safe-evolution/SKILL.md +35 -0
  229. package/.pi/skills/engineering/routine-function-design/SKILL.md +34 -0
  230. package/.pi/skills/engineering/small-change-discipline/SKILL.md +35 -0
  231. package/.pi/skills/lsp-navigation/SKILL.md +89 -0
  232. package/.pi/skills/quality/code-review-self-check/SKILL.md +35 -0
  233. package/.pi/skills/quality/privacy-data-handling/SKILL.md +26 -0
  234. package/.pi/skills/quality/security-review/SKILL.md +34 -0
  235. package/.pi/skills/quality/test-strategy/SKILL.md +33 -0
  236. package/.pi/skills/quality/testability-design/SKILL.md +33 -0
  237. package/.pi/skills/systems/concurrency-safety/SKILL.md +32 -0
  238. package/.pi/skills/systems/data-modeling-migrations/SKILL.md +31 -0
  239. package/.pi/skills/systems/observability-instrumentation/SKILL.md +32 -0
  240. package/.pi/skills/systems/performance-measurement/SKILL.md +35 -0
  241. package/.pi/skills/systems/reliability-design/SKILL.md +32 -0
  242. package/.sentrux/rules.toml +20 -4
  243. package/AGENTS.md +5 -0
  244. package/CHANGELOG.md +26 -0
  245. package/README.md +85 -58
  246. package/THIRD_PARTY_NOTICES.md +12 -21
  247. package/package.json +15 -7
  248. package/vendor/pi-subagents/src/agents.ts +45 -1
  249. package/vendor/pi-subagents/src/subagents.ts +866 -811
  250. package/vendor/pi-vcc/src/core/brief.ts +68 -99
  251. package/vendor/pi-vcc/src/core/settings.ts +2 -2
  252. package/.agents/skills/caveman/SKILL.md +0 -67
  253. package/.pi/agents/harness/meta-optimizer.md +0 -36
  254. package/.pi/agents/harness/planning/scout-graphify.md +0 -39
  255. package/.pi/agents/harness/planning/scout-semantic.md +0 -41
  256. package/.pi/agents/harness/planning/scout-structure.md +0 -37
  257. package/.pi/extensions/lib/ask-user/dialog.ts +0 -260
  258. package/.pi/extensions/lib/harness-subagent-auth.ts +0 -209
  259. package/.pi/extensions/lib/harness-subagent-policy.ts +0 -236
  260. package/.pi/extensions/pi-model-router-harness.ts +0 -42
  261. package/.pi/harness/evolution/meta-optimizer.mjs +0 -99
  262. package/.pi/harness/specs/router-tuning-proposal.schema.json +0 -114
  263. package/.pi/model-router.example.json +0 -36
  264. package/.pi/prompts/harness-critic.md +0 -10
  265. package/.pi/prompts/harness-eval.md +0 -10
  266. package/.pi/prompts/harness-router-tune.md +0 -52
  267. package/.pi/scripts/harness-generate-model-router.mjs +0 -327
  268. package/.pi/scripts/harness-model-router-routing.test.mjs +0 -97
  269. package/.pi/scripts/harness-sync-model-router.mjs +0 -97
  270. package/.pi/scripts/vendor-sync-pi-model-router.sh +0 -47
  271. package/vendor/pi-model-router/.prettierignore +0 -4
  272. package/vendor/pi-model-router/.prettierrc +0 -5
  273. package/vendor/pi-model-router/AGENTS.md +0 -39
  274. package/vendor/pi-model-router/LICENSE +0 -21
  275. package/vendor/pi-model-router/README.md +0 -99
  276. package/vendor/pi-model-router/UPSTREAM_PIN.md +0 -10
  277. package/vendor/pi-model-router/docs/ARCHITECTURE.md +0 -54
  278. package/vendor/pi-model-router/extensions/commands.ts +0 -720
  279. package/vendor/pi-model-router/extensions/config.ts +0 -348
  280. package/vendor/pi-model-router/extensions/constants.ts +0 -1
  281. package/vendor/pi-model-router/extensions/index.ts +0 -478
  282. package/vendor/pi-model-router/extensions/provider.ts +0 -580
  283. package/vendor/pi-model-router/extensions/routing.ts +0 -564
  284. package/vendor/pi-model-router/extensions/state.ts +0 -52
  285. package/vendor/pi-model-router/extensions/types.ts +0 -95
  286. package/vendor/pi-model-router/extensions/ui.ts +0 -144
  287. package/vendor/pi-model-router/model-router.example.json +0 -48
  288. package/vendor/pi-model-router/package.json +0 -48
  289. package/vendor/pi-model-router/tsconfig.json +0 -16
  290. /package/.pi/{prompts → harness/docs}/planning-rubrics.md +0 -0
  291. /package/.pi/{extensions/lib → lib}/ask-user/fallback.ts +0 -0
  292. /package/.pi/{extensions/lib → lib}/ask-user/render.ts +0 -0
  293. /package/.pi/{extensions/lib → lib}/ask-user/schema.ts +0 -0
  294. /package/.pi/{extensions/lib → lib}/ask-user/types.ts +0 -0
  295. /package/.pi/{extensions/lib → lib}/ask-user/validate-core.mjs +0 -0
  296. /package/.pi/{extensions/lib → lib}/ask-user/validate.ts +0 -0
  297. /package/.pi/{extensions/lib → lib}/harness-cocoindex-refresh.ts +0 -0
  298. /package/.pi/{extensions/lib → lib}/harness-paths.ts +0 -0
  299. /package/.pi/{extensions/lib → lib}/harness-spawn-budget.ts +0 -0
  300. /package/.pi/{extensions/lib → lib}/harness-vcc-settings.ts +0 -0
  301. /package/.pi/{extensions/lib → lib}/harness-web/run-cli.ts +0 -0
  302. /package/.pi/{extensions/lib → lib}/plan-approval/dialog.ts +0 -0
  303. /package/.pi/{extensions/lib → lib}/plan-approval/schema.ts +0 -0
  304. /package/.pi/{extensions/lib → lib}/plan-debate-eligibility.ts +0 -0
  305. /package/.pi/{extensions/lib → lib}/plan-debate-focus.ts +0 -0
  306. /package/.pi/{extensions/lib → lib}/plan-debate-id.ts +0 -0
  307. /package/.pi/{extensions/lib → lib}/plan-debate-lanes.ts +0 -0
  308. /package/.pi/{extensions/lib → lib}/plan-debate-round-status.ts +0 -0
  309. /package/.pi/{extensions/lib → lib}/plan-debate-write-guard.ts +0 -0
  310. /package/.pi/{extensions/lib → lib}/plan-review-gate.ts +0 -0
  311. /package/.pi/{extensions/lib → lib}/plan-review-integrator-rules.ts +0 -0
  312. /package/.pi/{extensions/lib → lib}/plan-scope-guard.ts +0 -0
  313. /package/.pi/{extensions/lib → lib}/posthog-client.ts +0 -0
  314. /package/.pi/{extensions/lib → lib}/posthog-node.d.ts +0 -0
@@ -0,0 +1,33 @@
1
+ # ADR 0045: Phase-scoped harness agent directories
2
+
3
+ Status: Accepted
4
+ Date: 2026-05-24
5
+
6
+ ## Context
7
+
8
+ Harness prompts had accumulated mixed agent ids such as `harness/executor`, `harness/evaluator`, and legacy planning `scout-*` agents. The current orchestration model is phase-scoped:
9
+
10
+ - planning context is parent-led or handled by `harness/planning/planning-context`
11
+ - execution is a single running agent
12
+ - post-run review is handled by reviewing agents
13
+
14
+ Flat run/review agent ids made prompt intent less obvious and left legacy planning scout agents discoverable even after ADR 0041 moved reconnaissance to parent tool use plus `planning-context.yaml`.
15
+
16
+ ## Decision
17
+
18
+ Use phase-scoped agent directories and ids for run/review orchestration:
19
+
20
+ - `.pi/agents/harness/running/executor.md` → `harness/running/executor`
21
+ - `.pi/agents/harness/reviewing/evaluator.md` → `harness/reviewing/evaluator`
22
+ - `.pi/agents/harness/reviewing/adversary.md` → `harness/reviewing/adversary`
23
+ - `.pi/agents/harness/reviewing/tie-breaker.md` → `harness/reviewing/tie-breaker`
24
+
25
+ Remove the legacy planning `scout-graphify`, `scout-structure`, and `scout-semantic` agents. Planning reconnaissance is represented by `artifacts/planning-context.yaml` only.
26
+
27
+ ## Consequences
28
+
29
+ - `/harness-run` must spawn only `harness/running/executor`.
30
+ - `/harness-review` must spawn only agents under `harness/reviewing/`.
31
+ - Submit-tool allowlists, precheck/topology policy, review-integrity policy, tests, and `agents.manifest.json` track the new ids.
32
+ - When post-run review records `next_recommended_command: "/harness-plan (mode: revise)"`, review-integrity treats `harness/planning/*` subagents as a phase handoff, not a review-isolation violation.
33
+ - Old scout YAML artifacts no longer satisfy plan approval readiness; `artifacts/planning-context.yaml` is required unless explicitly waived.
@@ -0,0 +1,51 @@
1
+ # ADR 0046: AGT policy engine and subagent identity
2
+
3
+ - **Status:** Accepted
4
+ - **Date:** 2026-05-24
5
+ - **Deciders:** ultimate-pi harness team
6
+
7
+ ## Context
8
+
9
+ Harness tool-call governance was split across `policy-gate.ts`, `harness-run-context.ts` (`guardToolCall`), `harness-subagent-policy.ts`, and subprocess-only `harness-subagent-submit.ts`. Subagents spawn with `--no-extensions -e <single-bundle>` and did not load parent `policy-gate.ts`, creating a governance bypass. We need a single declarative engine, npm-shipped policies, subprocess parity, and tamper-evident audit without MCP gateways.
10
+
11
+ ## Decision
12
+
13
+ 1. Adopt `@microsoft/agent-governance-sdk` (pinned in root `package.json`, Public Preview) as the **PolicyEngine** for allow/deny on every `tool_call` when AGT is enabled.
14
+ 2. Store policies under `.pi/harness/policies/*.yaml` and ship them via npm `files[]`.
15
+ 3. Implement `.pi/lib/agt/` for policy loading, evaluation-context precomputation (async FS/plan-scope logic stays in harness helpers), per-run identity/delegation/trust/audit.
16
+ 4. Rewrite `policy-gate.ts` `tool_call` to delegate to AGT when `HARNESS_AGT_POLICY` is not `0`/`false` (default **on**).
17
+ 5. Replace subprocess extension path with `harness-subagent-governance.ts` (AGT + submit tools in one bundle).
18
+ 6. Mint parent/subagent identities at spawn; persist under `.pi/harness/runs/<run_id>/agents/<agent_id>/` (gitignored).
19
+ 7. Fail closed: policy load errors and evaluation throws → deny.
20
+
21
+ Migration: `HARNESS_AGT_POLICY=0` restores legacy TS paths for one release window; parity tests (`test/harness-agt-policy-parity.test.mjs`) must show zero mismatches before deleting legacy branches.
22
+
23
+ ## Consequences
24
+
25
+ ### Positive
26
+
27
+ - One enforcement engine and audit trail (`agt-audit.jsonl` per run).
28
+ - Subprocess agents governed identically to parent orchestrator.
29
+ - Policies versioned in-repo and lintable (`agt lint-policy` optional in CI).
30
+
31
+ ### Negative / trade-offs
32
+
33
+ - Public Preview SDK may break; pinned version + golden matrix required on upgrade.
34
+ - Dual path during flag window increases maintenance until legacy removal.
35
+ - Identity material on disk requires run-dir hygiene (already gitignored).
36
+
37
+ ## Test contract surface
38
+
39
+ - `test/harness-agt-policy-matrix.test.mjs`
40
+ - `test/harness-agt-policy-parity.test.mjs`
41
+ - `test/harness-agt-policy-load.test.mjs`
42
+ - `test/harness-agt-packaging.test.mjs`
43
+ - `test/harness-tool-call-hook-chain.test.mjs`
44
+ - Extended `node .pi/scripts/harness-verify.mjs` AGT doctor
45
+
46
+ ## References
47
+
48
+ - [Microsoft Agent Governance Toolkit](https://github.com/microsoft/agent-governance-toolkit)
49
+ - [ADR 0001](0001-harness-constitution.md)
50
+ - [ADR 0037](0037-subagent-submit-tools.md)
51
+ - Plan: AGT policy-gate rewrite (2026-05)
@@ -0,0 +1,39 @@
1
+ # ADR 0047: AGT layered security (rings, prompt defense, workflow, CI)
2
+
3
+ - **Status:** Accepted
4
+ - **Date:** 2026-05-24
5
+ - **Deciders:** ultimate-pi harness team
6
+
7
+ ## Context
8
+
9
+ ADR 0046 covers PolicyEngine rewrite and subprocess identity. AGT also provides execution rings, kill switch, PromptDefense heuristics, workflow sequence rules, SRE circuit breakers, ShadowDiscovery, and GovernanceVerifier — complementary to Sentrux (architecture) and harness eval/review gates (outcomes).
10
+
11
+ ## Decision
12
+
13
+ 1. **Execution rings:** Map harness agent kinds to AGT `ExecutionRing` in `.pi/lib/agt/rings.ts`; enforce on spawn via `RingEnforcer` (planner/evaluator = inner, executor = middle, adversary = restricted).
14
+ 2. **Kill switch:** `.pi/extensions/agt-kill-switch.ts` arms on `/harness-abort` and repeated policy denies; blocks new spawns and tool calls until reset.
15
+ 3. **Prompt defense:** `.pi/extensions/agt-prompt-guard.ts` runs `PromptDefenseEvaluator` on `before_agent_start` for slash commands and subprocess task snippets (heuristic, no LLM).
16
+ 4. **Workflow rules:** `.pi/harness/policies/workflow-sequences.yaml` + `.pi/lib/agt/workflow-history.ts` read observation-bus flags for multi-step gates (mitigate per-action-only policy gap).
17
+ 5. **SRE hooks:** `.pi/lib/agt/sre-hooks.ts` ties `CircuitBreaker` to `harness-spawn-budget` counters (telemetry + optional hard stop when `HARNESS_AGT_SRE_ENFORCE=1`).
18
+ 6. **CI attestation:** `harness-verify.mjs` runs policy doctor, golden matrix, optional `agt lint-policy`; promotion may attach `agt-evidence.json` when `HARNESS_AGT_STRICT=1` (see ADR 0003 amendment note in harness README).
19
+
20
+ AGT does **not** replace Sentrux, review-integrity, budget-guard telemetry default, or `/harness-review` eval/adversary.
21
+
22
+ ## Consequences
23
+
24
+ ### Positive
25
+
26
+ - Defense-in-depth aligned with OWASP Agentic Top 10 mapping (documented in harness README).
27
+ - Deterministic CI (no LLM) for policy, prompt scan, and verify steps.
28
+
29
+ ### Negative / trade-offs
30
+
31
+ - Kill switch does not terminate already-running subprocesses (documented limitation).
32
+ - Workflow history depends on observation-bus completeness.
33
+
34
+ ## References
35
+
36
+ - [ADR 0046](0046-agt-policy-engine.md)
37
+ - [ADR 0003](0003-eval-promotion-gates.md)
38
+ - [ADR 0038](0038-budget-telemetry-only.md)
39
+ - AGT THREAT_MODEL and LIMITATIONS docs
@@ -0,0 +1,25 @@
1
+ # ADR 0048: tool_call hook interaction matrix
2
+
3
+ - **Status:** Accepted
4
+ - **Date:** 2026-05-24
5
+ - **Deciders:** ultimate-pi harness team
6
+
7
+ ## Context
8
+
9
+ Multiple Pi extensions register `tool_call` hooks: `policy-gate` (AGT), `harness-run-context` (coercion + legacy guards), `review-integrity`, `budget-guard`, `test-diff-integrity`, `harness-web-guard`, `harness-lens`, subprocess `harness-subagent-governance`, and `agt-kill-switch`. Block-first semantics must not be overridden by later hooks.
10
+
11
+ ## Decision
12
+
13
+ 1. **Primary deny:** `policy-gate` / subprocess `harness-subagent-governance` via AGT `PolicyEngine` (deny-overrides).
14
+ 2. **Secondary deny:** `agt-kill-switch` when session armed after abort or repeated denies.
15
+ 3. **Role separation:** `review-integrity` blocks executor tools during review phases (orthogonal to AGT).
16
+ 4. **Telemetry-only default:** `budget-guard` does not block (ADR 0038).
17
+ 5. **Coercion (not security):** `harness-run-context` scoped YAML coercion remains when AGT enabled; policy denies moved to YAML.
18
+ 6. **Subprocess:** Only `harness-subagent-governance.ts` is loaded (`-e` bundle); parent `policy-gate` does not run in child.
19
+
20
+ Pi invokes hooks in extension load order; any hook returning `{ block: true }` stops the tool. Tests in `test/harness-tool-call-hook-chain.test.mjs` document paths.
21
+
22
+ ## References
23
+
24
+ - [ADR 0046](0046-agt-policy-engine.md)
25
+ - [ADR 0038](0038-budget-telemetry-only.md)
@@ -0,0 +1,36 @@
1
+ # ADR 0049: agents.policy.yaml and native AGT integration
2
+
3
+ - **Status:** Accepted
4
+ - **Date:** 2026-05-24
5
+ - **Deciders:** ultimate-pi harness team
6
+
7
+ ## Context
8
+
9
+ Per-agent tool policy was split across agent `.md` frontmatter, [`harness-subagent-policy.ts`](../../../extensions/lib/harness-subagent-policy.ts), submit registry allowlists, and AGT precompute (`subagent_policy_block`). End users need custom agents under `.pi/agents/` and custom AGT rules under `.pi/policies/` without maintaining three copies. [`agents.manifest.json`](../agents.manifest.json) already pins package agent `.md` integrity (sha256); it must remain separate from runtime tool policy.
10
+
11
+ ## Decision
12
+
13
+ 1. **`agents.policy.yaml` SSOT** — package [`.pi/harness/agents.policy.yaml`](../agents.policy.yaml); project `.pi/agents.policy.yaml`. Defines `kinds` and per-agent `tools` / spawn fields. No `tools` / `disallowed_tools` in harness agent frontmatter.
14
+ 2. **Native discovery** — vendored [`parseMarkdownAgent`](../../../../vendor/pi-subagents/src/agents.ts) applies policy via [`.pi/lib/agents-policy`](../../../lib/agents-policy.ts) (same loader as AGT and verify).
15
+ 3. **AGT** — `createAgtPolicyEngine({ packageRoot, projectRoot })` loads package `.pi/harness/policies/` then project `.pi/policies/`. `tool_allowed` comes only from agents-policy; remove `subagent_policy_block` / delete `harness-subagent-policy.ts`.
16
+ 4. **Subprocess scope** — `subprocessGovernanceExtensionPath` loads governance for **all** subagents when `isAgtGovernanceActive(projectRoot)`; parent `policy-gate` AGT only during harness sessions (`isHarnessProjectEnabled()` + harness flow).
17
+ 5. **Submit registry** — implementation only (schema + artifact paths); allowlists live in `agents.policy.yaml`.
18
+ 6. **Verify** — extend [`harness-agents-manifest.mjs`](../../../scripts/harness-agents-manifest.mjs) for policy↔manifest alignment.
19
+
20
+ ## Consequences
21
+
22
+ ### Positive
23
+
24
+ - One edit surface per agent capability; project extensions without forking harness.
25
+ - Integrity manifest unchanged; supply-chain and policy concerns separated.
26
+
27
+ ### Negative / trade-offs
28
+
29
+ - Vendored pi-subagents delta must be preserved on `npm run vendor:sync-subagents`.
30
+ - Agents without policy entry fail closed in subprocess (doctor requires entries for spawnable project agents).
31
+
32
+ ## References
33
+
34
+ - [ADR 0046](0046-agt-policy-engine.md)
35
+ - [ADR 0048](0048-tool-call-hook-order.md)
36
+ - [ADR 0037](0037-subagent-submit-tools.md)
@@ -26,10 +26,16 @@ Team-shared ADRs for the ultimate-pi harness live under `.pi/harness/docs/adrs/`
26
26
  | [0038](0038-budget-telemetry-only.md) | Budget caps telemetry-only by default | Accepted |
27
27
  | [0039](0039-harness-post-run-review-gate.md) | `/harness-review` master post-run gate | Accepted |
28
28
  | [0040](0040-practice-grounded-orchestration.md) | Practice-grounded orchestration & team topology | Accepted |
29
+ | [0045](0045-harness-lens-minimal-contract.md) | Harness-lens minimal contract (edit safety, LSP, deferred format) | Accepted |
29
30
  | [0041](0041-intelligent-planning-reconnaissance.md) | Intelligent planning reconnaissance (tools over tool-scouts) | Accepted |
30
31
  | [0042](0042-agent-native-orchestration.md) | Agent-native orchestration (lakes, plan-verify probes, synthesizer) | Accepted |
31
32
  | [0043](0043-path-first-harness-tools.md) | Path-first harness tool contracts | Accepted |
32
33
  | [0044](0044-harness-steer-loop.md) | Post-run steer loop (repair vs plan revise) | Accepted |
34
+ | [0045](0045-phase-scoped-agent-directories.md) | Phase-scoped harness agent directories | Accepted |
35
+ | [0046](0046-agt-policy-engine.md) | AGT policy engine + subagent identity | Accepted |
36
+ | [0047](0047-agt-layered-security.md) | AGT layered security (rings, prompt defense, CI) | Accepted |
37
+ | [0048](0048-tool-call-hook-order.md) | tool_call hook interaction matrix | Accepted |
38
+ | [0049](0049-agents-policy-manifest.md) | agents.policy.yaml SSOT + native discovery | Accepted |
33
39
 
34
40
  ## Practice map
35
41
 
@@ -6,7 +6,8 @@
6
6
 
7
7
  The approved operating model is **hybrid allowlist auto-promotion with conservative staging**:
8
8
 
9
- - Daily local automation may auto-promote only explicitly approved allowlisted public sources with complete provenance and rights/access metadata.
9
+ - Daily local automation may auto-promote only explicitly approved allowlisted public sources (`article`, `repo`, or `release`) with complete provenance and rights/access metadata.
10
+ - Repository and release candidates are metadata-specific source classes; they do not inherit generic article behavior and must be authorized by `allowed_source_classes` on the allowlist entry.
10
11
  - Books, transcripts, YouTube/video material, paid/copyrighted/mirrored material, unclear-license content, and unknown open-web sources remain staged until manually approved.
11
12
  - Competitor monitoring is a curated taxonomy/watchlist/reporting signal, not an exhaustive crawler.
12
13
  - Pi-agent-open integration is intentionally limited/deferred: opening Pi should do at most a low-latency, no-network stale check. It must not perform synchronous web discovery, promotion, or Graphify mutation.
@@ -24,9 +25,11 @@ Allowlist auto-promotion requires all of the following:
24
25
 
25
26
  1. `.pi/harness/corpus/graphify-kb-updater.config.json` has `auto_promote_allowlist: true`.
26
27
  2. The candidate domain is present in `allowlist` with `approved: true`.
27
- 3. The candidate itself has `approved: true`.
28
- 4. `rights_access` is complete.
29
- 5. The candidate is not a risky source class that requires manual review.
28
+ 3. If the allowlist entry has `allowed_source_classes`, it includes the candidate `kind` (`article`, `repo`, or `release`).
29
+ 4. The candidate itself has `approved: true`.
30
+ 5. `provenance.origin` and `provenance.locator` are complete.
31
+ 6. `rights_access` is complete.
32
+ 7. The candidate is not a risky source class that requires manual review.
30
33
 
31
34
  Risky source classes (`book`, `transcript`, `youtube`) always require explicit approval and complete rights/access metadata. Raw HTTP shell paths are forbidden; keep discovery/fetch through approved harness web/API abstractions and verify with `.pi/scripts/harness-web-policy-guard.mjs`.
32
35
 
@@ -66,12 +69,13 @@ node .pi/scripts/harness-web-policy-guard.mjs
66
69
 
67
70
  1. Review dry-run JSON: candidate count, source counts, competitor labels, duplicate/skipped/blocked counts, stale warnings, planned promotions, and graph action.
68
71
  2. For a candidate, add it to `.pi/harness/corpus/graphify-kb-updater.config.json` `review_queue` with:
69
- - `kind` (`article`, `paper`, `book`, `transcript`, or `youtube`)
72
+ - `kind` (`article`, `repo`, `release`, `paper`, `book`, `transcript`, or `youtube`)
70
73
  - `title`
71
74
  - `url` or `path`
72
75
  - `approved: true`
73
76
  - `rights_access` object with all required fields
74
77
  - optional `competitor_labels` or provenance notes.
78
+ - for repo/release auto-promotion, an allowlist entry whose `allowed_source_classes` includes `repo` or `release`.
75
79
  3. For local files, you may place `<file>.rights.json` beside the source, but risky classes still require explicit approval before promotion.
76
80
  4. Run `--apply --refresh-graph`.
77
81
  5. Promoted sources land under `raw/graphify-kb-updates/<kind>/` with `.provenance.json` sidecars.
@@ -108,6 +112,7 @@ Each run reports:
108
112
  - `last_run_at`
109
113
  - `candidate_count`, `promoted_count`, `blocked_count`, `skipped_count`, `duplicate_skips`, `failure_count`
110
114
  - `counts.by_kind`, `counts.by_source_type`, `counts.by_competitor_label`, `counts.allowlisted`
115
+ - `staged_count`, `review_queue_count`, and `review_queue` items with reason codes and next actions
111
116
  - `stale_warnings`
112
117
  - `changed_existing_count` for same URL/path content changes
113
118
  - `graph.action`, `graph.exit_status`, and Graphify report path when refreshed
@@ -117,6 +122,7 @@ Review these fields before enabling unattended mode and after every config chang
117
122
 
118
123
  ## Troubleshooting
119
124
 
125
+ - `missing_complete_provenance`: add `provenance.origin` and `provenance.locator`.
120
126
  - `missing_rights_access_approval`: add complete rights/access metadata.
121
127
  - `manual_approval_required`: set `approved: true` after source and rights review.
122
128
  - `duplicate_unchanged`: candidate was already promoted and content hash is unchanged.
@@ -70,7 +70,7 @@ See also: [ADRs](adrs/README.md), [ADR 0040](adrs/0040-practice-grounded-orchest
70
70
  |------|----------|-------------------|-------|
71
71
  | Gate | Change control | `plan_ready` required | Parent |
72
72
  | Pre-work | Fitness baseline | `sentrux gate --save` | Parent |
73
- | Work | Single implementer | `executor_strategy` | `harness/executor` |
73
+ | Work | Single implementer | `executor_strategy` | `harness/running/executor` |
74
74
  | Post-work | Observation | `sentrux check` / signal artifact | Parent |
75
75
  | Handoff | Generator–evaluator | `submit_executor_handoff` | Executor |
76
76
  | Next | Always verify | **`/harness-review`** (not replan on blocked) | Parent routing |
@@ -95,7 +95,7 @@ See also: [ADRs](adrs/README.md), [ADR 0040](adrs/0040-practice-grounded-orchest
95
95
  |------|----------|-------|
96
96
  | 0 | Read review + repair briefs | Parent |
97
97
  | 1 | Policy phase → `execute` | Parent |
98
- | 2 | Repair scope | `harness/executor` `mode: repair` |
98
+ | 2 | Repair scope | `harness/running/executor` `mode: repair` |
99
99
  | 3 | Re-verify | `/harness-review` |
100
100
 
101
101
  ## Anti-patterns
@@ -1,11 +1,10 @@
1
1
  # Harness evolution (Phase 3)
2
2
 
3
- Self-healing and meta-optimization read **JSONL first** (`.pi/harness/runs/*/events.jsonl`), not PostHog.
3
+ Self-healing reads **JSONL first** (`.pi/harness/runs/*/events.jsonl`), not PostHog.
4
4
 
5
5
  ## Components
6
6
 
7
7
  - `self-healing-rules.json` — pattern → suggested remediation
8
- - `meta-optimizer.mjs` — scans run index, proposes router/tuning deltas; run `node "$UP_PKG/.pi/harness/evolution/meta-optimizer.mjs"` (see `.pi/scripts/README.md`).
9
8
  - `chaos-drill.md` — manual chaos / failure injection checklist
10
9
 
11
10
  PostHog `harness_*` events are for dashboards; JSONL is the optimization source of truth per ADR 0008.
@@ -0,0 +1,19 @@
1
+ # Example project override — copy to <project>/.pi/agents.policy.yaml
2
+ # Merges on top of package .pi/harness/agents.policy.yaml (same agent ids win on project keys).
3
+
4
+ apiVersion: harness.toolkit/v1
5
+
6
+ agents:
7
+ my-custom-scout:
8
+ kind: planner
9
+ tools_add:
10
+ - web_search
11
+ - web_fetch
12
+ extensions: false
13
+ max_turns: 12
14
+
15
+ my-custom-runner:
16
+ kind: executor
17
+ tools_add:
18
+ - submit_executor_handoff
19
+ extensions: true
@@ -0,0 +1,9 @@
1
+ # Example project AGT rule — copy to <project>/.pi/policies/custom-deny-bash.yaml
2
+ # Loaded after package .pi/harness/policies/*.yaml when createAgtPolicyEngine runs.
3
+
4
+ policies:
5
+ - name: deny-rm-rf-in-subagents
6
+ description: Block recursive rm -rf in subprocess tool calls
7
+ effect: deny
8
+ priority: 200
9
+ condition: is_subprocess == true && tool_name == "bash" && contains(tool_input.command, "rm -rf")
@@ -0,0 +1,5 @@
1
+ apiVersion: governance.toolkit/v1
2
+ name: harness-bash-denylists
3
+ description: Planning scout bash patterns (precomputed in context).
4
+ default_action: allow
5
+ rules: []
@@ -0,0 +1,51 @@
1
+ apiVersion: governance.toolkit/v1
2
+ name: harness-defaults
3
+ description: Fail-closed default; explicit allow when no harness blocks fire.
4
+ default_action: deny
5
+ rules:
6
+ - name: deny-abort-mutation
7
+ priority: 2000
8
+ ruleAction: deny
9
+ condition: abort_mutating_block == true
10
+ description: harness-abort lock blocks mutating tools
11
+ - name: deny-plan-mutation
12
+ priority: 1900
13
+ ruleAction: deny
14
+ condition: plan_mutation_block == true
15
+ - name: deny-context-mode
16
+ priority: 1800
17
+ ruleAction: deny
18
+ condition: context_mode_block == true
19
+ - name: deny-tool-not-in-manifest
20
+ priority: 1700
21
+ ruleAction: deny
22
+ condition: tool_allowed == false
23
+ description: tool not allowed by agents.policy.yaml for this agent
24
+ - name: deny-spawn-policy
25
+ priority: 1650
26
+ ruleAction: deny
27
+ condition: spawn_policy_block == true
28
+ - name: deny-mutating-bash-phase
29
+ priority: 1600
30
+ ruleAction: deny
31
+ condition: mutating_bash_phase_block == true
32
+ - name: deny-eval-plan-packet-write
33
+ priority: 1550
34
+ ruleAction: deny
35
+ condition: eval_plan_packet_write_block == true
36
+ - name: deny-bash-web-bypass
37
+ priority: 1500
38
+ ruleAction: deny
39
+ condition: bash_web_block == true
40
+ - name: deny-bash-planning-heavy
41
+ priority: 1450
42
+ ruleAction: deny
43
+ condition: bash_planning_deny == true
44
+ - name: deny-bash-planning-json-artifact
45
+ priority: 1440
46
+ ruleAction: deny
47
+ condition: bash_planning_json_block == true
48
+ - name: allow-no-blocks
49
+ priority: 100
50
+ ruleAction: allow
51
+ condition: abort_mutating_block == false and plan_mutation_block == false and context_mode_block == false and tool_allowed == true and spawn_policy_block == false and mutating_bash_phase_block == false and eval_plan_packet_write_block == false and bash_web_block == false and bash_planning_deny == false and bash_planning_json_block == false
@@ -0,0 +1,18 @@
1
+ apiVersion: governance.toolkit/v1
2
+ name: harness-orchestrator
3
+ description: Parent orchestrator submit_* and plan tools.
4
+ default_action: allow
5
+ rules:
6
+ - name: deny-parent-submit
7
+ priority: 2100
8
+ ruleAction: deny
9
+ condition: is_parent_orchestrator == true and is_submit_tool == true
10
+ description: submit_* is subprocess-only
11
+ - name: deny-subprocess-create-plan
12
+ priority: 2050
13
+ ruleAction: deny
14
+ condition: is_subprocess == true and tool_name == 'create_plan'
15
+ - name: deny-subprocess-approve-plan
16
+ priority: 2050
17
+ ruleAction: deny
18
+ condition: is_subprocess == true and tool_name == 'approve_plan'
@@ -0,0 +1,10 @@
1
+ apiVersion: governance.toolkit/v1
2
+ name: harness-phases
3
+ description: Phase hints for workflow (enforced via precomputed flags in defaults).
4
+ default_action: allow
5
+ rules:
6
+ - name: phase-metadata-plan
7
+ priority: 1
8
+ ruleAction: log
9
+ condition: harness_phase == 'plan'
10
+ description: informational only
@@ -0,0 +1,5 @@
1
+ apiVersion: governance.toolkit/v1
2
+ name: harness-roles
3
+ description: Role matrix enforced via subagent_policy_block precompute.
4
+ default_action: allow
5
+ rules: []
@@ -0,0 +1,5 @@
1
+ apiVersion: governance.toolkit/v1
2
+ name: harness-web-guard
3
+ description: Web fetch bypass blocks (precomputed bash_web_block).
4
+ default_action: allow
5
+ rules: []
@@ -0,0 +1,9 @@
1
+ apiVersion: governance.toolkit/v1
2
+ name: harness-workflow-sequences
3
+ description: Multi-step workflow gates (observation-bus flags); extend as needed.
4
+ default_action: allow
5
+ rules:
6
+ - name: log-execute-phase
7
+ priority: 1
8
+ ruleAction: log
9
+ condition: harness_phase == 'execute'
@@ -16,9 +16,15 @@
16
16
  },
17
17
  {
18
18
  "name": "contracts",
19
- "paths": [".pi/harness/specs/*", ".pi/harness/docs/*"],
19
+ "paths": [
20
+ ".pi/harness/specs/*",
21
+ ".pi/harness/docs/*",
22
+ ".pi/harness/policies/*",
23
+ ".pi/harness/agents.policy.yaml",
24
+ ".pi/harness/examples/*"
25
+ ],
20
26
  "order": 1,
21
- "description": "Harness schemas, ADRs, and governance docs"
27
+ "description": "Harness schemas, ADRs, AGT policies, and agents.policy SSOT"
22
28
  },
23
29
  {
24
30
  "name": "runtime",
@@ -39,9 +45,15 @@
39
45
  },
40
46
  {
41
47
  "name": "tooling",
42
- "paths": [".pi/scripts/*", "test/*"],
48
+ "paths": [".pi/scripts/*"],
43
49
  "order": 4,
44
- "description": "Harness CLI scripts and tests"
50
+ "description": "Harness CLI scripts"
51
+ },
52
+ {
53
+ "name": "foundation",
54
+ "paths": [".pi/lib/*"],
55
+ "order": 5,
56
+ "description": "Shared harness/AGT libraries (imported by extensions and scripts)"
45
57
  }
46
58
  ],
47
59
  "boundaries": [
@@ -65,6 +77,16 @@
65
77
  "to": ".pi/extensions/*",
66
78
  "reason": "Contracts are data-only JSON schemas; extensions implement behavior"
67
79
  },
80
+ {
81
+ "from": ".pi/lib/*",
82
+ "to": ".pi/extensions/*",
83
+ "reason": "Foundation lib must not import extension modules"
84
+ },
85
+ {
86
+ "from": ".pi/harness/policies/*",
87
+ "to": ".pi/extensions/*",
88
+ "reason": "Declarative AGT YAML must not depend on extension implementation"
89
+ },
68
90
  {
69
91
  "from": ".pi/scripts/*",
70
92
  "to": ".agents/skills/*",
@@ -14,7 +14,7 @@
14
14
  "agent": {
15
15
  "type": "string",
16
16
  "minLength": 1,
17
- "description": "Target subagent id, e.g. harness/planning/scout-graphify"
17
+ "description": "Target subagent id, e.g. harness/running/executor"
18
18
  },
19
19
  "mode": {
20
20
  "type": "string",
@@ -37,7 +37,8 @@
37
37
  "drift-monitor",
38
38
  "sentrux",
39
39
  "evaluator",
40
- "harness-telemetry"
40
+ "harness-telemetry",
41
+ "agt-policy"
41
42
  ]
42
43
  },
43
44
  "kind": {
@@ -0,0 +1,70 @@
1
+ export function packageAgentsPolicyPath(packageRoot: string): string;
2
+ export function projectAgentsPolicyPath(projectRoot: string): string;
3
+ export function projectPoliciesDir(projectRoot: string): string;
4
+
5
+ export interface AgentPolicySpec {
6
+ kind: string;
7
+ effectiveTools: string[];
8
+ extensionsOff: boolean;
9
+ readOnly: boolean;
10
+ maxTurns?: number;
11
+ thinking?: string;
12
+ submitTool?: string;
13
+ }
14
+
15
+ export interface AllowsAgentToolInput {
16
+ packageRoot: string;
17
+ projectRoot: string;
18
+ agentId: string;
19
+ toolName: string;
20
+ toolInput?: Record<string, unknown>;
21
+ isSubprocess?: boolean;
22
+ isParentOrchestrator?: boolean;
23
+ }
24
+
25
+ export function loadAgentsPolicyMerged(
26
+ packageRoot: string,
27
+ projectRoot: string,
28
+ ): {
29
+ schemaVersion: string;
30
+ kinds: Map<string, unknown>;
31
+ agents: Map<string, unknown>;
32
+ defaults: unknown;
33
+ };
34
+
35
+ export function resolveEffectiveTools(
36
+ agentId: string,
37
+ merged: ReturnType<typeof loadAgentsPolicyMerged>,
38
+ ): AgentPolicySpec;
39
+
40
+ export function getAgentPolicySpec(
41
+ packageRoot: string,
42
+ projectRoot: string,
43
+ agentId: string,
44
+ ): AgentPolicySpec | null;
45
+
46
+ export function getAgentKind(
47
+ packageRoot: string,
48
+ projectRoot: string,
49
+ agentId: string,
50
+ ): string;
51
+
52
+ export function isHarnessPlanningAgent(agentId: string): boolean;
53
+
54
+ export function harnessSubagentPhaseHint(
55
+ packageRoot: string,
56
+ projectRoot: string,
57
+ agentId: string,
58
+ ): string | null;
59
+
60
+ export function allowsAgentTool(input: AllowsAgentToolInput): boolean;
61
+
62
+ export function applyAgentPolicyToConfig<T extends { name: string }>(
63
+ agent: T,
64
+ packageRoot: string,
65
+ projectRoot: string,
66
+ ): T;
67
+
68
+ export function findProjectRootFromAgentsDir(projectAgentsDir: string): string;
69
+
70
+ export function isAgtGovernanceActive(projectRoot: string): boolean;