Baton Framework workflow definitions
@conductus-labs/baton-workflows provides workflow definitions for common agent tasks and project management. Workflows define structured processes that agents can execute, including:
- Step-by-step instructions
- Decision points and branching logic
- Error handling strategies
- Sub-flow composition
- Human-in-the-loop checkpoints
npm install @conductus-labs/baton-workflowsNote: This package depends on @conductus-labs/baton-core and @conductus-labs/baton-agents. Install them first:
npm install @conductus-labs/baton-core \
@conductus-labs/baton-agents \
@conductus-labs/baton-workflows- agent-initialisation.yml - Initialize an agent for a new session
- context-synchronisation.yml - Synchronize agent context with repository state
- manage-boundary-rule.yml - Manage project and agent boundary rules
- project-initialisation.yml - Initialize a new project with Baton Framework
Sub-flows are reusable workflow components that can be called from main workflows:
- sub-flow-create-agent-boundaries.yml - Create agent boundary file
- sub-flow-create-agent-context.yml - Create agent context file
- sub-flow-load-agent-boundaries.yml - Load agent boundary file
- sub-flow-load-agent-context.yml - Load agent context file
- sub-flow-load-all-boundaries.yml - Load all boundary files
- sub-flow-load-project-boundaries.yml - Load project boundary file
- sub-flow-load-project-config.yml - Load project configuration
- sub-flow-load-project-manifest.yml - Load project manifest
- sub-flow-validate-scope.yml - Validate agent scope for command/workflow
- sub-flow-validate-workflow-permission.yml - Validate workflow permissions
After installation, workflow files are available in the baton/workflows/ folder:
your-project/
└── baton/
└── workflows/
├── agent-initialisation.yml
├── context-synchronisation.yml
├── manage-boundary-rule.yml
├── project-initialisation.yml
└── sub-flows/
├── sub-flow-create-agent-boundaries.yml
├── sub-flow-create-agent-context.yml
└── ... (all sub-flows)
Use @conductus-labs/baton-core utilities to load workflow definitions:
import { loadWorkflow, loadWorkflowStrict } from "@conductus-labs/baton-core";
import type { WorkflowDefinition } from "@conductus-labs/baton-workflows";
// Safe loading (returns null if invalid)
const workflow = loadWorkflow("agent-initialisation");
if (workflow) {
console.log(workflow.workflow_name);
console.log(workflow.workflow_steps.length);
}
// Strict loading (throws if invalid)
try {
const workflow = loadWorkflowStrict("agent-initialisation");
// TypeScript knows workflow is WorkflowDefinition
} catch (error) {
console.error("Failed to load workflow:", error);
}import { loadSubFlow, loadSubFlowStrict } from "@conductus-labs/baton-core";
// Load sub-flow
const subFlow = loadSubFlow("sub-flow-load-project-config");
if (subFlow) {
console.log(subFlow.workflow_name);
}Import TypeScript types for type safety:
import type {
WorkflowDefinition,
WorkflowStep,
SubFlow,
DecisionPoint,
Prerequisite,
} from "@conductus-labs/baton-workflows";
function processWorkflow(workflow: WorkflowDefinition) {
console.log(`Workflow: ${workflow.workflow_name}`);
console.log(`Purpose: ${workflow.purpose}`);
console.log(`Steps: ${workflow.workflow_steps.length}`);
workflow.workflow_steps.forEach((step: WorkflowStep) => {
console.log(` Step ${step.step}: ${step.name}`);
});
}You can also read workflow files directly from the file system:
import { readFileSync } from "fs";
import { join } from "path";
import { loadYamlFile } from "@conductus-labs/baton-core";
const workflowPath = join(
process.cwd(),
"baton",
"workflows",
"agent-initialisation.yml"
);
const workflow = loadYamlFile(workflowPath);
console.log(workflow.workflow_name);
console.log(workflow.workflow_steps);Each workflow file follows this structure:
version: 1.0.0
workflow_name: agent-initialisation
purpose: Initialize an agent for a new session
associate_command: init-{agent_short_name}
requires_permission_check: false
created: 2025-11-23
prerequisites:
- Agent short-name parameter must be provided
- Write access to `.baton/` directory
parameters:
agent_short_name: { Required - Agent short-name to initialize }
workflow_steps:
- step: 1
name: Check Project Configuration Files
description: Verify project.config.yml exists
actions:
- Check if `.baton/project.config.yml` exists
decision_points:
- condition: File exists
if_true: Continue to step 2
if_false: Display error and stop
error_handling:
retry: false
error_messages:
- type: File Not Found
message_template: user-messages/workflows/agent-initialisation/step-1-error.md
action: Stop execution
error_handling:
global_retry:
enabled: false
max_retries: 0
command_references:
- command: /init-baton-agent
description: Initialize baton-agent
when_to_use: At the start of a new sessionWorkflows are executed by agents following the step-by-step instructions. Each step includes:
- Actions: Specific tasks to perform
- Decision Points: Conditional logic for branching
- Dependencies: Steps that must complete before this step
- Sub-Flows: Reusable workflow components
- Error Handling: How to handle errors at each step
Re-exported from @conductus-labs/baton-core:
WorkflowDefinition- Complete workflow definition structureWorkflowStep- Individual workflow stepSubFlow- Sub-flow definitionDecisionPoint- Decision point for branchingPrerequisite- Workflow prerequisiteErrorHandling- Error handling configurationCommandReference- Command reference
Workflow definition files are included in the package and available at:
- Package location:
node_modules/@conductus-labs/baton-workflows/src/workflows/**/*.yml - Project location (after install):
baton/workflows/**/*.yml
packages/workflows/
├── src/
│ ├── workflows/ # Workflow definition files
│ │ ├── agent-initialisation.yml
│ │ ├── context-synchronisation.yml
│ │ ├── manage-boundary-rule.yml
│ │ ├── project-initialisation.yml
│ │ └── sub-flows/
│ │ ├── sub-flow-create-agent-boundaries.yml
│ │ ├── sub-flow-create-agent-context.yml
│ │ └── ... (all sub-flows)
│ ├── types.ts # Type re-exports
│ └── index.ts # Main export
├── package.json
├── tsconfig.json
└── README.md
@conductus-labs/baton-core- Core types and utilities (required)@conductus-labs/baton-agents- Agent definitions referenced by workflows (required)
npm run buildnpm run test
npm run test:watch
npm run test:coverageThis package follows Semantic Versioning:
- Major (1.0.0 → 2.0.0): Breaking changes to workflow structure
- Minor (1.0.0 → 1.1.0): New workflows added
- Patch (1.0.0 → 1.0.1): Updates to existing workflows, bug fixes
MIT
@conductus-labs/baton-core- Core types and utilities (required)@conductus-labs/baton-agents- Agents that execute workflows (required)
For more information about workflows:
- RHYTHM Method Workflows - RHYTHM Method workflow patterns
- Scope System Documentation - Understanding scope-based authorization for workflows