@webpresso/agent-kit 3.1.26 → 3.1.30

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 (150) hide show
  1. package/catalog/AGENTS.md.tpl +7 -11
  2. package/catalog/agent/commands/verify.md +2 -2
  3. package/catalog/agent/rules/changeset-release.md +4 -2
  4. package/catalog/agent/rules/ci-cost-local-first.md +139 -0
  5. package/catalog/agent/rules/ci-test-perf.md +5 -1
  6. package/catalog/agent/rules/cmd-execution.md +9 -0
  7. package/catalog/agent/rules/pre-implementation.md +2 -1
  8. package/catalog/agent/rules/test-scan-perf.md +80 -0
  9. package/catalog/agent/rules/workflow-skills-routing.md +9 -4
  10. package/catalog/agent/skills/autopilot/SKILL.md +48 -11
  11. package/catalog/agent/skills/claude/SKILL.md +7 -0
  12. package/catalog/agent/skills/codex/SKILL.md +7 -0
  13. package/catalog/agent/skills/fix/SKILL.md +36 -8
  14. package/catalog/agent/skills/grok/SKILL.md +7 -0
  15. package/catalog/agent/skills/investigate/SKILL.md +12 -1
  16. package/catalog/agent/skills/pll/SKILL.md +53 -48
  17. package/catalog/agent/skills/team/SKILL.md +26 -9
  18. package/catalog/agent/skills/ultragoal/SKILL.md +147 -19
  19. package/catalog/agent/skills/verify/SKILL.md +89 -51
  20. package/dist/esm/audit/blueprint-lifecycle-sql.d.ts +8 -0
  21. package/dist/esm/audit/blueprint-lifecycle-sql.js +25 -1
  22. package/dist/esm/audit/blueprint-pr-coverage.js +68 -7
  23. package/dist/esm/audit/registry.d.ts +4 -4
  24. package/dist/esm/audit/registry.js +3 -0
  25. package/dist/esm/audit/roadmap-links.js +6 -0
  26. package/dist/esm/audit/test-scan-perf.d.ts +18 -0
  27. package/dist/esm/audit/test-scan-perf.js +275 -0
  28. package/dist/esm/blueprint/lifecycle/engine.d.ts +9 -0
  29. package/dist/esm/blueprint/lifecycle/engine.js +53 -6
  30. package/dist/esm/blueprint/lifecycle/review-provenance.d.ts +6 -0
  31. package/dist/esm/blueprint/lifecycle/review-provenance.js +93 -12
  32. package/dist/esm/blueprint/markdown/helpers.js +6 -2
  33. package/dist/esm/ci/act-replay.js +110 -7
  34. package/dist/esm/ci/act-runner.d.ts +4 -0
  35. package/dist/esm/ci/act-runner.js +85 -26
  36. package/dist/esm/ci/act-worktree-git.d.ts +11 -0
  37. package/dist/esm/ci/act-worktree-git.js +219 -0
  38. package/dist/esm/ci/native-session-memory-cache.d.ts +9 -1
  39. package/dist/esm/ci/native-session-memory-cache.js +9 -1
  40. package/dist/esm/ci/vitest-ci-shards.d.ts +6 -4
  41. package/dist/esm/ci/vitest-ci-shards.js +6 -4
  42. package/dist/esm/cli/auto-update/guard-tombstone.d.ts +25 -0
  43. package/dist/esm/cli/auto-update/guard-tombstone.js +67 -0
  44. package/dist/esm/cli/auto-update/installer.d.ts +4 -17
  45. package/dist/esm/cli/auto-update/installer.js +6 -57
  46. package/dist/esm/cli/auto-update/self-invocation.d.ts +37 -0
  47. package/dist/esm/cli/auto-update/self-invocation.js +62 -0
  48. package/dist/esm/cli/commands/audit.js +4 -0
  49. package/dist/esm/cli/commands/blueprint/mutations.js +35 -18
  50. package/dist/esm/cli/commands/blueprint/router.js +27 -2
  51. package/dist/esm/cli/commands/ci.d.ts +8 -1
  52. package/dist/esm/cli/commands/ci.js +80 -21
  53. package/dist/esm/cli/commands/dash/index.js +3 -3
  54. package/dist/esm/cli/commands/dash/keymap.js +1 -0
  55. package/dist/esm/cli/commands/dash/launch-preferences.d.ts +15 -0
  56. package/dist/esm/cli/commands/dash/launch-preferences.js +46 -17
  57. package/dist/esm/cli/commands/dash/plan-once-attention.d.ts +32 -0
  58. package/dist/esm/cli/commands/dash/plan-once-attention.js +50 -0
  59. package/dist/esm/cli/commands/dash/plan-once-label.d.ts +7 -0
  60. package/dist/esm/cli/commands/dash/plan-once-label.js +5 -0
  61. package/dist/esm/cli/commands/dash/plan-once-membership.d.ts +67 -0
  62. package/dist/esm/cli/commands/dash/plan-once-membership.js +151 -0
  63. package/dist/esm/cli/commands/dash/plan-once-merge.d.ts +143 -0
  64. package/dist/esm/cli/commands/dash/plan-once-merge.js +238 -0
  65. package/dist/esm/cli/commands/dash/plan-once-schema.d.ts +73 -0
  66. package/dist/esm/cli/commands/dash/plan-once-schema.js +119 -0
  67. package/dist/esm/cli/commands/dash/plan-once.d.ts +142 -0
  68. package/dist/esm/cli/commands/dash/plan-once.js +261 -0
  69. package/dist/esm/cli/commands/dash/tui/attention-hud.d.ts +9 -0
  70. package/dist/esm/cli/commands/dash/tui/attention-hud.js +9 -0
  71. package/dist/esm/cli/commands/dash/tui/chat-bridge.d.ts +41 -0
  72. package/dist/esm/cli/commands/dash/tui/chat-bridge.js +73 -0
  73. package/dist/esm/cli/commands/dash/tui/chat-mode.d.ts +47 -0
  74. package/dist/esm/cli/commands/dash/tui/chat-mode.js +98 -0
  75. package/dist/esm/cli/commands/dash/tui/frame.d.ts +3 -0
  76. package/dist/esm/cli/commands/dash/tui/frame.js +3 -1
  77. package/dist/esm/cli/commands/dash/tui/ipc-protocol.d.ts +87 -0
  78. package/dist/esm/cli/commands/dash/tui/ipc-protocol.js +128 -0
  79. package/dist/esm/cli/commands/dash/tui/native-host.d.ts +34 -0
  80. package/dist/esm/cli/commands/dash/tui/native-host.js +256 -0
  81. package/dist/esm/cli/commands/dash/tui/native-path.d.ts +11 -0
  82. package/dist/esm/cli/commands/dash/tui/native-path.js +41 -0
  83. package/dist/esm/cli/commands/dash/tui/palette.d.ts +1 -1
  84. package/dist/esm/cli/commands/dash/tui/palette.js +14 -0
  85. package/dist/esm/cli/commands/dash/tui/runtime.js +311 -4
  86. package/dist/esm/cli/commands/dash/tui/state.d.ts +41 -0
  87. package/dist/esm/cli/commands/dash/tui/state.js +257 -4
  88. package/dist/esm/cli/commands/format.js +0 -2
  89. package/dist/esm/cli/commands/init/config.d.ts +0 -1
  90. package/dist/esm/cli/commands/init/config.js +1 -4
  91. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/emitters/claude.d.ts +5 -6
  92. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/emitters/claude.js +6 -13
  93. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/ir.d.ts +0 -2
  94. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/ir.js +0 -2
  95. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/merge.d.ts +6 -3
  96. package/dist/esm/cli/commands/init/scaffolders/agent-hooks/merge.js +39 -26
  97. package/dist/esm/cli/commands/init/scaffolders/agent-kit-global/index.js +1 -1
  98. package/dist/esm/cli/commands/init/scaffolders/codex-mcp/index.js +61 -23
  99. package/dist/esm/cli/commands/logs.d.ts +15 -0
  100. package/dist/esm/cli/commands/logs.js +192 -3
  101. package/dist/esm/cli/commands/package-manager.js +2 -1
  102. package/dist/esm/cli/commands/quality-log-store.d.ts +1 -0
  103. package/dist/esm/cli/commands/quality-log-store.js +187 -51
  104. package/dist/esm/cli/commands/review.js +5 -8
  105. package/dist/esm/cli/commands/secrets.d.ts +1 -0
  106. package/dist/esm/cli/commands/secrets.js +4 -1
  107. package/dist/esm/cli/commands/self-install-guard.d.ts +14 -32
  108. package/dist/esm/cli/commands/self-install-guard.js +17 -63
  109. package/dist/esm/cli/direct-provider-launch.js +25 -1
  110. package/dist/esm/hooks/doctor.d.ts +15 -0
  111. package/dist/esm/hooks/doctor.js +56 -0
  112. package/dist/esm/hooks/guard-switch/index.js +8 -4
  113. package/dist/esm/hooks/post-tool/lint-after-edit.js +6 -4
  114. package/dist/esm/hooks/precompact/index.js +5 -3
  115. package/dist/esm/hooks/pretool-guard/validators/forbidden-commands.js +4 -4
  116. package/dist/esm/hooks/pretool-guard/validators/mcp-redirect.d.ts +0 -1
  117. package/dist/esm/hooks/pretool-guard/validators/mcp-redirect.js +8 -5
  118. package/dist/esm/hooks/pretool-guard/validators/worktree-discipline.d.ts +9 -7
  119. package/dist/esm/hooks/pretool-guard/validators/worktree-discipline.js +126 -14
  120. package/dist/esm/hooks/sessionstart/index.d.ts +10 -0
  121. package/dist/esm/hooks/sessionstart/index.js +61 -4
  122. package/dist/esm/hooks/shared/types.d.ts +11 -0
  123. package/dist/esm/hooks/shared/types.js +21 -0
  124. package/dist/esm/mcp/tools/_shared/audit-kinds.d.ts +1 -1
  125. package/dist/esm/mcp/tools/audit.d.ts +2 -1
  126. package/dist/esm/mcp/tools/audit.js +10 -0
  127. package/dist/esm/mcp/tools/audits.d.ts +1 -0
  128. package/dist/esm/mcp/tools/ci-act.js +9 -11
  129. package/dist/esm/paths/state-root.js +9 -0
  130. package/dist/esm/review/authority.js +17 -2
  131. package/dist/esm/review/availability.js +18 -5
  132. package/dist/esm/review/subject.d.ts +15 -0
  133. package/dist/esm/review/subject.js +105 -10
  134. package/dist/esm/runtime/executor.d.ts +1 -0
  135. package/dist/esm/runtime/executor.js +2 -1
  136. package/dist/esm/secret-gate/runner.d.ts +1 -0
  137. package/dist/esm/secret-gate/runner.js +4 -1
  138. package/dist/esm/session-memory/current-session.js +2 -0
  139. package/dist/esm/session-memory/native-runtime.js +5 -3
  140. package/dist/esm/session-memory/native-warm-markers.d.ts +18 -0
  141. package/dist/esm/session-memory/native-warm-markers.js +22 -0
  142. package/dist/esm/session-memory/sync/types.d.ts +4 -0
  143. package/dist/esm/session-memory/types.d.ts +3 -1
  144. package/dist/esm/session-memory/types.js +2 -0
  145. package/dist/esm/ultragoal/runtime.js +44 -2
  146. package/dist/esm/worktrees/current.d.ts +1 -0
  147. package/dist/esm/worktrees/current.js +1 -0
  148. package/dist/esm/worktrees/project-agent-surfaces.d.ts +1 -0
  149. package/dist/esm/worktrees/project-agent-surfaces.js +2 -1
  150. package/package.json +17 -14
