# loop

Decision: redesign-later, fail-closed locally. Automatic continuation belongs to OMP loop mode and interactive delivery, not to a local `agent_end` hook inside `miloc-pi`.

## Current Local State

- `extensions/loop/index.ts` registers `loopControl` and `/loop`.
- `loopControl status` returns a report-only result.
- `loopControl start`, `stop`, `once` and `until` return `isError=true` with `owner: "omp-loop-mode"` and `ported: false`.
- The extension no longer registers `tool_call` or `agent_end` hooks.
- Local `_shared/loop-policy.ts`, `LoopState`, `LoopPolicy`, `DEFAULT_LOOP_POLICY` and `sharedState.loop` were removed.
- The extension is disabled by default through `package.json#pi.extensions`.

## OMP Source Evidence

- `/tmp/oh-my-pi-review/packages/coding-agent/src/modes/loop-limit.ts` owns loop limit parsing and runtime consumption for iteration and duration limits.
- `/tmp/oh-my-pi-review/packages/coding-agent/test/loop-limit.test.ts` proves `/loop` argument parsing and limit consumption semantics.
- `/tmp/oh-my-pi-review/packages/coding-agent/test/interactive-mode-loop.test.ts` proves that loop auto-submit waits while compaction, streaming or post-prompt background work is pending.
- `/tmp/oh-my-pi-review/packages/coding-agent/src/prompts/system/auto-continue.md` defines the continuation prompt behavior.
- `/tmp/oh-my-pi-review/packages/coding-agent/src/prompts/goals/goal-continuation.md` defines goal-mode continuation guidance that must stay aligned with any Miloc-facing loop surface.

## Boundary

Do not re-enable local `agent_end` follow-up submission. The future Miloc-facing loop plugin may expose `/loop` and `loopControl`, but the behavior must be ported from OMP loop mode or thin-wrapped around it.

The future implementation must account for:

- iteration and duration limits;
- compaction guard;
- streaming guard;
- post-prompt background work guard;
- goal-mode continuation prompts;
- no hidden auto-approval of tools.

## License And Attribution

No OMP code was copied into this extension in this slice. If a future plugin ports OMP loop mode code, that subtask must record exact source files, symbols and license/attribution decisions.
