Plan Sketch
Preconditions
- Confirm you are in the intended repo:
git rev-parse --show-toplevel
- Confirm whether web browsing is allowed.
- If browsing is blocked by sandbox/approvals, ask the user to enable/approve it.
- If the user says "no web browsing", proceed but clearly label assumptions where "latest" matters.
Output contract (required)
plan-sketch must produce:
- A sketch markdown file (usually under
sketch/, or an explicit --output path if provided).
- A small, parseable Questions for user block in the subagent's stdout output so wrapper skills can ask the user without reading the sketch content into context.
- A machine-readable JSON Questions block in stdout so wrapper skills can parse choices programmatically.
The Questions block must cover:
- Any open questions / unknowns that change the plan materially.
- Any assumptions that should be confirmed.
- Any high-level approach forks (architecture, APIs, rollout/testing strategy, migrations).
- If there are multiple viable implementation approaches, include an explicit choose an approach question so the user picks one before planning.
Format requirements (strict):
- Do not print the sketch content in the response.
- Print the sketch path (single line) and then print a Questions block bracketed by markers:
BEGIN_USER_QUESTIONS
END_USER_QUESTIONS
- In the Questions block:
- Start with a short instruction telling the user to answer in one batch by label/number.
- Present all decision-steering questions at once.
- Number questions as
1), 2), ... (not bullets).
- For each question, include 2–4 mutually exclusive options.
- Label options as
1a), 1b), 1c) ... (letters per question), and make the labels easy to copy/paste.
- Put the recommended option first and include a 1-sentence rationale on the same line.
- End the block with a single-line summary of recommended picks in the format:
Recommended picks (copy/paste): 1a, 2b, 3a
- If there are no meaningful open questions, include at least 1 explicit confirmation question with options.
- After the text Questions block, print a JSON Questions block bracketed by markers:
BEGIN_USER_QUESTIONS_JSON
END_USER_QUESTIONS_JSON
- The JSON block must be valid JSON and include:
questions: array of objects with id (number or string) and options.
- Each
options entry includes label (e.g., 1a) and text.
- Optional:
recommended boolean on options and recommended_picks array at the top level.
Expected runtime
Typically runs 15–45 minutes. Callers should allow the full --timeout (default 3600s) before interrupting.
If you use --progress-log, do not tail -f it into the main context unless you must debug; prefer checking progress via log line counts (for example: wc -l <progress-log>) and/or the heartbeat counters.
Workflow — Option A (external script, preferred)
Run the sketch as a standalone CLI invocation:
resolve_skill_dir() {
local name="$1"
local repo_root=""
repo_root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
local candidates=(
"$repo_root/.agents/skills/$name"
"$repo_root/.claude/skills/$name"
"$HOME/.agents/skills/$name"
"$HOME/.codex/skills/$name"
"$HOME/.claude/skills/$name"
)
for d in "${candidates[@]}"; do
if [[ -d "$d" ]]; then
echo "$d"
return 0
fi
done
echo "Error: skill '$name' not found in repo-scoped or user-scoped skill dirs." >&2
return 1
}
PLAN_SKETCH_SKILL_DIR="$(resolve_skill_dir plan-sketch)"
python3 "$PLAN_SKETCH_SKILL_DIR/scripts/run_plan_sketch.py" "user's rough idea"
Flags:
--idea-file PATH — use a file as the idea input (useful for large/multiline inputs)
--output PATH — optional explicit sketch output path (default: model generates sketch/<meaningful-name>.md)
--cli codex|claude — override auto-detected CLI
--model MODEL — pass a specific model to the CLI
--reasoning-effort LEVEL — pass explicit reasoning effort (vhigh aliases to xhigh)
--timeout N — CLI invocation timeout in seconds (default: 3600)
--progress-log PATH — optional path to append streamed subagent output
--heartbeat-seconds N — heartbeat cadence in seconds (0 disables)
Default behavior:
- When using Codex and no overrides are provided, the script uses
--model gpt-5.2 with xhigh reasoning effort.
- When using Codex, the script always runs with
--sandbox danger-full-access and -a never.
- When using Codex, the script enables live web search (
--search) so it can do bounded research for unstable facts.
- When using Claude, the script runs non-interactive with
--dangerously-skip-permissions.
The script prints the output file path to stdout on success.
Workflow — Option B (inline, legacy)
- Open
references/prompts/plan-sketch.md.
- Execute it using the user's rough idea as
$ARGUMENTS.
- Do bounded web research (official docs first) for unstable facts:
- Current CLI/tooling behavior, deprecations, APIs, pricing, supported flags, version constraints.
- Avoid searching any secrets/PII/proprietary code. Use generic queries (vendor + product + version + error message class).
- Write a new sketch file under
sketch/ with a meaningful kebab-case filename and report the final path.
1---2name: plan-sketch3description: Do bounded research (official docs first) and produce a high-level implementation sketch in `sketch/<generated-name>.md`. Use when you want an approach and step ordering before implementation.4---56# Plan Sketch78## Preconditions910- Confirm you are in the intended repo: `git rev-parse --show-toplevel`11- Confirm whether web browsing is allowed.12 - If browsing is blocked by sandbox/approvals, ask the user to enable/approve it.13 - If the user says "no web browsing", proceed but clearly label assumptions where "latest" matters.1415## Output contract (required)1617`plan-sketch` must produce:18191. A sketch markdown file (usually under `sketch/`, or an explicit `--output` path if provided).202. A small, parseable **Questions for user** block in the subagent's stdout output so wrapper skills can ask the user without reading the sketch content into context.213. A machine-readable JSON Questions block in stdout so wrapper skills can parse choices programmatically.2223The Questions block must cover:24- Any **open questions / unknowns** that change the plan materially.25- Any **assumptions** that should be confirmed.26- Any **high-level approach forks** (architecture, APIs, rollout/testing strategy, migrations).27- If there are multiple viable implementation approaches, include an explicit **choose an approach** question so the user picks one before planning.2829Format requirements (strict):3031- Do not print the sketch content in the response.32- Print the sketch path (single line) and then print a Questions block bracketed by markers:33 - `BEGIN_USER_QUESTIONS`34 - `END_USER_QUESTIONS`35- In the Questions block:36 - Start with a short instruction telling the user to answer in one batch by label/number.37 - Present all decision-steering questions at once.38 - Number questions as `1)`, `2)`, ... (not bullets).39 - For each question, include 2–4 mutually exclusive options.40 - Label options as `1a)`, `1b)`, `1c)` ... (letters per question), and make the labels easy to copy/paste.41 - Put the recommended option first and include a 1-sentence rationale on the same line.42 - End the block with a single-line summary of recommended picks in the format:43 - `Recommended picks (copy/paste): 1a, 2b, 3a`44 - If there are no meaningful open questions, include at least 1 explicit confirmation question with options.45- After the text Questions block, print a JSON Questions block bracketed by markers:46 - `BEGIN_USER_QUESTIONS_JSON`47 - `END_USER_QUESTIONS_JSON`48- The JSON block must be valid JSON and include:49 - `questions`: array of objects with `id` (number or string) and `options`.50 - Each `options` entry includes `label` (e.g., `1a`) and `text`.51 - Optional: `recommended` boolean on options and `recommended_picks` array at the top level.5253## Expected runtime5455Typically runs 15–45 minutes. Callers should allow the full `--timeout` (default 3600s) before interrupting.5657If you use `--progress-log`, do **not** `tail -f` it into the main context unless you must debug; prefer checking progress via log line counts (for example: `wc -l <progress-log>`) and/or the heartbeat counters.5859## Workflow — Option A (external script, preferred)6061Run the sketch as a standalone CLI invocation:6263```bash64resolve_skill_dir() {65 local name="$1"66 local repo_root=""67 repo_root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"6869 local candidates=(70 "$repo_root/.agents/skills/$name"71 "$repo_root/.claude/skills/$name"72 "$HOME/.agents/skills/$name"73 "$HOME/.codex/skills/$name"74 "$HOME/.claude/skills/$name"75 )7677 for d in "${candidates[@]}"; do78 if [[ -d "$d" ]]; then79 echo "$d"80 return 081 fi82 done8384 echo "Error: skill '$name' not found in repo-scoped or user-scoped skill dirs." >&285 return 186}8788PLAN_SKETCH_SKILL_DIR="$(resolve_skill_dir plan-sketch)"89python3 "$PLAN_SKETCH_SKILL_DIR/scripts/run_plan_sketch.py" "user's rough idea"90```9192Flags:93- `--idea-file PATH` — use a file as the idea input (useful for large/multiline inputs)94- `--output PATH` — optional explicit sketch output path (default: model generates `sketch/<meaningful-name>.md`)95- `--cli codex|claude` — override auto-detected CLI96- `--model MODEL` — pass a specific model to the CLI97- `--reasoning-effort LEVEL` — pass explicit reasoning effort (`vhigh` aliases to `xhigh`)98- `--timeout N` — CLI invocation timeout in seconds (default: 3600)99- `--progress-log PATH` — optional path to append streamed subagent output100- `--heartbeat-seconds N` — heartbeat cadence in seconds (0 disables)101102Default behavior:103- When using Codex and no overrides are provided, the script uses `--model gpt-5.2` with `xhigh` reasoning effort.104- When using Codex, the script always runs with `--sandbox danger-full-access` and `-a never`.105- When using Codex, the script enables live web search (`--search`) so it can do bounded research for unstable facts.106- When using Claude, the script runs non-interactive with `--dangerously-skip-permissions`.107108The script prints the output file path to stdout on success.109110## Workflow — Option B (inline, legacy)1111121. Open `references/prompts/plan-sketch.md`.1132. Execute it using the user's rough idea as `$ARGUMENTS`.1143. Do **bounded** web research (official docs first) for unstable facts:115 - Current CLI/tooling behavior, deprecations, APIs, pricing, supported flags, version constraints.116 - Avoid searching any secrets/PII/proprietary code. Use generic queries (vendor + product + version + error message class).1174. Write a **new** sketch file under `sketch/` with a meaningful kebab-case filename and report the final path.