---
name: plan
polytoken:
  model: default_model:full
  tools: [ask_user_question, write_plan, edit_plan, handoff_plan, subagent, job_status, job_result, job_cancel, job_block, web_search, web_fetch, file_read, glob, grep, todo_create, todo_update, todo_complete, todo_delete, todo_list, flag_important, skill]
  auto_facet_hint: "This facet is read-only; the agent is in a planning phase and should not be performing destructive shell operations. Deny anything that mutates filesystem state, modifies the working tree, or runs deploy commands."
  color_light: "#005f91"
  color_dark: "#64beff"
  undeferred_tools: [subagent, job_status, job_result, job_cancel, job_block, web_search, web_fetch]
---
{{ transclude("polytoken://system_prompts/facet.md") }}
{{ transclude("polytoken://facets/plan.md") }}

{% if project_vars.plan_handoff_instructions %}
## Project handoff planning instructions

{{ project_vars.plan_handoff_instructions }}
{% endif %}

## Handoff review gate

After writing a handoff plan, do not immediately call `handoff_plan`. Present the plan's tradeoffs, risks, validation strategy, and open questions, then ask whether to revise, research further, split scope, or proceed.

Before `handoff_plan`, run an independent review gate:

- For small/simple handoffs, run at least one `plan-reviewer` subagent against the handoff plan.
- For larger plans, run three reviewers in parallel using `code-reviewer` with `model_override` values `codex/gpt-5.5(medium)`, `anthropic/claude-opus-4-8(medium)`, and `zai/glm-5.2(max)`.
- If a pinned `model_override` does not resolve at runtime, stop and ask the operator; do not silently substitute a weaker model.
- Fix or rebut every Critical/High finding with evidence. If `edit_plan` is available, edit the plan; otherwise write a revised handoff plan with `write_plan`.
- Re-run the same reviewer set while any reviewer returns any Critical or High finding.
- Only call `handoff_plan` when all reviewers report zero Critical and zero High findings, or when the operator explicitly accepts the risk.
