ultimate-pi 0.18.1 → 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 (284) 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/.pi/PACKAGING.md +4 -4
  5. package/.pi/SYSTEM.md +54 -120
  6. package/.pi/agents/harness/incident-recorder.md +0 -1
  7. package/.pi/agents/harness/planning/decompose.md +0 -2
  8. package/.pi/agents/harness/planning/execution-plan-author.md +0 -2
  9. package/.pi/agents/harness/planning/hypothesis-validator.md +0 -2
  10. package/.pi/agents/harness/planning/hypothesis.md +0 -2
  11. package/.pi/agents/harness/planning/implementation-researcher.md +0 -2
  12. package/.pi/agents/harness/planning/plan-adversary.md +0 -2
  13. package/.pi/agents/harness/planning/plan-evaluator.md +1 -3
  14. package/.pi/agents/harness/planning/planning-context.md +0 -2
  15. package/.pi/agents/harness/planning/review-integrator.md +0 -2
  16. package/.pi/agents/harness/planning/sprint-contract-auditor.md +0 -2
  17. package/.pi/agents/harness/planning/stack-researcher.md +0 -2
  18. package/.pi/agents/harness/reviewing/adversary.md +0 -2
  19. package/.pi/agents/harness/reviewing/evaluator.md +0 -2
  20. package/.pi/agents/harness/reviewing/tie-breaker.md +0 -2
  21. package/.pi/agents/harness/running/executor.md +0 -2
  22. package/.pi/agents/harness/sentrux-bootstrap.md +0 -1
  23. package/.pi/agents/harness/sentrux-steward.md +0 -2
  24. package/.pi/agents/harness/trace-librarian.md +0 -1
  25. package/.pi/extensions/00-posthog-network-bootstrap.ts +1 -1
  26. package/.pi/extensions/agt-kill-switch.ts +57 -0
  27. package/.pi/extensions/agt-prompt-guard.ts +32 -0
  28. package/.pi/extensions/custom-footer.ts +46 -145
  29. package/.pi/extensions/custom-header.ts +1 -1
  30. package/.pi/extensions/custom-system-prompt.ts +1 -1
  31. package/.pi/extensions/debate-orchestrator.ts +6 -6
  32. package/.pi/extensions/harness-ask-user.ts +7 -7
  33. package/.pi/extensions/harness-debate-tools.ts +26 -42
  34. package/.pi/extensions/harness-lens.ts +94 -0
  35. package/.pi/extensions/harness-plan-approval.ts +11 -11
  36. package/.pi/extensions/harness-run-context.ts +1070 -876
  37. package/.pi/extensions/harness-subagent-governance.ts +8 -0
  38. package/.pi/extensions/harness-subagent-submit.ts +34 -163
  39. package/.pi/extensions/harness-subagents.ts +3 -3
  40. package/.pi/extensions/harness-telemetry.ts +2 -2
  41. package/.pi/extensions/harness-web-tools.ts +2 -2
  42. package/.pi/extensions/policy-gate.ts +25 -5
  43. package/.pi/extensions/sentrux-rules-sync.ts +1 -1
  44. package/.pi/extensions/subagent-governance.ts +92 -0
  45. package/.pi/extensions/trace-recorder.ts +1 -1
  46. package/.pi/extensions/{ultimate-pi-vcc.ts → vcc-compaction.ts} +1 -1
  47. package/.pi/harness/README.md +6 -2
  48. package/.pi/harness/agents.manifest.json +22 -25
  49. package/.pi/harness/agents.policy.yaml +275 -0
  50. package/.pi/harness/docs/adrs/0030-inhouse-vcc-compaction.md +1 -1
  51. package/.pi/harness/docs/adrs/0035-plan-phase-review-gate.md +1 -1
  52. package/.pi/harness/docs/adrs/0045-harness-lens-minimal-contract.md +49 -0
  53. package/.pi/harness/docs/adrs/0046-agt-policy-engine.md +51 -0
  54. package/.pi/harness/docs/adrs/0047-agt-layered-security.md +39 -0
  55. package/.pi/harness/docs/adrs/0048-tool-call-hook-order.md +25 -0
  56. package/.pi/harness/docs/adrs/0049-agents-policy-manifest.md +36 -0
  57. package/.pi/harness/docs/adrs/README.md +5 -0
  58. package/.pi/harness/evolution/README.md +1 -2
  59. package/.pi/harness/examples/agents.policy.project.yaml +19 -0
  60. package/.pi/harness/examples/policies/custom-deny-bash.yaml +9 -0
  61. package/.pi/harness/policies/bash-denylists.yaml +5 -0
  62. package/.pi/harness/policies/defaults.yaml +51 -0
  63. package/.pi/harness/policies/orchestrator.yaml +18 -0
  64. package/.pi/harness/policies/phases.yaml +10 -0
  65. package/.pi/harness/policies/roles.yaml +5 -0
  66. package/.pi/harness/policies/web-guard.yaml +5 -0
  67. package/.pi/harness/policies/workflow-sequences.yaml +9 -0
  68. package/.pi/harness/sentrux/architecture.manifest.json +26 -4
  69. package/.pi/harness/specs/observation.schema.json +2 -1
  70. package/.pi/lib/agents-policy.d.mts +70 -0
  71. package/.pi/lib/agents-policy.mjs +325 -0
  72. package/.pi/lib/agents-policy.ts +19 -0
  73. package/.pi/lib/agt/audit-run-sink.ts +52 -0
  74. package/.pi/lib/agt/build-evaluation-context.ts +285 -0
  75. package/.pi/lib/agt/config.ts +28 -0
  76. package/.pi/lib/agt/delegation.ts +69 -0
  77. package/.pi/lib/agt/evaluate-policy.ts +56 -0
  78. package/.pi/lib/agt/identity-registry.ts +41 -0
  79. package/.pi/lib/agt/index.ts +55 -0
  80. package/.pi/lib/agt/kill-switch-state.ts +11 -0
  81. package/.pi/lib/agt/legacy-evaluate.ts +101 -0
  82. package/.pi/lib/agt/policy-engine.ts +154 -0
  83. package/.pi/lib/agt/rings.ts +21 -0
  84. package/.pi/lib/agt/sre-hooks.ts +45 -0
  85. package/.pi/lib/agt/trust-run-store.ts +26 -0
  86. package/.pi/lib/agt/workflow-history.ts +29 -0
  87. package/.pi/lib/agt-governance-active.ts +14 -0
  88. package/.pi/lib/agt-tool-guard.ts +78 -0
  89. package/.pi/lib/ask-user/dialog.ts +314 -0
  90. package/.pi/{extensions/lib → lib}/debate-bus-core.ts +10 -10
  91. package/.pi/{extensions/lib → lib}/debate-bus-state.ts +1 -1
  92. package/.pi/{extensions/lib → lib}/extension-load-guard.ts +13 -2
  93. package/.pi/lib/harness-agt-tool-guard.ts +5 -0
  94. package/.pi/{extensions/lib → lib}/harness-artifact-gate.ts +1 -1
  95. package/.pi/lib/harness-debate-core-deps.ts +14 -0
  96. package/.pi/lib/harness-debate-workflow-deps.ts +43 -0
  97. package/.pi/lib/harness-lens/.gitattributes +1 -0
  98. package/.pi/lib/harness-lens/clients/edit-autopatch.ts +88 -0
  99. package/.pi/lib/harness-lens/clients/file-kinds.ts +380 -0
  100. package/.pi/lib/harness-lens/clients/file-time.ts +215 -0
  101. package/.pi/lib/harness-lens/clients/file-utils.ts +484 -0
  102. package/.pi/lib/harness-lens/clients/format-service.ts +276 -0
  103. package/.pi/lib/harness-lens/clients/formatters.ts +1000 -0
  104. package/.pi/lib/harness-lens/clients/git-guard.ts +31 -0
  105. package/.pi/lib/harness-lens/clients/indent-retarget.ts +90 -0
  106. package/.pi/lib/harness-lens/clients/installer/index.ts +2368 -0
  107. package/.pi/lib/harness-lens/clients/latency-logger.ts +80 -0
  108. package/.pi/lib/harness-lens/clients/lens-config.ts +43 -0
  109. package/.pi/lib/harness-lens/clients/lens-events.ts +164 -0
  110. package/.pi/lib/harness-lens/clients/lsp/aggregation.ts +91 -0
  111. package/.pi/lib/harness-lens/clients/lsp/client.ts +1466 -0
  112. package/.pi/lib/harness-lens/clients/lsp/config.ts +216 -0
  113. package/.pi/lib/harness-lens/clients/lsp/edits.ts +297 -0
  114. package/.pi/lib/harness-lens/clients/lsp/index.ts +1355 -0
  115. package/.pi/lib/harness-lens/clients/lsp/interactive-install.ts +424 -0
  116. package/.pi/lib/harness-lens/clients/lsp/language.ts +223 -0
  117. package/.pi/lib/harness-lens/clients/lsp/launch.ts +939 -0
  118. package/.pi/lib/harness-lens/clients/lsp/lsp-index.ts +11 -0
  119. package/.pi/lib/harness-lens/clients/lsp/path-utils.ts +12 -0
  120. package/.pi/lib/harness-lens/clients/lsp/server-strategies.ts +81 -0
  121. package/.pi/lib/harness-lens/clients/lsp/server.ts +1971 -0
  122. package/.pi/lib/harness-lens/clients/path-utils.ts +182 -0
  123. package/.pi/lib/harness-lens/clients/pipeline.ts +360 -0
  124. package/.pi/lib/harness-lens/clients/project-profile.ts +117 -0
  125. package/.pi/lib/harness-lens/clients/runtime-agent-end.ts +112 -0
  126. package/.pi/lib/harness-lens/clients/runtime-config.ts +33 -0
  127. package/.pi/lib/harness-lens/clients/runtime-coordinator.ts +186 -0
  128. package/.pi/lib/harness-lens/clients/runtime-tool-result.ts +171 -0
  129. package/.pi/lib/harness-lens/clients/safe-spawn.ts +339 -0
  130. package/.pi/lib/harness-lens/clients/secrets-scanner.ts +214 -0
  131. package/.pi/lib/harness-lens/clients/tool-policy.ts +2072 -0
  132. package/.pi/lib/harness-lens/clients/types.ts +59 -0
  133. package/.pi/lib/harness-lens/clients/widget-state.ts +283 -0
  134. package/.pi/lib/harness-lens/index.ts +532 -0
  135. package/.pi/lib/harness-lens/tools/lsp-diagnostics.ts +706 -0
  136. package/.pi/lib/harness-lens/tools/lsp-navigation.ts +1246 -0
  137. package/.pi/{extensions/lib → lib}/harness-posthog.ts +3 -0
  138. package/.pi/lib/harness-run-context-responses.ts +9 -0
  139. package/.pi/lib/harness-run-context.ts +0 -2
  140. package/.pi/{extensions/lib/spawn-policy.ts → lib/harness-spawn-policy.ts} +1 -0
  141. package/.pi/{extensions/lib → lib}/harness-spawn-topology.ts +1 -1
  142. package/.pi/lib/harness-subagent-auth.ts +51 -0
  143. package/.pi/{extensions/lib → lib}/harness-subagent-precheck.ts +10 -7
  144. package/.pi/{extensions/lib → lib}/harness-subagent-submit-pipeline.ts +3 -3
  145. package/.pi/lib/harness-subagent-submit-register.ts +163 -0
  146. package/.pi/{extensions/lib → lib}/harness-subagent-submit-registry.ts +1 -37
  147. package/.pi/{extensions/lib → lib}/harness-subagents-bridge.ts +53 -14
  148. package/.pi/{extensions/lib → lib}/harness-subprocess-bootstrap.ts +1 -1
  149. package/.pi/{extensions/lib → lib}/plan-approval/create-plan.ts +2 -2
  150. package/.pi/{extensions/lib → lib}/plan-approval/format-plan.ts +2 -2
  151. package/.pi/{extensions/lib → lib}/plan-approval/plan-review.ts +162 -201
  152. package/.pi/{extensions/lib → lib}/plan-approval/render.ts +1 -1
  153. package/.pi/{extensions/lib → lib}/plan-approval/resolve-disk.ts +2 -2
  154. package/.pi/{extensions/lib → lib}/plan-approval/types.ts +1 -1
  155. package/.pi/{extensions/lib → lib}/plan-approval/validate.ts +3 -3
  156. package/.pi/{extensions/lib → lib}/plan-debate-envelope.ts +1 -1
  157. package/.pi/{extensions/lib → lib}/plan-debate-gate.ts +1 -1
  158. package/.pi/{extensions/lib → lib}/plan-debate-lane.ts +1 -4
  159. package/.pi/{extensions/lib → lib}/plan-messenger.ts +1 -1
  160. package/.pi/prompts/harness-plan.md +1 -1
  161. package/.pi/prompts/harness-setup.md +37 -64
  162. package/.pi/scripts/README.md +2 -5
  163. package/.pi/scripts/generate-agents-policy-yaml.mjs +148 -0
  164. package/.pi/scripts/harness-agents-manifest.mjs +60 -3
  165. package/.pi/scripts/harness-agt-doctor.ts +36 -0
  166. package/.pi/scripts/harness-cli-verify.sh +9 -2
  167. package/.pi/scripts/harness-verify.mjs +113 -39
  168. package/.pi/scripts/harness-web-policy-guard.mjs +2 -2
  169. package/.pi/scripts/validate-plan-dag.mjs +65 -74
  170. package/.pi/scripts/vendor-pi-vcc-settings.stub.ts +2 -2
  171. package/.pi/scripts/vendor-sync-pi-vcc.sh +1 -1
  172. package/.pi/skills/architecture/broker-domain/SKILL.md +65 -0
  173. package/.pi/skills/architecture/cqrs/SKILL.md +63 -0
  174. package/.pi/skills/architecture/event-driven/SKILL.md +60 -0
  175. package/.pi/skills/architecture/hexagonal-ports-adapters/SKILL.md +66 -0
  176. package/.pi/skills/architecture/layered/SKILL.md +68 -0
  177. package/.pi/skills/architecture/microkernel/SKILL.md +62 -0
  178. package/.pi/skills/architecture/microservices/SKILL.md +64 -0
  179. package/.pi/skills/architecture/modular-monolith/SKILL.md +65 -0
  180. package/.pi/skills/architecture/orchestration-driven-soa/SKILL.md +61 -0
  181. package/.pi/skills/architecture/pipeline/SKILL.md +63 -0
  182. package/.pi/skills/architecture/service-based/SKILL.md +64 -0
  183. package/.pi/skills/architecture/service-mesh/SKILL.md +60 -0
  184. package/.pi/skills/architecture/space-based/SKILL.md +60 -0
  185. package/.pi/skills/ast-grep/SKILL.md +40 -321
  186. package/.pi/skills/delivery/debugging-discipline/SKILL.md +36 -0
  187. package/.pi/skills/delivery/documentation-update/SKILL.md +33 -0
  188. package/.pi/skills/delivery/requirements-to-implementation/SKILL.md +34 -0
  189. package/.pi/skills/delivery/risk-based-verification/SKILL.md +43 -0
  190. package/.pi/skills/delivery/tradeoff-analysis/SKILL.md +34 -0
  191. package/.pi/skills/engineering/api-contract-design/SKILL.md +38 -0
  192. package/.pi/skills/engineering/cohesion-coupling/SKILL.md +43 -0
  193. package/.pi/skills/engineering/complexity-control/SKILL.md +31 -0
  194. package/.pi/skills/engineering/defensive-programming/SKILL.md +38 -0
  195. package/.pi/skills/engineering/dependency-management/SKILL.md +29 -0
  196. package/.pi/skills/engineering/domain-modeling/SKILL.md +32 -0
  197. package/.pi/skills/engineering/error-handling/SKILL.md +37 -0
  198. package/.pi/skills/engineering/legacy-code-seams/SKILL.md +35 -0
  199. package/.pi/skills/engineering/naming-and-intent/SKILL.md +29 -0
  200. package/.pi/skills/engineering/refactoring-safe-evolution/SKILL.md +35 -0
  201. package/.pi/skills/engineering/routine-function-design/SKILL.md +34 -0
  202. package/.pi/skills/engineering/small-change-discipline/SKILL.md +35 -0
  203. package/.pi/skills/lsp-navigation/SKILL.md +89 -0
  204. package/.pi/skills/quality/code-review-self-check/SKILL.md +35 -0
  205. package/.pi/skills/quality/privacy-data-handling/SKILL.md +26 -0
  206. package/.pi/skills/quality/security-review/SKILL.md +34 -0
  207. package/.pi/skills/quality/test-strategy/SKILL.md +33 -0
  208. package/.pi/skills/quality/testability-design/SKILL.md +33 -0
  209. package/.pi/skills/systems/concurrency-safety/SKILL.md +32 -0
  210. package/.pi/skills/systems/data-modeling-migrations/SKILL.md +31 -0
  211. package/.pi/skills/systems/observability-instrumentation/SKILL.md +32 -0
  212. package/.pi/skills/systems/performance-measurement/SKILL.md +35 -0
  213. package/.pi/skills/systems/reliability-design/SKILL.md +32 -0
  214. package/.sentrux/rules.toml +20 -4
  215. package/AGENTS.md +5 -0
  216. package/CHANGELOG.md +14 -0
  217. package/README.md +3 -12
  218. package/THIRD_PARTY_NOTICES.md +12 -21
  219. package/package.json +15 -7
  220. package/vendor/pi-subagents/src/agents.ts +45 -1
  221. package/vendor/pi-subagents/src/subagents.ts +866 -811
  222. package/vendor/pi-vcc/src/core/brief.ts +68 -99
  223. package/vendor/pi-vcc/src/core/settings.ts +2 -2
  224. package/.agents/skills/caveman/SKILL.md +0 -67
  225. package/.pi/agents/harness/meta-optimizer.md +0 -36
  226. package/.pi/extensions/lib/ask-user/dialog.ts +0 -260
  227. package/.pi/extensions/lib/harness-subagent-auth.ts +0 -207
  228. package/.pi/extensions/lib/harness-subagent-policy.ts +0 -236
  229. package/.pi/extensions/pi-model-router-harness.ts +0 -42
  230. package/.pi/harness/evolution/meta-optimizer.mjs +0 -99
  231. package/.pi/harness/specs/router-tuning-proposal.schema.json +0 -114
  232. package/.pi/model-router.example.json +0 -36
  233. package/.pi/prompts/harness-critic.md +0 -10
  234. package/.pi/prompts/harness-eval.md +0 -10
  235. package/.pi/prompts/harness-router-tune.md +0 -52
  236. package/.pi/scripts/harness-generate-model-router.mjs +0 -327
  237. package/.pi/scripts/harness-model-router-routing.test.mjs +0 -97
  238. package/.pi/scripts/harness-sync-model-router.mjs +0 -97
  239. package/.pi/scripts/vendor-sync-pi-model-router.sh +0 -47
  240. package/vendor/pi-model-router/.prettierignore +0 -4
  241. package/vendor/pi-model-router/.prettierrc +0 -5
  242. package/vendor/pi-model-router/AGENTS.md +0 -39
  243. package/vendor/pi-model-router/LICENSE +0 -21
  244. package/vendor/pi-model-router/README.md +0 -99
  245. package/vendor/pi-model-router/UPSTREAM_PIN.md +0 -10
  246. package/vendor/pi-model-router/docs/ARCHITECTURE.md +0 -54
  247. package/vendor/pi-model-router/extensions/commands.ts +0 -720
  248. package/vendor/pi-model-router/extensions/config.ts +0 -348
  249. package/vendor/pi-model-router/extensions/constants.ts +0 -1
  250. package/vendor/pi-model-router/extensions/index.ts +0 -478
  251. package/vendor/pi-model-router/extensions/provider.ts +0 -580
  252. package/vendor/pi-model-router/extensions/routing.ts +0 -564
  253. package/vendor/pi-model-router/extensions/state.ts +0 -52
  254. package/vendor/pi-model-router/extensions/types.ts +0 -95
  255. package/vendor/pi-model-router/extensions/ui.ts +0 -144
  256. package/vendor/pi-model-router/model-router.example.json +0 -48
  257. package/vendor/pi-model-router/package.json +0 -48
  258. package/vendor/pi-model-router/tsconfig.json +0 -16
  259. /package/.pi/{prompts → harness/docs}/planning-rubrics.md +0 -0
  260. /package/.pi/{extensions/lib → lib}/ask-user/fallback.ts +0 -0
  261. /package/.pi/{extensions/lib → lib}/ask-user/render.ts +0 -0
  262. /package/.pi/{extensions/lib → lib}/ask-user/schema.ts +0 -0
  263. /package/.pi/{extensions/lib → lib}/ask-user/types.ts +0 -0
  264. /package/.pi/{extensions/lib → lib}/ask-user/validate-core.mjs +0 -0
  265. /package/.pi/{extensions/lib → lib}/ask-user/validate.ts +0 -0
  266. /package/.pi/{extensions/lib → lib}/harness-cocoindex-refresh.ts +0 -0
  267. /package/.pi/{extensions/lib → lib}/harness-paths.ts +0 -0
  268. /package/.pi/{extensions/lib → lib}/harness-spawn-budget.ts +0 -0
  269. /package/.pi/{extensions/lib → lib}/harness-vcc-settings.ts +0 -0
  270. /package/.pi/{extensions/lib → lib}/harness-web/run-cli.ts +0 -0
  271. /package/.pi/{extensions/lib → lib}/plan-approval/dialog.ts +0 -0
  272. /package/.pi/{extensions/lib → lib}/plan-approval/schema.ts +0 -0
  273. /package/.pi/{extensions/lib → lib}/plan-approval-readiness.ts +0 -0
  274. /package/.pi/{extensions/lib → lib}/plan-debate-eligibility.ts +0 -0
  275. /package/.pi/{extensions/lib → lib}/plan-debate-focus.ts +0 -0
  276. /package/.pi/{extensions/lib → lib}/plan-debate-id.ts +0 -0
  277. /package/.pi/{extensions/lib → lib}/plan-debate-lanes.ts +0 -0
  278. /package/.pi/{extensions/lib → lib}/plan-debate-round-status.ts +0 -0
  279. /package/.pi/{extensions/lib → lib}/plan-debate-write-guard.ts +0 -0
  280. /package/.pi/{extensions/lib → lib}/plan-review-gate.ts +0 -0
  281. /package/.pi/{extensions/lib → lib}/plan-review-integrator-rules.ts +0 -0
  282. /package/.pi/{extensions/lib → lib}/plan-scope-guard.ts +0 -0
  283. /package/.pi/{extensions/lib → lib}/posthog-client.ts +0 -0
  284. /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
 
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,37 +1,44 @@
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 **`web_search` / `web_fetch`** via [[scrapling-web]] for non-API web. 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 — web_search + web_fetch
41
+ Use the harness web-search/fetch tools and the `scrapling-web` skill when available. No preflight: never probe package paths, list harness scripts, or import Scrapling before searching.
35
42
 
