<!-- task=m-iop-agent-cli-runtime/16+13,15_bootstrap_composition plan=0 tag=API -->

# Standalone Bootstrap Composition

## For the Implementing Agent

Filling implementation-owned sections in `CODE_REVIEW-cloud-G05.md` is mandatory. Run every verification command, paste actual notes/output, leave the active pair in place, and report ready for review. Finalization belongs only to the code-review skill. If blocked, record exact blocker evidence and resume conditions without asking the user, creating stop files, archiving, or writing `complete.log`.

## Background

The lifecycle packet provides host semantics but no validated construction boundary. This closure packet adds side-effect-free dependency validation and deterministic `Run`/`Close` delegation for later CLI, local-control, and process packets.

## Analysis

### Files Read

- `agent-task/m-iop-agent-cli-runtime/13_agent_domain/plan_cloud_G09_0.log`
- `agent-task/m-iop-agent-cli-runtime/13_agent_domain/code_review_cloud_G09_0.log`
- `apps/node/cmd/node/main.go`
- `apps/node/cmd/node/main_test.go`

### SDD Criteria

This compatibility-preserving prerequisite closes the standalone host foundation but does not claim an S10, S11, S12, or S15 Roadmap Task.

### Verification Context

Use fresh host/bootstrap tests, race, vet, formatting, and `git diff --check` from the original packet.

### Test Coverage Gaps

No constructor validates application dependencies or exposes deterministic startup-failure cleanup.

### Symbol References

None.

### Split Judgment

Bootstrap composition independently passes after the domain and lifecycle packets. It is the foundation closure consumed by binary, local-control, client-process, and integration work.

### Scope Rationale

Do not start concrete providers, sockets, logs, clients, or add user-facing commands.

### Final Routing

- evaluation_mode: `isolated-reassessment`
- finalizer: `finalize-task-policy.sh pair`
- build closures: all `true`; grade scores `1/1/1/1/1`; route `local-fit`, `local-G05`, filename `PLAN-local-G05.md`
- review closures: all `true`; grade scores `1/1/1/1/1`; route `official-review`, `cloud-G05`, filename `CODE_REVIEW-cloud-G05.md`
- large_indivisible_context: `false`
- positive loop risks: `boundary_contract` (count `1`)
- recovery signals: rework `0`, evidence-integrity failure `false`
- capability-gap evidence: none

## Implementation Checklist

- [ ] 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.

### [API-3] Add Bootstrap Composition

#### Problem

The standalone host has no constructor that validates dependencies and exposes one run/close boundary.

#### Solution

Add a bootstrap module that accepts explicit application dependencies, rejects nil or duplicate component names, builds the host, and exposes deterministic `Run`/`Close` behavior. Keep construction side-effect free.

#### Modified Files and Checklist

- [ ] `apps/agent/internal/bootstrap/module.go` — validate and compose host dependencies.
- [ ] `apps/agent/internal/bootstrap/module_test.go` — verify validation, lifecycle delegation, and startup failure cleanup.

#### Test Strategy

Write `TestNewModuleRejectsInvalidDependencies`, `TestModuleRunDelegatesLifecycle`, and `TestModuleStartupFailureRollsBack`.

#### Verification

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

Expected: the package passes.

## Dependencies and Execution Order

Predecessors `13_agent_domain` and `15+13_host_lifecycle` must each produce a same-group active or archived `complete.log`.

## Modified Files Summary

| File | Item |
|------|------|
| `apps/agent/internal/bootstrap/module.go` | API-3 |
| `apps/agent/internal/bootstrap/module_test.go` | API-3 |

## Final Verification

```bash
gofmt -w apps/agent/internal/bootstrap/*.go
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
go vet ./apps/agent/internal/host ./apps/agent/internal/bootstrap
git diff --check
```

Expected: fresh, race, vet, formatting, and diff checks pass. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.
