<!-- task=m-iop-agent-cli-runtime/13_agent_domain plan=2 tag=REVIEW_API -->

# Code Review Reference - REVIEW_API

> **[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-07-29
task=m-iop-agent-cli-runtime/13_agent_domain, plan=2, tag=REVIEW_API

## Archive Evidence Snapshot

- Prior task path: `agent-task/m-iop-agent-cli-runtime/13_agent_domain`
- Archived plan: `agent-task/m-iop-agent-cli-runtime/13_agent_domain/plan_local_G02_1.log`
- Archived review: `agent-task/m-iop-agent-cli-runtime/13_agent_domain/code_review_cloud_G02_1.log`
- Verdict: `FAIL`
- Findings: Required `2`, Suggested `0`, Nit `0`
- Affected file: `agent-ops/rules/project/domain/agent/rules.md`
- Verification evidence: the domain rule exists and `git diff --check` exits `0`, but the exact recorded mapping regex returns count `2` and exits `1`; a deterministic ownership search also finds speculative provider, selector, quota, task manager, guardrail, overlay, integration, and Node-bridge owners.
- Roadmap carryover: this remains a compatibility-preserving prerequisite and does not claim a Milestone Task on PASS.

## 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-G04.md` → `code_review_cloud_G04_2.log` and `PLAN-cloud-G04.md` → `plan_cloud_G04_2.log`.
3. If PASS, write `complete.log` and move active task directory to `agent-task/archive/YYYY/MM/m-iop-agent-cli-runtime/13_agent_domain/`. 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 |
|------|---------|
| REVIEW_API-1 Standalone host ownership boundary | [x] |

## Implementation Checklist

- [x] Rewrite the agent domain rule around standalone host adapters and records, preserve every shared-runtime and Node owner, and run the deterministic ownership verification.
- [x] 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.

- [x] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified `review_rework_count`, `evidence_integrity_failure` to `Code Review Result`.
- [x] Verify that verdict, `Dimension Assessment`, and Required/Suggested/Nit classifications match.
- [x] Archive active `CODE_REVIEW-*-G??.md` to `code_review_cloud_G04_2.log`.
- [x] Archive active `PLAN-*-G??.md` to `plan_cloud_G04_2.log`.
- [x] Verify that the Agent-Ops managed block in `.gitignore` unignores `agent-task/**/*.md` and `agent-task/**/*.log` and ignores `agent-roadmap/current.md`.
- [x] If PASS, write `complete.log` based on `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md` files.
- [x] If PASS, move active task directory `agent-task/m-iop-agent-cli-runtime/13_agent_domain/` to `agent-task/archive/YYYY/MM/m-iop-agent-cli-runtime/13_agent_domain/` and update this checklist at the final archive path.
- [x] If PASS and task group is `m-<milestone-slug>`, report completion event metadata for runtime, without modifying roadmap or directly calling `update-roadmap`.
- [x] If PASS for split work, remove empty active parent `agent-task/m-iop-agent-cli-runtime/` 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

None. Implementation proceeded strictly according to PLAN-cloud-G04.md.

## Key Design Decisions

Updated `agent-ops/rules/project/domain/agent/rules.md` to align with the standalone host ownership boundaries. Rewrote included paths to reflect standalone application paths (`cmd/agent`, `internal/command`, `internal/host`, `internal/bootstrap`, `internal/taskloop`, `internal/projectlog`, `internal/localcontrol`, `internal/clientprocess`) while keeping shared runtime packages (`agentconfig`, `agentprovider`, `agentpolicy`, `agenttask`, `agentguard`, `agentworkspace`, `agentstate`) and Node protobuf bridge (`apps/node/internal/node/runtime_bridge.go`) explicitly identified as shared or Node-owned. Removed speculative internal algorithm packages and pseudo-symbols.

## Reviewer Checkpoints

- Application-owned paths match the concrete standalone split packages and describe adapters or host-owned records rather than shared algorithms.
- `packages/go/agentconfig`, `agentprovider`, `agentpolicy`, `agenttask`, `agentguard`, `agentworkspace`, and `agentstate` remain explicit shared owners.
- Node protobuf translation remains at `apps/node/internal/node/runtime_bridge.go`; no `apps/agent/internal/nodebridge/` owner remains.
- The valid project mapping remains unique, and no common rule, contract, roadmap, or application source is changed.

## Verification Results

### Domain contract ownership

```bash
agent_rule='agent-ops/rules/project/domain/agent/rules.md'
set -e
test -f "$agent_rule"
test "$(rg -n --fixed-strings '| `apps/agent/**` | agent | `agent-ops/rules/project/domain/agent/rules.md` |' agent-ops/rules/project/rules.md | wc -l | tr -d ' ')" = 1
for rel in cmd/agent internal/command internal/host internal/bootstrap internal/taskloop internal/projectlog internal/localcontrol internal/clientprocess; do
  rg -q --fixed-strings "\`apps/agent/${rel}/\`" "$agent_rule"
done
for shared in agentconfig agentprovider agentpolicy agenttask agentguard agentworkspace agentstate; do
  rg -q --fixed-strings "\`packages/go/${shared}/\`" "$agent_rule"
done
rg -q --fixed-strings '`apps/node/internal/node/runtime_bridge.go`' "$agent_rule"
test -z "$(rg -n --sort path 'apps/agent/internal/(config|provider|selector|quota|taskmanager|guardrail|overlay|changeset|integration|claim|workflow|state|logevents|socket|clientproc|nodebridge)/|selector\.Evaluator|quota\.Parser|taskmanager\.Manager|nodebridge\.Bridge' "$agent_rule")"
```

Command exited with status code 0.
Output:
VERIFICATION_SUCCESS

### Scope and diff checks

```bash
set -e
test -z "$(git diff --name-only -- agent-ops/rules/common agent-ops/skills/common)"
git diff --check
```

Command exited with status code 0.
Output:
SCOPE_CHECK_SUCCESS

---

> **[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 |

## Code Review Result

### Overall Verdict

PASS

### Dimension Assessment

| Dimension | Assessment | Evidence |
|-----------|------------|----------|
| Correctness | Pass | The rule limits `apps/agent` to standalone host composition, adapters, and host-owned records while assigning shared runtime behavior to the existing `packages/go/agent*` owners. |
| Completeness | Pass | Both implementation checklist items are complete, every required standalone path and shared owner is explicit, and the Node bridge remains at `apps/node/internal/node/runtime_bridge.go`. |
| Test coverage | Pass | The deterministic ownership assertions cover the exact project mapping, required application paths, required shared owners, the Node bridge, and the forbidden duplicate-owner set; behavior tests are not applicable to this documentation-only change. |
| API contract | Pass | The ownership boundary matches `iop.agent-runtime`, `iop.agent-cli-runtime`, the approved SDD, and the current Edge-Node runtime spec. |
| Code quality | Pass | The rule has no stale speculative package or pseudo-symbol references, and `git diff --check` passes. |
| Implementation deviation | Pass | No implementation deviation was found; the modified domain rule matches the active plan and leaves central common rules, contracts, roadmap documents, and application source untouched. |
| Verification trust | Pass | Fresh reviewer execution reproduced `ownership_exit=0` and `scope_exit=0`; the exact mapping search returned only the mapping row at `agent-ops/rules/project/rules.md:78`, and the stale-owner search returned no matches. |

### Findings

None.

### Routing Signals

- `review_rework_count=1`
- `evidence_integrity_failure=false`

### Next Step

PASS: Archive the active plan and review, write `complete.log`, move the task to the dated archive, and report the Milestone task completion event without modifying the roadmap.
