Skip to content

structured planning

Aryan Iyappan edited this page Apr 28, 2026 · 1 revision

title: Structured Planning category: concepts tags: [harness, planning, dag, layer-2, quality] status: developing created: 2026-04-28 updated: 2026-04-28 sources:


Structured Planning

Origin Principle

Machine-readable task DAG reviewed before code begins. No code without a plan.

Flow

spec_hardened event →
Planner.createPlan(spec) → AI call → ExecutionPlan with nodes[]
    ↓
DAG validation: cycle detection, orphan detection, spec coverage
    ↓
If invalid: regenerate (max_plan_revisions)
    ↓
Plan review gate:
    → Adversarial critic review of plan
    → OR human approval (config: require_approval)
    ↓
Store ExecutionPlan in .pi/harness/plans/<id>.json
    ↓
Emit: plan_approved → Archon workflow (Layer 7)

ExecutionPlan Data Contract

Each PlanNode in the DAG includes:

  • task_id, title, description — what to do
  • inputs, outputs — declared data dependencies
  • dependencies — which tasks must complete first
  • risk_surface — at least one risk entry per task
  • verification — concrete method to verify completion
  • status — pending → in_progress → completed/failed/blocked

The ExecutionPlan tracks:

  • DAG validation status
  • Review status (pending/approved/rejected/revised)
  • Reviewer notes if rejected

Validation

Automated DAG validation checks:

  • Cycle detection — no circular dependencies
  • Orphan detection — no disconnected nodes
  • Spec coverage — every success criterion maps to at least one task

Review Gate

Plans go through adversarial review before approval:

  • A critic agent attacks the plan (missing tasks, incorrect dependencies, overly broad tasks)
  • If rejected, the planner regenerates with review notes incorporated
  • require_approval config controls whether human approval is also needed
  • max_plan_revisions caps regeneration cycles (default: 3)

Extension Interface

Type Name Description
Tool create-plan Generate plan from hardened spec
Tool review-plan Adversarial review of plan
Tool approve-plan Human approval gate
Command /harness-plan-status Current plan status

Files

  • lib/harness-planner.ts — Planner class, DAG generation, validation
  • extensions/harness-planner.ts — Extension: listens for spec_hardened, produces plan

Clone this wiki locally