@@ -54,6 +54,8 @@ Catalog-owned surfaces:
54
54
  - Reuse nearby utilities and patterns before adding new abstractions.
55
55
  - Apply DRY, SOLID, YAGNI, and KISS.
56
56
  - No hardcoded relative paths in executable code or config; derive from an explicit absolute anchor.
57
+ - Efficiency: MCP `wp_*` over shell; `ultragoal`/`/pll`; `/verify` local vs
58
+ `--merge-ready` (1 outside voice); `fix_budget`=1.
57
59
 
58
60
  Hook invariant: global hooks use the canonical contract; skill hooks never
59
61
  project into host settings. Bound hot paths; do not raise timeouts or hide work
@@ -61,17 +63,10 @@ asynchronously.
61
63
 
62
64
  ## Verify
63
65
 
64
- Before claiming completion, run the narrowest checks that prove the change:
65
-
66
- - agent-kit MCP tools first when available; otherwise the repo wrapper
67
- - typecheck
68
- - lint / format check
69
- - affected tests
70
- - repo policy checks such as `verify:paths` / `verify:secrets`
71
- - docs or blueprint validation when docs/plans changed
72
- - `wp sync --check` after template/catalog changes
73
-
74
- If a gate fails, fix root cause or record the blocker with evidence.
66
+ Before claiming completion, run the narrowest MCP/`wp` checks that prove the
67
+ change: typecheck, lint/format, affected tests, policy, docs/blueprint, and
68
+ `wp sync --check` after template/catalog changes. Fix root cause or record the
69
+ blocker. Before pushing, run `wp ci-preflight` (see `ci-cost-local-first`).
75
70
 
