.codemachine folder in your project. This folder tracks everything about your workflow session—what’s running, what’s finished, and how to pick up where you left off.
The .codemachine Folder
.codemachine
agents
agent-config.json
planner.md
coder.md
reviewer.md
inputs
specification.md
artifacts
prompts
memory
directive.json
logs
template.json
What each folder and file contains
What each folder and file contains
| Path | Description |
|---|---|
agents/agent-config.json | Subagents registered for this workflow |
inputs/specification.md | User specifications (if workflow requires them) |
artifacts/ | Optional folder for planning files (must be defined in prompts) |
prompts/ | Optional folder for cached prompts (must be defined in prompts) |
memory/directive.json | Action that determines what the workflow does next |
logs/ | Database of agent history and running states |
template.json | Single source of truth for runtime data. Deleting this resets the workflow from zero |
How Progress is Tracked
Thetemplate.json file is the heart of workflow tracking. It remembers:
Current Position
Which step is running and which steps are done
Session Info
IDs needed to resume interrupted steps
Your Choices
Selected track and conditions from onboarding
Recovery Data
Everything needed to continue after a crash
template.json Schema
State Transitions
| Phase | What Changes in template.json |
|---|---|
| Onboarding | selectedTrack, selectedConditions set |
| Workflow Start | activeTemplate set, completedSteps: {}, notCompletedSteps: [] |
| Step Starts | notCompletedSteps: [0] added |
| Session Init | completedSteps["0"] = { sessionId, monitoringId } |
| Chain Complete | completedSteps["0"].completedChains = [0, 1, ...] |
| Step Complete | completedSteps["0"].completedAt set, notCompletedSteps cleaned |
| Loop Triggered | notCompletedSteps updated to loop-back index |
| Crash Occurs | notCompletedSteps preserved for recovery |
Manipulating Workflow Progress
You can manually control workflow execution by editingtemplate.json. This is useful for:
- Re-running a specific step
- Resetting the workflow to an earlier point
- Skipping steps that already completed
Revert to a Previous Step
ThecompletedSteps object tracks finished steps by index. To go back to a step, remove it (and all steps after it) from completedSteps.
Example: You have steps 0, 1, 2 completed and want to re-run step 2:
Reset Entire Workflow
To start from the beginning, clearcompletedSteps:
template.json file to reset everything.
Workflow Lifecycle
Here’s what happens as your workflow runs:Workflow Starts
CodeMachine creates the
.codemachine folder and initializes template.json with your selected options.What Happens If Something Goes Wrong?
CodeMachine automatically saves your progress. If your workflow crashes or you close the terminal, you can pick up right where you left off.
- CodeMachine finds the
.codemachinefolder - It reads
template.jsonto see which step was running - It offers to resume from that step (or the last completed one)
Agent Directives
Agents can control what happens next by writing todirective.json. This is how agents communicate with the workflow.
- Continue
- Loop Back
- Wait for User
- Call Another Agent
- Stop
- Error
User Controls
You can control workflow execution with keyboard shortcuts:| Action | Shortcut | What Happens |
|---|---|---|
| Skip Step | Ctrl+S | Mark current step as done and move on |
| Quit | Ctrl+C | Save progress and exit (can resume later) |
| Advance | Enter | Complete step and continue to next |
Execution Logs
Thelogs/ folder contains detailed records of every agent run:
registry.db - Execution History
registry.db - Execution History
A SQLite database tracking every agent execution:
- Agent name and engine used
- Start time, end time, and duration
- Status (running, completed, failed, skipped)
- Token usage and cost estimates
- Error messages if something went wrong
Agent Log Files
Agent Log Files
Each agent gets its own log file (
agent-*.log) containing:- The full prompt sent to the agent
- The agent’s complete response
- Any errors or warnings during execution
Cleaning Up
To start fresh, you can safely delete the.codemachine folder: