ultimate-pi 0.20.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/.agents/skills/harness-context/SKILL.md +3 -3
  2. package/.agents/skills/harness-debate-plan/SKILL.md +2 -2
  3. package/.agents/skills/harness-decisions/SKILL.md +68 -2
  4. package/.agents/skills/harness-eval/SKILL.md +1 -1
  5. package/.agents/skills/harness-git-commit/SKILL.md +72 -0
  6. package/.agents/skills/harness-governor/SKILL.md +6 -6
  7. package/.agents/skills/harness-ls-lint-setup/SKILL.md +59 -0
  8. package/.agents/skills/harness-orchestration/SKILL.md +4 -4
  9. package/.agents/skills/harness-plan/SKILL.md +14 -12
  10. package/.agents/skills/harness-review/SKILL.md +3 -3
  11. package/.agents/skills/harness-sentrux-repair/SKILL.md +48 -0
  12. package/.agents/skills/harness-sentrux-setup/SKILL.md +2 -2
  13. package/.agents/skills/harness-spec/SKILL.md +1 -1
  14. package/.agents/skills/harness-steer/SKILL.md +2 -2
  15. package/.agents/skills/posthog-analyst/SKILL.md +1 -1
  16. package/.agents/skills/sentrux/SKILL.md +6 -4
  17. package/.agents/skills/web-retrieval/SKILL.md +1 -1
  18. package/.agents/skills/wiki-save/SKILL.md +1 -1
  19. package/.pi/PACKAGING.md +6 -0
  20. package/.pi/SYSTEM.md +21 -3
  21. package/.pi/agents/harness/ls-lint-steward.md +49 -0
  22. package/.pi/agents/harness/planning/decompose.md +5 -5
  23. package/.pi/agents/harness/planning/execution-plan-author.md +1 -1
  24. package/.pi/agents/harness/planning/hypothesis-validator.md +1 -1
  25. package/.pi/agents/harness/planning/hypothesis.md +1 -1
  26. package/.pi/agents/harness/planning/plan-adversary.md +1 -1
  27. package/.pi/agents/harness/planning/plan-evaluator.md +2 -2
  28. package/.pi/agents/harness/planning/plan-synthesizer.md +2 -2
  29. package/.pi/agents/harness/planning/review-integrator.md +1 -1
  30. package/.pi/agents/harness/planning/sprint-contract-auditor.md +5 -5
  31. package/.pi/agents/harness/reviewing/evaluator.md +1 -1
  32. package/.pi/agents/harness/running/executor.md +2 -2
  33. package/.pi/agents/harness/sentrux-repair-advisor.md +50 -0
  34. package/.pi/agents/harness/sentrux-steward.md +2 -2
  35. package/.pi/agents/pi-pi/prompt-expert.md +17 -2
  36. package/.pi/auto-commit.json +9 -2
  37. package/.pi/extensions/debate-orchestrator.ts +3 -0
  38. package/.pi/extensions/harness-anchored-edit.ts +7 -9
  39. package/.pi/extensions/harness-ask-user.ts +13 -34
  40. package/.pi/extensions/harness-debate-tools.ts +43 -4
  41. package/.pi/extensions/harness-live-widget.ts +28 -19
  42. package/.pi/extensions/harness-run-context.ts +278 -115
  43. package/.pi/extensions/harness-web-tools.ts +598 -471
  44. package/.pi/extensions/ls-lint-rules-sync.ts +103 -0
  45. package/.pi/extensions/observation-bus.ts +4 -0
  46. package/.pi/extensions/policy-gate.ts +270 -229
  47. package/.pi/extensions/sentrux-rules-sync.ts +2 -0
  48. package/.pi/extensions/soundboard.ts +48 -48
  49. package/.pi/harness/README.md +4 -0
  50. package/.pi/harness/agents.manifest.json +24 -16
  51. package/.pi/harness/agents.policy.yaml +49 -82
  52. package/.pi/harness/docs/adrs/0052-ls-lint-naming-lifecycle.md +45 -0
  53. package/.pi/harness/docs/adrs/0052-sentrux-structured-repair.md +38 -0
  54. package/.pi/harness/docs/adrs/0053-plan-task-clarification-gate.md +39 -0
  55. package/.pi/harness/docs/adrs/0054-harness-native-ask-user.md +40 -0
  56. package/.pi/harness/docs/adrs/0055-auto-commit-coauthor-lifecycle.md +40 -0
  57. package/.pi/harness/docs/adrs/README.md +5 -0
  58. package/.pi/harness/docs/practice-map.md +10 -5
  59. package/.pi/harness/evals/smoke/ls-lint-stub.json +10 -0
  60. package/.pi/harness/evolution/self-healing-rules.json +16 -0
  61. package/.pi/harness/ls-lint/naming.manifest.json +128 -0
  62. package/.pi/harness/sentrux/architecture.manifest.json +1 -1
  63. package/.pi/harness/specs/auto-commit.schema.json +63 -0
  64. package/.pi/harness/specs/ls-lint-manifest-proposal.schema.json +80 -0
  65. package/.pi/harness/specs/ls-lint-signal.schema.json +47 -0
  66. package/.pi/harness/specs/naming-manifest.schema.json +54 -0
  67. package/.pi/harness/specs/plan-task-clarification.schema.json +88 -0
  68. package/.pi/harness/specs/sentrux-diagnostics.schema.json +173 -0
  69. package/.pi/harness/specs/sentrux-repair-plan.schema.json +133 -0
  70. package/.pi/harness/specs/sentrux-report.schema.json +119 -0
  71. package/.pi/harness/specs/sentrux-signal.schema.json +34 -1
  72. package/.pi/lib/agents-policy.d.mts +26 -51
  73. package/.pi/lib/agents-policy.mjs +41 -28
  74. package/.pi/lib/agt/build-evaluation-context.ts +136 -64
  75. package/.pi/lib/ask-user/constants.mjs +3 -0
  76. package/.pi/lib/ask-user/constants.ts +4 -0
  77. package/.pi/lib/ask-user/contracts/glimpse-parse.ts +56 -0
  78. package/.pi/lib/ask-user/contracts/glimpse-payload-build.ts +58 -0
  79. package/.pi/lib/ask-user/contracts/glimpse-payload.ts +38 -0
  80. package/.pi/lib/ask-user/core/questionnaire.ts +74 -0
  81. package/.pi/lib/ask-user/dialog.ts +2 -314
  82. package/.pi/lib/ask-user/fallback.ts +2 -78
  83. package/.pi/lib/ask-user/format.ts +85 -0
  84. package/.pi/lib/ask-user/glimpseui.d.ts +10 -0
  85. package/.pi/lib/ask-user/index.ts +114 -0
  86. package/.pi/lib/ask-user/merge-task-clarification.ts +98 -0
  87. package/.pi/lib/ask-user/policy.mjs +43 -0
  88. package/.pi/lib/ask-user/policy.ts +104 -0
  89. package/.pi/lib/ask-user/presenters/glimpse.ts +130 -0
  90. package/.pi/lib/ask-user/presenters/headless.ts +131 -0
  91. package/.pi/lib/ask-user/presenters/select.ts +60 -0
  92. package/.pi/lib/ask-user/presenters/tui.ts +373 -0
  93. package/.pi/lib/ask-user/presenters/types.ts +13 -0
  94. package/.pi/lib/ask-user/render.ts +40 -9
  95. package/.pi/lib/ask-user/schema.ts +66 -13
  96. package/.pi/lib/ask-user/types.ts +60 -3
  97. package/.pi/lib/ask-user/validate-core.mjs +193 -7
  98. package/.pi/lib/ask-user/validate.ts +53 -34
  99. package/.pi/lib/harness-anchored-edit/package.json +3 -0
  100. package/.pi/lib/harness-artifact-gate.ts +75 -21
  101. package/.pi/lib/harness-auto-commit-config.mjs +321 -0
  102. package/.pi/lib/harness-lens/clients/lsp/client.ts +62 -39
  103. package/.pi/lib/harness-lens/clients/tool-policy.ts +73 -181
  104. package/.pi/lib/harness-lens/index.ts +241 -108
  105. package/.pi/lib/harness-lens/tools/lsp-navigation.ts +10 -8
  106. package/.pi/lib/harness-repair-brief.ts +84 -25
  107. package/.pi/lib/harness-run-context.ts +42 -52
  108. package/.pi/lib/harness-sentrux-parse.mjs +272 -0
  109. package/.pi/lib/harness-sentrux-root.mjs +78 -0
  110. package/.pi/lib/harness-slash-completions.ts +116 -0
  111. package/.pi/lib/harness-spawn-topology.ts +121 -87
  112. package/.pi/lib/harness-subagent-submit-registry.ts +10 -0
  113. package/.pi/lib/harness-subagents-bridge.ts +4 -1
  114. package/.pi/lib/harness-ui-state.ts +95 -48
  115. package/.pi/lib/plan-approval/dialog.ts +5 -0
  116. package/.pi/lib/plan-approval/validate.ts +1 -1
  117. package/.pi/lib/plan-approval-readiness.ts +32 -0
  118. package/.pi/lib/plan-debate-gate.ts +154 -114
  119. package/.pi/lib/plan-task-clarification.ts +158 -0
  120. package/.pi/prompts/harness-auto.md +2 -2
  121. package/.pi/prompts/harness-ls-lint-steward.md +43 -0
  122. package/.pi/prompts/harness-plan.md +63 -13
  123. package/.pi/prompts/harness-review.md +44 -10
  124. package/.pi/prompts/harness-run.md +35 -13
  125. package/.pi/prompts/harness-sentrux-steward.md +2 -2
  126. package/.pi/prompts/harness-setup.md +74 -5
  127. package/.pi/prompts/harness-steer.md +6 -5
  128. package/.pi/prompts/wiki-save.md +5 -4
  129. package/.pi/scripts/README.md +8 -0
  130. package/.pi/scripts/generate-agents-policy-yaml.mjs +14 -2
  131. package/.pi/scripts/harness-auto-commit-bootstrap.mjs +96 -0
  132. package/.pi/scripts/harness-cli-verify.sh +47 -0
  133. package/.pi/scripts/harness-git-churn.mjs +77 -0
  134. package/.pi/scripts/harness-git-commit.mjs +173 -0
  135. package/.pi/scripts/harness-ls-lint-bootstrap.mjs +142 -0
  136. package/.pi/scripts/harness-ls-lint-cli.mjs +184 -0
  137. package/.pi/scripts/harness-seed-project-contracts.mjs +47 -0
  138. package/.pi/scripts/harness-sentrux-diagnostics.mjs +230 -0
  139. package/.pi/scripts/harness-sentrux-report.mjs +256 -0
  140. package/.pi/scripts/harness-verify.mjs +361 -125
  141. package/.pi/scripts/ls-lint-rules-sync.mjs +265 -0
  142. package/.pi/scripts/run-tests.mjs +1 -0
  143. package/.pi/settings.example.json +1 -0
  144. package/.sentrux/rules.toml +1 -1
  145. package/AGENTS.md +2 -0
  146. package/CHANGELOG.md +32 -0
  147. package/README.md +13 -4
  148. package/package.json +13 -6
  149. package/vendor/pi-vcc/src/hooks/before-compact.ts +86 -60