76
71
  ## Communicate
77
72
 
@@ -149,6 +144,7 @@ Full details: `.agent/rules/package-conventions.md`
149
144
  ## Tech stack
150
145
 
151
146
  {{TECH_STACK}}
147
+
152
148
  <!-- <<< managed by webpresso (planning-and-release) -->
153
149
 
154
150
  <!-- >>> user-owned (escalation-map) -->
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: "Post-implementation quality gate that verifies work is actually done, runs the folded TPH/test-quality audit, cleans up legacy/backward-compat/dead-code garbage left behind, refreshes affected docs, and requires outside-model approval evidence before merge-ready claims. Use after implementing a feature or fix, before claiming done, or when finalizing a blueprint."
3
- argument-hint: "<target> [--full] where target is: package|file|plan-slug|all"
2
+ description: "Post-implementation quality gate: local checks by default; --merge-ready requires exactly one outside-voice approval. Runs TPH/test-quality audit, dead-code sweep, and docs refresh. Use after implementing a feature or fix, before claiming done, or when finalizing a blueprint."
3
+ argument-hint: "<target> [--full|--merge-ready] where target is: package|file|plan-slug|all"
4
4
  allowed-tools: Bash, Read, Write, Edit, Glob, Grep, Task, TodoWrite
5
5
  ---
6
6
 
@@ -180,8 +180,10 @@ for the current repository and package configuration contract.
180
180
  `npm view <package> version`. For consumer setup smoke, use
181
181
  `vp install -g @webpresso/agent-kit@latest`, `wp setup`, and
182
182
  `wp sync --check`.
183
- 6. If the Version Packages PR has no WP check / CI is `action_required` with
184
- zero jobs, follow
183
+ 6. Version Packages PRs are authored via the **webpresso-dev** App installation
184
+ token in `release.yml` (not bare `GITHUB_TOKEN`). If a PR still has no WP
185
+ check / CI is `action_required` with zero jobs (legacy bot author or App
186
+ mint failure), follow
185
187
  [`docs/runbooks/version-packages-bot-ci.md`](../../../docs/runbooks/version-packages-bot-ci.md)
186
188
  (`gh run rerun` or Approve workflows). Do not admin-merge without WP check.
187
189
  7. After the OIDC publish path succeeds, set npm package publishing access to
