This document is the handoff TODO for taking /expert from the current v0 workflow shell to a GSAP-class scheduler.
Current state:
/expert command exists and defaults to yolo.~/.zcode/cli/workflows.start/list/get/cancel plus workflow event notifications.exec through the generic workflow DAG scheduler.Target state:
exec becomes a real DAG scheduler.Goal: make exec use graph/frontier scheduling instead of one serial phase activity.
Status: initial generic scheduler landed. It derives ready/active/blocked nodes, dispatches ready executable nodes with maxConcurrentLoops, records child agent activities per node, emits node/frontier/executor events, retries failed nodes, pauses on maxConsecutiveErrors, and exposes the derived scheduler state through the workflow contract plus ZCode app-server detail responses. The durable contract now exposes generic WorkflowRunSnapshot / WorkflowStrategy names while keeping expert aliases for compatibility. Resume/cancel now have generic snapshot repair helpers: stale active work is closed before resume, cancellation marks non-terminal workflow state as cancelled, and same-process background workflows receive abort signals. Remaining P0 work is mostly feeding richer task graphs from planner output.
Tasks:
packages/core/src/workflow/.snapshot.graph and derive ready nodes from dependencies.pending, active, completed, failed, skipped, cancelled.executor.maxConcurrentLoopsexecutor.maxConsecutiveErrorsreactLoop.maxRounds is included in node prompts; per-node loop enforcement still belongs in child AgentRuntime/react-loop policy.node_startednode_completednode_failedfrontier_changedexecutor_pausedexecutor_completedAcceptance criteria:
zcode.dev/workflow/get returns a graph where z-code-2 can show active, ready, and blocked nodes correctly.Tests:
Goal: make built-in expert task nodes execute closer to zcode-cli-bak/src/gsap: subplan the node, run actor/critic loops, and expose every sub-activity through ZCode app-server.
Status: planned. The generic DAG scheduler should remain the owner of ready/blocked/frontier state. The expert workflow should provide a GSAP-like node executor for task nodes, while phase nodes can keep the direct activity path for compatibility.
Tasks:
reactLoop.maxRounds.snapshot.activities and snapshot.sessionLinks.workflow_session_linked with nodeId, activityId, activityKind, loopId, sessionId, and model.zcode.dev/workflow/get.scheduler.activeActivities derivable from the snapshot.Acceptance criteria:
Tests:
workflow/get returns nested session links and activity kinds.Goal: support GSAP-style graph expansion while exec is running.
Status: generic collection/frontier state, graph expansion validation, planner activity recording, and scheduler planner hooks are in place at the workflow layer. The runtime now also accepts a generic WorkflowGraphSeed from planning artifacts and uses it to seed exec task nodes and collections after expert arch_decompose. The parser accepts the legacy GSAP architecture graph shape (name, references, source/target, node_names/nodeNames) from ~/workspace/zcode-cli-bak, then persists the result through normal workflow graph records. meta_prompt can now return a generic WorkflowNodePromptUpdateSet, which updates existing target-phase nodes before scheduler dispatch.
Tasks:
collectionIdnodeIdsexplorablefrontierTargetplannerRunsexhaustedplanner_startedplanner_completedplanner_failedgraph_expandedcollection_exhaustedarch_decompose output into exec task nodes, edges, and collections.meta_prompt integration for node-level prompts when a future prompt artifact provides richer per-node instructions.Acceptance criteria:
exec.Tests:
maxPlannerRuns.meta_prompt prompt enrichment once wired.Goal: make final_critic able to reopen graph nodes and send them back through the executor.
Status: implemented as a generic workflow critic result schema plus reusable reopen-node snapshot operation. Expert final_critic now parses critic JSON, emits critic lifecycle events, reopens eligible completed/failed/skipped nodes with a cap, and re-enters the generic scheduler for reopened work. Empty fail-without-reopen exits safely.
Tasks:
reopen_node graph operation.pending.critic_startedcritic_passedcritic_failednode_reopenedcritic_iteration_limit_reachedAcceptance criteria:
finalCritic.maxIterations.Tests:
Goal: make long-running workflows safe to stop, resume, and inspect after process failure.
Tasks:
active nodes to pending on resume unless their child session is known to still be running.Current note: resume/cancel repair is implemented at the generic workflow snapshot boundary. The current runtime does not yet reconnect to still-running child sessions, so resumed active work is conservatively retried. Node-level/planner-level stop is represented by graph/activity cancellation state, while planner activities themselves remain future P1/P3 work.
Acceptance criteria:
exec allows safe resume.Tests:
Goal: expose enough state for z-code-2 to act as a useful workflow debugger.
Tasks:
zcode.dev/workflow/event.expert-workflow.md.Acceptance criteria:
Tests:
packages/shared/src/zcode-task-types.ts already models ZCodeWorkflowEventRecord.nodeId and payload, but packages/services/src/zcode-agent/zcodeTaskServiceAdapter.ts still leaves workflow methods as empty/unsupported. Reconnect workflow transport through IZCodeTaskService before productizing the debugger.
workspace_workflow_event through dynamic workspace events.ZCodeWorkflowKind as a non-empty string so custom definition-backed workflows are observable.Goal: make the current debug UI good enough for real workflow debugging.
Tasks in /Users/dev/workspace/z-code-2:
Acceptance criteria:
Tests:
Goal: make workflows configurable without hardcoding every step.
Status: built-in expert runs from a runtime-validated definition object. This slice also defines durable definition provenance, adapter-level JSON loading from ~/.zcode/cli/workflows/definitions, and a generic bootstrap/ZCode app-server control path. /expert remains pinned to the built-in definition, while zcode.dev/workflow/* may select a definition-backed workflow with kind and definitionId.
Tasks:
WorkflowDefinition and WorkflowPhaseDefinition contracts.~/.zcode/cli/workflows/definitions.expert as the default definition./expert --definition <name> or a future generic /workflow <name> slash command only after the schema is stable.Acceptance criteria:
expert works without user config.Tests:
The first useful milestone is P0 + part of P4: after that, z-code-2 can show a real moving frontier instead of only a static phase graph.
Current implementation:
docs/design/v2/expert-workflow.mdpackages/core/src/workflow/expert.tspackages/core/src/workflow/lifecycle.tspackages/contracts/src/workflow/index.tspackages/adapters/src/workflow/index.tspackages/bootstrap/src/zcode-protocol-entrypoint.tsGSAP reference:
/Users/dev/workspace/zcode-cli-bak/src/gsap/pipeline/orchestrator.ts/Users/dev/workspace/zcode-cli-bak/src/gsap/pipeline/executor.ts/Users/dev/workspace/zcode-cli-bak/src/gsap/graph/engine.ts/Users/dev/workspace/zcode-cli-bak/src/gsap/graph/ops.tsz-code-2 debugger:
/Users/dev/workspace/z-code-2/docs/workflow-debugger.md/Users/dev/workspace/z-code-2/packages/ui/src/WorkflowDebugPane.tsx/Users/dev/workspace/z-code-2/packages/ui/src/WorkflowGraphView.tsx/Users/dev/workspace/z-code/packages/services/src/zcode-agent/zcodeTaskServiceAdapter.ts