36
43
  | Task | Tool |
37
44
  |------|------|
@@ -39,121 +46,48 @@ See `.agents/skills/scrapling-web/SKILL.md`. **No preflight:** never resolve `UP
39
46
  | Scrape page | `web_fetch` (`url`, optional `fast: true`) |
40
47
  | Map links | `web_fetch` (`url`, `mode: map`) |
41
48
 
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/`.
49
+ - Artifacts default under the active project's `.web/`; use `read` for full JSON/markdown artifacts.
50
+ - If tools are unavailable, use the installed harness web fallback documented by the `scrapling-web` skill.
51
+ - Run setup diagnostics only when troubleshooting web tooling.
52
+ - Check local quality-site guidance when present before citing non-API sources. Prefer Tier 1 sources; exclude AI content farms, mirrors, and stale packages.
53
+ - For deep research, use `/wiki-autoresearch <topic>` when available and store outputs in the active project's configured research/wiki/graph locations.
47
54
 
48
55
  ### 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`
56
+ - harness-web / Scrapling missing: `uv tool install "scrapling[fetchers]" && scrapling install` then re-run the harness CLI verification command documented locally.
57
+ - Context7 missing: `npm install -g ctx7@latest`.
51
58
 
52
59
  ---
53
- ## Graphify-First Workflow (Mandatory)
60
+ ## Codebase Exploration Workflow
54
61
 
