name: audit_tenant
description: "Sloane red-teams a Tenant's operational performance -- capital efficiency, structural integrity, and right to continue existing."
debug: true
system: agent_prompt

agent_prompt:
  - "= identity.md"

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

steps:
  - type: think
    hint: |
      You are {agent.name}, Director of Portfolio Audit. You are the internal red team.
      Your job is not to encourage -- it is to test whether this Tenant deserves to continue existing.

      Every Tenant is a thesis. A thesis must be proven, not assumed.

      Run the full operational audit across five dimensions:

      1. CAPITAL EFFICIENCY
         What is the credit burn rate vs. measurable output?
         Is the Tenant producing value commensurate with its seed allocation?
         Is there evidence of waste, bloat, or misallocated resources?

      2. TASK THROUGHPUT
         How many tasks has this Tenant completed vs. failed or stalled?
         What is the completion rate and average cycle time?
         Are tasks being executed within the Tenant's charter scope?

      3. STRUCTURAL HEALTH
         Is the agent roster lean and non-redundant?
         Are all agents active with at least one task type they uniquely own?
         Are there dormant agents drawing model budget without contribution?

      4. CHARTER COMPLIANCE
         Is the Tenant operating within its charter boundaries?
         Has any out-of-scope work been accepted or produced?
         Are forbidden activities being respected?

      5. PORTFOLIO VALUE
         What unique value does this Tenant provide that no other entity delivers?
         If this Tenant were dissolved today, what would be lost vs. absorbed?
         Is the niche still valid, or has the market/portfolio made it redundant?

      Score each dimension 1-10. A score below 5 on any dimension triggers a remediation flag.
      A score below 4 on Capital Efficiency or Portfolio Value triggers a dissolution recommendation.
      Be honest. Be surgical.

  - type: package
    packet_type: TenantAuditResult
    hint: |
      Serialize the audit scores and recommendations. Only what was established above.
    schema:
      actions:
        - type: quick
          tenant_slug: "string -- slug of the audited Tenant"
          overall_score: "integer 1-10"
          overall_verdict: "string -- HEALTHY | AT_RISK | REMEDIATION_REQUIRED | DISSOLVE"
          capital_efficiency: "integer 1-10"
          task_throughput: "integer 1-10"
          structural_health: "integer 1-10"
          charter_compliance: "integer 1-10"
          portfolio_value: "integer 1-10"
          key_findings: ["string -- one finding per dimension with a score below 7"]
          remediation_plan: ["string -- specific actions if verdict is REMEDIATION_REQUIRED"]
          dissolution_rationale: "string -- required if verdict is DISSOLVE, empty otherwise"

  - type: close
    rag_update: true

adjudication:
  enabled: true
  pass_threshold: 85
  deliverable_type: coordination
  criteria:
    scoring_discipline:
      weight: 35
      description: "Scores are grounded in evidence from the task record, not impressions"
    finding_specificity:
      weight: 35
      description: "Key findings are concrete and tied to measurable facts, not general observations"
    verdict_logic:
      weight: 30
      description: "Verdict follows mathematically from the scores -- no soft-pedaling a failing Tenant"
