Operating playbooks and flows
Use this page when validating Playbook/Flow behavior against a real daemon. Treat the daemon CLI and HTTP API as the source of truth.Prerequisites
Build the daemon, load provider credentials, and start an isolated instance:Create and validate a Playbook
Write a manifest file:digest from the created version. Publish with evidence:
Start a Flow
Create a fresh session:flow_id, a run_id, and status.
Inspect evidence
Use Flow inspection first, then inspect the underlying primitives:flows get / agents list as well. Flow primitive_refs can include child run ids, child task ids, and approval/question ids that are no longer pending but remain visible through run events.
For manual restart triage on a Flow:
flows get for the aggregate primitive_refs, then use agents list to map child agent ids to child session ids. Task commands are session-scoped, so a task_id from primitive_refs.task_ids must be checked in the session that owns the corresponding child agent or root session.
If debug capture was enabled before the run, inspect:
Cancel a Flow
Flow cancellation delegates to the referenced run:FlowView.status becomes cancelled. If the root run is already terminal, it stays terminal; FlowView.status is still derived from all scoped run/task state and may not equal the embedded run.status.
Restart recovery live harness
For the production restart scenario, use the checked-in harness:target/debug/kheish-daemon, starts an isolated daemon with fresh --state-root and --workspace-root, starts a Playbook-backed Flow, uses Anthropic for the root run and OpenAI for the child worker, kills and restarts the daemon while a background shell task and write approval are active, then writes evidence under tmp/evidence/<run-id>/.
The final oracle is verdict.json, not the model’s final prose. The script fails if:
- the shell task is not
failedwithterminal_reason: "daemon_restarted" - partial output is missing
- the artifact exists before approval
- provider debug artifacts do not show the expected real providers
WORKER_RESTART_OKappears withouttask.status: "completed",exit_code: 0, and the final shell marker
Evidence Used
- CLI commands:
crates/kheish-daemon/src/main.rs,crates/kheish-daemon/src/cli/commands/playbooks.rs - API routes:
crates/kheish-daemon/src/api/handlers.rs - Debugging order: Debugging and recovery
- This page requires live provider validation only when the started Flow actually reaches a real model provider.
Evidence Note
- Code verified:
crates/kheish-daemon/src/cli/commands/playbooks.rs,crates/kheish-daemon/src/state/playbook_workflow.rs,crates/kheish-daemon/src/services/task.rs,scripts/e2e/restart_flow_recovery_live.sh. - CLI/API verified: commands shown on this page are implemented in the current CLI/API code.
- Daemon live tested for this note: no; run
scripts/e2e/restart_flow_recovery_live.shfor real binary/provider evidence. - Provider-specific tested for this note: no in this documentation pass; the harness is configured for Anthropic
claude-opus-4-6and OpenAIgpt-5.4.
