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
@@ -78,4 +78,4 @@ Resume: `harness_debate_round_status({ round_index: N })` → run listed `next_t
78
78
 
79
79
  Do not `approve_plan` on `policy_decision: block`. On `human_required` → `ask_user` first.
80
80
 
81
- Rubrics: `.pi/prompts/planning-rubrics.md`.
81
+ Rubrics: `.pi/harness/docs/planning-rubrics.md`.
@@ -9,8 +9,7 @@ description: Structured user decisions via ask_user for harness setup, planning,
9
9
 
10
10
  - `/harness-setup` — missing project `.env`, other bootstrap forks
11
11
  - `/harness-plan` or harness-auto **plan** phase — scope, risk, acceptance ambiguity
12
- - Orchestrator receives `human_required` from evaluator, adversary, tie-breaker, or meta-optimizer
13
- - `/harness-router-tune` — approve / reject / edit a router proposal before apply
12
+ - Orchestrator receives `human_required` from evaluator, adversary, or tie-breaker
14
13
 
15
14
  ## Decision handshake
16
15
 
@@ -14,11 +14,12 @@ description: Enforce harness governance phases, policy gates, budgets, and promo
14
14
  ## Workflow
15
15
 
16
16
  1. Read current phase from `/harness-policy-status` or session `harness-policy-state`.
17
- 2. Check ADRs: constitution (0001), eval promotion (0003), Sentrux (0006), drift (0007), rules lifecycle (0009).
18
- 3. For promotion: require eval pass, no abort lock, debate consensus if escalated, Sentrux when `HARNESS_SENTRUX_REQUIRED=true` (`artifacts/sentrux-signal.yaml` from `/harness-run`, not executor self-report).
19
- 4. **Intent vs observation:** Manifest/layer/boundary changes `/harness-sentrux-steward` proposal + chair approval + ADR when material, then `sentrux-rules-sync --force`. `sentrux check`/`gate` degradation after execute → replan or fix code — do not tune manifest on a single noisy gate.
20
- 5. After approved manifest edits: `node "$UP_PKG/.pi/scripts/harness-sentrux-bootstrap.mjs" --force` or `/harness-sentrux-sync`; emit `harness-architecture-changed` for the extension.
21
- 5. Run `node "$UP_PKG/.pi/scripts/harness-verify.mjs"` before claiming release readiness.
17
+ 2. Check ADRs: constitution (0001), eval promotion (0003), Sentrux (0006), drift (0007), rules lifecycle (0009), AGT policy (0046), AGT security layers (0047).
18
+ 3. Tool allow/deny is enforced by AGT `PolicyEngine` + `.pi/harness/policies/*.yaml` (parent `policy-gate`, subprocess `harness-subagent-governance`). Disable with `HARNESS_AGT_POLICY=0`. Audit: `.pi/harness/runs/<run_id>/agt-audit.jsonl`.
19
+ 4. For promotion: require eval pass, no abort lock, debate consensus if escalated, Sentrux when `HARNESS_SENTRUX_REQUIRED=true` (`artifacts/sentrux-signal.yaml` from `/harness-run`, not executor self-report).
20
+ 5. **Intent vs observation:** Manifest/layer/boundary changes `/harness-sentrux-steward` proposal + chair approval + ADR when material, then `sentrux-rules-sync --force`. `sentrux check`/`gate` degradation after execute → replan or fix code — do not tune manifest on a single noisy gate.
21
+ 6. After approved manifest edits: `node "$UP_PKG/.pi/scripts/harness-sentrux-bootstrap.mjs" --force` or `/harness-sentrux-sync`; emit `harness-architecture-changed` for the extension.
22
+ 7. Run `node "$UP_PKG/.pi/scripts/harness-verify.mjs"` before claiming release readiness (includes AGT policy doctor).
22
23
 
23
24
  ## Spec Distiller integration
24
25
 
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: web-retrieval
3
+ description: |
4
+ Agentic Web Retrieval Stack (WRS) — tiered web_search/web_fetch/web_contents (harness-web.py +
5
+ Scrapling). Default tier=deep with web-query-expander angles. Use for search, scrape, landscape,
6
+ prior art, comparisons, planning pre-research, cited answers, similar URLs, websets scoring.
7
+ Triggers on non-API web research, scrape URL, web_search, web_fetch, .web/ artifacts.
8
+ Library API docs → context7 only. Install: /harness-setup or harness-cli-verify.
9
+ allowed-tools: Read Write web_search web_fetch web_find_similar web_contents
10
+ ---
11
+
12
+ # web-retrieval (WRS)
13
+
14
+ Maps user intent → **tier** + pipeline. Pi tools: `web_search`, `web_fetch`, `web_find_similar`, `web_contents` (wrap `harness-web.py`). **Pooled cache** under `.web/cache/`; workspace aliases under `.web/`.
15
+
16
+ **Never before search/fetch:** `UP_PKG` resolution, `ls harness-web.py`, `python3 -c "import scrapling"`, Firecrawl, curl/wget, or scrapling CLI for SERP/fetch.
17
+
18
+ ## Workspace + cache (default)
19
+
20
+ | Layer | Path | Role |
21
+ |-------|------|------|
22
+ | **Cache** | `.web/cache/<kind>/<cacheKey>/` | Pooled SERP + fetch payloads with `meta.json` (query, tier, angles fingerprint, TTL) |
23
+ | **Workspace** | `.web/` (`angles.yaml`, `search-deep.json`, `page.md`, …) | Stable paths agents read/write; refreshed from cache on hit |
24
+
25
+ `web_search` / `web_fetch` return **`cacheHit`**, **`cacheKey`**, **`cachePath`** when reusing pooled results. Same intent + angles skips network until TTL expires.
26
+
27
+ | Control | Meaning |
28
+ |---------|---------|
29
+ | `HARNESS_WEB_CACHE_TTL_SEC` | Default freshness (86400 = 24h) |
30
+ | `HARNESS_WEB_CACHE=0` | Disable pooling |
31
+ | `refreshCache: true` on tool | Force network |
32
+ | `cacheMaxAge` on tool | Stricter max age (seconds) |
33
+
34
+ **Optional isolation** (parallel mutable synthesis): `HARNESS_WEB_ISOLATE=1` → `.web/runs/<run_id>/` or `.web/sessions/<pi_session_id>/` for `answer.md` / evidence when sessions must not share workspace files.
35
+
36
+ `web_search` responses include **`artifactDir`** (usually `.web`). Spawn web-retrieval subagents with `HARNESS_WEB_ARTIFACT_DIR` or `artifactDir` in the task.
37
+
38
+ ## Tier table
39
+
40
+ | User intent | Tier | Steps |
41
+ |-------------|------|-------|
42
+ | One narrow fact (scoped) | `instant` or `standard` | `web_search({ query, tier })` — **no subagent** |
43
+ | Fast open-web with angles | `standard` or `deep` + heuristic | `web-query-expander-fast` **or** `expandHeuristic:true` |
44
+ | "What is X?" needs sources | `deep` | `web-query-expander` → deep → highlights |
45
+ | Landscape / how / compare | `deep` | `web-query-expander` → deep → `web_fetch` highlights top 3 |
46
+ | Answer with citations | `research` | deep → `web_contents` → `web-answerer` |
47
+ | Qualified list (Websets analog) | `research` + verifier | deep → `web-criteria-verifier` → CSV |
48
+ | More like this URL | — | `web_find_similar` |
49
+ | Library API docs | — | **context7** (not WRS) |
50
+
51
+ ## Latency vs quality routing
52
+
53
+ | Priority | Search / subagent | Model / thinking |
54
+ |----------|-------------------|------------------|
55
+ | **Latency** | No expander: `tier=instant` or `standard` only | Parent session (pick a fast model in UI) |
56
+ | **Latency + angles** | `harness/web-retrieval/web-query-expander-fast` → `tier=deep` | `HARNESS_WEB_FAST_MODEL` (optional) |
57
+ | **Emergency angles (no LLM)** | `web_search({ tier: "deep", expandHeuristic: true, category? })` | Templates from `.pi/harness/web-heuristic-angles.yaml` (project file merges on top) |
58
+ | **Default research** | `harness/web-retrieval/web-query-expander` → `tier=deep` | `HARNESS_WEB_EXPANDER_MODEL` or parent |
59
+ | **Gap fill** | `harness/web-retrieval/web-gap-analyzer` | `HARNESS_WEB_FAST_MODEL` or parent |
60
+ | **Cited answer** | `harness/web-retrieval/web-answerer` | `HARNESS_WEB_QUALITY_MODEL` or parent |
61
+ | **Page digest** | `harness/web-retrieval/web-summarizer` | `HARNESS_WEB_FAST_MODEL` or parent |
62
+ | **Criteria scoring** | `harness/web-retrieval/web-criteria-verifier` | `HARNESS_WEB_QUALITY_MODEL` or parent |
63
+
64
+ ## Configuring models (env vars)
65
+
66
+ WRS subagents need a **concrete** `provider/model-id` (same format as Pi — any provider your install supports). Set in shell, `.env`, or harness-synced project env:
67
+
68
+ | Variable | Applies to |
69
+ |----------|------------|
70
+ | `HARNESS_WEB_FAST_MODEL` | `web-query-expander-fast`, `web-summarizer`, `web-gap-analyzer` |
71
+ | `HARNESS_WEB_EXPANDER_MODEL` | `web-query-expander` |
72
+ | `HARNESS_WEB_QUALITY_MODEL` | `web-answerer`, `web-criteria-verifier` |
73
+
74
+ Example (use **your** provider/model ids):
75
+
76
+ ```bash
77
+ export HARNESS_WEB_FAST_MODEL=your-provider/cheap-model
78
+ export HARNESS_WEB_EXPANDER_MODEL=your-provider/balanced-model
79
+ export HARNESS_WEB_QUALITY_MODEL=your-provider/strong-model
80
+ ```
81
+
82
+ If unset for an agent, the subagent inherits the **parent session model** (pick a fast model in Pi when latency matters).
83
+
84
+ Optional per-agent override: `model:` in agent `.md` frontmatter or project `.pi/agents.policy.yaml` (before parent fallback).
85
+
86
+ ## Deep pipeline (default for research)
87
+
88
+ 1. `subagent` **`harness/web-retrieval/web-query-expander`** → parent saves `.web/angles.yaml`
89
+ 2. `web_search({ query: "<intent>", tier: "deep", anglesFile: ".web/angles.yaml" })` — repeats hit cache when context unchanged
90
+ 3. `read` `.web/search-deep.json` — prefer URLs with multiple `angle_ids`
91
+ 5. `web_fetch({ url, highlights: true, highlightQuery: "<intent>" })` on top 3–5
92
+ 6. Optional gap pass: `harness/web-retrieval/web-gap-analyzer` → new angles → second `web_search` deep
93
+
94
+ **Anti-patterns:** bare `web_search({ query })` for open questions; 3+ manual SERP loops; `bulk: true` without need.
95
+
96
+ ## Research profile (`tier=research`)
97
+
98
+ After deep + highlight fetches:
99
+
100
+ ```bash
101
+ python3 "$UP_PKG/.pi/scripts/harness-web.py" contents-batch \
102
+ --from-search "$ARTIFACT_DIR/search-deep.json" \
103
+ --evidence-bundle "$ARTIFACT_DIR/evidence-bundle.json" --limit 5
104
+ ```
105
+
106
+ Spawn **`harness/web-retrieval/web-answerer`** with `artifactDir` / `answerPath: $ARTIFACT_DIR/answer.md`.
107
+
108
+ ## Websets profile
109
+
110
+ Spawn **`harness/web-retrieval/web-criteria-verifier`** with NL criteria + `search-deep.json` candidates → `.web/webset-reasoning.yaml` / CSV manifest.
111
+
112
+ ## Bash fallback (no pi tools)
113
+
114
+ ```bash
115
+ python3 "$UP_PKG/.pi/scripts/harness-web.py" search-deep "query" \
116
+ --expand-heuristic -o .web/search-deep.json --limit 10
117
+ ```
118
+
119
+ ## Subagents
120
+
121
+ | Agent | Role |
122
+ |-------|------|
123
+ | `harness/web-retrieval/web-query-expander` | Angles YAML (research / recall) |
124
+ | `harness/web-retrieval/web-query-expander-fast` | 2–3 angles (latency) |
125
+ | `harness/web-retrieval/web-gap-analyzer` | Follow-up angles |
126
+ | `harness/web-retrieval/web-answerer` | Cited answer |
127
+ | `harness/web-retrieval/web-summarizer` | Single-page digest |
128
+ | `harness/web-retrieval/web-criteria-verifier` | Criteria scoring |
129
+
130
+ ## Heuristic angle templates (no LLM expander)
131
+
132
+ Package defaults: `.pi/harness/web-heuristic-angles.yaml` (`max_angles: 8`). Categories include targeted `site:` angles — e.g. **code**: GitHub, Stack Overflow, Stack Exchange, Read the Docs, MDN, npm/PyPI/Go/Rust registries, Microsoft Learn, HN; **paper**: arXiv, Semantic Scholar, Papers with Code, OpenReview; **security**: NVD, OWASP, CWE; plus **news**, **company**, **people**, **default**.
133
+
134
+ `web_search({ tier: "deep", expandHeuristic: true, category: "code" })`
135
+
136
+ **External projects:** copy `.pi/harness/examples/web-heuristic-angles.project.yaml` → `<project>/.pi/harness/web-heuristic-angles.yaml` and add or override angle ids. Use `{query}` in templates.
137
+
138
+ ## Install (setup / humans only)
139
+
140
+ ```bash
141
+ command -v uv &>/dev/null || curl -LsSf https://astral.sh/uv/install.sh | sh
142
+ uv tool install "scrapling[fetchers]"
143
+ scrapling install # browser binaries for stealth scrape
144
+ bash "$UP_PKG/.pi/scripts/harness-cli-verify.sh"
145
+ ```
146
+
147
+ Diagnostics: `python3 "$UP_PKG/.pi/scripts/harness-web.py" status` (JSON).
148
+
149
+ ## Env
150
+
151
+ | Variable | Default | Purpose |
152
+ |----------|---------|---------|
153
+ | `HARNESS_WEB_FETCH_MODE` | `stealth` | `stealth` \| `fast` \| `auto` |
154
+ | `HARNESS_WEB_SEARCH_ENGINE` | `ddg_html` | `ddg_html` \| `searxng` (+ `HARNESS_WEB_SEARXNG_URL`) |
155
+ | `HARNESS_WEB_CACHE_TTL_SEC` | `86400` | Pooled cache TTL |
156
+ | `HARNESS_WEB_CACHE` | on | Set `0` to disable cache |
157
+ | `HARNESS_WEB_ISOLATE` | off | Set `1` for per-run/session workspace dirs |
158
+ | `HARNESS_WEB_RERANK` | — | `off` \| `lexical` |
159
+ | `HARNESS_WEB_DEEP_CONCURRENCY` | `4` | Parallel angle SERP |
160
+ | `HARNESS_WEB_HEURISTIC_ANGLES_FILE` | — | Extra heuristic angles YAML |
161
+ | `HARNESS_WEB_FAST_MODEL` / `EXPANDER` / `QUALITY` | — | Web subagent models |
162
+
163
+ See `.pi/harness/docs/harness-web-search.md` for internals.
@@ -127,16 +127,16 @@ When the user invokes the trigger with NO topic after it, ask:
127
127
  ```
128
128
  Input: topic (from Topic Selection, above)
129
129
 
130
- Round 1. Broad search
131
- 1. Decompose topic into 3-5 distinct search angles
132
- 2. For each angle: run 2-3 `web_search` queries
133
- 3. For top 2-3 results per angle: `web_fetch` each URL (or `read` `.web/` artifacts)
130
+ Round 1. Broad search (WRS deep — do not loop manual SERP)
131
+ 1. Invoke **web-retrieval** skill: `harness/web-retrieval/web-query-expander` `.web/angles.yaml`
132
+ 2. One `web_search({ query: topic, tier: "deep", anglesFile: ".web/angles.yaml" })` → `.web/search-deep.json`
133
+ 3. For top 2-3 fused URLs: `web_fetch` with `highlights: true` (or `read` `.web/` artifacts)
134
134
  4. Save each fetched page to ./raw/ as a markdown file
135
135
  5. Extract from each: key claims, entities, concepts, open questions
136
136
 
137
137
  Round 2. Gap fill
138
- 6. Identify what's missing or contradicted from Round 1
139
- 7. Run targeted searches for each gap (max 5 queries)
138
+ 6. Identify what's missing or contradicted from Round 1 (`read` `search-deep.json`)
139
+ 7. Optional: `harness/web-retrieval/web-gap-analyzer` second `web_search` deep with new angles (max one extra deep pass)
140
140
  8. Fetch top results for each gap, save to ./raw/
141
141
  9. Run `graphify extract ./raw --out .` to incorporate new sources
142
142
  (NOTE: `graphify update` only works for code files. Research sources are docs
package/.pi/PACKAGING.md CHANGED
@@ -6,7 +6,7 @@ Aligned with [pi packages](https://github.com/badlogic/pi-mono/blob/main/package
6
6
 
7
7
  | Key | Paths | Notes |
8
8
  |-----|-------|--------|
9
- | `extensions` | `.pi/extensions` | TypeScript extensions (loaded by pi) |
9
+ | `extensions` | `.pi/extensions` | TypeScript extensions loaded by pi, including the harness lens wrapper |
10
10
  | `skills` | `.agents/skills`, `.pi/skills` | Agent Skills + pi-local skills |
11
11
  | `prompts` | `.pi/prompts` | Slash-command prompt templates |
12
12
 
@@ -20,9 +20,9 @@ Pi does **not** define `scripts`, `agents`, or `providers` in the manifest.
20
20
 
21
21
  We use an explicit allowlist (not the whole `.pi/` tree) so dev-only artifacts never ship:
22
22
 
23
- - No `.pi/harness/runs/`, local `model-router.json`, or `firecrawl/.env`
23
+ - No `.pi/harness/runs/`, `.pi/harness/.lens/` runtime config/cache, or `firecrawl/.env`
24
24
  - Ship `.pi/settings.example.json`, not `.pi/settings.json` (dev checkout uses `".."` local package)
25
- - Include **`vendor/pi-model-router/`** ([`pi-model-router`](https://github.com/yeliu84/pi-model-router), MIT) — see repo [`THIRD_PARTY_NOTICES.md`](../THIRD_PARTY_NOTICES.md); refresh with `npm run vendor:sync-router`
25
+ - Include **`.pi/lib/harness-lens/`** (harness-native lens: edit autopatch, secrets, deferred format, LSP) — loaded through `.pi/extensions/harness-lens.ts`; findings flow to harness PostHog telemetry
26
26
  - Include **`vendor/pi-vcc/`** ([`pi-vcc`](https://github.com/sting8k/pi-vcc), MIT; inspired by [lllyasviel/VCC](https://github.com/lllyasviel/VCC)) — loaded via `.pi/extensions/ultimate-pi-vcc.ts`; refresh with `npm run vendor:sync-vcc`
27
27
  - Include **`vendor/pi-subagents/`** (vendored from [narumiruna/pi-extensions](https://github.com/narumiruna/pi-extensions) `pi-subagents`) — loaded via `.pi/extensions/harness-subagents.ts`; refresh with `npm run vendor:sync-subagents`
28
28
 
@@ -37,4 +37,4 @@ We use an explicit allowlist (not the whole `.pi/` tree) so dev-only artifacts n
37
37
 
38
38
  Runtime pi extensions are regular `dependencies` (installed by `npm install` when pi installs the package). We do **not** use `bundledDependencies`: bundling pre-installs `node_modules` and breaks `npm install -g` / `pi update` for native modules such as `koffi` (empty stub dir, postinstall fails).
39
39
 
40
- `@earendil-works/pi-coding-agent` (and sibling `@earendil-works/pi-ai`, `pi-tui`, `pi-agent-core` used by the vendored router) are provided by the Pi install / hoisted from the peer; ultimate-pi lists the latter three as `devDependencies` for `npm run check:ts`.
40
+ `@earendil-works/pi-coding-agent` (and sibling `@earendil-works/pi-ai`, `pi-tui`, `pi-agent-core` used by bundled extensions and vendored integrations) are provided by the Pi install / hoisted from the peer; ultimate-pi lists the latter three as `devDependencies` for `npm run check:ts`.
package/.pi/SYSTEM.md CHANGED
@@ -1,159 +1,111 @@
1
- # Ultimate Pi Coding Agent — System Prompt
1
+ # Harness Coding Agent — System Prompt
2
2
 
3
3
  You are an enterprise coding agent. Optimize for correctness, minimal diffs, and token efficiency.
4
4
 
5
- ---
6
- ## Voice
7
- - Default to concise, direct language.
8
- - Use caveman mode only when the user explicitly asks for it.
9
- - Keep commands, paths, code, logs exact.
10
-
11
- ## Primary Goal
12
- - Complete user request fully.
13
- - Preserve repo stability.
14
- - Prefer smallest safe change.
5
+ Scope: this file is the reusable harness-level instruction set. It must work when copied into or invoked from external projects. Keep it project-agnostic. Put repository-specific paths, ownership, local conventions, and project facts in the active project's `AGENTS.md` or equivalent local instruction file.
15
6
 
7
+ ---
16
8
  ## Instruction Order
17
9
  1. System/developer rules.
18
10
  2. This file.
19
11
  3. User request.
20
12
  4. Local conventions from repo files.
21
13
 
14
+ ---
15
+ ## Core Operating Rules
16
+ - Be concise and direct; keep commands, paths, code, and logs exact.
17
+ - Complete the user's request while preserving repo stability.
18
+ - Think before coding: state assumptions, ask when unclear, and surface tradeoffs instead of guessing.
19
+ - For multi-step work, state a brief plan with verification points.
20
+ - Prefer the smallest safe change; avoid speculative features, abstractions, configurability, rewrites, and adjacent cleanup.
21
+ - Every edit must map to the objective. If the plan changes or a better path appears, pause and explain.
22
+ - Match existing style. Remove only unused code that your change created; mention unrelated issues separately.
23
+ - Before edits, consult the graph and relevant local contract/project docs when present.
24
+ - For blocking harness forks, call `ask_user`; never silently default on web-provider mode, `.env` creation, scope, or risk.
25
+ - Validate outcomes with targeted checks/tests, inspect outputs, and never claim unverified success.
26
+ - No placeholders, TODO stubs, mock behavior, or partial implementations unless explicitly requested.
27
+ - Report changed files, why they changed, verification performed, and residual risks/next steps.
28
+
22
29
  ---
23
30
  ## Web Policy (Mandatory)
24
31
 
25
32
  > [!warning] No raw HTTP
26
- > Route **all** web through [[context7]] (API/library docs) or **`web_search` / `web_fetch`** ([[scrapling-web]]). No `curl`, `wget`, Firecrawl, or scrapling CLI preflight.
33
+ > Route **all** web through [[context7]] for API/library docs or the **Agentic Web Retrieval Stack (WRS)** — `web_search` / `web_fetch` / `web_find_similar` / `web_contents` via [[web-retrieval]]. Do not use `curl`, `wget`, Firecrawl, or scrapling CLI preflight.
27
34
 
28
35
  ### API / Library Docs — context7 ONLY
29
- - `ctx7 library <name> <query>` then `ctx7 docs <id> <query>`
30
- - context7 owns: function signatures, class APIs, config options, stdlib, framework specs.
31
- - **Never** use quality-sites or web_fetch for API docs.
36
+ - `ctx7 library <name> <query>` then `ctx7 docs <id> <query>`.
37
+ - context7 owns function signatures, class APIs, config options, stdlib, and framework specs.
38
+ - Never use quality-sites or web_fetch for API docs.
32
39
 
33
- ### All Non-API Web — web_search + web_fetch
34
- See `.agents/skills/scrapling-web/SKILL.md`. **No preflight:** never resolve `UP_PKG`, `ls harness-web.py`, or `python3 -c "import scrapling"` before searching.
40
+ ### Non-API Web — WRS (tiered)
41
+ Invoke the **`web-retrieval`** skill before non-trivial open-web work (landscape, prior art, comparisons, planning research). WRS uses a **pooled cache** (`.web/cache/`, TTL via `HARNESS_WEB_CACHE_TTL_SEC`) and **workspace aliases** under `.web/` (`angles.yaml`, `search-deep.json`, `answer.md`). Set `HARNESS_WEB_ISOLATE=1` only when per-run/session file isolation is required.
42
+
43
+ | Tier | When | Pattern |
44
+ |------|------|---------|
45
+ | **`deep`** | **Default** for landscape, prior art, how/why, comparisons, stack/implementation research, multi-source questions | 1) `subagent` `harness/web-retrieval/web-query-expander` → `.web/angles.yaml` 2) `web_search({ query, tier: "deep", anglesFile: ".web/angles.yaml" })` (cache reuse when fresh) 3) `web_fetch` top URLs with `highlights: true` |
46
+ | `standard` | One narrow fact; follow-up after `search-deep.json`; verify one claim | `web_search({ query, tier: "standard", limit: 5 })` |
47
+ | `instant` | Closed-form fact, latency-critical | `web_search({ query, tier: "instant", limit: 5 })` |
48
+ | `research` | Cited answer/report; harness-plan external research | `web-retrieval` `research` profile → deep → contents → `web-answerer` |
35
49
 
36
50
  | Task | Tool |
37
51
  |------|------|
38
- | Search (SERP) | `web_search` (`query`, optional `limit`, `bulk`) |
39
- | Scrape page | `web_fetch` (`url`, optional `fast: true`) |
40
- | Map links | `web_fetch` (`url`, `mode: map`) |
52
+ | Multi-angle SERP | `web_search` with `tier: "deep"` + `anglesFile` |
53
+ | Narrow SERP | `web_search` with `tier: "standard"` or `"instant"` |
54
+ | Scrape / highlights | `web_fetch` (`highlights: true` after deep search) |
55
+ | Batch excerpts | `web_contents` |
56
+ | Similar pages | `web_find_similar` |
57
+ | Map links | `web_fetch` (`mode: map`) |
58
+
59
+ **Anti-patterns**
60
+ - Open-ended question with omitted `tier` (weak single-query SERP).
61
+ - Three+ sequential `web_search` calls with different queries — use one `deep` search.
62
+ - `bulk: true` unless you need markdown bodies of top N immediately.
63
+ - Full `web_fetch` when SERP snippets + highlights suffice.
64
+ - `web_search` / `web_fetch` for library APIs — **context7 only**.
65
+
66
+ **After deep search:** `read` `<artifactDir>/search-deep.json`; prefer URLs listed under multiple `angle_ids`.
41
67
 
42
- - **Artifacts:** default under `.web/`; use `read` for full JSON/markdown.
43
- - **Fallback** (tools unavailable): `python3 "$UP_PKG/.pi/scripts/harness-web.py" …` per scrapling-web skill.
44
- - **Setup diagnostics only:** `harness-web.py status` (JSON config).
45
- - **Quality sites:** check `.agents/skills/wiki-autoresearch/references/quality-sites.md` before citing non-API sources. Prefer Tier 1 (StackOverflow, GitHub issues, engineering blogs, arxiv). Exclude AI content farms, mirrors, stale packages.
46
- - **Research:** use `/wiki-autoresearch <topic>` for deep research. Results are graphified into `graphify-out/`.
68
+ **Latency:** use `tier=instant|standard` without expander when possible; else `harness/web-retrieval/web-query-expander-fast` or `expandHeuristic:true`. **Models:** env `HARNESS_WEB_FAST_MODEL`, `HARNESS_WEB_EXPANDER_MODEL`, `HARNESS_WEB_QUALITY_MODEL` (any Pi `provider/model-id`); see `web-retrieval` skill.
69
+
70
+ - If tools are unavailable, use bash fallback in **web-retrieval** (setup/humans only).
71
+ - For long autonomous research loops, use `/wiki-autoresearch` (WRS deep path) when available.
47
72
 
48
73
  ### Missing CLI fallbacks
49
- - harness-web / Scrapling missing: `uv tool install "scrapling[fetchers]" && scrapling install` then re-run `bash "$UP_PKG/.pi/scripts/harness-cli-verify.sh"`
50
- - Context7 missing: `npm install -g ctx7@latest`
74
+ - harness-web / Scrapling missing: `uv tool install "scrapling[fetchers]" && scrapling install` then re-run the harness CLI verification command documented locally.
75
+ - Context7 missing: `npm install -g ctx7@latest`.
51
76
 
52
77
  ---
53
- ## Graphify-First Workflow (Mandatory)
78
+ ## Codebase Exploration Workflow
54
79
 
55
80
  > [!tip] Graph before grep
56
- > **Always** build or consult the Graphify knowledge graph before codebase exploration.
57
- > The graph reveals structure, god nodes, and surprising connections that raw
58
- > search cannot. 71.5× token reduction on mixed corpora.
59
-
60
- ### Graphify Knowledge Graph
61
-
62
- Graphify builds a queryable knowledge graph from code, docs, papers, and diagrams.
63
- It identifies core concepts (god nodes), community structure, and cross-domain
64
- connections via tree-sitter AST analysis + LLM semantic extraction.
65
-
66
- | Step | Command | When |
67
- |------|---------|------|
68
- | Build graph | `graphify .` | First session, or after major code changes |
69
- | Update graph | `graphify . --update` | After a few file changes (incremental) |
70
- | Query graph | `graphify query "question"` | Understanding relationships, architecture |
71
- | Trace paths | `graphify path "A" "B"` | How two concepts connect (includes call chains) |
72
- | Explain node | `graphify explain "Concept"` | Deep dive — shows all callers, callees, references |
73
- | DFS trace | `graphify query "who calls X" --dfs` | Follow a specific call/dependency chain |
74
- | Read report | Read `graphify-out/GRAPH_REPORT.md` | Fastest path to codebase understanding |
75
-
76
- **Call graph tracing via graphify:**
77
- Graphify's tree-sitter AST extraction captures `calls`, `implements`, and `references`
78
- edges at build time. Use these to answer call-graph questions without external tools:
79
- - **Who calls `functionName`?** → `graphify explain "functionName"` (shows all inbound `calls` edges)
80
- - **What does `functionName` call?** → `graphify explain "functionName"` (shows all outbound `calls` edges)
81
- - **How does `Auth` reach `Database`?** → `graphify path "Auth" "Database"` (shortest call chain)
82
- - **Trace a dependency chain deep** → `graphify query "how does X depend on Y" --dfs`
83
-
84
- **Semantic code search (two lanes):**
85
- - **Architecture / relationships** → graphify (`query`, `explain`, `path`, `GRAPH_REPORT.md`)
86
- - **Implementation by meaning** → CocoIndex Code (`ccc search --limit N "concept"`)
87
-
88
- Examples:
89
- - **Find code by meaning** → `ccc search --limit 10 "authentication session validation"`
90
- - **Who calls X / cross-module path** → `graphify explain "X"` or `graphify path "A" "B"`
91
- - **Cross-file surprises** → `graphify query "what unexpected connections exist"`
92
-
93
- **Order of operations for codebase exploration:**
94
- 1. Read `graphify-out/GRAPH_REPORT.md` (god nodes, surprises, suggested questions)
95
- 2. Run `graphify query` / `explain` / `path` for architecture and call graphs
96
- 3. Use `sg -p 'pattern'` for structural code search
97
- 4. Use `ccc search --limit N` for conceptual implementation chunks when graphify/sg are insufficient
98
- 5. Read individual files last — scouts and graph already narrowed the set
99
-
100
- **Indexing:** Harness runs incremental `ccc index` before subagent spawns. Use `ccc search` only in agents; run `ccc index` at session start or after large edits on parent turns. Never use `ccc search --refresh` in scouts. `/skill:ccc` for full CLI reference.
101
-
102
- ### Fallback Search (when graph doesn't cover it)
103
-
104
- > [!note] Graphify + ccc split responsibilities
105
- > Graphify owns call graphs and cross-module relationships. `ccc` owns AST-aware
106
- > semantic chunks. Only fall back to `find`/`grep` for exact literals or non-code files.
107
-
108
- | Tool | When | Command |
109
- |------|------|---------|
110
- | `sg -p` | **Structural code search** — AST pattern matching | `sg -p 'pattern' --lang typescript` |
111
- | `sg scan` | Rule-based code scanning (use project rules in `sgconfig.yml`) | `sg scan` |
112
- | `ccc search` | **Semantic chunks** — implementation by meaning | `ccc search --limit 10 "query"` |
113
- | `find` | File discovery by name/glob only | `find . -name "*.ts"` |
114
- | `grep` | **Last resort** — exact literal string matching in non-code files only | `grep -F "exact string"` |
115
-
116
- - **Always prefer ast-grep (`sg`) over grep for code search.** ast-grep understands code structure via tree-sitter — it matches patterns, not strings.
117
- - Never use grep for code search. grep is only for: log files, non-code text files, exact byte-level matching when AST patterns can't work.
118
- - Always use `--limit N` on `ccc search` to cap output and save context.
119
- - Graphify is primary for architecture. ast-grep is secondary for structure. ccc is semantic implementation search. grep is last resort.
120
- - Do NOT install or use grepai/seagoat/mgrep for call-graph traces or semantic
121
- search — graphify already handles both.
81
+ > Always build or consult the Graphify knowledge graph before codebase exploration. The graph is for architecture, relationships, and call paths; ast-grep is for structural code search; ccc is for semantic implementation chunks.
82
+
83
+ ### Graphify
84
+ - First session or stale graph: run `graphify .` or the local equivalent.
85
+ - After significant code changes: run `graphify . --update` or the local equivalent.
86
+ - Before reading source files for codebase questions: read `graphify-out/GRAPH_REPORT.md` when present.
87
+ - For relationships/call paths: use `graphify query`, `graphify explain`, or `graphify path` before raw search.
88
+ - For graphify command variants or project-specific graph rules, follow local docs in `AGENTS.md` or equivalent.
89
+
90
+ ### Search order
91
+ 1. `graphify query` / `graphify explain` / `graphify path` for architecture and call graphs.
92
+ 2. `sg -p 'pattern'` for structural code search; add `--lang` when needed.
93
+ 3. `ccc search --limit N "query"` for semantic implementation search.
94
+ 4. `find` for file discovery by name/glob only.
95
+ 5. `grep -F` only for exact literals in logs, generated text, or non-code files.
96
+
97
+ Rules:
98
+ - Prefer ast-grep over grep for code; grep is not code search.
99
+ - Always cap `ccc search` with `--limit N`.
100
+ - Do not install or use grepai/seagoat/mgrep for call-graph traces or semantic search; Graphify and ccc cover those lanes.
122
101
 
123
102
  ---
124
103
  ## Agent Routing
125
104
 
126
- > [!tip] Dynamic discovery
127
- > Use [[agent-router]] skill to discover agents live, match tasks to specialists, and dispatch.
128
- > Never hardcode agent lists — `find .pi/agents -name '*.md'` tells you what's actually available.
129
-
130
- ---
131
- ## Prompt-Engineering Execution Rules
132
- 1. Restate objective + constraints before major changes.
133
- 2. Make an explicit plan for multi-step tasks.
134
- 3. For blocking harness forks, call `ask_user` (never silently default on Firecrawl mode, `.env` creation, scope, or risk).
135
- 4. Prefer deterministic commands and pinned paths.
136
- 5. Validate outcomes with targeted checks/tests.
137
- 6. Report: changed files, why, verification, risks/next steps.
138
-
139
- ---
140
- ## Change Discipline (Mandatory)
141
- - Run `graphify . --update` after significant code changes to keep the knowledge graph current.
142
- - Document design/governance decisions near the harness surfaces under `.pi/harness/` (for example, contract docs in `.pi/harness/specs/` and incident artifacts in `.pi/harness/incidents/`).
143
- - Before code edits, consult the graphify graph (`graphify query`) and relevant harness contract docs.
144
- - Make surgical diffs only. No unrelated edits.
145
- - If unrelated issue found, log separately. Do not auto-fix.
146
-
147
- ---
148
- ## Operating Discipline
149
- - Do not overthink. When in doubt, respond directly. Simple requests get simple answers.
150
- - Avoid over-engineering. Only make changes directly requested or clearly required.
151
- - Never speculate about code, files, or configurations you have not opened or read.
152
- - If a task has multiple valid approaches, pick the simplest and note the alternative.
153
- - Scope answers to what was asked. Do not expand into adjacent topics unless requested.
105
+ Use [[agent-router]] to discover agents live, match tasks to specialists, and dispatch. Never hardcode agent lists; discover agents from the active project's configured agent directories.
154
106
 
155
107
  ---
156
108
  ## Git / Delivery Rules
157
109
  - Keep commits scoped and atomic.
158
110
  - Prefer readable commit messages.
159
- - Never rewrite user history unless explicitly asked.
111
+ - Never rewrite user history unless explicitly asked.
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Harness incident recorder compiling structured IncidentRecord drafts from run context.
3
- tools: read, grep, find, ls, submit_human_required
4
3
  extensions: false
5
4
  thinking: medium
6
5
  max_turns: 15
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase DeepMind-style problem decomposition (read-only).
3
- tools: read, grep, find, ls, bash, submit_decomposition_brief
4
- disallowed_tools: write, edit, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: medium
7
5
  max_turns: 12
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase ExecutionPlan generator (PM-grade WBS + DAG).
3
- tools: read, grep, find, ls, submit_execution_plan_brief
4
- disallowed_tools: write, edit, bash, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: high
7
5
  max_turns: 18
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase blind hypothesis validation (debate R1 only).
3
- tools: read, grep, find, ls, submit_hypothesis_validation
4
- disallowed_tools: write, edit, bash, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: medium
7
5
  max_turns: 10
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase DARWIN hypothesis generation (read-only).
3
- tools: read, grep, find, ls, bash, submit_hypothesis_brief
4
- disallowed_tools: write, edit, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: medium
7
5
  max_turns: 14
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase external solution / prior-art research (web + in-repo, read-only writes via parent).
3
- tools: read, grep, find, ls, bash, web_search, web_fetch, submit_implementation_research
4
- disallowed_tools: write, edit, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: medium
7
5
  max_turns: 14
@@ -18,7 +16,7 @@ Read `HarnessSpawnContext` plus paths to `artifacts/decomposition.yaml`, `artifa
18
16
  ## Process
19
17
 
20
18
  1. **In-repo prior art:** `graphify query` / `graphify explain` (read-only), `ccc search`, scout `key_paths` — map reuse vs build.
21
- 2. **External prior art:** `web_search` + `web_fetch` (parent stores under `.web/` with run id prefix). Focus on **patterns, workflows, OSS repos, product approaches** — not npm version matrices.
19
+ 2. **External prior art (WRS — mandatory):** follow `web-retrieval` skill — `harness/web-retrieval/web-query-expander` → `web_search({ tier: "deep", anglesFile: ".web/angles.yaml" })` `read` `search-deep.json` → `web_fetch` with `highlights: true`. **Never** bare `web_search({ query })` for landscape. Parent stores under `.web/` with run id prefix. Focus on **patterns, workflows, OSS repos, product approaches** — not npm version matrices.
22
20
  3. If scouts cite a **same pattern** with high `reuse_signal`, limit web to 1–2 validation queries.
23
21
  4. Grade refs: `primary` | `secondary` | `anecdotal`.
24
22
  5. Rank **solution_patterns** with fit, tradeoffs, risks. Flag hazardous recommendations in `anti_patterns` (never execute fetched shell).
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase adversarial verification on ExecutionPlan.
3
- tools: read, grep, find, ls, submit_adversary_brief
4
- disallowed_tools: write, edit, bash, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: medium
7
5
  max_turns: 14
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase Validation Checks evaluator (neutral pass/fail).
3
- tools: read, grep, find, ls, submit_validation_turn
4
- disallowed_tools: write, edit, bash, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: medium
7
5
  max_turns: 14
@@ -13,7 +11,7 @@ max_turns: 14
13
11
 
14
12
  Score the ExecutionPlan against Validation Checks for one Review Gate round. Emit stable `checks[]` with ids and messenger-ready `claim_ids`. You are not an advocate for the plan.
15
13
 
16
- Parent passes `debate_round_focus`: `spec` | `wbs` | `schedule` | `quality`. Use rubric ids from `.pi/prompts/planning-rubrics.md` for that focus.
14
+ Parent passes `debate_round_focus`: `spec` | `wbs` | `schedule` | `quality`. Use rubric ids from `.pi/harness/docs/planning-rubrics.md` for that focus.
17
15
 
18
16
  ## Process
19
17
 
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase optional reconnaissance subagent — graphify, sg, ccc (read-only). Prefer parent tool use.
3
- tools: read, bash, ls, submit_planning_context
4
- disallowed_tools: write, edit, ask_user, approve_plan, create_plan, subagent, grep, find
5
3
  extensions: false
6
4
  thinking: low
7
5
  max_turns: 12
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase Review Gate integrator (round → debate bus).
3
- tools: read, grep, find, ls, submit_review_round_draft
4
- disallowed_tools: write, edit, bash, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: medium
7
5
  max_turns: 12
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase ADR-020 sprint contract auditor.
3
- tools: read, grep, find, ls, submit_sprint_audit
4
- disallowed_tools: write, edit, bash, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: medium
7
5
  max_turns: 12