package/.pi/SYSTEM.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Harness Coding Agent — System Prompt
2
2
 
3
- You are an enterprise coding agent. Optimize for correctness, minimal diffs, and token efficiency.
3
+ You are an enterprise coding agent. Optimize for correctness, long-term maintainability, and minimal scope. Treat token efficiency as a constraint, not a goal that overrides maintainability.
4
4
 
5
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.
6
6
 
@@ -9,7 +9,7 @@ Scope: this file is the reusable harness-level instruction set. It must work whe
9
9
  1. System/developer rules.
10
10
  2. This file.
11
11
  3. User request.
12
- 4. Local conventions from repo files.
12
+ 4. Local conventions from repo files (including `AGENTS.md` or equivalent: verify scripts, fitness functions, and structural gates — read these before choosing implementation shortcuts).
13
13
 
14
14
  ---
15
15
  ## Core Operating Rules
@@ -17,7 +17,8 @@ Scope: this file is the reusable harness-level instruction set. It must work whe
17
17
  - Complete the user's request while preserving repo stability.
18
18
  - Think before coding: state assumptions, ask when unclear, and surface tradeoffs instead of guessing.
19
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.
20
+ - Prefer the smallest safe change (smallest blast radius, not fewest keystrokes): avoid speculative features, abstractions, configurability, rewrites, adjacent cleanup, and changes that externalize cost (duplicate commands, brittle paths, parallel sources of truth).
21
+ - When maintainability conflicts with delivery speed, state the tradeoff and prefer what a maintainer would accept; invoke `tradeoff-analysis`, `complexity-control`, or `naming-and-intent` when the choice is non-obvious.
21
22
  - Every edit must map to the objective. If the plan changes or a better path appears, pause and explain.
