Creates implementation plans through a plan-critique-revise loop using the planner agent. Use after /jc:research. Do NOT use for research (use /jc:research) or execution (use /jc:implement).
/jc:map. No exceptions./jc:research. No exceptions./jc:research, or detect from .planning/)/jc:implementResolve from the skill's base directory (the directory containing this SKILL.md):
{plugin-docs} = {skill-base-dir}/../../docs/If user provided a task-id, use it. Otherwise, detect from existing .planning/ directories:
ls -d .planning/*/ 2>/dev/null | grep -v codebase
If exactly one task directory exists, use that task-id. If multiple exist, present them via AskUserQuestion for the user to choose. If none exist, prompt the user to run /jc:research first.
Format rule: Task-IDs must contain only lowercase alphanumeric characters, hyphens, and underscores.
3-tier check:
| Check | Condition | Action |
|---|---|---|
| Missing | .planning/codebase/ does not exist or has no files | Hard gate. Stop. Tell user to run /jc:map first |
| Stale | >50 source commits since last map (heuristic for significant drift) | Soft prompt. AskUserQuestion: "regenerate map?" or "proceed with current map" |
| Recent | ≤50 source commits since last map | Proceed |
Staleness check — run as two separate Bash tool calls (no variable interpolation):
git log -1 --format=%H -- .planning/codebase/
git log --oneline <paste-hash-here>..HEAD -- . ':!.planning/' | wc -l
If step 1 returned empty (map exists but not committed), treat as stale.
Check if research exists for this task:
ls .planning/{task-id}/research/*.md 2>/dev/null
If no research files exist: hard gate. Stop. Tell user to run /jc:research {task-id} first.
Research gate note: The gate checks file presence only. Thin or partial research will surface as critique objections — the gate does not assess research quality.
Check if .planning/{task-id}/ACCEPTANCE-CRITERIA.md already exists:
ls .planning/{task-id}/ACCEPTANCE-CRITERIA.md 2>/dev/null
If it exists, skip to Step 5 (resume case — criteria already generated).
If not, spawn a team-criteria-generator agent via the Task tool. {task_description} is the user's original planning request from the current conversation.
TaskCreate with:
criteria-{task-id}Generate acceptance criteria for: {task_description}{"task_id": "{task-id}", "task_description": "{task_description}", "research_dir": "{absolute_project_root}/.planning/{task-id}/research/", "codebase_map_dir": "{absolute_project_root}/.planning/codebase/", "acceptance_criteria_path": "{absolute_project_root}/.planning/{task-id}/ACCEPTANCE-CRITERIA.md", "external_doc_paths": "{external_doc_paths or null}"}Spawn agent with subagent_type: "team-criteria-generator", prompt: Your task is {task-id-from-TaskCreate}.
After the agent completes, read results via TaskGet on the created task to confirm completion.
After the agent completes, verify the output file exists:
ls .planning/{task-id}/ACCEPTANCE-CRITERIA.md 2>/dev/null
If missing, retry the agent once. On second failure, report to user and stop. Suggest re-running /jc:research {task-id} to ensure research files are complete, then retrying /jc:plan.
Check if .planning/{task-id}/plans/PLAN.md exists:
ls .planning/{task-id}/plans/PLAN.md 2>/dev/null
If it exists, read it and check for tasks with status passed. If any completed tasks exist, use AskUserQuestion:
If no completed tasks, proceed with fresh plan (overwrite).
Get the absolute project root via pwd. All planner invocations use subagent_type: "team-planner".
For each planner invocation, create a task via TaskCreate with metadata, then spawn the agent with only the task ID:
TaskCreate with:
planner-{mode}-{task-id} (use a unique suffix if multiple invocations of the same mode, e.g., planner-critique-{task-id}-2){action} for: {task_description}{"mode": "{mode}", "task_id": "{task-id}", "planner_workflows_path": "{plugin-docs}/planner-workflows.md", "plan_schema_path": "{plugin-docs}/plan-schema.md", "acceptance_criteria_path": "{absolute_project_root}/.planning/{task-id}/ACCEPTANCE-CRITERIA.md", "research_dir": "{absolute_project_root}/.planning/{task-id}/research/", "codebase_map_dir": "{absolute_project_root}/.planning/codebase/"}Spawn agent with subagent_type: "team-planner", prompt: Your task is {task-id-from-TaskCreate}.
After each agent completes, read results via TaskGet on the created task to confirm completion.
Mode-to-action mapping:
| Mode | {action} |
|---|---|
plan | Create an implementation plan |
critique | Adversarially critique the plan |
revise | Revise the plan to address critique objections |
replan | Replan remaining work preserving completed tasks |
For replan mode, {task_description} is taken from the existing PLAN.md's ## Goal section.
For plan mode, {task_description} is the user's original planning request from the current conversation.
For replan mode, include "execution_learnings_dir": "{absolute_project_root}/.planning/{task-id}/execution/" in metadata if the directory exists.
Loop execution:
| Step | Mode | Action | Output |
|---|---|---|---|
| 6a | plan (or replan) | Create plan from research + codebase map + acceptance criteria | PLAN.md |
| 6b | critique | Adversarially review the plan | CRITIQUE.md + PASS/OBJECTIONS |
| 6c (if objections) | revise | Address critique objections | Revised PLAN.md |
| 6d (if revised) | critique | Re-review revised plan | Updated CRITIQUE.md + PASS/OBJECTIONS |
| 6e (if objections) | revise | Address remaining critique objections | Revised PLAN.md |
| 6f (if revised) | critique | Re-review revised plan | Updated CRITIQUE.md + PASS/OBJECTIONS |
Steps 6a and 6b are always executed. Steps 6c-6d execute only if 6b returns OBJECTIONS. Steps 6e-6f execute only if 6d returns OBJECTIONS. After 6f (or earlier if PASS), proceed to Step 7.
Each planner invocation is a separate Task tool call (sequential, not parallel — each depends on the previous output).
Result parsing: After each critique invocation completes, read the task's completion metadata via TaskGet. Check the result field: if PASS, no objections — proceed to Step 7. If OBJECTIONS, proceed to revision. If ERROR, surface the error to the user, stop the loop, and suggest remediation.
Replan note: For replan mode, acceptance criteria from the existing .planning/{task-id}/ACCEPTANCE-CRITERIA.md are passed as-is — they represent the task goals, not the implementation approach.
Read .planning/{task-id}/plans/PLAN.md and present a summary to the user:
PLAN.md/jc:implement {task-id} as the next stepDo NOT commit the plan — /jc:implement handles committing .planning/ docs before creating the worktree.
| Excuse | Reality |
|---|---|
| "The planner can read the codebase directly" | The planner reads the codebase map, not raw source files. Without the map, it produces plans with wrong file paths, missed conventions, and broken verification commands |
| "Critique is overkill for a small plan" | Small plans still have wrong test runners, missed conventions, and file overlap. Critique catches these systematically. Cost: one extra planner invocation. Cost of skipping: executor failures at runtime |
| "I can review the plan myself instead of critique" | You lack the planner's codebase map cross-referencing. You will miss convention violations and research gaps that the critique mode specifically checks |
/jc:implement)team-planner (sequential plan-critique-revise)team-criteria-generator (acceptance criteria generation){plugin-docs}/planner-workflows.md{plugin-docs}/plan-schema.md{plugin-docs}/agent-io-contract.md