ultimate-pi 0.18.1 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/.agents/skills/harness-debate-plan/SKILL.md +1 -1
  2. package/.agents/skills/harness-decisions/SKILL.md +1 -2
  3. package/.agents/skills/harness-governor/SKILL.md +6 -5
  4. package/.agents/skills/web-retrieval/SKILL.md +163 -0
  5. package/.agents/skills/wiki-autoresearch/SKILL.md +6 -6
  6. package/.pi/PACKAGING.md +4 -4
  7. package/.pi/SYSTEM.md +75 -123
  8. package/.pi/agents/harness/incident-recorder.md +0 -1
  9. package/.pi/agents/harness/planning/decompose.md +0 -2
  10. package/.pi/agents/harness/planning/execution-plan-author.md +0 -2
  11. package/.pi/agents/harness/planning/hypothesis-validator.md +0 -2
  12. package/.pi/agents/harness/planning/hypothesis.md +0 -2
  13. package/.pi/agents/harness/planning/implementation-researcher.md +1 -3
  14. package/.pi/agents/harness/planning/plan-adversary.md +0 -2
  15. package/.pi/agents/harness/planning/plan-evaluator.md +1 -3
  16. package/.pi/agents/harness/planning/planning-context.md +0 -2
  17. package/.pi/agents/harness/planning/review-integrator.md +0 -2
  18. package/.pi/agents/harness/planning/sprint-contract-auditor.md +0 -2
  19. package/.pi/agents/harness/planning/stack-researcher.md +5 -3
  20. package/.pi/agents/harness/reviewing/adversary.md +0 -2
  21. package/.pi/agents/harness/reviewing/evaluator.md +0 -2
  22. package/.pi/agents/harness/reviewing/tie-breaker.md +0 -2
  23. package/.pi/agents/harness/running/executor.md +0 -2
  24. package/.pi/agents/harness/sentrux-bootstrap.md +0 -1
  25. package/.pi/agents/harness/sentrux-steward.md +0 -2
  26. package/.pi/agents/harness/trace-librarian.md +0 -1
  27. package/.pi/agents/harness/web-retrieval/web-answerer.md +35 -0
  28. package/.pi/agents/harness/web-retrieval/web-criteria-verifier.md +28 -0
  29. package/.pi/agents/harness/web-retrieval/web-gap-analyzer.md +31 -0
  30. package/.pi/agents/harness/web-retrieval/web-query-expander-fast.md +34 -0
  31. package/.pi/agents/harness/web-retrieval/web-query-expander.md +60 -0
  32. package/.pi/agents/harness/web-retrieval/web-summarizer.md +18 -0
  33. package/.pi/extensions/agt-kill-switch.ts +57 -0
  34. package/.pi/extensions/agt-prompt-guard.ts +32 -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 +6 -6
  39. package/.pi/extensions/harness-ask-user.ts +7 -7
  40. package/.pi/extensions/harness-debate-tools.ts +26 -42
  41. package/.pi/extensions/harness-lens.ts +94 -0
  42. package/.pi/extensions/harness-plan-approval.ts +11 -11
  43. package/.pi/extensions/harness-run-context.ts +1070 -876
  44. package/.pi/extensions/harness-subagent-governance.ts +8 -0
  45. package/.pi/extensions/harness-subagent-submit.ts +34 -163
  46. package/.pi/extensions/harness-subagents.ts +3 -3
  47. package/.pi/extensions/harness-telemetry.ts +2 -2
  48. package/.pi/extensions/harness-web-guard.ts +2 -1
  49. package/.pi/extensions/harness-web-tools.ts +691 -53
  50. package/.pi/extensions/policy-gate.ts +25 -5
  51. package/.pi/extensions/sentrux-rules-sync.ts +1 -1
  52. package/.pi/extensions/subagent-governance.ts +92 -0
  53. package/.pi/extensions/trace-recorder.ts +1 -1
  54. package/.pi/extensions/{ultimate-pi-vcc.ts → vcc-compaction.ts} +1 -1
  55. package/.pi/harness/README.md +6 -2
  56. package/.pi/harness/agents.manifest.json +46 -25
  57. package/.pi/harness/agents.policy.yaml +309 -0
  58. package/.pi/harness/docs/adrs/0030-inhouse-vcc-compaction.md +1 -1
  59. package/.pi/harness/docs/adrs/0035-plan-phase-review-gate.md +1 -1
  60. package/.pi/harness/docs/adrs/0045-harness-lens-minimal-contract.md +49 -0
  61. package/.pi/harness/docs/adrs/0046-agt-policy-engine.md +51 -0
  62. package/.pi/harness/docs/adrs/0047-agt-layered-security.md +39 -0
  63. package/.pi/harness/docs/adrs/0048-tool-call-hook-order.md +25 -0
  64. package/.pi/harness/docs/adrs/0049-agents-policy-manifest.md +36 -0
  65. package/.pi/harness/docs/adrs/0050-agentic-web-retrieval-stack.md +46 -0
  66. package/.pi/harness/docs/adrs/README.md +5 -0
  67. package/.pi/harness/docs/harness-web-search.md +97 -0
  68. package/.pi/harness/env.harness.template +9 -1
  69. package/.pi/harness/evolution/README.md +1 -2
  70. package/.pi/harness/examples/agents.policy.project.yaml +19 -0
  71. package/.pi/harness/examples/policies/custom-deny-bash.yaml +9 -0
  72. package/.pi/harness/examples/web-heuristic-angles.project.yaml +22 -0
  73. package/.pi/harness/policies/bash-denylists.yaml +5 -0
  74. package/.pi/harness/policies/defaults.yaml +51 -0
  75. package/.pi/harness/policies/orchestrator.yaml +18 -0
  76. package/.pi/harness/policies/phases.yaml +10 -0
  77. package/.pi/harness/policies/roles.yaml +5 -0
  78. package/.pi/harness/policies/web-guard.yaml +5 -0
  79. package/.pi/harness/policies/workflow-sequences.yaml +9 -0
  80. package/.pi/harness/sentrux/architecture.manifest.json +26 -4
  81. package/.pi/harness/specs/observation.schema.json +2 -1
  82. package/.pi/harness/web-heuristic-angles.json +278 -0
  83. package/.pi/harness/web-heuristic-angles.yaml +182 -0
  84. package/.pi/lib/agents-policy.d.mts +70 -0
  85. package/.pi/lib/agents-policy.mjs +331 -0
  86. package/.pi/lib/agents-policy.ts +19 -0
  87. package/.pi/lib/agt/audit-run-sink.ts +52 -0
  88. package/.pi/lib/agt/build-evaluation-context.ts +285 -0
  89. package/.pi/lib/agt/config.ts +28 -0
  90. package/.pi/lib/agt/delegation.ts +69 -0
  91. package/.pi/lib/agt/evaluate-policy.ts +56 -0
  92. package/.pi/lib/agt/identity-registry.ts +41 -0
  93. package/.pi/lib/agt/index.ts +55 -0
  94. package/.pi/lib/agt/kill-switch-state.ts +11 -0
  95. package/.pi/lib/agt/legacy-evaluate.ts +101 -0
  96. package/.pi/lib/agt/policy-engine.ts +154 -0
  97. package/.pi/lib/agt/rings.ts +21 -0
  98. package/.pi/lib/agt/sre-hooks.ts +45 -0
  99. package/.pi/lib/agt/trust-run-store.ts +26 -0
  100. package/.pi/lib/agt/workflow-history.ts +29 -0
  101. package/.pi/lib/agt-governance-active.ts +14 -0
  102. package/.pi/lib/agt-tool-guard.ts +78 -0
  103. package/.pi/lib/ask-user/dialog.ts +314 -0
  104. package/.pi/{extensions/lib → lib}/debate-bus-core.ts +10 -10
  105. package/.pi/{extensions/lib → lib}/debate-bus-state.ts +1 -1
  106. package/.pi/{extensions/lib → lib}/extension-load-guard.ts +13 -2
  107. package/.pi/lib/harness-agt-tool-guard.ts +5 -0
  108. package/.pi/{extensions/lib → lib}/harness-artifact-gate.ts +1 -1
  109. package/.pi/lib/harness-debate-core-deps.ts +14 -0
  110. package/.pi/lib/harness-debate-workflow-deps.ts +43 -0
  111. package/.pi/lib/harness-lens/.gitattributes +1 -0
  112. package/.pi/lib/harness-lens/clients/edit-autopatch.ts +88 -0
  113. package/.pi/lib/harness-lens/clients/file-kinds.ts +380 -0
  114. package/.pi/lib/harness-lens/clients/file-time.ts +215 -0
  115. package/.pi/lib/harness-lens/clients/file-utils.ts +484 -0
  116. package/.pi/lib/harness-lens/clients/format-service.ts +276 -0
  117. package/.pi/lib/harness-lens/clients/formatters.ts +1000 -0
  118. package/.pi/lib/harness-lens/clients/git-guard.ts +31 -0
  119. package/.pi/lib/harness-lens/clients/indent-retarget.ts +90 -0
  120. package/.pi/lib/harness-lens/clients/installer/index.ts +2368 -0
  121. package/.pi/lib/harness-lens/clients/latency-logger.ts +80 -0
  122. package/.pi/lib/harness-lens/clients/lens-config.ts +43 -0
  123. package/.pi/lib/harness-lens/clients/lens-events.ts +164 -0
  124. package/.pi/lib/harness-lens/clients/lsp/aggregation.ts +91 -0
  125. package/.pi/lib/harness-lens/clients/lsp/client.ts +1466 -0
  126. package/.pi/lib/harness-lens/clients/lsp/config.ts +216 -0
  127. package/.pi/lib/harness-lens/clients/lsp/edits.ts +297 -0
  128. package/.pi/lib/harness-lens/clients/lsp/index.ts +1355 -0
  129. package/.pi/lib/harness-lens/clients/lsp/interactive-install.ts +424 -0
  130. package/.pi/lib/harness-lens/clients/lsp/language.ts +223 -0
  131. package/.pi/lib/harness-lens/clients/lsp/launch.ts +939 -0
  132. package/.pi/lib/harness-lens/clients/lsp/lsp-index.ts +11 -0
  133. package/.pi/lib/harness-lens/clients/lsp/path-utils.ts +12 -0
  134. package/.pi/lib/harness-lens/clients/lsp/server-strategies.ts +81 -0
  135. package/.pi/lib/harness-lens/clients/lsp/server.ts +1971 -0
  136. package/.pi/lib/harness-lens/clients/path-utils.ts +182 -0
  137. package/.pi/lib/harness-lens/clients/pipeline.ts +360 -0
  138. package/.pi/lib/harness-lens/clients/project-profile.ts +117 -0
  139. package/.pi/lib/harness-lens/clients/runtime-agent-end.ts +112 -0
  140. package/.pi/lib/harness-lens/clients/runtime-config.ts +33 -0
  141. package/.pi/lib/harness-lens/clients/runtime-coordinator.ts +186 -0
  142. package/.pi/lib/harness-lens/clients/runtime-tool-result.ts +171 -0
  143. package/.pi/lib/harness-lens/clients/safe-spawn.ts +339 -0
  144. package/.pi/lib/harness-lens/clients/secrets-scanner.ts +214 -0
  145. package/.pi/lib/harness-lens/clients/tool-policy.ts +2072 -0
  146. package/.pi/lib/harness-lens/clients/types.ts +59 -0
  147. package/.pi/lib/harness-lens/clients/widget-state.ts +283 -0
  148. package/.pi/lib/harness-lens/index.ts +532 -0
  149. package/.pi/lib/harness-lens/tools/lsp-diagnostics.ts +706 -0
  150. package/.pi/lib/harness-lens/tools/lsp-navigation.ts +1246 -0
  151. package/.pi/{extensions/lib → lib}/harness-posthog.ts +3 -0
  152. package/.pi/lib/harness-run-context-responses.ts +9 -0
  153. package/.pi/lib/harness-run-context.ts +0 -2
  154. package/.pi/{extensions/lib/spawn-policy.ts → lib/harness-spawn-policy.ts} +1 -0
  155. package/.pi/{extensions/lib → lib}/harness-spawn-topology.ts +1 -1
  156. package/.pi/lib/harness-subagent-auth.ts +81 -0
  157. package/.pi/{extensions/lib → lib}/harness-subagent-precheck.ts +10 -7
  158. package/.pi/{extensions/lib → lib}/harness-subagent-submit-pipeline.ts +3 -3
  159. package/.pi/lib/harness-subagent-submit-register.ts +163 -0
  160. package/.pi/{extensions/lib → lib}/harness-subagent-submit-registry.ts +1 -37
  161. package/.pi/{extensions/lib → lib}/harness-subagents-bridge.ts +74 -14
  162. package/.pi/{extensions/lib → lib}/harness-subprocess-bootstrap.ts +1 -1
  163. package/.pi/lib/harness-web/artifacts.ts +200 -0
  164. package/.pi/lib/harness-web/cache.ts +369 -0
  165. package/.pi/{extensions/lib → lib}/harness-web/run-cli.ts +42 -2
  166. package/.pi/{extensions/lib → lib}/plan-approval/create-plan.ts +2 -2
  167. package/.pi/{extensions/lib → lib}/plan-approval/format-plan.ts +2 -2
  168. package/.pi/{extensions/lib → lib}/plan-approval/plan-review.ts +162 -201
  169. package/.pi/{extensions/lib → lib}/plan-approval/render.ts +1 -1
  170. package/.pi/{extensions/lib → lib}/plan-approval/resolve-disk.ts +2 -2
  171. package/.pi/{extensions/lib → lib}/plan-approval/types.ts +1 -1
  172. package/.pi/{extensions/lib → lib}/plan-approval/validate.ts +3 -3
  173. package/.pi/{extensions/lib → lib}/plan-debate-envelope.ts +1 -1
  174. package/.pi/{extensions/lib → lib}/plan-debate-gate.ts +1 -1
  175. package/.pi/{extensions/lib → lib}/plan-debate-lane.ts +1 -4
  176. package/.pi/{extensions/lib → lib}/plan-messenger.ts +1 -1
  177. package/.pi/prompts/harness-plan.md +2 -1
  178. package/.pi/prompts/harness-setup.md +40 -65
  179. package/.pi/scripts/README.md +2 -5
  180. package/.pi/scripts/gen-web-heuristic-angles-json.mjs +24 -0
  181. package/.pi/scripts/generate-agents-policy-yaml.mjs +148 -0
  182. package/.pi/scripts/harness-agents-manifest.mjs +60 -3
  183. package/.pi/scripts/harness-agt-doctor.ts +36 -0
  184. package/.pi/scripts/harness-cli-verify.sh +14 -2
  185. package/.pi/scripts/harness-verify.mjs +191 -39
  186. package/.pi/scripts/harness-web-policy-guard.mjs +3 -3
  187. package/.pi/scripts/harness-web.py +218 -15
  188. package/.pi/scripts/harness_web/deep_search.py +55 -0
  189. package/.pi/scripts/harness_web/evidence_bundle.py +47 -0
  190. package/.pi/scripts/harness_web/find_similar.py +88 -0
  191. package/.pi/scripts/harness_web/heuristic_angles_shipped.py +85 -0
  192. package/.pi/scripts/harness_web/heuristic_config.py +251 -0
  193. package/.pi/scripts/harness_web/highlights.py +47 -0
  194. package/.pi/scripts/harness_web/multi_search.py +59 -0
  195. package/.pi/scripts/harness_web/output.py +24 -0
  196. package/.pi/scripts/harness_web/query_angles.py +116 -0
  197. package/.pi/scripts/harness_web/rank.py +163 -0
  198. package/.pi/scripts/harness_web/scrape.py +30 -0
  199. package/.pi/scripts/tests/test_harness_web_heuristic_config.py +132 -0
  200. package/.pi/scripts/tests/test_harness_web_query_angles.py +45 -0
  201. package/.pi/scripts/tests/test_harness_web_rank.py +56 -0
  202. package/.pi/scripts/validate-plan-dag.mjs +65 -74
  203. package/.pi/scripts/vendor-pi-vcc-settings.stub.ts +2 -2
  204. package/.pi/scripts/vendor-sync-pi-vcc.sh +1 -1
  205. package/.pi/skills/architecture/broker-domain/SKILL.md +65 -0
  206. package/.pi/skills/architecture/cqrs/SKILL.md +63 -0
  207. package/.pi/skills/architecture/event-driven/SKILL.md +60 -0
  208. package/.pi/skills/architecture/hexagonal-ports-adapters/SKILL.md +66 -0
  209. package/.pi/skills/architecture/layered/SKILL.md +68 -0
  210. package/.pi/skills/architecture/microkernel/SKILL.md +62 -0
  211. package/.pi/skills/architecture/microservices/SKILL.md +64 -0
  212. package/.pi/skills/architecture/modular-monolith/SKILL.md +65 -0
  213. package/.pi/skills/architecture/orchestration-driven-soa/SKILL.md +61 -0
  214. package/.pi/skills/architecture/pipeline/SKILL.md +63 -0
  215. package/.pi/skills/architecture/service-based/SKILL.md +64 -0
  216. package/.pi/skills/architecture/service-mesh/SKILL.md +60 -0
  217. package/.pi/skills/architecture/space-based/SKILL.md +60 -0
  218. package/.pi/skills/ast-grep/SKILL.md +40 -321
  219. package/.pi/skills/delivery/debugging-discipline/SKILL.md +36 -0
  220. package/.pi/skills/delivery/documentation-update/SKILL.md +33 -0
  221. package/.pi/skills/delivery/requirements-to-implementation/SKILL.md +34 -0
  222. package/.pi/skills/delivery/risk-based-verification/SKILL.md +43 -0
  223. package/.pi/skills/delivery/tradeoff-analysis/SKILL.md +34 -0
  224. package/.pi/skills/engineering/api-contract-design/SKILL.md +38 -0
  225. package/.pi/skills/engineering/cohesion-coupling/SKILL.md +43 -0
  226. package/.pi/skills/engineering/complexity-control/SKILL.md +31 -0
  227. package/.pi/skills/engineering/defensive-programming/SKILL.md +38 -0
  228. package/.pi/skills/engineering/dependency-management/SKILL.md +29 -0
  229. package/.pi/skills/engineering/domain-modeling/SKILL.md +32 -0
  230. package/.pi/skills/engineering/error-handling/SKILL.md +37 -0
  231. package/.pi/skills/engineering/legacy-code-seams/SKILL.md +35 -0
  232. package/.pi/skills/engineering/naming-and-intent/SKILL.md +29 -0
  233. package/.pi/skills/engineering/refactoring-safe-evolution/SKILL.md +35 -0
  234. package/.pi/skills/engineering/routine-function-design/SKILL.md +34 -0
  235. package/.pi/skills/engineering/small-change-discipline/SKILL.md +35 -0
  236. package/.pi/skills/lsp-navigation/SKILL.md +89 -0
  237. package/.pi/skills/quality/code-review-self-check/SKILL.md +35 -0
  238. package/.pi/skills/quality/privacy-data-handling/SKILL.md +26 -0
  239. package/.pi/skills/quality/security-review/SKILL.md +34 -0
  240. package/.pi/skills/quality/test-strategy/SKILL.md +33 -0
  241. package/.pi/skills/quality/testability-design/SKILL.md +33 -0
  242. package/.pi/skills/systems/concurrency-safety/SKILL.md +32 -0
  243. package/.pi/skills/systems/data-modeling-migrations/SKILL.md +31 -0
  244. package/.pi/skills/systems/observability-instrumentation/SKILL.md +32 -0
  245. package/.pi/skills/systems/performance-measurement/SKILL.md +35 -0
  246. package/.pi/skills/systems/reliability-design/SKILL.md +32 -0
  247. package/.sentrux/rules.toml +20 -4
  248. package/AGENTS.md +7 -2
  249. package/CHANGELOG.md +20 -0
  250. package/README.md +3 -12
  251. package/THIRD_PARTY_NOTICES.md +12 -21
  252. package/package.json +17 -7
  253. package/vendor/pi-subagents/src/agents.ts +45 -1
  254. package/vendor/pi-subagents/src/subagents.ts +866 -811
  255. package/vendor/pi-vcc/src/core/brief.ts +68 -99
  256. package/vendor/pi-vcc/src/core/settings.ts +2 -2
  257. package/.agents/skills/caveman/SKILL.md +0 -67
  258. package/.agents/skills/scrapling-web/SKILL.md +0 -98
  259. package/.pi/agents/harness/meta-optimizer.md +0 -36
  260. package/.pi/extensions/00-posthog-network-bootstrap.ts +0 -11
  261. package/.pi/extensions/lib/ask-user/dialog.ts +0 -260
  262. package/.pi/extensions/lib/harness-subagent-auth.ts +0 -207
  263. package/.pi/extensions/lib/harness-subagent-policy.ts +0 -236
  264. package/.pi/extensions/pi-model-router-harness.ts +0 -42
  265. package/.pi/harness/evolution/meta-optimizer.mjs +0 -99
  266. package/.pi/harness/specs/router-tuning-proposal.schema.json +0 -114
  267. package/.pi/model-router.example.json +0 -36
  268. package/.pi/prompts/harness-critic.md +0 -10
  269. package/.pi/prompts/harness-eval.md +0 -10
  270. package/.pi/prompts/harness-router-tune.md +0 -52
  271. package/.pi/scripts/harness-generate-model-router.mjs +0 -327
  272. package/.pi/scripts/harness-model-router-routing.test.mjs +0 -97
  273. package/.pi/scripts/harness-sync-model-router.mjs +0 -97
  274. package/.pi/scripts/harness_web/__pycache__/__init__.cpython-314.pyc +0 -0
  275. package/.pi/scripts/harness_web/__pycache__/config.cpython-314.pyc +0 -0
  276. package/.pi/scripts/harness_web/__pycache__/output.cpython-314.pyc +0 -0
  277. package/.pi/scripts/harness_web/__pycache__/scrape.cpython-314.pyc +0 -0
  278. package/.pi/scripts/harness_web/__pycache__/search.cpython-314.pyc +0 -0
  279. package/.pi/scripts/harness_web/__pycache__/search_ddg.cpython-314.pyc +0 -0
  280. package/.pi/scripts/harness_web/__pycache__/search_searxng.cpython-314.pyc +0 -0
  281. package/.pi/scripts/vendor-sync-pi-model-router.sh +0 -47
  282. package/vendor/pi-model-router/.prettierignore +0 -4
  283. package/vendor/pi-model-router/.prettierrc +0 -5
  284. package/vendor/pi-model-router/AGENTS.md +0 -39
  285. package/vendor/pi-model-router/LICENSE +0 -21
  286. package/vendor/pi-model-router/README.md +0 -99
  287. package/vendor/pi-model-router/UPSTREAM_PIN.md +0 -10
  288. package/vendor/pi-model-router/docs/ARCHITECTURE.md +0 -54
  289. package/vendor/pi-model-router/extensions/commands.ts +0 -720
  290. package/vendor/pi-model-router/extensions/config.ts +0 -348
  291. package/vendor/pi-model-router/extensions/constants.ts +0 -1
  292. package/vendor/pi-model-router/extensions/index.ts +0 -478
  293. package/vendor/pi-model-router/extensions/provider.ts +0 -580
  294. package/vendor/pi-model-router/extensions/routing.ts +0 -564
  295. package/vendor/pi-model-router/extensions/state.ts +0 -52
  296. package/vendor/pi-model-router/extensions/types.ts +0 -95
  297. package/vendor/pi-model-router/extensions/ui.ts +0 -144
  298. package/vendor/pi-model-router/model-router.example.json +0 -48
  299. package/vendor/pi-model-router/package.json +0 -48
  300. package/vendor/pi-model-router/tsconfig.json +0 -16
  301. /package/.pi/{prompts → harness/docs}/planning-rubrics.md +0 -0
  302. /package/.pi/{extensions/lib → lib}/ask-user/fallback.ts +0 -0
  303. /package/.pi/{extensions/lib → lib}/ask-user/render.ts +0 -0
  304. /package/.pi/{extensions/lib → lib}/ask-user/schema.ts +0 -0
  305. /package/.pi/{extensions/lib → lib}/ask-user/types.ts +0 -0
  306. /package/.pi/{extensions/lib → lib}/ask-user/validate-core.mjs +0 -0
  307. /package/.pi/{extensions/lib → lib}/ask-user/validate.ts +0 -0
  308. /package/.pi/{extensions/lib → lib}/harness-cocoindex-refresh.ts +0 -0
  309. /package/.pi/{extensions/lib → lib}/harness-paths.ts +0 -0
  310. /package/.pi/{extensions/lib → lib}/harness-spawn-budget.ts +0 -0
  311. /package/.pi/{extensions/lib → lib}/harness-vcc-settings.ts +0 -0
  312. /package/.pi/{extensions/lib → lib}/plan-approval/dialog.ts +0 -0
  313. /package/.pi/{extensions/lib → lib}/plan-approval/schema.ts +0 -0
  314. /package/.pi/{extensions/lib → lib}/plan-approval-readiness.ts +0 -0
  315. /package/.pi/{extensions/lib → lib}/plan-debate-eligibility.ts +0 -0
  316. /package/.pi/{extensions/lib → lib}/plan-debate-focus.ts +0 -0
  317. /package/.pi/{extensions/lib → lib}/plan-debate-id.ts +0 -0
  318. /package/.pi/{extensions/lib → lib}/plan-debate-lanes.ts +0 -0
  319. /package/.pi/{extensions/lib → lib}/plan-debate-round-status.ts +0 -0
  320. /package/.pi/{extensions/lib → lib}/plan-debate-write-guard.ts +0 -0
  321. /package/.pi/{extensions/lib → lib}/plan-review-gate.ts +0 -0
  322. /package/.pi/{extensions/lib → lib}/plan-review-integrator-rules.ts +0 -0
  323. /package/.pi/{extensions/lib → lib}/plan-scope-guard.ts +0 -0
  324. /package/.pi/{extensions/lib → lib}/posthog-client.ts +0 -0
  325. /package/.pi/{extensions/lib → lib}/posthog-node.d.ts +0 -0
