{
  "version": "s18",
  "title": "Worktree Isolation",
  "description": "A task can be bound to an isolated git worktree so concurrent agents avoid stepping on each other.",
  "steps": [
    {
      "type": "user_message",
      "content": "Let one teammate fix the docs while another changes the parser.",
      "annotation": "Concurrent edits need isolated working directories."
    },
    {
      "type": "tool_call",
      "toolName": "create_worktree",
      "content": "{\"task_id\":\"task_docs\",\"name\":\"docs-fix\"}",
      "annotation": "The tool validates a safe worktree name before touching git."
    },
    {
      "type": "system_event",
      "content": "git worktree add .worktrees/docs-fix -b agent/docs-fix",
      "annotation": "A separate branch and checkout are created for that task."
    },
    {
      "type": "tool_result",
      "toolName": "create_worktree",
      "content": "task_docs bound to .worktrees/docs-fix",
      "annotation": "The task record stores the assigned worktree path."
    },
    {
      "type": "system_event",
      "content": ".worktrees/events.jsonl <- {event:\"created\", task:\"task_docs\", worktree:\"docs-fix\"}",
      "annotation": "Lifecycle events are emitted as a side channel."
    },
    {
      "type": "tool_call",
      "toolName": "keep_worktree",
      "content": "{\"task_id\":\"task_docs\",\"reason\":\"needs human review\"}",
      "annotation": "Closeout can preserve a worktree instead of deleting it immediately."
    },
    {
      "type": "assistant_text",
      "content": "The docs task now has an isolated worktree and can be reviewed independently from parser changes.",
      "annotation": "The user sees the isolation boundary, not just a raw git command."
    }
  ]
}
