<!-- task=m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover plan=1 tag=REFACTOR -->

# Go Parity Inventory and Production Cutover

## For the Implementing Agent

Run every verification command, fill implementation-owned sections in `CODE_REVIEW-cloud-G07.md` with actual output, keep the pair active, and report ready for review. Finalization belongs only to code-review. If predecessor 25 has no verified `complete.log`, do not implement; record dependency waiting only.

## Background

The original packet combined production task-runtime composition with parity/cutover while depending on the logged smoke that itself required that composition. The review corrected ownership: task 25 now composes and field-validates the runtime, while this packet consumes that completed implementation to classify every reference behavior, cut the operator skill to Go, enforce zero stale production ownership, and prepare deterministic Python disposal evidence.

## Archive Evidence Snapshot

- Superseded plan: `agent-task/m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover/plan_cloud_G10_0.log`
- Superseded review stub: `agent-task/m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover/code_review_cloud_G10_0.log`
- Supersession reason: the sibling task 25 review proved that composition-after-smoke created a dependency cycle. The prior pair was unstarted and had no verdict or implementation evidence.
- Preserved scope: S13 disposition completeness, Go operator cutover, zero stale Python/static/Node ownership, and Python disposal inventory.
- Removed scope: standalone workflow/provider/recovery/evidence/review/integration adapters and manager/daemon composition; those are owned and verified by predecessor 25.

## Roadmap Targets

- Milestone: `agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-cli-runtime.md`
- Milestone link: [Milestone document](agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-cli-runtime.md)
- Task ids:
  - `parity-cutover`: classify Python/Node behavior and cut production task-loop ownership to Go with zero unclassified/runtime dependency/duplicate
- Completion mode: check-on-pass

## Analysis

### Files Read

- `agent-task/m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover/PLAN-cloud-G10.md`
- `agent-task/m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover/CODE_REVIEW-cloud-G10.md`
- `agent-task/m-iop-agent-cli-runtime/25+19,21,22,23,24_logged_smoke_closure/CODE_REVIEW-cloud-G09.md`
- `agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-cli-runtime.md`
- `agent-roadmap/sdd/automation-runtime-bridge/iop-agent-cli-runtime/SDD.md`
- `agent-contract/index.md`
- `agent-contract/inner/agent-runtime.md`
- `agent-contract/inner/iop-agent-cli-runtime.md`
- `agent-spec/runtime/edge-node-execution.md`
- `agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md`
- `agent-ops/skills/project/orchestrate-agent-task-loop/agents/openai.yaml`
- `agent-ops/skills/project/orchestrate-agent-task-loop/scripts/execution_target_policy.py`
- `agent-ops/skills/project/orchestrate-agent-task-loop/scripts/dispatcher_observation.py`
- `agent-ops/rules/project/domain/testing/rules.md`
- `agent-ops/rules/project/rules.md`
- `apps/agent/cmd/agent/main.go`
- `apps/agent/internal/command/root.go`
- `apps/agent/internal/command/service.go`
- `packages/go/agenttask/ports.go`
- `packages/go/agenttask/types.go`
- `Makefile`

### SDD Criteria

- Approved SDD scenario S13 maps to `parity-cutover`.
- Required evidence: a disposition-complete `absorb | replace | not-applicable` inventory, zero unclassified rows, zero Python production callers/fallbacks, zero stale static route/capability ownership, zero Node duplicate implementation, and a checksum-bound Python disposal manifest.
- The field manifest from predecessor 25 is consumed as implementation evidence; this packet does not rerun S14.

### Verification Context

- No neutral handoff was supplied. Repository-native evidence is the approved SDD, both runtime contracts, current orchestration skill/Python policy sources, current Go runtime surfaces, testing rules, and predecessor completion artifacts.
- Local verification uses fresh Go tests, deterministic stable-sorted searches, the built Go command in dry-run mode, parity validation, vet, and diff checks. No real provider CLI may launch.
- The packet is dependency-waiting until `agent-task/m-iop-agent-cli-runtime/25+19,21,22,23,24_logged_smoke_closure/complete.log` or its exact archived equivalent exists.