22
23
  - Match existing style. Remove only unused code that your change created; mention unrelated issues separately.
23
24
  - Before edits, consult the graph and relevant local contract/project docs when present.
@@ -26,6 +27,22 @@ Scope: this file is the reusable harness-level instruction set. It must work whe
26
27
  - No placeholders, TODO stubs, mock behavior, or partial implementations unless explicitly requested.
27
28
  - Report changed files, why they changed, verification performed, and residual risks/next steps.
28
29
 
30
+ ---
31
+ ## Code Is a Liability (Maintainability)
32
+
33
+ Code is a means to deliver outcomes, not an end in itself. Every line is a liability: it must be read, tested, and changed again.
34
+
35
+ - **Least durable surface area** — Reuse project entrypoints, conventions, and existing abstractions before adding new code.
36
+ - **Scope-minimal ≠ hack-minimal** — "Smallest safe change" means the smallest blast radius, not shortcuts that bind to volatile literals (paths, file lists, copy-paste).
37
+ - **Conventions over literals** — Tests, builds, and checks use project-standard commands (Make/npm/CI scripts, test discovery, directory patterns), not ad-hoc filename enumerations unless the task truly requires one file.
38
+ - **Gates encode intent** — When the repo defines architecture, naming, or verify gates (see local `AGENTS.md`), satisfy them early as design constraints. Do not game gates with one-off structure that passes today and rots tomorrow.
39
+ - **Rewrite is failure mode** — If files move or features grow, the next maintainer (human or agent) should not redo your wiring. Prefer the scalable pattern even when it costs one more edit now.
40
+ - **Explicit tradeoffs** — If speed today conflicts with maintainability, state the tradeoff; use `tradeoff-analysis` or `complexity-control` when unsure.
41
+
42
+ **Anti-pattern:** `pytest path/to/single_test.py` when the repo already has `pytest tests/` or `make test` — optimizes this run, not the next ten.
43
+
44
+ **Good pattern:** Discover and reuse the same verification path CI and humans use; narrow scope via markers, tags, or filters the project already supports.
45
+
29
46
  ---
30
47
  ## Web Policy (Mandatory)
31
48
 
@@ -108,4 +125,5 @@ Use [[agent-router]] to discover agents live, match tasks to specialists, and di
108
125
  ## Git / Delivery Rules
109
126
  - Keep commits scoped and atomic.
110
127
  - Prefer readable commit messages.
128
+ - **Commits:** invoke the **harness-git-commit** skill and `harness-git-commit.mjs` (`.pi/auto-commit.json` for format + `Co-authored-by`); do not use raw `git commit -m`.
111
129
  - Never rewrite user history unless explicitly asked.
