<!-- task=m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close plan=3 tag=REVIEW_REFACTOR milestone-task=decouple -->

# Harden the UI decoupling evidence audit

## For the Implementing Agent

Filling the implementation-owned sections of `CODE_REVIEW-cloud-G05.md` is mandatory. Regenerate the audit from fresh commands, run every verification, record actual stdout/stderr/exit values, keep the active pair in place, and report ready for review. If blocked, record only the exact blocker, attempted commands/output, and resume condition in implementation-owned evidence. Do not ask the user, call user-input tools, create control-plane stop files, classify the next state, archive logs, or write `complete.log`; finalization belongs to the code-review agent.

## Background

The standalone Flutter Agent surface removal and all fresh product regressions pass, but the task-local evidence audit is not exact. Its standalone scan stores a U+0008 byte instead of the required literal `\\b`, and its `scope=all` result lists only four active UI files while the verifier accepts any non-empty value. This follow-up repairs only the evidence boundary so Task 10 can consume a deterministic S03 contribution.

## Archive Evidence Snapshot

- The current failed pair will be archived as `plan_local_G08_2.log` and `code_review_cloud_G08_2.log`; the review has one Required finding and no Suggested or Nit findings.
- Fresh reviewer runs passed `make client-test`, `make client-build-web`, `make build-local`, `TMPDIR=$PWD/.tmp GOTMPDIR=$PWD/.tmp go test -count=1 ./...`, the intended standalone scan, the Chronos-connection scan, sync-state assertions, active UI graph checks, plan validation, and `git diff --check`.
- The failure is limited to evidence integrity: `decoupling-audit.log:26,122` omits the full active UI set and records a malformed scan command, while Verification 12 still returns PASS.
- Roadmap carryover remains `milestone-task=decouple`, SDD Scenario S03, and deferred completion to task 10. This child contributes evidence and does not claim Milestone Task completion.
- The facts required from the prior loop are recorded here; do not reread archive logs by default.

## Analysis

### Files Read

- `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/PLAN-local-G08.md`
- `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/CODE_REVIEW-cloud-G08.md`
- `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/decoupling-audit.log`
- `agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md`
- `agent-roadmap/sdd/automation-runtime-bridge/iop-agent-chronos-extraction-decoupling/SDD.md`
- `agent-ui/.sync-state.json`
- `agent-ui/definition/index.md`
- `agent-ui/definition/views/index.md`
- `agent-ui/definition/components/index.md`
- `agent-ui/definition/components/console-shell/index.md`
- `agent-ui/frame/index.md`
- `apps/client/README.md`
- `apps/client/lib/client_home_page.dart`
- `apps/client/lib/main.dart`
- `apps/client/test/app_shell_test.dart`
- `packages/flutter/iop_console/lib/src/iop_console_contract.dart`
- `packages/flutter/iop_console/lib/src/iop_console_shell.dart`
- `packages/flutter/iop_console/test/iop_console_shell_test.dart`
- `agent-ops/rules/common/rules-agent-ui.md`
- `agent-ops/skills/common/validate-agent-ui/SKILL.md`
- `agent-ops/rules/project/domain/client/rules.md`
- `agent-ops/rules/project/domain/testing/rules.md`
- `agent-test/local/client-smoke.md`

### SDD Criteria

- The selected SDD is `[승인됨]` with its lock released. This pair preserves `milestone-task=decouple` and targets Acceptance Scenario S03.
- S03 and its Evidence Map require a removed-path/reference audit and a clean IOP build proving the standalone/Chronos work surface is absent.
- The follow-up therefore binds exact scan commands, full active `agent-ui` validation membership, build/test outputs, and the deferred task-10 paths without asserting that S03 or `decouple` is complete.

### Verification Context

- No external handoff is required. Repository-native evidence is the current checkout, Flutter 3.41.5, Go module root, active `agent-ui` graph, task-local audit, Make targets, and local unit/build commands.
- Fresh reviewer evidence confirms the product behavior and regressions pass; only the recorded audit and its verifier are untrusted.
- No service, credential, remote runner, device, or long-running runtime is required. Confidence is high.

### Test Coverage Gaps

