{"candidate_reason": "python scope discovery", "chunk_end": 48, "chunk_start": 1, "chunk_summary": "No actionable findings; the file is a clean infrastructure wrapper for extracting visual world rules via structured LLM calls.", "duration_ms": 4695, "findings": [], "path": "backend/app/modules/pipeline/visual_world_rules.py", "scan_kind": "python", "sha256": "d175b0ca2f77e250eb3e5f62c48a7af863d5ea6426c80c7c7a03b630a4b1c411"}
{"candidate_reason": "python scope discovery", "chunk_end": 403, "chunk_start": 1, "chunk_summary": "The file provides infrastructure for loading prompt templates and JSON schemas from the database or filesystem with version-aware fallback logic, and contains no actionable semantic string debt.", "duration_ms": 6592, "findings": [], "path": "backend/app/modules/prompt_loader.py", "scan_kind": "python", "sha256": "4f096399c0a91a5d5bc3adbc065988b68a1ea77178a4d4a8da063de484233a1b"}
{"candidate_reason": "python scope discovery", "chunk_end": 171, "chunk_start": 1, "chunk_summary": "The module converts entity and scene descriptions into T2I prompts, but the scene conversion prompt establishes a brittle substring-matching contract for entity markers used in downstream substitution.", "duration_ms": 21712, "findings": [{"category": "blind_string_mutation", "evidence": "[이름]은 목록의 이름을 공백 포함 정확히 복사 ... [] 마커는 참조 이미지 치환용이므로 목록 외 사용 시 시스템 오류 발생", "line_end": 133, "line_start": 128, "recommended_fix": "Use a structured output format where the LLM identifies entities by ID or index rather than embedding markers in prose, or use a post-processing step that performs fuzzy matching or entity linking instead of exact substring replacement.", "severity": "P1", "why_problematic": "The prompt defines a strict contract for the LLM to generate exact substrings (markers) within natural language prose for later substitution. This is a form of blind semantic string mutation where the system's stability depends on the LLM's ability to perfectly replicate names from a provided list without any variation in spacing or characters, which is prone to hallucination or formatting drift."}], "path": "backend/app/modules/t2i_visual_converter.py", "scan_kind": "python", "sha256": "c288f257d1b6d258eea3850beaec967eb2d189a69209f4f25642ea86e9f3249c"}
{"candidate_reason": "python scope discovery", "chunk_end": 152, "chunk_start": 1, "chunk_summary": "The module uses a hardcoded list of semantic keywords to infer physical immobility from an overloaded gaze target field, which then drives sanitizer constraint logic.", "duration_ms": 21720, "findings": [{"category": "semantic_string_judgment", "evidence": "IMMOBILIZED_GAZE = frozenset({\"dead\", \"unconscious\", \"severely_injured\"}) ... gaze = entry.get(\"gaze_target\")", "line_end": 107, "line_start": 22, "recommended_fix": "Transition to the structured 'subject_state.immobility_state' field as planned in the B-next patch, ensuring the LLM outputs a formal enum rather than relying on keyword matching in the gaze field.", "severity": "P1", "why_problematic": "The system performs semantic classification of a character's physical state (immobilized vs active) by matching specific natural-language keywords within the 'gaze_target' field of an LLM-produced shot description. This field is semantically overloaded to carry state information, and the resulting classification directly controls critical sanitizer behaviors such as forbidding state polarity rewrites."}], "path": "backend/app/modules/semantic_contract_router.py", "scan_kind": "python", "sha256": "3eabedd46fc41df8eb486c7c37b479c82096db368111f44188c3cc7912667d56"}
{"candidate_reason": "python scope discovery", "chunk_end": 302, "chunk_start": 1, "chunk_summary": "The file is a clean LLM-based step coordinator that performs shot dependency analysis using structured LLM outputs and technical validation without brittle string patterns or scenario pollution.", "duration_ms": 27285, "findings": [], "path": "backend/app/core/steps/shot_dependency_t2i_step.py", "scan_kind": "python", "sha256": "4e5bf81c1d9040583870f1e8f14636e453dad73093f557bbbaf9b1511ec9cc8a"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 26, "chunk_start": 1, "chunk_summary": "no actionable findings", "duration_ms": 6010, "findings": [], "path": "prompts/_base/entity_extractor_v2/9.202605130226/turn_entity_detail.md", "scan_kind": "prompt", "sha256": "ec173df86b94c263a602aab6f01fd08b3b04afbda67b0ffdfe8a18ae0058482e"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 137, "chunk_start": 1, "chunk_summary": "The prompt defines a strict controlled vocabulary for sub-space classification, forcing open-world scenario locations into a small set of hardcoded strings used for downstream background routing.", "duration_ms": 15839, "findings": [{"category": "llm_closed_list_instruction", "evidence": "allowed_space_keys 는 controlled vocab 안에서 선택: main / kitchen / rooftop / stairs / yard / exterior / office. ... 위 controlled vocab 밖 단어 사용 절대 금지.", "line_end": 101, "line_start": 97, "recommended_fix": "Allow the LLM to generate descriptive keys based on the scenario text (e.g., 'bedroom', 'bridge') or expand the controlled vocabulary to a comprehensive set of common architectural spaces. If a fixed list is required for downstream logic, move the mapping to a post-processing step rather than a hardcoded prompt constraint.", "severity": "P1", "why_problematic": "This instruction forces the LLM to map arbitrary scenario locations (e.g., bedroom, laboratory, cockpit) into a very limited set of hardcoded semantic categories. It acts as a brittle semantic classifier that limits the system's ability to handle diverse environments and forces lossy 'main' fallback for any non-matching space, which directly affects the deterministic background ID assignment mentioned in line 106."}], "path": "prompts/_base/entity_extractor_v2/9.202605130226/system.md", "scan_kind": "prompt", "sha256": "4c6ca2572963ae30038f2acd9e844dc18c96adf97ceab28cead3f90c4a8af01a"}
{"candidate_reason": "python scope discovery", "chunk_end": 1027, "chunk_start": 1, "chunk_summary": "The service uses brittle regex patterns to resolve entity references from natural-language prompts and labels, performs blind string mutation on generated T2I prompts, and overloads the 'gaze_target' field as a semantic state classifier.", "duration_ms": 35319, "findings": [{"category": "semantic_string_judgment", "evidence": "_re.finditer(r'(C\\d{2,3})(O\\d{2,3})', t2i_prompt), _re.finditer(r'\\[\\[([^\\]]+)\\]\\+\\[([^\\]]+)\\]\\]', t2i_prompt)", "line_end": 478, "line_start": 367, "recommended_fix": "Pass a structured list of active entity IDs alongside the prompt instead of inferring them from the prompt text via regex.", "severity": "P1", "why_problematic": "The service resolves entity identity and decides which reference images to attach by parsing natural-language prompt text (both short_id patterns and legacy name-based patterns). This makes reference resolution dependent on the LLM's ability to maintain exact string formatting in prose."}, {"category": "blind_string_mutation", "evidence": "rewritten = _re.sub(pattern, replacement, rewritten)", "line_end": 130, "line_start": 111, "recommended_fix": "Use a template-based prompt generation system where placeholders are replaced in a controlled manner, or perform replacement on a structured representation of the prompt.", "severity": "P1", "why_problematic": "The function blindly replaces short IDs (C##, P##) within the generated T2I prompt text with descriptive phrases. This risks corrupting the prompt if these patterns appear naturally or in other metadata fields within the string."}, {"category": "semantic_string_judgment", "evidence": "ca.get(\"gaze_target\", \"\") in (\"unconscious\", \"dead\", \"severely_injured\")", "line_end": 988, "line_start": 932, "recommended_fix": "Introduce a dedicated 'physical_state' or 'status' field in the staging schema and use a formal enum for these values.", "severity": "P1", "why_problematic": "The 'gaze_target' field, which nominally describes orientation, is overloaded to carry physical/biological state information. Downstream code uses these specific strings to branch prompt label generation and reference image selection (state_variant)."}, {"category": "semantic_string_judgment", "evidence": "_re.search(r'character\\s+(C\\d{2,3}(?:O\\d{2,3})?)', label)", "line_end": 88, "line_start": 65, "recommended_fix": "Pass structured metadata (e.g., a dict or object) through the indexing pipeline instead of encoding/decoding information in label strings.", "severity": "P2", "why_problematic": "Internal metadata (entity IDs) is extracted from intermediate string labels to decide how to further transform those labels and attach descriptions. This creates a brittle internal string contract between different parts of the service."}], "path": "backend/app/services/scene_reference_service.py", "scan_kind": "python", "sha256": "053a42a8eb51b29dd818ab455f9c8589589f247774cc7050a428f2ba7d305a66"}
{"candidate_reason": "python scope discovery", "chunk_end": 1511, "chunk_start": 1, "chunk_summary": "The file coordinates scene generation, including prompt assembly, reference attachment, and variation generation, but contains a brittle substring check for camera directives.", "duration_ms": 43439, "findings": [{"category": "blind_string_mutation", "evidence": "if shot_name and shot_name.lower() not in var_t2i.lower(): var_t2i = f\"[Camera: {shot_name}] {var_t2i}\"", "line_end": 719, "line_start": 718, "recommended_fix": "Pass camera directives as a separate structured field to the T2I generator or use a dedicated prompt assembly helper that handles deduplication semantically.", "severity": "P1", "why_problematic": "This uses a brittle case-insensitive substring check over natural-language prompt text to decide whether to prepend a camera directive. Variations in phrasing or punctuation in the generated prompt can cause redundant or missing directives."}], "path": "backend/app/services/scene_generation_coordinator.py", "scan_kind": "python", "sha256": "258fea47b6c20d942e942bb8a6629f39495560b30f2655559c8b72a5818993fc"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 112, "chunk_start": 1, "chunk_summary": "The prompt defines several semantic classifiers for background planning and routing based on closed lists of location types, shot categories, and scenario-specific state examples.", "duration_ms": 27761, "findings": [{"category": "llm_closed_list_instruction", "evidence": "INDOOR / ENCLOSED / FIXED-SET (room, hallway, store interior, office, kitchen, basement, closed vehicle interior, fixed studio set, etc.) ... DETACHED OPEN AREA ... (a road far from any building, an unrelated forest, a wide beach, a public street block, a mountain trail, a public square not attached to a tracked building)", "line_end": 25, "line_start": 21, "recommended_fix": "Define a structured 'location_category' enum in the input metadata (e.g., 'architectural' vs 'detached') and use that to drive the skip_chain decision upstream or as a strict instruction.", "severity": "P1", "why_problematic": "The prompt uses a closed list of location examples to instruct the LLM to perform a semantic classification that determines the 'skip_chain' routing logic. This makes the pipeline's core branching logic dependent on the LLM's interpretation of open-world descriptions against a brittle list of examples."}, {"category": "llm_closed_list_instruction", "evidence": "Close-ups, prop inserts, hand-scale plates, 'background plate' shots, photograph inserts... DO NOT need their own background image", "line_end": 105, "line_start": 45, "recommended_fix": "Introduce a 'shot_kind' enum in the input schema and define the node-reuse policy based on those technical categories.", "severity": "P1", "why_problematic": "This defines a semantic classifier for shot types that determines whether a shot should reuse a parent background or create a new node. It relies on the LLM matching these specific concepts in natural language descriptions to decide graph topology."}, {"category": "scenario_dependent_prompt", "evidence": "different room state (clean / lived-in / disturbed / heavily-ransacked) ... different active fixed-element zones (e.g. 'open window with torn curtain' vs. 'closed window')", "line_end": 106, "line_start": 48, "recommended_fix": "Replace scenario-specific examples with abstract state categories or project-neutral descriptions of visual variance.", "severity": "P2", "why_problematic": "The prompt contains concrete scenario-specific examples ('heavily-ransacked', 'torn curtain') that function as semantic classifiers for state-based node splitting. These examples bias the LLM towards specific story tropes and may not generalize well to other genres."}], "path": "prompts/_base/background_chain_planning/4.202604291315/system.md", "scan_kind": "prompt", "sha256": "b6d96cccd24910b03feb484005f1233195e64b54e48add4ed8c1f3fc1ecec938"}
{"candidate_reason": "python scope discovery", "chunk_end": 522, "chunk_start": 1, "chunk_summary": "The file implements a multi-step entity extraction pipeline using structured LLM calls, with routing based on entity types and importance scores.", "duration_ms": 49569, "findings": [{"category": "schema_or_enum_drift", "evidence": "\"entity_type\": {\"type\": \"string\"}", "line_end": 88, "line_start": 88, "recommended_fix": "Update the ENTITY_DETAIL_SCHEMA to define 'entity_type' as an enum: [\"character\", \"location\", \"prop\"].", "severity": "P2", "why_problematic": "The 'entity_type' field in ENTITY_DETAIL_SCHEMA is defined as a generic string, but the pipeline logic (lines 471-477 and 504-509) performs exact string comparisons against 'character' and 'location' to route entities into specific processing buckets. This creates a risk where LLM variations in output (e.g., 'Character' or 'loc') would cause entities to be misrouted as 'props' in the final output."}], "path": "backend/app/modules/pipeline/entity_extractor_v3.py", "scan_kind": "python", "sha256": "c986035718b7f91b3dc9915305b09b38345443d8f0dfc9fcb7f037ea64709b33"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 92, "chunk_start": 1, "chunk_summary": "The prompt defines a workflow for generating consistent location descriptions that are intended to be blindly inserted into T2I prompts based on a bracketed string pattern [L##: description].", "duration_ms": 18126, "findings": [{"category": "blind_string_mutation", "evidence": "t2i_prompt에 쓰인 `[L##: 설명]` 블록 ... scene_detail이 t2i_prompt에 그대로 삽입", "line_end": 11, "line_start": 5, "recommended_fix": "Transition to a structured prompt representation where location descriptions are managed as distinct fields or objects in a schema rather than being embedded and replaced within a flat string using bracketed patterns.", "severity": "P1", "why_problematic": "The pipeline relies on a brittle bracketed string pattern ([L##: ...]) within generated natural-language prompt prose to identify and replace location descriptions. This is blind mutation of semantic text that can fail if the pattern is slightly altered or missing during the generation of the base prompt."}], "path": "prompts/_base/location_consistency/2.202604201230/system.md", "scan_kind": "prompt", "sha256": "dcac2b2e414a6c2561a116c4c282f6c435b823785ea9f2f1b808241c949a7645"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 70, "chunk_start": 1, "chunk_summary": "The prompt contains brittle string-based classification rules for scene types and scenario-specific logic related to a 'possession' mechanic.", "duration_ms": 24351, "findings": [{"category": "semantic_string_judgment", "evidence": "(<몽타주> 표시 또는 빠른 컷 전환)", "line_end": 47, "line_start": 47, "recommended_fix": "Instruct the LLM to identify montage sequences based on semantic characteristics (e.g., rapid time jumps, multiple locations) rather than specific bracketed markers.", "severity": "P1", "why_problematic": "Instructs the LLM to classify a scene as 'montage' based on the presence of a specific Korean string pattern in the input scenario text, which is a brittle way to infer cinematic structure."}, {"category": "scenario_dependent_prompt", "evidence": "rule_type=possession, remote_identity, visible_body", "line_end": 60, "line_start": 60, "recommended_fix": "Move scenario-specific entity relationship rules to a dynamic configuration or a specialized prompt layer rather than the base system prompt.", "severity": "P2", "why_problematic": "Hardcodes a specific 'possession' or 'remote control' story mechanic into the base scene extraction logic. This is scenario pollution that assumes the existence of specific supernatural or sci-fi tropes in arbitrary scenarios."}], "path": "prompts/_base/scene_extractor_v2/18.202605150955/system.md", "scan_kind": "prompt", "sha256": "acf7ef11303d21772e3caa534a4c7c76b02a391b7de8574ceb0e881072ca1874"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 28, "chunk_start": 1, "chunk_summary": "no actionable findings", "duration_ms": 39809, "findings": [], "path": "prompts/_base/outlook_extractor/11.202603311724/phase1.md", "scan_kind": "prompt", "sha256": "48204c280029e2dbd933775dd1b7e23fa8e9c3fda4c2cc85e10d6e1ad7722129"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 29, "chunk_start": 1, "chunk_summary": "no actionable findings", "duration_ms": 29487, "findings": [], "path": "prompts/_base/visual_world_rules/6.202605021400/rules_schema.json", "scan_kind": "prompt", "sha256": "c2d9af79cac5595c1a405bf3805e945791b8dbc25cecd56cb85e222e6a328849"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 109, "chunk_start": 1, "chunk_summary": "The prompt defines several semantic rules for T2I generation, including a closed list of camera/color options and a logic rule for omitting character IDs based on visual state (silhouettes/shadows).", "duration_ms": 37214, "findings": [{"category": "semantic_string_judgment", "evidence": "얼굴/형태 식별 불가 인물 — short_id 사용 금지: 실루엣, 그림자, 창문 반사, 역광, 안개 속 등으로 인물의 얼굴이나 신체 형태를 식별할 수 없는 경우 C##O## short_id를 사용하지 마세요.", "line_end": 38, "line_start": 34, "recommended_fix": "Pass a structured 'visibility_state' or 'is_silhouette' flag for each entity from the previous analysis step instead of asking the LLM to infer it from prose.", "severity": "P1", "why_problematic": "This instruction requires the LLM to perform semantic judgment on the scenario text (identifying visual states like 'silhouette' or 'backlight') to decide whether to include or exclude a character's short_id. This is a brittle routing mechanism that affects entity membership and reference attachment in the generated image."}, {"category": "llm_closed_list_instruction", "evidence": "카메라 구도 선택지: low angle / high angle / dutch angle / over-the-shoulder / bird's eye / extreme wide / tight medium\n색감 선택지: warm amber / cold blue / high contrast / desaturated / golden hour / neon-lit / silhouette backlight", "line_end": 92, "line_start": 91, "recommended_fix": "Define these options in a central schema/enum and inject them into the prompt dynamically, or ensure the downstream consumer handles arbitrary descriptive text.", "severity": "P2", "why_problematic": "The prompt provides a closed list of semantic categories for camera angles and color palettes. If downstream code or validators expect these exact strings, it creates a schema drift risk where the prompt and code must be manually synchronized."}, {"category": "semantic_string_judgment", "evidence": "visible_entities 주의사항: 이 씬의 화면에 물리적으로 존재하는 대상만 넣으세요 ... 예: \"<container descriptor> 안의 인물들\"이 <transport vehicle>에 타고 있다면 → container 는 transport vehicle 에 없으므로 제외", "line_end": 109, "line_start": 105, "recommended_fix": "Move entity visibility logic to a dedicated structured analysis step that uses a world-state model rather than relying on LLM interpretation of prose during prompt generation.", "severity": "P1", "why_problematic": "The LLM is instructed to perform complex semantic filtering of entities based on physical presence and containment logic described in natural language. This is a high-risk area for inconsistent entity membership across scenes."}], "path": "prompts/_base/scene_extractor_v2/18.202605150955/turn_scene_detail.md", "scan_kind": "prompt", "sha256": "a32ab2a3e97d6e51050ae5abda5d9ee002879725bc1ee1d626e9436b3d4c03d2"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 110, "chunk_start": 1, "chunk_summary": "The prompt defines several semantic classification tasks for an LLM, including a closed list of visual phenomenon types and a set of phrase-based categories for judging physical existence (physicality).", "duration_ms": 39547, "findings": [{"category": "llm_closed_list_instruction", "evidence": "director_notes (유형적 메타 판단 기준) ... 회상/F.B 장면 ... 환각/현시 대상 ... CCTV·모니터·창문 너머 ... 교차편집/몽타주 ... 안개·어둠", "line_end": 80, "line_start": 57, "recommended_fix": "Define a formal enum for physicality_type in the schema and have the LLM select from it, rather than relying on the LLM to replicate specific phrase patterns in a free-text notes field.", "severity": "P1", "why_problematic": "The prompt provides a specific list of semantic categories (Flashback, Hallucination, Media/CCTV, Montage, Occlusion) as 'Correct Examples' for judging 'physical existence'. This functions as a closed-list classifier for a core routing decision—whether an entity is physically present in a scene—which is often consumed by downstream logic or other LLMs using brittle string matching."}, {"category": "schema_or_enum_drift", "evidence": "rule_type: possession, transformation, ghost, projection, superpower, body_deformation, time_period, costume, technology, other", "line_end": 51, "line_start": 38, "recommended_fix": "Ensure this enum is centrally managed in a shared schema and that the prompt dynamically injects the allowed values to prevent drift.", "severity": "P2", "why_problematic": "The prompt defines a closed list of semantic categories for open-world supernatural or technical phenomena. While structured as an enum, these categories are inferred from natural language and must be manually synchronized with downstream logic that handles these specific visual types."}], "path": "prompts/_base/visual_world_rules/6.202605021400/system.md", "scan_kind": "prompt", "sha256": "911f1af6897a9acde2ff8b3b295158bda139b9d20ef07df8af570f02730c4a42"}
