iterate-implementation
Iterate an implementation
Treat follow-up feedback as a reconciliation job: recover the accepted intent, prove the current behavior, and close every reported or discovered gap without restarting sound work.
1. Establish the workspace and authority
Resolve the repository root, branch, worktree identity, and current status before changing files. Use git rev-parse --show-toplevel and git rev-parse --git-dir; when .agent-work/workspace.json or .agent-work/workspace.local.json exists, inspect both and let the local file override the shared file. Stay in the current checkout. A linked worktree, an ordinary checkout with workspace creation disabled, and an ordinary checkout with workspace creation enabled are all valid iteration locations; iteration itself does not create or switch branches or worktrees. If the requested work belongs to a different checkout, stop with the exact mismatch and the target path or branch that must be selected.
Locate the task directory from a supplied path or ticket ID. Under .agent-work/tasks/, inspect directory entries with symlink-aware commands such as ls -La; task directories may be symlinks. Read the complete plan and every artifact needed to interpret it: ticket or task, research, design discussion, PRD/TDD, structure outline, review comments, and relevant logs. If no plan exists, derive authority from the remaining artifacts. When artifacts conflict, use this precedence:
plan > structure outline > TDD > PRD > design discussion > research > ticket
Repository instructions and the user's current explicit direction still govern the work. Record any conflict rather than silently blending incompatible requirements.
Identify the implementation boundary from an explicit commit, phase handoff, or trustworthy merge base. Inspect every staged, unstaged, untracked, and committed change since that boundary. Separate iteration-owned changes from unrelated user work.
This step is complete when the task sources, authority order, implementation boundary, current phase, worktree mode, and unrelated changes are all known or each missing item is named as an uncertainty.