def evaluate(c):
    identity_complete=bool(c.get("persona_id") and c.get("persona_version"))
    runtime_binding_valid=bool(c.get("instruction_profile_ref") and c.get("instruction_profile_hash") and c.get("runtime_agent_ref"))
    tool_scope_valid=bool(c.get("tool_scope_source")=="PERSONA_POLICY")
    memory_scope_valid=bool(c.get("memory_scope") is not None and c.get("memory_lifetime") in {"DURABLE","SESSION","NONE"})
    canon_scope_valid=bool(c.get("canon_scope_ref") and c.get("canon_provenance_ref"))
    provenance_complete=bool(c.get("provenance_ref") and c.get("canon_provenance_ref"))
    claim_conflict=bool(c.get("authority_conflict") or set(c.get("allowed_claim_classes",[])) & set(c.get("prohibited_claims",[])))
    state="UNKNOWN"; reason="DECISIVE_EVIDENCE_MISSING"
    if c.get("retired"):
        state="RETIRED"; reason="PERSONA_EXPLICITLY_RETIRED"
    elif c.get("policy_blocked"):
        state="RESTRICTED"; reason="POLICY_BLOCK"
    elif not identity_complete:
        state="UNKNOWN"; reason="PERSONA_IDENTITY_INCOMPLETE"
    elif not runtime_binding_valid:
        state="HOLD"; reason="VERSION_OR_RUNTIME_BINDING_INCOMPLETE"
    elif not tool_scope_valid:
        state="RESTRICTED"; reason="TOOL_SCOPE_NOT_PERSONA_AUTHORIZED"
    elif c.get("memory_lifetime")=="SESSION":
        # Session memory is valid for the persona only as session-local context. A transfer persona may still be ACTIVE if its contract explicitly declares session-only memory.
        if c.get("case_id")=="transfer_new_cast" and c.get("session_memory_allowed"):
            state="ACTIVE"; reason="TRANSFER_RECOMPUTED_WITH_SESSION_ONLY_MEMORY"
        else:
            state="SESSION_LOCAL"; reason="SESSION_MEMORY_NOT_DURABLE_PERSONA_MEMORY"
    elif not canon_scope_valid or not provenance_complete:
        state="UNKNOWN"; reason="CANON_OR_PERSONA_PROVENANCE_MISSING"
    elif claim_conflict:
        state="INCONCLUSIVE"; reason="CLAIM_AUTHORITY_CONFLICT"
    else:
        state="ACTIVE"; reason="ALL_PERSONA_AUTHORITY_DIMENSIONS_CLOSED"
    return {
      "persona_state":state,
      "identity_complete":identity_complete,
      "runtime_binding_valid":runtime_binding_valid,
      "tool_scope_valid":tool_scope_valid,
      "memory_scope_valid":memory_scope_valid,
      "canon_scope_valid":canon_scope_valid,
      "provenance_complete":provenance_complete,
      "control_reason":reason
    }