### Test Coverage Gaps

- No machine-readable manifest proves every stabilized Python/Node behavior has one disposition and concrete Go evidence.
- The project orchestration skill still invokes Python and owns static provider/model/capacity tables.
- No deterministic guard rejects new Python production callers, static route text, or Node runtime duplication.
- No checksum-bound disposal inventory identifies exactly which Python reference files may be deleted at Milestone completion.

### Symbol References

- Production references to `dispatch.py` occur in `agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md` and testing ownership rules; replace them with the Go operator entry.
- Static model/provider/capacity names in the skill must be replaced by runtime catalog/policy evidence.
- Do not rename shared Go runtime symbols.

### Split Judgment

This reduced packet is indivisible: the disposition matrix is the proof that permits the operator cutover and disposal readiness, while cutover without the matrix would leave unclassified behavior and a matrix without cutover would leave Python in production. Runtime composition is independently PASS-verifiable and moved to predecessor 25.

Satisfied predecessors:

- `agent-task/archive/2026/07/m-iop-agent-cli-runtime/19+14,16,18_cli_binary_contract/complete.log`
- `agent-task/archive/2026/07/m-iop-agent-cli-runtime/21+13,17,20_project_log_sink/complete.log`
- `agent-task/archive/2026/07/m-iop-agent-cli-runtime/22+16_local_control/complete.log`
- `agent-task/archive/2026/07/m-iop-agent-cli-runtime/23+14,16,22_client_process_manager/complete.log`

Pending predecessor:

- `25+19,21,22,23,24_logged_smoke_closure` — active follow-up; requires a verified `complete.log`.

### Scope Rationale

Do not implement manager ports, host lifecycle composition, S14 harness behavior, shared runtime algorithms, Node wire changes, provider authentication, or physical Python deletion. Use the completed Go runtime as the sole production owner and keep Python files as checksum-bound reference fixtures until the Milestone completion transition.

### Final Routing

- evaluation_mode: `isolated-reassessment`
- finalizer: `finalize-task-policy.sh pair`
- build closures: all true after predecessor 25; base `local-fit`, promoted by risk boundary
- build grade scores: `2/0/2/2/1`; route `cloud-G07`; filename `PLAN-cloud-G07.md`
- review grade scores: `2/0/2/2/1`; route `official-review`; filename `CODE_REVIEW-cloud-G07.md`
- large_indivisible_context: `true`
- positive loop risks: `boundary_contract`, `structured_interpretation`, `variant_product` (count `3`)
- recovery signals: `review_rework_count=0`, `evidence_integrity_failure=false`
- capability-gap evidence: none

## Implementation Checklist

- [ ] Create a machine-validated disposition and disposal manifest covering every Python dispatcher/selector/observation and Node reference behavior.
- [ ] Add a thin Go task-loop operator command over predecessor 25's authoritative runtime without duplicating lifecycle, policy, provider, review, or integration logic.
- [ ] Redirect the project orchestration skill and testing ownership to the Go command and remove static model/route/capacity ownership from those surfaces.
- [ ] Add deterministic guards for zero unclassified rows, zero Python production callers/fallbacks, zero stale static policy text, and zero Node duplicate implementation.
- [ ] Record exact Python reference paths/checksums and the Milestone-completion deletion/verification procedure without deleting reference fixtures.
- [ ] Update the standalone contract with S13 sources and run fresh parity, dry-run, package, vet, zero-match, and diff verification.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REFACTOR-1] Establish the Disposition and Disposal Manifest

#### Problem

`agent-roadmap/sdd/automation-runtime-bridge/iop-agent-cli-runtime/SDD.md:155-180` requires complete classification and disposal evidence, but no current artifact fails on omitted, ambiguous, or stale rows.

#### Solution

Add one YAML manifest keyed by stable behavior ID. Each row records reference sources/tests, one disposition, Go owner/source/test, invariants, production-caller state, and disposal state. Validate unique IDs, exact existing paths, allowed dispositions, concrete Go evidence, no wildcard source, checksum integrity, and full reference inventory.

