plan-goal — команда Claude Code: план в условие для /goal
Команда plan-goal собирает условие завершения из task_plan.md и подставляет его в /goal, чтобы агент не остановился на середине плана.
MIT ★ 28 179 обновлён 2026-11-04
/plugin marketplace add OthmanAdi/planning-with-files
/plugin install planning-with-files@planning-with-filesЧто делает plan-goal
Команда читает task_plan.md, выводит из него условие завершения и передаёт текст в /goal. Дальше Claude Code гоняет агента, пока быстрая модель не подтвердит условие по транскрипту. Файлы при этой проверке не читаются, поэтому условие и берут из плана: цикл встаёт, когда закрыт план, а не когда переписка выглядит законченной.
Сначала ищется активный план: sh ${CLAUDE_PLUGIN_ROOT}/scripts/resolve-plan-dir.sh, в PowerShell resolve-plan-dir.ps1. Несколько планов без селектора дают PWF_PLAN_AMBIGUOUS_V1 и отказ: команда не хватает первый попавшийся файл, придётся задать PLAN_ID=<slug>. Переменная PWF_PLAN_ROOT фиксирует корень проекта, неверный корень не принимается.
Аргумент дописывается к условию отдельной фразой. В текст попадают только заголовки фаз и критерии приёмки, так что в лимит /goal на 4000 знаков это укладывается. Без task_plan.md команда откажется и отправит сначала выполнить /plan. Снять цель потом можно через /goal clear.
Какие задачи решает
- дотянуть агента до последней фазы плана без ручных подталкиваний
- превратить чек-лист фаз в условие остановки, которое можно проверить
- запустить длинную задачу и уйти по своим делам
- закрыть цикл по готовому плану, а не по бодрому тону переписки
Примеры запросов агенту
/plan-goal/plan-goal до тех пор, пока все тесты не пройдут/plan-goal до конца плана, меня не спрашивай
Как установить plan-goal
1Через маркетплейс плагинов
/plugin marketplace add OthmanAdi/planning-with-files/plugin install planning-with-files@planning-with-files2Вручную: положить файлы
.claude/commands/plan-goal.mdВызов — /plan-goal. Для всех проектов — ~/.claude/commands/
Вручную: положить файлы
~/.codex/prompts/plan-goal.mdВызов — /prompts:plan-goal. В Codex этот формат помечен устаревшим, замена — скиллы
Вручную: положить файлы
.github/prompts/plan-goal.prompt.mdВручную: положить файлы
.gemini/commands/plan-goal.tomlGemini хранит команды в TOML: текст запроса — в поле prompt
Вопросы о plan-goal
Как установить plan-goal в Claude Code?
Добавьте маркетплейс: /plugin marketplace add OthmanAdi/planning-with-files, потом поставьте плагин: /plugin install planning-with-files@planning-with-files. Файл самой команды лежит в .claude/commands/plan-goal.md.
Что делает plan-goal?
Превращает task_plan.md в условие завершения для /goal: фазы со статусом complete плюс проверку через check-complete.sh. После этого агент работает, пока условие не подтвердится.
Что будет, если в проекте несколько планов?
Скрипт выбора печатает PWF_PLAN_AMBIGUOUS_V1, и команда отказывается работать. Нужно указать PLAN_ID=<slug> и вызвать её снова.
Исходный текст
plan-goal.md · MIT
---
description: "Bridge Claude Code's /goal to the active plan. Derives a goal condition from task_plan.md and invokes /goal so Claude keeps working until the plan is complete. Available since v2.38.0."
disable-model-invocation: true
allowed-tools: "Read Bash"
---
Bridge the active plan to Claude Code's `/goal` primitive.
Steps:
1. Validate `${PWF_PLAN_ROOT}` as an absolute existing project root when set; refuse an invalid root pin. Otherwise use cwd as the project root. Resolve the selected plan with `sh ${CLAUDE_PLUGIN_ROOT}/scripts/resolve-plan-dir.sh` (PowerShell: `& "$env:CLAUDE_PLUGIN_ROOT\scripts\resolve-plan-dir.ps1"`). A printed directory is the selected plan. On empty output:
- With non-empty `${PLAN_ID}`, the plan selector was rejected. Refuse and ask the user to correct the pin; never fall back to another plan.
- If `resolve-plan-dir.sh --check-ambiguity` (PowerShell: `-CheckAmbiguity`) prints `PWF_PLAN_AMBIGUOUS_V1`, multiple plans exist without a selector. Refuse and ask the user to set `PLAN_ID=<slug>`.
- Otherwise use legacy `task_plan.md` from the validated project root (`PWF_PLAN_ROOT` when set), if it exists. A valid root pin alone does not reject a legacy root plan.
The shared `.planning/.active_plan` pointer does not bind a parallel session.
2. Read the selected `task_plan.md` and retain its absolute path for the goal condition and completion check.
3. Derive a goal condition from the plan content:
- Default: "all phases in the selected task_plan.md report Status: complete and check-complete.sh with that explicit plan path reports ALL PHASES COMPLETE"
- If user passed an argument: use that as an additional clause (e.g., `/plan-goal until all tests pass`)
4. Issue Claude Code's `/goal <condition>` with the derived text.
5. Confirm to the user: print the goal condition + the active plan ID + remind that `/goal clear` cancels.
If `task_plan.md` does not exist, refuse and direct user to run `/plan` first.
Why this exists:
`/goal` runs the agent until a small fast model confirms the condition is met. It evaluates the transcript only, not files. By deriving the condition from the plan file, this command turns the file-based plan into a measurable termination criterion for `/goal`, so the loop terminates when the plan is actually done, not when the conversation looks done.
Notes:
- `/plan-goal` does not replace `/goal`. It composes with it. Users can still run `/goal "any text"` directly.
- The derived condition stays under the 4000-char limit `/goal` enforces by quoting only phase headers + acceptance criteria, not full task body.
- Combine with `/plan-loop` for a "babysit until done" workflow: `/plan-loop` cadence + `/plan-goal` termination.
© OthmanAdi · MIT · OthmanAdi/planning-with-files