ultimate-pi 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/.agents/skills/harness-debate-plan/SKILL.md +1 -1
  2. package/.agents/skills/harness-decisions/SKILL.md +2 -3
  3. package/.agents/skills/harness-governor/SKILL.md +6 -5
  4. package/.agents/skills/harness-orchestration/SKILL.md +4 -4
  5. package/.agents/skills/harness-review/SKILL.md +7 -7
  6. package/.agents/skills/harness-sentrux-setup/SKILL.md +4 -3
  7. package/.agents/skills/harness-steer/SKILL.md +1 -1
  8. package/.agents/skills/sentrux/SKILL.md +9 -9
  9. package/.pi/PACKAGING.md +4 -4
  10. package/.pi/SYSTEM.md +54 -120
  11. package/.pi/agents/harness/incident-recorder.md +0 -1
  12. package/.pi/agents/harness/planning/decompose.md +1 -3
  13. package/.pi/agents/harness/planning/execution-plan-author.md +0 -2
  14. package/.pi/agents/harness/planning/hypothesis-validator.md +0 -2
  15. package/.pi/agents/harness/planning/hypothesis.md +0 -2
  16. package/.pi/agents/harness/planning/implementation-researcher.md +0 -2
  17. package/.pi/agents/harness/planning/plan-adversary.md +0 -2
  18. package/.pi/agents/harness/planning/plan-evaluator.md +1 -3
  19. package/.pi/agents/harness/planning/planning-context.md +0 -2
  20. package/.pi/agents/harness/planning/review-integrator.md +0 -2
  21. package/.pi/agents/harness/planning/sprint-contract-auditor.md +0 -2
  22. package/.pi/agents/harness/planning/stack-researcher.md +0 -2
  23. package/.pi/agents/harness/{adversary.md → reviewing/adversary.md} +0 -2
  24. package/.pi/agents/harness/{evaluator.md → reviewing/evaluator.md} +0 -2
  25. package/.pi/agents/harness/{tie-breaker.md → reviewing/tie-breaker.md} +0 -2
  26. package/.pi/agents/harness/{executor.md → running/executor.md} +0 -2
  27. package/.pi/agents/harness/sentrux-bootstrap.md +0 -1
  28. package/.pi/agents/harness/sentrux-steward.md +0 -2
  29. package/.pi/agents/harness/trace-librarian.md +0 -1
  30. package/.pi/extensions/00-harness-project-control.ts +133 -0
  31. package/.pi/extensions/00-posthog-network-bootstrap.ts +1 -1
  32. package/.pi/extensions/agt-kill-switch.ts +57 -0
  33. package/.pi/extensions/agt-prompt-guard.ts +32 -0
  34. package/.pi/extensions/budget-guard.ts +2 -0
  35. package/.pi/extensions/custom-footer.ts +46 -145
  36. package/.pi/extensions/custom-header.ts +1 -1
  37. package/.pi/extensions/custom-system-prompt.ts +1 -1
  38. package/.pi/extensions/debate-orchestrator.ts +7 -5
  39. package/.pi/extensions/harness-ask-user.ts +8 -8
  40. package/.pi/extensions/harness-debate-tools.ts +27 -43
  41. package/.pi/extensions/harness-lens.ts +94 -0
  42. package/.pi/extensions/harness-live-widget.ts +33 -2
  43. package/.pi/extensions/harness-plan-approval.ts +12 -12
  44. package/.pi/extensions/harness-run-context.ts +1214 -852
  45. package/.pi/extensions/harness-subagent-governance.ts +8 -0
  46. package/.pi/extensions/harness-subagent-submit.ts +36 -164
  47. package/.pi/extensions/harness-subagents.ts +4 -4
  48. package/.pi/extensions/harness-telemetry.ts +3 -1
  49. package/.pi/extensions/harness-web-tools.ts +3 -3
  50. package/.pi/extensions/observation-bus.ts +2 -0
  51. package/.pi/extensions/policy-gate.ts +27 -5
  52. package/.pi/extensions/review-integrity.ts +91 -10
  53. package/.pi/extensions/sentrux-rules-sync.ts +3 -1
  54. package/.pi/extensions/subagent-governance.ts +92 -0
  55. package/.pi/extensions/test-diff-integrity.ts +1 -0
  56. package/.pi/extensions/trace-recorder.ts +3 -1
  57. package/.pi/extensions/{ultimate-pi-vcc.ts → vcc-compaction.ts} +1 -1
  58. package/.pi/harness/README.md +6 -2
  59. package/.pi/harness/agents.manifest.json +38 -49
  60. package/.pi/harness/agents.policy.yaml +275 -0
  61. package/.pi/harness/corpus/graphify-kb-updater.config.json +55 -0
  62. package/.pi/harness/docs/adrs/0006-sentrux-dual-layer.md +2 -1
  63. package/.pi/harness/docs/adrs/0030-inhouse-vcc-compaction.md +1 -1
  64. package/.pi/harness/docs/adrs/0035-plan-phase-review-gate.md +1 -1
  65. package/.pi/harness/docs/adrs/0044-harness-steer-loop.md +3 -2
  66. package/.pi/harness/docs/adrs/0045-harness-lens-minimal-contract.md +49 -0
  67. package/.pi/harness/docs/adrs/0045-phase-scoped-agent-directories.md +33 -0
  68. package/.pi/harness/docs/adrs/0046-agt-policy-engine.md +51 -0
  69. package/.pi/harness/docs/adrs/0047-agt-layered-security.md +39 -0
  70. package/.pi/harness/docs/adrs/0048-tool-call-hook-order.md +25 -0
  71. package/.pi/harness/docs/adrs/0049-agents-policy-manifest.md +36 -0
  72. package/.pi/harness/docs/adrs/README.md +6 -0
  73. package/.pi/harness/docs/graphify-kb-updater-runbook.md +11 -5
  74. package/.pi/harness/docs/practice-map.md +2 -2
  75. package/.pi/harness/evolution/README.md +1 -2
  76. package/.pi/harness/examples/agents.policy.project.yaml +19 -0
  77. package/.pi/harness/examples/policies/custom-deny-bash.yaml +9 -0
  78. package/.pi/harness/policies/bash-denylists.yaml +5 -0
  79. package/.pi/harness/policies/defaults.yaml +51 -0
  80. package/.pi/harness/policies/orchestrator.yaml +18 -0
  81. package/.pi/harness/policies/phases.yaml +10 -0
  82. package/.pi/harness/policies/roles.yaml +5 -0
  83. package/.pi/harness/policies/web-guard.yaml +5 -0
  84. package/.pi/harness/policies/workflow-sequences.yaml +9 -0
  85. package/.pi/harness/sentrux/architecture.manifest.json +26 -4
  86. package/.pi/harness/specs/harness-spawn-context.schema.json +1 -1
  87. package/.pi/harness/specs/observation.schema.json +2 -1
  88. package/.pi/lib/agents-policy.d.mts +70 -0
  89. package/.pi/lib/agents-policy.mjs +325 -0
  90. package/.pi/lib/agents-policy.ts +19 -0
  91. package/.pi/lib/agt/audit-run-sink.ts +52 -0
  92. package/.pi/lib/agt/build-evaluation-context.ts +285 -0
  93. package/.pi/lib/agt/config.ts +28 -0
  94. package/.pi/lib/agt/delegation.ts +69 -0
  95. package/.pi/lib/agt/evaluate-policy.ts +56 -0
  96. package/.pi/lib/agt/identity-registry.ts +41 -0
  97. package/.pi/lib/agt/index.ts +55 -0
  98. package/.pi/lib/agt/kill-switch-state.ts +11 -0
  99. package/.pi/lib/agt/legacy-evaluate.ts +101 -0
  100. package/.pi/lib/agt/policy-engine.ts +154 -0
  101. package/.pi/lib/agt/rings.ts +21 -0
  102. package/.pi/lib/agt/sre-hooks.ts +45 -0
  103. package/.pi/lib/agt/trust-run-store.ts +26 -0
  104. package/.pi/lib/agt/workflow-history.ts +29 -0
  105. package/.pi/lib/agt-governance-active.ts +14 -0
  106. package/.pi/lib/agt-tool-guard.ts +78 -0
  107. package/.pi/lib/ask-user/dialog.ts +314 -0
  108. package/.pi/{extensions/lib → lib}/debate-bus-core.ts +10 -10
  109. package/.pi/{extensions/lib → lib}/debate-bus-state.ts +1 -1
  110. package/.pi/{extensions/lib → lib}/extension-load-guard.ts +21 -0
  111. package/.pi/lib/harness-agt-tool-guard.ts +5 -0
  112. package/.pi/{extensions/lib → lib}/harness-artifact-gate.ts +6 -16
  113. package/.pi/lib/harness-debate-core-deps.ts +14 -0
  114. package/.pi/lib/harness-debate-workflow-deps.ts +43 -0
  115. package/.pi/lib/harness-lens/.gitattributes +1 -0
  116. package/.pi/lib/harness-lens/clients/edit-autopatch.ts +88 -0
  117. package/.pi/lib/harness-lens/clients/file-kinds.ts +380 -0
  118. package/.pi/lib/harness-lens/clients/file-time.ts +215 -0
  119. package/.pi/lib/harness-lens/clients/file-utils.ts +484 -0
  120. package/.pi/lib/harness-lens/clients/format-service.ts +276 -0
  121. package/.pi/lib/harness-lens/clients/formatters.ts +1000 -0
  122. package/.pi/lib/harness-lens/clients/git-guard.ts +31 -0
  123. package/.pi/lib/harness-lens/clients/indent-retarget.ts +90 -0
  124. package/.pi/lib/harness-lens/clients/installer/index.ts +2368 -0
  125. package/.pi/lib/harness-lens/clients/latency-logger.ts +80 -0
  126. package/.pi/lib/harness-lens/clients/lens-config.ts +43 -0
  127. package/.pi/lib/harness-lens/clients/lens-events.ts +164 -0
  128. package/.pi/lib/harness-lens/clients/lsp/aggregation.ts +91 -0
  129. package/.pi/lib/harness-lens/clients/lsp/client.ts +1466 -0
  130. package/.pi/lib/harness-lens/clients/lsp/config.ts +216 -0
  131. package/.pi/lib/harness-lens/clients/lsp/edits.ts +297 -0
  132. package/.pi/lib/harness-lens/clients/lsp/index.ts +1355 -0
  133. package/.pi/lib/harness-lens/clients/lsp/interactive-install.ts +424 -0
  134. package/.pi/lib/harness-lens/clients/lsp/language.ts +223 -0
  135. package/.pi/lib/harness-lens/clients/lsp/launch.ts +939 -0
  136. package/.pi/lib/harness-lens/clients/lsp/lsp-index.ts +11 -0
  137. package/.pi/lib/harness-lens/clients/lsp/path-utils.ts +12 -0
  138. package/.pi/lib/harness-lens/clients/lsp/server-strategies.ts +81 -0
  139. package/.pi/lib/harness-lens/clients/lsp/server.ts +1971 -0
  140. package/.pi/lib/harness-lens/clients/path-utils.ts +182 -0
  141. package/.pi/lib/harness-lens/clients/pipeline.ts +360 -0
  142. package/.pi/lib/harness-lens/clients/project-profile.ts +117 -0
  143. package/.pi/lib/harness-lens/clients/runtime-agent-end.ts +112 -0
  144. package/.pi/lib/harness-lens/clients/runtime-config.ts +33 -0
  145. package/.pi/lib/harness-lens/clients/runtime-coordinator.ts +186 -0
  146. package/.pi/lib/harness-lens/clients/runtime-tool-result.ts +171 -0
  147. package/.pi/lib/harness-lens/clients/safe-spawn.ts +339 -0
  148. package/.pi/lib/harness-lens/clients/secrets-scanner.ts +214 -0
  149. package/.pi/lib/harness-lens/clients/tool-policy.ts +2072 -0
  150. package/.pi/lib/harness-lens/clients/types.ts +59 -0
  151. package/.pi/lib/harness-lens/clients/widget-state.ts +283 -0
  152. package/.pi/lib/harness-lens/index.ts +532 -0
  153. package/.pi/lib/harness-lens/tools/lsp-diagnostics.ts +706 -0
  154. package/.pi/lib/harness-lens/tools/lsp-navigation.ts +1246 -0
  155. package/.pi/{extensions/lib → lib}/harness-posthog.ts +3 -0
  156. package/.pi/lib/harness-project-config.ts +91 -0
  157. package/.pi/lib/harness-run-context-responses.ts +9 -0
  158. package/.pi/lib/harness-run-context.ts +1 -3
  159. package/.pi/{extensions/lib/spawn-policy.ts → lib/harness-spawn-policy.ts} +4 -3
  160. package/.pi/{extensions/lib → lib}/harness-spawn-topology.ts +5 -28
  161. package/.pi/lib/harness-subagent-auth.ts +51 -0
  162. package/.pi/{extensions/lib → lib}/harness-subagent-precheck.ts +13 -10
  163. package/.pi/{extensions/lib → lib}/harness-subagent-submit-pipeline.ts +3 -3
  164. package/.pi/lib/harness-subagent-submit-register.ts +163 -0
  165. package/.pi/{extensions/lib → lib}/harness-subagent-submit-registry.ts +1 -55
  166. package/.pi/{extensions/lib → lib}/harness-subagents-bridge.ts +53 -14
  167. package/.pi/{extensions/lib → lib}/harness-subprocess-bootstrap.ts +1 -1
  168. package/.pi/lib/harness-ui-state.ts +27 -12
  169. package/.pi/{extensions/lib → lib}/plan-approval/create-plan.ts +2 -2
  170. package/.pi/{extensions/lib → lib}/plan-approval/format-plan.ts +2 -2
  171. package/.pi/{extensions/lib → lib}/plan-approval/plan-review.ts +162 -201
  172. package/.pi/{extensions/lib → lib}/plan-approval/render.ts +1 -1
  173. package/.pi/{extensions/lib → lib}/plan-approval/resolve-disk.ts +2 -2
  174. package/.pi/{extensions/lib → lib}/plan-approval/types.ts +1 -1
  175. package/.pi/{extensions/lib → lib}/plan-approval/validate.ts +3 -3
  176. package/.pi/{extensions/lib → lib}/plan-approval-readiness.ts +3 -52
  177. package/.pi/{extensions/lib → lib}/plan-debate-envelope.ts +1 -1
  178. package/.pi/{extensions/lib → lib}/plan-debate-gate.ts +1 -1
  179. package/.pi/{extensions/lib → lib}/plan-debate-lane.ts +1 -4
  180. package/.pi/{extensions/lib → lib}/plan-messenger.ts +1 -1
  181. package/.pi/prompts/harness-auto.md +2 -2
  182. package/.pi/prompts/harness-plan.md +4 -6
  183. package/.pi/prompts/harness-review.md +9 -9
  184. package/.pi/prompts/harness-run.md +7 -7
  185. package/.pi/prompts/harness-setup.md +42 -68
  186. package/.pi/prompts/harness-steer.md +2 -2
  187. package/.pi/scripts/README.md +3 -5
  188. package/.pi/scripts/generate-agents-policy-yaml.mjs +148 -0
  189. package/.pi/scripts/graphify-kb-updater.mjs +48 -8
  190. package/.pi/scripts/harness-agents-manifest.mjs +61 -4
  191. package/.pi/scripts/harness-agt-doctor.ts +36 -0
  192. package/.pi/scripts/harness-cli-verify.sh +9 -2
  193. package/.pi/scripts/harness-project-toggle.mjs +129 -0
  194. package/.pi/scripts/harness-sentrux-cli.mjs +142 -0
  195. package/.pi/scripts/harness-verify.mjs +113 -39
  196. package/.pi/scripts/harness-web-policy-guard.mjs +2 -2
  197. package/.pi/scripts/validate-plan-dag.mjs +65 -74
  198. package/.pi/scripts/vendor-pi-vcc-settings.stub.ts +2 -2
  199. package/.pi/scripts/vendor-sync-pi-vcc.sh +1 -1
  200. package/.pi/skills/architecture/broker-domain/SKILL.md +65 -0
  201. package/.pi/skills/architecture/cqrs/SKILL.md +63 -0
  202. package/.pi/skills/architecture/event-driven/SKILL.md +60 -0
  203. package/.pi/skills/architecture/hexagonal-ports-adapters/SKILL.md +66 -0
  204. package/.pi/skills/architecture/layered/SKILL.md +68 -0
  205. package/.pi/skills/architecture/microkernel/SKILL.md +62 -0
  206. package/.pi/skills/architecture/microservices/SKILL.md +64 -0
  207. package/.pi/skills/architecture/modular-monolith/SKILL.md +65 -0
  208. package/.pi/skills/architecture/orchestration-driven-soa/SKILL.md +61 -0
  209. package/.pi/skills/architecture/pipeline/SKILL.md +63 -0
  210. package/.pi/skills/architecture/service-based/SKILL.md +64 -0
  211. package/.pi/skills/architecture/service-mesh/SKILL.md +60 -0
  212. package/.pi/skills/architecture/space-based/SKILL.md +60 -0
  213. package/.pi/skills/ast-grep/SKILL.md +40 -321
  214. package/.pi/skills/delivery/debugging-discipline/SKILL.md +36 -0
  215. package/.pi/skills/delivery/documentation-update/SKILL.md +33 -0
  216. package/.pi/skills/delivery/requirements-to-implementation/SKILL.md +34 -0
  217. package/.pi/skills/delivery/risk-based-verification/SKILL.md +43 -0
  218. package/.pi/skills/delivery/tradeoff-analysis/SKILL.md +34 -0
  219. package/.pi/skills/engineering/api-contract-design/SKILL.md +38 -0
  220. package/.pi/skills/engineering/cohesion-coupling/SKILL.md +43 -0
  221. package/.pi/skills/engineering/complexity-control/SKILL.md +31 -0
  222. package/.pi/skills/engineering/defensive-programming/SKILL.md +38 -0
  223. package/.pi/skills/engineering/dependency-management/SKILL.md +29 -0
  224. package/.pi/skills/engineering/domain-modeling/SKILL.md +32 -0
  225. package/.pi/skills/engineering/error-handling/SKILL.md +37 -0
  226. package/.pi/skills/engineering/legacy-code-seams/SKILL.md +35 -0
  227. package/.pi/skills/engineering/naming-and-intent/SKILL.md +29 -0
  228. package/.pi/skills/engineering/refactoring-safe-evolution/SKILL.md +35 -0
  229. package/.pi/skills/engineering/routine-function-design/SKILL.md +34 -0
  230. package/.pi/skills/engineering/small-change-discipline/SKILL.md +35 -0
  231. package/.pi/skills/lsp-navigation/SKILL.md +89 -0
  232. package/.pi/skills/quality/code-review-self-check/SKILL.md +35 -0
  233. package/.pi/skills/quality/privacy-data-handling/SKILL.md +26 -0
  234. package/.pi/skills/quality/security-review/SKILL.md +34 -0
  235. package/.pi/skills/quality/test-strategy/SKILL.md +33 -0
  236. package/.pi/skills/quality/testability-design/SKILL.md +33 -0
  237. package/.pi/skills/systems/concurrency-safety/SKILL.md +32 -0
  238. package/.pi/skills/systems/data-modeling-migrations/SKILL.md +31 -0
  239. package/.pi/skills/systems/observability-instrumentation/SKILL.md +32 -0
  240. package/.pi/skills/systems/performance-measurement/SKILL.md +35 -0
  241. package/.pi/skills/systems/reliability-design/SKILL.md +32 -0
  242. package/.sentrux/rules.toml +20 -4
  243. package/AGENTS.md +5 -0
  244. package/CHANGELOG.md +26 -0
  245. package/README.md +85 -58
  246. package/THIRD_PARTY_NOTICES.md +12 -21
  247. package/package.json +15 -7
  248. package/vendor/pi-subagents/src/agents.ts +45 -1
  249. package/vendor/pi-subagents/src/subagents.ts +866 -811
  250. package/vendor/pi-vcc/src/core/brief.ts +68 -99
  251. package/vendor/pi-vcc/src/core/settings.ts +2 -2
  252. package/.agents/skills/caveman/SKILL.md +0 -67
  253. package/.pi/agents/harness/meta-optimizer.md +0 -36
  254. package/.pi/agents/harness/planning/scout-graphify.md +0 -39
  255. package/.pi/agents/harness/planning/scout-semantic.md +0 -41
  256. package/.pi/agents/harness/planning/scout-structure.md +0 -37
  257. package/.pi/extensions/lib/ask-user/dialog.ts +0 -260
  258. package/.pi/extensions/lib/harness-subagent-auth.ts +0 -209
  259. package/.pi/extensions/lib/harness-subagent-policy.ts +0 -236
  260. package/.pi/extensions/pi-model-router-harness.ts +0 -42
  261. package/.pi/harness/evolution/meta-optimizer.mjs +0 -99
  262. package/.pi/harness/specs/router-tuning-proposal.schema.json +0 -114
  263. package/.pi/model-router.example.json +0 -36
  264. package/.pi/prompts/harness-critic.md +0 -10
  265. package/.pi/prompts/harness-eval.md +0 -10
  266. package/.pi/prompts/harness-router-tune.md +0 -52
  267. package/.pi/scripts/harness-generate-model-router.mjs +0 -327
  268. package/.pi/scripts/harness-model-router-routing.test.mjs +0 -97
  269. package/.pi/scripts/harness-sync-model-router.mjs +0 -97
  270. package/.pi/scripts/vendor-sync-pi-model-router.sh +0 -47
  271. package/vendor/pi-model-router/.prettierignore +0 -4
  272. package/vendor/pi-model-router/.prettierrc +0 -5
  273. package/vendor/pi-model-router/AGENTS.md +0 -39
  274. package/vendor/pi-model-router/LICENSE +0 -21
  275. package/vendor/pi-model-router/README.md +0 -99
  276. package/vendor/pi-model-router/UPSTREAM_PIN.md +0 -10
  277. package/vendor/pi-model-router/docs/ARCHITECTURE.md +0 -54
  278. package/vendor/pi-model-router/extensions/commands.ts +0 -720
  279. package/vendor/pi-model-router/extensions/config.ts +0 -348
  280. package/vendor/pi-model-router/extensions/constants.ts +0 -1
  281. package/vendor/pi-model-router/extensions/index.ts +0 -478
  282. package/vendor/pi-model-router/extensions/provider.ts +0 -580
  283. package/vendor/pi-model-router/extensions/routing.ts +0 -564
  284. package/vendor/pi-model-router/extensions/state.ts +0 -52
  285. package/vendor/pi-model-router/extensions/types.ts +0 -95
  286. package/vendor/pi-model-router/extensions/ui.ts +0 -144
  287. package/vendor/pi-model-router/model-router.example.json +0 -48
  288. package/vendor/pi-model-router/package.json +0 -48
  289. package/vendor/pi-model-router/tsconfig.json +0 -16
  290. /package/.pi/{prompts → harness/docs}/planning-rubrics.md +0 -0
  291. /package/.pi/{extensions/lib → lib}/ask-user/fallback.ts +0 -0
  292. /package/.pi/{extensions/lib → lib}/ask-user/render.ts +0 -0
  293. /package/.pi/{extensions/lib → lib}/ask-user/schema.ts +0 -0
  294. /package/.pi/{extensions/lib → lib}/ask-user/types.ts +0 -0
  295. /package/.pi/{extensions/lib → lib}/ask-user/validate-core.mjs +0 -0
  296. /package/.pi/{extensions/lib → lib}/ask-user/validate.ts +0 -0
  297. /package/.pi/{extensions/lib → lib}/harness-cocoindex-refresh.ts +0 -0
  298. /package/.pi/{extensions/lib → lib}/harness-paths.ts +0 -0
  299. /package/.pi/{extensions/lib → lib}/harness-spawn-budget.ts +0 -0
  300. /package/.pi/{extensions/lib → lib}/harness-vcc-settings.ts +0 -0
  301. /package/.pi/{extensions/lib → lib}/harness-web/run-cli.ts +0 -0
  302. /package/.pi/{extensions/lib → lib}/plan-approval/dialog.ts +0 -0
  303. /package/.pi/{extensions/lib → lib}/plan-approval/schema.ts +0 -0
  304. /package/.pi/{extensions/lib → lib}/plan-debate-eligibility.ts +0 -0
  305. /package/.pi/{extensions/lib → lib}/plan-debate-focus.ts +0 -0
  306. /package/.pi/{extensions/lib → lib}/plan-debate-id.ts +0 -0
  307. /package/.pi/{extensions/lib → lib}/plan-debate-lanes.ts +0 -0
  308. /package/.pi/{extensions/lib → lib}/plan-debate-round-status.ts +0 -0
  309. /package/.pi/{extensions/lib → lib}/plan-debate-write-guard.ts +0 -0
  310. /package/.pi/{extensions/lib → lib}/plan-review-gate.ts +0 -0
  311. /package/.pi/{extensions/lib → lib}/plan-review-integrator-rules.ts +0 -0
  312. /package/.pi/{extensions/lib → lib}/plan-scope-guard.ts +0 -0
  313. /package/.pi/{extensions/lib → lib}/posthog-client.ts +0 -0
  314. /package/.pi/{extensions/lib → lib}/posthog-node.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Pre-approve_plan readiness checks (artifacts, scouts, phase status).
