Skip to content
Back to skills

Whygraph Plan

ASecurity

Plan a non-trivial code change with WhyGraph rationale and CodeGraph symbols. Runs a fan-out/fan-in pipeline (planner -> one researcher per knowledge source -> synthesizer), splits a large task into child plans only when needed, and asks the few plan-shaping questions after research.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 9, 2026
ai-agentsgobashreactnodegitapi

Works with

  • cursor
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned November 26, 2026

npx -y skills add mtrdesign/whygraph --skill whygraph-plan --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Whygraph Plan?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Whygraph Plan
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mtrdesign-whygraph-plan-whygraph/badge)](https://www.skillsdirectory.com/skills/mtrdesign-whygraph-plan-whygraph)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: whygraph-plan
description: Plan a non-trivial code change with WhyGraph rationale and CodeGraph symbols. Runs a fan-out/fan-in pipeline (planner -> one researcher per knowledge source -> synthesizer), splits a large task into child plans only when needed, and asks the few plan-shaping questions after research.
disable-model-invocation: true
---

# /whygraph-plan - plan a non-trivial change with grounded rationale

Plan a non-trivial code change with WhyGraph rationale + CodeGraph symbols. Dispatches to the planner subagent, which researches the change with one researcher per knowledge source and a synthesizer, splits a large task into child plans only when needed, and returns the few plan-shaping questions for you to ask after research.

**Argument shape:** `<task description> [--shallow|--deep] [--split|--no-split] [--sources <a,b>] [--no-questions] [--review|--no-review] [--no-dry-run] [--no-e2e] [--refresh-profile] [--out <path>] [--publish <stem> [--force]]`

## Step 1 - Parse arguments

**Publish mode.** If the user's input holds `--publish`, this is a separate mode that skips Steps 2-8; go to **Publish a plan** below. Otherwise:

Strip and remember these flags if present (any order, anywhere in the user's input):

- `--shallow` -> force single-pass mode (no fan-out).
- `--deep` -> force fan-out mode (skip the heuristic).
- `--split` -> force a split into child plans along the task's deliverables.
- `--no-split` -> forbid a split.
- `--sources <a,b>` -> run only these sources, by `name`, comma-separated (consume the next token). A named source runs even when its file says `enabled: false`. Each name must match `^[a-z0-9-]+$`.
- `--no-questions` -> ask nothing: every consent is `no`, and open questions take their defaults.
- `--review` -> review the plan before it is handed over, in single-pass mode too.
- `--no-review` -> skip the plan review.
- `--no-dry-run` -> skip the dry run. Without it, the planner runs each Verify once before it hands the plan over.
- `--no-e2e` -> plan no browser test. Without it, a UI plan in a repo with browser tests gets an end-to-end test step.
- `--refresh-profile` -> derive the UI profile (`.whygraph/profiles/ui.md`) again, even when the cached one is fresh.
- `--out <path>` -> save the plan to `<path>` instead of the default `.whygraph/plans/<slug>.md`. The token after `--out` is the path, not part of the task description.

Whatever remains is the **task description**. If it is empty, respond with:
`Usage: /whygraph-plan <task description> [--shallow|--deep] [--split|--no-split] [--sources <a,b>] [--no-questions] [--review|--no-review] [--no-dry-run] [--no-e2e] [--refresh-profile] [--out <path>] [--publish <stem> [--force]]` and stop.

- If both `--shallow` and `--deep` are passed, respond with `Pass --shallow OR --deep, not both.` and stop.
- If both `--split` and `--no-split` are passed, respond with `Pass --split OR --no-split, not both.` and stop.
- If both `--review` and `--no-review` are passed, respond with `Pass --review OR --no-review, not both.` and stop.
- If a `--sources` name does not match the pattern, respond with `Unknown source name: <name>` and stop.

## Publish a plan

`/whygraph-plan --publish <stem> [--force]` copies a finished plan into the repository's plans folder so a teammate can commit it. It plans nothing.

1. `--force` is the only other token allowed. Any task text or other flag: respond with `--publish takes only a plan stem and --force.` and stop.
2. The stem must match `^[a-z0-9][a-z0-9-]{0,79}$`, and the file `.whygraph/plans/<stem>.md` must exist. Otherwise respond with `No plan .whygraph/plans/<stem>.md.` and stop. Validate before the stem reaches Bash.
3. Run `sh .cursor/skills/whygraph-plan/plan-tool.sh publish .whygraph/plans/<stem>.md` (with ` --force` appended when it was passed) **alone**, with no folder argument and nothing chained after it: one tool command per call.
4. Print the tool's line(s) verbatim. A `skip:` line is the whole answer.
5. After `published`, `republished` or `unchanged` with no `ignored:` line, print `To share it, commit it: git add <dest>`, with `<dest>` from the tool's line.

Never run `git add` or commit. Stop after this; do not run Steps 2-8.

## Step 2 - Resolve the paths

Find the repo root with `git rev-parse --show-toplevel`. Resolve these absolute paths before dispatch:

- `OUT_PATH` - the plan goes there. The planner writes it in single-pass mode; in deep mode the synthesizer writes it.
  - If `--out <path>` was passed, use that path. Resolve a relative path against the current working directory. If the path does not end in `.md`, append `.md`.
  - Otherwise, slugify the task description: lowercase it, replace each run of non-alphanumeric characters with one `-`, strip leading and trailing `-`, and truncate to 60 characters. The default path is `<repo root>/.whygraph/plans/<slug>.md`. If that file exists, append `-2`, `-3`, ... until the name is unused. A slug also counts as used when the file `<repo root>/<plans dir>/<slug>.md` exists, with `<plans dir>` the line `sh .cursor/skills/whygraph-plan/plan-tool.sh plans-dir` prints (run it once, alone); when it prints nothing, only `.whygraph/plans/` is checked. Never overwrite.
  - Create its parent directory with `mkdir -p <parent>`.
- `SOURCES_DIR` - `<repo root>/.cursor/skills/whygraph-plan/sources/`.
- `SPINE_PATH` - `<repo root>/.cursor/skills/whygraph-plan/plan-spine.md`.
- `CAPTURE_PATH` - `.cursor/skills/whygraph-ui-check/capture.mjs`. It stays relative to the repo root: the planner runs `node <CAPTURE_PATH> --probe` from there.
- `PLAN_TOOL` - `sh .cursor/skills/whygraph-plan/plan-tool.sh`. The planner runs its `fingerprint` and `check` commands from the repo root.

If the file at `SPINE_PATH` does not exist, respond with `The planning files are missing from .cursor/skills/whygraph-plan/. Open the WhyGraph portal, run Settings > Update agent files, then re-run /whygraph-plan.` and stop.

## Step 3 - Consent

A source file is repo content, so this command decides which sources need the user's OK. A source file can force the question; it can never suppress it.

With `--no-questions`, ask nothing: record `<name>=no` for every source that needs consent (below), and go to Step 4.

1. List `SOURCES_DIR/*.md`. Skip `README.md`.
2. Read each file's frontmatter only (its first 15 lines). Never read a source's body: only the researcher that runs it reads the body.
3. Keep a source when both hold:
   - It would run: with `--sources`, its `name` is in the list; otherwise its `enabled` is not `false`. `--shallow` changes nothing here, because the single-pass planner runs a consented source through one researcher.
   - Every tool in its `requires` is callable in this session. A bare name matches a session tool whose name equals it, or ends in `__<name>` or `/<name>`. An empty `requires` always matches.
4. A kept source needs consent when any of these holds:
   - (a) Its `requires` or `tools` names an MCP tool other than the `whygraph_*` and `codegraph_*` tools, or the word `web`. The word `read` is not an MCP tool.
   - (b) Its file name is not one of the six bundled sources: `code-structure.md`, `whygraph-rationale.md`, `repo-tests.md`, `repo-history.md`, `ui-surface.md`, `best-practices.md`.
   - (c) It says `consent: true`.
5. If no kept source needs consent, record `CONSENT: none` and go to Step 4.
6. Derive `TERMS` once: 1 to 3 technical topics from the task text, separated by `; `. Name the technique, pattern or public library the task names (`React list empty state`, not `empty state`). Never use a project, client, company, product, file or symbol name in a term.
7. Ask the user in chat and wait: put all consent questions in **one** message, at most 4 consent questions. A fifth or later source is `no`; print `<name>: not asked (at most 4 consent questions per run); it will not run.` for each. Number the questions. Each question:
   - names the source (its `name`);
   - says what the source reaches: "an external service through <its non-WhyGraph, non-CodeGraph tools>" for (a), "the web, through your editor's web search" for the word `web`, and "added to this repo, not shipped with WhyGraph" plus its `description` for (b);
   - shows the terms: `Search terms: <TERMS>`;
   - offers `No (default)` first, then `Yes`.
8. Record one line per asked source: `CONSENT: <name>=yes` only when the reply clearly says yes to that question, otherwise `CONSENT: <name>=no`. A question the reply leaves unanswered is `no`.

## Step 4 - Dispatch to the planner subagent

Run the `whygraph-planner` subagent (it lives in `.cursor/agents/planner.md`; start it by name) with this prompt body:

```
TASK: <task description>
MODE: <shallow | deep | auto>
SPLIT: <yes | no | auto>
SOURCES_DIR: <absolute path>
SPINE_PATH: <absolute path>
SOURCES: <all | comma-separated names>
CONSENT: <name>=<yes | no>
(one CONSENT line per source that needed consent, or "CONSENT: none")
TERMS: <topic>; <topic>
(only when some CONSENT is yes - otherwise omit the line)
PARENT: none
OUT_PATH: <absolute path resolved in Step 2>
CAPTURE_PATH: .cursor/skills/whygraph-ui-check/capture.mjs
PLAN_TOOL: sh .cursor/skills/whygraph-plan/plan-tool.sh
REFRESH_PROFILE: <yes | no>
REVIEW: <yes | no | auto>
DRY_RUN: <yes | no>
E2E: <yes | no>
```

- `MODE` is `shallow` for `--shallow`, `deep` for `--deep`, otherwise `auto`.
- `SPLIT` is `yes` for `--split`, `no` for `--no-split`, otherwise `auto`.
- `SOURCES` is the `--sources` list, otherwise `all`.
- `REFRESH_PROFILE` is `yes` for `--refresh-profile`, otherwise `no`.
- `REVIEW` is `yes` for `--review`, `no` for `--no-review`, otherwise `auto`.
- `DRY_RUN` is `no` for `--no-dry-run`, otherwise `yes`. `--no-questions` does not change it.
- `E2E` is `no` for `--no-e2e`, otherwise `yes`. `--no-questions` does not change it.

The planner has its own system prompt and the CodeGraph and WhyGraph MCP tools. Do not inline planning instructions here.

## Step 5 - Read the reply

Print every planner reply **verbatim**, with the one exception in Step 8. Then act on its shape:

- The reply says CodeGraph is not available -> print it and stop. Do not attempt a fallback or save anything. WhyGraph planning is meaningless without the graph.
- The reply starts `CLARIFY: ` -> go to **Clarify** below.
- The reply starts `SPLIT: ` -> go to Step 6.
- Otherwise a plan was written (by the planner, or by the synthesizer in deep mode). Go to Step 7 with its `QUESTIONS:` block.

**Clarify.** The planner found no seed symbol and wrote no plan. The reply has the shape `CLARIFY: <one question> | options: <a>; <b>[; <c>]`.

- With `--no-questions`, print `Re-run /whygraph-plan with a more specific task, or without --no-questions.` and stop.
- Otherwise ask the user the question with its options in chat and wait. Then start the planner again with the same prompt plus the line `CLARIFICATION: <answer>`.
- A second `CLARIFY: ` reply for the same plan: print it and stop.

## Step 6 - Split

The planner wrote a `tasks.json` and no plan. The reply has the shape `SPLIT: <path>`, then one line per child: `t<N> (wave <W>): <title>`.

1. Validate the file. On a failed check, respond with `Refusing <path>: <reason>.` and stop.
   - Its path resolves to `<repo root>/.whygraph/plans/<stem>.tasks.json`.
   - It is not tracked by git: `git ls-files -- <path>` prints nothing.
   - Read it. It parses as JSON and has `version: 1`.
   - `children` has 1 to 6 entries. Each `id` is one of `t1`-`t6`, and no `id` repeats.
   - Every `plan` matches `^\.whygraph/plans/[a-z0-9-]+-t[1-6]\.md$`.
   - Every `depends_on` entry names an existing `id`, and the dependencies have no cycle.
2. For each `wave` value, in ascending order, start one fresh `whygraph-planner` per child in that wave, in parallel. Wait for the wave to finish before the next one. Each child's prompt is the Step 4 prompt with these changes:
   - `TASK: <the child's task>`
   - `SPLIT: no`
   - `PARENT: <absolute path of the tasks.json>`
   - `OUT_PATH: <repo root>/<the child's plan>`
   - `CONSENT` and `TERMS` lines as in Step 4 for `t1` only. Every other child gets `CONSENT: none` and no `TERMS` line.
   - `REFRESH_PROFILE` as in Step 4 for `t1` only. Every other child gets `REFRESH_PROFILE: no`.
   - `MODE`, `REVIEW`, `DRY_RUN`, `SOURCES_DIR`, `SPINE_PATH`, `SOURCES`, `CAPTURE_PATH`, `PLAN_TOOL` and `E2E` stay the same.
3. Print each child's reply verbatim under a line `### <id>: <title>`, with the one exception in Step 8. A child reply that starts `CLARIFY: ` follows **Clarify** for that child only.
4. After every wave is planned, run Step 7 for each child's reply, one child at a time, in `id` order.

## Step 7 - Questions

The plan reply ends with a `QUESTIONS:` block. It is either `QUESTIONS: none`, or `QUESTIONS:` followed by lines of this shape:

```
Q<n>. <question> | options: <default>; <alt>[; <alt>] | default: <default> | why: <one line>
```

- `QUESTIONS: none`, or no block -> nothing to ask. Go to Step 8.
- With `--no-questions` -> do not ask. Start the planner in revise mode (below) with `ANSWERS: defaults`.
- Otherwise ask the user in chat and wait: put the questions in **one** message, at most 3 questions. If the block has more, ask the first 3; the rest take their defaults. For each question:
  - show `Q<n>.`, then `<question>`, then `<why>`;
  - list the options from `| options: `, in order, so the default is first; label the default `<default> (default)`;
  - say that the user may type their own answer instead, and that a question left unanswered takes its default.

**Revise.** Start a fresh `whygraph-planner` with the prompt of the dispatch that wrote this plan (Step 4, or the child's Step 6 prompt), with these changes:

```
MODE: revise
PLAN_PATH: <the plan's absolute path - the OUT_PATH of that dispatch>
REFRESH_PROFILE: no
ANSWERS:
- Q<n>: <the chosen option, without "(default)", or the user's own text>
```

(or `ANSWERS: defaults` with `--no-questions`). Print the revise reply verbatim, under the child's `### <id>: <title>` line for a split child. A revise reply always ends `QUESTIONS: none`; never ask again for the same plan.

## Step 8 - Print the result

Print each planner reply **verbatim** to the user. The one exception: with `--no-questions`, do not print a plan reply whose `QUESTIONS:` block has questions, because its revise reply replaces it. A plan reply is `Saved plan to <path>` plus the plan's `## Blockers` and `## Confidence` lines and its `QUESTIONS:` block - the planner wrote the file itself. Do not summarize, paraphrase, re-format or comment on it, and do not write the file yourself. The planner is the source of truth.

After the replies, print one extra line per saved plan, with `<stem>` the basename of its `Saved plan to <path>` line without `.md`, lowercased, each run of characters outside `[a-z0-9]` replaced by one `-`, and leading and trailing `-` trimmed: `To share this plan before implementing it: /whygraph-plan --publish <stem>. A successful /whygraph-implement run publishes it for you.` Never edit a planner reply to add it.

This command's only job is: parse -> resolve paths -> consent -> dispatch -> clarify, split or questions -> print (or, with `--publish`, publish one plan). Do not edit files, run other tools (the `plan-tool.sh publish` and `plans-dir` calls above are the only ones), or improvise.

Files in this skill

  • SKILL.md11.6 KB
  • plan-spine.md3.8 KB
  • sources/README.md3.2 KB
  • sources/code-structure.md1.1 KB
  • sources/medium.md1.2 KB
  • sources/repo-history.md1.2 KB
  • sources/repo-tests.md1.7 KB
  • sources/ui-surface.md2.3 KB
  • sources/whygraph-rationale.md1.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.