@@ -0,0 +1,139 @@
1
+ ---
2
+ type: rule
3
+ slug: ci-cost-local-first
4
+ title: CI cost and local-first gates
5
+ status: active
6
+ scope: repo
7
+ applies_to: [agents]
8
+ related:
9
+ - cmd-execution
10
+ - ci-test-perf
11
+ - pre-implementation
12
+ - hook-hot-path
13
+ - no-timeout-as-fix
14
+ created: "2026-07-21"
15
+ last_reviewed: "2026-07-21"
16
+ paths:
17
+ - ".github/workflows/**"
18
+ - "catalog/agent/**"
19
+ - "AGENTS.md"
20
+ - ".husky/**"
21
+ ---
22
+
23
+ # CI cost and local-first gates
24
+
25
+ Agents waste money when they treat remote CI as the primary debugger.
26
+ **Catch failures locally first.** Remote CI is confirmation, not exploration.
27
+
28
+ Monthly spend on private repos (Ubicloud + GitHub-hosted minutes + artifact
29
+ storage) is a product constraint. Prefer cheap local loops over burning full
30
+ PR matrices to discover format/lint/type/test/governance failures.
31
+
32
+ ## Iron law
33
+
34
+ 1. **Never open or update a PR you already know will fail** a locally-runnable
35
+ gate (format, guardrails, typecheck, lint, affected tests, PR body contract,
36
+ changeset/blueprint trailers when applicable).
37
+ 2. **Never use `git push --no-verify` / `HUSKY=0` / skip hooks** to “save
38
+ time.” That only moves the failure to paid CI and trains a red-loop habit.
39
+ 3. **Never re-run a failed CI job “to see if it flaked”** until you have a
40
+ local reproduction or a concrete flake hypothesis with evidence.
41
+ 4. **Never add GitHub-hosted runners** (`ubuntu-latest`, `macos-*`,
42
+ `windows-*`) on private-repo workflows except the **Release / npm OIDC
43
+ publish** path (and release-native targets that truly need that OS). Default
44
+ is **Ubicloud** (`ubicloud-standard-2` / `-4` only when justified).
45
+
46
+ ## Local gate stack (must pass before push)
47
+
48
+ | When | Command / check |
49
+ | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
50
+ | Every commit | Managed pre-commit (format + staged guardrails) |
51
+ | Every push | `wp ci-preflight` before pushing; in agent-kit itself this is also enforced by `.husky/pre-push` |
52
+ | Before PR open / body edit | PR template fields filled; trailers exact (`Blueprint-exempt`, `Changeset-exempt`, `Review-skip` as **start-of-line** when used) |
53
+ | Before claim merge-ready | `/verify <target>` then `/verify <target> --merge-ready` when landing |
54
+
55
+ `wp ci-preflight` is fail-fast and **branch-scoped**:
56
+
57
+ 1. `wp format --affected --branch --check`
58
+ 2. `wp audit guardrails --affected --branch`
59
+ 3. `wp typecheck --affected --branch`
60
+ 4. `wp lint --affected --branch`
61
+ 5. `wp test --affected --branch`
62
+
63
+ If preflight fails: **fix locally**, do not push. Reproduce with the printed
64
+ `wp …` line.
65
+
66
+ ### Bootstrap before preflight
67
+
68
+ Missing `node_modules` in a worktree → run `wp install` (or the repo’s setup),
69
+ then preflight. Use `vp install` only when `wp` has no equivalent. Do not push a
70
+ bare worktree “to let CI install.”
71
+
72
+ ## Cost model (private repos)
73
+
74
+ | Resource | Cost driver | Agent duty |
75
+ | ------------------------------ | ------------------------------------------------- | ---------------------------------------------- |
76
+ | Ubicloud minutes | Every PR job matrix (lint, tests, smokes, shards) | Local preflight; avoid drive-by full re-runs |
77
+ | GitHub-hosted `ubuntu-latest` | Billable Actions minutes | Only release/OIDC publish unless proven needed |
78
+ | GitHub `macos-*` / `windows-*` | ~10× Linux minutes | Release natives only; never default PR CI |
79
+ | Actions artifacts / caches | Storage quota; can block Release uploads | Prefer short retention; do not spam artifacts |
80
+ | Failed CI loops | Full matrix × attempts | Fix from logs locally before `gh run rerun` |
81
+
82
+ Related: `ci-test-perf.md` (keep coverage; speed via workers/cache/shards — not
83
+ by skipping tests). Prefer **fewer/cheaper runners + sharding** over raising
84
+ timeouts (`no-timeout-as-fix.md`).
85
+
86
+ ## Workflow authoring (when you touch CI)
87
+
88
+ - Private non-release jobs: `runs-on: ubicloud-standard-2` by default.
89
+ - Use `ubicloud-standard-4` only when wall-time evidence shows standard-2 is
90
+ insufficient **with** full coverage and workers (document why).
91
+ - Release publish job may use `ubuntu-latest` for npm trusted publishing /
92
+ provenance. Session-memory / platform native matrices that require Darwin or
93
+ Windows may use GH-hosted OS runners **only on the Release (publish=true)
94
+ path**, never on ordinary PR CI.
95
+ - Path filters, `concurrency` cancel-in-progress, and change-scope skips are
96
+ preferred over always-on heavy jobs.
97
+ - Do not add nightly/macOS “perf” jobs that run on every PR; keep them opt-in
98
+ (`workflow_dispatch`, label, or schedule) and prefer Ubicloud for any check
99
+ that is not Apple-signing/display-bound.
100
+
101
+ ## PR governance without burning CI
102
+
103
+ These fail **before** expensive tests if you get them wrong — fix **before**
104
+ push/open:
105
+
106
+ - PR description AI/model disclosure + `Session id` (or `Session-skip`)
107
+ - `Review-skip: SKIP <reason>` must match `^Review-skip:` at **line start**
108
+ (not nested under a bullet)
109
+ - `Blueprint-exempt:` / `Changeset-exempt:` in **commit message** and/or body
110
+ when required (blueprint-pr-coverage reads **git trailers**, not only the PR body)
111
+ - Version Packages / bot CI: do not invent admin-merge; use the runbook
112
+ (`docs/runbooks/version-packages-bot-ci.md` when present)
113
+
114
+ ## Forbidden agent habits
115
+
116
+ - Push → watch red CI → tweak → push again (the “CI as unit test” loop)
117
+ - Broaden CI timeouts / disable flakes instead of root-cause fix
118
+ - Schedule or matrix-expand macOS/Windows for convenience
119
+ - Upload large artifacts every PR “for debugging”
120
+ - Claim “CI is green” from a partial check while WP check / required jobs pending
121
+ - Force-push past hooks to land red work for “later fix”
122
+
123
+ ## Good loop
124
+
125
+ ```text
126
+ edit → scoped lint/type/test → commit (hooks) → wp ci-preflight → push
127
+ → open PR with complete body → watch CI once → fix root cause locally if red
128
+ ```
129
+
130
+ When CI fails: download/read the failed job log, reproduce with the matching
131
+ local `wp` command, fix, preflight, push **one** corrective commit.
132
+
133
+ ## Related
134
+
135
+ - `cmd-execution.md` — bookend QA; scoped commands in the middle
136
+ - `ci-test-perf.md` — parallelism and install cache
137
+ - `pre-implementation.md` — blueprint gates that only fail in CI if left open
138
+ - `hook-hot-path.md` — pre-push stays local and non-network
139
+ - CLI: `wp ci-preflight` (pre-push owner)
@@ -56,9 +56,13 @@ Mutation/Stryker jobs are auto-exempt when the step/job name or nearby lines men
56
56
  When a single job still exceeds budget **with full coverage**:
57
57
 
58
58
  1. Prefer **Vitest sharding** (`vitest run --shard=i/n` + blob reporter merge) over raising isolation-off globally.
59
- 2. Prefer a **larger runner** (`ubicloud-standard-4`, etc.) + more `VITEST_MAX_WORKERS` over dropping suites.
59
+ 2. Prefer a **larger runner** (`ubicloud-standard-4`, etc.) + more `VITEST_MAX_WORKERS` over dropping suites — only after `ubicloud-standard-2` is proven insufficient. Do not jump to GitHub-hosted macOS/Windows for ordinary test jobs.
60
60
  3. Cache **native/build artifacts** when warm steps rebuild every PR (producer-specific).
61
61
 
62
+ Private-repo default is **Ubicloud** for non-release jobs. GitHub-hosted
63
+ runners are reserved for Release/OIDC publish (and release-native OS builds).
64
+ See `ci-cost-local-first.md`.
65
+
62
66
  ## Related
63
67
 
64
68
  - Vitest performance: https://vitest.dev/guide/improving-performance
@@ -14,6 +14,15 @@ paths:
14
14
 
15
15
  # Command Execution Rules
16
16
 
17
+ ## Local-first before remote CI
18
+
19
+ Paid CI (Ubicloud + GitHub-hosted) is for confirmation. Use scoped commands
20
+ while iterating, then **`wp ci-preflight` before every push**. In agent-kit
21
+ itself, `.husky/pre-push` enforces that gate; consumer templates may leave
22
+ pre-push checks user-owned. Never `git push --no-verify` to skip a configured
23
+ local gate. See `ci-cost-local-first.md` for runner policy and anti-red-loop
24
+ habits.
25
+
17
26
  ## BOOKEND Rule: Full QA Runs Exactly Twice
18
27
 
19
28
  The full QA pipeline (e.g. `wp qa`, `bun run qa`) is a
@@ -264,7 +264,8 @@ Doing it post-merge is also impossible without a second PR: you cannot push the
264
264
  **Local pre-push check (catches the CI failure before it costs minutes):** the
265
265
  local lifecycle audit gives a false pass here because the owner worktree resolves
266
266
  on your machine. So do not rely on it alone — before opening or updating the PR,
267
- confirm no changed blueprint is still under `blueprints/in-progress/`:
267
+ run `wp ci-preflight` for ordinary quality gates and confirm no changed blueprint
268
+ is still under `blueprints/in-progress/`:
268
269
 
