# Cross-Code Review Report: B-10 — `agent_identities` tier-3 신원 캐시 완전 제거 (Option A)

**Job ID**: `2f64681f`
**Reviewer**: cline
**Date**: 2026-08-17
**Changeset**: 12 files, +99/-114 lines (git diff HEAD)

---

## 1. Changeset Overview

The B-10 backlog item (Option A) eliminates the dead `agent_identities` reading path and tier-3 fallback, removes PyYAML dependency from `workspace_uuid.py`, and simplifies UUID lookup to a 2-tier resolution (tier-1: per-row own id → tier-2: adapter `discover()`).

### Files Changed (12 files)

| File | Change | Lines |
|---|---|---|
| `lib.sh` | Comment updates: 3-tier → 2-tier description | +4/-9 |
| `lib_py/agents/base.py` | Docstring added to `identity_cache_fields` (retention rationale) | +4/-0 |
| `lib_py/verify_session.py` | `import yaml` moved from top-level to YAML fallback branch | +2/-1 |
| `lib_py/workspace_uuid.py` | Tier-3 fallback block removed (32 lines); `sqlite3` import removed | +1/-33 |
| `multi-agent-mux-monitor/SKILL.md` | "### D. Stale UUID" detailed section removed | +0/-10 |
| `multi-agent-mux-monitor/scripts/reconcile.sh` | Drift D detection code removed (37 lines) | +0/-37 |
| `multi-agent-mux-resume/SKILL.md` | UUID resolution order updated to 2-tier | +4/-7 |
| `multi-agent-mux-status/SKILL.md` | Drift class D table row removed | +0/-1 |
| `multi-agent-mux-stop/scripts/stop_session.sh` | Cache clearing code removed (6 lines); comment updated | +1/-7 |
| `IMPROVEMENTS.md` | B-10 moved from open to completed; counts updated | +12/-9 |
| `VERSIONS.md` | B-10 entry added under v2.0.0 item 7 | +7/-0 |
| `tests/test_tier1_unit.py` | 3 new regression tests (B-10 guards) | +64/-0 |

---

## 2. Verification Results

### 2.1 Lint (린트) — ✅ PASS

| Check | Method | Result |
|---|---|---|
| `bash -n lib.sh` | Syntax check | ✅ OK |
| `bash -n reconcile.sh` | Syntax check | ✅ OK |
| `bash -n stop_session.sh` | Syntax check | ✅ OK |
| `py_compile workspace_uuid.py` | Python compile check | ✅ OK |
| `py_compile verify_session.py` | Python compile check | ✅ OK |
| `py_compile base.py` | Python compile check | ✅ OK |
| `agent_identities` in production code | `grep -rn` across 4 target files | ✅ NO MATCHES (even in comments) |
| `import yaml` in workspace_uuid.py | `grep -n yaml` | ✅ NO MATCHES — PyYAML dependency removed |
| `import yaml` in verify_session.py | `grep -n import yaml` | ✅ Only at line 50 (inside YAML fallback branch) |
| IMPROVEMENTS.md header counts | `grep` + `wc -l` | ✅ 3 open (1 arch + 2 edge), 22 completed |
| Section 2 item count | `sed` + `grep -c` | ✅ 2 items (B-13, B-9) — B-10 removed |
| Section 5 item count | `sed` + `grep -c` | ✅ 22 entries (matches header list) |
| B-10 in completed list | `grep B-10` | ✅ In header line 6, section 5 detailed entry, update date |
| VERSIONS.md B-10 entry | `grep -n B-10` | ✅ Line 74, item 7 under v2.0.0 |
| 3 new B-10 tests | `grep -n 'def test_b10'` | ✅ All 3 present (lines 343, 364, 382) |
| `identity_cache_fields` retention | `grep -rn` in adapters | ✅ Retained in base.py + 4 adapters with docstring |

### 2.2 Operability (동작성) — ✅ PASS

| Check | Method | Result |
|---|---|---|
| B-10 regression tests | `pytest -k b10` | ✅ 3/3 PASSED (0.04s) |
| `test_b10_no_agent_identities_reader_in_production` | Unit test | ✅ PASSED — guards against agent_identities read path resurrection |
| `test_b10_workspace_uuid_has_no_yaml_import` | AST analysis | ✅ PASSED — guards against `import yaml` reintroduction (including lazy) |
| `test_b10_find_workspace_uuid_runs_without_pyyaml` | Subprocess stub | ✅ PASSED — UUID resolution path completes without PyYAML |
| Full regression suite | `pytest tests/ -v` | ✅ **266/266 PASS (100%) in 411.09s** |