55
62
  > [!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.
63
+ > 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.
64
+
65
+ ### Graphify
66
+ - First session or stale graph: run `graphify .` or the local equivalent.
67
+ - After significant code changes: run `graphify . --update` or the local equivalent.
68
+ - Before reading source files for codebase questions: read `graphify-out/GRAPH_REPORT.md` when present.
69
+ - For relationships/call paths: use `graphify query`, `graphify explain`, or `graphify path` before raw search.
70
+ - For graphify command variants or project-specific graph rules, follow local docs in `AGENTS.md` or equivalent.
71
+
72
+ ### Search order
73
+ 1. `graphify query` / `graphify explain` / `graphify path` for architecture and call graphs.
74
+ 2. `sg -p 'pattern'` for structural code search; add `--lang` when needed.
75
+ 3. `ccc search --limit N "query"` for semantic implementation search.
76
+ 4. `find` for file discovery by name/glob only.
77
+ 5. `grep -F` only for exact literals in logs, generated text, or non-code files.
78
+
79
+ Rules:
80
+ - Prefer ast-grep over grep for code; grep is not code search.
81
+ - Always cap `ccc search` with `--limit N`.
82
+ - Do not install or use grepai/seagoat/mgrep for call-graph traces or semantic search; Graphify and ccc cover those lanes.
122
83
 
123
84
  ---
124
85
  ## Agent Routing
125
86
 
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.
87
+ 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
88
 
155
89
  ---
156
90
  ## Git / Delivery Rules
157
91
  - Keep commits scoped and atomic.
158
92
  - Prefer readable commit messages.
159
- - Never rewrite user history unless explicitly asked.
93
+ - 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
@@ -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
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Plan-phase stack research (ctx7 + web, read-only file writes via parent).
3
- tools: read, grep, find, ls, bash, web_search, web_fetch, submit_stack_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: 16
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  description: Adversarial harness reviewer focused on breaking assumptions and surfacing regressions.
3
- tools: read, grep, find, ls, submit_adversary_report
4
3
  extensions: false
5
- disallowed_tools: ask_user
6
4
  thinking: high
7
5
  max_turns: 20
8
6
  ---
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  description: Independent harness evaluator producing structured pass/fail verdicts.
3
- tools: read, grep, find, ls, submit_eval_verdict
4
3
  extensions: false
5
- disallowed_tools: ask_user
6
4
  thinking: high
7
5
  max_turns: 20
8
6
  ---
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  description: Final arbiter for unresolved evaluator vs adversary debates within budget limits.
3
- tools: read, grep, find, ls, submit_human_required
4
3
  extensions: false
5
- disallowed_tools: ask_user
6
4
  thinking: high
7
5
  max_turns: 15
8
6
  ---
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  description: Harness executor that implements only within approved PlanPacket scope.
3
- tools: read, write, edit, bash, grep, find, ls, submit_executor_handoff
4
3
  extensions: true
5
- disallowed_tools: ask_user
6
4
  thinking: medium
7
5
  max_turns: 20
8
6
  ---
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Bootstrap Sentrux rules for a harness project — seed architecture manifest, sync merge-safe rules.toml, verify sentrux check.
3
- tools: read, bash, grep, find, ls
4
3
  extensions: true
5
4
  thinking: low
6
5
  max_turns: 12
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  description: Propose architecture.manifest.json changes from graphify evidence (read-only governance steward).
3
- tools: read, grep, find, ls, bash, submit_sentrux_manifest_proposal
4
- disallowed_tools: write, edit, ask_user, approve_plan, create_plan, subagent
5
3
  extensions: false
6
4
  thinking: high
7
5
  max_turns: 16
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Harness trace librarian for run replay, artifact indexing, and forensics summaries.
3
- tools: read, grep, find, ls, submit_human_required
4
3
  extensions: false
5
4
  thinking: medium
6
5
  max_turns: 20
@@ -2,7 +2,7 @@
2
2
  * Load before other extensions: IPv4-first fetch for *.posthog.com (@posthog/pi uses global fetch).
3
3
  */
4
4
 
5
- import { installPostHogFetchPatch } from "./lib/posthog-client.js";
5
+ import { installPostHogFetchPatch } from "../lib/posthog-client.js";
6
6
 
7
7
  installPostHogFetchPatch();
8
8
 
@@ -0,0 +1,57 @@
1
+ /**
2
+ * AGT kill switch — arms on harness-abort and repeated policy denies (ADR 0047).
3
+ */
4
+
5
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
6
+ import { KillSwitch } from "@microsoft/agent-governance-sdk";
7
+ import { isHarnessProjectEnabled } from "../lib/harness-project-config.js";
8
+ import {
9
+ hasHarnessAbortSignal,
10
+ userVisiblePromptSlice,
11
+ } from "../lib/harness-run-context.js";
12
+
13
+ const killSwitch = new KillSwitch({ enabled: true });
14
+
15
+ import { recordHarnessPolicyDeny } from "../lib/agt/kill-switch-state.js";
16
+
17
+ export function getHarnessKillSwitch(): KillSwitch {
18
+ return killSwitch;
19
+ }
20
+
21
+ export function recordHarnessPolicyDenyForKillSwitch(sessionId: string): void {
22
+ const n = recordHarnessPolicyDeny(sessionId);
23
+ if (n >= 5) {
24
+ void killSwitch.kill(sessionId, {
25
+ reason: "Repeated harness policy denials",
26
+ });
27
+ }
28
+ }
29
+
30
+ export default function agtKillSwitch(pi: ExtensionAPI) {
31
+ if (!isHarnessProjectEnabled()) return;
32
+
33
+ pi.on("before_agent_start", async (event, ctx) => {
34
+ const prompt = userVisiblePromptSlice(event.prompt);
35
+ if (hasHarnessAbortSignal(prompt)) {
36
+ const sessionId = ctx.sessionManager.getSessionId();
37
+ await killSwitch.kill(sessionId, {
38
+ reason: "harness-abort command",
39
+ });
40
+ }
41
+ return undefined;
42
+ });
43
+
44
+ pi.on("tool_call", async (_event, ctx) => {
45
+ const sessionId = ctx.sessionManager.getSessionId();
46
+ const history = killSwitch.getHistory();
47
+ const armed = history.some((h) => h.agentId === sessionId);
48
+ if (armed) {
49
+ return {
50
+ block: true,
51
+ reason:
52
+ "agt-kill-switch: harness session halted after abort or repeated policy breaches.",
53
+ };
54
+ }
55
+ return undefined;
56
+ });
57
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * AGT PromptDefense heuristics on harness slash commands (ADR 0047).
3
+ */
4
+
5
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
6
+ import { PromptDefenseEvaluator } from "@microsoft/agent-governance-sdk";
7
+ import { isHarnessProjectEnabled } from "../lib/harness-project-config.js";
8
+ import { userVisiblePromptSlice } from "../lib/harness-run-context.js";
9
+
10
+ const evaluator = new PromptDefenseEvaluator({ minGrade: "D" });
11
+
12
+ export default function agtPromptGuard(pi: ExtensionAPI) {
13
+ if (!isHarnessProjectEnabled()) return;
14
+
15
+ pi.on("before_agent_start", async (event) => {
16
+ const prompt = userVisiblePromptSlice(event.prompt);
17
+ if (!prompt.trim()) return undefined;
18
+ if (!/\/harness-/.test(prompt)) return undefined;
19
+
20
+ const report = evaluator.evaluate(prompt);
21
+ if (report.isBlocking("D")) {
22
+ return {
23
+ message: {
24
+ customType: "harness-policy-violation",
25
+ display: true,
26
+ content: `agt-prompt-guard: prompt defense grade ${report.grade} (${report.score}). Missing defenses: ${report.missing.join(", ") || "see findings"}.`,
27
+ },
28
+ };
29
+ }
30
+ return undefined;
31
+ });
32
+ }