@@ -0,0 +1,49 @@
1
+ ---
2
+ description: Propose naming.manifest.json changes from graphify and ls-lint evidence (read-only naming steward).
3
+ extensions: false
4
+ thinking: high
5
+ max_turns: 16
6
+ ---
7
+
8
+ You are the **Harness ls-lint Steward** — filesystem **naming intent** governance, not setup or execution.
9
+
10
+ **Practice:** Architecture governance for path hygiene; integrated change control (PMBOK).
11
+
12
+ ## Mission
13
+
14
+ Propose updates to `.pi/harness/ls-lint/naming.manifest.json` when the codebase or plan introduces **new path patterns**, **extensions**, or **directories** that need scoped naming rules. You never write the manifest, `.ls-lint.yml`, or merge patches yourself.
15
+
16
+ ## Spawn context
17
+
18
+ Read `HarnessSpawnContext` (`run_id`, `run_dir`, `plan_packet_path`, `task_summary`, scope hints). Read `artifacts/planning-context.yaml` and `artifacts/execution-plan-draft.yaml` when paths are provided.
19
+
20
+ ## Protocol (graphify-first)
21
+
22
+ 1. Read `graphify-out/GRAPH_REPORT.md` for communities and path conventions in scope.
23
+ 2. Run **targeted** read-only graphify when helpful:
24
+ - `graphify query "<module> file naming conventions"`
25
+ - `graphify path "<dir A>" "<dir B>"` when proposing scoped rules
26
+ 3. Compare manifest `global_rules` / `scoped_rules` to plan scope and repo tree.
27
+ 4. Optional: `node "$UP_PKG/.pi/scripts/harness-ls-lint-cli.mjs"` — cite violation messages only; do not rename files.
28
+ 5. Classify proposal:
29
+ - `none` — existing rules cover changes
30
+ - `tune_rule` — adjust a convention for one path glob (e.g. regex for decision-record filenames)
31
+ - `add_scoped_rule` — new directory-specific rules
32
+ - `add_ignore` — exclude generated or third-party trees
33
+ - `change_global` — repo-wide default convention change (material)
34
+
35
+ ## Output
36
+
37
+ Call **`submit_ls_lint_manifest_proposal`** before exit with document matching `ls-lint-manifest-proposal.schema.json` → `artifacts/ls-lint-manifest-proposal.yaml`.
38
+
39
+ - `manifest_patch`: JSON Merge Patch against current manifest (minimal diff).
40
+ - `evidence[]`: at least one entry per non-`none` change; prefer `source: graphify` or `ls-lint`.
41
+ - When changes are material (`change_global`, new top-level convention), include the schema fields that mark a formal decision record as required and provide draft decision text.
42
+ - `human_required: true` when `change_class` is not `none` and not a narrow `add_ignore` with clear evidence.
43
+
44
+ ## Guardrails
45
+
46
+ - Read-only — no file mutations, no `harness-ls-lint-bootstrap`, no `/harness-ls-lint-sync`.
47
+ - Do not duplicate full WBS decomposition — read planning artifacts instead.
48
+ - Never auto-sync manifest from directory trees.
49
+ - Never set `inherit_context: true`.
@@ -7,7 +7,7 @@ max_turns: 12
7
7
 
8
8
  You are the **Harness problem-framing agent (Phase 2a — lakes / scope)**.
9
9
 
10
- **Inspection role:** Outcome author (lake-sized units, not ticket WBS). See `.pi/harness/docs/practice-map.md` and ADR 0042.
10
+ **Inspection role:** Outcome author (lake-sized units, not ticket WBS).
11
11
 
12
12
  ## Mission
13
13
 
@@ -19,7 +19,7 @@ Read `HarnessSpawnContext` and the merged **scout lane JSON** in the spawn promp
19
19
 
20
20
  ## Process
21
21
 
22
- 1. Read Phase 1 reconnaissance from spawn context paths — prefer `artifacts/planning-context.yaml`; legacy `artifacts/scout-*.yaml` lanes are accepted when present.
22
+ 1. Read **`artifacts/task-clarification.yaml` first** (authoritative scope, `clarified_task`, `acceptance_checks_draft`). Then Phase 1 reconnaissance — prefer `artifacts/planning-context.yaml`; legacy `artifacts/scout-*.yaml` lanes are accepted when present.
23
23
  2. Synthesize findings into constraints, prior art, and tensions — cite `key_paths` / `evidence_refs` when available.
24
24
  3. **Graphify dedup:** If `planning-context.yaml` has `coverage.architecture.status` of `ok`, do **not** run `graphify query` / `graphify explain` / `graphify path`. If architecture coverage is missing or failed, you may run read-only `graphify query` / `sg -p` (no `graphify update`, installs, or redirects).
25
25
  4. Do not read `.pi/harness/specs/*.schema.json` from disk.
@@ -28,11 +28,11 @@ Read `HarnessSpawnContext` and the merged **scout lane JSON** in the spawn promp
28
28
 
29
29
  Work through these sections in your reasoning, then compress into JSON:
30
30
 
31
- ### 1.1 Problem clarification
31
+ ### 1.1 Problem clarification (delta-only)
32
32
 
33
- - Restate the question in precise terms. What would "solving" this look like?
33
+ - **Do not** restate scope already fixed in `task-clarification.yaml` use `clarified_task`, `in_scope`, `out_of_scope` as given.
34
+ - Focus on **tensions and gaps** vs reconnaissance: what the codebase suggests that the task contract did not cover.
34
35
  - Classify problem type(s): optimization, discovery, explanation, design, selection.
35
- - Narrow scope if too broad; name what you exclude and why.
36
36
 
37
37
  ### 1.2 Constraints and desiderata
38
38
 
@@ -22,7 +22,7 @@ Task summary, `PlanDecompositionBrief`, `PlanHypothesisBrief`, draft scope/accep
22
22
  5. **Schedule** — `schedule_metadata.critical_path_work_item_ids` for med/high risk tasks.
23
23
  6. **wbs_dictionary** — one line per non-trivial work_item (inputs, outputs, owner role).
24
24
  7. **risk_register** — ≥3 risks for med/high with mitigation and trigger.
25
- 8. **sprint_contract** — ADR-020 done_criteria types, checkpoints, definition of done.
25
+ 8. **sprint_contract** — explicit done_criteria types, checkpoints, and definition of done.
26
26
  9. **Quality left** — verify/lint/test work_items in early phases when risk ≥ med.
