cclaw-cli 0.40.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/content/compound-command.js +4 -2
- package/dist/content/harness-playbooks.js +34 -1
- package/dist/content/harness-tool-refs.d.ts +1 -1
- package/dist/content/harness-tool-refs.js +38 -10
- package/dist/content/ideate-command.d.ts +7 -0
- package/dist/content/ideate-command.js +178 -34
- package/dist/content/protocols.js +12 -4
- package/dist/content/retro-command.js +8 -4
- package/dist/content/stages/design.js +1 -1
- package/dist/content/stages/review.js +2 -2
- package/dist/content/stages/scope.js +1 -1
- package/dist/content/stages/ship.js +1 -1
- package/dist/content/start-command.js +1 -1
- package/dist/content/subagents.js +2 -2
- package/dist/harness-adapters.d.ts +17 -1
- package/dist/harness-adapters.js +18 -2
- package/dist/install.js +18 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,7 +152,7 @@ inside `/cc-ops` subcommands.
|
|
|
152
152
|
|---|---|
|
|
153
153
|
| **`/cc <idea>`** | Classify the task, discover origin docs (`docs/prd/**`, ADRs, root `PRD.md`, …), sniff the stack, recommend a track, then start the first stage of that track. `/cc` without arguments resumes the current flow. |
|
|
154
154
|
| **`/cc-next`** | The one progression primitive. Reads `flow-state.json`, checks gates + mandatory subagent delegations, and either resumes the current stage or advances to the next. `/cc-next` in a new session is how you **resume**. |
|
|
155
|
-
| **`/cc-ideate`** | Repository improvement discovery. Scans for TODOs, flaky tests, oversized modules, docs drift, and recurring knowledge-store lessons
|
|
155
|
+
| **`/cc-ideate`** | Repository improvement discovery. Scans for TODOs, flaky tests, oversized modules, docs drift, and recurring knowledge-store lessons, **persists the ranked backlog** to `.cclaw/artifacts/ideation-<date>-<slug>.md`, and ends with a concrete handoff: launch `/cc` on the selected candidate in the same session, save-and-close, or discard. Resume check on next run reuses any ideation artifact younger than 30 days. Never mutates `flow-state.json`. |
|
|
156
156
|
| **`/cc-view`** | Read-only flow visibility. `/cc-view status` (default) shows stage progress, mandatory delegations with their fulfillment mode (isolated / generic-dispatch / role-switch), the ship closeout substate (retro → compound → archive), and the active harness parity row. `/cc-view tree` renders the same picture as a tree with a closeout sub-branch under ship and a per-harness playbook summary. `/cc-view diff` shows stage/gate/closeout/delegation deltas since the last run. Never mutates state (except diff's snapshot baseline). |
|
|
157
157
|
|
|
158
158
|
> Power-user surface: `/cc-ops` is an operational router for manual
|
|
@@ -359,8 +359,8 @@ closes every real gap with a documented fallback — not a silent waiver.
|
|
|
359
359
|
|---|---|---|---|---|---|
|
|
360
360
|
| Claude Code | full (named subagents) | `native` | full | `AskUserQuestion` | [`claude-playbook.md`](./src/content/harness-playbooks.ts) |
|
|
361
361
|
| Cursor | generic Task dispatcher | `generic-dispatch` | full | `AskQuestion` | `cursor-playbook.md` |
|
|
362
|
-
| OpenCode | plugin / in-session | `role-switch` | plugin |
|
|
363
|
-
| OpenAI Codex | in-session only | `role-switch` (evidenceRefs required) | limited (Bash-only `PreToolUse`/`PostToolUse`; requires `codex_hooks` feature flag) |
|
|
362
|
+
| OpenCode | plugin / in-session | `role-switch` | plugin | `question` (permission-gated; `permission.question: "allow"`) | `opencode-playbook.md` |
|
|
363
|
+
| OpenAI Codex | in-session only | `role-switch` (evidenceRefs required) | limited (Bash-only `PreToolUse`/`PostToolUse`; requires `codex_hooks` feature flag) | `request_user_input` (experimental; Plan / Collaboration mode) | `codex-playbook.md` |
|
|
364
364
|
|
|
365
365
|
What the fallbacks mean:
|
|
366
366
|
|
|
@@ -39,8 +39,10 @@ the user can approve individual lifts, accept-all, or skip.
|
|
|
39
39
|
"Drift check" section in the skill): confirm the lift target file is
|
|
40
40
|
current, spot-check the repo for contradictions, demote stale clusters
|
|
41
41
|
into a new superseding entry instead of a lift.
|
|
42
|
-
6. Otherwise, present **one** structured ask
|
|
43
|
-
|
|
42
|
+
6. Otherwise, present **one** structured ask via the harness's native ask
|
|
43
|
+
tool (\`AskUserQuestion\` / \`AskQuestion\` / \`question\` /
|
|
44
|
+
\`request_user_input\`; plain-text lettered list as fallback) summarising
|
|
45
|
+
all candidates at once:
|
|
44
46
|
- \`apply-all\` (default) — apply every listed lift,
|
|
45
47
|
- \`apply-selected\` — prompt per-candidate,
|
|
46
48
|
- \`skip\` — record a skip reason and advance without changes.
|
|
@@ -134,7 +134,7 @@ Cursor dispatch is real isolation.
|
|
|
134
134
|
const OPENCODE_PLAYBOOK = `---
|
|
135
135
|
harness: opencode
|
|
136
136
|
fallback: role-switch
|
|
137
|
-
description: "OpenCode has plugin-based dispatch hooks but no isolated subagent worker primitive. cclaw uses an in-session role-switch with a delegation-log entry + evidenceRefs."
|
|
137
|
+
description: "OpenCode has plugin-based dispatch hooks and a native structured-ask tool (question) but no isolated subagent worker primitive. cclaw uses an in-session role-switch with a delegation-log entry + evidenceRefs, and emits Decision Protocol calls through the question tool when it is permitted."
|
|
138
138
|
---
|
|
139
139
|
|
|
140
140
|
# OpenCode — Parity Playbook
|
|
@@ -145,6 +145,22 @@ delegation gate by role-switching inside the same session: the agent
|
|
|
145
145
|
announces the role, performs the work against the contract, and records
|
|
146
146
|
evidence.
|
|
147
147
|
|
|
148
|
+
**Structured ask: native \`question\` tool.** OpenCode ships a first-class
|
|
149
|
+
\`question\` primitive (header + question text + options, plus a
|
|
150
|
+
"type custom" fallback; supports multi-question navigation). It is
|
|
151
|
+
permission-gated:
|
|
152
|
+
|
|
153
|
+
- \`opencode.json\` must grant \`permission.question: "allow"\` (or be
|
|
154
|
+
covered by a \`"*": "allow"\` default).
|
|
155
|
+
- ACP clients additionally need \`OPENCODE_ENABLE_QUESTION_TOOL=1\` set
|
|
156
|
+
on the \`opencode acp\` process.
|
|
157
|
+
|
|
158
|
+
When the tool is permitted, every Decision Protocol call maps to a single
|
|
159
|
+
\`question\` invocation. When it is denied or the host doesn't expose it,
|
|
160
|
+
fall back to the shared plain-text lettered list — same skeleton, same
|
|
161
|
+
artifact decision log. Full mapping:
|
|
162
|
+
\`.cclaw/references/harness-tools/opencode.md\`.
|
|
163
|
+
|
|
148
164
|
## Role-switch protocol
|
|
149
165
|
|
|
150
166
|
1. Announce the role explicitly in a single message:
|
|
@@ -225,6 +241,23 @@ Codex CLI has a different shape from Claude/Cursor:
|
|
|
225
241
|
layout is replaced by \`.agents/skills/cc*/\` and the old folders are
|
|
226
242
|
auto-removed on sync. Do not restore either by hand.
|
|
227
243
|
|
|
244
|
+
## Structured ask: native \`request_user_input\` tool
|
|
245
|
+
|
|
246
|
+
Codex exposes \`request_user_input\` — an experimental tool that accepts
|
|
247
|
+
1-3 short questions and returns the user's answers in the same order.
|
|
248
|
+
It is the primitive the built-in Plan / Collaboration mode templates use
|
|
249
|
+
(see \`codex-rs/collaboration-mode-templates/templates/plan.md\`), and
|
|
250
|
+
agents running inside Codex can call it directly. Answers come back as
|
|
251
|
+
free-form strings, not option IDs — keep lettered options inline in the
|
|
252
|
+
question text so the user's reply maps cleanly to the artifact
|
|
253
|
+
decision log.
|
|
254
|
+
|
|
255
|
+
cclaw stage skills invoke \`request_user_input\` for every Decision
|
|
256
|
+
Protocol call when the tool is available, and fall back to the shared
|
|
257
|
+
plain-text lettered list when Codex returns a schema error or when the
|
|
258
|
+
current host hides the tool (older builds, non-collaboration mode). Full
|
|
259
|
+
mapping: \`.cclaw/references/harness-tools/codex.md\`.
|
|
260
|
+
|
|
228
261
|
## Fallback: role-switch
|
|
229
262
|
|
|
230
263
|
Codex has no subagent dispatch — neither named nor generic. Mandatory
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
import type { HarnessId } from "../types.js";
|
|
18
18
|
export declare const HARNESS_TOOL_REFS_DIR = "references/harness-tools";
|
|
19
19
|
export declare function harnessToolRefMarkdown(harness: HarnessId): string;
|
|
20
|
-
export declare const HARNESS_TOOL_REFS_INDEX_MD = "---\nname: Harness tool maps\ndescription: \"Index file. One reference per supported harness \u2014 cite the per-harness file instead of hardcoding tool names in stage skills.\"\n---\n\n# Harness Tool Maps\n\ncclaw supports four harnesses; each exposes different primitive names for the same capabilities. Stage skills and utility skills cite the file matching the currently active harness and fall back to plain-text equivalents for capabilities that the harness lacks.\n\n| Harness | File | Notes |\n|---|---|---|\n| Claude Code | `.cclaw/references/harness-tools/claude.md` | Richest tool surface (AskUserQuestion, Task, WebFetch, WebSearch, MCP, \u2026). |\n| Cursor | `.cclaw/references/harness-tools/cursor.md` | Near-parity with Claude; uses `AskQuestion` instead of `AskUserQuestion`. |\n| OpenCode | `.cclaw/references/harness-tools/opencode.md` |
|
|
20
|
+
export declare const HARNESS_TOOL_REFS_INDEX_MD = "---\nname: Harness tool maps\ndescription: \"Index file. One reference per supported harness \u2014 cite the per-harness file instead of hardcoding tool names in stage skills.\"\n---\n\n# Harness Tool Maps\n\ncclaw supports four harnesses; each exposes different primitive names for the same capabilities. Stage skills and utility skills cite the file matching the currently active harness and fall back to plain-text equivalents for capabilities that the harness lacks.\n\n| Harness | File | Notes |\n|---|---|---|\n| Claude Code | `.cclaw/references/harness-tools/claude.md` | Richest tool surface (AskUserQuestion, Task, WebFetch, WebSearch, MCP, \u2026). |\n| Cursor | `.cclaw/references/harness-tools/cursor.md` | Near-parity with Claude; uses `AskQuestion` instead of `AskUserQuestion`. |\n| OpenCode | `.cclaw/references/harness-tools/opencode.md` | Native `question` tool (permission-gated) for structured asks; no isolated subagent dispatch. |\n| Codex | `.cclaw/references/harness-tools/codex.md` | Native `request_user_input` tool (experimental, Plan / Collaboration mode) for structured asks; no subagent dispatch. |\n\nWhen a new harness is added or an existing one renames a tool, update the corresponding file (and this index) \u2014 do NOT scatter tool names across skill text.\n";
|
|
@@ -133,13 +133,13 @@ description: "Canonical mapping of cclaw capability names → OpenCode primitive
|
|
|
133
133
|
|
|
134
134
|
# OpenCode — Tool Map
|
|
135
135
|
|
|
136
|
-
OpenCode exposes a leaner tool surface than Claude Code / Cursor. When a cclaw skill describes a capability that OpenCode lacks, fall back to the plain-text equivalent listed below.
|
|
136
|
+
OpenCode exposes a leaner tool surface than Claude Code / Cursor, but it DOES have a native structured-ask primitive (\`question\`) — you just have to opt into it. When a cclaw skill describes a capability that OpenCode lacks entirely, fall back to the plain-text equivalent listed below.
|
|
137
137
|
|
|
138
138
|
## Core capabilities
|
|
139
139
|
|
|
140
140
|
| cclaw capability | OpenCode primitive | Notes |
|
|
141
141
|
|---|---|---|
|
|
142
|
-
| Ask user a structured question |
|
|
142
|
+
| Ask user a structured question | \`question\` tool | Each call has a header, question text, and a list of options; users can pick an option or type a custom answer. Supports multiple questions with navigation. **Gated:** \`opencode.json\` must set \`permission.question: "allow"\`; ACP clients additionally need the \`OPENCODE_ENABLE_QUESTION_TOOL=1\` env var. If the tool is denied or unavailable, fall back to a plain-text lettered list (\`A) ... B) ... C) (recommended) ...\`). |
|
|
143
143
|
| Dispatch a subagent | **Not available as a tool.** | Inline the work in the current turn, or split across multiple turns with the user driving. |
|
|
144
144
|
| Read file | file-read primitive | Same role as \`Read\`. |
|
|
145
145
|
| Edit file | file-edit primitive | Same role as \`StrReplace\`; confirm diff before writing. |
|
|
@@ -154,6 +154,22 @@ OpenCode exposes a leaner tool surface than Claude Code / Cursor. When a cclaw s
|
|
|
154
154
|
|
|
155
155
|
## Decision-protocol mapping
|
|
156
156
|
|
|
157
|
+
When the \`question\` tool is enabled, issue one call per decision:
|
|
158
|
+
|
|
159
|
+
\`\`\`
|
|
160
|
+
question({
|
|
161
|
+
header: "<stage> decision",
|
|
162
|
+
question: "<one-sentence decision>",
|
|
163
|
+
options: [
|
|
164
|
+
"A) <label> — <trade-off>",
|
|
165
|
+
"B) <label> — <trade-off>",
|
|
166
|
+
"C) <label> — <trade-off> (recommended, because <reason>)"
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
\`\`\`
|
|
170
|
+
|
|
171
|
+
If the tool is denied or the host doesn't expose it, fall back to plain text using the same skeleton:
|
|
172
|
+
|
|
157
173
|
\`\`\`
|
|
158
174
|
Decision: <one sentence>.
|
|
159
175
|
|
|
@@ -166,7 +182,7 @@ Please reply with the letter.
|
|
|
166
182
|
|
|
167
183
|
## Escalation / fall-back
|
|
168
184
|
|
|
169
|
-
|
|
185
|
+
OpenCode has the structured-ask primitive (\`question\`) but no isolated subagent dispatch, so delegation falls back to the role-switch playbook. Flow gates and artifacts are identical; only the delivery channel changes.
|
|
170
186
|
`;
|
|
171
187
|
const CODEX_TOOLS_MD = `---
|
|
172
188
|
harness: codex
|
|
@@ -176,14 +192,14 @@ description: "Canonical mapping of cclaw capability names → Codex CLI primitiv
|
|
|
176
192
|
|
|
177
193
|
# Codex — Tool Map
|
|
178
194
|
|
|
179
|
-
Codex (OpenAI Codex CLI) exposes
|
|
195
|
+
Codex (OpenAI Codex CLI) exposes file I/O, shell, skills, and lifecycle hooks (≥ v0.114, gated by the \`codex_hooks\` feature flag). It does NOT have isolated subagent dispatch, but it DOES expose a native structured-ask tool (\`request_user_input\`) on builds with the Plan / Collaboration mode templates. Fall back to plain text only when that tool is denied or hidden.
|
|
180
196
|
|
|
181
197
|
## Core capabilities
|
|
182
198
|
|
|
183
199
|
| cclaw capability | Codex primitive | Notes |
|
|
184
200
|
|---|---|---|
|
|
185
|
-
| Ask user a structured question |
|
|
186
|
-
| Dispatch a subagent | **Not available as a tool.** |
|
|
201
|
+
| Ask user a structured question | \`request_user_input\` tool | Accepts 1-3 short questions and returns the user's answers in the same order. Experimental; used by Codex's built-in Plan / Collaboration mode (see \`codex-rs/collaboration-mode-templates/templates/plan.md\`). Offer only meaningful options — filler choices are explicitly discouraged. Free-form answer strings are returned; keep the lettered options inline in the question text. Fall back to a plain-text lettered list if the tool is hidden or errors. |
|
|
202
|
+
| Dispatch a subagent | **Not available as a tool.** | Codex has no named or generic subagent dispatch. cclaw closes the mandatory-delegation gate with the role-switch playbook (\`.cclaw/references/harnesses/codex-playbook.md\`). |
|
|
187
203
|
| Read file | \`read\` / \`open\` primitive | Same role as \`Read\`. |
|
|
188
204
|
| Edit file | \`edit\` / \`patch\` primitive | Same role as \`StrReplace\`. |
|
|
189
205
|
| Create file | \`write\` primitive | Prefer editing existing files. |
|
|
@@ -192,11 +208,23 @@ Codex (OpenAI Codex CLI) exposes roughly the same core surface as OpenCode: file
|
|
|
192
208
|
| Shell command | shell primitive | Codex CLI may restrict some binaries by default — check the effective permissions. |
|
|
193
209
|
| Fetch URL | \`curl\` via shell | Extract markdown manually. |
|
|
194
210
|
| Web search | **Not available.** | Ask user for docs / URL. |
|
|
195
|
-
| Todo tracking | **
|
|
211
|
+
| Todo tracking | \`update_plan\` tool (Codex-native checklist) | \`update_plan\` is Codex's built-in progress / checklist surface and is **separate** from Plan / Collaboration mode — do not conflate them. cclaw also keeps an inline \`### TODO\` block in-turn as an audit mirror. |
|
|
196
212
|
| MCP tool call | Depends on runtime config. | If MCP is wired, cite the descriptor; otherwise treat as unavailable. |
|
|
197
213
|
|
|
198
214
|
## Decision-protocol mapping
|
|
199
215
|
|
|
216
|
+
When \`request_user_input\` is available, issue a single call with 1-3 questions:
|
|
217
|
+
|
|
218
|
+
\`\`\`
|
|
219
|
+
request_user_input({
|
|
220
|
+
questions: [
|
|
221
|
+
"<stage> — <one-sentence decision>. Reply A/B/C. A) <label> — <trade-off>. B) <label> — <trade-off>. C) <label> — <trade-off> (recommended, <reason>)."
|
|
222
|
+
]
|
|
223
|
+
})
|
|
224
|
+
\`\`\`
|
|
225
|
+
|
|
226
|
+
Answers come back as free-form strings, not option IDs — keep the lettered options inline so the user's reply maps cleanly to the artifact decision log. When the tool is hidden (older build, non-collaboration mode), fall back to plain text with the same skeleton:
|
|
227
|
+
|
|
200
228
|
\`\`\`
|
|
201
229
|
Decision: <one sentence>.
|
|
202
230
|
|
|
@@ -209,7 +237,7 @@ Please reply with the letter.
|
|
|
209
237
|
|
|
210
238
|
## Escalation / fall-back
|
|
211
239
|
|
|
212
|
-
Treat missing tools as "plain-text required", not "skip the step". The gate still has to pass; only the channel changes.
|
|
240
|
+
\`request_user_input\` is the only structured-ask primitive Codex ships; dispatch still requires the role-switch playbook. Treat missing tools as "plain-text required", not "skip the step". The gate still has to pass; only the channel changes.
|
|
213
241
|
`;
|
|
214
242
|
const HARNESS_TOOL_REFS = {
|
|
215
243
|
claude: CLAUDE_TOOLS_MD,
|
|
@@ -233,8 +261,8 @@ cclaw supports four harnesses; each exposes different primitive names for the sa
|
|
|
233
261
|
|---|---|---|
|
|
234
262
|
| Claude Code | \`.cclaw/${HARNESS_TOOL_REFS_DIR}/claude.md\` | Richest tool surface (AskUserQuestion, Task, WebFetch, WebSearch, MCP, …). |
|
|
235
263
|
| Cursor | \`.cclaw/${HARNESS_TOOL_REFS_DIR}/cursor.md\` | Near-parity with Claude; uses \`AskQuestion\` instead of \`AskUserQuestion\`. |
|
|
236
|
-
| OpenCode | \`.cclaw/${HARNESS_TOOL_REFS_DIR}/opencode.md\` |
|
|
237
|
-
| Codex | \`.cclaw/${HARNESS_TOOL_REFS_DIR}/codex.md\` |
|
|
264
|
+
| OpenCode | \`.cclaw/${HARNESS_TOOL_REFS_DIR}/opencode.md\` | Native \`question\` tool (permission-gated) for structured asks; no isolated subagent dispatch. |
|
|
265
|
+
| Codex | \`.cclaw/${HARNESS_TOOL_REFS_DIR}/codex.md\` | Native \`request_user_input\` tool (experimental, Plan / Collaboration mode) for structured asks; no subagent dispatch. |
|
|
238
266
|
|
|
239
267
|
When a new harness is added or an existing one renames a tool, update the corresponding file (and this index) — do NOT scatter tool names across skill text.
|
|
240
268
|
`;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export declare function ideateCommandContract(): string;
|
|
2
2
|
export declare function ideateCommandSkillMarkdown(): string;
|
|
3
|
+
/**
|
|
4
|
+
* Exposed for tests and docs that need to mention the artifact convention
|
|
5
|
+
* without hard-coding the path string in two places.
|
|
6
|
+
*/
|
|
7
|
+
export declare const IDEATION_ARTIFACT_PATH_PATTERN = ".cclaw/artifacts/ideation-<YYYY-MM-DD-slug>.md";
|
|
8
|
+
export declare const IDEATION_ARTIFACT_GLOB_PATTERN = ".cclaw/artifacts/ideation-*.md";
|
|
9
|
+
export declare const IDEATION_RESUME_WINDOW = 30;
|
|
@@ -1,39 +1,62 @@
|
|
|
1
1
|
import { RUNTIME_ROOT } from "../constants.js";
|
|
2
2
|
const IDEATE_SKILL_FOLDER = "flow-ideate";
|
|
3
3
|
const IDEATE_SKILL_NAME = "flow-ideate";
|
|
4
|
+
/**
|
|
5
|
+
* Directory + filename convention for ideation artifacts. These are separate
|
|
6
|
+
* from stage artifacts (00-..08-*.md) because `/cc-ideate` runs outside the
|
|
7
|
+
* critical-path flow state machine and must not collide with stage numbering.
|
|
8
|
+
*/
|
|
9
|
+
const IDEATION_ARTIFACT_GLOB = ".cclaw/artifacts/ideation-*.md";
|
|
10
|
+
const IDEATION_ARTIFACT_PATTERN = ".cclaw/artifacts/ideation-<YYYY-MM-DD-slug>.md";
|
|
11
|
+
const IDEATION_RESUME_WINDOW_DAYS = 30;
|
|
12
|
+
/**
|
|
13
|
+
* Structured-ask tool list reused across cclaw skills. Kept inline here (small
|
|
14
|
+
* enough) to avoid cross-module coupling; larger stage skills cite the shared
|
|
15
|
+
* protocol file instead.
|
|
16
|
+
*/
|
|
17
|
+
const STRUCTURED_ASK_TOOLS = "`AskUserQuestion` on Claude, `AskQuestion` on Cursor, " +
|
|
18
|
+
"`question` on OpenCode when `permission.question: \"allow\"` is set, " +
|
|
19
|
+
"`request_user_input` on Codex in Plan / Collaboration mode; " +
|
|
20
|
+
"fall back to a plain-text lettered list when the tool is hidden or errors";
|
|
4
21
|
export function ideateCommandContract() {
|
|
5
22
|
return `# /cc-ideate
|
|
6
23
|
|
|
7
24
|
## Purpose
|
|
8
25
|
|
|
9
|
-
Repository-improvement discovery mode. Generate a ranked backlog of
|
|
10
|
-
improvements
|
|
26
|
+
Repository-improvement discovery mode. Generate a ranked backlog of
|
|
27
|
+
high-value improvements, persist it as an artifact on disk, and end with
|
|
28
|
+
an explicit handoff — either launch \`/cc\` on a chosen candidate in the
|
|
29
|
+
same session, or save/discard the backlog.
|
|
11
30
|
|
|
12
31
|
## HARD-GATE
|
|
13
32
|
|
|
14
|
-
-
|
|
15
|
-
- Every recommendation
|
|
16
|
-
|
|
33
|
+
- Discovery mode only. Never mutate \`.cclaw/state/flow-state.json\`.
|
|
34
|
+
- Every recommendation cites evidence from the current repository
|
|
35
|
+
(file path, command output, or knowledge-store entry id).
|
|
36
|
+
- Always write a persisted artifact to
|
|
37
|
+
\`${IDEATION_ARTIFACT_PATTERN}\`. Chat-only output is not acceptable —
|
|
38
|
+
the next session must be able to resume.
|
|
39
|
+
- Always end with a structured handoff prompt, not an open question.
|
|
17
40
|
|
|
18
41
|
## Algorithm
|
|
19
42
|
|
|
20
|
-
1.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
4.
|
|
33
|
-
5.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
1. **Resume check.** Glob \`${IDEATION_ARTIFACT_GLOB}\`. If any artifact
|
|
44
|
+
has been modified within the last ${IDEATION_RESUME_WINDOW_DAYS} days,
|
|
45
|
+
offer the user: continue that backlog, start fresh, or cancel.
|
|
46
|
+
2. **Scan repo signals:**
|
|
47
|
+
- open TODO/FIXME/XXX/HACK notes,
|
|
48
|
+
- flaky or failing tests,
|
|
49
|
+
- oversized modules / complexity hotspots,
|
|
50
|
+
- docs drift vs changed code,
|
|
51
|
+
- repeated entries in \`${RUNTIME_ROOT}/knowledge.jsonl\`.
|
|
52
|
+
3. **Produce 5-10 candidates** with impact (High/Medium/Low),
|
|
53
|
+
effort (S/M/L), confidence (High/Medium/Low), and one evidence path
|
|
54
|
+
per candidate.
|
|
55
|
+
4. **Rank by impact/effort**, recommend the top item.
|
|
56
|
+
5. **Write the artifact** at
|
|
57
|
+
\`${IDEATION_ARTIFACT_PATTERN}\` using the schema in the skill.
|
|
58
|
+
6. **Present the handoff prompt** with four concrete options — not A/B/C
|
|
59
|
+
letters. Default = "Start /cc on the top recommendation".
|
|
37
60
|
|
|
38
61
|
## Primary skill
|
|
39
62
|
|
|
@@ -43,31 +66,152 @@ improvements before committing to a specific feature request.
|
|
|
43
66
|
export function ideateCommandSkillMarkdown() {
|
|
44
67
|
return `---
|
|
45
68
|
name: ${IDEATE_SKILL_NAME}
|
|
46
|
-
description: "Repository ideation mode: detect and rank high-leverage improvements
|
|
69
|
+
description: "Repository ideation mode: detect and rank high-leverage improvements, persist a backlog artifact, and hand off to /cc or save/discard."
|
|
47
70
|
---
|
|
48
71
|
|
|
49
72
|
# /cc-ideate
|
|
50
73
|
|
|
51
74
|
## Announce at start
|
|
52
75
|
|
|
53
|
-
"Using flow-ideate to identify highest-leverage improvements in this
|
|
76
|
+
"Using flow-ideate to identify highest-leverage improvements in this
|
|
77
|
+
repository. Will persist a ranked backlog to
|
|
78
|
+
\`${IDEATION_ARTIFACT_PATTERN}\` and end with an explicit handoff."
|
|
54
79
|
|
|
55
80
|
## HARD-GATE
|
|
56
81
|
|
|
57
|
-
Do not start coding in ideate mode.
|
|
82
|
+
- Do not start coding in ideate mode.
|
|
83
|
+
- Do not mutate \`.cclaw/state/flow-state.json\` — ideation sits outside
|
|
84
|
+
the critical-path flow.
|
|
85
|
+
- Always produce the artifact file on disk before presenting the handoff.
|
|
86
|
+
- Always end with a structured handoff that names the concrete follow-up
|
|
87
|
+
command for each option. No A/B/C letters without command context.
|
|
58
88
|
|
|
59
89
|
## Protocol
|
|
60
90
|
|
|
61
|
-
|
|
62
|
-
2. Build candidate improvements with impact/effort/confidence.
|
|
63
|
-
3. Rank and recommend one candidate.
|
|
64
|
-
4. Ask for explicit selection.
|
|
65
|
-
5. If user selects a candidate, hand off to \`/cc <selected idea>\`.
|
|
91
|
+
### Phase 0 — Resume check
|
|
66
92
|
|
|
67
|
-
|
|
93
|
+
1. Use the harness's file-glob tool (\`Glob\` pattern
|
|
94
|
+
\`${IDEATION_ARTIFACT_GLOB}\` or equivalent \`ls\`/\`find\`).
|
|
95
|
+
2. Filter to files modified within the last ${IDEATION_RESUME_WINDOW_DAYS} days.
|
|
96
|
+
3. If one or more match, present **one** structured ask using the
|
|
97
|
+
harness's native tool (${STRUCTURED_ASK_TOOLS}) with options:
|
|
98
|
+
- **Continue the existing backlog** — read the most-recent
|
|
99
|
+
ideation-*.md and work from its candidate list; skip re-scanning.
|
|
100
|
+
- **Start a fresh scan** — proceed to Phase 1; the old artifact stays
|
|
101
|
+
on disk for history.
|
|
102
|
+
- **Cancel** — stop; do not scan or write anything.
|
|
103
|
+
4. If no recent artifact exists, proceed to Phase 1 silently.
|
|
68
104
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
105
|
+
### Phase 1 — Collect evidence
|
|
106
|
+
|
|
107
|
+
Scan the current repo. Examples of signals (not exhaustive):
|
|
108
|
+
|
|
109
|
+
- \`rg -n 'TODO|FIXME|XXX|HACK|TBD'\` grouped by file.
|
|
110
|
+
- Test-runner output (\`npm test\`, \`pytest\`, \`go test ./...\`) — note
|
|
111
|
+
failures, timeouts, deprecation warnings.
|
|
112
|
+
- Module size outliers (\`wc -l\` or \`du\`) with weak direct test coverage.
|
|
113
|
+
- Docs drift: check that \`README.md\` / \`docs/\` reference files that
|
|
114
|
+
still exist and flags/APIs that still match \`src/\`.
|
|
115
|
+
- \`${RUNTIME_ROOT}/knowledge.jsonl\` entries with \`type: "heuristic"\`
|
|
116
|
+
or repeated \`subject:\` values.
|
|
117
|
+
|
|
118
|
+
Record each finding with the exact file path or command that produced it.
|
|
119
|
+
|
|
120
|
+
### Phase 2 — Build candidates
|
|
121
|
+
|
|
122
|
+
For each high-signal finding, construct a candidate:
|
|
123
|
+
|
|
124
|
+
- **ID** — \`I-1\`, \`I-2\`, …
|
|
125
|
+
- **Title** — one short imperative phrase
|
|
126
|
+
- **Impact** — High / Medium / Low
|
|
127
|
+
- **Effort** — S / M / L
|
|
128
|
+
- **Confidence** — High / Medium / Low
|
|
129
|
+
- **Evidence** — path(s) or command output, inline if short
|
|
130
|
+
- **Proposed handoff** — the exact \`/cc <phrase>\` the user would run
|
|
131
|
+
to act on this candidate
|
|
132
|
+
|
|
133
|
+
Aim for 5–10 candidates. Do not invent candidates without evidence.
|
|
134
|
+
|
|
135
|
+
### Phase 3 — Rank and write the artifact
|
|
136
|
+
|
|
137
|
+
1. Sort by impact/effort ratio; break ties with confidence.
|
|
138
|
+
2. Compute the artifact filename:
|
|
139
|
+
- \`slug\` = first 3–5 words of the top recommendation, lowercase,
|
|
140
|
+
non-alphanumeric collapsed to \`-\`, trimmed. When ideation is
|
|
141
|
+
focus-hinted (user passed an argument), use the focus hint instead.
|
|
142
|
+
- \`date\` = today in \`YYYY-MM-DD\` (local time).
|
|
143
|
+
- Path = \`.cclaw/artifacts/ideation-<date>-<slug>.md\`.
|
|
144
|
+
3. Use the harness's write-file tool (\`Write\`, \`apply_patch\`, or shell
|
|
145
|
+
\`cat <<EOF > path\`) to create the artifact with this schema:
|
|
146
|
+
|
|
147
|
+
\`\`\`markdown
|
|
148
|
+
# Ideation — <date>
|
|
149
|
+
|
|
150
|
+
**Focus:** <user-supplied focus or "open-ended scan">
|
|
151
|
+
**Generated:** <ISO-8601 timestamp>
|
|
152
|
+
**Recommendation:** I-1
|
|
153
|
+
|
|
154
|
+
## Ranked backlog
|
|
155
|
+
|
|
156
|
+
| ID | Improvement | Impact | Effort | Confidence | Evidence |
|
|
157
|
+
|---|---|---|---|---|---|
|
|
158
|
+
| I-1 | Fix feature-worktree test timeouts | High | S | High | tests/unit/feature-system.test.ts:31 |
|
|
159
|
+
| … | … | … | … | … | … |
|
|
160
|
+
|
|
161
|
+
## Candidate detail
|
|
162
|
+
|
|
163
|
+
### I-1 — Fix feature-worktree test timeouts
|
|
164
|
+
- **Evidence:** \`npm test\` hangs 40s on tests/unit/feature-system.test.ts:31.
|
|
165
|
+
- **Handoff:** \`/cc Fix feature-worktree test timeouts on macOS\`
|
|
166
|
+
|
|
167
|
+
### I-2 — …
|
|
168
|
+
\`\`\`
|
|
169
|
+
|
|
170
|
+
4. Confirm in chat: "Wrote <path>."
|
|
171
|
+
|
|
172
|
+
### Phase 4 — Handoff prompt
|
|
173
|
+
|
|
174
|
+
Present **one** structured ask using the harness's native tool
|
|
175
|
+
(${STRUCTURED_ASK_TOOLS}). Each option must name the concrete follow-up —
|
|
176
|
+
no bare A/B/C.
|
|
177
|
+
|
|
178
|
+
Required options, in this order:
|
|
179
|
+
|
|
180
|
+
1. **Start /cc on the top recommendation** — the agent immediately loads
|
|
181
|
+
\`${RUNTIME_ROOT}/skills/using-cclaw/SKILL.md\` and invokes
|
|
182
|
+
\`/cc <I-1 handoff phrase>\` in the same turn. Default choice.
|
|
183
|
+
2. **Pick a different candidate** — the agent asks which ID (I-2, I-3, …)
|
|
184
|
+
and then invokes \`/cc <that candidate's handoff phrase>\`.
|
|
185
|
+
3. **Save and close** — leave the artifact on disk, do nothing else.
|
|
186
|
+
Next session: \`/cc-ideate\` will offer to resume it.
|
|
187
|
+
4. **Discard** — delete the just-written artifact. Use only when the
|
|
188
|
+
scan produced nothing actionable.
|
|
189
|
+
|
|
190
|
+
When the structured-ask tool is unavailable, fall back to a plain-text
|
|
191
|
+
lettered list with the same four labels. Do not invent extra options.
|
|
192
|
+
|
|
193
|
+
### Phase 5 — Execute the choice
|
|
194
|
+
|
|
195
|
+
- **Start /cc on I-1** or **different candidate:** announce
|
|
196
|
+
"Handing off to /cc <phrase>" and load the \`using-cclaw\` router
|
|
197
|
+
skill. From there, the normal \`/cc\` classification and stage flow
|
|
198
|
+
takes over. Do not produce a second artifact; the ideation file is
|
|
199
|
+
preserved as the origin document for this run.
|
|
200
|
+
- **Save and close:** reply with the artifact path and stop.
|
|
201
|
+
- **Discard:** delete the artifact file, confirm deletion, stop.
|
|
202
|
+
|
|
203
|
+
## Do not
|
|
204
|
+
|
|
205
|
+
- Do not write into \`.cclaw/artifacts/0X-*.md\` (stage artifacts).
|
|
206
|
+
- Do not mutate \`.cclaw/state/flow-state.json\` at any phase.
|
|
207
|
+
- Do not end the turn with an ungrounded "pick one" question — every
|
|
208
|
+
option in the handoff prompt must reference a concrete command.
|
|
72
209
|
`;
|
|
73
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Exposed for tests and docs that need to mention the artifact convention
|
|
213
|
+
* without hard-coding the path string in two places.
|
|
214
|
+
*/
|
|
215
|
+
export const IDEATION_ARTIFACT_PATH_PATTERN = IDEATION_ARTIFACT_PATTERN;
|
|
216
|
+
export const IDEATION_ARTIFACT_GLOB_PATTERN = IDEATION_ARTIFACT_GLOB;
|
|
217
|
+
export const IDEATION_RESUME_WINDOW = IDEATION_RESUME_WINDOW_DAYS;
|
|
@@ -13,10 +13,18 @@ Shared format for decisions that require user confirmation.
|
|
|
13
13
|
1. State the decision in one sentence.
|
|
14
14
|
2. Provide 2-4 labeled options (A, B, C...).
|
|
15
15
|
3. Mark one option as **recommended** with a short rationale.
|
|
16
|
-
4. Use harness
|
|
17
|
-
- Claude: \`AskUserQuestion\`
|
|
18
|
-
- Cursor: \`AskQuestion\`
|
|
19
|
-
- OpenCode
|
|
16
|
+
4. Use the harness's structured-ask tool when available:
|
|
17
|
+
- Claude: \`AskUserQuestion\` (up to ~4 options × multi-question).
|
|
18
|
+
- Cursor: \`AskQuestion\` (≥2 options, multi-question, optional \`allow_multiple\`).
|
|
19
|
+
- OpenCode: \`question\` tool (options + "type custom" fallback).
|
|
20
|
+
Requires \`permission.question: "allow"\` in \`opencode.json\`; ACP
|
|
21
|
+
clients additionally need \`OPENCODE_ENABLE_QUESTION_TOOL=1\`.
|
|
22
|
+
- Codex: \`request_user_input\` (1-3 short questions; experimental,
|
|
23
|
+
surfaced in Plan / Collaboration mode).
|
|
24
|
+
- Fallback (any harness where the native tool is hidden, denied, or
|
|
25
|
+
returns a schema error): a numbered / lettered plain-text list
|
|
26
|
+
keeping the same Re-ground / Simplify / RECOMMENDATION / Options
|
|
27
|
+
skeleton described below.
|
|
20
28
|
5. Wait for user choice before proceeding.
|
|
21
29
|
|
|
22
30
|
## Decision skeleton
|
|
@@ -48,8 +48,11 @@ in the structured ask; there is no \`--skip\` flag.
|
|
|
48
48
|
- scan \`${knowledgePath()}\` for entries recorded during this run,
|
|
49
49
|
- structure the draft as: Outcomes / Slowed / Accelerated / Repeatable rule.
|
|
50
50
|
4. Update \`closeout.retroDraftedAt = <ISO>\` in flow-state.
|
|
51
|
-
5. Present **one** structured ask
|
|
52
|
-
Cursor,
|
|
51
|
+
5. Present **one** structured ask using the harness's native tool
|
|
52
|
+
(\`AskUserQuestion\` on Claude, \`AskQuestion\` on Cursor, \`question\` on
|
|
53
|
+
OpenCode when \`permission.question: "allow"\` is set,
|
|
54
|
+
\`request_user_input\` on Codex in Plan / Collaboration mode; fall back
|
|
55
|
+
to a plain-text lettered list when the tool is hidden or errors):
|
|
53
56
|
- \`accept\` (default) — keep the draft as-is,
|
|
54
57
|
- \`edit\` — user edits \`${retroArtifactPath()}\` in-place, then re-runs \`/cc-next\`,
|
|
55
58
|
- \`skip\` — record \`retroSkipped: true\` + one-line reason, no compound entry required.
|
|
@@ -106,8 +109,9 @@ Do not silently skip. Do not finalize without updating \`flow-state.json\`.
|
|
|
106
109
|
- **Accelerated** — patterns/decisions that worked and are worth keeping.
|
|
107
110
|
- **Repeatable rule** — one candidate rule/pattern for next run.
|
|
108
111
|
Record \`closeout.retroDraftedAt\`.
|
|
109
|
-
3. Ask the user **one** structured question via the harness
|
|
110
|
-
(AskUserQuestion / AskQuestion /
|
|
112
|
+
3. Ask the user **one** structured question via the harness's native
|
|
113
|
+
ask tool (\`AskUserQuestion\` / \`AskQuestion\` / \`question\` /
|
|
114
|
+
\`request_user_input\`; plain-text lettered list as fallback):
|
|
111
115
|
|
|
112
116
|
> Retro draft ready at \`${retroArtifactPath()}\`. How do you want to
|
|
113
117
|
> proceed? (default: accept)
|
|
@@ -37,7 +37,7 @@ export const DESIGN = {
|
|
|
37
37
|
interactionProtocol: [
|
|
38
38
|
"Review architecture decisions section-by-section.",
|
|
39
39
|
"For EACH issue found in a review section, present it ONE AT A TIME. Do NOT batch multiple issues.",
|
|
40
|
-
"For each issue: use the Decision Protocol — describe concretely with file/line references, present labeled options (A/B/C) with trade-offs, effort estimate (S/M/L/XL), risk level (Low/Med/High), and mark one as (recommended). Do NOT use a numeric Completeness rubric; recommend the option that best covers architecture, data-flow, failure-modes, test, and perf review concerns for the issue with the lowest risk. If AskQuestion/
|
|
40
|
+
"For each issue: use the Decision Protocol — describe concretely with file/line references, present labeled options (A/B/C) with trade-offs, effort estimate (S/M/L/XL), risk level (Low/Med/High), and mark one as (recommended). Do NOT use a numeric Completeness rubric; recommend the option that best covers architecture, data-flow, failure-modes, test, and perf review concerns for the issue with the lowest risk. If the harness's native structured-ask tool is available (`AskUserQuestion` / `AskQuestion` / `question` / `request_user_input`), send exactly ONE question per call, validate fields against the runtime schema, and on schema error immediately fall back to a plain-text lettered list instead of retrying guessed payloads.",
|
|
41
41
|
"Only proceed to the next review section after ALL issues in the current section are resolved.",
|
|
42
42
|
"If a section has no issues, say 'No issues found' and move on.",
|
|
43
43
|
"Do not skip failure-mode mapping.",
|
|
@@ -39,9 +39,9 @@ export const REVIEW = {
|
|
|
39
39
|
"Run Layer 1 (spec compliance) completely before starting Layer 2.",
|
|
40
40
|
"In each review section, present findings ONE AT A TIME. Do NOT batch.",
|
|
41
41
|
"Classify every finding as Critical, Important, or Suggestion.",
|
|
42
|
-
"For each Critical finding: use the Decision Protocol — present resolution options (A/B/C) with trade-offs, and mark one as (recommended). Do NOT use a numeric Completeness rubric; recommend the option that fully closes the finding with no carry-over risk and the smallest blast radius. If
|
|
42
|
+
"For each Critical finding: use the Decision Protocol — present resolution options (A/B/C) with trade-offs, and mark one as (recommended). Do NOT use a numeric Completeness rubric; recommend the option that fully closes the finding with no carry-over risk and the smallest blast radius. If the harness's native structured-ask tool is available (`AskUserQuestion` on Claude, `AskQuestion` on Cursor, `question` on OpenCode with `permission.question: \"allow\"`, `request_user_input` on Codex in Plan/Collaboration mode), send exactly ONE question per call, validate fields against the runtime schema, and on schema error immediately fall back to a plain-text lettered list instead of retrying guessed payloads.",
|
|
43
43
|
"Resolve all critical blockers before ship.",
|
|
44
|
-
"For final verdict: use AskQuestion/
|
|
44
|
+
"For final verdict: use the native structured-ask tool (`AskUserQuestion` / `AskQuestion` / `question` / `request_user_input`) only if runtime schema is confirmed; otherwise collect verdict with a plain-text single-choice prompt (APPROVED / APPROVED_WITH_CONCERNS / BLOCKED).",
|
|
45
45
|
"**STOP.** Do NOT proceed to ship until the user provides an explicit verdict."
|
|
46
46
|
],
|
|
47
47
|
process: [
|
|
@@ -32,7 +32,7 @@ export const SCOPE = {
|
|
|
32
32
|
"**Error and Rescue Registry** — For each capability: what breaks, how detected, what fallback."
|
|
33
33
|
],
|
|
34
34
|
interactionProtocol: [
|
|
35
|
-
"For scope mode selection: use the Decision Protocol — present expand/selective/hold/reduce as labeled options with trade-offs and mark one as (recommended). Do NOT use a numeric Completeness rubric; recommend the option that best covers the prime-directive failure modes, four data-flow paths, observability, and deferred handling for the in-scope set with the smallest blast radius. Base your recommendation on default heuristics: greenfield -> expand, enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius -> reduce. If AskQuestion/
|
|
35
|
+
"For scope mode selection: use the Decision Protocol — present expand/selective/hold/reduce as labeled options with trade-offs and mark one as (recommended). Do NOT use a numeric Completeness rubric; recommend the option that best covers the prime-directive failure modes, four data-flow paths, observability, and deferred handling for the in-scope set with the smallest blast radius. Base your recommendation on default heuristics: greenfield -> expand, enhancement -> selective, bugfix/hotfix/refactor -> hold, broad blast radius -> reduce. If the harness's native structured-ask tool is available (`AskUserQuestion` / `AskQuestion` / `question` / `request_user_input`), send exactly ONE question per call, validate fields against the runtime schema, and on schema error immediately fall back to a plain-text lettered list instead of retrying guessed payloads.",
|
|
36
36
|
"Walk through the scope checklist interactively. Each checklist item that surfaces a decision should be presented to the user as a question, not as a monologue. Do not dump all items at once.",
|
|
37
37
|
"Challenge premise and verify the problem framing before anything else.",
|
|
38
38
|
"Take a position on every scope decision. Avoid hedging phrases like 'this could work' or 'there are many ways'; state your recommendation and one concrete condition that would change it.",
|
|
@@ -35,7 +35,7 @@ export const SHIP = {
|
|
|
35
35
|
interactionProtocol: [
|
|
36
36
|
"Run preflight checks before any release action.",
|
|
37
37
|
"Document release notes and rollback plan explicitly.",
|
|
38
|
-
"For finalization mode: use the Decision Protocol — present modes as labeled options (A/B/C/D) with consequences, and mark one as (recommended). Do NOT use a numeric Completeness rubric; recommend the mode that best addresses release blast-radius, rollback readiness, observability, and stakeholder communication — ties go to the most reversible option. If AskQuestion/
|
|
38
|
+
"For finalization mode: use the Decision Protocol — present modes as labeled options (A/B/C/D) with consequences, and mark one as (recommended). Do NOT use a numeric Completeness rubric; recommend the mode that best addresses release blast-radius, rollback readiness, observability, and stakeholder communication — ties go to the most reversible option. If the harness's native structured-ask tool is available (`AskUserQuestion` / `AskQuestion` / `question` / `request_user_input`), send exactly ONE question per call, validate fields against the runtime schema, and on schema error immediately fall back to a plain-text lettered list instead of retrying guessed payloads.",
|
|
39
39
|
"Do not proceed if critical blockers remain from review.",
|
|
40
40
|
"**STOP.** Present finalization options and wait for user selection before executing any finalization action."
|
|
41
41
|
],
|
|
@@ -76,7 +76,7 @@ This is the **recommended way to start** working with cclaw. Use \`/cc-next\` fo
|
|
|
76
76
|
7. Present the recommendation as a single decision with explicit options:
|
|
77
77
|
> \`Recommended track: <quick|medium|standard>\` because \`<one-line reason citing matched triggers>\`.
|
|
78
78
|
> Override? (A) keep \`<recommended>\` (B) switch track (C) cancel.
|
|
79
|
-
If \`
|
|
79
|
+
If the harness's native ask tool is available (\`AskUserQuestion\` / \`AskQuestion\` / \`question\` / \`request_user_input\`), send exactly ONE question; on schema error, fall back to a plain-text lettered list.
|
|
80
80
|
8. Persist the chosen track to \`${flowPath}\` (\`track\` field). Compute \`skippedStages\` from the track and write that too. Use the **first stage of the chosen track** as \`currentStage\` (quick → \`spec\`, medium/standard → \`brainstorm\`, trivial fast-path → \`design\` or \`spec\` per Phase 0).
|
|
81
81
|
9. Write the prompt to \`.cclaw/artifacts/00-idea.md\` with the following header lines: \`Class:\` (from Phase 0), \`Track:\` (chosen track + matched heuristic), \`Stack:\` (from Phase 2 detection, or \`unknown\`), and a \`Discovered context\` section if Phase 1 found origin docs.
|
|
82
82
|
10. Load the **first-stage skill for the chosen track** and its command file:
|
|
@@ -47,8 +47,8 @@ Human input remains mandatory only at explicit approval gates (plan approval, us
|
|
|
47
47
|
|---|---|---|---|---|
|
|
48
48
|
| Claude | \`native\` | Task (named subagent_type) | AskUserQuestion | \`.cclaw/references/harnesses/claude-playbook.md\` |
|
|
49
49
|
| Cursor | \`generic-dispatch\` | Task (generic subagent_type: explore/generalPurpose/…) | AskQuestion | \`.cclaw/references/harnesses/cursor-playbook.md\` |
|
|
50
|
-
| OpenCode | \`role-switch\` | plugin dispatch _or_ in-session role-switch |
|
|
51
|
-
| Codex | \`role-switch\` | in-session role-switch (mandatory evidenceRefs) |
|
|
50
|
+
| OpenCode | \`role-switch\` | plugin dispatch _or_ in-session role-switch | \`question\` (permission-gated; \`permission.question: "allow"\`) | \`.cclaw/references/harnesses/opencode-playbook.md\` |
|
|
51
|
+
| Codex | \`role-switch\` | in-session role-switch (mandatory evidenceRefs) | \`request_user_input\` (experimental; Plan / Collaboration mode) | \`.cclaw/references/harnesses/codex-playbook.md\` |
|
|
52
52
|
|
|
53
53
|
**Dispatch rules driven by \`subagentFallback\`:**
|
|
54
54
|
|
|
@@ -58,7 +58,23 @@ export interface HarnessAdapter {
|
|
|
58
58
|
*/
|
|
59
59
|
nativeSubagentDispatch: "full" | "generic" | "partial" | "none";
|
|
60
60
|
hookSurface: "full" | "plugin" | "limited" | "none";
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Structured-ask primitive exposed by the harness.
|
|
63
|
+
*
|
|
64
|
+
* - `AskUserQuestion` — Claude Code native tool (≤5 options × multi-question).
|
|
65
|
+
* - `AskQuestion` — Cursor native tool (≥2 options, multi-question, `allow_multiple`).
|
|
66
|
+
* - `question` — OpenCode native tool (header + options + "type custom"
|
|
67
|
+
* fallback); **gated**: requires `permission.question: "allow"` in
|
|
68
|
+
* `opencode.json`, and for ACP clients additionally needs
|
|
69
|
+
* `OPENCODE_ENABLE_QUESTION_TOOL=1`.
|
|
70
|
+
* - `request_user_input` — Codex CLI tool (1-3 short questions); experimental
|
|
71
|
+
* and primarily surfaced inside Plan / Collaboration mode templates
|
|
72
|
+
* (`codex-rs/collaboration-mode-templates`). Available to agents running
|
|
73
|
+
* inside Codex but may be hidden on very old builds.
|
|
74
|
+
* - `plain-text` — fallback only; used when no native primitive is
|
|
75
|
+
* available (no shipping harness uses this in v0.41.0).
|
|
76
|
+
*/
|
|
77
|
+
structuredAsk: "AskUserQuestion" | "AskQuestion" | "question" | "request_user_input" | "plain-text";
|
|
62
78
|
/**
|
|
63
79
|
* Declared fallback pattern used when the harness cannot satisfy a
|
|
64
80
|
* mandatory delegation natively. Drives `checkMandatoryDelegations`
|
package/dist/harness-adapters.js
CHANGED
|
@@ -104,7 +104,15 @@ export const HARNESS_ADAPTERS = {
|
|
|
104
104
|
capabilities: {
|
|
105
105
|
nativeSubagentDispatch: "partial",
|
|
106
106
|
hookSurface: "plugin",
|
|
107
|
-
|
|
107
|
+
// OpenCode exposes a native `question` tool (header + options +
|
|
108
|
+
// custom-answer fallback, multi-question navigation). It is
|
|
109
|
+
// permission-gated — `opencode.json` must set
|
|
110
|
+
// `permission.question: "allow"` and ACP clients must export
|
|
111
|
+
// `OPENCODE_ENABLE_QUESTION_TOOL=1`. cclaw surfaces the tool name
|
|
112
|
+
// in the Decision Protocol and in the OpenCode playbook; skills
|
|
113
|
+
// fall back to the shared plain-text lettered list when the tool
|
|
114
|
+
// is denied or unavailable.
|
|
115
|
+
structuredAsk: "question",
|
|
108
116
|
subagentFallback: "role-switch"
|
|
109
117
|
}
|
|
110
118
|
},
|
|
@@ -125,7 +133,15 @@ export const HARNESS_ADAPTERS = {
|
|
|
125
133
|
capabilities: {
|
|
126
134
|
nativeSubagentDispatch: "none",
|
|
127
135
|
hookSurface: "limited",
|
|
128
|
-
|
|
136
|
+
// Codex CLI exposes `request_user_input` — an experimental tool
|
|
137
|
+
// that asks 1-3 short questions and returns the user's answers.
|
|
138
|
+
// It is the primitive the built-in Plan / Collaboration mode
|
|
139
|
+
// templates use (see `codex-rs/collaboration-mode-templates`).
|
|
140
|
+
// Agents running inside Codex can call it directly; cclaw wires
|
|
141
|
+
// it into the Decision Protocol and the Codex playbook. The
|
|
142
|
+
// shared plain-text lettered list is the documented fallback
|
|
143
|
+
// when the tool is unavailable.
|
|
144
|
+
structuredAsk: "request_user_input",
|
|
129
145
|
subagentFallback: "role-switch"
|
|
130
146
|
}
|
|
131
147
|
}
|
package/dist/install.js
CHANGED
|
@@ -984,8 +984,24 @@ async function writeHarnessGapsState(projectRoot, harnesses) {
|
|
|
984
984
|
remediation.push(`subagent dispatch → record explicit harness_limitation waiver; no parity path available`);
|
|
985
985
|
break;
|
|
986
986
|
}
|
|
987
|
-
|
|
988
|
-
|
|
987
|
+
// Per-harness structuredAsk remediation: record either the fallback
|
|
988
|
+
// requirement (plain-text) or the gating / experimental status of the
|
|
989
|
+
// native primitive so `cclaw doctor` and harness-gaps.json stay
|
|
990
|
+
// honest about *why* a primitive might silently not fire.
|
|
991
|
+
switch (capabilities.structuredAsk) {
|
|
992
|
+
case "plain-text":
|
|
993
|
+
remediation.push("structured ask → fall back to a numbered plain-text list; first option is default");
|
|
994
|
+
break;
|
|
995
|
+
case "question":
|
|
996
|
+
remediation.push(`structured ask → OpenCode \`question\` tool; enable with \`permission.question: "allow"\` in \`opencode.json\` (ACP clients additionally need \`OPENCODE_ENABLE_QUESTION_TOOL=1\`). Fallback: shared plain-text lettered list.`);
|
|
997
|
+
break;
|
|
998
|
+
case "request_user_input":
|
|
999
|
+
remediation.push("structured ask → Codex `request_user_input` tool (experimental; surfaced in Plan / Collaboration mode). Fallback: shared plain-text lettered list when the tool is hidden.");
|
|
1000
|
+
break;
|
|
1001
|
+
case "AskUserQuestion":
|
|
1002
|
+
case "AskQuestion":
|
|
1003
|
+
// Native first-class ask — no remediation required.
|
|
1004
|
+
break;
|
|
989
1005
|
}
|
|
990
1006
|
for (const event of missingHookEvents) {
|
|
991
1007
|
remediation.push(`hook event ${event} → schedule the corresponding script manually or accept reduced observability`);
|