Plan Critic
src/goal_orchestrator/plan_critic.py. Feature-flagged via plan_critic_enabled (default true).
What it does
Plan Critic is a second LLM pass that validates every TaskGraph generated by PlanGenerator before the executor starts running it. The critic looks for structural and policy issues that a single-pass plan generator can miss.
Validation checks
- All skills referenced exist in the registered catalog.
- No circular dependencies between tasks.
- Each task's input mappings reference real outputs from prior tasks.
- Side-effect skills (
gmail.send,agent_manager.create,task_manager.create) have explicit user intent in the goal objective. - Plan stays within
MAX_PLAN_STEPS(8). - No task uses a placeholder argument (subject="Subject", body="...") that would be blocked by the intent gate at execution time.
Integration
PlanGenerator → TaskGraph
│
▼ (if plan_critic_enabled)
PlanCritic.validate(task_graph, goal)
│
▼
Pass: forward to executor
Fail: regenerate (up to MAX_PLAN_RETRIES = 3)
If the critic rejects 3 times in a row, the goal is flagged FAILED with the latest critic feedback as the failure reason.
Trade-off
The critic costs one extra LLM call per plan. For simple goals (1–2 step plans), this is wasted. Disable via /config if you want to save tokens at the cost of catching planning errors at execution time instead of pre-flight.
Critic feedback in audit log
Each critic decision is logged as plan_critic.passed or plan_critic.rejected with the structured reason. Useful for tracing why a goal failed during planning.