@cognitive-engine/planning
v0.3.1
Published
Goal decomposition, action planning, and plan execution tracking
Readme
@cognitive-engine/planning
Goal decomposition and plan execution tracking for cognitive-engine.
Install
npm install @cognitive-engine/planningUsage
import { Planner } from '@cognitive-engine/planning'
const planner = new Planner(llmProvider)
// Decompose a goal into actionable steps
const plan = await planner.plan({
goal: 'Help user debug authentication flow',
context: cognitiveState,
})
plan.steps
// [
// { id: 1, action: 'identify_error', status: 'pending' },
// { id: 2, action: 'analyze_auth_config', status: 'pending', dependsOn: [1] },
// { id: 3, action: 'suggest_fix', status: 'pending', dependsOn: [2] },
// ]
// Track execution
planner.markComplete(1, { result: 'TokenExpiredError at line 42' })
planner.markComplete(2, { result: 'JWT secret not set in env' })
const status = planner.getStatus()
status.progress // 0.67
status.nextStep // { id: 3, action: 'suggest_fix' }
status.blockers // []Plan Structure
| Field | Description |
|-------|-------------|
| goal | Top-level objective |
| steps[] | Ordered actions with dependencies |
| steps[].dependsOn | IDs of steps that must complete first |
| steps[].status | pending, in_progress, completed, failed |
| progress | 0.0 to 1.0 completion ratio |
