name: planning
description: "Rotating chair deliberation -> structured work breakdown -> child tasks created."
debug: true
system: agent_prompt
agent: Nova
participant_prompt:
  - "= identity.md"
agent_prompt:
  - "= identity.md"
sections:
  - agent
  - project
  - history
  - rag
  - participants
  - participants_prompt
  - roster
  - message
  - instructions
steps:
  - type: think
    rotate_participants: true
    loop:
      max_iterations: 3
    hint: |
      You are {agent.name}. This is round {task.iteration} of the planning session.
      The group is breaking down this project or task into a concrete work plan.
      Write YOUR perspective on the plan from your area of expertise:
        - What work streams or tasks need to exist?
        - What order do they need to happen in? What depends on what?
        - Which agents from the TEAM ROSTER are best suited to each piece?
        - What risks, gaps, or open questions do you see?
        - What do you agree or disagree with from prior planning rounds above?
      Reference the TEAM ROSTER above for agent names and the task types they own.
      Use EXACT task type names from each agent's supported_templates list -- these are the
      template filenames the Bouncer uses to route tasks. Do NOT invent task type names.
      Be specific about agent assignments -- use EXACT names from the TEAM ROSTER.
      ROUNDTABLE CHAIR RULE: For business strategy or operations deliberations, assign the chair
      to a business-register agent (director or executive role). Do NOT assign pure writing or
      creative-execution agents as chair for planning deliverables.
      When the group has genuinely agreed on a complete plan, include exactly:
      "consensus_reached: true"
      If the plan still has gaps or unresolved assignments, do NOT include that line.
  - type: think
    agent: first_available
    hint: |
      Structure the team's agreed plan into a precise task list.
      IMPORTANT: Do NOT re-deliberate or reconsider what was agreed above.
      Your only job in this step is to serialize the decisions into clean task records.
      For each task:
        - task_name: short, specific
        - description: full detail -- enough that the assigned agent can execute without asking
        - agents: EXACT name(s) from TEAM ROSTER
        - task_type: MUST be an EXACT template name from the agent's supported_templates in the TEAM ROSTER
        - priority: 1 (critical) to 5 (nice-to-have)
      Order tasks correctly -- blockers before dependents.
      No ambiguous assignments. No placeholder names.
      Do NOT invent task type names. Each task_type MUST appear verbatim in the TEAM ROSTER.

      ANTI-HALLUCINATION RULE FOR AGENTS:
        NEVER invent agent names. Only assign tasks to agents that exist in the TEAM ROSTER above.
        Invented agents like "Worldbuilder", "Prose Engine", "Plot Architect", "Voice Sculptor",
        "Concept Analyst", "Logic Warden", "Heartstring Tensioner", or ANY name not in the roster
        will cause routing failure -- the task will run with no agent context and produce nothing.
        If no existing agent perfectly fits a task, assign it to the closest match:
          - Writing/prose tasks -> Iris
          - Planning/strategy tasks -> Nova or Selene
          - Research tasks -> Forrest
          - Editorial/review tasks -> Devon, Lane, or Cora

      BOARDROOM RULE:
        - When the request is for a strategic debate, a structured discussion, a decision-making
          session, or a formal deliberation WITHOUT producing new content artifacts, create ONE task:
            task_type: boardroom, agent: Selene, priority: 1
        - boardroom tasks are purely deliberative -- no research, no content output.
        - Example triggers: "convene a boardroom", "debate strategy", "decide on priorities",
          "executive discussion", "formal boardroom session", "strategic review"
        - Do NOT create book_research, blog_research, or any other content pipeline task
          for a boardroom request. ONE boardroom task only.

      NO-RE-PIPELINE RULE:
        - CRITICALLY IMPORTANT: If the project history above shows that book_research,
          book_outline, ai_article_research, blog_research, recipe_collection_plan, or
          short_story tasks have already been created for this project, do NOT create them again.
        - Check the HISTORY section above. If any content pipeline tasks are listed as
          InProgress, Completed, or AdjudicationPending, the pipeline is already running.
        - For an in-flight project, only create tasks that are genuinely missing: editorial
          review (book_editorial), boardroom deliberations, or quick answers.
        - NEVER restart a research or outline pipeline mid-flight.

      BOOK/FICTION SEQUENCING RULE:
        - For novels and books, the pipeline is: book_research -> book_outline -> book_chapter (?N) ->
          chapter_review (?3 per chapter) -> chapter_roundtable -> chapter_polish -> book_editorial -> project_index
        - Do NOT spawn book_chapter tasks until book_outline has run and provided chapter context.
        - Start with ONE book_research task only. The cascade templates handle everything after that.
        - If the operator or project metadata marks the project as draft-only, use `drafting`
          instead of `book_chapter` for chapter tasks and stop after the draft deliverable.

      ARTICLE SERIES SEQUENCING RULE:
        - For article series: ai_article_research -> ai_article_plan -> ai_article_write (?N)
        - Start with ONE ai_article_research task only.

      BLOG SEQUENCING RULE:
        - For a blog post: blog_research -> blog_write (one per post)

      RECIPE SEQUENCING RULE:
        - For a recipe collection: ONE recipe_collection_plan task only.

      SHORT STORY RULE:
        - For a short story (under 20k words): ONE short_story task only.

      CANONICAL SELECTION RULE: If the plan produces multiple competing drafts of the
      same artifact (e.g. three mission statement drafts, two roadmap versions), the plan
      MUST include a final "Select Canonical: [artifact]" task assigned to the most
      relevant specialist that explicitly picks one version, merges the best elements, and
      archives the rest. Do NOT leave competing versions unresolved.

      DECOMPOSITION RULE: When the deliverable is a batch of similar items (e.g. 10 podcast
      scripts, 5 chapters, 8 articles), create ONE individual task per item -- NOT a
      single "write all 10" batch task. Each item must be its own task with its own specific
      description. Review and polish tasks can be batched at the end.

  - type: package
    packet_type: PlanningResponsePacket
    schema:
      tasks:
        - task_name: "string -- short descriptive name"
          description: "string -- full instructions for the assigned agent"
          agents:
            - "string -- EXACT agent name from TEAM ROSTER"
          task_type: "string -- MUST be a template name from AVAILABLE TASK TEMPLATES"
          priority: "integer 1 (critical) to 5 (nice-to-have)"
    insert_children: true

  - type: close
    rag_update: false
adjudication:
  enabled: false
