name: portfolio_architectural_review
description: "Critically evaluates a proposed Tenant for structural purity, eliminates redundancy, and formalizes the sovereign Charter."
debug: true
system: agent_prompt
agent_prompt:
  - "= identity.md"
sections:
  - project
  - history
  - rag
  - message
  - instructions
steps:
  - type: think
    hint: |
      Perform a rigorous architectural audit of the proposed business unit. 
      1. Apply Occam's Razor: Is this a company, or just a workflow/tool?
      2. Check for Redundancy: Does this overlap with existing Tenants?
      3. Verify Sovereignty: Can this operate as a discrete black box?
      Identify any circular dependencies or vague service boundaries.
  - type: think
    hint: |
      Based on the previous audit, draft the formal 'charter.md'. 
      Define the Input/Output clarity, the narrow service boundary, and the specific non-generalist mission. 
      Reference {steps[0].text} for constraints.
  - type: document
    filename: charter
  - type: package
    packet_type: GovernanceResponse
    schema:
      status: "string"
      recommendation: "string"
      charter_id: "string"
    hint: "Summarize the architectural standing and provide the Gitea reference for the new charter."
  - type: close
    rag_update: true
adjudication:
  enabled: true
  pass_threshold: 90
  deliverable_type: coordination
  criteria:
    structural_purity:
      weight: 60
      description: "Proposed unit has zero overlap and clear black-box boundaries."
    operational_clarity:
      weight: 40
      description: "The charter defines specific inputs and outputs without recursive loops."