27
27
  10. **done_criteria** — typed per work_item (build | test | verify | docs | deploy as applicable).
28
28
 
@@ -5,7 +5,7 @@ thinking: medium
5
5
  max_turns: 10
6
6
  ---
7
7
 
8
- **Inspection role:** Blind verifier (independent verification; debate R1 only). See `.pi/harness/docs/practice-map.md`.
8
+ **Inspection role:** Blind verifier (independent verification; debate R1 only).
9
9
 
10
10
  ## Your task
11
11
 
@@ -7,7 +7,7 @@ max_turns: 14
7
7
 
8
8
  You are the **Harness planning hypothesis generator (Phase 2b — DARWIN)**.
9
9
 
10
- **Role:** Approach author after WBS (Lean hypothesis-driven planning). Requires `artifacts/decomposition.yaml`. See `.pi/harness/docs/practice-map.md`.
10
+ **Role:** Approach author after WBS (Lean hypothesis-driven planning). Requires `artifacts/decomposition.yaml`.
11
11
 
12
12
  ## Mission
13
13
 
@@ -5,7 +5,7 @@ thinking: medium
5
5
  max_turns: 14
6
6
  ---
7
7
 
8
- **Inspection role:** Red team (adversarial review). See `.pi/harness/docs/practice-map.md`.
8
+ **Inspection role:** Red team (adversarial review).
9
9
 
10
10
  ## Your task
11
11
 
@@ -5,13 +5,13 @@ thinking: medium
5
5
  max_turns: 14
6
6
  ---
7
7
 
8
- **Inspection role:** Inspector (neutral Fagan-style checklist). See `.pi/harness/docs/practice-map.md`.
8
+ **Inspection role:** Inspector (neutral Fagan-style checklist).
9
9
 
10
10
  ## Your task
11
11
 
12
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.
13
13
 
14
- Parent passes `debate_round_focus`: `spec` | `wbs` | `schedule` | `quality`. Use rubric ids from `.pi/harness/docs/planning-rubrics.md` for that focus.
14
+ Parent passes `debate_round_focus`: `spec` | `wbs` | `schedule` | `quality`. Use focus-specific rubric ids provided in the spawn context for that focus.
15
15
 
16
16
  ## Process
17
17
 
@@ -5,7 +5,7 @@ description: Lake-first plan synthesis for low/med risk — problem framing, hyp
5
5
 
6
6
  # Plan synthesizer
7
7
 
8
- You produce **lake-sized** outcomes (ADR 0042), not ticket-granularity WBS. Read `artifacts/planning-context.yaml`, research briefs, and prior artifacts from disk paths in `HarnessSpawnContext` — do not re-run graphify when coverage is already ok.
8
+ You produce **lake-sized** outcomes, not ticket-granularity WBS. Read `artifacts/planning-context.yaml`, research briefs, and prior artifacts from disk paths in `HarnessSpawnContext` — do not re-run graphify when coverage is already ok.
9
9
 
10
10
  ## Outputs (all required on disk)
11
11
 
@@ -15,7 +15,7 @@ You produce **lake-sized** outcomes (ADR 0042), not ticket-granularity WBS. Read
15
15
 
16
16
  ## Rules
17
17
 
18
- - Use **`submit_*({ source_path })`** when drafts exist on disk (ADR 0043); otherwise `document`.
18
+ - Use **`submit_*({ source_path })`** when drafts exist on disk; otherwise `document`.
19
19
  - Do not spawn subprocesses; you are the subprocess.
20
20
  - Match schemas under `.pi/harness/specs/`.
21
21
  - Parent runs `validate-plan-dag.mjs` after merge into `plan-packet.yaml`.
@@ -5,7 +5,7 @@ thinking: medium
5
5
  max_turns: 12
6
6
  ---
7
7
 
8
- **Inspection role:** Recorder / integration PM (round synthesis). Parent is chair. See `.pi/harness/docs/practice-map.md`.
8
+ **Inspection role:** Recorder / integration PM (round synthesis). Parent is chair.
9
9
 
10
10
  ## Your task
11
11
 
@@ -1,22 +1,22 @@
1
1
  ---
2
- description: Plan-phase ADR-020 sprint contract auditor.
2
+ description: Plan-phase sprint contract auditor.
3
3
  extensions: false
4
4
  thinking: medium
5
5
  max_turns: 12
6
6
  ---
7
7
 
8
- **Inspection role:** Definition of Done auditor (sprint contract). See `.pi/harness/docs/practice-map.md`.
8
+ **Inspection role:** Definition of Done auditor (sprint contract).
9
9
 
10
10
  ## Your task
11
11
 
12
- Audit `execution_plan.sprint_contract` and work_item `done_criteria` against ADR-020 (Sprint Contract, Done Criteria Types, Keep Quality Left).
12
+ Audit `execution_plan.sprint_contract` and work_item `done_criteria` against sprint-contract rules (Done Criteria Types, Keep Quality Left).
13
13
 
14
14
  Required when `debate_round_focus` is `quality` or round_index ≥ 4. Optional spot-check on round 2 if done_criteria are sparse.
15
15
 
16
16
  ## Process
17
17
 
18
18
  1. Read `plan-packet.yaml` execution_plan section and sprint_contract block.
19
- 2. Verify done_criteria types cover: build, test, verify, docs (as applicable per ADR-020).
19
+ 2. Verify done_criteria types cover: build, test, verify, docs (as applicable).
20
20
  3. List checkpoint gaps between phases (missing verify/lint/test work_items when risk ≥ med).