- Product behavior needs no new test: existing client and console widget tests cover the absent Agent rail/surface and surviving navigation.
- The missing coverage is audit tamper resistance. The strict verifier must reject control bytes, wrong command bodies, incomplete checked-file membership, duplicate/missing markers, wrong pending paths, malformed blocks, or nonzero exits.

### Symbol References

- No product symbol changes are planned.
- The evidence scan still covers `IopAgentPanel`, `IopConsoleSection.agent`, `agent_shell`, `iopDefaultCapabilityPack`, `IopCapabilityPack`, bare `IopCapability`, `agent-panel`, and `views/agent`.

### Split Judgment

- Keep one compact follow-up. Regenerating the audit and strengthening the verifier are one trust invariant and cannot independently PASS.
- Predecessor `08+07_cleanup_build_contract` has exactly one archived PASS `complete.log` at `agent-task/archive/2026/08/m-iop-agent-chronos-extraction-decoupling/08+07_cleanup_build_contract/complete.log`.

### Scope Rationale

- Do not modify Flutter source, tests, dependencies, agent-ui definitions, `.sync-state.json`, roadmap, SDD, contract, spec, manifest, or task-10 transitional runtime paths.
- Preserve the existing standalone UI removal. This follow-up only regenerates `decoupling-audit.log` and fills the new review evidence file.

### Final Routing

- `evaluation_mode=isolated-reassessment`; `finalizer=finalize-task-policy.sh`; `finalizer_mode=pair`.
- Build closures are all true. Scores are `1,0,0,2,2`, grade `G05`, base `local-fit`, final route `recovery-boundary`, lane `cloud`, filename `PLAN-cloud-G05.md`.
- Review closures are all true. Scores are `1,0,0,2,2`, grade `G05`, route `official-review`, lane `cloud`, filename `CODE_REVIEW-cloud-G05.md`.
- `large_indivisible_context=false`; positive loop risk is `structured_interpretation`, count `1`; `review_rework_count=1`; `evidence_integrity_failure=true`; risk boundary false; recovery boundary true; capability gap none.

## Dependencies and Execution Order

1. Confirm the encoded predecessor has exactly one PASS `complete.log`.
2. Run full-scope agent-ui validation and the eight exact evidence commands, then regenerate the audit without control bytes.
3. Run the strict verifier and fill the review stub.

## Implementation Checklist

- [ ] Confirm exactly one PASS `complete.log` for predecessor `08+07_cleanup_build_contract`.
- [ ] Regenerate `decoupling-audit.log` from the eight exact commands, record the complete active UI file set for `validate-agent-ui(scope=all,repair=true,sync-intent=inherited)`, preserve the five ordered `pending_task_10` paths, and keep S03 completion deferred to task 10.
- [ ] Run the strict audit verifier plus fresh Flutter tests/web build, local IOP build, full uncached Go suite, sync-state check, standalone/Chronos scans, plan validation, and `git diff --check`; the strict verifier must reject control bytes and compare exact command bodies and checked-file membership.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_REFACTOR-1] Bind exact audit commands and full-scope UI evidence

**Problem**

`decoupling-audit.log:26` claims `scope=all` while listing only four files, and line 122 stores U+0008 after `IopCapability`. The current parser only requires non-empty fields, so malformed evidence passes.

```text
- Checked Files: agent-ui/definition/index.md, ... only four files
IopCapability<0x08>
```

**Solution**

Run `validate-agent-ui(scope=all,repair=true,sync-intent=inherited)` and record every active root/definition/view/component/frame document plus `.sync-state.json`. Recapture all eight command blocks with exact command source text and actual stdout/stderr/exit. Verify exact command maps, exact checked membership, ordered task-10 paths, unique markers/blocks, exit zero, and the absence of control bytes other than newline/tab.

```text
IopCapability\\b
checked files = all 23 active UI metadata/definition/frame/state files
```

**Modified Files and Checklist**

- [ ] `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/decoupling-audit.log` — regenerate exact full-scope evidence and command captures.
- [ ] `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/CODE_REVIEW-cloud-G05.md` — record implementation decisions and actual verification output.

**Test Strategy**

Do not add product tests because product source is unchanged and existing widget tests already cover the removed surface. Rerun the existing client/web/local/full-Go regression commands to make the regenerated audit current. Use an inline deterministic parser as the regression oracle for exact audit content.

**Verification**