@@ -32,4 +32,4 @@ Early implementation treated debate as a fixed four-round checklist with single
32
32
 
33
33
  - [ADR-0033](0033-parent-orchestrated-planning.md), [ADR-0034](0034-darwin-plan-research-pipeline.md)
34
34
  - `raw/decisions/adr-020.md`, `raw/modules/structured-planning.md`
35
- - `.pi/prompts/planning-rubrics.md`, `.pi/prompts/harness-plan.md` Phase 5
35
+ - `.pi/harness/docs/planning-rubrics.md`, `.pi/prompts/harness-plan.md` Phase 5
@@ -0,0 +1,49 @@
1
+ # ADR 0045: Harness-lens minimal contract
2
+
3
+ ## Status
4
+
5
+ Accepted — 2026-05-24
6
+
7
+ ## Context
8
+
9
+ ultimate-pi previously shipped a trimmed fork of pi-lens with bundled YAML rules, ast-grep pi tools, and JS/TS-centric session scans. That overlapped Sentrux (architecture gate), shell `sg` (structural search), and graphify/ccc (recon). Target projects can be any stack (Go, Python, Rust, polyglot monorepos).
10
+
11
+ ## Decision
12
+
13
+ Replace the fork with a **harness-native** extension at `.pi/extensions/lib/harness-lens/`:
14
+
15
+ | Concern | Owner |
16
+ |---------|--------|
17
+ | Recon | graphify, ccc |
18
+ | Structural search | shell `sg` only |
19
+ | Architecture gate | Sentrux |
20
+ | Edit autopatch, secrets block, deferred format, LSP | harness-lens |
21
+
22
+ ### Runtime contract
23
+
24
+ - **Edit autopatch** — indentation-only oldText correction on `tool_call` (edit).
25
+ - **Secrets** — regex scanner blocks writes with credentials (stack-agnostic).
26
+ - **Deferred format** — queue on `tool_result`, run at `agent_end` (default). `--immediate-format` and `--no-autoformat` unchanged.
27
+ - **Formatters** — PATH binaries only when the **target project** declares config (`biome.json`, `ruff` in `pyproject.toml`, `.prettierrc`, `go.mod` + gofmt, `Cargo.toml` + rustfmt, etc.). No bundled biome/ruff config in lens; no lazy gem/rustup installs.
28
+ - **LSP** — `lsp_diagnostics`, `lsp_navigation`; auto-touch on read/write/edit; installer catalog is **LSP servers only** (no shadow-install of biome/ruff/sg).
29
+ - **Session bootstrap** — `project-profile.ts` detects FileKinds from tree + markers; pre-install at most 2–3 LSP defaults for detected kinds only.
30
+
31
+ ### External projects
32
+
33
+ - **Detect, don't assume** — no JS/TS export guard, no default biome for Go-only repos.
34
+ - **Harness setup tools ≠ lens stack** — `/harness-setup` may install global `sg` and optional `biome` on the machine; lens does not require them for unrelated stacks.
35
+ - **Graceful degradation** — missing LSP or formatter on PATH → skip with debug log.
36
+
37
+ ### Flags
38
+
39
+ `--no-lens`, `--no-lsp`, `--no-autoformat`, `--immediate-format`, `--lens-guard` (interactive commit block when blockers present).
40
+
41
+ ### Removed
42
+
43
+ - Bundled `rules/` YAML corpus, ast-grep pi tools, upstream `UPSTREAM_PIN.md` sync, duplicate export guard, AgentBehaviorClient, rules-scanner injection, cosmetic todo/go/rust scans.
44
+
45
+ ## Consequences
46
+
47
+ - Smaller npm payload and one quality story per concern.
48
+ - Agents on external repos get stack-appropriate LSP/format behavior without harness JS defaults.
49
+ - `harness-verify.mjs` asserts no `lib/lens`, no bundled rules, no `ast_grep_search` in index.
@@ -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)
@@ -0,0 +1,46 @@
1
+ # ADR 0050: Agentic Web Retrieval Stack (WRS)
2
+
3
+ - **Status:** Accepted
4
+ - **Date:** 2026-05-26
5
+ - **Deciders:** ultimate-pi harness team
6
+
7
+ ## Context
8
+
9
+ Harness agents treated `web_search` as single-query SERP, yielding poor recall on ambiguous research questions. Exa-style outcomes (multi-angle discovery, fusion, evidence, synthesis) are needed without Exa API, MCP, or a neural index at Exa scale.
10
+
11
+ ## Decision
12
+
13
+ Introduce **WRS** as the default non-API web layer:
14
+
15
+ 1. **Tiers** on `web_search`: `instant`, `standard`, **`deep`** (default for research), `research`.
16
+ 2. **Planning subagents** under `.pi/agents/harness/web-retrieval/` — e.g. `harness/web-retrieval/web-query-expander` produces `.web/angles.yaml`; parent runs `web_search(tier=deep, anglesFile=…)`.
17
+ 3. **Python fusion**: parallel metasearch per angle (DDG HTML or SearXNG) + RRF (`k=60`) + optional lexical rerank.
18
+ 4. **Extension tools**: `web_find_similar`, `web_contents`, `web_fetch` highlights.
19
+ 5. **Synthesis subagents** (same directory): `web-answerer`, `web-gap-analyzer`, `web-criteria-verifier`, `web-summarizer`, `web-query-expander-fast`.
20
+ 6. **web-retrieval** skill as canonical workflow; **SYSTEM.md** mandates deep default and anti-patterns.
21
+ 7. **context7** remains sole path for library API documentation.
22
+ 8. **User model routing:** env vars `HARNESS_WEB_FAST_MODEL`, `HARNESS_WEB_EXPANDER_MODEL`, `HARNESS_WEB_QUALITY_MODEL` (any Pi `provider/model-id`); else parent session or agent `model:` override.
23
+ 9. **Pooled local cache:** `.web/cache/` keyed by search/fetch context with TTL (`HARNESS_WEB_CACHE_TTL_SEC`); workspace aliases under `.web/`. Optional `HARNESS_WEB_ISOLATE=1` for per-run/session dirs.
24
+
25
+ Subagents are **not** spawned inside tool `execute()`; parent orchestrates expander → deep → fetch.
26
+
27
+ ## Consequences
28
+
29
+ ### Positive
30
+
31
+ - Higher recall on landscape / prior-art questions without paid search APIs.
32
+ - Path-first `.web/` artifacts for harness-plan debate.
33
+ - Contract checks in `harness-verify.mjs` keep guidance aligned with tools.
34
+
35
+ ### Negative / trade-offs
36
+
37
+ - Deep search is slower (N parallel SERP calls).
38
+ - Heuristic `--expand-heuristic` is weaker than expander subagent (templates from mergeable `.pi/harness/web-heuristic-angles.yaml`; projects extend via same path under their repo).
39
+ - No embedding index; O3 precision is approximate vs Exa neural search.
40
+
41
+ ## References
42
+
43
+ - `.pi/harness/docs/harness-web-search.md`
44
+ - `.agents/skills/web-retrieval/SKILL.md`
45
+ - `.pi/extensions/harness-web-tools.ts`
46
+ - Plan: `.cursor/plans/exa-style_harness_web_fd231183.plan.md`
@@ -26,11 +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 |
33
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 |
34
39
 
35
40
  ## Practice map
36
41
 
@@ -0,0 +1,97 @@
1
+ # Harness Web Retrieval Stack (WRS)
2
+
3
+ Internal reference for multi-angle search, fusion, and agent workflows. User-facing procedures: **web-retrieval** skill (install + env).
4
+
5
+ ## Outcomes (Exa analog)
6
+
7
+ | Outcome | Primitive |
8
+ |---------|-----------|
9
+ | Discovery / recall | `search-deep` + RRF |
10
+ | Precision | Multi-angle + optional `HARNESS_WEB_RERANK=lexical` |
11
+ | Evidence / highlights | `web_fetch(highlights)` |
12
+ | Similar pages | `find-similar` CLI / `web_find_similar` |
13
+ | Synthesis | `evidence-bundle` + `web-answerer` |
14
+
15
+ ## CLI
16
+
17
+ ```bash
18
+ python3 .pi/scripts/harness-web.py search-deep "query" \
19
+ --angles-file .web/angles.yaml -o .web/search-deep.json
20
+ python3 .pi/scripts/harness-web.py search-deep "query" --expand-heuristic -o .web/search-deep.json
21
+ python3 .pi/scripts/harness-web.py find-similar "https://example.com" -o .web/search-deep.json
22
+ python3 .pi/scripts/harness-web.py contents-batch --from-search .web/search-deep.json -o .web/contents/
23
+ ```
24
+
25
+ ## Python modules
26
+
27
+ - `harness_web/query_angles.py` — parse expander YAML
28
+ - `harness_web/multi_search.py` — parallel per-angle SERP
29
+ - `harness_web/rank.py` — normalize URL, RRF, lexical rerank
30
+ - `harness_web/deep_search.py` — orchestration
31
+ - `harness_web/highlights.py` — excerpt scoring
32
+ - `harness_web/evidence_bundle.py` — merge for answerer
33
+
34
+ ## Artifacts
35
+
36
+ **Cache** (pooled): `.web/cache/<kind>/<cacheKey>/` with `meta.json` (search context, `createdAt`, `expiresAt`, `hitCount`).
37
+
38
+ **Workspace** (default `.web/`): tool aliases agents read. `web_search` / `web_fetch` set `cacheHit`, `cacheKey`, `cachePath` in details.
39
+
40
+ | Env / param | Effect |
41
+ |-------------|--------|
42
+ | `HARNESS_WEB_CACHE_TTL_SEC` | Default TTL (86400) |
43
+ | `HARNESS_WEB_CACHE=0` | Disable cache |
44
+ | `refreshCache: true` | Bypass cache |
45
+ | `cacheMaxAge` | Max reuse age (seconds) |
46
+ | `HARNESS_WEB_ISOLATE=1` | Per-run/session dirs (legacy) |
47
+
48
+ | File | Content |
49
+ |------|---------|
50
+ | `angles.yaml` | Expander output |
51
+ | `search-deep.json` | Fused SERP + scores + `angle_ids` |
52
+ | `evidence-bundle.json` | URLs + snippets + highlights |
53
+ | `answer.md` | Cited synthesis |
54
+
55
+ ## Subagents (`.pi/agents/harness/web-retrieval/`)
56
+
57
+ | Spawn id | Role |
58
+ |----------|------|
59
+ | `harness/web-retrieval/web-query-expander` | Angles YAML (default research) |
60
+ | `harness/web-retrieval/web-query-expander-fast` | 2–3 angles (latency) |
61
+ | `harness/web-retrieval/web-gap-analyzer` | Follow-up angles |
62
+ | `harness/web-retrieval/web-answerer` | Cited answer |
63
+ | `harness/web-retrieval/web-summarizer` | Single-page digest |
64
+ | `harness/web-retrieval/web-criteria-verifier` | Criteria scoring |
65
+
66
+ ## Heuristic angles config (user-extensible)
67
+
68
+ Emergency templates for `expandHeuristic:true` / `--expand-heuristic` load from YAML:
69
+
70
+ | File | Role |
71
+ |------|------|
72
+ | `<package>/.pi/harness/web-heuristic-angles.yaml` | Built-in defaults (code → github, stackoverflow, …) |
73
+ | `<project>/.pi/harness/web-heuristic-angles.yaml` | **Your** extensions (merged on top) |
74
+
75
+ Copy [examples/web-heuristic-angles.project.yaml](../examples/web-heuristic-angles.project.yaml) into an external project’s `.pi/harness/` to add sites per category or define new categories (use `category` on `web_search`).
76
+
77
+ Query templates use `{query}` as the user search string. Same `id` in a category replaces the package angle.
78
+
79
+ Optional: `HARNESS_WEB_HEURISTIC_ANGLES_FILE=/path/to/custom.yaml` (merged last).
80
+
81
+ ## Environment
82
+
83
+ | Variable | Default |
84
+ |----------|---------|
85
+ | `HARNESS_WEB_SEARCH_ENGINE` | `ddg_html` |
86
+ | `HARNESS_WEB_DEEP_CONCURRENCY` | `4` |
87
+ | `HARNESS_WEB_RERANK` | `off` |
88
+ | `HARNESS_WEB_FAST_MODEL` | expander-fast, summarizer, gap-analyzer |
89
+ | `HARNESS_WEB_EXPANDER_MODEL` | full query expander |
90
+ | `HARNESS_WEB_QUALITY_MODEL` | answerer, criteria-verifier |
91
+ | `HARNESS_WEB_HEURISTIC_ANGLES_FILE` | Extra heuristic angles YAML (merged last) |
92
+ | `HARNESS_PROJECT_ROOT` | Project root for `.pi/harness/web-heuristic-angles.yaml` |
93
+ | `HARNESS_PKG_ROOT` | Package root for default heuristic YAML |
94
+
95
+ Values use Pi `provider/model-id` format (any provider your install supports). Unset → subagent inherits parent session model. See **web-retrieval** skill.
96
+
97
+ ADR: [0050-web-retrieval-retrieval-stack.md](adrs/0050-web-retrieval-retrieval-stack.md)
@@ -13,6 +13,15 @@ HARNESS_WEB_SEARCH_ENGINE=ddg_html
13
13
  # HARNESS_WEB_PROXY=
