Adversarial review of execution plans before they run.
The PlanCritic acts as an "SRE" that validates plans for:
- Missing synthesis gates (context window risk)
- Loose coupling (tasks expecting data that may not exist)
- Optimism bias (wrong error handling for flaky operations)
- Structural issues (circular deps, orphan tasks)
Usage
{:ok, critique} = PlanCritic.review(plan, llm: my_llm)
if critique.score < 8 do
{:ok, refined_plan} = MetaPlanner.refine(plan, critique)
endStatic vs LLM Analysis
The critic performs both:
- Static analysis: Structural checks that don't need an LLM
- LLM analysis: Semantic checks that require understanding intent
Summary
Types
Functions
@spec review( PtcRunner.Plan.t(), keyword() ) :: {:ok, critique()} | {:error, term()}
Review a plan and return a structured critique.
Combines static analysis (fast, deterministic) with optional LLM analysis (slower, semantic understanding).
Options
llm- LLM callback for semantic analysis (optional)static_only- Skip LLM analysis, only do structural checks (default: false)
Returns
A critique map with:
score- Overall quality score 1-10issues- List of specific issues foundsummary- Human-readable summaryrecommendations- List of actionable fixes
@spec static_review(PtcRunner.Plan.t()) :: {:ok, critique()}
Quick static-only review (no LLM needed).