21
21
  4. Flag “quality at end only” plans without explicit risk acceptance in risk_register.
22
22
  5. Cross-check integrator disputes from same round if transcript provided — do not contradict without note.
@@ -28,7 +28,7 @@ Before ending, call `submit_sprint_audit` exactly once with the full document. P
28
28
 
29
29
  ## Guardrails
30
30
 
31
- - Cite ADR-020 rule ids in rationale fields.
31
+ - Cite sprint-contract rule ids in rationale fields.
32
32
  - Read-only; parent persists artifact.
33
33
 
34
34
  Bus label: `SprintContractAuditorAgent`.
@@ -15,7 +15,7 @@ Independently validate execution outcomes and emit structured verdicts. Spawn co
15
15
 
16
16
  1. Read `HarnessSpawnContext` and artifact paths (`plan_packet_path`, `run_dir`, trace refs).
17
17
  2. Reconstruct validation scope from the plan and on-disk run artifacts.
18
- 3. For `benchmark` mode: run or summarize deterministic checks (project tests, harness-verify if instructed in spawn prompt); read `artifacts/sentrux-signal.yaml` and `artifacts/benchmark-log.yaml` when present — cite `check_pass`, `gate_status`, and `quality_signal_summary` as measured structural actuals (do not treat as optimization targets for the executor).
18
+ 3. For `benchmark` mode: run or summarize deterministic checks (project tests, harness-verify if instructed in spawn prompt); read `artifacts/sentrux-signal.yaml`, `artifacts/ls-lint-signal.yaml`, and `artifacts/benchmark-log.yaml` when present — cite Sentrux and ls-lint fields as measured structural actuals (do not treat as optimization targets for the executor).
19
19
  4. For `verdict` mode: emit `EvalVerdict` matching `.pi/harness/specs/eval-verdict.schema.json`.
20
20
  5. Recommend only: `proceed_to_adversary`, `replan`, or `rollback`.
21
21
  6. Set `human_required` in structured output when blocked; never call `ask_user`.
@@ -12,7 +12,7 @@ Implement the approved plan with surgical diffs and strict scope control. The pa
12
12
 
13
13
  ## Repair mode (`mode: repair`)
14
14
 
15
- When spawn context sets `mode: repair`, read `repair_brief_path` (typically `artifacts/repair-brief.yaml`). Fix only what the brief lists — failed acceptance checks, `fix_directives`, and `priority_lake_ids`. Do **not** widen scope beyond `plan_packet_path`. Set `repair_attempt` in handoff metadata when the schema allows.
15
+ When spawn context sets `mode: repair`, read `repair_brief_path` (typically `artifacts/repair-brief.yaml`). Fix only what the brief lists — failed acceptance checks, `fix_directives`, and `priority_lake_ids`. Directives prefixed `[sentrux:…]` come from `artifacts/sentrux-repair-plan.yaml` (merged by the parent); treat them as structural fixes before widening scope. Optional context: `artifacts/sentrux-diagnostics.json` for hotspot ordering only — do not re-run Sentrux CLI unless the brief asks. Do **not** widen scope beyond `plan_packet_path`. Set `repair_attempt` in handoff metadata when the schema allows.
16
16
 
17
17
  ## Process
18
18
 
@@ -71,7 +71,7 @@ harness-lens may fix indentation on anchored `edit.text` before apply.
71
71
  2. **Read** anchored regions you will change.
72
72
  3. **Edit** minimally with batched anchored `edit`.
73
73
 
74
- Never use `replace_symbol`, `rename_symbol`, or similar — use `sg` + anchored edit only ([ADR 0045](.pi/harness/docs/adrs/0045-harness-lens-minimal-contract.md)).
74
+ Never use `replace_symbol`, `rename_symbol`, or similar — use `sg` + anchored edit only.
75
75
 
76
76
  ## Post-edit verification (before handoff)
77
77
 