#### Modified Files and Checklist

- [ ] `apps/agent/internal/taskloop/testdata/parity.yaml` — add disposition and disposal inventory.
- [ ] `apps/agent/internal/taskloop/parity.go` — load, validate, and report the manifest.
- [ ] `apps/agent/internal/taskloop/parity_test.go` — cover complete, missing, duplicate, unclassified, stale path, caller, and hash cases.

#### Test Strategy

Use in-memory negative fixtures; no real provider process.

#### Verification

```bash
go test -count=1 ./apps/agent/internal/taskloop -run 'TestParity|TestDisposition|TestDisposal'
```

Expected: zero missing, duplicate, unclassified, stale, or checksum-drift rows.

### [REFACTOR-2] Add the Thin Go Operator Command

#### Problem

`agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md:172-193` invokes Python. Predecessor 25 provides the authoritative runtime, but no bounded one-shot operator entry currently exposes dry-run, task-group filter, retry-blocked, and terminal exit status for the skill.

#### Solution

Add `iop-agent task-loop [--dry-run] [--task-group NAME] [--retry-blocked]` as a presentation adapter over the existing runtime. It may load configuration and invoke the host port, but must not duplicate selection, scheduling, recovery, review, or integration decisions.

```text
Before: python3 .../dispatch.py --dry-run --task-group <task_group>
After:  build/bin/iop-agent task-loop --dry-run --task-group <task_group> ...
```

#### Modified Files and Checklist

- [ ] `apps/agent/internal/command/task_loop.go` — add flags, output, and exit mapping.
- [ ] `apps/agent/internal/command/task_loop_test.go` — cover dry-run, filtering, retry, blocker, and terminal exits.
- [ ] `apps/agent/internal/command/root.go` — register the thin subcommand.
- [ ] `apps/agent/internal/command/service.go` — add bounded request/response DTOs only.
- [ ] `apps/agent/cmd/agent/main.go` — delegate the operator request to the authoritative runtime.
- [ ] `apps/agent/cmd/agent/main_test.go` — cover built command help and no-provider dry-run.

#### Test Strategy

Use predecessor 25's fake runtime seams. Assert the command never constructs a second manager or starts a raw provider.

#### Verification

```bash
go test -count=1 ./apps/agent/internal/command ./apps/agent/cmd/agent -run 'Test.*TaskLoop'
make build-agent
build/bin/iop-agent task-loop --help
```

Expected: command mapping passes and help exposes the compatibility flags.

### [REFACTOR-3] Cut the Skill and Add Zero-Ownership Guards

#### Problem

The orchestration skill and testing rules still own Python execution and static route/model/capacity facts, so Go is not the sole production owner.

#### Solution

Rewrite operator commands to call the Go binary and read runtime catalog/policy revisions. Add repository tests that report exact path/line failures for Python production callers, static ownership text, unclassified behavior, and Node duplicates. Retain Python names only inside their own reference directory and the parity manifest.

#### Modified Files and Checklist

- [ ] `agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md` — use Go and remove static ownership.
- [ ] `agent-ops/rules/project/domain/testing/rules.md` — assign production verification to the Go command.
- [ ] `agent-ops/rules/project/rules.md` — replace legacy dispatcher path mappings with Go/parity paths.
- [ ] `apps/agent/internal/taskloop/cutover_test.go` — add zero-match and ownership guards.
- [ ] `Makefile` — add `test-iop-agent-parity`.

#### Test Strategy

Run stable-sorted repository searches from Go tests and require exact allow-lists for reference-only paths.

#### Verification

```bash
make test-iop-agent-parity
rg -n --sort path 'dispatch\.py|python3 .*orchestrate-agent-task-loop|gpt-5\.6|claude-opus|Gemini|ornith|laguna' \
  agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md \
  agent-ops/rules/project/domain/testing/rules.md \
  agent-ops/rules/project/rules.md
```

Expected: parity tests pass and the search exits 1 with no matches.