269
270
  ```bash
270
271
  git diff --name-only origin/main...HEAD | grep -q '^blueprints/in-progress/' \
@@ -0,0 +1,80 @@
1
+ ---
2
+ type: rule
3
+ slug: test-scan-perf
4
+ title: Test scan performance (no full-repo FS walks)
5
+ status: active
6
+ scope: repo
7
+ applies_to: [agents]
8
+ related:
9
+ - testing-philosophy
10
+ - ci-test-perf
11
+ created: "2026-07-20"
12
+ last_reviewed: "2026-07-20"
13
+ paths:
14
+ - "**/*.{test,spec}.{ts,tsx,js,jsx}"
15
+ - "src/audit/test-scan-perf.ts"
16
+ ---
17
+
18
+ # Test scan performance
19
+
20
+ Unit and contract tests must not walk the whole repository with
21
+ `readdirSync` / `statSync` / `readFileSync` and paper over the cost with a
22
+ 30s+ per-test timeout.
23
+
24
+ ## Forbidden pattern
25
+
26
+ ```ts
27
+ const repoRoot = findRepoRoot();
28
+ const walk = (dir: string) => {
29
+ for (const entry of readdirSync(dir)) {
30
+ const full = join(dir, entry);
31
+ if (statSync(full).isDirectory()) {
32
+ walk(full);
33
+ continue;
34
+ }
35
+ const text = readFileSync(full, "utf8");
36
+ // ...
37
+ }
38
+ };
39
+ walk(repoRoot);
40
+
41
+ it("scan", () => {
42
+ /* ... */
43
+ }, 30_000); // band-aid
44
+ ```
45
+
46
+ ## Preferred
47
+
48
+ ```ts
49
+ // Tracked files only — seconds, not tens of seconds.
50
+ const stdout = execFileSync(
51
+ "git",
52
+ ["-C", root, "grep", "-l", "-I", "-E", "RETIRED_SPECIFIER_A|RETIRED_SPECIFIER_B"],
53
+ { encoding: "utf8" },
54
+ );
55
+ ```
56
+
57
+ Or walk a **bounded** fixture / package tree (not `findRepoRoot()` / `process.cwd()`).
58
+
59
+ ## Guardrail
60
+
61
+ | Surface | Contract |
62
+ | ---------- | ---------------------------------- |
63
+ | Audit | `wp audit test-scan-perf` |
64
+ | Guardrails | included in `wp audit guardrails` |
65
+ | Scope | affected-safe (changed test files) |
66
+
67
+ ### Opt-out
68
+
69
+ ```ts
70
+ // test-scan-perf-allow — one-off inventory with justification
71
+ walk(repoRoot);
72
+
73
+ // or once per file:
74
+ // test-scan-perf-allow-file — full inventory intentionally walks the tree
75
+ ```
76
+
77
+ ## Related
78
+
79
+ - Implementation: `src/audit/test-scan-perf.ts`
80
+ - CI workers/cache: `ci-test-perf` (workflow-level, separate concern)
@@ -73,7 +73,12 @@ Map routing intent like this:
73
73
  `deep-research`
74
74
  - debugging and regressions → `investigate` then `fix`
75
75
  - bounded cleanup after behavior is green → `ai-deslop`
76
-
77
- Use `wp_*` tools for tests, lint, typecheck, audits, blueprint execution, and
78
- quality gates. Use the curated review skills for plan critique, outside voice,
79
- and pre-landing review when explicitly requested or clearly useful.
76
+ - multi-task / parallel execute → `ultragoal` + `/pll` (ready-queue, worktrees)
77
+ - local completeness `/verify` then `wp ci-preflight` before push; merge-ready
78
+ outside voice `/verify --merge-ready` (exactly one sequential outside
79
+ reviewer unless user sets N). Do not use remote CI as the first debugger
80
+ (`ci-cost-local-first`).
81
+
82
+ Use the full `wp_*` MCP surface for tests, lint, typecheck, audits, session memory,
83
+ ultragoal, worktrees, PRs, and quality gates — not shell reimplementations. Use
84
+ curated outside-voice skills only within `review_budget` (default 0 local / 1 merge-ready).
@@ -5,9 +5,9 @@ title: Autopilot
5
5
  status: active
6
6
  scope: repo
7
7
  applies_to: [agents]
8
- related: [goal, plan-refine, verify, testing-philosophy]
8
+ related: [goal, plan-refine, verify, testing-philosophy, ultragoal, pll, fix]
9
9
  created: "2026-07-10"
10
- last_reviewed: "2026-07-10"
10
+ last_reviewed: "2026-07-21"
11
11
  name: autopilot
12
12
  description: "Drive a brief through the bounded native goal pipeline."
13
13
  argument-hint: "<brief|force: brief>"
@@ -15,25 +15,62 @@ argument-hint: "<brief|force: brief>"
15
15
 
16
16
  # Autopilot
17
17
 
18
- Drive an approved brief through `plan -> execute -> qa -> validate -> land -> complete` using `wp ultragoal run` and the current handoff.
18
+ Drive an approved brief through `plan -> execute -> qa -> validate -> land -> complete`
19
+ using `wp_ultragoal_run` / `wp ultragoal run` and the current handoff.
20
+
21
+ ## Outside-voice (required)
22
+
23
+ After each ultragoal **phase or plan-gate milestone**, run an **OpenCode Go** outside-voice review and pick the model by purpose (plan critique → DeepSeek Pro; coding quality → Kimi Code first; cheap recheck → DeepSeek Flash). Resolve IDs from live `opencode models opencode-go`. Lifecycle authority only via converged `wp review gate` — never self-approve. Full protocol: the `ultragoal` skill. Respect `review_budget` (default one sequential path; no multi-host stampede).
19
24
 
20
25
  ## Vague gate
21
26
 
22
- A brief is anchored when it includes a file path, symbol, issue number, test name, or numbered steps. Route any unanchored brief through `plan-refine` before execution. A leading `force:` is the only explicit bypass; strip it before creating the goal and record the bypass in the blueprint.
27
+ A brief is anchored when it includes a file path, symbol, issue number, test name, or numbered steps
28
+ (blueprint slug and explicit budgets also count). Route any unanchored brief through
29
+ `plan-refine` before execution.
30
+
31
+ **Reject** (unless rewritten with scope + budgets): “complete all”, “full autopilot”,
32
+ “go to sleep”, “elegantly merge everything” without a named blueprint/PR set.
33
+
34
+ A leading `force:` is the only explicit bypass; strip it before creating the goal and
35
+ record the bypass in the blueprint.
36
+
37
+ Default budgets if the user omits them: `concurrency=4`, `fix_budget=1`,
38
+ `review_budget=1`, no `/loop`. See `ultragoal` skill.
39
+
40
+ ## Tooling map
41
+
42
+ | Pipeline step | Tools |
43
+ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
44
+ | Plan | `plan-refine`, `wp_blueprint_*`, `wp_session_capture` for decisions |
45
+ | Create controller | `wp_ultragoal_new`, `wp_worktree` |
46
+ | Execute | ready-set via blueprint tools; `/pll` or parallel subagents; `wp_session_context` for delegates; `wp_blueprint_task_verify` only to complete tasks |
47
+ | Opportunistic repair | `/fix` up to `fix_budget`; else handoff backlog |
48
+ | QA | `wp_qa` / `wp_lint` / `wp_typecheck` / `wp_test`; PR checks via `wp_pr_status` / `wp_pr_wait` |
49
+ | Validate | one outside voice if merge-bound (OpenCode Go by purpose, or claude/codex/grok); `wp review gate` for authority |
50
+ | Land | `wp_pr_upsert`, green required checks, merge + owner cleanup |
51
+ | Blocked / stop | `wp_ultragoal_handoff` ≤40 lines; `wp_ultragoal_cancel` if abandoned |
23
52
 
24
53
  ## Pipeline
25
54
 
26
- 1. Plan: refine blueprints and satisfy provenance-backed promotion approvals.
27
- 2. Execute: implement current ready tasks; use only `wp_blueprint_task_verify` to mark them done.
28
- 3. QA: run affected checks and `wp qa`; preserve normalized failure evidence.
29
- 4. Validate: obtain distinct verification and code-review evidence and resolve findings. Each lane appends a tracked `reviews.md` record in one of these exact forms:
55
+ 1. **Plan:** refine blueprints and satisfy provenance-backed promotion approvals.
56
+ 2. **Execute:** implement current **ready** tasks in parallel up to `concurrency`; use only
57
+ `wp_blueprint_task_verify` to mark them done.
58
+ 3. **QA:** run affected checks and `wp_qa`; preserve normalized failure evidence. Prefer
59
+ PR-bound CI when a PR exists.
60
+ 4. **Validate:** obtain verification + code-review evidence within `review_budget`. Each
61
+ lane appends a tracked `reviews.md` record in one of these exact forms:
30
62
 
31
63
  ```text
