name: hire_agent
description: "CEO designs and provisions a new agent -- skills-guided, adjudicated, directly committed."
debug: true
system: agent_prompt

agent_prompt:
  - "= identity.md"

skills:
  - guides/PAEAgentGuide.md

sections:
  - agent
  - project
  - rag
  - roster
  - skills
  - message
  - rejection_feedback
  - instructions

steps:
  - type: think
    hint: |
      You are {agent.name}, executing the hiring process for Crimson Leaf LLC.

      OPERATOR'S ORIGINAL REQUEST (context for why this hire is needed):
      {original_operator_prompt}

      CONTEXT: Read the SKILLS & GUIDES section -- it contains the PAE Agent Guide
      which defines the exact file schemas you must produce.

      DECISION PROCESS:
      1. Review the TEAM ROSTER. Determine whether an existing agent already covers
         the needed capability within their current directives.
      2. If an existing agent can serve, explain why hiring is unnecessary.
         Your package step should still output a hire_agent action, but with a
         clear justification that may cause adjudication to reject if the hire is redundant.
      3. If a new hire IS justified, design the complete agent:

      AGENT DESIGN REQUIREMENTS:
      - name: A distinctive, professional name fitting the role and company culture.
      - role: One of: ceo, director, specialist, analyst, writer, editor, researcher.
      - model: power for directors, default for specialists (unless deep reasoning needed).
      - character.personality: One paragraph -- temperament, working style, decision-making.
      - character.stats: 1-10 scale -- intelligence, creativity, diligence, adaptability, leadership.
      - manages: Directors manage [specialists]. Specialists manage [].
      - department: executive, operations, creative, research, engineering.
      - supported_templates: ONLY templates that exist in the company templates/ directory.
      - identity.md: Full narrative identity with Core Directives, Constitutional Principles,
        Authority (authorized + not authorized), and Communication Style.
      - system.md: Lean 3-8 line system prompt (You are..., MANDATE, SYSTEMIC RULES, OPERATING POSTURE).

      CONSTRAINTS:
      - Every hire must serve the company charter. Re-read the charter before finalizing.
      - Crimson Leaf roster cap is 8 agents (excluding intake). Check roster size before proposing.
      - No vanity roles, overlapping roles, or speculative roles.
      - Each agent must have a distinct constitutional function.

      ZERO-OVERLAP HIRING RULE (MANDATORY):
      - Every new agent MUST have at least ONE supported_template that NO existing
        roster member already covers. If the new agent's supported_templates are a
        subset of an existing agent's templates, the hire is REJECTED.
      - Review the TEAM ROSTER carefully. List each member's supported_templates.
        If any current agent already covers every template you plan to assign,
        you must either: (a) expand the existing agent's mandate instead, or
        (b) design the new agent with a genuinely unique task type.
      - Agents that can only do "planning + boardroom" are boardroom voices, not
        workers. Prefer hiring agents that can DO something (hire_agent, write_template,
        create_company, research, analysis) -- not just deliberate.

  - type: package
    packet_type: IntakeResponse
    hint: |
      Convert the agent design into a strict JSON payload.
      Output exactly ONE hire_agent action.
      The agent_yml must be valid YAML. The identity_md and system_md must be complete markdown.
      Do not include prose outside the JSON structure.
    schema:
      actions:
        - type: hire_agent
          agent_name: "string -- the agent's display name"
          role: "string -- role slug: ceo, director, specialist, analyst, writer, editor, researcher"
          agent_yml: "string -- complete content of agent.yml (valid YAML)"
          identity_md: "string -- complete content of identity.md (full markdown)"
          system_md: "string -- complete content of system.md (lean markdown)"

  - type: close
    rag_update: true

adjudication:
  enabled: true
  pass_threshold: 85
  deliverable_type: coordination
  criteria:
    charter_alignment:
      weight: 20
      description: "Agent serves the company charter and fills a genuine gap"
    role_specificity:
      weight: 15
      description: "Agent has a distinct, non-overlapping function"
    identity_quality:
      weight: 20
      description: "Identity is complete, constitutional, and actionable"
    file_correctness:
      weight: 15
      description: "agent.yml, identity.md, and system.md are well-formed and consistent"
    roster_discipline:
      weight: 15
      description: "Hire respects roster limits and avoids redundancy"
    unique_capability:
      weight: 15
      description: "Agent has at least one supported_template not covered by any existing roster member. Score 0 if all templates overlap with existing agents."
