# Iteration Policy

Use this policy for development and QA loops on AI-executed chunks.

## Retry Limit

- Allow at most two developer retry cycles for the same chunk after QA or validation failure.
- A retry cycle means changing the implementation to address failed validation, QA findings, or missed acceptance criteria.
- Simple reruns for sandbox, local server binding, or transient environment permission issues do not count as developer retry cycles when no code changes are made.

## Stop Conditions

Stop for human review when:

- The same validation failure remains after two developer retry cycles.
- Fixing the failure requires expanding scope beyond the approved chunk.
- Requirements conflict with existing architecture or prior chunks.
- A change would require modifying out-of-scope areas.
- The agent cannot determine whether behavior is correct from available requirements and tests.

## Scope Discipline

- Do not silently expand scope to make validation pass.
- Do not add auth, sockets, state libraries, infrastructure, or unrelated refactors unless the chunk explicitly asks for them.
- Document follow-up work as new recommended chunks instead of hiding it in the current chunk.
- When a chunk or package selects `assertive_solving`, solve local,
  well-scoped, safe prerequisites that are required for the accepted outcome
  instead of converting them into carry-forward debt. Use
  `ai/standards/assertive-solving.md`.

## Validation Discipline

- Do not bypass validation.
- If validation cannot run, document the exact command, failure, and environment limitation.
- If a safer narrower validation command is used temporarily, still run the chunk's required validation before completion or explain why human review is needed.
- Do not weaken tests, types, generated-code checks, or architecture boundaries to pass validation.
- In `assertive_solving` mode, do not claim success from narrowed prose when a
  local proof harness, wrapper, cleanup path, or typed owner can be implemented
  and validated inside the active package.
