Workflow System¶
Workflow execution — DAG, execution policy, auto-run steps, conductor, step result visibility
Details¶
Workflow definitions live in knowledge/store/workflows.json as WorkflowUnit entries. Each contains: - workflow_name: registry slug - execution: main | subagent (default policy) - steps: [{id, name, step_type, depends_on, auto_run, optional, execution, ...}] - step_instructions: {step_id: instruction text} - content.full: workflow-level context (philosophy, what-not-to-do)
The conductor reads these at runtime via _discover_workflows_from_store(). Workflows can chain into sub-workflows via workflow_ref. Steps with auto_run specs are executed by the conductor automatically.
Auto-Run Steps¶
Workflow steps can be marked auto_run in workflows.json. The conductor executes these transparently — the agent never sees them as "current." Results are stored in the DAG and delivered to the agent in step_results.
steps:
- id: load-config
name: Load morning config
step_type: code
auto_run:
callable: work_buddy.morning.get_morning_config # dotted import path
kwargs: {} # optional static keyword args
input_map: {} # optional: {kwarg_name: step_id} wires prior results into kwargs
timeout: 30 # seconds (default 30)
When to use auto_run: The step is deterministic, has no side effects, needs no agent reasoning, and produces data consumed by later steps. Examples: config loading, phase resolution, data formatting.
When NOT to use auto_run: The step requires LLM reasoning, user interaction, consent, or calls external services that may fail and need agent-mediated recovery.
Safety: Only work_buddy.* import paths are allowed. Failed auto_run steps are marked FAILED with the error surfaced to the agent. A 30s default timeout prevents runaway calls.
Data threading: Every response from the conductor includes step_results: {step_id: result} — a map of all completed step results (auto_run and agent-completed). The input_map field lets auto_run steps consume upstream results declaratively: input_map: {cfg: load-config} passes the load-config result as the cfg kwarg.
Implementation: _execute_auto_run() in conductor.py. The auto-run loop is in _build_response() — it chains consecutive auto_run steps before returning control to the agent.
Workflow-level blanket consent¶
Starting a workflow grants blanket consent for all its steps (grant_workflow_consent). The blanket is revoked when the workflow completes (3h default TTL). Steps can opt out with requires_individual_consent: true.
DAG resilience¶
- Step results over 50K chars are capped with a summary (_cap_step_results)
- Timed-out auto_run steps produce timeout_recovery hints with re-poll instructions
- Smart trimming: only relevant predecessor results are sent to each step (not all results)
Slash commands¶
All 34 slash commands (.claude/commands/wb-*.md) are thin launchers that load behavioral directions from the knowledge store via agent_docs. The slash command is the entry point; the knowledge store directions unit contains the behavioral content; the workflows.json WorkflowUnit contains the DAG structure.