# Prompt-Side Hygiene Audit

Date: 2026-05-14 (audit 시작) / 2026-05-15 (작성)
Scope: `prompts/_base/<latest dir>/*.{md,txt,json}` — active prompt 안 시나리오 leak, over-specific example, 도메인 nomenclature 분산.

## 1. Audit Boundary

본 파일은 본 audit 시리즈의 **prompt-side hygiene** 영역.

Included:
- active prompt 디렉터리 (각 module 의 latest version dir, file fallback 의 numeric-desc sort 결과)
- `*.md`, `*.txt`, `*.json` (시나리오 키워드 grep + 도메인 nomenclature grep)
- 변신/빙의 visual_world_rules SOT 별도 area boundary 명시

Excluded (다른 영역 위임):
- legacy prompt version 디렉터리 (file fallback 의 non-latest)
- LLM-facing classifier instruction (`shot_director/system.md:29-49`, `scene_detail_owned_judge/system.md:18-61`, `t2i_review/scene_system.md:31-91`) → `03-llm-side-heuristic-audit.md`
- code-side regex / substring → `01-code-side-regex-audit.md`
- DB row override / file fallback / code pin → `04-db-row-verification.md`

Loader caveat (`prompt_loader.py` 인용, 자세는 `04-` 파일):
- DB-first, file fallback. 본 hygiene patch 가 적용되려면 affected `(module, stem)` 의 DB row 가 없거나 inactive 여야 함.
- 또한 hardcoded `Path(...)` bypass module 2개 (`entity_extraction` / `t2i_visual_converter`) 는 path string 변경 의무 (자세는 `04-`).

## 2. Verification Passes Performed

### 2.1 Active prompt 디렉터리 재산출

- `ls -d prompts/_base/*/` → **58 module 디렉터리** (Codex 일치).
- 각 module 의 latest version dir 결정 (lexicographic last, version 형식 `N.YYYYMMDDHHmm` 또는 `vN`).
- `*.md` / `*.txt` / `*.json` file 수 = **178** (Codex 177 + 1 차이 — 미세 카운트 정정, 항목 수 영향 없음).

### 2.2 시나리오 Leak Grep

| Keyword | Hits |
|---|---|
| 은성 | 1 (`entity_extraction/v7/chunk_system.md:24`) |
| ZRBB | 1 (위와 동일) |
| 동녘 | 1 (`scene_extractor_v2/.../system.md:60`) |
| 강의원 | 1 (위와 동일) |
| 캡슐속 | 2 (`scene_extractor_v2/system.md:63`, `turn_scene_detail.md:108`) |
| 청록색 | 1 (`t2i_visual_converter/v3/system.md:19`) |
| compact room | 1 (`t2i_review/.../scene_system.md:46`) |
| wet floor | 2 (`t2i_review/.../scene_system.md:62-63`) |
| shared bench | 2 (`t2i_review/.../scene_system.md:74, 78`) |
| Figure A / B | 1 line (`t2i_review/.../scene_system.md:69`) |
| Korean police | 2 (`scene_extractor_v2/.../turn_scene_detail.md:83, 85`) |
| Joseon | 1 (`scene_extractor_v2/.../turn_scene_detail.md:84`) |
| tiled-roof | 1 (위와 동일) |

### 2.3 도메인 Nomenclature Grep

- `요괴 / 구미호 / 이무기 / 뱀파이어 / 망령 / 빙의 / 원격 조종` — 다수 site (11+ prompt).
- `좀비 / 아바타` — **0 hit** (Codex 가 outlook_extractor `humanoid monster, vampire, zombie` 인용 시 zombie 포함했으나 phase1.md 에 실재 없음. Codex 인용 오류 — §9 정정).
- `transformation / possession / ghost / projection / superpower / body_deformation` — `visual_world_rules/6.../system.md:51` 와 `rules_schema.json:9` 에 SOT 정의.

## 3. Severity Schema (4-tuple)

각 row 적용:
- **Priority**: `P0` (confirmed 시나리오 leak — 한국인명 / 프로젝트 코드 / 명백한 specific) / `P1` (over-specific example — 도메인 명시는 OK 이나 generic 가능) / `P2` (acceptable generic / owner SOT, keep) / `Excluded` (non-counted, anti-pattern context 등)
- **Evidence**: `confirmed` / `plausible` / `unverified`
- **Fix Cost**: `small` (단일 prompt 새 version dir + placeholder 교체) / `medium` (2-3 prompt cascade) / `large` (cross-prompt SOT 일원화)
- **Dependency**: prerequisite / blocked-by / independent

## 4. Scenario Leak — Active P0 (3 rows / 2 unique sites) + Orphan (1)

사용자 메모 "P-1 ~ P-6 leak 6" 표현은 본 audit 의 P0/P1 leak rows 의 unique-site 그룹화. P-3 + P-3b 는 같은 P-3 rule 의 2 file site.

**P-1 orphan 분리 (2026-05-15 follow-up)**: P-1 은 active entity extraction path 외 orphan module (`entity_extractor_legacy`) 의 prompt — Hygiene v1 scope **외**, 별도 orphan cleanup area. Active P0 = P-2 / P-3 / P-3b (3 rows / 2 unique sites). 자세는 P-1 row 의 Orphan 확정 evidence 참조.

### P-1. `entity_extraction/v7/chunk_system.md:24` — 한국인명 + 프로젝트 코드 (**ORPHAN — Hygiene v1 scope 외**)

```
- possession: 캐릭터를 시각적으로 정의하는 핵심 장비만 (예: 은성<->ZRBB51)
```

**Orphan 확정 (2026-05-15 follow-up evidence)**:
- `entity_extractor_legacy.py` import 0 (`grep -rn "entity_extractor_legacy" --include="*.py" backend/` = 0 hits)
- `extract_entities()` function 존재 (`backend/app/modules/entity_extractor_legacy.py:241`) but caller 0
- `ENTITY_PROMPT_DIR / "v7"` 사용 = 자기 module 내만 (line 14, 161), 외부 reference 0
- Active entity extraction path = `entity_extractor_v2/9.202605130226/` (prompts, file fallback latest) + `entity_extractor_v3.py` (impl, `_MODULE = "entity_extractor_v2"`) + `entity_extractor_v2_legacy.py` (fallback, `operation_type="entity_extraction"` provenance label emit)
- Active `entity_extractor_v2/9.202605130226/` 내 시나리오 leak grep = 0 hits — active path clean.

- **위험**: orphan prompt leak — runtime 효과 0. 단 prompt file 자체는 git tracked, 미래 reactivate 시 leak 재발 위험.
- **4-tuple**: **Orphan** / confirmed / small / independent (Hygiene v1 scope **외**)
- **Codex 매핑**: P0-1 (Codex 미명시 orphan status — 본 audit follow-up 정정) / **사용자 메모**: P-1
- **Fix direction**: Hygiene v1 외 별도 **"orphan cleanup" area**. `entity_extractor_legacy.py` + `prompts/_base/entity_extraction/` archive 또는 삭제 검토. **Hygiene v1 에서 entity_extraction/v8 새 dir 생성 또는 path bump 금지** (runtime 효과 0).

### P-2. `scene_extractor_v2/.../system.md:60` — 빙의/원격조종 예시

```
예: "동녘(강의원)" → 동녘의 몸만 보이고, 강의원은 다른 곳에 있으므로 강의원 제외
```
- **위험**: `동녘` / `강의원` = 한국 인명. 규칙은 valid 하나 예시는 generic 화 의무.
- **4-tuple**: P0 / confirmed / small / independent
- **Codex 매핑**: P0-2 (line range :59-60) / **사용자 메모**: P-2
- **Fix**: `"<visible_body_name>(<remote_identity_name>)" → only visible body present` + visual_world_rules `rule_type=possession` reference pointer.

### P-3. `scene_extractor_v2/.../system.md:63` — 컨테이너 수식어 예시

```
- **수식어로만 등장하는 소품**: "캡슐속 남자들" → 캡슐이 이 장소에 없으면 제외
```
- **위험**: `캡슐속 남자들` = sci-fi/action scene-shaped. 규칙은 valid 하나 예시 specific.
- **4-tuple**: P0 / confirmed / small / independent
- **Codex 매핑**: P0-3 / **사용자 메모**: P-3
- **Fix**: `"<container descriptor> 안의 인물들"이 실제 현장에 없으면 제외`.

### P-3b. `scene_extractor_v2/.../turn_scene_detail.md:108` — 캡슐 + 헬기 컨테이너

```
- 예: "캡슐속 남자들"이 헬기에 타고 있다면 → 캡슐은 헬기에 없으므로 제외
```
- **위험**: P-3 와 동일 패턴 + 헬기 추가.
- **4-tuple**: P0 / confirmed / small / independent
- **Codex 매핑**: P0-3 (동일) / **사용자 메모**: P-3
- **Fix**: P-3 와 함께 generic placeholder.