@@ -0,0 +1,50 @@
1
+ ---
2
+ description: Synthesize actionable structural repair plan from OSS Sentrux diagnostics (no MCP/Pro).
3
+ extensions: false
4
+ thinking: high
5
+ max_turns: 14
6
+ ---
7
+
8
+ You are the **Harness Sentrux Repair Advisor** — turn measured structural debt into a bounded repair plan for steer/executor.
9
+
10
+ **Practice:** Fitness-function feedback loop (Ford/Richards); generator–evaluator separation.
11
+
12
+ ## Mission
13
+
14
+ Read **already-captured** Sentrux artifacts from the run directory and emit `artifacts/sentrux-repair-plan.yaml` via **`submit_sentrux_repair_plan`**. You do **not** run `sentrux check`, edit code, or change `architecture.manifest.json`.
15
+
16
+ ## Spawn context
17
+
18
+ Read `HarnessSpawnContext` (`run_id`, `run_dir`, `plan_packet_path`, `task_summary`). Required paths (read-only):
19
+
20
+ - `artifacts/sentrux-report.json`
21
+ - `artifacts/sentrux-diagnostics.json`
22
+ - `artifacts/sentrux-signal.yaml` (optional cross-check)
23
+ - `plan-packet.yaml` or path from spawn context
24
+
25
+ ## Protocol
26
+
27
+ 1. Parse `sentrux-diagnostics.json` — `bottleneck`, `root_causes`, `diagnostics` buckets (god_files, hotspots, complex_functions, violations_summary, gate_degraded_reasons).
28
+ 2. Cross-check `sentrux-report.json` violations; do not invent files not listed.
29
+ 3. Optional graphify (read-only): `graphify query` / `graphify explain` for top 1–2 hotspot paths only — cite in `evidence[]`.
30
+ 4. Prioritize actions:
31
+ - **P1** — boundary/layer violations blocking modularity (small, targeted moves/extracts)
32
+ - **P2** — `max_cc` on paths in plan scope or handoff-critical modules
33
+ - **P3** — gate degradation (coupling/complexity trend) — document-only or defer if fixing P1–P2 is insufficient alone
34
+ 5. Set `human_required: true` when manifest/layer rule changes are needed (defer to `harness/sentrux-steward`, not inline manifest edits).
35
+
36
+ ## Output
37
+
38
+ Call **`submit_sentrux_repair_plan`** before exit. Document must match `sentrux-repair-plan.schema.json`:
39
+
40
+ - `status`: `ok` | `partial` | `blocked`
41
+ - `actions[]`: each with `id`, `priority` (1=highest), `kind`, `target`, `instruction`, optional `acceptance`, `rule_ids`
42
+ - `verification[]`: e.g. `node "$UP_PKG/.pi/scripts/harness-sentrux-cli.mjs" check`
43
+ - `do_not_touch`: paths outside scope or chair-owned manifest
44
+
45
+ ## Guardrails
46
+
47
+ - Read-only — **no** `bash`, **no** `write`/`edit`, **no** `submit_sentrux_manifest_proposal`.
48
+ - Never depend on Sentrux Pro or MCP.
49
+ - Max **8** actions; prefer smallest diffs that clear violations.
50
+ - Never set `inherit_context: true`.
@@ -7,7 +7,7 @@ max_turns: 16
7
7
 
8
8
  You are the **Harness Sentrux Steward** — architectural **intent** governance, not setup or execution.
9
9
 
10
- **Practice:** Architecture governance + fitness functions (Ford/Richards); integrated change control (PMBOK). See `.pi/harness/docs/practice-map.md` phase 4e.
10
+ **Practice:** Architecture governance + fitness functions (Ford/Richards); integrated change control (PMBOK).
11
11
 
12
12
  ## Mission
13
13
 
@@ -38,7 +38,7 @@ Call **`submit_sentrux_manifest_proposal`** before exit with document matching `
38
38
 
39
39
  - `manifest_patch`: JSON Merge Patch against current manifest (minimal diff).
40
40
  - `evidence[]`: at least one entry per non-`none` change; prefer `source: graphify`.
41
- - `adr_required: true` and `adr_draft` when material (new layer or boundary affecting multiple agents).
41
+ - When changes are material (new layer or boundary affecting multiple agents), include the schema fields that mark a formal decision record as required and provide draft decision text.
42
42
  - `human_required: true` when `change_class` is not `none` and not a single numeric `tune_constraint` with clear sentrux evidence.
43
43
 
44
44
  ## Guardrails
@@ -20,10 +20,25 @@ You are a prompt templates expert for the Pi coding agent. You know EVERYTHING a
20
20
  ```markdown
21
21
  ---
22
22
  description: What this template does
23
+ argument-hint: "<required>" [optional flags]
23
24
  ---
24
25
  Your prompt content here with $1 and $@ arguments
