name: write_charter
description: "Silas synthesizes a formal constitutional charter for a sovereign Tenant -- narrow boundaries, forbidden activities, and black-box operating mandate."
debug: true
system: agent_prompt

agent_prompt:
  - "= identity.md"

skills:
  - guides/CorporateCharterGuide.md

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

steps:
  - type: think
    hint: |
      You are {agent.name}, Chief Architect of Crimson Leaf LLC.

      A charter is not a document -- it is constitutional law. It defines a company's right to exist,
      the boundaries of that existence, and the conditions under which it forfeits that right.

      Read the SKILLS & GUIDES section. The CorporateCharterGuide.md defines every required section
      and the quality standard each must meet. Follow it exactly.

      Design the charter for the proposed Tenant using this strict sequence:

      1. MISSION STATEMENT (must be hyper-specific)
         Who does this company serve?
         What exact problem does it solve?
         What is the one thing it does that no other Tenant does?

      2. DOMAIN & JURISDICTION (authorized operational areas only)
         List every authorized domain with a bold label and one-sentence description.
         If you cannot define the boundary, the company is not ready to be chartered.

      3. FORBIDDEN ACTIVITIES (hard constraints -- minimum 5)
         What must this company never do?
         What adjacent activities would cause portfolio overlap or constitutional drift?
         What commodity execution is outside its mandate?

      4. CONSTITUTIONAL PRINCIPLES (actionable constraints, not aspirational statements)
         What design principles govern every decision this CEO makes?
         Each principle must be testable -- it must be possible to verify compliance.

      5. STANDARD OPERATING PROCEDURE
         What is the step-by-step workflow for this company's core function?
         This must map to the actual templates the company will use.

      6. CONSTITUTIONAL ENFORCEMENT
         How is this charter enforced?
         What is the adjudication threshold for this company's deliverables?

      7. SERVICE BOUNDARY
         What is offered as a B2B service? What is out of scope?
         Distinguish clearly: Service (deliberative, multi-agent) vs Tool (deterministic, programmatic).

      8. FINANCIAL MANDATE
         Seed budget governance rules.
         Follow-on investment conditions.
         Dormancy trigger conditions.

      9. CEO AUTHORITY
         What specific action types is the CEO authorized to execute?
         What is explicitly outside CEO authority?

      10. AMENDMENT STANDARD
          Under what conditions can this charter be amended?
          Elevated adjudication threshold required.

      QUALITY TEST before finalizing:
      - Is the mission statement something only THIS company could have?
      - Do the forbidden activities create a clean separation from every other Tenant in the portfolio?
      - Would the adjudicator be able to use this charter to evaluate any deliverable unambiguously?

  - type: document
    filename: charter

  - type: package
    packet_type: CharterPackage
    hint: |
      Serialize the charter. The charter_md must be complete, properly formatted markdown.
      Do not summarize or truncate -- a partial charter is worse than no charter.
    schema:
      actions:
        - type: quick
          company_slug: "string -- the Tenant this charter governs"
          charter_version: "string -- e.g. 1.0"
          charter_md: "string -- complete markdown content of the charter"
          constitutional_summary: "string -- two-sentence summary of what this company is and is not"
          adjudication_threshold: "integer -- recommended pass threshold for this company's deliverables"

  - type: close
    rag_update: true

adjudication:
  enabled: true
  pass_threshold: 90
  deliverable_type: coordination
  criteria:
    completeness:
      weight: 25
      description: "All 10 required charter sections are present and substantive -- no placeholders"
    specificity:
      weight: 25
      description: "Mission and domain are hyper-specific -- not generalist descriptions that could apply to any company"
    enforcement_clarity:
      weight: 25
      description: "Forbidden activities and constitutional principles are concrete enough to adjudicate against"
    black_box_integrity:
      weight: 25
      description: "Company can operate as a sovereign unit -- clear input/output boundary with no recursive loops"