## 5. P1 — Over-Specific Active Prompt Examples (3)

### P-4. `scene_extractor_v2/.../turn_scene_detail.md:83-85` — Korean / Joseon hard-prime

```
한국 배경이면 "Korean police officer", "Korean-style apartment", "Korean convenience store"
조선시대면 "Joseon-era nobleman", "tiled-roof wooden structure"
```
- **위험**: 시나리오 leak 자체는 아니지만 generic extraction prompt 가 Korean/Joseon phrasing 으로 hard-prime.
- **4-tuple**: P1 / confirmed / small / independent
- **Codex 매핑**: P1-1 / **사용자 메모**: P-4
- **Fix**: `<region-derived demonym> police officer` / `<era-derived noble role>` placeholder. 문화 cue 보존, generic 화.
- **cinematography 5-line block (line 87-91)** = Area #7d (audit 03 L-8) 처리됨 (W1-W4 atomic, 2026-05-19+).

### P-5. `t2i_visual_converter/v3/system.md:19` — 청록색 sci-fi 예시

```
예시: "[주인공]이 투명 벽 너머로 남자를 올려다본다, 청록색 발광, 미디엄 숏"
```
- **위험**: `[주인공]` = generic placeholder OK. `투명 벽` + `청록색 발광` = sci-fi/lighting prime.
- **4-tuple**: P1 / confirmed / small / independent
- **Codex 매핑**: P1-2 / **사용자 메모**: P-5
- **Fix**: `[primary character] looks toward [secondary visible target], <lighting cue>, <shot scale>`.

### P-6. `t2i_review/.../scene_system.md:45-78` — synthetic placeholder 너무 구체

```
:46  compact room / existing tabletop / close-framing 전체 rewrite
:62-63  wet floor planks visible behind subject's hands
:69  Figure A / Figure B / 벤치
:74, 78  shared bench / shared table / "the same X they both occupy"
```
- **위험**: 코멘트 "synthetic placeholder" 명시지만 예시 길어 style/scene prior 가 됨. code-side blind substring mutation (`t2i_review.py:383-403, :407-451`) 와 mirror.
- **4-tuple**: P1 / confirmed / medium / independent (Codex H3 LLM redesign 별도 area 의존)
- **Codex 매핑**: P1-3 (line range :45-47, :61-63, :69-78, :87-90 통합) / **사용자 메모**: P-6
- **Fix**: issue-type 정의 유지 + 예시 `<existing background object>` / `<frame-edge surface>` / `<shared support surface>` 추상 placeholder 로 교체. 장기 = LLM-side redesign (H3) 영역.
- **Status: closed by Area #7c (2026-05-19+, W1-W3; push pending until APPROVED_FOR_PUSH)** (Codex iter 3 verbatim wording — Phase 2 hygiene v6→v7 example abstraction in `prompts/_base/t2i_review/7.202605190201/` covers 5 scene body-part/action cue + 1 keep-abstract + 2 entity role/demonym cue = 8 site replacement, 7 strict residue catalog 0 count, schema sibling sha256 byte-identical, STEP_MANIFEST single-entry preservation; §14 본 audit 안 closure section 참조; Carry follow-up = Area #7d cinematography / Carry-A100 t2i_context demonym / Carry-A099 director_notes prose / Carry-P021 scene_consistency).

## 6. P1 — 도메인 Nomenclature 분산 (5 + 추가 6 = 11)

사용자 메모 / Codex §6 인벤토리 5 site 외 **추가 6 site 신규 발견** (D-1~D-5 + ADD-6~ADD-11). 모두 **별도 area carry** (변신/빙의 visual_world_rules SOT 일원화) — 사용자 명시.

### 사용자 인벤토리 + Codex (D-1 ~ D-5)

| # | file:line | 인용 발췌 | Codex 매핑 | 사용자 메모 |
|---|---|---|---|---|
| **D-1** | `entity_all/.../character.md:26-30` | 인간↔요괴 / 인간↔괴물 / 본체↔변신체 / 빙의/합체 / 이무기 / 구미호 / 요괴화 / 뱀파이어 | §6 site 1 | 도메인 #1 |
| **D-2** | `entity_character_list/.../system.md:10` | 인간 / 요괴 / 동물 / 로봇 / 외계인 | §6 site 2 | 도메인 #2 |
| **D-3** | `entity_relation/.../system.md:11-13, :30` | 요괴/괴물 형태 / 유령/망령 형태 / 갑옷 착용 형태 | §6 site 3 | 도메인 #3 |
| **D-4** | `outlook_extractor/.../phase1.md:16` | 메카 / 파워드슈트 / 강화복 / 갑옷 로봇 | §6 site 4 (**Codex 인용 정정** — §9 참조) | 도메인 #4 |
| **D-5** | `visual_world_rules/.../system.md:30-36, :51` | `possession / transformation / ghost / projection / superpower / body_deformation / time_period / costume / technology / other` enum | §6 site 5 (SOT owner) | 도메인 #5 |

D-5 = SOT owner — **P2 keep**. D-1~D-4 = **P1 confirmed / medium / independent / yes (별도 area carry)**.

### 추가 발견 (Codex/사용자 메모 외)

| # | file:line | 인용 발췌 | 등급 | 비고 |
|---|---|---|---|---|
| **ADD-6** | `entity_extractor_v2/.../turn0_style.md:13` | 원격 접속/조종/빙의/텔레파시 등 기술이 있다면 | P1 / confirmed / small / 별도 area | visual_world_rules SOT 재사용 가능 — Codex §6 누락 |
| **ADD-7** | `scene_director/.../system.md:8, :24, :34` | 영상통화 / CCTV / 방송 화면 / 홀로그램 / VR / 원격 조종/빙의 기술 / 빙의/원격접속 중이면 / 빙의/원격/V.O. | P1 / confirmed / medium / 별도 area | scene_director 자체 도메인 list — Codex §6 누락 |
| **ADD-8** | `scene_verify/.../system.md:7` | 빙의/영혼 상태: 다른 인물의 몸에 들어간 경우 | P1 / confirmed / small / 별도 area | 동일 패턴 — Codex §6 누락 |
| **ADD-9** | `scene_detail/.../system.md:327` | 원격 조종/접속 인물 제외 (조종자 몸이 다른 장소) | P1 / confirmed / small / 별도 area | 동일 패턴 — Codex §6 누락 |
| **ADD-10** | `shot_extract/.../user.md:33` | 얼굴이 크게 달라지는 변화: 나이 변화 / 변장/성형 전후 / 빙의로 얼굴이 바뀜 | P1 / confirmed / small / 별도 area | 동일 패턴 — Codex §6 누락 |
| **ADD-11** | `entity_extractor_v2/.../system.md:22, :32` | 평상복 → 전신 갑옷 (완전히 다른 실루엣) / ### 빙의/정신 전환/몸을 빌리는 설정 | P1 / confirmed / medium / 별도 area | 도메인 분산 — Codex §6 누락 |

**Summary**: Codex / 사용자 메모 도메인 인벤토리 = **5 site**. 본 audit 실측 = **11 site** (5 + 6 추가). 변신/빙의 SOT 일원화 area cost 산정 시 11 site 기준 medium-large.

### visual_world_rules 자체 schema description drift (추가 발견)

- `visual_world_rules/6.../system.md:51` 10-token enum: `possession / transformation / ghost / projection / superpower / body_deformation / time_period / costume / technology / other`.
- `visual_world_rules/6.../rules_schema.json:9` = `{"type": "string", "description": "규칙 유형 (possession, transformation, ghost, time_period, costume, technology 등)"}` — **JSON schema enum 아님 (type: string + description token list with "등", non-enforced)**.
- **Description drift**: system.md 10-token vs schema description 6-token + "등". `projection / superpower / body_deformation / other` 가 schema description 에 부재. 단 schema 미강제이므로 어떤 string 도 통과 (silent miss 가능).
- **drift fix 의무**: 별도 area 진입 시 schema description 도 system.md 10-token 과 정렬 (P1 / small) + 가능하면 JSON schema `enum` 으로 강제 (struct SOT gate 3 모범).

## 7. Excluded (Non-counted)

본 audit boundary 외 / acceptable generic / 의도된 anti-pattern context:

- `t2i_visual_converter/v3/system.md:46` "디스토피아 분위기" — line 43 `## 나쁜 예 vs 좋은 예` 헤딩 아래 의도된 anti-pattern. leak 아님.
- `shot_essence_extraction/3.../system.md:85-86` "주인공이 주먹을 쥔다" / "주인공의 흐트러진 머리카락" — 일반 placeholder, leak 아님.
- `entity_extractor_v2/.../turn0_style.md:17, :20-22` `근미래/현대/조선시대` `조선시대 한옥` `한복, 중세 갑옷` — schema field enum example, **P2 acceptable**.
- `scene_generator/v2/scene_rules_ko.md:5-6` "프로젝트 스타일 가이드" + "사극풍 복식, 판타지 갑옷, 중세풍 건축 금지" — generic rule (시대 충돌 방지), **P2 acceptable**.
- `lvm_prompts/2.../style_rules_generator.md:5, :7-9` + `scene_generator/v2/style_rules_generator.md:5, :7, :9` — enum example (시대/장르/architecture/costume), **P2 acceptable**.
- `scene_detail/9.../system.md:317-318` `C03O05 wearing a bright orange heavy-duty waterproof fisherman jumper...` — anti-pattern (과잉 묘사) 예시로 의도. 다소 구체적이나 `scene_detail` 본체 — hygiene v1 boundary 외.
- `location_floor_plan/3.../system.md:31` 한국어 scene heading example (`"옥탑방 안 / 실내", "한옥 / 안방 / 마루"`) — generic instruction context, fix 권장 X.

## 8. 추가 발견 (시나리오/도메인 외) — P2 등급, fix 권고 X

- **ADD-1**: `scene_generator/v2/scene_rules_ko.md:5-6` — P2 (generic rule)
- **ADD-2**: `lvm_prompts/2.../style_rules_generator.md:5, :7-9` — P2 (enum example)
- **ADD-3**: `scene_generator/v2/style_rules_generator.md:5, :7, :9` — P2 (enum example)
- **ADD-4**: `scene_detail/9.../system.md:317-318` — P2 (anti-pattern 의도, hygiene v1 boundary 외)
- **ADD-5**: `location_floor_plan/3.../system.md:31` — P2 (generic instruction)

ADD-6 ~ ADD-11 = §6 도메인 분산 신규 발견 (P1, 별도 area carry).

## 9. Codex Absorption Mapping + 정정

| Codex 항목 | 본 audit row | 검증 결과 |
|---|---|---|
| P0-1 (`entity_extraction/v7/chunk_system.md:24`) | P-1 | confirm |
| P0-2 (`scene_extractor_v2/.../system.md:59-60`) | P-2 | confirm — Codex `:59-60` range = rule header (59) + 예시 (60). 본 audit P-2 = line 60. |
| P0-3 (`scene_extractor_v2/.../system.md:63`, `turn_scene_detail.md:108`) | P-3 / P-3b | confirm |
| P1-1 (`turn_scene_detail.md:83-85`) | P-4 | confirm |
| P1-2 (`t2i_visual_converter/v3/system.md:19`) | P-5 | confirm |
| P1-3 (`t2i_review/.../scene_system.md:45-47, :61-63, :69-78, :87-90`) | P-6 | confirm — 본 audit P-6 = line 45-78 통합. line :87-90 (target/suggestion 규칙 본체) 는 LLM-side 영역 (`03-`) 으로 위임. |
| §6 (5 distributed sites) | D-1~D-5 + ADD-6~ADD-11 | **보강** — Codex 5 site 외 6 site 추가 발견 (총 11). |
| §6 outlook_extractor `humanoid monster, vampire, zombie` (Codex 인용 `phase1.md:24`) | D-4 (정정) | **Codex 인용 오류** — phase1.md 는 line 19 까지 존재. line 24 없음. 실제 도메인 분산은 phase1.md:16 (`메카, 파워드슈트, 강화복, 갑옷 로봇`) + phase2.md:8 (`원격접속/빙의`). **본 audit 정정**. |

## 10. Boundary Notes

- LLM-side classifier instruction (`shot_director/system.md:29-49` gaze/framing/blocking, `scene_detail_owned_judge/system.md:18-61` redraw verb whitelist, `t2i_review/scene_system.md:31-91` phrase detection + target/suggestion mutation) → `03-llm-side-heuristic-audit.md`. 본 audit 의 P-6 예시 텍스트만 hygiene scope (LLM-side redesign 별도).
- code regex / `.replace()` / token mutation (`t2i_review.py:383-403, :407-451` blind substring) → `01-code-side-regex-audit.md` #10.
- **변신/빙의 visual_world_rules SOT 일원화 = Hygiene v1 boundary 외** (사용자 명시). D-1~D-5 + ADD-6~ADD-11 모두 별도 area carry — `area-vwr-sot-unification` 으로 추적 (cost: medium-large).

## 11. visual_world_rules SOT 일원화 별도 area 명세

### 11.1 현재 SOT

- **`visual_world_rules/6.202605021400/system.md:51`** — 10개 enum (`possession, transformation, ghost, projection, superpower, body_deformation, time_period, costume, technology, other`).
- **`visual_world_rules/6.202605021400/rules_schema.json:9`** — enum description 6개 (`possession, transformation, ghost, time_period, costume, technology`). **`projection / superpower / body_deformation / other` 누락**.
- **drift fix**: 별도 area 진입 시 schema 동시 정렬 (P1 / small).

### 11.2 분산 site (11)

