# 방어 인벤토리

> dispatch gate, ledgered decisions, model verification, placement, duplicate master, redaction, revival, progressive onboarding guard를 표로 정리합니다.

- Repository: local/master-ops-with-local-mogui-ADE-orchestrator

- Human docs: https://grok-wiki.com/public/docs/local-master-ops-with-local-mogui-ade-orches-0ac7093355f3
- Complete Markdown: https://grok-wiki.com/public/docs/local-master-ops-with-local-mogui-ade-orches-0ac7093355f3/llms-full.txt

## Source Files

- `local-mogui-ade-orchestrator:docs/public/defense-inventory.md`
- `local-mogui-ade-orchestrator:src/master_runtime/core/dispatch_gate.py`
- `local-mogui-ade-orchestrator:src/master_runtime/core/succession.py`
- `local-mogui-ade-orchestrator:scripts/redaction-scan.sh`
- `local-master-ops:docs/runbooks/succession-boot-card.md`
- `local-master-ops:docs/MASTER-OPERATIONS.md`

---

---
title: "방어 인벤토리"
description: "dispatch gate, ledgered decisions, model verification, placement, duplicate master, redaction, revival, progressive onboarding guard를 표로 정리합니다."
---

`mogui-ADE-orchestrator`의 방어 표면은 `scripts/dispatch-gate`, `scripts/master-succeed`, `scripts/model-identity-probe`, `scripts/model-drift-audit`, `scripts/redaction-scan.sh`, `scripts/redaction-inventory`와 `master-ops` 템플릿 runbook에 나뉘어 있다. 각 방어는 허용/거부 verdict, JSONL ledger, Orca terminal metadata, transcript, 또는 scan coverage처럼 다시 읽을 수 있는 측정값을 남기는 경우에만 운영 규칙으로 취급된다.

## 방어 항목

| 방어 | 막는 실패 | 실행 표면 | 통과 신호 | 실패 신호 |
| --- | --- | --- | --- | --- |
| Dispatch gate | contract 없이 worker를 만들거나, budget·tier·completion channel 검사를 우회하는 dispatch | `scripts/dispatch-gate check`, `src/master_runtime/core/dispatch_gate.py` | JSON verdict `allow: true`, `reason: OK`, dispatch ticket 발급 | `CONTRACT_UNREADABLE`, `INVALID_REQUEST`, `BUDGET_EXCEEDED`, `ROUTING_VIOLATION`, `TIER_POLICY_UNAVAILABLE`, `TIER_FANOUT_CAP` |
| Ledgered decisions | “gate가 허용했다”는 사후 주장만 있고 어떤 정책이 판단했는지 모르는 상태 | `.dispatch-gate-ledger.jsonl` 또는 `--ledger`, `dispatch-gate report` | row에 `tier_policy_path`, `tier_policy_sha256`, `tier`, `contract_sha`, `attempt` 기록 | ledger가 없거나 읽을 수 없음, JSON decode 실패, 같은 span에 여러 정책 digest가 섞임 |
| Model verification | 선언한 model id와 실제 worker session model이 다른 상태 | `dispatch-gate register --declared-model --model-probe-cmd`, `model-identity-probe`, `model-drift-audit` | ledger에 `model_declared`, `model_measured`, `model_verified: true` 기록 | `MODEL_TIER_ESCALATION` deny, `MODEL_MISMATCH`, `MODEL_UNVERIFIED`, `MODEL_PROBE_FAILED` warning |
| Placement guard | master가 workspace folder seat가 아니라 product repository worktree에 앉는 misplacement | `master-succeed spawn --workspace-selector --expected-placement`, onboarding `04-seat.md`, `09-spawn.md` | spawn verification `MATCH` 또는 `MATCH_REISSUED`; selector, cwd, session namespace 3종 증거 | exit 26 `SPAWN_PLACEMENT_MISMATCH`, stale handle, wrong worktree, path selector 대체 |
| Empty-seat gate | Founding 재진입으로 같은 seat에 두 번째 master를 만드는 상태 | `orca terminal list --worktree <selector> --json`, onboarding `09-spawn.md` | spawn 전 seat terminal 수 0 | 기존 terminal이 하나라도 있으면 hard stop |
| Duplicate master detection | succession·resume 후 master session이 둘 이상 살아 있는 상태 | `master-succeed check-duplicates --self-handle --marker` | `duplicates: []` | self handle 제외 후 같은 marker session이 반환됨 |
| Redaction scan | generic secret scan만 돌고 조직 식별자 rule 누락을 green으로 오해하는 상태 | `scripts/redaction-scan.sh`, `REDACTION_EXTRA_PATTERNS`, `REDACTION_REQUIRE_EXTRA=1` | `OK — 0 findings`와 mode, files, commit-messages, org-rules count 출력 | exit 1 findings, exit 2 missing tool/rules/config/range/engine failure |
| Redaction inventory | rule이 실제 tree token blind spot을 덮는지 모르는 상태 | `scripts/redaction-inventory` | exit 0 uncovered candidate 없음 | exit 1 uncovered candidates, exit 2 rules 없음 또는 git tree 측정 불가 |
| Revival check | retired master가 다른 device나 terminal에서 다시 resume되는 상태 | `docs/runbooks/succession-boot-card.md`, lineage session id, process/tty 측정 | process, pane, tty 세 disappearance 측정 후 `CLOSED` | `CLOSED_PARTIAL`, `REFUSED`, session id 누락, process/tty 측정 불가 |
| Progressive onboarding guard | installer가 전체 onboarding 문서를 한 번에 읽고 mode를 섞거나 spawn 금지를 우회하는 상태 | `ONBOARDING.md`, `onboarding/*.md`, `reverify.md`, `upgrade.md` | 한 turn에 한 step file만 load, Verify 통과 후 다음 step | Reverify/Upgrade에서 spawn 시도, Founding guard와 기존 ops/lineage 충돌 |

## Dispatch gate와 tier 정책

`dispatch-gate check`는 contract, runtime, model, agent 수, estimated chars, completion channel을 받아 verdict를 만든다. 기본 completion channel은 암묵적으로 허용되지 않으며, 허용 가능한 값은 `orchestration`과 `sentinel-log`이다.

```bash
scripts/dispatch-gate --ledger ~/.mogui/dispatch-ledger.jsonl check \
  --runtime claude \
  --model claude-haiku-4-5-20251001 \
  --contract contracts/example.md \
  --agents 1 \
  --est-chars 3000 \
  --completion-channel orchestration
```

Tier policy 해석 순서는 명시적 `--tier-policy`, `DISPATCH_TIER_POLICY`, instance `config/model-tier-policy.json`, template `master-ops/model-tier-policy.json`이다. 현재 template policy는 `version: 2`이며 `unknown` tier에 `fanout_caps.unknown: 8`, `window_seconds: 86400`을 둔다. `top` tier는 template policy에서 cap이 제거되어 있고, ops wrapper인 `master-ops/scripts/dispatch`가 top-tier model에 대해 `--top-approved "<reason>"`을 요구한다.

<Note>
`--top-approved`는 인증 경계가 아니라 운영 승인 이유를 run log에 남기는 절차 방어다. gate ledger에는 policy path와 digest가 남고, wrapper stdout에는 top-tier 승인 이유가 남는다.
</Note>

`--no-record`는 dry run 전용이다. 이 옵션은 ledger row와 dispatch ticket을 만들지 않으므로, 검사 자체가 fan-out window를 소비하지 않는다.

## Register-time 검증

`register`는 worker job id가 실제 artifact에 나타나는지 `--probe-cmd`로 확인한 뒤 pending dispatch와 연결한다. completion channel이 `sentinel-log`가 아니면 orchestration task 검증도 요구된다.

```bash
scripts/dispatch-gate --ledger ~/.mogui/dispatch-ledger.jsonl register \
  --job-id <dispatch-id> \
  --contract-sha <contract-sha-prefix> \
  --runtime claude \
  --orchestration-task <task-id> \
  --probe-cmd "orca orchestration dispatch-show --task <task-id> --json | grep -o <dispatch-id> | head -1" \
  --declared-model claude-haiku-4-5-20251001 \
  --model-probe-cmd "scripts/model-identity-probe --transcript <worker.jsonl>"
```

| 상태 | 처리 |
| --- | --- |
| declared model과 measured model이 같음 | register allow, model verification 기록 |
| measured model이 declared model보다 더 엄격한 tier | `MODEL_TIER_ESCALATION` deny |
| measured model이 다르지만 더 느슨하거나 rank 불가 | `MODEL_MISMATCH` warning |
| declared model 없음 | `MODEL_UNVERIFIED` warning |
| model probe 실패 또는 빈 결과 | `MODEL_PROBE_FAILED` warning |

`model-identity-probe`는 최근 assistant event의 model field를 읽는다. `--expect` 또는 `MODEL_IDENTITY_EXPECT`가 없으면 exit 0이어도 “정보 출력”일 뿐 pass assertion이 아니다. `model-drift-audit`는 transcript 전체 assistant turn을 걷고 model transition을 보고한다. exit 2는 두 스크립트 모두 “판정 불가” 계열로 취급해야 하며 clean pass로 읽으면 안 된다.

## Placement와 master 중복 방어

Master seat는 multi-repository workspace에서 folder workspace여야 한다. product repository worktree에 앉은 master는 cwd와 hook이 맞아도 worker seat에 앉은 것이므로 misplacement다.

Founding spawn 전에 durable seat selector를 다시 확인한다.

```bash
orca terminal list --worktree <id:folder:...> --json
```

이 목록이 0 terminal이어야 spawn을 진행한다. 이후 `master-succeed spawn`은 requested worktree와 Orca가 반환한 `worktreeId`를 비교하고, 별도의 `--expected-placement`가 있으면 그 값과도 다시 비교한다.

```bash
scripts/master-succeed spawn \
  --workspace-selector <id:folder:...> \
  --expected-placement <folder:...> \
  --kickoff-file <kickoff.md> \
  --root <workspace-root> \
  --model <model-id> \
  --title "Gen-1 founding boot" \
  --json
```

중복 master는 runtime check로도 확인한다.

```bash
scripts/master-succeed check-duplicates \
  --self-handle <current-handle> \
  --marker <session-marker> \
  --json
```

결과의 `duplicates`가 비어 있지 않으면 soft warning이 아니라 중복 master finding이다.

## Redaction 방어

`redaction-scan.sh`는 tracked file, staged file, range file, commit message를 gitleaks로 검사하고 scan scope를 출력한다. 조직별 rule은 repository에 commit하지 않고 `REDACTION_EXTRA_PATTERNS` 파일로 공급한다.

```bash
REDACTION_EXTRA_PATTERNS=~/.config/mogui/redaction-extra.txt \
REDACTION_REQUIRE_EXTRA=1 \
scripts/redaction-scan.sh --staged
```

| exit | 의미 |
| --- | --- |
| 0 | clean |
| 1 | finding 있음 |
| 2 | 판정 불가: gitleaks 없음, base config 없음, required extra rule 없음, range 불가, engine self-test 실패, retired allowlist 사용 등 |

`redaction-inventory`는 scan의 역방향 질문을 한다. rule이 덮지 못한 후보 token을 보고하며, candidate는 secret 판정이 아니다.

```bash
REDACTION_EXTRA_PATTERNS=~/.config/mogui/redaction-extra.txt \
scripts/redaction-inventory --baseline .redaction-inventory-baseline
```

## Revival과 retirement

Succession retirement는 close command 성공으로 끝나지 않는다. `succession-boot-card.md`는 process, pane, tty 세 disappearance가 모두 측정될 때만 retirement를 완료로 본다.

| retirement 상태 | 의미 |
| --- | --- |
| `CLOSED` | pane, process, tty disappearance 모두 측정 |
| `CLOSED_PARTIAL` | pane은 사라졌지만 process 또는 tty 측정이 skipped |
| `REFUSED` | 대상이 여전히 present이거나 self close 위험, ambiguous target 등 |
| `DRY_RUN` | close 실행 없이 대상만 해석 |

부팅 시 또는 owner가 stray session을 보고하면 lineage에 기록된 session id를 process argv에서 찾는다. revived session이 발견되면 해당 session record를 읽어 미처리 owner instruction을 회수하고, agent process와 hosting tty chain을 종료한 뒤 gone 상태를 다시 측정한다.

## Progressive onboarding guard

`ONBOARDING.md`는 router이고, step 파일은 한 번에 하나만 읽는 운영 단위다. Founding은 `00`부터 `10`까지 진행하지만, Reverify와 Upgrade는 각각 전용 파일만 읽고 spawn을 금지한다.

| mode | 허용 경로 | spawn |
| --- | --- | --- |
| Founding | `00-orientation.md` → `10-card-and-retire.md` | Step 8에서만 가능 |
| Reverify | `onboarding/reverify.md` | 금지 |
| Upgrade | `onboarding/upgrade.md` | 금지 |
| Template improve | installer flow 중단 후 일반 작업으로 routing | 금지 |

기존 ops repository나 lineage file이 있으면 Founding이 아니다. master가 죽었거나 half-finished install이어도 Founding 재실행으로 복구하지 않고, ops repository의 succession/recovery 절차로 넘긴다.

## Related pages

<CardGroup>
  <Card title="작업자 위임" href="/dispatch-workers">
    `check -> dispatch -> register` 흐름과 acceptance 전 재검증 절차.
  </Card>
  <Card title="모델 식별과 drift 감사" href="/model-identity">
    transcript 기반 model probe, drift audit, undecidable 상태.
  </Card>
  <Card title="Redaction 게이트" href="/redaction-gates">
    scan scope, 조직 rule, commit message scan, release gate.
  </Card>
  <Card title="문제 해결" href="/troubleshooting">
    misplacement, duplicate master, model probe undecidable, redaction cannot decide 대응.
  </Card>
</CardGroup>
