@webpresso/plugin-codex 0.0.4

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 (40) hide show
  1. package/.codex-plugin/plugin.json +23 -0
  2. package/.mcp.json +9 -0
  3. package/LICENSE +104 -0
  4. package/bin/wp +60 -0
  5. package/hooks/hooks.json +3 -0
  6. package/package.json +40 -0
  7. package/plugin-skill-ownership.json +99 -0
  8. package/skills/ai-deslop/SKILL.md +91 -0
  9. package/skills/autopilot/SKILL.md +77 -0
  10. package/skills/autoresearch/SKILL.md +49 -0
  11. package/skills/best-practice-research/SKILL.md +89 -0
  12. package/skills/browse/SKILL.md +25 -0
  13. package/skills/claude/SKILL.md +186 -0
  14. package/skills/codex/SKILL.md +142 -0
  15. package/skills/deep-interview/LICENSE.txt +28 -0
  16. package/skills/deep-interview/SKILL.md +269 -0
  17. package/skills/deep-research/SKILL.md +258 -0
  18. package/skills/delivery-program/SKILL.md +57 -0
  19. package/skills/design-review/SKILL.md +26 -0
  20. package/skills/devex-review/SKILL.md +28 -0
  21. package/skills/fix/SKILL.md +174 -0
  22. package/skills/grok/SKILL.md +32 -0
  23. package/skills/hooks-doctor/SKILL.md +78 -0
  24. package/skills/investigate/SKILL.md +72 -0
  25. package/skills/lore-protocol/SKILL.md +84 -0
  26. package/skills/opencode-go/SKILL.md +97 -0
  27. package/skills/plan-ceo-review/SKILL.md +27 -0
  28. package/skills/plan-design-review/SKILL.md +27 -0
  29. package/skills/plan-devex-review/SKILL.md +19 -0
  30. package/skills/plan-eng-review/SKILL.md +24 -0
  31. package/skills/plan-refine/SKILL.md +50 -0
  32. package/skills/plan-refine/references/full-methodology.md +645 -0
  33. package/skills/ralplan/SKILL.md +50 -0
  34. package/skills/team/SKILL.md +77 -0
  35. package/skills/tech-debt/SKILL.md +79 -0
  36. package/skills/testing-philosophy/SKILL.md +53 -0
  37. package/skills/testing-philosophy/references/full-testing-philosophy.md +523 -0
  38. package/skills/tph/SKILL.md +35 -0
  39. package/skills/ultragoal/SKILL.md +179 -0
  40. package/skills/verify/SKILL.md +283 -0
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: browse
3
+ description: "Browser/page inspection via Webpresso Playwright: inspect DOM, console, network basics, screenshots, and findings."
4
+ license: MIT
5
+ allowed-tools:
6
+ - Read
7
+ - Glob
8
+ - Grep
9
+ - Bash
10
+ ---
11
+
12
+ # Browse
13
+
14
+ Use `wp browser doctor` first if browser availability is unknown; if it reports a missing browser, run `wp browser ensure chromium`. Prefer repo-local preview or dev-server URLs; if none are discoverable, ask for a URL.
15
+
16
+ ## Read-only inspection
17
+
18
+ The `allowed-tools` frontmatter is an audited disclosure for supported hosts;
19
+ pretool-guard remains the enforced mutation backstop when a host does not prove
20
+ skill-frontmatter enforcement.
21
+
22
+ 1. Identify the URL and whether headed or headless mode is needed.
23
+ 2. Use `wp browser open <url> --json` for a lightweight smoke snapshot, or a project Playwright test for deeper flows.
24
+ 3. Report URL, title, status evidence, console/page errors when available, and any screenshots/artifacts.
25
+ 4. Do not mutate app data unless the user explicitly asks for a mutating browser flow.
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: claude
3
+ description: "Claude CLI outside-voice wrapper for review, adversarial challenge, or consultation from non-Claude hosts."
4
+ license: MIT
5
+ ---
6
+
7
+ # Claude outside voice
8
+
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
+
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 MCP `wp_review_run`, then the `wp review run` CLI fallback, over hand-rolled multi-agent loops.
16
+ - Bounded payload only (see below). Split large diffs across sequential calls, never unbounded whole-PR dumps.
17
+
18
+ ## Primary path: the `wp_review_run` MCP tool
19
+
20
+ When the webpresso MCP server is available, call `wp_review_run` exactly once
21
+ instead of any bash block below. It is the same `wp review run` typed runtime,
22
+ called in-process, and takes a `prompt` string without `--prompt-file` bookkeeping.
23
+ Use the default review stage.
24
+
25
+ ```jsonc
26
+ // wp_review_run MCP tool call
27
+ {
28
+ "prompt": "<diff summary + what to look for>",
29
+ "provider": "claude",
30
+ // model, effort, artifactRoot, idleSeconds, and stage are optional and
31
+ // default the same way the `wp review run` CLI does. The default stage is
32
+ // review.
33
+ }
34
+ ```
35
+
36
+ Use the requested provider for this invocation. Do not retry, use provider
37
+ fallback, or rotate accounts within the invocation. Never shell into a
38
+ provider CLI when MCP is available; that bypasses typed artifact capture under
39
+ `.webpresso/reviews`.
40
+
41
+ For long-running reviews, prefer the async MCP path: call `wp_review_run` with
42
+ `"provider": "claude"` and `"background": true`, then poll `wp_review_wait`
43
+ with the returned `runId`. Do not solve MCP transport limits by inflating
44
+ synchronous review timeouts.
45
+
46
+ The bash blocks in this skill (below) are the **MCP-unavailable fallback only**
47
+ — use them when the webpresso MCP server itself is not reachable in the current
48
+ host, not as a provider-fallback mechanism.
49
+
50
+ ## MCP-unavailable fallback: auth check
51
+
52
+ Use local Claude CLI login directly; do not route through Anthropic API-key env vars.
53
+
54
+ ```bash
55
+ AUTH_STATUS_FILE=$(mktemp -t wp-claude-auth.XXXXXX)
56
+ trap 'rm -f "$AUTH_STATUS_FILE"' EXIT
57
+ if ! claude auth status --json >"$AUTH_STATUS_FILE" 2>/dev/null; then
58
+ if ! claude auth status >"$AUTH_STATUS_FILE" 2>/dev/null; then
59
+ echo "CLAUDE_AUTH=missing: run claude auth login with the intended Claude Max account"
60
+ exit 1
61
+ fi
62
+ fi
63
+ if grep -E '"(authenticated|loggedIn|success)"[[:space:]]*:[[:space:]]*true' "$AUTH_STATUS_FILE" >/dev/null; then
64
+ echo "CLAUDE_AUTH=cli-login"
65
+ else
66
+ echo "CLAUDE_AUTH=missing: claude auth status did not report a recognized Claude CLI login"
67
+ exit 1
68
+ fi
69
+ ```
70
+
71
+ ## MCP-unavailable fallback: portable prompt file
72
+
73
+ Use a suffix-free `mktemp -t` pattern so macOS and Linux both work:
74
+
75
+ ```bash
76
+ PROMPT_FILE=$(mktemp -t wp-claude-review.XXXXXX)
77
+ trap 'rm -f "$PROMPT_FILE"' EXIT
78
+ ```
79
+
80
+ ## Dashboard helper relation
81
+
82
+ When this skill runs under `wp dash`, record the outside-voice lifecycle with
83
+ `wp dash-helper-start --provider claude --role reviewer` and
84
+ `wp dash-helper-complete --provider claude --role reviewer --outcome <completed|failed>`
85
+ using the actual terminal outcome and artifact path.
86
+ Outside the dashboard, skip helper emission. Claude's managed native subagent
87
+ lifecycle is not parent-linked; this unsupported coverage must stay explicit,
88
+ and completion must never be inferred from transcript text or timing.
89
+
90
+ ## Modes
91
+
92
+ ### Review
93
+
94
+ Use single-file / single-question first for any non-trivial diff. Do not send a whole PR unless it already fits within the bounded payload below.
95
+
96
+ **Model policy:** leave `CLAUDE_REVIEW_MODEL` unset unless the user requested a
97
+ specific Claude model (for example `fable` for a lighter advisory pass). When it
98
+ is unset, `wp review run` lets the Claude CLI choose its own default by omitting
99
+ `--model`. The blueprint promotion/completion approval gate
100
+ (`catalog/agent/rules/pre-implementation.md`) validates reviewer identity
101
+ (`claude`/`codex`/`grok`/an OpenCode-Go model), not the reviewed model string, so do not
102
+ claim the gate rejects a different Claude model.
103
+
104
+ #### Bounded prompt payload
105
+
106
+ Always include:
107
+
108
+ - current branch and base branch
109
+ - `git diff --stat`
110
+ - changed file list
111
+ - one targeted file diff or one narrow snippet/hunk only, capped to a fixed size
112
+
113
+ Prefer ~12 KB or ~200 lines per call. Split large reviews instead of raising the cap.
114
+
115
+ ```bash
116
+ BASE_BRANCH=${BASE_BRANCH:-origin/main}
117
+ CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
118
+ TARGET_FILE=${TARGET_FILE:?set TARGET_FILE to one changed file}
119
+
120
+ {
121
+ printf 'Outside review mode: focused diff review\n'
122
+ printf 'Base branch: %s\nCurrent branch: %s\n\n' "$BASE_BRANCH" "$CURRENT_BRANCH"
123
+ printf 'git diff --stat %s...HEAD\n' "$BASE_BRANCH"
124
+ git diff --stat "$BASE_BRANCH"...HEAD
125
+ printf '\nChanged files:\n'
126
+ git diff --name-only "$BASE_BRANCH"...HEAD
127
+ printf '\nTarget file: %s\n' "$TARGET_FILE"
128
+ printf 'Bounded target diff (max 12000 bytes):\n'
129
+ git diff --unified=3 "$BASE_BRANCH"...HEAD -- "$TARGET_FILE" | \
130
+ head -c 12000
131
+ printf '\n\nQuestion: Identify the highest-signal correctness, security, data-loss, or maintainability risk in %s. Quote only the smallest relevant excerpt. If context is insufficient, answer INSUFFICIENT_CONTEXT.\n' "$TARGET_FILE"
132
+ } >"$PROMPT_FILE"
133
+ ```
134
+
135
+ #### Progress-aware review runtime
136
+
137
+ Run one review through the typed `wp review run` owner. Skills must not embed
138
+ subprocess supervision. The runtime consumes Claude's streaming JSON events,
139
+ advances its idle clock only on monotonic semantic progress, and has no total
140
+ wall-clock cutoff.
141
+
142
+ The artifact root contains private runtime diagnostics, not a recorded
143
+ transcript or committable approval evidence. Direct `wp review run` output is
144
+ advisory. `wp_review_gate` is plan-only exact-version draft approval/auto-promotion;
145
+ implementation/phase reviews use advisory `wp_review_run` and never mutate
146
+ blueprint approval state. CLI delivery gates are MCP-unavailable compatibility only.
147
+
148
+ ```bash
149
+ CLAUDE_REVIEW_MODEL=${CLAUDE_REVIEW_MODEL:-}
150
+ CLAUDE_MODEL_ARGS=()
151
+ if [ -n "$CLAUDE_REVIEW_MODEL" ]; then
152
+ CLAUDE_MODEL_ARGS=(--model "$CLAUDE_REVIEW_MODEL")
153
+ fi
154
+ CLAUDE_REVIEW_EFFORT=${CLAUDE_REVIEW_EFFORT:-medium}
155
+ CLAUDE_REVIEW_IDLE_SECONDS=${CLAUDE_REVIEW_IDLE_SECONDS:-180}
156
+ CLAUDE_REVIEW_ARTIFACT_ROOT=${CLAUDE_REVIEW_ARTIFACT_ROOT:-"$(pwd)/.webpresso/reviews"}
157
+ CLAUDE_REVIEW_CODE=0
158
+ wp review run \
159
+ --provider claude \
160
+ --prompt-file "$PROMPT_FILE" \
161
+ "${CLAUDE_MODEL_ARGS[@]}" \
162
+ --effort "$CLAUDE_REVIEW_EFFORT" \
163
+ --stage review \
164
+ --artifact-root "$CLAUDE_REVIEW_ARTIFACT_ROOT" \
165
+ --idle-seconds "$CLAUDE_REVIEW_IDLE_SECONDS"
166
+ CLAUDE_REVIEW_CODE=$?
167
+ ```
168
+
169
+ Treat `true-idle`, `protocol-unsupported`, provider failure, abort, spawn failure, or artifact failure as an unavailable advisory result. Never replace them with a static timeout, arbitrary byte-growth heartbeat, or buffered-output fallback.
170
+
171
+ #### Invocation policy
172
+
173
+ Run one provider review per invocation. Do not retry, fall back to another
174
+ provider, or rotate accounts within the invocation. A new invocation requires
175
+ an explicit diagnosis and caller decision. Do not fall back to an unbounded
176
+ whole-PR prompt.
177
+
178
+ Summarize findings with severity, evidence, model, artifact path, and whether you independently verified them.
179
+
180
+ ### Challenge
181
+
182
+ Ask Claude to argue against the current plan: hidden assumptions, failure modes, missing tests, and simpler alternatives.
183
+
184
+ ### Consult
185
+
186
+ Ask a focused repo question. Include only the necessary file paths and snippets; do not send secrets.
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: codex
3
+ description: "Codex CLI outside-voice wrapper for code review, plan challenge, or consultation from non-Codex hosts."
4
+ license: MIT
5
+ ---
6
+
7
+ # Codex outside voice
8
+
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
+
11
+ ## Primary path: the `wp_review_run` MCP tool
12
+
13
+ When the webpresso MCP server is available, call `wp_review_run` exactly once instead of any bash block below. It is the same `wp review run` typed runtime, called in-process, and takes a `prompt` string without `--prompt-file` bookkeeping. Use the default review stage.
14
+
15
+ ```jsonc
16
+ // wp_review_run MCP tool call
17
+ {
18
+ "prompt": "<diff summary + what to look for>",
19
+ "provider": "codex",
20
+ // model, effort, artifactRoot, idleSeconds, and stage are optional and
21
+ // default the same way the `wp review run` CLI does. The default stage is
22
+ // review.
23
+ }
24
+ ```
25
+
26
+ Use the requested provider for this invocation. Do not retry, use provider fallback, or rotate accounts within the invocation. Never shell into a provider CLI when MCP is available; that bypasses typed artifact capture under `.webpresso/reviews`. The pretool guard hook redirects provider review launches to MCP.
27
+
28
+ For long-running reviews, prefer the async MCP path: call `wp_review_run` with
29
+ `"provider": "codex"` and `"background": true`, then poll `wp_review_wait`
30
+ with the returned `runId`. Do not solve MCP transport limits by inflating
31
+ synchronous review timeouts.
32
+
33
+ The bash blocks in this skill (below) are the **MCP-unavailable fallback only** — use them when the webpresso MCP server itself is not reachable in the current host, not as a provider-fallback mechanism.
34
+
35
+ ## Single-shot budget (anti-stampede)
36
+
37
+ - Default: **one** review invocation per request.
38
+ - Do **not** fan out parallel multi-host review matrices unless the user set `review_budget`/`N` > 1.
39
+ - Prefer `wp_review_run` (MCP) or `wp review run` (CLI fallback) over spawn/wait agent loops for review.
40
+ - Keep prompts bounded; no whole-repo paste.
41
+
42
+ ## MCP-unavailable fallback (raw CLI)
43
+
44
+ Everything from here down is the manual `wp review run` CLI path documented for hosts or sessions where the webpresso MCP server is not reachable. Prefer `wp_review_run` above whenever MCP is available.
45
+
46
+ ## MCP-unavailable fallback: auth check
47
+
48
+ ```bash
49
+ if ! codex login status >/dev/null 2>&1; then
50
+ echo "CODEX_AUTH=missing: run codex login before using the codex outside-voice skill"
51
+ exit 1
52
+ fi
53
+ echo "CODEX_AUTH=ok"
54
+ ```
55
+
56
+ ## MCP-unavailable fallback: portable prompt file
57
+
58
+ ```bash
59
+ PROMPT_FILE=$(mktemp -t wp-codex-review.XXXXXX)
60
+ trap 'rm -f "$PROMPT_FILE"' EXIT
61
+ ```
62
+
63
+ ## Dashboard helper relation
64
+
65
+ When called by `wp dash`, record the outside-voice lifecycle with
66
+ `wp dash-helper-start --provider codex --role reviewer` and
67
+ `wp dash-helper-complete --provider codex --role reviewer --outcome <completed|failed>`
68
+ using the actual terminal outcome and artifact path.
69
+ Standalone calls skip helper emission. Codex native subagent events are not
70
+ parent-linked in the managed lifecycle; this unsupported coverage must stay
71
+ explicit, and completion must never be inferred from text, PIDs, or
72
+ timestamps.
73
+
74
+ ## Options
75
+
76
+ Every mode runs through the `wp review run` runtime and honors these environment
77
+ overrides. Set them inline, e.g.
78
+ `CODEX_REVIEW_MODEL=gpt-5.6-sol CODEX_REVIEW_EFFORT=high /codex`.
79
+
80
+ - `CODEX_REVIEW_MODEL` — the Codex model. Defaults to the `model = "..."` in the
81
+ active Codex config (`${CODEX_HOME:-~/.codex}/config.toml`); if neither the
82
+ environment nor config names a model, `wp review run` lets the Codex CLI choose
83
+ its own default. It MUST be a model the current login is provisioned for: ChatGPT-account
84
+ logins use the config's codenamed ids (e.g. `gpt-5.6-sol`) and reject a bare
85
+ `gpt-5.6`. When the user names a model ("review with 5.6-sol"), pass it here.
86
+ - `CODEX_REVIEW_EFFORT` — reasoning effort, default `medium`. The review stage
87
+ accepts only `medium` or `high`; any other value is rejected.
88
+ - `CODEX_REVIEW_IDLE_SECONDS` — idle timeout in seconds for the review stage,
89
+ default `180`.
90
+ - `CODEX_REVIEW_ARTIFACT_ROOT` — directory for private runtime diagnostics,
91
+ default `<cwd>/.webpresso/reviews`. Never commit files from this directory or
92
+ cite them as approval evidence.
93
+
94
+ Direct `wp review run` output is advisory. `wp_review_gate` is plan-only
95
+ exact-version draft approval/auto-promotion; implementation/phase reviews use
96
+ advisory `wp_review_run` and never mutate blueprint approval state. CLI delivery
97
+ gates are MCP-unavailable compatibility only.
98
+
99
+ ## Modes
100
+
101
+ ### Review
102
+
103
+ 1. Capture the current branch, base branch, and `git diff --stat`.
104
+ 2. Write a concise prompt asking Codex to find correctness, security, data-loss, and maintainability risks.
105
+ 3. Run Codex through the typed review runtime in read-only mode:
106
+
107
+ ```bash
108
+ # CODEX_REVIEW_MODEL / CODEX_REVIEW_EFFORT are overridable — see ## Options for
109
+ # the full option list, valid values, and how to pick a login-supported model.
110
+ CODEX_REVIEW_MODEL=${CODEX_REVIEW_MODEL:-}
111
+ CODEX_MODEL_ARGS=()
112
+ if [ -n "$CODEX_REVIEW_MODEL" ]; then
113
+ CODEX_MODEL_ARGS=(--model "$CODEX_REVIEW_MODEL")
114
+ fi
115
+ CODEX_REVIEW_EFFORT=${CODEX_REVIEW_EFFORT:-medium}
116
+ case "$CODEX_REVIEW_EFFORT" in
117
+ medium|high) ;;
118
+ *) echo "CODEX_REVIEW_EFFORT must be one of: medium, high" >&2; exit 2 ;;
119
+ esac
120
+ CODEX_REVIEW_IDLE_SECONDS=${CODEX_REVIEW_IDLE_SECONDS:-180}
121
+ CODEX_REVIEW_ARTIFACT_ROOT=${CODEX_REVIEW_ARTIFACT_ROOT:-"$(pwd)/.webpresso/reviews"}
122
+ CODEX_REVIEW_CODE=0
123
+ wp review run \
124
+ --provider codex \
125
+ --prompt-file "$PROMPT_FILE" \
126
+ "${CODEX_MODEL_ARGS[@]}" \
127
+ --effort "$CODEX_REVIEW_EFFORT" \
128
+ --stage review \
129
+ --artifact-root "$CODEX_REVIEW_ARTIFACT_ROOT" \
130
+ --idle-seconds "$CODEX_REVIEW_IDLE_SECONDS"
131
+ CODEX_REVIEW_CODE=$?
132
+ ```
133
+
134
+ 4. Summarize findings with severity, evidence, and whether you independently verified them.
135
+
136
+ ### Challenge
137
+
138
+ Ask Codex to argue against the current plan: hidden assumptions, failure modes, missing tests, and simpler alternatives.
139
+
140
+ ### Consult
141
+
142
+ Ask a focused repo question. Include only the necessary file paths and snippets; do not send secrets.
@@ -0,0 +1,28 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yeachan Heo
4
+
5
+ Applies to the upstream deep-interview skill vendored from
6
+ https://github.com/Yeachan-Heo/oh-my-codex at commit
7
+ 0e00a6ebdd12a6674f5a4735942940b9bdcdb8c0. The upstream repository declares
8
+ the MIT license in its package.json and Cargo.toml at that commit without
9
+ shipping a standalone LICENSE file; this file preserves the standard MIT
10
+ copyright and permission notice for the vendored material.
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
@@ -0,0 +1,269 @@
1
+ ---
2
+ type: skill
3
+ slug: deep-interview
4
+ title: Deep Interview
5
+ status: active
6
+ scope: repo
7
+ applies_to: [agents]
8
+ related: [ralplan, autopilot, deep-research]
9
+ created: "2026-07-17"
10
+ last_reviewed: "2026-07-17"
11
+ name: deep-interview
12
+ description: "Socratic requirements interview with ambiguity gating before planning or execution handoff."
13
+ license: MIT
14
+ upstream:
15
+ source: https://github.com/Yeachan-Heo/oh-my-codex/tree/0e00a6ebdd12a6674f5a4735942940b9bdcdb8c0/skills/deep-interview
16
+ last_synced: "2026-07-17"
17
+ argument-hint: "[--quick|--standard|--deep] <idea or vague description>"
18
+ ---
19
+
20
+ <Purpose>
21
+ Deep Interview is an intent-first Socratic clarification loop that runs before planning or implementation. It turns vague ideas into execution-ready requirements by asking targeted questions about why the user wants a change, how far it should go, what should stay out of scope, and what the agent may decide without confirmation. It is a requirements mode: it produces a spec and hands off — it does NOT implement.
22
+ </Purpose>
23
+
24
+ <Use_When>
25
+
26
+ - The request is broad, ambiguous, or missing concrete acceptance criteria
27
+ - The user says "deep interview", "interview me", "ask me everything", or "don't assume"
28
+ - You want to avoid misaligned implementation from underspecified requirements
29
+ - You need a requirements artifact before handing off to `ralplan`, `autopilot`, `ultragoal`, `team`, or a new blueprint
30
+ </Use_When>
31
+
32
+ <Do_Not_Use_When>
33
+
34
+ - The request already has concrete file/symbol targets and clear acceptance criteria
35
+ - The user explicitly asks to skip planning/interview and execute immediately
36
+ - The user wants a technology/tradeoff investigation (use `deep-research`)
37
+ - A complete blueprint/plan already exists and execution should start
38
+ </Do_Not_Use_When>
39
+
40
+ <Why_This_Exists>
41
+ Execution quality is usually bottlenecked by intent clarity, not just missing implementation detail. A single expansion pass often misses why the user wants a change, where scope should stop, which tradeoffs are unacceptable, and which decisions still require user approval. This workflow applies Socratic pressure plus quantitative ambiguity scoring so downstream planning begins with an explicit, testable, intent-aligned spec.
42
+ </Why_This_Exists>
43
+
44
+ <Depth_Profiles>
45
+
46
+ - **Quick (`--quick`)**: fast pre-plan pass; target ambiguity `<= 0.30`; max 5 rounds
47
+ - **Standard (`--standard`, default)**: full requirement interview; target `<= 0.20`; max 12 rounds
48
+ - **Deep (`--deep`)**: high-rigor exploration; target `<= 0.15`; max 20 rounds
49
+
50
+ Max rounds is a hard cap, not a target. Do not continue only to reach a round count. Extra rigor does not override the active threshold. If no flag is provided, use **Standard**.
51
+ </Depth_Profiles>
52
+
53
+ <Execution_Policy>
54
+
55
+ - Ask ONE question per round. Never batch multiple interview rounds into one prompt.
56
+ - Ask about intent and boundaries before implementation detail.
57
+ - Target the weakest clarity dimension each round, after applying the stage-priority rules below.
58
+ - Treat every answer as a claim to pressure-test: the next question should usually demand evidence or an example, expose a hidden assumption, force a tradeoff or boundary, or reframe root cause vs symptom.
59
+ - Do not rotate to a new dimension just for coverage when the current answer is still vague. Stay on the thread until it is one layer deeper, one assumption clearer, or one boundary tighter.
60
+ - Before crystallizing, complete at least one explicit pressure pass that revisits an earlier answer with a deeper, assumption- or tradeoff-focused follow-up.
61
+ - Gather codebase facts via local search tools, `wp_session_*` retrieval, and read-only repo inspection before asking the user about internals.
62
+ - Always run a preflight context intake before the first question.
63
+ - For brownfield work, preflight must ground in docs before user-facing questions: inspect applicable `AGENTS.md`/`CLAUDE.md`, README/getting-started docs, relevant `docs/` contracts/plans/ADRs, existing blueprints under `blueprints/`, and any project glossary such as `UBIQUITOUS_LANGUAGE.md` when present.
64
+ - Treat repo language as evidence, not authority: if the user uses a fuzzy, overloaded, or conflicting term, surface the specific doc/code wording and ask which meaning should govern.
65
+ - Cross-check user claims about current behavior against code or documented contracts. If docs and code disagree, ask a confirmation question that names both sources instead of silently choosing one.
66
+ - Use scenario-based edge-case grilling when relationships, boundaries, or handoff behavior are unclear: invent one concrete scenario that stresses the ambiguous boundary, then ask one focused question about the expected outcome.
67
+ - Reduce user effort: ask only the highest-leverage unresolved question, and never ask the user for codebase facts you can discover directly.
68
+ - For brownfield work, prefer evidence-backed confirmation questions such as "I found X in Y. Should this change follow that pattern?"
69
+ - Route facts before judgment: before each user-facing round, classify whether the needed information is a discoverable fact, a fact needing confirmation, or a human decision. The interview is with the human for judgment, not for facts the agent can inspect.
70
+ - When unresolved ambiguity depends on current external best practices, upstream guidance, standards, or version-aware behavior, use `best-practice-research` as the bounded evidence wrapper before crystallizing.
71
+ - Auto-confirm only descriptive facts. If a finding implies what the feature should do, which pattern to follow, which tradeoff to accept, or what stays in/out of scope, route that decision to the user.
72
+ - Re-score ambiguity after each answer and show progress transparently.
73
+ - Once ambiguity is at or below the active threshold, stop ordinary questioning. Run the closure audit: crystallize/hand off when the readiness gates pass; otherwise ask only the final closure question needed to satisfy a named gate.
74
+ - Do not crystallize or hand off while `Non-goals` or `Decision Boundaries` remain unresolved, even if the weighted threshold is met.
75
+ - Do not hand off to execution while ambiguity remains above threshold unless the user explicitly opts to proceed with a warning.
76
+ - Treat early exit as a safety valve, not the default success path.
77
+ </Execution_Policy>
78
+
79
+ <Steps>
80
+
81
+ ## Phase 0: Preflight Context Intake
82
+
83
+ 1. Parse `{{ARGUMENTS}}` and derive a short kebab-case task slug.
84
+ 2. Attempt to load the latest relevant context for the slug from session memory via the `wp_session_search`/`wp_session_retrieve` MCP tools.
85
+ 3. If the provided initial context (or loaded snapshot) is too large for safe prompt use, the first round must ask for a concise prompt-safe summary before scoring ambiguity or any downstream handoff. This gate is blocking: preserve goals, constraints, success criteria, non-goals, decision boundaries, and references to the full source documents.
86
+ 4. If no snapshot exists, create a minimum snapshot with: task statement, desired outcome, stated solution, probable intent hypothesis, known facts/evidence, constraints, unknowns/open questions, decision-boundary unknowns, likely codebase touchpoints, repo docs/rules inspected, terminology/doc-code conflicts found.
87
+ 5. For brownfield tasks, inspect the applicable documentation/rule surface before the first user-facing round. Prefer exact, nearby sources: governing `AGENTS.md`/`CLAUDE.md`, README/getting-started docs, relevant `docs/` contracts/plans/ADRs, existing blueprints, and project glossary/context files when present.
88
+ 6. Capture the snapshot into session memory via `wp_session_capture` (tagged with the slug) and reference it in the interview state.
89
+
90
+ ## Phase 1: Initialize
91
+
92
+ 1. Parse `{{ARGUMENTS}}` and the depth profile (`--quick|--standard|--deep`).
93
+ 2. Detect project context: use local search tools and read-only repo inspection to classify **brownfield** (existing codebase target) vs **greenfield**; for brownfield, collect relevant context before questioning.
94
+ 3. Persist a lightweight resumable interview state to session memory via `wp_session_capture` (interview id, profile, type, initial idea, rounds, current ambiguity, threshold, max rounds, challenge modes used, current stage/focus, context snapshot reference), so a later session can resume via `wp_session_search`/`wp_session_restore`.
95
+ 4. Announce kickoff with the profile, threshold, and current ambiguity.
96
+
97
+ ## Phase 2: Socratic Interview Loop
98
+
99
+ Repeat until ambiguity `<= threshold`, the pressure pass is complete, and the readiness gates are explicit — or the user exits with warning or max rounds are reached. This is a stop condition: below threshold, do not open a new ordinary interview branch.
100
+
101
+ ### 2a) Generate next question
102
+
103
+ If the initial context is oversized and no prompt-safe summary has been recorded, the next question must be only a summary request. Do not score ambiguity or hand off until that summary is captured.
104
+
105
+ Use the original idea, prior Q&A rounds, current dimension scores, brownfield context, doc/terminology grounding notes, and any activated challenge mode (Phase 3).
106
+
107
+ Target the lowest-scoring dimension, but respect stage priority:
108
+
109
+ - **Stage 1 — Intent-first:** Intent, Outcome, Scope, Non-goals, Decision Boundaries
110
+ - **Stage 2 — Feasibility:** Constraints, Success Criteria
111
+ - **Stage 3 — Brownfield grounding:** Context Clarity (brownfield only)
112
+
113
+ Follow-up pressure ladder after each answer:
114
+
115
+ 1. Ask for a concrete example, counterexample, or evidence signal behind the latest claim.
116
+ 2. Probe the hidden assumption, dependency, or belief that makes the claim true.
117
+ 3. Force a boundary or tradeoff: what would you explicitly not do, defer, or reject?
118
+ 4. Challenge fuzzy or conflicting terms against the repo's documented language and current behavior.
119
+ 5. Stress-test the boundary with one concrete scenario when a relationship or handoff remains ambiguous.
120
+ 6. If the answer still describes symptoms, reframe toward root cause before moving on.
121
+
122
+ Prefer staying on the highest-leverage thread across multiple rounds. Breadth without pressure is not progress.
123
+
124
+ Maintain a **Breadth Ledger** across independent tracks (scope, constraints, outputs, verification, brownfield integration, plus any user-mentioned deliverable). The ledger is a guard, not a rotation rule: stay deep on the current thread until it is pressure-tested, then zoom out only when another material track remains unresolved and would change execution.
125
+
126
+ Maintain a **Docs/Terminology Ledger** for brownfield interviews: repo docs/rules inspected (with paths), canonical terms already in use, user terms that conflict with docs or code, and doc/code mismatches that require a human decision before implementation.
127
+
128
+ Detailed dimensions:
129
+
130
+ - Intent Clarity — why the user wants this
131
+ - Outcome Clarity — what end state they want
132
+ - Scope Clarity — how far the change should go
133
+ - Constraint Clarity — technical or business limits that must hold
134
+ - Success Criteria Clarity — how completion will be judged
135
+ - Context Clarity — existing codebase understanding (brownfield only)
136
+
137
+ `Non-goals` and `Decision Boundaries` are mandatory readiness gates. Ask about them early and keep revisiting them until they are explicit.
138
+
139
+ ### 2b) Ask the question
140
+
141
+ Ask exactly one question per round using the host's native structured-question tool (e.g. `AskUserQuestion`) when available; otherwise ask one concise plain-text question and wait for the answer. Present:
142
+
143
+ ```
144
+ Round {n} | Target: {weakest_dimension} | Ambiguity: {score}%
145
+
146
+ {question}
147
+ ```
148
+
149
+ Question-shape guidance:
150
+
151
+ - Deep Interview is Socratic — one focused round at a time. Never combine multiple rounds into one prompt.
152
+ - Use a **single-answerable** round when exactly one answer should drive the next branch, the options are mutually exclusive, or selecting more than one would blur the decision (e.g. handoff lane selection, choosing the primary failure mode, confirming which competing interpretation is correct).
153
+ - Use a **multi-answerable** round when multiple options may all be true at once and you need a bounded set of coexisting constraints, non-goals, risks, or acceptance checks in one round (e.g. all out-of-scope items, all success metrics that must hold, all deployment constraints that apply).
154
+ - If one selected option would immediately require a follow-up to disambiguate the others, prefer a single-answerable round now and ask the follow-up next. Do not hide a branching tree inside one overloaded multi-select.
155
+ - Keep options bounded and concrete. Only leave an "other" escape hatch when the interview genuinely needs one user-supplied option that cannot be enumerated in advance.
156
+
157
+ ### 2c) Score ambiguity
158
+
159
+ Score each weighted dimension in `[0.0, 1.0]` with justification and gap.
160
+
161
+ Greenfield: `ambiguity = 1 - (intent × 0.30 + outcome × 0.25 + scope × 0.20 + constraints × 0.15 + success × 0.10)`
162
+
163
+ Brownfield: `ambiguity = 1 - (intent × 0.25 + outcome × 0.20 + scope × 0.20 + constraints × 0.15 + success × 0.10 + context × 0.10)`
164
+
165
+ Readiness gate:
166
+
167
+ - `Non-goals` must be explicit.
168
+ - `Decision Boundaries` must be explicit.
169
+ - A pressure pass must be complete: at least one earlier answer revisited with an evidence, assumption, or tradeoff follow-up.
170
+ - A closure audit must pass: another question would change execution materially, not merely polish wording or chase a narrow edge case.
171
+ - If a gate is unresolved or the pressure pass is incomplete, continue below threshold only with a final closure question that names the unresolved gate.
172
+ - Treat a low score as permission to audit closure, not to keep drilling. If remaining uncertainty would not change implementation, crystallize instead of opening a new branch.
173
+
174
+ ### 2d) Report progress
175
+
176
+ Show the weighted breakdown table, readiness-gate status (`Non-goals`, `Decision Boundaries`), and the next focus dimension.
177
+
178
+ ### 2e) Persist state
179
+
180
+ Append the round result and updated scores to the slug-tagged interview state in session memory (`wp_session_capture`).
181
+
182
+ ### 2f) Round controls
183
+
184
+ - Do not offer early exit before the first explicit assumption probe and one persistent follow-up have happened.
185
+ - Apply a **Dialectic Rhythm Guard**: after 3 consecutive fact/confirmation answers, the next material round must solicit direct human judgment — unless the closure audit says the interview is ready to crystallize.
186
+ - Round 4+: allow explicit early exit with a risk warning.
187
+ - Soft warning at the profile midpoint.
188
+ - Hard cap at the profile max rounds; never treat this cap as a desired interview length.
189
+
190
+ ## Phase 3: Challenge Modes (assumption stress tests)
191
+
192
+ Use each mode once when applicable — normal escalation tools, not rare rescue moves:
193
+
194
+ - **Contrarian** (round 2+ or immediately when an answer rests on an untested assumption): challenge core assumptions.
195
+ - **Terminologist** (brownfield, when a key term is fuzzy, overloaded, or conflicts with repo docs/code): force a canonical meaning against existing project language before implementation.
196
+ - **Simplifier** (round 4+ or when scope expands faster than outcome clarity): probe minimal viable scope.
197
+ - **Ontologist** (round 5+ and ambiguity > 0.25, or when the user keeps describing symptoms): ask for essence-level reframing.
198
+
199
+ Track used modes in state to prevent repetition.
200
+
201
+ ## Phase 4: Crystallize Artifacts
202
+
203
+ When the threshold is met (or the user exits with warning / hard cap):
204
+
205
+ 1. Create or update the versioned draft that owns this task with `wp_blueprint_put`, yielding `blueprints/draft/{slug}/`. In this repo, deep interviews exist to produce better blueprints before implementation; carry the returned `bpv1:` version through every replacement.
206
+ 2. Write the interview transcript summary to `blueprints/draft/{slug}/interview.md`.
207
+ 3. Fold the execution-ready spec into `blueprints/draft/{slug}/_overview.md` (intent, scope, non-goals, decision boundaries, constraints, acceptance criteria), and capture a copy of the final spec + scores into session memory via `wp_session_capture`.
208
+
209
+ The spec should include: metadata (profile, rounds, final ambiguity, threshold, context type); context snapshot reference; prompt-safe initial-context summary when oversized context was provided, plus references to the full sources; the clarity breakdown table; Intent (why); Desired Outcome; In-Scope; Out-of-Scope / Non-goals; Decision Boundaries (what the agent may decide without confirmation); Constraints; testable acceptance criteria (prefer repo verification surfaces — `wp test`, `wp typecheck`, `wp audit` — over manual checks); assumptions exposed and their resolutions; pressure-pass findings (which answer was revisited and what changed); brownfield evidence-vs-inference notes; the Docs/Terminology Ledger; scenario/edge-case findings that shaped scope or acceptance; and the full or condensed transcript.
210
+
211
+ Durable docs, glossary, or ADR updates are opt-in and public-safe only: recommend them in the handoff summary, but do not auto-create or dump public docs from interview transcripts unless the user explicitly chooses that as in-scope.
212
+
213
+ ## Phase 5: Execution Bridge
214
+
215
+ Present execution options after artifact generation using explicit handoff contracts. Treat the deep-interview spec as the current requirements source of truth and preserve intent, non-goals, decision boundaries, acceptance criteria, docs/terminology grounding, and any residual-risk warnings across the handoff.
216
+
217
+ - **`ralplan`** — when architecture/test-shape review is still needed. Consumer treats the spec as the requirements source of truth and refines architecture/feasibility around the clarified intent instead of re-interviewing.
218
+ - **`autopilot`** — when the spec is already strong enough for direct planning plus execution. Consumer uses the spec as the clarified execution brief with the non-goals and acceptance criteria as binding context.
219
+ - **`ultragoal`** — when the clarified work should become durable, sequentially tracked goal-mode work.
220
+ - **`team`** — when the task is large, multi-lane, or blocker-sensitive enough to justify coordinated parallel execution.
221
+ - **Blueprint lifecycle** — refine with `wp_blueprint_put`, review the exact version with `wp_review_gate`, and inspect the auto-promoted result with `wp_blueprint_get` when work should enter planned execution directly.
222
+ - **Refine further** — re-enter the loop to resolve the highest-leverage remaining uncertainty when residual ambiguity is still too high or an early-exit/above-threshold warning indicates too much risk to proceed cleanly.
223
+
224
+ For research-shaped requests (a research question, evaluator-backed analysis, or reference gathering), hand off to `autoresearch` after the interview converges on a validator-ready mission; keep the explicit `refine further` vs `launch` boundary and do not launch until the user confirms.
225
+
226
+ **Residual-Risk Rule:** if the interview ended via early exit, hard cap, or above-threshold proceed-with-warning, explicitly preserve that residual-risk state in the handoff so the downstream skill knows it inherited a partially clarified brief.
227
+
228
+ **IMPORTANT:** Deep Interview is a requirements mode. On handoff, invoke the selected skill using the contract above. **Do NOT implement directly** inside deep-interview.
229
+
230
+ </Steps>
231
+
232
+ <Tool_Usage>
233
+
234
+ - Use local search tools, `wp_session_*` retrieval, and read-only repo inspection for codebase fact gathering.
235
+ - Use the host's native structured-question tool (e.g. `AskUserQuestion`) for each round when available; otherwise ask one concise plain-text question and wait.
236
+ - Keep context snapshots and resumable interview state in session memory via the `wp_session_*` MCP tools, tagged with the task slug.
237
+ - Read applicable repo docs/rules/context during preflight; write durable docs/glossary/ADR updates only when the user explicitly opts in and the content is public-safe.
238
+ - Land transcript artifacts in the active task's blueprint folder; create/update `_overview.md` only through `wp_blueprint_put`.
239
+ - Use `best-practice-research` when unresolved ambiguity depends on current external/upstream guidance.
240
+ </Tool_Usage>
241
+
242
+ <Escalation_And_Stop_Conditions>
243
+
244
+ - User says stop/cancel/abort — persist state and stop.
245
+ - Ambiguity stalls for 3 rounds (± 0.05) — force Ontologist mode once.
246
+ - Max rounds reached — proceed with an explicit residual-risk warning.
247
+ - All dimensions `>= 0.9` — allow early crystallization even before max rounds.
248
+ </Escalation_And_Stop_Conditions>
249
+
250
+ <Final_Checklist>
251
+
252
+ - [ ] Preflight context snapshot captured to session memory (`wp_session_capture`, slug-tagged)
253
+ - [ ] Oversized initial context, if present, has a prompt-safe summary before scoring or handoff
254
+ - [ ] Ambiguity score shown each round
255
+ - [ ] Intent-first stage priority used before implementation detail
256
+ - [ ] Weakest-dimension targeting used within the active stage
257
+ - [ ] At least one explicit assumption probe before crystallization
258
+ - [ ] At least one persistent follow-up / pressure pass deepened a prior answer
259
+ - [ ] Challenge modes triggered at thresholds (when applicable)
260
+ - [ ] `Non-goals` and `Decision Boundaries` explicit before handoff
261
+ - [ ] Transcript written to `blueprints/draft/{slug}/interview.md`
262
+ - [ ] Spec folded into `blueprints/draft/{slug}/_overview.md` through `wp_blueprint_put`
263
+ - [ ] Brownfield questions use evidence-backed confirmation and doc grounding when applicable
264
+ - [ ] Fuzzy/conflicting terminology challenged against repo language when applicable
265
+ - [ ] Handoff options provided (`ralplan`, `autopilot`, `ultragoal`, `team`, blueprint lifecycle)
266
+ - [ ] No direct implementation performed in this mode
267
+ </Final_Checklist>
268
+
269
+ Task: {{ARGUMENTS}}