32
64
  <!-- wp:goal-validation {"kind":"verify","reviewer":"<identity>","artifact":"<tracked-path>"} -->
33
65
  <!-- wp:goal-validation {"kind":"code-review","reviewer":"<different-identity>","artifact":"<tracked-path>"} -->
34
66
  ```
35
67
 
36
- 5. Land: require green PR checks, complete the blueprint in the same PR, merge, and run owner cleanup.
37
- 6. Complete: stop only when `wp ultragoal run` records terminal evidence.
68
+ 5. **Land:** require green PR checks, complete the blueprint in the same PR, merge, and
69
+ run owner cleanup.
70
+ 6. **Complete:** stop only when `wp_ultragoal_run` records terminal evidence.
38
71
 
39
- Resume from durable state after interruption. Obey `WP_ULTRAGOAL_DISABLE=1`, iteration/error/validation caps, and repository ownership. The pipeline must never self-approve, directly mark tasks done, bypass evidence, or push to main. Keep every loop bounded and never increase timeouts.
72
+ Resume from durable state after interruption. Obey `WP_ULTRAGOAL_DISABLE=1`,
73
+ iteration/error/validation caps, and repository ownership. Never self-approve, directly
74
+ mark tasks done, bypass evidence, push to main, or increase timeouts (keep every loop bounded and never increase timeouts). After every phase
75
+ transition recorded by `wp ultragoal run`, obtain a fresh OpenCode Go outside review
76
+ before treating the milestone as closed (see Outside-voice above and the `ultragoal` skill).
@@ -8,6 +8,13 @@ license: MIT
8
8
 
9
9
  Use when a non-Claude host needs Claude to review a diff, challenge a plan, or answer a focused repo question. Keep it bounded/read-only unless asked otherwise, and report Claude output as advice, not verified fact.
10
10
 
11
+ ## Single-shot budget (anti-stampede)
12
+
13
+ - Default: **one** review invocation per request.
14
+ - Do **not** spawn parallel Claude + Codex + Grok + OpenCode reviews unless the user set `review_budget`/`N` > 1.
15
+ - Prefer `wp review run` / `wp review gate` over hand-rolled multi-agent loops.
16
+ - Bounded payload only (see below). Split large diffs across sequential calls, never unbounded whole-PR dumps.
17
+
11
18
  ## Auth check
12
19
 
13
20
  Use local Claude CLI login directly; do not route through Anthropic API-key env vars.
@@ -8,6 +8,13 @@ license: MIT
8
8
 
9
9
  Use this skill from Claude or another non-Codex host when the user wants Codex to independently review a diff, challenge a plan, or answer a repo question. Keep Codex read-only by default and treat its answer as external advice until independently verified.
10
10
 
11
+ ## Single-shot budget (anti-stampede)
12
+
13
+ - Default: **one** review invocation per request.
14
+ - Do **not** fan out parallel multi-host review matrices unless the user set `review_budget`/`N` > 1.
15
+ - Prefer `wp review run` / `wp review gate` over spawn/wait agent loops for review.
16
+ - Keep prompts bounded; no whole-repo paste.
17
+
11
18
  ## Auth check
12
19
 
13
20
  ```bash
@@ -7,7 +7,7 @@ scope: repo
7
7
  applies_to: [agents]
8
8
  related: [verify, testing-philosophy]
9
9
  created: "2026-05-13"
10
- last_reviewed: "2026-05-22"
10
+ last_reviewed: "2026-07-21"
11
11
  name: fix
12
12
  description: "Root-cause fix workflow that runs investigate first when diagnosis or failing proof is still missing."
13
13
  argument-hint: '<target> where target is: file|symptom|error|test|"free-text description"'
@@ -23,18 +23,43 @@ This command turns "please fix it well" into an enforceable workflow: diagnose
23
23
  first, repair at the owner, prove the repair, and escalate to `/verify` when
24
24
  the blast radius is broader than a local fix.
25
25
 
26
+ ## Tooling map
27
+
28
+ | Need | Prefer |
29
+ | ---------------------- | --------------------------------------------------------------------------- |
30
+ | Reproduce / large logs | `wp_session_execute`, `wp_session_batch_execute`, `wp_session_execute_file` |
31
+ | Recall prior evidence | `wp_session_search`, `wp_session_restore`, `wp_session_retrieve` |
32
+ | Capture decisions | `wp_session_capture` (do not paste full reports back as user text) |
33
+ | Scoped proof | `wp_test`, `wp_lint`, `wp_typecheck`, or `wp_qa` |
34
+ | Audits | `wp_audit` / `wp_audits` |
35
+ | Worktree isolation | `wp_worktree` / `wp blueprint start` — never thrash primary checkout |
36
+ | PR follow-up | `wp_pr_status`, `wp_pr_upsert` when landing the fix |
37
+
26
38
  ## Non-negotiable invariants
27
39
 
28
40
  1. **Root cause, not symptom.** Trace the failure to the invariant that actually broke. Do not patch callers when the owner is fixable.
29
41
  2. **Loud failures, no silent fallbacks.** No default shims, sentinel returns, or catch-and-continue behavior that hides missing config, bad state, or broken boundaries.