- Run the strict audit verifier in Final Verification; it must exit 0 only for the exact commands, complete checked-file list, ordered pending paths, unique blocks, no control bytes, and zero exits.
- `make client-test`
- `make client-build-web`
- `make build-local`
- `mkdir -p .tmp && TMPDIR=$PWD/.tmp GOTMPDIR=$PWD/.tmp go test -count=1 ./...`

## Modified Files Summary

| File | Item |
|------|------|
| `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/decoupling-audit.log` | REVIEW_REFACTOR-1 |
| `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/CODE_REVIEW-cloud-G05.md` | REVIEW_REFACTOR-1 |

## Final Verification

1. `test "$(git rev-parse --show-toplevel)" = "$PWD" && test "$(go env GOMOD)" = "$PWD/go.mod" && command -v bash flutter go python3 rg >/dev/null`
2. `bash -lc 'set -euo pipefail; mapfile -t predecessor_logs < <({ test ! -f agent-task/m-iop-agent-chronos-extraction-decoupling/08+07_cleanup_build_contract/complete.log || printf "%s\n" agent-task/m-iop-agent-chronos-extraction-decoupling/08+07_cleanup_build_contract/complete.log; find agent-task/archive -path "*/m-iop-agent-chronos-extraction-decoupling/08+07_cleanup_build_contract/complete.log" -type f -print 2>/dev/null; } | sort -u); test "${#predecessor_logs[@]}" -eq 1; awk "BEGIN {in_summary=0; pass_count=0} /^## Summary$/ {in_summary=1; next} in_summary && /^## / {in_summary=0; next} in_summary && /PASS/ {pass_count++} END {exit pass_count==1?0:1}" "${predecessor_logs[0]}"'`
3. `flutter --version`
4. `make client-test`
5. `make client-build-web`
6. `bash -c 'rg --sort path -n "$1" "${@:2}"; status=$?; test "$status" -eq 1' _ 'IopAgentPanel|IopConsoleSection\.agent|agent_shell|iopDefaultCapabilityPack|IopCapabilityPack|IopCapability\b|agent-panel|views/agent|Agent Shell 구성|IOP 운영/유지보수 agent' --glob '!**/archive/**' apps/client/Dockerfile apps/client/README.md apps/client/lib apps/client/pubspec.yaml apps/client/pubspec.lock apps/client/test/app_shell_test.dart packages/flutter/iop_console agent-ops/rules/project/domain/client/rules.md agent-ui/definition`
7. `python3 -c "import json; from pathlib import Path; s=json.loads(Path('agent-ui/.sync-state.json').read_text()); pending=s['pending_milestone_work']; assert len(pending)==1; assert pending[0]['milestone_path']=='agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md'; assert pending[0]['status_paths']==['agent-ui/definition/components/console-shell/index.md']; assert s['pending_code_work']==[]"`
8. `test ! -e agent-ui/USER_REVIEW.md && test -s agent-ui/definition/archive/views/agent/index.log && test -s agent-ui/definition/archive/components/agent-panel/index.log`
9. `make build-local`
10. `mkdir -p .tmp && TMPDIR=$PWD/.tmp GOTMPDIR=$PWD/.tmp go test -count=1 ./...`
11. `bash -c 'rg --sort path -n "$1" "${@:2}"; status=$?; test "$status" -eq 1' _ 'git\.toki-labs\.com/toki/chronos|/config/workspace/chronos|chronos[_-](bridge|node|server)|CHRONOS_' apps packages cmd proto configs`
12. Run this strict audit verifier:

```bash
python3 - <<'PY'
from pathlib import Path
import re

p = Path('agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/decoupling-audit.log')
text = p.read_text()
assert not any(ord(c) < 32 and c not in '\n\t' for c in text), 'control-byte'
lines = text.splitlines()

required = [
    'audit_schema=iop-agent-chronos-ui-decoupling-v1',
    'agent_ui_validation_invocation=validate-agent-ui(scope=all,repair=true,sync-intent=inherited)',
    'agent_ui_validation_scope=all',
    'agent_ui_validation_repair=true',
    'agent_ui_validation_sync_intent=inherited',
    'agent_ui_validation_result=PASS',
    'agent_ui_user_review=none',
    'agent_ui_remaining_issues=none',
    'standalone_ui_residuals=0',
    'chronos_connection_residuals=0',
    'iop_clean_build=PASS',
    's03_completion=deferred_to_task_10',
]
for marker in required:
    assert lines.count(marker) == 1, marker

checked = '- Checked Files: agent-ui/README.md, agent-ui/.sync-state.json, agent-ui/definition/index.md, agent-ui/definition/views/index.md, agent-ui/definition/views/edges/index.md, agent-ui/definition/views/execution-logs/index.md, agent-ui/definition/views/nodes/index.md, agent-ui/definition/views/overview/index.md, agent-ui/definition/views/runtime/index.md, agent-ui/definition/components/index.md, agent-ui/definition/components/command-action-bar/index.md, agent-ui/definition/components/console-shell/index.md, agent-ui/definition/components/domain-agent-card/index.md, agent-ui/definition/components/edge-detail-list/index.md, agent-ui/definition/components/edge-list/index.md, agent-ui/definition/components/edge-selector/index.md, agent-ui/definition/components/endpoint-card/index.md, agent-ui/definition/components/event-log-entry/index.md, agent-ui/definition/components/node-card/index.md, agent-ui/definition/components/operation-history-list/index.md, agent-ui/definition/components/provider-snapshot-card/index.md, agent-ui/definition/components/status-badge/index.md, agent-ui/frame/index.md'
assert lines.count(checked) == 1, 'checked-files'

pending = [line.removeprefix('pending_task_10=') for line in lines if line.startswith('pending_task_10=')]
assert pending == [
    'packages/go/agentruntime',
    'packages/go/agentprovider/cli',
    'apps/node/internal/node/runtime_bridge.go',
    'agent-contract/inner/agent-runtime.md',
    'agent-spec/runtime/edge-node-execution.md',
]

expected = {
    'flutter-version': 'flutter --version',
    'client-test': 'make client-test',
    'client-build-web': 'make client-build-web',
    'standalone-scan': r'''bash -c 'rg --sort path -n "$1" "${@:2}"; status=$?; test "$status" -eq 1' _ 'IopAgentPanel|IopConsoleSection\.agent|agent_shell|iopDefaultCapabilityPack|IopCapabilityPack|IopCapability\b|agent-panel|views/agent|Agent Shell 구성|IOP 운영/유지보수 agent' --glob '!**/archive/**' apps/client/Dockerfile apps/client/README.md apps/client/lib apps/client/pubspec.yaml apps/client/pubspec.lock apps/client/test/app_shell_test.dart packages/flutter/iop_console agent-ops/rules/project/domain/client/rules.md agent-ui/definition''',
    'sync-state': '''python3 -c "import json; from pathlib import Path; s=json.loads(Path('agent-ui/.sync-state.json').read_text()); pending=s['pending_milestone_work']; assert len(pending)==1; assert pending[0]['milestone_path']=='agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md'; assert pending[0]['status_paths']==['agent-ui/definition/components/console-shell/index.md']; assert s['pending_code_work']==[]"''',
    'build-local': 'make build-local',
    'full-go': 'mkdir -p .tmp && TMPDIR=$PWD/.tmp GOTMPDIR=$PWD/.tmp go test -count=1 ./...',
    'chronos-scan': r'''bash -c 'rg --sort path -n "$1" "${@:2}"; status=$?; test "$status" -eq 1' _ 'git\.toki-labs\.com/toki/chronos|/config/workspace/chronos|chronos[_-](bridge|node|server)|CHRONOS_' apps packages cmd proto configs''',
}

for command_id, command in expected.items():
    pattern = re.compile(
        rf'(?ms)^\[command:{re.escape(command_id)}\]\n'
        r'command-begin\n(.*?)\ncommand-end\n'
        r'stdout-begin\n(.*?)\nstdout-end\n'
        r'stderr-begin\n(.*?)\nstderr-end\n'
        rf'exit=0\n\[/command:{re.escape(command_id)}\]$',
    )
    matches = pattern.findall(text)
    assert len(matches) == 1, command_id
    assert matches[0][0] == command, (command_id, repr(matches[0][0]))
PY
```

13. `python3 agent-ops/skills/common/orchestrate-agent-task-loop/scripts/dispatch.py --workspace . --validate-plan agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/PLAN-cloud-G05.md`
14. `git diff --check`

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