| # | site | line | 자체 list 인용 | Status |
|---|---|---|---|---|
| 1 | `entity_all/.../character.md` | 26-30 | 인간↔요괴 / 인간↔괴물 / 본체↔변신체 / 빙의/합체 / 이무기 / 구미호 / 요괴화 / 뱀파이어 | **closed (Area #7b, 2026-05-19+)** |
| 2 | `entity_character_list/.../system.md` | 10 | 인간 / 요괴 / 동물 / 로봇 / 외계인 | **D-2 carve-out (변경 0 boundary preserve, Area #7b 2026-05-19+)** |
| 3 | `entity_relation/.../system.md` | 11-13, 30 | 요괴/괴물 형태 / 유령/망령 형태 / 갑옷 착용 형태 | **closed (Area #7b, 2026-05-19+)** |
| 4 | `outlook_extractor/.../phase1.md` | 16 | 메카 / 파워드슈트 / 강화복 / 갑옷 로봇 | **closed (Area #7b, 2026-05-19+)** |
| 5 | `outlook_extractor/.../phase2.md` | 8 | 원격접속/빙의 | **closed (Area #7b, 2026-05-19+)** |
| 6 | `entity_extractor_v2/.../system.md` | 22, 32 | 평상복 → 전신 갑옷 / ### 빙의/정신 전환/몸을 빌리는 설정 | **closed (Area #7b, 2026-05-19+)** |
| 7 | `entity_extractor_v2/.../turn0_style.md` | 13 | 원격 접속/조종/빙의/텔레파시 | **closed (Area #7b, 2026-05-19+)** |
| 8 | `scene_director/.../system.md` | 8, 24, 34 | 영상통화 / CCTV / 방송 화면 / 홀로그램 / VR / 원격 조종/빙의 / 빙의/원격접속 / 빙의/원격/V.O. | **closed (Area #7a, 2026-05-19, push `d0410eb`)** |
| 9 | `scene_verify/.../system.md` | 7 | 빙의/영혼 상태 | **closed (Area #7b, 2026-05-19+)** |
| 10 | `scene_detail/.../system.md` | 327 (line drift → 473 current latest) | 원격 조종/접속 | **closed (Area #7b, 2026-05-19+)** |
| 11 | `shot_extract/.../user.md` | 33 (line drift → 49 current latest) | 빙의로 얼굴이 바뀜 | **closed (Area #7b, 2026-05-19+)** |

### 11.3 일원화 방향

분산 site 자체 list 를 reference 한 줄로 교체:
```
본 prompt 의 변신/빙의/원격접속 판단 기준은 visual_world_rules.rules[] 의 rule_type ∈ {possession, transformation, ghost, projection, superpower, body_deformation} 을 따른다. 작품에 해당 rule_type rule 이 정의되어 있지 않으면 일반 인물로 처리.
```

**보존**:
- 한국 fantasy/supernatural 처리 능력 — visual_world_rules SOT 에서 rule 정의 능력 유지.
- D-2 의 generic 분류 (인간/요괴/동물/로봇/외계인) 는 그 자체로 유효 generic example — 사용자 명시 시 P2.

**제거**:
- 도메인-specific Korean fantasy term (`구미호 / 이무기 / 망령 / 요괴화 / 갑옷 로봇`) — 분산 site 에서 제거.

**Carry-A099 reference (2026-05-19+)**: 본 §11.3 일원화 방향 (rule_type ∈ {possession, transformation, ghost, projection, superpower, body_deformation} reference clause) 는 system.md line 51 canonical 10-token list 관련. system.md `director_notes` section (line 57-80, A099 영역) 별도 prose redesign 영역 — Carry-A099 resolved by W1/W2 + W3 closure-docs (W1 `d1ca603` + W2 `d1d32dd` + W2 fix-up 1 `25a0830` + W3 closure-docs wave; director_notes prose 안 5+4 hard-prime examples abstracted, R1-R9 9 strict residue 0, canonical process wording EN+KR pair 도입). 본 §11.3 reference clause 와 무관.

**Carry-A100 reference (2026-05-19+)**: 본 §11.3 일원화 방향 (rule_type ∈ ... reference clause) 는 system.md line 51 canonical 10-token list 관련. system.md `t2i_context` section (line 98-114, A100 영역) + `rules_schema.json:40` description 별도 demonym redesign 영역 — Carry-A100 resolved by W1-W4 + W4 closure-docs (W1 test compat historical pin + W2 v9 producer prompt-pack `9.202605191334` + W3 integrated test 7 Gate + W4 closure-docs wave; line 102 literal angle-bracket placeholder + 예시 form 완전 제거 + outlook/evidence-first wording lift, R1-R5 5 strict residue 0, carrier shape preserve = type:string + required + additionalProperties false, STEP_MANIFEST schema_version=1 preserve). 본 §11.3 reference clause 와 무관.

### 11.4 Fix Cost

- 11 prompt 새 버전 dir + `version_registry` sync + schema_version bump consideration (medium-large).
- DB row 영향 (Subagent D 위임 — `04-`): 11 module 중 1개 (`entity_character_list`) 만 `db=`-aware caller. 다른 10개는 file fallback. file 새 dir 만들면 active.
- code 상수 pin 영향: 11 module 중 0개 — load-time pin 없음 (`04-` §4 grep 결과).

### 11.5 Hygiene v1 boundary

- 본 area 는 Hygiene v1 (P-2 ~ P-6 active prompt hygiene fix, 즉 3 active P0 + 3 P1; P-1 = orphan 별도 cleanup area, 2026-05-15 follow-up 결정) 와 **별도 schedule**.
- 사용자 명시: "한 번에 다 고치지 말 것 — scope 폭발 위험". Hygiene v1 즉시 + visual_world_rules SOT 일원화 별도 area.
- 진입 순서: Hygiene v1 → framing_scale enum SOT (code-side first impl) → visual_world_rules SOT 일원화 → 그 외 area.

## 12. Area #7a v1 Closure (2026-05-19+)

**Status**: visual_world_rules SOT 일원화 area = **Sub-A (Area #7a) closed**. Spec `docs/superpowers/specs/2026-05-18-area-7a-visual-world-rules-sot-v1-design.md` (status: closed). Roadmap `§5.7` Sub-area (b) closed mark.

**Wave commits** (5 atomic, W1-W3c):
- W1 `54fe057` — VWR v7 producer atomic (rules_schema.json + system.md + step_manifest.schema_version=1).
- W2 `b2765a7` — scene_director v9 consumer atomic (A047 3 site principle-only).
- W3a `e6c0f0f` — residue gate test (4 strict + sanity).
- W3b `50cb85b` — canary test (5 항목, no live LLM).
- W3c `0a2e2b4` — closure cleanup.

**In-scope closed (4 finding A047/A096/A097/A098, audit row 매핑)**:

| Finding | 본 audit row | Site |
|---|---|---|
| **A047** (scene_director A047 3 site) | **ADD-7** (line 176) + §11.2 site 8 (line 251) | `scene_director/.../system.md:8, :24, :34` — v9 principle-only rewrite (`9.202605181550/system.md`) |
| **A096** (rules_schema rule_type enum 미강제 + description 6-token drift) | line 184-189 "visual_world_rules 자체 schema description drift" section + §11.1 line 237 | `visual_world_rules/.../rules_schema.json:9` — v7 enum strict 10-token (`7.202605181540/rules_schema.json`) |
| **A097** (rules_schema director_notes description small fix) | §11.1 line 236-238 boundary 안 | `visual_world_rules/.../rules_schema.json` director_notes description abstraction |
| **A098** (system.md:51 rule_type 10-token list 보존 + drift 0) | **D-5** (line 167) + §11.1 line 236 | `visual_world_rules/.../system.md:51` — v7 10-token list 정합 (`7.202605181540/system.md`) |

**Carry (non-claim, follow-up area)**:

| Carry | 본 audit row | Follow-up area |
|---|---|---|
| **A099** (system.md director_notes prose redesign) | §11.1 line 236 boundary 외 | Carry-A099 resolved by W1/W2 + W3 closure-docs (2026-05-19+) — director_notes prose hard-prime examples abstracted |
| **A100** (system.md t2i_context demonym redesign) | §11.1 line 236 boundary 외 | Carry-A100 resolved by W1-W4 + W4 closure-docs (2026-05-19+) — V8+ VWR t2i_context demonym redesign + rules_schema.json:40 description abstraction (v9 prompt-pack `9.202605191334`) |
| 11-site VWR downstream cascade (D-1 ~ D-4 + ADD-6, ADD-8 ~ ADD-11) | §11.2 line 240-254 (site 1-7, 9-11 = ADD-7 제외) | **Area #7b** (11-site VWR downstream prompt cascade) |
| t2i_review placeholder example abstraction | (별도 audit 영역) | **Area #7c** (t2i_review v6 placeholder) |
| cinematography closed-list SOT dual-site | (별도 audit 영역) | **Area #7d** (variation_recommender + scene_extractor_v2 turn_scene_detail) |
| scene_consistency 7 enumeration broad (source unresolved) | (별도 audit 영역) | **Carry-P021** — Status: closed by Carry-P021 (2026-05-20+) |

**Closure verdict** (Codex iter 2 Q7 verbatim):

> "Area #7a closes when visual_world_rules v7 is the structured SOT for physical-presence/visual-world rule_type via 10-value schema enum + synchronized system instruction, scene_director v9 no longer teaches A047 scenario-specific exclusion lists and instead uses VWR rules/director_notes as the upstream principle source, active prompt/schema residue gates pass, canary validates rule_type enum enforcement and scene_director prompt residue, and no VLM validation is used."

**NO VLM hard constraint** — 모든 canary + residue gate = schema/text/manifest verification only.

## 13. Area #7b Closure (2026-05-19+)

**Status**: closed (W6 commit `c92d460` path-limited 3 repo-local docs; range review/push gate pending → Codex APPROVED_FOR_PUSH 후 즉시 `git push origin main`, [[feedback_push_no_user_ask]] 정합).

**Wave commits** (W1-W6, W6 closure commit `c92d460` through W6 = 26 commits since `d0410eb`; 후속 range-review fix-up commits 가능 — final pushed range/count recorded in external memory after push, infinite self-reference 회피):

| Wave | Commit(s) | Scope |
|---|---|---|
| spec drafting | `9c1f7d6` v1 + `feeb3b5` amend 1 + `dc07ea7` amend 2 + `8fafd03` amend 3 + `90a8cea` amend 4 | spec v1 + Codex iter 1-7 흡수 → APPROVED_FOR_PLAN |
| plan drafting | `1f79d7c` v1 + `e39db38` amend 1 + `e853606` amend 2 | plan v1 + Codex iter 0/1/2 |
| plan amend stack (date + W1) | `479dcf8` + `5601005` + `ac22594` + `1fb1e57` | UTC date drift + W1 S2.4 inventory OPTION_C + W1 review prompt §4 + Codex verbatim |
| W1 execution | `95688d9` + `9967993` | Group E entity_all + entity_relation + entity_extractor_v2 atomic (5 site / 4 modified file / 17 sibling) + plan amend 7 + spec amend 6 narrow `_list_module_versions` API sync |
| W2 execution + narrow stack | `50f15f0` + `55c30b9` + `b31de67` + `2bd4a40` | Group O outlook_extractor atomic (2 site + line 24 / 2 modified file / 4 sibling) + plan amend 8-10 + spec amend 7-9 narrow scene_detail 4-point sync exemption (Codex OPTION_A 3-phase narrow expansion singular → plural 2 → plural 5 files) |
| W3 execution + fix-up | `5060254` + `75d4f3a` + `403c5ef` | Group S scene_verify + scene_detail + shot_extract atomic (3 site / 3 modified file / 3 sibling, line drift 327→473 / 33→49) + fix-up 1 narrow alignment tests 2 files current-contract docstring + fix-up 2 narrow spatial_alignment.py loader docstring v26→v27 sync |
| W4 execution + fix-up | `313f1b6` + `844cde9` | Residue gate test 21 PASS (Gate 1.1-1.9 + Gate 2 + Gate 3 + Gate 4 + Sanity) + fix-up 1 narrow Gate 1.1 `빙의/합체` standalone → full legacy phrase form sync |
| W5 execution + fix-up | `531e67f` + `fe7e55e` | Canary test 44 PASS (C1 7 + C2 24 + C3 1 + C4 1 + C5 2 + C6 9, no live LLM + NO VLM) + fix-up 1 narrow Option B C3 "snapshot diff 0" → "12 affected step entry presence verify" wording + function rename |
| W6 closure (closure commit anchor) | `c92d460` | spec status closed + spec §5.6 C3 wording sync (W5 fix-up 1 narrow cascade) + spec §11 Closure section + roadmap §5.7 Sub-area (b) Phase 2 mark + 본 §13 + 본 §11.2 row 11 Status column (path-limited 3 repo-local docs) |

**Scope** = §11.2 row 9 site closed mapping (row 1+3+4+5+6+7+9+10+11):

| §11.2 row | Module / new dir / file | Action |
|---|---|---|
| 1 (D-1) | `entity_all/5.20260518HHMM/character.md` | line 26+29+30 audit-verbatim 8 phrase 폐기 + canonical VWR SOT clause |
| 3 (D-3) | `entity_relation/3.20260518HHMM/system.md` | line 11-13 audit-verbatim 3 + line 30 current-active-promoted 1 phrase 폐기 + canonical clause |
| 6 (D-4) | `entity_extractor_v2/10.20260518HHMM/system.md` | line 22 + 32 audit-verbatim 2 phrase 폐기 + canonical clause + section header rewrite |
| 7 (ADD-6) | `entity_extractor_v2/10.20260518HHMM/turn0_style.md` | line 13 audit-verbatim 1 phrase 폐기 + canonical clause |
| 4 (ADD-8) | `outlook_extractor/12.20260518HHMM/phase1.md` | line 16 audit-verbatim + line 24 current-active-promoted 2 phrase 폐기 + canonical clause |
| 5 (ADD-9) | `outlook_extractor/12.20260518HHMM/phase2.md` | line 8 audit-verbatim 1 phrase 폐기 + canonical clause |
| 9 (ADD-10) | `scene_verify/2.20260518HHMM/system.md` | line 7 audit-verbatim 1 full sentence 폐기 + canonical clause |
| 10 (ADD-11) | `scene_detail/27.20260518HHMM/system.md` | line 473 audit-verbatim 1 full sentence 폐기 + canonical clause (line drift 327 → 473) |
| 11 | `shot_extract/12.20260518HHMM/user.md` | line 49 audit-verbatim 1 parenthetical 폐기 + canonical clause (line drift 33 → 49) |

**D-2 carve-out**: `entity_character_list/2.202605011057/system.md` (row 2) = **변경 0 boundary preserve**. owner taxonomy 5-element 분류 = 인물 정의 boundary, presence/visibility 결정 X. sha256 anchor `4ca95ca996a5e1d649e92c9baf8963654a5f89537a794ab6ec04e86ce9971713` (W4 Gate 3 + W5 C5 hardcoded compare primary check, byte-identical preserve verify).

**Area #7a boundary** (row 8 scene_director, closed 2026-05-19 commit `d0410eb`): 변경 0 (선행 phase 정합).

**Canonical numbers** (Codex iter 4 F-2 흡수 + Plan canonical Codex iter 1/2 F-1 reconciliation): 7 new prompt dirs + 9 modified prompt files + 24 byte-identical sibling files + **12 affected STEP_MANIFEST entries** (= 10 modified-file-bound step entries + 2 sibling-only shared-module entries `entity_all_location` / `entity_all_prop`; spec wording "10 STEP_MANIFEST entries" = modified-file-bound count metric, execution test contract = 12 entry presence).

**4-Gate Boundary Doctrine 적용 inline** (사용자 격분 흡수 2026-05-19): closed-world exact residue phrase contract (fixed-string / glyph-exact membership, audit-verbatim + current-active-promoted inventory split, source path + line + classification anchored, Generic Korean standalone ban 0). Gate (1) Semantic Regex Ban / Gate (2) Prompt Closed-List Ban (full-phrase ban only, generic Korean standalone heading exempt) / Gate (3) Structured SOT Required / Gate (4) No Silent Fallback. [[feedback_llm_based_judgment]] 정합.

**W4 + W5 fix-up history** (Codex per-wave narrow re-review 흡수):
- W4 fix-up 1 narrow (`844cde9`): Gate 1.1 line 106 `"빙의/합체"` standalone → `"빙의/합체: 다른 존재가 몸을 빌리거나 합체하여 외형이 변하는 경우"` full legacy phrase form sync (7 ins / 2 del). Generic Korean standalone ban 0 doctrine + Gate 2 (Prompt Closed-List Ban refined as full-phrase ban only) 정합.
- W5 fix-up 1 narrow (`fe7e55e`): C3 wording sync "snapshot diff 0" → "12 affected step entry presence verify" + function rename `test_c3_step_manifest_snapshot_diff_zero` → `test_c3_step_manifest_entry_presence_verify` + section header + docstring sync (9 ins / 6 del). entry-existence contract + schema_version drift = C4 별도 (snapshot field-level diff 0 scope 외).

**W3 narrow exemption history** (scene_detail 4-point sync hard-pinned guard, Codex amend 8 + amend 9 + amend 10 OPTION_A expanded 흡수, W2-W3 narrow stack `55c30b9` + `b31de67` + `2bd4a40`): scene_detail 4-point sync narrow exemption inside W3 atomic boundary — `detail_steps.py:106` SCENE_DETAIL_PROMPT_VERSION + `version_registry.py:34`/`:126` MODULE_VERSIONS/_MODULE_INFO + scene_detail-pinned tests 5 files (continuity_alignment + spatial_alignment + prompt_versions + g4_5a_spatial_integration + area_5_residue_gate, 14+ assertion + 3 function rename) + `SCENE_DETAIL_SCHEMA_VERSION == 11` 보존. 다른 module production code 변경 0 doctrine 유지.

**Closure verdict** (Q7 verbatim, handoff session 안 Codex 2-round APPROVED, fixed):

> Area #7b closes when the VWR downstream prompt cascade is converted from prompt-owned scenario/domain term lists to canonical visual_world_rules.rules[].rule_type SOT references across the rewritten entity/outlook/scene prompt sites; entity_character_list D-2 remains explicitly preserved as a generic owner-taxonomy boundary; active prompt residue gates verify site-specific exact residue phrases 0 (fixed-string / glyph-exact membership, audit-verbatim + current-active-promoted inventory split, no semantic judgment) and canonical VWR SOT references present in every rewritten site; canaries verify prompt_loader latest activation, STEP_MANIFEST schema_version unchanged, DB override risk neutralized, and no VLM validation is used.

**NO VLM hard constraint** — residue gate (W4) + canary (W5) 모두 schema/text/manifest verification only (jsonschema + path glob + sha256 + STEP_MANIFEST struct + str.__contains__ only). VLM 의존 0 ([[feedback_no_vlm_dependency]] 정합).

**Carry follow-up** (non-claim, separate area):
- **Area #7c** (t2i_review v6 placeholder example abstraction — Track B Tier 3 #3 후속).
- **Area #7d** (cinematography closed-list SOT dual-site — Track B Tier 3 #4 후속).
- **Carry-A099** resolved by W1/W2 + W3 closure-docs (2026-05-19+) — director_notes prose hard-prime examples abstracted.
- **Carry-A100** resolved by W1-W4 + W4 closure-docs (2026-05-19+) — V8+ VWR `system.md` t2i_context demonym redesign + `rules_schema.json:40` description abstraction (v9 prompt-pack `9.202605191334`).
- **Carry-P021** resolved by W1-W4 (2026-05-20+) — scene_consistency v7 system.md hard-prime examples abstracted (v8 prompt-pack `8.202605191744`).

## 14. Area #7c Closure (2026-05-19+)

**Status**: closed at W3 closure commit anchor `600993b` (path-limited 3 repo-local docs; W1-W3 range review/push gate pending → Codex APPROVED_FOR_PUSH 후 즉시 `git push origin main`, [[feedback_push_no_user_ask]] 정합). Final pushed range/count = recorded in external memory only after push (live closure docs 안 push-complete pre-claim 0, TEMPLATE ONLY doctrine 정합).

**Wave commits** (W3 closure commit `600993b` — W1-W3 atomic 3 wave commit + spec drafting 2 commit + plan drafting 2 commit = 7 commits total in range `e751e72..600993b`; 후속 range-review fix-up commits 가능 — final pushed range/count recorded in external memory after push):

| Wave | Commit | Scope |
|---|---|---|
| spec drafting | `5118e5e` v1 + `1032dbc` amend 1 | spec v1 + Codex iter 0-3 흡수 + iter 4 NEEDS_REVISION_MINOR 흡수 → iter 5 APPROVED_FOR_PLAN |
| plan drafting | `1d41801` v1 + `3bf7c22` amend 1 | plan v1 + Codex plan iter 0 APPROVED_FOR_PLAN_V1_DRAFT + iter 1 NEEDS_REVISION_MINOR 흡수 → iter 2 APPROVED_FOR_EXECUTION |
| W1 execution | `426d959` | Producer atomic — `prompts/_base/t2i_review/7.202605190201/` 4 file (2 prompt modified + 2 schema byte-identical sibling) + 7 strict residue + 1 keep-abstract = 8 site replacement (spec §2 Codex iter 2 verbatim wording) + 249 ins / 0 del |
| W2 execution | `df751dd` | Integrated test atomic — `backend/tests/integration/test_area_7c_t2i_review_placeholder_hygiene.py` 205 line 5 verify gate (residue 7 strict + schema sibling sha256 2 + load_prompt/load_schema 4 stem + STEP_MANIFEST schema_version preservation + `_resolve_stem_in_pack` 4 stem v7 source-path proof) 14 PASS in 0.12s, no live LLM + NO VLM + no regex semantic + 205 ins / 0 del |
| W3 closure | `600993b` (+ 후속 range-review fix-up commits 가능) | spec status closed + spec §11 Closure section append + roadmap §5.7 Sub-area (b) Phase 2 직후 Area #7c follow-up bullet append + 본 §14 Area #7c Closure section + §5 P-6 row Status marker (path-limited 3 repo-local docs / +128/-9 line) |

**Scope** = §5 P-6 row owner. 8 site replacement in `scene_system.md` + `entity_system.md`:

| file:line | replacement surface | legacy phrase (v6) | residue gate? | result |
|---|---|---|---|---|
| `scene_system.md:31` | body-part cue | `subject's hands` | strict residue | 0 count (W2 PASS) |
| `scene_system.md:32` | body-part cue | `feet visible at lower frame edge with floor below` | strict residue | 0 count (W2 PASS) |
| `scene_system.md:33` | body-part cue | `full silhouette including head and feet visible` | strict residue | 0 count (W2 PASS) |
| `scene_system.md:39` | action cue | `sits hunched in the left background` | strict residue | 0 count (W2 PASS) |
| `scene_system.md:40` | action+object cue | `a hand reaching from the right edge holding a small object` | strict residue | 0 count (W2 PASS) |
| `scene_system.md:60-61` | hint_diagnostic illustration | (이미 abstract; v6 wording) | not strict residue target | keep concept (Codex iter 2 verbatim) |
| `entity_system.md:33` | role cue | `'security guard'` | strict residue | 0 count (W2 PASS) |
| `entity_system.md:34` | demonym cue | `Asian / Korean 인종 형용사` | strict residue | 0 count (W2 PASS) |

**Strict residue catalog result**: 7 entry exact legacy phrase substring membership check — new v7 dir `prompts/_base/t2i_review/7.202605190201/` 안 0 strict count (closed-world membership only, no regex semantic, standalone word ban prohibition; scene 60-61 = not strict residue target, keep concept).

**STEP_MANIFEST single-entry preservation**: `STEP_MANIFEST["t2i_review"].schema_version == 1` 보존 (Area #7c content-only, 변경 0). 4 stem `scene_system / scene_schema / entity_system / entity_schema` `load_prompt` / `load_schema` API 모두 v7 dir resolve (W2 source-path proof `_resolve_stem_in_pack` 4 stem v7 — v6/v7 schema byte-identical blind spot 보완).

**Boundary preserve** (Area #6 + Area #7a + Area #7b boundaries):
- **Area #6 closed boundary**: target.replace mutation 폐기 + 5 core fields structured diagnostic (id / scope / issue_code / action / hint_diagnostic) + alias contract (id == item_id == short_id, mismatch `t2i_review.diagnostic_alias_mismatch` AppError) 보존. 본 area = v6 prompt-pack content-only example abstraction, producer/consumer/schema shape 변경 0.
- **v6 dir `6.202605181200/` 변경 0**: Area #6 prompt-pack 보존, v7 새 dir 으로 분리.
- **Area #7a boundary** (VWR SOT v1, push `d0410eb`): VWR v7 schema + scene_director v9 A047 흡수 본 area 영향 0.
- **Area #7b boundary** (VWR Downstream Cascade v1, 9 site cascade + D-2 carve-out): 본 area 영향 0.
- **Carry-A100 resolved by W1-W4** (2026-05-19+, V8+ VWR `system.md` t2i_context demonym redesign + `rules_schema.json:40` description abstraction, v9 prompt-pack `9.202605191334`): Area #7c 안 `Asian/Korean` example abstraction = t2i_review v6 prompt-pack 예시 hard-prime 제거 only, A100 cross-cut X 보존.
- **§11.2 row 추가 X** (Codex spec iter 2/3 정합): Area #7c 는 §5 P-6 row owner, §11.2 VWR downstream cascade row 아님.

**4-Gate Boundary Doctrine + closed-world exact residue contract** (사용자 격분 흡수 [[feedback_llm_based_judgment]] 정합):
- **Gate (1) Semantic Regex Ban**: W2 residue gate code 안 시나리오 의존 regex 0 (`import re` ban grep PASS). substring membership check only.
- **Gate (2) Prompt Closed-List Ban**: prompt 안 LLM-instruction closed-list 변경 0 (Area #6 mutation redesign closed boundary 정합, scope 외).
- **Gate (3) Structured SOT Required**: t2i_review v6 producer 5 core fields + alias contract 보존 (Area #6 closed).
- **Gate (4) No Silent Fallback**: 예시 generic placeholder 사용해도 LLM emit fail-fast 보존 (alias mismatch + schema required field 강제).

**TEMPLATE ONLY doctrine** (Codex Q0-light Q4 verbatim 흡수): controller-substitute targets only, not live closure claims; HISTORICAL AUDIT TRAIL marker on plan template historical block; live closure unresolved placeholder ban + push-complete pre-claim ban; final pushed range/count = external memory only.

**NO VLM hard constraint** — W2 5 verify gate 모두 schema/text/manifest verification only (sha256 byte-identical + STEP_MANIFEST struct + str.__contains__ substring + `_resolve_stem_in_pack` path glob). VLM 의존 0 ([[feedback_no_vlm_dependency]] 정합).

**Carry follow-up** (non-claim, separate area):
- **Area #7d** (cinematography closed-list SOT dual-site `variation_recommender/v2/system.md` + `scene_extractor_v2/19.*/turn_scene_detail.md:87-91` — Track B Tier 3 #4).
- **Carry-A099** resolved by W1/W2 + W3 closure-docs (2026-05-19+) — director_notes prose hard-prime examples abstracted.
- **Carry-A100** resolved by W1-W4 + W4 closure-docs (2026-05-19+) — V8+ VWR `system.md` t2i_context demonym redesign + `rules_schema.json:40` description abstraction (v9 prompt-pack `9.202605191334`).
- **Carry-P021** resolved by W1-W4 (2026-05-20+) — scene_consistency v7 system.md hard-prime examples abstracted (v8 prompt-pack `8.202605191744`).

## 15. Carry-A100 Closure (2026-05-19+)

**Status**: closed at W4 closure-docs commit (Carry-A100 V8+ VWR `system.md` t2i_context demonym redesign + `rules_schema.json:40` description abstraction; v9 prompt-pack `prompts/_base/visual_world_rules/9.202605191334/` 신설). Final pushed range/count = external memory only after push (live closure docs 안 push-complete pre-claim 0, [[feedback_push_no_user_ask]] 정합).

**Wave commits** (W1-W4 atomic 4 wave commit + spec drafting + plan drafting untracked; W4 closure commit 시점 push 보류 → Codex APPROVED_FOR_PUSH 후 즉시 `git push origin main`, exact hash recorded by git log/range review):

| Wave | Scope |
|---|---|
| W1 execution | Carry-A099 test compat atomic — `backend/tests/integration/test_carry_a099_director_notes_abstraction.py` historical v8 pin (`VWR_V8_DIR = REPO_ROOT / "prompts/_base/visual_world_rules/8.202605191102"` constant) + `_v8_dir()` active resolution → literal pin refactor + unused import 제거 + `test_gate_6_v8_active_source_path_proof` → `test_gate_6_v8_historical_closure_anchor_proof` rename + body refactor. 33 PASS (A099 6 + Area #7a inherited 18 + visual_context_helper 9 direct consumer). |
| W2 execution | v9 producer prompt-pack atomic — `prompts/_base/visual_world_rules/9.202605191334/` 2 file 신설 (`system.md` line 102 narrow + `rules_schema.json:40` description-only narrow). literal angle-bracket placeholder + 예시 form 완전 제거 + Korean phrase abstract lift + outlook/evidence-first wording. director_notes section line 57-84 byte-equal preserve from v8 (Carry-A099 boundary canary). Carrier shape preserve = `type:string` + `required` list + `additionalProperties false`. STEP_MANIFEST `schema_version=1` preserve. |
| W3 execution | A100 integrated test atomic — `backend/tests/integration/test_carry_a100_t2i_context_demonym_abstraction.py` 신규 7 Gate G1-G7 (active prompt-pack v9 source-path proof / file count 2 / R1-R5 strict residue absence / new abstract wording presence / carrier shape 3-point preserve / STEP_MANIFEST=1 preserve / director_notes section byte-equal canary). Marker-wrapped R1_R5_STRICT constants (closed-world test constants only). 40 PASS (W3 7 + A099 6 + Area #7a inherited 18 + visual_context_helper 9). |
| W4 closure | Closure docs atomic (path-limited 7 repo-local docs / 8 logical edit sites: Carry-A100 spec frontmatter status closed + spec §10 in-place REPLACE + Carry-A100 plan frontmatter status closed + roadmap §5.7 narrow append + 본 audit §11.3 Carry-A100 reference + §13/§14 Carry-A100 carry-status update + line 311 A100 row Status update + 본 §15 신설 + Area #7a spec narrow + Area #7b spec narrow + Carry-A099 spec carry table narrow). No W4 self-hash literal in commit body (TEMPLATE ONLY doctrine + post-Carry-D7d-1 fix-up 1 + post-Carry-A099 N-5 정합). |

**Scope** = §11.1 line 236 boundary 외 (A100 row). 5 strict residue catalog R1-R5 (closed-world full-phrase membership only) — R1 literal angle-bracket placeholder + R2 default-coerce example form + R3 ethnicity-nationality conflation Korean lead + R4 single-region 가정 Korean clause (모두 `system.md:102`) + R5 schema description Korean phrase (`rules_schema.json:40`). 0 strict count in v9 prompt-pack producer surface.

**Boundary preserve** (Area #7a + Area #7b + Area #7c + Area #7d + Carry-D7d-1 + Carry-A099 boundaries):
- **Area #7a closed boundary** (push `d0410eb`): VWR producer SOT v7 schema + scene_director v9 A047 흡수 본 carry 영향 0.
- **Area #7b closed boundary** (push `e751e72`): VWR downstream cascade 11-site 본 carry 영향 0.
- **Area #7c closed boundary** (push `62aa2ef`): t2i_review v6→v7 placeholder example abstraction, A100 cross-cut X.
- **Area #7d closed boundary** (push `b9c610e`): cinematography closed-list SOT dual-site 본 carry 영향 0.
- **Carry-D7d-1 closed boundary** (push `05d5265`): scene_detail v28 description align 본 carry 영향 0.
- **Carry-A099 closed boundary** (push `146401c`): director_notes prose redesign V8 본 carry 영향 0 — `system.md` director_notes section (line 57-84 v8) 변경 0, v8 prompt-pack anchor preserve.
- **8 direct reader** (`visual_context_helper.py` / `entity_steps.py` / `beat_shot_steps.py` / `detail_steps.py` / `outlook_steps.py` / `t2i_review.py` / `shot_staging.py` + test fixtures) 변경 0.
- **STEP_MANIFEST** `visual_world_rules.schema_version=1` 변경 0 (shape unchanged 조건 정합).

**4-Gate Boundary Doctrine + closed-world exact residue contract** ([[feedback_llm_based_judgment]] 정합):
- **Gate 1 Semantic Regex Ban**: W3 residue gate code 안 시나리오 의존 regex 0 (Python `in` operator + `assert not in`). substring membership check only.
- **Gate 2 Prompt Closed-List Ban refined full-phrase only**: residue contract = exact 5-item full-phrase from `system.md:102` + `rules_schema.json:40` only. Standalone token global ban X (`demonym` / `nationality` / `ethnicity` / `국적` / `인종` / `region` natural use 보존).
- **Gate 3 Structured SOT Required**: v1 = abstraction of existing free-text carrier + schema description-only (partial remediation). Field-shape migration = Future Carry-A100-structured.
- **Gate 4 No Silent Fallback**: `t2i_context` field shape `string required additionalProperties false` preserve. 8 direct reader empty pass-through 패턴 preserve.

**TEMPLATE ONLY doctrine** (Codex Q0-light Q2 (a) + 2nd narrow re-review guard 2 + 3rd narrow re-review N-1 정합): literal angle-bracket placeholder 재방출 outside formal `<!-- HISTORICAL AUDIT TRAIL — BEGIN/END -->` marker blocks X. underscore-escape variant 도 live prompt 안 X. Spec §10 in-place REPLACE (heading 이미 존재; append X; pending placeholder 전체 replace). W4 commit body 안 self-hash literal 0.

**NO VLM hard constraint** — W1-W3 verify gates + W3 test 모두 schema/text/manifest verification only (jsonschema parse + path glob + sha256 byte-equal + STEP_MANIFEST struct + Python `in` operator). VLM 의존 0 ([[feedback_no_vlm_dependency]] 정합).

**Carry follow-up post Carry-A100** (non-claim, separate area):
- **Carry-P021** resolved by W1-W4 (2026-05-20+) — scene_consistency v7 system.md hard-prime examples abstracted (v8 prompt-pack `8.202605191744`); content-only abstraction + schema byte-identical + Area #4 producer code 변경 0.
- **Future Carry-A100-structured** (`t2i_context: string` → `object {default_demographic_policy, tone, genre}` field-shape migration) — major carry / future area follow-up.
- **Future Carry-A099-structured** (director_notes `array of string` → `array of object` 구조화 migration) — major area, separate.

## 16. Carry-P021 Closure (2026-05-20+)

**Status**: closed at W4 closure-docs commit (Carry-P021 scene_consistency v7 system.md hard-prime example abstraction; v8 prompt-pack `prompts/_base/scene_consistency/8.202605191744/` 신설). Final pushed range/count = external memory only after push (live closure docs 안 push-complete pre-claim 0, [[feedback_push_no_user_ask]] 정합).

**Scope** = **prompt-side hygiene only** (Carry-P021 v1 scope; Area #4 code-side classifier closure 별도 boundary, P021 part 아님). audit row source = system.md hard-prime example R1-R6 + JS1/JS2a/JS2b/JS3 (10 strict residue catalog, marker-wrapped single constant).

**Wave commits** (W1-W4 atomic 4 wave commit + spec drafting + plan drafting untracked; W4 closure commit 시점 push 보류 → Codex APPROVED_FOR_PUSH 후 즉시 `git push origin main`, exact hash recorded by git log/range review):

| Wave | Commit | Scope |
|---|---|---|
| W1 execution | `b03b65f` | test_prompt_versions.py historical cleanup atomic — `_scene_consistency_v7_dir()` → `_scene_consistency_v7_historical_dir()` function rename + body refactor (active glob 폐기 + literal pin `7.202605181210`) + 3 test rename + 3 helper 호출 site rename + body docstring rewording + line 10 comment narrow append. 1 file modify / 13 ins / 14 del / 17 pytest PASS. |
| W2 execution | `96834f0` | v8 producer prompt-pack + version_registry sync atomic — `prompts/_base/scene_consistency/8.202605191744/system.md` modified (line 13/14 R1+R2 + line 18 R3 + line 22 R4 + line 58 R5 + line 61 R6 narrow abstraction + line 89-110 JSON example block 전체 제거 + abstract schema skeleton 변환) + `schema.json` byte-identical copy from v7 (sha256 `d9ed6040dd6342f51452034703e6692503543c54349efcd990f22478dfca0a19` match). version_registry.py 3 logical edits (Site 1 MODULE_VERSIONS 2.5.0→2.6.0 + Site 2 prompt_dependency v7→v8 + Site 3 updated_at 2026-05-18→2026-05-20). 3 file / 170 ins / 3 del / 99 pytest bundle PASS. |
| W3 execution | `da700c8` | Carry-P021 integrated test atomic — `backend/tests/integration/test_carry_p021_scene_consistency_prompt_abstraction.py` 7 Gate G1-G7 (active v8 source-path proof / file count 2 / STRICT_RESIDUES 10-id absence / abstract wording presence / schema sha256 byte-identical / version_registry 3 sync + STEP_MANIFEST + SCENE_CONSISTENCY_SCHEMA_VERSION preserve / v7 historical canary). STRICT_RESIDUES single constant marker-wrapped HISTORICAL AUDIT TRAIL block. `import re` ban + no live LLM + NO VLM. 1 file new / 154 ins / 7 PASS in 0.16s + W3 regression bundle 106 PASS in 0.30s. |
| W4 closure | recorded by git log/range review after W4 + external memory only | Closure docs atomic (path-limited 5 repo-local docs): 본 spec frontmatter status closed + spec §12 in-place REPLACE (12.1 Status + 12.2 Wave Commit Table + 12.3 Gate Result + 12.4 Closure Verdict + 12.5 함정 신규 + 12.6 Carry Follow-up) + 본 plan frontmatter status closed + roadmap §5.7 narrow append (Carry-A100 carry-follow-up bullet 안 Carry-P021 closure narrow) + 본 audit §11.3/§13/§14/§15 Carry-P021 rows narrow + 본 §16 신설 + Area #4 v1 spec §1.5/§2.3/§3.2/§7.1/§10.2 narrow update. No W4 self-hash literal in commit body (TEMPLATE ONLY doctrine + post-Carry-D7d-1 fix-up 1 + post-Carry-A099 N-5 + post-Carry-A100 N-1 정합). |

**Allowed closure wording**:

> Carry-P021 resolved by W1-W4 — scene_consistency v7 system.md hard-prime example phrases (R1-R5) + demographic default instruction (R6) + JSON example block (JS1/JS2a/JS2b/JS3) were abstracted to remove closed-list semantic hard-prime examples while preserving the existing `fixed_elements` carrier contract. content-only abstraction, schema byte-identical, Area #4 producer code 변경 0, Future Carry-P021-structured deferred.

**Forbidden claims** (spec §10.2 정합):
- `scene_consistency structured SOT complete` (X — Future Carry-P021-structured deferred)
- `element_id opaque UUID migration complete` (X — Future)
- `element_type enum expansion complete` (X — Future)
- `Area #4 (Prompt Hygiene v2) closure complete` (X — Area #4 boundary preserve, P021 = prompt-side hygiene only)
- `all scene_consistency prompt hygiene risk fixed` (X — Tier 4 carry only)
- `field-shape migration complete` (X — Future)
- `JSON example structured schema generation complete` (X — Future)
- `Area #4 code-side closure complete (P021 part)` (X — Audit 02 안 Area #4 code-side claim 0, P021 scope = prompt-side hygiene only)

**Scope** = R1-R6 + JS1/JS2a/JS2b/JS3 narrow abstraction (10 strict residue catalog, exact full-phrase membership; closed-world fixed-string scan only, no semantic regex). 5 R + 1 demographic default policy + 5 JS sub-anchor exact wording absence in v8 system.md verified at W3 G3.

**Boundary preserve** (Area #4 + Area #7a + Area #7b + Area #7c + Area #7d + Carry-D7d-1 + Carry-A099 + Carry-A100 boundaries):
- **Area #4 closed boundary** (2026-05-18): scene_consistency element_scope SOT v1 producer code (`scene_consistency_step.py`) 변경 0. `SCENE_CONSISTENCY_SCHEMA_VERSION=3` + `STEP_MANIFEST["scene_consistency"]["schema_version"]=3` preserve. `element_scope` enum LLM emit SOT preserve. `_detect_framing_conflicts` enum 직접 read fail-fast preserve.
- **Area #7a closed boundary** (push `d0410eb`): VWR producer SOT v7 schema + scene_director v9 A047 흡수 본 carry 영향 0.
- **Area #7b closed boundary** (push `e751e72`): VWR downstream cascade 11-site 본 carry 영향 0.
- **Area #7c closed boundary** (push `62aa2ef`): t2i_review v6→v7 placeholder example abstraction 본 carry 영향 0.
- **Area #7d closed boundary** (push `b9c610e`): cinematography closed-list SOT dual-site 본 carry 영향 0.
- **Carry-D7d-1 closed boundary** (push `05d5265`): scene_detail v28 description align 본 carry 영향 0.
- **Carry-A099 closed boundary** (push `146401c`): director_notes prose redesign V8 본 carry 영향 0.
- **Carry-A100 closed boundary** (push `0f24492`): VWR system.md t2i_context demonym redesign V8+/V9 본 carry 영향 0.
- **STEP_MANIFEST** `scene_consistency.schema_version=3` 변경 0 (content-only abstraction, carrier schema byte-identical).

**4-Gate Boundary Doctrine + closed-world exact residue contract** ([[feedback_llm_based_judgment]] 정합):
- **Gate 1 Semantic Regex Ban**: W3 test code `import re` 0 (Carry-A099 Gate 1 lineage). Python `in` operator + `assert not in` substring membership only.
- **Gate 2 Prompt Closed-List Ban refined full-phrase only**: 10 strict R-id full-phrase ban (STRICT_RESIDUES marker-wrapped single constant). Standalone token global ban X (`East Asian` / `body_pose_canonical` / `character_state` / `인종` / `국적` / `상처` / `혈흔` natural use 보존 in abstract category descriptor).
- **Gate 3 Structured SOT Required (partial v1)**: v1 = scene_consistency v7→v8 prompt-pack content abstraction only (carrier `fixed_elements` schema preserve). Structured SOT completion claim X — Future Carry-P021-structured (field-shape migration) deferred.
- **Gate 4 No Silent Fallback**: Producer code `_detect_framing_conflicts` element_scope 직접 read + KeyError schema violation fail-fast preserve (Area #4 boundary). v8 prompt-pack 안 abstract instruction LLM emit element_scope 강제. `call_structured` jsonschema validation 실패 시 retry 자동 trigger preserve.

**TEMPLATE ONLY doctrine** (Carry-A099/A100 lineage + post-Carry-D7d-1 fix-up 1 강화): literal angle-bracket placeholder 재방출 outside formal `<!-- HISTORICAL AUDIT TRAIL — BEGIN/END -->` marker blocks X. underscore-escape variant 도 live W1/W2 target code/test files 안 X (per Codex plan amend 1 IMPORTANT 1 fix — W1/W2 target 안 `8.W2_COMMIT_UTC` underscore form 사용 X). 본 spec §12 in-place REPLACE (heading 이미 존재; append X; pending placeholder 전체 replace per Carry-A100 spec §10 in-place REPLACE doctrine 정합). W4 commit body 안 self-hash literal 0 + final pushed range/count = external memory only.

**NO VLM hard constraint** — W1-W4 verify gates + W3 7 Gate test 모두 schema/text/manifest verification only (jsonschema validate + path glob + sha256 byte-identical + STEP_MANIFEST struct + Python `in` operator + `get_effective_source` dict source-path proof). VLM 의존 0 ([[feedback_no_vlm_dependency]] 정합).

**Carry follow-up post Carry-P021** (non-claim, separate area):
- **Future Carry-P021-structured** (`element_id` opaque snake_case → opaque UUID migration / `element_type` enum 3 entry 확장 / `element_scope` enum 2 entry 확장 / `applies_to_shots` schema 변경 등 field-shape migration) — major carry / future area follow-up.
- **Future Carry-A099-structured** (`director_notes` `array of string` → `array of object` 구조화 migration) — major area, separate.
- **Future Carry-A100-structured** (`t2i_context: string` → `object {default_demographic_policy, tone, genre}` field-shape migration) — major carry / future area follow-up.

## 17. C1 Closure (perception_mode enum SOT, 2026-05-20+)

**Status**: **closed** — C1 perception_mode enum SOT v1 W1-W4 atomic execution 완료. `docs/fix-critical-1/index.html` C1 section 신규 area (Track B Tier α #1, roadmap 원 12 area 미포함 — fix-critical-1 persistent guide 추가 area). spec `docs/superpowers/specs/2026-05-20-c1-perception-mode-enum-sot-v1-design.md` (status closed) + plan `docs/superpowers/plans/2026-05-20-c1-perception-mode-enum-sot-v1-implementation.md` (status closed).

**본질**: `shot_staging` schema `perception_mode` = `type:string` (JSON enum 강제 0, `mirror` description 부재) + `render_prompt_card.py` consumer 4-tuple literal subset 비교 + `detail_steps.py` 6-key dict (mirror 부재) generic fallback → arbitrary string silent miss + 3-way drift.

**Fix applied**: shot_staging v14 `perception_mode` JSON enum 8-token 강제 (`direct/hallucination/dream/memory/reflection/mirror/through_device/projection`, `mirror` 추가) + `backend/app/core/perception_mode.py` helper 신설 (`PERCEPTION_MODES` 8-set + `REPRODUCTION_PERCEPTION_MODES` 4-set strict subset + `_PERCEPTION_GUIDES` non-direct 7-key Mapping + `_validate_perception_mode` / `is_reproduction_perception` / `get_perception_guide` 2-stage check fail-fast) + render_prompt_card `is_reproduction_perception()` consume (4-tuple literal 폐기) + detail_steps `get_perception_guide()` consume (local `_perception_guides` map + generic fallback 폐기) + scene_detail v29 consumer prompt helper SOT cross-reference (4-token closed list 폐기).

**Commit chain**: W1 `4655741` (producer + helper) / W2 `c486993` (consumer code switch) / W3 `cfc0347` (scene_detail v29 + integrated test + 4 alignment test) / W4 closure commit.

**Boundary preserve**: Area C (directionality_class enum SOT) 변경 0 — `_ALLOWED_DIRECTIONALITY_CLASSES` + `_REPRODUCTION_SURFACE_CLASSES` + fail-fast + shot_staging directionality_class 5-enum. OQ-5 = shot_staging schema_version 5 preserve. OQ-6 (a-amended) = `SCENE_DETAIL_PROMPT_VERSION` bump (cp config_hash invalidation accepted), `SCENE_DETAIL_SCHEMA_VERSION` 11 preserve.

**NO VLM hard constraint** — W1-W4 verify gates + W3 integrated test G1-G7 모두 schema/text/manifest verification only (AST-based no-VLM canary 포함). VLM 의존 0 ([[feedback_no_vlm_dependency]] 정합).

**Carry follow-up** (fix-critical-1 index.html, 2026-05-20+ 갱신): C1·C2·C3·C7·C6 ✓ closed → C9 L-7 body-light verb (다음 진입) → C4 #8 background classifier → C5 #9 action segment SOT → C8 #7 잔여 sub-area split → C10 future structured carries.