14
14
  # HARNESS_WEB_RATE_LIMIT_MS=2000
15
15
  # HARNESS_WEB_TIMEOUT_MS=30000
16
+ # Heuristic angles (--expand-heuristic): edit <project>/.pi/harness/web-heuristic-angles.yaml
17
+ # Optional override path (merged after package + project):
18
+ # HARNESS_WEB_HEURISTIC_ANGLES_FILE=
19
+ # Pooled WRS cache (Firecrawl-style freshness); workspace aliases under .web/
20
+ # HARNESS_WEB_CACHE_TTL_SEC=86400
21
+ # HARNESS_WEB_CACHE=0
22
+ # HARNESS_WEB_ISOLATE=1
23
+ # HARNESS_PROJECT_ROOT=
24
+ # HARNESS_PKG_ROOT=
16
25
 
17
26
  # --- VCC compaction (env-only; no JSON config files) ---
18
27
  # Default: VCC handles /compact and auto-compaction. Set false for Pi LLM compaction:
@@ -21,7 +30,6 @@ HARNESS_WEB_SEARCH_ENGINE=ddg_html
21
30
 
22
31
  # --- PostHog (optional) ---
23
32
  # Project key — required for harness_* telemetry when HARNESS_TELEMETRY_ENABLED=true
24
- # WSL2: ultimate-pi loads 00-posthog-network-bootstrap.ts (IPv4 fetch for *.posthog.com).
25
33
  # If flush still fails, set POSTHOG_ENABLED=false or fix outbound HTTPS to PostHog.
26
34
  # POSTHOG_API_KEY=
27
35
  # POSTHOG_HOST=https://us.i.posthog.com
@@ -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,22 @@
1
+ # Example project extension — copy to:
2
+ # <your-project>/.pi/harness/web-heuristic-angles.yaml
3
+ #
4
+ # Merges on top of package .pi/harness/web-heuristic-angles.yaml.
5
+ # Same angle id in a category replaces the package entry; new ids append.
6
+
7
+ version: 1
8
+
9
+ categories:
10
+ code:
11
+ # Add Rust-specific angles (keeps github + stackoverflow from package defaults)
12
+ - id: docs_rs
13
+ query: "{query} site:docs.rs"
14
+ rationale: Official Rust API docs
15
+ - id: crates_io
16
+ query: "{query} site:crates.io"
17
+ rationale: Crate ecosystem
18
+ # Package already ships category=security; extend or override ids here:
19
+ # security:
20
+ # - id: cisa_kev
21
+ # query: "{query} site:cisa.gov/known-exploited-vulnerabilities"
22
+ # rationale: CISA KEV catalog
@@ -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/*",
@@ -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": {