2
+ * Pre-approve_plan readiness checks (planning context, research, phase status).
3
3
  */
4
4
 
5
5
  import { constants } from "node:fs";
@@ -13,12 +13,6 @@ export interface PlanApprovalReadiness {
13
13
  warnings: string[];
14
14
  }
15
15
 
16
- const LEGACY_SCOUT_ARTIFACTS = [
17
- "artifacts/scout-graphify.yaml",
18
- "artifacts/scout-structure.yaml",
19
- "artifacts/scout-semantic.yaml",
20
- ] as const;
21
-
22
16
  const PLANNING_CONTEXT_ARTIFACT = "artifacts/planning-context.yaml";
23
17
 
24
18
  const PHASE35_ARTIFACTS = [
@@ -86,44 +80,6 @@ function coverageLaneStatus(
86
80
  return String(laneDoc?.status ?? "").toLowerCase();
87
81
  }
88
82
 
89
- async function validateLegacyScouts(
90
- runDir: string,
91
- quick: boolean,
92
- errors: string[],
93
- warnings: string[],
94
- ): Promise<boolean> {
95
- let anyPresent = false;
96
- for (const rel of LEGACY_SCOUT_ARTIFACTS) {
97
- if (rel === "artifacts/scout-semantic.yaml" && quick) continue;
98
- const abs = join(runDir, rel);
99
- if (!(await fileExists(abs))) {
100
- const waived = await hasPhaseWaiver(runDir, `missing:${rel}`);
101
- if (!waived) {
102
- errors.push(`missing ${rel}`);
103
- }
104
- continue;
105
- }
106
- anyPresent = true;
107
- const doc = await readYamlObject(abs);
108
- const bad = artifactStatusBad(doc, rel);
109
- if (bad) {
110
- const waived = await hasPhaseWaiver(
111
- runDir,
112
- `scout:${rel}:${String(doc?.status ?? "")}`,
113
- );
114
- if (!waived) {
115
- errors.push(bad);
116
- }
117
- }
118
- }
119
- if (anyPresent) {
120
- warnings.push(
121
- "legacy scout YAML artifacts detected — prefer artifacts/planning-context.yaml (see ADR 0041)",
122
- );
123
- }
124
- return anyPresent;
125
- }
126
-
127
83
  async function validatePlanningContext(
128
84
  runDir: string,
129
85
  quick: boolean,
@@ -203,19 +159,14 @@ export async function validatePlanApprovalReadiness(
203
159
  quick,
204
160
  errors,
205
161
  );
206
- const hasLegacyScouts = hasPlanningContext
207
- ? false
208
- : await validateLegacyScouts(runDir, quick, errors, warnings);
209
162
 
210
- if (!hasPlanningContext && !hasLegacyScouts) {
163
+ if (!hasPlanningContext) {
211
164
  const waived = await hasPhaseWaiver(
212
165
  runDir,
213
166
  "missing:planning-reconnaissance",
214
167
  );
215
168
  if (!waived) {
216
- errors.push(
217
- `missing ${PLANNING_CONTEXT_ARTIFACT} (or legacy scout-graphify/structure/semantic trio)`,
218
- );
169
+ errors.push(`missing ${PLANNING_CONTEXT_ARTIFACT}`);
219
170
  }
220
171
  }
221
172
 
@@ -2,7 +2,7 @@
2
2
  * Plan Review Gate — convert integrator YAML to debate bus round JSON.
3
3
  */
4
4
 
5
- import type { DebateParticipant } from "../../lib/debate-orchestrator-types.js";
5
+ import type { DebateParticipant } from "./debate-orchestrator-types.js";
6
6
 
7
7
  export interface PlanReviewRoundDraft {
8
8
  schema_version: string;
@@ -5,8 +5,8 @@
5
5
  import { constants } from "node:fs";
6
6
  import { access, readFile } from "node:fs/promises";
7
7
  import { join } from "node:path";
8
- import { isHarnessBudgetEnforceOn } from "../../lib/harness-budget-enforce.js";
9
8
  import { capsForDebate } from "./debate-bus-core.js";
9
+ import { isHarnessBudgetEnforceOn } from "./harness-budget-enforce.js";
10
10
  import type { DebateEligibilityResult } from "./plan-debate-eligibility.js";
11
11
  import {
12
12
  getPlanFocusCoverage,
@@ -5,10 +5,7 @@
5
5
  import { constants } from "node:fs";
6
6
  import { access, mkdir } from "node:fs/promises";
7
7
  import { dirname, join } from "node:path";
8
- import {
9
- parseStructuredDocument,
10
- writeYamlFile,
11
- } from "../../lib/harness-yaml.js";
8
+ import { parseStructuredDocument, writeYamlFile } from "./harness-yaml.js";
12
9
  import { postMessengerMessage } from "./plan-messenger.js";
13
10
 
14
11
  export type DebateLaneKind =
@@ -16,7 +16,7 @@ import {
16
16
  writeFile,
17
17
  } from "node:fs/promises";
18
18
  import { join } from "node:path";
19
- import type { DebateParticipant } from "../../lib/debate-orchestrator-types.js";
19
+ import type { DebateParticipant } from "./debate-orchestrator-types.js";
20
20
  import type { DebateProfile } from "./plan-debate-eligibility.js";
21
21
  import type { PlanDebateFocus } from "./plan-debate-focus.js";
22
22
 
@@ -21,7 +21,7 @@ If task missing:
21
21
  Follow **harness-plan** performance rules (`subagent` with `agentScope: "both"`). Use parallel `tasks` only for Phase 3.5 research (≤2 lanes) when subprocesses are needed. Never parallelize decompose∥hypothesis or debate lanes — precheck enforces this.
22
22
 
23
23
  1. **Plan** — follow `/harness-plan` (context → lakes/synthesis or sequential framing → research → plan-verify → `approve_plan()` + `create_plan()`). One approval.
24
- 2. **Execute** — `harness/executor` with `executor_strategy` from packet (default `single_pass` for low/med).
24
+ 2. **Execute** — `harness/running/executor` with `executor_strategy` from packet (default `single_pass` for low/med).
25
25
  3. **Review** — always **`/harness-review`** after execute (no benchmark fail-fast).
26
26
  4. **Steer loop** — while `review-outcome.remediation_class === implementation_gap` and `steer_attempt < HARNESS_STEER_MAX_ATTEMPTS`: `/harness-steer` → `/harness-review` (tiered adversary on attempts 2+).
27
27
  5. **Parent** — apply locked strict gates; commit/PR only when `remediation_class: pass`.
@@ -50,7 +50,7 @@ Block commit/PR if any fails: plan gate, execution in scope, evaluator pass, adv
50
50
  - `--quick` reduces breadth (skips semantic coverage in planning context, post-run adversary, tie-breaker), never core safety gates on plan approval or evaluator.
51
51
  - High risk/ambiguity → stop and recommend manual `/harness-plan` with `ask_user`.
52
52
  - Interrupt: `/harness-abort [reason]` then `/harness-plan`.
53
- - Artifact refs under active run dir; `/harness-run-status` or `/harness-trace-last` for handoff.
53
+ - Artifact refs under active run dir; use `/harness-trace` for handoff and forensics.
54
54
 
55
55
  ## Completion
56
56
 
@@ -26,8 +26,6 @@ Subagents persist artifacts via scoped **`submit_*`** tools (deterministic YAML
26
26
  - `harness/planning/sprint-contract-auditor` (DoD auditor)
27
27
  - `harness/planning/review-integrator` (recorder / integration PM)
28
28
 
29
- Legacy (deprecated, ADR 0041): `scout-graphify`, `scout-structure`, `scout-semantic` — do not spawn by default.
30
-
31
29
  Read **harness-debate-plan** skill before Review Gate rounds.
32
30
 
33
31
  ## Team topology (spawn laws)
@@ -72,16 +70,16 @@ Do **not** run `ccc index` or `ccc search --refresh`. The harness runs increment
72
70
  3. Use `ccc search` for semantic implementation matches (unless `--quick` — set `coverage.semantic.status: skipped`).
73
71
  4. Write `artifacts/planning-context.yaml` via `write_harness_yaml` with `schema_version: "1.0.0"`, `status`, `summary`, `coverage` (architecture + structure required; semantic per risk/quick), `findings`, `evidence_refs`, `open_questions`.
74
72
 
75
- **Optional subprocess:** Spawn **at most one** `harness/planning/planning-context` when the brief is large or you need context isolation. Do **not** spawn legacy `scout-*` agents in parallel by default.
73
+ **Optional subprocess:** Spawn **at most one** `harness/planning/planning-context` when the brief is large or you need context isolation.
76
74
 
77
- Gate: `harness_artifact_ready({ paths: ["artifacts/planning-context.yaml"] })` (legacy trio of `scout-*.yaml` still accepted for one release — see ADR 0041).
75
+ Gate: `harness_artifact_ready({ paths: ["artifacts/planning-context.yaml"] })`.
78
76
 
79
77
  ## Phase 2a — WBS / scope decomposition (sequential)
80
78
 
81
79
  **Practice:** PMBOK scope / WBS; Berkun — how the team divides work.
82
80
 
83
81
  ```
84
- subagent({ agentScope: "both", agent: "harness/planning/decompose", task: "<HarnessSpawnContext + path to planning-context.yaml or legacy scout artifacts>" })
82
+ subagent({ agentScope: "both", agent: "harness/planning/decompose", task: "<HarnessSpawnContext + path to planning-context.yaml>" })
85
83
  ```
86
84
 
87
85
  Gate: `harness_artifact_ready({ paths: ["artifacts/decomposition.yaml"] })`.
@@ -213,7 +211,7 @@ Med/low non-fork plans with clear stack and no implementation `open_questions` d
213
211
 
214
212
  ## Phase 5 — Structured inspection / Review Gate (Fagan-style)
215
213
 
216
- **Practice:** Code Complete collaborative construction; Fagan inspection with rubrics in `planning-rubrics.md`. Parent is **chair**; one debate agent per `subagent` batch.
214
+ **Practice:** Code Complete collaborative construction; Fagan inspection with rubrics in `.pi/harness/docs/planning-rubrics.md`. Parent is **chair**; one debate agent per `subagent` batch.
217
215
 
218
216
  **Forbidden:** parallel `subagent` calls for any debate lane agent in one batch.
219
217
 
@@ -13,9 +13,9 @@ Read **harness-orchestration** and **harness-review** skills before spawning.
13
13
 
14
14
  ## Allowed subagents
15
15
 
16
- - `harness/evaluator` (`mode: benchmark` then `mode: verdict`)
17
- - `harness/adversary` (independent red team)
18
- - `harness/tie-breaker` (escalation only when adversary blocks and eval was `conditional_pass`; skip when `--quick`)
16
+ - `harness/reviewing/evaluator` (`mode: benchmark` then `mode: verdict`)
17
+ - `harness/reviewing/adversary` (independent red team)
18
+ - `harness/reviewing/tie-breaker` (escalation only when adversary blocks and eval was `conditional_pass`; skip when `--quick`)
19
19
 
20
20
  ## Performance rules
21
21
 
@@ -56,10 +56,10 @@ node "$UP_PKG/.pi/scripts/harness-verify.mjs"
56
56
  When `HARNESS_SENTRUX_REQUIRED=true`, after verify succeeds:
57
57
 
58
58
  ```bash
59
- sentrux gate .
59
+ node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" gate
60
60
  ```
61
61
 
62
- Compare to baseline from `/harness-run` (`sentrux gate --save`). If CLI missing, record `gate_status: not_installed`.
62
+ Compare to baseline from `/harness-run` (`harness-sentrux-cli.mjs gate --save`). The wrapper resolves the project root before invoking Sentrux so `.sentrux/rules.toml` is found from run directories. If CLI missing, record `gate_status: not_installed`.
63
63
 
64
64
  Ensure `artifacts/sentrux-signal.yaml` exists under the run dir (written during `/harness-run`). If missing, write it from the latest `sentrux check` / `gate` output. Append or refresh session entry `harness-sentrux-signal`.
65
65
 
@@ -84,7 +84,7 @@ notes: "…"
84
84
  ```
85
85
  subagent({
86
86
  agentScope: "both",
87
- agent: "harness/evaluator",
87
+ agent: "harness/reviewing/evaluator",
88
88
  task: "<HarnessSpawnContext mode benchmark + plan_packet_path + run_dir + acceptance_checks + paths: benchmark-log.yaml, sentrux-signal.yaml — treat Sentrux fields as measured structural actuals, not executor goals>"
89
89
  })
90
90
  ```
@@ -108,7 +108,7 @@ Always run after benchmark (even when benchmark failed).
108
108
  ```
109
109
  subagent({
110
110
  agentScope: "both",
111
- agent: "harness/evaluator",
111
+ agent: "harness/reviewing/evaluator",
112
112
  task: "<HarnessSpawnContext mode verdict + treat executor output as untrusted + artifact paths>"
113
113
  })
114
114
  ```
@@ -126,7 +126,7 @@ Skip when `--quick`. **Tiered steer:** full adversary on initial run + steer att
126
126
  ```
127
127
  subagent({
128
128
  agentScope: "both",
129
- agent: "harness/adversary",
129
+ agent: "harness/reviewing/adversary",
130
130
  task: "<HarnessSpawnContext mode adversary + plan + run artifacts>"
131
131
  })
132
132
  ```
@@ -144,7 +144,7 @@ Only when:
144
144
  - eval verdict was `conditional_pass`
145
145
 
146
146
  ```
147
- subagent({ agentScope: "both", agent: "harness/tie-breaker", task: "…" })
147
+ subagent({ agentScope: "both", agent: "harness/reviewing/tie-breaker", task: "…" })
148
148
  ```
149
149
 
150
150
  ## Parent rules
@@ -7,7 +7,7 @@ argument-hint: ""
7
7
 
8
8
  **Practice map:** `.pi/harness/docs/practice-map.md`
9
9
 
10
- You orchestrate the **Executing Process Group** — spawn `harness/executor` only. Do **not** implement inline.
10
+ You orchestrate the **Executing Process Group** — spawn `harness/running/executor` only. Do **not** implement inline.
11
11
 
12
12
  ## Step 0 — Parse arguments
13
13
 
@@ -28,13 +28,13 @@ Refuse if `plan_ready` is false.
28
28
 
29
29
  **Practice:** Fitness functions (architecture governance) — save structural baseline before the executor mutates the tree.
30
30
 
31
- When `HARNESS_SENTRUX_REQUIRED=true` (see `.env.example`), from **project root**:
31
+ When `HARNESS_SENTRUX_REQUIRED=true` (see `.env.example`), run the bundled root-resolving wrapper:
32
32
 
33
33
  ```bash
34
- sentrux gate --save .
34
+ node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" gate --save
35
35
  ```
36
36
 
37
- If `sentrux` is not installed, note `gate_baseline: skipped` in run notes and continue (harness-verify may still pass rules-sync checks).
37
+ The wrapper passes the resolved project root explicitly so Sentrux can find `.sentrux/rules.toml` even if the active shell is under `.pi/harness/runs/*`. If `sentrux` is not installed, note `gate_baseline: skipped` in run notes and continue (harness-verify may still pass rules-sync checks).
38
38
 
39
39
  Do **not** ask the executor to optimize Sentrux metrics — observation is for `/harness-review` only.
40
40
 
@@ -48,7 +48,7 @@ Do **not** ask the executor to optimize Sentrux metrics — observation is for `
48
48
  4. Spawn (max **1** agent per call):
49
49
 
50
50
  ```
51
- subagent({ agentScope: "both", agent: "harness/executor", task: "<HarnessSpawnContext + handoff + critical path hint>" })
51
+ subagent({ agentScope: "both", agent: "harness/running/executor", task: "<HarnessSpawnContext + handoff + critical path hint>" })
52
52
  ```
53
53
 
54
54
  5. Parse subprocess output JSON (`execution_status`, validations, rollback refs) from tool result text.
@@ -61,8 +61,8 @@ subagent({ agentScope: "both", agent: "harness/executor", task: "<HarnessSpawnCo
61
61
  After executor subprocess completes:
62
62
 
63
63
  ```bash
64
- sentrux check .
65
- sentrux gate .
64
+ node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" check
65
+ node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" gate
66
66
  ```
67
67
 
68
68
  - If `sentrux check` exits non-zero or `gate` reports degradation → set `execution_status: scope_drift` (or `blocked` if unrecoverable); parent runs **`/harness-review`** next (not immediate replan).
@@ -14,7 +14,6 @@ Bootstraps the complete ultimate-pi agentic harness: Graphify knowledge graph, C
14
14
  | Pitfall | Correct approach |
15
15
  |---------|------------------|
16
16
  | `UP_PKG="$(pwd)"` in an **external** repo | Wrong — scripts live in the npm package. Resolve via `harness-resolve-up-pkg.mjs` (see Step 0). |
17
- | Provider detection from `OPENAI_*` / `ANTHROPIC_*` env only | Wrong for pi users — keys live in `~/.pi/agent/auth.json`. Use `harness-generate-model-router.mjs` (Pi `ModelRegistry.getAvailable()`). |
18
17
  | Re-running 2.1–2.8 manually after CLI verify | Wasteful — trust `harness-cli-verify.sh` output; only fix reported ✗ lines. |
19
18
  | Overwriting `AGENTS.md` after graphify | Graphify appends a section — **merge**, do not replace (Step 4.3). |
20
19
  | `sentrux-rules-sync` without project manifest | Use **`harness-sentrux-bootstrap.mjs`** (Step 4.2) — seeds manifest + idempotent rules sync. |
@@ -154,9 +153,9 @@ bash "$UP_PKG/.pi/scripts/harness-cli-verify.sh"
154
153
  # Reinstall everything: bash "$UP_PKG/.pi/scripts/harness-cli-verify.sh" --force
155
154
  ```
156
155
 
157
- **Required (script must exit 0):** scrapling + harness-web smoke, ctx7, biome, ast-grep (`sg`), sentrux (when harness manifest present).
156
+ **Required (script must exit 0):** scrapling + harness-web smoke, ctx7, ast-grep (`sg`), sentrux (when harness manifest present).
158
157
 
159
- **Warnings allowed:** gh (if not authenticated), agent-browser (if OS libs need manual `sudo apt-get install`), cocoindex-code (empty corpus on tiny repos; first `[full]` install downloads local embedding model).
158
+ **Warnings allowed:** biome (optional; skipped for non-JS/TS repos or if install fails), gh (if not authenticated), agent-browser (if OS libs need manual `sudo apt-get install`), cocoindex-code (empty corpus on tiny repos; first `[full]` install downloads local embedding model).
160
159
 
161
160
  If the script reports **agent-browser shared library errors** on Linux/WSL, run the fix it prints, then re-verify:
162
161
 
@@ -251,21 +250,21 @@ ccc status
251
250
 
252
251
  Verify: `ccc doctor` and `ccc search --limit 3 "export function"` (no `--refresh`).
253
252
 
254
- ### 2.5 — biome (Lint + Format Gate)
253
+ ### 2.5 — biome (Optional, JS/TS-focused lint + format)
255
254
 
256
- ```bash
257
- if ! command -v biome &>/dev/null || [ "$FORCE" = "true" ]; then
258
- npm install -g @biomejs/biome
259
- fi
260
- ```
255
+ Biome is **not a hard requirement** for harness setup. Install/use it when the target project is JS/TS (for example, has `package.json` or already uses `biome.json`). For other stacks, skip and use the repo's native formatter/linter.
261
256
 
262
- Check if project already has biome config:
263
257
  ```bash
264
- ls biome.json 2>/dev/null && echo "biome.json found — using project config" || echo "No biome.json using defaults"
258
+ if [ -f package.json ] || [ -f biome.json ]; then
259
+ if ! command -v biome &>/dev/null || [ "$FORCE" = "true" ]; then
260
+ npm install -g @biomejs/biome
261
+ fi
262
+ biome --version
263
+ else
264
+ echo "Skipping biome (non-JS/TS repo; optional tool)"
265
+ fi
265
266
  ```
266
267
 
267
- Verify: `biome --version`
268
-
269
268
  ### 2.6 — ast-grep (AST-Aware Structural Code Search)
270
269
 
271
270
  ```bash
@@ -327,7 +326,14 @@ sentrux plugin add-standard 2>/dev/null || echo "Plugins already installed or fa
327
326
 
328
327
  ## Step 3 — Pi Extension Packages
329
328
 
330
- Bundled extensions load from the installed `ultimate-pi` package. **Session-locked model routing** comes from a **vendored** fork of [`yeliu84/pi-model-router`](https://github.com/yeliu84/pi-model-router) in `vendor/pi-model-router/`, wired through [`.pi/extensions/pi-model-router-harness.ts`](.pi/extensions/pi-model-router-harness.ts). The router picks **one concrete model** when the session starts (from the first user prompt + system prompt complexity), then changes **thinking level only** each turn. The harness **gates** activation on `.pi/model-router.json` (Step **3.5** below) so `router/auto` cannot load prematurely. Attribution: see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) and `vendor/pi-model-router/UPSTREAM_PIN.md`. Maintainer refresh: `npm run vendor:sync-router`.
329
+ Bundled extensions load from the installed `ultimate-pi` package. The harness lens wrapper at `.pi/extensions/harness-lens.ts` loads `.pi/extensions/lib/harness-lens/` for edit autopatch, secrets blocking, deferred format, and LSP tools. Structural search uses shell `sg` (installed globally by setup); architecture gates use Sentrux. See [ADR 0045](.pi/harness/docs/adrs/0045-harness-lens-minimal-contract.md).
330
+
331
+ Harness lens findings are **complementary** to Sentrux:
332
+
333
+ - **Harness lens:** fast edit-time and turn-time code feedback; standalone lens widgets/health telemetry are disabled, and findings flow through the harness PostHog telemetry layer.
334
+ - **Sentrux:** architecture-quality signal and gate (`.sentrux/rules.toml`, `sentrux-signal.yaml`, harness review/evaluate inputs).
335
+
336
+ Do not treat harness lens as a replacement for Sentrux. If a future lens change adds architecture-boundary gating that duplicates Sentrux, keep Sentrux authoritative and disable/remove the overlapping lens path.
331
337
 
332
338
  Optionally install the companion lockfile used in development:
333
339
 
@@ -341,57 +347,25 @@ else
341
347
  fi
342
348
  ```
343
349
 
344
- Merge extension entries from `$UP_PKG/.pi/settings.example.json` into this project's `.pi/settings.json` `packages` array (add any missing `npm:…` entries; keep existing user packages). **Do not add** `npm:@yeliu84/pi-model-router` (superseded by the vendored router).
350
+ Merge extension entries from `$UP_PKG/.pi/settings.example.json` into this project's `.pi/settings.json` `packages` array (add any missing `npm:…` entries; keep existing user packages).
345
351
 
346
352
  Verify each package:
347
353
 
348
354
  | Package | Purpose | Phase |
349
355
  |---------|---------|-------|
350
356
  | `@posthog/pi` | Analytics event capture | F0 |
351
- | `pi-lean-ctx` | Context runtime (read/bash/find/grep/MCP bridge) | F0 |
357
+ | `context-mode` | Context runtime and MCP context-saving tools | F0 |
352
358
  | `harness-subagents` (bundled extension) | L4 `subagent` tool, subprocess spawns, package agents | P16 |
353
359
  | Vendored `pi-vcc` (`vendor/pi-vcc`, `.pi/extensions/ultimate-pi-vcc.ts`) | VCC compaction / `vcc_recall` — env-only: `HARNESS_VCC_COMPACTION` (default on), `HARNESS_VCC_DEBUG` | Shipped |
354
- | `pi-model-router` | Vendored (`vendor/`); activates after `.pi/model-router.json` exists | F0 |
355
-
356
- ## Step 3.5 — Model Router Configuration (Dynamic)
357
-
358
- `.pi/model-router.json` is **user-specific** (gitignored). Generate from **Pi authenticated providers** (`~/.pi/agent/auth.json`, OAuth, env) — **not** env-var guessing alone.
359
-
360
- Pi API (see `packages/coding-agent` docs / SDK example `02-custom-model.ts`):
361
-
362
- - `AuthStorage.create()` → credentials store
363
- - `ModelRegistry.create(authStorage)` → registry
364
- - `await modelRegistry.getAvailable()` → models with working auth (same as interactive pi)
365
-
366
- ```bash
367
- # Verify vendored extension source ships with ultimate-pi
368
- ls "$UP_PKG/vendor/pi-model-router/extensions/index.ts" 2>/dev/null \
369
- && echo "✓ vendored pi-model-router" \
370
- || echo "✗ missing vendor/pi-model-router"
371
-
372
- # Generate from Pi registry (skips if .pi/model-router.json exists; --force to regenerate)
373
- node "$UP_PKG/.pi/scripts/harness-generate-model-router.mjs"
374
- # Preview only: node "$UP_PKG/.pi/scripts/harness-generate-model-router.mjs" --dry-run
375
-
376
- # Merge router defaults after config exists (never adds npm packages — router is vendored)
377
- node "$UP_PKG/.pi/scripts/harness-sync-model-router.mjs"
378
- ```
379
-
380
- If generation prints "No authenticated Pi providers": warn in report — user should run **`/login`** in pi (or `pi login`) then re-run Step 3.5. Do **not** infer providers from `OPENAI_API_KEY` alone; pi sessions often use `opencode-go` via auth.json without those env vars.
381
-
382
- Do NOT block setup. If no config is written, `harness-sync-model-router.mjs` clears a premature `defaultProvider: "router"` in `.pi/settings.json`.
383
-
384
- **Router onboarding** — The vendored extension starts only after `.pi/model-router.json` appears. Running the script above prepares that file plus optional Pi defaults (**`router` / `auto`**, or whatever `defaultProfile` is) via `harness-sync-model-router.mjs` when `defaultProvider` was unset—then **`/reload`**. Generated profiles use **one model SKU per profile**; high/medium/low tiers differ in **thinking** only. Subagents resolve their subprocess model from the **agent system prompt** complexity (same lock rules).
385
-
386
- Manual override: **`/router profile auto`** or **`/router profile opencode-go`** anytime after reload if they changed defaults.
360
+ | Harness lens (`.pi/extensions/harness-lens.ts` → `.pi/extensions/lib/harness-lens/index.ts`) | Edit autopatch, secrets block, deferred format, LSP tools; PostHog lens telemetry; Sentrux remains architecture gate; `sg` is shell-only | F0 |
387
361
 
388
- ## Step 3.6 — Harness agents (package-resolved)
362
+ ## Step 3.5 — Harness agents (package-resolved)
389
363
 
390
- `harness-subagents` loads agents from the installed **`ultimate-pi`** package (`$UP_PKG/.pi/agents/**`) with namespaced ids (`harness/executor`, `harness/planning/scout-graphify`, `pi-pi/agent-expert`). **Do not copy** agents into the project unless you want a deliberate override.
364
+ `harness-subagents` loads agents from the installed **`ultimate-pi`** package (`$UP_PKG/.pi/agents/**`) with namespaced ids (`harness/running/executor`, `harness/reviewing/evaluator`, `pi-pi/agent-expert`). **Do not copy** agents into the project unless you want a deliberate override.
391
365
 
392
366
  **Slash commands are orchestrators:** `/harness-plan`, `/harness-run`, etc. spawn `harness/*` agents via the `Agent` tool — bootstrap stays **script-first**; only optionally spawn `harness/sentrux-bootstrap` for Sentrux (see Step 4.2).
393
367
 
394
- Optional per-repo overrides: place `.md` files at the **same relative path** (e.g. `.pi/agents/harness/planning/scout-graphify.md` overrides the package scout).
368
+ Optional per-repo overrides: place `.md` files at the **same relative path** (e.g. `.pi/agents/harness/running/executor.md` overrides the package executor).
395
369
 
396
370
  Verify manifest drift after `pi update ultimate-pi`:
397
371
 
@@ -500,10 +474,9 @@ Ensure `.gitignore` contains harness runtime entries (see repo root `.gitignore`
500
474
  !.pi/harness/incidents/README.md
501
475
  .pi/harness/debates/*
502
476
  !.pi/harness/debates/README.md
503
- .pi/harness/router/proposals/*
504
477
 
505
- # Model router config (user-specific generated from env)
506
- .pi/model-router.json
478
+ # Harness lens runtime config/cache and local diagnostics state
479
+ .pi/harness/.lens/
507
480
 
508
481
  # sentrux baselines and local meta (rules.toml is committed)
509
482
  .sentrux/*
@@ -531,18 +504,19 @@ node "$UP_PKG/.pi/scripts/harness-sentrux-bootstrap.mjs" --force
531
504
  | `harness-sentrux-bootstrap.mjs` (no flags) | `/harness-setup`, first install, re-run safe |
532
505
  | `harness-sentrux-bootstrap.mjs --force` | Manifest layers/boundaries/constraints changed |
533
506
  | `sentrux-rules-sync.mjs --check` | CI / harness-verify drift only |
507
+ | `harness-sentrux-cli.mjs check` / `gate` | Root-resolving Sentrux checks from harness run dirs |
534
508
  | `/harness-sentrux-sync` | Interactive re-sync from pi |
535
509
 
536
510
  `harness-seed-project-contracts.mjs` (Step 0.5) may copy `architecture.manifest.json` early; bootstrap still personalizes `project` on first seed and writes `rules.toml`.
537
511
 
538
512
  Verify rules:
539
513
  ```bash
540
- sentrux check . && echo "✓ sentrux rules pass" || echo "✗ sentrux check failed"
514
+ node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" check && echo "✓ sentrux rules pass" || echo "✗ sentrux check failed"
541
515
  ```
542
516
 
543
517
  Set up structural regression baseline (optional):
544
518
  ```bash
545
- sentrux gate --save . 2>/dev/null || echo "Baseline will be saved on first gate run"
519
+ node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" gate --save 2>/dev/null || echo "Baseline will be saved on first gate run"
546
520
  ```
547
521
 
548
522
  ### 4.3 — Project AGENTS.md
@@ -563,7 +537,7 @@ Created: $(date +%Y-%m-%d)
563
537
  - .pi/harness/specs/ → Harness contracts and schema docs
564
538
  - .pi/harness/incidents/ → Incident and override records
565
539
  - `.agents/skills/` (npm package) → Harness skills (no copy into `.pi/skills/` needed)
566
- - `.pi/agents/` → Optional per-repo agent overrides (package agents load automatically — see Step 3.6)
540
+ - `.pi/agents/` → Optional per-repo agent overrides (package agents load automatically — see Step 3.5)
567
541
 
568
542
  ## Graphify-First Workflow
569
543
 
@@ -579,7 +553,7 @@ Created: $(date +%Y-%m-%d)
579
553
  - Decisions and incidents in `.pi/harness/` with structured artifacts
580
554
  - `GRAPHIFY_VIZ_NODE_LIMIT=200000 graphify update .` after significant code changes
581
555
  - ast-grep (`sg`) is the default code search tool — use `sg -p 'pattern'` for structural search, never grep for code
582
- - Create `.sg/rules/` for project-wide code quality rules
556
+ - Use shell `sg` for structural search; project-specific ast-grep rule dirs are optional in the **target repo**, not a harness template default
583
557
  ```
584
558
 
585
559
  ## Step 5 — Verification
@@ -626,10 +600,11 @@ print(f'✓ knowledge graph built ({n} nodes)' if n else '✗ graph.json has 0 n
626
600
  " 2>/dev/null || echo "✗ no graph built yet"
627
601
  graphify hook status 2>/dev/null && echo "✓ graphify git hooks installed" || echo "✗ graphify git hooks not installed"
628
602
 
629
- # vendored model router
630
- ls "$UP_PKG/vendor/pi-model-router/extensions/index.ts" 2>/dev/null \
631
- && echo "✓ vendored pi-model-router" || echo "✗ vendor/pi-model-router missing"
632
- ls .pi/model-router.json 2>/dev/null && echo "✓ model-router config" || echo "✗ model-router config"
603
+ # harness lens extension
604
+ ls "$UP_PKG/.pi/extensions/harness-lens.ts" 2>/dev/null \
605
+ && echo "✓ harness lens wrapper" || echo "✗ harness lens wrapper missing"
606
+ ls "$UP_PKG/.pi/extensions/lib/harness-lens/index.ts" 2>/dev/null \
607
+ && echo "✓ harness lens upstream pin" || echo "✗ harness lens upstream pin missing"
633
608
 
634
609
  # raw folder for graphify sources
635
610
  ls -d ./raw 2>/dev/null && echo "✓ ./raw directory exists" || echo "! ./raw directory missing"
@@ -671,13 +646,13 @@ Output summary table:
671
646
  | ctx7 | ✓/✗ | Login: yes/no |
672
647
  | agent-browser | ✓/✗ | Config: .pi/harness/browser.json |
673
648
  | cocoindex-code | ✓/✗ | `ccc status`; index auto-refreshed before harness scouts |
674
- | biome | ✓/✗ | Project config: found/default |
649
+ | biome | ✓/✗/skip | Optional; JS/TS-focused (skip on non-JS/TS stacks) |
675
650
  | ast-grep | ✓/✗ | AST-aware code search (`sg`)
676
651
  | gh CLI | ✓/✗ | Auth: yes/no |
677
652
  | sentrux | ✓/✗ | CLI + plugins; rules via Step 4.2 bootstrap |
678
653
  | Sentrux rules.toml | ✓/✗ | `.sentrux/rules.toml` synced from manifest |
679
- | pi extensions | ✓/✗ | 4 packages |
680
- | model router | ✓/✗ | Package + config verified, activation via `/router profile auto` (or `opencode-go`) |
654
+ | pi extensions | ✓/✗ | bundled extensions + harness lens wrapper |
655
+ | harness lens | ✓/✗ | `.pi/extensions/harness-lens.ts`; PostHog owns lens telemetry; complements Sentrux architecture signal |
681
656
  | `.env` | ✓/✗/ask | Created / keys appended / user declined |
682
657
 
683
658
  | .gitignore | ✓/✗ | entries added (incl. `.env`) |
@@ -727,11 +702,10 @@ Next steps:
727
702
  | gh not installed | Show GitHub CLI install link. Skip label creation. |
728
703
  | pi packages install fail | Show error output. Check npm permissions. |
729
704
  | graph already exists | Report node count. Refresh with `graphify update .` unless user passed `--force`. |
730
- | biome.json missing | Create minimal config. |
705
+ | biome.json missing | No action required. Biome is optional; use project-native tooling. |
731
706
  | settings.json not writable | Warn. Settings won't persist across sessions. |
732
707
  | No internet | Block for tool installs. Continue for graphify-only steps if `--skip-tools`. |
733
708
  | sentrux install fails | Show install script output. Fallback: download from https://github.com/sentrux/sentrux/releases/latest |
734
- | No model-router.json / "No authenticated Pi providers" | Run `/login` in pi, then `node "$UP_PKG/.pi/scripts/harness-generate-model-router.mjs" --force` |
735
709
  | UP_PKG not found | `pi install npm:ultimate-pi` or `npm i -g ultimate-pi`; verify with `node "$UP_PKG/.pi/scripts/harness-resolve-up-pkg.mjs"` |
736
710
  | No `.env` at project root | `ask_user` create vs skip; on create: `harness-sync-env.mjs --create-missing` |
737
711
 
@@ -19,8 +19,8 @@ Thin orchestrator for the **steer loop** (ADR 0044). Run only after `/harness-re
19
19
  2. Update `artifacts/steer-state.yaml` (`attempt`, `max_attempts`, `active: true`).
20
20
  3. Set policy phase to **execute** before spawning executor (required for mutating tools).
21
21
  4. One `ask_user` steer gate unless `run-context.steer_approved` is already true.
22
- 5. Spawn **`harness/executor`** with `HarnessSpawnContext.mode: repair` and `repair_brief_path: artifacts/repair-brief.yaml`.
23
- 6. Optional: `sentrux gate --save .` after repair to refresh baseline (ADR 0044).
22
+ 5. Spawn **`harness/running/executor`** with `HarnessSpawnContext.mode: repair` and `repair_brief_path: artifacts/repair-brief.yaml`.
23
+ 6. Optional: `node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" gate --save` after repair to refresh baseline (ADR 0044).
24
24
  7. `next_command`: **`/harness-review`** (always re-verify; tiered adversary on attempts 2+ per practice-map).
25
25
 
26
26
  ## Forbidden
@@ -14,7 +14,7 @@ UP_PKG="$(node -p "require('path').dirname(require.resolve('ultimate-pi/package.
14
14
 
15
15
  **Developing this repo** (clone of `ultimate-pi`): from the repo root, `UP_PKG="$(pwd)"` (or the same `require.resolve` after `npm install`).
16
16
 
17
- From **Typescript extensions**, use `resolveHarnessScript()` / `getHarnessPackageRoot()` in `.pi/extensions/lib/harness-paths.ts`.
17
+ From **Typescript extensions**, use `resolveHarnessScript()` / `getHarnessPackageRoot()` in `.pi/lib/harness-paths.ts`.
18
18
 
19
19
  ## Invocations (from the consuming project root)
20
20
 
@@ -27,12 +27,10 @@ From **Typescript extensions**, use `resolveHarnessScript()` / `getHarnessPackag
27
27
  | Sentrux rules bootstrap (harness-setup) | `node "$UP_PKG/.pi/scripts/harness-sentrux-bootstrap.mjs"` |
28
28
  | Sentrux rules re-sync after manifest edit | `node "$UP_PKG/.pi/scripts/harness-sentrux-bootstrap.mjs" --force` or `/harness-sentrux-sync` |
29
29
  | Sentrux rules drift check (CI) | `node "$UP_PKG/.pi/scripts/sentrux-rules-sync.mjs" --check` |
30
+ | Sentrux run/review check or gate (root-resolving) | `node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" check` / `gate [--save]` |
30
31
  | Resolve package root (`UP_PKG`) | `node "$UP_PKG/.pi/scripts/harness-resolve-up-pkg.mjs"` |
31
- | Model-router config (Pi auth) | `node "$UP_PKG/.pi/scripts/harness-generate-model-router.mjs"` |
32
32
  | Project `.env` (append-only) | `node "$UP_PKG/.pi/scripts/harness-sync-env.mjs"` (`--create-missing` after user confirms) |
33
- | Model-router / Pi defaults | `harness-sync-model-router.mjs` (Step 3.5 of `/harness-setup`) |
34
- | Vendor router sync (this repo only) | `bash .pi/scripts/vendor-sync-pi-model-router.sh` or `npm run vendor:sync-router` |
35
- | Meta-optimizer (JSONL proposals) | `node "$UP_PKG/.pi/harness/evolution/meta-optimizer.mjs"` |
33
+ | Harness lens extension | `.pi/extensions/harness-lens.ts` → `.pi/lib/harness-lens/index.ts` (loaded by `.pi/extensions`; PostHog owns lens telemetry) |
36
34
 
37
35
  Pass `--force` to shell scripts that support it (e.g. `harness-graphify-bootstrap.sh --force`, `harness-cli-verify.sh --force`).
38
36