Judge Persona Loader for MoE Verification Layer.
Loads and manages judge personas from config/judge-personas.json for the Constitutional Court architecture (H.3.1.7).
Features:
- Load personas by ID or get all enabled personas
- Generate prompt templates with artifact/context injection
- Validate persona schema completeness
- Model routing configuration (configurable, not hard-coded)
- Environment variable overrides for models
- Diversity verification across model families
Model Configuration Priority (highest to lowest):
- Runtime override via get_model_for_persona(override_model=...)
- Environment variables: CODITECT_JUDGE_MODEL_<PERSONA_ID>
- Model routing config file: config/judge-model-routing.json
- Persona-specific config in judge-personas.json
File: persona_loader.py
Classes
Verdict
Unified verdict types for consensus.
StrictnessLevel
Persona strictness levels.
ModelRouting
Model routing configuration for a persona.
EvaluationDimension
A single evaluation dimension with scoring.
RedFlag
A red flag pattern to identify during evaluation.
Demographics
Persona demographic information.
EvaluationStyle
Evaluation style configuration.
JudgePersona
Complete judge persona with all attributes.
PersonaConfig
Global persona configuration.
PersonaRegistry
Registry of all loaded personas with configuration.
Functions
get_default_loader()
Get or create the default persona loader.
load_persona(persona_id)
Load a persona by ID using the default loader.
get_prompt_template(persona, artifact, context)
Generate prompt template using the default loader.
validate_persona_schema(persona)
Validate a persona schema using the default loader.
verify_panel_diversity(persona_ids)
Verify panel diversity using the default loader.
get_persona(persona_id)
Get a persona by ID.
get_all_personas(enabled_only)
Get all personas, optionally filtered by enabled status.
get_personas_for_artifact(artifact_tags)
Get personas relevant for a given artifact based on trigger conditions.
get_prompt_template(persona, artifact, context)
Generate the evaluation prompt for a persona with artifact injection.
validate_persona_schema(persona)
Validate that a persona has all required fields.
validate_all_personas()
Validate all loaded personas.
verify_panel_diversity(persona_ids)
Verify that a panel of personas meets diversity requirements.
get_model_for_persona(persona_id, use_backup, override_model)
Get the model to use for a persona with configuration priority.
get_all_model_mappings()
Get all persona-to-model mappings with resolved priorities.
map_verdict_to_consensus(persona_id, verdict)
Map a persona-specific verdict to unified consensus verdict.