Documentation
Everything you need to get started with Lanes.
Create a New Session
Creating a new session in Lanes is straightforward. Each session is isolated and runs in its own Git worktree, giving Claude Code a clean workspace to work in without affecting your main codebase.
Before You Start
Make sure you have:
- Opened a folder or workspace in VS Code
- A Git repository initialized (
git initif needed) - Claude Code installed globally (
npm install -g @anthropic-ai/claude-code) - Logged into Claude (
claude login) jqinstalled for status tracking (brew install jqon macOS orapt install jqon Linux)
Note: Lanes currently supports macOS and Linux. Windows is not yet supported (WSL may work).
Step 1: Open the Lanes Sidebar
Click the Lanes icon in the VS Code activity bar (the vertical bar on the far left) to open the Lanes panel. You'll see the session creation form at the top.
Tip
Can't find the Lanes icon? Use the command palette (Cmd+Shift+P) and search for "Lanes: Create Session".
Step 2: Fill in the Session Form
The form has several fields to configure your session. Here's what each one does:
1 Session Name *
A unique identifier for your session. This becomes the Git branch name, so use descriptive, Git-safe names.
✗ Bad: my session, task#123, testing!!!
Allowed characters: letters, numbers, hyphens, underscores, dots, and slashes
2 Source Branch (optional)
The branch to create the worktree from. If left empty, Lanes uses your current HEAD.
main to always start from main, or develop for your development branch.
Note: The source branch must already exist. Lanes will create a new branch (with the session name) from this branch.
3 Starting Prompt (optional)
The initial task description sent to Claude Code when the session starts. Be specific about what you want Claude to do.
Leave empty if you want to start with a blank session and provide instructions manually.
4 Acceptance Criteria (optional)
Define what success looks like. Claude will use this to know when the task is complete.
- Users stay logged in for at least 30 minutes
- Token refresh happens automatically before expiration
- All existing tests still pass
5 Permission Mode
Controls what Claude Code can do without asking for permission. Choose based on your trust level and workflow:
default
Standard behavior - asks for permission on sensitive operations
acceptEdits
Auto-accepts file edits (recommended for most workflows)
dontAsk
Auto-deny tools unless explicitly allowed by an allow rule
bypassPermissions
Runs all commands automatically (use with caution)
Recommendation: Start with default or acceptEdits until you're comfortable with how Claude works.
6 Workflow Template (optional)
Choose a structured workflow to guide Claude through your task. Workflows define clear phases like plan, implement, test, and review.
.lanes/workflows/
Click the refresh button (↻) to reload the workflow list if you just added new workflow files.
Step 3: Click "Create Session"
Once you've filled in the required fields, click the Create Session button. Lanes will:
Create a new Git worktree
Located at .worktrees/[session-name] - a complete, isolated copy of your repository
Create a new branch
Named after your session, branched from the source branch (or current HEAD)
Open a dedicated terminal
Each session gets its own terminal window in VS Code
Launch Claude Code
With your starting prompt (if provided) and selected permission mode
Initialize workflow (if selected)
Sets up the MCP server and prepares the workflow state
What Happens Next?
Terminal Opens: You'll see a new terminal window appear with Claude Code running. The terminal title shows your session name.
Session Appears in Sidebar: Your new session shows up in the "Active Sessions" list in the Lanes sidebar with a real-time status indicator.
Claude Starts Working: If you provided a starting prompt, Claude immediately begins working on your task. Otherwise, it waits for your instructions.
Isolated Environment: All changes Claude makes are contained in the worktree. Your main working directory remains untouched.
Tips for Success
Use descriptive session names
Names like fix-user-logout-bug are more helpful than session1
Be specific in your prompts
Include file paths, expected behavior, and any relevant context
Start with a clean working directory
Commit or stash changes in your main branch before creating sessions
Use workflows for complex tasks
Features with multiple files, testing requirements, or documentation needs benefit from structured workflows
One task per session
Keep sessions focused on a single goal - create multiple sessions for multiple tasks
Troubleshooting Common Issues
Error: "Session name already exists"
A session with this name is already active, or a branch with this name exists. Choose a different name or delete the existing session first.
Error: "Not a git repository"
Run git init in your project folder to initialize a Git repository.
Error: "Claude Code not found"
Install Claude Code globally: npm install -g @anthropic-ai/claude-code
Understanding Worktrees
Git worktrees are the foundation of Lanes' isolation strategy. They allow you to have multiple working directories attached to the same repository, enabling you to work on multiple tasks simultaneously without conflicts.
What are Git Worktrees?
Imagine you're working on a feature in your project, but suddenly need to fix a critical bug. Normally, you'd have to:
- Stash or commit your incomplete work
- Switch branches
- Fix the bug
- Switch back
- Restore your work-in-progress
Git worktrees solve this problem. They let you check out multiple branches simultaneously, each in its own separate directory. Think of it as having multiple copies of your project, each on a different branch, but all sharing the same Git database.
my-project/
├── .git/ # Shared git database (history, commits, refs)
├── src/ # Your main working directory
├── package.json
└── .worktrees/ # Lanes stores worktrees here
├── fix-login-bug/ # Claude working on bug fix
│ ├── src/
│ └── package.json
└── add-dark-mode/ # Claude working on new feature
├── src/
└── package.json
Key Insight
Each worktree is a complete working directory with its own files, but they all share the same .git database. This means commits made in one worktree are immediately visible in all others, but the working files remain isolated.
How Lanes Uses Worktrees
When you create a new Lanes session, here's what happens under the hood:
Creates a new branch
Named after your session (e.g., fix-login-bug), branched from your source branch
Creates a worktree directory
Located at .worktrees/fix-login-bug/ with a full checkout of your project
Launches Claude Code
Claude works exclusively in the worktree directory, completely isolated from your main workspace
git worktree add .worktrees/fix-login-bug -b fix-login-bug
Benefits of Complete Isolation
No File Conflicts
Changes in one session never affect files in another. You can run multiple Claude sessions simultaneously without any interference.
Clean Starting State
Each session starts fresh from your source branch. No leftover files or uncommitted changes from previous work.
No Context Switching
Say goodbye to git stash. Your main workspace stays exactly as you left it while Claude works elsewhere.
Parallel Workflows
Run multiple agents on different tasks at the same time. One fixing bugs, another implementing features.
Permission Modes
Permission modes control how Claude Code interacts with your files and executes commands. Each mode offers a different balance between automation and control, allowing you to choose the level of oversight that matches your workflow and security requirements.
When creating a new session, you can select the permission mode from the dropdown in the session form. The mode you choose will apply to Claude's entire session in that worktree.
Quick Comparison
| Mode | File Edits | Commands | Best For |
|---|---|---|---|
| default | Ask first | Ask first unless allowed by an allow rule | Standard interactive workflow |
| acceptEdits | Auto-approve | Ask first unless allowed by an allow rule | Fast coding, careful with commands |
| dontAsk | Auto-approve | Auto-deny unless allowed by an allow rule | Auto-deny tools unless explicitly allowed by an allow rule |
| bypassPermissions | Auto-approve | Auto-approve | Testing/debugging only |
How to Select a Permission Mode
When Creating a Session
- Open the Lanes sidebar in VS Code
- Fill out the session form with your session name and prompt
- Select your desired permission mode from the "Permission Mode" dropdown
- Click "Create Session"
The permission mode is set when the session is created and applies to Claude's entire session in that worktree. Choose carefully based on your task and trust level.
Reviewing Changes
Lanes includes a built-in code review tool that lets you view changes, add comments, and generate review feedback for your coding agents.
Opening the Git Changes Viewer
To review changes made in a session:
-
1
Click the "Show Git Changes" button in the session's action bar (the diff icon)
-
2
A new panel opens showing all file changes between your session branch and the comparison branch
-
2
This can be slow when there are many changes.
Understanding the Diff View
The diff viewer shows changes in a unified diff format:
Comparison Branch
By default, changes are compared against main or master.
You can change this using the branch selector dropdown at the top of the diff panel.
+ Added Lines
Lines highlighted in green are new additions to the codebase.
- Removed Lines
Lines highlighted in red have been deleted from the original.
Adding Review Comments
You can add comments to specific lines in the diff to provide feedback:
-
1
Click on any line in the diff view to select it
-
2
Type your comment in the input field that appears
-
3
Press Enter to save the comment
Comments are displayed inline with the code, making it easy to track your feedback as you review.
Note: Comments are stored locally in the diff viewer session. They are not persisted to git or any external system.
Submitting Your Review
Once you've added all your comments, you can generate a formatted review to share with your coding agent:
-
1
Click the "Submit Review" button at the top of the diff panel
-
2
The review is automatically copied to your clipboard in a structured markdown format
-
3
Paste the review into your coding agent's terminal or chat
Clipboard Format
The generated review follows a structured markdown format that's easy for AI agents to parse:
# Code Review Comments
## docs/docs.html
**Line 38** (added):
```
+ </script>
```
> Is this really a script tag? It seems misplaced.
**Line 142** (added):
```
+ const user = await getUser();
```
> Consider adding error handling for the getUser() call.
## src/utils/helper.ts
**Line 25** (removed):
```
- // TODO: Remove this hack
```
> Good cleanup! But make sure the hack was actually fixed, not just the comment removed.
Introduction to Workflows
Workflows are structured development processes that guide Claude through proven phases like planning, implementation, testing, and review. Built on research from Anthropic's long-running agent harnesses, they bring consistency and quality to complex development tasks.
What are Workflows?
A workflow is like a development playbook that Claude follows step-by-step. Each workflow defines:
Phases
The sequence of steps (plan, implement, test, review) that ensure thorough development
Specialized Agents
Different "roles" for Claude with specific tools and restrictions (orchestrator, implementer, tester, reviewer)
Repeatable Loops
Patterns that repeat for each task (implement → test → review → resolve)
Progress Tracking
Automatic state persistence so Claude can resume work across context windows
Why Use Workflows?
Consistent Structure
Every task follows the same proven pattern: plan before coding, test after implementation, review before completion. This prevents common mistakes like coding without a plan or skipping tests.
Higher Quality
Specialized agents bring focused expertise to each phase. The reviewer agent only reads code (can't edit), ensuring objective feedback. The tester focuses solely on test quality.
Built-in Checkpoints
Workflows prevent Claude from jumping ahead or getting sidetracked. Each phase must complete before moving to the next, ensuring nothing is skipped.
Seamless Context Continuity
Workflow state is saved to workflow-state.json after each step. If Claude runs out of context or the session ends, you can resume exactly where you left off.
Built-in Workflow Types
Lanes includes four workflow templates out of the box. Each is optimized for a specific type of development work:
Feature Dev
New features with tests and review.
Bug Fix
Investigate and fix bugs safely.
Refactor
Improve code quality safely.
Default
General-purpose tasks.
Custom
Your own workflows.
How to Start a Workflow Session
Click "New Session" in the Lanes sidebar
Enter a branch name (e.g., "feat-user-auth" or "fix-login-bug")
Describe your goal to Claude (e.g., "Add user authentication with email and password")
Choose a workflow type from the dropdown (If you have not created a custom workflow you will need to. You can learn how in the Creating Workflows section.)
Claude will automatically follow the workflow phases, creating a workflow-state.json file to track progress and saving workflow state after each step.
When to Use Workflows vs. Ad-Hoc Sessions
Use Workflows For:
- • New features with multiple components
- • Complex bug fixes requiring investigation
- • Large refactors touching multiple files
- • Work that needs thorough testing and review
- • Tasks that may span multiple sessions
- • Team projects needing consistent process
Use Ad-Hoc Sessions For:
- • Quick fixes (typos, small tweaks)
- • Exploratory coding or prototyping
- • One-off scripts or utilities
- • Documentation updates
- • Code review or analysis (no changes)
- • When you want full manual control
Tip: Start with a workflow for quality work. You can always switch to ad-hoc if the structure feels unnecessary. Workflows add minimal overhead but provide significant benefits for anything beyond trivial changes.
Want to Learn More?
This introduction covered the basics of workflows. For deeper understanding:
- Workflow Templates - Learn YAML syntax and create custom workflows
- Lanes MCP - Understand how workflows use Model Context Protocol
- Anthropic's Research Paper - The science behind workflow harnesses
Workflow Structure
This section covers the YAML structure of workflow templates, including how to define agents, create loops, and configure steps.
YAML Structure Overview
Workflow templates are YAML files. Simple workflows only need name, description, and steps. The agents and loops sections are optional for more complex workflows:
name
Type: string
Required: Yes
Purpose: Identifies the workflow. Must be unique within your project.
description
Type: string
Required: Yes
Purpose: Human-readable description shown in the workflow selector.
agents
Type: object
Required: No (optional)
Purpose: Defines specialized agents with tool permissions and restrictions. Only needed for complex workflows requiring sub-agents.
loops
Type: object
Required: No (optional)
Purpose: Reusable sub-workflows that iterate over tasks. Only needed for workflows that process multiple items.
steps
Type: array
Required: Yes (must have at least one step)
Purpose: The main workflow sequence, executed in order.
Agents Definition
Agents are specialized roles that execute workflow steps. Each agent has specific capabilities and restrictions.
agents:
orchestrator:
description: Plans work and coordinates sub-agents
implementer:
description: Writes code to implement features
Steps (Main Workflow Sequence)
Steps define the main workflow sequence. They are executed in order from top to bottom.
steps:
- id: plan
type: action
agent: orchestrator
instructions: |
Analyze the goal and break it into discrete tasks.
Consider:
1. What are the individual features or changes needed?
2. What are the dependencies between tasks?
3. What is the optimal order of implementation?
- id: define_tasks
type: action
agent: orchestrator
instructions: |
Call workflow_set_tasks('feature_development', tasks) with:
- id: unique identifier
- title: concise title
- description: detailed description
- id: feature_development
type: loop
# References the loop defined above
- id: final_review
type: action
agent: reviewer
instructions: |
Review the implementation as a whole...
Step Fields
id
Type: string
Required: Yes
Unique identifier for this step. For loop steps, must match a loop name.
type
Type: string
Required: Yes
Valid values: action, loop, ralph
action
A single operation performed by an agent. Used for planning, reviewing, or any one-off task.
Required fields: id, type, instructions
Optional fields: agent
loop
Iterates over a list of tasks, executing the loop's sub-steps for each task.
Required fields: id, type
Note: The id must match a loop name defined in the loops: section
ralph
Repeats the same task n times for iterative refinement. Claude works on the task multiple times to improve quality.
Required fields: id, type, instructions, n
Optional fields: agent
agent
Type: string
Required: No (for action steps)
Not applicable: For loop steps (agents are specified in loop sub-steps)
Name of the agent to execute this step. When omitted, the main Claude agent handles that step directly instead of delegating to a specialized sub-agent.
This is useful for simpler workflows or steps that don't require specialized capabilities.
instructions
Type: string
Required: Yes (for action and ralph steps)
Not applicable: For loop steps (instructions are in loop sub-steps)
Instructions for what to do in this step.
n
Type: integer
Required: Yes (for ralph steps only)
Valid values: Positive integer (1 or greater)
Number of times to repeat the step. Each iteration stores its output with a unique key (e.g., step-id.1, step-id.2).
on_fail
Type: string
Required: No
Valid values: retry, skip, abort
Default: abort
Action to take if this step fails.
Loops and Sub-steps
Loops are reusable sub-workflows that execute a sequence of steps for each task in a list. They enable structured iteration over features, fixes, or refactors.
loops:
feature_development:
- id: implement
agent: implementer
instructions: |
Implement: {task.title}
1. Read relevant files to understand context
2. Plan the implementation approach
3. Write the code
4. Verify it compiles
- id: test
agent: tester
instructions: |
Run tests for: {task.title}
1. Run the existing test suite
2. Identify any failing tests
3. Fix any test failures
4. Ensure all tests pass
on_fail: retry
- id: review
agent: reviewer
instructions: |
Review implementation of: {task.title}
Check for:
1. Security vulnerabilities
2. Proper error handling
3. Code quality and patterns
- id: resolution
instructions: |
# No agent specified - main Claude handles this
Address any issues from the review of: {task.title}
Task Variables
Within loop sub-step instructions, you can reference task properties using curly brace syntax:
{task.id}
The unique identifier for the current task (e.g., "add-login-form").
{task.title}
The concise title of the current task (e.g., "Login form UI").
instructions: |
Implement: {task.title}
Task ID for reference: {task.id}
1. Read relevant files
2. Implement the feature
3. Verify it works
Creating a Workflow
Learn how to create custom workflows for your projects, with a complete annotated example and best practices.
Step-by-Step Guide
Custom workflows let you define project-specific development processes. They appear in the "Custom" section of the workflow dropdown.
-
1
Define corresponding agents (if needed)
First thing you will want to do is make sure you have already created all the agents you want to use in your workflow ahead of time. This is because agent names in your workflow must match either inline definitions or external agent files.
mkdir -p .claude/agents
# Create .claude/agents/my-agent.mdNote: Inline agent definitions in the workflow file take precedence over external files.
-
2
Start creating a workflow document
Open the Lanes sidebar → Open the "Workflow" window → Press the '+' icon.
-
3
Start creating a workflow document
If you like, choose a template to start from (feature, bugfix, refactor, or default). This will create a new YAML file in
.lanes/workflows/. -
4
Write your workflow
Edit your the template document, you can use the examples below or use the Workflow Structure page for guidance.
-
5
Validate your workflow
The lanes extension comes with the 'Validate Workflow' command which you cna find in your command palette. This will check your workflow for common errors and help ensure it is correctly formatted.
-
6
Use the new Workflow
The workflow should now appear in the workflow dropdown in the Lanes New Session window. You might need to use the refresh button. Select it to start using your custom workflow for new worktrees.
Simple Workflow Example
For straightforward tasks, you can create a workflow with just steps—no agents or loops required. The main Claude agent handles all steps directly:
# A minimal workflow - just name, description, and steps
name: simple-task
description: Execute a straightforward task
steps:
- id: analyze
type: action
instructions: |
Analyze the codebase and identify what needs to be done.
- id: implement
type: action
instructions: |
Implement the required changes.
Ensure all tests pass.
- id: verify
type: action
instructions: |
Run tests and verify the implementation.
Update documentation if needed.
Tip: Simple workflows are great for quick prototypes, single-developer tasks, or when you don't need specialized phases.
Complete Annotated Example (with Agents and Loops)
For complex workflows that need specialized agents and iteration over tasks, here's a complete template with detailed annotations:
# ==============================================================================
# WORKFLOW TEMPLATE: Custom Feature Development
# ==============================================================================
# Required: Unique name for this workflow
name: custom-dev-workflow
# Required: Description shown in workflow selector
description: Custom workflow for our team's feature development process
# ==============================================================================
# AGENTS: Define specialized roles with tool permissions
# ==============================================================================
agents:
# Planning agent - can read code but not modify it
planner:
description: Analyzes requirements and breaks down work
# Implementation agent - can write code but not commit
coder:
description: Implements features according to plan
# Test agent - can run tests and fix test code
tester:
description: Runs tests and fixes failures
# Review agent - read-only, provides feedback
reviewer:
description: Reviews code quality and security
# ==============================================================================
# LOOPS: Reusable sub-workflows that iterate over tasks
# ==============================================================================
loops:
# This loop executes for each task in the task list
build_feature:
# Sub-step 1: Implement the feature
- id: code
agent: coder
instructions: |
Implement: {task.title}
Steps:
1. Read relevant files to understand context
2. Plan your implementation approach
3. Write the code
4. Verify it compiles without errors
Do NOT run tests - that's handled in the next step.
# Sub-step 2: Test the implementation
- id: test
agent: tester
instructions: |
Test the implementation of: {task.title}
1. Run the full test suite
2. Identify any failing tests
3. Fix test failures
4. Ensure all tests pass
5. Report test results
on_fail: retry # Retry if tests fail
# Sub-step 3: Review the code
- id: review
agent: reviewer
instructions: |
Review the implementation of: {task.title}
Check for:
1. Security vulnerabilities
2. Proper error handling
3. Code quality and maintainability
4. Adherence to project patterns
5. Edge cases and potential bugs
Provide specific feedback on any issues found.
# Sub-step 4: Address review feedback (no agent = main Claude)
- id: fix_issues
instructions: |
Review feedback for: {task.title}
1. Read the reviewer's feedback
2. If there are critical issues, fix them
3. If there are minor suggestions, note them for future work
4. Mark the task as complete
# ==============================================================================
# STEPS: Main workflow sequence (executed in order)
# ==============================================================================
steps:
# Step 1: ACTION type - single operation by planner agent
- id: analyze
type: action
agent: planner
instructions: |
Analyze the user's goal and break it into discrete tasks.
Consider:
1. What features or changes are needed?
2. What are the dependencies between tasks?
3. What is the optimal implementation order?
Document your analysis clearly.
# Step 2: ACTION type - planner defines the task list
- id: create_tasks
type: action
agent: planner
instructions: |
Create a task list based on your analysis.
For each task, define:
- id: unique-identifier (e.g., 'add-login', 'fix-validation')
- title: Clear, concise title (e.g., 'Add login form')
- description: Detailed requirements
Call workflow_set_tasks('build_feature', tasks) when ready.
# Step 3: LOOP type - references the 'build_feature' loop above
# This will execute all sub-steps for each task
- id: build_feature
type: loop
# Step 4: ACTION type - final review of all changes
- id: final_review
type: action
agent: reviewer
instructions: |
Review the complete implementation.
Check:
1. Consistency across all changes
2. Integration between features
3. Overall code quality
4. Any missed requirements from the original goal
Provide a summary of the implementation quality.
# Step 5: ACTION type - finalize and prepare for commit
- id: finalize
type: action
instructions: |
# No agent specified - main Claude handles this
Finalize the implementation.
1. Review the final review feedback
2. Address any critical issues
3. Run final tests
4. Prepare a summary of what was accomplished
5. The workflow will complete and you can commit
Best Practices for Custom Workflows
Keep Agent Roles Focused
Each agent should have a single, clear responsibility. Don't create "super agents" that can do everything. Focused agents enforce separation of concerns and prevent mistakes.
Use Clear, Specific Instructions
Instructions should be explicit and actionable. Include numbered steps, expected outputs, and what NOT to do. Remember that different Claude instances will execute these instructions across context windows.
Use on_fail Strategically
• retry - For test failures or transient issues
• skip - For optional steps that might fail
• abort (default) - For critical steps that must succeed
Use Task Variables
Always reference {task.id} and {task.title}
in loop instructions. This provides context across different tasks and helps Claude understand what it's working on.
Test Your Workflow
Before rolling out a custom workflow to your team, test it on a real task. Verify that: • Each step produces the expected output • Agents execute their roles correctly • The workflow completes successfully • The final result matches expectations
Version Control Your Workflows
Commit your .lanes/workflows/ directory to git.
This ensures your team uses consistent workflows and you can track changes over time.
Validation and Debugging
Lanes validates workflow templates when they're loaded. Common validation errors:
Agent 'X' references unknown agent 'Y'
A step references an agent that isn't defined. Check:
- Is the agent name spelled correctly?
- Is the agent defined in the
agents:section? - Does a matching file exist in
.claude/agents/?
Loop step 'X' references unknown loop definition
A type: loop step's id
doesn't match any loop in the loops: section.
The loop step ID must exactly match a loop name.
Invalid YAML syntax
YAML parsing failed. Common issues:
- Incorrect indentation (YAML uses 2 spaces, not tabs)
- Missing colons after keys
- Unquoted strings with special characters
- Inconsistent list formatting
Next Steps
Now that you understand workflow templates, you might want to:
- Learn about the Lanes MCP Server - Understanding how workflows communicate with Claude
-
Study the built-in workflows in
workflows/for real-world examples - Create a custom workflow for your team's specific development process
- Read Anthropic's research on effective harnesses for long-running agents
Lanes MCP
The Lanes Model Context Protocol (MCP) server enables workflows to maintain state, track progress, and coordinate between agents across context windows. This technical explains how the MCP integration works under the hood.
What is MCP?
The Model Context Protocol (MCP) is Anthropic's open protocol that enables AI assistants to securely connect to data sources and tools. It provides a standardized way to extend Claude with custom capabilities while maintaining security and control.
The Lanes MCP server is a specialized MCP implementation that gives Claude fine-grained control over workflow execution:
- Workflow State Management: Tracks current position in workflow, step outputs, and task progress
- Session Management: Allows Claude to request creation of new Lanes sessions programmatically
- Context Preservation: Maintains history across steps so agents can reference earlier work
Learn more: Visit modelcontextprotocol.io for the official MCP specification.
Architecture
When you start a workflow session, Lanes automatically spins up an MCP server process that communicates with Claude via stdio:
┌─────────────────────────────────────────────────────────┐
│ VS Code Extension │
│ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ Start Workflow Session │ │
│ └──────────────────┬───────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ Spawn MCP Server Process │ │
│ │ node server.js --worktree --workflow-path│ │
│ └──────────────────┬───────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ Generate .claude/mcp.json config │ │
│ └──────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
▼ stdio transport
┌─────────────────────────────────────────────────────────┐
│ MCP Server Process │
│ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ Workflow State Machine │ │
│ │ - Current step/sub-step │ │
│ │ - Task iteration │ │
│ │ - Step outputs history │ │
│ └──────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ Tool Handlers │ │
│ │ - workflow_start │ │
│ │ - workflow_set_tasks │ │
│ │ - workflow_status │ │
│ │ - workflow_advance │ │
│ │ - workflow_context │ │
│ │ - session_create │ │
│ └──────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────┐ │
│ │ File System Persistence │ │
│ │ - workflow-state.json (state) │ │
│ └──────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
▼ MCP protocol
┌─────────────────────────────────────────────────────────┐
│ Claude Code │
│ │
│ Calls MCP tools to navigate workflow steps │
└─────────────────────────────────────────────────────────┘
The MCP server runs in the background for the lifetime of the session. Claude can call the MCP tools at any time to query or update workflow state.
MCP Tools Reference
The Lanes MCP server exposes six tools that Claude uses to control workflow execution:
workflow_start
Initialize the workflow and return the first step instructions. If the workflow was previously started, returns the current status (enables resume).
Parameters:
Returns:
{
"status": "active",
"step": {
"id": "plan",
"type": "action",
"agent": "orchestrator",
"instructions": "Analyze the goal and break it into..."
},
"progress": {
"currentStepIndex": 0,
"totalSteps": 5,
"stepsCompleted": 0
},
"summary": "Add user authentication"
}
Example Usage:
workflow_set_tasks
Associate tasks with a loop step. Each task will be iterated through the loop's sub-steps..
Parameters:
Task Object:
{
"id": string, // Unique identifier
"title": string, // Human-readable title
"description"?: string // Optional detailed description
}
Returns:
{
"success": true,
"tasksSet": 3
}
Example Usage:
workflow_set_tasks("feature_development", [ { id: "login-form", title: "Create login form", description: "Build login form with email and password" }, { id: "auth-api", title: "Implement auth API", description: "Create API endpoint for authentication" } ])
workflow_status
Get current workflow position with full context. Returns the current step, sub-step (if in a loop), agent, instructions, and progress.
Parameters:
Returns (in loop):
{
"status": "active",
"step": {
"id": "feature_development",
"type": "loop",
"subStep": {
"id": "implement",
"agent": "implementer",
"instructions": "Implement: Create login form..."
}
},
"task": {
"id": "login-form",
"title": "Create login form",
"index": 0,
"total": 2
},
"progress": {
"currentStepIndex": 2,
"totalSteps": 5,
"stepsCompleted": 1
}
}
workflow_advance
Complete the current step/sub-step and advance to the next. When a task completes (all sub-steps done), automatically updates workflow-state.json to mark the task as passes: true.
Parameters:
Returns:
{
"status": "active",
"step": {
"id": "feature_development",
"type": "loop",
"subStep": {
"id": "test",
"agent": "tester",
"instructions": "Run tests for: Create login form..."
}
},
"task": {
"id": "login-form",
"title": "Create login form",
"index": 0,
"total": 2
},
"progress": { ... }
}
Example Usage:
workflow_context
Get outputs from previous steps. Returns a record keyed by step path (e.g., "plan" or "feature_development.login-form.implement").
Parameters:
Returns:
{
"plan": "Analyzed requirements. Identified 2 tasks: login-form, auth-api",
"define_tasks": "Created task list with 2 tasks",
"feature_development.login-form.implement": "Implemented login form with...",
"feature_development.login-form.test": "All tests passing",
"feature_development.login-form.review": "Code looks good, no issues"
}
This enables agents to reference earlier work and build upon previous decisions.
session_create
Request creation of a new Lanes session. Writes a config file to .lanes/pending-sessions/ that the VS Code extension monitors and processes.
Parameters:
Returns:
{
"success": true,
"configPath": ".lanes/pending-sessions/fix-auth-bug-1736454321.json"
}
Example Usage:
session_create( "fix-auth-bug", "main", "Fix authentication timeout issue", "bugfix" )
Workflow State Persistence
The MCP server persists workflow state to workflow-state.json in the worktree root after every state change. This enables:
- Resume capability: If Claude crashes or loses context, calling
workflow_startagain restores to the current position - Context preservation: All step outputs are stored and accessible via
workflow_context - Progress tracking: Current step, task progress, and completion status are persisted
Example workflow-state.json:
{
"status": "active",
"currentStepIndex": 2,
"currentSubStepIndex": 1,
"currentTaskIndex": 0,
"stepOutputs": {
"plan": "Analyzed requirements...",
"define_tasks": "Created task list...",
"feature_development.login-form.implement": "Implemented login form..."
},
"loopTasks": {
"feature_development": [
{
"id": "login-form",
"title": "Create login form",
"description": "Build login form with email and password",
"status": "in_progress"
},
{
"id": "auth-api",
"title": "Implement auth API",
"description": "Create API endpoint for authentication",
"status": "pending"
}
]
},
"summary": "Add user authentication"
}
Important: The workflow state file is automatically managed by the MCP server. Do not manually edit this file.
Example Usage Flow
Here's how Claude uses the MCP tools to execute a typical workflow:
Claude calls: workflow_set_tasks("feature_development", [ { id: "login-form", title: "Create login form", ... }, { id: "auth-api", title: "Implement auth API", ... } ])
MCP Configuration
The Lanes MCP server is automatically configured when you create a workflow session. The VS Code extension:
- Spawns the MCP server process with the workflow path and worktree path
- Generates a
.claude/mcp.jsonconfig file in the worktree - Passes the config to Claude Code via the
--mcp-configflag
Generated .claude/mcp.json:
{
"mcpServers": {
"lanes-workflow": {
"command": "node",
"args": [
"/path/to/lanes/dist/mcp/server.js",
"--worktree", "/path/to/worktree",
"--workflow-path", "/path/to/workflow.yaml"
]
}
}
}
The MCP server runs in the background for the lifetime of the session. It's automatically stopped when the session is closed.
Next Steps
Now that you understand the Lanes MCP server, you might want to:
-
Explore the MCP server source code in
src/mcp/ - Review the Workflow Templates documentation to understand how workflows are structured
- Read the MCP specification to understand the protocol
- Try creating a workflow session and observe the MCP tools in action
Contributing to Lanes
Lanes is an open-source project, and we welcome contributions from the community. Whether you want to report a bug, suggest a feature, or contribute code, here's how to get involved.
Development Guidelines
Interested in contributing code? Check out our comprehensive contribution guide for development setup, coding standards, and the pull request process.
View Contributing GuidelinesReporting Issues
Found a bug? Please report it through our issue tracker with as much detail as possible.
Issue Template
When reporting a bug, please include the following information:
**Description**
A clear description of the issue
**Steps to Reproduce**
1. Go to...
2. Click on...
3. See error
**Expected Behavior**
What should happen
**Actual Behavior**
What actually happens
**Environment**
- OS: [e.g., macOS 14.0]
- VS Code version: [e.g., 1.85.0]
- Lanes version: [e.g., v1.0.2]
- Node version: [e.g., v18.17.0]
**Logs**
[Relevant error messages or console output]
Suggesting Features
Have an idea for improving Lanes? We'd love to hear it! Please provide a clear description of the problem you're trying to solve.
Feature Request Template
When requesting a feature, please include the following information:
**Problem Description**
Describe the problem you want to solve
**Proposed Solution**
Describe your proposed solution (if you have one)
**Benefits**
Explain how this would benefit other users
**Alternatives**
Any alternative approaches you've considered
Thank You for Contributing!
Every contribution helps make Lanes better for everyone. Whether it's reporting bugs, suggesting features, or writing code, we appreciate your support.