<!-- task=m-iop-agent-chronos-extraction-decoupling/10+09_neutral_execution plan=3 tag=REFACTOR -->

# Code Review Reference - REFACTOR

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `Implementation Checklist`; the final checklist item is mandatory before saving.
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
> If implementation is blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence fields.
> Do not ask the user directly, present choices, call user-input tools, create control-plane stop files, or classify the next state.
> Finalization (`Code Review Result`, log rename, `complete.log`, archive moves, `Review-Only Checklist`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.

## Overview

date=2026-08-01
task=m-iop-agent-chronos-extraction-decoupling/10+09_neutral_execution, plan=3, tag=REFACTOR

## Roadmap Targets

- Milestone: `agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md`
- Milestone link: [Milestone 문서](agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md)
- Task ids:
  - `decouple`: task09가 허용한 transitional runtime exception까지 제거하고 IOP Agent/Chronos 작업 surface 부재와 clean build를 최종 증명한다.
  - `retain-node`: IOP provider 전용 Node 실행·취소·상태·usage·lifecycle과 Edge wire만 유지하고 Chronos 연결점을 닫는다.
- Completion mode: check-on-pass

## Archive Evidence Snapshot

- 이 replan 직전에 미착수 active pair `PLAN-local-G08.md`와 `CODE_REVIEW-cloud-G08.md`를 각각 `plan_local_G08_2.log`, `code_review_cloud_G08_2.log`로 보존한다.
- 보존 pair에는 checked implementation item, actual verification output, verdict가 없었다. 따라서 구현 diff나 PASS evidence를 승계하지 않는다.
- 보존 방향의 핵심 오류는 `packages/go/agentprovider/cli -> packages/go/provider/cli`, PTY/session/status 보존, AgentUsageStatus/SESSION_LIST/TERMINATE_SESSION wire compatibility 유지였다. D04가 이를 명시적으로 대체한다.
- 같은 task의 `plan_local_G08_0.log`와 `code_review_cloud_G08_0.log`는 이전 neutralization 분석의 파일 inventory 근거로만 사용하며, 새 책임 경계는 승인 SDD와 이 plan이 우선한다.
- 과거 11/12 child log는 별도 실행하지 않는다. 해당 provider/consumer/contract 범위는 이 plan의 REFACTOR-2~5에 흡수한다.

## For the Review Agent

> **[REVIEW AGENT ONLY]** The finalization steps below are review-agent only. Implementing agents must not execute this section.

Compare implementation of each item against source files and verify that output in `Verification Results` matches code.
Review completion means the following steps are finished:

1. Append verdict and `review_rework_count` / `evidence_integrity_failure` routing signals.
2. Archive `CODE_REVIEW-cloud-G10.md` → `code_review_cloud_G10_3.log` and `PLAN-cloud-G10.md` → `plan_cloud_G10_3.log`.
3. If PASS, write `complete.log` and move active task directory to `agent-task/archive/YYYY/MM/m-iop-agent-chronos-extraction-decoupling/10+09_neutral_execution/`. If WARN/FAIL, fully write the next filesystem state required by the code-review skill.
4. If PASS and task group is `m-<milestone-slug>`, report completion event metadata. Roadmap state check and `update-roadmap` calls are runtime responsibilities.
5. Check applicable `Review-Only Checklist` items at the final `.log` location before reporting.

---

## Implementation Item Completion

| Item | Status |
|------|---------|
| REFACTOR-1 Immutable manifest 위의 versioned D04 disposition delta | [ ] |
| REFACTOR-2 CLI/session/terminal 제거와 provider-minimal execution package | [ ] |
| REFACTOR-3 IOP Node provider 운영 경계 | [ ] |
| REFACTOR-4 Edge wire/config/API consumer closure | [ ] |
| REFACTOR-5 Living contract/spec/rule/doc D04 동기화 | [ ] |
| REFACTOR-6 S03/S04 combined closure와 forbidden-reference audit | [ ] |

## Implementation Checklist

- [ ] Refuse to start until predecessor `09+08_remove_agent_ui_close` has exactly one PASS `complete.log`.
- [ ] Create and digest the versioned all-and-only `retain-generic` boundary delta without modifying the task03 manifest; verify deterministic effective-disposition reconstruction as task13-owned S01 evidence without claiming `inventory` completion.
- [ ] Remove CLI agent provider/profile, persistent session, PTY/terminal, workspace/status/quota surfaces and every task09 transitional runtime exception; retain only non-Agent provider lifecycle/execution primitives and close S03 removal scope.
- [ ] Update IOP Node consumers so run/cancel/provider status/usage/lifecycle remain while session list/terminate, arbitrary command and Chronos control meanings are absent.
- [ ] Update Edge proto/config/mapper/service/OpenAI/opsconsole consumers and generated Go/Dart while preserving standard OpenAI/Anthropic inference and tool calling.
- [ ] Reconcile active contract/spec/project rules/docs/readability through update-contract/update-spec and state the D04 boundary without adding a Chronos bridge.
- [ ] Run fresh delta/effective-path, proto, focused, race, IOP clean-build, dependency and forbidden-reference verification; absorb task09 evidence and record the combined S03/S04 closure output in `node-boundary-audit.log`.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

## Review-Only Checklist

> **[REVIEW AGENT ONLY]** This checklist is used only by the review agent.
> Implementing agents must not modify or check this section.

- [ ] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified `review_rework_count`, `evidence_integrity_failure` to `Code Review Result`.
- [ ] Verify that verdict, `Dimension Assessment`, and Required/Suggested/Nit classifications match.
- [ ] Archive active `CODE_REVIEW-cloud-G10.md` to `code_review_cloud_G10_3.log`.
- [ ] Archive active `PLAN-cloud-G10.md` to `plan_cloud_G10_3.log`.
- [ ] Verify that the Agent-Ops managed block in `.gitignore` unignores `agent-task/**/*.md` and `agent-task/**/*.log` and ignores `agent-roadmap/current.md`.
- [ ] If PASS, write `complete.log` based on `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md` files.
- [ ] If PASS, move active task directory `agent-task/m-iop-agent-chronos-extraction-decoupling/10+09_neutral_execution/` to `agent-task/archive/YYYY/MM/m-iop-agent-chronos-extraction-decoupling/10+09_neutral_execution/` and update this checklist at the final archive path.
- [ ] If PASS and task group is `m-<milestone-slug>`, report completion event metadata for runtime, without modifying roadmap or directly calling `update-roadmap`.
- [ ] If PASS for split work, remove empty active parent `agent-task/m-iop-agent-chronos-extraction-decoupling/` or verify it was kept due to remaining siblings/files.
- [ ] If WARN/FAIL, write the next filesystem state matching code-review verdict and do not write `complete.log`.

## Deviations from Plan

_Record any deviations from the plan and the rationale here._

## Key Design Decisions

_Record key design decisions here._

## Reviewer Checkpoints

- predecessor 09 completion path and PASS verdict are exact and unambiguous.
- task09의 transitional runtime exceptions는 최종 evidence에 승계되지 않고 effective removed-path audit와 IOP clean build로 대체된다.
- original task03 manifest remains byte-identical; delta schema, 137-row coverage, sorted uniqueness and digest are reproducible.
- no CLI agent provider/profile, persistent session, PTY/terminal, workspace mutation, arbitrary command/quota/status gateway or Chronos connection surface remains.
- `packages/go/execution` contains only model/provider/device operational primitives and does not become a generic remote shell.
- proto/config/generated Go/Dart and every Node/Edge consumer agree on the reduced wire.
- standard OpenAI/Anthropic inference, provider tool-calling, run cancel, usage and lifecycle regressions pass.
- active contract/spec/rules/docs match D04 and do not add a future Chronos bridge.

## Verification Results

### Verification 1

Command: Confirm exactly one PASS `complete.log` for predecessor `09+08_remove_agent_ui_close`.

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 2

Command: `python3 scripts/verify-iop-agent-chronos-boundary.py --manifest scripts/fixtures/iop-agent-chronos-ownership-manifest.tsv --expected-manifest-sha256 7026fedc8b0eb24eab5c4124d3818400f66db5f1d116a71e7781f346fbd256a7 --delta agent-task/m-iop-agent-chronos-extraction-decoupling/10+09_neutral_execution/boundary-disposition-delta-v1.tsv --delta-sha256 agent-task/m-iop-agent-chronos-extraction-decoupling/10+09_neutral_execution/boundary-disposition-delta-v1.sha256 --iop-root /config/workspace/iop-s1 --check-only`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 3

Command: `git diff --exit-code -- scripts/fixtures/iop-agent-chronos-ownership-manifest.tsv`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 4

Command: `make proto`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 5

Command: `make proto-dart`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 6

Command: `go test -count=1 ./packages/go/execution ./packages/go/config ./apps/node/... ./apps/edge/internal/node ./apps/edge/internal/edgevalidate ./apps/edge/internal/service ./apps/edge/internal/openai ./apps/edge/internal/opsconsole`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 7

Command: `go test -race -count=1 ./packages/go/execution ./apps/node/internal/node ./apps/node/internal/router ./apps/node/internal/adapters/... ./apps/edge/internal/service ./apps/edge/internal/openai`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 8

Command: `go vet ./packages/go/execution ./apps/node/... ./apps/edge/...`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 9

Command: `make client-test`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 10

Command: `make readability-audit`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 11

Command: `test ! -e apps/agent && test ! -e cmd/iop-provider-smoke && test ! -e packages/go/agentruntime && test ! -e packages/go/agentpolicy && test ! -e packages/go/agentprovider && test ! -e packages/go/agentstate && test ! -e packages/go/agenttask && test ! -e packages/go/provider/cli && test ! -e proto/iop/agent.proto`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 12

Command: `test -z "$(go list -deps ./... | rg 'github.com/creack/pty')"`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 13

Command: `test -z "$(rg --sort path -n 'packages/go/agentprovider/cli|packages/go/provider/cli|packages/go/agentruntime|CLIAdapterConfig|CLIProfileConfig|CLICompletionMarker|CLIConf|CLIProfileConf|CompletionMarkerConf|CategoryCLI|RunSessionMode|TERMINATE_SESSION|NODE_COMMAND_TYPE_USAGE_STATUS|NODE_COMMAND_TYPE_SESSION_LIST|AgentUsageStatus|WorkspaceRequired|metadata\\.workspace|quota-probe' apps packages proto configs agent-contract agent-spec agent-ops/rules/project docs README.md go.mod go.sum)"`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 14

Command: `test -z "$(rg --sort path -n 'git\\.toki-labs\\.com/toki/chronos|Chronos(Target|Registry|Bridge)|chronos_(target|registry|bridge)' apps packages proto configs agent-contract agent-spec)"`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 15

Command: `go test -count=1 ./...`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

### Verification 16

Command: `git diff --check`

_Actual stdout/stderr and exit code (or exact saved-output path and capture command):_

---

> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.

## Section Ownership

| Section | Owner | Note |
|---------|-------|------|
| Header comment, Overview, Review Agent Instructions | Fixed at stub creation | Implementing agent must not modify or execute these (archive, complete.log, and task-directory archive move are review-agent only) |
| Roadmap Targets | Fixed at stub creation from plan when present | Implementing agent must not modify; code-review copies it into `complete.log` as `Roadmap Completion` only on PASS |
| Archive Evidence Snapshot | Fixed at stub creation from plan when present | Implementing agent uses it as default prior-loop context; read only the specific archive files cited there when more detail is required |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementing agent checks `[ ]` → `[x]` only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementing agent checks `[ ]` → `[x]` only |
| Review-Only Checklist | Review agent only | Implementing agent must not modify or check this section |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholder text with actual content |
| Reviewer Checkpoints | Fixed at stub creation | Pre-filled from plan |
| Verification Results (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only; command changes require a `Deviations from Plan` entry |
| Code Review Result | Review agent appends | Not included in stub |