### [REFACTOR-4] Record S13 Contract Evidence

#### Problem

`agent-contract/inner/iop-agent-cli-runtime.md:9-18` does not identify concrete S13 sources or the exact completion-transition disposal boundary.

#### Solution

Record the parity manifest, validator, thin command, cutover tests, and the deletion gate. Keep shared manager semantics in `iop.agent-runtime`.

#### Modified Files and Checklist

- [ ] `agent-contract/inner/iop-agent-cli-runtime.md` — add S13 source/evidence/disposal anchors.

#### Test Strategy

No new test file; verify contract anchors through the cutover test and deterministic search.

#### Verification

```bash
rg -n --sort path 'S13|parity.yaml|disposal|production callers' agent-contract/inner/iop-agent-cli-runtime.md
git diff --check
```

Expected: concrete S13 anchors exist and the diff is clean.

## Dependencies and Execution Order

Do not start until predecessor 25 has exactly one active or archived `complete.log`. Then implement REFACTOR-1 before REFACTOR-2/3, and finish with REFACTOR-4 plus the full regression.

## Modified Files Summary

| File | Item |
|------|------|
| `apps/agent/internal/taskloop/testdata/parity.yaml` | REFACTOR-1 |
| `apps/agent/internal/taskloop/parity.go` | REFACTOR-1 |
| `apps/agent/internal/taskloop/parity_test.go` | REFACTOR-1 |
| `apps/agent/internal/command/task_loop.go` | REFACTOR-2 |
| `apps/agent/internal/command/task_loop_test.go` | REFACTOR-2 |
| `apps/agent/internal/command/root.go` | REFACTOR-2 |
| `apps/agent/internal/command/service.go` | REFACTOR-2 |
| `apps/agent/cmd/agent/main.go` | REFACTOR-2 |
| `apps/agent/cmd/agent/main_test.go` | REFACTOR-2 |
| `agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md` | REFACTOR-3 |
| `agent-ops/rules/project/domain/testing/rules.md` | REFACTOR-3 |
| `agent-ops/rules/project/rules.md` | REFACTOR-3 |
| `apps/agent/internal/taskloop/cutover_test.go` | REFACTOR-3 |
| `Makefile` | REFACTOR-3 |
| `agent-contract/inner/iop-agent-cli-runtime.md` | REFACTOR-4 |
| `agent-task/m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover/CODE_REVIEW-cloud-G07.md` | REFACTOR-4 |

## Final Verification

```bash
gofmt -w apps/agent/internal/taskloop/parity.go apps/agent/internal/taskloop/parity_test.go apps/agent/internal/taskloop/cutover_test.go apps/agent/internal/command/task_loop.go apps/agent/internal/command/task_loop_test.go apps/agent/internal/command/root.go apps/agent/internal/command/service.go apps/agent/cmd/agent/main.go apps/agent/cmd/agent/main_test.go
go test -count=1 ./apps/agent/internal/taskloop ./apps/agent/internal/command ./apps/agent/cmd/agent
go test -count=1 -race ./apps/agent/internal/taskloop ./apps/agent/internal/command ./apps/agent/cmd/agent
go vet ./apps/agent/internal/taskloop ./apps/agent/internal/command ./apps/agent/cmd/agent
make test-iop-agent-parity
make build-agent
build/bin/iop-agent task-loop --help
build/bin/iop-agent task-loop --dry-run --task-group m-iop-agent-cli-runtime
build/bin/iop-agent task-loop parity --disposal-manifest
rg -n --sort path 'dispatch\.py|python3 .*orchestrate-agent-task-loop|gpt-5\.6|claude-opus|Gemini|ornith|laguna' agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md agent-ops/rules/project/domain/testing/rules.md agent-ops/rules/project/rules.md
go test -count=1 ./packages/go/... ./apps/agent/...
git diff --check
```

Expected: all fresh package/race/vet/parity/dry-run checks pass; the zero-match search exits 1; disposal output is stable and checksum-bound; no real provider launches.

After all code changes are complete, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.