30
- 3. **Use the repo's real execution surface.** Prefer repo-owned wrappers and injected routing guidance over host-specific tool assumptions. If the repo exposes quality wrappers, use them. Use bounded inspection paths for large-output investigation.
42
+ 3. **Use the repo's real execution surface.** Prefer MCP `wp_*` tools and repo wrappers over host Bash for search/test/lint. Use bounded session-memory paths for large output.
31
43
  4. **Regression proof is mandatory.** Add or strengthen a test or other reliable proof that would fail against the old behavior.
32
44
  5. **Raising timeouts is not a fix.** If a timeout fires, investigate the bottleneck. Only raise a bound when the repo already documents that workload and you can cite measurement.
33
45
  6. **Zero suppressions, zero papering over.** No lint disables, ts-ignore, compat aliases, or "temporary" branches to sneak the fix through.
34
46
  7. **Minimal correct diff.** Update every consumer of a changed contract in the same change, but do not bundle unrelated cleanup.
47
+ 8. **Primary checkout is sacred.** If HEAD is detached, primary is dirty with unrelated work, or you are not on a managed worktree for non-trivial edits → **stop** and move to `wp_worktree` / blueprint owner. Never leave the primary checkout broken.
48
+
49
+ ## Opportunistic fix budget (when called from ultragoal / autopilot / pll)
50
+
51
+ - At most **`fix_budget` (default 1)** pre-existing issues per controller phase.
52
+ - Each must have: named invariant, failing proof, owning path.
53
+ - If the repair needs its own blueprint or expands epic scope → **handoff backlog**, do not inline.
54
+ - Additional discoveries: list in the final report; do not thrash.
35
55
 
36
56
  ## Protocol
37
57
 
58
+ ### Step 0a — Worktree preflight
59
+
60
+ Before editing: confirm you are on a managed worktree or an explicitly allowed branch.
61
+ If the primary checkout is dirty/detached with unrelated state, stop and isolate first.
62
+
38
63
  ### Step 0 — Run the investigate phase when evidence is missing
39
64
 
40
65
  Before editing, check whether the current context already contains all of the
@@ -94,17 +119,20 @@ Do not keep production code written before the test as "reference". If you wrote
94
119
 
95
120
  Run the narrowest checks that prove the repaired behavior on the real repo surface:
96
121
 
97
- - targeted test(s) for the repaired path
98
- - targeted lint/typecheck/build checks for changed files or packages
99
- - any boundary-specific verification the repo requires for the touched surface
122
+ - `wp_test` / targeted tests for the repaired path
123
+ - `wp_lint` / `wp_typecheck` for changed surfaces
124
+ - `wp_qa` only when the blast radius needs the bookend
125
+ - Before push: `wp ci-preflight` (local pre-push owner). Do not use remote CI
126
+ re-runs as the primary fix loop (`ci-cost-local-first`).
100
127
 
101
128
  Rules:
102
129
 
103
- - Prefer repo-owned wrappers or routed quality tools over raw host-specific commands.
104
- - Reuse fresh logs if the repo auto-saves them; do not re-run long commands just to re-read output.
130
+ - Prefer MCP `wp_*` over raw host Bash.
131
+ - Reuse fresh logs / session-memory indexed output; do not re-run long commands just to re-read.
105
132
  - Read the exit code and summary before making a claim.
133
+ - Never `git push --no-verify` to land an unproven fix.
106
134
 
107
- Escalate to `/verify <target>` when any of these are true:
135
+ Escalate to `/verify <target>` (local) or `/verify <target> --merge-ready` when any of these are true:
108
136
 
109
137
  - the fix crosses packages
110
138
  - the fix changes a public or shared contract
@@ -8,6 +8,13 @@ license: MIT
8
8
 
9
9
  Use when a non-Grok host needs Grok Build to review a diff, challenge a plan, or answer a focused repo question. Keep it read-only by default. A provenance-backed Grok approval is first-class and satisfies the blueprint strong-reviewer gate alone, with the same rejection authority as Claude or Codex.
10
10
 
11
+ ## Single-shot budget (anti-stampede)
12
+
13
+ - Default: **one** review invocation per request.
14
+ - Do **not** run parallel multi-host review swarms unless the user set `review_budget`/`N` > 1.
15
+ - Prefer `wp review run` / `wp review gate --provider grok` for lifecycle authority.
16
+ - Bounded prompts only.
17
+
11
18
  ## Auth / binary
12
19
 
13
20
  ```bash
@@ -17,10 +17,21 @@ flaky behavior, or confusing symptom before editing code.
17
17
  - Stop once you can name the broken invariant, show the failing proof, and
18
18
  point at the owner that should be repaired.
19
19
 
20
+ ## Tooling map
21
+
22
+ | Need | Prefer |
23
+ | ---------------------- | ---------------------------------------------------------------- |
24
+ | Reproduce / large logs | `wp_session_execute`, `wp_session_batch_execute` |
25
+ | Large files | `wp_session_execute_file` |
26
+ | Prior continuity | `wp_session_search`, `wp_session_restore`, `wp_session_retrieve` |
27
+ | Capture findings | `wp_session_capture` (short pointer, not full paste-back) |
28
+ | Proof runs | `wp_test`, `wp_qa`, `wp_lint`, `wp_typecheck` |
29
+ | Code search/read | host Grep/Read first; avoid shell-as-IDE |
30
+
20
31
  ## Workflow
21
32
 
22
33
  1. Reproduce or capture the failure.
23
- - Run the exact failing command or trace the exact user path.
34
+ - Run the exact failing command or trace the exact user path (prefer `wp_session_execute`).
24
35
  - Keep the evidence that matters: error text, failing assertion, exit code,
25
36
  log path, or boundary mismatch.
26
37
  2. Read the whole boundary.