# Orch Auto Code Worktree

## Status

- `completed`

## Owner

- codex

## Started At

- `2026-03-19`

## Goal

- automatically select worktree mode for code-like `orch` tasks so leaders do not need to pass worktree flags for common code-writing dispatches

## Scope

- extend dispatch-time worktree selection to infer code-like tasks from existing task metadata
- keep explicit worktree flags authoritative when provided
- add integration tests for automatic worktree enablement and non-code fallback behavior
- update the implementation roadmap and archive this workstream when complete

## Checklist

- [x] inspect current dispatch/worktree code and the remaining roadmap item
- [x] implement automatic code-task detection for worktree selection
- [x] add integration coverage for auto-enable and non-code fallback
- [x] run `go test ./...`
- [x] update `docs/implementation-roadmap.md`
- [x] archive this roadmap with a completion summary

## Files

- `docs/roadmaps/archive/orch-auto-code-worktree.md`
- `docs/implementation-roadmap.md`
- `internal/cli/orch/worktree.go`
- `internal/cli/orch/integration_test.go`

## Decisions

- infer code-like tasks from existing metadata instead of introducing a new required task field in this slice
- prioritize explicit worktree flags over automatic detection so users can still force or shape dispatch behavior

## Blockers

- none

## Next Step

- move to `Milestone 7: Council Review`

## Completion Summary

- `orch dispatch` now auto-enables strict worktree mode for code-like tasks inferred from existing task metadata when explicit worktree flags are omitted
- explicit worktree flags remain authoritative and non-code tasks still fall back to ordinary non-worktree dispatch
- integration tests now cover both auto-enabled worktree dispatch and non-code fallback behavior