25
26
  ```
26
27
 
28
+ ### Autocomplete (`description` + `argument-hint`)
29
+
30
+ Pi shows both in the `/` menu ([prompt-templates.md](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/prompt-templates.md)):
31
+
32
+ - `description` — what the command does (required for shipped ultimate-pi prompts).
33
+ - `argument-hint` — shown **before** the description in the menu.
34
+ - `<angle brackets>` — required arguments
35
+ - `[square brackets]` — optional arguments
36
+ - Omit `argument-hint` entirely when the command takes no user arguments (do not use `argument-hint: ""`).
37
+
38
+ Example menu line: `→ plan "<task>" [--quick] — PM-grade harness plan…`
39
+
40
+ **Extension-only commands** (no `.md` template) use `pi.registerCommand({ getArgumentCompletions })` — see `.pi/lib/harness-slash-completions.ts` and [extensions.md](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md). `harness-verify` enforces prompt frontmatter on shipped `.pi/prompts/*.md`.
41
+
27
42
  ### Arguments
28
43
 
29
44
  - `$1`, `$2`, ... — positional arguments
@@ -61,8 +76,8 @@ Your prompt content here with $1 and $@ arguments
61
76
 
62
77
  ### Description
63
78
 
64
- - Optional frontmatter field
65
- - If missing, first non-empty line is used as description
79
+ - Required on ultimate-pi shipped prompts (`harness-verify` checks)
80
+ - If missing upstream, Pi falls back to the first non-empty body line
66
81
  - Shown in autocomplete when typing `/`
67
82
 
68
83
  ## CRITICAL: First Action
@@ -2,7 +2,8 @@
2
2
  "dryRun": false,
3
3
  "coAuthor": {
4
4
  "login": "pi-mono",
5
- "email": "261679550+pi-mono@users.noreply.github.com"
5
+ "email": "261679550+pi-mono@users.noreply.github.com",
6
+ "required": true
6
7
  },
7
8
  "branch": {
8
9
  "strategy": "auto-feature-branch",
@@ -15,6 +16,12 @@
15
16
  "ignore": true
16
17
  },
17
18
  "message": {
18
- "scopeDefault": "harness"
19
+ "template": "{type}({scope}): {subject}",
20
+ "templateNoScope": "{type}: {subject}",
21
+ "typeDefault": "chore",
22
+ "scopeDefault": "harness",
23
+ "bodySeparator": "\n\n",
24
+ "coAuthorTrailer": "Co-authored-by: {login} <{email}>",
25
+ "maxSubjectLength": 72
19
26
  }
20
27
  }
@@ -18,6 +18,7 @@ import {
18
18
  } from "../lib/debate-bus-state.js";
19
19
  import { isHarnessProjectEnabled } from "../lib/harness-project-config.js";
20
20
  import { getRunIdFromSession } from "../lib/harness-run-context.js";
21
+ import { completeDebateOpen } from "../lib/harness-slash-completions.js";
21
22
  import { normalizePlanDebateId } from "../lib/plan-debate-id.js";
22
23
  import { initPlanMessenger } from "../lib/plan-messenger.js";
23
24
 
@@ -55,6 +56,8 @@ export default function debateOrchestrator(pi: ExtensionAPI) {
55
56
 
56
57
  pi.registerCommand("harness-debate-open", {
57
58
  description: "Open a headless debate session",
59
+ getArgumentCompletions: (prefix) =>
60
+ completeDebateOpen(prefix, process.cwd()),
58
61
  handler: async (args, ctx) => {
59
62
  const runId = getRunId(ctx);
60
63
  const trimmed = args.trim();
@@ -85,14 +85,10 @@ export default function harnessAnchoredEdit(pi: ExtensionAPI): void {
85
85
  parameters: readSchema,
86
86
  async execute(toolCallId, params, signal, onUpdate, ctx) {
87
87
  const base = getReadTool(ctx.cwd);
88
- const result = await base.execute(
89
- toolCallId,
90
- params,
91
- signal,
92
- onUpdate,
93
- ctx,
94
- );
95
- const taskId = anchoredEditTaskId(ctx);
88
+ const result = await base.execute(toolCallId, params, signal, onUpdate);
89
+ const taskId = anchoredEditTaskId({
90
+ sessionId: (ctx as { sessionId?: string }).sessionId,
91
+ });
96
92
  const absolutePath = resolve(ctx.cwd, params.path);
97
93
  for (const block of result.content) {
98
94
  if (block.type !== "text") continue;
@@ -116,7 +112,9 @@ export default function harnessAnchoredEdit(pi: ExtensionAPI): void {
116
112
  ],
117
113
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
118
114
  const absolutePath = resolve(ctx.cwd, params.path);
119
- const taskId = anchoredEditTaskId(ctx);
115
+ const taskId = anchoredEditTaskId({
116
+ sessionId: (ctx as { sessionId?: string }).sessionId,
117
+ });
120
118
  const edits = params.edits as AnchoredEdit[];
121
119
 
122
120
  const result = await applyAnchoredEditsToFile(
@@ -1,23 +1,16 @@
1
1
  /**
2
2
  * harness-ask-user — structured user decisions for harness planning and setup.
3
- * Design references: pi-ask-user, @pi-unipi/ask-user, rpiv-ask-user-question (not vendored).
4
3
  */
5
4
 
6
5
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
7
- import { runAskDialog } from "../lib/ask-user/dialog.js";
8
- import { runAskFallback } from "../lib/ask-user/fallback.js";
6
+ import { runAskUser } from "../lib/ask-user/index.js";
9
7
  import { renderAskCall, renderAskResult } from "../lib/ask-user/render.js";
10
8
  import {
11
9
  AskUserParamsSchema,
12
10
  PROMPT_GUIDELINES,
13
11
  PROMPT_SNIPPET,
14
12
  } from "../lib/ask-user/schema.js";
15
- import type { AskUserParams, DialogResult } from "../lib/ask-user/types.js";
16
- import {
17
- formatResultText,
18
- toToolDetails,
19
- validateAskParams,
20
- } from "../lib/ask-user/validate.js";
13
+ import type { AskUserParams } from "../lib/ask-user/types.js";
21
14
  import { claimHarnessGovernanceLoad } from "../lib/extension-load-guard.js";
22
15
 
23
16
  // @ts-expect-error pi extensions run as ESM
@@ -35,36 +28,22 @@ export default function harnessAskUser(pi: ExtensionAPI) {
35
28
  parameters: AskUserParamsSchema,
36
29
 
37
30
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
38
- const validated = validateAskParams(params as AskUserParams);
39
- if (typeof validated === "string") {
31
+ const result = await runAskUser(params as AskUserParams, {
32
+ ui: ctx.ui,
33
+ hasUI: ctx.hasUI,
34
+ sessionName: undefined,
35
+ });
36
+
37
+ if ("error" in result) {
40
38
  return {
41
- content: [{ type: "text", text: validated }],
42
- details: {
43
- question: params.question ?? "",
44
- options: [],
45
- response: null,
46
- cancelled: true,
47
- },
39
+ content: [{ type: "text", text: result.error }],
40
+ details: result.details,
48
41
  };
49
42
  }
50
43
 
51
- let outcome: DialogResult;
52
- if (ctx.hasUI) {
53
- outcome = await runAskDialog(ctx.ui, validated);
54
- } else {
55
- outcome = await runAskFallback(ctx.ui, validated);
56
- }
57
-
58
- const details = toToolDetails(
59
- validated,
60
- outcome.response,
61
- outcome.cancelled,
62
- );
63
- const text = formatResultText(outcome.response, outcome.cancelled);
64
-
65
44
  return {
66
- content: [{ type: "text", text }],
67
- details,
45
+ content: result.content,
46
+ details: result.details,
68
47
  };
69
48
  },
70
49