### 2.3 Loss (유실) — ✅ PASS

| Check | Method | Result |
|---|---|---|
| Tier-3 fallback removed from workspace_uuid.py | `git diff` | ✅ 32-line block removed; `sqlite3` import removed |
| Drift D removed from reconcile.sh | `git diff` | ✅ 37-line block removed (claude/agy/hermes/cline stale UUID checks) |
| Cache clearing removed from stop_session.sh | `git diff` | ✅ 6-line block removed (agent_identities purge on --purge-conversation) |
| PyYAML removed from workspace_uuid.py | `grep yaml` | ✅ No yaml references at all |
| PyYAML moved to lazy import in verify_session.py | `git diff` | ✅ `import yaml` now inside YAML fallback `try` block (line 50) |
| UUID resolution simplified to 2-tier | Code inspection | ✅ tier-1 (per-row own id) → tier-2 (adapter discover()) → print('') |
| `identity_cache_fields` retained intentionally | `grep` + docstring | ✅ Retained with docstring explaining future cache write path need |
| SKILL.md docs updated (resume, monitor, status) | `git diff` | ✅ All 3 docs updated to reflect 2-tier resolution and drift D removal |
| Comments updated (lib.sh, stop_session.sh) | `git diff` | ✅ "3-tier" → "2-tier", tier-3 references removed |
| No production code reads agent_identities | Regression test | ✅ `test_b10_no_agent_identities_reader_in_production` guards this |

---

## 3. Minor Non-Blocking Observations

1. **Monitor SKILL.md line 175**: The "Drift responses" summary list still contains "- D. Stale UUID: report only, no YAML change" even though the detailed "### D. Stale UUID" section and the reconcile.sh drift D implementation were both removed. This summary reference was outside the diff hunk and was not cleaned up. **Non-blocking** — the implementation is correctly removed; only a documentation summary line is stale. Consider removing line 175 in a future cleanup.

2. **`identity_cache_fields` retention**: The `identity_cache_fields` property is retained in `base.py` and all 4 adapters (claude, agy, hermes, cline) with a Korean docstring explaining that while the read path has zero production consumers post-B-10, it remains the sole schema description needed when a cache write path is introduced. This is an intentional, documented design decision — not dead code to remove.

3. **`import yaml` in verify_session.py**: The `yaml` import is now inside a conditional branch (YAML fallback at line 50), only executed when `.db` doesn't contain `orchestrator_uuids` and the YAML file exists. This follows the existing `state.py` precedent for lazy YAML imports. The UUID resolution path can complete without PyYAML when the `.db` file has the data, as verified by `test_b10_find_workspace_uuid_runs_without_pyyaml`.

---

## 4. Verdict

The B-10 backlog item has been correctly resolved via Option A (complete elimination):

- **`agent_identities` read paths removed** from all 3 production locations: `workspace_uuid.py` (tier-3 fallback, 32 lines), `reconcile.sh` (drift D detection, 37 lines), `stop_session.sh` (cache clearing on purge, 6 lines).
- **PyYAML dependency removed** from `workspace_uuid.py` (no `import yaml` at all) and deferred to a lazy conditional import in `verify_session.py` (YAML fallback branch only).
- **UUID resolution simplified** to a clean 2-tier model: tier-1 (per-row own id from `herdr_sessions[]`) → tier-2 (adapter `discover()` on-disk scan) → empty result.
- **Regression guards** (3 new tests) protect against resurrection of the `agent_identities` read path, reintroduction of `import yaml` in `workspace_uuid.py` (including lazy imports via AST analysis), and runtime PyYAML dependency in the resolution path.
- **Documentation updated** consistently across 6 files: `lib.sh` comments, 3 SKILL.md files, `IMPROVEMENTS.md` (B-10 moved to completed, counts updated to 3 open / 22 completed), `VERSIONS.md` (entry 7 under v2.0.0).
- **Full regression suite passes**: 266/266 PASS (100%) in 411.09s.
- The `identity_cache_fields` property is intentionally retained with documentation for future cache write path use.

[VERDICT: PASS]