<!-- task=m-iop-agent-cli-runtime/13_standalone_host_foundation plan=0 tag=API -->

# Code Review Reference - API

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Complete the checklist and implementation-owned evidence, leave active files in place, and report ready for review. If blocked, record exact evidence and resume conditions only. Finalization, user-review classification, log renames, `complete.log`, and archive moves are review-agent-only.

## Overview

date=2026-07-29
task=m-iop-agent-cli-runtime/13_standalone_host_foundation, plan=0, tag=API

## 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.

1. Append verdict and `review_rework_count` / `evidence_integrity_failure` routing signals.
2. Archive `CODE_REVIEW-cloud-G09.md` → `code_review_cloud_G09_0.log` and `PLAN-cloud-G09.md` → `plan_cloud_G09_0.log`.
3. If PASS, write `complete.log` and move this task directory to the dated archive. If WARN/FAIL, fully write the next filesystem state required by the code-review skill.
4. If PASS, report the milestone completion event metadata without modifying the roadmap.
5. Check the `Review-Only Checklist` at the final log location before reporting.

## Implementation Item Completion

| Item | Status |
|------|--------|
| API-1 Agent application domain | [ ] |
| API-2 Host lifecycle | [ ] |
| API-3 Bootstrap composition | [ ] |

## Implementation Checklist

- [ ] Bootstrap the project-only `agent` domain rule and map `apps/agent/**` before adding application code.
- [ ] Implement and test the standalone host lifecycle and dependency ports without duplicating shared runtime behavior.
- [ ] Add and test bootstrap composition with deterministic startup rollback and reverse shutdown.
- [ ] Run fresh focused, race, vet, formatting, and diff verification.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

## Review-Only Checklist

> **[REVIEW AGENT ONLY]** Implementing agents must not modify this checklist.

- [ ] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified routing signals.
- [ ] Verify verdict, dimension assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive `CODE_REVIEW-cloud-G09.md` to `code_review_cloud_G09_0.log`.
- [ ] Archive `PLAN-cloud-G09.md` to `plan_cloud_G09_0.log`.
- [ ] Verify the Agent-Ops managed block in `.gitignore`.
- [ ] If PASS, write `complete.log` from the canonical template and leave no active Markdown files.
- [ ] If PASS, move this task directory to the dated archive and update this checklist at the final location.
- [ ] If PASS, report milestone completion event metadata without editing the roadmap.
- [ ] If PASS, remove an empty active split parent or prove remaining siblings/files require it.
- [ ] If WARN/FAIL, write the next filesystem state and do not write `complete.log`.

## Deviations from Plan

_Implementer: replace with actual deviations or `None`._

## Key Design Decisions

_Implementer: replace with actual decisions._

## Reviewer Checkpoints

- The new domain rule exists and is mapped before application implementation.
- Host lifecycle is application-owned and does not duplicate shared runtime algorithms.
- Startup rollback and reverse shutdown retain all error identities and are race-free.
- Modified paths exactly match the plan.

## Verification Results

### Domain mapping

```bash
test -f agent-ops/rules/project/domain/agent/rules.md
test "$(rg -n 'apps/agent/\\*\\*' agent-ops/rules/project/rules.md | wc -l | tr -d ' ')" = 1
```

_Paste actual stdout/stderr and exit status._

### Focused and race tests

```bash
go test -count=1 ./apps/agent/internal/host ./apps/agent/internal/bootstrap
go test -count=1 -race ./apps/agent/internal/host ./apps/agent/internal/bootstrap
```

_Paste actual stdout/stderr and exit status._

### Static verification

```bash
go vet ./apps/agent/internal/host ./apps/agent/internal/bootstrap
git diff --check
```

_Paste actual stdout/stderr and exit status._

---

> **[IMPLEMENTING AGENT — BEFORE SAVING]** Fill every implementation-owned section, then leave review-agent-only sections unchanged.

## Section Ownership

| Section | Owner | Note |
|---------|-------|------|
| Header, Overview, Review Agent Instructions | Fixed at stub creation | Implementer must not modify or execute these |
| Implementation Item Completion | Implementing agent | Check item status only |
| Implementation Checklist | Implementing agent | Check status only; do not change text/order |
| Review-Only Checklist | Review agent | Implementer must not modify |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholders with actual evidence |
| Reviewer Checkpoints | Fixed at stub creation | Reviewer verifies them |
| Verification Results | Implementing agent | Paste actual output; command changes require a deviation |
| Code Review Result | Review agent appends | Not included in the stub |
