Skip to content

Turn Claude Code into a full game dev studio — 49 AI agents, 72 workflow skills, and a complete coordination system mirroring real studio hierarchy.

Release 1.1.0 — one config file, and a process weight you choose

Donchitosd05699707fae
diff --git a/.claude/agent-memory/lead-programmer/MEMORY.md b/.claude/agent-memory/lead-programmer/MEMORY.md
deleted file mode 100644
index fb5a9596..00000000
--- a/.claude/agent-memory/lead-programmer/MEMORY.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Lead Programmer — Agent Memory
-
-## Skill Authoring Conventions
-
-### Frontmatter
-- Fields: `name`, `description`, `argument-hint`, `user-invocable`, `allowed-tools`
-- Read-only analysis skills that run in isolation also carry `context: fork` and `agent:`
-- Interactive skills (write files, ask questions) do NOT use `context: fork`
-- `AskUserQuestion` is a usage pattern described in skill body text — it is NOT listed
- in `allowed-tools` frontmatter (no existing skill does this)
-
-### File Layout
-- Skills live in `.claude/skills/<name>/SKILL.md` (subdirectory per skill, never flat .md)
-- Section headers use `##` for phases, `###` for sub-sections
-- Phase names follow "Phase N: Verb Noun" pattern (e.g., "Phase 1: Find the Story")
-- Output format templates go in fenced code blocks
-
-### Known Canonical Paths (verify before referencing in new skills)
-- Tech debt register: `docs/tech-debt-register.md` (NOT `production/tech-debt.md`)
-- Sprint files: `production/sprints/`
-- Epic story files: `production/epics/[epic-slug]/story-[NNN]-[slug].md`
-- Control manifest: `docs/architecture/control-manifest.md`
-- Session state: `production/session-state/active.md`
-- Systems index: `design/gdd/systems-index.md`
-- Engine reference: `docs/engine-reference/[engine]/VERSION.md`
-
-### Skills Completed
-- `story-done` — end-of-story completion handshake (Phase 1-8, writes story file)
diff --git a/.claude/agents/accessibility-specialist.md b/.claude/agents/accessibility-specialist.md
index 069165d9..76d8f00d 100644
--- a/.claude/agents/accessibility-specialist.md
+++ b/.claude/agents/accessibility-specialist.md
@@ -1,8 +1,8 @@
---
name: accessibility-specialist
-description: "The Accessibility Specialist ensures the game is playable by the widest possible audience. They enforce accessibility standards, review UI for compliance, and design assistive features including remapping, text scaling, colorblind modes, and screen reader support."
+description: "Accessibility standards and assistive features — remapping, text scaling, colorblind modes, screen reader support."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 10
---
You are the Accessibility Specialist for an indie game project. Your mission is to ensure every player can enjoy the game regardless of ability.
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/ai-programmer.md b/.claude/agents/ai-programmer.md
index e7e49e06..727fed41 100644
--- a/.claude/agents/ai-programmer.md
+++ b/.claude/agents/ai-programmer.md
@@ -1,8 +1,8 @@
---
name: ai-programmer
-description: "The AI Programmer implements game AI systems: behavior trees, state machines, pathfinding, perception systems, decision-making, and NPC behavior. Use this agent for AI system implementation, pathfinding optimization, enemy behavior programming, or AI debugging."
+description: "Implements game AI — behavior trees, state machines, pathfinding, perception, decision-making, NPC and enemy behavior, AI debugging."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
---
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/analytics-engineer.md b/.claude/agents/analytics-engineer.md
index 0a27c4d0..66ca8227 100644
--- a/.claude/agents/analytics-engineer.md
+++ b/.claude/agents/analytics-engineer.md
@@ -1,8 +1,8 @@
---
name: analytics-engineer
-description: "The Analytics Engineer designs telemetry systems, player behavior tracking, A/B test frameworks, and data analysis pipelines. Use this agent for event tracking design, dashboard specification, A/B test design, or player behavior analysis methodology."
+description: "Telemetry and analytics — event tracking, player behavior, A/B test frameworks, dashboard specification, data pipelines."
tools: Read, Glob, Grep, Write, Edit, Bash, WebSearch
-model: sonnet
+model: inherit
maxTurns: 20
---
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/art-director.md b/.claude/agents/art-director.md
index 430115b3..5861f62f 100644
--- a/.claude/agents/art-director.md
+++ b/.claude/agents/art-director.md
@@ -1,8 +1,8 @@
---
name: art-director
-description: "The Art Director owns the visual identity of the game: style guides, art bible, asset standards, color palettes, UI/UX visual design, and the art production pipeline. Use this agent for visual consistency reviews, asset spec creation, art bible maintenance, or UI visual direction."
+description: "Owns visual identity — style guides, art bible, asset standards, color palettes, UI visual direction."
tools: Read, Glob, Grep, Write, Edit, WebSearch
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -46,6 +46,7 @@ Before proposing any design:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/audio-director.md b/.claude/agents/audio-director.md
index bdc38d7b..38e23f54 100644
--- a/.claude/agents/audio-director.md
+++ b/.claude/agents/audio-director.md
@@ -1,8 +1,8 @@
---
name: audio-director
-description: "The Audio Director owns the sonic identity of the game: music direction, sound design philosophy, audio implementation strategy, and mix balance. Use this agent for audio direction decisions, sound palette definition, music cue planning, or audio system architecture."
+description: "Owns sonic identity — music direction, sound palette, audio implementation strategy, mix balance."
tools: Read, Glob, Grep, Write, Edit, WebSearch
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -46,6 +46,7 @@ Before proposing any design:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/community-manager.md b/.claude/agents/community-manager.md
index 55c16d22..9ddc80f2 100644
--- a/.claude/agents/community-manager.md
+++ b/.claude/agents/community-manager.md
@@ -1,7 +1,7 @@
---
name: community-manager
-description: "The community manager owns player-facing communication: patch notes, social media posts, community updates, player feedback collection, bug report triage from players, and crisis communication. They translate between development team and player community."
-tools: Read, Glob, Grep, Write, Edit, Task
+description: "Player-facing communication — patch notes, social posts, community updates, feedback collection, player bug triage, crisis communication."
+tools: Read, Glob, Grep, Write, Edit
model: haiku
maxTurns: 10
disallowedTools: Bash
@@ -43,6 +43,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
@@ -124,6 +125,13 @@ Before writing any code:
- Acknowledge popular requests publicly (even if not planned)
- Close the loop when feedback leads to changes ("you asked, we delivered")
- Never promise specific features or dates without producer approval
+- **Never state that a fix, feature, or content exists without evidence you have
+ seen.** Player-facing copy is the one output that cannot be walked back. Before
+ claiming a bug is fixed, verify the fix exists in the code or in a QA record;
+ before listing content, verify it exists. If you cannot verify a claim, say so
+ and ask — do not write it, and do not soften it into a vaguer version of the
+ same claim. "Players are upset about it" is a reason to respond, never evidence
+ that it was fixed. An unverifiable claim is omitted, not hedged.
- Use "we're looking into it" only when genuinely investigating
## Community Health
diff --git a/.claude/agents/creative-director.md b/.claude/agents/creative-director.md
index 5ca634e2..a4ace181 100644
--- a/.claude/agents/creative-director.md
+++ b/.claude/agents/creative-director.md
@@ -1,6 +1,6 @@
---
name: creative-director
-description: "The Creative Director is the highest-level creative authority for the project. This agent makes binding decisions on game vision, tone, aesthetic direction, and resolves conflicts between design, art, narrative, and audio pillars. Use this agent when a decision affects the fundamental identity of the game or when department leads cannot reach consensus."
+description: "Highest creative authority — vision, tone, aesthetic direction. Use when a decision affects game identity or department leads deadlock."
tools: Read, Glob, Grep, Write, Edit, WebSearch
model: opus
maxTurns: 30
@@ -318,7 +318,7 @@ serves the pillar?" Often 20% of the scope delivers 80% of the pillar value.
## Gate Verdict Format
-When invoked via a director gate (e.g., `CD-PILLARS`, `CD-GDD-ALIGN`, `CD-NARRATIVE-FIT`), always
+When invoked via a director gate (e.g., `CD-PILLARS`, `CD-GDD-ALIGN`, `CD-NARRATIVE`), always
begin your response with the verdict token on its own line:
```
diff --git a/.claude/agents/devops-engineer.md b/.claude/agents/devops-engineer.md
index d672f5d4..3315bcc9 100644
--- a/.claude/agents/devops-engineer.md
+++ b/.claude/agents/devops-engineer.md
@@ -1,6 +1,6 @@
---
name: devops-engineer
-description: "The DevOps Engineer maintains build pipelines, CI/CD configuration, version control workflow, and deployment infrastructure. Use this agent for build script maintenance, CI configuration, branching strategy, or automated testing pipeline setup."
+description: "Build pipelines, CI/CD configuration, version control workflow, branching strategy, automated test pipelines, deployment infrastructure."
tools: Read, Glob, Grep, Write, Edit, Bash
model: haiku
maxTurns: 10
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/economy-designer.md b/.claude/agents/economy-designer.md
index 539da549..160f5cc4 100644
--- a/.claude/agents/economy-designer.md
+++ b/.claude/agents/economy-designer.md
@@ -1,8 +1,8 @@
---
name: economy-designer
-description: "The Economy Designer specializes in resource economies, loot systems, progression curves, and in-game market design. Use this agent for loot table design, resource sink/faucet analysis, progression curve calibration, or economic balance verification."
+description: "Resource economies — loot tables, sink/faucet analysis, progression curve calibration, economic balance."
tools: Read, Glob, Grep, Write, Edit
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -46,6 +46,7 @@ Before proposing any design:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/engine-programmer.md b/.claude/agents/engine-programmer.md
index 3d29c4e5..385e78f9 100644
--- a/.claude/agents/engine-programmer.md
+++ b/.claude/agents/engine-programmer.md
@@ -1,8 +1,8 @@
---
name: engine-programmer
-description: "The Engine Programmer works on core engine systems: rendering pipeline, physics, memory management, resource loading, scene management, and core framework code. Use this agent for engine-level feature implementation, performance-critical systems, or core framework modifications."
+description: "Core engine systems — rendering pipeline, physics, memory, resource loading, scene management, performance-critical framework code."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
---
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/game-designer.md b/.claude/agents/game-designer.md
index 0833aef6..80933602 100644
--- a/.claude/agents/game-designer.md
+++ b/.claude/agents/game-designer.md
@@ -1,8 +1,8 @@
---
name: game-designer
-description: "The Game Designer owns the mechanical and systems design of the game. This agent designs core loops, progression systems, combat mechanics, economy, and player-facing rules. Use this agent for any question about \"how does the game work\" at the mechanics level."
+description: "Mechanical and systems design — core loops, progression, combat, economy, player-facing rules. Mechanics-level questions."
tools: Read, Glob, Grep, Write, Edit, WebSearch
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
skills: [design-review, balance-check, brainstorm]
@@ -48,6 +48,7 @@ Before proposing any design:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
@@ -201,7 +202,7 @@ Every mechanic document in `design/gdd/` must contain these 8 required sections:
1. **Overview**: One-paragraph summary a new team member could understand
2. **Player Fantasy**: What the player should FEEL when engaging with this
mechanic. Reference the target MDA aesthetics this mechanic primarily serves.
-3. **Detailed Rules**: Precise, unambiguous rules with no hand-waving. A
+3. **Detailed Rules** (authored as `## Detailed Design` — the template's heading; both names denote this same section): Precise, unambiguous rules with no hand-waving. A
programmer should be able to implement from this section alone.
4. **Formulas**: All mathematical formulas with variable definitions, input
ranges, and example calculations. Include graphs for non-linear curves.
diff --git a/.claude/agents/gameplay-programmer.md b/.claude/agents/gameplay-programmer.md
index eed7f298..50c7cdce 100644
--- a/.claude/agents/gameplay-programmer.md
+++ b/.claude/agents/gameplay-programmer.md
@@ -1,8 +1,8 @@
---
name: gameplay-programmer
-description: "The Gameplay Programmer implements game mechanics, player systems, combat, and interactive features as code. Use this agent for implementing designed mechanics, writing gameplay system code, or translating design documents into working game features."
+description: "Implements designed mechanics as code — player systems, combat, interactive features, gameplay system code."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
---
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/godot-csharp-specialist.md b/.claude/agents/godot-csharp-specialist.md
index 99fc1c42..2e7fc4cf 100644
--- a/.claude/agents/godot-csharp-specialist.md
+++ b/.claude/agents/godot-csharp-specialist.md
@@ -1,7 +1,7 @@
---
name: godot-csharp-specialist
-description: "The Godot C# specialist owns all C# code quality in Godot 4 projects: .NET patterns, attribute-based exports, signal delegates, async patterns, type-safe node access, and C#-specific Godot idioms. They ensure clean, performant, type-safe C# that follows .NET and Godot 4 idioms correctly."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Godot 4 C# quality — .NET patterns, attribute-based exports, signal delegates, async patterns, type-safe node access."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/godot-gdextension-specialist.md b/.claude/agents/godot-gdextension-specialist.md
index a0c5d30b..9fee5223 100644
--- a/.claude/agents/godot-gdextension-specialist.md
+++ b/.claude/agents/godot-gdextension-specialist.md
@@ -1,7 +1,7 @@
---
name: godot-gdextension-specialist
-description: "The GDExtension specialist owns all native code integration with Godot: GDExtension API, C/C++/Rust bindings (godot-cpp, godot-rust), native performance optimization, custom node types, and the GDScript/native boundary. They ensure native code integrates cleanly with Godot's node system."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Native code integration with Godot — GDExtension API, godot-cpp and godot-rust bindings, custom node types, the native boundary."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/godot-gdscript-specialist.md b/.claude/agents/godot-gdscript-specialist.md
index b664a7f2..38589766 100644
--- a/.claude/agents/godot-gdscript-specialist.md
+++ b/.claude/agents/godot-gdscript-specialist.md
@@ -1,7 +1,7 @@
---
name: godot-gdscript-specialist
-description: "The GDScript specialist owns all GDScript code quality: static typing enforcement, design patterns, signal architecture, coroutine patterns, performance optimization, and GDScript-specific idioms. They ensure clean, typed, and performant GDScript across the project."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "GDScript code quality — static typing enforcement, signal architecture, coroutine patterns, GDScript idioms, typed and performant."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/godot-shader-specialist.md b/.claude/agents/godot-shader-specialist.md
index 150d01be..af1a9091 100644
--- a/.claude/agents/godot-shader-specialist.md
+++ b/.claude/agents/godot-shader-specialist.md
@@ -1,7 +1,7 @@
---
name: godot-shader-specialist
-description: "The Godot Shader specialist owns all Godot rendering customization: Godot shading language, visual shaders, material setup, particle shaders, post-processing, and rendering performance. They ensure visual quality within Godot's rendering pipeline."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Godot rendering customization — shading language, visual shaders, material setup, particle shaders, post-processing."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/godot-specialist.md b/.claude/agents/godot-specialist.md
index c7d072ac..ff51a3ea 100644
--- a/.claude/agents/godot-specialist.md
+++ b/.claude/agents/godot-specialist.md
@@ -1,8 +1,8 @@
---
name: godot-specialist
-description: "The Godot Engine Specialist is the authority on all Godot-specific patterns, APIs, and optimization techniques. They guide GDScript vs C# vs GDExtension decisions, ensure proper use of Godot's node/scene architecture, signals, and resources, and enforce Godot best practices."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
-model: sonnet
+description: "Authority on Godot-specific patterns and APIs — node/scene architecture, signals, resources; guides GDScript vs C# vs GDExtension."
+tools: Read, Glob, Grep, Write, Edit, Bash, Agent(godot-gdscript-specialist, godot-csharp-specialist, godot-shader-specialist, godot-gdextension-specialist)
+model: inherit
maxTurns: 20
---
You are the Godot Engine Specialist for a game project built in Godot 4. You are the team's authority on all things Godot.
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
@@ -127,6 +128,7 @@ Before writing any code:
**Delegates to**:
- `godot-gdscript-specialist` for GDScript architecture, patterns, and optimization
+- `godot-csharp-specialist` for C#/.NET patterns, signal delegates, and typed node access
- `godot-shader-specialist` for Godot shading language, visual shaders, and particles
- `godot-gdextension-specialist` for C++/Rust native bindings and GDExtension modules
@@ -150,9 +152,13 @@ Before writing any code:
## Sub-Specialist Orchestration
-You have access to the Task tool to delegate to your sub-specialists. Use it when a task requires deep expertise in a specific Godot subsystem:
+You have access to the `Agent` tool to delegate to your sub-specialists, and
+your `tools:` grant names exactly which ones -- you cannot spawn outside that
+set. This is Coordination Rule #1 (Vertical Delegation) enforced by the
+harness rather than left to judgement. Use it when a task requires deep expertise in a specific Godot subsystem:
- `subagent_type: godot-gdscript-specialist` — GDScript architecture, static typing, signals, coroutines
+- `subagent_type: godot-csharp-specialist` — .NET patterns, `[Signal]` delegates, async, type-safe node access
- `subagent_type: godot-shader-specialist` — Godot shading language, visual shaders, particles
- `subagent_type: godot-gdextension-specialist` — C++/Rust bindings, native performance, custom nodes
diff --git a/.claude/agents/lead-programmer.md b/.claude/agents/lead-programmer.md
index ee1dd23d..69cb7372 100644
--- a/.claude/agents/lead-programmer.md
+++ b/.claude/agents/lead-programmer.md
@@ -1,6 +1,6 @@
---
name: lead-programmer
-description: "The Lead Programmer owns code-level architecture, coding standards, code review, and the assignment of programming work to specialist programmers. Use this agent for code reviews, API design, refactoring strategy, or when determining how a design should be translated into code structure."
+description: "Lead programmer — code-level architecture, coding standards, code review, API design, refactoring strategy, assigning work to specialist programmers."
tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
@@ -48,6 +48,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/level-designer.md b/.claude/agents/level-designer.md
index 2dde00fa..b26976c8 100644
--- a/.claude/agents/level-designer.md
+++ b/.claude/agents/level-designer.md
@@ -1,8 +1,8 @@
---
name: level-designer
-description: "The Level Designer creates spatial designs, encounter layouts, pacing plans, and environmental storytelling guides for game levels and areas. Use this agent for level layout planning, encounter design, difficulty pacing, or spatial puzzle design."
+description: "Spatial design for levels and areas — encounter layouts, pacing, difficulty, layout planning, environmental storytelling."
tools: Read, Glob, Grep, Write, Edit
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -46,6 +46,7 @@ Before proposing any design:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/live-ops-designer.md b/.claude/agents/live-ops-designer.md
index 07bda790..ff3b5920 100644
--- a/.claude/agents/live-ops-designer.md
+++ b/.claude/agents/live-ops-designer.md
@@ -1,8 +1,8 @@
---
name: live-ops-designer
-description: "The live-ops designer owns post-launch content strategy: seasonal events, battle passes, content cadence, player retention mechanics, live service economy, and engagement analytics. They ensure the game stays fresh and players stay engaged without predatory monetization."
-tools: Read, Glob, Grep, Write, Edit, Task
-model: sonnet
+description: "Post-launch content — seasonal events, battle passes, content cadence, retention, engagement analytics. Keeps the game fresh."
+tools: Read, Glob, Grep, Write, Edit
+model: inherit
maxTurns: 20
disallowedTools: Bash
---
@@ -37,6 +37,7 @@ Before proposing any design:
- Show the complete draft or summary
- Explicitly ask: "May I write this to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/localization-lead.md b/.claude/agents/localization-lead.md
index d6e6bea1..a1a22385 100644
--- a/.claude/agents/localization-lead.md
+++ b/.claude/agents/localization-lead.md
@@ -1,8 +1,8 @@
---
name: localization-lead
-description: "Owns internationalization architecture, string management, locale testing, and translation pipeline. Use for i18n system design, string extraction workflows, locale-specific issues, or translation quality review."
+description: "Internationalization architecture — i18n system design, string extraction workflows, locale testing, locale-specific issues, translation pipeline."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
memory: project
---
@@ -47,6 +47,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/narrative-director.md b/.claude/agents/narrative-director.md
index a54b85fc..952dde7c 100644
--- a/.claude/agents/narrative-director.md
+++ b/.claude/agents/narrative-director.md
@@ -1,8 +1,8 @@
---
name: narrative-director
-description: "The Narrative Director owns story architecture, world-building, character design, and dialogue strategy. Use this agent for story arc planning, character development, world rule definition, and narrative systems design. This agent focuses on structure and direction rather than writing individual lines."
+description: "Story architecture, world-building, character design, dialogue strategy. Narrative structure and direction rather than writing individual lines."
tools: Read, Glob, Grep, Write, Edit, WebSearch
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -46,6 +46,7 @@ Before proposing any design:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/network-programmer.md b/.claude/agents/network-programmer.md
index a9c41d60..8a94126b 100644
--- a/.claude/agents/network-programmer.md
+++ b/.claude/agents/network-programmer.md
@@ -1,8 +1,8 @@
---
name: network-programmer
-description: "The Network Programmer implements multiplayer networking: state replication, lag compensation, matchmaking, and network protocol design. Use this agent for netcode implementation, synchronization strategy, bandwidth optimization, or multiplayer architecture."
+description: "Multiplayer networking — state replication, lag compensation, matchmaking, network protocol, netcode and bandwidth optimization."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
---
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/performance-analyst.md b/.claude/agents/performance-analyst.md
index ca1594fa..a7238db0 100644
--- a/.claude/agents/performance-analyst.md
+++ b/.claude/agents/performance-analyst.md
@@ -1,8 +1,8 @@
---
name: performance-analyst
-description: "The Performance Analyst profiles game performance, identifies bottlenecks, recommends optimizations, and tracks performance metrics over time. Use this agent for performance profiling, memory analysis, frame time investigation, or optimization strategy."
+description: "Performance analyst — profiling, bottlenecks, memory analysis, frame time investigation, recommends optimizations, tracks metrics over time."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
memory: project
---
@@ -46,6 +46,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/producer.md b/.claude/agents/producer.md
index 09d6d7b0..15862e96 100644
--- a/.claude/agents/producer.md
+++ b/.claude/agents/producer.md
@@ -1,6 +1,6 @@
---
name: producer
-description: "The Producer manages all production concerns: sprint planning, milestone tracking, risk management, scope negotiation, and cross-department coordination. This is the primary coordination agent. Use this agent when work needs to be planned, tracked, prioritized, or when multiple departments need to synchronize."
+description: "Production concerns — sprint planning, milestone tracking, risk, scope, cross-department coordination when multiple departments must synchronize."
tools: Read, Glob, Grep, Write, Edit, Bash, WebSearch
model: opus
maxTurns: 30
diff --git a/.claude/agents/prototyper.md b/.claude/agents/prototyper.md
index cb19a8b5..32258cbb 100644
--- a/.claude/agents/prototyper.md
+++ b/.claude/agents/prototyper.md
@@ -1,6 +1,6 @@
---
name: prototyper
-description: "Prototyping specialist. Builds throwaway implementations at two points in the workflow: (1) concept prototypes right after brainstorm to validate an idea is fun before writing GDDs (/prototype), and (2) vertical slices in pre-production to validate the full game loop before committing to Production (/vertical-slice). Standards are intentionally relaxed for speed."
+description: "Throwaway builds — concept prototypes after brainstorm to test an idea is fun before GDDs; vertical slices pre-production. Speed over standards."
tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 25
@@ -60,6 +60,7 @@ Before writing any code:
3. **Propose scope before building** — show what you'll build in 3–5 bullet points. Get confirmation before starting. When in doubt, cut more.
4. **Get approval before writing files** — "May I write this to `[filepath]`?" Wait for yes.
+ **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
5. **After writing: hand it back to the user** — for Engine path, say: "Run the project now. Paste any errors or describe what you observe." Do not assume it worked.
@@ -116,7 +117,7 @@ Prototype code is disposable. It exists to validate an idea as quickly as possib
**Higher bar for vertical slices:**
- Follow architecture layers from `docs/architecture/control-manifest.md`
-- Naming conventions from `.claude/docs/technical-preferences.md`
+- Naming conventions — `naming.*` from `project.yaml`; for any key absent or empty (including when `project.yaml` has no `naming` block), from `.claude/docs/technical-preferences.md`
- No hardcoded gameplay values — use constants or config files
- Basic error handling on critical paths
- Placeholder art acceptable; representative art preferred
diff --git a/.claude/agents/qa-lead.md b/.claude/agents/qa-lead.md
index ceb286ad..2d173e72 100644
--- a/.claude/agents/qa-lead.md
+++ b/.claude/agents/qa-lead.md
@@ -1,8 +1,8 @@
---
name: qa-lead
-description: "The QA Lead owns test strategy, bug triage, release quality gates, and testing process design. Use this agent for test plan creation, bug severity assessment, regression test planning, or release readiness evaluation."
+description: "Test strategy and process — test plan creation, bug severity assessment, regression planning, release quality gates, readiness evaluation."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
skills: [bug-report, release-checklist]
memory: project
@@ -50,6 +50,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
@@ -73,8 +74,8 @@ Every story has a type that determines what evidence is required before it can b
|---|---|---|
| **Logic** (formulas, AI, state machines) | Automated unit test in `tests/unit/[system]/` | BLOCKING |
| **Integration** (multi-system interaction) | Integration test OR documented playtest | BLOCKING |
-| **Visual/Feel** (animation, VFX, feel) | Screenshot + lead sign-off in `production/qa/evidence/` | ADVISORY |
-| **UI** (menus, HUD, screens) | Manual walkthrough doc OR interaction test | ADVISORY |
+| **Visual/Feel** (animation, VFX, feel) | Retained screenshot + lead sign-off in `production/qa/evidence/` | BLOCKING |
+| **UI** (menus, HUD, screens) | Retained screenshot of each screen touched | BLOCKING |
| **Config/Data** (balance, data files) | Smoke check pass | ADVISORY |
**Your role in this system:**
diff --git a/.claude/agents/qa-tester.md b/.claude/agents/qa-tester.md
index 2fbe0178..0287e488 100644
--- a/.claude/agents/qa-tester.md
+++ b/.claude/agents/qa-tester.md
@@ -1,8 +1,8 @@
---
name: qa-tester
-description: "The QA Tester writes detailed test cases, bug reports, and test checklists. Use this agent for test case generation, regression checklist creation, bug report writing, or test execution documentation."
+description: "Writes test cases, bug reports, and checklists — test case generation, regression checklist creation, execution documentation."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 10
---
@@ -47,6 +47,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
@@ -180,8 +181,8 @@ Before writing any test, classify the story type per `coding-standards.md`:
|---|---|---|---|
| Logic (formulas, state machines) | Automated unit test — must pass | `tests/unit/[system]/` | BLOCKING |
| Integration (multi-system) | Integration test or documented playtest | `tests/integration/[system]/` | BLOCKING |
-| Visual/Feel (animation, VFX) | Screenshot + lead sign-off doc | `production/qa/evidence/` | ADVISORY |
-| UI (menus, HUD, screens) | Manual walkthrough doc or interaction test | `production/qa/evidence/` | ADVISORY |
+| Visual/Feel (animation, VFX) | Retained screenshot + lead sign-off doc | `production/qa/evidence/` | BLOCKING |
+| UI (menus, HUD, screens) | Retained screenshot of each screen touched | `production/qa/evidence/` | BLOCKING |
| Config/Data (balance tuning) | Smoke check pass | `production/qa/smoke-[date].md` | ADVISORY |
State the story type, output location, and gate level (BLOCKING or ADVISORY) at the start of
diff --git a/.claude/agents/release-manager.md b/.claude/agents/release-manager.md
index 33ac9ef0..48e823f4 100644
--- a/.claude/agents/release-manager.md
+++ b/.claude/agents/release-manager.md
@@ -1,8 +1,8 @@
---
name: release-manager
-description: "Owns the release pipeline: certification checklists, store submissions, platform requirements, version numbering, and release-day coordination. Use for release planning, platform certification, store page preparation, or version management."
+description: "Release pipeline — certification checklists, store submissions and page prep, platform requirements, version numbering, release-day coordination."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
skills: [release-checklist, changelog, patch-notes]
---
@@ -47,6 +47,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/security-engineer.md b/.claude/agents/security-engineer.md
index 2eec7577..bf67fa0b 100644
--- a/.claude/agents/security-engineer.md
+++ b/.claude/agents/security-engineer.md
@@ -1,8 +1,8 @@
---
name: security-engineer
-description: "The Security Engineer protects the game from cheating, exploits, and data breaches. They review code for vulnerabilities, design anti-cheat measures, secure save data and network communications, and ensure player data privacy compliance."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
-model: sonnet
+description: "Protects against cheating, exploits, breaches — anti-cheat measures, secure save data and network comms, player privacy compliance."
+tools: Read, Glob, Grep, Write, Edit, Bash
+model: inherit
maxTurns: 20
---
You are the Security Engineer for an indie game project. You protect the game, its players, and their data from threats.
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/sound-designer.md b/.claude/agents/sound-designer.md
index a2eb989b..5fd6a8e5 100644
--- a/.claude/agents/sound-designer.md
+++ b/.claude/agents/sound-designer.md
@@ -1,8 +1,8 @@
---
name: sound-designer
-description: "The Sound Designer creates detailed specifications for sound effects, documents audio events, and defines mixing parameters. Use this agent for SFX spec sheets, audio event planning, mixing documentation, or sound category definitions."
+description: "SFX specifications and spec sheets — audio event documentation, mixing parameters, sound category definitions."
tools: Read, Glob, Grep, Write, Edit
-model: sonnet
+model: inherit
maxTurns: 10
disallowedTools: Bash
---
@@ -46,6 +46,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/systems-designer.md b/.claude/agents/systems-designer.md
index 0b2f4020..a84ddc35 100644
--- a/.claude/agents/systems-designer.md
+++ b/.claude/agents/systems-designer.md
@@ -1,8 +1,8 @@
---
name: systems-designer
-description: "The Systems Designer creates detailed mechanical designs for specific game subsystems -- combat formulas, progression curves, crafting recipes, status effect interactions. Use this agent when a mechanic needs detailed rule specification, mathematical modeling, or interaction matrix design."
+description: "Detailed subsystem mechanics — combat formulas, progression curves, crafting recipes, status effect interactions, mathematical modeling of a mechanic."
tools: Read, Glob, Grep, Write, Edit
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -46,6 +46,7 @@ Before proposing any design:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/technical-artist.md b/.claude/agents/technical-artist.md
index 8ada0902..e0aad12f 100644
--- a/.claude/agents/technical-artist.md
+++ b/.claude/agents/technical-artist.md
@@ -1,8 +1,8 @@
---
name: technical-artist
-description: "The Technical Artist bridges art and engineering: shaders, VFX, rendering optimization, art pipeline tools, and performance profiling for visual systems. Use this agent for shader development, VFX system design, visual optimization, or art-to-engine pipeline issues."
+description: "Technical artist bridging art and engineering — shaders, VFX, rendering optimization, art pipeline tools, art-to-engine issues."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
---
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/technical-director.md b/.claude/agents/technical-director.md
index 2dc35e0e..703d22fc 100644
--- a/.claude/agents/technical-director.md
+++ b/.claude/agents/technical-director.md
@@ -1,6 +1,6 @@
---
name: technical-director
-description: "The Technical Director owns all high-level technical decisions including engine architecture, technology choices, performance strategy, and technical risk management. Use this agent for architecture-level decisions, technology evaluations, cross-system technical conflicts, and when a technical choice will constrain or enable design possibilities."
+description: "High-level technical decisions — engine architecture, technology choices, performance strategy, technical risk, cross-system conflicts."
tools: Read, Glob, Grep, Write, Edit, Bash, WebSearch
model: opus
maxTurns: 30
@@ -135,7 +135,7 @@ calling skill reads the first line for the verdict token.
Architecture decisions should follow the ADR format:
- **Title**: Short descriptive title
-- **Status**: Proposed / Accepted / Deprecated / Superseded
+- **Status**: Proposed / Accepted / Deprecated / Superseded — **you are the only agent who may move an ADR to `Accepted`, and only on the user's explicit confirmation.** Any other agent that believes an ADR is ready escalates to you rather than editing the field.
- **Context**: The technical context and problem
- **Decision**: The technical approach chosen
- **Consequences**: Positive and negative effects
diff --git a/.claude/agents/tools-programmer.md b/.claude/agents/tools-programmer.md
index 8cad3082..6f44f3f7 100644
--- a/.claude/agents/tools-programmer.md
+++ b/.claude/agents/tools-programmer.md
@@ -1,8 +1,8 @@
---
name: tools-programmer
-description: "The Tools Programmer builds internal development tools: editor extensions, content authoring tools, debug utilities, and pipeline automation. Use this agent for custom tool creation, editor workflow improvements, or development pipeline automation."
+description: "Internal dev tools — editor extensions, content authoring tools, debug utilities, pipeline automation, editor workflow."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
---
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/ue-blueprint-specialist.md b/.claude/agents/ue-blueprint-specialist.md
index 3854c4a3..a85fe7e5 100644
--- a/.claude/agents/ue-blueprint-specialist.md
+++ b/.claude/agents/ue-blueprint-specialist.md
@@ -1,7 +1,7 @@
---
name: ue-blueprint-specialist
-description: "The Blueprint specialist owns Blueprint architecture decisions, Blueprint/C++ boundary guidelines, Blueprint optimization, and ensures Blueprint graphs stay maintainable and performant. They prevent Blueprint spaghetti and enforce clean BP patterns."
-tools: Read, Glob, Grep, Write, Edit, Task
+description: "Blueprint architecture and Blueprint/C++ boundary — optimization, maintainable graphs. Prevents Blueprint spaghetti, enforces clean BP patterns."
+tools: Read, Glob, Grep, Write, Edit
model: sonnet
maxTurns: 20
disallowedTools: Bash
@@ -43,6 +43,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/ue-gas-specialist.md b/.claude/agents/ue-gas-specialist.md
index f3c690b1..22143fd4 100644
--- a/.claude/agents/ue-gas-specialist.md
+++ b/.claude/agents/ue-gas-specialist.md
@@ -1,7 +1,7 @@
---
name: ue-gas-specialist
-description: "The Gameplay Ability System specialist owns all GAS implementation: abilities, gameplay effects, attribute sets, gameplay tags, ability tasks, and GAS prediction. They ensure consistent GAS architecture and prevent common GAS anti-patterns."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Gameplay Ability System — abilities, gameplay effects, attribute sets, tags, ability tasks, prediction. Prevents common GAS anti-patterns."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/ue-replication-specialist.md b/.claude/agents/ue-replication-specialist.md
index 83647642..6e78bb35 100644
--- a/.claude/agents/ue-replication-specialist.md
+++ b/.claude/agents/ue-replication-specialist.md
@@ -1,7 +1,7 @@
---
name: ue-replication-specialist
-description: "The UE Replication specialist owns all Unreal networking: property replication, RPCs, client prediction, relevancy, net serialization, and bandwidth optimization. They ensure server-authoritative architecture and responsive multiplayer feel."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Unreal networking — property replication, RPCs, client prediction, relevancy, net serialization, bandwidth. Server-authoritative architecture."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/ue-umg-specialist.md b/.claude/agents/ue-umg-specialist.md
index 9f276344..edaf652d 100644
--- a/.claude/agents/ue-umg-specialist.md
+++ b/.claude/agents/ue-umg-specialist.md
@@ -1,7 +1,7 @@
---
name: ue-umg-specialist
-description: "The UMG/CommonUI specialist owns all Unreal UI implementation: widget hierarchy, data binding, CommonUI input routing, widget styling, and UI optimization. They ensure UI follows Unreal best practices and performs well."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Unreal UI implementation — UMG widget hierarchy, data binding, CommonUI input routing, widget styling, UI optimization."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/ui-programmer.md b/.claude/agents/ui-programmer.md
index c0282fa8..5f1ead61 100644
--- a/.claude/agents/ui-programmer.md
+++ b/.claude/agents/ui-programmer.md
@@ -1,8 +1,8 @@
---
name: ui-programmer
-description: "The UI Programmer implements user interface systems: menus, HUDs, inventory screens, dialogue boxes, and UI framework code. Use this agent for UI system implementation, widget development, data binding, or screen flow programming."
+description: "Implements user interface systems — menus, HUDs, inventory screens, dialogue boxes, UI framework code, screen flow."
tools: Read, Glob, Grep, Write, Edit, Bash
-model: sonnet
+model: inherit
maxTurns: 20
---
@@ -45,6 +45,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/unity-addressables-specialist.md b/.claude/agents/unity-addressables-specialist.md
index 2e814375..57459d0e 100644
--- a/.claude/agents/unity-addressables-specialist.md
+++ b/.claude/agents/unity-addressables-specialist.md
@@ -1,7 +1,7 @@
---
name: unity-addressables-specialist
-description: "The Addressables specialist owns all Unity asset management: Addressable groups, asset loading/unloading, memory management, content catalogs, remote content delivery, and asset bundle optimization. They ensure fast load times and controlled memory usage."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Unity asset management — Addressable groups, loading/unloading, content catalogs, remote delivery, asset bundle optimization, fast load times."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/unity-dots-specialist.md b/.claude/agents/unity-dots-specialist.md
index 69736876..a78e0ce4 100644
--- a/.claude/agents/unity-dots-specialist.md
+++ b/.claude/agents/unity-dots-specialist.md
@@ -1,7 +1,7 @@
---
name: unity-dots-specialist
-description: "The DOTS/ECS specialist owns all Unity Data-Oriented Technology Stack implementation: Entity Component System architecture, Jobs system, Burst compiler optimization, hybrid renderer, and DOTS-based gameplay systems. They ensure correct ECS patterns and maximum performance."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Unity Data-Oriented Technology Stack — Entity Component System, Jobs, Burst compiler optimization, hybrid renderer, correct ECS patterns."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/unity-shader-specialist.md b/.claude/agents/unity-shader-specialist.md
index 2b014929..a4a6ec14 100644
--- a/.claude/agents/unity-shader-specialist.md
+++ b/.claude/agents/unity-shader-specialist.md
@@ -1,7 +1,7 @@
---
name: unity-shader-specialist
-description: "The Unity Shader/VFX specialist owns all Unity rendering customization: Shader Graph, custom HLSL shaders, VFX Graph, render pipeline customization (URP/HDRP), post-processing, and visual effects optimization. They ensure visual quality within performance budgets."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Unity rendering — Shader Graph, custom HLSL, VFX Graph, render pipeline customization (URP/HDRP), post-processing within performance budgets."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/unity-specialist.md b/.claude/agents/unity-specialist.md
index d5b2bfb0..7b6bf385 100644
--- a/.claude/agents/unity-specialist.md
+++ b/.claude/agents/unity-specialist.md
@@ -1,8 +1,8 @@
---
name: unity-specialist
-description: "The Unity Engine Specialist is the authority on all Unity-specific patterns, APIs, and optimization techniques. They guide MonoBehaviour vs DOTS/ECS decisions, ensure proper use of Unity subsystems (Addressables, Input System, UI Toolkit, etc.), and enforce Unity best practices."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
-model: sonnet
+description: "Authority on Unity-specific patterns and APIs — guides MonoBehaviour vs DOTS/ECS, Unity subsystems including Addressables and Input System."
+tools: Read, Glob, Grep, Write, Edit, Bash, Agent(unity-dots-specialist, unity-shader-specialist, unity-addressables-specialist, unity-ui-specialist)
+model: inherit
maxTurns: 20
---
You are the Unity Engine Specialist for a game project built in Unity. You are the team's authority on all things Unity.
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
@@ -164,7 +165,10 @@ Before writing any code:
## Sub-Specialist Orchestration
-You have access to the Task tool to delegate to your sub-specialists. Use it when a task requires deep expertise in a specific Unity subsystem:
+You have access to the `Agent` tool to delegate to your sub-specialists, and
+your `tools:` grant names exactly which ones -- you cannot spawn outside that
+set. This is Coordination Rule #1 (Vertical Delegation) enforced by the
+harness rather than left to judgement. Use it when a task requires deep expertise in a specific Unity subsystem:
- `subagent_type: unity-dots-specialist` — Entity Component System, Jobs, Burst compiler
- `subagent_type: unity-shader-specialist` — Shader Graph, VFX Graph, URP/HDRP customization
diff --git a/.claude/agents/unity-ui-specialist.md b/.claude/agents/unity-ui-specialist.md
index beae284a..a2a21fb5 100644
--- a/.claude/agents/unity-ui-specialist.md
+++ b/.claude/agents/unity-ui-specialist.md
@@ -1,7 +1,7 @@
---
name: unity-ui-specialist
-description: "The Unity UI specialist owns all Unity UI implementation: UI Toolkit (UXML/USS), UGUI (Canvas), data binding, runtime UI performance, input handling, and cross-platform UI adaptation. They ensure responsive, performant, and accessible UI."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
+description: "Unity UI implementation — UI Toolkit (UXML/USS), UGUI Canvas, data binding, runtime UI performance, cross-platform adaptation."
+tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
maxTurns: 20
---
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
diff --git a/.claude/agents/unreal-specialist.md b/.claude/agents/unreal-specialist.md
index 971ff593..e7bf5dce 100644
--- a/.claude/agents/unreal-specialist.md
+++ b/.claude/agents/unreal-specialist.md
@@ -1,8 +1,8 @@
---
name: unreal-specialist
-description: "The Unreal Engine Specialist is the authority on all Unreal-specific patterns, APIs, and optimization techniques. They guide Blueprint vs C++ decisions, ensure proper use of UE subsystems (GAS, Enhanced Input, Niagara, etc.), and enforce Unreal best practices across the codebase."
-tools: Read, Glob, Grep, Write, Edit, Bash, Task
-model: sonnet
+description: "Authority on Unreal-specific patterns and APIs — guides Blueprint vs C++, UE subsystems (GAS, Enhanced Input, Niagara, etc.)."
+tools: Read, Glob, Grep, Write, Edit, Bash, Agent(ue-gas-specialist, ue-blueprint-specialist, ue-replication-specialist, ue-umg-specialist)
+model: inherit
maxTurns: 20
---
You are the Unreal Engine Specialist for an indie game project built in Unreal Engine 5. You are the team's authority on all things Unreal.
@@ -42,6 +42,7 @@ Before writing any code:
- Explicitly ask: "May I write this to [filepath(s)]?"
- For multi-file changes, list all affected files
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
6. **Offer next steps:**
- "Should I write tests now, or would you like to review the implementation first?"
@@ -153,7 +154,10 @@ Before writing any code:
## Sub-Specialist Orchestration
-You have access to the Task tool to delegate to your sub-specialists. Use it when a task requires deep expertise in a specific Unreal subsystem:
+You have access to the `Agent` tool to delegate to your sub-specialists, and
+your `tools:` grant names exactly which ones -- you cannot spawn outside that
+set. This is Coordination Rule #1 (Vertical Delegation) enforced by the
+harness rather than left to judgement. Use it when a task requires deep expertise in a specific Unreal subsystem:
- `subagent_type: ue-gas-specialist` — Gameplay Ability System, effects, attributes, tags
- `subagent_type: ue-blueprint-specialist` — Blueprint architecture, BP/C++ boundary, optimization
diff --git a/.claude/agents/ux-designer.md b/.claude/agents/ux-designer.md
index e0f62c78..2e424dbd 100644
--- a/.claude/agents/ux-designer.md
+++ b/.claude/agents/ux-designer.md
@@ -1,8 +1,8 @@
---
name: ux-designer
-description: "The UX Designer owns user experience flows, interaction design, accessibility, information architecture, and input handling design. Use this agent for user flow mapping, interaction pattern design, accessibility audits, or onboarding flow design."
+description: "User experience flows, interaction design, information architecture — user flow mapping, interaction pattern design, onboarding, accessibility audits."
tools: Read, Glob, Grep, Write, Edit, WebSearch
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -41,6 +41,7 @@ Before proposing any design:
- Show the complete draft or summary
- Explicitly ask: "May I write this to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/world-builder.md b/.claude/agents/world-builder.md
index 1f638e76..16090649 100644
--- a/.claude/agents/world-builder.md
+++ b/.claude/agents/world-builder.md
@@ -1,8 +1,8 @@
---
name: world-builder
-description: "The World Builder designs detailed world lore: factions, cultures, history, geography, ecology, and the rules that govern the game world. Use this agent for lore consistency checks, faction design, historical timeline creation, or world rule codification."
+description: "World builder for lore — factions, cultures, history, geography, ecology, world rules. Faction design, lore consistency checks."
tools: Read, Glob, Grep, Write, Edit
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -46,6 +46,7 @@ Before proposing any design:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
#### Collaborative Mindset
diff --git a/.claude/agents/writer.md b/.claude/agents/writer.md
index 4161ee92..56f03b74 100644
--- a/.claude/agents/writer.md
+++ b/.claude/agents/writer.md
@@ -1,8 +1,8 @@
---
name: writer
-description: "The Writer creates dialogue, lore entries, item descriptions, environmental text, and all player-facing written content. Use this agent for dialogue writing, lore creation, item/ability descriptions, or in-game text of any kind."
+description: "Writer of player-facing text — dialogue, lore entries, item and ability descriptions, environmental text."
tools: Read, Glob, Grep, Write, Edit
-model: sonnet
+model: inherit
maxTurns: 20
disallowedTools: Bash
memory: project
@@ -45,6 +45,7 @@ Before writing any code:
- Show the draft section or summary
- Explicitly ask: "May I write this section to [filepath]?"
- Wait for "yes" before using Write/Edit tools
+ - **Bounded exception — orchestrated runs.** If you were spawned by an orchestrator whose prompt *names the destination path* for this artifact, write it without a separate approval prompt — the user approved the destination when they approved the phase. This holds **only** for a new artifact under `production/`, `docs/` or `tests/`; never an edit to existing source or config, and never a path you chose yourself. If you were invoked directly, or no path was named for you, ask as above.
- If user says "no" or "change X", iterate and return to step 3
6. **Offer next steps:**
diff --git a/.claude/docs/agent-coordination-map.md b/.claude/docs/agent-coordination-map.md
deleted file mode 100644
index 260b617d..00000000
--- a/.claude/docs/agent-coordination-map.md
+++ /dev/null
@@ -1,281 +0,0 @@
-# Agent Coordination and Delegation Map
-
-## Organizational Hierarchy
-
-```
- [Human Developer]
- |
- +---------------+---------------+
- | | |
- creative-director technical-director producer
- | | |
- +--------+--------+ | (coordinates all)
- | | | |
- game-designer art-dir narr-dir lead-programmer qa-lead audio-dir
- | | | | | |
- +--+--+ | +--+--+ +--+--+--+--+--+ | |
- | | | | | | | | | | | | | |
- sys lvl eco ta wrt wrld gp ep ai net tl ui qa-t snd
- |
- +---+---+
- | |
- perf-a devops analytics
-
- Additional Leads (report to producer/directors):
- release-manager -- Release pipeline, versioning, deployment
- localization-lead -- i18n, string tables, translation pipeline
- prototyper -- Rapid throwaway prototypes, concept validation
- security-engineer -- Anti-cheat, exploits, data privacy, network security
- accessibility-specialist -- WCAG, colorblind, remapping, text scaling
- live-ops-designer -- Seasons, events, battle passes, retention, live economy
- community-manager -- Patch notes, player feedback, crisis comms
-
- Engine Specialists (use the SET matching your engine):
- unreal-specialist -- UE5 lead: Blueprint/C++, GAS overview, UE subsystems
- ue-gas-specialist -- GAS: abilities, effects, attributes, tags, prediction
- ue-blueprint-specialist -- Blueprint: BP/C++ boundary, graph standards, optimization
- ue-replication-specialist -- Networking: replication, RPCs, prediction, bandwidth
- ue-umg-specialist -- UI: UMG, CommonUI, widget hierarchy, data binding
-
- unity-specialist -- Unity lead: MonoBehaviour/DOTS, Addressables, URP/HDRP
- unity-dots-specialist -- DOTS/ECS: Jobs, Burst, hybrid renderer
- unity-shader-specialist -- Shaders: Shader Graph, VFX Graph, SRP customization
- unity-addressables-specialist -- Assets: async loading, bundles, memory, CDN
- unity-ui-specialist -- UI: UI Toolkit, UGUI, UXML/USS, data binding
-
- godot-specialist -- Godot 4 lead: GDScript, node/scene, signals, resources
- godot-gdscript-specialist -- GDScript: static typing, patterns, signals, performance
- godot-csharp-specialist -- C#: .NET patterns, [Signal] delegates, async, type-safe node access
- godot-shader-specialist -- Shaders: Godot shading language, visual shaders, VFX
- godot-gdextension-specialist -- Native: C++/Rust bindings, GDExtension, build systems
-```
-
-### Legend
-```
-sys = systems-designer gp = gameplay-programmer
-lvl = level-designer ep = engine-programmer
-eco = economy-designer ai = ai-programmer
-ta = technical-artist net = network-programmer
-wrt = writer tl = tools-programmer
-wrld = world-builder ui = ui-programmer
-snd = sound-designer qa-t = qa-tester
-narr-dir = narrative-director perf-a = performance-analyst
-art-dir = art-director
-```
-
-## Delegation Rules
-
-### Who Can Delegate to Whom
-
-| From | Can Delegate To |
-|------|----------------|
-| creative-director | game-designer, art-director, audio-director, narrative-director |
-| technical-director | lead-programmer, devops-engineer, performance-analyst, technical-artist (technical decisions) |
-| producer | Any agent (task assignment within their domain only) |
-| game-designer | systems-designer, level-designer, economy-designer |
-| lead-programmer | gameplay-programmer, engine-programmer, ai-programmer, network-programmer, tools-programmer, ui-programmer |
-| art-director | technical-artist, ux-designer |
-| audio-director | sound-designer |
-| narrative-director | writer, world-builder |
-| qa-lead | qa-tester |
-| release-manager | devops-engineer (release builds), qa-lead (release testing) |
-| localization-lead | writer (string review), ui-programmer (text fitting) |
-| prototyper | (works independently, reports findings to producer and relevant leads) |
-| security-engineer | network-programmer (security review), lead-programmer (secure patterns) |
-| accessibility-specialist | ux-designer (accessible patterns), ui-programmer (implementation), qa-tester (a11y testing) |
-| [engine]-specialist | engine sub-specialists (delegates subsystem-specific work) |
-| [engine] sub-specialists | (advises all programmers on engine subsystem patterns and optimization) |
-| live-ops-designer | economy-designer (live economy), community-manager (event comms), analytics-engineer (engagement metrics) |
-| community-manager | (works with producer for approval, release-manager for patch note timing) |
-
-### Escalation Paths
-
-| Situation | Escalate To |
-|-----------|------------|
-| Two designers disagree on a mechanic | game-designer |
-| Game design vs narrative conflict | creative-director |
-| Game design vs technical feasibility | producer (facilitates), then creative-director + technical-director |
-| Art vs audio tonal conflict | creative-director |
-| Code architecture disagreement | technical-director |
-| Cross-system code conflict | lead-programmer, then technical-director |
-| Schedule conflict between departments | producer |
-| Scope exceeds capacity | producer, then creative-director for cuts |
-| Quality gate disagreement | qa-lead, then technical-director |
-| Performance budget violation | performance-analyst flags, technical-director decides |
-
-## Common Workflow Patterns
-
-### Pattern 1: New Feature (Full Pipeline)
-
-```
-1. creative-director -- Approves feature concept aligns with vision
-2. game-designer -- Creates design document with full spec
-3. producer -- Schedules work, identifies dependencies
-4. lead-programmer -- Designs code architecture, creates interface sketch
-5. [specialist-programmer] -- Implements the feature
-6. technical-artist -- Implements visual effects (if needed)
-7. writer -- Creates text content (if needed)
-8. sound-designer -- Creates audio event list (if needed)
-9. qa-tester -- Writes test cases
-10. qa-lead -- Reviews and approves test coverage
-11. lead-programmer -- Code review
-12. qa-tester -- Executes tests
-13. producer -- Marks task complete
-```
-
-### Pattern 2: Bug Fix
-
-```
-1. qa-tester -- Files bug report with /bug-report
-2. qa-lead -- Triages severity and priority
-3. producer -- Assigns to sprint (if not S1)
-4. lead-programmer -- Identifies root cause, assigns to programmer
-5. [specialist-programmer] -- Fixes the bug
-6. lead-programmer -- Code review
-7. qa-tester -- Verifies fix and runs regression
-8. qa-lead -- Closes bug
-```
-
-### Pattern 3: Balance Adjustment
-
-```
-1. analytics-engineer -- Identifies imbalance from data (or player reports)
-2. game-designer -- Evaluates the issue against design intent
-3. economy-designer -- Models the adjustment
-4. game-designer -- Approves the new values
-5. [data file update] -- Change configuration values
-6. qa-tester -- Regression test affected systems
-7. analytics-engineer -- Monitor post-change metrics
-```
-
-### Pattern 4: New Area/Level
-
-```
-1. narrative-director -- Defines narrative purpose and beats for the area
-2. world-builder -- Creates lore and environmental context
-3. level-designer -- Designs layout, encounters, pacing
-4. game-designer -- Reviews mechanical design of encounters
-5. art-director -- Defines visual direction for the area
-6. audio-director -- Defines audio direction for the area
-7. [implementation by relevant programmers and artists]
-8. writer -- Creates area-specific text content
-9. qa-tester -- Tests the complete area
-```
-
-### Pattern 5: Sprint Cycle
-
-```
-1. producer -- Plans sprint with /sprint-plan new
-2. [All agents] -- Execute assigned tasks
-3. producer -- Daily status with /sprint-plan status
-4. qa-lead -- Continuous testing during sprint
-5. lead-programmer -- Continuous code review during sprint
-6. producer -- Sprint retrospective with post-sprint hook
-7. producer -- Plans next sprint incorporating learnings
-```
-
-### Pattern 6: Milestone Checkpoint
-
-```
-1. producer -- Runs /milestone-review
-2. creative-director -- Reviews creative progress
-3. technical-director -- Reviews technical health
-4. qa-lead -- Reviews quality metrics
-5. producer -- Facilitates go/no-go discussion
-6. [All directors] -- Agree on scope adjustments if needed
-7. producer -- Documents decisions and updates plans
-```
-
-### Pattern 7: Release Pipeline
-
-```text
-1. producer -- Declares release candidate, confirms milestone criteria met
-2. release-manager -- Cuts release branch, generates /release-checklist
-3. qa-lead -- Runs full regression, signs off on quality
-4. localization-lead -- Verifies all strings translated, text fitting passes
-5. performance-analyst -- Confirms performance benchmarks within targets
-6. devops-engineer -- Builds release artifacts, runs deployment pipeline
-7. release-manager -- Generates /changelog, tags release, creates release notes
-8. technical-director -- Final sign-off on major releases
-9. release-manager -- Deploys and monitors for 48 hours
-10. producer -- Marks release complete
-```
-
-### Pattern 8: Concept Prototype (early — before GDDs)
-
-```text
-1. game-designer -- Defines the hypothesis and success criteria
-2. prototyper -- Scaffolds concept prototype with /prototype
-3. prototyper -- Builds minimal implementation (1-3 days)
-4. game-designer -- Evaluates prototype against criteria
-5. prototyper -- Documents findings in REPORT.md
-6. creative-director -- PROCEED / PIVOT / KILL decision (full mode only)
-7. game-designer -- Informs GDD writing with prototype learnings if PROCEED
-```
-
-### Pattern 8b: Vertical Slice (pre-production — after GDDs and architecture)
-
-```text
-1. game-designer -- Confirms slice scope against GDDs
-2. prototyper -- Builds production-quality end-to-end build with /vertical-slice
-3. prototyper -- Conducts internal playtest sessions (minimum 1)
-4. prototyper -- Documents findings in REPORT.md
-5. creative-director -- Go/no-go decision on proceeding to Production (full mode)
-6. producer -- Schedules Production epics/sprints if PROCEED
-```
-
-### Pattern 9: Live Event / Season Launch
-
-```text
-1. live-ops-designer -- Designs event/season content, rewards, schedule
-2. game-designer -- Validates gameplay mechanics for event
-3. economy-designer -- Balances event economy and reward values
-4. narrative-director -- Provides seasonal narrative theme
-5. writer -- Creates event descriptions and lore
-6. producer -- Schedules implementation work
-7. [implementation by relevant programmers]
-8. qa-lead -- Test event flow end-to-end
-9. community-manager -- Drafts event announcement and patch notes
-10. release-manager -- Deploys event content
-11. analytics-engineer -- Monitors event participation and metrics
-12. live-ops-designer -- Post-event analysis and learnings
-```
-
-## Cross-Domain Communication Protocols
-
-### Design Change Notification
-
-When a design document changes, the game-designer must notify:
-- lead-programmer (implementation impact)
-- qa-lead (test plan update needed)
-- producer (schedule impact assessment)
-- Relevant specialist agents depending on the change
-
-### Architecture Change Notification
-
-When an ADR is created or modified, the technical-director must notify:
-- lead-programmer (code changes needed)
-- All affected specialist programmers
-- qa-lead (testing strategy may change)
-- producer (schedule impact)
-
-### Asset Standard Change Notification
-
-When the art bible or asset standards change, the art-director must notify:
-- technical-artist (pipeline changes)
-- All content creators working with affected assets
-- devops-engineer (if build pipeline is affected)
-
-## Anti-Patterns to Avoid
-
-1. **Bypassing the hierarchy**: A specialist agent should never make decisions
- that belong to their lead without consultation.
-2. **Cross-domain implementation**: An agent should never modify files outside
- their designated area without explicit delegation from the relevant owner.
-3. **Shadow decisions**: All decisions must be documented. Verbal agreements
- without written records lead to contradictions.
-4. **Monolithic tasks**: Every task assigned to an agent should be completable
- in 1-3 days. If it is larger, it must be broken down first.
-5. **Assumption-based implementation**: If a spec is ambiguous, the implementer
- must ask the specifier rather than guessing. Wrong guesses are more expensive
- than a question.
diff --git a/.claude/docs/agent-teams.md b/.claude/docs/agent-teams.md
new file mode 100644
index 00000000..b24f2837
--- /dev/null
+++ b/.claude/docs/agent-teams.md
@@ -0,0 +1,27 @@
+# Agent Teams (experimental — opt-in)
+
+> On-demand reference. Demoted out of `coordination-rules.md` (an always-loaded
+> CLAUDE.md import) in v1.1 — read this when actually considering a team, not
+> on every turn.
+
+Multiple independent Claude Code *sessions* running simultaneously, coordinated
+via a shared task list. Each session has its own context window and token budget.
+Requires the `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` environment variable.
+
+## Use agent teams when
+
+- Work spans multiple subsystems that will not touch the same files
+- Each workstream would take >30 minutes and benefits from true parallelism
+- A senior agent (technical-director, producer) needs to coordinate 3+ specialist
+ sessions working on different epics simultaneously
+
+## Do not use agent teams when
+
+- One session's output is required as input for another (use sequential subagents)
+- The task fits in a single session's context (use subagents instead)
+- Cost is a concern — each team member burns tokens independently
+
+## Current status
+
+Opt-in via `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`. Document first usage here
+when adopted.
diff --git a/.claude/docs/automation-modes.md b/.claude/docs/automation-modes.md
new file mode 100644
index 00000000..ecb80f7e
--- /dev/null
+++ b/.claude/docs/automation-modes.md
@@ -0,0 +1,261 @@
+# Automation Modes — Shared Skill Pattern
+
+This document defines the standard `modes.automation` pattern for every skill
+that uses `AskUserQuestion` or writes files. Skills reference this document
+instead of embedding the full mode-handling rules inline — eliminating drift
+when the pattern needs updating.
+
+**Scope**: ~44 skills across authoring, review, team orchestration,
+implementation, and utility categories. Any skill that gates a decision
+through `AskUserQuestion` or writes files should follow this pattern.
+
+**Companion spec**: `.claude/docs/effects-map.md`
+section `modes.automation` is the source of truth for behavior. This document
+is the implementation pattern.
+
+> **Do not read `effects-map.md` during a skill run** — it is ~110 KB, a
+> reference for authoring the spec rather than a runtime input, and **this
+> document is self-sufficient** for deciding what to ask and what to proceed on.
+> If a case genuinely is not covered here, read only its `modes.automation`
+> section, never the file.
+
+---
+
+## How to Use This Document
+
+In any skill, add a single resolution step at startup and reference the
+mode-aware AskUserQuestion pattern below at each gated site.
+
+**Startup prelude** (add near Phase 0 / Phase 1):
+
+```
+Resolve automation mode (once, store for the run):
+1. Read `modes.automation` from `project.local.yaml` (if present) → use that
+2. Else read `modes.automation` from `project.yaml` → use that value
+3. Else → default to `collaborative`
+
+Pattern reference: `.claude/docs/automation-modes.md`.
+```
+
+This resolution is automatic via `get_effective_yaml_key modes.automation` —
+the helper deep-merges project.local.yaml on top of project.yaml.
+
+**At each AskUserQuestion site**, follow the pattern table in §Universal
+Rules below. The skill author labels each decision as **major** or **minor**
+(per the classification matrix in §Major vs Minor) so the pattern can apply
+the right rule.
+
+---
+
+## The Three Modes
+
+| Mode | Speed | Control | What changes |
+|------|-------|---------|--------------|
+| `collaborative` | Slowest | Full — every decision is the user's | Default. Q→O→D→Draft→Approval strictly followed. |
+| `guided` | Balanced | High — major decisions are the user's, minor ones proceed automatically | AI states recommendation and proceeds for minor decisions. AskUserQuestion reserved for major decisions. |
+| `autonomous` | Fastest | Low — AI decides, logs, and proceeds | No AskUserQuestion (except `automation_always_ask` categories). All decisions logged. |
+
+**Default**: `collaborative`. New projects start here.
+
+**Set by**: `/start`, `/settings`.
+
+---
+
+## Universal Rules per Mode
+
+### Collaborative (current v1.0 behavior — no change)
+
+- `AskUserQuestion` called for every multi-option decision
+- 2–4 options presented with pros/cons for every design choice
+- Full draft shown and approved before every file write
+- "May I write this to [filepath]?" asked before every write
+- Section-by-section approval in multi-section authoring skills
+- Multi-file changes require explicit approval
+
+### Guided
+
+- `AskUserQuestion` called for **major decisions only** (see classification below)
+- Minor decisions: AI states recommendation inline and proceeds — e.g.
+ > *"Going with a static utility pattern here — it fits the existing architecture. Continuing unless you want to change direction."*
+- Draft shown briefly before writing — proceeds after a short summary, does not wait for explicit "yes"
+- "May I write?" asked for **new files only** — updates to existing files proceed directly
+- Still presents options for major decisions but caps at 2 choices with a clear recommendation
+- Multi-section authoring: writes each approved section immediately, no per-section confirmation
+
+### Autonomous
+
+- No `AskUserQuestion` calls **except** for categories listed in `modes.automation_always_ask`
+- No draft review
+- No "May I write?" prompts — writes directly
+- Picks the recommended option for every decision without presenting alternatives
+- All decisions logged via `log_decision` (helper in yaml-helper.sh) to
+ `production/session-logs/decision-log.md`
+- User reviews decision log post-session to audit choices made
+
+---
+
+## Major vs Minor Decision Classification
+
+Skills label each gated decision as **major** or **minor** before applying
+the mode rules.
+
+### Major — always use AskUserQuestion in guided mode
+
+| Decision type | Example |
+|---------------|---------|
+| Choosing a system name or document path | "What should we call this system?" |
+| Mutually exclusive design directions | "Real-time or turn-based?" |
+| Any choice that gates downstream work | Engine choice, architecture approach |
+| Scope changes | "Cut this feature or slip the deadline?" |
+| Any decision that can't be changed without significant rework | Core loop mechanic |
+
+### Minor — AI recommends and proceeds in guided mode
+
+| Decision type | Example |
+|---------------|---------|
+| Which section to work on next | "Moving to Edge Cases next" |
+| Optional section inclusion | "Adding a Visual Notes section — fits the system" |
+| Formatting and structure choices | Heading levels, table vs prose |
+| Adding detail to an already-decided direction | Sub-options within an approved approach |
+| Next-step routing after a phase completes | "Running design-review now" |
+
+---
+
+## `automation_always_ask` Categories
+
+Even in `autonomous` mode, certain decision categories ALWAYS trigger
+`AskUserQuestion`. The configured list lives at
+`modes.automation_always_ask` in `project.yaml`.
+
+**Default** (when unset): `[scope_changes, file_deletions, schema_changes]`.
+
+### Recognized categories
+
+**This table is the set you may configure, NOT the set that always asks.** Only
+the categories actually listed in `modes.automation_always_ask` — the three
+defaults above, unless the project overrides them — interrupt an `autonomous`
+run. The other rows do nothing until a project opts into them. Read the resolved
+list with `resolve_config` rather than assuming a row here is active; a real run
+logged two `architecture_decisions` as rule violations on a project where that
+category was never configured.
+
+| Category | Examples of decisions in this category |
+|----------|----------------------------------------|
+| `scope_changes` | Cutting a feature, slipping a deadline, splitting/merging an epic, removing acceptance criteria |
+| `file_deletions` | Removing a story, deleting a GDD, removing a system, removing a test file |
+| `schema_changes` | Changes to project.yaml, story template, control manifest, ADR template, GDD template |
+| `architecture_decisions` | New ADR creation, ADR replacement, system boundary changes |
+| `version_bumps` | Engine version change, framework version bump, dependency major version change |
+| `external_calls` | Invoking external APIs (asset gen, AI services) when in autonomous mode |
+
+### Helper
+
+```bash
+is_always_ask_category <category>
+```
+
+Returns 0 if the named category is in `modes.automation_always_ask`,
+1 otherwise. Skills use this at decision points that fall into any
+of the six categories above.
+
+---
+
+## Exemptions — Skills That Ignore the Automation Setting
+
+These skills always behave as `collaborative` regardless of the setting:
+
+| Skill | Why always collaborative |
+|-------|--------------------------|
+| `hotfix` | Emergency decisions — user must approve scope and risk before any action |
+| `gate-check` | Results must be reviewed — a gate verdict without acknowledgement defeats the purpose |
+| `day-one-patch` | Release-critical — every action needs explicit sign-off |
+| `setup-engine` | One-time irreversible choice that affects the entire project |
+
+These skills do NOT add the automation prelude described above. They keep
+the v1.0 Q→O→D→Draft→Approval protocol exactly.
+
+---
+
+## Decision Log Format (Autonomous Mode)
+
+When `autonomous` mode skips an `AskUserQuestion`, the skill calls
+`log_decision` to write a structured entry. Format per entry:
+
+```markdown
+## [timestamp] — [skill-name]
+
+**Decision point:** [what was being decided]
+**Options considered:** [list of options that would have been presented]
+**Chosen:** [what was picked]
+**Reason:** [one-line rationale]
+**Category:** [scope_changes | file_deletions | schema_changes | … or "minor"]
+```
+
+Written to `production/session-logs/decision-log.md` (append-only, never
+truncated, created if absent). The user reviews the log post-session to
+audit choices made.
+
+### Helper
+
+```bash
+log_decision "<skill-name>" "<decision-point>" "<options>" "<chosen>" "<reason>" "<category>"
+```
+
+Wraps the format above. Skills call this at every decision point in
+autonomous mode, including ones where the chosen value differs from
+the recommended default (so the audit trail is complete).
+
+### What to log, and at what granularity
+
+These rules keep autonomous logs consistent across runs:
+
+- **Log every decision that would have shown an `AskUserQuestion` widget** —
+ including option/framing choices, not only final approvals. The
+ framing/options decisions (which approach, which formula, which edge
+ cases) are usually the most informative entries; do not log only the
+ rote "approve this section" steps.
+- **Collapse a single multi-tab widget into ONE entry.** List each tab's
+ choice under **Chosen** rather than emitting one entry per tab.
+- **Do NOT log conversational answers the model synthesizes for itself**
+ (e.g. internal Q&A while drafting a section) — only log what would have
+ been an explicit user decision.
+- **Do NOT emit a separate entry for routine "may I write?" file gates** —
+ fold the write into the decision it implements (autonomous mode writes
+ directly anyway).
+
+### Categorizing data-file writes
+
+The most common categorization mistake is treating a data-file append as a
+`schema_changes` decision:
+
+- **Appending facts to a registry or index** — e.g.
+ `design/registry/entities.yaml`, `design/gdd/systems-index.md` — is
+ **`minor`**. It adds data without altering a *template*.
+- **`schema_changes`** means editing the *structure* of `project.yaml` or a
+ template (story / ADR / GDD / control-manifest template). These are
+ always-ask.
+- **When genuinely unsure** between `minor` and an always-ask category,
+ prefer the always-ask category and prompt — failing safe.
+
+---
+
+## The Pattern Skills Apply at Each AskUserQuestion Site
+
+```
+At each decision point in this skill:
+
+1. Classify the decision: major or minor (see §Major vs Minor above).
+2. Check whether the decision falls into an `automation_always_ask`
+ category: scope_changes, file_deletions, schema_changes,
+ architecture_decisions, version_bumps, external_calls.
+3. Apply the mode rule:
+
+ collaborative: AskUserQuestion always.
+ guided + major: AskUserQuestion with capped options + recommendation.
+ guided + minor: State recommendation inline, proceed.
+ autonomous + always_ask: AskUserQuestion (regardless of mode).
+ autonomous + other: Pick recommended, log via log_decision, proceed.
+```
+
+This is the contract. Skills that follow this pattern produce
+consistent behavior across all three automation modes.
diff --git a/.claude/docs/code-root-resolution.md b/.claude/docs/code-root-resolution.md
new file mode 100644
index 00000000..4ab8096f
--- /dev/null
+++ b/.claude/docs/code-root-resolution.md
@@ -0,0 +1,67 @@
+# Code Root Resolution
+
+Shared procedure for any skill that reads, scans, counts or writes game source
+files. Referenced from the point of use in each such skill. Those skills keep
+the one load-bearing imperative inline — **an unresolved code root means the
+check did not run** — and cite this file for the resolution order.
+
+`.claude/docs/directory-structure.md` is the authority for which directory holds
+code. This file is the procedure for applying it.
+
+## The roots
+
+| `engine.name` | Code root | Why it cannot be `src/` |
+|---|---|---|
+| Godot | `src/` | No constraint; Godot loads from `res://` anywhere under the project root |
+| Unity | `Assets/` | Unity compiles **only** `Assets/` and `Packages/` |
+| Unreal | `Source/<Module>/` | UnrealBuildTool discovers modules under `Source/`; content lives in `Content/` |
+
+`src/` is the **Godot row of that table, not a universal path.**
+
+## Resolution order
+
+1. `engine.name` from `project.local.yaml`, then `project.yaml`.
+2. The legacy mirror: an `Engine:` line in
+ `.claude/docs/technical-preferences.md`. A value of `[TO BE CONFIGURED]`
+ does not count.
+3. Derivation from the tree, but **only when it is unambiguous**. Exactly one of
+ `src/`, `Assets/` or `Source/` present means that is the root. Two or more
+ present means the project is genuinely undecidable — do not guess.
+4. Otherwise: **unresolved.**
+
+The hooks already implement exactly this as `resolve_code_root()` in
+`.claude/hooks/yaml-helper.sh`. Skills must match its semantics so that a hook
+and a skill never disagree about where the code lives.
+
+## Unresolved does not default to `src/`
+
+This is the rule the whole file exists for, and it is obligation 2 of
+`.claude/rules/skill-authoring.md`: an absent value may not default to the
+permissive one.
+
+**For a read or scan:** report `NOT ASSESSED — code root unresolved` and say
+which check did not run. Never report zero hits.
+
+A scan anchored to a root the project does not use matches nothing, and
+**nothing is indistinguishable from a clean result.** A localization check finds
+no hardcoded strings; a security scan finds no secrets; a content audit counts
+no implemented content; a stage detector counts no source files and calls a
+finished project greenfield. Every one of those reads as a pass. This has been
+found repeatedly across skills and hooks, which is why the resolution lives in
+one place now.
+
+**For a write:** do not write. Report the unresolved root and stop.
+
+Writing game code to the wrong root is worse than a false pass, because it
+produces a project that cannot build: on Unity, source placed outside `Assets/`
+is never compiled and never appears in the editor, so the work is silently
+inert. Resolving the engine in order to pick a specialist agent is **not** the
+same as resolving the code root — a skill can do the first correctly and still
+write to the wrong directory.
+
+## Applying it
+
+Where a skill says `src/`, read it as *the code root* and substitute the table
+above. Where a skill greps, glob the resolved root. Where a skill writes,
+write under the resolved root and use the engine's own conventions beneath it
+(`Assets/Scripts/<System>/` on Unity, `Source/<Module>/<System>/` on Unreal).
diff --git a/.claude/docs/coding-standards.md b/.claude/docs/coding-standards.md
index d86347d8..c59dfbc6 100644
--- a/.claude/docs/coding-standards.md
+++ b/.claude/docs/coding-standards.md
@@ -1,7 +1,10 @@
# Coding Standards
- All game code must include doc comments on public APIs
-- Every system must have a corresponding architecture decision record in `docs/architecture/`
+- Architecture decisions are recorded as ADRs in `docs/architecture/`. **How many is
+ set by `modes.workflow`** — all ADRs at `full`, *critical* ADRs only at `standard`,
+ and none required at `minimal`, where the decision log and `design/game-brief.md`
+ carry the rationale instead. See `.claude/docs/workflow-modes.md`.
- Gameplay values must be data-driven (external config), never hardcoded
- All public methods must be unit-testable (dependency injection over singletons)
- Commits must reference the relevant design document or task ID
@@ -9,12 +12,22 @@
- **Verification-driven development**: Write tests first when adding gameplay systems.
For UI changes, verify with screenshots. Compare expected output to actual output
before marking work complete. Every implementation should have a way to prove it works.
+- **A parse check is not a run.** Every story that changes something
+ player-observable is launched and observed before it closes, and the
+ observation is a retained screenshot in `production/qa/evidence/`. Procedure
+ per engine: `.claude/docs/run-and-observe.md`. Not waived at
+ `qa.level: minimal` — tests are, the look is not.
# Design Document Standards
- All design docs use Markdown
- Each mechanic has a dedicated document in `design/gdd/`
-- Documents must include these 8 required sections:
+- **How many of the 8 sections are required depends on `modes.workflow`** —
+ all 8 at `full`, 5 (+ Formulas when the system defines numeric rules — rates,
+ curves, thresholds, costs; the system's `Category` is a hint, not the test) at
+ `standard`, and no
+ GDD at all at `minimal`, where `design/game-brief.md` is the design record.
+ See `.claude/docs/workflow-modes.md`. The 8 sections:
1. **Overview** -- one-paragraph summary
2. **Player Fantasy** -- intended feeling and experience
3. **Detailed Rules** -- unambiguous mechanics
@@ -31,14 +44,34 @@
All stories must have appropriate test evidence before they can be marked Done:
-| Story Type | Required Evidence | Location | Gate Level |
+| Story Type | Required Evidence | Location | Default Gate Level |
|---|---|---|---|
| **Logic** (formulas, AI, state machines) | Automated unit test — must pass | `tests/unit/[system]/` | BLOCKING |
| **Integration** (multi-system) | Integration test OR documented playtest | `tests/integration/[system]/` | BLOCKING |
-| **Visual/Feel** (animation, VFX, feel) | Screenshot + lead sign-off | `production/qa/evidence/` | ADVISORY |
-| **UI** (menus, HUD, screens) | Manual walkthrough doc OR interaction test | `production/qa/evidence/` | ADVISORY |
+| **Visual/Feel** (animation, VFX, feel) | Retained screenshot + lead sign-off | `production/qa/evidence/` | BLOCKING |
+| **UI** (menus, HUD, screens) | Retained screenshot of each screen touched | `production/qa/evidence/` | BLOCKING |
| **Config/Data** (balance tuning) | Smoke check pass | `production/qa/smoke-[date].md` | ADVISORY |
+The **Default Gate Level** applies when `testing.strict` is not set in
+`project.yaml`. A project may override it per test type: `testing.strict.logic`,
+`.integration`, `.visual`, `.ui`, and `.config` each take `true` (BLOCKING) or
+`false` (ADVISORY). `/story-done`, `/story-readiness`, `/dev-story`,
+`/gate-check`, and `/smoke-check` resolve the effective level from that setting,
+falling back to the defaults above when it is absent.
+
+> **Why Visual and UI block.** "Retained" is load-bearing — the screenshot must
+> still be on disk in `production/qa/evidence/` when the story is closed. One
+> that was captured and discarded is an assertion, not evidence. These two rows
+> block because for a game the way it looks *is* the product: an advisory visual
+> gate gets deferred in favour of whatever does block, and the result is a
+> well-tested game that looks wrong.
+
+> **Exception — `/smoke-check`.** The ADVISORY default for **Config/Data** above
+> applies to *per-story evidence* gates. `/smoke-check` is a build-health gate,
+> not a per-story evidence gate, so its own unset default for
+> `testing.strict.config` is **BLOCKING**. This divergence is intentional and is
+> documented at both sites; do not reconcile one to the other.
+
## Automated Test Rules
- **Naming**: `[system]_[feature]_test.[ext]` for files; `test_[scenario]_[expected]` for functions
diff --git a/.claude/docs/config-resolution.md b/.claude/docs/config-resolution.md
new file mode 100644
index 00000000..1dbb2e5a
--- /dev/null
+++ b/.claude/docs/config-resolution.md
@@ -0,0 +1,262 @@
+# Config Resolution
+
+How a skill learns its effective settings. **One command, no prose chain.**
+
+## The rule
+
+A skill that needs config puts this near the top of its **body** (not frontmatter):
+
+````markdown
+!`source .claude/hooks/yaml-helper.sh 2>/dev/null && resolve_config`
+````
+
+The command runs as preprocessing *before the model sees the skill*, and its
+output replaces the placeholder inline. The skill then reads the resolved values
+and **does not re-derive them**.
+
+Skills that resolve a per-system tier pass the system name: `resolve_config combat`.
+
+## Why the body, not `context:`
+
+`` !`cmd` `` in the skill body is the documented mechanism. Frontmatter
+`context:` accepts only `context: fork` — it does **not** run shell. A
+`context: |` block containing `!` commands **never executes**; put the command in
+the skill body instead.
+
+Two consequences:
+
+- `allowed-tools` does **not** gate this. It governs tools the *model* calls
+ during the turn; preprocessing happens before that. A skill needs no `Bash`
+ grant to use `resolve_config`.
+- The repo-wide setting `disableSkillShellExecution: true` disables it. If a
+ skill sees no config block, it falls back to the defaults below.
+
+## The block
+
+```
+=== CCGS Resolved Config ===
+review_mode: lean (production/review-mode.txt)
+automation: guided (project.local.yaml)
+workflow: standard (project.yaml)
+docs.density: balanced (default)
+story_granularity: balanced (default)
+qa.level: standard (default)
+team.size: individual (rigor:standard)
+project.stage: Systems Design (production/stage.txt)
+automation_always_ask: scope_changes, file_deletions, schema_changes (default)
+engine: Godot 4.6 (project.yaml)
+testing.strict: logic=true integration=false visual=unset ui=unset config=unset (unset = each skill applies its own default)
+system_overrides: combat=full inventory=minimal
+notes: none
+Values above are fully resolved (local -> yaml -> legacy -> default). Use as-is.
+An inline --review flag, if passed, overrides review_mode.
+=== end CCGS config ===
+```
+
+Every knob line ends with its **provenance** in parentheses. That is what makes a
+wrong value diagnosable — `review_mode: solo (default)` when `project.yaml` says
+`full` points straight at the problem.
+
+## Resolution chain
+
+| Step | Source | Applies to |
+|---|---|---|
+| 1 | `project.local.yaml` | any setting on the `/settings --local` whitelist (12 keys — `modes.review_mode`, `modes.automation`, `modes.automation_always_ask`, `team.size`, all five `testing.strict.*`, `performance.enforce`, `features.*`) |
+| 2 | `project.yaml` | all keys |
+| 3 | legacy plain-text mirror | `modes.review_mode` → `production/review-mode.txt`; `project.stage` → `production/stage.txt` |
+| 4 | **`modes.rigor` expansion** | the six knobs `rigor` fronts — `modes.workflow`, `docs.density`, `qa.level`, `modes.story_granularity`, `modes.review_mode`, `team.size` |
+| 5 | documented default | the table below |
+
+An **enum-invalid value does not win** — the chain continues past it and the
+rejected value is named on the `notes:` line. A typo degrades to the documented
+default rather than propagating a nonsense mode into every skill.
+
+> **Step 4 sits below every explicit source and above the terminal default, and
+> that ordering is the whole back-compat guarantee.** A `project.yaml` that
+> already sets `docs.density: terse` resolves exactly as it did before `rigor`
+> existed, because step 2 answers first. Invert steps 4 and 5 and `rigor` becomes
+> a no-op; hoist step 4 above step 2 and it silently overrides settings people
+> already have. Tests **X.2** and **X.3** assert both directions.
+>
+> Derived values report their provenance as **`rigor:<level>`**, so the source
+> vocabulary is `{project.local.yaml, project.yaml, <legacy path>, rigor:<level>,
+> default, unset}`. `docs.density: balanced (rigor:standard)` says the value was
+> never written down anywhere — it follows the project's rigor level and will
+> move if that level moves.
+
+> **Read scope == write whitelist.** Anything `/settings --local` may *write*
+> is also *read* during resolution. If the read scope were ever narrower,
+> `/settings --local modes.review_mode=solo` would write a value
+> that `/settings` accepted and displayed and every skill then ignored. The
+> test suite asserts the two lists stay in step — adding a setting to one
+> without the other reproduces that bug.
+>
+> This matches the spec: `effects-map.md` § "Local Override Pattern" has always
+> stated the chain applies to *every* setting. The narrow read scope was an
+> implementation gap, not a design.
+
+> **A key OUTSIDE the whitelist, hand-written into `project.local.yaml`, is
+> reported rather than swallowed.** `/settings --local` refuses to
+> write one, but the file exists to be edited by hand, so that path needs its own
+> guard. `modes.rigor: full` written there is a real key with a legal value, so
+> `validate_yaml_enum` passes it — and then resolution never consults the local
+> file for that path, so the setting vanishes and the user sees the default they
+> were trying to override, with no error anywhere. Every check in the chain
+> validated the **value**; nothing validated the **location**.
+>
+> `validate_local_scope` now names such keys on `notes:`. It **warns and never
+> reconciles**, the same shape as the stage-mirror check: it does not edit the
+> file, does not begin honouring the key, and does not change resolution. A
+> locked setting is locked because it decides which artifacts exist on disk, so
+> a helper that quietly applied one would let two developers' checkouts diverge
+> — the exact thing the whitelist prevents. The user moves the key to
+> `project.yaml` or deletes it.
+>
+> `schema_version` and `framework.*` are exempt: `effects-map.md` classes them as
+> file metadata rather than preferences, and a `project.local.yaml` carrying
+> `schema_version: 1` is correct as written.
+
+## Defaults
+
+| Knob | Default |
+|---|---|
+| `modes.automation` | `collaborative` |
+| `modes.rigor` | `minimal` |
+| `modes.automation_always_ask` | `scope_changes`, `file_deletions`, `schema_changes` |
+
+**The six knobs `rigor` fronts have no terminal default at all.** `modes.workflow`,
+`docs.density`, `qa.level`, `modes.story_granularity`, `modes.review_mode` and `team.size` are
+deliberately absent from `_yaml_helper_defaults`: a default there would answer at step 5 before the
+expansion at step 4 ever ran, making `rigor` a no-op for anyone who had not also
+set the sub-knob. Their effective values come from the rigor level:
+
+| `modes.rigor` | `modes.workflow` | `docs.density` | `qa.level` | `modes.story_granularity` | `modes.review_mode` | `team.size` |
+|---|---|---|---|---|---|---|
+| `minimal` (default) | `minimal` | `terse` | `minimal` | `coarse` | `solo` | `individual` |
+| `standard` | `standard` | `balanced` | `standard` | `balanced` | `lean` | `individual` |
+| `full` | `full` | `thorough` | `full` | `fine` | `full` | `studio` |
+
+Because `rigor` itself defaults to `minimal`, an unconfigured project resolves
+these six to the lean row. That default was `standard`; it changed because the
+heavier tier measured several times more expensive to reach working code without
+producing a better result. See the rationale block above `_yaml_helper_defaults`
+in `.claude/hooks/yaml-helper.sh` for the reasoning and the ordering
+constraint. Raising the tier is one question in `/start` or one `/settings`
+call, and `settings-guidance.md § 4`'s upward triggers are written to fire from
+this starting state. (`team.size` is the one knob the flip does not move:
+`minimal` and `standard` both yield `individual`, and only `full` opts into the
+`studio` roster.) Test **X.8** asserts the six stay defaultless.
+
+> **The flip DOES reach existing projects.** A `project.yaml` that sets some of
+> the six explicitly but never sets `rigor` keeps its explicit values and takes
+> the new `minimal` row for the rest -- so an unset `qa.level` that used to
+> resolve `standard` now resolves `minimal`. Test **X.3** pins exactly this.
+> Pin the old behaviour by setting `modes.rigor: standard` explicitly; see
+> UPGRADING.md.
+
+`modes.workflow` is **fronted, not replaced**: it keeps
+`workflow_overrides.system_overrides`, which still beats the derived value
+(**X.6**). Setting any of the six explicitly overrides just that one and leaves
+its siblings on the rigor level, which is how "comprehensive but compact"
+(`rigor: full` + `docs.density: terse`) stays expressible. Two of the six —
+`modes.review_mode` and `team.size` — are personal-experience knobs that also
+remain overridable from `project.local.yaml` (that source sits above the
+expansion), unlike the four on-disk knobs, which are locked.
+
+> **This table is asserted against the helper, not maintained by hand.** Test
+> **X.10** reads `_yaml_helper_defaults` through `get_yaml_default` and checks
+> both directions: every knob listed here must carry the value the helper
+> actually returns, and none of the six fronted knobs may appear at all. It
+> exists because a table can list knobs the helper has stopped defaulting and
+> read as correct: the structural check pairs a knob with the word "default" on
+> a single line, so a two-cell table row is invisible to it. Editing this table
+> without editing the helper now fails the build.
+
+**`testing.strict.*` has no central default on purpose.** Its unset default
+differs per skill by design: `/smoke-check` treats unset as **blocking** (it is a
+build-health gate), while `/story-done` and `/dev-story` apply the per-story-type
+table in `.claude/docs/coding-standards.md`. `resolve_config` therefore reports
+only the *configured state* (`unset` where absent) and each skill applies its own
+default. The script resolves **sources**; the skill owns **policy**.
+
+**`engine` is reported from `project.yaml` only.** No markdown reader is built.
+Skills keep their existing per-field fallback to
+`.claude/docs/technical-preferences.md`, which also remains the sole source for
+forbidden patterns and allowed libraries — those never migrated.
+
+## Failure modes
+
+`resolve_config` **always exits 0 and always emits a complete block.** Each
+condition below degrades to defaults and is named on `notes:`:
+
+| Condition | Behavior |
+|---|---|
+| `project.yaml` absent | legacy → defaults; `notes: project.yaml absent` |
+| `project.yaml` **empty** | defaults; `notes: project.yaml is EMPTY`. Distinct from absent on purpose — a truncated write or an interrupted `/setup-engine` looks like this |
+| Malformed YAML | unparseable keys resolve empty and fall through |
+| Tab-indented lines | rejected, and the **line numbers are named** on `notes:` |
+| CRLF line endings | parsed correctly (the Windows default) |
+| UTF-8 BOM | parsed correctly; the BOM does not poison the first key |
+| 3-space indent | parsed correctly; the parser is indent-tolerant |
+| Key present, value empty | treated as **unset**; falls through to the next source, never to `""` |
+| Enum-invalid value | chain continues; rejected value named in `notes:` |
+| `project.local.yaml` without a base | `validate_local_yaml_base` message on `notes:` |
+| Locked key in `project.local.yaml` | ignored as always, but now **named** on `notes:` — `local: not locally overridable, ignored — modes.rigor (move to project.yaml or delete)` |
+| No Python interpreter | legacy files and defaults only; **explicitly noted** on `notes:` |
+| No block at all | shell preprocessing disabled — use the defaults table above |
+
+A skill must never treat a missing block as "config is unset in an interesting
+way". It means the block did not render; the defaults apply.
+
+### Two behaviours that are correct but SILENT
+
+In both cases the
+resolved *value* is right — the chain falls through to the default — but the user
+is told nothing, and their explicit configuration was discarded.
+
+| Input | What happens | Note emitted |
+|---|---|---|
+| **Duplicate key** (`rigor:` twice in one block) | **the last occurrence wins**, deterministically | **none** |
+| **Wrong shape** — a list where a scalar belongs (`rigor:` followed by `- standard`) | key resolves empty, falls through to the default | **none** |
+
+**Why this is worth knowing rather than shrugging at.** An enum-*invalid* value is
+announced (`modes.workflow: 'medium' is not a valid value … — ignored, chain
+continued`). A structurally-invalid one is not. So a user who mistypes the value
+gets told, and a user who mistypes the *structure* does not — and the second
+mistake is the easier one to make by copy-paste. The framework has the mechanism
+(`notes:`) and already uses it for absence, emptiness, tabs, locked keys, orphan
+locals and bad enums. Shape is the gap.
+
+**Deliberately not fixed in v1.1.** Detecting "this key is present in the file but
+resolved to nothing" means changing the parser every config read in the framework
+goes through, and the empty-value fall-through above is a *legitimate* case of
+exactly that signature. Distinguishing "empty on purpose" from "unparseable" is
+real work, not a one-liner, and it lands in the most load-bearing file there is.
+Recorded here as v1.2.
+
+**Duplicate-key precedence was undocumented before this entry.** Last-wins is
+deterministic and reproducible, so it is not a bug — but nothing said so, which
+meant nobody could rely on it either.
+
+## Why not inject at session start
+
+`resolve_config` is also safe to call from a hook, but session-start does **not**
+call it. The block would cost tokens on every session whether or not any skill
+needs config, and it would go stale mid-session as `/settings` writes land. The
+per-skill body call is fresher and only loads where it is used. Session start
+still prints the resolved review mode and any schema errors, which is the part a
+human reads.
+
+## Testing
+
+The resolution chain, the legacy reader, enum fall-through, block shape and
+every failure mode above are covered by the framework's own test suite under
+`tests/`, along with the `modes.rigor` expansion and its precedence in both
+directions. Two properties are asserted that are easy to lose:
+
+- The local **read** scope and the `/settings --local` **write** whitelist stay
+ in step. If they drift, `/settings` accepts and displays a value that every
+ skill then ignores.
+- The expansion is *reachable* (`/start` asks about it) and *legible*
+ (`/settings` reports derived values rather than "(not set)"). A correct
+ expansion nobody is asked about and no view displays would be worth nothing.
diff --git a/.claude/docs/context-management.md b/.claude/docs/context-management.md
index 2734f3b3..cc76997b 100644
--- a/.claude/docs/context-management.md
+++ b/.claude/docs/context-management.md
@@ -17,13 +17,45 @@ after each significant milestone:
- Implementation milestone reached
- Test results obtained
-The state file should contain: current task, progress checklist, key decisions
-made, files being worked on, and open questions.
+**Create it from `.claude/docs/templates/session-state.md`** — the file has a
+schema, and hooks depend on it.
+
+Two regions, and the distinction is load-bearing:
+
+| Region | Who reads it | Rule |
+|--------|--------------|------|
+| `<!-- STATUS -->` … `<!-- /STATUS -->` | `statusline.sh` (breadcrumb, Production+ only) | Keep the markers even when empty |
+| `<!-- CHECKPOINT -->` … `<!-- /CHECKPOINT -->` | `session-start.sh` and `pre-compact.sh` | **Overwrite, never append.** Under ~25 lines — hooks inject it verbatim |
+| Everything after `<!-- /CHECKPOINT -->` | humans, and an agent that wants detail | Free-form; no hook injects it |
+
+The checkpoint holds: current task, next step, what it is blocked on, files in
+progress, open questions. Write it so a cold reader can resume without opening
+anything else.
+
+> **Why the split.** One append-only file doing both jobs grows without bound —
+> past 700 lines every consumer invents its own slice: a status line parsing a
+> STATUS block nothing writes, `pre-compact` injecting `head -100` (12.7 KB, at
+> the moment context is scarcest), `session-start` previewing `tail -20` — the
+> opposite end. None was wrong, because nothing defined where
+> the recoverable state lived. Now every consumer reads the named region, and
+> the cost is fixed no matter how long the narrative grows.
+
+**Rotation.** When the narrative passes ~200 lines, move it into
+`production/session-logs/`:
+
+```bash
+bash .claude/scripts/rotate-session-state.sh # --dry-run to preview
+```
+
+The checkpoint stays, the narrative is appended to a dated log, nothing is
+deleted. `session-start.sh` observes when rotation is due but never performs it.
### Status Line Block (Production+ only)
When the project is in Production, Polish, or Release stage, include a structured
-status block in `active.md` that the status line script can parse:
+status block in `active.md` that the status line script can parse. (The project
+stage is resolved from `project.stage` in `project.yaml`, falling back to
+`production/stage.txt`.)
```markdown
<!-- STATUS -->
@@ -69,6 +101,37 @@ This keeps the context window holding only the *current* section's discussion
- Medium (implement feature): ~8k tokens
- Heavy (multi-system refactor): ~15k tokens
+## Deterministic Helpers — `.claude/scripts/`
+
+The cheapest context saving is not summarising a document, it is **not reading it
+at all**. When a question has a deterministic answer, a script should answer it
+and the model should spend its budget on judgment instead.
+
+Two directories, two purposes — reach for the right one:
+
+| Directory | Purpose | Invoked by |
+|---|---|---|
+| `.claude/hooks/` | Event-driven — wired into `settings.json` and fired by Claude Code | the harness |
+| `.claude/scripts/` | Manually invoked from a skill body | `bash .claude/scripts/<name>.sh` |
+
+Current helpers:
+
+- **`gdd-structure-check.sh`** — which of the 8 standard sections a GDD contains.
+ Replaces a full-document read per GDD, and cannot hallucinate a missing
+ section. Reports **presence only**; the caller applies the workflow tier.
+- **`review-scope.sh`** — which GDDs changed since the last cross-review, plus
+ their declared dependencies. Replaces reasoning through git history.
+
+Two rules when adding one:
+
+1. **A skill invoking a script needs `Bash` in `allowed-tools`**, or the step
+ silently no-ops. A skill that only needs *resolved config* does not — use the
+ documented `` !`cmd` `` body form, which is preprocessing and is not gated by
+ `allowed-tools` (see `.claude/docs/config-resolution.md`).
+2. **Emit observations, not verdicts.** A script that scores or judges will
+ eventually contradict a tier, mode, or per-system override it does not know
+ about. Report what is on disk and let the caller decide what it means.
+
## Subagent Delegation
Use subagents for research and exploration to keep the main session clean.
diff --git a/.claude/docs/coordination-rules.md b/.claude/docs/coordination-rules.md
index 54dc1498..f1ab3c40 100644
--- a/.claude/docs/coordination-rules.md
+++ b/.claude/docs/coordination-rules.md
@@ -14,60 +14,43 @@
## Model Tier Assignment
-Skills and agents are assigned to model tiers based on task complexity:
+Read `.claude/docs/model-tiers.md` on demand. It carries the tier table, the
+per-skill assignments and the authoring rule.
-| Tier | Model | When to use |
-|------|-------|-------------|
-| **Haiku** | `claude-haiku-4-5-20251001` | Read-only status checks, formatting, simple lookups — no creative judgment needed |
-| **Sonnet** | `claude-sonnet-4-6` | Implementation, design authoring, analysis of individual systems — default for most work |
-| **Opus** | `claude-opus-4-6` | Multi-document synthesis, high-stakes phase gate verdicts, cross-system holistic review |
-
-Skills with `model: haiku`: `/help`, `/sprint-status`, `/story-readiness`, `/scope-check`,
-`/project-stage-detect`, `/changelog`, `/patch-notes`, `/onboard`
-
-Skills with `model: opus`: `/review-all-gdds`, `/architecture-review`, `/gate-check`
-
-All other skills default to Sonnet. When creating new skills, assign Haiku if the
-skill only reads and formats; assign Opus if it must synthesize 5+ documents with
-high-stakes output; otherwise leave unset (Sonnet).
+**One line of it is load-bearing enough to restate here:** a skill's `model:`
+frontmatter is **declared but not applied** — Claude Code reads it and serves the
+skill from the session model regardless. Never tell a user that a skill's tier
+is saving them money. The agent-side `model:` is a different mechanism and is
+untested, not known-broken.
## Subagents vs Agent Teams
This project uses two distinct multi-agent patterns:
### Subagents (current, always active)
-Spawned via `Task` within a single Claude Code session. Used by all `team-*` skills
-and orchestration skills. Subagents share the session's permission context, run
-sequentially or in parallel within the session, and return results to the parent.
+Spawned via the `Agent` tool within a single Claude Code session (renamed from
+`Task` in Claude Code 2.1.63; `Task` still works as an alias). Used by all
+`team-*` skills and orchestration skills. Subagents share the session's
+permission context, run sequentially or in parallel within the session, and
+return results to the parent.
**When to spawn in parallel**: If two subagents' inputs are independent (neither
-needs the other's output to begin), spawn both Task calls simultaneously rather
-than waiting. Example: `/review-all-gdds` Phase 1 (consistency) and Phase 2
-(design theory) are independent — spawn both at the same time.
+needs the other's output to begin), spawn both `Agent` calls simultaneously
+rather than waiting. Example: `/review-all-gdds` **Phase 2** (consistency) and
+**Phase 3** (design theory) are independent — spawn both at the same time.
+Phase 1 loads the GDDs and both depend on it, so it is the one phase here that
+must NOT be parallelised.
### Agent Teams (experimental — opt-in)
-Multiple independent Claude Code *sessions* running simultaneously, coordinated
-via a shared task list. Each session has its own context window and token budget.
-Requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` environment variable.
-
-**Use agent teams when**:
-- Work spans multiple subsystems that will not touch the same files
-- Each workstream would take >30 minutes and benefits from true parallelism
-- A senior agent (technical-director, producer) needs to coordinate 3+ specialist
- sessions working on different epics simultaneously
-
-**Do not use agent teams when**:
-- One session's output is required as input for another (use sequential subagents)
-- The task fits in a single session's context (use subagents instead)
-- Cost is a concern — each team member burns tokens independently
-
-**Current status**: Opt-in via `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`. Document first usage here when adopted.
+Multiple independent Claude Code *sessions* coordinated via a shared task list.
+Opt-in and never yet used here — read `.claude/docs/agent-teams.md` on demand
+before proposing one.
## Parallel Task Protocol
When an orchestration skill spawns multiple independent agents:
-1. Issue all independent Task calls before waiting for any result
+1. Issue all independent `Agent` calls before waiting for any result
2. Collect all results before proceeding to dependent phases
3. If any agent is BLOCKED, surface it immediately — do not silently skip
4. Always produce a partial report if some agents complete and others block
diff --git a/.claude/docs/director-gates.md b/.claude/docs/director-gates.md
index 7ca3bbdb..7c0b7cbf 100644
--- a/.claude/docs/director-gates.md
+++ b/.claude/docs/director-gates.md
@@ -1,96 +1,121 @@
# Director Gates — Shared Review Pattern
-This document defines the standard gate prompts for all director and lead reviews
-across every workflow stage. Skills reference gate IDs from this document instead
-of embedding full prompts inline — eliminating drift when prompts need updating.
+Index of all director and lead review gates. Skills reference gate IDs from this
+index instead of embedding prompts inline — eliminating drift when prompts need
+updating. Each gate's full definition (Trigger, Context to pass, Prompt, Verdicts)
+lives in its own file under `.claude/docs/director-gates/`, named after the gate
+ID in lowercase.
**Scope**: All 7 production stages (Concept → Release), all 3 Tier 1 directors,
all key Tier 2 leads. Any skill, team orchestrator, or workflow may invoke these gates.
----
-
-## How to Use This Document
-
-In any skill, replace an inline director prompt with a reference:
-
-```
-Spawn `creative-director` via Task using gate **CD-PILLARS** from
-`.claude/docs/director-gates.md`.
-```
-
-Pass the context listed under that gate's **Context to pass** field, then handle
-the verdict using the **Verdict handling** rules below.
+**When a skill spawns a director for a gate, it must NOT read the gate definition
+file itself. Include the gate definition file path in the `Agent` prompt and instruct
+the director agent to read it first, then pass only the context fields that gate's
+row requires. Gate definitions are read by the spawned agent, in the agent's own
+context window.**
+
+---
+
+## Gate Index
+
+Agent by prefix: `CD-` creative-director (Opus) · `TD-` technical-director (Opus)
+· `PR-` producer (Opus) · `AD-` art-director (Sonnet) · `LP-` lead-programmer ·
+`QL-` qa-lead · `ND-` narrative-director (Tier 2 leads: Sonnet).
+Definition files below are in `.claude/docs/director-gates/`.
+
+| Gate ID | Purpose | Definition file |
+|---------|---------|-----------------|
+| CD-PILLARS | Pillar stress test after pillars are defined | cd-pillars.md |
+| CD-GDD-ALIGN | GDD pillar alignment after a system GDD is authored | cd-gdd-align.md |
+| CD-SYSTEMS | Systems decomposition vision check after `/map-systems` | cd-systems.md |
+| CD-NARRATIVE | Narrative consistency of story/lore documents | cd-narrative.md |
+| CD-PLAYTEST | Player experience validation of playtest reports | cd-playtest.md |
+| CD-PHASE-GATE | Creative readiness at phase transition | cd-phase-gate.md |
+| TD-SYSTEM-BOUNDARY | System boundary review before GDD authoring | td-system-boundary.md |
+| TD-FEASIBILITY | Technical feasibility of early concept risks | td-feasibility.md |
+| TD-ARCHITECTURE | Master architecture document sign-off | td-architecture.md |
+| TD-ADR | Individual ADR review before Accepted | td-adr.md |
+| TD-ENGINE-RISK | Engine version risk for post-cutoff APIs | td-engine-risk.md |
+| TD-PHASE-GATE | Technical readiness at phase transition | td-phase-gate.md |
+| TD-MANIFEST | Control manifest review before it is written | td-manifest.md |
+| TD-CHANGE-IMPACT | Design-change impact assessment review | td-change-impact.md |
+| PR-SCOPE | Scope and timeline validation | pr-scope.md |
+| PR-SPRINT | Sprint plan feasibility review | pr-sprint.md |
+| PR-MILESTONE | Milestone risk assessment | pr-milestone.md |
+| PR-EPIC | Epic structure feasibility before story breakdown | pr-epic.md |
+| PR-PHASE-GATE | Production readiness at phase transition | pr-phase-gate.md |
+| AD-CONCEPT-VISUAL | Visual identity anchor after pillars lock | ad-concept-visual.md |
+| AD-ART-BIBLE | Art bible sign-off before asset production | ad-art-bible.md |
+| AD-PHASE-GATE | Visual readiness at phase transition | ad-phase-gate.md |
+| LP-FEASIBILITY | Implementation feasibility of the architecture | lp-feasibility.md |
+| LP-CODE-REVIEW | Code review of an implemented story | lp-code-review.md |
+| QL-STORY-READY | Acceptance-criteria testability before sprint | ql-story-ready.md |
+| QL-TEST-COVERAGE | Test coverage review before epic done / advance | ql-test-coverage.md |
+| ND-CONSISTENCY | Narrative consistency of writer deliverables | nd-consistency.md |
+| AD-VISUAL | Visual consistency of art/tech-art decisions | ad-visual.md |
---
## Review Modes
-Review intensity controls whether director gates run. It can be set globally
-(persists across sessions) or overridden per skill run.
+Review intensity controls whether gates run.
-**Global config**: `production/review-mode.txt` — one word: `full`, `lean`, or `solo`.
-Set once during `/start`. Edit the file directly to change it at any time.
+**Global config**: `modes.review_mode` in `project.yaml` — one word: `full`,
+`lean`, or `solo`. Legacy fallback: `production/review-mode.txt` (single line,
+same values); `project.yaml` wins when both are present. Set once during
+`/start`, or change it any time with `/settings modes.review_mode=<value>`.
-**Per-run override**: any gate-using skill accepts `--review [full|lean|solo]` as an
-argument. This overrides the global config for that run only.
-
-Examples:
-```
-/brainstorm space horror → uses global mode
-/brainstorm space horror --review full → forces full mode this run
-/architecture-decision --review solo → skips all gates this run
-```
-
-| Mode | What runs | Best for |
-|------|-----------|----------|
-| `full` | All gates active — every workflow step reviewed | Teams, learning users, or when you want thorough director feedback at every step |
-| `lean` | PHASE-GATEs only (`/gate-check`) — per-skill gates skipped | **Default** — solo devs and small teams; directors review at milestones only |
-| `solo` | No director gates anywhere | Game jams, prototypes, maximum speed |
-
-**Check pattern — apply before every gate spawn:**
-
-```
-Before spawning gate [GATE-ID]:
-1. If skill was called with --review [mode], use that
-2. Else read production/review-mode.txt
-3. Else default to lean
+**Per-run override**: any gate-using skill accepts `--review [full|lean|solo]`,
+overriding the global config for that run only.
-Apply the resolved mode:
-- solo → skip all gates. Note: "[GATE-ID] skipped — Solo mode"
-- lean → skip unless this is a PHASE-GATE (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- Note: "[GATE-ID] skipped — Lean mode"
-- full → spawn as normal
-```
+| Mode | What runs |
+|------|-----------|
+| `full` | All gates active — every workflow step reviewed |
+| `lean` | PHASE-GATEs only (`/gate-check`) — per-skill gates skipped. **Default** |
+| `solo` | No director gates anywhere (game jams, prototypes, max speed) |
---
## Invocation Pattern (copy into any skill)
-**MANDATORY: Resolve review mode before every gate spawn.** Never spawn a gate without checking. The resolved mode is determined once per skill run:
-1. If skill was called with `--review [mode]`, use that
-2. Else read `production/review-mode.txt`
-3. Else default to `lean`
+**MANDATORY: apply the review mode before every gate spawn.**
+
+The value is already resolved — skills call
+`` !`source .claude/hooks/yaml-helper.sh && resolve_config --keys review_mode` ``
+and read `review_mode` from the emitted block. Do **not** re-derive it here. The
+full chain (`project.local.yaml` → `project.yaml` → `production/review-mode.txt`
+→ `modes.rigor` expansion, `standard`→`lean`), its defaults and its failure modes are specified in
+`.claude/docs/config-resolution.md`, and covered by the config test suite.
+
+An inline `--review [mode]` argument, if the skill accepts one, overrides the
+resolved value for that run.
Apply the resolved mode:
-- `solo` → **skip all gates**. Note in output: `[GATE-ID] skipped — Solo mode`
+- `solo` → **skip all gates**. Note: `[GATE-ID] skipped — Solo mode`
- `lean` → **skip unless this is a PHASE-GATE** (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE). Note: `[GATE-ID] skipped — Lean mode`
- `full` → spawn as normal
+> **PHASE-GATE panel width is a second, independent axis.** `review_mode` decides
+> whether the four PHASE-GATEs run at all; `modes.workflow` decides how many of
+> them run — `minimal` → PR only, `standard` → TD + PR, `full` → all four. The
+> rule and its rationale live in `/gate-check` Section 4b, the only skill that
+> spawns PHASE-GATEs. Every other gate in this index is single-director and
+> unaffected. Width never softens a verdict: the escalation rule below applies
+> unchanged to whoever ran.
+
```
# Apply mode check, then:
-Spawn `[agent-name]` via Task:
-- Gate: [GATE-ID] (see .claude/docs/director-gates.md)
-- Context: [fields listed under that gate]
+Spawn `[agent-name]` via `Agent`:
+- Gate: [GATE-ID] — `Agent` prompt instructs the agent to read
+ `.claude/docs/director-gates/[gate-id].md` FIRST (parent must not read it)
+- Context: [fields under that gate's **Context to pass**]
- Await the verdict before proceeding.
```
-For parallel spawning (multiple directors at the same gate point):
-
-```
-# Apply mode check for each gate first, then spawn all that survive:
-Spawn all [N] agents simultaneously via Task — issue all Task calls before
-waiting for any result. Collect all verdicts before proceeding.
-```
+For parallel spawning (multiple directors at one gate point): apply the mode
+check per gate, then spawn all surviving agents simultaneously — issue all `Agent`
+calls before waiting for any result; collect all verdicts before proceeding.
---
@@ -122,655 +147,14 @@ For phase gates, record in `docs/architecture/architecture.md` or
---
-## Tier 1 — Creative Director Gates
-
-Agent: `creative-director` | Model tier: Opus | Domain: Vision, pillars, player experience
-
----
-
-### CD-PILLARS — Pillar Stress Test
-
-**Trigger**: After game pillars and anti-pillars are defined (brainstorm Phase 4,
-or any time pillars are revised)
-
-**Context to pass**:
-- Full pillar set with names, definitions, and design tests
-- Anti-pillars list
-- Core fantasy statement
-- Unique hook ("Like X, AND ALSO Y")
-
-**Prompt**:
-> "Review these game pillars. Are they falsifiable — could a real design decision
-> actually fail this pillar? Do they create meaningful tension with each other? Do
-> they differentiate this game from its closest comparables? Would they help resolve
-> a design disagreement in practice, or are they too vague to be useful? Return
-> specific feedback for each pillar and an overall verdict: APPROVE (strong), CONCERNS
-> [list] (needs sharpening), or REJECT (weak — pillars do not carry weight)."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### CD-GDD-ALIGN — GDD Pillar Alignment Check
-
-**Trigger**: After a system GDD is authored (design-system, quick-design, or any
-workflow that produces a GDD)
-
-**Context to pass**:
-- GDD file path
-- Game pillars (from `design/gdd/game-concept.md` or `design/gdd/game-pillars.md`)
-- MDA aesthetics target for this game
-- System's stated Player Fantasy section
-
-**Prompt**:
-> "Review this system GDD for pillar alignment. Does every section serve the stated
-> pillars? Are there mechanics or rules that contradict or weaken a pillar? Does
-> the Player Fantasy section match the game's core fantasy? Return APPROVE, CONCERNS
-> [specific sections with issues], or REJECT [pillar violations that must be
-> redesigned before this system is implementable]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### CD-SYSTEMS — Systems Decomposition Vision Check
-
-**Trigger**: After the systems index is written by `/map-systems` — validates the
-complete system set before GDD authoring begins
-
-**Context to pass**:
-- Systems index path (`design/gdd/systems-index.md`)
-- Game pillars and core fantasy (from `design/gdd/game-concept.md`)
-- Priority tier assignments (MVP / Vertical Slice / Alpha / Full Vision)
-- Any high-risk or bottleneck systems identified in the dependency map
-
-**Prompt**:
-> "Review this systems decomposition against the game's design pillars. Does the
-> full set of MVP-tier systems collectively deliver the core fantasy? Are there
-> systems whose mechanics don't serve any stated pillar — indicating they may be
-> scope creep? Are there pillar-critical player experiences that have no system
-> assigned to deliver them? Are any systems missing that the core loop requires?
-> Return APPROVE (systems serve the vision), CONCERNS [specific gaps or
-> misalignments with their pillar implications], or REJECT [fundamental gaps —
-> the decomposition misses critical design intent and must be revised before GDD
-> authoring begins]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### CD-NARRATIVE — Narrative Consistency Check
-
-**Trigger**: After narrative GDDs, lore documents, dialogue specs, or world-building
-documents are authored (team-narrative, design-system for story systems, writer
-deliverables)
-
-**Context to pass**:
-- Document file path(s)
-- Game pillars
-- Narrative direction brief or tone guide (if exists at `design/narrative/`)
-- Any existing lore that the new document references
-
-**Prompt**:
-> "Review this narrative content for consistency with the game's pillars and
-> established world rules. Does the tone match the game's established voice? Are
-> there contradictions with existing lore or world-building? Does the content serve
-> the player experience pillar? Return APPROVE, CONCERNS [specific inconsistencies],
-> or REJECT [contradictions that break world coherence]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### CD-PLAYTEST — Player Experience Validation
-
-**Trigger**: After playtest reports are generated (`/playtest-report`), or after
-any session that produces player feedback
-
-**Context to pass**:
-- Playtest report file path
-- Game pillars and core fantasy statement
-- The specific hypothesis being tested
-
-**Prompt**:
-> "Review this playtest report against the game's design pillars and core fantasy.
-> Is the player experience matching the intended fantasy? Are there systematic issues
-> that represent pillar drift — mechanics that feel fine in isolation but undermine
-> the intended experience? Return APPROVE (core fantasy is landing), CONCERNS [gaps
-> between intended and actual experience], or REJECT [core fantasy is not present —
-> redesign needed before further playtesting]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### CD-PHASE-GATE — Creative Readiness at Phase Transition
-
-**Trigger**: Always at `/gate-check` — spawn in parallel with TD-PHASE-GATE and PR-PHASE-GATE
-
-**Context to pass**:
-- Target phase name
-- List of all artifacts present (file paths)
-- Game pillars and core fantasy
-
-**Prompt**:
-> "Review the current project state for [target phase] gate readiness from a
-> creative direction perspective. Are the game pillars faithfully represented in
-> all design artifacts? Does the current state preserve the core fantasy? Are there
-> any design decisions across GDDs or architecture that compromise the intended
-> player experience? Return READY, CONCERNS [list], or NOT READY [blockers]."
-
-**Verdicts**: READY / CONCERNS / NOT READY
-
----
-
-## Tier 1 — Technical Director Gates
-
-Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
-
----
-
-### TD-SYSTEM-BOUNDARY — System Boundary Architecture Review
-
-**Trigger**: After `/map-systems` Phase 3 dependency mapping is agreed but before
-GDD authoring begins — validates that the system structure is architecturally
-sound before teams invest in writing GDDs against it
-
-**Context to pass**:
-- Systems index path (or the dependency map summary if index not yet written)
-- Layer assignments (Foundation / Core / Feature / Presentation / Polish)
-- The full dependency graph (what each system depends on)
-- Any bottleneck systems flagged (many dependents)
-- Any circular dependencies found and their proposed resolutions
-
-**Prompt**:
-> "Review this systems decomposition from an architectural perspective before GDD
-> authoring begins. Are the system boundaries clean — does each system own a
-> distinct concern with minimal overlap? Are there God Object risks (systems doing
-> too much)? Does the dependency ordering create implementation-sequencing problems?
-> Are there implicit shared-state problems in the proposed boundaries that will
-> cause tight coupling when implemented? Are any Foundation-layer systems actually
-> dependent on Feature-layer systems (inverted dependency)? Return APPROVE
-> (boundaries are architecturally sound — proceed to GDD authoring), CONCERNS
-> [specific boundary issues to address in the GDDs themselves], or REJECT
-> [fundamental boundary problems — the system structure will cause architectural
-> issues and must be restructured before any GDD is written]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### TD-FEASIBILITY — Technical Feasibility Assessment
-
-**Trigger**: After biggest technical risks are identified during scope/feasibility
-(brainstorm Phase 6, quick-design, or any early-stage concept with technical unknowns)
-
-**Context to pass**:
-- Concept's core loop description
-- Platform target
-- Engine choice (or "undecided")
-- List of identified technical risks
-
-**Prompt**:
-> "Review these technical risks for a [genre] game targeting [platform] using
-> [engine or 'undecided engine']. Flag any HIGH risk items that could invalidate
-> the concept as described, any risks that are engine-specific and should influence
-> the engine choice, and any risks that are commonly underestimated by solo
-> developers. Return VIABLE (risks are manageable), CONCERNS [list with mitigation
-> suggestions], or HIGH RISK [blockers that require concept or scope revision]."
-
-**Verdicts**: VIABLE / CONCERNS / HIGH RISK
-
----
-
-### TD-ARCHITECTURE — Architecture Sign-Off
-
-**Trigger**: After the master architecture document is drafted (`/create-architecture`
-Phase 7), and after any major architecture revision
-
-**Context to pass**:
-- Architecture document path (`docs/architecture/architecture.md`)
-- Technical requirements baseline (TR-IDs and count)
-- ADR list with statuses
-- Engine knowledge gap inventory
-
-**Prompt**:
-> "Review this master architecture document for technical soundness. Check: (1) Is
-> every technical requirement from the baseline covered by an architectural decision?
-> (2) Are all HIGH risk engine domains explicitly addressed or flagged as open
-> questions? (3) Are the API boundaries clean, minimal, and implementable? (4) Are
-> Foundation layer ADR gaps resolved before implementation begins? Return APPROVE,
-> CONCERNS [list], or REJECT [blockers that must be resolved before coding starts]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### TD-ADR — Architecture Decision Review
-
-**Trigger**: After an individual ADR is authored (`/architecture-decision`), before
-it is marked Accepted
-
-**Context to pass**:
-- ADR file path
-- Engine version and knowledge gap risk level for the domain
-- Related ADRs (if any)
-
-**Prompt**:
-> "Review this Architecture Decision Record. Does it have a clear problem statement
-> and rationale? Are the rejected alternatives genuinely considered? Does the
-> Consequences section acknowledge the trade-offs honestly? Is the engine version
-> stamped? Are post-cutoff API risks flagged? Does it link to the GDD requirements
-> it covers? Return APPROVE, CONCERNS [specific gaps], or REJECT [the decision is
-> underspecified or makes unsound technical assumptions]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### TD-ENGINE-RISK — Engine Version Risk Review
-
-**Trigger**: When making architecture decisions that touch post-cutoff engine APIs,
-or before finalizing any engine-specific implementation approach
-
-**Context to pass**:
-- The specific API or feature being used
-- Engine version and LLM knowledge cutoff (from `docs/engine-reference/[engine]/VERSION.md`)
-- Relevant excerpt from breaking-changes or deprecated-apis docs
-
-**Prompt**:
-> "Review this engine API usage against the version reference. Is this API present
-> in [engine version]? Has its signature, behaviour, or namespace changed since the
-> LLM knowledge cutoff? Are there known deprecations or post-cutoff alternatives?
-> Return APPROVE (safe to use as described), CONCERNS [verify before implementing],
-> or REJECT [API has changed — provide corrected approach]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### TD-PHASE-GATE — Technical Readiness at Phase Transition
-
-**Trigger**: Always at `/gate-check` — spawn in parallel with CD-PHASE-GATE and PR-PHASE-GATE
-
-**Context to pass**:
-- Target phase name
-- Architecture document path (if exists)
-- Engine reference path
-- ADR list
-
-**Prompt**:
-> "Review the current project state for [target phase] gate readiness from a
-> technical direction perspective. Is the architecture sound for this phase? Are
-> all high-risk engine domains addressed? Are performance budgets realistic and
-> documented? Are Foundation-layer decisions complete enough to begin implementation?
-> Return READY, CONCERNS [list], or NOT READY [blockers]."
-
-**Verdicts**: READY / CONCERNS / NOT READY
-
----
-
-## Tier 1 — Producer Gates
-
-Agent: `producer` | Model tier: Opus | Domain: Scope, timeline, dependencies, production risk
-
----
-
-### PR-SCOPE — Scope and Timeline Validation
-
-**Trigger**: After scope tiers are defined (brainstorm Phase 6, quick-design, or
-any workflow that produces an MVP definition and timeline estimate)
-
-**Context to pass**:
-- Full vision scope description
-- MVP definition
-- Timeline estimate
-- Team size (solo / small team / etc.)
-- Scope tiers (what ships if time runs out)
-
-**Prompt**:
-> "Review this scope estimate. Is the MVP achievable in the stated timeline for
-> the stated team size? Are the scope tiers correctly ordered by risk — does each
-> tier deliver a shippable product if work stops there? What is the most likely
-> cut point under time pressure, and is it a graceful fallback or a broken product?
-> Return REALISTIC (scope matches capacity), OPTIMISTIC [specific adjustments
-> recommended], or UNREALISTIC [blockers — timeline or MVP must be revised]."
-
-**Verdicts**: REALISTIC / OPTIMISTIC / UNREALISTIC
-
----
-
-### PR-SPRINT — Sprint Feasibility Review
-
-**Trigger**: Before finalising a sprint plan (`/sprint-plan`), and after any
-mid-sprint scope change
-
-**Context to pass**:
-- Proposed sprint story list (titles, estimates, dependencies)
-- Team capacity (hours available)
-- Current sprint backlog debt (if any)
-- Milestone constraints
-
-**Prompt**:
-> "Review this sprint plan for feasibility. Is the story load realistic for the
-> available capacity? Are stories correctly ordered by dependency? Are there hidden
-> dependencies between stories that could block the sprint mid-way? Are any stories
-> underestimated given their technical complexity? Return REALISTIC (plan is
-> achievable), CONCERNS [specific risks], or UNREALISTIC [sprint must be
-> descoped — identify which stories to defer]."
-
-**Verdicts**: REALISTIC / CONCERNS / UNREALISTIC
-
----
-
-### PR-MILESTONE — Milestone Risk Assessment
-
-**Trigger**: At milestone review (`/milestone-review`), at mid-sprint retrospectives,
-or when a scope change is proposed that affects the milestone
-
-**Context to pass**:
-- Milestone definition and target date
-- Current completion percentage
-- Blocked stories count
-- Sprint velocity data (if available)
-
-**Prompt**:
-> "Review this milestone status. Based on current velocity and blocked story count,
-> will this milestone hit its target date? What are the top 3 production risks
-> between now and the milestone? Are there scope items that should be cut to protect
-> the milestone date vs. items that are non-negotiable? Return ON TRACK, AT RISK
-> [specific mitigations], or OFF TRACK [date must slip or scope must cut — provide
-> both options]."
-
-**Verdicts**: ON TRACK / AT RISK / OFF TRACK
-
----
-
-### PR-EPIC — Epic Structure Feasibility Review
-
-**Trigger**: After epics are defined by `/create-epics`, before stories are
-broken out — validates the epic structure is producible before `/create-stories`
-is invoked
-
-**Context to pass**:
-- Epic definition file paths (all epics just created)
-- Epic index path (`production/epics/index.md`)
-- Milestone timeline and target dates
-- Team capacity (solo / small team / size)
-- Layer being epiced (Foundation / Core / Feature / etc.)
-
-**Prompt**:
-> "Review this epic structure for production feasibility before story breakdown
-> begins. Are the epic boundaries scoped appropriately — could each epic realistically
-> complete before a milestone deadline? Are epics correctly ordered by system
-> dependency — does any epic require another epic's output before it can start?
-> Are any epics underscoped (too small, should merge) or overscoped (too large,
-> should split into 2-3 focused epics)? Are the Foundation-layer epics scoped to
-> allow Core-layer epics to begin at the start of the next sprint after Foundation
-> completes? Return REALISTIC (epic structure is producible), CONCERNS [specific
-> structural adjustments before stories are written], or UNREALISTIC [epics must
-> be split, merged, or reordered — story breakdown cannot begin until resolved]."
-
-**Verdicts**: REALISTIC / CONCERNS / UNREALISTIC
-
----
-
-### PR-PHASE-GATE — Production Readiness at Phase Transition
-
-**Trigger**: Always at `/gate-check` — spawn in parallel with CD-PHASE-GATE and TD-PHASE-GATE
-
-**Context to pass**:
-- Target phase name
-- Sprint and milestone artifacts present
-- Team size and capacity
-- Current blocked story count
-
-**Prompt**:
-> "Review the current project state for [target phase] gate readiness from a
-> production perspective. Is the scope realistic for the stated timeline and team
-> size? Are dependencies properly ordered so the team can actually execute in
-> sequence? Are there milestone or sprint risks that could derail the phase within
-> the first two sprints? Return READY, CONCERNS [list], or NOT READY [blockers]."
-
-**Verdicts**: READY / CONCERNS / NOT READY
-
----
-
-## Tier 1 — Art Director Gates
-
-Agent: `art-director` | Model tier: Sonnet | Domain: Visual identity, art bible, visual production readiness
-
----
-
-### AD-CONCEPT-VISUAL — Visual Identity Anchor
-
-**Trigger**: After game pillars are locked (brainstorm Phase 4), in parallel with CD-PILLARS
-
-**Context to pass**:
-- Game concept (elevator pitch, core fantasy, unique hook)
-- Full pillar set with names, definitions, and design tests
-- Target platform (if known)
-- Any reference games or visual touchstones mentioned by the user
-
-**Prompt**:
-> "Based on these game pillars and core concept, propose 2-3 distinct visual identity
-> directions. For each direction provide: (1) a one-line visual rule that could guide
-> all visual decisions (e.g., 'everything must move', 'beauty is in the decay'), (2)
-> mood and atmosphere targets, (3) shape language (sharp/rounded/organic/geometric
-> emphasis), (4) color philosophy (palette direction, what colors mean in this world).
-> Be specific — avoid generic descriptions. One direction should directly serve the
-> primary design pillar. Name each direction. Recommend which best serves the stated
-> pillars and explain why."
-
-**Verdicts**: CONCEPTS (multiple valid options — user selects) / STRONG (one direction clearly dominant) / CONCERNS (pillars don't provide enough direction to differentiate visual identity yet)
-
----
-
-### AD-ART-BIBLE — Art Bible Sign-Off
-
-**Trigger**: After the art bible is drafted (`/art-bible`), before asset production begins
-
-**Context to pass**:
-- Art bible path (`design/art/art-bible.md`)
-- Game pillars and core fantasy
-- Platform and performance constraints (from `.claude/docs/technical-preferences.md` if configured)
-- Visual identity anchor chosen during brainstorm (from `design/gdd/game-concept.md`)
-
-**Prompt**:
-> "Review this art bible for completeness and internal consistency. Does the color
-> system match the mood targets? Does the shape language follow from the visual
-> identity statement? Are the asset standards achievable within the platform
-> constraints? Does the character design direction give artists enough to work from
-> without over-specifying? Are there contradictions between sections? Would an
-> outsourcing team be able to produce assets from this document without additional
-> briefing? Return APPROVE (art bible is production-ready), CONCERNS [specific
-> sections needing clarification], or REJECT [fundamental inconsistencies that must
-> be resolved before asset production begins]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### AD-PHASE-GATE — Visual Readiness at Phase Transition
-
-**Trigger**: Always at `/gate-check` — spawn in parallel with CD-PHASE-GATE, TD-PHASE-GATE, and PR-PHASE-GATE
-
-**Context to pass**:
-- Target phase name
-- List of all art/visual artifacts present (file paths)
-- Visual identity anchor from `design/gdd/game-concept.md` (if present)
-- Art bible path if it exists (`design/art/art-bible.md`)
-
-**Prompt**:
-> "Review the current project state for [target phase] gate readiness from a visual
-> direction perspective. Is the visual identity established and documented at the
-> level this phase requires? Are the right visual artifacts in place? Would visual
-> teams be able to begin their work without visual direction gaps that cause costly
-> rework later? Are there visual decisions that are being deferred past their latest
-> responsible moment? Return READY, CONCERNS [specific visual direction gaps that
-> could cause production rework], or NOT READY [visual blockers that must exist
-> before this phase can succeed — specify what artifact is missing and why it
-> matters at this stage]."
-
-**Verdicts**: READY / CONCERNS / NOT READY
-
----
-
-## Tier 2 — Lead Gates
-
-These gates are invoked by orchestration skills and senior skills when a domain
-specialist's feasibility sign-off is needed. Tier 2 leads use Sonnet (default).
-
----
-
-### LP-FEASIBILITY — Lead Programmer Implementation Feasibility
-
-**Trigger**: After the master architecture document is written (`/create-architecture`
-Phase 7b), or when a new architectural pattern is proposed
-
-**Context to pass**:
-- Architecture document path
-- Technical requirements baseline summary
-- ADR list with statuses
-
-**Prompt**:
-> "Review this architecture for implementation feasibility. Flag: (a) any decisions
-> that would be difficult or impossible to implement with the stated engine and
-> language, (b) any missing interface definitions that programmers would need to
-> invent themselves, (c) any patterns that create avoidable technical debt or
-> that contradict standard [engine] idioms. Return FEASIBLE, CONCERNS [list], or
-> INFEASIBLE [blockers that make this architecture unimplementable as written]."
-
-**Verdicts**: FEASIBLE / CONCERNS / INFEASIBLE
-
----
-
-### LP-CODE-REVIEW — Lead Programmer Code Review
-
-**Trigger**: After a dev story is implemented (`/dev-story`, `/story-done`), or
-as part of `/code-review`
-
-**Context to pass**:
-- Implementation file paths
-- Story file path (for acceptance criteria)
-- Relevant GDD section
-- ADR that governs this system
-
-**Prompt**:
-> "Review this implementation against the story acceptance criteria and governing
-> ADR. Does the code match the architecture boundary definitions? Are there
-> violations of the coding standards or forbidden patterns? Is the public API
-> testable and documented? Are there any correctness issues against the GDD rules?
-> Return APPROVE, CONCERNS [specific issues], or REJECT [must be revised before merge]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### QL-STORY-READY — QA Lead Story Readiness Check
-
-**Trigger**: Before a story is accepted into a sprint — invoked by `/create-stories`,
-`/story-readiness`, and `/sprint-plan` during story selection
-
-**Context to pass**:
-- Story file path
-- Story type (Logic / Integration / Visual/Feel / UI / Config/Data)
-- Acceptance criteria list (verbatim from the story)
-- The GDD requirement (TR-ID and text) the story covers
-
-**Prompt**:
-> "Review this story's acceptance criteria for testability before it enters the
-> sprint. Are all criteria specific enough that a developer would know unambiguously
-> when they are done? For Logic-type stories: can every criterion be verified with
-> an automated test? For Integration stories: is each criterion observable in a
-> controlled test environment? Flag criteria that are too vague to implement
-> against, and flag criteria that require a full game build to test (mark these
-> DEFERRED, not BLOCKED). Return ADEQUATE (criteria are implementable as written),
-> GAPS [specific criteria needing refinement], or INADEQUATE [criteria are too
-> vague — story must be revised before sprint inclusion]."
-
-**Verdicts**: ADEQUATE / GAPS / INADEQUATE
-
----
-
-### QL-TEST-COVERAGE — QA Lead Test Coverage Review
-
-**Trigger**: After implementation stories are complete, before marking an epic
-done, or at `/gate-check` Production → Polish
-
-**Context to pass**:
-- List of implemented stories with story types (Logic / Integration / Visual / UI / Config)
-- Test file paths in `tests/`
-- GDD acceptance criteria for the system
-
-**Prompt**:
-> "Review the test coverage for these implementation stories. Are all Logic stories
-> covered by passing unit tests? Are Integration stories covered by integration
-> tests or documented playtests? Are the GDD acceptance criteria each mapped to at
-> least one test? Are there untested edge cases from the GDD Edge Cases section?
-> Return ADEQUATE (coverage meets standards), GAPS [specific missing tests], or
-> INADEQUATE [critical logic is untested — do not advance]."
-
-**Verdicts**: ADEQUATE / GAPS / INADEQUATE
-
----
-
-### ND-CONSISTENCY — Narrative Director Consistency Check
-
-**Trigger**: After writer deliverables (dialogue, lore, item descriptions) are
-authored, or when a design decision has narrative implications
-
-**Context to pass**:
-- Document or content file path(s)
-- Narrative bible or tone guide path (if exists)
-- Relevant world-building rules
-- Character or faction profiles affected
-
-**Prompt**:
-> "Review this narrative content for internal consistency and adherence to
-> established world rules. Are character voices consistent with their established
-> profiles? Does the lore contradict any established facts? Is the tone consistent
-> with the game's narrative direction? Return APPROVE, CONCERNS [specific
-> inconsistencies to fix], or REJECT [contradictions that break the narrative
-> foundation]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
-### AD-VISUAL — Art Director Visual Consistency Review
-
-**Trigger**: After art direction decisions are made, when new asset types are
-introduced, or when a tech art decision affects visual style
-
-**Context to pass**:
-- Art bible path (if exists at `design/art/art-bible.md`)
-- The specific asset type, style decision, or visual direction being reviewed
-- Reference images or style descriptions
-- Platform and performance constraints
-
-**Prompt**:
-> "Review this visual direction decision for consistency with the established art
-> style and production constraints. Does it match the art bible? Is it achievable
-> within the platform's performance budget? Are there asset pipeline implications
-> that create technical risk? Return APPROVE, CONCERNS [specific adjustments], or
-> REJECT [style violation or production risk that must be resolved first]."
-
-**Verdicts**: APPROVE / CONCERNS / REJECT
-
----
-
## Parallel Gate Protocol
-When a workflow requires multiple directors at the same checkpoint (most common
-at `/gate-check`), spawn all agents simultaneously:
+At checkpoints needing multiple directors (most common at `/gate-check`):
```
-Spawn in parallel (issue all Task calls before waiting for any result):
-1. creative-director → gate CD-PHASE-GATE
-2. technical-director → gate TD-PHASE-GATE
-3. producer → gate PR-PHASE-GATE
-4. art-director → gate AD-PHASE-GATE
+Spawn in parallel (issue all `Agent` calls before waiting for any result):
+creative-director → CD-PHASE-GATE, technical-director → TD-PHASE-GATE,
+producer → PR-PHASE-GATE, art-director → AD-PHASE-GATE
Collect all four verdicts, then apply escalation rules:
- Any NOT READY / REJECT → overall verdict minimum FAIL
@@ -782,14 +166,14 @@ Collect all four verdicts, then apply escalation rules:
## Adding New Gates
-When a new gate is needed for a new skill or workflow:
-
-1. Assign a gate ID: `[DIRECTOR-PREFIX]-[DESCRIPTIVE-SLUG]`
- - Prefixes: `CD-` `TD-` `PR-` `LP-` `QL-` `ND-` `AD-`
- - Add new prefixes for new agents: `audio-director` → `AU-`, `ux-designer` → `UX-`
-2. Add the gate under the appropriate director section with all five fields:
- Trigger, Context to pass, Prompt, Verdicts, and any special handling notes
-3. Reference it in skills by ID only — never copy the prompt text into the skill
+1. Assign a gate ID: `[DIRECTOR-PREFIX]-[DESCRIPTIVE-SLUG]`. Prefixes: `CD-`
+ `TD-` `PR-` `LP-` `QL-` `ND-` `AD-`; add new ones for new agents
+ (`audio-director` → `AU-`, `ux-designer` → `UX-`)
+2. Create `.claude/docs/director-gates/[gate-id].md` (lowercase), starting with
+ the standard "> Gate definition..." header note, with all five fields:
+ Trigger, Context to pass, Prompt, Verdicts, special handling notes
+3. Add its row to the Gate Index table above
+4. Reference it in skills by ID only — never copy the prompt text into the skill
---
@@ -798,9 +182,9 @@ When a new gate is needed for a new skill or workflow:
| Stage | Required Gates | Optional Gates |
|-------|---------------|----------------|
| **Concept** | CD-PILLARS, AD-CONCEPT-VISUAL | TD-FEASIBILITY, PR-SCOPE |
-| **Systems Design** | TD-SYSTEM-BOUNDARY, CD-SYSTEMS, PR-SCOPE, CD-GDD-ALIGN (per GDD) | ND-CONSISTENCY, AD-VISUAL |
-| **Technical Setup** | TD-ARCHITECTURE, TD-ADR (per ADR), LP-FEASIBILITY, AD-ART-BIBLE | TD-ENGINE-RISK |
+| **Systems Design** | TD-SYSTEM-BOUNDARY, CD-SYSTEMS, PR-SCOPE, CD-GDD-ALIGN (per GDD) | ND-CONSISTENCY, AD-VISUAL, TD-CHANGE-IMPACT (on GDD revision) |
+| **Technical Setup** | TD-ARCHITECTURE, TD-ADR (per ADR), TD-MANIFEST, LP-FEASIBILITY, AD-ART-BIBLE | TD-ENGINE-RISK |
| **Pre-Production** | PR-EPIC, QL-STORY-READY (per story), PR-SPRINT, all four PHASE-GATEs (via gate-check) | CD-PLAYTEST |
-| **Production** | LP-CODE-REVIEW (per story), QL-STORY-READY, PR-SPRINT (per sprint), QL-TEST-COVERAGE (per sprint close-out) | PR-MILESTONE, AD-VISUAL |
+| **Production** | LP-CODE-REVIEW (per story), QL-STORY-READY, PR-SPRINT (per sprint), QL-TEST-COVERAGE (per sprint close-out) | PR-MILESTONE, AD-VISUAL, TD-CHANGE-IMPACT (on GDD revision) |
| **Polish** | QL-TEST-COVERAGE, CD-PLAYTEST, PR-MILESTONE | AD-VISUAL |
| **Release** | All four PHASE-GATEs (via gate-check) | QL-TEST-COVERAGE |
diff --git a/.claude/docs/director-gates/ad-art-bible.md b/.claude/docs/director-gates/ad-art-bible.md
new file mode 100644
index 00000000..da50f8f3
--- /dev/null
+++ b/.claude/docs/director-gates/ad-art-bible.md
@@ -0,0 +1,26 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# AD-ART-BIBLE — Art Bible Sign-Off
+
+Agent: `art-director` | Model tier: Sonnet | Domain: Visual identity, art bible, visual production readiness
+
+**Trigger**: After the art bible is drafted (`/art-bible`), before asset production begins
+
+**Context to pass**:
+- Art bible path (`design/art/art-bible.md`)
+- Game pillars and core fantasy
+- Platform and performance constraints (`platform.*` and `performance.*` from `project.yaml`, falling back to `.claude/docs/technical-preferences.md`)
+- Visual identity anchor chosen during brainstorm (from `design/gdd/game-concept.md`)
+
+**Prompt**:
+> "Review this art bible for completeness and internal consistency. Does the color
+> system match the mood targets? Does the shape language follow from the visual
+> identity statement? Are the asset standards achievable within the platform
+> constraints? Does the character design direction give artists enough to work from
+> without over-specifying? Are there contradictions between sections? Would an
+> outsourcing team be able to produce assets from this document without additional
+> briefing? Return APPROVE (art bible is production-ready), CONCERNS [specific
+> sections needing clarification], or REJECT [fundamental inconsistencies that must
+> be resolved before asset production begins]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/ad-concept-visual.md b/.claude/docs/director-gates/ad-concept-visual.md
new file mode 100644
index 00000000..adeded97
--- /dev/null
+++ b/.claude/docs/director-gates/ad-concept-visual.md
@@ -0,0 +1,25 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# AD-CONCEPT-VISUAL — Visual Identity Anchor
+
+Agent: `art-director` | Model tier: Sonnet | Domain: Visual identity, art bible, visual production readiness
+
+**Trigger**: After game pillars are locked (brainstorm Phase 4), in parallel with CD-PILLARS
+
+**Context to pass**:
+- Game concept (elevator pitch, core fantasy, unique hook)
+- Full pillar set with names, definitions, and design tests
+- Target platform (if known)
+- Any reference games or visual touchstones mentioned by the user
+
+**Prompt**:
+> "Based on these game pillars and core concept, propose 2-3 distinct visual identity
+> directions. For each direction provide: (1) a one-line visual rule that could guide
+> all visual decisions (e.g., 'everything must move', 'beauty is in the decay'), (2)
+> mood and atmosphere targets, (3) shape language (sharp/rounded/organic/geometric
+> emphasis), (4) color philosophy (palette direction, what colors mean in this world).
+> Be specific — avoid generic descriptions. One direction should directly serve the
+> primary design pillar. Name each direction. Recommend which best serves the stated
+> pillars and explain why."
+
+**Verdicts**: CONCEPTS (multiple valid options — user selects) / STRONG (one direction clearly dominant) / CONCERNS (pillars don't provide enough direction to differentiate visual identity yet)
diff --git a/.claude/docs/director-gates/ad-phase-gate.md b/.claude/docs/director-gates/ad-phase-gate.md
new file mode 100644
index 00000000..2cbcaf09
--- /dev/null
+++ b/.claude/docs/director-gates/ad-phase-gate.md
@@ -0,0 +1,26 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# AD-PHASE-GATE — Visual Readiness at Phase Transition
+
+Agent: `art-director` | Model tier: Sonnet | Domain: Visual identity, art bible, visual production readiness
+
+**Trigger**: Always at `/gate-check` — spawn in parallel with CD-PHASE-GATE, TD-PHASE-GATE, and PR-PHASE-GATE
+
+**Context to pass**:
+- Target phase name
+- List of all art/visual artifacts present (file paths)
+- Visual identity anchor from `design/gdd/game-concept.md` (if present)
+- Art bible path if it exists (`design/art/art-bible.md`)
+
+**Prompt**:
+> "Review the current project state for [target phase] gate readiness from a visual
+> direction perspective. Is the visual identity established and documented at the
+> level this phase requires? Are the right visual artifacts in place? Would visual
+> teams be able to begin their work without visual direction gaps that cause costly
+> rework later? Are there visual decisions that are being deferred past their latest
+> responsible moment? Return READY, CONCERNS [specific visual direction gaps that
+> could cause production rework], or NOT READY [visual blockers that must exist
+> before this phase can succeed — specify what artifact is missing and why it
+> matters at this stage]."
+
+**Verdicts**: READY / CONCERNS / NOT READY
diff --git a/.claude/docs/director-gates/ad-visual.md b/.claude/docs/director-gates/ad-visual.md
new file mode 100644
index 00000000..033103b2
--- /dev/null
+++ b/.claude/docs/director-gates/ad-visual.md
@@ -0,0 +1,23 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# AD-VISUAL — Art Director Visual Consistency Review
+
+Agent: `art-director` | Model tier: Sonnet (Tier 2 lead — invoked when a domain specialist's feasibility sign-off is needed)
+
+**Trigger**: After art direction decisions are made, when new asset types are
+introduced, or when a tech art decision affects visual style
+
+**Context to pass**:
+- Art bible path (if exists at `design/art/art-bible.md`)
+- The specific asset type, style decision, or visual direction being reviewed
+- Reference images or style descriptions
+- Platform and performance constraints
+
+**Prompt**:
+> "Review this visual direction decision for consistency with the established art
+> style and production constraints. Does it match the art bible? Is it achievable
+> within the platform's performance budget? Are there asset pipeline implications
+> that create technical risk? Return APPROVE, CONCERNS [specific adjustments], or
+> REJECT [style violation or production risk that must be resolved first]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/cd-gdd-align.md b/.claude/docs/director-gates/cd-gdd-align.md
new file mode 100644
index 00000000..0ab51aca
--- /dev/null
+++ b/.claude/docs/director-gates/cd-gdd-align.md
@@ -0,0 +1,23 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# CD-GDD-ALIGN — GDD Pillar Alignment Check
+
+Agent: `creative-director` | Model tier: Opus | Domain: Vision, pillars, player experience
+
+**Trigger**: After a system GDD is authored (design-system, quick-design, or any
+workflow that produces a GDD)
+
+**Context to pass**:
+- GDD file path
+- Game pillars (from `design/gdd/game-concept.md` or `design/gdd/game-pillars.md`)
+- MDA aesthetics target for this game
+- System's stated Player Fantasy section
+
+**Prompt**:
+> "Review this system GDD for pillar alignment. Does every section serve the stated
+> pillars? Are there mechanics or rules that contradict or weaken a pillar? Does
+> the Player Fantasy section match the game's core fantasy? Return APPROVE, CONCERNS
+> [specific sections with issues], or REJECT [pillar violations that must be
+> redesigned before this system is implementable]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/cd-narrative.md b/.claude/docs/director-gates/cd-narrative.md
new file mode 100644
index 00000000..d6828ecf
--- /dev/null
+++ b/.claude/docs/director-gates/cd-narrative.md
@@ -0,0 +1,24 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# CD-NARRATIVE — Narrative Consistency Check
+
+Agent: `creative-director` | Model tier: Opus | Domain: Vision, pillars, player experience
+
+**Trigger**: After narrative GDDs, lore documents, dialogue specs, or world-building
+documents are authored (team-narrative, design-system for story systems, writer
+deliverables)
+
+**Context to pass**:
+- Document file path(s)
+- Game pillars
+- Narrative direction brief or tone guide (if exists at `design/narrative/`)
+- Any existing lore that the new document references
+
+**Prompt**:
+> "Review this narrative content for consistency with the game's pillars and
+> established world rules. Does the tone match the game's established voice? Are
+> there contradictions with existing lore or world-building? Does the content serve
+> the player experience pillar? Return APPROVE, CONCERNS [specific inconsistencies],
+> or REJECT [contradictions that break world coherence]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/cd-phase-gate.md b/.claude/docs/director-gates/cd-phase-gate.md
new file mode 100644
index 00000000..6e9c8dfd
--- /dev/null
+++ b/.claude/docs/director-gates/cd-phase-gate.md
@@ -0,0 +1,21 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# CD-PHASE-GATE — Creative Readiness at Phase Transition
+
+Agent: `creative-director` | Model tier: Opus | Domain: Vision, pillars, player experience
+
+**Trigger**: Always at `/gate-check` — spawn in parallel with TD-PHASE-GATE and PR-PHASE-GATE
+
+**Context to pass**:
+- Target phase name
+- List of all artifacts present (file paths)
+- Game pillars and core fantasy
+
+**Prompt**:
+> "Review the current project state for [target phase] gate readiness from a
+> creative direction perspective. Are the game pillars faithfully represented in
+> all design artifacts? Does the current state preserve the core fantasy? Are there
+> any design decisions across GDDs or architecture that compromise the intended
+> player experience? Return READY, CONCERNS [list], or NOT READY [blockers]."
+
+**Verdicts**: READY / CONCERNS / NOT READY
diff --git a/.claude/docs/director-gates/cd-pillars.md b/.claude/docs/director-gates/cd-pillars.md
new file mode 100644
index 00000000..86f2e6a6
--- /dev/null
+++ b/.claude/docs/director-gates/cd-pillars.md
@@ -0,0 +1,24 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# CD-PILLARS — Pillar Stress Test
+
+Agent: `creative-director` | Model tier: Opus | Domain: Vision, pillars, player experience
+
+**Trigger**: After game pillars and anti-pillars are defined (brainstorm Phase 4,
+or any time pillars are revised)
+
+**Context to pass**:
+- Full pillar set with names, definitions, and design tests
+- Anti-pillars list
+- Core fantasy statement
+- Unique hook ("Like X, AND ALSO Y")
+
+**Prompt**:
+> "Review these game pillars. Are they falsifiable — could a real design decision
+> actually fail this pillar? Do they create meaningful tension with each other? Do
+> they differentiate this game from its closest comparables? Would they help resolve
+> a design disagreement in practice, or are they too vague to be useful? Return
+> specific feedback for each pillar and an overall verdict: APPROVE (strong), CONCERNS
+> [list] (needs sharpening), or REJECT (weak — pillars do not carry weight)."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/cd-playtest.md b/.claude/docs/director-gates/cd-playtest.md
new file mode 100644
index 00000000..55569146
--- /dev/null
+++ b/.claude/docs/director-gates/cd-playtest.md
@@ -0,0 +1,23 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# CD-PLAYTEST — Player Experience Validation
+
+Agent: `creative-director` | Model tier: Opus | Domain: Vision, pillars, player experience
+
+**Trigger**: After playtest reports are generated (`/playtest-report`), or after
+any session that produces player feedback
+
+**Context to pass**:
+- Playtest report file path
+- Game pillars and core fantasy statement
+- The specific hypothesis being tested
+
+**Prompt**:
+> "Review this playtest report against the game's design pillars and core fantasy.
+> Is the player experience matching the intended fantasy? Are there systematic issues
+> that represent pillar drift — mechanics that feel fine in isolation but undermine
+> the intended experience? Return APPROVE (core fantasy is landing), CONCERNS [gaps
+> between intended and actual experience], or REJECT [core fantasy is not present —
+> redesign needed before further playtesting]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/cd-systems.md b/.claude/docs/director-gates/cd-systems.md
new file mode 100644
index 00000000..71dd176d
--- /dev/null
+++ b/.claude/docs/director-gates/cd-systems.md
@@ -0,0 +1,27 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# CD-SYSTEMS — Systems Decomposition Vision Check
+
+Agent: `creative-director` | Model tier: Opus | Domain: Vision, pillars, player experience
+
+**Trigger**: After the systems index is written by `/map-systems` — validates the
+complete system set before GDD authoring begins
+
+**Context to pass**:
+- Systems index path (`design/gdd/systems-index.md`)
+- Game pillars and core fantasy (from `design/gdd/game-concept.md`)
+- Priority tier assignments (MVP / Vertical Slice / Alpha / Full Vision)
+- Any high-risk or bottleneck systems identified in the dependency map
+
+**Prompt**:
+> "Review this systems decomposition against the game's design pillars. Does the
+> full set of MVP-tier systems collectively deliver the core fantasy? Are there
+> systems whose mechanics don't serve any stated pillar — indicating they may be
+> scope creep? Are there pillar-critical player experiences that have no system
+> assigned to deliver them? Are any systems missing that the core loop requires?
+> Return APPROVE (systems serve the vision), CONCERNS [specific gaps or
+> misalignments with their pillar implications], or REJECT [fundamental gaps —
+> the decomposition misses critical design intent and must be revised before GDD
+> authoring begins]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/lp-code-review.md b/.claude/docs/director-gates/lp-code-review.md
new file mode 100644
index 00000000..f6a56b41
--- /dev/null
+++ b/.claude/docs/director-gates/lp-code-review.md
@@ -0,0 +1,23 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# LP-CODE-REVIEW — Lead Programmer Code Review
+
+Agent: `lead-programmer` | Model tier: Sonnet (Tier 2 lead — invoked when a domain specialist's feasibility sign-off is needed)
+
+**Trigger**: After a dev story is implemented (`/dev-story`, `/story-done`), or
+as part of `/code-review`
+
+**Context to pass**:
+- Implementation file paths
+- Story file path (for acceptance criteria)
+- Relevant GDD section
+- ADR that governs this system
+
+**Prompt**:
+> "Review this implementation against the story acceptance criteria and governing
+> ADR. Does the code match the architecture boundary definitions? Are there
+> violations of the coding standards or forbidden patterns? Is the public API
+> testable and documented? Are there any correctness issues against the GDD rules?
+> Return APPROVE, CONCERNS [specific issues], or REJECT [must be revised before merge]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/lp-feasibility.md b/.claude/docs/director-gates/lp-feasibility.md
new file mode 100644
index 00000000..1157a009
--- /dev/null
+++ b/.claude/docs/director-gates/lp-feasibility.md
@@ -0,0 +1,23 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# LP-FEASIBILITY — Lead Programmer Implementation Feasibility
+
+Agent: `lead-programmer` | Model tier: Sonnet (Tier 2 lead — invoked when a domain specialist's feasibility sign-off is needed)
+
+**Trigger**: After the master architecture document is written (`/create-architecture`
+Phase 7b), or when a new architectural pattern is proposed
+
+**Context to pass**:
+- Architecture document path
+- Technical requirements baseline summary
+- ADR list with statuses
+
+**Prompt**:
+> "Review this architecture for implementation feasibility. Flag: (a) any decisions
+> that would be difficult or impossible to implement with the stated engine and
+> language, (b) any missing interface definitions that programmers would need to
+> invent themselves, (c) any patterns that create avoidable technical debt or
+> that contradict standard [engine] idioms. Return FEASIBLE, CONCERNS [list], or
+> INFEASIBLE [blockers that make this architecture unimplementable as written]."
+
+**Verdicts**: FEASIBLE / CONCERNS / INFEASIBLE
diff --git a/.claude/docs/director-gates/nd-consistency.md b/.claude/docs/director-gates/nd-consistency.md
new file mode 100644
index 00000000..3e0ef349
--- /dev/null
+++ b/.claude/docs/director-gates/nd-consistency.md
@@ -0,0 +1,24 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# ND-CONSISTENCY — Narrative Director Consistency Check
+
+Agent: `narrative-director` | Model tier: Sonnet (Tier 2 lead — invoked when a domain specialist's feasibility sign-off is needed)
+
+**Trigger**: After writer deliverables (dialogue, lore, item descriptions) are
+authored, or when a design decision has narrative implications
+
+**Context to pass**:
+- Document or content file path(s)
+- Narrative bible or tone guide path (if exists)
+- Relevant world-building rules
+- Character or faction profiles affected
+
+**Prompt**:
+> "Review this narrative content for internal consistency and adherence to
+> established world rules. Are character voices consistent with their established
+> profiles? Does the lore contradict any established facts? Is the tone consistent
+> with the game's narrative direction? Return APPROVE, CONCERNS [specific
+> inconsistencies to fix], or REJECT [contradictions that break the narrative
+> foundation]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/pr-epic.md b/.claude/docs/director-gates/pr-epic.md
new file mode 100644
index 00000000..558b4f34
--- /dev/null
+++ b/.claude/docs/director-gates/pr-epic.md
@@ -0,0 +1,30 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# PR-EPIC — Epic Structure Feasibility Review
+
+Agent: `producer` | Model tier: Opus | Domain: Scope, timeline, dependencies, production risk
+
+**Trigger**: After epics are defined by `/create-epics`, before stories are
+broken out — validates the epic structure is producible before `/create-stories`
+is invoked
+
+**Context to pass**:
+- Epic definition file paths (all epics just created)
+- Epic index path (`production/epics/index.md`)
+- Milestone timeline and target dates
+- Team capacity (solo / small team / size)
+- Layer being epiced (Foundation / Core / Feature / etc.)
+
+**Prompt**:
+> "Review this epic structure for production feasibility before story breakdown
+> begins. Are the epic boundaries scoped appropriately — could each epic realistically
+> complete before a milestone deadline? Are epics correctly ordered by system
+> dependency — does any epic require another epic's output before it can start?
+> Are any epics underscoped (too small, should merge) or overscoped (too large,
+> should split into 2-3 focused epics)? Are the Foundation-layer epics scoped to
+> allow Core-layer epics to begin at the start of the next sprint after Foundation
+> completes? Return REALISTIC (epic structure is producible), CONCERNS [specific
+> structural adjustments before stories are written], or UNREALISTIC [epics must
+> be split, merged, or reordered — story breakdown cannot begin until resolved]."
+
+**Verdicts**: REALISTIC / CONCERNS / UNREALISTIC
diff --git a/.claude/docs/director-gates/pr-milestone.md b/.claude/docs/director-gates/pr-milestone.md
new file mode 100644
index 00000000..575dcf9f
--- /dev/null
+++ b/.claude/docs/director-gates/pr-milestone.md
@@ -0,0 +1,24 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# PR-MILESTONE — Milestone Risk Assessment
+
+Agent: `producer` | Model tier: Opus | Domain: Scope, timeline, dependencies, production risk
+
+**Trigger**: At milestone review (`/milestone-review`), at mid-sprint retrospectives,
+or when a scope change is proposed that affects the milestone
+
+**Context to pass**:
+- Milestone definition and target date
+- Current completion percentage
+- Blocked stories count
+- Sprint velocity data (if available)
+
+**Prompt**:
+> "Review this milestone status. Based on current velocity and blocked story count,
+> will this milestone hit its target date? What are the top 3 production risks
+> between now and the milestone? Are there scope items that should be cut to protect
+> the milestone date vs. items that are non-negotiable? Return ON TRACK, AT RISK
+> [specific mitigations], or OFF TRACK [date must slip or scope must cut — provide
+> both options]."
+
+**Verdicts**: ON TRACK / AT RISK / OFF TRACK
diff --git a/.claude/docs/director-gates/pr-phase-gate.md b/.claude/docs/director-gates/pr-phase-gate.md
new file mode 100644
index 00000000..b96f1620
--- /dev/null
+++ b/.claude/docs/director-gates/pr-phase-gate.md
@@ -0,0 +1,22 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# PR-PHASE-GATE — Production Readiness at Phase Transition
+
+Agent: `producer` | Model tier: Opus | Domain: Scope, timeline, dependencies, production risk
+
+**Trigger**: Always at `/gate-check` — spawn in parallel with CD-PHASE-GATE and TD-PHASE-GATE
+
+**Context to pass**:
+- Target phase name
+- Sprint and milestone artifacts present
+- Team size and capacity
+- Current blocked story count
+
+**Prompt**:
+> "Review the current project state for [target phase] gate readiness from a
+> production perspective. Is the scope realistic for the stated timeline and team
+> size? Are dependencies properly ordered so the team can actually execute in
+> sequence? Are there milestone or sprint risks that could derail the phase within
+> the first two sprints? Return READY, CONCERNS [list], or NOT READY [blockers]."
+
+**Verdicts**: READY / CONCERNS / NOT READY
diff --git a/.claude/docs/director-gates/pr-scope.md b/.claude/docs/director-gates/pr-scope.md
new file mode 100644
index 00000000..36016e90
--- /dev/null
+++ b/.claude/docs/director-gates/pr-scope.md
@@ -0,0 +1,25 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# PR-SCOPE — Scope and Timeline Validation
+
+Agent: `producer` | Model tier: Opus | Domain: Scope, timeline, dependencies, production risk
+
+**Trigger**: After scope tiers are defined (brainstorm Phase 6, quick-design, or
+any workflow that produces an MVP definition and timeline estimate)
+
+**Context to pass**:
+- Full vision scope description
+- MVP definition
+- Timeline estimate
+- Team size (solo / small team / etc.)
+- Scope tiers (what ships if time runs out)
+
+**Prompt**:
+> "Review this scope estimate. Is the MVP achievable in the stated timeline for
+> the stated team size? Are the scope tiers correctly ordered by risk — does each
+> tier deliver a shippable product if work stops there? What is the most likely
+> cut point under time pressure, and is it a graceful fallback or a broken product?
+> Return REALISTIC (scope matches capacity), OPTIMISTIC [specific adjustments
+> recommended], or UNREALISTIC [blockers — timeline or MVP must be revised]."
+
+**Verdicts**: REALISTIC / OPTIMISTIC / UNREALISTIC
diff --git a/.claude/docs/director-gates/pr-sprint.md b/.claude/docs/director-gates/pr-sprint.md
new file mode 100644
index 00000000..ca55c9d9
--- /dev/null
+++ b/.claude/docs/director-gates/pr-sprint.md
@@ -0,0 +1,24 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# PR-SPRINT — Sprint Feasibility Review
+
+Agent: `producer` | Model tier: Opus | Domain: Scope, timeline, dependencies, production risk
+
+**Trigger**: Before finalising a sprint plan (`/sprint-plan`), and after any
+mid-sprint scope change
+
+**Context to pass**:
+- Proposed sprint story list (titles, estimates, dependencies)
+- Team capacity (hours available)
+- Current sprint backlog debt (if any)
+- Milestone constraints
+
+**Prompt**:
+> "Review this sprint plan for feasibility. Is the story load realistic for the
+> available capacity? Are stories correctly ordered by dependency? Are there hidden
+> dependencies between stories that could block the sprint mid-way? Are any stories
+> underestimated given their technical complexity? Return REALISTIC (plan is
+> achievable), CONCERNS [specific risks], or UNREALISTIC [sprint must be
+> descoped — identify which stories to defer]."
+
+**Verdicts**: REALISTIC / CONCERNS / UNREALISTIC
diff --git a/.claude/docs/director-gates/ql-story-ready.md b/.claude/docs/director-gates/ql-story-ready.md
new file mode 100644
index 00000000..4c6a9a17
--- /dev/null
+++ b/.claude/docs/director-gates/ql-story-ready.md
@@ -0,0 +1,27 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# QL-STORY-READY — QA Lead Story Readiness Check
+
+Agent: `qa-lead` | Model tier: Sonnet (Tier 2 lead — invoked when a domain specialist's feasibility sign-off is needed)
+
+**Trigger**: Before a story is accepted into a sprint — invoked by `/create-stories`,
+`/story-readiness`, and `/sprint-plan` during story selection
+
+**Context to pass**:
+- Story file path
+- Story type (Logic / Integration / Visual/Feel / UI / Config/Data)
+- Acceptance criteria list (verbatim from the story)
+- The GDD requirement (TR-ID and text) the story covers
+
+**Prompt**:
+> "Review this story's acceptance criteria for testability before it enters the
+> sprint. Are all criteria specific enough that a developer would know unambiguously
+> when they are done? For Logic-type stories: can every criterion be verified with
+> an automated test? For Integration stories: is each criterion observable in a
+> controlled test environment? Flag criteria that are too vague to implement
+> against, and flag criteria that require a full game build to test (mark these
+> DEFERRED, not BLOCKED). Return ADEQUATE (criteria are implementable as written),
+> GAPS [specific criteria needing refinement], or INADEQUATE [criteria are too
+> vague — story must be revised before sprint inclusion]."
+
+**Verdicts**: ADEQUATE / GAPS / INADEQUATE
diff --git a/.claude/docs/director-gates/ql-test-coverage.md b/.claude/docs/director-gates/ql-test-coverage.md
new file mode 100644
index 00000000..ac6ac7bc
--- /dev/null
+++ b/.claude/docs/director-gates/ql-test-coverage.md
@@ -0,0 +1,23 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# QL-TEST-COVERAGE — QA Lead Test Coverage Review
+
+Agent: `qa-lead` | Model tier: Sonnet (Tier 2 lead — invoked when a domain specialist's feasibility sign-off is needed)
+
+**Trigger**: After implementation stories are complete, before marking an epic
+done, or at `/gate-check` Production → Polish
+
+**Context to pass**:
+- List of implemented stories with story types (Logic / Integration / Visual / UI / Config)
+- Test file paths in `tests/`
+- GDD acceptance criteria for the system
+
+**Prompt**:
+> "Review the test coverage for these implementation stories. Are all Logic stories
+> covered by passing unit tests? Are Integration stories covered by integration
+> tests or documented playtests? Are the GDD acceptance criteria each mapped to at
+> least one test? Are there untested edge cases from the GDD Edge Cases section?
+> Return ADEQUATE (coverage meets standards), GAPS [specific missing tests], or
+> INADEQUATE [critical logic is untested — do not advance]."
+
+**Verdicts**: ADEQUATE / GAPS / INADEQUATE
diff --git a/.claude/docs/director-gates/td-adr.md b/.claude/docs/director-gates/td-adr.md
new file mode 100644
index 00000000..76f79f42
--- /dev/null
+++ b/.claude/docs/director-gates/td-adr.md
@@ -0,0 +1,23 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# TD-ADR — Architecture Decision Review
+
+Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
+
+**Trigger**: After an individual ADR is authored (`/architecture-decision`), before
+it is marked Accepted
+
+**Context to pass**:
+- ADR file path
+- Engine version and knowledge gap risk level for the domain
+- Related ADRs (if any)
+
+**Prompt**:
+> "Review this Architecture Decision Record. Does it have a clear problem statement
+> and rationale? Are the rejected alternatives genuinely considered? Does the
+> Consequences section acknowledge the trade-offs honestly? Is the engine version
+> stamped? Are post-cutoff API risks flagged? Does it link to the GDD requirements
+> it covers? Return APPROVE, CONCERNS [specific gaps], or REJECT [the decision is
+> underspecified or makes unsound technical assumptions]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/td-architecture.md b/.claude/docs/director-gates/td-architecture.md
new file mode 100644
index 00000000..6fbc0358
--- /dev/null
+++ b/.claude/docs/director-gates/td-architecture.md
@@ -0,0 +1,24 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# TD-ARCHITECTURE — Architecture Sign-Off
+
+Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
+
+**Trigger**: After the master architecture document is drafted (`/create-architecture`
+Phase 7), and after any major architecture revision
+
+**Context to pass**:
+- Architecture document path (`docs/architecture/architecture.md`)
+- Technical requirements baseline (TR-IDs and count)
+- ADR list with statuses
+- Engine knowledge gap inventory
+
+**Prompt**:
+> "Review this master architecture document for technical soundness. Check: (1) Is
+> every technical requirement from the baseline covered by an architectural decision?
+> (2) Are all HIGH risk engine domains explicitly addressed or flagged as open
+> questions? (3) Are the API boundaries clean, minimal, and implementable? (4) Are
+> Foundation layer ADR gaps resolved before implementation begins? Return APPROVE,
+> CONCERNS [list], or REJECT [blockers that must be resolved before coding starts]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/td-change-impact.md b/.claude/docs/director-gates/td-change-impact.md
new file mode 100644
index 00000000..b5f882cd
--- /dev/null
+++ b/.claude/docs/director-gates/td-change-impact.md
@@ -0,0 +1,25 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# TD-CHANGE-IMPACT — Design Change Impact Review
+
+Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
+
+**Trigger**: After the Design Change Impact Report is produced
+(`/propagate-design-change` Phase 6), before the resolution workflow begins
+
+**Context to pass**:
+- The full Design Change Impact Report from Phase 6 — change summary, every
+ affected ADR with its Still Valid / Needs Review / Likely Superseded
+ classification, and the recommended actions
+
+**Prompt**:
+> "Review this design-change impact assessment before any ADR is revised. Are the
+> impact classifications correct — in particular, is any ADR under-classified
+> (marked Still Valid when the change actually contradicts its assumptions)? Are
+> the recommended actions architecturally sound? Were any cascading effects on
+> other ADRs or systems missed — decisions that depend on the ones already
+> flagged? Return APPROVE, CONCERNS [the specific ADRs or recommendations to
+> revisit], or REJECT [the assessment must be re-analyzed before resolution
+> begins — say what was missed]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/td-engine-risk.md b/.claude/docs/director-gates/td-engine-risk.md
new file mode 100644
index 00000000..adeb123f
--- /dev/null
+++ b/.claude/docs/director-gates/td-engine-risk.md
@@ -0,0 +1,22 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# TD-ENGINE-RISK — Engine Version Risk Review
+
+Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
+
+**Trigger**: When making architecture decisions that touch post-cutoff engine APIs,
+or before finalizing any engine-specific implementation approach
+
+**Context to pass**:
+- The specific API or feature being used
+- Engine version and LLM knowledge cutoff (from `docs/engine-reference/[engine]/VERSION.md`)
+- Relevant excerpt from breaking-changes or deprecated-apis docs
+
+**Prompt**:
+> "Review this engine API usage against the version reference. Is this API present
+> in [engine version]? Has its signature, behaviour, or namespace changed since the
+> LLM knowledge cutoff? Are there known deprecations or post-cutoff alternatives?
+> Return APPROVE (safe to use as described), CONCERNS [verify before implementing],
+> or REJECT [API has changed — provide corrected approach]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/td-feasibility.md b/.claude/docs/director-gates/td-feasibility.md
new file mode 100644
index 00000000..b06afb7c
--- /dev/null
+++ b/.claude/docs/director-gates/td-feasibility.md
@@ -0,0 +1,24 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# TD-FEASIBILITY — Technical Feasibility Assessment
+
+Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
+
+**Trigger**: After biggest technical risks are identified during scope/feasibility
+(brainstorm Phase 6, quick-design, or any early-stage concept with technical unknowns)
+
+**Context to pass**:
+- Concept's core loop description
+- Platform target
+- Engine choice (or "undecided")
+- List of identified technical risks
+
+**Prompt**:
+> "Review these technical risks for a [genre] game targeting [platform] using
+> [engine or 'undecided engine']. Flag any HIGH risk items that could invalidate
+> the concept as described, any risks that are engine-specific and should influence
+> the engine choice, and any risks that are commonly underestimated by solo
+> developers. Return VIABLE (risks are manageable), CONCERNS [list with mitigation
+> suggestions], or HIGH RISK [blockers that require concept or scope revision]."
+
+**Verdicts**: VIABLE / CONCERNS / HIGH RISK
diff --git a/.claude/docs/director-gates/td-manifest.md b/.claude/docs/director-gates/td-manifest.md
new file mode 100644
index 00000000..6f3c30db
--- /dev/null
+++ b/.claude/docs/director-gates/td-manifest.md
@@ -0,0 +1,26 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# TD-MANIFEST — Control Manifest Review
+
+Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
+
+**Trigger**: After control-manifest rules are extracted and previewed
+(`/create-control-manifest` Phase 4), before the manifest file is written
+
+**Context to pass**:
+- The Control Manifest Preview from Phase 4 (rule counts per layer, full extracted rule list)
+- The list of ADRs covered
+- Engine version
+- Any rules sourced from `technical-preferences.md` or engine reference docs
+
+**Prompt**:
+> "Review this control manifest before it is written. Are all mandatory ADR
+> patterns captured and accurately stated? Are the forbidden approaches complete
+> and correctly attributed to their source ADR? Were any rules added that lack a
+> source ADR or preference document — that is, invented rather than extracted?
+> Are the performance guardrails consistent with the constraints the ADRs
+> actually set? Return APPROVE, CONCERNS [list the specific rules to revise], or
+> REJECT [rules that are wrong or unsourced and must be fixed before the manifest
+> is written]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/director-gates/td-phase-gate.md b/.claude/docs/director-gates/td-phase-gate.md
new file mode 100644
index 00000000..e204448a
--- /dev/null
+++ b/.claude/docs/director-gates/td-phase-gate.md
@@ -0,0 +1,22 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# TD-PHASE-GATE — Technical Readiness at Phase Transition
+
+Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
+
+**Trigger**: Always at `/gate-check` — spawn in parallel with CD-PHASE-GATE and PR-PHASE-GATE
+
+**Context to pass**:
+- Target phase name
+- Architecture document path (if exists)
+- Engine reference path
+- ADR list
+
+**Prompt**:
+> "Review the current project state for [target phase] gate readiness from a
+> technical direction perspective. Is the architecture sound for this phase? Are
+> all high-risk engine domains addressed? Are performance budgets realistic and
+> documented? Are Foundation-layer decisions complete enough to begin implementation?
+> Return READY, CONCERNS [list], or NOT READY [blockers]."
+
+**Verdicts**: READY / CONCERNS / NOT READY
diff --git a/.claude/docs/director-gates/td-system-boundary.md b/.claude/docs/director-gates/td-system-boundary.md
new file mode 100644
index 00000000..34360085
--- /dev/null
+++ b/.claude/docs/director-gates/td-system-boundary.md
@@ -0,0 +1,31 @@
+> Gate definition. The spawning skill passes this file's path to the director agent; the AGENT reads it — the parent session should not.
+
+# TD-SYSTEM-BOUNDARY — System Boundary Architecture Review
+
+Agent: `technical-director` | Model tier: Opus | Domain: Architecture, engine risk, performance
+
+**Trigger**: After `/map-systems` Phase 3 dependency mapping is agreed but before
+GDD authoring begins — validates that the system structure is architecturally
+sound before teams invest in writing GDDs against it
+
+**Context to pass**:
+- Systems index path (or the dependency map summary if index not yet written)
+- Layer assignments (Foundation / Core / Feature / Presentation / Polish)
+- The full dependency graph (what each system depends on)
+- Any bottleneck systems flagged (many dependents)
+- Any circular dependencies found and their proposed resolutions
+
+**Prompt**:
+> "Review this systems decomposition from an architectural perspective before GDD
+> authoring begins. Are the system boundaries clean — does each system own a
+> distinct concern with minimal overlap? Are there God Object risks (systems doing
+> too much)? Does the dependency ordering create implementation-sequencing problems?
+> Are there implicit shared-state problems in the proposed boundaries that will
+> cause tight coupling when implemented? Are any Foundation-layer systems actually
+> dependent on Feature-layer systems (inverted dependency)? Return APPROVE
+> (boundaries are architecturally sound — proceed to GDD authoring), CONCERNS
+> [specific boundary issues to address in the GDDs themselves], or REJECT
+> [fundamental boundary problems — the system structure will cause architectural
+> issues and must be restructured before any GDD is written]."
+
+**Verdicts**: APPROVE / CONCERNS / REJECT
diff --git a/.claude/docs/directory-structure.md b/.claude/docs/directory-structure.md
index 7e859f28..268a01b6 100644
--- a/.claude/docs/directory-structure.md
+++ b/.claude/docs/directory-structure.md
@@ -3,16 +3,41 @@
```text
/
├── CLAUDE.md # Master configuration
+├── project.yaml # Machine-readable project config — engine, modes, stage (source of truth)
├── .claude/ # Agent definitions, skills, hooks, rules, docs
-├── src/ # Game source code (core, gameplay, ai, networking, ui, tools)
+├── <code root>/ # Game source code — THE PATH IS ENGINE-SPECIFIC, see below
├── assets/ # Game assets (art, audio, vfx, shaders, data)
├── design/ # Game design documents (gdd, narrative, levels, balance)
├── docs/ # Technical documentation (architecture, api, postmortems)
│ └── engine-reference/ # Curated engine API snapshots (version-pinned)
-├── tests/ # Test suites (unit, integration, performance, playtest)
+├── tests/ # Game test suites (unit, integration, performance, playtest)
├── tools/ # Build and pipeline tools (ci, build, asset-pipeline)
├── prototypes/ # Throwaway prototypes (isolated from src/)
-└── production/ # Production management (sprints, milestones, releases)
- ├── session-state/ # Ephemeral session state (active.md — gitignored)
- └── session-logs/ # Session audit trail (gitignored)
+├── production/ # Production management (sprints, milestones, releases)
+│ ├── session-state/ # Ephemeral session state (active.md — gitignored)
+│ └── session-logs/ # Session audit trail (gitignored)
+└── CCGS Skill Testing Framework/ # QA for the skills/agents themselves — /skill-test, /skill-improve
```
+
+## The code root is engine-specific
+
+**Two of the three supported engines will not build a project whose code sits in
+`src/`.** This is not a style preference — it is a hard constraint of the engine's
+own toolchain:
+
+| `engine.name` | Code root | Why it cannot be `src/` |
+|---|---|---|
+| **Godot** | `src/` | No constraint — Godot loads from `res://` anywhere under the project root. |
+| **Unity** | `Assets/` | Unity compiles **only** `Assets/` and `Packages/`. Code outside them is invisible to the compiler. |
+| **Unreal** | `Source/<Module>/` | UnrealBuildTool discovers modules under `Source/`; content lives in `Content/`. A module elsewhere is not built. |
+
+**Resolve the code root from `engine.name` before writing any source file.** Where
+a skill, rule or template says `src/`, read it as *"the code root"* and substitute
+the row above. `src/` is the table's Godot row, not a universal path.
+
+> **Known residual — do not read `src/` as settled.** Roughly 30 files under
+> `.claude/` still name `src/` literally, because they were written when Godot was
+> the only engine walked end to end. They are correct for Godot and wrong for the
+> other two. This section is the authority; those files are the default. The
+> breakage is real, not theoretical — a Unity tree laid out this way does not
+> compile, and an Unreal one produces a module no `.uproject` can consume.
diff --git a/.claude/docs/effects-map.md b/.claude/docs/effects-map.md
new file mode 100644
index 00000000..bcdabb39
--- /dev/null
+++ b/.claude/docs/effects-map.md
@@ -0,0 +1,2421 @@
+# project.yaml — Effects Map
+
+> ## READ ONE SECTION, NEVER THIS WHOLE FILE
+>
+> This document is **~31,000 tokens** — roughly **four times an entire turn's
+> context budget**, which sits near 8,300. It is organised as **36 sections of
+> ~900 tokens each**, one per setting, headed `## <key>`.
+>
+> **So opening it costs 36× what you need.** To look up a setting:
+>
+> ```
+> Grep pattern="^## modes.review_mode" path=".claude/docs/effects-map.md" -A 40
+> ```
+>
+> Read the section for your key and stop. The same rule the skills already apply
+> to their own reference files — `/gate-check` loads only the row for the target
+> phase and says "never load the others" — applies here, and this is the largest
+> file in the framework by a factor of seven.
+>
+> This banner exists because six skills cite this document and **none of them
+> scoped the citation**. None instructed a full read either, so
+> nothing was actually loading 31k — but "see effects-map.md for full schema" in
+> front of a file this size is an invitation, and the cost of accepting it is
+> silent.
+
+This document defines what each `project.yaml` setting actually does across
+every skill that reads it. It is the tracked, authoritative reference.
+
+**Purpose:** When a skill reads a setting, this document is the authoritative
+source for what each value means for that skill's behavior. Implementers update
+this file when adding a new setting or changing how a skill responds to one.
+
+**Format per setting:**
+- Priority chain — which source wins when multiple are present
+- Per-value intent — what the value means in plain terms
+- Skill behavior table — exactly what changes per skill per value
+
+**Coverage scope:** This document covers the skills most affected by each setting.
+Skills not listed (e.g. `ux-review`, `balance-check`, `test-flakiness`, `test-helpers`,
+`test-setup`, `soak-test`, `perf-profile`, `launch-checklist`, `release-checklist`,
+`skill-test`, `skill-improve`, `vertical-slice`) are not meaningfully affected by
+`project.yaml` settings and do not need entries here. Add a skill only when its
+behavior genuinely branches on a setting value.
+
+**Local override pattern:** `project.yaml` is committed to git as the shared team
+config. Per-developer overrides live in `project.local.yaml` (gitignored). Priority
+chain across all settings: `project.local.yaml` → `project.yaml` → legacy mirror →
+`modes.rigor` expansion → hardcoded default. The expansion step applies only to the
+six knobs `rigor` fronts (`modes.workflow`, `docs.density`, `qa.level`,
+`modes.story_granularity`, `modes.review_mode`, `team.size`), which for that reason have **no** hardcoded default —
+see the `modes.rigor` section.
+**Secrets do NOT belong in either file — use environment variables.** See the
+"Local Override Pattern" section below for full design including the whitelist of
+which settings can be locally overridden.
+
+---
+
+## Local Override Pattern — `project.local.yaml`
+
+The `project.local.yaml` file lets each developer override specific settings for
+their own use without affecting the team. The file is gitignored and never
+committed.
+
+### How it works
+
+Priority chain (every setting): `project.local.yaml` → `project.yaml` → hardcoded default
+
+If a setting is present in `project.local.yaml`, that value wins. If absent, the
+value from `project.yaml` is used. If absent there too, the hardcoded default
+takes over.
+
+---
+
+### Deep merge semantics
+
+When both files set a nested value, only the explicitly-set key is overridden.
+Sibling keys in the same block are preserved.
+
+Example:
+
+`project.yaml`:
+```yaml
+testing:
+ strict:
+ logic: true
+ integration: true
+ visual: false
+```
+
+`project.local.yaml` (sparse override):
+```yaml
+testing:
+ strict:
+ logic: false
+```
+
+Effective config seen by skills: `logic: false, integration: true, visual: false`.
+Only the explicitly-set `logic` key is overridden; sibling keys come through from
+`project.yaml`.
+
+---
+
+### Whitelist — which settings can be locally overridden
+
+Only personal-experience settings can be locally overridden. Project-wide facts
+(engine, stage, naming conventions, what's required on disk) are locked to
+`project.yaml` because divergence between developers would break team coordination.
+
+The rule for deciding which side a setting belongs on:
+
+> **If a setting affects what artifacts exist or what they look like on disk,
+> it must be locked to `project.yaml`. If a setting only changes your personal
+> experience (which agents spawn for you, whether you get prompts, your local
+> CI bypass), it can be locally overridden.**
+
+**Locally overridable** (personal experience only — no effect on artifacts on disk):
+
+| Setting | Why local override makes sense |
+|---------|-------------------------------|
+| `modes.review_mode` | How much AI review you personally want |
+| `modes.automation` | How often the AI prompts you |
+| `modes.automation_always_ask` | Your personal safety categories |
+| `team.size` | Which agents spawn for your reviews (review depth differs, artifacts don't) |
+| `testing.strict.*` (each type) | Whether failures block your local work (CI still enforces project.yaml defaults) |
+| `performance.enforce` | Whether budget violations block your local work (CI enforces project defaults) |
+| `features.session_state` | Your session tracking preference |
+| `features.token_budget_warn_at` | Your personal cost threshold |
+
+**Locked to `project.yaml`** (project-wide — would create artifact divergence if local):
+
+| Setting | Why it must be project-wide |
+|---------|----------------------------|
+| `schema_version`, `framework.*` | File metadata, not preferences — **exempt from the report below**, since a `project.local.yaml` carrying `schema_version: 1` is correct as written |
+| `project.name`, `version`, `genre`, `kind`, `stage` | Project identity |
+| `engine.*`, `specialists.*` | Whole team must use same engine |
+| `naming.*` | Code conventions must be consistent across team |
+| `platform.*` | Game facts (what platforms it ships on) |
+| `performance.target_framerate`, `frame_budget_ms`, `draw_call_limit`, `memory_ceiling_mb` | Game budgets, shared targets |
+| `accessibility.target` | Game commitment, project-wide |
+| `cadence.*` | Sprint/milestone length affects team coordination |
+| `modes.rigor` | Fronts the four below — locked for the same reason they are |
+| `modes.workflow` and `workflow_overrides` | Affects which sections are required in authored docs |
+| `modes.story_granularity` | Affects how big stories are in repo — team must be consistent |
+| `docs.density` | Affects how deep authored docs are — team must produce consistent docs |
+| `qa.level` | Affects what test evidence stories must include on disk |
+| `qa.coverage_minimum` | Project quality bar |
+| `strict_gate_checks` | Affects whether `project.stage` advances — a project-wide write |
+| `commands.*` | Build/test commands are project facts |
+| `testing.framework` | Whole project uses one framework |
+
+> **A locked key written into `project.local.yaml` by hand is reported, not
+> swallowed.** `/settings --local` refuses to write one, but the
+> file is meant to be hand-edited and that path had no guard: `modes.rigor: full`
+> there is a real key with a legal value, so enum validation passes it, and then
+> resolution never consults the local file for that path — the setting vanishes
+> and the user sees the default they were trying to override, with no error
+> anywhere. Every check validated the **value**; nothing validated the
+> **location**. `validate_local_scope` in `yaml-helper.sh` now names such keys on
+> `resolve_config`'s `notes:` line. It **warns and never reconciles**: it does not
+> edit the file, does not begin honouring the key, and does not change
+> resolution — a locked setting decides which artifacts exist on disk, so
+> applying one quietly would produce exactly the divergence this table prevents.
+> A clean file stays silent — you are only told when a key is actually in the
+> wrong place.
+
+---
+
+### `/settings --local` flag behavior
+
+```
+/settings workflow=minimal → writes to project.yaml (team-wide)
+/settings --local automation=autonomous → writes to project.local.yaml (just you)
+```
+
+**Behavior rules:**
+
+- Default (no flag): writes to `project.yaml`
+- `--local` flag: writes to `project.local.yaml` (creates it if absent)
+- `--local` on a locked setting → error:
+ > *"`<setting>` cannot be locally overridden — it's a project-wide setting.
+ > Use `/settings <setting>=<value>` (no `--local`) to change it for the whole team."*
+- Writing to `project.yaml` when the same setting is currently locally overridden → warning:
+ > *"This setting is currently locally overridden in `project.local.yaml`.
+ > Writing to `project.yaml` will not affect your effective value."*
+
+---
+
+### Schema validation on read
+
+When skills or hooks read either file:
+
+| Issue | Behavior |
+|-------|----------|
+| Unknown key (typo or stale setting) | Session-start warning: *"`project.local.yaml` has unknown key `modes.automaton` — typo? Ignored."* Does NOT block (forwards-compat with future settings). |
+| Invalid value not in enum (e.g. `automation: chaotic`) | Hard error: skill exits with explanation of valid values. |
+| Type mismatch (e.g. integer field set to a string) | Hard error: skill exits with type expected. |
+
+---
+
+### Creation and error handling
+
+| Scenario | Behavior |
+|----------|----------|
+| `/start` on fresh project | Creates `project.yaml` only. Does NOT create `project.local.yaml`. |
+| `/settings --local <x>=<y>` when local.yaml doesn't exist | Creates `project.local.yaml` containing just that setting. |
+| `project.local.yaml` exists but `project.yaml` doesn't | Hard error: *"`project.yaml` missing — run `/start` to create one. Local overrides require a base."* |
+| Both files exist | Read `project.yaml` first, deep-merge `project.local.yaml` on top. Normal operation. |
+| Both files set the same key | `project.local.yaml` wins. No prompting. |
+
+---
+
+### Two-developer clash scenarios — and why the whitelist prevents them
+
+**File-level conflict (`project.yaml`):**
+Standard git merge conflict. Each developer's `project.local.yaml` is gitignored
+and never collides with another developer's. Normal git workflow handles team-wide
+changes.
+
+**Logical inconsistency (prevented by whitelist):**
+
+Example of what the whitelist prevents:
+
+> Sarah sets `modes.workflow: minimal` locally to skip GDD requirements. She
+> doesn't write GDDs because her local mode doesn't require them. Mike runs
+> `/gate-check` with the team default of `standard`; gate-check sees missing
+> GDDs and fails.
+
+This can't happen because `modes.workflow` is locked to `project.yaml`. Same
+for `qa.level`, `docs.density`, `strict_gate_checks`, `naming.*`, and every
+other setting that affects what artifacts exist on disk.
+
+Personal experience settings (`automation`, `review_mode`, `team.size`,
+`testing.strict.*`, `performance.enforce`) can diverge freely without affecting
+anyone else.
+
+---
+
+### Stricter reviewer reviewing a looser reviewer's work
+
+A common worry: "what if my teammate has stricter review settings than me?
+Will their `/gate-check` or `/design-review` flag things in my work?"
+
+The answer depends on which kind of difference you're talking about:
+
+**Different review depth, same project requirements (HEALTHY):**
+
+- Teammate A: local `review_mode: full`, `automation: collaborative`, `testing.strict.logic: true`
+- Teammate B: local `review_mode: solo`, `automation: autonomous`, `testing.strict.logic: false`
+- Both bound by the same project.yaml-locked settings (e.g. `workflow: standard`, `qa.level: standard`)
+
+B writes a GDD that meets `workflow: standard` (all 5 required sections present).
+B's `/design-review` runs with `review_mode: solo` — fast advisory check, no
+specialists spawned. B moves on.
+
+Later A reviews the same GDD with `review_mode: full` — spawns 5–15 specialists,
+finds polish opportunities and edge cases B's lighter review missed. A files
+findings as PR comments or follow-up issues. B addresses the ones that matter.
+
+**This is normal team collaboration.** Different reviewers catching different
+things is the value of having multiple reviewers. The artifacts on disk are the
+same; only review depth differs. Nothing about this scenario creates project-state
+divergence.
+
+**Different requirements (PREVENTED by the whitelist):**
+
+If `qa.level` were locally overridable:
+
+- B sets `qa.level: minimal` locally. B's stories don't include test evidence.
+- B's `/story-done` accepts the story without evidence. Story marked Complete on disk.
+- A pulls. A's `qa.level: standard` requires evidence. A's `/story-done` would have rejected it.
+- A's next `/gate-check` fails because evidence is missing across multiple of B's "Complete" stories.
+
+This is the artifact divergence problem. To prevent it, `qa.level` is locked to
+`project.yaml`. The team agrees together on what's required; individuals override
+only their personal experience, never the team's standards.
+
+**The pattern to remember:**
+
+| Difference type | Outcome |
+|----------------|---------|
+| Different review depth (review_mode, team.size) | Stricter reviewer surfaces more findings — healthy. Artifacts unchanged. |
+| Different local strictness on failures (testing.strict.*, performance.enforce) | Stricter dev's local /story-done blocks earlier — they fix it locally. CI uses project.yaml defaults so team-wide quality bar stays. |
+| Different artifact requirements (workflow, qa.level, docs.density, etc.) | **Can't happen — these are locked.** Team agrees once in project.yaml. |
+
+---
+
+### CI behavior
+
+CI environments have no `project.local.yaml` — the file is gitignored and never
+present in a fresh clone. CI therefore always runs against `project.yaml`
+defaults: strict project standards, no developer-specific overrides.
+
+This is intentional and important:
+
+| Setting | Local default for fast iteration | CI default (`project.yaml`) |
+|---------|----------------------------------|------------------------------|
+| `modes.review_mode` (locally overridable) | `solo` for one developer | `lean` (team default — phase gates always run) |
+| `testing.strict.logic` (locally overridable) | `false` for fast WIP commits | `true` (failing tests block CI) |
+| `modes.automation` (locally overridable) | `autonomous` for solo flow | `collaborative` (the team's collab protocol, but CI doesn't ask questions anyway — this is mostly a no-op on CI) |
+
+A developer can iterate locally with relaxed gates, but CI catches issues using
+the strict project defaults. The team's quality bar is enforced at the CI level
+regardless of any individual developer's local config.
+
+---
+
+### Secrets — never in either file
+
+`project.yaml` and `project.local.yaml` are for **preferences and configuration**,
+never for **secrets**. API keys, tokens, and credentials belong in:
+
+- **Environment variables** (preferred for production/CI)
+- **`.env` file** (gitignored, local dev)
+- **OS keychain** (when integrating with services that support it)
+
+When a skill needs an API key (e.g. `/asset-spec` calling Midjourney), it reads
+from the environment, not from `project.yaml`. `project.yaml` only stores **which**
+generator is used (`art.generator: midjourney`), not the API key for it.
+
+CI environments typically have no `project.local.yaml` (gitignored, not in the
+clone) — so CI always runs against `project.yaml` defaults. This is correct
+behavior: strict project defaults for CI, looser developer overrides for local work.
+
+---
+
+## modes.review_mode
+
+**Controls:** How many specialist and director agents are spawned during skill execution
+**Values:** `full` | `lean` | `solo`
+**Default:** *none* — supplied by `modes.rigor` (`standard` yields `lean`)
+**Set by:** `/start`, `/adopt`, `/settings`
+**Read by:** See skill table below
+
+**Priority chain (all skills):** inline argument flag → `modes.review_mode` in `project.yaml` → `production/review-mode.txt` (legacy fallback) → `modes.rigor` expansion (no terminal default; `minimal`→`solo`, `standard`→`lean`, `full`→`full`)
+
+> **design-review follows the standard chain.** `modes.review_mode` controls
+> design-review depth, its inline flag is `--review` for consistency with every
+> other review-mode-aware skill, and the default is `lean` to match them.
+
+> **Hotfix / day-one-patch exception:** These skills are emergency or release-critical
+> pipelines. They are never gated by `review_mode` — all agents always run.
+
+> **Known inertness — `full` and `lean` are identical in all nine `team-*`
+> orchestrators.** Each of them documents a three-way split:
+> `full` spawns every director and lead gate, `lean` skips director gates *unless*
+> they are PHASE-GATE type, `solo` skips gate spawning entirely. But every
+> `team-*` skill names exactly four gates — `CD-PHASE-GATE`, `TD-PHASE-GATE`,
+> `PR-PHASE-GATE`, `AD-PHASE-GATE` — and all four are the type `lean` keeps. So
+> `lean` has nothing to skip and behaves as `full`.
+>
+> `solo` genuinely differs, and outside the orchestrators (`/design-review`,
+> `/architecture-review`) all three levels differ as documented.
+>
+> **This is recorded, not fixed.** Making `lean` mean something in the
+> orchestrators requires deciding which non-phase-gate reviewers each of the nine
+> should call at `full` — a design decision about review depth, not a wording fix,
+> and one that changes how many agents a run spawns.
+
+---
+
+### Value intent
+
+| Value | Intent |
+|-------|--------|
+| `full` | All director and specialist gates active. Best for teams, learning, or anyone who wants thorough AI feedback on every decision. |
+| `lean` | Phase gates only — per-skill director sign-offs skipped. Default. Balances quality with token cost. |
+| `solo` | No gates, no director spawns at all. Fastest. For confident solo iteration. |
+
+---
+
+### Core skills (currently review-mode aware)
+
+| Skill | full | lean | solo |
+|-------|------|------|------|
+| **design-review** | 5–15 specialist agents spawned in Phase 3b | No specialist agents — single-session analysis only | Phases 1–4 only, no delegation, no next-steps prompt |
+| **gate-check** | Director panel runs in parallel — **width set by `modes.workflow`**, not by this axis | Director panel runs in parallel — same width rule; phase gates always run | Artifact existence checks only, no directors spawned |
+| **design-system** | All section specialists + CD-GDD-ALIGN sign-off gate | All section specialists, CD-GDD-ALIGN skipped | All section specialists, CD-GDD-ALIGN skipped |
+| **art-bible** | All section specialists + AD-ART-BIBLE sign-off gate | All section specialists, AD-ART-BIBLE skipped | All section specialists, AD-ART-BIBLE skipped |
+| **architecture-decision** | Engine specialist + TD-ADR gate | Both skipped | Both skipped |
+| **create-architecture** | TD self-review + LP-FEASIBILITY agent | Both skipped | Both skipped |
+| **brainstorm** | CD-PILLARS, AD-CONCEPT-VISUAL, TD-FEASIBILITY, PR-SCOPE | All skipped | All skipped |
+| **map-systems** | TD-SYSTEM-BOUNDARY, PR-SCOPE, CD-SYSTEMS | All skipped | All skipped |
+| **story-done** | QL-TEST-COVERAGE + LP-CODE-REVIEW | Both skipped | Both skipped |
+| **sprint-plan** | PR-SPRINT feasibility check | Skipped | Skipped |
+| **create-epics** | PR-EPIC scope check | Skipped | Skipped |
+| **create-stories** | QL-STORY-READY + test case specs | Skipped | Skipped |
+| **prototype** | CD-PLAYTEST director override | Skipped — prototyper verdict is final | Skipped — prototyper verdict is final |
+| **milestone-review** | PR-MILESTONE feasibility check | Skipped — no producer verdict | Skipped — no producer verdict |
+| **playtest-report** | CD-PLAYTEST creative assessment | Skipped | Skipped |
+| **story-readiness** | QL-STORY-READY acceptance criteria check | Skipped | Skipped |
+
+---
+
+### Skills to be made review-mode aware (currently ignore the setting)
+
+| Skill | full | lean | solo |
+|-------|------|------|------|
+| **review-all-gdds** | Phase 2 consistency pass + Phase 3 design theory pass (parallel) | Phase 2 consistency pass only, Phase 3 skipped | Phase 2 only, Phase 3 skipped |
+| **architecture-review** | Engine specialist + security-engineer (if online features) | Both skipped | Both skipped |
+| **dev-story** | Core programmer routing always runs + engine-specialist escalation on HIGH risk stories | Core programmer routing always runs, engine-specialist escalation skipped | Core programmer routing always runs, engine-specialist escalation skipped |
+| **code-review** | Language, shader, UI specialists + qa-tester | All optional specialists skipped | All optional specialists skipped |
+| **security-audit** | security-engineer spawned | Skipped | Skipped |
+| **create-control-manifest** | technical-director validation step | Skipped | Skipped |
+| **propagate-design-change** | technical-director validation step | Skipped | Skipped |
+
+---
+
+### Team orchestration skills (pipeline behavior — different relationship)
+
+Team skills are execution pipelines, not review gates. `review_mode` controls
+whether *optional* specialists within the pipeline are included — not whether
+the pipeline runs.
+
+| Skill | full | lean | solo |
+|-------|------|------|------|
+| **team-combat** | Full pipeline including technical-artist, sound-designer, qa-tester | Core pipeline only (game-designer, gameplay-programmer, ai-programmer) — optional specialists skipped | Core pipeline only |
+| **team-ui** | Full pipeline including accessibility-specialist, art-director review pass | Core pipeline (ux-designer, ui-programmer, engine UI specialist) — optional reviewers skipped | Core pipeline only |
+| **team-audio** | Full pipeline including accessibility-specialist, engine-specialist | Core pipeline (audio-director, sound-designer, technical-artist) — optional specialists skipped | Core pipeline only |
+| **team-qa** | Full QA cycle including per-story qa-tester spawns + qa-lead sign-off | Core qa-lead plan only, per-story tester spawns skipped | Core qa-lead plan only |
+| **team-release** | Full pipeline including security-engineer, analytics-engineer, localization-lead | Core pipeline (producer, release-manager, devops-engineer, qa-lead) — optional reviewers skipped | Core pipeline only |
+| **team-narrative** | Full pipeline including world-builder, writer, localization-lead | Core pipeline (narrative-director, art-director) — optional contributors skipped | Core pipeline only |
+| **team-polish** | Full pipeline including engine-programmer, sound-designer, qa-tester | Core pipeline (performance-analyst, technical-artist) — optional specialists skipped | Core pipeline only |
+| **team-level** | Full pipeline including narrative-director, world-builder, accessibility-specialist, qa-tester | Core pipeline (level-designer, systems-designer, art-director) — optional reviewers skipped | Core pipeline only |
+| **team-live-ops** | Full pipeline including analytics-engineer, community-manager | Core pipeline (live-ops-designer, narrative-director, economy-designer) — optional contributors skipped | Core pipeline only |
+
+---
+
+### Special cases and notes
+
+- **gate-check** is the only skill where `full` and `lean` behave identically —
+ phase gates always run. Only `solo` skips them. This is intentional: phase
+ gates are the minimum quality bar, not optional extras. **How many directors
+ run is a separate axis** — `modes.workflow` sets panel width (`minimal` → PR
+ only, `standard` → TD + PR, `full` → all four), because a fixed four-director
+ Opus panel cost a two-system jam exactly what it cost a thirty-system
+ commercial project. Width never softens a verdict: the strictest verdict from
+ whoever ran still wins, and `/gate-check` names the perspectives it skipped.
+- **design-system** and **art-bible** always spawn section specialists regardless
+ of mode — only the final sign-off gate is controlled by `review_mode`. Specialist
+ delegation is mandatory for the authoring output to be useful, and that has not
+ changed. What sets `art-bible`'s **spawn count** is therefore not `review_mode`
+ but (a) `modes.workflow`, via how many sections get authored at all — `standard`
+ requires sections 1–4, not all 9, and Phase 1 recommends the tier's set — and
+ (b) batching consecutive sections that call the *same* agent with the *same*
+ input into one delegation (2–4, and 5–6). Unbatched, sections 5 and 6 spawn
+ `art-director` twice with the identical `sections 1–4` brief. Every section is
+ still specialist-authored; per-section approval and write-to-file are unchanged.
+- **dev-story** core programmer routing (gameplay-programmer, ui-programmer, etc.)
+ always runs regardless of mode — only the optional engine-specialist escalation
+ for HIGH risk stories is gated.
+- **hotfix** and **day-one-patch** are exempt — all agents always run.
+- When a gate is skipped, skills emit: `"[GATE-ID] skipped — [mode] mode."` before
+ proceeding. This is consistent across all skills.
+
+---
+
+## modes.rigor
+
+**Controls:** How much process the project carries overall — the single question
+`/start` asks that sets the six knobs below
+**Values:** `minimal` | `standard` | `full`
+**Default:** `minimal` — see the rationale block above `_yaml_helper_defaults`
+in `.claude/hooks/yaml-helper.sh`. Short version: the heavier tier cost several
+times more to reach working code without producing a better result.
+**Set by:** `/start` (Phase 3d), `/settings`
+**Read by:** nothing directly — it is read *through* the six knobs it supplies
+
+**Priority chain:** `modes.rigor` in `project.yaml` → hardcoded default `minimal`
+(**locked** — not overridable from `project.local.yaml`, like the four *on-disk*
+knobs it fronts — `modes.workflow`, `docs.density`, `qa.level`,
+`modes.story_granularity` — because those five change what artifacts exist on
+disk. The two personal-experience knobs it also fronts, `modes.review_mode` and
+`team.size`, stay locally overridable.)
+
+---
+
+### Expansion table
+
+| `modes.rigor` | `modes.workflow` | `docs.density` | `qa.level` | `modes.story_granularity` | `modes.review_mode` | `team.size` |
+|---|---|---|---|---|---|---|
+| `minimal` | `minimal` | `terse` | `minimal` | `coarse` | `solo` | `individual` |
+| `standard` *(default)* | `standard` | `balanced` | `standard` | `balanced` | `lean` | `individual` |
+| `full` | `full` | `thorough` | `full` | `fine` | `full` | `studio` |
+
+### It fronts, it does not replace
+
+The expansion sits **below every explicit source and above the terminal
+default**:
+
+```
+project.local.yaml → project.yaml → legacy file → rigor expansion → default
+```
+
+That ordering is the back-compat guarantee, and it is what makes the migration
+free. Three consequences worth stating plainly:
+
+- **An existing `project.yaml` behaves identically.** If it already sets
+ `docs.density: terse`, step 2 answers before the expansion is consulted — so
+ the value and its reported source (`project.yaml`) are unchanged whether or not
+ `rigor` is present. No migration, no `schema_version` bump.
+- **Overrides go both ways.** Unlike the `workflow_overrides` **boolean flags** —
+ which are additive and stricter-only — an explicit knob may be *looser* than
+ the rigor level implies.
+ (`workflow_overrides.system_overrides` is also two-directional — it replaces a tier; only the flags are stricter-only.)
+ Inheriting the stricter-only rule would make "comprehensive but compact"
+ inexpressible, which is the one off-diagonal the docs have always cited.
+- **`modes.workflow` keeps `workflow_overrides.system_overrides`.** Per-system
+ tiers still beat the rigor-derived project tier. `workflow` was fronted rather
+ than folded away precisely because it drives ~5 distinct behaviors and owns the
+ only per-system override mechanism.
+
+The six fronted knobs therefore have **no entry in `_yaml_helper_defaults`**. A
+terminal default there would answer before the expansion and make `rigor` a no-op
+for anyone who had not also set the sub-knob.
+
+### Provenance
+
+Derived values report their source as `rigor:<level>`, so the vocabulary is
+`{project.local.yaml, project.yaml, <legacy path>, rigor:<level>, default,
+unset}`. `/settings` renders this as `(derived from rigor: standard)` and
+force-appends the five to its view-all list — none of them is a leaf of either
+YAML file, so enumerating file leaves alone would hide exactly the settings the
+user just chose.
+
+---
+
+## modes.workflow
+
+**Controls:** How much design documentation is required before code can begin —
+the tradeoff between token/time cost of documentation and speed of reaching
+working code
+**Values:** `full` | `standard` | `minimal`
+**Default:** *none* — supplied by `modes.rigor` (`standard` yields `standard`)
+**Set by:** `/start`, `/settings`
+**Read by:** See skill tables below
+
+**Priority chain:** `modes.workflow` in `project.yaml` → `modes.rigor` expansion → *(no hardcoded default)*
+
+> **Why the middle level is `standard`, not `indie`.** A developer-type label
+> would conflate "type of developer" with "level of process". `standard`
+> describes the *amount of process*, not the user, and pairs cleanly with
+> `minimal` and `full`.
+
+> **Permissive, not restrictive:** `workflow` controls what is REQUIRED —
+> not what is ALLOWED. Any skill can be run at any workflow level. The
+> setting changes what gate-check enforces and what completeness checks
+> validate, not what the user can invoke.
+
+> **`minimal` floor:** Even in minimal mode, engine choice and a filled
+> **`design/game-brief.md`** are required before code starts — the brief's
+> build-order field is the plan, so there is no separate `sprint-plan` step.
+> Both take minutes and prevent real problems downstream. Everything else can
+> be skipped.
+
+> **Escape hatches via `workflow_overrides`:** Users who want *almost* the
+> standard set with one extra requirement (e.g. always force Edge Cases) use
+> `workflow_overrides` rather than escalating to `full`. See next section.
+
+---
+
+### Value intent
+
+| Value | Token/time cost | Required before code | Best for |
+|-------|----------------|---------------------|----------|
+| `full` | High | All 8 GDD sections per system, full architecture, all ADRs, art bible, UX specs per screen | Projects where design correctness matters more than speed — teams, commercial titles, learning the full pipeline |
+| `standard` | Balanced | 5 GDD sections per system, one architecture doc, critical ADRs, game concept, systems index | Projects that have outgrown a brief — several interacting systems, or a design someone else has to implement |
+| `minimal` | Low | One-page `design/game-brief.md` + engine choice (build order in the brief = the plan; no separate sprint plan) | **Default.** Get to code fast — small scope, jam projects, or the design already in your head. Raise it when the project grows |
+
+**standard required GDD sections:** Overview, Detailed Rules, Edge Cases, Dependencies,
+Acceptance Criteria.
+**standard conditional:** Formulas — required when the system **defines numeric
+rules**: rates, curves, thresholds, costs, damage, drop weights, or any value a
+balance pass would tune. Optional only when the system defines no such value.
+
+> **The test is what the system defines, not what it is called.** The `Category`
+> column in `systems-index.md` is a *hint* — `Gameplay`, `Economy` and
+> `Progression` systems almost always qualify — but it is not the test, and a
+> `Core`, `UI` or `Persistence` system that defines a numeric rule qualifies too.
+>
+> Do not restate it as "required when system category is combat, economy,
+> progression, or AI". Those four tokens are not the vocabulary `/map-systems`
+> writes: `templates/systems-index.md` defines the categories as `Core ·
+> Gameplay · Progression · Economy · Persistence · UI · Audio · Narrative ·
+> Meta`, and lists **combat and AI as example systems under `Gameplay`**. A
+> combat system categorised exactly as the template instructs therefore matched
+> none of the four, and Formulas was silently dropped for the system most likely
+> to need it. `coding-standards.md` and `rules/design-docs.md` already stated the
+> "has math" test; the skills are reconciled to them rather than the other way
+> round.
+
+> **Edge Cases is required at `standard`.** Skipping it consistently produces
+> "wait, what happens if X is null?" debt during implementation. These 5
+> required sections are the minimum that produces implementable code.
+
+> **Art bible is conditional in `standard`.** It is required only if visual
+> asset stories exist in the project. Code-focused projects can skip it
+> entirely at `standard` level.
+
+---
+
+### Authoring skills
+
+| Skill | full | standard | minimal |
+|-------|------|----------|---------|
+| **design-system** | All 8 sections required | 5 required sections + conditional Formulas; Player Fantasy, Tuning Knobs skipped | Not required — game brief replaces GDDs. Can still be run voluntarily. |
+| **art-bible** | All 9 sections required | Required only if visual asset stories exist; sections 1–4 minimum when required | Not required. Can still be run voluntarily. |
+| **create-architecture** | Full architecture — all layers, module ownership, data flow, API boundaries, full ADR audit | Simplified — system layer map + critical ADR list only | Not required. Can still be run voluntarily. |
+| **ux-design** | UX spec required per screen | Core screens only (main menu, HUD, primary game loop) | Not required. Can still be run voluntarily. |
+| **map-systems** | Required before design-system | Required before design-system | Not required |
+| **architecture-decision** | All ADRs on required ADR list must be completed | Critical ADRs only — Foundation layer systems | Not required |
+
+---
+
+### Review and validation skills
+
+| Skill | full | standard | minimal |
+|-------|------|----------|---------|
+| **design-review** | All 8 sections validated — any missing section blocks approval | 5 required sections validated; missing optional sections warned but do not block | Not applicable — no GDDs to review |
+| **review-all-gdds** | Validates all 8 sections across all GDDs | Validates 5 required sections across all GDDs; optional sections surfaced as advisory only | Not applicable |
+| **architecture-review** | Full traceability matrix — all GDDs, all ADRs | Reduced scope — architecture doc + critical ADRs only | Not applicable |
+| **consistency-check** | Full entity registry cross-check against all GDD sections | Entity registry check against required sections only | Not meaningful — no GDDs to check |
+| **content-audit** | Full content count audit against all GDD specs | Limited audit — only specs in required sections counted | Cannot run — no systems index exists |
+
+---
+
+### Phase gate enforcement (gate-check)
+
+`gate-check` is where workflow has the most visible impact — the artifact
+checklists differ per phase per mode.
+
+| Gate | full | standard | minimal |
+|------|------|----------|---------|
+| Concept → Systems Design | game-concept.md, pillars, Visual Identity Anchor | game-concept.md only | `design/game-brief.md` only (content check, not section check) |
+| Systems Design → Technical Setup | systems-index, all MVP GDDs reviewed (8 sections), cross-GDD review | systems-index, 5-section GDDs reviewed, cross-GDD review optional | Not applicable — no gates between brief and code |
+| Technical Setup → Pre-Production | engine, art bible sections 1–4+, 3+ ADRs, architecture, UX specs started | engine, art bible only if visual assets, critical ADRs, architecture | engine configured (required floor) |
+| Pre-Production → Production | prototype, sprint plan, complete art bible, epics, 3+ playtests | prototype, sprint plan, epics, 1+ playtest | prototype (advisory); the brief's Build order is the plan — no separate sprint-plan floor |
+<!-- gate-check reconciliation: the Vertical Slice / prototype keeps
+ its long-standing "recommended, not blocking → CONCERNS if absent; FAIL if
+ built-and-broken" status at ALL tiers — the tier table never upgrades it to
+ a hard blocker. The genuinely-required floor item at this gate is the
+ sprint plan at `standard`/`full`; at `minimal` (Option A) there is
+ no separate sprint-plan step — the brief's Build order is the plan, so the
+ brief existing satisfies the floor. "prototype" above means "checked,
+ advisory," not "blocks." -->
+
+| Production → Polish | core mechanics, tests, smoke check, QA sign-off | core mechanics, smoke check | smoke check |
+| Polish → Release | all features, content complete, QA, smoke, no critical bugs | all features, smoke, no critical bugs | smoke, no critical bugs |
+
+**Director panel width** (`/gate-check` Section 4b) is workflow's second effect
+here. Directors are Opus-tier, so a fixed four-director panel charged a
+two-system jam exactly what it charged a thirty-system commercial project:
+
+| `workflow` | Panel | Directors |
+|---|---|---|
+| `full` | 4 | `creative-director`, `technical-director`, `producer`, `art-director` |
+| `standard` | 2 | `technical-director`, `producer` |
+| `minimal` | 1 | `producer` |
+
+`review_mode` remains the axis that decides *whether* the panel runs at all
+(`solo` skips it entirely); workflow decides only how wide it is. Narrowing
+never softens a verdict — the strictest verdict from whoever ran still wins, and
+`/gate-check` names the perspectives that did not run.
+
+---
+
+### Planning and implementation skills
+
+| Skill | full | standard | minimal |
+|-------|------|----------|---------|
+| **create-epics** | Requires all GDDs approved (8 sections) | Requires 5-section GDDs approved | **Skipped** (Option A) — no separate epic doc. `/create-stories` reads `design/game-brief.md` directly and synthesizes the implicit epic container itself. |
+| **create-stories** | Requires all ADRs on required list present | Requires critical ADRs present | No ADR requirement |
+| **dev-story** | Requires TR registry + governing ADR + control manifest — blocks without them | TR registry optional; critical ADR required where present | No TR registry, no ADR required — implements against `design/game-brief.md` |
+| **story-readiness** | Full TR registry + ADR + control manifest validation | TR registry optional; critical ADR check only | Acceptance criteria check only |
+| **story-done** | Full GDD traceability + ADR consistency check | 5-section GDD traceability check | Acceptance criteria check only |
+| **qa-plan** | Full test plan derived from all 8 GDD sections | Test plan from 5 required sections | Test plan from acceptance criteria only |
+| **regression-suite** | Critical paths mapped from all sections including Edge Cases | Critical paths from required sections (including Edge Cases) | Smoke test coverage only |
+
+---
+
+### Support skills
+
+| Skill | full | standard | minimal |
+|-------|------|----------|---------|
+| **project-stage-detect** | Checks for all doc types; missing art bible or UX specs flagged as gaps | Adjusts expectations — art bible only flagged if visual-asset stories exist; non-core UX specs not flagged | `design/game-brief.md` + engine present = normal state; no gaps flagged for absent GDDs |
+| **adopt** | Full format compliance audit across all doc types | Audit scope reduced to required docs only | `design/game-brief.md` format check only |
+| **reverse-document** | Generates full 8-section GDD from code | Generates 5-section GDD from code | Generates `design/game-brief.md` from code |
+| **propagate-design-change** | Full cascading impact analysis across all ADRs | Checks critical ADRs for references only | Not applicable |
+| **help** | Full artifact detection — surfaces all missing docs as next steps | Adjusts "what's missing" to required docs only — optional docs not surfaced as gaps | `design/game-brief.md` + engine present = next step is code |
+
+---
+
+### Workflow change mid-project
+
+When `workflow` changes via `/settings`, the skill emits an informational note:
+
+> "Workflow changed from [old] to [new]. Run `/content-audit` to see what's now
+> required or extra. No automatic migration — existing files stay in place."
+
+No documents are auto-deleted, auto-generated, or blocked. The setting only affects
+*new* enforcement going forward.
+
+---
+
+## workflow_overrides
+
+**Controls:** Opt-in granular requirements that override the chosen workflow level
+**Location:** **top level of `project.yaml`** — a sibling of `modes:`, *not* a child of it
+**Values:** object with sub-flags (see below)
+**Default:** all false / empty
+**Set by:** `/settings`
+**Read by:** `/design-system`, `/design-review`, `/art-bible`, `/gate-check`, `/review-all-gdds`, `/qa-plan`
+
+> **Why the location is called out.** `resolve_config` reads
+> `workflow_overrides.system_overrides.*` from the document root
+> (`yaml-helper.sh`), and all 14 consuming skill files grep the same top-level
+> path. Nested under `modes:` it is still valid YAML, so nothing errors — the
+> setting is simply never read. If you copied a `workflow_overrides` block from
+> anywhere, check its indentation: it belongs at the document root, never under
+> `modes:`.
+
+**Priority chain:** the three `workflow_overrides` **boolean flags**
+(`edge_cases`, `tuning_knobs`, `art_bible_strict`) are *additive* on top of the
+chosen `workflow` level — they make things stricter, never looser. None of them
+has a value that opts out of a requirement the workflow level imposes.
+
+> **`workflow_overrides.system_overrides` is not a flag and is not additive — it replaces a tier in both directions.**
+> This rule does not extend to it. On a
+> `full` project, `system_overrides.inventory: minimal` really does drop that
+> system's required sections to zero. Intended — see
+> `.claude/docs/workflow-modes.md § workflow_overrides`. Stating the additive
+> rule over the whole key is wrong: the guarantee never held for
+> `system_overrides`, so do not rely on it as a safety net.
+
+---
+
+### Fields
+
+```yaml
+workflow_overrides:
+ edge_cases: false # force Edge Cases section required (no-op at standard since already required; relevant at minimal)
+ tuning_knobs: false # force Tuning Knobs section required (relevant at standard, no-op at full)
+ art_bible_strict: false # force all 9 art bible sections required regardless of asset stories
+ system_overrides: {} # per-system tier overrides — see below
+```
+
+### Per-system overrides
+
+```yaml
+workflow_overrides:
+ system_overrides:
+ combat: full # combat-system GDD requires full (8 sections) regardless of project workflow
+ boss-encounters: full
+ inventory: minimal # inventory needs no GDD — the game brief covers it (minimal = no required sections)
+```
+
+`system_overrides` is a map of `system_name: workflow_level`. The named system uses the override; all other systems use the project-level `workflow`.
+
+---
+
+### Affected skills
+
+| Skill | How workflow_overrides changes behavior |
+|-------|----------------------------------------|
+| **design-system** | Reads `system_overrides[system_name]` first; falls back to project `workflow`. Applies override-specific section requirements. |
+| **design-review** | Same lookup — validates against the override tier, not the project default, for the named system. |
+| **art-bible** | If `art_bible_strict: true`, requires all 9 sections regardless of `workflow` level. |
+| **gate-check** | Considers `system_overrides` when validating that all required GDDs are complete. A system at `system_overrides.combat: full` blocks the gate until all 8 sections exist for combat. |
+| **review-all-gdds** | Validates each GDD against its effective tier (project workflow + any system override). |
+
+---
+
+## modes.automation
+
+**Controls:** Whether skills ask for decisions and approval before acting, or
+recommend and proceed — the tradeoff between user control and speed
+**Values:** `collaborative` | `guided` | `autonomous`
+**Default:** `collaborative`
+**Set by:** `/start`, `/settings`
+**Read by:** All ~40 skills that use `AskUserQuestion` or write files
+
+**Priority chain:** `modes.automation` in `project.yaml` → hardcoded default
+
+> **Unlike review_mode and workflow, this setting is not a per-skill table.**
+> It defines universal interaction rules that apply across all skills. A
+> per-skill breakdown would repeat the same answer 40 times.
+
+> **Overrides COLLABORATIVE-DESIGN-PRINCIPLE.md:** `guided` and `autonomous`
+> modes intentionally relax the Q→O→D→Draft→Approval protocol defined in that
+> document. This is opt-in. `collaborative` preserves the protocol exactly.
+
+> **Safety net — `automation_always_ask`:** Even in `autonomous` mode, certain
+> categories of decision can be configured to always prompt. See next section.
+
+---
+
+### Value intent
+
+| Value | Speed | Control | What changes |
+|-------|-------|---------|--------------|
+| `collaborative` | Slowest | Full — every decision is the user's | Current behavior. Q→O→D→Draft→Approval strictly followed. |
+| `guided` | Balanced | High — major decisions are the user's, minor ones proceed automatically | AI states recommendation and proceeds for minor decisions. AskUserQuestion reserved for major/irreversible decisions. |
+| `autonomous` | Fastest | Low — AI decides, logs, and proceeds | No AskUserQuestion (except categories in `automation_always_ask`). No draft review. No write approval. All decisions logged to decision log. |
+
+---
+
+### Universal rules per mode
+
+#### collaborative (current behavior — no change)
+
+- `AskUserQuestion` called for every multi-option decision
+- 2–4 options presented with pros/cons for every design choice
+- Full draft shown and approved before every file write
+- "May I write this to [filepath]?" asked before every write
+- "May I create [filepath] with skeleton?" asked before skeleton creation
+- Section-by-section approval in multi-section authoring skills
+- Multi-file changes require explicit approval of the full changeset
+
+#### guided
+
+- `AskUserQuestion` called for **major decisions only** (see classification below)
+- Minor decisions: AI states recommendation inline and proceeds — e.g.
+ *"Going with a static utility pattern here — it fits the existing architecture.
+ Continuing unless you want to change direction."*
+- Draft shown briefly before writing — proceeds after a short summary, does not
+ wait for explicit "yes"
+- "May I write?" asked for **new files only** — updates to existing files proceed
+ directly
+- Still presents options for major decisions but caps at 2 choices with a clear
+ recommendation
+- Multi-section authoring: writes each approved section immediately, no per-section
+ confirmation prompt
+
+#### autonomous
+
+- No `AskUserQuestion` calls **except** for categories listed in `automation_always_ask`
+- No draft review
+- No "May I write?" prompts — writes directly
+- Picks the recommended option for every decision without presenting alternatives
+- All decisions logged immediately to `production/session-logs/decision-log.md`
+ with: timestamp, skill, decision point, option chosen, reasoning
+- User reviews decision log post-session to audit choices made
+
+---
+
+### Major vs minor decision classification (guided mode)
+
+**Major — always use AskUserQuestion in guided mode:**
+
+| Decision type | Example |
+|---------------|---------|
+| Choosing a system name or document path | "What should we call this system?" |
+| Mutually exclusive design directions | "Real-time or turn-based?" |
+| Any choice that gates downstream work | Engine choice, architecture approach |
+| Scope changes | "Cut this feature or slip the deadline?" |
+| Any decision that can't be changed without significant rework | Core loop mechanic |
+
+**Minor — AI recommends and proceeds in guided mode:**
+
+| Decision type | Example |
+|---------------|---------|
+| Which section to work on next | "Moving to Edge Cases next" |
+| Optional section inclusion | "Adding a Visual Notes section — fits the system" |
+| Formatting and structure choices | Heading levels, table vs prose |
+| Adding detail to an already-decided direction | Sub-options within an approved approach |
+| Next-step routing after a phase completes | "Running design-review now" |
+
+---
+
+### Affected skills by category
+
+**Authoring skills — highest impact.** Each pauses 10–15 times per document in
+`collaborative`. Drops to 2–3 in `guided`, zero in `autonomous`.
+
+`brainstorm`, `design-system`, `art-bible`, `create-architecture`, `ux-design`,
+`map-systems`, `architecture-decision`, `create-epics`, `create-stories`,
+`sprint-plan`, `prototype`
+
+**Review skills — medium impact.** Pause after presenting findings to ask what
+to do next. In `guided` routing decisions proceed automatically. In `autonomous`
+the recommended path is taken and logged.
+
+`design-review`, `architecture-review`, `gate-check`, `review-all-gdds`,
+`story-readiness`, `story-done`, `milestone-review`, `playtest-report`
+
+**Team orchestration skills — medium impact.** Pause between phases for
+check-in. In `guided` the pipeline advances automatically unless BLOCKED. In
+`autonomous` the full pipeline runs end to end.
+
+`team-combat`, `team-ui`, `team-audio`, `team-qa`, `team-release`,
+`team-narrative`, `team-polish`, `team-level`, `team-live-ops`
+
+**Implementation skills — lower impact.** Pause for architectural questions
+before writing code. In `guided` only genuinely ambiguous decisions stop. In
+`autonomous` the conventional approach is picked and logged.
+
+`dev-story`, `code-review`
+
+**Setup and utility skills — lowest impact.** Pause for initial configuration
+or routing questions. In `guided` defaults are applied automatically. In
+`autonomous` recommended defaults are taken without prompting.
+
+`start`, `adopt`, `setup-engine`, `retrospective`, `localize`, `propagate-design-change`,
+`asset-spec`, `smoke-check`, `qa-plan`, `story-readiness`
+
+---
+
+### Exemptions — skills that ignore the automation setting
+
+These skills always behave as `collaborative` regardless of the setting.
+The reasons are noted.
+
+| Skill | Why always collaborative |
+|-------|--------------------------|
+| **hotfix** | Emergency decisions — user must approve scope and risk before any action |
+| **gate-check** | Results must be reviewed — a gate verdict without user acknowledgement defeats the purpose |
+| **day-one-patch** | Release-critical — every action needs explicit sign-off |
+| **setup-engine** | One-time irreversible choice that affects the entire project |
+
+---
+
+### Decision log format (autonomous mode)
+
+Written to `production/session-logs/decision-log.md` — append-only.
+
+```markdown
+## [timestamp] — [skill-name]
+
+**Decision point:** [what was being decided]
+**Options considered:** [list of options that would have been presented]
+**Chosen:** [what was picked]
+**Reason:** [one-line rationale]
+**Category:** [scope_changes | file_deletions | schema_changes | etc., or "minor"]
+```
+
+If the file does not exist, it is created. It is never truncated — each session
+appends to the existing log.
+
+---
+
+## modes.automation_always_ask
+
+**Controls:** Decision categories that ALWAYS trigger AskUserQuestion regardless of automation mode
+**Values:** list of category names
+**Default:** `[scope_changes, file_deletions, schema_changes]`
+**Set by:** `/start`, `/settings`
+**Read by:** All skills that respect `modes.automation`
+
+> **Makes `autonomous` safe.** Without this, `autonomous` is "AI does literally
+> everything, no questions asked." With it, AI does most things but stops on
+> destructive or irreversible decisions you specifically named.
+
+---
+
+### Recognized categories
+
+| Category | Examples of decisions in this category |
+|----------|----------------------------------------|
+| `scope_changes` | Cutting a feature, slipping a deadline, splitting/merging an epic, removing acceptance criteria |
+| `file_deletions` | Removing a story, deleting a GDD, removing a system, removing a test file |
+| `schema_changes` | Changes to project.yaml, story template, control manifest, ADR template, GDD template |
+| `architecture_decisions` | New ADR creation, ADR replacement, system boundary changes |
+| `version_bumps` | Engine version change, framework version bump, dependency major version change |
+| `external_calls` | Invoking external APIs (asset gen, AI services) when in autonomous mode |
+
+The list is a YAML list of these strings. Skills check whether the current decision falls into one of the configured categories and prompt regardless of `automation` value.
+
+---
+
+### Affected skills
+
+| Skill | Categories typically triggered |
+|-------|--------------------------------|
+| **scope-check** | `scope_changes` |
+| **propagate-design-change** | `schema_changes`, `architecture_decisions` |
+| **architecture-decision** | `architecture_decisions` |
+| **setup-engine** | `version_bumps`, `schema_changes` |
+| **story-done** | `file_deletions` (when removing/replacing test files) |
+| **asset-spec** | `external_calls` (when calling external generators) |
+
+---
+
+## modes.story_granularity
+
+**Controls:** How big each story is and how many stories per epic/sprint
+**Values:** `coarse` | `balanced` | `fine`
+**Default:** *none* — supplied by `modes.rigor` (`standard` yields `balanced`)
+**Set by:** `/start`, `/settings`
+**Read by:** `/create-epics`, `/create-stories`, `/dev-story`, `/sprint-plan`, `/story-done`, `/sprint-status`
+
+**Priority chain:** `modes.story_granularity` in `project.yaml` → `modes.rigor` expansion → *(no hardcoded default)*
+
+---
+
+### Value intent
+
+| Value | Story shape | Stories per sprint | Best for |
+|-------|-------------|-------------------|----------|
+| `coarse` | 1 story = 1 feature. 3–5 days work each. 5–10 ACs per story. | 2–4 | Solo devs, prototyping, "I know what I'm building" |
+| `balanced` | 1 story = 1 task. 1–2 days work each. 2–4 ACs per story. Current default behavior. | 6–10 | Most projects |
+| `fine` | 1 story = 1 AC. Hours of work each. Easy code review. Frequent /story-done. | 15–25 | Teams, learning, anything needing fine handoffs |
+
+---
+
+### Affected skills
+
+| Skill | coarse | balanced | fine |
+|-------|--------|----------|------|
+| **create-epics** | Generates 3–5 child stories per epic | Generates 5–10 child stories per epic | Generates 10–20 child stories per epic |
+| **create-stories** | Each story carries 5–10 ACs covering an entire feature | Each story carries 2–4 ACs covering one task | Each story carries 1 AC; story name = AC restatement |
+| **dev-story** | Routing prompt expects multi-day implementation cycle. Subagent given longer working context. | Standard 1–2 day expectation. | Each story implementable in hours; subagent given tighter context. |
+| **sprint-plan** | Allocates 2–4 stories per sprint based on velocity. | Allocates 6–10 stories per sprint. | Allocates 15–25 stories per sprint. |
+| **story-done** | Fires every 3–5 days on average. | Fires every 1–2 days on average. | Fires multiple times per day. |
+| **sprint-status** | Burn-down reads in feature-sized chunks. | Burn-down reads in task-sized chunks. | Burn-down reads in AC-sized chunks. |
+
+---
+
+## docs.density
+
+**Controls:** How deep each section in authored docs goes — independent of which sections are required
+**Values:** `terse` | `balanced` | `thorough`
+**Default:** *none* — supplied by `modes.rigor` (`standard` yields `balanced`)
+**Set by:** `/start`, `/settings`
+**Read by:** `/design-system`, `/art-bible`, `/create-architecture`, `/ux-design`, `/map-systems`, `/brainstorm`
+
+**Priority chain:** `docs.density` in `project.yaml` → `modes.rigor` expansion → *(no hardcoded default)*
+
+> **Distinct from `workflow`, but no longer independent by default.** `workflow`
+> controls which sections exist; `density` controls how deep each section goes.
+> `modes.rigor` now sets both together, so the diagonal (`rigor: full` → 8
+> sections *and* thorough prose) is what you get without asking. The off-diagonal
+> is still reachable and is the reason `rigor` overrides both ways: `rigor: full`
+> + an explicit `docs.density: terse` gives "all sections but each is compact" —
+> the "comprehensive but tight" mode, which neither knob expresses alone.
+
+---
+
+### Value intent
+
+| Value | Per-section output style |
+|-------|--------------------------|
+| `terse` | Bullet points. 2–5 lines per section. Skip rationale and narrative framing. Skip preambles like "In this game..." Just facts needed to implement. |
+| `balanced` | Paragraphs with light rationale. Examples where helpful. Current default behavior. |
+| `thorough` | Full prose. Rationale for every decision. Examples, alternatives considered, design history. |
+
+---
+
+### Combination matrix with workflow
+
+| | docs.density: terse | balanced | thorough |
+|---|---|---|---|
+| **workflow: minimal** | Game brief in bullets | Game brief in prose | Game brief + rationale |
+| **workflow: standard** | 5 sections, bullets | 5 sections, paragraphs *(default)* | 5 sections + examples |
+| **workflow: full** | 8 sections, bullets *(comprehensive but compact)* | 8 sections, paragraphs *(current full)* | 8 sections + rationale + examples |
+
+---
+
+### Affected skills
+
+| Skill | terse | balanced | thorough |
+|-------|-------|----------|----------|
+| **design-system** | Each GDD section is 2–5 bullets. Skip Player Fantasy preambles. | Paragraphs with key decisions explained. | Full prose, decision history, alternatives considered. |
+| **art-bible** | Each art bible section is a bulleted list of constraints + references. | Paragraphs explaining each visual choice. | Full prose including style explorations, references, rationale per choice. |
+| **create-architecture** | Layer diagrams + decision bullets. No essays. | Diagrams + paragraph explanations of layer choices. | Full prose with rationale, trade-offs, alternatives considered per layer. |
+| **ux-design** | Wireframe descriptions + interaction bullets. | Wireframes + paragraph descriptions of flows. | Full prose including user research summaries, alternative flow considerations. |
+| **map-systems** | One-line system descriptions. | Brief paragraph per system + dependency notes. | Full system-by-system rationale + relationship analysis. |
+| **brainstorm** | Pillar bullets + concept bullets. | Pillars + concept with brief rationale. | Pillars + concept + extensive rationale + alternatives. |
+
+---
+
+## testing.framework
+
+**Controls:** Which test framework the project uses — drives test-runner commands and per-engine assumptions in CI
+**Values:** engine-specific (see table)
+**Default:** auto-populated by `/setup-engine` based on engine choice
+**Set by:** `/setup-engine`, `/settings`
+**Read by:** `/test-helpers` — the only skill that references it. `/qa-plan`, `/dev-story`, `/regression-suite`, `/test-setup` and `/smoke-check` do **not** name the key, despite being plausible readers.
+ *(Derived by grep. A helper-based read such as `session_state_enabled()` would not show up, so treat this list as the verified floor, not a ceiling.)*
+
+**Priority chain:** `testing.framework` in `project.yaml` → engine default
+
+> **Migrated from `technical-preferences.md`.**
+
+---
+
+### Engine defaults
+
+| Engine | Default test framework | Alternatives |
+|--------|------------------------|--------------|
+| Godot | `gdunit4` | `godot-test`, `WAT` |
+| Unity | `unity-test-framework` | `nunit`, custom |
+| Unreal | `unreal-automation` | Google Test, custom |
+
+---
+
+### Affected skills
+
+| Skill | How `testing.framework` is used |
+|-------|--------------------------------|
+| **qa-plan** | Test plan tailored to framework's idioms (assertion style, fixture pattern, parameterized tests) |
+| **dev-story** | Test framework name passed to programmer subagent in implementation brief |
+| **regression-suite** | Test file naming and discovery patterns match framework conventions |
+| **test-setup** | Scaffolds the right test runner config (e.g. `gdunit4_runner.gd` for Godot vs Unity Test Framework Asset) |
+| **smoke-check** | Invokes framework-appropriate test runner |
+
+---
+
+## testing.strict
+
+**Controls:** Whether failing or missing test evidence blocks a story from
+closing, or produces a warning and lets work continue — per test type
+**Values:** map of `{logic, integration, visual, ui, config}` → `true | false`
+**Default:** `{logic: true, integration: true, visual: true, ui: true, config: false}`
+**Set by:** `/start`, `/settings`
+**Read by:** `story-done`, `story-readiness`, `gate-check`, `smoke-check`, `dev-story`
+
+> **Per-type, not a single bool.** A global `testing.strict: true|false` forces
+> all-or-nothing: either all test failures block or none do. Per-type matches how
+> most teams actually work — strict logic and visual gates, an advisory smoke check.
+
+> **Composes with `qa.level`:** `qa.level` controls whether evidence is REQUIRED.
+> `testing.strict` controls whether failures BLOCK when evidence exists. If
+> `qa.level: minimal`, the strict map is effectively ignored (no evidence required
+> means nothing to be strict about).
+
+---
+
+### Value intent per type
+
+| Type | `true` | `false` |
+|------|--------|---------|
+| `logic` (formulas, AI, state machines) | Unit test failures BLOCK — story cannot close | Failures WARN — story can close with warning |
+| `integration` (multi-system) | Integration test failures BLOCK | Failures WARN |
+| `visual` (animation, VFX, feel) | Missing/failing screenshot evidence BLOCKS (default) | Advisory only — story can close |
+| `ui` (menus, HUD, screens) | Missing screenshot of the screen BLOCKS (default) | Advisory only — story can close |
+| `config` (balance tuning) | Failing smoke check BLOCKS | Advisory only — story can close (default) |
+
+---
+
+### Affected skills
+
+| Skill | strict.[type]: true | strict.[type]: false |
+|-------|---------------------|----------------------|
+| **story-done** | Story of that type cannot close on test/evidence failure | Story can close; warning logged in story file |
+| **story-readiness** | Validates test requirements exist before implementation — blocks if absent | Validates but does not block — surfaces as warnings |
+| **gate-check** | CI failures of that type block phase transition | CI failures of that type surfaced as concerns, not blockers |
+| **smoke-check** | Failing smoke (config strict) blocks QA handoff | Failing smoke flagged but handoff proceeds |
+| **dev-story** | References test requirements — flags story as unverifiable if absent | References test requirements — advisory only |
+
+> **Unset-key resolution.** Each skill reads `testing.strict.<type>`; if absent
+> it reads `testing.strict` as a plain boolean (legacy form); if still absent it
+> falls back to a hardcoded default. For `story-done`, `story-readiness`,
+> `gate-check`, and `dev-story` the hardcoded default is the per-type default map
+> above (logic/integration/visual/ui strict, config advisory). **`smoke-check` is
+> the exception**: it is a build-health gate, so an unset `testing.strict.config`
+> defaults to *strict* (a FAIL blocks QA hand-off) — preserving its v1.0 behavior.
+> Only an explicit `testing.strict.config: false` makes a failing smoke advisory.
+
+---
+
+## qa.level
+
+**Controls:** What test evidence is required to mark stories Done
+**Values:** `minimal` | `standard` | `full`
+**Default:** *none* — supplied by `modes.rigor` (`standard` yields `standard`)
+**Set by:** `/start`, `/settings`
+**Read by:** `/story-done`, `/story-readiness`, `/dev-story`, `/smoke-check`, `/gate-check`, `/qa-plan`, `/regression-suite`
+
+**Priority chain:** `qa.level` in `project.yaml` → `modes.rigor` expansion → *(no hardcoded default)*
+
+> **Different axis from `testing.strict`.** `qa.level` = what evidence is required.
+> `testing.strict` = do failures block. A user wanting "minimal QA" sets
+> `qa.level: minimal` and the strict map becomes effectively a no-op.
+
+---
+
+### Value intent
+
+| Aspect | minimal | standard | full |
+|--------|---------|----------|------|
+| Logic stories | No test required, no gap flagged | Unit test required (strict.logic controls block) | Unit test + coverage minimum |
+| Integration stories | No test required | Integration test or playtest doc required | Same + regression coverage |
+| Visual stories | No evidence required | Screenshot required (strict.visual controls block) | Screenshot + lead sign-off required |
+| UI stories | No evidence required | Screenshot of each screen required (strict.ui controls block) | Screenshot + walkthrough doc + interaction test |
+| Config/Data stories | No evidence required | Smoke check advisory | Smoke check required |
+| /story-done test gate | Acceptance criteria only | Enforced per story type | Enforced for every story type |
+| /gate-check phase enforcement | No test gates | Logic + integration must pass | Full coverage + regression suite |
+| /dev-story routing prompt | No "Test required: ..." line | Per-type test requirement included | Per-type + coverage target included |
+| Regression suite required by | Never | Polish stage | Production stage |
+| Best for | Jam games, throwaway prototypes, fast iteration | Most projects | Commercial, console cert, learning, paranoid teams |
+
+---
+
+### Affected skills
+
+| Skill | minimal | standard | full |
+|-------|---------|----------|------|
+| **story-done** | Acceptance criteria check only — no evidence required | Per-type evidence required; strictness from `testing.strict` | All types require evidence; strictness from `testing.strict` |
+| **story-readiness** | No test requirement validated | Test requirement per story type validated | Test requirement + coverage target validated |
+| **dev-story** | Routing prompt has no "Test required" line | Per-type test requirement passed to programmer agent | Coverage target passed to programmer agent |
+| **smoke-check** | Optional | Required before phase transition | Required before every commit |
+| **gate-check** | No test enforcement at phase transitions | Logic + integration tests must pass | Full coverage check + regression suite |
+| **qa-plan** | Skipped entirely or minimal smoke plan | Full plan per story type | Full plan + coverage targets per system |
+| **regression-suite** | Not generated | Generated at Polish stage entry | Generated at Production stage entry |
+
+---
+
+## qa.coverage_minimum
+
+**Controls:** Minimum code coverage percentage enforced at `qa.level: full`
+**Values:** integer 0–100, or `null` for unset
+**Default:** `null`
+**Set by:** `/settings`
+**Read by:** `/gate-check` only. `/story-done` does not reference the key, and no CI runner reads it.
+ *(Derived by grep. A helper-based read such as `session_state_enabled()` would not show up, so treat this list as the verified floor, not a ceiling.)*
+
+**Priority chain:** `qa.coverage_minimum` in `project.yaml` → no enforcement if `null`
+
+> **Only meaningful at `qa.level: full`.** Ignored at minimal and standard. A
+> non-null value at standard or minimal level emits a warning at session-start:
+> *"coverage_minimum is set but qa.level is not full — value will not be enforced."*
+
+> **Implementation is engine-specific.** Coverage measurement is different per engine:
+> - Godot: gdunit4 coverage report (markdown export)
+> - Unity: Unity Test Framework coverage (xml export)
+> - Unreal: gcov-style coverage from clang flags
+> CCGS does not unify these — gate-check reads the engine-appropriate report.
+
+---
+
+## strict_gate_checks
+
+> ### RESERVED - NOT IMPLEMENTED
+>
+> **No skill or hook reads this setting. Setting it has no effect.** Everything
+> below describes the intended design, not current behaviour.
+>
+> The value is checked for valid spelling when you set it, and then ignored.
+
+**Controls:** Whether phase gate failures block stage transition or just warn
+**Values:** `true` | `false`
+**Default:** `true`
+**Set by:** `/start`, `/settings`
+**Read by:** `/gate-check`
+
+**Priority chain:** `strict_gate_checks` in `project.yaml` → hardcoded default of `true`
+
+> **Different from `review_mode: solo`.** `review_mode: solo` skips the gate
+> *entirely* — directors don't even run. `strict_gate_checks: false` runs the
+> gate normally but treats the verdict as advisory.
+
+---
+
+### Value intent
+
+| Value | Behavior |
+|-------|----------|
+| `true` | Default. FAIL or BLOCKING-CONCERNS verdict stops the stage transition. `project.stage` is not advanced. User must address findings and re-run gate. |
+| `false` | All gate verdicts are advisory. `/gate-check` still runs and reports findings. `project.stage` advances on user confirmation regardless of verdict. |
+
+---
+
+### Affected skills
+
+| Skill | true | false |
+|-------|------|-------|
+| **gate-check** | FAIL verdict stops execution before writing new stage; CONCERNS verdict prompts user but defaults to "stay at current stage." | All verdicts surfaced as informational; user is asked "advance anyway?" with default Yes. |
+
+---
+
+## team.size
+
+**Controls:** Which agents are active by default — solo devs shouldn't get studio-grade gating on every change
+**Values:** `individual` | `small` | `studio`
+**Default:** *none* — supplied by `modes.rigor` (`minimal`/`standard` yield `individual`, `full` yields `studio`)
+**Set by:** `/start` (via `modes.rigor`), `/settings`
+**Read by:** All `team-*` skills, `/gate-check`, all skills that spawn agents via `Agent`
+
+**Priority chain:** `team.size` in `project.local.yaml` → `project.yaml` → the `modes.rigor` expansion (`full` → `studio`, else `individual`) → no terminal default. Locally overridable — it is a personal-experience knob, not an on-disk artifact.
+
+> **`individual` at `minimal`/`standard`, `studio` at `full`.** CCGS's audience is
+> overwhelmingly solo indie developers, so the two lighter rigor tiers resolve
+> `team.size` to `individual` — a `standard` (default) project gets one active agent
+> per role, not 15 (directors and leads included). Only `rigor: full` opts into the
+> full `studio` roster; a smaller team on a big project sets `team.size: small`
+> explicitly, which wins over the rigor-derived value.
+
+> **Different axis from `workflow`.** `workflow` controls *what docs are required.*
+> `team.size` controls *which agents exist to make them.* A solo dev on
+> `workflow: full` still doesn't need all 49 agents — they need the same coverage
+> from a smaller active set.
+
+---
+
+### Active agent set per value
+
+| Value | Active set | Notes |
+|-------|-----------|-------|
+| `individual` | Core 8: `producer`, `game-designer`, `gameplay-programmer`, engine-specialist (engine-driven), `technical-artist`, `sound-designer`, `qa-tester`, `writer`. **Default.** | Directors and lead-* run only on explicit invocation (e.g. via `/architecture-decision`). Specialists outside the core 8 routed through their nearest core agent. |
+| `small` | Core 15: directors (CD, TD, PR) + leads (LP, AD, QL, ND) + game-designer + systems-designer + engine-specialist + technical-artist + sound-designer + qa-tester + ux-designer + writer | `team-*` skills run their full pipeline. Optional specialists added per `review_mode`. |
+| `studio` | All 49 agents available. Engine sub-specialists (e.g. `unity-dots-specialist` separate from `unity-specialist`) routed when relevant. Adversarial review patterns active. | Commercial titles, learning the full org chart, large teams with parallel work. |
+
+---
+
+### Affected skills
+
+| Skill | individual | small | studio |
+|-------|------|-------|--------|
+| **team-combat** | Single agent (gameplay-programmer) runs the pipeline; ai-programmer escalated only if AI work flagged | Default pipeline as documented | Default + engine sub-specialists + adversarial review pass |
+| **team-narrative** | writer only; narrative-director invoked only on explicit pillar conflict | narrative-director + writer + (per review_mode) localization-lead, world-builder | All narrative agents active + per-system writer reviews |
+| **team-ui** | ui-programmer + ux-designer | + accessibility-specialist + art-director | + engine UI specialist + adversarial review pass |
+| **team-audio** | sound-designer only | + audio-director + technical-artist | + localization-lead + per-system audio reviewers |
+| **team-level** | level-designer + gameplay-programmer | + systems-designer + art-director | + narrative-director + world-builder + accessibility-specialist |
+| **team-qa** | qa-tester only; qa-lead invoked at phase gates only | qa-lead + qa-tester pipeline | qa-lead + per-story qa-tester spawn + sign-off |
+| **team-release** | release-manager only | + producer + devops-engineer + qa-lead | + security-engineer + analytics-engineer + localization-lead |
+| **gate-check** | Panel width is `modes.workflow`'s axis, not this one (gates always run) — `team.size` affects only specialist depth within each director's review | Same as individual for directors; specialists within directors' reviews use small set | Same plus engine sub-specialists |
+| **architecture-decision** | TD + lead-programmer; engine-specialist | TD + LP + engine-specialist + engine sub-specialist if applicable | All of small + adversarial review by alternate engine-specialist |
+
+---
+
+### Special cases
+
+- The 3 directors (CD, TD, PR) are present in ALL team sizes — phase gates require them. The setting affects *who else* shows up.
+- `individual` does not disable agents — it just changes which are active by default. Any agent can still be invoked by name.
+- When `team.size: individual` and a non-core agent is needed (e.g. `network-programmer` for a multiplayer story), the skill emits an informational note and routes through the nearest active core agent.
+
+---
+
+## platform.multiplayer
+
+**Controls:** Whether the project includes real-time online multiplayer — determines
+which specialists are routed and which architecture sections are required
+**Values:** `true` | `false`
+**Default:** `false`
+**Set by:** `/setup-engine`, `/settings`
+**Read by:** `dev-story`, `create-architecture`, `security-audit`, `team-release`, `gate-check`
+
+**Priority chain:** `platform.multiplayer` in `project.yaml` → hardcoded default of `false`
+
+> **Distinct from `platform.online`.** `multiplayer` is *real-time multiplayer
+> specifically* (network specialist, netcode review, replication architecture).
+> `platform.online` covers everything else online (cloud saves, leaderboards,
+> telemetry). See next section.
+
+> **This is a project attribute, not a mode.** It describes what the game is,
+> not how the pipeline operates. It lives in `platform` alongside `targets`,
+> `primary_input`, and `gamepad_support` — not in `modes`.
+
+---
+
+### Value intent
+
+| Value | Meaning |
+|-------|---------|
+| `true` | Game has real-time online multiplayer. Network specialist included in routing. Architecture requires networking layer. Security audit includes netcode review. |
+| `false` | No real-time multiplayer. Network specialist excluded from routing. Architecture has no networking section. |
+
+---
+
+### Affected skills
+
+| Skill | multiplayer: true | multiplayer: false |
+|-------|------------------|-------------------|
+| **dev-story** | `network-programmer` included in routing table for networking stories | `network-programmer` excluded — networking stories flagged as out of scope |
+| **create-architecture** | Networking layer section required in architecture doc | Networking section omitted entirely |
+| **security-audit** | Includes netcode review — authentication, replication, cheat vectors | Netcode review skipped |
+| **team-release** | `network-programmer` included in release sign-off pipeline | `network-programmer` excluded |
+| **gate-check** | Technical Setup gate checks for network architecture ADR | No network architecture requirement |
+
+---
+
+## platform.online
+
+**Controls:** Whether the project has any online features (leaderboards, cloud saves, telemetry, IAP)
+**Values:** `true` | `false`
+**Default:** `false`
+**Set by:** `/setup-engine`, `/settings`
+**Read by:** `dev-story`, `create-architecture`, `security-audit`, `team-live-ops`, `gate-check`
+
+**Priority chain:** `platform.online` in `project.yaml` → hardcoded default of `false`
+
+> **Independent of `platform.multiplayer`.** A single-player game with Steam
+> Cloud and leaderboards is `online: true, multiplayer: false`. The two settings
+> have different specialist routing implications.
+
+---
+
+### Value intent
+
+| Value | Meaning |
+|-------|---------|
+| `true` | Project includes online services (cloud saves, leaderboards, achievements, telemetry, IAP, anything calling external APIs at runtime). Analytics-engineer included; live-ops considerations active; security-audit includes data-transit review. |
+| `false` | Project is fully offline. No analytics-engineer routing, no live-ops scope, security audit is local-only. |
+
+---
+
+### Affected skills
+
+| Skill | online: true | online: false |
+|-------|--------------|---------------|
+| **create-architecture** | Data layer must include online service integration (cloud save sync, leaderboard auth, telemetry buffering) | Data layer is local storage only |
+| **security-audit** | Includes data-transit review — TLS, save data integrity, leaderboard tampering | Local-only review (save file tampering, save data privacy) |
+| **dev-story** | `analytics-engineer` routed for telemetry stories | analytics-engineer not routed |
+| **team-live-ops** | Skill is available (live-ops-designer routes meaningfully) | Skill emits "no online features — live ops scope is empty" |
+| **gate-check** | Technical Setup gate checks for online architecture decisions in critical ADRs | No online ADR requirement |
+
+---
+
+## platform.cert_tier
+
+> ### WIRED — this setting is live
+>
+> `/launch-checklist` and `/release-checklist` both resolve it and emit
+> console/mobile certification items only for the platforms it names, asking
+> which are in scope when it is unset.
+
+**Controls:** Certification target — scopes what `/launch-checklist` asks for
+**Values:** `none` | `itch` | `steam` | `console`
+**Default:** `none`
+**Set by:** `/setup-engine`, `/settings`
+**Read by:** `/launch-checklist`, `/release-checklist`
+
+**Priority chain:** `platform.cert_tier` in `project.yaml` → hardcoded default of `none`
+
+---
+
+### Value intent
+
+| Value | Required compliance | Best for |
+|-------|---------------------|----------|
+| `none` | No certification — internal release, alpha, jam game | Default |
+| `itch` | itch.io upload requirements (build size, page setup, age tags) | Indie web/desktop releases |
+| `steam` | Steamworks integration, store page, achievements, depot build, system requirements, common content rules | Commercial PC releases |
+| `console` | Platform certification (PlayStation/Xbox/Switch) — heavy compliance: TRC/XR/Lotcheck, save data rules, controller mapping rules, age rating boards | Console releases |
+
+---
+
+### Affected skills
+
+| Skill | none | itch | steam | console |
+|-------|------|------|-------|---------|
+| **launch-checklist** | Internal launch only — no external requirements | + itch.io page setup, butler upload, build size | + Steamworks integration, store page, achievements depot, common content checks | + Platform-specific TRC, certification submission, console save format compliance |
+| **release-checklist** | Smoke pass + version bump only | + itch.io page live, build uploaded to butler | + Steam store page live, depot pushed, achievements live | + Platform submission accepted, age rating boards cleared |
+| **/pre-cert** (future) | Not applicable | Lightweight readiness check | Steam common content audit | Full TRC compliance audit |
+
+---
+
+## accessibility.target
+
+> ### RESERVED - NOT IMPLEMENTED
+>
+> **No skill or hook reads this setting. Setting it has no effect.** Everything
+> below describes the intended design, not current behaviour.
+>
+> The value is checked for valid spelling when you set it, and then ignored.
+> The accessibility-specialist routing and the Polish-stage audit described
+> below **do not happen at any level** — `/team-ui`, `/team-level`,
+> `/team-polish` and `/gate-check` do not read this setting, and `/start`
+> does not ask for it.
+
+**Controls:** Accessibility commitment level — routes accessibility specialist and gates audit requirements
+**Values:** `none` | `standard` | `aaa`
+**Default:** `none`
+**Set by:** `/start`, `/settings`
+**Read by:** `/team-ui`, `/team-level`, `/team-polish`, `/gate-check`
+
+**Priority chain:** `accessibility.target` in `project.yaml` → hardcoded default of `none`
+
+> **Default is `none`, not `standard`.** Most CCGS users are solo devs and jam-game
+> makers — defaulting to `standard` would auto-spawn the accessibility specialist
+> for projects where it's overhead. `/start` asks the question explicitly so users
+> who care can opt into `standard` or `aaa` consciously.
+
+---
+
+### Value intent
+
+| Value | Required features | Specialist routing |
+|-------|-------------------|--------------------|
+| `none` | None enforced | `accessibility-specialist` not spawned |
+| `standard` | Colorblind-safe palette, subtitles for any voice content, key remapping | `accessibility-specialist` runs in team-ui, team-level |
+| `aaa` | Full Game Accessibility Guidelines: motor, vision, hearing, cognitive categories | `accessibility-specialist` runs in all team-* skills; mandatory audit at Polish stage |
+
+---
+
+### Affected skills
+
+| Skill | none | standard | aaa |
+|-------|------|----------|-----|
+| **team-ui** | accessibility-specialist not spawned | accessibility-specialist included for HUD/menu reviews | accessibility-specialist included for every screen + accessibility audit pass |
+| **team-level** | accessibility-specialist not spawned | accessibility-specialist reviews level for colorblind safety and signposting | accessibility-specialist reviews for full mobility/audio/cognitive considerations |
+| **team-polish** | No accessibility pass | Final accessibility pass added | Full accessibility audit required before completion |
+| **gate-check** | No accessibility check at any stage | Polish gate checks for the standard required features | Polish gate requires full Game Accessibility Guidelines compliance audit |
+
+---
+
+## cadence.sprint_length and cadence.milestone_length
+
+> ### RESERVED - NOT IMPLEMENTED
+>
+> **No skill or hook reads this setting. Setting it has no effect.** Everything
+> below describes the intended design, not current behaviour.
+>
+> No reference anywhere outside this file.
+
+**Controls:** Default sprint and milestone durations for planning
+**Values:**
+- `sprint_length`: `1w` | `2w` | `3w` | `4w` | `none`
+- `milestone_length`: `4w` | `6w` | `8w` | `12w`
+**Defaults:** `sprint_length: 2w`, `milestone_length: 8w`
+**Set by:** `/start`, `/settings`
+**Read by:** `/sprint-plan`, `/milestone-review`, `/sprint-status`, future velocity tracking
+
+**Priority chain:** `cadence.*` in `project.yaml` → hardcoded defaults
+
+> **`none` for `sprint_length`** means continuous-flow / kanban-style — no sprint boundaries.
+> `/sprint-plan` becomes `/work-plan` and is invoked manually as needed. Velocity tracking
+> is per-week rather than per-sprint.
+
+---
+
+### Affected skills
+
+| Skill | What changes |
+|-------|--------------|
+| **sprint-plan** | Capacity calculated as `sprint_length × team.size velocity baseline`. `none` makes the skill emit a continuous-flow plan instead. |
+| **milestone-review** | Milestone window for retrospective scope = `milestone_length`. |
+| **sprint-status** | Burn-down chart x-axis spans `sprint_length`. |
+| **retrospective** | Sprint retro fires at `sprint_length` cadence (or weekly when sprint_length is `none`). |
+
+---
+
+## performance.target_framerate and performance.frame_budget_ms
+
+**Controls:** The frame-rate target and its per-frame millisecond budget
+**Values:** integers (e.g. `60`, `16.67`)
+**Default:** none — unset means no budget was ever committed to
+**Set by:** the user, by hand or via `/settings`
+**Read by:** `/perf-profile`, `/gate-check`
+
+## performance.draw_call_limit and performance.memory_ceiling_mb
+
+**Controls:** Per-frame draw-call ceiling and total memory ceiling
+**Values:** integers
+**Default:** none — unset means no budget was ever committed to
+**Set by:** the user, by hand or via `/settings`
+**Read by:** `/perf-profile`, `/gate-check`
+
+> **Every setting needs its own `## ` heading in this file, not just a table
+> row.** The dead-settings audit derives what it checks from those headings, so
+> a setting mentioned only inside a table is invisible to it — it can neither be
+> reported DEAD if it loses its reader, nor caught if it gains one. A setting
+> outside the audit's field of view is exactly how a documented-but-dead entry,
+> or a working-but-listed-as-dead one, survives unnoticed.
+>
+> **Unset is not zero and not a default.** A budget nobody set is not a budget
+> that was met — `/perf-profile` must report `NOT ASSESSED` for a metric with no
+> committed target rather than measuring against a placeholder. That exact
+> failure (">99% headroom against a 16.67ms budget", from zero profiler data)
+> is one of the two instances that motivated `.claude/rules/skill-authoring.md`.
+
+## performance.enforce
+
+**Controls:** Whether performance budget violations warn or block
+**Values:** `warn` | `block` | `off`
+**Default:** `warn`
+**Set by:** `/start`, `/settings`
+**Read by:** `/perf-profile`, `/gate-check`, CI runner
+
+**Priority chain:** `performance.enforce` in `project.local.yaml` → `project.yaml` → hardcoded default of `warn`, resolved by `resolve_config --keys performance.enforce`
+
+> **Read it from the resolved block, never from `project.yaml` directly.** The key is on the `/settings --local` whitelist. `/perf-profile` Phase 0 and `/gate-check` Section 3 are the two readers the table above promises — a key that is enum-validated, accepted and displayed while nothing reads it is exactly the failure this warning guards against.
+
+> **Mirrors the `testing.strict` pattern.** Defines what happens when a budget
+> defined in `performance.target_framerate`, `frame_budget_ms`, `draw_call_limit`,
+> or `memory_ceiling_mb` is exceeded.
+
+---
+
+### Value intent
+
+| Value | Behavior |
+|-------|----------|
+| `warn` | Default. Profile runs flag violations as findings. CI logs them but doesn't fail. `/gate-check` surfaces them as concerns, not blockers. |
+| `block` | Profile failures block CI. `/gate-check` treats violations as FAIL verdict (Polish stage onward). |
+| `off` | Performance budgets are informational only — no profile runs gated, no findings surfaced. |
+
+---
+
+## project.stage
+
+**Controls:** The current development phase — determines which gate-check
+validates and what artifacts are expected to exist
+**Values:** `Concept` | `Systems Design` | `Technical Setup` | `Pre-Production` | `Production` | `Polish` | `Release`
+**Default:** `Concept`
+**Set by:** `/gate-check` on PASS verdict only — never set manually
+**Read by:** `gate-check`, `project-stage-detect`, `help`, `sprint-status`, `day-one-patch`
+
+> **Stage count:** This document uses the
+> 7-stage reality implemented by gate-check:
+> `Concept | Systems Design | Technical Setup | Pre-Production | Production | Polish | Release`
+
+> **This is a project attribute, not a mode.** It records where the project is
+> in its lifecycle. Only `/gate-check` writes it — and only on a PASS verdict
+> with user confirmation. Never write it manually mid-session except to correct
+> an incorrect auto-detect.
+
+> **Legacy fallback + dual-write.** Stage is read from `project.stage` in
+> `project.yaml` first, then legacy `production/stage.txt`, then artifact
+> auto-detection. When `/gate-check` advances the stage it dual-writes BOTH
+> `project.yaml` and `production/stage.txt`, so hooks that have not migrated
+> still resolve correctly. `/start` also dual-writes the initial stage. The
+> legacy `.txt` file is retired at `.claude/scripts/migrate-v1-config.sh --finalize`.
+
+---
+
+### Stage progression and gate requirements
+
+Each row is the gate that must be passed to advance FROM that stage.
+
+| From stage | Key artifacts required to pass | gate-check writes |
+|------------|-------------------------------|-------------------|
+| **Concept** | `game-concept.md`, design pillars, Visual Identity Anchor | `Systems Design` |
+| **Systems Design** | `systems-index.md`, all MVP GDDs reviewed, cross-GDD consistency check | `Technical Setup` |
+| **Technical Setup** | Engine configured, art bible sections 1–4 (if visual stories exist), 3+ ADRs, architecture doc, control manifest, test framework | `Pre-Production` |
+| **Pre-Production** | Prototype, 3+ playtests, UX specs, epics defined, first sprint plan | `Production` |
+| **Production** | Core mechanics implemented, main path playable, smoke check passes, QA sign-off | `Polish` |
+| **Polish** | All features complete, content complete, localization, no critical bugs | `Release` |
+
+Gates adjust per `modes.workflow` — see `modes.workflow` section for what is
+required at `standard` and `minimal` levels.
+
+---
+
+### Affected skills
+
+| Skill | How it uses stage |
+|-------|------------------|
+| **gate-check** | Reads current stage to determine which gate to validate. Writes next stage on PASS. |
+| **project-stage-detect** | Reads `project.stage` first — if set, uses it as authoritative. Falls back to heuristic detection only if absent. |
+| **help** | Uses stage to determine "where are you in the pipeline" and surfaces the correct next steps. |
+| **sprint-status** | Displays current stage in status summary. |
+| **day-one-patch** | Validates that stage is `Release` before proceeding — refuses to run if project is not at release stage. |
+
+---
+
+## project.kind
+
+> ### RESERVED - NOT IMPLEMENTED
+>
+> **No skill or hook reads this setting. Setting it has no effect.** Everything
+> below describes the intended design, not current behaviour.
+>
+> No reference anywhere outside this file.
+
+**Controls:** What type of project this is — routes skill subsets
+**Values:** `game` | `tool` | `engine` | `mod` | `library`
+**Default:** `game`
+**Set by:** `/start`, `/setup-engine`
+**Read by:** Many skills (advisory routing — see below)
+
+**Priority chain:** `project.kind` in `project.yaml` → hardcoded default of `game`
+
+---
+
+### Value intent
+
+| Value | Meaning | What's deactivated |
+|-------|---------|-------------------|
+| `game` | Default. Full CCGS framework applies. | Nothing |
+| `tool` | Developer tool, not a game | Skip art bible, narrative, level design, playtesting |
+| `engine` | Custom engine or library underneath games | Skip game-specific concerns entirely (narrative, art, playtest) |
+| `mod` | Mod for an existing game | Skip engine setup; assume parent engine; reduce architecture scope |
+| `library` | Reusable library | Emphasize tests + API design; design docs lighter; no asset pipeline |
+
+---
+
+### Affected skills
+
+| Skill | game | tool | engine | mod | library |
+|-------|------|------|--------|-----|---------|
+| **brainstorm** | Full game-concept output | Tool concept output (user, problem, solution) | Engine concept (target use cases, scope) | Mod concept (what changes) | Library concept (API surface, target consumers) |
+| **art-bible** | Required at appropriate workflow level | Skipped | Skipped | Optional (depends on visual scope) | Skipped |
+| **map-systems** | Full game systems decomposition | Tool subsystems | Engine subsystems | Modified-system map | Library module map |
+| **playtest-report** | Required at appropriate stages | Skipped or replaced with user testing | Skipped | Required (compatibility testing) | Skipped or replaced with API usage testing |
+| **setup-engine** | Game engine setup | Skipped or replaced with build tool setup | Self-referential — engine IS the project | Parent engine assumed | Skipped or replaced with library scaffolding |
+
+---
+
+## engine.name and specialists
+
+**Controls:** Which engine-specific specialist agents are routed to for code
+implementation, review, and architecture validation
+**Values:** `Godot` | `Unity` | `Unreal`
+**Default:** `[UNSET]` — must be configured via `/setup-engine`
+**Set by:** `/setup-engine`
+**Read by:** `dev-story`, `code-review`, `architecture-decision`, `create-architecture`, all `team-*` skills
+
+> **Currently stored in `technical-preferences.md`**, not `project.yaml`. After
+> YAML expansion, `engine.name` and the specialist routing table move to
+> `project.yaml specialists` block. Skill behavior is unchanged — only the
+> source file changes.
+
+> **This is a project attribute, not a mode.** Engine choice drives specialist
+> routing the same way `platform.multiplayer` drives network routing — skills
+> respond to a fact about the project, not a process preference.
+
+---
+
+### Specialist routing by engine
+
+| Engine | Language/code specialist | Shader specialist | UI specialist | Additional specialists |
+|--------|--------------------------|-------------------|---------------|----------------------|
+| **Godot** | `godot-gdscript-specialist` (GDScript) or `godot-csharp-specialist` (C#) — driven by `engine.language` | `godot-shader-specialist` | `godot-specialist` | `godot-gdextension-specialist` |
+| **Unity** | `unity-specialist` | `unity-shader-specialist` | `unity-ui-specialist` | `unity-addressables-specialist`, `unity-dots-specialist` |
+| **Unreal** | `unreal-specialist` | `unreal-specialist` | `ue-umg-specialist` | `ue-gas-specialist`, `ue-blueprint-specialist`, `ue-replication-specialist` |
+| **[UNSET]** | No specialist spawned — warning emitted | No specialist spawned | No specialist spawned | None |
+
+---
+
+### Affected skills
+
+| Skill | How engine.name is used |
+|-------|------------------------|
+| **dev-story** | Routes code stories to language specialist. Spawns engine specialist alongside for HIGH engine-risk stories or engine-specific API usage. |
+| **code-review** | Routes review to language, shader, or UI specialist based on file type being reviewed. |
+| **architecture-decision** | Loads `docs/engine-reference/[engine]/VERSION.md` before authoring. Spawns engine specialist to validate ADR for API correctness and post-cutoff compatibility. |
+| **create-architecture** | Includes engine-specific constraints and patterns in architecture doc based on engine choice. |
+| **team-combat / team-ui / team-audio / team-level / team-polish** | All team skills spawn the appropriate engine specialist for implementation phases. |
+
+---
+
+## commands
+
+> **Live since the run-and-observe step.** This block was RESERVED — written by
+> `/setup-engine`, read by nothing — through most of v1.1. `test`, `smoke` and
+> `build` gained readers as the parse-check and smoke gates landed; `run` gained
+> its reader last, when `/dev-story` Phase 6 step 4 started launching the game to
+> look at it. The per-skill table at the bottom is now current behaviour, not
+> intent. `validate-push.sh` was once named as a reader and never was.
+
+**Controls:** Explicit shell commands to build, test, run, and smoke-test the project
+**Values:** strings — shell-executable commands
+**Default:** `[UNSET]` — populated by `/setup-engine` with engine-typical defaults
+**Set by:** `/setup-engine`, `/settings`
+**Written by:** `/setup-engine`, `/settings`. **Read by:** `test` — `/dev-story` (Phase 6 parse check), `/smoke-check`, `project-coherence.sh`; `smoke` — `/dev-story`; `build` — `/smoke-check`, `project-coherence.sh`; `run` — `/dev-story` (Phase 6 step 4, the run-and-observe step). `/launch-checklist` and `/regression-suite` name these commands but cannot execute them — their `allowed-tools` has no `Bash`.
+ *(Derived by grep. A helper-based read would not show up, so treat this list as the verified floor, not a ceiling.)*
+
+**Priority chain:** `commands.*` in `project.yaml` → engine-typical default → no command available
+
+> **Why explicit:** Without this block, CCGS has to guess engine-typical conventions
+> for invoking the project. Better to be explicit per-project — covers cases where
+> projects customize their build (e.g., a Godot project using gdunit4 for tests but
+> a custom export script for builds).
+
+---
+
+### Fields
+
+Each command can be a simple string (used on all OSes) or an OS-aware map:
+
+**Simple form** (one command, used on every OS):
+```yaml
+commands:
+ build: "godot --headless --export-debug '<PRESET>'" # ask; see the note below
+ test: "godot --headless --script tests/gdunit4_runner.gd"
+ run: "godot --path . --windowed --resolution 1280x720"
+ smoke: "godot --headless --quit-after 5"
+```
+
+Note that `build` is the one row the simple form suits least: an export preset
+names a *platform*, so a single build string is portable only for a project that
+builds one platform. The other three rows are genuinely OS-independent.
+
+**OS-aware form** (different commands per OS):
+```yaml
+commands:
+ build:
+ default: "godot --headless --export-debug 'Linux/X11'"
+ windows: "godot.exe --headless --export-debug 'Windows Desktop'"
+ macos: "godot --headless --export-debug 'macOS'"
+ test:
+ default: "godot --headless --script tests/gdunit4_runner.gd"
+ run:
+ default: "godot --path . --windowed --resolution 1280x720"
+ smoke:
+ default: "godot --headless --quit-after 5"
+```
+
+**Resolution rule:** if the value is a string, use it as-is on any OS. If the
+value is a map, skills/hooks read the current OS and pick the matching key
+(`linux`, `windows`, `macos`). Fall back to `default` if no OS-specific key
+matches.
+
+This solves the Windows/Linux/macOS path-and-binary-name differences without
+breaking the whitelist (commands stays locked to project.yaml — the OS-specific
+keys are inside the locked file, not a local override).
+
+| Field | Purpose |
+|-------|---------|
+| `build` | Full project build for CI or release. Used by `/launch-checklist`, CI hooks. |
+| `test` | Run the full test suite. Used by `/smoke-check`, `/regression-suite`, CI hooks. |
+| `run` | Launch the **game** windowed at a fixed resolution — not the editor. Used by `/dev-story` Phase 6 step 4 to observe the feature and retain a screenshot; see `.claude/docs/run-and-observe.md` for the per-engine capture flags that are appended to it. |
+| `smoke` | Minimal "does it boot?" check. Named by `/smoke-check` in its prose. Should complete in < 5 seconds. |
+
+---
+
+### Engine defaults
+
+When `/setup-engine` runs, it populates `commands` based on engine choice — except
+the **build** row, which it must **ask** for. The build artifact is named by a
+project-defined string (a Godot export preset, a Unity build target), and no
+engine reference in this repo can source it. See `/setup-engine` §"The Godot
+`build` row must not hardcode `'Linux/X11'`".
+
+| Engine | build | test | run | smoke |
+|--------|-------|------|-----|-------|
+| Godot | `godot --headless --export-debug '<PRESET>'` | `godot --headless --script tests/gdunit4_runner.gd` | `godot --path . --windowed --resolution 1280x720` | `godot --headless --quit-after 5` |
+| Unity | `Unity -batchmode -quit -projectPath . -buildTarget <TARGET>` | `Unity -runTests -projectPath . -testPlatform PlayMode` | `Builds/<Target>/<Game>.exe -screen-width 1280 -screen-height 720 -screen-fullscreen 0` | `Unity -batchmode -quit -projectPath . -executeMethod SmokeCheck.Run` |
+| Unreal | engine-specific (varies by version) | engine-specific | engine-specific | engine-specific |
+
+> **`<PRESET>` and `<TARGET>` are placeholders, not values to copy.** A Godot
+> export preset is whatever string the operator typed into `export_presets.cfg`;
+> the shipped defaults are per-platform (`Windows Desktop`, `macOS`, `Web`,
+> `Linux/X11`). Copying a preset name you do not have gives you a build command
+> that fails with `Unknown export preset`; copying one you *do* have, but did not
+> mean, gives you a command that succeeds and builds the wrong platform. The
+> second is the dangerous one. If no presets exist yet — common, since
+> `/setup-engine` usually runs before the project has any — write
+> `[TO BE CONFIGURED]` rather than guessing a name.
+
+Users override per-project as needed via `/settings commands.<field>=<value>` or by editing `project.yaml` directly.
+
+---
+
+### Affected skills
+
+| Skill | How `commands` is used |
+|-------|------------------------|
+| **smoke-check** | Invokes `commands.smoke` (or `commands.test` for full pass). Critical path for QA hand-off. |
+| **launch-checklist** | Emits a checklist **item** asking whether the build produces a valid artifact. It does **not** run `commands.build` — its `allowed-tools` has no `Bash`. The verification is a human step. |
+| **validate-push.sh** | Does **not** read `commands.*`. It warns on pushes to protected branches (`develop`/`main`/`master`) and runs no build or smoke command — the block path in it is commented out, so it never fails a push. |
+| **dev-story** | Phase 6 step 2 runs `commands.test` or `commands.smoke` as the parse check. Phase 6 step 4 runs `commands.run` — the windowed game launch — to observe the feature and retain a screenshot (`.claude/docs/run-and-observe.md`). |
+| **regression-suite** | Maps coverage by **globbing test filenames**. It does **not** invoke `commands.test` — its `allowed-tools` has no `Bash`, so coverage here means "a test file exists", never "a test passed". |
+
+---
+
+## naming
+
+**Controls:** Code naming conventions for the project
+**Values:** see field list below
+**Default:** engine-specific (auto-populated by `/setup-engine`)
+**Set by:** `/setup-engine`, `/settings`
+**Read by:** `/adopt`, `/architecture-review`, `/asset-spec`,
+`/create-architecture`, `/create-control-manifest`, `/dev-story`,
+`/vertical-slice` — each reads `naming.*` from `project.yaml` and feeds the
+conventions into a brief, manifest or spec. **NOT by `/code-review` and NOT by
+`validate-commit.sh`**.
+ *(Reader list derived by grep, so treat it as the verified floor rather than
+ a ceiling — a skill reading the value through a helper would not show up.)*
+
+> **These conventions are guidance, not a gate.** They reach your project by
+> being passed into briefs, manifests and specs for whoever writes the code.
+> Nothing checks the result: `/code-review` does not validate files against them
+> and `validate-commit.sh` does not warn on violations — neither contains any
+> naming logic. If you need enforcement, it has to be added.
+>
+> **Known rough edge — asset filenames.** `validate-assets.sh` warns unless files
+> under `assets/` are lowercase-with-underscores, and it takes no config input,
+> while `/asset-spec` specifies asset names from `naming.*`. On Unity, Unreal and
+> Godot-C#, where `/setup-engine` sets `naming.files: PascalCase`, that hook will
+> warn on assets named exactly as `/asset-spec` specified them. The two are
+> measuring different things — `naming.files` describes **source** files by its
+> own examples (`PlayerController.cs`), and no key currently governs asset
+> filenames — so treat the hook's naming warning as advisory on those engines.
+
+> **Moved from `technical-preferences.md`**, which is being deleted. Naming
+> conventions are project-level facts shared by everyone on the project, so they
+> belong in `project.yaml` alongside the rest of your structured config.
+
+---
+
+### Fields
+
+| Field | Values | Godot default | Unity default | Unreal default |
+|-------|--------|---------------|---------------|----------------|
+| `classes` | `PascalCase` \| `snake_case` \| `camelCase` | PascalCase | PascalCase | PascalCase |
+| `variables` | `snake_case` \| `camelCase` | snake_case | camelCase | camelCase |
+| `constants` | `SCREAMING_SNAKE` \| `PascalCase` | SCREAMING_SNAKE | SCREAMING_SNAKE | SCREAMING_SNAKE |
+| `signals` (Godot) / `events` (Unity, Unreal) | `past_tense` \| `on_event_name` | past_tense | on_event_name | OnEventName |
+| `files` | `snake_case` \| `PascalCase` \| `kebab-case` | snake_case | PascalCase | PascalCase |
+| `scenes` / `prefabs` | `snake_case` \| `PascalCase` | snake_case | PascalCase | PascalCase |
+
+> **`signals` vs `events`:** Godot uses signals natively; Unity uses C# events
+> or UnityEvents; Unreal uses delegates and dynamic multicast. The field stays
+> named `signals` in project.yaml for consistency across engines — interpret as
+> "event-like callbacks" regardless of engine.
+
+---
+
+### Affected skills
+
+| Skill | How naming is used |
+|-------|--------------------|
+| **dev-story** | Passes the naming conventions to the programmer subagent as part of the implementation context |
+| **create-control-manifest** | Emits the conventions as manifest rows (classes, variables, signals/events, files, constants) |
+| **asset-spec** | Specifies asset naming per the configured convention |
+| **create-architecture** / **architecture-review** | Read as project config alongside `performance.*` |
+| **vertical-slice** / **adopt** | Read as project config; `/adopt` audits conformance at MEDIUM severity |
+
+No skill or hook validates code *against* these conventions — see the note above.
+
+---
+
+## features.session_state
+
+> ⚠️ **`active.yaml` does not exist and nothing writes it — anywhere in this
+> document.** It is deferred design. What ships is
+> `production/session-state/**active.md**`, whose `<!-- CHECKPOINT -->` region
+> `session-start.sh` and `pre-compact.sh` both read, and whose
+> `<!-- STATUS -->` block `statusline.sh` parses. **Read every `active.yaml` and
+> `status:` mention in this file — above and below — as the deferred design, and
+> substitute `active.md` (and its STATUS block).** This scope note is
+> document-wide on purpose: the equivalent warning under *Status line behavior*
+> scoped itself to mentions "below", which left this section's own Controls line
+> and Hook behavior table describing a file that does not exist.
+
+**Controls:** Whether the harness runs a full session tracking pipeline (hooks,
+log files, `active.yaml` checkpoint — see the scope note above) or relies on
+skeleton-first output files for recovery
+**Values:** `off` | `on`
+**Default:** `on`
+**Set by:** `/start`, `/settings`
+**Read by:** All 7 session-lifecycle hooks; `statusline.sh`; any skill that writes
+to `production/session-state/`
+
+> **This is the recommended setting for most users.** The session state pipeline
+> was built to solve mid-task context loss during long conversations, but the
+> problem is better solved by long-form skills writing self-describing skeleton
+> files upfront. `session_state: on` is an opt-in for teams or power users who
+> want explicit tracking across many files over many days.
+
+> **Priority chain:** `features.session_state` in `project.local.yaml` →
+> `project.yaml` → hardcoded default of **`on`**. Hooks read it via
+> `session_state_enabled()` in `yaml-helper.sh` and exit early when `off`.
+> Skills check it before writing to `production/session-state/`.
+
+> **The default is `on`, deliberately.** `.claude/docs/context-management.md`
+> tells you to rely on `production/session-state/active.md` as your
+> crash-recovery checkpoint, so defaulting this off would quietly take away
+> recovery, the session archive and the subagent tally. The ~2–5k tokens per
+> session are an explicit opt-out (`/settings features.session_state=off`),
+> never a silent default.
+
+> **`session-start.sh` is gated per-block, not at the top.** Its sprint,
+> milestone and git context is not part of the session-state pipeline; only the
+> `active.md` recovery preview is gated. Its check also fails OPEN — that hook
+> sources `yaml-helper.sh` conditionally, and an undefined function is falsey,
+> which would suppress the recovery checkpoint invisibly.
+
+---
+
+### Value intent
+
+| Value | Intent |
+|-------|--------|
+| `off` | Recovery via skeleton-first output files. Long-form skills write a complete skeleton (all section headers, empty bodies) before starting. If context clears or compacts, the agent reads the skeleton + relevant docs and resumes. No hooks, no logs, no separate state file. ~2,000–5,000 tokens saved per session. |
+| `on` | Full session tracking. `active.yaml` checkpoint, session-stop archival, compaction log, agent audit log, and STATUS breadcrumb all active. Adds ~2,000–5,000 tokens per session-start and ~1,000–6,000 per compaction event. |
+
+---
+
+### Hook behavior
+
+> **Implementation note:** The feature flag check lives inside each hook script,
+> not at the harness level. Every session-state-aware hook reads
+> `features.session_state` from `project.yaml` at its top (via Python fallback
+> chain) and exits silently with no output if the value is `off`. This ensures
+> the harness always fires the hook — the hook decides whether to act.
+
+| Hook | session_state: off | session_state: on |
+|------|--------------------|-------------------|
+| **session-start.sh** | Runs normally (git/sprint context) — skips active.yaml preview block | Runs fully including active.yaml preview |
+| **detect-gaps.sh** | Runs unchanged — gap detection is independent of session state | Runs unchanged |
+| **pre-compact.sh** | Emits: "Read skeleton files and relevant docs to resume" — no active.yaml dump, no WIP scan, no compaction-log append | Full dump: active.yaml content + git diff + WIP scan + compaction-log append |
+| **post-compact.sh** | No-op — exits silently | Runs: reminds agent to re-read active.yaml |
+| **session-stop.sh** | No-op — exits silently | Archives active.yaml to session-log, appends commits and diffs |
+| **log-agent.sh** | No-op — exits silently | Appends to agent-audit.log |
+| **log-agent-stop.sh** | No-op — exits silently | Appends to agent-audit.log |
+
+---
+
+### File existence by mode
+
+| File | session_state: off | session_state: on |
+|------|--------------------|-------------------|
+| `production/session-state/active.yaml` | Not created | Written by skills, read by hooks and status line |
+| `production/session-logs/session-log.md` | Not written | Append-only archive of each session's active.yaml |
+| `production/session-logs/compaction-log.txt` | Not written | Append-only timestamp log of compaction events |
+| `production/session-logs/agent-audit.log` | Not written | Append-only log of agent spawn/complete events |
+
+---
+
+### Skeleton-first pattern (session_state: off recovery mechanism)
+
+Long-form skills must write a skeleton file as their first action — before any
+section discussion begins. The skeleton contains all section headers with empty
+bodies and a `<!-- STATUS: incomplete -->` marker per section.
+
+```markdown
+# Combat System — GDD
+
+## Overview
+<!-- STATUS: incomplete -->
+
+## Player Fantasy
+<!-- STATUS: incomplete -->
+
+## Detailed Rules
+<!-- STATUS: incomplete -->
+...
+```
+
+As each section is approved and written, the marker changes to `<!-- STATUS: done -->`.
+On recovery (after /clear or compaction), the agent reads the skeleton, identifies
+which sections are `done` vs `incomplete`, reads relevant ADRs and the systems index,
+and resumes at the first `incomplete` section. No active.yaml needed.
+
+**Skills required to implement skeleton-first:**
+
+| Skill | Output file | Skeleton written when |
+|-------|-------------|----------------------|
+| **design-system** | `design/gdd/[system].md` | Before Phase 1 (section discussion) |
+| **art-bible** | `design/art/art-bible.md` | Before section 1 discussion |
+| **create-architecture** | `docs/architecture/architecture.md` | Before layer discussion |
+| **ux-design** | `design/ux/[screen].md` | Before screen discussion |
+| **create-stories** | `production/epics/[epic-slug]/story-NNN-[slug].md` | Before story authoring loop |
+| **create-epics** | `production/epics/[epic-slug]/EPIC.md` | Before epic authoring loop |
+| **map-systems** | `design/gdd/systems-index.md` | Before system enumeration |
+| **brainstorm** | `design/gdd/game-concept.md` (`standard`/`full`) · `design/game-brief.md` (`minimal`) | Before concept discussion |
+
+> **Note on agents:** `world-builder` and `narrative-director` are agents, not
+> invocable skills — they do not have SKILL.md files. Long-form output from these
+> agents is produced via the skills above (design-system, art-bible, etc.) which
+> are responsible for skeleton-first enforcement.
+
+---
+
+### Status line behavior
+
+> ⚠️ **The table below describes POST-YAML-EXPANSION behavior, which is NOT
+> IMPLEMENTED.** `active.yaml` does not exist and nothing writes it. What ships
+> today: `statusline.sh` parses the `<!-- STATUS --> ... <!-- /STATUS -->`
+> markdown comment block inside `production/session-state/active.md`. Substitute
+> "the STATUS block in `active.md`" for every `active.yaml` / `status:` mention
+> here. **The same substitution applies document-wide, not just below this
+> point** — see the scope note under `## features.session_state`.
+
+> **Stage detection is always independent of session state.** `statusline.sh`
+> auto-detects stage from `project.yaml` `project.stage` or artifact heuristics regardless
+> of `session_state` value — only the breadcrumb is gated.
+
+| Feature | session_state: off | session_state: on |
+|---------|--------------------|-------------------|
+| Context % display | Always shown | Always shown |
+| Model display | Always shown | Always shown |
+| Stage display | Always shown (from project.yaml or heuristics) | Always shown (same) |
+| Epic/Feature/Task breadcrumb | Not shown — no active.yaml parsed | Parsed from `status:` block in `active.yaml` |
+
+---
+
+### Affected skills
+
+Skills interact with session state in two ways: **inference** (reading active.yaml
+to resolve a missing argument) and **extraction** (appending a SESSION EXTRACT
+block after completing work). Both behaviors are gated by `session_state`.
+
+#### Inference — skills that read active.yaml to fill in missing arguments
+
+When `session_state: off`, these skills cannot infer from active.yaml and must
+receive the argument explicitly. If called without an argument, they should prompt
+the user rather than fail silently.
+
+| Skill | What it infers from active.yaml | Fallback when `off` |
+|-------|----------------------------------|---------------------|
+| **dev-story** | Active story path (when no arg given) | Prompt user for story path |
+| **story-done** | In-progress story path (when no arg given) | Prompt user for story path |
+| **team-release** | Target version (when no arg given) | Prompt user for version |
+| **team-qa** | Active sprint (when no arg given) | Prompt user for sprint file |
+| **help** | Current task and STATUS block for context-aware suggestions | Responds without session context — surfaces next steps from sprint/epics only |
+
+#### Extraction — skills that append SESSION EXTRACT to active.yaml
+
+These skills append a structured block after completing work when `session_state: on`.
+When `off`, they skip this write entirely.
+
+| Skill | What it writes to active.yaml |
+|-------|-------------------------------|
+| **dev-story** | Story path, files changed, test written, blockers, next steps |
+| **story-done** | Verdict, story path, tech debt count, next recommended story |
+| **architecture-review** | Verdict, TR coverage counts, new TR-IDs, GDD flags, ADR gaps, report path |
+| **prototype** | Prototype scope, current phase, key decisions |
+| **vertical-slice** | Slice concept, current phase, blocked items |
+| **team-qa** | QA phase comment, blocking issues |
+| **map-systems** | Task record: systems enumerated, current phase |
+
+---
+
+### Token cost summary
+
+| Scenario | session_state: off | session_state: on |
+|----------|--------------------|-------------------|
+| Per session start | ~500 tokens (git/sprint context only) | ~2,000–5,000 tokens (+ active.yaml preview) |
+| Per compaction event | ~200 tokens (reminder only) | ~1,000–6,000 tokens (active.yaml + git diff + WIP scan) |
+| Per session end | 0 | File I/O only (no conversation tokens) |
+| Recovery after /clear | Read skeleton + 2–3 docs (~1,000–3,000 tokens) | Read active.yaml (~200–500 tokens) |
+| Net for 50 sessions, 2 compactions/session | ~60,000 tokens | ~250,000–550,000 tokens |
+
+> **Note:** The `off` recovery cost (reading skeleton + docs) is paid only when
+> recovery is actually needed. The `on` session-start cost is paid every session
+> whether recovery is needed or not.
+
+---
+
+## features.token_budget_warn_at
+
+> ### RESERVED - NOT IMPLEMENTED
+>
+> **No skill or hook reads this setting. Setting it has no effect.** Everything
+> below describes the intended design, not current behaviour.
+>
+> The value is checked for valid spelling when you set it, and then ignored.
+> Nothing warns at any threshold.
+
+**Controls:** Context usage threshold at which session warnings fire
+**Values:** float between 0.0 and 1.0
+**Default:** `0.7` (warn at 70%)
+**Set by:** `/start`, `/settings`
+**Read by:** `pre-compact.sh`, `session-start.sh`, `statusline.sh`
+
+**Priority chain:** `features.token_budget_warn_at` in `project.yaml` → hardcoded default of `0.7`
+
+> Surfaces a warning when session context usage exceeds the threshold. Helps
+> cost-conscious users hit `/clear` before runaway sessions. Set to `1.0` to
+> disable.
+
+---
+
+### Behavior
+
+| Threshold | What fires |
+|-----------|-----------|
+| Below `warn_at` | No warning |
+| At or above `warn_at` | `statusline.sh` shows context usage in yellow; next session-start hook emits a one-line note: *"Last session reached [X]% context — consider /clear if continuing work."* |
+| At 90%+ | Yellow becomes red regardless of `warn_at` value |
+
+---
+
+## schema_version
+
+**Controls:** Which version of the project.yaml schema this file conforms to
+**Values:** integer
+**Default:** `1` (for v1.1 of CCGS)
+**Set by:** `/start`, `/adopt`
+**Read by:** All skills and hooks that parse project.yaml (for migration safety)
+
+> Lets future CCGS versions detect and migrate old project.yaml files. The
+> migration logic compares `schema_version` in the file against the current
+> CCGS's expected version. If newer, warn. If older, run migrations.
+
+---
+
+### Migration behavior
+
+| project.yaml schema_version | Current CCGS expects | Behavior |
+|----------------------------|---------------------|----------|
+| Matches expected | — | Normal operation |
+| Lower than expected | — | `/adopt` warns and offers migration; skills run with deprecation warnings |
+| Higher than expected | — | All skills warn: "This project.yaml was created by a newer CCGS version. Some settings may be ignored." |
+| Missing | — | Treated as legacy (pre-v1.1); migration prompted on next `/start` or `/adopt` |
+
+---
+
+## framework
+
+**Controls:** Tracks which CCGS version created or last touched this project
+**Values:** `framework.version` (semver string) + `framework.last_upgraded` (ISO date)
+**Default:** auto-populated by `/start` and `/adopt`
+**Set by:** `/start`, `/adopt`
+**Read by:** no skill branches on it — it is file metadata, not a behavioural setting. It appears in `/start`, `/gate-check`, `/brainstorm`, `/settings` and `/setup-engine` as part of the `project.yaml` block they **write or display**, and in `yaml-helper.sh`.
+ *(The five skills above were verified to name it; whether each reads it or merely emits it was NOT separated, so this says 'appears in', not 'read by'.)*
+
+---
+
+### Fields
+
+```yaml
+framework:
+ version: "1.1.0"
+ last_upgraded: "2026-05-14"
+```
+
+| Field | Purpose |
+|-------|---------|
+| `version` | The CCGS version that created the project (or last ran `/upgrade`). Used to determine which migrations apply when CCGS itself is updated. |
+| `last_upgraded` | ISO date of most recent `/adopt` or `/upgrade` run. Helps detect long-stale projects. |
+
+---
+
+### Affected skills
+
+| Skill | How it uses framework |
+|-------|----------------------|
+| **adopt** | Reads `framework.version` to determine which migration steps apply. Updates both fields after running. |
+| **session-start hook** | Warns if `last_upgraded` is more than 90 days stale: "Project was last upgraded over 3 months ago — consider running /adopt." |
+
+---
+
+## Migration from v1.0 → v1.1
+
+When a v1.0 CCGS project upgrades to v1.1, migration tooling (run via `/adopt`)
+converts legacy files to `project.yaml`. This section specifies the intended
+behavior.
+
+### Detection
+
+A project is detected as needing migration when:
+- `project.yaml` does **NOT** exist at the repo root, AND
+- One or more legacy files exists:
+ - `production/stage.txt`
+ - `production/review-mode.txt`
+ - `.claude/docs/technical-preferences.md`
+
+### Preservation
+
+| Legacy source | Migrates to |
+|---------------|-------------|
+| `production/stage.txt` (single line) | `project.stage` |
+| `production/review-mode.txt` (single line) | `modes.review_mode` |
+| `.claude/docs/technical-preferences.md` → "Engine & Language" section | `engine.name`, `engine.version`, `engine.language`, `engine.rendering`, `engine.physics` |
+| `technical-preferences.md` → "Input & Platform" section | `platform.targets`, `platform.primary_input`, `platform.gamepad_support`, `platform.touch_support` |
+| `technical-preferences.md` → "Naming Conventions" section | `naming.classes`, `naming.variables`, `naming.constants`, `naming.signals`, `naming.files`, `naming.scenes` |
+| `technical-preferences.md` → "Performance Budgets" section | `performance.target_framerate`, `performance.frame_budget_ms`, `performance.draw_call_limit`, `performance.memory_ceiling_mb` |
+| `technical-preferences.md` → "Testing" section | `testing.framework`, `qa.coverage_minimum` (bare number only — prose is reported for manual entry) |
+| `technical-preferences.md` → "Engine Specialists" section | `specialists.code`, `specialists.shader`, `specialists.ui`, `specialists.additional` |
+
+**Value rename — `review_mode: none` → `solo`.** v1.0 used `none` for the "no
+director reviews" tier; v1.1 renamed that tier to `solo` (the enum is
+`full | lean | solo`). Migration **coerces** a legacy `none` to `solo` and reports
+the rename in the migration report's Warnings. This is the one documented value
+rename, so it is mapped-and-flagged rather than preserved raw: writing `none`
+verbatim would produce an enum-invalid `project.yaml` that `resolve_config` rejects
+and falls back to `lean` (reviews *on*) — inverting the user's intent. The
+`--finalize` preservation check applies the same mapping so it does not falsely
+refuse. Every *other* non-v1.1 stage/review value is a fork, not a rename:
+preserved raw and flagged for manual resolution, never coerced (test II.21-23; the
+rename is II.25-27).
+
+Settings absent from the legacy files (new v1.1 settings like `qa.level`,
+`docs.density`, `team.size`, etc.) get hardcoded defaults from the v1.1 schema.
+
+### Cleanup (deferred, non-destructive)
+
+Migration is **non-destructive in v1.1**: legacy files are NOT auto-deleted.
+Migration produces `project.yaml` and leaves the legacy files in place. Hooks
+and skills read `project.yaml` first; they fall back to the legacy file if a
+specific key is missing.
+
+Legacy files are deleted only when the user runs
+`.claude/scripts/migrate-v1-config.sh --finalize` (driven by `/adopt`, which
+detects a v1.0 project automatically at Phase 2g). The cleanup step verifies
+that every legacy file's content has been preserved in `project.yaml` before
+deleting.
+
+### Failure modes
+
+| Problem | Behavior |
+|---------|----------|
+| Legacy file is malformed (can't parse) | Migration emits warning per file, leaves it untouched, continues with the others. `project.yaml` gets the parseable values + defaults for the rest. |
+| Parsed value doesn't match v1.1 enum (e.g. `stage: Alpha` from a fork) | Migration writes the raw value with a `_migration_warning` comment in `project.yaml`. User resolves manually. |
+| Both `project.yaml` AND a legacy file exist (split-brain) | Migration tooling refuses to run. Error: "Both project.yaml and legacy files exist — resolve which is authoritative before migrating." |
+| Custom sections in forked `technical-preferences.md` | Custom content logged to `production/migration-report.md` as "not migrated — please integrate manually." |
+
+### Migration report
+
+Every migration run writes `production/migration-report.md`:
+
+- Source files detected
+- Values preserved (per file → per setting)
+- Defaults applied (for v1.1-new settings)
+- Warnings encountered (malformed, mismatched enums, etc.)
+- Manual review items
+
+User reads the report before running `--finalize`.
+
+---
+
+## Complete example `project.yaml`
+
+A full project.yaml with every setting, showing sensible defaults for a solo
+Godot project. Use this as the reference shape when authoring or migrating.
+
+```yaml
+schema_version: 1
+
+framework:
+ version: "1.1.0"
+ last_upgraded: "2026-05-15"
+
+project:
+ name: "Forge Knights"
+ genre: "ARPG"
+ version: "0.1.0"
+ stage: Concept # Concept | Systems Design | Technical Setup | Pre-Production | Production | Polish | Release
+ kind: game # game | tool | engine | mod | library
+
+modes:
+ review_mode: lean # full | lean | solo
+ workflow: standard # minimal | standard | full
+ automation: collaborative # collaborative | guided | autonomous
+ automation_always_ask: # decision categories that always prompt regardless of mode
+ - scope_changes
+ - file_deletions
+ - schema_changes
+ story_granularity: balanced # coarse | balanced | fine
+
+# TOP-LEVEL, not nested under `modes:` — resolve_config reads
+# `workflow_overrides.system_overrides.*` from the document root
+# (yaml-helper.sh), and every skill greps the same top-level path.
+# Nesting it under `modes:` parses as valid YAML and is silently never read.
+workflow_overrides:
+ edge_cases: false # force GDD Edge Cases section required
+ tuning_knobs: false # force GDD Tuning Knobs section required
+ art_bible_strict: false # force all 9 art bible sections regardless of asset stories
+ system_overrides: {} # { combat: full, inventory: minimal }
+
+docs:
+ density: balanced # terse | balanced | thorough
+
+testing:
+ framework: gdunit4 # engine-specific — auto-populated by /setup-engine
+ strict:
+ logic: true # unit test failures BLOCK story closure
+ integration: true # integration test failures BLOCK
+ visual: true # missing screenshot BLOCKS
+ ui: true # missing screenshot BLOCKS
+ config: false # advisory only
+
+qa:
+ level: standard # minimal | standard | full
+ coverage_minimum: null # integer 0-100; only enforced at level: full
+
+strict_gate_checks: true # phase gate failures block stage transition
+
+team:
+ size: individual # individual | small | studio
+
+platform:
+ multiplayer: false # real-time multiplayer
+ online: false # any online features (leaderboards, cloud, telemetry)
+ targets: [PC] # [PC, Mobile, Web, Console]
+ primary_input: "Keyboard/Mouse"
+ gamepad_support: "Full" # Full | Partial | None
+ touch_support: "None" # Full | Partial | None
+ cert_tier: none # none | itch | steam | console
+
+engine:
+ name: "Godot" # Godot | Unity | Unreal — set by /setup-engine
+ version: "4.6"
+ language: "GDScript" # GDScript | C# | C++ | Blueprint
+ rendering: "Forward+"
+ physics: "Jolt"
+
+specialists: # auto-populated by /setup-engine
+ code: "godot-gdscript-specialist"
+ shader: "godot-shader-specialist"
+ ui: "godot-specialist"
+ additional: ["godot-gdextension-specialist"]
+
+naming:
+ classes: PascalCase # PascalCase | snake_case | camelCase
+ variables: snake_case
+ constants: SCREAMING_SNAKE
+ signals: past_tense # past_tense | on_event_name (engine-interpreted)
+ files: snake_case
+ scenes: snake_case
+
+accessibility:
+ target: none # none | standard | aaa
+
+cadence:
+ sprint_length: "2w" # 1w | 2w | 3w | 4w | none
+ milestone_length: "8w" # 4w | 6w | 8w | 12w
+
+performance:
+ target_framerate: 60
+ frame_budget_ms: 16.67
+ draw_call_limit: null
+ memory_ceiling_mb: null
+ enforce: warn # warn | block | off
+
+commands: # simple string OR OS-aware map per command
+ build: "godot --headless --export-debug '<PRESET>'" # your export_presets.cfg name
+ test: "godot --headless --script tests/gdunit4_runner.gd"
+ run: "godot --editor"
+ smoke: "godot --headless --quit-after 5"
+
+features:
+ session_state: on # off | on
+ token_budget_warn_at: 0.7 # 0.0-1.0; warn at this context % usage
+```
+
+And a minimal sparse `project.local.yaml` example — a single developer who wants autonomous mode locally:
+
+```yaml
+modes:
+ automation: autonomous
+features:
+ session_state: on
+```
+
+Only the overridden keys are present; everything else cascades from `project.yaml`.
+See "Local Override Pattern" section for full whitelist of what can/cannot be overridden locally.
diff --git a/.claude/docs/error-recovery-protocol.md b/.claude/docs/error-recovery-protocol.md
new file mode 100644
index 00000000..78f9612f
--- /dev/null
+++ b/.claude/docs/error-recovery-protocol.md
@@ -0,0 +1,59 @@
+# Error Recovery Protocol
+
+Shared procedure for any skill that spawns agents via the `Agent` tool. Referenced from the
+`## Error Recovery Protocol` section of each orchestration/review skill. Those
+skills keep the two load-bearing imperatives (surface immediately, produce a
+partial report) inline, and keep their own **Common blockers** list inline —
+those are skill-specific. This file holds the full four-step procedure.
+
+## Trigger 0 — verify the artifact before reading the response
+
+**Before applying anything below, and before treating a phase as complete: if
+the return contract named a path, check that the path exists.** A named
+artifact that is not on disk is a FAILED PHASE, no matter how the agent's
+response reads.
+
+This trigger exists because the three below are not sufficient. They fire on
+BLOCKED, on an error, and on "cannot complete" — and an agent can fail in a way
+that is none of those. Observed live: a `devops-engineer` spawned
+as half of a parallel phase ran **26 tool calls and ~31,600 tokens**, then
+returned a single fluent preamble — "I'll verify the build infrastructure…" —
+with no path, no summary, no BLOCKED item, and **no file written**. Nothing in
+steps 1–4 matches that shape. An orchestrator reading the transcript sees a
+plausible response and advances, and half a parallel phase disappears with no
+signal at all.
+
+The work was not lost — resumed with an explicit "you did not honour the return
+contract" message, the same agent completed in **one tool call**, because its
+investigation was still in context. Only the write-and-return step had failed.
+So the recovery is cheap; the detection is the hard part, and the detection
+cannot come from reading the response.
+
+**A fluent response is not evidence that a phase ran.** The artifact is —
+observe the artifact, not the transcript. The rule applies to sub-agents
+exactly as it does to skills.
+
+When the path is missing:
+1. Do **not** advance the pipeline or summarise the phase as done.
+2. Resume the agent, naming the unmet contract explicitly and telling it that
+ "I could not write" is a valid answer but silence is not. Prefer resuming
+ over re-spawning — the context is usually still there, and a re-spawn pays
+ for the whole investigation again.
+3. If the second attempt also produces nothing, treat it as BLOCKED and apply
+ steps 1–4 below.
+
+---
+
+If any spawned agent returns BLOCKED, errors, or cannot complete:
+
+1. **Surface immediately** — report "[AgentName]: BLOCKED — [reason]" to the user
+ before continuing to dependent phases.
+2. **Assess dependencies** — check whether the blocked agent's output is required
+ by subsequent phases. If yes, do not proceed past that dependency point without
+ user input.
+3. **Offer options** via `AskUserQuestion`:
+ - Skip this agent and note the gap in the final report
+ - Retry with narrower scope
+ - Stop here and resolve the blocker first
+4. **Always produce a partial report** — output whatever was completed. Never
+ discard work because one agent blocked.
diff --git a/.claude/docs/hooks-reference.md b/.claude/docs/hooks-reference.md
index d3d15b35..777de28c 100644
--- a/.claude/docs/hooks-reference.md
+++ b/.claude/docs/hooks-reference.md
@@ -12,10 +12,54 @@ Hooks are configured in `.claude/settings.json` and fire automatically:
| `pre-compact.sh` | PreCompact | Context compression | Dumps session state (active.md, modified files, WIP design docs) into conversation before compaction so it survives summarization |
| `post-compact.sh` | PostCompact | After compaction | Reminds Claude to restore session state from `active.md` checkpoint |
| `notify.sh` | Notification | Notification event | Shows Windows toast notification via PowerShell |
-| `session-stop.sh` | Stop | Session ends | Summarizes accomplishments and updates session log |
-| `log-agent.sh` | SubagentStart | Agent spawned | Audit trail start — logs subagent invocation with timestamp |
+| `session-stop.sh` | Stop | **Every response ends** — not once per session | Summarizes accomplishments, updates session log, and writes the subagent spawn tally to `production/session-logs/session-cost.md`. Archives `active.md` only when its content hash changed; without that guard a long session appended the whole file on every turn. |
+| `log-agent.sh` | SubagentStart | Agent spawned | Audit trail start — logs subagent invocation with timestamp and session id |
| `log-agent-stop.sh` | SubagentStop | Agent stops | Audit trail stop — completes subagent record |
| `validate-skill-change.sh` | PostToolUse (Write/Edit) | Skill file changes | Advises running `/skill-test` after any `.claude/skills/` file is written or edited |
+### Subagent cost visibility
+
+The three hooks above form one chain. `log-agent.sh` writes a record per spawn
+to `production/session-logs/agent-audit.log` in a fixed three-field shape:
+
+```
+YYYYMMDD_HHMMSS | <session_id> | Agent invoked: <agent_type>
+```
+
+`session-stop.sh` greps the literal string `" | $SESSION_ID | Agent invoked: "`
+to tally the current session, then writes a count plus a per-agent breakdown to
+`production/session-logs/session-cost.md` and echoes a one-line total.
+
+Three constraints that must not be "tidied" later:
+
+- **The field order is load-bearing.** Nothing else parses this log, so a
+ reformat looks free — but it silently zeroes the spawn count rather than
+ erroring.
+- **`session-stop.sh` reads stdin last, on purpose.** Everything above the
+ tally block (notably archiving `active.md`) runs first, so a stdin read that
+ ever blocked would cost only the count, not the state archive.
+- **No session id means no number.** The hook prints nothing rather than a
+ total spanning every session in the log. Silence here is correct; a
+ plausible-but-wrong cost figure is worse than none.
+
+`agent_type` — not `agent_name` — is the field carrying the agent name. See
+`hooks-reference/hook-input-schemas.md`.
+
+## Events considered and deliberately not added
+
+Claude Code offers many more hook events than the eleven above. These were
+evaluated and rejected. Recorded so a future review does not re-propose them
+from the event list alone.
+
+| Event | Why not |
+| ---- | ---- |
+| `UserPromptSubmit` | Would re-inject session state on **every prompt**. `.claude/docs/config-resolution.md` already rejects the weaker version of this — injecting config at session start — because it "would cost tokens on every session whether or not any skill needs config, and it would go stale mid-session as `/settings` writes land". Firing per prompt is the same argument, multiplied. |
+| `ConfigChange` | Fires only for Claude Code's own settings files — user, project, local, policy and skills. It does **not** fire for `project.yaml`, so a hook watching CCGS config here would never run. `FileChanged` is the event that watches arbitrary files. |
+| `FileChanged` on `project.yaml` | Config is resolved per skill invocation, in the skill body, precisely so each run reads fresh values. The only staleness left is text already injected into an earlier invocation, which is the accepted trade in `config-resolution.md`. A warning hook would second-guess a settled decision. |
+| `PreToolUse` `updatedInput` | Could rewrite a non-conventional commit message instead of blocking it. Silently editing the user's input contradicts the collaboration protocol: this project blocks and explains rather than acting unasked. |
+| `PostToolUseFailure` | Would add another log with no reader. This repo has already been bitten by that — `log-agent.sh` wrote per-spawn records nothing consumed until `session-stop.sh` was given the job. |
+| `SessionEnd` | `session-stop.sh` stays on `Stop`. `SessionEnd` fires on termination, which a crash may never reach, and the content-hash guard already makes the per-response firing cheap. |
+| `InstructionsLoaded` | Useful for debugging which CLAUDE.md and rules files actually loaded, but it is a diagnostic, not a project requirement. Wire it in your own `.claude/settings.local.json` when you need it rather than paying for it on every load. |
+
Hook reference documentation: `.claude/docs/hooks-reference/`
Hook input schema documentation: `.claude/docs/hooks-reference/hook-input-schemas.md`
diff --git a/.claude/docs/hooks-reference/hook-input-schemas.md b/.claude/docs/hooks-reference/hook-input-schemas.md
index 55cc27f4..a147ba85 100644
--- a/.claude/docs/hooks-reference/hook-input-schemas.md
+++ b/.claude/docs/hooks-reference/hook-input-schemas.md
@@ -88,7 +88,9 @@ Fired after a tool completes. **Cannot block** (exit code ignored for blocking).
## SubagentStart
-Fired when a subagent is spawned via the Task tool.
+Fired when a subagent is spawned via the `Agent` tool (named `Task` before
+Claude Code 2.1.63; `Task` still works as an alias in permission rules and
+`tools:` frontmatter, but the hook payload's `tool_name` is now `Agent`).
```json
{
diff --git a/.claude/docs/model-tiers.md b/.claude/docs/model-tiers.md
new file mode 100644
index 00000000..6504e9be
--- /dev/null
+++ b/.claude/docs/model-tiers.md
@@ -0,0 +1,55 @@
+# Model Tier Assignment
+
+> ### DECLARED, NOT CURRENTLY APPLIED — skills only
+>
+> **Claude Code reads `model:` from a skill's frontmatter and then serves the
+> skill from the session's model anyway.** This has been measured directly
+> against session transcripts on several Claude Code versions, and held every
+> time. To re-test it on a newer version, run a skill that declares a tier
+> different from the session model and check which model the transcript
+> attributes the skill's turns to.
+>
+> So the skill tiers below are **intent, not behaviour**. Setting one changes
+> nothing today. They are kept because they are correct descriptions of what each
+> skill needs, and because they cost nothing to carry if Claude Code honours them
+> later — but do not budget on them, and never tell a user a tier is saving them
+> money.
+>
+> **This does NOT apply to agents.** `model:` in `.claude/agents/*.md` is a
+> different mechanism, spawned as a separate session rather than executed inline.
+> It has not been measured here, so treat the agent section below as unverified
+> in either direction rather than assuming it behaves the same way.
+
+Skills and agents are assigned tiers by task complexity:
+
+| Tier | Model | When to use |
+|------|-------|-------------|
+| **Haiku** | `claude-haiku-4-5-20251001` | Read-only status checks, formatting, simple lookups — no creative judgment needed |
+| **Sonnet** | `claude-sonnet-5` | Implementation, design authoring, analysis of individual systems — default for most work |
+| **Opus** | `claude-opus-5` | Multi-document synthesis, high-stakes phase gate verdicts, cross-system holistic review |
+
+Skills with `model: haiku` (5): `/help`, `/onboard`, `/project-stage-detect`,
+`/scope-check`, `/sprint-status`
+
+> `/patch-notes` and `/changelog` are `sonnet`, not `haiku`: both produce
+> **player-facing** copy and need judgement the cheapest tier is defined as not
+> doing. Full reasoning in each skill's own header.
+>
+> `/settings` was moved off `haiku` for the same reason. It does not only read
+> and format — it resolves every leaf with provenance and then compares the
+> configured rigor against the project's observable working practice. That is
+> synthesis, which is what the Haiku row is defined as excluding.
+
+Skills with `model: opus` (3): `/architecture-review`, `/gate-check`, `/review-all-gdds`
+
+All other skills are Sonnet. When creating a new skill, assign Haiku if it only
+reads and formats; assign Opus if it must synthesize 5+ documents with
+high-stakes output; otherwise write `model: sonnet` explicitly. Every skill in
+this repo declares a tier, and the lists above are kept in step with what the
+`SKILL.md` files declare. That is a check on two descriptions agreeing; it
+proves nothing about which model actually runs.
+
+**Agent model tiers.** Orchestrator-spawned agents (`team-*`, `/review-all-gdds`)
+use `model: inherit` so a fixed smaller model can't overflow when the parent runs
+a large-context tier. Directors stay `opus`, `community-manager`/`devops-engineer`
+stay `haiku`, and non-orchestrator agents stay pinned at `sonnet` as a floor.
diff --git a/.claude/docs/quick-start.md b/.claude/docs/quick-start.md
index 519f5c54..625728da 100644
--- a/.claude/docs/quick-start.md
+++ b/.claude/docs/quick-start.md
@@ -189,12 +189,6 @@ Templates are in `.claude/docs/templates/`:
- `difficulty-curve.md` -- for difficulty axes, onboarding ramp, and cross-system interactions
- `test-evidence.md` -- template for recording manual test evidence (screenshots, walkthrough notes)
-Also in `.claude/docs/templates/collaborative-protocols/` (used by agents, not typically edited directly):
-
-- `design-agent-protocol.md` -- question-options-draft-approval cycle for design agents
-- `implementation-agent-protocol.md` -- story pickup through /story-done cycle for programming agents
-- `leadership-agent-protocol.md` -- cross-department delegation and escalation for director-tier agents
-
### 5. Follow the Coordination Rules
1. Work flows down the hierarchy: Directors -> Leads -> Specialists
@@ -218,8 +212,8 @@ If you already know what you need, jump directly to the relevant path:
- Produces a game concept document and recommends an engine
2. **Set up the engine** — Run `/setup-engine` (uses the brainstorm recommendation)
- Configures CLAUDE.md, detects knowledge gaps, populates reference docs
- - Creates `.claude/docs/technical-preferences.md` with naming conventions,
- performance budgets, and engine-specific defaults
+ - Writes engine, naming conventions, and performance budgets to `project.yaml`
+ (the source of truth), mirrored to `.claude/docs/technical-preferences.md`
- If the engine version is newer than the LLM's training data, it fetches
current docs from the web so agents suggest correct APIs
3. **Validate the concept** — Run `/design-review design/gdd/game-concept.md`
@@ -271,15 +265,16 @@ If you have design docs, prototypes, or code already:
```
CLAUDE.md -- Master config (read this first, ~60 lines)
+project.yaml -- Machine-readable project config (engine, modes, stage) — source of truth
.claude/
settings.json -- Claude Code hooks and project settings
agents/ -- 49 agent definitions (YAML frontmatter)
- skills/ -- 73 slash command definitions (YAML frontmatter)
- hooks/ -- 12 hook scripts (.sh) wired by settings.json
+ skills/ -- 74 slash command definitions (YAML frontmatter)
+ hooks/ -- 12 event hooks (.sh, wired by settings.json) + yaml-helper.sh
rules/ -- 11 path-specific rule files
docs/
quick-start.md -- This file
- technical-preferences.md -- Project-specific standards (populated by /setup-engine)
+ technical-preferences.md -- Legacy fallback for project.yaml config (mirror; see project.yaml at repo root)
coding-standards.md -- Coding and design doc standards
coordination-rules.md -- Agent coordination rules
context-management.md -- Context budgets and compaction instructions
@@ -287,5 +282,6 @@ CLAUDE.md -- Master config (read this first, ~60 lines)
workflow-catalog.yaml -- 7-phase pipeline definition (read by /help)
setup-requirements.md -- System prerequisites (Git Bash, jq, Python)
settings-local-template.md -- Personal settings.local.json guide
- templates/ -- 41 document templates
+ CLAUDE-local-template.md -- Personal CLAUDE.local.md guide (gitignored overrides)
+ templates/ -- 38 document templates (+ per-section guidance)
```
diff --git a/.claude/docs/review-workflow.md b/.claude/docs/review-workflow.md
deleted file mode 100644
index ef762a07..00000000
--- a/.claude/docs/review-workflow.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Review Workflow
-
-1. Code changes require review by the relevant department lead agent
-2. Design changes require sign-off from `game-designer` and `creative-director`
-3. Architecture changes require sign-off from `technical-director`
-4. Cross-domain changes require sign-off from `producer`
diff --git a/.claude/docs/rules-reference.md b/.claude/docs/rules-reference.md
index 7fb78635..9a527812 100644
--- a/.claude/docs/rules-reference.md
+++ b/.claude/docs/rules-reference.md
@@ -1,6 +1,33 @@
# Path-Specific Rules
-Rules in `.claude/rules/` are automatically enforced when editing files in matching paths:
+Rules in `.claude/rules/` carry `paths:` frontmatter. Claude Code loads a
+path-scoped rule **when it READS a file matching one of those globs** — not on
+every tool use, and not when it creates one.
+
+Three consequences, and none of them are optional reading:
+
+1. **Reading, not editing.** A rule scoped to `src/gameplay/**` reaches the model
+ when a file there is opened. An agent that writes a brand-new file in that
+ directory without opening an existing one never sees it. Most work in this
+ framework creates files rather than reads them, so this is the common case,
+ not the corner case.
+2. **Context, not enforcement.** A loaded rule is guidance the model weighs, the
+ same as `CLAUDE.md`. Anything that must hold regardless of what the model
+ decides belongs in a hook — `.claude/hooks/` already enforces JSON validity
+ and commit shape that way.
+3. **A rule with no `paths:` loads every session**, at the same priority as
+ `.claude/CLAUDE.md`. That is the lever for a rule that must always apply; it
+ costs context in every session, so it is a deliberate trade, not a default.
+
+Where a rule duplicates guidance an agent definition already carries, the two
+must agree. Contradicting instructions are resolved arbitrarily, so a rule and
+an agent stating different versions of the same standard is worse than either
+alone.
+
+To see which rules actually load, and why, wire the `InstructionsLoaded` hook —
+`.claude/hooks/log-instructions.sh` records every instruction file and its load
+reason (`session_start`, `path_glob_match`, `nested_traversal`, `compact`) to
+`production/session-logs/instructions-loaded.log`.
| Rule File | Path Pattern | Enforces |
| ---- | ---- | ---- |
@@ -15,3 +42,12 @@ Rules in `.claude/rules/` are automatically enforced when editing files in match
| `test-standards.md` | `tests/**` | Test naming, coverage requirements, fixture patterns |
| `prototype-code.md` | `prototypes/**` | Relaxed standards, README required, hypothesis documented |
| `shader-code.md` | `assets/shaders/**` | Naming conventions, performance targets, cross-platform rules |
+| `agent-memory.md` | `.claude/agent-memory/**` | The one place an agent may write unasked — and why a temporary absence must never be recorded as a durable fact |
+| `skill-authoring.md` | `.claude/skills/**`, `.claude/agents/**` | A check that cannot report it did not run is not a check — verdict vocabularies, fail-closed defaults, self-announcing skips, sourcing, derived gate coverage |
+
+> **`skill-authoring.md` is the odd one out and deliberately so.** Every other
+> rule here scopes a *game* directory; that one scopes the **framework's own**
+> authoring paths. It exists because one failure shape kept recurring across
+> unrelated subsystems — a step that could not run producing output
+> indistinguishable from a step that ran and found nothing. The same mistake in
+> nine places is a missing design rule, not nine mistakes.
diff --git a/.claude/docs/run-and-observe.md b/.claude/docs/run-and-observe.md
new file mode 100644
index 00000000..a478248a
--- /dev/null
+++ b/.claude/docs/run-and-observe.md
@@ -0,0 +1,178 @@
+# Run and Observe
+
+Shared procedure for any skill that closes a story which changes something a
+player can see. Referenced from the point of use in `/dev-story` (Phase 6) and
+`/story-done` (Phase 3). Those skills keep the one load-bearing imperative
+inline — **a parse check is not a run, and a story nobody looked at does not
+close** — and cite this file for how to look.
+
+`.claude/docs/coding-standards.md` is the authority for *what* evidence a story
+needs. This file is the procedure for *producing* the visual half of it.
+
+## The rule
+
+Every story that changes something player-observable is **launched and observed
+before it closes**, and the observation is a **retained screenshot** in
+`production/qa/evidence/`. Compiling proves the code loads. Tests prove the
+logic. Neither proves the text fits in the box.
+
+The agent can see images: Claude Code's `Read` tool renders a PNG. The whole
+problem is getting a picture out of the engine unattended, and every supported
+engine has a native way.
+
+## The procedure
+
+1. **Launch windowed** at a fixed resolution — `1280x720` unless the project
+ says otherwise — using `commands.run` from `project.yaml`. Never the
+ headless / batch / null-RHI flag: those exist to *skip* rendering.
+2. **Launch straight into the scene or map the story touched.** A feature that
+ is only reachable through the main menu and three clicks is a feature the
+ run will not reach. Stories should be written so their surface is reachable
+ from a launch argument (a scene path, a map URL, a `--scene` flag).
+3. **Wait, capture, quit.** Let the engine render real frames — 60 is a safe
+ floor — capture one, and exit. Each engine's mechanism is below.
+4. **Look.** `Read` the PNG. Compare what is on screen to the acceptance
+ criteria. Clipped text, an overflowing panel, a missing element, the wrong
+ colour — these are defects, and this is the only step that finds them.
+5. **Retain.** Copy the image to
+ `production/qa/evidence/[story-slug]/[NN]-[what-it-shows].png` and reference
+ it from the evidence doc. A screenshot that was taken and discarded is an
+ assertion, not evidence.
+6. **Report** one `Run result:` line in the implementation summary — vocabulary
+ below.
+
+## Per engine
+
+| `engine.name` | Launch | Capture | Output lands in | Never use | Scaffold needed |
+|---|---|---|---|---|---|
+| Godot 4 | `godot --path . --windowed --resolution 1280x720 <scene>.tscn` | `--write-movie <path>.png --quit-after <N>` | beside the given path, `<name>00000000.png` … | `--headless` | **none** |
+| Unity 6 | built player `.exe -screen-width 1280 -screen-height 720 -screen-fullscreen 0 --scene <Name>` | `ScreenCapture.CaptureScreenshot(<abs path>)` from a bootstrap script | the absolute path you pass | `-batchmode`, `-nographics` | one MonoBehaviour |
+| Unreal 5 | `MSYS_NO_PATHCONV=1 UnrealEditor.exe <Game>.uproject <MapURL> -game -windowed -ResX=1280 -ResY=720` | `HighResShot filename=<path>` console command | `Saved/Screenshots/Windows/` | `-nullrhi`, `-unattended` alone | one actor or `-ExecCmds` |
+
+### Godot 4 — zero scaffold
+
+```
+godot --path . --windowed --resolution 1280x720 --write-movie shots/shop.png --quit-after 60 res://scenes/shop.tscn
+```
+
+`--write-movie` is Movie Maker mode: with a `.png` target it writes a frame
+sequence and `--quit-after` sets the frame count. Filenames carry **8**
+zero-padded digits — `shop00000000.png` through `shop00000059.png` — so take the
+last. `--fixed-fps` is applied automatically. The scene path is positional; any
+`.tscn` can be launched directly, which is how step 2 is satisfied.
+
+Capture-on-trigger alternative, for a state a scene launch cannot reach: an
+autoload that on the wanted condition does
+`await RenderingServer.frame_post_draw`, then
+`get_viewport().get_texture().get_image().save_png(path)`, then
+`get_tree().quit()`.
+
+### Unity 6 — one MonoBehaviour
+
+`-batchmode` displays nothing, so the run is either the **built player** or the
+editor in play mode. The player is the robust path:
+
+```
+Builds/Win64/Game.exe -screen-width 1280 -screen-height 720 -screen-fullscreen 0 --scene Shop --screenshot C:/abs/path/shop.png --after 60
+```
+
+`-screen-*` are Unity's own player arguments. `--scene`, `--screenshot` and
+`--after` are **yours**: a `ScreenshotOnArg` MonoBehaviour in the bootstrap
+scene parses `System.Environment.GetCommandLineArgs()`, loads `--scene`, waits
+`--after` frames, calls `ScreenCapture.CaptureScreenshot(path)`, waits one more
+frame, then `Application.Quit()`. Pass an **absolute** path — the relative base
+differs between editor and player. `CaptureScreenshot` captures the last frame
+*presented*, so it must run after at least one rendered frame.
+
+`/test-setup` scaffolds this script under the code root. Building the player
+first costs 1–3 minutes on a small project; that is the price of looking at
+the thing you ship rather than the editor.
+
+### Unreal 5 — one actor, or `-ExecCmds`
+
+```
+MSYS_NO_PATHCONV=1 UnrealEditor.exe Game.uproject /Game/Maps/Shop -game -windowed -ResX=1280 -ResY=720
+```
+
+`-game` runs standalone without the editor UI. The map is a **positional URL
+immediately after the `.uproject`** — not a console command. **The
+`MSYS_NO_PATHCONV=1` prefix is required on Windows:** Claude Code runs commands
+in Git Bash, which rewrites any argument beginning with `/` as a Windows path, so
+`/Game/Maps/Shop` reaches the engine as `C:/Program Files/Git/Game/Maps/Shop`
+and the game stops on a "map not found" dialog nobody can see. Alternatively
+pass the map through `-ExecCmds="open /Game/Maps/Shop"`, which is not converted. Capture is the
+`HighResShot` console command, fired either from a dev actor (`Execute Console
+Command` on BeginPlay after a short delay, then `quit`) or from the launch line:
+
+```
+-ExecCmds="HighResShot filename=C:/abs/path/shop.png,Quit"
+```
+
+`-ExecCmds` is comma-separated. Output defaults to `Saved/Screenshots/Windows/`.
+**Do not `Quit` on the same frame as the request** — the file flushes late and
+an immediate quit can leave nothing on disk; a one-second delay before `quit`
+is enough. The Blueprint node `Take High Res Screenshot` is editor-only and
+does not work in a `-game` launch.
+
+### Any engine — OS capture fallback
+
+On Windows, PowerShell with `System.Drawing` can `CopyFromScreen` into a bitmap
+and save it. It needs a visible desktop and the game window on top, and it
+captures whatever is there — it cannot be told "the shop panel". Use it when the
+engine-native path is unavailable, and say so in the run result. Linux CI with
+no display needs `xvfb-run` in front of the launch; `--headless` is not a
+substitute.
+
+## The `Run result:` line
+
+Exactly one of three shapes, in the implementation summary:
+
+- **`Run result: OBSERVED — <what was on screen, one line>`** with the retained
+ path. *"Shop panel renders, all 6 slots inside the frame, prices legible at
+ 720p — `production/qa/evidence/shop-panel/01-shop-open.png`."*
+- **`Run result: NOT VERIFIED — <reason>`**. Engine binary not found,
+ `commands.run` unset, launch crashed, screenshot empty. This is a **blocker**
+ at the default gate level for Visual/Feel and UI stories, not a note — a
+ story nobody looked at does not close. Under an explicit
+ `testing.strict.visual`/`.ui: false` it is recorded and the story may close
+ with the gap in `## Completion Notes`.
+- **`Run result: N/A — <reason>`**, only for a story with genuinely nothing
+ observable — a pure data migration, a save-format change with no surface.
+ Say why. "It's a Logic story" is not a reason: a damage formula has a number
+ on screen somewhere.
+
+The run is **not waived at `qa.level: minimal`**. Tests are waived there; the
+look is not. It is the cheapest verification in the pipeline and the one
+whose absence produces a well-tested game that looks wrong.
+
+## What a still can and cannot show
+
+**Can:** layout, clipping, overflow, presence, alignment, colour, legibility,
+that the right screen appeared at all. This is where shipped visual defects
+actually live.
+
+**Cannot:** timing, responsiveness, weight, animation curves, audio sync — the
+"feel" half of Visual/Feel. Godot's `--write-movie` gives a frame sequence; the
+other engines need OS video capture. Feel stays a human check in `/team-qa`.
+Say which half the screenshot covered.
+
+## Reaching the state
+
+A screenshot of the title screen verifies nothing about depth 2. Either launch
+the scene/map directly (Godot scene arg, Unreal map URL, Unity `--scene`) or
+give the bootstrap a debug argument that sets state (`--gold=500 --depth=2`).
+Write stories so their surface is reachable one of those ways; a story that is
+not is a story that will be marked `NOT VERIFIED` every time.
+
+## Finding the engine
+
+None of the three engines installs onto `PATH` on Windows. `engine.path` in
+`project.yaml` is where the editor lives; resolve it before concluding "no
+engine on this machine". Absence of a path is not absence of an engine.
+
+---
+
+*Commands and APIs above verified against the official Godot 4.7, Unity 6.3 LTS
+and Unreal 5.8 references on 2026-09-14. `docs/engine-reference/<engine>/` is
+the project's pinned authority; check it before trusting a version-qualified
+claim here.*
diff --git a/.claude/docs/settings-guidance.md b/.claude/docs/settings-guidance.md
new file mode 100644
index 00000000..9c336e58
--- /dev/null
+++ b/.claude/docs/settings-guidance.md
@@ -0,0 +1,120 @@
+# Settings Guidance — which value to recommend, and when
+
+The **advisory** layer for project settings. This doc answers two questions no
+other doc does:
+
+1. **Which value should a skill recommend** for a given project or user?
+2. **When should a skill proactively suggest changing** a setting already set?
+
+## Boundary with its siblings — do not duplicate their content here
+
+| Doc | Answers | Nature |
+|---|---|---|
+| `effects-map.md` | What each setting *does* | Descriptive |
+| `config-resolution.md` | How a setting *resolves* (precedence chain) | Mechanical |
+| **`settings-guidance.md`** (this file) | Which value to *recommend*, and *when* | Prescriptive |
+
+Skills reference this doc **on demand**, only at a "recommend a setting" moment.
+It is deliberately **not** a CLAUDE.md import — advisory content must not ride in
+per-turn context (the same reason `context-management.md` was demoted).
+
+---
+
+## 1. The knob that matters most: `modes.rigor`
+
+Almost every "what settings should I use?" question reduces to one choice:
+`modes.rigor` (`minimal` | `standard` | `full`, default `minimal`). It fronts six
+sub-knobs — `modes.workflow`, `docs.density`, `qa.level`, `modes.story_granularity`,
+`modes.review_mode`, `team.size`. Recommend **rigor**, not the six; let the
+expansion do the rest. Full expansion table lives in `effects-map.md § modes.rigor`
+— do not restate it here.
+
+`modes.automation` (`collaborative` | `guided` | `autonomous`) is a **separate
+axis** — how often skills stop to confirm — and is *not* fronted by rigor. Pick it
+by working style, not by game type (see § 5).
+
+---
+
+## 2. Archetype → rigor presets
+
+Match the project to an archetype; recommend the paired rigor. These are starting
+points, not verdicts — the user can always override.
+
+| Archetype | Rigor | Why | Common override |
+|---|---|---|---|
+| Weekend jam / prototype / throwaway | `minimal` | Shipping beats recording; design lives in the maker's head | Bump one deep system: `workflow_overrides.system_overrides: {combat: full}` |
+| Small solo / hobby game (arcade, puzzle, short narrative) | `minimal` → `standard` if it grows | Start light; add rigor when scope proves real | — |
+| Focused commercial indie (platformer, roguelike, tactics, deckbuilder) | `standard` *(default)* | One well-understood loop; enough design to build correctly | "Comprehensive but compact": `rigor: full` + `docs.density: terse` |
+| Systems-heavy / long-haul (open-world RPG, colony sim, immersive sim, 4X, survival) | `full` | Many interacting systems; a design mistake costs weeks | Solo dev: keep `full` on disk, set `review_mode: solo` locally |
+| Live-service / competitive multiplayer | `full` + domain emphasis | Full pipeline *plus* netcode/security/live-ops | Raise `qa.level` / `testing.strict.*` for the online-critical types |
+
+**The model:** the table picks a baseline; overrides handle the diagonal. Most real
+projects are one baseline plus one or two deliberate exceptions.
+
+---
+
+## 3. Seeding rigor from a described concept
+
+When the user has described their game (e.g. `/start` Phase 2 free text), map it to
+an archetype and **pre-select** the recommendation rather than asking cold. Signals:
+
+| Concept mentions… | Lean toward |
+|---|---|
+| open-world, RPG, sim, sandbox, faction, crafting, economy, MMO, multiplayer, "systems" | `full` |
+| jam, weekend, prototype, "first game", small, "just trying", experiment | `minimal` |
+| "release", "commercial", "on Steam", a single clear core loop | `standard` |
+| *ambiguous / nothing above* | `standard` (the documented default) |
+
+**Rules:** these are heuristics, never locks. Always confirm the pre-selection with
+the user in their own terms ("Sounds like a big systems game — I'd suggest `full`
+rigor; want that?"). If the user has **no concept yet** (exploring), do not seed
+`full` — default `minimal`, and revisit once a concept exists.
+
+"No concept yet" means **no signal**, not a particular onboarding path. A rough
+one-line hint is still a description: if it trips the signals above, seed from the
+signal. Only fall back to `minimal`-for-exploring when the user has given you
+nothing to map. (`/start` Phase 3d states the same rule for its Path A/B branch —
+the two must agree, since both drive the identical recommendation.)
+
+---
+
+## 4. When to recommend a *change* (adaptive triggers)
+
+Bidirectional and **threshold-based**. Fire only on a threshold *crossing*, never
+every session — that is what keeps this from becoming the nagging the `automation`
+modes exist to eliminate.
+
+| Trigger (crossing) | Direction | Detectable signal | Suggested action |
+|---|---|---|---|
+| Project grew past its band | ↑ raise | System-GDD count crosses ~9, or `src/` crosses the Production threshold, while rigor is `minimal` | "You're at N systems on `rigor: minimal` — most projects this size run `standard`. Revisit? → `/settings`" |
+| Stage advanced into Production | ↑ raise | `/gate-check` PASS into Production while rigor is `minimal` | Same, offered once at the gate |
+| User sounds overwhelmed by process | ↓ lower | Phrases like "too many steps", "so much documentation", "overwhelmed" — *and* rigor is not already `minimal` | "If the required-doc list feels heavy, a lower rigor trims it → `/settings modes.rigor=standard`" |
+| Chosen rigor mismatches described scope | flag once | Onboarding pick contradicts the Phase-2 description | State it in one sentence, offer `/settings`, do not re-ask |
+
+**Frequency guard:** the crossing *is* the gate. Because the hosts (`/gate-check` on
+PASS, `/help` on request) are themselves infrequent, no persistent "already nudged"
+state is needed — but never emit the same suggestion twice in one session.
+
+---
+
+## 5. Which skills reference this doc, and when
+
+| Skill | Moment | Sections used |
+|---|---|---|
+| `/start` | Phase 3d/4 — choosing rigor | § 2 (presets), § 3 (seed from concept) |
+| `/help` | escalation footer when user sounds stuck/overwhelmed | § 4 (lower trigger) |
+| `/gate-check` | on PASS into a new stage | § 4 (raise trigger) |
+| `/settings` | view output — further reading | § 2 (choosing a value) |
+
+Each skill carries a **one-line pointer** to this doc, not a copy of its tables.
+
+---
+
+## 6. How to phrase a recommendation
+
+- **Recommend, don't dictate.** State the suggestion and the reason in one line;
+ the user decides. (`collaborative`/`guided` require this; even `autonomous`
+ treats a rigor change as a `schema_changes` decision and asks.)
+- **Always route to `/settings`** — never edit `project.yaml` as a side effect of a
+ recommendation.
+- **One line, then stop.** A nudge is a nudge, not a lecture.
diff --git a/.claude/docs/setup-requirements.md b/.claude/docs/setup-requirements.md
index 02413992..42921d5d 100644
--- a/.claude/docs/setup-requirements.md
+++ b/.claude/docs/setup-requirements.md
@@ -72,6 +72,37 @@ python3 --version # Should show python version (optional)
| **Python 3** | JSON data file validation in commit and asset hooks is skipped. Invalid JSON can be committed without warning. |
| **Both** | All hooks still execute without error (exit 0) but provide no validation. You're flying without safety nets. |
+## Optional Performance Settings
+
+CCGS deliberately ships **no** values for the settings below. Each one's best
+value depends on your machine, your Claude plan and how you work, so a value
+committed here would be a guess every user inherits without noticing. Set the
+ones you want in `.claude/settings.local.json`, which is gitignored and yours
+alone.
+
+| Setting | What it does | When to change it |
+| ---- | ---- | ---- |
+| `promptCacheTtl` | How long the main conversation's prompt cache lives. | Raise it if you work in long sessions with gaps; the cache surviving a break avoids re-sending context. |
+| `subagentPromptCacheTtl` | The same, for subagents and other off-conversation requests. | Worth raising on a 49-agent project like this one, where `team-*` skills spawn repeatedly. |
+| `autoCompactWindow` | How full the context gets before Claude Code compacts it. | Lower it if compaction keeps surprising you mid-task; raise it if you would rather compact less often and keep more history. |
+| `skillListingBudgetFraction` | How much context the skill listing may occupy. | CCGS ships 74 skills, so the listing is not small. Lower it if you want more room for work; `skillListingMaxDescChars` trims each description instead. |
+
+`sandbox.enabled` isolates shell commands from your filesystem and network. It
+is worth turning on, but it runs on **macOS, Linux and WSL2 only** — it is not
+available on native Windows, which is CCGS's primary platform.
+
+### One setting CCGS does ship
+
+`permissions.defaultMode` is set to `default` in `.claude/settings.json`, on
+purpose. It makes Claude Code ask before acting, which is what every approval
+gate in this framework depends on. Project settings outrank personal ones, so
+this holds even if your own config sets `acceptEdits` or `auto` — otherwise
+CCGS's collaboration protocol would be silently switched off for you and the
+agents would write files you never approved.
+
+If you genuinely want it off, override it in `.claude/settings.local.json`,
+which takes precedence. Understand what you are turning off first.
+
## Recommended IDE
Claude Code works with any editor, but the template is optimized for:
diff --git a/.claude/docs/skills-reference.md b/.claude/docs/skills-reference.md
index 5b072f68..d7a419e7 100644
--- a/.claude/docs/skills-reference.md
+++ b/.claude/docs/skills-reference.md
@@ -136,3 +136,23 @@ Coordinate multiple agents on a single feature area:
| `/team-level` | level-designer + narrative-director + world-builder + art-director + systems-designer + qa-tester |
| `/team-live-ops` | live-ops-designer + economy-designer + community-manager + analytics-engineer |
| `/team-qa` | qa-lead + qa-tester + gameplay-programmer + producer |
+
+## Overlap with Claude Code's bundled skills
+
+Claude Code ships its own skills, and one name collides with CCGS's.
+
+| You type | You get | Use it for |
+|---------|---------|-----------|
+| `/code-review` | **CCGS's** — project skills take the bare name | Architectural review against this project's coding standards, SOLID, testability and the control manifest. Knows about ADRs, stories and `docs/architecture/`. |
+| `/code-review:code-review` | **Claude Code's bundled** review | Reviewing a pull request or a plain diff, with no knowledge of CCGS's design documents or gates. |
+
+Both are useful; they answer different questions. Reach for the CCGS one during
+`/dev-story` and before `/story-done`, because it checks the things the gates
+later check. Reach for the bundled one when you want a general review of a diff
+that has nothing to do with a story.
+
+CCGS does **not** turn the bundled skills off. `disableBundledSkills` would
+remove all of them, including `/debug`, `/security-review` and `/simplify`,
+which are worth keeping. If you want a bundled skill hidden, use
+`skillOverrides` in your own `.claude/settings.local.json` rather than disabling
+the whole set.
diff --git a/.claude/docs/technical-preferences.md b/.claude/docs/technical-preferences.md
index 94a91fbb..40565804 100644
--- a/.claude/docs/technical-preferences.md
+++ b/.claude/docs/technical-preferences.md
@@ -1,7 +1,12 @@
# Technical Preferences
-<!-- Populated by /setup-engine. Updated as the user makes decisions throughout development. -->
-<!-- All agents reference this file for project-specific standards and conventions. -->
+<!-- project.yaml at the repo root is the machine-readable source of truth for
+ engine, specialists, naming, performance, platform, and testing.framework.
+ This file is the human-readable LEGACY FALLBACK: agents and skills resolve
+ each key from project.yaml first and fall back here only when the
+ project.yaml key is absent. /setup-engine dual-writes both.
+ Forbidden patterns and allowed libraries are NOT migrated — they live only
+ in this file. Populated by /setup-engine; updated as decisions are made. -->
## Engine & Language
diff --git a/.claude/docs/templates/SKILL-CONTRACT-TEMPLATE.md b/.claude/docs/templates/SKILL-CONTRACT-TEMPLATE.md
new file mode 100644
index 00000000..3577913f
--- /dev/null
+++ b/.claude/docs/templates/SKILL-CONTRACT-TEMPLATE.md
@@ -0,0 +1,520 @@
+# Skill Contract Template
+
+> **Status — read before using this template.**
+>
+> The **Identity & Scope**, **Input Contract**, **Output Contract**, **Hard/Soft
+> Constraints** and **Handoff Configuration** sections are live and reflect how
+> contracts are authored today.
+>
+> The **Testing Evidence Required** and **Drift Monitoring** sections are
+> **aspirational** — the runners they name (`tests/smoke-tests/`,
+> `tests/golden-datasets/`, `tests/behavioral-tests/`, `tests/integration/`) and
+> `production/session-state/drift-monitor.md` do **not exist**, no skill has a
+> `TESTS.md`, and none of the seven shipped `CONTRACT.md` files use the ASI or
+> drift machinery. Treat them as a design sketch for a future skill-quality
+> system, not as steps to follow.
+>
+> The seven shipped contracts use a simpler shape than this template:
+> `Inputs Consumed` / `Files That Must Exist` / `Preconditions` /
+> `Outputs Produced` / `Output Guarantees` / `Immutability Rules`. Match an
+> existing contract (e.g. `.claude/skills/dev-story/CONTRACT.md`) rather than
+> this template's schema-heavy form until the two are reconciled.
+
+**Purpose:** Define formal handoff contract for a skill. Create as `.claude/skills/<skill-name>/CONTRACT.md`.
+
+**How to Use:**
+1. Copy this template
+2. Replace `[SKILL_NAME]`, `[ROLE]`, `[DESCRIPTION]` with your skill's details
+3. Define input/output schemas precisely
+4. List hard constraints (must never violate) and soft constraints (recover if violated)
+5. Include examples of valid input/output
+6. Reference this contract in your SKILL.md file
+
+---
+
+# [SKILL_NAME] Handoff Contract
+
+**Version:** 1.0
+**Last Updated:** [DATE]
+**Skill File:** `.claude/skills/[SKILL_NAME]/SKILL.md`
+**Test File:** `.claude/skills/[SKILL_NAME]/TESTS.md`
+
+---
+
+## Identity & Scope
+
+### Role
+[ROLE] — [ONE SENTENCE DESCRIBING WHAT THIS SKILL DOES]
+
+### Example
+Story Author — Decomposes game design epics into atomic, testable user stories with clear acceptance criteria.
+
+### Domain Boundaries
+**Can Read:**
+- `design/gdd/` (game design documents)
+- `.claude/docs/` (architectural guidance)
+- `production/session-state/` (context from previous skills)
+
+**Can Write:**
+- `production/epics/[epic-slug]/` (creates new story markdown files)
+- `production/qa/evidence/` (creates test evidence stubs)
+
+**Cannot Touch:**
+- `src/` (no game code)
+- `assets/` (no asset modifications)
+- Source data files (read-only)
+
+---
+
+## Input Contract
+
+### What This Skill Receives
+
+**Source Skill:** [PREVIOUS_SKILL_NAME] (e.g., `/create-epics`)
+**Format:** Markdown with structured frontmatter
+**Transport:** Session context or file reference
+
+### Required Fields
+
+```yaml
+# Example input epic (YAML frontmatter in Markdown)
+epic_id: "COMBAT-BASIC"
+epic_goal: "Implement core melee attack system"
+epic_acceptance_criteria:
+ - "Player can attack with sword"
+ - "Damage is configurable"
+ - "Animation plays on hit"
+ - "Enemy health updates"
+target_complexity: "medium" # low | medium | high
+estimated_story_count: 3
+```
+
+### Schema Definition
+
+```json
+{
+ "type": "object",
+ "required": ["epic_id", "epic_goal", "epic_acceptance_criteria", "target_complexity"],
+ "properties": {
+ "epic_id": {
+ "type": "string",
+ "pattern": "^[A-Z]+(-[A-Z0-9]+)?$",
+ "minLength": 2,
+ "maxLength": 50
+ },
+ "epic_goal": {
+ "type": "string",
+ "minLength": 10,
+ "maxLength": 500,
+ "description": "High-level objective, not implementation"
+ },
+ "epic_acceptance_criteria": {
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 20,
+ "items": {
+ "type": "string",
+ "minLength": 5,
+ "maxLength": 200
+ }
+ },
+ "target_complexity": {
+ "type": "string",
+ "enum": ["low", "medium", "high"]
+ },
+ "estimated_story_count": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 50
+ }
+ }
+}
+```
+
+### Validation Rules
+
+- [ ] Epic ID matches pattern `^[A-Z]+-[A-Z0-9]+$` (e.g., `COMBAT-BASIC`)
+- [ ] Epic goal is 10–500 characters (not too brief, not a novel)
+- [ ] At least 1, at most 20 acceptance criteria
+- [ ] Target complexity is one of: `low`, `medium`, `high`
+- [ ] If estimated story count provided, >= 1 and <= 50
+
+### Examples of Valid Input
+
+```markdown
+## Valid Example 1: Simple Epic
+
+epic_id: COMBAT-BASIC
+epic_goal: Implement core melee attack system
+epic_acceptance_criteria:
+ - Player can attack with sword
+ - Damage is configurable from external data
+ - Attack animation plays when action triggered
+ - Target health decreases by damage amount
+target_complexity: medium
+estimated_story_count: 3
+```
+
+```markdown
+## Valid Example 2: Large Epic
+
+epic_id: PROGRESSION-FULL
+epic_goal: Implement complete character progression system
+epic_acceptance_criteria:
+ - Player gains experience from defeated enemies
+ - Experience unlocks new abilities
+ - Player can level up manually
+ - Leveling resets some cooldowns
+ - New abilities appear in player menu
+target_complexity: high
+estimated_story_count: 12
+```
+
+---
+
+## Output Contract
+
+### What This Skill Produces
+
+**Destination Skill:** [NEXT_SKILL_NAME] (e.g., `/dev-story`)
+**Format:** Markdown with structured headers
+**Location:** Typically written to `production/epics/[epic-slug]/story-NNN-[slug].md`
+
+### Output Structure
+
+```markdown
+# Stories for [EPIC_ID]
+
+## [STORY_ID]: [STORY_TITLE]
+
+### Description
+[1-3 paragraph description of the user story, written from player/user perspective]
+
+### Acceptance Criteria
+1. [Testable criterion 1 — imperative mood, specific observable behavior]
+2. [Testable criterion 2]
+3. [Testable criterion 3]
+4. [Optional: criterion 4+, up to 5 per story]
+
+### Complexity Estimate
+[low | medium | high]
+
+### Dependencies
+[List other stories that should complete first, if any. Format: "EPIC_ID-N"]
+
+---
+## [STORY_ID+1]: [NEXT_STORY_TITLE]
+...
+```
+
+### Schema Definition
+
+```json
+{
+ "type": "object",
+ "required": ["stories"],
+ "properties": {
+ "epic_id": { "type": "string" },
+ "stories": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "required": ["story_id", "title", "description", "acceptance_criteria"],
+ "properties": {
+ "story_id": {
+ "type": "string",
+ "pattern": "^[A-Z]+-[A-Z0-9]+-[0-9]+$",
+ "description": "Format: EPIC-ID-N"
+ },
+ "title": {
+ "type": "string",
+ "minLength": 5,
+ "maxLength": 100,
+ "description": "User-centric; action-oriented"
+ },
+ "description": {
+ "type": "string",
+ "minLength": 20,
+ "maxLength": 1000,
+ "description": "1-3 paragraphs, player perspective"
+ },
+ "acceptance_criteria": {
+ "type": "array",
+ "minItems": 3,
+ "maxItems": 5,
+ "items": {
+ "type": "string",
+ "minLength": 10,
+ "maxLength": 200,
+ "description": "Testable, imperative mood"
+ }
+ },
+ "complexity_estimate": {
+ "type": "string",
+ "enum": ["low", "medium", "high"]
+ },
+ "dependencies": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "Story IDs that should complete first"
+ }
+ }
+ }
+ }
+ }
+}
+```
+
+### Validation Rules
+
+- [ ] Each story has unique story ID matching pattern `^[A-Z]+-[A-Z0-9]+-[0-9]+$`
+- [ ] Story IDs are sequential by epic (e.g., `COMBAT-BASIC-1`, `COMBAT-BASIC-2`, etc.)
+- [ ] Story count matches epic estimate ± 1 (e.g., if epic estimated 3, produce 2–4)
+- [ ] Each story has ≥3 and ≤5 acceptance criteria
+- [ ] Acceptance criteria are in imperative mood ("Player can...", "System validates...")
+- [ ] No code suggestions in story description (remain abstract)
+- [ ] No modification to original epic acceptance criteria (can expand, not change)
+- [ ] Dependencies reference valid story IDs (not forward references)
+
+### Examples of Valid Output
+
+```markdown
+# Stories for COMBAT-BASIC
+
+## COMBAT-BASIC-1: Player Can Attack with Sword
+
+### Description
+The player wields a sword and can trigger basic melee attacks against enemies. When the attack button is pressed, the player's character plays an attack animation and applies damage to the target if in range.
+
+### Acceptance Criteria
+1. Player equips sword from starting inventory
+2. Attack action triggers when spacebar pressed
+3. Attack animation plays (2-frame simple swing)
+4. Damage applied to target if in melee range (2-unit radius)
+
+### Complexity Estimate
+low
+
+### Dependencies
+(none)
+
+---
+
+## COMBAT-BASIC-2: Damage Values Are Configurable
+
+### Description
+All damage values (sword damage, enemy health) come from external configuration files. This allows designers to tune balance without changing code.
+
+### Acceptance Criteria
+1. Sword damage loaded from `data/weapons.json`
+2. Enemy health loaded from `data/enemies.json`
+3. Changing JSON values changes in-game behavior immediately
+4. Invalid values trigger error log and fall back to default
+
+### Complexity Estimate
+medium
+
+### Dependencies
+- COMBAT-BASIC-1
+```
+
+---
+
+## Hard Constraints (Must Never Violate)
+
+Violations automatically trigger intervention/rejection.
+
+- ❌ **Do not modify epic goals** — story must not contradict or rewrite the input epic's goal
+- ❌ **Do not change acceptance criteria sources** — if epic says "damage is configurable", don't remove this criteria
+- ❌ **Do not write game code** — stories remain abstract, no code suggestions like `player.attack()`
+- ❌ **Do not modify input epic file** — treat as read-only immutable
+- ❌ **Do not produce invalid story IDs** — must match pattern `EPIC-ID-N`
+- ❌ **Do not produce stories without acceptance criteria** — minimum 3 required
+- ❌ **Do not skip or merge stories** — if epic estimated 5 stories, deliver 4–6, not 2–3
+- ❌ **Do not create circular dependencies** — story cannot depend on later stories
+
+**Enforcement:** Schema validation + assertion checks in test runner. Failures block handoff.
+
+---
+
+## Soft Constraints (Recover if Violated)
+
+Violations warn and attempt recovery; don't block.
+
+- ⚠️ **Exceeded story count estimate** — if epic estimated 3, produced 6: log warning and continue (likely not a fatal error, but note for analysis)
+- ⚠️ **Story description too brief** — < 20 characters: resample with examples and continue
+- ⚠️ **Acceptance criteria phrasing unclear** — not imperative mood: ask for clarification or resample
+- ⚠️ **Tone inconsistency** — some stories formal, others casual: resample to match baseline tone
+- ⚠️ **Missing complexity estimates** — only partially provided: fill missing with median of provided values
+- ⚠️ **Vague dependencies** — circular or invalid references: log and continue (downstream can validate)
+
+**Enforcement:** Detected during behavioral tests; logged to drift monitor. Do not block handoff, but flag for review.
+
+---
+
+## Handoff Configuration
+
+### Receives From
+**Upstream Skill:** `/create-epics` (or equivalent epic-generation skill)
+
+**How Data Arrives:**
+- Option 1: Epic content passed as context string
+- Option 2: Epic file path provided; skill reads it
+- Option 3: Epic data in structured YAML/JSON
+
+**Immutability at Boundary:**
+- Epic goal — read-only, not modified
+- Acceptance criteria sources — read-only, can expand but not contradict
+- Epic ID — read-only, referenced in story IDs
+
+### Delivers To
+**Downstream Skill:** `/dev-story` (or equivalent story-to-task skill)
+
+**How Data Handed Off:**
+- Option 1: Story markdown written to `production/epics/[epic-slug]/story-NNN-[slug].md`
+- Option 2: Story content passed as context string to next skill
+- Option 3: Story metadata indexed in central registry
+
+**What Downstream Must Receive:**
+- All story IDs and content
+- Acceptance criteria unchanged (downstream may add technical notes, not change criteria)
+- Dependencies preserved
+
+**What Downstream Cannot Change:**
+- Story IDs
+- Story titles (can add context/notes, not rename)
+- Acceptance criteria (can add implementation guidance, not modify criteria)
+
+### Rollback Procedure
+
+If downstream skill (`/dev-story`) fails to consume stories:
+
+1. **Fail Signal:** Downstream returns error (e.g., "story validation failed")
+2. **Rollback Action:** Discard any partial work in downstream; return to this skill's output
+3. **Recovery:** This skill does NOT re-run; upstream skill decides whether to provide different epic
+4. **No State Mutation:** Story file remains unchanged; epic remains unchanged; no side effects
+
+---
+
+## Testing Evidence Required
+
+Every story skill output must pass this test suite before handoff:
+
+### T1: Schema Validation (Deterministic)
+- [ ] Output parses as valid Markdown
+- [ ] Output validates against output schema (JSON schema above)
+- [ ] Story IDs follow pattern `EPIC-ID-N`
+- [ ] Each story has ≥3 acceptance criteria
+- [ ] No hard constraint violations (assertion checks)
+
+**Test File:** `tests/smoke-tests/schema-validate.sh`
+
+### T2: Golden Dataset Consistency (Stochastic)
+- [ ] Input: Known good epic (golden dataset)
+- [ ] Output: Compare to baseline stories (golden dataset)
+- [ ] Metric: Semantic similarity >= 0.85 (embedding cosine distance)
+- [ ] Pass: If similarity OK, stories are consistent
+
+**Test File:** `tests/golden-datasets/` (stores expected outputs)
+
+### T3: Format Stability (Stochastic)
+- [ ] Run skill on same input 5 times
+- [ ] Measure format consistency across runs
+- [ ] Metric: All 5 outputs match structure (no sections added/removed)
+- [ ] Pass: If all 5 runs have same format
+
+**Test File:** `tests/behavioral-tests/format-stability.sh`
+
+### T4: Handoff Integration (Integration)
+- [ ] Downstream skill (`/dev-story`) accepts this output
+- [ ] No schema validation errors from downstream
+- [ ] Downstream produces valid task output
+- [ ] Pass: If downstream accepts >95% of stories
+
+**Test File:** `tests/integration/story-to-devstory.sh`
+
+### Acceptance Criteria for Handoff
+
+**This skill is READY TO HAND OFF when:**
+- ✅ All hard constraints pass (schema validation, assertion checks)
+- ✅ Semantic similarity to golden dataset >= 0.85
+- ✅ Format stability across 5 runs (all match structure)
+- ✅ Downstream skill accepts output (integration test passes)
+- ✅ Drift monitor ASI >= 0.75 (no degradation)
+
+**Blocking Issues:**
+- ❌ Hard constraint violation → must fix before handoff
+- ❌ Similarity < 0.85 → investigate drift, resample or adjust
+- ❌ Downstream rejection → fix schema or content
+
+---
+
+## Drift Monitoring
+
+### Agent Stability Index (ASI) Components
+
+**For `/create-stories`, we measure:**
+
+1. **Response Consistency (30%)** — Are story formats stable across runs?
+ - Measure: Embedding similarity of 5 runs on same input (cosine distance)
+ - Baseline: >= 0.88 (established on 10 historical stories)
+ - Alarm: < 0.85 for 3 consecutive runs
+
+2. **Tool Usage Patterns (25%)** — Does the skill use consistent patterns?
+ - Measure: Tool calls, templates, references consistent
+ - Baseline: Same design docs referenced, same patterns followed
+ - Alarm: New patterns emerge without explanation
+
+3. **Acceptance Criteria Quality (25%)** — Acceptance criteria stable and testable?
+ - Measure: Phrasing in imperative mood, specific, testable
+ - Baseline: 0 vague criteria per story (e.g., no "should work")
+ - Alarm: >1 vague criterion per story
+
+4. **Behavioral Boundaries (20%)** — Skill stays in lane?
+ - Measure: No code suggestions, no modified epic goals, no assets touched
+ - Baseline: 0 violations per output
+ - Alarm: Any violation
+
+**ASI Calculation:**
+```
+consistency_score = avg_embedding_similarity across 5 runs
+tool_score = 1.0 if patterns consistent, 0.8 if slight drift, 0.6 if major change
+criteria_score = 1.0 if all testable, 0.8 if 1 vague, 0.6 if >1 vague
+boundary_score = 1.0 if no violations, 0.0 if any violation
+
+ASI = (0.30 * consistency) + (0.25 * tool) + (0.25 * criteria) + (0.20 * boundary)
+```
+
+**Monitoring:**
+- Measure after every 5 story skill invocations
+- Log to `production/session-state/drift-monitor.md`
+- Alert if ASI < 0.75 for 3 consecutive windows
+
+---
+
+## Glossary & References
+
+**Immutable:** Data that cannot be changed after being read. At skill boundaries, input is immutable (protect source epic).
+
+**Handoff:** Moment when one skill's output becomes another skill's input. Must be machine-validated.
+
+**Hard Constraint:** Rule that must never be violated. Violation blocks handoff.
+
+**Soft Constraint:** Rule that should be followed. Violation warns but doesn't block; recovery attempted.
+
+**ASI (Agent Stability Index):** Four-dimensional metric measuring skill consistency across 4 dimensions. Threshold 0.75.
+
+**Drift:** Progressive degradation of skill behavior over time or repeated invocations.
+
+**Semantic Similarity:** Embedding-based comparison of two texts (0.0 = completely different, 1.0 = identical meaning). Used instead of exact string matching for LLM outputs.
+
+**Golden Dataset:** Curated set of real inputs and expected outputs used as regression test baseline.
+
+**Schema Validation:** Checking output against JSON/Markdown schema. Deterministic, machine-verifiable.
+
+---
+
+**Template Version:** 1.0
+**Last Updated:** 2026-03-26
+**Audience:** Skill authors creating new skills or upgrading existing ones to include contracts
diff --git a/.claude/docs/templates/accessibility-requirements.md b/.claude/docs/templates/accessibility-requirements.md
index 3a7089b6..4105ebd0 100644
--- a/.claude/docs/templates/accessibility-requirements.md
+++ b/.claude/docs/templates/accessibility-requirements.md
@@ -1,5 +1,7 @@
# Accessibility Requirements: [Game Title]
+> Authoring guidance: .claude/docs/templates/guidance/accessibility-requirements-guide.md (load per-section as you author — do not read entirely).
+
> **Status**: Draft | Committed | Audited | Certified
> **Author**: [ux-designer / producer]
> **Last Updated**: [Date]
@@ -29,13 +31,6 @@
## Accessibility Tier Definition
-> **Why define tiers**: Accessibility is not binary. Defining four tiers gives
-> the team a shared vocabulary, forces an explicit commitment at the start of
-> production, and prevents scope creep in both directions ("we'll add it later"
-> and "we have to support everything"). The tiers below are this project's
-> definitions — the industry uses similar but not identical language. Commit to
-> a tier with specific feature targets, not just the tier name.
-
### Tier Definitions
| Tier | Core Commitment | Typical Effort |
@@ -47,47 +42,20 @@
### This Project's Commitment
-**Target Tier**: [Standard]
-
-**Rationale**: [Write 3-5 sentences justifying the tier choice. Do not simply
-state the tier — explain the reasoning. Consider: What is the game's genre and
-how does it map to common accessibility barriers (e.g., fast-twitch games have
-motor barriers; reading-heavy games have visual barriers)? Who is the target
-player and what does the research say about disability prevalence in that group?
-What are the platform requirements (Xbox requires XAG compliance for ID@Xbox)?
-What is the team's capacity? What would dropping one tier cost the player base,
-in concrete terms?
-
-Example: "This is a narrative RPG with turn-based combat targeted at players
-25-45. The turn-based structure eliminates the most severe motor barriers common
-in action games, but the reading-heavy design creates significant visual and
-cognitive barriers. Standard tier addresses all of these. Exemplary tier is not
-achievable without a dedicated accessibility engineer. Xbox ID@Xbox program
-requires XAG compliance for Game Pass consideration, which Standard meets.
-Dropping to Basic would exclude players who rely on colorblind modes or input
-remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
+**Target Tier**: [Basic / Standard / Comprehensive / Exemplary]
+
+**Rationale**: [3-5 sentences justifying the tier choice — genre barriers, target audience, platform requirements, team capacity, cost of dropping a tier. See guide for the reasoning checklist and a worked example.]
**Features explicitly in scope (beyond tier baseline)**:
-- [e.g., "Full subtitle customization — elevated from Comprehensive because our
- game is dialogue-heavy and subtitles are a primary channel"]
-- [e.g., "One-hand mode for controller — we have hold inputs critical to combat"]
+- [Feature elevated above the tier baseline + why]
**Features explicitly out of scope**:
-- [e.g., "Screen reader for in-game world (not menus) — requires engine work
- beyond current capacity. Documented in Known Intentional Limitations."]
+- [Feature excluded + why — must also appear in Known Intentional Limitations]
---
## Visual Accessibility
-> **Why this section comes first**: Visual impairments affect the largest
-> proportion of players who use accessibility features. Color vision deficiency
-> alone affects approximately 8% of men and 0.5% of women. Text legibility at
-> TV viewing distance is frequently the single largest accessibility failure
-> in shipped games. Document every visual feature before implementation begins,
-> because retrofitting minimum text sizes or color decisions after assets are
-> locked is expensive.
-
| Feature | Target Tier | Scope | Status | Implementation Notes |
|---------|-------------|-------|--------|---------------------|
| Minimum text size — menu UI | Standard | All menu screens | Not Started | 24px minimum at 1080p. At 4K, scale proportionally. Reference: WCAG 2.1 SC 1.4.4 requires text resizable to 200% without loss of content. |
@@ -113,28 +81,16 @@ remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
> Fill in every gameplay or UI element where color is currently the sole
> differentiator. Resolve each before shipping. A resolved entry has a non-color
-> backup that works in all three colorblind modes above.
+> backup that works in all three colorblind modes above. See guide for example rows.
| Location | Color Signal | What It Communicates | Non-Color Backup | Status |
|----------|-------------|---------------------|-----------------|--------|
-| [Health bar] | [Red = low health] | [Player is near death] | [Bar also shows numeric value and flashes] | [Not Started] |
-| [Minimap markers] | [Red = enemy, green = ally] | [Unit allegiance] | [Enemy markers are triangles; ally markers are circles] | [Not Started] |
-| [Inventory item rarity] | [Color-coded border (grey/blue/purple/gold)] | [Item quality tier] | [Rarity name shown on hover/focus; icon star count] | [Not Started] |
| [Add row for each color-coded element] | | | | |
---
## Motor Accessibility
-> **Why motor accessibility matters for games**: Games are more motor-demanding
-> than most software. A web form requires precise clicks; a game may require
-> rapid simultaneous button combinations held for specific durations. Motor
-> impairments span a wide range — from tremor (affecting precision) to
-> hemiplegia (one functional hand) to RSI (affecting hold duration). The AbleGamers
-> Able Assistance program estimates 35 million gamers in the US have a disability
-> affecting their ability to play. Many of the features below cost very little
-> to implement if planned from the start, and are extremely expensive to add post-launch.
-
| Feature | Target Tier | Scope | Status | Implementation Notes |
|---------|-------------|-------|--------|---------------------|
| Full input remapping | Standard | All gameplay inputs, all platforms | Not Started | Every input bound by default must be rebindable. Remapping applies to keyboard, mouse, controller, and any supported peripheral independently. No two actions may be bound to the same input simultaneously (warn on conflict). Persist remapping to player profile. |
@@ -152,16 +108,6 @@ remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
## Cognitive Accessibility
-> **Why cognitive accessibility is often under-specced**: Cognitive accessibility
-> affects players with ADHD, dyslexia, autism spectrum conditions, acquired brain
-> injuries, and anxiety disorders — a larger combined population than many studios
-> realize. It also benefits all players in high-stress moments. The most common
-> failures are: no pause anywhere, tutorial information that can only be seen once,
-> and systems that require tracking too many simultaneous states. Games like
-> Hades and Celeste have demonstrated that cognitive assist options (god mode,
-> persistent reminders, extended text display) do not harm the experience for
-> players who don't use them.
-
| Feature | Target Tier | Scope | Status | Implementation Notes |
|---------|-------------|-------|--------|---------------------|
| Difficulty options | Standard | All gameplay difficulty parameters | Not Started | Separate granular sliders where possible (damage dealt, damage received, enemy aggression, enemy speed) rather than a single Easy/Normal/Hard label. Document which parameters are adjustable and which are fixed. Fixed parameters require a design justification. |
@@ -177,14 +123,6 @@ remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
## Auditory Accessibility
-> **Why auditory accessibility matters even for players without hearing loss**:
-> 7% of players are deaf or hard of hearing. Additionally, a large portion of
-> players regularly play in environments where audio is reduced or absent (commute,
-> shared household, infant sleeping). Any gameplay-critical information delivered
-> only through audio is a design failure even before accessibility is considered.
-> The guiding principle: every sound that changes what the player should DO next
-> must have a visual equivalent.
-
| Feature | Target Tier | Scope | Status | Implementation Notes |
|---------|-------------|-------|--------|---------------------|
| Subtitles for all spoken dialogue | Basic | All voiced content | Not Started | 100% coverage — no exceptions. Include narration, in-engine dialogue, radio/environmental dialogue heard from a distance. Test subtitle sync against voice acting timing. |
@@ -198,27 +136,16 @@ remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
> Identify every sound effect that communicates state the player needs to act on.
> Each entry in this table requires either a confirmed visual backup or a caption.
+> See guide for example rows.
| Sound Effect | What It Communicates | Visual Backup | Caption Required | Status |
|-------------|---------------------|--------------|-----------------|--------|
-| [Enemy attack windup sound] | [Incoming damage — player should dodge] | [Enemy animation telegraph visible from all camera angles] | [No — visual is sufficient] | [Not Started] |
-| [Trap trigger click] | [Trap is about to fire] | [Not always visible depending on camera angle] | [Yes — "[CLICK]" caption with directional indicator] | [Not Started] |
-| [Low health heartbeat] | [Player health critical] | [Health bar also shows critical state visually] | [No — visual is sufficient] | [Not Started] |
-| [Quest completion chime] | [Objective completed] | [Quest tracker updates visually] | [No — visual is sufficient] | [Not Started] |
| [Add each SFX that changes what the player should do] | | | | |
---
## Platform Accessibility API Integration
-> **Why this section exists**: Each platform provides native accessibility APIs
-> that, when used, allow OS-level features (system screen readers, display
-> accommodations, motor accessibility services) to work with your game. Ignoring
-> these APIs does not break the game, but it means players who rely on OS-level
-> accessibility tools get no benefit from them inside your game. Xbox in particular
-> requires XAG compliance for certification. Verify platform requirements before
-> committing to a tier — platform requirements set a floor, not a ceiling.
-
| Platform | API / Standard | Features Planned | Status | Notes |
|----------|---------------|-----------------|--------|-------|
| Xbox (GDK) | Xbox Game Core Accessibility / XAG | [Input remapping via Xbox Ease of Access, high contrast support, narrator integration for menus] | Not Started | XAG compliance is required for ID@Xbox Game Pass consideration. Review XAG checklist at https://docs.microsoft.com/gaming/accessibility/guidelines |
@@ -232,34 +159,18 @@ remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
## Per-Feature Accessibility Matrix
-> **Why this matrix exists**: Accessibility is not a list of settings — it is a
-> property of every game system. This matrix creates the "accessibility impact"
-> view of the game: which systems have which barriers, and whether those barriers
-> are addressed. When a new system is added to systems-index.md, a row must be
-> added here. If a system has an unaddressed accessibility concern, it cannot be
-> marked Approved in the systems index.
+> When a new system is added to systems-index.md, a row must be added here. If a
+> system has an unaddressed accessibility concern, it cannot be marked Approved
+> in the systems index. See guide for example rows.
| System | Visual Concerns | Motor Concerns | Cognitive Concerns | Auditory Concerns | Addressed | Notes |
|--------|----------------|---------------|-------------------|------------------|-----------|-------|
-| [Combat System] | [Enemy health bars are color-coded; attack animations may cause motion sickness] | [Rapid input required for combos; hold inputs for guard] | [Track enemy patterns + cooldowns + player resources simultaneously] | [Audio cues for off-screen attacks; critical damage warning sounds] | [Partial] | [Colorblind palette applied; hold-to-block toggle needed] |
-| [Inventory / Equipment] | [Item rarity conveyed by border color] | [No motor concerns — turn-based] | [Item stats comparison requires reading multiple values] | [None — no critical audio in this system] | [Partial] | [Non-color rarity indicators in progress] |
-| [Dialogue System] | [Subtitle display depends on contrast settings] | [No motor concerns] | [Long dialogue trees with time pressure on dialogue choices] | [All dialogue must be subtitled] | [Not Started] | [Timed dialogue choices must support extended timer option] |
-| [Navigation / World Map] | [Map marker colors] | [No motor concerns] | [Quest objective clarity; waypoint visibility] | [Audio pings for objectives have no visual equivalent] | [Not Started] | |
| [Add system from systems-index.md] | | | | | | |
---
## Accessibility Test Plan
-> **Why testing accessibility separately from QA**: Standard QA tests whether
-> features work. Accessibility testing tests whether features work for players
-> who use them. These are different tests. A subtitle system can pass QA (it
-> displays text) and fail accessibility testing (the text is unreadable at TV
-> distance by a player with low vision). Plan for three test types: automated
-> (contrast ratios, text sizes), manual internal (team members simulating
-> impairments using accessibility simulators), and user testing (players who
-> actually use these features).
-
| Feature | Test Method | Test Cases | Pass Criteria | Responsible | Status |
|---------|------------|------------|--------------|-------------|--------|
| Text contrast ratios | Automated — contrast analyzer tool on all UI screenshots | All text/background combinations at all game states | All body text ≥ 4.5:1; all large text ≥ 3:1; subtitle backgrounds ≥ 7:1 | ux-designer | Not Started |
@@ -276,32 +187,20 @@ remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
## Known Intentional Limitations
-> **Why document what is NOT included**: Omissions left undocumented become
-> surprises at certification or in community feedback. Documenting a limitation
-> with a rationale demonstrates that it was a deliberate choice, not an oversight.
-> It also identifies which players are not served and what the mitigation is.
-> Every entry here is a risk — assess it honestly.
+> Every entry here is a risk — assess it honestly. See guide for example rows.
| Feature | Tier Required | Why Not Included | Risk / Impact | Mitigation |
|---------|--------------|-----------------|--------------|------------|
-| [Screen reader support for in-game world (NPCs, objects, environmental text)] | Exemplary | Engine (Godot 4.6) AccessKit integration covers menus only; extending to the game world requires a custom spatial audio description system beyond current scope | Affects blind and low-vision players who can navigate menus but cannot independently explore the game world | Ensure all critical world information is duplicated in accessible menu systems (quest log, map); evaluate for post-launch DLC |
-| [Full subtitle customization (font/color/background)] | Comprehensive | Scope reduction — targeting Standard tier. Custom font rendering in Godot requires additional asset pipeline work | Affects deaf and hard-of-hearing players with specific legibility needs; particularly affects players with dyslexia who use custom fonts | Provide two preset subtitle styles (default and high-readability) as a partial mitigation; log for post-launch update |
-| [Tactile/haptic alternatives for all audio cues] | Exemplary | Platform rumble API integration for non-Xbox platforms is out of scope for v1.0 | Affects deaf players relying on haptic feedback; PC players with non-Xbox controllers get no haptic response | Xbox controller haptic integration is in scope; evaluate PlayStation DualSense haptic API for a post-launch patch |
-| [Add any other intentionally excluded accessibility feature] | | | | |
+| [Add any intentionally excluded accessibility feature] | | | | |
---
## Audit History
-> **Why track audit history**: Accessibility is not certified once and done.
-> Platform requirements change. New features may introduce new barriers. Legal
-> standards evolve. An audit history demonstrates due diligence and helps identify
-> regressions between audits.
+> See guide for example rows.
| Date | Auditor | Type | Scope | Findings Summary | Status |
|------|---------|------|-------|-----------------|--------|
-| [Date] | [Internal — ux-designer] | Internal review | [Pre-submission checklist against committed tier] | [e.g., "12 items verified, 3 open issues: subtitle contrast below target in 2 scenes, color-only indicator on minimap not resolved"] | [In Progress] |
-| [Date] | [External — AbleGamers Player Panel] | User testing | [Motor accessibility — one-hand mode and timing adjustments] | [e.g., "Toggle modes functional. Timed QTE window at 3x still failed for one participant — recommend 5x option."] | [Findings addressed] |
| [Add row for each audit] | | | | | |
---
@@ -325,7 +224,4 @@ remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
| Question | Owner | Deadline | Resolution |
|----------|-------|----------|-----------|
-| [Does Godot 4.6 AccessKit support dynamic accessibility node updates for HUD elements, or only static menus?] | [ux-designer] | [Before Technical Setup gate] | [Unresolved — check engine-reference/godot/ docs] |
-| [What is the Xbox ID@Xbox minimum XAG compliance requirement for our release window?] | [producer] | [Before Pre-Production gate] | [Unresolved] |
-| [Will the dialogue system support timed choice extensions without a full architecture change?] | [lead-programmer] | [During Technical Design] | [Unresolved] |
| [Add question] | [Owner] | [Deadline] | [Resolution] |
diff --git a/.claude/docs/templates/architecture-decision-record.md b/.claude/docs/templates/architecture-decision-record.md
index 0bc567a9..4f7cf0d2 100644
--- a/.claude/docs/templates/architecture-decision-record.md
+++ b/.claude/docs/templates/architecture-decision-record.md
@@ -4,6 +4,19 @@
[Proposed | Accepted | Deprecated | Superseded by ADR-XXXX]
+> **Who may move this to `Accepted`: the user, or `technical-director` on the
+> user's explicit confirmation. No other agent, and no skill on its own.**
+> Stated here because every consumer of this field enforces the *consequences*
+> of acceptance (stories referencing a `Proposed` ADR are set `Blocked`; epics
+> require `Accepted`), so something has to say who may produce it. `technical-director` is the role `coordination-rules.md`
+> already escalates technical conflicts to, and an ADR is exactly that decision
+> made durable.
+>
+> This does **not** relax the existing rule that `Status: Accepted` is never set
+> without explicit user confirmation — it narrows *which agent* may set it once
+> that confirmation exists. An agent that believes an ADR is ready says so and
+> escalates; it does not edit this field.
+
## Date
[YYYY-MM-DD — when this ADR was written]
@@ -31,6 +44,7 @@ chosen approach.]
|-------|-------|
| **Engine** | [e.g. Godot 4.6 / Unity 6 / Unreal Engine 5.4] |
| **Domain** | [Physics / Rendering / UI / Audio / Navigation / Animation / Networking / Core / Input / Scripting] |
+| **Layer** | [Foundation / Core / Feature / Presentation] |
| **Knowledge Risk** | [LOW — in training data / MEDIUM — near cutoff, verify / HIGH — post-cutoff, must verify] |
| **References Consulted** | [e.g. `docs/engine-reference/godot/modules/physics.md`, `breaking-changes.md`] |
| **Post-Cutoff APIs Used** | [Specific APIs from post-cutoff engine versions this decision depends on, or "None"] |
@@ -39,6 +53,21 @@ chosen approach.]
> **Note**: If Knowledge Risk is MEDIUM or HIGH, this ADR must be re-validated if the
> project upgrades engine versions. Flag it as "Superseded" and write a new ADR.
+> **`Layer` is the ADR's own layer, not the referencing epic's — and it is a
+> different taxonomy from `Domain`.** Four sites branch on whether an ADR is
+> *critical (Foundation-layer)*: `/create-stories`, `/create-epics`,
+> `/architecture-decision`, and `gate-pre-production.md`. At `standard`,
+> `/create-stories` **stops** for a missing critical ADR and only **warns** for a
+> non-critical one, so this row decides whether a run halts. Earlier revisions of
+> this template recorded no layer at all, leaving those four sites to infer one from
+> the referencing epic — which gives the wrong answer whenever a Foundation-layer
+> ADR is referenced by a Core-layer epic, the common case.
+>
+> The vocabulary is the same `Foundation / Core / Feature / Presentation` that
+> epics and stories already carry — do not invent a fifth value, and do not
+> reuse a `Domain` value here. `Domain` says *what part of the engine this
+> touches*; `Layer` says *how early in the build it must exist*.
+
## ADR Dependencies
| Field | Value |
diff --git a/.claude/docs/templates/collaborative-protocols/design-agent-protocol.md b/.claude/docs/templates/collaborative-protocols/design-agent-protocol.md
deleted file mode 100644
index c9d7460b..00000000
--- a/.claude/docs/templates/collaborative-protocols/design-agent-protocol.md
+++ /dev/null
@@ -1,157 +0,0 @@
-# Collaborative Protocol for Design Agents
-
-Insert this section after the "You are..." introduction and before "Key Responsibilities":
-
-```markdown
-### Collaboration Protocol
-
-**You are a collaborative consultant, not an autonomous executor.** The user makes all creative decisions; you provide expert guidance.
-
-#### Question-First Workflow
-
-Before proposing any design:
-
-1. **Ask clarifying questions:**
- - What's the core goal or player experience?
- - What are the constraints (scope, complexity, existing systems)?
- - Any reference games or mechanics the user loves/hates?
- - How does this connect to the game's pillars?
- - *Use `AskUserQuestion` to batch up to 4 constrained questions at once*
-
-2. **Present 2-4 options with reasoning:**
- - Explain pros/cons for each option
- - Reference game design theory (MDA, SDT, Bartle, etc.)
- - Align each option with the user's stated goals
- - Make a recommendation, but explicitly defer the final decision to the user
- - *After the full explanation, use `AskUserQuestion` to capture the decision*
-
-3. **Draft based on user's choice:**
- - Create sections iteratively (show one section, get feedback, refine)
- - Ask about ambiguities rather than assuming
- - Flag potential issues or edge cases for user input
-
-4. **Get approval before writing files:**
- - Show the complete draft or summary
- - Explicitly ask: "May I write this to [filepath]?"
- - Wait for "yes" before using Write/Edit tools
- - If user says "no" or "change X", iterate and return to step 3
-
-#### Example Interaction Pattern
-
-```
-User: "Design a crafting system"
-
-You (ask questions):
-"I'd love to help design your crafting system. First, some questions:
- 1. Should recipes be discovered through experimentation or learned from NPCs/books?
- 2. How punishing should failed craft attempts be? (materials lost vs. partial recovery)
- 3. Is this a core pillar system or a supporting feature?
- 4. Any reference games? (Minecraft discovery, Terraria complexity, Stardew simplicity?)"
-
-User: [answers questions]
-
-You (present options):
-"Based on your answers, here are three approaches:
-
-**Option A: Full Discovery System**
-- Mechanics: [detailed description]
-- ✅ Pros: [list with reasoning]
-- ❌ Cons: [list with reasoning]
-- Aligns with pillars: [analysis]
-- Reference games: Minecraft, Doodle God
-
-**Option B: Recipe Book System**
-- [similar structure]
-
-**Option C: Hybrid Discovery + Hints**
-- [similar structure]
-
-I recommend Option C because [reasoning based on their goals], but you should choose based on what excites you most. Which approach fits your vision?"
-
-User: "Option C, but with X modification"
-
-You (draft iteratively):
-"Great choice. Here's a draft of the Overview and Player Fantasy sections:
-
-[Draft content]
-
-Does this match your intent? Should I continue to the Detailed Rules section, or would you like to refine these first?"
-
-User: "Looks good, continue"
-
-You: [drafts next section, shows it, iterates]
-
-[After all sections complete]
-
-You (request approval):
-"The complete crafting system design is ready. I've covered:
- ✓ Overview, ✓ Player Fantasy, ✓ Detailed Rules, ✓ Formulas,
- ✓ Edge Cases, ✓ Dependencies, ✓ Tuning Knobs, ✓ Acceptance Criteria
-
- May I write this to design/gdd/crafting-system.md?"
-
-User: "Yes"
-
-You: [uses Write tool]
- "Created design/gdd/crafting-system.md. Would you like me to run /design-review to validate it?"
-```
-
-#### Collaborative Mindset
-
-- You are an expert consultant providing options and reasoning
-- The user is the creative director making final decisions
-- When uncertain, ask rather than assume
-- Explain WHY you recommend something (theory, examples, pillar alignment)
-- Iterate based on feedback without defensiveness
-- Celebrate when the user's modifications improve your suggestion
-
-#### Structured Decision UI
-
-Use the `AskUserQuestion` tool to present decisions as a selectable UI instead of
-plain text. Follow the **Explain → Capture** pattern:
-
-1. **Explain first** — Write your full analysis in conversation text: detailed
- pros/cons, theory references, example games, pillar alignment. This is where
- the expert reasoning lives — don't try to fit it into the tool.
-
-2. **Capture the decision** — Call `AskUserQuestion` with concise option labels
- and short descriptions. The user picks from the UI or types a custom answer.
-
-**When to use it:**
-- Every decision point where you present 2-4 options (step 2)
-- Initial clarifying questions that have constrained answers (step 1)
-- Batch up to 4 independent questions in a single `AskUserQuestion` call
-- Next-step choices ("Draft formulas section or refine rules first?")
-
-**When NOT to use it:**
-- Open-ended discovery questions ("What excites you about roguelikes?")
-- Single yes/no confirmations ("May I write to file?")
-- When running as a Task subagent (tool may not be available) — structure your
- text output so the orchestrator can present options via AskUserQuestion
-
-**Format guidelines:**
-- Labels: 1-5 words (e.g., "Hybrid Discovery", "Full Randomized")
-- Descriptions: 1 sentence summarizing the approach and key trade-off
-- Add "(Recommended)" to your preferred option's label
-- Use `markdown` previews for comparing code structures or formulas side-by-side
-
-**Example — multi-question batch for clarifying questions:**
-
- AskUserQuestion with questions:
- 1. question: "Should crafting recipes be discovered or learned?"
- header: "Discovery"
- options: "Experimentation", "NPC/Book Learning", "Tiered Hybrid"
- 2. question: "How punishing should failed crafts be?"
- header: "Failure"
- options: "Materials Lost", "Partial Recovery", "No Loss"
-
-**Example — capturing a design decision (after full analysis in conversation):**
-
- AskUserQuestion with questions:
- 1. question: "Which crafting approach fits your vision?"
- header: "Approach"
- options:
- "Hybrid Discovery (Recommended)" — balances exploration and accessibility
- "Full Discovery" — maximum mystery, risk of frustration
- "Hint System" — accessible but less surprise
-```
diff --git a/.claude/docs/templates/collaborative-protocols/implementation-agent-protocol.md b/.claude/docs/templates/collaborative-protocols/implementation-agent-protocol.md
deleted file mode 100644
index 3ea80e70..00000000
--- a/.claude/docs/templates/collaborative-protocols/implementation-agent-protocol.md
+++ /dev/null
@@ -1,158 +0,0 @@
-# Collaborative Protocol for Implementation Agents
-
-Insert this section after the "You are..." introduction and before "Key Responsibilities":
-
-```markdown
-### Collaboration Protocol
-
-**You are a collaborative implementer, not an autonomous code generator.** The user approves all architectural decisions and file changes.
-
-#### Implementation Workflow
-
-Before writing any code:
-
-1. **Read the design document:**
- - Identify what's specified vs. what's ambiguous
- - Note any deviations from standard patterns
- - Flag potential implementation challenges
-
-2. **Ask architecture questions:**
- - "Should this be a static utility class or a scene node?"
- - "Where should [data] live? (CharacterStats? Equipment class? Config file?)"
- - "The design doc doesn't specify [edge case]. What should happen when...?"
- - "This will require changes to [other system]. Should I coordinate with that first?"
- - *Use `AskUserQuestion` to batch constrained architecture questions*
-
-3. **Propose architecture before implementing:**
- - Show class structure, file organization, data flow
- - Explain WHY you're recommending this approach (patterns, engine conventions, maintainability)
- - Highlight trade-offs: "This approach is simpler but less flexible" vs "This is more complex but more extensible"
- - Ask: "Does this match your expectations? Any changes before I write the code?"
-
-4. **Implement with transparency:**
- - If you encounter spec ambiguities during implementation, STOP and ask
- - If rules/hooks flag issues, fix them and explain what was wrong
- - If a deviation from the design doc is necessary (technical constraint), explicitly call it out
-
-5. **Get approval before writing files:**
- - Show the code or a detailed summary
- - Explicitly ask: "May I write this to [filepath(s)]?"
- - For multi-file changes, list all affected files
- - Wait for "yes" before using Write/Edit tools
-
-6. **Complete the story with `/story-done`:**
- - When implementation (and tests, if written) is complete, invoke `/story-done [story-file-path]`
- - This verifies acceptance criteria, checks for GDD/ADR deviations, prompts code review, and updates the story status
- - Do NOT mark a story complete manually — always go through `/story-done`
- - If no story file exists for this work (ad-hoc task), offer `/code-review` directly instead
-
-#### Example Interaction Pattern
-
-```
-User: "Implement the damage calculation system per design/gdd/combat-system.md"
-
-You (read and analyze):
-[Reads design doc]
-
-"I've read the combat system design. The damage formula is:
- final_damage = base_damage * weapon_multiplier * crit_multiplier * (1 - resistance)
-
-Before I implement, a few architectural questions:
- 1. Should DamageCalculator be a static utility or an autoload singleton?
- 2. Where should weapon data live? (Equipment class? CharacterStats? Separate WeaponData resource?)
- 3. The design doc doesn't specify rounding behavior. Round down, round up, or keep decimal damage?
- 4. Should we emit a signal when damage is calculated (for VFX/SFX hookup)?"
-
-User: "Static utility in src/gameplay/combat/. Weapon data in Equipment class. Round down to int. Yes, emit signal."
-
-You (propose architecture):
-"Got it. Here's the proposed structure:
-
-```
-# src/gameplay/combat/damage_calculator.gd
-class_name DamageCalculator
-extends RefCounted
-
-signal damage_calculated(target: Node, final_damage: int, is_crit: bool)
-
-static func calculate_damage(attacker: CharacterStats, target: CharacterStats, weapon: Equipment) -> int:
- var base_damage: float = attacker.get_attack_power()
- var weapon_mult: float = weapon.damage_multiplier
- var crit_mult: float = 2.0 if _roll_crit(attacker.crit_chance) else 1.0
- var resistance: float = target.get_resistance(weapon.damage_type)
-
- var final_damage: int = floor(base_damage * weapon_mult * crit_mult * (1.0 - resistance))
- damage_calculated.emit(target, final_damage, crit_mult > 1.0)
- return final_damage
-```
-
-Constants like crit_mult (2.0) will move to assets/data/combat_config.json per the data-driven rule.
-
-Does this match your expectations? Any changes before I write the code?"
-
-User: "Looks good. Implement it."
-
-You (implement):
-[Writes code]
-[gameplay-code rule flags hardcoded crit multiplier]
-
-"Implemented src/gameplay/combat/damage_calculator.gd.
-
-The gameplay-code rule flagged one issue: crit multiplier was hardcoded (2.0).
-I moved it to assets/data/combat_config.json as 'critical_damage_multiplier': 2.0.
-
-File is ready. Would you like me to:
- A) Write tests now (recommended)
- B) Let you review the code first
- C) Run /code-review for architecture validation"
-
-User: "A, write tests"
-
-You: [creates tests/combat/test_damage_calculator.gd]
- "Created test file with 6 test cases covering the acceptance criteria from the design doc.
- All tests passing.
-
- Running /story-done to verify acceptance criteria and close out the story."
-
-[/story-done runs — verifies criteria, checks deviations, prompts code review, updates story status]
-```
-
-#### Collaborative Mindset
-
-- Clarify before assuming — specs are never 100% complete
-- Propose architecture, don't just implement — show your thinking
-- Explain trade-offs transparently — there are always multiple valid approaches
-- Flag deviations from design docs explicitly — designer should know if implementation differs
-- Rules are your friend — when they flag issues, they're usually right
-- Tests prove it works — offer to write them proactively
-- Story completion is explicit — use `/story-done` to close every story, never assume done because code is written
-
-#### Structured Decision UI
-
-Use the `AskUserQuestion` tool for architecture decisions and next-step choices.
-Follow the **Explain → Capture** pattern:
-
-1. **Explain first** — Describe the architectural options and trade-offs in
- conversation text.
-2. **Capture the decision** — Call `AskUserQuestion` with concise option labels.
-
-**When to use it:**
-- Architecture questions with constrained answers (step 2)
-- Next-step choices ("Write tests, review code, or run code-review?")
-- Batch up to 4 independent architecture questions in one call
-
-**When NOT to use it:**
-- Open-ended spec clarifications — use conversation
-- Single confirmations ("May I write to file?")
-- When running as a Task subagent — structure text for orchestrator
-
-**Example — architecture questions (batch):**
-
- AskUserQuestion with questions:
- 1. question: "Where should DamageCalculator live?"
- header: "Architecture"
- options: "Static Utility (Recommended)", "Autoload Singleton", "Scene Node"
- 2. question: "How should damage be rounded?"
- header: "Rounding"
- options: "Floor to Int (Recommended)", "Round to Int", "Keep Decimal"
-```
diff --git a/.claude/docs/templates/collaborative-protocols/leadership-agent-protocol.md b/.claude/docs/templates/collaborative-protocols/leadership-agent-protocol.md
deleted file mode 100644
index 72e36c87..00000000
--- a/.claude/docs/templates/collaborative-protocols/leadership-agent-protocol.md
+++ /dev/null
@@ -1,181 +0,0 @@
-# Collaborative Protocol for Leadership Agents
-
-Insert this section after the "You are..." introduction and before "Key Responsibilities":
-
-```markdown
-### Collaboration Protocol
-
-**You are the highest-level consultant, but the user makes all final strategic decisions.** Your role is to present options, explain trade-offs, and provide expert recommendations — then the user chooses.
-
-#### Strategic Decision Workflow
-
-When the user asks you to make a decision or resolve a conflict:
-
-1. **Understand the full context:**
- - Ask questions to understand all perspectives
- - Review relevant docs (pillars, constraints, prior decisions)
- - Identify what's truly at stake (often deeper than the surface question)
- - *Use `AskUserQuestion` to batch up to 4 constrained questions at once*
-
-2. **Frame the decision:**
- - State the core question clearly
- - Explain why this decision matters (what it affects downstream)
- - Identify the evaluation criteria (pillars, budget, quality, scope, vision)
-
-3. **Present 2-3 strategic options:**
- - For each option:
- - What it means concretely
- - Which pillars/goals it serves vs. which it sacrifices
- - Downstream consequences (technical, creative, schedule, scope)
- - Risks and mitigation strategies
- - Real-world examples (how other games handled similar decisions)
- - *After the full analysis, use `AskUserQuestion` to capture the decision*
-
-4. **Make a clear recommendation:**
- - "I recommend Option [X] because..."
- - Explain your reasoning using theory, precedent, and project-specific context
- - Acknowledge the trade-offs you're accepting
- - But explicitly: "This is your call — you understand your vision best."
-
-5. **Support the user's decision:**
- - Once decided, document the decision (ADR, pillar update, vision doc)
- - Cascade the decision to affected departments
- - Set up validation criteria: "We'll know this was right if..."
-
-#### Example Interaction Pattern
-
-```
-User: "The game-designer wants complex crafting but the lead-programmer says it will take 3 weeks and we only have 2 weeks before Alpha. What should we do?"
-
-You (understand context):
-"I need to understand both sides fully before making a recommendation.
-
-Let me read:
- - design/gdd/crafting-system.md (what's designed)
- - production/sprints/sprint-current.md (what's planned)
- - design/pillars.md (what's non-negotiable)
-
-[Reads docs]
-
-I also need to clarify:
- 1. Is crafting a core pillar feature or a nice-to-have?
- 2. What's the minimum crafting system that still serves the pillar (if it's core)?
- 3. Can we slip Alpha by 1 week, or is that date hard?
- 4. What breaks if crafting is cut entirely?"
-
-User: [answers: crafting is pillar 2 "emergent discovery", Alpha date is hard (investor demo), minimum is recipe discovery without complex UI]
-
-You (frame and present options):
-"Thank you. Here's the core decision:
-
-**The Question:** Do we deliver full crafting for Alpha, accept schedule slip, or simplify crafting to meet deadline?
-
-**What's at Stake:** This affects:
- - Pillar 2 ("Emergent Discovery") representation at the investor demo
- - Schedule integrity and team trust
- - Technical debt if we rush complex systems
-
-**Option A: Implement Full Crafting (3 weeks, slip Alpha)**
- - ✅ Pillar 2 fully represented
- - ✅ No design compromises
- - ❌ Misses investor demo date
- - ❌ May damage relationship with investor
- - Risk: High — could lose funding opportunity
-
-**Option B: Simplify Crafting to Core (1.5 weeks, make Alpha)**
- - Scope: Recipe discovery only, no UI polish, 10 recipes instead of 30
- - ✅ Pillar 2 still represented (core mechanic intact)
- - ✅ Makes investor demo
- - ✅ Can polish post-Alpha
- - ❌ First impression is "rough"
- - Risk: Medium — demo may not wow, but pillar is visible
-
-**Option C: Cut Crafting Entirely (0 weeks, make Alpha)**
- - ✅ Makes deadline with polish
- - ✅ Team focuses on core combat (Pillar 1)
- - ❌ Pillar 2 not represented
- - ❌ Game identity incomplete
- - Risk: High — investor won't see 50% of the vision
-
-**My Recommendation: Option B (Simplify to Core)**
-
-Reasoning:
- 1. The investor demo needs to show ALL pillars, even if rough. A polished half-game is worse than a playable full-game.
- 2. Recipe discovery is the SOUL of the crafting pillar — the UI is just presentation. Core > polish for a vertical slice.
- 3. This protects schedule (team morale) and pillar integrity (investor confidence).
- 4. We can polish post-Alpha and show progression: "Here's Alpha vs. Beta" is a compelling narrative.
-
-References: Hades showed rough vertical slices in Early Access and iterated — investors loved the pillar demonstration over polish.
-
-Trade-offs I'm accepting: The demo won't look AAA-polished, but it will feel complete.
-
-**But this is your call.** You know the investor relationship better than I do. If they value polish over completeness, Option C might be right. If they're technical and want to see systems depth, Option A might be worth the risk.
-
-What's your decision?"
-
-User: "Option B. Let's simplify the scope."
-
-You (support decision):
-"Excellent. I'll document this decision and cascade it:
-
-1. Creating ADR: docs/architecture/adr-005-alpha-crafting-scope-reduction.md
-2. Updating design/gdd/crafting-system.md with Alpha scope markers
-3. Notifying game-designer and lead-programmer to align on new 1.5-week plan
-4. Adding to production/milestones/alpha.md as success criteria: 'Crafting pillar demonstrated via core discovery mechanic'
-
-Validation criteria: We'll know this was right if:
- - Investor demo shows both Pillar 1 (combat) and Pillar 2 (discovery) in playable form
- - Team hits Alpha deadline without crunch
- - Post-Alpha sprint can polish crafting without rework
-
-May I proceed with documentation?"
-
-User: "Yes"
-
-You: [Creates ADR, updates docs, notifies relevant agents]
-```
-
-#### Collaborative Mindset
-
-- You provide strategic analysis, the user provides final judgment
-- Present options clearly — don't make the user drag it out of you
-- Explain trade-offs honestly — acknowledge what each option sacrifices
-- Use theory and precedent, but defer to user's contextual knowledge
-- Once decided, commit fully — document and cascade the decision
-- Set up success metrics — "we'll know this was right if..."
-
-#### Structured Decision UI
-
-Use the `AskUserQuestion` tool to present strategic decisions as a selectable UI.
-Follow the **Explain → Capture** pattern:
-
-1. **Explain first** — Write full strategic analysis in conversation: options with
- pillar alignment, downstream consequences, risk assessment, recommendation.
-
-2. **Capture the decision** — Call `AskUserQuestion` with concise option labels.
-
-**When to use it:**
-- Every strategic decision point (options in step 3, context questions in step 1)
-- Batch up to 4 independent questions in one call
-- Next-step choices after a decision is made
-
-**When NOT to use it:**
-- Open-ended context gathering ("Tell me about the investor relationship")
-- Single confirmations ("May I document this decision?")
-- When running as a Task subagent — structure text for orchestrator
-
-**Format guidelines:**
-- Labels: 1-5 words. Descriptions: 1 sentence with key trade-off.
-- Add "(Recommended)" to your preferred option's label
-- Use `markdown` previews for comparing architectural approaches
-
-**Example — strategic decision (after full analysis in conversation):**
-
- AskUserQuestion with questions:
- 1. question: "How should we handle crafting scope for Alpha?"
- header: "Scope"
- options:
- "Simplify to Core (Recommended)" — makes deadline, pillar visible
- "Full Implementation" — slips Alpha by 1 week
- "Cut Entirely" — deadline met, pillar missing
-```
diff --git a/.claude/docs/templates/game-brief.md b/.claude/docs/templates/game-brief.md
new file mode 100644
index 00000000..60e3f36e
--- /dev/null
+++ b/.claude/docs/templates/game-brief.md
@@ -0,0 +1,41 @@
+# Game Brief: [Working Title]
+
+<!--
+THE ONE-PAGE BRIEF. At the `minimal` workflow tier this is the ENTIRE design doc —
+it replaces the full concept doc, systems decomposition, and per-system GDDs.
+Keep it to one screen. If a field needs a second paragraph, you're writing a GDD,
+not a brief. Fill every REQUIRED field; the two RECOMMENDED one-liners are cheap
+but optional. Engine is set separately (project.yaml / /setup-engine) — don't restate it.
+
+Field set grounded in industry practice — Tim Ryan (*Anatomy of a Design Document*),
+Stone Librande (GDC *One-Page Designs*: the one-page constraint forces the real
+thinking and cuts ceremony), and lean/agile GDD practice.
+-->
+
+**One-sentence pitch:** [Describe the game in one excited sentence. If it takes two, cut until it's one — "the longer your pitch, the more diluted your vision."]
+
+## Core loop
+<!-- The cycle the player repeats. What they do → what they get → why they do it again. 2–4 bullets. -->
+-
+
+## Player goal & fail state — what "working" looks like
+<!-- What the player is trying to achieve (the win, the score, or the point) and how a run ends or fails. Even a cozy or sandbox game has a "a session feels complete when…". This is the one field your stories' ACCEPTANCE CRITERIA trace back to — it turns "the game works" into something testable. One or two lines. -->
+-
+
+## MVP — what must exist to be the game
+<!-- The ruthlessly short list of features without which this ISN'T the game yet. Each one becomes a story. Longer than ~7 and it's not an MVP. -->
+-
+
+## Out of scope — not building this
+<!-- What you're deliberately NOT doing. The list that saves the project. Be specific: "no multiplayer", "no save system", "one level only". -->
+-
+
+## Build order
+<!-- The sequence to build the MVP. Risky / core-fun thing FIRST — prove it's fun before you polish. -->
+1.
+
+---
+<!-- RECOMMENDED — one line each, delete a line only if it's truly N/A for this game. -->
+**Who it's for / what they feel:** [One line: the player and the feeling. e.g. "solo puzzle fans who want a cozy 20-minute sitting."]
+
+**Art & audio direction:** [One line of aesthetic intent — drives asset choices. e.g. "flat pastel vector art, lo-fi ambient."]
diff --git a/.claude/docs/templates/guidance/accessibility-requirements-guide.md b/.claude/docs/templates/guidance/accessibility-requirements-guide.md
new file mode 100644
index 00000000..dcfe0ba8
--- /dev/null
+++ b/.claude/docs/templates/guidance/accessibility-requirements-guide.md
@@ -0,0 +1,210 @@
+> Authoring guidance for accessibility-requirements.md. Load only the part covering the section currently being authored — not the whole file at once.
+
+# Accessibility Requirements Template — Authoring Guidance
+
+Guidance is organized by template section. When authoring a section of a
+project's accessibility requirements document, read only that section's
+guidance below. The feature tables themselves (Visual / Motor / Cognitive /
+Auditory), the platform API table, the test plan, and the external resources
+remain in the template — they are the requirement catalog, not guidance.
+
+---
+
+## Accessibility Tier Definition
+
+> **Why define tiers**: Accessibility is not binary. Defining four tiers gives
+> the team a shared vocabulary, forces an explicit commitment at the start of
+> production, and prevents scope creep in both directions ("we'll add it later"
+> and "we have to support everything"). The tiers below are this project's
+> definitions — the industry uses similar but not identical language. Commit to
+> a tier with specific feature targets, not just the tier name.
+
+**Authoring the commitment rationale**:
+
+[Write 3-5 sentences justifying the tier choice. Do not simply
+state the tier — explain the reasoning. Consider: What is the game's genre and
+how does it map to common accessibility barriers (e.g., fast-twitch games have
+motor barriers; reading-heavy games have visual barriers)? Who is the target
+player and what does the research say about disability prevalence in that group?
+What are the platform requirements (Xbox requires XAG compliance for ID@Xbox)?
+What is the team's capacity? What would dropping one tier cost the player base,
+in concrete terms?
+
+Example: "This is a narrative RPG with turn-based combat targeted at players
+25-45. The turn-based structure eliminates the most severe motor barriers common
+in action games, but the reading-heavy design creates significant visual and
+cognitive barriers. Standard tier addresses all of these. Exemplary tier is not
+achievable without a dedicated accessibility engineer. Xbox ID@Xbox program
+requires XAG compliance for Game Pass consideration, which Standard meets.
+Dropping to Basic would exclude players who rely on colorblind modes or input
+remapping, estimated at 8-12% of the target audience based on AbleGamers data."]
+
+**Example in-scope / out-of-scope entries**:
+
+Features explicitly in scope (beyond tier baseline):
+- [e.g., "Full subtitle customization — elevated from Comprehensive because our
+ game is dialogue-heavy and subtitles are a primary channel"]
+- [e.g., "One-hand mode for controller — we have hold inputs critical to combat"]
+
+Features explicitly out of scope:
+- [e.g., "Screen reader for in-game world (not menus) — requires engine work
+ beyond current capacity. Documented in Known Intentional Limitations."]
+
+---
+
+## Visual Accessibility
+
+> **Why this section comes first**: Visual impairments affect the largest
+> proportion of players who use accessibility features. Color vision deficiency
+> alone affects approximately 8% of men and 0.5% of women. Text legibility at
+> TV viewing distance is frequently the single largest accessibility failure
+> in shipped games. Document every visual feature before implementation begins,
+> because retrofitting minimum text sizes or color decisions after assets are
+> locked is expensive.
+
+**Worked example rows — Color-as-Only-Indicator Audit**:
+
+| Location | Color Signal | What It Communicates | Non-Color Backup | Status |
+|----------|-------------|---------------------|-----------------|--------|
+| [Health bar] | [Red = low health] | [Player is near death] | [Bar also shows numeric value and flashes] | [Not Started] |
+| [Minimap markers] | [Red = enemy, green = ally] | [Unit allegiance] | [Enemy markers are triangles; ally markers are circles] | [Not Started] |
+| [Inventory item rarity] | [Color-coded border (grey/blue/purple/gold)] | [Item quality tier] | [Rarity name shown on hover/focus; icon star count] | [Not Started] |
+
+---
+
+## Motor Accessibility
+
+> **Why motor accessibility matters for games**: Games are more motor-demanding
+> than most software. A web form requires precise clicks; a game may require
+> rapid simultaneous button combinations held for specific durations. Motor
+> impairments span a wide range — from tremor (affecting precision) to
+> hemiplegia (one functional hand) to RSI (affecting hold duration). The AbleGamers
+> Able Assistance program estimates 35 million gamers in the US have a disability
+> affecting their ability to play. Many of the features below cost very little
+> to implement if planned from the start, and are extremely expensive to add post-launch.
+
+---
+
+## Cognitive Accessibility
+
+> **Why cognitive accessibility is often under-specced**: Cognitive accessibility
+> affects players with ADHD, dyslexia, autism spectrum conditions, acquired brain
+> injuries, and anxiety disorders — a larger combined population than many studios
+> realize. It also benefits all players in high-stress moments. The most common
+> failures are: no pause anywhere, tutorial information that can only be seen once,
+> and systems that require tracking too many simultaneous states. Games like
+> Hades and Celeste have demonstrated that cognitive assist options (god mode,
+> persistent reminders, extended text display) do not harm the experience for
+> players who don't use them.
+
+---
+
+## Auditory Accessibility
+
+> **Why auditory accessibility matters even for players without hearing loss**:
+> 7% of players are deaf or hard of hearing. Additionally, a large portion of
+> players regularly play in environments where audio is reduced or absent (commute,
+> shared household, infant sleeping). Any gameplay-critical information delivered
+> only through audio is a design failure even before accessibility is considered.
+> The guiding principle: every sound that changes what the player should DO next
+> must have a visual equivalent.
+
+**Worked example rows — Gameplay-Critical SFX Audit**:
+
+| Sound Effect | What It Communicates | Visual Backup | Caption Required | Status |
+|-------------|---------------------|--------------|-----------------|--------|
+| [Enemy attack windup sound] | [Incoming damage — player should dodge] | [Enemy animation telegraph visible from all camera angles] | [No — visual is sufficient] | [Not Started] |
+| [Trap trigger click] | [Trap is about to fire] | [Not always visible depending on camera angle] | [Yes — "[CLICK]" caption with directional indicator] | [Not Started] |
+| [Low health heartbeat] | [Player health critical] | [Health bar also shows critical state visually] | [No — visual is sufficient] | [Not Started] |
+| [Quest completion chime] | [Objective completed] | [Quest tracker updates visually] | [No — visual is sufficient] | [Not Started] |
+
+---
+
+## Platform Accessibility API Integration
+
+> **Why this section exists**: Each platform provides native accessibility APIs
+> that, when used, allow OS-level features (system screen readers, display
+> accommodations, motor accessibility services) to work with your game. Ignoring
+> these APIs does not break the game, but it means players who rely on OS-level
+> accessibility tools get no benefit from them inside your game. Xbox in particular
+> requires XAG compliance for certification. Verify platform requirements before
+> committing to a tier — platform requirements set a floor, not a ceiling.
+
+---
+
+## Per-Feature Accessibility Matrix
+
+> **Why this matrix exists**: Accessibility is not a list of settings — it is a
+> property of every game system. This matrix creates the "accessibility impact"
+> view of the game: which systems have which barriers, and whether those barriers
+> are addressed. When a new system is added to systems-index.md, a row must be
+> added here. If a system has an unaddressed accessibility concern, it cannot be
+> marked Approved in the systems index.
+
+**Worked example rows**:
+
+| System | Visual Concerns | Motor Concerns | Cognitive Concerns | Auditory Concerns | Addressed | Notes |
+|--------|----------------|---------------|-------------------|------------------|-----------|-------|
+| [Combat System] | [Enemy health bars are color-coded; attack animations may cause motion sickness] | [Rapid input required for combos; hold inputs for guard] | [Track enemy patterns + cooldowns + player resources simultaneously] | [Audio cues for off-screen attacks; critical damage warning sounds] | [Partial] | [Colorblind palette applied; hold-to-block toggle needed] |
+| [Inventory / Equipment] | [Item rarity conveyed by border color] | [No motor concerns — turn-based] | [Item stats comparison requires reading multiple values] | [None — no critical audio in this system] | [Partial] | [Non-color rarity indicators in progress] |
+| [Dialogue System] | [Subtitle display depends on contrast settings] | [No motor concerns] | [Long dialogue trees with time pressure on dialogue choices] | [All dialogue must be subtitled] | [Not Started] | [Timed dialogue choices must support extended timer option] |
+| [Navigation / World Map] | [Map marker colors] | [No motor concerns] | [Quest objective clarity; waypoint visibility] | [Audio pings for objectives have no visual equivalent] | [Not Started] | |
+
+---
+
+## Accessibility Test Plan
+
+> **Why testing accessibility separately from QA**: Standard QA tests whether
+> features work. Accessibility testing tests whether features work for players
+> who use them. These are different tests. A subtitle system can pass QA (it
+> displays text) and fail accessibility testing (the text is unreadable at TV
+> distance by a player with low vision). Plan for three test types: automated
+> (contrast ratios, text sizes), manual internal (team members simulating
+> impairments using accessibility simulators), and user testing (players who
+> actually use these features).
+
+---
+
+## Known Intentional Limitations
+
+> **Why document what is NOT included**: Omissions left undocumented become
+> surprises at certification or in community feedback. Documenting a limitation
+> with a rationale demonstrates that it was a deliberate choice, not an oversight.
+> It also identifies which players are not served and what the mitigation is.
+> Every entry here is a risk — assess it honestly.
+
+**Worked example rows**:
+
+| Feature | Tier Required | Why Not Included | Risk / Impact | Mitigation |
+|---------|--------------|-----------------|--------------|------------|
+| [Screen reader support for in-game world (NPCs, objects, environmental text)] | Exemplary | Engine (Godot 4.6) AccessKit integration covers menus only; extending to the game world requires a custom spatial audio description system beyond current scope | Affects blind and low-vision players who can navigate menus but cannot independently explore the game world | Ensure all critical world information is duplicated in accessible menu systems (quest log, map); evaluate for post-launch DLC |
+| [Full subtitle customization (font/color/background)] | Comprehensive | Scope reduction — targeting Standard tier. Custom font rendering in Godot requires additional asset pipeline work | Affects deaf and hard-of-hearing players with specific legibility needs; particularly affects players with dyslexia who use custom fonts | Provide two preset subtitle styles (default and high-readability) as a partial mitigation; log for post-launch update |
+| [Tactile/haptic alternatives for all audio cues] | Exemplary | Platform rumble API integration for non-Xbox platforms is out of scope for v1.0 | Affects deaf players relying on haptic feedback; PC players with non-Xbox controllers get no haptic response | Xbox controller haptic integration is in scope; evaluate PlayStation DualSense haptic API for a post-launch patch |
+
+---
+
+## Audit History
+
+> **Why track audit history**: Accessibility is not certified once and done.
+> Platform requirements change. New features may introduce new barriers. Legal
+> standards evolve. An audit history demonstrates due diligence and helps identify
+> regressions between audits.
+
+**Worked example rows**:
+
+| Date | Auditor | Type | Scope | Findings Summary | Status |
+|------|---------|------|-------|-----------------|--------|
+| [Date] | [Internal — ux-designer] | Internal review | [Pre-submission checklist against committed tier] | [e.g., "12 items verified, 3 open issues: subtitle contrast below target in 2 scenes, color-only indicator on minimap not resolved"] | [In Progress] |
+| [Date] | [External — AbleGamers Player Panel] | User testing | [Motor accessibility — one-hand mode and timing adjustments] | [e.g., "Toggle modes functional. Timed QTE window at 3x still failed for one participant — recommend 5x option."] | [Findings addressed] |
+
+---
+
+## Open Questions
+
+**Worked example questions**:
+
+| Question | Owner | Deadline | Resolution |
+|----------|-------|----------|-----------|
+| [Does Godot 4.6 AccessKit support dynamic accessibility node updates for HUD elements, or only static menus?] | [ux-designer] | [Before Technical Setup gate] | [Unresolved — check engine-reference/godot/ docs] |
+| [What is the Xbox ID@Xbox minimum XAG compliance requirement for our release window?] | [producer] | [Before Pre-Production gate] | [Unresolved] |
+| [Will the dialogue system support timed choice extensions without a full architecture change?] | [lead-programmer] | [During Technical Design] | [Unresolved] |
diff --git a/.claude/docs/templates/guidance/hud-design-guide.md b/.claude/docs/templates/guidance/hud-design-guide.md
new file mode 100644
index 00000000..f995709d
--- /dev/null
+++ b/.claude/docs/templates/guidance/hud-design-guide.md
@@ -0,0 +1,380 @@
+> Authoring guidance for hud-design.md. Load only the part covering the section currently being authored — not the whole file at once.
+
+# HUD Design Template — Authoring Guidance
+
+Guidance is organized by template section number. When authoring a section of a
+project's HUD design document, read only that section's guidance below.
+
+---
+
+## Section 1 — HUD Philosophy
+
+> **Why this section exists**: The HUD design philosophy is not decoration — it is a
+> design constraint that every subsequent decision is measured against. Without a
+> philosophy, individual elements get added on request ("the quest tracker wants a
+> bigger icon") without any principled way to push back. With a philosophy, there is
+> a shared, explicit standard. More importantly, the philosophy prevents the HUD from
+> slowly growing to cover the game world while each individual addition seemed
+> reasonable in isolation. Write this before specifying any elements.
+
+**Authoring the philosophy statement**:
+
+[One paragraph. This is a design statement, not a description of features. Consider
+the game's genre, pacing, and player fantasy. A stealth game's HUD philosophy might
+be: "The world is the interface. If the player has to look away from the environment
+to survive, the HUD has failed." A tactics game might say: "Complete situational
+awareness is the game. The HUD is not an overlay — it is the battlefield."
+
+Reference comparable games if helpful, but describe your specific stance:
+Example — diegetic-first action RPG: "We treat screen information as a concession,
+not a feature. Every HUD element must earn its pixel space by answering the question:
+would the player make demonstrably worse decisions without this information visible?
+If the answer is 'they'd adapt,' we put it in the environment instead."]
+
+**Authoring the visibility principle**:
+
+[State the default resolution for ambiguous cases. Options:
+- Default to HIDE: information is available on demand (e.g., Dark Souls — no quest tracker, no minimap, stats are in a menu)
+- Default to SHOW: players prefer to be informed; cluttered is better than uncertain
+- Default to CONTEXTUAL: information appears when it becomes relevant and fades when it does not
+Most games benefit from contextual defaults. State your game's default clearly so every element decision is consistent.]
+
+**Authoring the Rule of Necessity**:
+
+[Complete this sentence: "A HUD element earns its place when ______________."
+
+Example: "...the player would have to stop playing to find the same information
+elsewhere, or would make meaningfully worse decisions without it."
+
+Example: "...removing it in playtesting causes measurable frustration or confusion
+in more than 25% of testers within the first hour of play."
+
+This rule is the veto power over feature requests to add HUD elements. Document it
+so it can be cited in design reviews.]
+
+---
+
+## Section 2 — Information Architecture
+
+> **Why this section exists**: Before specifying any HUD element's visual design,
+> position, or behavior, you must answer a more fundamental question: should this
+> information be on the HUD at all? This section is a forcing function — it requires
+> you to categorize EVERY piece of information the game world generates and make an
+> explicit, intentional decision about how each is presented. "We'll figure that out
+> later" is how games end up with 18 elements competing for the player's peripheral
+> vision. This table is the master inventory of game information, not just HUD information.
+
+**Worked example table** (typical information types and categorization reasoning):
+
+| Information Type | Always Show | Contextual (show when relevant) | On Demand (menu/button) | Hidden (environmental / diegetic) | Reasoning |
+|-----------------|-------------|--------------------------------|------------------------|----------------------------------|-----------|
+| [Health / Vitality] | [X if action game — player needs constant awareness] | [X if exploration game — show only when injured] | [ ] | [ ] | [Example: always visible because health decisions (retreat, heal) must be instant in combat] |
+| [Primary resource (mana / stamina / ammo)] | [ ] | [X — show when resource is being consumed or is critically low] | [ ] | [ ] | [Example: contextual because stable resource levels are not decision-relevant] |
+| [Secondary resource (currency / materials)] | [ ] | [ ] | [X — check in inventory] | [ ] | [Example: on-demand because resource totals don't affect immediate gameplay decisions] |
+| [Minimap / Compass] | [X] | [ ] | [ ] | [ ] | [Example: always visible because navigation decisions are constant during exploration] |
+| [Quest objective] | [ ] | [X — show when objective changes or player is near it] | [ ] | [ ] | [Example: contextual — player knows their objective; only remind at key moments] |
+| [Enemy health bar] | [ ] | [X — show only during combat encounters] | [ ] | [ ] | [Example: contextual because enemy health is irrelevant outside combat] |
+| [Status effects (buffs/debuffs)] | [ ] | [X — show when active] | [ ] | [ ] | [Example: contextual because status effects only affect decisions when present] |
+| [Dialogue subtitles] | [X when dialogue is playing] | [ ] | [ ] | [ ] | [Example: always show while dialogue is active — accessibility requirement] |
+| [Combo / streak counter] | [ ] | [X — show while combo is active, hide on reset] | [ ] | [ ] | [Example: contextual because it communicates active performance, not baseline state] |
+| [Timer] | [ ] | [X — show only in timed sequences] | [ ] | [ ] | [Example: contextual because timers only exist in specific encounter types] |
+| [Tutorial prompts] | [ ] | [X — show for first-time situations only] | [ ] | [ ] | [Example: contextual and one-time; never repeat to experienced players] |
+| [Score / points] | [ ] | [X — show in score-relevant modes only] | [ ] | [ ] | [Example: contextual by game mode; hidden in modes where score is irrelevant] |
+| [XP / level progress] | [ ] | [ ] | [X — available via character screen] | [ ] | [Example: on-demand because progression does not affect in-moment gameplay decisions] |
+| [Waypoint / objective marker] | [ ] | [X — show when player is navigating to objective] | [ ] | [ ] | [Example: contextual — suppress during cutscenes, cinematic moments, and free exploration] |
+
+---
+
+## Section 3 — Layout Zones
+
+> **Why this section exists**: The game world is the primary content — the HUD is a
+> frame around it. Before placing any element, divide the screen into named zones
+> with explicit positions and safe zone margins. This section prevents two failure
+> modes: (1) elements placed ad-hoc until the screen is cluttered, and (2) elements
+> that overlap platform-required safe zones and get rejected in certification.
+> Every element in Section 4 must be assigned to a zone defined here.
+
+**Worked example — zone specification table**:
+
+| Zone Name | Screen Position | Safe Zone Compliant | Primary Elements | Max Simultaneous Elements | Notes |
+|-----------|----------------|---------------------|-----------------|--------------------------|-------|
+| [Top Left] | [Top-left corner, within safe margin] | [Yes — 10% from top, 10% from left] | [Health bar, stamina bar, shield bar] | [3] | [Vital status — player's own resources. Priority zone for player state.] |
+| [Top Center] | [Top edge, centered horizontally] | [Yes — 10% from top] | [Quest objective, area name (on enter)] | [1 — only one message at a time] | [Use for narrative context, not mechanical information. Keep text minimal.] |
+| [Top Right] | [Top-right corner, within safe margin] | [Yes — 10% from top, 10% from right] | [Ammo count, ability cooldowns] | [2] | [Weapon/ability state. Most relevant during active combat.] |
+| [Center] | [Screen center ±15%] | [N/A — not a margin zone] | [Crosshair, interaction prompt, hit marker] | [1 active at a time] | [CRITICAL: Nothing persistent here. Only momentary indicators.] |
+| [Bottom Left] | [Bottom-left corner, within safe margin] | [Yes — 10% from bottom, 10% from left] | [Minimap, ability icons] | [2] | [Navigation and ability readout. Small, non-intrusive.] |
+| [Bottom Center] | [Bottom edge, centered horizontally] | [Yes — 10% from bottom] | [Subtitles, tutorial prompts] | [2 — subtitle + tutorial may coexist] | [Highest-priority accessibility zone. Never place other elements here.] |
+| [Bottom Right] | [Bottom-right corner, within safe margin] | [Yes — 10% from bottom, 10% from right] | [Notification toasts, pick-up feedback] | [3 stacked] | [Transient notifications. Stack vertically. Oldest disappears first.] |
+
+**Worked example — safe zone margins by platform**:
+
+| Platform | Top | Bottom | Left | Right | Notes |
+|----------|-----|--------|------|-------|-------|
+| [PC — windowed] | [0% — no safe zone required] | [0%] | [0%] | [0%] | [But respect minimum resolution — elements must not crowd at 1280x720] |
+| [PC — fullscreen] | [3%] | [3%] | [3%] | [3%] | [Slight margin for 4K TV-connected PCs] |
+| [Console — TV] | [10%] | [10%] | [10%] | [10%] | [Action-safe zone for broadcast-spec TVs. Some TVs overscan beyond this.] |
+| [Steam Deck] | [5%] | [5%] | [5%] | [5%] | [Small screen; safe zone is smaller but crowding risk is higher] |
+| [Mobile — portrait] | [15% top] | [10% bottom] | [5%] | [5%] | [15% top avoids notch/camera cutout on most devices] |
+| [Mobile — landscape] | [5%] | [5%] | [15% left] | [15% right] | [Thumb placement on landscape — side zones are obscured by hands] |
+
+---
+
+## Section 4 — HUD Element Specifications
+
+> **Why this section exists**: Each HUD element needs its own specification to be
+> built correctly. Ad-hoc implementation of HUD elements produces inconsistent
+> sizing, mismatched update frequencies, missing urgency states, and accessibility
+> failures. This section is the implementation brief for every element — fill it
+> completely before any element moves into development.
+
+**Worked example — element overview table (4.1)**:
+
+| Element Name | Zone | Always Visible | Visibility Trigger | Data Source | Update Frequency | Max Size (% screen W) | Min Readable Size | Overlap Priority | Accessibility Alt |
+|-------------|------|---------------|-------------------|-------------|-----------------|----------------------|------------------|-----------------|------------------|
+| [Health Bar] | [Top Left] | [Yes] | [N/A] | [PlayerStats] | [On value change] | [20%] | [120px wide] | [1 — highest] | [Numerical text label showing current/max: "80/100"] |
+| [Stamina Bar] | [Top Left] | [No — context] | [Show when consuming stamina; hide 3s after full] | [PlayerStats] | [Realtime during use] | [15%] | [80px wide] | [2] | [Numerical label, or hide if full (accessible assumption)] |
+| [Shield Indicator] | [Top Left] | [No — context] | [Show when shield is active or recently hit] | [PlayerStats] | [On value change] | [20%] | [120px wide] | [3] | [Numerical label. Must not use color alone — add shield icon.] |
+| [Ammo Counter] | [Top Right] | [No — context] | [Show when weapon is equipped; hide when unarmed] | [WeaponSystem] | [On fire / on reload] | [10%] | ["88/888" readable at game's min resolution] | [4] | [Text-only fallback: "32 / 120"] |
+| [Minimap] | [Bottom Left] | [Yes] | [N/A — but suppressed in cinematic mode] | [NavigationSystem] | [Realtime] | [18%] | [150x150px] | [5] | [Cardinal direction compass strip as fallback; must be toggleable] |
+| [Quest Objective] | [Top Center] | [No — context] | [Show on objective change; show when near objective location; hide after 5s] | [QuestSystem] | [On event] | [30%] | [Legible at body text size] | [6] | [Read aloud on objective change via screen reader] |
+| [Crosshair] | [Center] | [No — context] | [Show when ranged weapon equipped; hide in melee or unarmed] | [WeaponSystem / AimSystem] | [Realtime] | [3%] | [12px diameter minimum] | [1 — center zone priority] | [Reduce motion: static crosshair only. Option to enlarge.] |
+| [Interaction Prompt] | [Center] | [No — context] | [Show when player is within interaction range of an interactive object] | [InteractionSystem] | [On enter/exit interaction range] | [15%] | [24px icon + readable text] | [2 — center zone] | [Text description of interaction always present, not icon-only] |
+| [Subtitles] | [Bottom Center] | [No — always on when dialogue plays, if setting enabled] | [Show during any voiced line or ambient dialogue] | [DialogueSystem] | [Per dialogue line] | [60%] | [Minimum 24px font] | [1 — highest in zone] | [This IS the accessibility feature — see Section 8 for subtitle spec] |
+| [Damage Numbers] | [World-space / anchored to entity] | [No — context] | [Show on any damage event; duration 800ms] | [CombatSystem] | [On event] | [5% per number] | [18px minimum] | [3] | [Option to disable; numbers can overwhelm for photosensitive players] |
+| [Status Effect Icons] | [Top Left — below health bar] | [No — context] | [Show when any status effect is active on player] | [StatusSystem] | [On effect add/remove] | [3% per icon] | [24px per icon] | [3] | [Icon + text label on hover/focus. Never icon-only.] |
+| [Notification Toast] | [Bottom Right] | [No — event-driven] | [On loot, XP gain, achievement, quest update] | [Multiple — see Section 6] | [On event] | [25%] | [Legible at body text size] | [7 — lowest] | [Queued; never overlapping. Read by screen reader if subtitle mode on.] |
+
+**Worked example — element detail blocks (4.2)**:
+
+---
+
+**Health Bar**
+
+- Visual description: [Horizontal fill bar. Left-to-right fill direction. Segmented at 25/50/75% to aid reading at a glance. Background: dark semi-transparent (40% opacity). Fill color: context-dependent — see Urgency States.]
+- Data displayed: [Current HP as fill percentage. Numerical value displayed as text below bar at all times: "80 / 100".]
+- Update behavior: [Bar fill decreases or increases smoothly using a lerp over 150ms per change. Large damage (>25% single hit) triggers a brief flash (1 frame white, then drain).]
+- Urgency states:
+ - Normal (>50% HP): [Green fill, no special behavior]
+ - Caution (25–50% HP): [Yellow fill, low warning pulse every 4 seconds]
+ - Critical (<25% HP): [Red fill, persistent slow pulse (1 Hz), vignette appears at screen edges]
+ - Zero (0% HP): [Bar empties and turns grey; death state begins]
+- Interaction: [Display only. Not interactive. Player cannot click, hover, or focus this element as an action target.]
+- Player customization: [Opacity adjustable (see Section 7 Tuning Knobs). Can be repositioned to any corner by player in accessibility settings.]
+
+---
+
+**Minimap**
+
+- Visual description: [Circular mask, radius = 75px at reference resolution 1920x1080. Player icon at center. North always up unless player has unlocked "Rotate minimap" setting. Range = configurable, default 80 world units radius.]
+- Data displayed: [Player position, nearby enemies (if detection perk unlocked), quest markers within range, points of interest icons, traversal obstacles (walls, drops).]
+- Update behavior: [Realtime. Updates every frame. Enemy icons fade in/out as they enter/leave detection range over 300ms.]
+- Urgency states: [None for the map itself. Enemy icons turn red when they are in combat-alert state.]
+- Interaction: [Not interactive in-game. Press dedicated Map button to open the full map screen (separate UX spec).]
+- Player customization: [Size: S/M/L (70/90/110px radius). Opacity: 30–100%. Rotation: locked-north or player-relative. Can be disabled entirely (compass strip shows as fallback).]
+
+---
+
+## Section 5 — HUD States by Gameplay Context
+
+> **Why this section exists**: The HUD is not a static overlay — it is a dynamic
+> system that must adapt to what the player is doing. A HUD designed only for
+> standard gameplay will look wrong in cutscenes, feel cluttered in exploration,
+> and occlude critical information in boss fights. This section defines the
+> transformations the HUD undergoes in each gameplay context. It is also the spec
+> for the system that manages HUD visibility — the HUD state machine.
+
+**Worked example table**:
+
+| Context | Elements Shown | Elements Hidden | Elements Modified | Transition Into This State |
+|---------|---------------|-----------------|------------------|---------------------------|
+| [Exploration — no threats] | [Minimap, Quest Objective (faded, 60%), Subtitles (if active)] | [Ammo Counter, Crosshair, Damage Numbers, Status Effects (if none active)] | [Health Bar fades to 40% opacity — visible but not dominant] | [Fade transition, 500ms, when no enemies detected for 10s] |
+| [Combat — active threat] | [Health Bar (full opacity), Stamina Bar (when used), Ammo Counter, Crosshair, Damage Numbers, Status Effects, Enemy Health Bars] | [Quest Objective (temporarily hidden), Notification Toasts (paused queue)] | [Minimap scales down 15% and raises opacity to 100%] | [Immediate snap in on first enemy detection — no fade. Combat readiness requires instant info.] |
+| [Dialogue / Cutscene] | [Subtitles, Dialogue speaker name] | [All gameplay HUD elements: health, ammo, minimap, crosshair, damage numbers] | [N/A] | [All gameplay elements fade out over 300ms when cutscene flag is set] |
+| [Cinematic (scripted camera sequence)] | [Subtitles only] | [Everything else including speaker name] | [Letterbox bars appear (if applicable to this game's style)] | [Immediate on cinematic flag; letterbox slides in from top/bottom over 400ms] |
+| [Inventory / Menu open] | [None — inventory renders full-screen or as overlay] | [All HUD elements] | [Game world visible but paused behind inventory screen] | [All HUD elements hide over 150ms as menu opens] |
+| [Death / Respawn pending] | [Death screen overlay — separate spec] | [All gameplay HUD elements] | [Screen desaturates and darkens over 800ms] | [Death state begins when HP reaches 0 — HUD elements fade over 600ms] |
+| [Loading / Transition] | [Loading indicator, tip text] | [All gameplay HUD elements] | [N/A] | [Instant on level transition trigger] |
+| [Tutorial — new mechanic] | [Standard context HUD + Tutorial Prompt overlay] | [Nothing additional hidden] | [Tutorial prompt dims background subtly to draw attention to prompt] | [Tutorial system fires ShowTutorial event; prompt fades in over 200ms] |
+| [Boss Encounter] | [Boss health bar appears (large, bottom of screen or top center), all combat elements] | [Quest Objective] | [Boss bar renders in a distinct visual style — must not be confused with player health] | [Boss health bar slides in on boss encounter trigger over 400ms] |
+
+---
+
+## Section 6 — Information Hierarchy
+
+> **Why this section exists**: Not all HUD information is equally important. When
+> screen space is limited, when the player is under high stress, or when elements
+> compete for the same zone, there must be a principled priority order that governs
+> which elements survive and which get suppressed. This section formalizes that
+> hierarchy so it can be enforced systematically and not just "feels obvious" decisions
+> made at implementation time.
+
+**Worked example table**:
+
+| Element | Priority Tier | Reasoning | What Replaces It If Hidden |
+|---------|--------------|-----------|---------------------------|
+| [Subtitles] | [MUST KEEP — never hide during dialogue] | [Accessibility requirement. Legal requirement in some markets. Story clarity.] | [N/A — nothing replaces subtitles] |
+| [Health Bar] | [MUST KEEP — during any state where the player can be damaged] | [Without health visibility, survival decisions become impossible] | [Auditory cues (heartbeat, breathing) supplement but do not replace] |
+| [Crosshair] | [MUST KEEP — while aiming with a ranged weapon] | [Targeting without a crosshair is a precision failure, not a difficulty feature] | [Alternative: dot-only mode for minimalists; never fully hidden while aiming] |
+| [Interaction Prompt] | [MUST KEEP — when player is in interaction range] | [Without it, interactive objects are invisible to the player] | [Environmental visual cues can supplement but interaction affordance must be explicit] |
+| [Ammo Counter] | [SHOULD KEEP] | [Low ammo decisions (switch weapon, reload) require awareness; can be contextual] | [Auditory "click" on empty chamber is acceptable fallback for experienced players] |
+| [Minimap] | [SHOULD KEEP] | [Navigation requires spatial awareness; loss forces repeated map opens] | [Compass strip (simplified directional indicator) is acceptable fallback] |
+| [Status Effects] | [SHOULD KEEP — while active] | [Active debuffs change what actions are viable; invisible debuffs feel unfair] | [Character animation states can partially communicate status effects (limping, sparks)] |
+| [Quest Objective] | [CAN HIDE] | [Player can hold objective in memory for extended periods; contextual is correct default] | [Player remembers objective from context] |
+| [Damage Numbers] | [CAN HIDE] | [Feedback element, not decision-critical. Many players turn these off.] | [Hit sounds and enemy reactions communicate hit registration] |
+| [Notification Toasts] | [CAN HIDE in high-intensity moments] | [Mid-combat "You gained 50 XP" is noise, not signal. Queue and show after combat.] | [Queue held and released when combat ends] |
+| [Combo Counter] | [ALWAYS HIDE when combo resets or player is not attacking] | [Stale combo information is actively misleading] | [N/A — simply hidden] |
+
+---
+
+## Section 7 — Visual Budget
+
+> **Why this section exists**: Without explicit budget constraints, HUD elements
+> accumulate until the game world is nearly invisible. These numbers are hard limits,
+> not guidelines. Every element addition that would breach a limit requires explicit
+> approval and must displace or reduce an existing element.
+
+> **How to apply these budgets**: For every new HUD element proposed during
+> production, require the proposer to state (1) which budget line it affects,
+> (2) what the new total will be, and (3) what existing element will be reduced or
+> made contextual to stay within budget. "It's a small icon" is not an analysis.
+
+---
+
+## Section 8 — Feedback & Notification Systems
+
+> **Why this section exists**: Notifications are the most frequently-added and
+> worst-controlled part of most HUDs. Every system wants to tell the player
+> something. Without explicit rules about notification priority, stacking limits,
+> and queue behavior, the notification zone becomes a firehose of overlapping
+> toasts that players learn to ignore entirely. This section establishes the
+> notification contract for all systems.
+
+**Worked example table**:
+
+| Notification Type | Trigger System | Screen Position | Duration (ms) | Animation In / Out | Max Simultaneous | Priority | Queue Behavior | Dismissible? |
+|------------------|---------------|-----------------|--------------|-------------------|-----------------|----------|---------------|-------------|
+| [Item Pickup] | [InventorySystem] | [Bottom Right — toast] | [2000] | [Slide in from right 200ms / fade out 300ms] | [3 stacked] | [Low] | [FIFO queue; older toasts pushed up as new ones enter] | [No — auto-dismiss] |
+| [XP Gain] | [ProgressionSystem] | [Bottom Right — toast, below item toasts] | [1500] | [Fade in 150ms / fade out 300ms] | [1 — XP messages merge: "XP +150"] | [Very Low — suppress during combat, queue for post-combat] | [Combat-aware queue] | [No] |
+| [Level Up] | [ProgressionSystem] | [Center screen — persistent until dismissed] | [Persistent — requires input to dismiss] | [Scale up from 80% + fade in 400ms] | [1] | [High — interrupts normal toasts] | [Pauses all other notifications until dismissed] | [Yes — any input] |
+| [Quest Update] | [QuestSystem] | [Top Center] | [4000] | [Slide down from top 250ms / fade out 400ms] | [1 — top center is single-message zone] | [Medium] | [If quest update arrives while previous is visible, extend duration by 2000ms; do not stack] | [No] |
+| [Objective Complete] | [QuestSystem] | [Top Center] | [3000] | [Same as Quest Update but with additional completion sound] | [1] | [Medium-High — preempts Quest Update] | [Preempts any queued top-center message] | [No] |
+| [Critical Warning (low health, hazard)] | [CombatSystem / EnvironmentSystem] | [Screen edge vignette + text at center-bottom] | [Persistent while condition active] | [Fade in 200ms; fades out 500ms when condition clears] | [1 per warning type] | [Critical — never suppressed] | [Renders immediately, bypasses all queues] | [No] |
+| [Achievement Unlocked] | [AchievementSystem] | [Bottom Right — distinct from item toasts] | [4000] | [Slide in from right with icon expansion 300ms / fade out 400ms] | [1] | [Low] | [Queues behind item toasts; never more than one achievement toast at a time] | [No] |
+| [Hint / Tutorial] | [TutorialSystem] | [Bottom Center] | [Persistent — until player performs the action or dismisses] | [Fade in 300ms] | [1] | [Medium] | [Only one tutorial hint at a time; queue others] | [Yes — B button / Esc] |
+
+**Worked example — notification queue rules**:
+1. Combat-aware queue: notifications tagged as Low priority are queued, not displayed, when the player is in combat state. The queue is flushed in a batch when the player exits combat, with a max of 3 items displayed in sequence.
+2. Merge rule: identical notification types that fire within 500ms of each other are merged into a single notification with a combined value (e.g., "Item Pickup x3" rather than three separate toasts).
+3. Critical notifications (health warning, environmental hazard) are never queued, never merged, and always displayed immediately regardless of combat state or existing notifications.
+
+---
+
+## Section 9 — Platform Adaptation
+
+> **Why this section exists**: A HUD designed at 1920x1080 on a monitor may be
+> illegible on a 55-inch TV at 4K, broken at 1280x720 on Steam Deck, or hidden
+> behind a notch on mobile. Platform adaptation is not optional post-ship work —
+> it is a design requirement that must be specified before implementation so the
+> architecture can support it from the start. Every platform listed here requires
+> explicit layout testing before certification.
+
+**Worked example table**:
+
+| Platform | Safe Zone | Resolution Range | Input Method | HUD-Specific Notes |
+|----------|-----------|-----------------|-------------|-------------------|
+| [PC — Windows, 1920x1080 reference] | [3% margin] | [1280x720 min to 3840x2160 max] | [Mouse + keyboard, controller optional] | [HUD must scale correctly at all resolutions. Test at 1280x720 — minimum before cert. Consider ultrawide (21:9) — minimap must not stretch.] |
+| [PC — Steam Deck, 1280x800] | [5% margin] | [Fixed 1280x800] | [Controller + touchscreen] | [Smaller screen means minimum text sizes are critical. Test ALL elements at this resolution. Touch targets irrelevant (controller-only by default).] |
+| [PlayStation 5 / Xbox Series X] | [10% margin] | [1080p to 4K] | [Controller] | [Console certification requires TV safe zone compliance. Action-safe is 90% of screen area. Test on a real TV, not a monitor — overscan behavior differs.] |
+| [Mobile — iOS / Android] | [15% top, 10% other sides] | [360x640 min to 414x896 common] | [Touch] | [Notch/camera cutout avoidance at top. Bottom home indicator zone avoidance. Portrait and landscape layouts may differ significantly — specify both.] |
+
+---
+
+## Section 10 — Accessibility (HUD Specific)
+
+> **Why this section exists**: HUD accessibility failures are the most visible
+> accessibility failures in games — players encounter the HUD in every session,
+> in every gameplay moment. Color-blind failures, illegible text at minimum scale,
+> and inability to disable distracting animations are among the top accessibility
+> complaints in game reviews. This section defines HUD-specific requirements; refer
+> to the project's `design/accessibility-requirements.md` for the full project standard.
+
+**Worked example — colorblind modes table (10.1)**:
+
+| Element | Color-Only Information Risk | Colorblind Mode Fix |
+|---------|----------------------------|---------------------|
+| [Health bar fill] | [Red = low health uses red/green distinction] | [Add icon pulse + vignette as non-color indicators. Red fill is supplemental, not sole indicator.] |
+| [Damage numbers] | [Red = taken, green = healed] | [Add minus (-) prefix for damage, plus (+) for healing. Symbols, not color.] |
+| [Enemy health bars] | [If colored by faction or threat level] | [Add text label or icon badge for faction/threat level. Never color-only.] |
+| [Status effect icons] | [If icon tint communicates status type] | [All status icons must have distinct shapes, not just distinct colors. Shape encodes meaning; color is secondary.] |
+| [Minimap icons] | [If player vs. enemy vs. objective distinguished by color] | [Distinct icon shapes: circle = player, triangle = enemy, star = objective. Color supplements shape.] |
+
+**Authoring the text scaling narrative (10.2)**:
+
+[Describe what happens when the player sets the UI text scale to 150% (the maximum required for your Accessibility Tier). Which elements reflow? Which elements clip? Which elements are architecturally blocked from scaling (e.g., fixed-size canvases)?
+
+Example: "Health bar numerical label grows with text scale — bar expands slightly to accommodate. Quest objective text wraps at 150% scale — verify Top Center zone can accommodate two-line objectives. Damage numbers do not scale (they are world-space, not screen-space) — this is an accepted limitation documented here."]
+
+**Worked example — text scaling test matrix (10.2)**:
+
+| Element | 100% (baseline) | 125% | 150% | Overflow behavior |
+|---------|----------------|------|------|-------------------|
+| [Health bar label] | [Pass] | [Pass] | [TBD] | [Bar expands; does not overlap stamina bar] |
+| [Quest objective text] | [Pass] | [TBD] | [TBD] | [Wraps to second line; zone height expands] |
+| [Notification toast text] | [Pass] | [TBD] | [TBD] | [Toast width expands to max 35% screen width, then wraps] |
+| [Subtitle text] | [Pass] | [TBD] | [TBD] | [Dedicated subtitle zone — must accommodate scale] |
+
+**Worked example — motion sensitivity table (10.3)**:
+
+| Animation / Motion Element | Severity | Disabled by Reduced Motion Setting? | Replacement Behavior |
+|---------------------------|----------|-------------------------------------|---------------------|
+| [Health bar low-HP pulse] | [Mild] | [Yes] | [Solid fill, no pulse. Vignette remains as it is less likely to trigger sensitivity.] |
+| [Screen edge vignette] | [Moderate] | [Optional — separate toggle] | [Replace with static darkened corners at 30% opacity] |
+| [Damage numbers float upward] | [Mild] | [Yes] | [Instant appear/disappear in place, no float] |
+| [Notification toast slide-in] | [Mild] | [Yes] | [Instant appear at final position] |
+| [Level up center animation] | [High] | [Yes — required] | [Static level up card, no scale animation, no particle effects] |
+| [Combo counter scale pulse] | [Mild] | [Yes] | [Number increments without scale animation] |
+
+---
+
+## Section 11 — Tuning Knobs
+
+> **Why this section exists**: HUD behavior should be data-driven to the same degree
+> as gameplay systems. Values that are hardcoded are values that require an engineer
+> to change. Values that are in config can be tuned by a designer or adjusted for
+> player preferences. Document all tunable parameters before implementation so the
+> programmer knows which values to externalize.
+
+**Worked example table**:
+
+| Parameter | Current Value | Range | Effect of Increase | Effect of Decrease | Player Adjustable? | Notes |
+|-----------|-------------|-------|-------------------|-------------------|-------------------|-------|
+| [Notification display duration (default)] | [2000ms] | [500ms – 5000ms] | [Toasts persist longer — less likely to be missed, more screen clutter] | [Toasts disappear faster — cleaner, higher miss risk] | [No — but player can adjust verbosity level] | [Per-type overrides in Section 8 take precedence] |
+| [Notification queue max size] | [8] | [3 – 15] | [More messages preserved but queue takes longer to clear] | [Older messages dropped earlier] | [No] | [Expand if playtesting reveals important messages being lost] |
+| [Health bar low-HP pulse frequency] | [1 Hz] | [0.5 – 2 Hz] | [More urgent feeling — can become fatiguing] | [Calmer — may fail to communicate urgency] | [No — but Reduced Motion disables it] | [Linked to accessibility setting] |
+| [Combat HUD reveal duration] | [0ms (instant)] | [0 – 300ms] | [Softer reveal — feels less jarring] | [Instant — highest responsiveness] | [No] | [Keep at 0ms — combat information must be instant] |
+| [Exploration HUD fade-out delay] | [10000ms (10s after last threat)] | [3000 – 30000ms] | [HUD fades sooner — cleaner exploration] | [HUD stays longer — more reassurance] | [No] | [Tune based on playtest; 10s is a starting estimate] |
+| [Minimap range (world units visible)] | [80] | [40 – 200] | [More map context visible] | [Tighter local view] | [Yes — Small/Medium/Large preset] | [Exposed as S/M/L, not raw unit value] |
+| [Minimap size (px radius at 1080p)] | [75] | [50 – 120] | [Larger map, more screen space consumed] | [Smaller, less intrusive] | [Yes — S/M/L preset] | [Three sizes exposed to player] |
+| [Damage number duration (ms)] | [800] | [400 – 1500] | [Numbers linger longer — easier to read, more cluttered] | [Numbers clear faster — cleaner, harder to parse] | [No] | [Tune based on visual noise in dense combat] |
+| [Global HUD opacity] | [100%] | [0 – 100%] | [Fully visible] | [Fully hidden] | [Yes — opacity slider in Accessibility settings] | [0% = full HUD off; some players prefer this] |
+
+---
+
+## Section 12 — Acceptance Criteria
+
+> **Why this section exists**: These criteria are the certification checklist for the
+> HUD. Every item must pass before the HUD can be marked Approved. QA must be able
+> to verify each item independently.
+
+---
+
+## Section 13 — Open Questions
+
+**Worked example questions**:
+
+| Question | Owner | Deadline | Resolution |
+|----------|-------|----------|-----------|
+| [e.g., Should the minimap show enemy positions by default, or only after a detection skill is unlocked?] | [systems-designer + ui-designer] | [Sprint 5, Day 2] | [Pending — depends on progression GDD decision] |
+| [e.g., Does the game have a boss health bar, or do bosses use the standard enemy health bar? Bosses need a visually distinct treatment if they are significantly more important than normal enemies.] | [game-designer] | [Sprint 5, Day 1] | [Pending] |
+| [e.g., Damage numbers: diegetic (floating in world space, occluded by geometry) or screen space (always readable, overlaid on HUD layer)?] | [ui-designer + lead-programmer] | [Sprint 4, Day 5] | [Pending — architecture decision affects rendering layer choice] |
+| [e.g., Mobile portrait vs. landscape: does the game support both orientations? If yes, each requires its own zone layout.] | [producer] | [Sprint 3, Day 3] | [Pending — platform scope decision required first] |
diff --git a/.claude/docs/templates/guidance/interaction-pattern-library-guide-game-specific.md b/.claude/docs/templates/guidance/interaction-pattern-library-guide-game-specific.md
new file mode 100644
index 00000000..8b3c3214
--- /dev/null
+++ b/.claude/docs/templates/guidance/interaction-pattern-library-guide-game-specific.md
@@ -0,0 +1,175 @@
+> Authoring guidance for interaction-pattern-library.md. Load only the part covering the section currently being authored — not the whole file at once.
+
+> Covers: **Game-Specific UI Patterns** — full reference specifications for Inventory Slot, Ability / Skill Icon, Health / Resource Bar, Dialogue Box, Context Action Prompt, Damage Number.
+
+## Game-Specific UI Patterns
+
+---
+
+#### Inventory Slot
+
+**Category**: Game-Specific
+**Status**: Draft
+**When to Use**: Every item container in the inventory grid. Empty slots, populated
+slots, equipped slots, locked slots. The slot is the frame; the item icon is the
+content.
+
+**States**:
+
+| State | Visual | Notes |
+|-------|--------|-------|
+| Empty | Subtle slot border, no content. Not the same as disabled. Empty slots are interactable (receive items). | Avoid fully invisible empty slots — players lose track of grid dimensions |
+| Populated | Item icon fills 80% of slot area. Stack count bottom-right (if applicable). Quality border (colorblind-safe — icon + color). Equipped badge (top-right, if equipped). | |
+| Focused | Focus ring. Tooltip appears after 300ms. | |
+| Selected | Thicker or contrasting border. Used when multi-select is supported. | |
+| Drag source | Slot dims, drag ghost follows pointer. | See Grid Item for full drag spec |
+| Locked | Padlock icon overlay. No interaction. May show item at 50% opacity behind lock. | Used for locked loadout slots, DLC content, etc. |
+| Highlighted | Animated border glow (pulsing). Used for quest-relevant items or newly acquired items. | Respect motion reduction — replace pulse with a static badge |
+| Cooldown overlay | Radial fill overlay from 12 o'clock, clockwise, depleting as cooldown expires. | Only applicable if slots represent active items with cooldowns |
+
+**Accessibility**: Stack counts and quality tiers must have text or icon alternatives to color coding. Tooltip is the primary accessibility mechanism — ensure it is reachable by keyboard and screen reader. Locked slots must announce "locked" to screen readers.
+
+**Implementation Notes**: [Godot: Custom `Control` node. Quality border implemented as a `StyleBoxFlat` swapped based on rarity — avoid using `modulate` color for quality, as it affects the icon color. Drag and drop implemented via `get_drag_data()` and `can_drop_data()` / `drop_data()` override methods.]
+
+---
+
+#### Ability / Skill Icon
+
+**Category**: Game-Specific
+**Status**: Draft
+**When to Use**: Ability buttons in the HUD ability bar, skill tree nodes, and
+any context where an ability must show availability state.
+
+**States**:
+
+| State | Visual | Notes |
+|-------|--------|-------|
+| Available | Full opacity icon. Keybinding label below. | |
+| On cooldown | Radial overlay depleting clockwise from 12 o'clock. Remaining time shown as a number in the center when > 2 seconds remain. | |
+| Charges remaining | Charge pip indicators below icon (e.g., 3 filled circles = 3 charges). Number alternative for screen readers. | |
+| Out of resource | Icon desaturates to ~20%. Border dims. Keybinding label dims. Distinct from cooldown — resource-gated, not time-gated. | |
+| Locked / not unlocked | Icon silhouette only (no full art visible). Padlock badge. May show unlock condition in tooltip. | |
+| Active / channeling | Pulsing border. Radial fill shows channel duration remaining. | |
+| Just activated | Brief scale 0.9x then spring to 1.0x (overshoot to 1.05x). | Example: Guild Wars 2 and Path of Exile both use press-depress animations on ability use to confirm activation. Respect motion reduction. |
+
+**Accessibility**: All cooldown/charge information must have a numeric value (screen reader cannot parse radial overlays). The cooldown timer number satisfies this. Ability names and descriptions must be exposed to screen readers via tooltip.
+
+**Implementation Notes**: [Godot: Custom `TextureButton` subclass with overlay
+`Control` nodes for cooldown radial and charge pips. The cooldown radial uses a
+custom shader on a `ColorRect` rotating a mask — or implement with a
+`ProgressBar` styled as circular if engine supports it. Verify against
+engine-reference/godot/ for Godot 4.6 shader support for this pattern.]
+
+---
+
+#### Health / Resource Bar
+
+**Category**: Game-Specific
+**Status**: Draft
+**When to Use**: Any continuously varying value in the HUD that represents a
+critical player resource. Health, mana, stamina, shield, fuel.
+
+**States and behaviors**:
+
+| Event | Visual | Audio | Duration |
+|-------|--------|-------|---------|
+| Value decrease (damage) | Fill shrinks. Brief "damage flash" on the fill (white or red flash). Ghost bar lingers at previous value and drains to new value over 0.5s ("damage indicator"). | [Damage taken sound — varies by amount] | Instant decrease, 500ms ghost bar drain |
+| Value increase (heal) | Fill grows. Brief heal color flash (green — ensure colorblind safe with icon/glow backup). | [Heal sound] | 300ms ease-in |
+| Below 25% threshold | Fill changes color to warning state. Border pulses (or static badge in motion reduction mode). Optional: heartbeat audio cue (paired with visual if audio is sole signal). | [Low health sound — loops until above threshold] | Continuous |
+| At zero | Bar empty. Optional: bar shakes briefly. Death/depletion event fires. | [Death/depletion sound] | 200ms shake |
+| Maximum | Fill at 100%, brief glow. | — | 200ms |
+| Overflow (shield) | A separate bar segment appears beyond the natural fill area, in shield color. | [Shield gain sound] | 200ms |
+
+**Accessibility**: The current value must be accessible as a number (tooltip or persistent display, or both). Color-coded threshold states must have non-color backups (icon, flashing, or audio visual warning). Warning state at 25% must have a visual signal independent of the color change.
+
+**Implementation Notes**: [Godot: Two overlapping `ProgressBar` nodes for ghost
+bar effect — back bar holds previous value (drains via Tween), front bar holds
+current value (updates instantly). Threshold states trigger `StyleBoxFlat` swaps
+on the front bar. Ghost bar Tween duration is tunable as a designer parameter.]
+
+---
+
+#### Dialogue Box
+
+**Category**: Game-Specific
+**Status**: Draft
+**When to Use**: NPC conversation, voiced narrative dialogue, tutorial text
+delivered through a character. All dialogue that has a speaker.
+
+**Structure**: Speaker portrait or name tag (top of box or left side). Dialogue text body. Continue/advance prompt (bottom right). Optional: skip-all button, voice acting indicator, subtitle indicator.
+
+**States and behaviors**:
+
+| State | Visual | Input | Response | Duration |
+|-------|--------|-------|----------|---------|
+| Line entering | Text reveals character-by-character (typewriter effect). Or: text fades in at full speed if accessibility option set. | — | — | Speed: configurable in accessibility settings |
+| Revealing | Text animating in. Continue prompt hidden or pulsing at slow opacity. | [Any advance input] | Skip to end of current line instantly (show full line, stop typewriter) | Immediate |
+| Line complete | Full line shown. Continue prompt visible and animated. | — | — | — |
+| Advancing to next line | Continue prompt hides. Text fades out or wipes. New line begins. | [Any advance input] — Enter / A / Cross / Space / mouse click | Advance | 100ms transition |
+| Choices appearing | Choice buttons appear below dialogue text. Continue prompt hidden. Navigation focus moves to first choice. | D-pad / keyboard to select, Enter / A / Cross to confirm | Select choice | 150ms enter animation |
+| Closing | Box fades out | Final line advanced | Return control to player | 200ms |
+| Skipping all (if supported) | Brief confirmation prompt: "Skip dialogue?" | Dedicated skip button | Skip to post-dialogue state | — |
+
+**Accessibility**: Subtitles are always enabled by default for all voiced dialogue. Typewriter animation speed is a user setting (see accessibility-requirements.md). The dialogue box must not auto-advance — players must control pacing. Speaker name is always shown. All choice buttons must be navigable by keyboard and gamepad. Choices must be accessible to screen readers with position announced.
+
+**Implementation Notes**: [Godot: `RichTextLabel` with `bbcode_enabled` for
+formatting. Typewriter effect via `visible_characters` property animated by a
+`Timer`. Bind the advance input to a function that either skips typewriter
+(sets `visible_characters = -1`) or advances the dialogue state. Speaker name
+displayed in a separate `Label` above or beside the box. Dialogue data loaded from
+JSON or a dedicated dialogue format (e.g., Dialogic, Yarn Spinner for Godot).]
+
+---
+
+#### Context Action Prompt
+
+**Category**: Game-Specific
+**Status**: Draft
+**When to Use**: A prompt that appears near an interactable game object indicating
+what the player can do. "Press [A] to open chest." "Hold [E] to pick up." Appears
+when the player enters the interaction zone, disappears when they leave.
+
+**States**:
+
+| State | Visual | Notes |
+|-------|--------|-------|
+| Appearing | Fades in and rises 8px from object anchor point. | Respect motion reduction — fade only, no rise |
+| Idle | Platform-correct button icon + action label. Icon matches current input method (updates if player switches). | Always show platform-correct icon — do not hardcode "Press A" for all platforms |
+| Holding (for hold inputs) | Radial fill on the button icon shows hold progress. Label changes to active verb ("Opening..."). | |
+| Cannot interact (blocked) | Icon dims. Label shows reason if known ("Too heavy", "Need key"). | Optional — only show blocked state if the reason is meaningful to the player |
+| Disappearing | Fades out. | Triggered when player exits interaction zone |
+
+**Accessibility**: The button icon must be accompanied by a text label — do not rely on icon alone (some players use custom button labels or adaptive controllers with non-standard icons). The prompt must be positioned to not overlap character health or critical HUD information.
+
+**Implementation Notes**: [Godot: Attach as a `Node3D` child (or `Node2D` child in 2D) of the interactable object. Use a `BillboardMesh` or a `SubViewport` with a UI scene for 3D games — this keeps the prompt facing the camera without code. Update the button icon texture based on `Input.get_joy_name()` or keyboard detection via `InputEventKey` vs `InputEventJoypadButton`. Hold progress implemented as an `AnimationPlayer` or `Tween` on a radial mask shader.]
+
+---
+
+#### Damage Number
+
+**Category**: Game-Specific
+**Status**: Draft
+**When to Use**: Floating feedback numbers above combat participants. Normal
+damage, critical damage, healing, miss.
+
+**Variants**:
+
+| Variant | Visual | Notes |
+|---------|--------|-------|
+| Normal damage | White number, normal weight, medium size. | |
+| Critical hit | Larger size (1.5x), bold weight, orange or yellow — verify colorblind safe. Brief scale impact (1.3x → 1.0x on appear). | Example: Path of Exile and Diablo IV both use scale-pop for crits to make them immediately recognizable by size alone, independent of color. |
+| Healing | Green (verify colorblind safe — use + prefix and upward trajectory as non-color backups). | |
+| Miss / Evade | "MISS" text, grey, italic. Floats at smaller size. | |
+| Status damage (DoT) | Smaller size, distinct color matching the status effect. | |
+
+**Behavior**: Numbers float upward from the hit location over 1.0 second. Numbers fade from 100% to 0% during the last 0.4 seconds. Multiple numbers from rapid hits stagger horizontally to avoid overlap. Maximum simultaneous damage numbers on screen: [define per game — typically 8-12 per character].
+
+**Accessibility**: Damage numbers are purely supplementary feedback — they must never be the only way to understand combat state. Health bars are the authoritative source. Provide an option to disable damage numbers entirely (some players find them visually overwhelming). When disabled, the game must remain fully playable.
+
+**Implementation Notes**: [Godot: Pool of `Label3D` (3D games) or `Label` (2D games)
+instances recycled via an object pool. Each instance is given a random small
+horizontal offset on spawn (±20px) to reduce overlap. Float animation via
+`Tween` on `position.y` and `modulate.a`. Critical hit scale-pop via Tween
+with `EASE_OUT` on scale followed by linear settle.]
+
+---
diff --git a/.claude/docs/templates/guidance/interaction-pattern-library-guide-navigation-feedback.md b/.claude/docs/templates/guidance/interaction-pattern-library-guide-navigation-feedback.md
new file mode 100644
index 00000000..00ea9d2e
--- /dev/null
+++ b/.claude/docs/templates/guidance/interaction-pattern-library-guide-navigation-feedback.md
@@ -0,0 +1,135 @@
+> Authoring guidance for interaction-pattern-library.md. Load only the part covering the section currently being authored — not the whole file at once.
+
+> Covers: **Navigation Patterns** (Screen Push / Pop / Replace, Focus Management, Escape / Cancel) and **Feedback and Loading Patterns** (Loading State, Empty State, Error State) — full reference specifications.
+
+## Navigation Patterns
+
+---
+
+#### Screen Push / Pop / Replace
+
+**Category**: Navigation
+**Status**: Draft
+
+These three patterns define how screens enter and exit the navigation stack.
+
+| Pattern | Trigger | Animation | Stack Behavior | Focus Behavior |
+|---------|---------|-----------|---------------|----------------|
+| Push | Navigate deeper (open submenu, open detail view) | New screen slides in from right. Previous screen slides left and dims. | Previous screen remains on stack | Focus moves to first interactive element on new screen |
+| Pop (Back) | Back button / Escape / B / Circle | Current screen slides right and exits. Previous screen slides in from left and brightens. | Current screen removed from stack | Focus returns to the element that triggered the Push |
+| Replace | Navigate to a peer screen (not child, not parent). Loading screen. | Fade out current, fade in new. No directional bias. | Current screen removed. New screen added. | Focus moves to first interactive element on new screen |
+
+**Animation durations**: Push/Pop: 250ms ease-in-out. Replace: 200ms fade out + 200ms fade in.
+
+**Motion reduction**: All slide animations become fades. Duration reduces to 100ms.
+
+**Implementation Notes**: [Godot: Implement as a `ScreenManager` singleton managing
+a stack of `Control` scenes. `push(screen_scene)` instantiates and animates in.
+`pop()` animates out and frees. `replace(screen_scene)` calls pop then push without
+the intermediate stack state. Use `CanvasLayer` per screen to isolate input handling.
+Store the "return focus" element reference before pushing so it can be restored on pop.]
+
+---
+
+#### Focus Management
+
+**Category**: Navigation
+**Status**: Draft
+
+> Focus management is the most common keyboard and gamepad accessibility failure
+> in game UIs. These rules must be implemented consistently. A player should
+> never be in a state where they cannot see which element is focused, or where
+> Tab/D-pad produces no visible result.
+
+| Rule | Description |
+|------|-------------|
+| Screen open | Focus is placed on the most logical interactive element — typically the Primary button, the first list item, or the last-focused element if the screen was previously visited. Never on a non-interactive element. |
+| Screen close / pop | Focus returns to the element that triggered the navigation (the button that opened the screen, the list item that was selected). If that element no longer exists, focus goes to the nearest preceding interactive element. |
+| Modal open | Focus is trapped inside the modal. See Modal Dialog pattern. |
+| Modal close | Focus returns to the element that triggered the modal. |
+| Element disabled | If the focused element becomes disabled, focus moves to the next available interactive element in the tab order. |
+| Element destroyed | If the focused element is removed from the scene, focus moves to the nearest preceding element in the tab order. |
+| Screen without interactive elements | Focus management is a no-op. Ensure back/cancel input still works. |
+| Tab key (keyboard) | Moves focus forward through interactive elements in document order (left to right, top to bottom). Shift+Tab moves backward. |
+| D-pad (gamepad) | Moves focus in the spatial direction pressed. Spatial navigation is preferred over strict tab order for gamepad. Never wrap focus between unrelated regions (e.g., Tab bar and content area should be separate navigation regions). |
+| Focus is always visible | Focus ring or equivalent focus indicator must ALWAYS be visible when an element is focused via keyboard or gamepad. Never suppress focus indicators. |
+
+---
+
+#### Escape / Cancel
+
+**Category**: Navigation
+**Status**: Draft
+
+> The "go back" action is the most-used navigation input in all menu systems.
+> It must be consistent across every screen with no exceptions.
+
+| Platform | Input | Behavior |
+|----------|-------|---------|
+| PC (keyboard) | Escape | Close top-most modal / go back one screen in stack / if at root screen (main menu), open "quit?" confirmation |
+| PC (gamepad) | B (Xbox layout) / Circle (PS layout) | Same as Escape |
+| Xbox | B button | Same as Escape |
+| PlayStation | Circle button | Same as Escape |
+| Nintendo Switch | B button | Same as Escape (NOTE: Nintendo uses B for confirm in some first-party titles — verify platform convention for this release and document the decision) |
+
+**Rules**: This input must never be overridden to do something other than "go back / cancel." If a screen has no back action (e.g., the game is paused and the player must make a choice), Escape does nothing or shows a "you must choose" message — it does not navigate away. Every screen must define its Escape behavior explicitly in its UX spec.
+
+---
+
+## Feedback and Loading Patterns
+
+---
+
+#### Loading State
+
+**Category**: Feedback
+**Status**: Draft
+
+| Scope | Pattern | Notes |
+|-------|---------|-------|
+| Full screen (initial load) | Full-screen loading screen with game art, progress bar (determinate if possible), tip text (optional). | Never use an empty black screen. Give the player something to read or look at. |
+| Full screen (level transition) | Fade to black, loading screen, fade from black to new scene. | The fade removes the pop of the previous scene disappearing. |
+| Component / inline | Spinner or skeleton placeholder replaces the loading component. Component does not shift layout when content loads. | Skeleton placeholder (grey boxes approximating content shape) is preferable to spinner for layout-heavy content — it prevents layout shift on load. |
+| Background / async | No visual indication unless operation exceeds 2 seconds. After 2 seconds, show a small spinner or toast. | Do not show loading indicators for operations that complete in under 2 seconds — the flash of an indicator is more disruptive than waiting. |
+
+**Accessibility**: Loading states must announce to screen readers: "[Context] loading, please wait." Completion must announce "[Context] loaded." For full-screen loading, ensure the loading screen itself is navigable to screen readers — the tips text and any UI elements must be exposed.
+
+---
+
+#### Empty State
+
+**Category**: Feedback
+**Status**: Draft
+
+> Empty states are consistently the least-designed parts of game UIs. They are
+> the difference between a player feeling "this is where I'll store my items"
+> and "why is nothing here? did something break?" Every empty list and grid must
+> have a designed empty state. The empty state is not an error — it is a starting
+> point.
+
+| Location | Empty State Content | Notes |
+|----------|--------------------|----|
+| Inventory (no items) | Icon (subtle, large, centered). Message: "Your inventory is empty." Sub-message: "Items you find on your journey will appear here." | Do not say "No items found" — "found" implies a failed search. |
+| Quest Log (no active quests) | Icon. Message: "No active quests." Sub-message: "Talk to characters marked with [quest marker icon] to start a quest." | Give the player a clear action. |
+| Achievements (none earned) | Icon. Message: "No achievements yet." List of hint achievements: "Try [Action] to earn your first achievement." | Gamified motivation, not just emptiness. |
+| Search results (no matches) | Icon. Message: "No results for '[search term]'." Sub-message: "Try a different search or [browse all]." | Mirror the search term back at them. Give an alternative action. |
+
+**Rule**: Every empty state must include an icon, a message, and either a sub-message or an action button. A blank container with no explanation is never acceptable.
+
+---
+
+#### Error State
+
+**Category**: Feedback
+**Status**: Draft
+
+| Error Type | Pattern | Tone |
+|-----------|---------|------|
+| Input validation (form field) | Inline error message below the field. Error icon left of message. Red border on field (colorblind-safe with icon). | Neutral and specific — "Username must be 3-20 characters." Not "Invalid input." |
+| Operation failed (save error, network error) | Toast notification for non-critical failures. Modal Dialog for critical failures (save file cannot be written). | Calm and actionable — "Save failed. Check storage space." Not "FATAL ERROR." |
+| System error (crash, data corruption) | Full-screen error screen with error code, recovery options ("Restart Game," "Load last save"), and support contact. | Reassuring — acknowledge the problem, give the player agency. Never blame the player. |
+| Soft error (action cannot be performed) | Toast or inline message. | Explanatory — "Not enough gold" not "Action unavailable." |
+
+**Principle**: Error messages are never the player's fault. They are the game telling the player what happened and what to do next. Remove the word "invalid" from all error messages — replace with specific explanations.
+
+---
diff --git a/.claude/docs/templates/guidance/interaction-pattern-library-guide-standard-controls.md b/.claude/docs/templates/guidance/interaction-pattern-library-guide-standard-controls.md
new file mode 100644
index 00000000..6fb46286
--- /dev/null
+++ b/.claude/docs/templates/guidance/interaction-pattern-library-guide-standard-controls.md
@@ -0,0 +1,589 @@
+> Authoring guidance for interaction-pattern-library.md. Load only the part covering the section currently being authored — not the whole file at once.
+
+> Covers: **Standard Control Patterns** — full reference specifications for Button (Primary/Secondary/Destructive), Toggle, Slider, Dropdown / Select, List Item, Grid Item, Modal Dialog, Confirmation Dialog, Toast / Notification, Tooltip, Progress Bar, Input Field, Tab Bar, Scroll Container.
+
+## Standard Control Patterns
+
+---
+
+#### Button (Primary)
+
+**Category**: Input
+**Status**: Draft
+**When to Use**: The single most important action on a screen. "Start Game,"
+"Confirm," "Accept," "Buy." There should be at most one Primary button visible
+at a time. It is the answer to "what does the player most likely want to do here?"
+**When NOT to Use**: Alternative or secondary actions; destructive actions that
+require confirmation before the consequence is irreversible; any action that is
+not the primary intent of the screen.
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Default | Full-opacity fill, primary color from art-bible. Label centered. | — | — | — | — |
+| Hovered (mouse) | Brightness +15%, subtle scale 1.03x, cursor changes to pointer | Mouse over element | Transition from Default | 80ms ease-out | [UI hover sound — see Sound Standards] |
+| Focused (keyboard/gamepad) | Focus ring visible (2px, offset 3px, high contrast color). Same brightness as Hovered. | Tab / D-pad navigation | Transition from Default | 80ms ease-out | [UI focus sound — same as hover] |
+| Pressed | Scale 0.97x, brightness -10% | Click / Enter / A (Xbox) / Cross (PS) | Action fires on press-up, not press-down. Scale on press-down. | 60ms ease-in for press; 80ms ease-out on release | [UI confirm sound] |
+| Disabled | 40% opacity, no pointer cursor, no hover state | — | No response | — | — |
+| Loading (post-press) | Replace label with spinner. Button remains at pressed scale, disabled state. | — | Prevents double-submission | Duration of async operation | — |
+
+**Accessibility**:
+- Keyboard: Tab to focus, Enter or Space to activate. Must be reachable from any other interactive element on screen via Tab sequence.
+- Gamepad: D-pad or left stick to navigate focus to button. A (Xbox) / Cross (PS) to activate. Focus must be placed on Primary button by default when screen opens.
+- Screen reader: Button must expose accessible name matching visible label. Role: "button." State: "dimmed" when disabled. Activation announcement: "[Label] button — [result of action, if known]."
+- Colorblind: Do not rely on color alone to distinguish Primary from Secondary. Primary uses higher visual weight (fill vs. outline, or larger size) in addition to color differentiation.
+- Minimum touch target: 44x44pt (iOS HIG) / 48x48dp (Android). Apply even on PC if touch support is possible.
+
+**Implementation Notes**:
+[Godot: Extend `Button` control. Override `_draw()` for custom states rather than
+modifying themes mid-state. Use `focus_mode = FOCUS_ALL` to ensure keyboard
+focusability. Set `mouse_default_cursor_shape = CURSOR_POINTING_HAND`. For the
+scale animation, use a Tween on the `scale` property of the button's parent
+Control — scaling the Button itself can clip children.]
+
+---
+
+#### Button (Secondary)
+
+**Category**: Input
+**Status**: Draft
+**When to Use**: Alternative or cancel action. "Back," "Cancel," "Skip," "Maybe
+Later." Lower visual weight than Primary — it should recede visually, not compete.
+**When NOT to Use**: Destructive actions (use Button (Destructive)). The most
+important action on the screen (use Button (Primary)).
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Default | Outlined style (border only, transparent fill), secondary color. Slightly smaller or lower weight than Primary. | — | — | — | — |
+| Hovered | Background fill appears at 15% opacity. Border brightens. Scale 1.02x. | Mouse over | Transition from Default | 80ms ease-out | [UI hover sound — softer variant than Primary] |
+| Focused | Focus ring, same specification as Primary. | Tab / D-pad | Transition from Default | 80ms ease-out | [UI focus sound] |
+| Pressed | Scale 0.97x, fill opacity increases to 30% | Click / Enter / B (Xbox) / Circle (PS) on focused state | Action fires on press-up | 60ms ease-in | [UI cancel/back sound] |
+| Disabled | 40% opacity | — | No response | — | — |
+
+**Accessibility**: Same requirements as Button (Primary). Accessible name must
+match visible label. In a dialog with Primary and Secondary buttons, the Secondary
+button typically maps to the platform "cancel" input (B / Circle / Escape) as well
+as direct focus activation.
+
+**Implementation Notes**: [Same as Button (Primary). Where a Primary and Secondary
+appear together, ensure Secondary is always positioned consistently — right/bottom
+of Primary on horizontal layouts, or below Primary on vertical layouts. Consistency
+across screens is more important than per-screen aesthetic preference.]
+
+---
+
+#### Button (Destructive)
+
+**Category**: Input
+**Status**: Draft
+**When to Use**: Any action that is irreversible and causes loss of player data or
+significant progress: "Delete Save File," "Reset All Settings," "Leave Match,"
+"Discard Changes." The visual treatment signals danger before the player presses.
+**When NOT to Use**: Actions that can be undone, or actions that are merely
+consequential but reversible.
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Default | Outlined or filled with destructive color (typically a desaturated red — confirm colorblind compatibility in accessibility-requirements). Label may include a warning icon. | — | — | — | — |
+| Hovered / Focused | Same behavior as Button (Primary) hover/focus but with destructive color | — | — | 80ms | [UI hover sound] |
+| Pressed (first press) | Does NOT execute the action. Instead, opens Confirmation Dialog pattern (see below). The button itself shows a brief pulse animation. | Click / Enter | Trigger Confirmation Dialog | 100ms pulse | [UI warning sound — distinct from standard confirm] |
+| — | Confirmation Dialog handles the actual execution | — | — | — | — |
+| Disabled | 40% opacity | — | No response | — | — |
+
+> **Critical rule**: A Button (Destructive) NEVER executes its action directly.
+> It always triggers a Confirmation Dialog. There are no exceptions. A player
+> who presses it by accident must always have one more opportunity to back out.
+> Games that skip confirmation on destructive actions generate the most visible
+> negative community sentiment of any UX failure type. See: every "accidentally
+> deleted save file" complaint on any game forum.
+
+**Accessibility**: Screen reader must announce the destructive nature: "[Label] button — this action cannot be undone." In addition to accessible name, use the `description` property if available to add the warning text.
+
+**Implementation Notes**: [Destructive button triggers a separate Confirmation Dialog scene. Pass the action callback to the dialog — the button itself does not hold the execution logic. This separation prevents accidental execution if the confirmation dialog has a bug.]
+
+---
+
+#### Toggle
+
+**Category**: Input
+**Status**: Draft
+**When to Use**: Binary on/off settings where both states are equally valid and
+the current state must be visible at a glance. "Subtitles: On/Off," "Aim Assist:
+On/Off," "Notifications: On/Off."
+**When NOT to Use**: Selections from more than two options (use Dropdown). Actions
+that happen once rather than representing a persistent state (use Button). Cases
+where the consequence of toggling is complex enough to need explanation (show
+a description field alongside).
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Off / Default | Track: muted fill. Thumb: leftmost position. Label: "Off" or state label. | — | — | — | — |
+| Hovered | Track brightens 10%. Cursor: pointer. | Mouse over | Transition | 60ms | [UI hover sound] |
+| Focused | Focus ring around entire toggle element (track + thumb). | Tab / D-pad | — | 60ms | [UI focus sound] |
+| Pressed / Activated | Thumb slides to right side. Track fill changes to active color. Label changes to "On" or active state label. State persists. | Click / Enter / A / Cross | Toggle state change. Fire onChange event. Persist value. | 150ms ease-in-out for slide | [Toggle ON sound] |
+| Pressed / Deactivated | Thumb slides to left. Track reverts to muted fill. | Same inputs | Toggle state change | 150ms ease-in-out | [Toggle OFF sound — subtly different from ON] |
+| Disabled | 40% opacity. No interaction. Current state still visible. | — | No response | — | — |
+
+**Accessibility**:
+- Keyboard/Gamepad: Space or Enter to toggle. Avoid requiring directional inputs (left/right) to toggle — some users cannot predict that behavior.
+- Screen reader: Role: "switch." State: "on" or "off" — the accessible name should NOT include the state (the screen reader announces state separately). Correct: accessible name "Subtitles," state "on." Incorrect: accessible name "Subtitles On."
+- The toggle label (not just the visual thumb position) must change to show current state for players who cannot reliably distinguish left from right positions.
+
+**Implementation Notes**: [Godot: Use a custom Control or a CheckButton. The
+built-in CheckButton provides accessibility role but uses a checkbox-style visual;
+a custom slide-toggle animation may be needed for the target art style. Ensure
+the slide animation is skipped when motion reduction mode is active — in that
+case, snap to final state instantly.]
+
+---
+
+#### Slider
+
+**Category**: Input
+**Status**: Draft
+**When to Use**: Selecting a value from a continuous range where approximate values
+are acceptable and the range and relative position matter. Volume (0–100%), brightness,
+text size. The visual representation of position is itself useful information.
+**When NOT to Use**: Precise value entry (use Input Field). Selection from a short
+discrete list (use Dropdown). Binary state (use Toggle).
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Default | Track (full width). Fill (left of thumb, shows current value). Thumb (draggable handle). Current value label (right of track or above thumb). | — | — | — | — |
+| Hovered | Thumb enlarges slightly (1.2x). Track brightens. | Mouse over | — | 60ms | — |
+| Focused | Focus ring on thumb. Track brightens. | Tab / D-pad | — | 60ms | [UI focus sound] |
+| Dragging (mouse) | Thumb follows cursor. Fill updates in real time. Value label updates in real time. | Click + drag on thumb | Continuous value update. Fire onChange continuously. | Real time | [Slider adjust sound — subtle, loops while dragging] |
+| Keyboard / D-pad adjust | Thumb moves one step (5% of range per press, or 1 discrete unit). | Left/Right arrows or Left/Right D-pad while focused | Step value change. Fire onChange per step. | Instant | [Slider step sound — one click per step] |
+| Keyboard fast adjust | Larger step (25% of range). | Page Up / Page Down while focused | Large step value change | Instant | [Same step sound] |
+| Released | Value locks. onChange fires final value. | Mouse release | — | — | — |
+| Disabled | 40% opacity. No interaction. Value visible. | — | No response | — | — |
+
+**Accessibility**:
+- Keyboard: Left/Right arrows to adjust by small step. Page Up/Page Down for large step. Home/End to jump to min/max.
+- Screen reader: Role: "slider." Accessible name: the label (e.g., "Music Volume"). Current value announced on every change: "Music Volume, 80 percent." Min/max values announced on first focus.
+- All sliders must show a numeric value alongside the visual position. Relying only on track fill position excludes players who cannot perceive relative position.
+
+**Implementation Notes**: [Godot `HSlider`: set `step` to appropriate increment.
+Override keyboard input to add Page Up/Down support via `_input()`. Bind the
+`value_changed` signal to update the displayed numeric label. When motion reduction
+mode is enabled, ensure value label updates are the sole feedback — do not suppress
+them. Rumble feedback on gamepad slider adjustment is a nice enhancement for
+accessibility.]
+
+---
+
+#### Dropdown / Select
+
+**Category**: Input
+**Status**: Draft
+**When to Use**: Selection from a discrete list of 3-15 options where only the
+selected value needs to be visible at rest. Display resolution, language, window
+mode, input preset. The closed state shows only the current selection.
+**When NOT to Use**: Binary choices (use Toggle). More than ~15 options (use a
+full List pattern or a scrollable Select). When comparing options matters as much
+as selecting one (show options visibly, e.g., as a horizontal selector or list).
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Closed / Default | Label (left). Current value (right). Chevron-down icon (far right). | — | — | — | — |
+| Hovered | Row background fills at 10% opacity | Mouse over | — | 60ms | — |
+| Focused (closed) | Focus ring on entire row. | Tab / D-pad | — | 60ms | [UI focus sound] |
+| Opening | Dropdown list appears below (or above if near screen bottom). List items visible. Previously selected item highlighted. Focus moves to selected item inside list. | Click / Enter / A / Cross | Open list | 100ms ease-out (expand) | [UI expand sound] |
+| List item hovered/focused | List item highlights | Mouse / D-pad | — | 60ms | [UI hover sound] |
+| List item selected | List closes. Closed state shows new value. onChange event fires. | Click / Enter / A / Cross on item | Select value, close list | 80ms ease-in (collapse) | [UI confirm sound] |
+| Dismissed without selecting | List closes. Value unchanged. | Escape / B / Circle / click outside | Dismiss | 80ms | [UI cancel sound] |
+| Disabled | 40% opacity. No interaction. | — | — | — | — |
+
+**Accessibility**:
+- Keyboard: Up/Down arrows navigate list items while open. Enter selects. Escape dismisses. First letter of an option jumps focus to first matching item.
+- Screen reader: Role: "combobox." Accessible name: the field label. Expanded/collapsed state announced. Current value announced when focused. Each list item announces its value and position: "English, 1 of 12."
+- The dropdown list must never obscure the current item or the control that opened it — this is a common failure on small screens.
+
+**Implementation Notes**: [Godot: Custom implementation using a `Button` (the
+closed state) and a `PopupMenu` or a `VBoxContainer` revealed by animation. Native
+`OptionButton` provides accessibility but limited visual customization. Ensure
+the popup positions itself above the control if it would be clipped by the screen
+bottom. Close the popup on `_input` detecting click outside its rect.]
+
+---
+
+#### List Item
+
+**Category**: Layout / Input
+**Status**: Draft
+**When to Use**: A single selectable row in a vertically scrollable list. Achievements,
+quest log entries, settings categories, save file slots. The list is the container;
+this is the row within it.
+**When NOT to Use**: Grid layouts where items exist in two dimensions (use Grid Item).
+Non-selectable content rows (remove hover/focus states and the pressed state).
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Default | Full-width row. Icon (optional, left). Primary label. Secondary label / metadata (right or below primary). Chevron (right, if navigates deeper). | — | — | — | — |
+| Hovered | Row background at 12% opacity highlight. | Mouse over | — | 60ms | — |
+| Focused | Focus ring on row OR row background at 20% opacity (consistent with platform convention). | D-pad / Tab | — | 60ms | [UI focus sound] |
+| Selected (persistent) | Row background at 25% opacity. May show a selection indicator (left border, checkmark). Distinct from focused state — a row can be selected but not focused. | — | Rendered state | — | — |
+| Pressed / Activated | Brief brightness flash, then navigates or performs action | Click / Enter / A / Cross | Navigation or action | 80ms flash | [UI confirm sound] |
+| Disabled | 40% opacity. No interaction. | — | — | — | — |
+
+**Accessibility**:
+- Keyboard/Gamepad: Up/Down arrows or D-pad to move between list items. The list must handle focus cycling — reaching the bottom should stop (not wrap) unless wrapping is explicitly designed.
+- Screen reader: Role: "listitem." Parent list role: "list." Accessible name: primary label content. Metadata (secondary label) is optionally included in the description. Position announced: "Quest Log, 3 of 12."
+- Minimum row height: 44pt / 48dp for touch. For controller-primary platforms, 56px rows are more comfortable.
+
+**Implementation Notes**: [Godot: Use a `VBoxContainer` inside a `ScrollContainer`.
+Each row is a custom `Control` or `PanelContainer` with a `_gui_input` override.
+For keyboard navigation inside the scroll container, implement custom focus
+traversal — Godot's default Tab navigation does not scroll the container to keep
+focused items in view. Use `ensure_control_visible()` on the scroll container.]
+
+---
+
+#### Grid Item
+
+**Category**: Layout / Input
+**Status**: Draft
+**When to Use**: A selectable cell in a two-dimensional grid. Inventory slots,
+ability select, crafting ingredient selection, character portrait selection. The
+grid is the container; this is the cell.
+**When NOT to Use**: Single-column content (use List Item). Non-selectable display
+cells (remove interactive states).
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Empty | Empty slot visual (subtle border or dashed outline). Different from disabled. | — | — | — | — |
+| Populated | Item icon fills cell. Stack count (bottom right, if applicable). Quality indicator (border color or icon overlay). | — | — | — | — |
+| Hovered | Brightness +15%. Tooltip appears after 400ms delay. | Mouse over | — | 60ms | — |
+| Focused | Focus ring (2px, offset 2px). Same brightness as hovered. Tooltip appears after 400ms delay or immediately on gamepad. | D-pad navigation | — | 60ms | [UI focus sound] |
+| Selected (persistent) | Distinct border (thicker, contrasting color). May show selection checkmark. | Click / Enter / A / Cross | Select item. Can coexist with focused state on a different cell. | Instant | [UI select sound] |
+| Pressed | Brief scale 0.95x, then executes action | Double-click / Enter / A / Cross | Action (equip, use, inspect — defined by context) | 80ms | [UI confirm sound] |
+| Locked | Padlock overlay icon on populated content. No hover/focus states. | — | No interaction | — | — |
+| Drag source | Cell dims (50% opacity), drag preview appears at cursor. | Click + drag (mouse only) | Begin drag operation | Instant | [UI grab sound] |
+| Drop target (valid) | Cell brightens, accepting color indicator | Item dragged over | — | 60ms | — |
+| Drop target (invalid) | Red tint or shake animation | Item dragged over invalid slot | — | 60ms | [UI error sound] |
+
+**Accessibility**:
+- Keyboard/Gamepad: D-pad or arrow keys navigate cells. The grid must communicate its dimensions to screen readers. Row/column position announced.
+- Screen reader: Role: "gridcell." Parent role: "grid." Accessible name: item name (or "empty slot" for empty cells). State: "selected" when selected, "dimmed" when locked. Position: "row 2, column 3."
+- Tooltips must be reachable by keyboard — they must appear when the cell is focused, not only when hovered.
+
+**Implementation Notes**: [Godot: `GridContainer` with fixed column count. Each
+cell is a custom `Control`. Implement custom D-pad navigation by overriding
+`_gui_input` and calculating the cell to the left/right/above/below based on
+index and column count. `GridContainer` does not provide this natively.]
+
+---
+
+#### Modal Dialog
+
+**Category**: Feedback / Layout
+**Status**: Draft
+**When to Use**: A decision or acknowledgment that must be resolved before the
+player can continue. The dialog is blocking — background content is dimmed and
+non-interactive. "Are you sure?", "Your progress will be saved.", error states.
+**When NOT to Use**: Non-blocking notifications (use Toast / Notification). Information
+that can wait until the player is ready (add it to a persistent help system instead).
+Dialogs that should allow the player to continue playing behind them.
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Opening | Background overlay animates from 0 to 60% opacity. Dialog panel scales from 0.9 to 1.0. Dialog enters from center (not from an edge). | Triggered by code | Focus moves to first interactive element in dialog (or the Primary button) | 200ms ease-out | [UI modal open sound] |
+| Active | Background non-interactive. Dialog has all input focus. Player cannot interact with background. | Keyboard / gamepad navigates within dialog only | — | — | — |
+| Dismissing (confirmed) | Dialog panel scales to 1.1 then fades. Overlay fades to 0%. | Primary button pressed | Execute action, return focus to trigger element | 180ms | [UI confirm sound] |
+| Dismissing (cancelled) | Dialog panel scales to 0.9 then fades. Overlay fades to 0%. | Secondary button / Escape / B / Circle | No action, return focus to trigger element | 150ms | [UI cancel sound] |
+| Cannot dismiss | If the dialog represents a blocking error, do not provide a cancel path. Provide only resolution options. | — | — | — | — |
+
+> **Focus trap rule**: While a modal dialog is open, Tab and D-pad navigation
+> must cycle within the dialog's interactive elements only. It must not be possible
+> to navigate focus outside the dialog to the background content. This is both
+> an accessibility requirement (WCAG 2.1 SC 2.1.2) and a UX integrity requirement.
+> When the dialog closes, focus must return to the element that triggered it,
+> not to the top of the page.
+
+**Accessibility**:
+- Screen reader: Dialog container role: "dialog." Accessible name: dialog title (required — every dialog must have a title, even if visually hidden). On open, screen reader announces dialog title and first focusable element. Focus trap active.
+- Keyboard: Escape key always maps to the cancel/dismiss action (same as Secondary button or close button). Enter always maps to the primary/confirm action.
+- Motion reduction: Scale animation replaced with instant appear/disappear. Overlay fade retained at 100ms (faster).
+
+**Implementation Notes**: [Godot: Implement as a `CanvasLayer` with a high layer
+value (100+) to ensure it renders above all game content. The background overlay
+is a full-screen `ColorRect` at 60% black opacity. Use `grab_focus()` on the
+dialog's primary button after the open animation completes. Override `_input()` to
+implement the focus trap — intercept Tab navigation and reroute to the dialog's
+focusable elements.]
+
+---
+
+#### Confirmation Dialog
+
+**Category**: Feedback / Layout
+**Status**: Draft
+**When to Use**: The specific case of confirming a destructive action. Always
+triggered by Button (Destructive). Always has exactly two options: confirm (labeled
+with the specific action, not "OK") and cancel.
+**When NOT to Use**: Non-destructive confirmations. Errors or notifications that
+do not require a decision. Any dialog with more than two actions.
+
+> **Label rule**: The confirm button must be labeled with the specific action,
+> not a generic "OK" or "Yes." "Delete Save File" not "OK." "Leave Match" not
+> "Yes." This reduces mistakes for players who have difficulty reading the dialog
+> content quickly. The pattern comes from Apple HIG and is validated by decades
+> of usability research.
+
+**Structure**:
+- Title: Brief, action-describing. "Delete save file?" not "Are you sure?"
+- Body: One sentence stating the consequence. "This cannot be undone."
+- Confirm button: Button (Primary) — labeled with the specific action. "Delete Save File."
+- Cancel button: Button (Secondary) — "Cancel."
+- Default focus: Cancel (safer default — reduces accidental destructive actions).
+
+**Accessibility**: Inherits all Modal Dialog accessibility. Additionally: screen
+reader announces "Alert dialog, [title]" to signal destructive context. Default
+focus on Cancel is a requirement, not a preference.
+
+**Implementation Notes**: [Confirmation Dialog is a specific instance of Modal
+Dialog — implement it as a subclass or as a parameterized scene. The default
+focus on Cancel is critical: set `grab_focus()` on the Cancel button, not the
+Confirm button, after open animation completes.]
+
+---
+
+#### Toast / Notification
+
+**Category**: Feedback
+**Status**: Draft
+**When to Use**: Brief, non-blocking information that does not require a player
+decision. "Game saved." "Achievement unlocked." "Your inventory is full." The player
+can continue playing; the notification disappears on its own.
+**When NOT to Use**: Information that requires a decision (use Modal Dialog).
+Errors that require the player to take action. Critical information that the player
+must not miss.
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Entering | Slides in from screen edge (typically bottom-right, away from primary action areas). Fades from 0 to 100% opacity. | Triggered by code | — | 200ms ease-out | [Sound matching notification type — see Sound Standards] |
+| Displayed | Full opacity. Optional: icon (left), title, body text (optional), dismiss button (X, optional). | Pointer hover pauses auto-dismiss timer | Pause auto-dismiss | — | — |
+| Auto-dismiss | Fades from 100 to 0% opacity, slides out | Timer expires (5 seconds default for one-line; 8 seconds for two-line) | Remove from queue | 200ms ease-in | — |
+| Manual dismiss | Fades and slides out immediately | Click/tap X button or swipe on touch | Remove | 150ms | [UI cancel sound, quiet] |
+| Queue overflow | New notification pushes oldest out early | New notification triggered while previous is displayed | FIFO queue, max 3 simultaneous | — | — |
+
+**Accessibility**:
+- Screen reader: Toasts must be read aloud without requiring focus. In HTML, this uses `role="status"` or `role="alert"`. In game UI, this requires the engine's accessibility notification system. Verify engine support in engine-reference docs.
+- Motion reduction: Slide animation replaced with fade only.
+- Toasts must never be the sole communication channel for information the player needs to act on. If the information requires action, use a persistent UI element in addition to the toast.
+- Auto-dismiss timer: 5 seconds is the minimum. Players with cognitive processing differences may need more time. Consider a setting to extend to 10 or 15 seconds.
+
+**Implementation Notes**: [Godot: Manage a queue of `PanelContainer` scenes in a
+`VBoxContainer` anchored to a screen corner. Each toast is instantiated, added to
+the container, then auto-removed after a timer. The container should be on a high
+`CanvasLayer` (50+) but below modal dialogs (100+). Animate using a `Tween` on
+`modulate.a` and `position.x`. When motion reduction is active, skip the position
+animation.]
+
+---
+
+#### Tooltip
+
+**Category**: Feedback
+**Status**: Draft
+**When to Use**: Contextual information that supplements a visible label. Item
+descriptions in inventory. Stat explanations on a character sheet. Setting
+descriptions in accessibility options. The player must be able to access this
+information or proceed without it.
+**When NOT to Use**: Information the player MUST read to complete an action — put
+that in the label or body text, not a tooltip. Tooltips are not discoverable
+on mobile touch without a hover state. On touch-only platforms, use an info button
+that opens a description modal instead.
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Hidden | — | — | — | — | — |
+| Hover trigger | — | Mouse enters element | Begin 400ms delay timer | — | — |
+| Gamepad/keyboard trigger | — | Element receives focus | Begin 300ms delay timer (shorter because navigation is intentional) | — | — |
+| Appearing | Tooltip panel fades in and scales from 0.95 to 1.0. Positioned near element (prefer above, adjust if near screen edge). | Timer expires | Show tooltip | 120ms ease-out | — |
+| Displayed | Tooltip visible. Title (optional). Body text. Max width: 300px. Multiple lines allowed. | — | — | — | — |
+| Hiding | Tooltip fades out | Mouse leaves element / focus moves away | Hide tooltip | 80ms ease-in | — |
+
+**Accessibility**:
+- Screen reader: Tooltip content must be accessible without hover. The accessible name of the parent element should include the most critical tooltip information. The full tooltip text is optionally in the `description` property. Screen reader reads tooltip content when element is focused.
+- The delay (300-400ms) prevents accidental tooltip display and is required — instant tooltips are disruptive in gamepad navigation.
+- Tooltip text must meet the same contrast requirements as body text (4.5:1 minimum).
+
+**Implementation Notes**: [Godot: Attach a custom `TooltipControl` scene as a
+child of the trigger element. Show/hide with a `Timer` node. Position the tooltip
+using a `CanvasLayer` to ensure it appears above all other UI. For screen edges,
+detect if the tooltip rect extends beyond `get_viewport_rect()` and flip the
+position to the opposite side.]
+
+---
+
+#### Progress Bar
+
+**Category**: Feedback / Layout
+**Status**: Draft
+**When to Use**: Linear progress toward a defined endpoint. Loading screens (time
+to completion), XP fill toward next level, quest objectives with countable progress
+("3 of 10 enemies defeated"), download progress.
+**When NOT to Use**: Circular or radial progress (use a separate Radial Progress
+pattern if needed). Values that fluctuate up and down rapidly (use Health/Resource
+Bar pattern). Values with no defined endpoint.
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Default | Track (full width, background color). Fill (left to right, value color). Value label (percentage or N/M, outside or inside fill). | — | — | — | — |
+| Value increasing | Fill width animates to new value | Value changes | Smooth fill animation | 300ms ease-out | [Context-dependent — XP gain has a sound; loading has none] |
+| Value at maximum | Fill reaches full width. Optional: completion animation (pulse, glow). | Value reaches 100% | Completion event fires | 200ms | [Completion sound if appropriate] |
+| Value at zero | Fill hidden (zero width). Track still visible. | — | — | — | — |
+| Indeterminate (unknown duration) | Animated loop (fill segment moves left-to-right, repeat). Used for loading of unknown duration. | — | — | Infinite loop | — |
+
+**Accessibility**:
+- Screen reader: Role: "progressbar." Accessible name: what is progressing (e.g., "Experience Points," "Loading"). Value: current numeric value AND percentage AND maximum. "Experience Points, 450 of 1000, 45 percent." Update on significant changes (not every pixel).
+- Do not rely only on fill color to communicate value. Include a numeric label.
+- Indeterminate progress bars: announce "Loading, in progress" — do not announce changes since the value is unknown.
+- Motion reduction: Indeterminate animation is replaced with a static "loading" indicator. Smooth fill animation is replaced with instant jump to new value.
+
+**Implementation Notes**: [Godot: `ProgressBar` built-in with custom theming.
+For indeterminate mode, `ProgressBar` does not have a native indeterminate state
+in Godot 4.x — implement using a looping `Tween` on a fill element's position.
+Ensure the Tween is paused when motion reduction mode is active and a static
+indicator is shown instead.]
+
+---
+
+#### Input Field
+
+**Category**: Input
+**Status**: Draft
+**When to Use**: Text entry. Player name on a new save, search within a list,
+remapping a key binding (special case — shows the key press, not typed text),
+entering a numeric value precisely.
+**When NOT to Use**: Selecting from known options (use Dropdown or List). On
+console-primary platforms, minimize text entry — it requires a virtual keyboard,
+which is high friction.
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Default | Field border, placeholder text (label-style, muted color), empty input area. | — | — | — | — |
+| Hovered | Border brightens slightly | Mouse over | — | 60ms | — |
+| Focused | Border brightens fully. Cursor (blinking, 530ms on/530ms off). Placeholder text hidden. | Tab / click | Open virtual keyboard on console/mobile | Instant | [UI focus sound] |
+| Typing | Characters appear. Cursor advances. | Keyboard input | Update field value | Immediate | [Subtle keystroke sound, optional] |
+| Value present | Field shows typed value. Placeholder hidden. Clear button appears (X, right of field) if value is non-empty. | — | — | — | — |
+| Character limit reached | No further input accepted. Optional: brief shake animation and limit indicator changes color. | Input at limit | Reject further characters | 200ms shake | [UI error sound, subtle] |
+| Clear | Field empties. Cursor returns. Clear button disappears. | Click X / gamepad clear input | Clear value | Instant | [UI cancel sound, subtle] |
+| Validation error | Border turns error color (red — ensure colorblind safe). Error message appears below field. | On submit or on blur | Show error | Instant | [UI error sound] |
+| Validated / correct | Border turns success color (green — ensure colorblind safe). Success icon optional. | On validation pass | — | Instant | — |
+| Disabled | 40% opacity, no interaction. Value still visible. | — | — | — | — |
+
+**Accessibility**:
+- Keyboard: All standard text editing shortcuts (Home, End, Ctrl+A, Ctrl+C, Ctrl+V, Ctrl+Z).
+- Screen reader: Role: "textbox." Accessible name: field label (not placeholder text). Current value announced. Character limit announced when reached. Validation errors announced immediately on occurrence.
+- Placeholder text must not be used as the only label — a visible label above or beside the field is required. Placeholder text disappears when the player types, causing confusion for players with cognitive or memory impairments.
+
+**Implementation Notes**: [Godot `LineEdit`: set `placeholder_text` for the hint
+but always include a visible `Label` node as the field's accessible name. Bind
+`text_changed` signal for real-time validation. Bind `text_submitted` for form
+submission on Enter. On console, `LineEdit.call("_popup_keyboard")` or use the OS
+virtual keyboard API — verify against engine-reference/godot/ for Godot 4.6
+console keyboard API specifics.]
+
+---
+
+#### Tab Bar
+
+**Category**: Navigation
+**Status**: Draft
+**When to Use**: Dividing a single screen's content into discrete sections where
+only one section is visible at a time. Character sheet tabs (Stats / Equipment /
+Skills), settings tabs (Gameplay / Graphics / Audio / Accessibility). Maximum
+5-6 tabs before the pattern breaks down and a sidebar navigation should be
+considered instead.
+**When NOT to Use**: More than 6 tabs. Content that benefits from simultaneous
+visibility (use a layout pattern instead). Navigation between different screens
+(use Screen Push).
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Default (inactive tab) | Tab label. No active indicator. | — | — | — | — |
+| Active tab | Tab label. Active indicator (underline, fill, or contrasting background). Content area shows this tab's content. | — | — | — | — |
+| Hovered (inactive) | Tab background fills slightly | Mouse over | — | 60ms | — |
+| Focused (keyboard/gamepad) | Focus ring on tab label. | Tab key (within tab bar) or D-pad left/right on tab row | — | 60ms | [UI focus sound] |
+| Activated | Active indicator transitions to this tab. Content area transitions (fade or slide). | Click / Enter / A / Cross | Switch active tab. Content update. | 150ms ease | [UI tab switch sound] |
+| Gamepad shoulder button | — | L1/R1 (PS) or LB/RB (Xbox) | Switch to previous/next tab (standard platform convention) | 150ms | [UI tab switch sound] |
+
+**Accessibility**:
+- Keyboard: Arrow keys navigate between tabs within the tab bar (left/right). Tab key moves focus into the content area below. This follows the ARIA tab panel pattern.
+- Screen reader: Role: "tab" for individual tabs. Role: "tablist" for the container. Role: "tabpanel" for the content area. Active tab state: "selected." Accessible name: tab label. Tabpanel is labeled by its corresponding tab.
+- The active tab must be visually distinguishable by more than color alone (underline, fill pattern, or weight change in addition to color).
+
+**Implementation Notes**: [Godot: `TabContainer` built-in. For custom visual
+styling, implement manually with a `HBoxContainer` of tab buttons and a
+`MarginContainer` for content. The shoulder button shortcut (LB/RB) must be
+implemented in the screen's `_input()` override — it is not built into Godot's
+tab system. Check platform conventions: Xbox uses LB/RB; PlayStation uses L1/R1;
+both are the same physical button, so a single binding works.]
+
+---
+
+#### Scroll Container
+
+**Category**: Layout
+**Status**: Draft
+**When to Use**: Content that exceeds the visible area of its container. Inventory
+lists, lore entry text, credits, long settings lists. The scroll indicator shows
+the player that more content exists.
+**When NOT to Use**: Content that can be paginated instead (pagination may be
+clearer for dense list navigation). Infinite scroll (always provide a loading
+state and an end state).
+
+**Interaction Specification**:
+
+| State | Visual | Input | Response | Duration | Audio |
+|-------|--------|-------|----------|----------|-------|
+| Content fits | No scrollbar visible (or always-visible scrollbar at full height, depending on art direction). | — | — | — | — |
+| Scrollable | Scrollbar appears (right edge). Scrollbar thumb size represents viewport vs. content ratio. | — | — | — | — |
+| Scrolling (mouse) | Content moves. Scrollbar thumb moves proportionally. | Mouse wheel | Scroll by 3 lines per wheel tick (configurable in OS) | Smooth | — |
+| Scrollbar drag | Content moves. Thumb follows pointer. | Click + drag scrollbar thumb | Scroll proportionally | Real time | — |
+| Keyboard scroll | Content moves one item height per keypress. | Up/Down arrows when container is focused and no child is focused | Scroll by one unit | Immediate | — |
+| Gamepad scroll | Content moves to keep focused item in view. | D-pad navigation to items beyond visible area | Auto-scroll to keep focused item visible | Smooth 150ms | — |
+| Scroll top / bottom | Content stops. Scrollbar thumb at end. | Content boundary reached | Stop scrolling | — | — |
+| Focus follows scroll | When a child element receives focus, scroll container ensures it is fully visible. | Any child receives focus | Scroll to reveal focused element | 200ms ease | — |
+
+**Accessibility**:
+- Keyboard/Gamepad: The scroll container itself should not require explicit scrollbar interaction — navigating list items inside it should auto-scroll to keep focused items in view.
+- Screen reader: The scroll container announces "scrollable" and the scroll position ("showing items 5 through 15 of 30"). This requires engine accessibility support — verify in engine-reference/godot/.
+- Fade edges (content fading at scroll boundaries to indicate more content exists) are a helpful visual affordance but must not be the only indicator that content exists beyond the visible area. Include a scrollbar.
+
+**Implementation Notes**: [Godot `ScrollContainer`: call `ensure_control_visible()`
+on the focused child whenever `gui_focus_changed` fires inside the container.
+Bind this via a recursive `connect` on the container's `gui_focus_changed` signal.
+For smooth scroll animation, use a `Tween` on `scroll_vertical` rather than
+setting it directly.]
+
+---
diff --git a/.claude/docs/templates/guidance/interaction-pattern-library-guide.md b/.claude/docs/templates/guidance/interaction-pattern-library-guide.md
new file mode 100644
index 00000000..319af404
--- /dev/null
+++ b/.claude/docs/templates/guidance/interaction-pattern-library-guide.md
@@ -0,0 +1,20 @@
+> Authoring guidance for interaction-pattern-library.md. Load only the part covering the section currently being authored — not the whole file at once.
+
+# Interaction Pattern Library — Guidance Index
+
+The guidance for this template is split by major section so consumers can load
+one part at a time. Read the file matching the section you are currently
+authoring — never all three at once.
+
+| Template Section | Guidance File |
+|------------------|---------------|
+| Standard Control Patterns (Button variants, Toggle, Slider, Dropdown / Select, List Item, Grid Item, Modal Dialog, Confirmation Dialog, Toast / Notification, Tooltip, Progress Bar, Input Field, Tab Bar, Scroll Container) | `.claude/docs/templates/guidance/interaction-pattern-library-guide-standard-controls.md` |
+| Game-Specific UI Patterns (Inventory Slot, Ability / Skill Icon, Health / Resource Bar, Dialogue Box, Context Action Prompt, Damage Number) | `.claude/docs/templates/guidance/interaction-pattern-library-guide-game-specific.md` |
+| Navigation Patterns + Feedback and Loading Patterns (Screen Push / Pop / Replace, Focus Management, Escape / Cancel, Loading State, Empty State, Error State) | `.claude/docs/templates/guidance/interaction-pattern-library-guide-navigation-feedback.md` |
+
+Each guidance file contains the full reference specification for its patterns —
+When to Use / When NOT to Use rationale, complete state tables with timing and
+audio values, accessibility requirements, and engine implementation notes. Use
+them as the worked-example source when filling the corresponding skeleton stubs
+in the template. The Pattern Catalog Index, Animation Standards, Sound
+Standards, and Open Questions sections remain in the template itself.
diff --git a/.claude/docs/templates/guidance/ux-spec-guide.md b/.claude/docs/templates/guidance/ux-spec-guide.md
new file mode 100644
index 00000000..40e89f89
--- /dev/null
+++ b/.claude/docs/templates/guidance/ux-spec-guide.md
@@ -0,0 +1,443 @@
+> Authoring guidance for ux-spec.md. Load only the part covering the section currently being authored — not the whole file at once.
+
+# UX Specification Template — Authoring Guidance
+
+Guidance is organized by template section number. When authoring a section of a
+project's UX spec, read only that section's guidance below.
+
+---
+
+## Section 1 — Purpose & Player Need
+
+> **Why this section exists**: Every screen must justify its existence from the
+> player's perspective. Screens that are designed from a developer perspective ("display
+> the save data") produce cluttered, confusing interfaces. Screens designed from the
+> player's perspective ("let the player feel confident their progress is safe before they
+> put the controller down") produce purposeful, calm interfaces. Write this section before
+> touching any layout decisions — it is the filter through which every subsequent choice
+> is evaluated.
+
+**Authoring the player need**:
+
+[One paragraph. Name the real human need, not the system function. Consider: what would
+a player say they want when they open this screen? What would frustrate them if it did
+not work? That frustration describes the need.
+
+Example — bad: "Displays the player's current items and equipment."
+Example — good: "Lets the player understand what they're carrying and quickly decide what
+to take into the next encounter, without breaking their mental model of the game world.
+The inventory is the player's planning tool between moments of action."]
+
+**Authoring the player goal**:
+
+[One sentence. Specific enough that you could write an acceptance criterion for it.
+Example: "Find the item they are looking for within three button presses and equip it
+without navigating to a separate screen."]
+
+**Authoring the game goal**:
+
+[One sentence. This is what the system needs from this interaction. Example: "Record the
+player's equipment choices and relay them to the combat system before the next encounter
+loads." This section prevents UI that looks good but fails to serve the system it is
+part of.]
+
+---
+
+## Section 2 — Player Context on Arrival
+
+> **Why this section exists**: Screens do not exist in isolation. A player opening the
+> inventory mid-combat is in a completely different cognitive and emotional state than
+> a player opening it after clearing a dungeon. The same information architecture can
+> feel oppressively complex in one context and trivially simple in another. Document the
+> context so that design decisions — what to show first, what to hide, what to animate,
+> what to simplify — are calibrated to the actual player arriving at this screen, not
+> an abstract user.
+
+**Worked example answers for the context table**:
+
+| Question | Answer |
+|----------|--------|
+| What was the player just doing? | [e.g., Completed a combat encounter / Pressed Esc from exploration / Triggered a story cutscene] |
+| What is their emotional state? | [e.g., High tension — just narrowly survived / Calm — exploring between objectives] |
+| What cognitive load are they carrying? | [e.g., High — actively tracking enemy positions / Low — no active threats] |
+| What information do they already have? | [e.g., They know they just picked up an item but haven't seen its stats yet] |
+| What are they most likely trying to do? | [e.g., Check if the new item is better than their current weapon — primary use case] |
+| What are they likely afraid of? | [e.g., Missing something, making an irreversible mistake, losing track of where they were] |
+
+**Authoring the emotional design target**:
+
+[One sentence describing the feeling the player should have while using this screen.
+Example: "Confident and in control — the player should feel like they have complete
+information and complete authority over their choices, with no ambiguity about outcomes."]
+
+---
+
+## Section 3 — Navigation Position
+
+> **Why this section exists**: A screen that does not know where it sits in the
+> navigation hierarchy cannot define its entry/exit transitions, its back-button
+> behavior, or its relationship to the game's pause state. Navigation position also
+> reveals architectural problems early — if this screen is reachable from eight
+> different places, that is a complexity flag that should be resolved in design, not
+> implementation.
+
+**Worked example — reachability table**:
+
+| Entry Point | Triggered By | Notes |
+|-------------|-------------|-------|
+| [e.g., Main Menu → Play] | [Player selects "New Game"] | [Primary entry point] |
+| [e.g., Pause Menu → Resume] | [Player presses Start from any gameplay state] | [Secondary entry] |
+| [e.g., Game event] | [Tutorial system forces open first time only] | [Systemic entry — must not break if player dismisses] |
+
+---
+
+## Section 4 — Entry & Exit Points
+
+> **Why this section exists**: Entry and exit define the screen's contract with the
+> rest of the navigation system. Every entry point must have a corresponding exit point.
+> Transitions that are undefined become bugs — the player finds themselves stuck, or the
+> game state becomes inconsistent. Fill this table completely before implementation
+> begins. Empty cells are a sign that design work is unfinished.
+
+**Worked example — entry table**:
+
+| Trigger | Source Screen / State | Transition Type | Data Passed In | Notes |
+|---------|----------------------|-----------------|----------------|-------|
+| [e.g., Player presses Inventory button] | [Gameplay / Exploration state] | [Overlay push — game pauses] | [Current player loadout, inventory contents] | [Works from any non-combat state] |
+| [e.g., Item pickup prompt accepted] | [Gameplay / Item Pickup dialog] | [Replace dialog with full inventory] | [Newly acquired item pre-highlighted] | [The new item should be visually distinguished on open] |
+| [e.g., Quest system directs player to inventory] | [Gameplay / Quest Update notification] | [Overlay push] | [Quest-relevant item ID for highlight] | [Screen should deep-link to the relevant item] |
+
+**Worked example — exit table**:
+
+| Exit Action | Destination | Transition Type | Data Returned / Saved | Notes |
+|-------------|------------|-----------------|----------------------|-------|
+| [e.g., Player closes inventory (Back/B/Esc)] | [Previous state — Exploration] | [Overlay pop — game resumes] | [Updated equipment loadout committed] | [Changes must be committed before transition begins] |
+| [e.g., Player selects "Equip" on item] | [Same screen, updated state] | [In-place state change] | [Loadout change event fired] | [No navigation, just a state refresh] |
+| [e.g., Player navigates to Map from inventory shortcut] | [Map Screen] | [Replace] | [No data] | [Inventory state is preserved if player returns] |
+
+---
+
+## Section 5 — Layout Specification
+
+> **Why this section exists**: The layout specification is the handoff artifact between
+> UX design and UI programming. It does not need to be pixel-perfect — it needs to
+> communicate hierarchy (what is important), proximity (what belongs together), and
+> proportion (what is big vs. small). ASCII wireframes achieve this without requiring
+> design software. A programmer who reads this section should be able to build the
+> correct structure without guessing. An artist who reads it should know where
+> visual weight should be concentrated.
+>
+> Draw the layout at one standard resolution (e.g., 1920x1080). Note adaptations
+> for other resolutions separately.
+
+**Worked example — wireframe (5.1)**:
+
+```
+Example:
+┌──────────────────────────────────────────────┐
+│ [← Back] INVENTORY [Options] │ ← HEADER ZONE
+├──────────────────────────────────────────────┤
+│ ┌──────────────┐ ┌─────────────────────────┐│
+│ │ CATEGORY NAV │ │ ITEM DETAIL PANEL ││ ← CONTENT ZONE
+│ │ ● Weapons │ │ Item Name ││
+│ │ Armor │ │ {item icon} ││
+│ │ Consumable│ │ Stats comparison ││
+│ │ Key Items │ │ Description text... ││
+│ ├──────────────┤ └─────────────────────────┘│
+│ │ ITEM GRID │ │
+│ │ {□}{□}{□}{□} │ │
+│ │ {□}{□}{□}{□} │ │
+│ │ ... │ │
+│ └──────────────┘ │
+├──────────────────────────────────────────────┤
+│ [Equip] [Drop] [Compare] [Close] │ ← ACTION BAR
+└──────────────────────────────────────────────┘
+```
+
+**Worked example — zone definitions table (5.2)**:
+
+| Zone Name | Description | Approximate Size | Scrollable? | Overflow Behavior |
+|-----------|-------------|-----------------|-------------|-------------------|
+| [e.g., Header Zone] | [Top bar: navigation, screen title, global actions] | [Full width, ~10% height] | [No] | [Truncate long screen names with ellipsis] |
+| [e.g., Category Nav] | [Left panel: item category tabs] | [~25% width, ~75% height] | [Yes — vertical if categories exceed panel] | [Scroll indicator appears at bottom of list] |
+| [e.g., Item Grid] | [Center: grid of item icons for selected category] | [~45% width, ~75% height] | [Yes — vertical] | [Page-based: 4x4 grid, next page on overflow] |
+| [e.g., Detail Panel] | [Right: stats and description for selected item] | [~30% width, ~75% height] | [Yes — vertical for long descriptions] | [Fade at bottom, scroll to reveal] |
+| [e.g., Action Bar] | [Bottom: context-sensitive actions for selected item] | [Full width, ~15% height] | [No] | [Actions collapse to icon-only below 4] |
+
+**Worked example — component inventory table (5.3)**:
+
+| Component Name | Type | Zone | Purpose | Required? | Reuses Existing Component? |
+|----------------|------|------|---------|-----------|---------------------------|
+| [e.g., Back Button] | [Button] | [Header] | [Returns to previous screen] | [Yes] | [Yes — standard NavButton component] |
+| [e.g., Screen Title Label] | [Text] | [Header] | [Displays "INVENTORY" or context name] | [Yes] | [Yes — ScreenTitle component] |
+| [e.g., Category Tab] | [Toggle Button] | [Category Nav] | [Filters item grid by category] | [Yes] | [No — new component needed] |
+| [e.g., Item Slot] | [Icon + Frame] | [Item Grid] | [Represents one inventory slot, empty or filled] | [Yes] | [No — new component] |
+| [e.g., Item Name Label] | [Text] | [Detail Panel] | [Shows selected item's name] | [Yes] | [Yes — BodyText component] |
+| [e.g., Stat Comparison Row] | [Compound — label + value + delta] | [Detail Panel] | [Shows stat value vs. currently equipped] | [Yes] | [No — new component] |
+| [e.g., Equip Button] | [Primary Button] | [Action Bar] | [Equips selected item in appropriate slot] | [Yes] | [Yes — PrimaryAction component] |
+| [e.g., Empty State Message] | [Text + Icon] | [Item Grid] | [Shown when category has no items] | [Yes] | [Yes — EmptyState component] |
+
+**Worked example — primary focus element on open**: [e.g., The first item in the Item Grid — or, if deep-linked, the highlighted item. If the grid is empty, focus lands on the first Category Tab.]
+
+---
+
+## Section 6 — States & Variants
+
+> **Why this section exists**: A screen is not a single picture — it is a set of
+> states, each of which must look correct and behave correctly. Screens that are
+> designed only in their "happy path" state ship with broken empty states, invisible
+> loading indicators, and crashes when data is missing. Document every state before
+> implementation. The states table is also the test matrix for QA.
+
+**Worked example table**:
+
+| State Name | Trigger | What Changes Visually | What Changes Behaviorally | Notes |
+|------------|---------|----------------------|--------------------------|-------|
+| [Loading] | [Screen is opening, data not yet available] | [Item Grid shows skeleton/shimmer placeholders; Action Bar buttons disabled] | [No interactions possible except Close] | [Should not be visible >500ms under normal conditions; if it is, investigate data fetch performance] |
+| [Empty — no items in category] | [Player switches to a category with zero items] | [Item Grid replaced by EmptyState component: icon + "Nothing here yet."] | [Action Bar shows no item actions; Drop/Equip/Compare all hidden] | [Do not show disabled buttons — remove them. Disabled buttons with no tooltip are confusing.] |
+| [Populated — items present] | [Category has at least one item] | [Item Grid fills with item slots; first slot is auto-focused] | [All item actions available for selected item] | [Default and most common state] |
+| [Item Selected] | [Player navigates to an item slot] | [Detail Panel populates; selected slot has focus ring; Action Bar updates to item's valid actions] | [Equip/Drop/Compare enabled based on item type] | [Equip is disabled if item is already equipped — show a "Equipped" badge instead] |
+| [Confirmation Pending — Drop] | [Player selects Drop action] | [Confirmation dialog overlays the screen] | [All background interactions suspended until dialog resolves] | [Use a modal confirmation, not an inline toggle. Items cannot be recovered after dropping.] |
+| [Error — data load failed] | [Inventory data could not be retrieved] | [Item Grid shows error state: icon + "Couldn't load items." + Retry button] | [Only Retry and Close are available] | [Log the error; do not expose technical details to player] |
+| [Item Newly Acquired] | [Screen opened from item pickup deep-link] | [Newly acquired item has a visual "New" badge; Detail Panel pre-populated with that item] | [Same as Item Selected but with badge until player navigates away] | [Badge persists until the player manually navigates off that slot once] |
+
+---
+
+## Section 7 — Interaction Map
+
+> **Why this section exists**: This section is the source of truth for what every
+> input does on this screen. It forces the designer to think through every input
+> method (mouse, keyboard, gamepad, touch) and every interactive state (hover, focus,
+> pressed, disabled). Gaps in this table are bugs waiting to happen. The
+> interaction map is also the input for the accessibility audit — if an action is
+> only reachable by mouse, it will fail the keyboard and gamepad columns.
+
+**Worked example — navigation inputs (7.1)**:
+
+| Input | Platform | Action | Visual Response | Audio Cue | Notes |
+|-------|----------|--------|-----------------|-----------|-------|
+| [Arrow keys / D-Pad] | [All] | [Move focus within active zone] | [Focus ring moves to adjacent element] | [Soft navigation tick] | [Wrap at edges within zone; do not cross zones with arrows alone] |
+| [Tab / R1] | [KB / Gamepad] | [Move focus to next zone (Category → Grid → Detail → Action Bar)] | [Focus ring jumps to first element in next zone] | [Distinct zone-change tone] | [Shift+Tab / L1 goes backward] |
+| [Mouse hover] | [PC] | [Show hover state on interactive elements] | [Highlight / underline / color shift] | [None] | [Hover does NOT move focus — only click does] |
+| [Mouse click] | [PC] | [Select and focus the clicked element] | [Pressed state flash, then selected/focused] | [Soft click] | [Right-click opens context menu if applicable; otherwise no-op] |
+| [Touch tap] | [Mobile] | [Select and activate in one gesture] | [Press ripple] | [Soft click] | [Treat tap as click + confirm for low-risk actions; require explicit confirm for destructive actions] |
+
+**Worked example — action inputs (7.2)**:
+
+| Input | Platform | Context (What must be focused) | Action | Response | Animation | Audio Cue | Notes |
+|-------|----------|-------------------------------|--------|----------|-----------|-----------|-------|
+| [Enter / A button / Left click] | [All] | [Item slot focused] | [Select item → populate Detail Panel] | [Detail panel slides in or updates in place] | [Panel fade/slide in, 120ms] | [Soft select tone] | [If item already selected: no-op] |
+| [Enter / A button] | [All] | [Equip button focused] | [Equip selected item] | [Button animates press; item badge updates to "Equipped"; previously equipped item loses badge] | [Badge swap, 80ms] | [Equip success sound] | [Fires EquipItem event to Inventory system] |
+| [Triangle / Y button / Right-click] | [All] | [Item slot focused] | [Open item context menu] | [Context menu appears adjacent to item slot] | [Popover, 80ms] | [Menu open sound] | [Context menu contains: Equip, Drop, Inspect, Compare] |
+| [Square / X button] | [Gamepad] | [Item slot focused] | [Quick-equip without opening detail] | [Equip animation plays inline on slot] | [Slot flash, 80ms] | [Equip success sound] | [Convenience shortcut; does not change screen state] |
+| [Esc / B button / Back] | [All] | [Any, screen level] | [Close screen and return to previous state] | [Screen exit transition plays] | [Slide out, 200ms] | [Back/close tone] | [Commits all changes before closing. No discard — inventory is not a draft.] |
+| [F / L2] | [KB / Gamepad] | [Any] | [Toggle filter panel] | [Sort/filter overlay opens] | [Slide in from right, 200ms] | [Panel open tone] | [If no items in category, filter is disabled] |
+
+**Worked example — state-specific behaviors (7.3)**:
+
+| State | Input Restriction | Reason |
+|-------|------------------|--------|
+| [Loading] | [All item and action inputs disabled] | [No data to act on; prevent race conditions] |
+| [Confirmation dialog open] | [Only Confirm and Cancel inputs active] | [Modal — background is locked] |
+| [Error state] | [Only Retry and Close active] | [No data available to navigate] |
+
+---
+
+## Section 8 — Data Requirements
+
+> **Why this section exists**: The separation between UI and game state is the most
+> important architectural boundary in a game's UI system. UI reads data; it does not
+> own it. UI fires events; it does not write state directly. This section defines
+> exactly what data this screen needs to display, where it comes from, and how
+> frequently it updates. Filling this table before implementation prevents two
+> common failure modes: (1) UI developers reaching into systems they should not touch,
+> and (2) systems not knowing they need to expose data until a UI is half-built.
+
+**Worked example table**:
+
+| Data Element | Source System | Update Frequency | Who Owns It | Format | Null / Missing Handling |
+|--------------|--------------|-----------------|-------------|--------|------------------------|
+| [e.g., Item list] | [Inventory System] | [On screen open; on InventoryChanged event] | [InventorySystem] | [Array of ItemData structs: id, name, icon_path, category, stats, is_equipped] | [Empty array → show Empty State. Never null — system must return array.] |
+| [e.g., Equipped loadout] | [Equipment System] | [On screen open; on EquipmentChanged event] | [EquipmentSystem] | [Dict mapping slot_id → item_id] | [Unequipped slot has null value — UI shows empty slot icon] |
+| [e.g., Item stat comparisons] | [Stats System] | [On item selection change] | [StatsSystem] | [Dict mapping stat_name → {current, new, delta}] | [If no item selected, detail panel shows placeholder. Stats system must handle this gracefully.] |
+| [e.g., Player currency] | [Economy System] | [On screen open only — inventory does not show live currency] | [EconomySystem] | [Int — gold pieces] | [If currency system not active for this game mode, hide the currency row entirely] |
+| [e.g., Newly acquired item flag] | [Inventory System] | [On screen open] | [InventorySystem] | [Array of item_ids flagged as new] | [If empty array, no badges shown] |
+
+---
+
+## Section 9 — Events Fired
+
+> **Why this section exists**: This is the other half of the UI/system boundary.
+> Where Section 8 defines what the UI reads, this section defines what the UI
+> communicates back to the game. Specifying events at design time prevents UI
+> programmers from writing game logic, and prevents game programmers from being
+> surprised by what the UI does. Every destructive or state-changing player action
+> must appear in this table.
+
+**Worked example table**:
+
+| Player Action | Event Fired | Payload | Receiver System | Notes |
+|---------------|-------------|---------|-----------------|-------|
+| [Player equips an item] | [EquipItemRequested] | [{item_id: string, target_slot: string}] | [Equipment System] | [Equipment System validates the action and fires EquipmentChanged if successful; UI listens for EquipmentChanged to update its display] |
+| [Player drops an item] | [DropItemRequested] | [{item_id: string, quantity: int}] | [Inventory System] | [Fires only after player confirms the drop dialog. Inventory System removes the item and fires InventoryChanged.] |
+| [Player opens item compare] | [ItemCompareOpened] | [{item_a_id: string, item_b_id: string}] | [Analytics System] | [No game-state change — analytics event only. Compare view is purely local UI state.] |
+| [Player closes screen] | [InventoryScreenClosed] | [{session_duration_ms: int}] | [Analytics System] | [Fires on every close regardless of reason. Used for engagement metrics.] |
+| [Player navigates between categories] | [InventoryCategoryChanged] | [{category: string}] | [Analytics System] | [Analytics only. No game state change.] |
+
+---
+
+## Section 10 — Transition & Animation
+
+> **Why this section exists**: Transitions are not decoration — they communicate
+> hierarchy and causality. A screen that slides in from the right implies the
+> player has moved forward. A screen that fades implies a context break. Inconsistent
+> transitions make navigation feel broken even when it is technically correct.
+> This section ensures transitions are specified intentionally, not left to the
+> developer's discretion, and that accessibility settings (reduced motion) are
+> planned for from the start.
+
+**Worked example table**:
+
+| Transition | Trigger | Direction / Type | Duration (ms) | Easing | Interruptible? | Skipped by Reduced Motion? |
+|------------|---------|-----------------|--------------|--------|----------------|---------------------------|
+| [Screen enter] | [Screen pushed onto stack] | [Slide in from right] | [250] | [Ease out cubic] | [No — must complete before interaction is enabled] | [Yes — instant appear at 0ms] |
+| [Screen exit — Back] | [Player presses Back] | [Slide out to right] | [200] | [Ease in cubic] | [No] | [Yes — instant disappear] |
+| [Screen exit — Forward] | [Player navigates to child screen] | [Slide out to left] | [200] | [Ease in cubic] | [No] | [Yes — instant] |
+| [Detail panel update] | [Player selects a new item] | [Cross-fade content] | [120] | [Linear] | [Yes — if player navigates quickly, previous animation cancels] | [Yes — instant swap] |
+| [Loading → Populated] | [Data arrives after load] | [Skeleton shimmer fades out, content fades in] | [180] | [Ease out] | [No] | [Yes — instant reveal] |
+| [Action Bar button press] | [Player activates a button] | [Scale down 95% on press, return on release] | [60 down / 60 up] | [Ease out / ease in] | [Yes — if released early, returns to normal] | [No — this is tactile feedback, not decorative motion] |
+| [Confirmation dialog open] | [Player initiates destructive action] | [Background dims 60% opacity; dialog scales up from 95%] | [150] | [Ease out] | [No] | [Yes — instant appear, no scale] |
+| [New item badge appear] | [Screen opens with newly acquired item] | [Badge pops from 0% to 110% to 100% scale] | [200 total] | [Ease out back] | [No] | [Yes — instant appear at 100% scale] |
+
+---
+
+## Section 11 — Input Method Completeness Checklist
+
+> **Why this section exists**: Input completeness is not optional — it is a
+> certification requirement for console platforms and a legal risk area for
+> accessibility laws in multiple markets. Fill this checklist before marking
+> the spec as Approved. Any unchecked item blocks implementation start.
+
+---
+
+## Section 12 — Screen-Level Accessibility Requirements
+
+> **Why this section exists**: Accessibility requirements must be specified at design
+> time because retrofitting them is expensive and often architecturally impractical.
+> This section documents requirements specific to this screen. Project-wide standards
+> live in `design/accessibility-requirements.md` — consult it before filling this
+> section so you do not duplicate or contradict project-level commitments.
+
+**Worked example — text contrast table**:
+
+| Text Element | Background Context | Required Ratio | Current Ratio | Pass? |
+|--------------|-------------------|---------------|---------------|-------|
+| [e.g., Item name in Detail Panel] | [Dark panel background ~#1a1a1a] | [4.5:1 (WCAG AA normal text)] | [TBD — verify in implementation] | [ ] |
+| [e.g., Category tab label — inactive] | [Mid-grey tab background] | [4.5:1] | [TBD] | [ ] |
+| [e.g., Category tab label — active] | [Accent color background] | [4.5:1] | [TBD] | [ ] |
+| [e.g., Action button label] | [Button color (varies by state)] | [4.5:1] | [TBD] | [ ] |
+| [e.g., Stat comparison delta (positive)] | [Detail panel] | [4.5:1 — do NOT rely on green color alone] | [TBD] | [ ] |
+
+**Worked example — colorblind mitigations table**:
+
+| Element | Colorblind Risk | Mitigation |
+|---------|----------------|------------|
+| [e.g., Stat delta indicators (red/green for worse/better)] | [Red-green colorblindness (Deuteranopia) — most common form] | [Add arrow icons (↑ / ↓) and +/- prefix in addition to color. Color is a redundant, not sole, indicator.] |
+| [e.g., Item rarity color coding (grey/green/blue/purple/orange)] | [Multiple types — rarity color is a common industry failure] | [Add rarity name text label below icon. Color is supplemental only.] |
+
+**Worked example — focus order**:
+
+[e.g.,
+1. Back button (Header)
+2. Options button (Header)
+3. Category Tab 1 — Weapons
+4. Category Tab 2 — Armor
+5. Category Tab 3 — Consumables
+6. Category Tab 4 — Key Items
+7. Item Slot [0,0]
+8. Item Slot [0,1] ... (grid traverses left-to-right, top-to-bottom)
+9. Last item slot
+10. Equip button (Action Bar)
+11. Drop button (Action Bar)
+12. Compare button (Action Bar)
+13. Close button (Action Bar)
+→ Cycles back to Back button
+
+Focus does not enter the Detail Panel — it is a display panel driven by item focus, not independently navigable.]
+
+**Worked example — screen reader announcements table**:
+
+| State Change | Announcement Text | Announcement Timing |
+|--------------|------------------|---------------------|
+| [Screen opens] | ["Inventory screen. [N] items. [Active category] selected."] | [On screen focus settle] |
+| [Player focuses an item slot] | ["[Item name]. [Category]. [Rarity]. [Key stats summary]. [Equipped / Not equipped]."] | [On focus arrival] |
+| [Player equips an item] | ["[Item name] equipped to [slot name]."] | [After EquipmentChanged event confirmed] |
+| [Player drops an item] | ["[Item name] dropped."] | [After InventoryChanged event confirmed] |
+| [Category changes] | ["[Category name]. [N] items."] | [On category tab focus] |
+| [Empty state shown] | ["No items in [category name]."] | [When empty state renders] |
+
+**Authoring the cognitive load assessment**:
+
+[Estimate the number of information streams the player is simultaneously tracking while
+using this screen. For this screen: (1) item grid position, (2) item detail stats,
+(3) current equipment loadout for comparison, (4) available actions, (5) item category.
+That is 5 concurrent streams — within the standard 7±2 limit, but at the higher end.
+Mitigation: detail panel auto-updates on navigation so the player never needs to
+manually retrieve item info. Reduce active decisions by surfacing stat comparison
+automatically.]
+
+---
+
+## Section 13 — Localization Considerations
+
+> **Why this section exists**: UI built without localization in mind breaks on first
+> translation. German text is typically 30–40% longer than English. Arabic and Hebrew
+> require right-to-left layout mirroring. Japanese and Chinese text may be significantly
+> shorter than English, creating awkward whitespace. These issues are cheap to plan for
+> and expensive to fix after a layout is built and shipped. Every text element should
+> have an explicit max-character count and a plan for overflow.
+
+**Worked example table**:
+
+| Text Element | English Baseline Length | Max Characters | Expansion Budget | RTL Behavior | Overflow Behavior | Risk |
+|--------------|------------------------|----------------|-----------------|--------------|-------------------|------|
+| [e.g., Screen title "INVENTORY"] | [9 chars] | [16 chars] | [78%] | [Mirror to right, or center — acceptable] | [Truncate with ellipsis — title is not critical content] | [Low] |
+| [e.g., Item name] | [~15 chars avg, max ~35 "Enchanted Dragon Scale Gauntlets"] | [50 chars] | [43%] | [Right-align in RTL layouts] | [Truncate with tooltip showing full name on hover/focus] | [Medium — long fantasy item names are common] |
+| [e.g., Item description] | [~80–120 chars] | [200 chars] | [67%] | [Right-align, wrap normally] | [Scroll within Detail Panel — no truncation] | [Low — panel is scrollable] |
+| [e.g., Action button "Equip"] | [5 chars] | [14 chars] | [180%] | [Button layout mirrors; text right-aligns] | [Shrink font to 90% minimum, then truncate] | [Medium — "Ausrüsten" in German is 9 chars] |
+| [e.g., Category tab "Consumables"] | [11 chars] | [18 chars] | [64%] | [Mirror tab position] | [Abbreviate: "Consum." — define abbreviations per language in loc file] | [High — long localized tab labels are a known problem] |
+
+---
+
+## Section 14 — Acceptance Criteria
+
+> **Why this section exists**: Acceptance criteria are the contractual definition of
+> "done." Without them, implementation is complete when the developer says it is.
+> With them, implementation is complete when a QA tester can verify every item on
+> this list. Write criteria that a tester can verify independently, without asking the
+> designer what they meant. Every criterion should be binary — pass or fail, not
+> subjective.
+
+**Worked example criteria (inventory screen)** — note how each is screen-specific
+and independently verifiable:
+
+- [ ] Navigation between items produces no perceptible frame drop (maintain target framerate ±5fps)
+- [ ] All states (Loading, Empty, Populated, Error, Confirmation) render correctly
+- [ ] Item grid scrolls smoothly without frame drops when all item slots are populated
+- [ ] Inventory changes persist correctly after screen is closed and reopened
+- [ ] Screen handles InventoryChanged events fired by other systems while it is open without crashing
+- [ ] Stat comparison does not rely on color alone as the sole differentiator
+- [ ] Screen reader announces item name and key stats on focus (verify with platform screen reader)
+
+---
+
+## Section 15 — Open Questions
+
+**Worked example questions**:
+
+| Question | Owner | Deadline | Resolution |
+|----------|-------|----------|-----------|
+| [e.g., Should item comparison be automatic (always showing equipped stats) or player-triggered (press Compare)?] | [ui-designer] | [Sprint 4, Day 3] | [Pending] |
+| [e.g., Do we support controller cursor (free aim) in the item grid, or d-pad-only grid navigation?] | [lead-programmer + ui-designer] | [Sprint 4, Day 3] | [Pending — depends on ADR-0015 input model decision] |
+| [e.g., What is the game's item drop policy — permanent loss or drop-to-world?] | [systems-designer] | [Requires GDD update] | [Blocked on inventory GDD Edge Cases section] |
+| [e.g., Maximum inventory size — does the grid have a hard cap or is it infinite-scroll?] | [economy-designer] | [Sprint 3, Day 5] | [Pending] |
diff --git a/.claude/docs/templates/hud-design.md b/.claude/docs/templates/hud-design.md
index 73172785..848d58e8 100644
--- a/.claude/docs/templates/hud-design.md
+++ b/.claude/docs/templates/hud-design.md
@@ -1,5 +1,7 @@
# HUD Design: [Game Name]
+> Authoring guidance: .claude/docs/templates/guidance/hud-design-guide.md (load per-section as you author — do not read entirely).
+
> **Status**: Draft | In Review | Approved | Implemented
> **Author**: [Name or agent — e.g., ui-designer]
> **Last Updated**: [Date]
@@ -20,89 +22,34 @@
## 1. HUD Philosophy
-> **Why this section exists**: The HUD design philosophy is not decoration — it is a
-> design constraint that every subsequent decision is measured against. Without a
-> philosophy, individual elements get added on request ("the quest tracker wants a
-> bigger icon") without any principled way to push back. With a philosophy, there is
-> a shared, explicit standard. More importantly, the philosophy prevents the HUD from
-> slowly growing to cover the game world while each individual addition seemed
-> reasonable in isolation. Write this before specifying any elements.
-
**What is this game's relationship with on-screen information?**
-[One paragraph. This is a design statement, not a description of features. Consider
-the game's genre, pacing, and player fantasy. A stealth game's HUD philosophy might
-be: "The world is the interface. If the player has to look away from the environment
-to survive, the HUD has failed." A tactics game might say: "Complete situational
-awareness is the game. The HUD is not an overlay — it is the battlefield."
-
-Reference comparable games if helpful, but describe your specific stance:
-Example — diegetic-first action RPG: "We treat screen information as a concession,
-not a feature. Every HUD element must earn its pixel space by answering the question:
-would the player make demonstrably worse decisions without this information visible?
-If the answer is 'they'd adapt,' we put it in the environment instead."]
+[One-paragraph design statement — see guide Section 1 for framing and examples]
**Visibility principle** — when in doubt, show or hide?
-[State the default resolution for ambiguous cases. Options:
-- Default to HIDE: information is available on demand (e.g., Dark Souls — no quest tracker, no minimap, stats are in a menu)
-- Default to SHOW: players prefer to be informed; cluttered is better than uncertain
-- Default to CONTEXTUAL: information appears when it becomes relevant and fades when it does not
-Most games benefit from contextual defaults. State your game's default clearly so every element decision is consistent.]
+[Default resolution for ambiguous cases: HIDE / SHOW / CONTEXTUAL — see guide]
**The Rule of Necessity for this game**:
-[Complete this sentence: "A HUD element earns its place when ______________."
-
-Example: "...the player would have to stop playing to find the same information
-elsewhere, or would make meaningfully worse decisions without it."
-
-Example: "...removing it in playtesting causes measurable frustration or confusion
-in more than 25% of testers within the first hour of play."
-
-This rule is the veto power over feature requests to add HUD elements. Document it
-so it can be cited in design reviews.]
+["A HUD element earns its place when ______________." — see guide for examples]
---
## 2. Information Architecture
-> **Why this section exists**: Before specifying any HUD element's visual design,
-> position, or behavior, you must answer a more fundamental question: should this
-> information be on the HUD at all? This section is a forcing function — it requires
-> you to categorize EVERY piece of information the game world generates and make an
-> explicit, intentional decision about how each is presented. "We'll figure that out
-> later" is how games end up with 18 elements competing for the player's peripheral
-> vision. This table is the master inventory of game information, not just HUD information.
+> Categorize EVERY piece of information the game generates — this is the master
+> inventory of game information, not just HUD information. See guide Section 2
+> for a worked example covering typical information types.
| Information Type | Always Show | Contextual (show when relevant) | On Demand (menu/button) | Hidden (environmental / diegetic) | Reasoning |
|-----------------|-------------|--------------------------------|------------------------|----------------------------------|-----------|
-| [Health / Vitality] | [X if action game — player needs constant awareness] | [X if exploration game — show only when injured] | [ ] | [ ] | [Example: always visible because health decisions (retreat, heal) must be instant in combat] |
-| [Primary resource (mana / stamina / ammo)] | [ ] | [X — show when resource is being consumed or is critically low] | [ ] | [ ] | [Example: contextual because stable resource levels are not decision-relevant] |
-| [Secondary resource (currency / materials)] | [ ] | [ ] | [X — check in inventory] | [ ] | [Example: on-demand because resource totals don't affect immediate gameplay decisions] |
-| [Minimap / Compass] | [X] | [ ] | [ ] | [ ] | [Example: always visible because navigation decisions are constant during exploration] |
-| [Quest objective] | [ ] | [X — show when objective changes or player is near it] | [ ] | [ ] | [Example: contextual — player knows their objective; only remind at key moments] |
-| [Enemy health bar] | [ ] | [X — show only during combat encounters] | [ ] | [ ] | [Example: contextual because enemy health is irrelevant outside combat] |
-| [Status effects (buffs/debuffs)] | [ ] | [X — show when active] | [ ] | [ ] | [Example: contextual because status effects only affect decisions when present] |
-| [Dialogue subtitles] | [X when dialogue is playing] | [ ] | [ ] | [ ] | [Example: always show while dialogue is active — accessibility requirement] |
-| [Combo / streak counter] | [ ] | [X — show while combo is active, hide on reset] | [ ] | [ ] | [Example: contextual because it communicates active performance, not baseline state] |
-| [Timer] | [ ] | [X — show only in timed sequences] | [ ] | [ ] | [Example: contextual because timers only exist in specific encounter types] |
-| [Tutorial prompts] | [ ] | [X — show for first-time situations only] | [ ] | [ ] | [Example: contextual and one-time; never repeat to experienced players] |
-| [Score / points] | [ ] | [X — show in score-relevant modes only] | [ ] | [ ] | [Example: contextual by game mode; hidden in modes where score is irrelevant] |
-| [XP / level progress] | [ ] | [ ] | [X — available via character screen] | [ ] | [Example: on-demand because progression does not affect in-moment gameplay decisions] |
-| [Waypoint / objective marker] | [ ] | [X — show when player is navigating to objective] | [ ] | [ ] | [Example: contextual — suppress during cutscenes, cinematic moments, and free exploration] |
+| [Information type — e.g., Health, resource, minimap, quest objective, subtitles, status effects, timer, XP] | [ ] | [ ] | [ ] | [ ] | [Why this presentation category] |
---
## 3. Layout Zones
-> **Why this section exists**: The game world is the primary content — the HUD is a
-> frame around it. Before placing any element, divide the screen into named zones
-> with explicit positions and safe zone margins. This section prevents two failure
-> modes: (1) elements placed ad-hoc until the screen is cluttered, and (2) elements
-> that overlap platform-required safe zones and get rejected in certification.
-> Every element in Section 4 must be assigned to a zone defined here.
-
### 3.1 Zone Diagram
```
@@ -139,84 +86,42 @@ so it can be cited in design reviews.]
| Zone Name | Screen Position | Safe Zone Compliant | Primary Elements | Max Simultaneous Elements | Notes |
|-----------|----------------|---------------------|-----------------|--------------------------|-------|
-| [Top Left] | [Top-left corner, within safe margin] | [Yes — 10% from top, 10% from left] | [Health bar, stamina bar, shield bar] | [3] | [Vital status — player's own resources. Priority zone for player state.] |
-| [Top Center] | [Top edge, centered horizontally] | [Yes — 10% from top] | [Quest objective, area name (on enter)] | [1 — only one message at a time] | [Use for narrative context, not mechanical information. Keep text minimal.] |
-| [Top Right] | [Top-right corner, within safe margin] | [Yes — 10% from top, 10% from right] | [Ammo count, ability cooldowns] | [2] | [Weapon/ability state. Most relevant during active combat.] |
-| [Center] | [Screen center ±15%] | [N/A — not a margin zone] | [Crosshair, interaction prompt, hit marker] | [1 active at a time] | [CRITICAL: Nothing persistent here. Only momentary indicators.] |
-| [Bottom Left] | [Bottom-left corner, within safe margin] | [Yes — 10% from bottom, 10% from left] | [Minimap, ability icons] | [2] | [Navigation and ability readout. Small, non-intrusive.] |
-| [Bottom Center] | [Bottom edge, centered horizontally] | [Yes — 10% from bottom] | [Subtitles, tutorial prompts] | [2 — subtitle + tutorial may coexist] | [Highest-priority accessibility zone. Never place other elements here.] |
-| [Bottom Right] | [Bottom-right corner, within safe margin] | [Yes — 10% from bottom, 10% from right] | [Notification toasts, pick-up feedback] | [3 stacked] | [Transient notifications. Stack vertically. Oldest disappears first.] |
+| [Zone] | [Position] | [Yes/No + margins] | [Elements assigned] | [N] | [Zone purpose] |
**Safe zone margins by platform**:
| Platform | Top | Bottom | Left | Right | Notes |
|----------|-----|--------|------|-------|-------|
-| [PC — windowed] | [0% — no safe zone required] | [0%] | [0%] | [0%] | [But respect minimum resolution — elements must not crowd at 1280x720] |
-| [PC — fullscreen] | [3%] | [3%] | [3%] | [3%] | [Slight margin for 4K TV-connected PCs] |
-| [Console — TV] | [10%] | [10%] | [10%] | [10%] | [Action-safe zone for broadcast-spec TVs. Some TVs overscan beyond this.] |
-| [Steam Deck] | [5%] | [5%] | [5%] | [5%] | [Small screen; safe zone is smaller but crowding risk is higher] |
-| [Mobile — portrait] | [15% top] | [10% bottom] | [5%] | [5%] | [15% top avoids notch/camera cutout on most devices] |
-| [Mobile — landscape] | [5%] | [5%] | [15% left] | [15% right] | [Thumb placement on landscape — side zones are obscured by hands] |
+| [Platform] | [%] | [%] | [%] | [%] | [Platform-specific notes] |
---
## 4. HUD Element Specifications
-> **Why this section exists**: Each HUD element needs its own specification to be
-> built correctly. Ad-hoc implementation of HUD elements produces inconsistent
-> sizing, mismatched update frequencies, missing urgency states, and accessibility
-> failures. This section is the implementation brief for every element — fill it
-> completely before any element moves into development.
-
### 4.1 Element Overview Table
> One row per HUD element. This is the master inventory for implementation planning.
| Element Name | Zone | Always Visible | Visibility Trigger | Data Source | Update Frequency | Max Size (% screen W) | Min Readable Size | Overlap Priority | Accessibility Alt |
|-------------|------|---------------|-------------------|-------------|-----------------|----------------------|------------------|-----------------|------------------|
-| [Health Bar] | [Top Left] | [Yes] | [N/A] | [PlayerStats] | [On value change] | [20%] | [120px wide] | [1 — highest] | [Numerical text label showing current/max: "80/100"] |
-| [Stamina Bar] | [Top Left] | [No — context] | [Show when consuming stamina; hide 3s after full] | [PlayerStats] | [Realtime during use] | [15%] | [80px wide] | [2] | [Numerical label, or hide if full (accessible assumption)] |
-| [Shield Indicator] | [Top Left] | [No — context] | [Show when shield is active or recently hit] | [PlayerStats] | [On value change] | [20%] | [120px wide] | [3] | [Numerical label. Must not use color alone — add shield icon.] |
-| [Ammo Counter] | [Top Right] | [No — context] | [Show when weapon is equipped; hide when unarmed] | [WeaponSystem] | [On fire / on reload] | [10%] | ["88/888" readable at game's min resolution] | [4] | [Text-only fallback: "32 / 120"] |
-| [Minimap] | [Bottom Left] | [Yes] | [N/A — but suppressed in cinematic mode] | [NavigationSystem] | [Realtime] | [18%] | [150x150px] | [5] | [Cardinal direction compass strip as fallback; must be toggleable] |
-| [Quest Objective] | [Top Center] | [No — context] | [Show on objective change; show when near objective location; hide after 5s] | [QuestSystem] | [On event] | [30%] | [Legible at body text size] | [6] | [Read aloud on objective change via screen reader] |
-| [Crosshair] | [Center] | [No — context] | [Show when ranged weapon equipped; hide in melee or unarmed] | [WeaponSystem / AimSystem] | [Realtime] | [3%] | [12px diameter minimum] | [1 — center zone priority] | [Reduce motion: static crosshair only. Option to enlarge.] |
-| [Interaction Prompt] | [Center] | [No — context] | [Show when player is within interaction range of an interactive object] | [InteractionSystem] | [On enter/exit interaction range] | [15%] | [24px icon + readable text] | [2 — center zone] | [Text description of interaction always present, not icon-only] |
-| [Subtitles] | [Bottom Center] | [No — always on when dialogue plays, if setting enabled] | [Show during any voiced line or ambient dialogue] | [DialogueSystem] | [Per dialogue line] | [60%] | [Minimum 24px font] | [1 — highest in zone] | [This IS the accessibility feature — see Section 8 for subtitle spec] |
-| [Damage Numbers] | [World-space / anchored to entity] | [No — context] | [Show on any damage event; duration 800ms] | [CombatSystem] | [On event] | [5% per number] | [18px minimum] | [3] | [Option to disable; numbers can overwhelm for photosensitive players] |
-| [Status Effect Icons] | [Top Left — below health bar] | [No — context] | [Show when any status effect is active on player] | [StatusSystem] | [On effect add/remove] | [3% per icon] | [24px per icon] | [3] | [Icon + text label on hover/focus. Never icon-only.] |
-| [Notification Toast] | [Bottom Right] | [No — event-driven] | [On loot, XP gain, achievement, quest update] | [Multiple — see Section 6] | [On event] | [25%] | [Legible at body text size] | [7 — lowest] | [Queued; never overlapping. Read by screen reader if subtitle mode on.] |
+| [Element] | [Zone] | [Yes/No] | [Trigger or N/A] | [Owning system] | [When it updates] | [%] | [px] | [N] | [Non-visual/non-color alternative] |
### 4.2 Element Detail Blocks
> For each element in the table above, write a detail block. Copy and complete
-> one block per element.
+> one block per element. See guide Section 4 for completed Health Bar and
+> Minimap examples.
---
-**Health Bar**
+**[Element Name]**
-- Visual description: [Horizontal fill bar. Left-to-right fill direction. Segmented at 25/50/75% to aid reading at a glance. Background: dark semi-transparent (40% opacity). Fill color: context-dependent — see Urgency States.]
-- Data displayed: [Current HP as fill percentage. Numerical value displayed as text below bar at all times: "80 / 100".]
-- Update behavior: [Bar fill decreases or increases smoothly using a lerp over 150ms per change. Large damage (>25% single hit) triggers a brief flash (1 frame white, then drain).]
-- Urgency states:
- - Normal (>50% HP): [Green fill, no special behavior]
- - Caution (25–50% HP): [Yellow fill, low warning pulse every 4 seconds]
- - Critical (<25% HP): [Red fill, persistent slow pulse (1 Hz), vignette appears at screen edges]
- - Zero (0% HP): [Bar empties and turns grey; death state begins]
-- Interaction: [Display only. Not interactive. Player cannot click, hover, or focus this element as an action target.]
-- Player customization: [Opacity adjustable (see Section 7 Tuning Knobs). Can be repositioned to any corner by player in accessibility settings.]
-
----
-
-**Minimap**
-
-- Visual description: [Circular mask, radius = 75px at reference resolution 1920x1080. Player icon at center. North always up unless player has unlocked "Rotate minimap" setting. Range = configurable, default 80 world units radius.]
-- Data displayed: [Player position, nearby enemies (if detection perk unlocked), quest markers within range, points of interest icons, traversal obstacles (walls, drops).]
-- Update behavior: [Realtime. Updates every frame. Enemy icons fade in/out as they enter/leave detection range over 300ms.]
-- Urgency states: [None for the map itself. Enemy icons turn red when they are in combat-alert state.]
-- Interaction: [Not interactive in-game. Press dedicated Map button to open the full map screen (separate UX spec).]
-- Player customization: [Size: S/M/L (70/90/110px radius). Opacity: 30–100%. Rotation: locked-north or player-relative. Can be disabled entirely (compass strip shows as fallback).]
+- Visual description: [Shape, fill direction, background, color behavior]
+- Data displayed: [Values shown, including any numerical text labels]
+- Update behavior: [Animation/lerp timing, flash behavior on large changes]
+- Urgency states: [Per-threshold visual states, e.g., Normal / Caution / Critical / Zero]
+- Interaction: [Interactive or display-only]
+- Player customization: [Opacity, repositioning, size options]
---
@@ -226,58 +131,32 @@ so it can be cited in design reviews.]
## 5. HUD States by Gameplay Context
-> **Why this section exists**: The HUD is not a static overlay — it is a dynamic
-> system that must adapt to what the player is doing. A HUD designed only for
-> standard gameplay will look wrong in cutscenes, feel cluttered in exploration,
-> and occlude critical information in boss fights. This section defines the
-> transformations the HUD undergoes in each gameplay context. It is also the spec
-> for the system that manages HUD visibility — the HUD state machine.
+> Define the HUD transformation for every gameplay context — at minimum:
+> exploration, combat, dialogue/cutscene, and paused/menu. See guide Section 5
+> for a worked example covering nine contexts.
| Context | Elements Shown | Elements Hidden | Elements Modified | Transition Into This State |
|---------|---------------|-----------------|------------------|---------------------------|
-| [Exploration — no threats] | [Minimap, Quest Objective (faded, 60%), Subtitles (if active)] | [Ammo Counter, Crosshair, Damage Numbers, Status Effects (if none active)] | [Health Bar fades to 40% opacity — visible but not dominant] | [Fade transition, 500ms, when no enemies detected for 10s] |
-| [Combat — active threat] | [Health Bar (full opacity), Stamina Bar (when used), Ammo Counter, Crosshair, Damage Numbers, Status Effects, Enemy Health Bars] | [Quest Objective (temporarily hidden), Notification Toasts (paused queue)] | [Minimap scales down 15% and raises opacity to 100%] | [Immediate snap in on first enemy detection — no fade. Combat readiness requires instant info.] |
-| [Dialogue / Cutscene] | [Subtitles, Dialogue speaker name] | [All gameplay HUD elements: health, ammo, minimap, crosshair, damage numbers] | [N/A] | [All gameplay elements fade out over 300ms when cutscene flag is set] |
-| [Cinematic (scripted camera sequence)] | [Subtitles only] | [Everything else including speaker name] | [Letterbox bars appear (if applicable to this game's style)] | [Immediate on cinematic flag; letterbox slides in from top/bottom over 400ms] |
-| [Inventory / Menu open] | [None — inventory renders full-screen or as overlay] | [All HUD elements] | [Game world visible but paused behind inventory screen] | [All HUD elements hide over 150ms as menu opens] |
-| [Death / Respawn pending] | [Death screen overlay — separate spec] | [All gameplay HUD elements] | [Screen desaturates and darkens over 800ms] | [Death state begins when HP reaches 0 — HUD elements fade over 600ms] |
-| [Loading / Transition] | [Loading indicator, tip text] | [All gameplay HUD elements] | [N/A] | [Instant on level transition trigger] |
-| [Tutorial — new mechanic] | [Standard context HUD + Tutorial Prompt overlay] | [Nothing additional hidden] | [Tutorial prompt dims background subtly to draw attention to prompt] | [Tutorial system fires ShowTutorial event; prompt fades in over 200ms] |
-| [Boss Encounter] | [Boss health bar appears (large, bottom of screen or top center), all combat elements] | [Quest Objective] | [Boss bar renders in a distinct visual style — must not be confused with player health] | [Boss health bar slides in on boss encounter trigger over 400ms] |
+| [Context — e.g., Exploration / Combat / Dialogue / Cinematic / Menu open / Death / Loading / Tutorial / Boss] | [Shown] | [Hidden] | [Modified] | [Transition timing + trigger] |
---
## 6. Information Hierarchy
-> **Why this section exists**: Not all HUD information is equally important. When
-> screen space is limited, when the player is under high stress, or when elements
-> compete for the same zone, there must be a principled priority order that governs
-> which elements survive and which get suppressed. This section formalizes that
-> hierarchy so it can be enforced systematically and not just "feels obvious" decisions
-> made at implementation time.
+> Assign every element a priority tier (MUST KEEP / SHOULD KEEP / CAN HIDE /
+> ALWAYS HIDE) with reasoning. See guide Section 6 for a worked example.
| Element | Priority Tier | Reasoning | What Replaces It If Hidden |
|---------|--------------|-----------|---------------------------|
-| [Subtitles] | [MUST KEEP — never hide during dialogue] | [Accessibility requirement. Legal requirement in some markets. Story clarity.] | [N/A — nothing replaces subtitles] |
-| [Health Bar] | [MUST KEEP — during any state where the player can be damaged] | [Without health visibility, survival decisions become impossible] | [Auditory cues (heartbeat, breathing) supplement but do not replace] |
-| [Crosshair] | [MUST KEEP — while aiming with a ranged weapon] | [Targeting without a crosshair is a precision failure, not a difficulty feature] | [Alternative: dot-only mode for minimalists; never fully hidden while aiming] |
-| [Interaction Prompt] | [MUST KEEP — when player is in interaction range] | [Without it, interactive objects are invisible to the player] | [Environmental visual cues can supplement but interaction affordance must be explicit] |
-| [Ammo Counter] | [SHOULD KEEP] | [Low ammo decisions (switch weapon, reload) require awareness; can be contextual] | [Auditory "click" on empty chamber is acceptable fallback for experienced players] |
-| [Minimap] | [SHOULD KEEP] | [Navigation requires spatial awareness; loss forces repeated map opens] | [Compass strip (simplified directional indicator) is acceptable fallback] |
-| [Status Effects] | [SHOULD KEEP — while active] | [Active debuffs change what actions are viable; invisible debuffs feel unfair] | [Character animation states can partially communicate status effects (limping, sparks)] |
-| [Quest Objective] | [CAN HIDE] | [Player can hold objective in memory for extended periods; contextual is correct default] | [Player remembers objective from context] |
-| [Damage Numbers] | [CAN HIDE] | [Feedback element, not decision-critical. Many players turn these off.] | [Hit sounds and enemy reactions communicate hit registration] |
-| [Notification Toasts] | [CAN HIDE in high-intensity moments] | [Mid-combat "You gained 50 XP" is noise, not signal. Queue and show after combat.] | [Queue held and released when combat ends] |
-| [Combo Counter] | [ALWAYS HIDE when combo resets or player is not attacking] | [Stale combo information is actively misleading] | [N/A — simply hidden] |
+| [Element] | [MUST KEEP / SHOULD KEEP / CAN HIDE / ALWAYS HIDE] | [Why] | [Fallback channel or N/A] |
---
## 7. Visual Budget
-> **Why this section exists**: Without explicit budget constraints, HUD elements
-> accumulate until the game world is nearly invisible. These numbers are hard limits,
-> not guidelines. Every element addition that would breach a limit requires explicit
-> approval and must displace or reduce an existing element.
+> These numbers are hard limits, not guidelines. Every element addition that
+> would breach a limit requires explicit approval and must displace or reduce an
+> existing element. See guide Section 7 for how to apply the budgets.
| Budget Constraint | Limit | Measurement Method | Current Estimate | Status |
|------------------|-------|--------------------|-----------------|--------|
@@ -289,60 +168,37 @@ so it can be cited in design reviews.]
| Maximum opacity for HUD background panels | [65%] | [Opacity of any panel behind HUD text — must preserve world visibility through panel] | [TBD] | [To verify] |
| Minimum HUD element size at minimum supported resolution | [40px for icons, 18px for text] | [Measure at lowest target resolution] | [TBD] | [To verify] |
-> **How to apply these budgets**: For every new HUD element proposed during
-> production, require the proposer to state (1) which budget line it affects,
-> (2) what the new total will be, and (3) what existing element will be reduced or
-> made contextual to stay within budget. "It's a small icon" is not an analysis.
-
---
## 8. Feedback & Notification Systems
-> **Why this section exists**: Notifications are the most frequently-added and
-> worst-controlled part of most HUDs. Every system wants to tell the player
-> something. Without explicit rules about notification priority, stacking limits,
-> and queue behavior, the notification zone becomes a firehose of overlapping
-> toasts that players learn to ignore entirely. This section establishes the
-> notification contract for all systems.
+> One row per notification type. Every notification must have queue/priority
+> behavior defined. See guide Section 8 for a worked example table and queue rules.
| Notification Type | Trigger System | Screen Position | Duration (ms) | Animation In / Out | Max Simultaneous | Priority | Queue Behavior | Dismissible? |
|------------------|---------------|-----------------|--------------|-------------------|-----------------|----------|---------------|-------------|
-| [Item Pickup] | [InventorySystem] | [Bottom Right — toast] | [2000] | [Slide in from right 200ms / fade out 300ms] | [3 stacked] | [Low] | [FIFO queue; older toasts pushed up as new ones enter] | [No — auto-dismiss] |
-| [XP Gain] | [ProgressionSystem] | [Bottom Right — toast, below item toasts] | [1500] | [Fade in 150ms / fade out 300ms] | [1 — XP messages merge: "XP +150"] | [Very Low — suppress during combat, queue for post-combat] | [Combat-aware queue] | [No] |
-| [Level Up] | [ProgressionSystem] | [Center screen — persistent until dismissed] | [Persistent — requires input to dismiss] | [Scale up from 80% + fade in 400ms] | [1] | [High — interrupts normal toasts] | [Pauses all other notifications until dismissed] | [Yes — any input] |
-| [Quest Update] | [QuestSystem] | [Top Center] | [4000] | [Slide down from top 250ms / fade out 400ms] | [1 — top center is single-message zone] | [Medium] | [If quest update arrives while previous is visible, extend duration by 2000ms; do not stack] | [No] |
-| [Objective Complete] | [QuestSystem] | [Top Center] | [3000] | [Same as Quest Update but with additional completion sound] | [1] | [Medium-High — preempts Quest Update] | [Preempts any queued top-center message] | [No] |
-| [Critical Warning (low health, hazard)] | [CombatSystem / EnvironmentSystem] | [Screen edge vignette + text at center-bottom] | [Persistent while condition active] | [Fade in 200ms; fades out 500ms when condition clears] | [1 per warning type] | [Critical — never suppressed] | [Renders immediately, bypasses all queues] | [No] |
-| [Achievement Unlocked] | [AchievementSystem] | [Bottom Right — distinct from item toasts] | [4000] | [Slide in from right with icon expansion 300ms / fade out 400ms] | [1] | [Low] | [Queues behind item toasts; never more than one achievement toast at a time] | [No] |
-| [Hint / Tutorial] | [TutorialSystem] | [Bottom Center] | [Persistent — until player performs the action or dismisses] | [Fade in 300ms] | [1] | [Medium] | [Only one tutorial hint at a time; queue others] | [Yes — B button / Esc] |
+| [Type] | [System] | [Zone] | [ms] | [In / out animation + timing] | [N] | [Priority] | [Queue/merge/preempt behavior] | [Yes/No] |
**Notification queue rules**:
-1. Combat-aware queue: notifications tagged as Low priority are queued, not displayed, when the player is in combat state. The queue is flushed in a batch when the player exits combat, with a max of 3 items displayed in sequence.
-2. Merge rule: identical notification types that fire within 500ms of each other are merged into a single notification with a combined value (e.g., "Item Pickup x3" rather than three separate toasts).
-3. Critical notifications (health warning, environmental hazard) are never queued, never merged, and always displayed immediately regardless of combat state or existing notifications.
+1. [Combat-aware queue rule — which priorities are held during combat and how the queue flushes]
+2. [Merge rule — when identical notification types merge into one]
+3. [Critical bypass rule — which notifications are never queued, never merged]
---
## 9. Platform Adaptation
-> **Why this section exists**: A HUD designed at 1920x1080 on a monitor may be
-> illegible on a 55-inch TV at 4K, broken at 1280x720 on Steam Deck, or hidden
-> behind a notch on mobile. Platform adaptation is not optional post-ship work —
-> it is a design requirement that must be specified before implementation so the
-> architecture can support it from the start. Every platform listed here requires
-> explicit layout testing before certification.
+> Every target platform requires explicit layout testing before certification.
+> See guide Section 9 for a worked example.
| Platform | Safe Zone | Resolution Range | Input Method | HUD-Specific Notes |
|----------|-----------|-----------------|-------------|-------------------|
-| [PC — Windows, 1920x1080 reference] | [3% margin] | [1280x720 min to 3840x2160 max] | [Mouse + keyboard, controller optional] | [HUD must scale correctly at all resolutions. Test at 1280x720 — minimum before cert. Consider ultrawide (21:9) — minimap must not stretch.] |
-| [PC — Steam Deck, 1280x800] | [5% margin] | [Fixed 1280x800] | [Controller + touchscreen] | [Smaller screen means minimum text sizes are critical. Test ALL elements at this resolution. Touch targets irrelevant (controller-only by default).] |
-| [PlayStation 5 / Xbox Series X] | [10% margin] | [1080p to 4K] | [Controller] | [Console certification requires TV safe zone compliance. Action-safe is 90% of screen area. Test on a real TV, not a monitor — overscan behavior differs.] |
-| [Mobile — iOS / Android] | [15% top, 10% other sides] | [360x640 min to 414x896 common] | [Touch] | [Notch/camera cutout avoidance at top. Bottom home indicator zone avoidance. Portrait and landscape layouts may differ significantly — specify both.] |
+| [Platform] | [Margin] | [Min–max resolution] | [Input] | [Platform-specific HUD constraints] |
**HUD repositionability requirement**: Players must be able to reposition at minimum the following elements using an in-game HUD layout editor (required for accessibility compliance on console):
-- Health bar
-- Minimap
-- Ability bar (if present)
+- [Health bar]
+- [Minimap]
+- [Ability bar (if present)]
Repositioning saves to player profile, not to a single slot. Applies across play sessions.
@@ -350,48 +206,30 @@ Repositioning saves to player profile, not to a single slot. Applies across play
## 10. Accessibility — HUD Specific
-> **Why this section exists**: HUD accessibility failures are the most visible
-> accessibility failures in games — players encounter the HUD in every session,
-> in every gameplay moment. Color-blind failures, illegible text at minimum scale,
-> and inability to disable distracting animations are among the top accessibility
-> complaints in game reviews. This section defines HUD-specific requirements; refer
-> to the project's `docs/accessibility-requirements.md` for the full project standard.
+> HUD-specific requirements only — refer to the project's
+> `design/accessibility-requirements.md` for the full project standard.
### 10.1 Colorblind Modes
| Element | Color-Only Information Risk | Colorblind Mode Fix |
|---------|----------------------------|---------------------|
-| [Health bar fill] | [Red = low health uses red/green distinction] | [Add icon pulse + vignette as non-color indicators. Red fill is supplemental, not sole indicator.] |
-| [Damage numbers] | [Red = taken, green = healed] | [Add minus (-) prefix for damage, plus (+) for healing. Symbols, not color.] |
-| [Enemy health bars] | [If colored by faction or threat level] | [Add text label or icon badge for faction/threat level. Never color-only.] |
-| [Status effect icons] | [If icon tint communicates status type] | [All status icons must have distinct shapes, not just distinct colors. Shape encodes meaning; color is secondary.] |
-| [Minimap icons] | [If player vs. enemy vs. objective distinguished by color] | [Distinct icon shapes: circle = player, triangle = enemy, star = objective. Color supplements shape.] |
+| [Element] | [Where color alone carries meaning] | [Non-color alternative: shape, icon, symbol, text] |
### 10.2 Text Scaling
-[Describe what happens when the player sets the UI text scale to 150% (the maximum required for your Accessibility Tier). Which elements reflow? Which elements clip? Which elements are architecturally blocked from scaling (e.g., fixed-size canvases)?
-
-Example: "Health bar numerical label grows with text scale — bar expands slightly to accommodate. Quest objective text wraps at 150% scale — verify Top Center zone can accommodate two-line objectives. Damage numbers do not scale (they are world-space, not screen-space) — this is an accepted limitation documented here."]
+[Describe what happens at 150% UI text scale: which elements reflow, clip, or are architecturally blocked from scaling — see guide Section 10 for an example narrative]
**Text scaling test matrix**:
| Element | 100% (baseline) | 125% | 150% | Overflow behavior |
|---------|----------------|------|------|-------------------|
-| [Health bar label] | [Pass] | [Pass] | [TBD] | [Bar expands; does not overlap stamina bar] |
-| [Quest objective text] | [Pass] | [TBD] | [TBD] | [Wraps to second line; zone height expands] |
-| [Notification toast text] | [Pass] | [TBD] | [TBD] | [Toast width expands to max 35% screen width, then wraps] |
-| [Subtitle text] | [Pass] | [TBD] | [TBD] | [Dedicated subtitle zone — must accommodate scale] |
+| [Element] | [Pass/Fail/TBD] | [Pass/Fail/TBD] | [Pass/Fail/TBD] | [What happens on overflow] |
### 10.3 Motion Sensitivity
| Animation / Motion Element | Severity | Disabled by Reduced Motion Setting? | Replacement Behavior |
|---------------------------|----------|-------------------------------------|---------------------|
-| [Health bar low-HP pulse] | [Mild] | [Yes] | [Solid fill, no pulse. Vignette remains as it is less likely to trigger sensitivity.] |
-| [Screen edge vignette] | [Moderate] | [Optional — separate toggle] | [Replace with static darkened corners at 30% opacity] |
-| [Damage numbers float upward] | [Mild] | [Yes] | [Instant appear/disappear in place, no float] |
-| [Notification toast slide-in] | [Mild] | [Yes] | [Instant appear at final position] |
-| [Level up center animation] | [High] | [Yes — required] | [Static level up card, no scale animation, no particle effects] |
-| [Combo counter scale pulse] | [Mild] | [Yes] | [Number increments without scale animation] |
+| [Animated element] | [Mild/Moderate/High] | [Yes/No/Optional] | [Static replacement] |
### 10.4 Subtitles Specification
@@ -400,15 +238,15 @@ Example: "Health bar numerical label grows with text scale — bar expands sligh
> implementation discretion.
- **Default setting**: [ON or OFF — document your game's default and the rationale. Industry standard is ON by default.]
-- **Position**: Bottom Center zone, centered horizontally, above the bottom safe zone margin
-- **Max characters per line**: [42 characters — the readable limit for subtitle lines at minimum text size on TV viewing distance]
-- **Max simultaneous lines**: [2 lines before scrolling — do not display more than 2 lines at once]
-- **Speaker identification**: [Speaker name displayed in color or above subtitle text — never rely on color alone; add colon prefix: "ARIA: The door is locked."]
-- **Background**: [Semi-transparent black panel, 70% opacity, behind all subtitle text — ensures contrast against any game world background]
-- **Font size minimum**: [24px at 1080p reference — scales with text scale setting]
-- **Line break behavior**: [Break at natural language pause points — before conjunctions, after commas, never mid-word]
-- **Subtitle persistence**: [Each subtitle line holds for the duration of the spoken line plus 300ms after it ends — never disappear while audio is still playing]
-- **Non-dialogue captions**: [Document whether ambient sounds, music descriptions, and sound effects are captioned — e.g., "[tense music]", "[explosion in the distance]" — and where these appear if different from dialogue subtitles]
+- **Position**: [Zone, alignment, relationship to safe zone margin]
+- **Max characters per line**: [e.g., 42 characters — the readable limit at minimum text size on TV viewing distance]
+- **Max simultaneous lines**: [e.g., 2 lines before scrolling]
+- **Speaker identification**: [Name display method — never rely on color alone]
+- **Background**: [Panel treatment ensuring contrast against any game world background]
+- **Font size minimum**: [px at reference resolution — scales with text scale setting]
+- **Line break behavior**: [Break at natural language pause points — never mid-word]
+- **Subtitle persistence**: [Hold duration relative to spoken line — never disappear while audio is still playing]
+- **Non-dialogue captions**: [Whether ambient sounds, music, and SFX are captioned, and where these appear]
### 10.5 HUD Opacity and Visibility Controls
@@ -428,31 +266,20 @@ The following player-adjustable settings must be available from the Accessibilit
## 11. Tuning Knobs
-> **Why this section exists**: HUD behavior should be data-driven to the same degree
-> as gameplay systems. Values that are hardcoded are values that require an engineer
-> to change. Values that are in config can be tuned by a designer or adjusted for
-> player preferences. Document all tunable parameters before implementation so the
-> programmer knows which values to externalize.
+> Document all tunable parameters before implementation so the programmer knows
+> which values to externalize. See guide Section 11 for a worked example.
| Parameter | Current Value | Range | Effect of Increase | Effect of Decrease | Player Adjustable? | Notes |
|-----------|-------------|-------|-------------------|-------------------|-------------------|-------|
-| [Notification display duration (default)] | [2000ms] | [500ms – 5000ms] | [Toasts persist longer — less likely to be missed, more screen clutter] | [Toasts disappear faster — cleaner, higher miss risk] | [No — but player can adjust verbosity level] | [Per-type overrides in Section 8 take precedence] |
-| [Notification queue max size] | [8] | [3 – 15] | [More messages preserved but queue takes longer to clear] | [Older messages dropped earlier] | [No] | [Expand if playtesting reveals important messages being lost] |
-| [Health bar low-HP pulse frequency] | [1 Hz] | [0.5 – 2 Hz] | [More urgent feeling — can become fatiguing] | [Calmer — may fail to communicate urgency] | [No — but Reduced Motion disables it] | [Linked to accessibility setting] |
-| [Combat HUD reveal duration] | [0ms (instant)] | [0 – 300ms] | [Softer reveal — feels less jarring] | [Instant — highest responsiveness] | [No] | [Keep at 0ms — combat information must be instant] |
-| [Exploration HUD fade-out delay] | [10000ms (10s after last threat)] | [3000 – 30000ms] | [HUD fades sooner — cleaner exploration] | [HUD stays longer — more reassurance] | [No] | [Tune based on playtest; 10s is a starting estimate] |
-| [Minimap range (world units visible)] | [80] | [40 – 200] | [More map context visible] | [Tighter local view] | [Yes — Small/Medium/Large preset] | [Exposed as S/M/L, not raw unit value] |
-| [Minimap size (px radius at 1080p)] | [75] | [50 – 120] | [Larger map, more screen space consumed] | [Smaller, less intrusive] | [Yes — S/M/L preset] | [Three sizes exposed to player] |
-| [Damage number duration (ms)] | [800] | [400 – 1500] | [Numbers linger longer — easier to read, more cluttered] | [Numbers clear faster — cleaner, harder to parse] | [No] | [Tune based on visual noise in dense combat] |
-| [Global HUD opacity] | [100%] | [0 – 100%] | [Fully visible] | [Fully hidden] | [Yes — opacity slider in Accessibility settings] | [0% = full HUD off; some players prefer this] |
+| [Parameter] | [Value] | [Min–max] | [Effect] | [Effect] | [Yes/No + how exposed] | [Tuning notes] |
---
## 12. Acceptance Criteria
-> **Why this section exists**: These criteria are the certification checklist for the
-> HUD. Every item must pass before the HUD can be marked Approved. QA must be able
-> to verify each item independently.
+> These criteria are the certification checklist for the HUD. Every item must
+> pass before the HUD can be marked Approved. QA must be able to verify each
+> item independently.
**Layout & Visibility**
- [ ] All HUD elements are within platform safe zone margins on all target platforms
@@ -495,11 +322,9 @@ The following player-adjustable settings must be available from the Accessibilit
## 13. Open Questions
> Track unresolved design questions here. All questions must be resolved before
-> the HUD design document can be marked Approved.
+> the HUD design document can be marked Approved. See guide Section 13 for
+> example questions.
| Question | Owner | Deadline | Resolution |
|----------|-------|----------|-----------|
-| [e.g., Should the minimap show enemy positions by default, or only after a detection skill is unlocked?] | [systems-designer + ui-designer] | [Sprint 5, Day 2] | [Pending — depends on progression GDD decision] |
-| [e.g., Does the game have a boss health bar, or do bosses use the standard enemy health bar? Bosses need a visually distinct treatment if they are significantly more important than normal enemies.] | [game-designer] | [Sprint 5, Day 1] | [Pending] |
-| [e.g., Damage numbers: diegetic (floating in world space, occluded by geometry) or screen space (always readable, overlaid on HUD layer)?] | [ui-designer + lead-programmer] | [Sprint 4, Day 5] | [Pending — architecture decision affects rendering layer choice] |
-| [e.g., Mobile portrait vs. landscape: does the game support both orientations? If yes, each requires its own zone layout.] | [producer] | [Sprint 3, Day 3] | [Pending — platform scope decision required first] |
+| [Add question] | [Owner] | [Deadline] | [Resolution] |
diff --git a/.claude/docs/templates/interaction-pattern-library.md b/.claude/docs/templates/interaction-pattern-library.md
index 355d9414..e8a927ad 100644
--- a/.claude/docs/templates/interaction-pattern-library.md
+++ b/.claude/docs/templates/interaction-pattern-library.md
@@ -1,5 +1,7 @@
# Interaction Pattern Library: [Game Title]
+> Authoring guidance: .claude/docs/templates/guidance/interaction-pattern-library-guide.md (load per-section as you author — do not read entirely).
+
> **Status**: Draft | Stable | Under Revision
> **Author**: [ux-designer]
> **Last Updated**: [Date]
@@ -8,7 +10,7 @@
> **UI Framework**: [Godot Control nodes / Unity UI Toolkit / Unreal UMG]
> **Related Documents**:
> - `design/art/art-bible.md` — visual standards (colors, typography, iconography)
-> - `docs/accessibility-requirements.md` — accessibility commitments per feature
+> - `design/accessibility-requirements.md` — accessibility commitments per feature
> - `docs/ux/ux-spec-[screen].md` — individual screen specs that reference patterns
> **Why this document exists**: Every UI screen spec should be able to say
@@ -106,43 +108,29 @@ update this document before or simultaneously with any implementation change.
## Standard Control Patterns
+> Full reference specifications for every pattern in this section (state tables
+> with timing/audio values, accessibility requirements, implementation notes)
+> are in `.claude/docs/templates/guidance/interaction-pattern-library-guide-standard-controls.md` —
+> load only the pattern(s) currently being specified.
+
---
#### Button (Primary)
**Category**: Input
**Status**: Draft
-**When to Use**: The single most important action on a screen. "Start Game,"
-"Confirm," "Accept," "Buy." There should be at most one Primary button visible
-at a time. It is the answer to "what does the player most likely want to do here?"
-**When NOT to Use**: Alternative or secondary actions; destructive actions that
-require confirmation before the consequence is irreversible; any action that is
-not the primary intent of the screen.
+**When to Use**: [The single most important action on a screen — at most one visible at a time]
+**When NOT to Use**: [Alternative/secondary actions; destructive actions; anything not the screen's primary intent]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Default | Full-opacity fill, primary color from art-bible. Label centered. | — | — | — | — |
-| Hovered (mouse) | Brightness +15%, subtle scale 1.03x, cursor changes to pointer | Mouse over element | Transition from Default | 80ms ease-out | [UI hover sound — see Sound Standards] |
-| Focused (keyboard/gamepad) | Focus ring visible (2px, offset 3px, high contrast color). Same brightness as Hovered. | Tab / D-pad navigation | Transition from Default | 80ms ease-out | [UI focus sound — same as hover] |
-| Pressed | Scale 0.97x, brightness -10% | Click / Enter / A (Xbox) / Cross (PS) | Action fires on press-up, not press-down. Scale on press-down. | 60ms ease-in for press; 80ms ease-out on release | [UI confirm sound] |
-| Disabled | 40% opacity, no pointer cursor, no hover state | — | No response | — | — |
-| Loading (post-press) | Replace label with spinner. Button remains at pressed scale, disabled state. | — | Prevents double-submission | Duration of async operation | — |
-
-**Accessibility**:
-- Keyboard: Tab to focus, Enter or Space to activate. Must be reachable from any other interactive element on screen via Tab sequence.
-- Gamepad: D-pad or left stick to navigate focus to button. A (Xbox) / Cross (PS) to activate. Focus must be placed on Primary button by default when screen opens.
-- Screen reader: Button must expose accessible name matching visible label. Role: "button." State: "dimmed" when disabled. Activation announcement: "[Label] button — [result of action, if known]."
-- Colorblind: Do not rely on color alone to distinguish Primary from Secondary. Primary uses higher visual weight (fill vs. outline, or larger size) in addition to color differentiation.
-- Minimum touch target: 44x44pt (iOS HIG) / 48x48dp (Android). Apply even on PC if touch support is possible.
-
-**Implementation Notes**:
-[Godot: Extend `Button` control. Override `_draw()` for custom states rather than
-modifying themes mid-state. Use `focus_mode = FOCUS_ALL` to ensure keyboard
-focusability. Set `mouse_default_cursor_shape = CURSOR_POINTING_HAND`. For the
-scale animation, use a Tween on the `scale` property of the button's parent
-Control — scaling the Button itself can clip children.]
+| [Default / Hovered / Focused / Pressed / Disabled / Loading] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Keyboard, gamepad, screen reader, colorblind, and touch-target requirements]
+
+**Implementation Notes**: [Engine-specific guidance]
---
@@ -150,30 +138,18 @@ Control — scaling the Button itself can clip children.]
**Category**: Input
**Status**: Draft
-**When to Use**: Alternative or cancel action. "Back," "Cancel," "Skip," "Maybe
-Later." Lower visual weight than Primary — it should recede visually, not compete.
-**When NOT to Use**: Destructive actions (use Button (Destructive)). The most
-important action on the screen (use Button (Primary)).
+**When to Use**: [Alternative or cancel action — lower visual weight than Primary]
+**When NOT to Use**: [Destructive actions; the screen's most important action]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Default | Outlined style (border only, transparent fill), secondary color. Slightly smaller or lower weight than Primary. | — | — | — | — |
-| Hovered | Background fill appears at 15% opacity. Border brightens. Scale 1.02x. | Mouse over | Transition from Default | 80ms ease-out | [UI hover sound — softer variant than Primary] |
-| Focused | Focus ring, same specification as Primary. | Tab / D-pad | Transition from Default | 80ms ease-out | [UI focus sound] |
-| Pressed | Scale 0.97x, fill opacity increases to 30% | Click / Enter / B (Xbox) / Circle (PS) on focused state | Action fires on press-up | 60ms ease-in | [UI cancel/back sound] |
-| Disabled | 40% opacity | — | No response | — | — |
-
-**Accessibility**: Same requirements as Button (Primary). Accessible name must
-match visible label. In a dialog with Primary and Secondary buttons, the Secondary
-button typically maps to the platform "cancel" input (B / Circle / Escape) as well
-as direct focus activation.
-
-**Implementation Notes**: [Same as Button (Primary). Where a Primary and Secondary
-appear together, ensure Secondary is always positioned consistently — right/bottom
-of Primary on horizontal layouts, or below Primary on vertical layouts. Consistency
-across screens is more important than per-screen aesthetic preference.]
+| [State] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Same baseline as Button (Primary); note cancel-input mapping in dialogs]
+
+**Implementation Notes**: [Engine-specific guidance; consistent Primary/Secondary positioning]
---
@@ -181,32 +157,21 @@ across screens is more important than per-screen aesthetic preference.]
**Category**: Input
**Status**: Draft
-**When to Use**: Any action that is irreversible and causes loss of player data or
-significant progress: "Delete Save File," "Reset All Settings," "Leave Match,"
-"Discard Changes." The visual treatment signals danger before the player presses.
-**When NOT to Use**: Actions that can be undone, or actions that are merely
-consequential but reversible.
+**When to Use**: [Irreversible actions causing loss of player data or progress]
+**When NOT to Use**: [Actions that can be undone or are merely consequential]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Default | Outlined or filled with destructive color (typically a desaturated red — confirm colorblind compatibility in accessibility-requirements). Label may include a warning icon. | — | — | — | — |
-| Hovered / Focused | Same behavior as Button (Primary) hover/focus but with destructive color | — | — | 80ms | [UI hover sound] |
-| Pressed (first press) | Does NOT execute the action. Instead, opens Confirmation Dialog pattern (see below). The button itself shows a brief pulse animation. | Click / Enter | Trigger Confirmation Dialog | 100ms pulse | [UI warning sound — distinct from standard confirm] |
-| — | Confirmation Dialog handles the actual execution | — | — | — | — |
-| Disabled | 40% opacity | — | No response | — | — |
+| [State] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
> **Critical rule**: A Button (Destructive) NEVER executes its action directly.
-> It always triggers a Confirmation Dialog. There are no exceptions. A player
-> who presses it by accident must always have one more opportunity to back out.
-> Games that skip confirmation on destructive actions generate the most visible
-> negative community sentiment of any UX failure type. See: every "accidentally
-> deleted save file" complaint on any game forum.
+> It always triggers a Confirmation Dialog. There are no exceptions.
-**Accessibility**: Screen reader must announce the destructive nature: "[Label] button — this action cannot be undone." In addition to accessible name, use the `description` property if available to add the warning text.
+**Accessibility**: [Screen reader must announce the destructive nature]
-**Implementation Notes**: [Destructive button triggers a separate Confirmation Dialog scene. Pass the action callback to the dialog — the button itself does not hold the execution logic. This separation prevents accidental execution if the confirmation dialog has a bug.]
+**Implementation Notes**: [Engine-specific guidance]
---
@@ -214,35 +179,18 @@ consequential but reversible.
**Category**: Input
**Status**: Draft
-**When to Use**: Binary on/off settings where both states are equally valid and
-the current state must be visible at a glance. "Subtitles: On/Off," "Aim Assist:
-On/Off," "Notifications: On/Off."
-**When NOT to Use**: Selections from more than two options (use Dropdown). Actions
-that happen once rather than representing a persistent state (use Button). Cases
-where the consequence of toggling is complex enough to need explanation (show
-a description field alongside).
+**When to Use**: [Binary on/off settings where current state must be visible at a glance]
+**When NOT to Use**: [More than two options; one-shot actions; choices needing explanation]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Off / Default | Track: muted fill. Thumb: leftmost position. Label: "Off" or state label. | — | — | — | — |
-| Hovered | Track brightens 10%. Cursor: pointer. | Mouse over | Transition | 60ms | [UI hover sound] |
-| Focused | Focus ring around entire toggle element (track + thumb). | Tab / D-pad | — | 60ms | [UI focus sound] |
-| Pressed / Activated | Thumb slides to right side. Track fill changes to active color. Label changes to "On" or active state label. State persists. | Click / Enter / A / Cross | Toggle state change. Fire onChange event. Persist value. | 150ms ease-in-out for slide | [Toggle ON sound] |
-| Pressed / Deactivated | Thumb slides to left. Track reverts to muted fill. | Same inputs | Toggle state change | 150ms ease-in-out | [Toggle OFF sound — subtly different from ON] |
-| Disabled | 40% opacity. No interaction. Current state still visible. | — | No response | — | — |
-
-**Accessibility**:
-- Keyboard/Gamepad: Space or Enter to toggle. Avoid requiring directional inputs (left/right) to toggle — some users cannot predict that behavior.
-- Screen reader: Role: "switch." State: "on" or "off" — the accessible name should NOT include the state (the screen reader announces state separately). Correct: accessible name "Subtitles," state "on." Incorrect: accessible name "Subtitles On."
-- The toggle label (not just the visual thumb position) must change to show current state for players who cannot reliably distinguish left from right positions.
-
-**Implementation Notes**: [Godot: Use a custom Control or a CheckButton. The
-built-in CheckButton provides accessibility role but uses a checkbox-style visual;
-a custom slide-toggle animation may be needed for the target art style. Ensure
-the slide animation is skipped when motion reduction mode is active — in that
-case, snap to final state instantly.]
+| [State] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Activation inputs, screen reader switch role/state rules, state label requirements]
+
+**Implementation Notes**: [Engine-specific guidance; motion-reduction behavior]
---
@@ -250,36 +198,18 @@ case, snap to final state instantly.]
**Category**: Input
**Status**: Draft
-**When to Use**: Selecting a value from a continuous range where approximate values
-are acceptable and the range and relative position matter. Volume (0–100%), brightness,
-text size. The visual representation of position is itself useful information.
-**When NOT to Use**: Precise value entry (use Input Field). Selection from a short
-discrete list (use Dropdown). Binary state (use Toggle).
+**When to Use**: [Continuous value selection where range and relative position matter]
+**When NOT to Use**: [Precise value entry; short discrete lists; binary state]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Default | Track (full width). Fill (left of thumb, shows current value). Thumb (draggable handle). Current value label (right of track or above thumb). | — | — | — | — |
-| Hovered | Thumb enlarges slightly (1.2x). Track brightens. | Mouse over | — | 60ms | — |
-| Focused | Focus ring on thumb. Track brightens. | Tab / D-pad | — | 60ms | [UI focus sound] |
-| Dragging (mouse) | Thumb follows cursor. Fill updates in real time. Value label updates in real time. | Click + drag on thumb | Continuous value update. Fire onChange continuously. | Real time | [Slider adjust sound — subtle, loops while dragging] |
-| Keyboard / D-pad adjust | Thumb moves one step (5% of range per press, or 1 discrete unit). | Left/Right arrows or Left/Right D-pad while focused | Step value change. Fire onChange per step. | Instant | [Slider step sound — one click per step] |
-| Keyboard fast adjust | Larger step (25% of range). | Page Up / Page Down while focused | Large step value change | Instant | [Same step sound] |
-| Released | Value locks. onChange fires final value. | Mouse release | — | — | — |
-| Disabled | 40% opacity. No interaction. Value visible. | — | No response | — | — |
-
-**Accessibility**:
-- Keyboard: Left/Right arrows to adjust by small step. Page Up/Page Down for large step. Home/End to jump to min/max.
-- Screen reader: Role: "slider." Accessible name: the label (e.g., "Music Volume"). Current value announced on every change: "Music Volume, 80 percent." Min/max values announced on first focus.
-- All sliders must show a numeric value alongside the visual position. Relying only on track fill position excludes players who cannot perceive relative position.
-
-**Implementation Notes**: [Godot `HSlider`: set `step` to appropriate increment.
-Override keyboard input to add Page Up/Down support via `_input()`. Bind the
-`value_changed` signal to update the displayed numeric label. When motion reduction
-mode is enabled, ensure value label updates are the sole feedback — do not suppress
-them. Rumble feedback on gamepad slider adjustment is a nice enhancement for
-accessibility.]
+| [State] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Keyboard step/large-step/min-max inputs, screen reader value announcements, numeric value display requirement]
+
+**Implementation Notes**: [Engine-specific guidance]
---
@@ -287,36 +217,18 @@ accessibility.]
**Category**: Input
**Status**: Draft
-**When to Use**: Selection from a discrete list of 3-15 options where only the
-selected value needs to be visible at rest. Display resolution, language, window
-mode, input preset. The closed state shows only the current selection.
-**When NOT to Use**: Binary choices (use Toggle). More than ~15 options (use a
-full List pattern or a scrollable Select). When comparing options matters as much
-as selecting one (show options visibly, e.g., as a horizontal selector or list).
+**When to Use**: [Selection from a discrete list of 3-15 options; only the selection visible at rest]
+**When NOT to Use**: [Binary choices; more than ~15 options; when comparing options matters]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Closed / Default | Label (left). Current value (right). Chevron-down icon (far right). | — | — | — | — |
-| Hovered | Row background fills at 10% opacity | Mouse over | — | 60ms | — |
-| Focused (closed) | Focus ring on entire row. | Tab / D-pad | — | 60ms | [UI focus sound] |
-| Opening | Dropdown list appears below (or above if near screen bottom). List items visible. Previously selected item highlighted. Focus moves to selected item inside list. | Click / Enter / A / Cross | Open list | 100ms ease-out (expand) | [UI expand sound] |
-| List item hovered/focused | List item highlights | Mouse / D-pad | — | 60ms | [UI hover sound] |
-| List item selected | List closes. Closed state shows new value. onChange event fires. | Click / Enter / A / Cross on item | Select value, close list | 80ms ease-in (collapse) | [UI confirm sound] |
-| Dismissed without selecting | List closes. Value unchanged. | Escape / B / Circle / click outside | Dismiss | 80ms | [UI cancel sound] |
-| Disabled | 40% opacity. No interaction. | — | — | — | — |
-
-**Accessibility**:
-- Keyboard: Up/Down arrows navigate list items while open. Enter selects. Escape dismisses. First letter of an option jumps focus to first matching item.
-- Screen reader: Role: "combobox." Accessible name: the field label. Expanded/collapsed state announced. Current value announced when focused. Each list item announces its value and position: "English, 1 of 12."
-- The dropdown list must never obscure the current item or the control that opened it — this is a common failure on small screens.
-
-**Implementation Notes**: [Godot: Custom implementation using a `Button` (the
-closed state) and a `PopupMenu` or a `VBoxContainer` revealed by animation. Native
-`OptionButton` provides accessibility but limited visual customization. Ensure
-the popup positions itself above the control if it would be clipped by the screen
-bottom. Close the popup on `_input` detecting click outside its rect.]
+| [State] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [List navigation, combobox role, expanded/collapsed announcements, positioning rules]
+
+**Implementation Notes**: [Engine-specific guidance]
---
@@ -324,33 +236,18 @@ bottom. Close the popup on `_input` detecting click outside its rect.]
**Category**: Layout / Input
**Status**: Draft
-**When to Use**: A single selectable row in a vertically scrollable list. Achievements,
-quest log entries, settings categories, save file slots. The list is the container;
-this is the row within it.
-**When NOT to Use**: Grid layouts where items exist in two dimensions (use Grid Item).
-Non-selectable content rows (remove hover/focus states and the pressed state).
+**When to Use**: [A selectable row in a vertically scrollable list]
+**When NOT to Use**: [Two-dimensional grids; non-selectable content rows]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Default | Full-width row. Icon (optional, left). Primary label. Secondary label / metadata (right or below primary). Chevron (right, if navigates deeper). | — | — | — | — |
-| Hovered | Row background at 12% opacity highlight. | Mouse over | — | 60ms | — |
-| Focused | Focus ring on row OR row background at 20% opacity (consistent with platform convention). | D-pad / Tab | — | 60ms | [UI focus sound] |
-| Selected (persistent) | Row background at 25% opacity. May show a selection indicator (left border, checkmark). Distinct from focused state — a row can be selected but not focused. | — | Rendered state | — | — |
-| Pressed / Activated | Brief brightness flash, then navigates or performs action | Click / Enter / A / Cross | Navigation or action | 80ms flash | [UI confirm sound] |
-| Disabled | 40% opacity. No interaction. | — | — | — | — |
-
-**Accessibility**:
-- Keyboard/Gamepad: Up/Down arrows or D-pad to move between list items. The list must handle focus cycling — reaching the bottom should stop (not wrap) unless wrapping is explicitly designed.
-- Screen reader: Role: "listitem." Parent list role: "list." Accessible name: primary label content. Metadata (secondary label) is optionally included in the description. Position announced: "Quest Log, 3 of 12."
-- Minimum row height: 44pt / 48dp for touch. For controller-primary platforms, 56px rows are more comfortable.
-
-**Implementation Notes**: [Godot: Use a `VBoxContainer` inside a `ScrollContainer`.
-Each row is a custom `Control` or `PanelContainer` with a `_gui_input` override.
-For keyboard navigation inside the scroll container, implement custom focus
-traversal — Godot's default Tab navigation does not scroll the container to keep
-focused items in view. Use `ensure_control_visible()` on the scroll container.]
+| [State] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Focus cycling rules, listitem role and position announcements, minimum row height]
+
+**Implementation Notes**: [Engine-specific guidance; scroll-into-view on focus]
---
@@ -358,36 +255,18 @@ focused items in view. Use `ensure_control_visible()` on the scroll container.]
**Category**: Layout / Input
**Status**: Draft
-**When to Use**: A selectable cell in a two-dimensional grid. Inventory slots,
-ability select, crafting ingredient selection, character portrait selection. The
-grid is the container; this is the cell.
-**When NOT to Use**: Single-column content (use List Item). Non-selectable display
-cells (remove interactive states).
+**When to Use**: [A selectable cell in a two-dimensional grid]
+**When NOT to Use**: [Single-column content; non-selectable display cells]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Empty | Empty slot visual (subtle border or dashed outline). Different from disabled. | — | — | — | — |
-| Populated | Item icon fills cell. Stack count (bottom right, if applicable). Quality indicator (border color or icon overlay). | — | — | — | — |
-| Hovered | Brightness +15%. Tooltip appears after 400ms delay. | Mouse over | — | 60ms | — |
-| Focused | Focus ring (2px, offset 2px). Same brightness as hovered. Tooltip appears after 400ms delay or immediately on gamepad. | D-pad navigation | — | 60ms | [UI focus sound] |
-| Selected (persistent) | Distinct border (thicker, contrasting color). May show selection checkmark. | Click / Enter / A / Cross | Select item. Can coexist with focused state on a different cell. | Instant | [UI select sound] |
-| Pressed | Brief scale 0.95x, then executes action | Double-click / Enter / A / Cross | Action (equip, use, inspect — defined by context) | 80ms | [UI confirm sound] |
-| Locked | Padlock overlay icon on populated content. No hover/focus states. | — | No interaction | — | — |
-| Drag source | Cell dims (50% opacity), drag preview appears at cursor. | Click + drag (mouse only) | Begin drag operation | Instant | [UI grab sound] |
-| Drop target (valid) | Cell brightens, accepting color indicator | Item dragged over | — | 60ms | — |
-| Drop target (invalid) | Red tint or shake animation | Item dragged over invalid slot | — | 60ms | [UI error sound] |
-
-**Accessibility**:
-- Keyboard/Gamepad: D-pad or arrow keys navigate cells. The grid must communicate its dimensions to screen readers. Row/column position announced.
-- Screen reader: Role: "gridcell." Parent role: "grid." Accessible name: item name (or "empty slot" for empty cells). State: "selected" when selected, "dimmed" when locked. Position: "row 2, column 3."
-- Tooltips must be reachable by keyboard — they must appear when the cell is focused, not only when hovered.
-
-**Implementation Notes**: [Godot: `GridContainer` with fixed column count. Each
-cell is a custom `Control`. Implement custom D-pad navigation by overriding
-`_gui_input` and calculating the cell to the left/right/above/below based on
-index and column count. `GridContainer` does not provide this natively.]
+| [Empty / Populated / Hovered / Focused / Selected / Pressed / Locked / Drag source / Drop target] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Grid dimensions and row/column position announcements, keyboard-reachable tooltips]
+
+**Implementation Notes**: [Engine-specific guidance; custom D-pad cell navigation]
---
@@ -395,41 +274,21 @@ index and column count. `GridContainer` does not provide this natively.]
**Category**: Feedback / Layout
**Status**: Draft
-**When to Use**: A decision or acknowledgment that must be resolved before the
-player can continue. The dialog is blocking — background content is dimmed and
-non-interactive. "Are you sure?", "Your progress will be saved.", error states.
-**When NOT to Use**: Non-blocking notifications (use Toast / Notification). Information
-that can wait until the player is ready (add it to a persistent help system instead).
-Dialogs that should allow the player to continue playing behind them.
+**When to Use**: [A decision or acknowledgment that must be resolved before continuing]
+**When NOT to Use**: [Non-blocking notifications; information that can wait; dialogs that should allow play behind them]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Opening | Background overlay animates from 0 to 60% opacity. Dialog panel scales from 0.9 to 1.0. Dialog enters from center (not from an edge). | Triggered by code | Focus moves to first interactive element in dialog (or the Primary button) | 200ms ease-out | [UI modal open sound] |
-| Active | Background non-interactive. Dialog has all input focus. Player cannot interact with background. | Keyboard / gamepad navigates within dialog only | — | — | — |
-| Dismissing (confirmed) | Dialog panel scales to 1.1 then fades. Overlay fades to 0%. | Primary button pressed | Execute action, return focus to trigger element | 180ms | [UI confirm sound] |
-| Dismissing (cancelled) | Dialog panel scales to 0.9 then fades. Overlay fades to 0%. | Secondary button / Escape / B / Circle | No action, return focus to trigger element | 150ms | [UI cancel sound] |
-| Cannot dismiss | If the dialog represents a blocking error, do not provide a cancel path. Provide only resolution options. | — | — | — | — |
-
-> **Focus trap rule**: While a modal dialog is open, Tab and D-pad navigation
-> must cycle within the dialog's interactive elements only. It must not be possible
-> to navigate focus outside the dialog to the background content. This is both
-> an accessibility requirement (WCAG 2.1 SC 2.1.2) and a UX integrity requirement.
-> When the dialog closes, focus must return to the element that triggered it,
-> not to the top of the page.
-
-**Accessibility**:
-- Screen reader: Dialog container role: "dialog." Accessible name: dialog title (required — every dialog must have a title, even if visually hidden). On open, screen reader announces dialog title and first focusable element. Focus trap active.
-- Keyboard: Escape key always maps to the cancel/dismiss action (same as Secondary button or close button). Enter always maps to the primary/confirm action.
-- Motion reduction: Scale animation replaced with instant appear/disappear. Overlay fade retained at 100ms (faster).
-
-**Implementation Notes**: [Godot: Implement as a `CanvasLayer` with a high layer
-value (100+) to ensure it renders above all game content. The background overlay
-is a full-screen `ColorRect` at 60% black opacity. Use `grab_focus()` on the
-dialog's primary button after the open animation completes. Override `_input()` to
-implement the focus trap — intercept Tab navigation and reroute to the dialog's
-focusable elements.]
+| [Opening / Active / Dismissing (confirmed) / Dismissing (cancelled) / Cannot dismiss] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+> **Focus trap rule**: While a modal dialog is open, focus navigation must cycle
+> within the dialog only, and focus must return to the trigger element on close.
+
+**Accessibility**: [Dialog role and required title, Escape/Enter mappings, motion-reduction overrides]
+
+**Implementation Notes**: [Engine-specific guidance]
---
@@ -437,33 +296,22 @@ focusable elements.]
**Category**: Feedback / Layout
**Status**: Draft
-**When to Use**: The specific case of confirming a destructive action. Always
-triggered by Button (Destructive). Always has exactly two options: confirm (labeled
-with the specific action, not "OK") and cancel.
-**When NOT to Use**: Non-destructive confirmations. Errors or notifications that
-do not require a decision. Any dialog with more than two actions.
+**When to Use**: [Confirming a destructive action — always triggered by Button (Destructive)]
+**When NOT to Use**: [Non-destructive confirmations; dialogs with more than two actions]
> **Label rule**: The confirm button must be labeled with the specific action,
-> not a generic "OK" or "Yes." "Delete Save File" not "OK." "Leave Match" not
-> "Yes." This reduces mistakes for players who have difficulty reading the dialog
-> content quickly. The pattern comes from Apple HIG and is validated by decades
-> of usability research.
+> not a generic "OK" or "Yes."
**Structure**:
-- Title: Brief, action-describing. "Delete save file?" not "Are you sure?"
-- Body: One sentence stating the consequence. "This cannot be undone."
-- Confirm button: Button (Primary) — labeled with the specific action. "Delete Save File."
-- Cancel button: Button (Secondary) — "Cancel."
-- Default focus: Cancel (safer default — reduces accidental destructive actions).
+- Title: [Brief, action-describing]
+- Body: [One sentence stating the consequence]
+- Confirm button: [Button (Primary) — labeled with the specific action]
+- Cancel button: [Button (Secondary) — "Cancel"]
+- Default focus: [Cancel — safer default]
-**Accessibility**: Inherits all Modal Dialog accessibility. Additionally: screen
-reader announces "Alert dialog, [title]" to signal destructive context. Default
-focus on Cancel is a requirement, not a preference.
+**Accessibility**: [Inherits Modal Dialog; alert-dialog announcement; default focus on Cancel is required]
-**Implementation Notes**: [Confirmation Dialog is a specific instance of Modal
-Dialog — implement it as a subclass or as a parameterized scene. The default
-focus on Cancel is critical: set `grab_focus()` on the Cancel button, not the
-Confirm button, after open animation completes.]
+**Implementation Notes**: [Engine-specific guidance]
---
@@ -471,35 +319,18 @@ Confirm button, after open animation completes.]
**Category**: Feedback
**Status**: Draft
-**When to Use**: Brief, non-blocking information that does not require a player
-decision. "Game saved." "Achievement unlocked." "Your inventory is full." The player
-can continue playing; the notification disappears on its own.
-**When NOT to Use**: Information that requires a decision (use Modal Dialog).
-Errors that require the player to take action. Critical information that the player
-must not miss.
+**When to Use**: [Brief, non-blocking information requiring no player decision]
+**When NOT to Use**: [Decisions; errors requiring action; critical information the player must not miss]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Entering | Slides in from screen edge (typically bottom-right, away from primary action areas). Fades from 0 to 100% opacity. | Triggered by code | — | 200ms ease-out | [Sound matching notification type — see Sound Standards] |
-| Displayed | Full opacity. Optional: icon (left), title, body text (optional), dismiss button (X, optional). | Pointer hover pauses auto-dismiss timer | Pause auto-dismiss | — | — |
-| Auto-dismiss | Fades from 100 to 0% opacity, slides out | Timer expires (5 seconds default for one-line; 8 seconds for two-line) | Remove from queue | 200ms ease-in | — |
-| Manual dismiss | Fades and slides out immediately | Click/tap X button or swipe on touch | Remove | 150ms | [UI cancel sound, quiet] |
-| Queue overflow | New notification pushes oldest out early | New notification triggered while previous is displayed | FIFO queue, max 3 simultaneous | — | — |
-
-**Accessibility**:
-- Screen reader: Toasts must be read aloud without requiring focus. In HTML, this uses `role="status"` or `role="alert"`. In game UI, this requires the engine's accessibility notification system. Verify engine support in engine-reference docs.
-- Motion reduction: Slide animation replaced with fade only.
-- Toasts must never be the sole communication channel for information the player needs to act on. If the information requires action, use a persistent UI element in addition to the toast.
-- Auto-dismiss timer: 5 seconds is the minimum. Players with cognitive processing differences may need more time. Consider a setting to extend to 10 or 15 seconds.
-
-**Implementation Notes**: [Godot: Manage a queue of `PanelContainer` scenes in a
-`VBoxContainer` anchored to a screen corner. Each toast is instantiated, added to
-the container, then auto-removed after a timer. The container should be on a high
-`CanvasLayer` (50+) but below modal dialogs (100+). Animate using a `Tween` on
-`modulate.a` and `position.x`. When motion reduction is active, skip the position
-animation.]
+| [Entering / Displayed / Auto-dismiss / Manual dismiss / Queue overflow] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Announcement without focus, motion-reduction fallback, minimum auto-dismiss timing, never sole channel for actionable info]
+
+**Implementation Notes**: [Engine-specific guidance; queue management and layer ordering]
---
@@ -507,36 +338,18 @@ animation.]
**Category**: Feedback
**Status**: Draft
-**When to Use**: Contextual information that supplements a visible label. Item
-descriptions in inventory. Stat explanations on a character sheet. Setting
-descriptions in accessibility options. The player must be able to access this
-information or proceed without it.
-**When NOT to Use**: Information the player MUST read to complete an action — put
-that in the label or body text, not a tooltip. Tooltips are not discoverable
-on mobile touch without a hover state. On touch-only platforms, use an info button
-that opens a description modal instead.
+**When to Use**: [Contextual information supplementing a visible label]
+**When NOT to Use**: [Information required to complete an action; touch-only platforms without hover]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Hidden | — | — | — | — | — |
-| Hover trigger | — | Mouse enters element | Begin 400ms delay timer | — | — |
-| Gamepad/keyboard trigger | — | Element receives focus | Begin 300ms delay timer (shorter because navigation is intentional) | — | — |
-| Appearing | Tooltip panel fades in and scales from 0.95 to 1.0. Positioned near element (prefer above, adjust if near screen edge). | Timer expires | Show tooltip | 120ms ease-out | — |
-| Displayed | Tooltip visible. Title (optional). Body text. Max width: 300px. Multiple lines allowed. | — | — | — | — |
-| Hiding | Tooltip fades out | Mouse leaves element / focus moves away | Hide tooltip | 80ms ease-in | — |
-
-**Accessibility**:
-- Screen reader: Tooltip content must be accessible without hover. The accessible name of the parent element should include the most critical tooltip information. The full tooltip text is optionally in the `description` property. Screen reader reads tooltip content when element is focused.
-- The delay (300-400ms) prevents accidental tooltip display and is required — instant tooltips are disruptive in gamepad navigation.
-- Tooltip text must meet the same contrast requirements as body text (4.5:1 minimum).
-
-**Implementation Notes**: [Godot: Attach a custom `TooltipControl` scene as a
-child of the trigger element. Show/hide with a `Timer` node. Position the tooltip
-using a `CanvasLayer` to ensure it appears above all other UI. For screen edges,
-detect if the tooltip rect extends beyond `get_viewport_rect()` and flip the
-position to the opposite side.]
+| [Hidden / Hover trigger / Focus trigger / Appearing / Displayed / Hiding] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Content accessible without hover, required appearance delay, contrast requirements]
+
+**Implementation Notes**: [Engine-specific guidance; screen-edge repositioning]
---
@@ -544,34 +357,18 @@ position to the opposite side.]
**Category**: Feedback / Layout
**Status**: Draft
-**When to Use**: Linear progress toward a defined endpoint. Loading screens (time
-to completion), XP fill toward next level, quest objectives with countable progress
-("3 of 10 enemies defeated"), download progress.
-**When NOT to Use**: Circular or radial progress (use a separate Radial Progress
-pattern if needed). Values that fluctuate up and down rapidly (use Health/Resource
-Bar pattern). Values with no defined endpoint.
+**When to Use**: [Linear progress toward a defined endpoint]
+**When NOT to Use**: [Radial progress; rapidly fluctuating values; values with no endpoint]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Default | Track (full width, background color). Fill (left to right, value color). Value label (percentage or N/M, outside or inside fill). | — | — | — | — |
-| Value increasing | Fill width animates to new value | Value changes | Smooth fill animation | 300ms ease-out | [Context-dependent — XP gain has a sound; loading has none] |
-| Value at maximum | Fill reaches full width. Optional: completion animation (pulse, glow). | Value reaches 100% | Completion event fires | 200ms | [Completion sound if appropriate] |
-| Value at zero | Fill hidden (zero width). Track still visible. | — | — | — | — |
-| Indeterminate (unknown duration) | Animated loop (fill segment moves left-to-right, repeat). Used for loading of unknown duration. | — | — | Infinite loop | — |
-
-**Accessibility**:
-- Screen reader: Role: "progressbar." Accessible name: what is progressing (e.g., "Experience Points," "Loading"). Value: current numeric value AND percentage AND maximum. "Experience Points, 450 of 1000, 45 percent." Update on significant changes (not every pixel).
-- Do not rely only on fill color to communicate value. Include a numeric label.
-- Indeterminate progress bars: announce "Loading, in progress" — do not announce changes since the value is unknown.
-- Motion reduction: Indeterminate animation is replaced with a static "loading" indicator. Smooth fill animation is replaced with instant jump to new value.
-
-**Implementation Notes**: [Godot: `ProgressBar` built-in with custom theming.
-For indeterminate mode, `ProgressBar` does not have a native indeterminate state
-in Godot 4.x — implement using a looping `Tween` on a fill element's position.
-Ensure the Tween is paused when motion reduction mode is active and a static
-indicator is shown instead.]
+| [Default / Value increasing / At maximum / At zero / Indeterminate] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Progressbar role, numeric value + percentage announcements, numeric label requirement, motion-reduction overrides]
+
+**Implementation Notes**: [Engine-specific guidance; indeterminate-mode implementation]
---
@@ -579,39 +376,18 @@ indicator is shown instead.]
**Category**: Input
**Status**: Draft
-**When to Use**: Text entry. Player name on a new save, search within a list,
-remapping a key binding (special case — shows the key press, not typed text),
-entering a numeric value precisely.
-**When NOT to Use**: Selecting from known options (use Dropdown or List). On
-console-primary platforms, minimize text entry — it requires a virtual keyboard,
-which is high friction.
+**When to Use**: [Text entry — player name, search, precise numeric values, key binding capture]
+**When NOT to Use**: [Selecting from known options; console-primary flows where virtual keyboards add friction]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Default | Field border, placeholder text (label-style, muted color), empty input area. | — | — | — | — |
-| Hovered | Border brightens slightly | Mouse over | — | 60ms | — |
-| Focused | Border brightens fully. Cursor (blinking, 530ms on/530ms off). Placeholder text hidden. | Tab / click | Open virtual keyboard on console/mobile | Instant | [UI focus sound] |
-| Typing | Characters appear. Cursor advances. | Keyboard input | Update field value | Immediate | [Subtle keystroke sound, optional] |
-| Value present | Field shows typed value. Placeholder hidden. Clear button appears (X, right of field) if value is non-empty. | — | — | — | — |
-| Character limit reached | No further input accepted. Optional: brief shake animation and limit indicator changes color. | Input at limit | Reject further characters | 200ms shake | [UI error sound, subtle] |
-| Clear | Field empties. Cursor returns. Clear button disappears. | Click X / gamepad clear input | Clear value | Instant | [UI cancel sound, subtle] |
-| Validation error | Border turns error color (red — ensure colorblind safe). Error message appears below field. | On submit or on blur | Show error | Instant | [UI error sound] |
-| Validated / correct | Border turns success color (green — ensure colorblind safe). Success icon optional. | On validation pass | — | Instant | — |
-| Disabled | 40% opacity, no interaction. Value still visible. | — | — | — | — |
-
-**Accessibility**:
-- Keyboard: All standard text editing shortcuts (Home, End, Ctrl+A, Ctrl+C, Ctrl+V, Ctrl+Z).
-- Screen reader: Role: "textbox." Accessible name: field label (not placeholder text). Current value announced. Character limit announced when reached. Validation errors announced immediately on occurrence.
-- Placeholder text must not be used as the only label — a visible label above or beside the field is required. Placeholder text disappears when the player types, causing confusion for players with cognitive or memory impairments.
-
-**Implementation Notes**: [Godot `LineEdit`: set `placeholder_text` for the hint
-but always include a visible `Label` node as the field's accessible name. Bind
-`text_changed` signal for real-time validation. Bind `text_submitted` for form
-submission on Enter. On console, `LineEdit.call("_popup_keyboard")` or use the OS
-virtual keyboard API — verify against engine-reference/godot/ for Godot 4.6
-console keyboard API specifics.]
+| [Default / Hovered / Focused / Typing / Value present / Limit reached / Clear / Validation error / Validated / Disabled] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Standard editing shortcuts, textbox role, visible label requirement (placeholder is not a label)]
+
+**Implementation Notes**: [Engine-specific guidance; virtual keyboard handling]
---
@@ -619,37 +395,18 @@ console keyboard API specifics.]
**Category**: Navigation
**Status**: Draft
-**When to Use**: Dividing a single screen's content into discrete sections where
-only one section is visible at a time. Character sheet tabs (Stats / Equipment /
-Skills), settings tabs (Gameplay / Graphics / Audio / Accessibility). Maximum
-5-6 tabs before the pattern breaks down and a sidebar navigation should be
-considered instead.
-**When NOT to Use**: More than 6 tabs. Content that benefits from simultaneous
-visibility (use a layout pattern instead). Navigation between different screens
-(use Screen Push).
+**When to Use**: [Dividing one screen's content into discrete sections, one visible at a time — max 5-6 tabs]
+**When NOT to Use**: [More than 6 tabs; content needing simultaneous visibility; navigation between screens]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Default (inactive tab) | Tab label. No active indicator. | — | — | — | — |
-| Active tab | Tab label. Active indicator (underline, fill, or contrasting background). Content area shows this tab's content. | — | — | — | — |
-| Hovered (inactive) | Tab background fills slightly | Mouse over | — | 60ms | — |
-| Focused (keyboard/gamepad) | Focus ring on tab label. | Tab key (within tab bar) or D-pad left/right on tab row | — | 60ms | [UI focus sound] |
-| Activated | Active indicator transitions to this tab. Content area transitions (fade or slide). | Click / Enter / A / Cross | Switch active tab. Content update. | 150ms ease | [UI tab switch sound] |
-| Gamepad shoulder button | — | L1/R1 (PS) or LB/RB (Xbox) | Switch to previous/next tab (standard platform convention) | 150ms | [UI tab switch sound] |
-
-**Accessibility**:
-- Keyboard: Arrow keys navigate between tabs within the tab bar (left/right). Tab key moves focus into the content area below. This follows the ARIA tab panel pattern.
-- Screen reader: Role: "tab" for individual tabs. Role: "tablist" for the container. Role: "tabpanel" for the content area. Active tab state: "selected." Accessible name: tab label. Tabpanel is labeled by its corresponding tab.
-- The active tab must be visually distinguishable by more than color alone (underline, fill pattern, or weight change in addition to color).
-
-**Implementation Notes**: [Godot: `TabContainer` built-in. For custom visual
-styling, implement manually with a `HBoxContainer` of tab buttons and a
-`MarginContainer` for content. The shoulder button shortcut (LB/RB) must be
-implemented in the screen's `_input()` override — it is not built into Godot's
-tab system. Check platform conventions: Xbox uses LB/RB; PlayStation uses L1/R1;
-both are the same physical button, so a single binding works.]
+| [Inactive / Active / Hovered / Focused / Activated / Shoulder-button switch] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [ARIA tab panel pattern (tab/tablist/tabpanel), active-tab distinction beyond color]
+
+**Implementation Notes**: [Engine-specific guidance; shoulder-button shortcut handling]
---
@@ -657,67 +414,44 @@ both are the same physical button, so a single binding works.]
**Category**: Layout
**Status**: Draft
-**When to Use**: Content that exceeds the visible area of its container. Inventory
-lists, lore entry text, credits, long settings lists. The scroll indicator shows
-the player that more content exists.
-**When NOT to Use**: Content that can be paginated instead (pagination may be
-clearer for dense list navigation). Infinite scroll (always provide a loading
-state and an end state).
+**When to Use**: [Content exceeding the visible area of its container]
+**When NOT to Use**: [Content better paginated; infinite scroll without loading/end states]
**Interaction Specification**:
| State | Visual | Input | Response | Duration | Audio |
|-------|--------|-------|----------|----------|-------|
-| Content fits | No scrollbar visible (or always-visible scrollbar at full height, depending on art direction). | — | — | — | — |
-| Scrollable | Scrollbar appears (right edge). Scrollbar thumb size represents viewport vs. content ratio. | — | — | — | — |
-| Scrolling (mouse) | Content moves. Scrollbar thumb moves proportionally. | Mouse wheel | Scroll by 3 lines per wheel tick (configurable in OS) | Smooth | — |
-| Scrollbar drag | Content moves. Thumb follows pointer. | Click + drag scrollbar thumb | Scroll proportionally | Real time | — |
-| Keyboard scroll | Content moves one item height per keypress. | Up/Down arrows when container is focused and no child is focused | Scroll by one unit | Immediate | — |
-| Gamepad scroll | Content moves to keep focused item in view. | D-pad navigation to items beyond visible area | Auto-scroll to keep focused item visible | Smooth 150ms | — |
-| Scroll top / bottom | Content stops. Scrollbar thumb at end. | Content boundary reached | Stop scrolling | — | — |
-| Focus follows scroll | When a child element receives focus, scroll container ensures it is fully visible. | Any child receives focus | Scroll to reveal focused element | 200ms ease | — |
-
-**Accessibility**:
-- Keyboard/Gamepad: The scroll container itself should not require explicit scrollbar interaction — navigating list items inside it should auto-scroll to keep focused items in view.
-- Screen reader: The scroll container announces "scrollable" and the scroll position ("showing items 5 through 15 of 30"). This requires engine accessibility support — verify in engine-reference/godot/.
-- Fade edges (content fading at scroll boundaries to indicate more content exists) are a helpful visual affordance but must not be the only indicator that content exists beyond the visible area. Include a scrollbar.
-
-**Implementation Notes**: [Godot `ScrollContainer`: call `ensure_control_visible()`
-on the focused child whenever `gui_focus_changed` fires inside the container.
-Bind this via a recursive `connect` on the container's `gui_focus_changed` signal.
-For smooth scroll animation, use a `Tween` on `scroll_vertical` rather than
-setting it directly.]
+| [Content fits / Scrollable / Scrolling / Scrollbar drag / Keyboard scroll / Gamepad scroll / Boundary / Focus follows scroll] | [Visual treatment] | [Input trigger] | [Response] | [Duration + easing] | [Sound category] |
+
+**Accessibility**: [Auto-scroll to keep focused items in view, scroll position announcements, scrollbar as required indicator]
+
+**Implementation Notes**: [Engine-specific guidance; ensure-visible on focus change]
---
## Game-Specific UI Patterns
+> Full reference specifications for every pattern in this section are in
+> `.claude/docs/templates/guidance/interaction-pattern-library-guide-game-specific.md` — load only the
+> pattern(s) currently being specified.
+
---
#### Inventory Slot
**Category**: Game-Specific
**Status**: Draft
-**When to Use**: Every item container in the inventory grid. Empty slots, populated
-slots, equipped slots, locked slots. The slot is the frame; the item icon is the
-content.
+**When to Use**: [Every item container in the inventory grid — empty, populated, equipped, locked]
**States**:
| State | Visual | Notes |
|-------|--------|-------|
-| Empty | Subtle slot border, no content. Not the same as disabled. Empty slots are interactable (receive items). | Avoid fully invisible empty slots — players lose track of grid dimensions |
-| Populated | Item icon fills 80% of slot area. Stack count bottom-right (if applicable). Quality border (colorblind-safe — icon + color). Equipped badge (top-right, if equipped). | |
-| Focused | Focus ring. Tooltip appears after 300ms. | |
-| Selected | Thicker or contrasting border. Used when multi-select is supported. | |
-| Drag source | Slot dims, drag ghost follows pointer. | See Grid Item for full drag spec |
-| Locked | Padlock icon overlay. No interaction. May show item at 50% opacity behind lock. | Used for locked loadout slots, DLC content, etc. |
-| Highlighted | Animated border glow (pulsing). Used for quest-relevant items or newly acquired items. | Respect motion reduction — replace pulse with a static badge |
-| Cooldown overlay | Radial fill overlay from 12 o'clock, clockwise, depleting as cooldown expires. | Only applicable if slots represent active items with cooldowns |
+| [Empty / Populated / Focused / Selected / Drag source / Locked / Highlighted / Cooldown overlay] | [Visual treatment] | [Behavioral notes] |
-**Accessibility**: Stack counts and quality tiers must have text or icon alternatives to color coding. Tooltip is the primary accessibility mechanism — ensure it is reachable by keyboard and screen reader. Locked slots must announce "locked" to screen readers.
+**Accessibility**: [Non-color alternatives for stack counts and quality tiers; keyboard-reachable tooltip; locked-state announcement]
-**Implementation Notes**: [Godot: Custom `Control` node. Quality border implemented as a `StyleBoxFlat` swapped based on rarity — avoid using `modulate` color for quality, as it affects the icon color. Drag and drop implemented via `get_drag_data()` and `can_drop_data()` / `drop_data()` override methods.]
+**Implementation Notes**: [Engine-specific guidance]
---
@@ -725,28 +459,17 @@ content.
**Category**: Game-Specific
**Status**: Draft
-**When to Use**: Ability buttons in the HUD ability bar, skill tree nodes, and
-any context where an ability must show availability state.
+**When to Use**: [HUD ability bar buttons, skill tree nodes, any availability-state ability display]
**States**:
| State | Visual | Notes |
|-------|--------|-------|
-| Available | Full opacity icon. Keybinding label below. | |
-| On cooldown | Radial overlay depleting clockwise from 12 o'clock. Remaining time shown as a number in the center when > 2 seconds remain. | |
-| Charges remaining | Charge pip indicators below icon (e.g., 3 filled circles = 3 charges). Number alternative for screen readers. | |
-| Out of resource | Icon desaturates to ~20%. Border dims. Keybinding label dims. Distinct from cooldown — resource-gated, not time-gated. | |
-| Locked / not unlocked | Icon silhouette only (no full art visible). Padlock badge. May show unlock condition in tooltip. | |
-| Active / channeling | Pulsing border. Radial fill shows channel duration remaining. | |
-| Just activated | Brief scale 0.9x then spring to 1.0x (overshoot to 1.05x). | Example: Guild Wars 2 and Path of Exile both use press-depress animations on ability use to confirm activation. Respect motion reduction. |
-
-**Accessibility**: All cooldown/charge information must have a numeric value (screen reader cannot parse radial overlays). The cooldown timer number satisfies this. Ability names and descriptions must be exposed to screen readers via tooltip.
-
-**Implementation Notes**: [Godot: Custom `TextureButton` subclass with overlay
-`Control` nodes for cooldown radial and charge pips. The cooldown radial uses a
-custom shader on a `ColorRect` rotating a mask — or implement with a
-`ProgressBar` styled as circular if engine supports it. Verify against
-engine-reference/godot/ for Godot 4.6 shader support for this pattern.]
+| [Available / On cooldown / Charges remaining / Out of resource / Locked / Active / Just activated] | [Visual treatment] | [Behavioral notes] |
+
+**Accessibility**: [Numeric alternatives for cooldown/charge information; names and descriptions exposed to screen readers]
+
+**Implementation Notes**: [Engine-specific guidance]
---
@@ -754,26 +477,17 @@ engine-reference/godot/ for Godot 4.6 shader support for this pattern.]
**Category**: Game-Specific
**Status**: Draft
-**When to Use**: Any continuously varying value in the HUD that represents a
-critical player resource. Health, mana, stamina, shield, fuel.
+**When to Use**: [Any continuously varying critical player resource in the HUD]
**States and behaviors**:
| Event | Visual | Audio | Duration |
|-------|--------|-------|---------|
-| Value decrease (damage) | Fill shrinks. Brief "damage flash" on the fill (white or red flash). Ghost bar lingers at previous value and drains to new value over 0.5s ("damage indicator"). | [Damage taken sound — varies by amount] | Instant decrease, 500ms ghost bar drain |
-| Value increase (heal) | Fill grows. Brief heal color flash (green — ensure colorblind safe with icon/glow backup). | [Heal sound] | 300ms ease-in |
-| Below 25% threshold | Fill changes color to warning state. Border pulses (or static badge in motion reduction mode). Optional: heartbeat audio cue (paired with visual if audio is sole signal). | [Low health sound — loops until above threshold] | Continuous |
-| At zero | Bar empty. Optional: bar shakes briefly. Death/depletion event fires. | [Death/depletion sound] | 200ms shake |
-| Maximum | Fill at 100%, brief glow. | — | 200ms |
-| Overflow (shield) | A separate bar segment appears beyond the natural fill area, in shield color. | [Shield gain sound] | 200ms |
+| [Decrease / Increase / Below threshold / At zero / Maximum / Overflow] | [Visual treatment] | [Sound category] | [Duration] |
-**Accessibility**: The current value must be accessible as a number (tooltip or persistent display, or both). Color-coded threshold states must have non-color backups (icon, flashing, or audio visual warning). Warning state at 25% must have a visual signal independent of the color change.
+**Accessibility**: [Numeric value access; non-color backups for threshold states]
-**Implementation Notes**: [Godot: Two overlapping `ProgressBar` nodes for ghost
-bar effect — back bar holds previous value (drains via Tween), front bar holds
-current value (updates instantly). Threshold states trigger `StyleBoxFlat` swaps
-on the front bar. Ghost bar Tween duration is tunable as a designer parameter.]
+**Implementation Notes**: [Engine-specific guidance; ghost-bar technique]
---
@@ -781,31 +495,19 @@ on the front bar. Ghost bar Tween duration is tunable as a designer parameter.]
**Category**: Game-Specific
**Status**: Draft
-**When to Use**: NPC conversation, voiced narrative dialogue, tutorial text
-delivered through a character. All dialogue that has a speaker.
+**When to Use**: [All dialogue that has a speaker — NPC conversation, voiced narrative, character-delivered tutorial text]
-**Structure**: Speaker portrait or name tag (top of box or left side). Dialogue text body. Continue/advance prompt (bottom right). Optional: skip-all button, voice acting indicator, subtitle indicator.
+**Structure**: [Speaker identification, dialogue text body, advance prompt, optional skip/voice/subtitle indicators]
**States and behaviors**:
| State | Visual | Input | Response | Duration |
|-------|--------|-------|----------|---------|
-| Line entering | Text reveals character-by-character (typewriter effect). Or: text fades in at full speed if accessibility option set. | — | — | Speed: configurable in accessibility settings |
-| Revealing | Text animating in. Continue prompt hidden or pulsing at slow opacity. | [Any advance input] | Skip to end of current line instantly (show full line, stop typewriter) | Immediate |
-| Line complete | Full line shown. Continue prompt visible and animated. | — | — | — |
-| Advancing to next line | Continue prompt hides. Text fades out or wipes. New line begins. | [Any advance input] — Enter / A / Cross / Space / mouse click | Advance | 100ms transition |
-| Choices appearing | Choice buttons appear below dialogue text. Continue prompt hidden. Navigation focus moves to first choice. | D-pad / keyboard to select, Enter / A / Cross to confirm | Select choice | 150ms enter animation |
-| Closing | Box fades out | Final line advanced | Return control to player | 200ms |
-| Skipping all (if supported) | Brief confirmation prompt: "Skip dialogue?" | Dedicated skip button | Skip to post-dialogue state | — |
-
-**Accessibility**: Subtitles are always enabled by default for all voiced dialogue. Typewriter animation speed is a user setting (see accessibility-requirements.md). The dialogue box must not auto-advance — players must control pacing. Speaker name is always shown. All choice buttons must be navigable by keyboard and gamepad. Choices must be accessible to screen readers with position announced.
-
-**Implementation Notes**: [Godot: `RichTextLabel` with `bbcode_enabled` for
-formatting. Typewriter effect via `visible_characters` property animated by a
-`Timer`. Bind the advance input to a function that either skips typewriter
-(sets `visible_characters = -1`) or advances the dialogue state. Speaker name
-displayed in a separate `Label` above or beside the box. Dialogue data loaded from
-JSON or a dedicated dialogue format (e.g., Dialogic, Yarn Spinner for Godot).]
+| [Line entering / Revealing / Line complete / Advancing / Choices appearing / Closing / Skipping all] | [Visual treatment] | [Input trigger] | [Response] | [Duration] |
+
+**Accessibility**: [Subtitles on by default, configurable typewriter speed, no auto-advance, navigable choices with position announcements]
+
+**Implementation Notes**: [Engine-specific guidance; dialogue data format]
---
@@ -813,23 +515,17 @@ JSON or a dedicated dialogue format (e.g., Dialogic, Yarn Spinner for Godot).]
**Category**: Game-Specific
**Status**: Draft
-**When to Use**: A prompt that appears near an interactable game object indicating
-what the player can do. "Press [A] to open chest." "Hold [E] to pick up." Appears
-when the player enters the interaction zone, disappears when they leave.
+**When to Use**: [A prompt near an interactable object indicating what the player can do]
**States**:
| State | Visual | Notes |
|-------|--------|-------|
-| Appearing | Fades in and rises 8px from object anchor point. | Respect motion reduction — fade only, no rise |
-| Idle | Platform-correct button icon + action label. Icon matches current input method (updates if player switches). | Always show platform-correct icon — do not hardcode "Press A" for all platforms |
-| Holding (for hold inputs) | Radial fill on the button icon shows hold progress. Label changes to active verb ("Opening..."). | |
-| Cannot interact (blocked) | Icon dims. Label shows reason if known ("Too heavy", "Need key"). | Optional — only show blocked state if the reason is meaningful to the player |
-| Disappearing | Fades out. | Triggered when player exits interaction zone |
+| [Appearing / Idle / Holding / Cannot interact / Disappearing] | [Visual treatment] | [Behavioral notes] |
-**Accessibility**: The button icon must be accompanied by a text label — do not rely on icon alone (some players use custom button labels or adaptive controllers with non-standard icons). The prompt must be positioned to not overlap character health or critical HUD information.
+**Accessibility**: [Text label alongside button icon; positioning must not overlap critical HUD]
-**Implementation Notes**: [Godot: Attach as a `Node3D` child (or `Node2D` child in 2D) of the interactable object. Use a `BillboardMesh` or a `SubViewport` with a UI scene for 3D games — this keeps the prompt facing the camera without code. Update the button icon texture based on `Input.get_joy_name()` or keyboard detection via `InputEventKey` vs `InputEventJoypadButton`. Hold progress implemented as an `AnimationPlayer` or `Tween` on a radial mask shader.]
+**Implementation Notes**: [Engine-specific guidance; input-method-aware icon swapping]
---
@@ -837,33 +533,28 @@ when the player enters the interaction zone, disappears when they leave.
**Category**: Game-Specific
**Status**: Draft
-**When to Use**: Floating feedback numbers above combat participants. Normal
-damage, critical damage, healing, miss.
+**When to Use**: [Floating feedback numbers above combat participants]
**Variants**:
| Variant | Visual | Notes |
|---------|--------|-------|
-| Normal damage | White number, normal weight, medium size. | |
-| Critical hit | Larger size (1.5x), bold weight, orange or yellow — verify colorblind safe. Brief scale impact (1.3x → 1.0x on appear). | Example: Path of Exile and Diablo IV both use scale-pop for crits to make them immediately recognizable by size alone, independent of color. |
-| Healing | Green (verify colorblind safe — use + prefix and upward trajectory as non-color backups). | |
-| Miss / Evade | "MISS" text, grey, italic. Floats at smaller size. | |
-| Status damage (DoT) | Smaller size, distinct color matching the status effect. | |
+| [Normal / Critical / Healing / Miss / Status damage] | [Visual treatment] | [Behavioral notes] |
-**Behavior**: Numbers float upward from the hit location over 1.0 second. Numbers fade from 100% to 0% during the last 0.4 seconds. Multiple numbers from rapid hits stagger horizontally to avoid overlap. Maximum simultaneous damage numbers on screen: [define per game — typically 8-12 per character].
+**Behavior**: [Float trajectory, fade timing, overlap staggering, maximum simultaneous numbers]
-**Accessibility**: Damage numbers are purely supplementary feedback — they must never be the only way to understand combat state. Health bars are the authoritative source. Provide an option to disable damage numbers entirely (some players find them visually overwhelming). When disabled, the game must remain fully playable.
+**Accessibility**: [Supplementary-only feedback; disable option; game fully playable when disabled]
-**Implementation Notes**: [Godot: Pool of `Label3D` (3D games) or `Label` (2D games)
-instances recycled via an object pool. Each instance is given a random small
-horizontal offset on spawn (±20px) to reduce overlap. Float animation via
-`Tween` on `position.y` and `modulate.a`. Critical hit scale-pop via Tween
-with `EASE_OUT` on scale followed by linear settle.]
+**Implementation Notes**: [Engine-specific guidance; object pooling]
---
## Navigation Patterns
+> Full reference specifications for this section and the next are in
+> `.claude/docs/templates/guidance/interaction-pattern-library-guide-navigation-feedback.md` — load
+> only the pattern(s) currently being specified.
+
---
#### Screen Push / Pop / Replace
@@ -875,19 +566,13 @@ These three patterns define how screens enter and exit the navigation stack.
| Pattern | Trigger | Animation | Stack Behavior | Focus Behavior |
|---------|---------|-----------|---------------|----------------|
-| Push | Navigate deeper (open submenu, open detail view) | New screen slides in from right. Previous screen slides left and dims. | Previous screen remains on stack | Focus moves to first interactive element on new screen |
-| Pop (Back) | Back button / Escape / B / Circle | Current screen slides right and exits. Previous screen slides in from left and brightens. | Current screen removed from stack | Focus returns to the element that triggered the Push |
-| Replace | Navigate to a peer screen (not child, not parent). Loading screen. | Fade out current, fade in new. No directional bias. | Current screen removed. New screen added. | Focus moves to first interactive element on new screen |
+| [Push / Pop / Replace] | [Trigger] | [Animation] | [Stack behavior] | [Focus behavior] |
-**Animation durations**: Push/Pop: 250ms ease-in-out. Replace: 200ms fade out + 200ms fade in.
+**Animation durations**: [Push/Pop and Replace durations + easing]
-**Motion reduction**: All slide animations become fades. Duration reduces to 100ms.
+**Motion reduction**: [Fallback behavior]
-**Implementation Notes**: [Godot: Implement as a `ScreenManager` singleton managing
-a stack of `Control` scenes. `push(screen_scene)` instantiates and animates in.
-`pop()` animates out and frees. `replace(screen_scene)` calls pop then push without
-the intermediate stack state. Use `CanvasLayer` per screen to isolate input handling.
-Store the "return focus" element reference before pushing so it can be restored on pop.]
+**Implementation Notes**: [Engine-specific guidance; screen stack manager and return-focus storage]
---
@@ -897,22 +582,11 @@ Store the "return focus" element reference before pushing so it can be restored
**Status**: Draft
> Focus management is the most common keyboard and gamepad accessibility failure
-> in game UIs. These rules must be implemented consistently. A player should
-> never be in a state where they cannot see which element is focused, or where
-> Tab/D-pad produces no visible result.
+> in game UIs. These rules must be implemented consistently.
| Rule | Description |
|------|-------------|
-| Screen open | Focus is placed on the most logical interactive element — typically the Primary button, the first list item, or the last-focused element if the screen was previously visited. Never on a non-interactive element. |
-| Screen close / pop | Focus returns to the element that triggered the navigation (the button that opened the screen, the list item that was selected). If that element no longer exists, focus goes to the nearest preceding interactive element. |
-| Modal open | Focus is trapped inside the modal. See Modal Dialog pattern. |
-| Modal close | Focus returns to the element that triggered the modal. |
-| Element disabled | If the focused element becomes disabled, focus moves to the next available interactive element in the tab order. |
-| Element destroyed | If the focused element is removed from the scene, focus moves to the nearest preceding element in the tab order. |
-| Screen without interactive elements | Focus management is a no-op. Ensure back/cancel input still works. |
-| Tab key (keyboard) | Moves focus forward through interactive elements in document order (left to right, top to bottom). Shift+Tab moves backward. |
-| D-pad (gamepad) | Moves focus in the spatial direction pressed. Spatial navigation is preferred over strict tab order for gamepad. Never wrap focus between unrelated regions (e.g., Tab bar and content area should be separate navigation regions). |
-| Focus is always visible | Focus ring or equivalent focus indicator must ALWAYS be visible when an element is focused via keyboard or gamepad. Never suppress focus indicators. |
+| [Screen open / close, modal open / close, element disabled / destroyed, Tab order, D-pad spatial navigation, focus visibility] | [Rule description] |
---
@@ -926,13 +600,9 @@ Store the "return focus" element reference before pushing so it can be restored
| Platform | Input | Behavior |
|----------|-------|---------|
-| PC (keyboard) | Escape | Close top-most modal / go back one screen in stack / if at root screen (main menu), open "quit?" confirmation |
-| PC (gamepad) | B (Xbox layout) / Circle (PS layout) | Same as Escape |
-| Xbox | B button | Same as Escape |
-| PlayStation | Circle button | Same as Escape |
-| Nintendo Switch | B button | Same as Escape (NOTE: Nintendo uses B for confirm in some first-party titles — verify platform convention for this release and document the decision) |
+| [Platform] | [Input] | [Behavior] |
-**Rules**: This input must never be overridden to do something other than "go back / cancel." If a screen has no back action (e.g., the game is paused and the player must make a choice), Escape does nothing or shows a "you must choose" message — it does not navigate away. Every screen must define its Escape behavior explicitly in its UX spec.
+**Rules**: [Never override "go back / cancel"; every screen defines its Escape behavior explicitly in its UX spec]
---
@@ -947,12 +617,9 @@ Store the "return focus" element reference before pushing so it can be restored
| Scope | Pattern | Notes |
|-------|---------|-------|
-| Full screen (initial load) | Full-screen loading screen with game art, progress bar (determinate if possible), tip text (optional). | Never use an empty black screen. Give the player something to read or look at. |
-| Full screen (level transition) | Fade to black, loading screen, fade from black to new scene. | The fade removes the pop of the previous scene disappearing. |
-| Component / inline | Spinner or skeleton placeholder replaces the loading component. Component does not shift layout when content loads. | Skeleton placeholder (grey boxes approximating content shape) is preferable to spinner for layout-heavy content — it prevents layout shift on load. |
-| Background / async | No visual indication unless operation exceeds 2 seconds. After 2 seconds, show a small spinner or toast. | Do not show loading indicators for operations that complete in under 2 seconds — the flash of an indicator is more disruptive than waiting. |
+| [Full screen (initial) / Full screen (transition) / Component inline / Background async] | [Pattern] | [Notes] |
-**Accessibility**: Loading states must announce to screen readers: "[Context] loading, please wait." Completion must announce "[Context] loaded." For full-screen loading, ensure the loading screen itself is navigable to screen readers — the tips text and any UI elements must be exposed.
+**Accessibility**: [Screen reader loading/loaded announcements; loading screens navigable]
---
@@ -961,20 +628,14 @@ Store the "return focus" element reference before pushing so it can be restored
**Category**: Feedback
**Status**: Draft
-> Empty states are consistently the least-designed parts of game UIs. They are
-> the difference between a player feeling "this is where I'll store my items"
-> and "why is nothing here? did something break?" Every empty list and grid must
-> have a designed empty state. The empty state is not an error — it is a starting
-> point.
+> Every empty list and grid must have a designed empty state. The empty state
+> is not an error — it is a starting point.
| Location | Empty State Content | Notes |
|----------|--------------------|----|
-| Inventory (no items) | Icon (subtle, large, centered). Message: "Your inventory is empty." Sub-message: "Items you find on your journey will appear here." | Do not say "No items found" — "found" implies a failed search. |
-| Quest Log (no active quests) | Icon. Message: "No active quests." Sub-message: "Talk to characters marked with [quest marker icon] to start a quest." | Give the player a clear action. |
-| Achievements (none earned) | Icon. Message: "No achievements yet." List of hint achievements: "Try [Action] to earn your first achievement." | Gamified motivation, not just emptiness. |
-| Search results (no matches) | Icon. Message: "No results for '[search term]'." Sub-message: "Try a different search or [browse all]." | Mirror the search term back at them. Give an alternative action. |
+| [Location] | [Icon + message + sub-message or action] | [Notes] |
-**Rule**: Every empty state must include an icon, a message, and either a sub-message or an action button. A blank container with no explanation is never acceptable.
+**Rule**: Every empty state must include an icon, a message, and either a sub-message or an action button.
---
@@ -985,15 +646,11 @@ Store the "return focus" element reference before pushing so it can be restored
| Error Type | Pattern | Tone |
|-----------|---------|------|
-| Input validation (form field) | Inline error message below the field. Error icon left of message. Red border on field (colorblind-safe with icon). | Neutral and specific — "Username must be 3-20 characters." Not "Invalid input." |
-| Operation failed (save error, network error) | Toast notification for non-critical failures. Modal Dialog for critical failures (save file cannot be written). | Calm and actionable — "Save failed. Check storage space." Not "FATAL ERROR." |
-| System error (crash, data corruption) | Full-screen error screen with error code, recovery options ("Restart Game," "Load last save"), and support contact. | Reassuring — acknowledge the problem, give the player agency. Never blame the player. |
-| Soft error (action cannot be performed) | Toast or inline message. | Explanatory — "Not enough gold" not "Action unavailable." |
+| [Input validation / Operation failed / System error / Soft error] | [Pattern] | [Tone guidance] |
-**Principle**: Error messages are never the player's fault. They are the game telling the player what happened and what to do next. Remove the word "invalid" from all error messages — replace with specific explanations.
+**Principle**: Error messages are never the player's fault. They tell the player what happened and what to do next.
---
-
## Animation Standards
> These timing values apply to ALL patterns in this library. When a pattern says
diff --git a/.claude/docs/templates/project-stage-report.md b/.claude/docs/templates/project-stage-report.md
index c033dd69..0aa806a6 100644
--- a/.claude/docs/templates/project-stage-report.md
+++ b/.claude/docs/templates/project-stage-report.md
@@ -70,7 +70,7 @@
### Prototypes
- **Active Prototypes**: [N] in `prototypes/`
- - ✅ [Prototype 1] — documented with README
+ - ✅ [Prototype 1] — documented with REPORT.md
- ⚠️ [Prototype 2] — no README, unclear status
- **Archived**: [N] (experiments completed)
- **Key Gaps**:
diff --git a/.claude/docs/templates/session-state.md b/.claude/docs/templates/session-state.md
new file mode 100644
index 00000000..e8a790e6
--- /dev/null
+++ b/.claude/docs/templates/session-state.md
@@ -0,0 +1,74 @@
+# Active Session State — [project or branch]
+
+<!--
+ THE CONTRACT. Read this before editing the file or any hook that consumes it.
+
+ This file has TWO regions and they are not interchangeable:
+
+ 1. The CHECKPOINT region below (STATUS + CHECKPOINT blocks) is the part
+ machines read. Hooks inject it verbatim into the context, so it is
+ BOUNDED BY CONSTRUCTION: keep it under ~25 lines. It is OVERWRITTEN on
+ every update, never appended to.
+
+ 2. Everything after `<!-- /CHECKPOINT -->` is free-form narrative for humans
+ and for a returning agent that wants detail. No hook ever injects it, so
+ it may grow — but see Rotation below.
+
+ Why the split exists: before it, `active.md` was one append-only file doing
+ both jobs. It reached 712 lines / 44 KB, and each consumer invented its own
+ slice of it — the status line parsed for a STATUS block nothing wrote,
+ pre-compact injected `head -100` (12.7 KB), and session-start previewed
+ `tail -20`, the opposite end. They disagreed because there was no contract to
+ agree on. Now every consumer reads the named region.
+
+ ROTATION. When the narrative below grows past ~200 lines, move it to
+ `production/session-logs/` and start it fresh:
+ bash .claude/scripts/rotate-session-state.sh
+ Nothing is lost — and the commit history already records most of what the
+ narrative repeats.
+-->
+
+<!-- STATUS -->
+Epic:
+Feature:
+Task:
+<!-- /STATUS -->
+
+<!-- CHECKPOINT -->
+**Updated:** [YYYY-MM-DD]
+**Branch:** `[branch]`
+**Current task:** [one line — what is actively being worked on]
+**Next step:** [one line — the very next action, concrete enough to resume cold]
+**Blocked on:** [one line, or `nothing`]
+**Files in progress:** [paths, comma-separated, or `none`]
+**Open questions:** [one line each, or `none`]
+<!-- /CHECKPOINT -->
+
+---
+
+## Notes
+
+[Free-form. Decisions and their rationale, what was tried and rejected, context
+that would be expensive to reconstruct. Not machine-read — write for the person
+or agent picking this up cold.]
+
+<!--
+ FIELD NOTES
+
+ STATUS block
+ Drives the status-line breadcrumb (`Combat System > Melee > Hitboxes`), and
+ only at Production / Polish / Release stage. All three fields are optional —
+ leave a field blank when it does not apply, and blank all three when there is
+ no active focus. Do not delete the markers themselves — `statusline.sh`
+ expects them to exist.
+
+ CHECKPOINT block
+ The recovery payload. `session-start.sh` shows it when a previous session
+ left state; `pre-compact.sh` injects it before compaction. Both read THIS
+ region and nothing else, which is what keeps the cost fixed no matter how
+ long the narrative gets.
+
+ Write it so a cold reader can resume without reading anything else. "Current
+ task: fixing the thing" is useless; "Current task: wiring modes.rigor into
+ /gate-check section 6.4" is not.
+-->
diff --git a/.claude/docs/templates/skill-test-spec.md b/.claude/docs/templates/skill-test-spec.md
deleted file mode 100644
index c39f7037..00000000
--- a/.claude/docs/templates/skill-test-spec.md
+++ /dev/null
@@ -1,96 +0,0 @@
-# Skill Test Spec: /[skill-name]
-
-## Skill Summary
-
-[One paragraph: what this skill does, when to use it, what it produces. Include
-the primary output artifact, the verdict format it uses, and which pipeline stage
-it belongs to.]
-
----
-
-## Static Assertions (Structural)
-
-Verified automatically by `/skill-test static` — no fixture needed.
-
-- [ ] Has required frontmatter fields: `name`, `description`, `argument-hint`, `user-invocable`, `allowed-tools`
-- [ ] Has ≥2 phase headings (## Phase N or numbered ## sections)
-- [ ] Contains verdict keywords: [list the ones expected, e.g., PASS, FAIL, CONCERNS]
-- [ ] Contains "May I write" collaborative protocol language (if skill writes files)
-- [ ] Has a next-step handoff at the end
-
----
-
-## Test Cases
-
-### Case 1: Happy Path — [short description]
-
-**Fixture:** [Describe the assumed project state. Which files exist? What do they
-contain? E.g., "game-concept.md exists with all 8 required sections complete.
-systems-index.md exists. All MVP GDDs are present and individually reviewed."]
-
-**Input:** `/[skill-name] [args]`
-
-**Expected behavior:**
-1. [Phase 1 action — what the skill should read or check]
-2. [Phase 2 action — what the skill should evaluate]
-3. [Phase N action — what the skill should output]
-
-**Assertions:**
-- [ ] Skill reads [specific file] before producing output
-- [ ] Output includes verdict keyword [PASS/FAIL/etc.]
-- [ ] Output lists [specific content] from the fixture
-- [ ] Skill asks for approval before writing any file
-
----
-
-### Case 2: Failure Path — [short description, e.g., "Missing required artifact"]
-
-**Fixture:** [Describe the failure state. E.g., "game-concept.md is missing.
-No files exist in design/gdd/."]
-
-**Input:** `/[skill-name] [args]`
-
-**Expected behavior:**
-1. [Phase 1: skill detects missing file]
-2. [Phase 2: skill surfaces the gap rather than assuming OK]
-3. [Output: FAIL or BLOCKED verdict with specific blocker named]
-
-**Assertions:**
-- [ ] Skill does NOT output PASS when the fixture is incomplete
-- [ ] Skill names the specific missing artifact
-- [ ] Skill suggests a remediation action (e.g., "Run /[other-skill]")
-- [ ] Skill does not create files to fill in the gap without asking
-
----
-
-### Case 3: Edge Case — [short description, e.g., "No argument provided"]
-
-**Fixture:** [State of project files for this case]
-
-**Input:** `/[skill-name]` (no argument)
-
-**Expected behavior:**
-1. [What the skill should do when invoked without arguments]
-
-**Assertions:**
-- [ ] [assertion]
-
----
-
-## Protocol Compliance
-
-- [ ] Uses "May I write" before all file writes
-- [ ] Presents findings or report before asking for write approval
-- [ ] Ends with a recommended next step or follow-up skill
-- [ ] Never auto-creates files without explicit user approval
-- [ ] Does not skip phases or jump straight to a verdict without checking
-
----
-
-## Coverage Notes
-
-[Document what is intentionally NOT tested in this spec and why. Examples:
-- "Case 3 (all-mode) is not covered because it runs too many checks to evaluate
- in a single spec — test each sub-mode individually."
-- "The database integration path is not covered as it requires a live environment."
-- "Edge cases involving corrupted YAML files are deferred to a future spec."]
diff --git a/.claude/docs/templates/test-evidence.md b/.claude/docs/templates/test-evidence.md
index b9b52da9..7d76d872 100644
--- a/.claude/docs/templates/test-evidence.md
+++ b/.claude/docs/templates/test-evidence.md
@@ -32,6 +32,10 @@ the acceptance criteria numbers from the story that this evidence covers.]
List all captured evidence below. Store files in the same directory as this
document or in `production/qa/evidence/[story-slug]/`.
+**The file must actually be on disk.** Visual/Feel and UI gates are BLOCKING by
+default, and `/story-done` and `/test-evidence-review` glob for the image — a
+filename listed here with no file beside it does not satisfy the gate.
+
| # | Filename | What It Shows | Acceptance Criterion |
|---|----------|--------------|----------------------|
| 1 | `[filename.png]` | [brief description of what is visible] | AC-1 |
diff --git a/.claude/docs/templates/ux-spec.md b/.claude/docs/templates/ux-spec.md
index 4a0c8505..01561616 100644
--- a/.claude/docs/templates/ux-spec.md
+++ b/.claude/docs/templates/ux-spec.md
@@ -1,5 +1,7 @@
# UX Specification: [Screen / Flow Name]
+> Authoring guidance: .claude/docs/templates/guidance/ux-spec-guide.md (load per-section as you author — do not read entirely).
+
> **Status**: Draft | In Review | Approved | Implemented
> **Author**: [Name or agent — e.g., ui-designer]
> **Last Updated**: [Date]
@@ -20,76 +22,39 @@
## 1. Purpose & Player Need
-> **Why this section exists**: Every screen must justify its existence from the
-> player's perspective. Screens that are designed from a developer perspective ("display
-> the save data") produce cluttered, confusing interfaces. Screens designed from the
-> player's perspective ("let the player feel confident their progress is safe before they
-> put the controller down") produce purposeful, calm interfaces. Write this section before
-> touching any layout decisions — it is the filter through which every subsequent choice
-> is evaluated.
-
**What player need does this screen serve?**
-[One paragraph. Name the real human need, not the system function. Consider: what would
-a player say they want when they open this screen? What would frustrate them if it did
-not work? That frustration describes the need.
-
-Example — bad: "Displays the player's current items and equipment."
-Example — good: "Lets the player understand what they're carrying and quickly decide what
-to take into the next encounter, without breaking their mental model of the game world.
-The inventory is the player's planning tool between moments of action."]
+[One paragraph — the real human need from the player's perspective, not the system function. See guide Section 1 for good/bad examples.]
**The player goal** (what the player wants to accomplish):
-[One sentence. Specific enough that you could write an acceptance criterion for it.
-Example: "Find the item they are looking for within three button presses and equip it
-without navigating to a separate screen."]
+[One sentence, specific enough to write an acceptance criterion for.]
**The game goal** (what the game needs to communicate or capture):
-[One sentence. This is what the system needs from this interaction. Example: "Record the
-player's equipment choices and relay them to the combat system before the next encounter
-loads." This section prevents UI that looks good but fails to serve the system it is
-part of.]
+[One sentence — what the system needs from this interaction.]
---
## 2. Player Context on Arrival
-> **Why this section exists**: Screens do not exist in isolation. A player opening the
-> inventory mid-combat is in a completely different cognitive and emotional state than
-> a player opening it after clearing a dungeon. The same information architecture can
-> feel oppressively complex in one context and trivially simple in another. Document the
-> context so that design decisions — what to show first, what to hide, what to animate,
-> what to simplify — are calibrated to the actual player arriving at this screen, not
-> an abstract user.
-
| Question | Answer |
|----------|--------|
-| What was the player just doing? | [e.g., Completed a combat encounter / Pressed Esc from exploration / Triggered a story cutscene] |
-| What is their emotional state? | [e.g., High tension — just narrowly survived / Calm — exploring between objectives] |
-| What cognitive load are they carrying? | [e.g., High — actively tracking enemy positions / Low — no active threats] |
-| What information do they already have? | [e.g., They know they just picked up an item but haven't seen its stats yet] |
-| What are they most likely trying to do? | [e.g., Check if the new item is better than their current weapon — primary use case] |
-| What are they likely afraid of? | [e.g., Missing something, making an irreversible mistake, losing track of where they were] |
+| What was the player just doing? | [Prior activity / triggering state] |
+| What is their emotional state? | [Tension / calm / urgency] |
+| What cognitive load are they carrying? | [High / low + what they are tracking] |
+| What information do they already have? | [Known context on arrival] |
+| What are they most likely trying to do? | [Primary use case] |
+| What are they likely afraid of? | [Risks and anxieties to design against] |
**Emotional design target for this screen**:
-[One sentence describing the feeling the player should have while using this screen.
-Example: "Confident and in control — the player should feel like they have complete
-information and complete authority over their choices, with no ambiguity about outcomes."]
+[One sentence describing the feeling the player should have while using this screen.]
---
## 3. Navigation Position
-> **Why this section exists**: A screen that does not know where it sits in the
-> navigation hierarchy cannot define its entry/exit transitions, its back-button
-> behavior, or its relationship to the game's pause state. Navigation position also
-> reveals architectural problems early — if this screen is reachable from eight
-> different places, that is a complexity flag that should be resolved in design, not
-> implementation.
-
**Screen hierarchy** (use indentation to show parent-child relationships):
```
@@ -110,51 +75,31 @@ information and complete authority over their choices, with no ambiguity about o
| Entry Point | Triggered By | Notes |
|-------------|-------------|-------|
-| [e.g., Main Menu → Play] | [Player selects "New Game"] | [Primary entry point] |
-| [e.g., Pause Menu → Resume] | [Player presses Start from any gameplay state] | [Secondary entry] |
-| [e.g., Game event] | [Tutorial system forces open first time only] | [Systemic entry — must not break if player dismisses] |
+| [Entry point] | [Trigger] | [Notes] |
---
## 4. Entry & Exit Points
-> **Why this section exists**: Entry and exit define the screen's contract with the
-> rest of the navigation system. Every entry point must have a corresponding exit point.
-> Transitions that are undefined become bugs — the player finds themselves stuck, or the
-> game state becomes inconsistent. Fill this table completely before implementation
-> begins. Empty cells are a sign that design work is unfinished.
+> Every entry point must have a corresponding exit point. Empty cells are a sign
+> that design work is unfinished. See guide Section 4 for worked examples.
**Entry table**:
| Trigger | Source Screen / State | Transition Type | Data Passed In | Notes |
|---------|----------------------|-----------------|----------------|-------|
-| [e.g., Player presses Inventory button] | [Gameplay / Exploration state] | [Overlay push — game pauses] | [Current player loadout, inventory contents] | [Works from any non-combat state] |
-| [e.g., Item pickup prompt accepted] | [Gameplay / Item Pickup dialog] | [Replace dialog with full inventory] | [Newly acquired item pre-highlighted] | [The new item should be visually distinguished on open] |
-| [e.g., Quest system directs player to inventory] | [Gameplay / Quest Update notification] | [Overlay push] | [Quest-relevant item ID for highlight] | [Screen should deep-link to the relevant item] |
+| [Trigger] | [Source] | [Transition] | [Data in] | [Notes] |
**Exit table**:
| Exit Action | Destination | Transition Type | Data Returned / Saved | Notes |
|-------------|------------|-----------------|----------------------|-------|
-| [e.g., Player closes inventory (Back/B/Esc)] | [Previous state — Exploration] | [Overlay pop — game resumes] | [Updated equipment loadout committed] | [Changes must be committed before transition begins] |
-| [e.g., Player selects "Equip" on item] | [Same screen, updated state] | [In-place state change] | [Loadout change event fired] | [No navigation, just a state refresh] |
-| [e.g., Player navigates to Map from inventory shortcut] | [Map Screen] | [Replace] | [No data] | [Inventory state is preserved if player returns] |
+| [Exit action] | [Destination] | [Transition] | [Data out / committed] | [Notes] |
---
## 5. Layout Specification
-> **Why this section exists**: The layout specification is the handoff artifact between
-> UX design and UI programming. It does not need to be pixel-perfect — it needs to
-> communicate hierarchy (what is important), proximity (what belongs together), and
-> proportion (what is big vs. small). ASCII wireframes achieve this without requiring
-> design software. A programmer who reads this section should be able to build the
-> correct structure without guessing. An artist who reads it should know where
-> visual weight should be concentrated.
->
-> Draw the layout at one standard resolution (e.g., 1920x1080). Note adaptations
-> for other resolutions separately.
-
### 5.1 Wireframe
```
@@ -166,37 +111,14 @@ information and complete authority over their choices, with no ambiguity about o
... for scrollable content
● for the focused element on open
-Example:
-┌──────────────────────────────────────────────┐
-│ [← Back] INVENTORY [Options] │ ← HEADER ZONE
-├──────────────────────────────────────────────┤
-│ ┌──────────────┐ ┌─────────────────────────┐│
-│ │ CATEGORY NAV │ │ ITEM DETAIL PANEL ││ ← CONTENT ZONE
-│ │ ● Weapons │ │ Item Name ││
-│ │ Armor │ │ {item icon} ││
-│ │ Consumable│ │ Stats comparison ││
-│ │ Key Items │ │ Description text... ││
-│ ├──────────────┤ └─────────────────────────┘│
-│ │ ITEM GRID │ │
-│ │ {□}{□}{□}{□} │ │
-│ │ {□}{□}{□}{□} │ │
-│ │ ... │ │
-│ └──────────────┘ │
-├──────────────────────────────────────────────┤
-│ [Equip] [Drop] [Compare] [Close] │ ← ACTION BAR
-└──────────────────────────────────────────────┘
-]
+See guide Section 5 for a completed example wireframe.]
```
### 5.2 Zone Definitions
| Zone Name | Description | Approximate Size | Scrollable? | Overflow Behavior |
|-----------|-------------|-----------------|-------------|-------------------|
-| [e.g., Header Zone] | [Top bar: navigation, screen title, global actions] | [Full width, ~10% height] | [No] | [Truncate long screen names with ellipsis] |
-| [e.g., Category Nav] | [Left panel: item category tabs] | [~25% width, ~75% height] | [Yes — vertical if categories exceed panel] | [Scroll indicator appears at bottom of list] |
-| [e.g., Item Grid] | [Center: grid of item icons for selected category] | [~45% width, ~75% height] | [Yes — vertical] | [Page-based: 4x4 grid, next page on overflow] |
-| [e.g., Detail Panel] | [Right: stats and description for selected item] | [~30% width, ~75% height] | [Yes — vertical for long descriptions] | [Fade at bottom, scroll to reveal] |
-| [e.g., Action Bar] | [Bottom: context-sensitive actions for selected item] | [Full width, ~15% height] | [No] | [Actions collapse to icon-only below 4] |
+| [Zone] | [Contents and purpose] | [% width x % height] | [Yes/No] | [Overflow handling] |
### 5.3 Component Inventory
@@ -205,96 +127,58 @@ Example:
| Component Name | Type | Zone | Purpose | Required? | Reuses Existing Component? |
|----------------|------|------|---------|-----------|---------------------------|
-| [e.g., Back Button] | [Button] | [Header] | [Returns to previous screen] | [Yes] | [Yes — standard NavButton component] |
-| [e.g., Screen Title Label] | [Text] | [Header] | [Displays "INVENTORY" or context name] | [Yes] | [Yes — ScreenTitle component] |
-| [e.g., Category Tab] | [Toggle Button] | [Category Nav] | [Filters item grid by category] | [Yes] | [No — new component needed] |
-| [e.g., Item Slot] | [Icon + Frame] | [Item Grid] | [Represents one inventory slot, empty or filled] | [Yes] | [No — new component] |
-| [e.g., Item Name Label] | [Text] | [Detail Panel] | [Shows selected item's name] | [Yes] | [Yes — BodyText component] |
-| [e.g., Stat Comparison Row] | [Compound — label + value + delta] | [Detail Panel] | [Shows stat value vs. currently equipped] | [Yes] | [No — new component] |
-| [e.g., Equip Button] | [Primary Button] | [Action Bar] | [Equips selected item in appropriate slot] | [Yes] | [Yes — PrimaryAction component] |
-| [e.g., Empty State Message] | [Text + Icon] | [Item Grid] | [Shown when category has no items] | [Yes] | [Yes — EmptyState component] |
+| [Component] | [Type] | [Zone] | [Purpose] | [Yes/No] | [Yes — pattern/component name, or No — new] |
-**Primary focus element on open**: [e.g., The first item in the Item Grid — or, if deep-linked, the highlighted item. If the grid is empty, focus lands on the first Category Tab.]
+**Primary focus element on open**: [Element that receives focus when the screen opens, including deep-link and empty-state cases]
---
## 6. States & Variants
-> **Why this section exists**: A screen is not a single picture — it is a set of
-> states, each of which must look correct and behave correctly. Screens that are
-> designed only in their "happy path" state ship with broken empty states, invisible
-> loading indicators, and crashes when data is missing. Document every state before
-> implementation. The states table is also the test matrix for QA.
+> Document every state before implementation — at minimum: loading, empty,
+> populated, and error. The states table is also the test matrix for QA.
+> See guide Section 6 for a worked example.
| State Name | Trigger | What Changes Visually | What Changes Behaviorally | Notes |
|------------|---------|----------------------|--------------------------|-------|
-| [Loading] | [Screen is opening, data not yet available] | [Item Grid shows skeleton/shimmer placeholders; Action Bar buttons disabled] | [No interactions possible except Close] | [Should not be visible >500ms under normal conditions; if it is, investigate data fetch performance] |
-| [Empty — no items in category] | [Player switches to a category with zero items] | [Item Grid replaced by EmptyState component: icon + "Nothing here yet."] | [Action Bar shows no item actions; Drop/Equip/Compare all hidden] | [Do not show disabled buttons — remove them. Disabled buttons with no tooltip are confusing.] |
-| [Populated — items present] | [Category has at least one item] | [Item Grid fills with item slots; first slot is auto-focused] | [All item actions available for selected item] | [Default and most common state] |
-| [Item Selected] | [Player navigates to an item slot] | [Detail Panel populates; selected slot has focus ring; Action Bar updates to item's valid actions] | [Equip/Drop/Compare enabled based on item type] | [Equip is disabled if item is already equipped — show a "Equipped" badge instead] |
-| [Confirmation Pending — Drop] | [Player selects Drop action] | [Confirmation dialog overlays the screen] | [All background interactions suspended until dialog resolves] | [Use a modal confirmation, not an inline toggle. Items cannot be recovered after dropping.] |
-| [Error — data load failed] | [Inventory data could not be retrieved] | [Item Grid shows error state: icon + "Couldn't load items." + Retry button] | [Only Retry and Close are available] | [Log the error; do not expose technical details to player] |
-| [Item Newly Acquired] | [Screen opened from item pickup deep-link] | [Newly acquired item has a visual "New" badge; Detail Panel pre-populated with that item] | [Same as Item Selected but with badge until player navigates away] | [Badge persists until the player manually navigates off that slot once] |
+| [Loading / Empty / Populated / Selected / Confirmation / Error / other] | [Trigger] | [Visual changes] | [Behavioral changes] | [Notes] |
---
## 7. Interaction Map
-> **Why this section exists**: This section is the source of truth for what every
-> input does on this screen. It forces the designer to think through every input
-> method (mouse, keyboard, gamepad, touch) and every interactive state (hover, focus,
-> pressed, disabled). Gaps in this table are bugs waiting to happen. The
-> interaction map is also the input for the accessibility audit — if an action is
-> only reachable by mouse, it will fail the keyboard and gamepad columns.
+> Cover every input method for the platform target (mouse, keyboard, gamepad,
+> touch). Gaps in this table are bugs waiting to happen. See guide Section 7.
### 7.1 Navigation Inputs
| Input | Platform | Action | Visual Response | Audio Cue | Notes |
|-------|----------|--------|-----------------|-----------|-------|
-| [Arrow keys / D-Pad] | [All] | [Move focus within active zone] | [Focus ring moves to adjacent element] | [Soft navigation tick] | [Wrap at edges within zone; do not cross zones with arrows alone] |
-| [Tab / R1] | [KB / Gamepad] | [Move focus to next zone (Category → Grid → Detail → Action Bar)] | [Focus ring jumps to first element in next zone] | [Distinct zone-change tone] | [Shift+Tab / L1 goes backward] |
-| [Mouse hover] | [PC] | [Show hover state on interactive elements] | [Highlight / underline / color shift] | [None] | [Hover does NOT move focus — only click does] |
-| [Mouse click] | [PC] | [Select and focus the clicked element] | [Pressed state flash, then selected/focused] | [Soft click] | [Right-click opens context menu if applicable; otherwise no-op] |
-| [Touch tap] | [Mobile] | [Select and activate in one gesture] | [Press ripple] | [Soft click] | [Treat tap as click + confirm for low-risk actions; require explicit confirm for destructive actions] |
+| [Input] | [Platform] | [Action] | [Visual response] | [Audio] | [Notes] |
### 7.2 Action Inputs
| Input | Platform | Context (What must be focused) | Action | Response | Animation | Audio Cue | Notes |
|-------|----------|-------------------------------|--------|----------|-----------|-----------|-------|
-| [Enter / A button / Left click] | [All] | [Item slot focused] | [Select item → populate Detail Panel] | [Detail panel slides in or updates in place] | [Panel fade/slide in, 120ms] | [Soft select tone] | [If item already selected: no-op] |
-| [Enter / A button] | [All] | [Equip button focused] | [Equip selected item] | [Button animates press; item badge updates to "Equipped"; previously equipped item loses badge] | [Badge swap, 80ms] | [Equip success sound] | [Fires EquipItem event to Inventory system] |
-| [Triangle / Y button / Right-click] | [All] | [Item slot focused] | [Open item context menu] | [Context menu appears adjacent to item slot] | [Popover, 80ms] | [Menu open sound] | [Context menu contains: Equip, Drop, Inspect, Compare] |
-| [Square / X button] | [Gamepad] | [Item slot focused] | [Quick-equip without opening detail] | [Equip animation plays inline on slot] | [Slot flash, 80ms] | [Equip success sound] | [Convenience shortcut; does not change screen state] |
-| [Esc / B button / Back] | [All] | [Any, screen level] | [Close screen and return to previous state] | [Screen exit transition plays] | [Slide out, 200ms] | [Back/close tone] | [Commits all changes before closing. No discard — inventory is not a draft.] |
-| [F / L2] | [KB / Gamepad] | [Any] | [Toggle filter panel] | [Sort/filter overlay opens] | [Slide in from right, 200ms] | [Panel open tone] | [If no items in category, filter is disabled] |
+| [Input] | [Platform] | [Focus context] | [Action] | [Response] | [Animation + timing] | [Audio] | [Notes] |
### 7.3 State-Specific Behaviors
| State | Input Restriction | Reason |
|-------|------------------|--------|
-| [Loading] | [All item and action inputs disabled] | [No data to act on; prevent race conditions] |
-| [Confirmation dialog open] | [Only Confirm and Cancel inputs active] | [Modal — background is locked] |
-| [Error state] | [Only Retry and Close active] | [No data available to navigate] |
+| [State] | [Which inputs are disabled] | [Why] |
---
## 8. Data Requirements
-> **Why this section exists**: The separation between UI and game state is the most
-> important architectural boundary in a game's UI system. UI reads data; it does not
-> own it. UI fires events; it does not write state directly. This section defines
-> exactly what data this screen needs to display, where it comes from, and how
-> frequently it updates. Filling this table before implementation prevents two
-> common failure modes: (1) UI developers reaching into systems they should not touch,
-> and (2) systems not knowing they need to expose data until a UI is half-built.
+> UI reads data; it does not own it. UI fires events; it does not write state
+> directly. Every displayed data element needs a source system and owner.
+> See guide Section 8 for a worked example.
| Data Element | Source System | Update Frequency | Who Owns It | Format | Null / Missing Handling |
|--------------|--------------|-----------------|-------------|--------|------------------------|
-| [e.g., Item list] | [Inventory System] | [On screen open; on InventoryChanged event] | [InventorySystem] | [Array of ItemData structs: id, name, icon_path, category, stats, is_equipped] | [Empty array → show Empty State. Never null — system must return array.] |
-| [e.g., Equipped loadout] | [Equipment System] | [On screen open; on EquipmentChanged event] | [EquipmentSystem] | [Dict mapping slot_id → item_id] | [Unequipped slot has null value — UI shows empty slot icon] |
-| [e.g., Item stat comparisons] | [Stats System] | [On item selection change] | [StatsSystem] | [Dict mapping stat_name → {current, new, delta}] | [If no item selected, detail panel shows placeholder. Stats system must handle this gracefully.] |
-| [e.g., Player currency] | [Economy System] | [On screen open only — inventory does not show live currency] | [EconomySystem] | [Int — gold pieces] | [If currency system not active for this game mode, hide the currency row entirely] |
-| [e.g., Newly acquired item flag] | [Inventory System] | [On screen open] | [InventorySystem] | [Array of item_ids flagged as new] | [If empty array, no badges shown] |
+| [Data element] | [System] | [When it updates — specific trigger, not "realtime"] | [Owning system — never the UI] | [Type/shape] | [What shows when data is unavailable] |
> **Rule**: This screen must never write directly to any system listed above. All
> player actions fire events (see Section 9). Systems update their own data and
@@ -304,52 +188,30 @@ Example:
## 9. Events Fired
-> **Why this section exists**: This is the other half of the UI/system boundary.
-> Where Section 8 defines what the UI reads, this section defines what the UI
-> communicates back to the game. Specifying events at design time prevents UI
-> programmers from writing game logic, and prevents game programmers from being
-> surprised by what the UI does. Every destructive or state-changing player action
-> must appear in this table.
+> Every destructive or state-changing player action must appear in this table.
+> See guide Section 9 for a worked example.
| Player Action | Event Fired | Payload | Receiver System | Notes |
|---------------|-------------|---------|-----------------|-------|
-| [Player equips an item] | [EquipItemRequested] | [{item_id: string, target_slot: string}] | [Equipment System] | [Equipment System validates the action and fires EquipmentChanged if successful; UI listens for EquipmentChanged to update its display] |
-| [Player drops an item] | [DropItemRequested] | [{item_id: string, quantity: int}] | [Inventory System] | [Fires only after player confirms the drop dialog. Inventory System removes the item and fires InventoryChanged.] |
-| [Player opens item compare] | [ItemCompareOpened] | [{item_a_id: string, item_b_id: string}] | [Analytics System] | [No game-state change — analytics event only. Compare view is purely local UI state.] |
-| [Player closes screen] | [InventoryScreenClosed] | [{session_duration_ms: int}] | [Analytics System] | [Fires on every close regardless of reason. Used for engagement metrics.] |
-| [Player navigates between categories] | [InventoryCategoryChanged] | [{category: string}] | [Analytics System] | [Analytics only. No game state change.] |
+| [Action] | [EventName] | [{fields}] | [System] | [Validation/response flow, or "analytics only"] |
---
## 10. Transition & Animation
-> **Why this section exists**: Transitions are not decoration — they communicate
-> hierarchy and causality. A screen that slides in from the right implies the
-> player has moved forward. A screen that fades implies a context break. Inconsistent
-> transitions make navigation feel broken even when it is technically correct.
-> This section ensures transitions are specified intentionally, not left to the
-> developer's discretion, and that accessibility settings (reduced motion) are
-> planned for from the start.
+> Specify at least the screen enter and exit transitions, plus reduced-motion
+> behavior for each. See guide Section 10 for a worked example.
| Transition | Trigger | Direction / Type | Duration (ms) | Easing | Interruptible? | Skipped by Reduced Motion? |
|------------|---------|-----------------|--------------|--------|----------------|---------------------------|
-| [Screen enter] | [Screen pushed onto stack] | [Slide in from right] | [250] | [Ease out cubic] | [No — must complete before interaction is enabled] | [Yes — instant appear at 0ms] |
-| [Screen exit — Back] | [Player presses Back] | [Slide out to right] | [200] | [Ease in cubic] | [No] | [Yes — instant disappear] |
-| [Screen exit — Forward] | [Player navigates to child screen] | [Slide out to left] | [200] | [Ease in cubic] | [No] | [Yes — instant] |
-| [Detail panel update] | [Player selects a new item] | [Cross-fade content] | [120] | [Linear] | [Yes — if player navigates quickly, previous animation cancels] | [Yes — instant swap] |
-| [Loading → Populated] | [Data arrives after load] | [Skeleton shimmer fades out, content fades in] | [180] | [Ease out] | [No] | [Yes — instant reveal] |
-| [Action Bar button press] | [Player activates a button] | [Scale down 95% on press, return on release] | [60 down / 60 up] | [Ease out / ease in] | [Yes — if released early, returns to normal] | [No — this is tactile feedback, not decorative motion] |
-| [Confirmation dialog open] | [Player initiates destructive action] | [Background dims 60% opacity; dialog scales up from 95%] | [150] | [Ease out] | [No] | [Yes — instant appear, no scale] |
-| [New item badge appear] | [Screen opens with newly acquired item] | [Badge pops from 0% to 110% to 100% scale] | [200 total] | [Ease out back] | [No] | [Yes — instant appear at 100% scale] |
+| [Screen enter / exit / in-screen transition] | [Trigger] | [Type] | [ms] | [Easing] | [Yes/No] | [Yes/No + fallback] |
---
## 11. Input Method Completeness Checklist
-> **Why this section exists**: Input completeness is not optional — it is a
-> certification requirement for console platforms and a legal risk area for
-> accessibility laws in multiple markets. Fill this checklist before marking
-> the spec as Approved. Any unchecked item blocks implementation start.
+> Fill this checklist before marking the spec as Approved. Any unchecked item
+> blocks implementation start.
**Keyboard**
- [ ] All interactive elements are reachable using Tab and arrow keys alone
@@ -382,11 +244,9 @@ Example:
## 12. Screen-Level Accessibility Requirements
-> **Why this section exists**: Accessibility requirements must be specified at design
-> time because retrofitting them is expensive and often architecturally impractical.
-> This section documents requirements specific to this screen. Project-wide standards
-> live in `docs/accessibility-requirements.md` — consult it before filling this
-> section so you do not duplicate or contradict project-level commitments.
+> Project-wide standards live in `design/accessibility-requirements.md` — consult it
+> before filling this section so you do not duplicate or contradict project-level
+> commitments.
>
> Accessibility Tiers in this project:
> - Basic: WCAG 2.1 AA text contrast, keyboard navigable, no motion-only information
@@ -398,71 +258,32 @@ Example:
| Text Element | Background Context | Required Ratio | Current Ratio | Pass? |
|--------------|-------------------|---------------|---------------|-------|
-| [e.g., Item name in Detail Panel] | [Dark panel background ~#1a1a1a] | [4.5:1 (WCAG AA normal text)] | [TBD — verify in implementation] | [ ] |
-| [e.g., Category tab label — inactive] | [Mid-grey tab background] | [4.5:1] | [TBD] | [ ] |
-| [e.g., Category tab label — active] | [Accent color background] | [4.5:1] | [TBD] | [ ] |
-| [e.g., Action button label] | [Button color (varies by state)] | [4.5:1] | [TBD] | [ ] |
-| [e.g., Stat comparison delta (positive)] | [Detail panel] | [4.5:1 — do NOT rely on green color alone] | [TBD] | [ ] |
+| [Text element] | [Background] | [Ratio — 4.5:1 WCAG AA baseline] | [TBD] | [ ] |
**Colorblind-unsafe elements and mitigations**:
| Element | Colorblind Risk | Mitigation |
|---------|----------------|------------|
-| [e.g., Stat delta indicators (red/green for worse/better)] | [Red-green colorblindness (Deuteranopia) — most common form] | [Add arrow icons (↑ / ↓) and +/- prefix in addition to color. Color is a redundant, not sole, indicator.] |
-| [e.g., Item rarity color coding (grey/green/blue/purple/orange)] | [Multiple types — rarity color is a common industry failure] | [Add rarity name text label below icon. Color is supplemental only.] |
+| [Element] | [Risk type] | [Non-color redundant indicator] |
**Focus order** (Tab key sequence, numbered):
-[e.g.,
-1. Back button (Header)
-2. Options button (Header)
-3. Category Tab 1 — Weapons
-4. Category Tab 2 — Armor
-5. Category Tab 3 — Consumables
-6. Category Tab 4 — Key Items
-7. Item Slot [0,0]
-8. Item Slot [0,1] ... (grid traverses left-to-right, top-to-bottom)
-9. Last item slot
-10. Equip button (Action Bar)
-11. Drop button (Action Bar)
-12. Compare button (Action Bar)
-13. Close button (Action Bar)
-→ Cycles back to Back button
-
-Focus does not enter the Detail Panel — it is a display panel driven by item focus, not independently navigable.]
+[Numbered focus sequence covering every interactive element, including cycle behavior and any panels focus does not enter — see guide Section 12 for an example]
**Screen reader announcements for key state changes**:
| State Change | Announcement Text | Announcement Timing |
|--------------|------------------|---------------------|
-| [Screen opens] | ["Inventory screen. [N] items. [Active category] selected."] | [On screen focus settle] |
-| [Player focuses an item slot] | ["[Item name]. [Category]. [Rarity]. [Key stats summary]. [Equipped / Not equipped]."] | [On focus arrival] |
-| [Player equips an item] | ["[Item name] equipped to [slot name]."] | [After EquipmentChanged event confirmed] |
-| [Player drops an item] | ["[Item name] dropped."] | [After InventoryChanged event confirmed] |
-| [Category changes] | ["[Category name]. [N] items."] | [On category tab focus] |
-| [Empty state shown] | ["No items in [category name]."] | [When empty state renders] |
+| [State change] | ["Announcement"] | [When it fires] |
**Cognitive load assessment**:
-[Estimate the number of information streams the player is simultaneously tracking while
-using this screen. For this screen: (1) item grid position, (2) item detail stats,
-(3) current equipment loadout for comparison, (4) available actions, (5) item category.
-That is 5 concurrent streams — within the standard 7±2 limit, but at the higher end.
-Mitigation: detail panel auto-updates on navigation so the player never needs to
-manually retrieve item info. Reduce active decisions by surfacing stat comparison
-automatically.]
+[Count the concurrent information streams the player tracks on this screen; compare against the 7±2 limit and state mitigations — see guide Section 12 for an example]
---
## 13. Localization Considerations
-> **Why this section exists**: UI built without localization in mind breaks on first
-> translation. German text is typically 30–40% longer than English. Arabic and Hebrew
-> require right-to-left layout mirroring. Japanese and Chinese text may be significantly
-> shorter than English, creating awkward whitespace. These issues are cheap to plan for
-> and expensive to fix after a layout is built and shipped. Every text element should
-> have an explicit max-character count and a plan for overflow.
-
**General rules for this screen**:
- All text elements must tolerate a minimum of 40% expansion from English baseline
- RTL layout (Arabic, Hebrew): mirrored layout required — document which elements mirror and which do not
@@ -471,27 +292,19 @@ automatically.]
| Text Element | English Baseline Length | Max Characters | Expansion Budget | RTL Behavior | Overflow Behavior | Risk |
|--------------|------------------------|----------------|-----------------|--------------|-------------------|------|
-| [e.g., Screen title "INVENTORY"] | [9 chars] | [16 chars] | [78%] | [Mirror to right, or center — acceptable] | [Truncate with ellipsis — title is not critical content] | [Low] |
-| [e.g., Item name] | [~15 chars avg, max ~35 "Enchanted Dragon Scale Gauntlets"] | [50 chars] | [43%] | [Right-align in RTL layouts] | [Truncate with tooltip showing full name on hover/focus] | [Medium — long fantasy item names are common] |
-| [e.g., Item description] | [~80–120 chars] | [200 chars] | [67%] | [Right-align, wrap normally] | [Scroll within Detail Panel — no truncation] | [Low — panel is scrollable] |
-| [e.g., Action button "Equip"] | [5 chars] | [14 chars] | [180%] | [Button layout mirrors; text right-aligns] | [Shrink font to 90% minimum, then truncate] | [Medium — "Ausrüsten" in German is 9 chars] |
-| [e.g., Category tab "Consumables"] | [11 chars] | [18 chars] | [64%] | [Mirror tab position] | [Abbreviate: "Consum." — define abbreviations per language in loc file] | [High — long localized tab labels are a known problem] |
+| [Text element] | [chars] | [max chars] | [%] | [Mirror/align behavior] | [Truncate/scroll/shrink strategy] | [Low/Medium/High] |
---
## 14. Acceptance Criteria
-> **Why this section exists**: Acceptance criteria are the contractual definition of
-> "done." Without them, implementation is complete when the developer says it is.
-> With them, implementation is complete when a QA tester can verify every item on
-> this list. Write criteria that a tester can verify independently, without asking the
-> designer what they meant. Every criterion should be binary — pass or fail, not
-> subjective.
+> Write criteria a QA tester can verify independently, without asking the designer
+> what they meant. Every criterion should be binary — pass or fail, not subjective.
**Performance**
-- [ ] Screen opens (first frame visible) within 200ms of trigger on minimum-spec hardware
-- [ ] Screen is fully interactive (all data loaded) within 500ms of trigger on minimum-spec hardware
-- [ ] Navigation between items produces no perceptible frame drop (maintain target framerate ±5fps)
+- [ ] Screen opens (first frame visible) within [200]ms of trigger on minimum-spec hardware
+- [ ] Screen is fully interactive (all data loaded) within [500]ms of trigger on minimum-spec hardware
+- [ ] Navigation between elements produces no perceptible frame drop (maintain target framerate ±5fps)
**Layout & Rendering**
- [ ] Screen displays correctly (no overlap, no cutoff, no overflow) at minimum supported resolution [specify]
@@ -499,8 +312,8 @@ automatically.]
- [ ] Screen displays correctly at 4:3, 16:9, 16:10, and 21:9 aspect ratios if targeting PC
- [ ] No text overflow or truncation in English within defined max-character bounds
- [ ] No text overflow or truncation in the longest-translation language [specify — typically German]
-- [ ] All states (Loading, Empty, Populated, Error, Confirmation) render correctly
-- [ ] Item grid scrolls smoothly without frame drops when all item slots are populated
+- [ ] All states documented in Section 6 render correctly
+- [ ] Scrollable zones scroll smoothly without frame drops when fully populated
**Input**
- [ ] All interactive elements reachable by keyboard using Tab and arrow keys only
@@ -513,13 +326,13 @@ automatically.]
**Events & Data**
- [ ] All events in Section 9 fire with correct payloads on all exit paths (verify with debug logging)
- [ ] Screen does not write directly to any game system (verify: no direct state mutation calls)
-- [ ] Inventory changes persist correctly after screen is closed and reopened
-- [ ] Screen handles InventoryChanged events fired by other systems while it is open without crashing
+- [ ] Changes made on this screen persist correctly after it is closed and reopened
+- [ ] Screen handles data-change events fired by other systems while it is open without crashing
**Accessibility**
- [ ] All text passes minimum contrast ratios specified in Section 12
-- [ ] Stat comparison does not rely on color alone as the sole differentiator
-- [ ] Screen reader announces item name and key stats on focus (verify with platform screen reader)
+- [ ] No information relies on color alone as the sole differentiator
+- [ ] Screen reader announces documented state changes (verify with platform screen reader)
- [ ] Reduced motion setting results in instant transitions (no animated transitions)
- [ ] High contrast mode (if applicable to Accessibility Tier) renders without visual breakage
@@ -538,7 +351,4 @@ automatically.]
| Question | Owner | Deadline | Resolution |
|----------|-------|----------|-----------|
-| [e.g., Should item comparison be automatic (always showing equipped stats) or player-triggered (press Compare)?] | [ui-designer] | [Sprint 4, Day 3] | [Pending] |
-| [e.g., Do we support controller cursor (free aim) in the item grid, or d-pad-only grid navigation?] | [lead-programmer + ui-designer] | [Sprint 4, Day 3] | [Pending — depends on ADR-0015 input model decision] |
-| [e.g., What is the game's item drop policy — permanent loss or drop-to-world?] | [systems-designer] | [Requires GDD update] | [Blocked on inventory GDD Edge Cases section] |
-| [e.g., Maximum inventory size — does the grid have a hard cap or is it infinite-scroll?] | [economy-designer] | [Sprint 3, Day 5] | [Pending] |
+| [Add question] | [Owner] | [Deadline] | [Resolution] |
diff --git a/.claude/docs/workflow-catalog.yaml b/.claude/docs/workflow-catalog.yaml
index d1efcec7..11b2dca8 100644
--- a/.claude/docs/workflow-catalog.yaml
+++ b/.claude/docs/workflow-catalog.yaml
@@ -6,6 +6,9 @@
# pattern: text pattern that must appear in the file (checked after glob)
# min_count: minimum matching files required (default: 1)
# note: human-readable fallback when completion can't be auto-detected
+# any_of: list of alternative {glob, pattern} specs — the step is complete if
+# ANY one of them matches. Use when a setting has migrated and may
+# legitimately live in either the new or the legacy location.
#
# required: true → blocks progression to next phase (shown as REQUIRED)
# required: false → optional enhancement (shown as OPTIONAL)
@@ -31,9 +34,20 @@ phases:
name: "Engine Setup"
command: /setup-engine
required: true
+ # v1.1: engine.name in project.yaml is the primary source; technical-
+ # preferences.md is the legacy fallback. Checking only the legacy file
+ # made a correctly-configured project fail this REQUIRED gate.
artifact:
- glob: ".claude/docs/technical-preferences.md"
- pattern: "Engine: [^[]"
+ any_of:
+ - glob: "project.yaml"
+ pattern: "name:[[:space:]]*(Godot|Unity|Unreal)"
+ # technical-preferences.md writes "- **Engine**: Godot 4.6", so the
+ # pattern must clear the bold markers. The previous "Engine: [^[]"
+ # required a literal "Engine: " and therefore never matched any
+ # file /setup-engine produces. The [^[] guard rejects the
+ # "[TO BE CONFIGURED]" placeholder.
+ - glob: ".claude/docs/technical-preferences.md"
+ pattern: "\\*\\*Engine\\*\\*: [^[]"
description: "Configure engine, pin version, set naming conventions and performance budgets"
- id: game-concept
@@ -85,7 +99,7 @@ phases:
command: /design-review
required: true
repeatable: true
- description: "Validate each GDD (8 required sections, no MAJOR REVISION verdict). Run per system."
+ description: "Validate each GDD (required sections per workflow tier, no MAJOR REVISION verdict). Run per system."
- id: review-all-gdds
name: "Cross-GDD Review"
@@ -143,10 +157,16 @@ phases:
- id: accessibility-doc
name: "Accessibility Requirements"
+ # This step had no `command:` at all -- the only artifact entry in the
+ # catalog that named no producer. It was REQUIRED, so the Technical
+ # Setup -> Pre-Production gate could never pass, and the remediation
+ # every skill printed ("run /ux-design") wrote into design/ux/ where
+ # this glob does not look. /ux-design now has an `accessibility` mode.
+ command: /ux-design
required: true
artifact:
glob: "design/accessibility-requirements.md"
- description: "Commit accessibility tier (Basic/Standard/Comprehensive/Exemplary) and feature matrix. UX specs (Phase 4) reference this tier."
+ description: "Run `/ux-design accessibility`. Commit accessibility tier (Basic/Standard/Comprehensive/Exemplary) and feature matrix. UX specs (Phase 4) reference this tier."
pre-production:
label: "Pre-Production"
@@ -191,7 +211,11 @@ phases:
command: /prototype
required: false
artifact:
- glob: "prototypes/*/README.md"
+ # /prototype writes prototypes/[name]-concept/REPORT.md -- it has never
+ # written a README. The `-concept` suffix is load-bearing: /vertical-slice
+ # writes the same REPORT.md basename under `-vertical-slice`, so a bare
+ # `prototypes/*/REPORT.md` here would let either step satisfy the other.
+ glob: "prototypes/*-concept/REPORT.md"
min_count: 1
description: "Build a throwaway prototype to validate the core mechanic is fun before committing to full production. Recommended for first-time mechanics or high-risk design decisions. Solo devs with proven concepts may skip."
@@ -237,7 +261,11 @@ phases:
command: /vertical-slice
required: false
artifact:
- glob: "prototypes/*/REPORT.md"
+ # Must stay scoped to `-vertical-slice`: the untethered form matched
+ # /prototype's concept report, so running only /prototype silently
+ # marked the vertical slice complete and skipped the validation the
+ # Pre-Production → Production gate exists to require.
+ glob: "prototypes/*-vertical-slice/REPORT.md"
min_count: 1
description: "Build and playtest a vertical slice — a complete end-to-end pass through the core loop. Recommended before committing epics and stories to production. Skipping is a valid solo dev call but increases risk of late-stage design pivots. If built, must be played and documented before advancing."
@@ -355,7 +383,10 @@ phases:
command: /playtest-report
required: true
artifact:
- glob: "production/playtests/*.md"
+ # /playtest-report writes production/qa/playtests/, not production/playtests/.
+ # The old glob matched nothing on every project, so this REQUIRED step
+ # read as 0/3 forever no matter how many playtests were actually run.
+ glob: "production/qa/playtests/*.md"
min_count: 3
description: "Cover: new player experience, mid-game systems, difficulty curve"
diff --git a/.claude/docs/workflow-modes.md b/.claude/docs/workflow-modes.md
new file mode 100644
index 00000000..680ad24c
--- /dev/null
+++ b/.claude/docs/workflow-modes.md
@@ -0,0 +1,310 @@
+# Workflow Modes — Shared Skill Pattern
+
+This document defines `modes.workflow` and `workflow_overrides` — how much
+design documentation is REQUIRED before code can begin — for every skill that
+authors, reviews, gates, or plans against project artifacts. Skills reference
+this document instead of embedding the tier tables inline.
+
+**Companion spec**: `.claude/docs/effects-map.md`
+sections `modes.workflow` and `workflow_overrides` are the source of
+truth for behavior. This document is the implementation pattern.
+
+> **Do not read `effects-map.md` during a skill run.** It is ~2,150 lines
+> (~110 KB) — about five times the size of everything CLAUDE.md loads per
+> session combined — and it is a reference for *authoring and changing the
+> spec*, not a runtime input. **This document is self-sufficient** for resolving
+> the tier and applying it: the resolution chain, the three tiers, the required
+> sections, and the override rules are all here. If you hit a case this document
+> genuinely does not cover, read only the one `effects-map.md` section for the
+> knob in question — never the file.
+
+**Related shared docs**: `.claude/docs/automation-modes.md` (how skills prompt),
+`.claude/docs/director-gates.md` (which reviewers spawn). `workflow` is
+orthogonal to both — it controls *what artifacts must exist*, not *how the
+skill prompts* or *who reviews*.
+
+---
+
+## How to Use This Document
+
+A skill that authors, reviews, or gates a design artifact resolves the
+effective workflow tier at startup, then applies the required-section /
+required-artifact set for that tier.
+
+**Resolution (per skill):**
+
+```
+Resolve the workflow tier (store the result; see scope note below):
+1. If the resolution is for a named system AND
+ `workflow_overrides.system_overrides.<system>` is set → use that tier
+2. Else read `modes.workflow` from `project.yaml` → use that value
+3. Else → use the tier implied by `modes.rigor`
+ (`minimal`→`minimal`, `standard`→`standard`, `full`→`full`;
+ `rigor` itself defaults to `minimal`)
+```
+
+`modes.workflow` has **no terminal default** — step 3 is the `rigor` expansion,
+not a hardcoded `standard`. The resolved value is the same for an unconfigured
+project, so nothing observable changed; but a skill that hardcodes `standard` as
+its fallback will ignore `rigor: minimal` and `rigor: full` entirely.
+
+### What `<system>` is — one derivation, everywhere
+
+**`<system>` is the GDD filename stem**: `design/gdd/hammer-heat-system.md` →
+`hammer-heat-system`. That is the key to write under
+`workflow_overrides.system_overrides`, and every skill must derive it the same
+way.
+
+A `TR-[system]-NNN` ID's `[system]` segment is **an alias, not the key**. Accept
+it as a fallback match when the GDD stem yields nothing, but never derive the key
+from it in preference to the stem.
+
+> **Why this is stated here rather than per skill.** Reading *"the `[system]`
+> segment of its `TR-[system]-NNN` ID (else its `design/gdd/` path)"* — TR-ID
+> **first** — is the wrong order. A system whose GDD is `hammer-heat-system.md` and
+> whose requirements are `TR-heat-001` then had **two different override keys
+> depending on whether a registry entry existed**, and the documented remedy for
+> a missing GDD section — "set
+> `workflow_overrides.system_overrides.hammer-heat-system: full`" — was looked up
+> under `heat`, found nothing, and continued at the project tier **silently**.
+> The escape hatch existed and could not be reached.
+
+**A key that matches no system is an error, not a no-op.** If
+`workflow_overrides.system_overrides` contains a key that resolves to no GDD stem
+in `design/gdd/`, say so — naming the unmatched key and the stems available.
+Silently ignoring it is how the above went unnoticed.
+
+> **Checked where GDDs are expected to already exist — not by the skill that
+> writes them.** `/gate-check` is the single implementing site (see
+> `.claude/skills/gate-check/SKILL.md` §"Per-system overrides"), and it runs at a
+> phase boundary, by which point every in-scope GDD should be on disk. An
+> unmatched key there is genuinely suspicious.
+>
+> `/design-system` **creates** `design/gdd/<system>.md`, so before its first run
+> the override key matches no stem *by definition* — that is the healthy case,
+> not an error. It must not report the key as orphaned, and must not refuse to
+> apply the tier it names. The same holds for any other authoring skill running
+> before the GDD exists. Applying this rule there would fire on exactly the
+> configuration it was written to protect.
+
+---
+
+Step 1 (the per-system override) applies to skills that act on a named system:
+- **Single-system, resolve once per run**: `design-system`, `design-review`,
+ `dev-story`, `story-done`, `create-stories` (one story/epic per invocation).
+- **Multi-system, resolve once per item**: `story-readiness` (per story across
+ `all`/`sprint` scope), `qa-plan` and `regression-suite` audit (per GDD/system).
+ These do NOT freeze a single tier for the run — different systems in one run
+ may resolve to different tiers.
+
+Skills that operate project-wide (`gate-check`, `create-epics`) use the
+project-level `workflow` plus consider per-system overrides where the tier table
+says so.
+
+> **"Critical ADR" (used in the tier tables):** an ADR governing a
+> **Foundation-layer** system (scene management, event architecture, save/load,
+> and the like — the systems whose decisions everything else depends on). At
+> `standard`, only critical ADRs are required/blocking; non-critical ADRs are
+> advisory. When in doubt about an ADR's layer, treat it as critical (fail safe
+> toward requiring it).
+
+`modes.workflow` reads via **`resolve_config --keys workflow`** (or
+`resolve_setting modes.workflow`), which applies the whole chain including the
+`rigor` expansion. Do **not** use `get_effective_yaml_key modes.workflow`: it
+reads the two YAML files only, so on a project that sets `modes.rigor` and not
+`modes.workflow` it returns **empty** while the effective tier is whatever rigor
+implies. (`project.local.yaml` is not allowed to override workflow — it is locked
+to `project.yaml` per the whitelist — so the only sources are `project.yaml` and
+the expansion.) Per-system overrides read via
+`get_yaml_key project.yaml workflow_overrides.system_overrides.<system>`.
+
+---
+
+## The Three Tiers
+
+| Tier | Token/time cost | Required before code | Best for |
+|------|----------------|---------------------|----------|
+| `full` | High | All 8 GDD sections per system, full architecture, all ADRs, art bible, UX specs per screen | Teams, commercial titles, learning the full pipeline |
+| `standard` | Balanced | 5 GDD sections per system, one architecture doc, critical ADRs, game concept, systems index | Projects that outgrew a brief - several interacting systems, or a design someone else implements |
+| `minimal` | Low | One-page `design/game-brief.md` + engine choice (its build-order field is the plan — no separate sprint plan) | **Default.** Jam projects, small scope, design already in your head |
+
+**Default**: `minimal` (the rationale block above `_yaml_helper_defaults` in
+`.claude/hooks/yaml-helper.sh` carries the reasoning and the ordering
+constraint). **Set by**: `/start`, `/settings`. **Locked to
+`project.yaml`** (not locally overridable — divergence would change which
+artifacts must exist on disk).
+
+> **Permissive, not restrictive.** `workflow` controls what is REQUIRED, not
+> what is ALLOWED. Any skill can run at any tier. The setting changes what
+> `gate-check` enforces and what completeness checks validate — never what the
+> user can invoke.
+
+> **`minimal` floor.** Even at minimal, engine choice and a filled
+> **`design/game-brief.md`** are required before code starts — the brief's
+> build-order field is the plan, so there is no separate `sprint-plan` step.
+> Everything else can be skipped.
+
+> **"Game brief" is a real artifact at `minimal`: `design/game-brief.md`.**
+> `/brainstorm` writes it from the one-page template
+> (`.claude/docs/templates/game-brief.md`) when the effective tier is `minimal`,
+> in place of the full-length `design/gdd/game-concept.md` it writes at
+> `standard`/`full`. The two are distinct files for distinct tiers: any check,
+> gate, or glob for the `minimal` design artifact must target
+> **`design/game-brief.md`**; `game-concept.md` remains the `standard`/`full`
+> concept doc.
+
+---
+
+## GDD Required Sections per Tier
+
+The 8 GDD sections: Overview, Player Fantasy, Detailed Rules, Formulas,
+Edge Cases, Dependencies, Tuning Knobs, Acceptance Criteria.
+
+> **Section-name alias.** "Detailed Rules" is the canonical name in the design
+> standard, but the GDD template (`.claude/docs/templates/game-design-document.md`)
+> and `/design-system` author this section under the heading `## Detailed Design`
+> (with Core Rules / States / Interactions sub-headings). The two names denote the
+> **same required section** — any skill that detects or validates section presence
+> (`design-review`, `gate-check`, `adopt`, `project-stage-detect`) must accept
+> either heading. Do not treat "Detailed Rules" as missing when `## Detailed
+> Design` is present.
+
+| Tier | Required GDD sections |
+|------|----------------------|
+| `full` | All 8 |
+| `standard` | **5 required**: Overview, Detailed Rules, Edge Cases, Dependencies, Acceptance Criteria. **Conditional**: Formulas — required when the system **defines numeric rules** (rates, curves, thresholds, costs, damage, drop weights — anything a balance pass would tune); optional only when it defines none. The `Category` column is a hint, not the test. **Skipped**: Player Fantasy, Tuning Knobs. |
+| `minimal` | None — `design/game-brief.md` replaces GDDs. A GDD may still be authored voluntarily. |
+
+> **Edge Cases is required at `standard`** (it was promoted from optional —
+> skipping it produced "what happens if X is null?" debt during implementation).
+
+> **Art bible is conditional at `standard`** — required only if visual asset
+> stories exist in the project. Code-focused projects skip it. At `full`, all
+> 9 art bible sections are required. (`workflow_overrides.art_bible_strict:
+> true` forces all 9 regardless of tier.)
+
+---
+
+## `workflow_overrides`
+
+This key holds two mechanisms with **different directional rules**. Read the one
+you are using — conflating them is a known and easy mistake.
+
+```yaml
+workflow_overrides:
+ # --- the three boolean FLAGS: additive, stricter-only ---
+ edge_cases: false # force Edge Cases required (no-op at standard/full; relevant at minimal)
+ tuning_knobs: false # force Tuning Knobs required (relevant at standard, no-op at full)
+ art_bible_strict: false # force all 9 art bible sections regardless of asset stories
+
+ # --- system_overrides: replaces a tier, BOTH directions ---
+ system_overrides: {} # per-system tier overrides (see below)
+```
+
+**The three boolean flags are additive on top of the chosen `workflow` level —
+they make requirements STRICTER, never looser.** Each one only ever forces a
+requirement *on*; setting a flag cannot opt out of a requirement the tier
+imposes. There is no value of `edge_cases`, `tuning_knobs` or `art_bible_strict`
+that removes anything.
+
+**`system_overrides` is not a flag and is not additive.** It *replaces* the
+effective tier for one named system, in **either** direction — see the next
+section. A loosening override genuinely loosens: on a `full` project,
+`system_overrides.inventory: minimal` drops that system's required sections to
+zero. That is the intended design (it is what makes "one trivial system inside a
+serious project" expressible), but it means an override is **not** a safe
+no-op — do not leave one in place assuming the stricter-only rule protects you.
+
+### Per-system overrides
+
+```yaml
+workflow_overrides:
+ system_overrides:
+ combat: full # combat GDD requires all 8 sections regardless of project workflow
+ inventory: minimal # inventory needs no GDD — the game brief covers it (minimal = no required sections)
+```
+
+`system_overrides` is a map of `system_name: workflow_level`. The named system
+uses the override tier; all other systems use the project-level `workflow`.
+A skill acting on a named system resolves its effective tier via step 1 of the
+resolution chain above.
+
+---
+
+## Effective-Tier Resolution Worked Example
+
+Project has `modes.workflow: standard`, `workflow_overrides.system_overrides.combat: full`.
+
+- `/design-system combat` → effective tier **full** → requires all 8 sections
+- `/design-system inventory` → no override → effective tier **standard** → 5 sections + conditional Formulas
+- `/gate-check` (Systems Design → Technical Setup) → requires the combat GDD at 8 sections AND every other MVP GDD at 5 sections before passing
+
+---
+
+## Per-Skill Behavior (the working summary — sufficient at runtime)
+
+**Authoring** — branch on the effective tier for required sections (and, for
+`brainstorm`, for which design artifact is produced — `design/game-brief.md` at
+`minimal` vs `design/gdd/game-concept.md` at `standard`/`full`):
+`brainstorm`, `design-system`, `art-bible`, `create-architecture`, `ux-design`,
+`map-systems`, `architecture-decision`.
+
+**Review/validation** — validate against the effective tier; missing
+*required* sections block, missing *optional* sections warn:
+`design-review`, `review-all-gdds`, `architecture-review`, `consistency-check`,
+`content-audit`.
+
+**Gate enforcement** — `gate-check` uses a different artifact checklist per
+stage per tier (the highest-visibility impact). Each gate's own checklist and
+tier reductions live in `.claude/skills/gate-check/references/gate-<phase>.md`,
+and `/gate-check` loads only the one gate it is running — that is the right
+place to look, not `effects-map.md`.
+
+**Planning/implementation** — adjust artifact prerequisites:
+`create-epics`, `create-stories`, `dev-story`, `story-readiness`, `story-done`,
+`qa-plan`, `regression-suite`.
+
+**Support** — adjust "what's missing" expectations so optional docs aren't
+flagged as gaps: `project-stage-detect`, `adopt`, `reverse-document`,
+`propagate-design-change`, `help`.
+
+---
+
+## Workflow Change Mid-Project
+
+When `workflow` changes via `/settings`, emit an informational note:
+
+> "Workflow changed from [old] to [new]. Run `/content-audit` to see what's now
+> required or extra. No automatic migration — existing files stay in place."
+
+No documents are auto-deleted, auto-generated, or blocked. The setting only
+affects *new* enforcement going forward.
+
+---
+
+## Companion Settings
+
+These are separate settings that compose with `workflow`. The summaries below
+are what a skill needs at runtime; `effects-map.md` carries the exhaustive
+per-skill tables for spec authors, and is not worth loading to apply a knob.
+
+> **All four below are fronted by `modes.rigor`** (`docs.density`,
+> `modes.story_granularity`, `qa.level`, `team.size` — along with `workflow` itself,
+> and `modes.review_mode`, for six fronted knobs total). One question at `/start`
+> sets all of them; setting any explicitly overrides just that one and leaves its
+> siblings on the rigor level. `team.size` and `modes.review_mode` are the two that
+> also stay overridable from `project.local.yaml` (they are personal-experience
+> knobs, not on-disk artifacts).
+
+- **`docs.density`** (`terse` | `balanced` | `thorough`) — `workflow` controls
+ *which sections exist*; `density` controls *how deep each section goes*.
+ `rigor` sets the two together; override `docs.density` alone to get
+ `full` + `terse` = "all 8 sections, each compact."
+- **`modes.story_granularity`** (`coarse` | `balanced` | `fine`) — how big
+ each story is and how many per epic/sprint.
+- **`qa.level`** (`minimal` | `standard` | `full`) — what test evidence is
+ required to mark stories Done. Composes with `testing.strict`:
+ `qa.level` = is evidence required; `testing.strict` = do failures block.
+- **`team.size`** (`individual` | `small` | `studio`) — which agents are active by
+ default. Different axis from workflow: workflow controls *what docs are
+ required*, team.size controls *which agents exist to make them*.
diff --git a/.claude/hooks/detect-gaps.sh b/.claude/hooks/detect-gaps.sh
index 2a2c96da..fae822bf 100644
--- a/.claude/hooks/detect-gaps.sh
+++ b/.claude/hooks/detect-gaps.sh
@@ -1,4 +1,32 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Hook: detect-gaps.sh
# Event: SessionStart
# Purpose: Detect missing documentation when code/prototypes exist
@@ -12,24 +40,78 @@ echo "=== Checking for Documentation Gaps ==="
# --- Check 0: Fresh project detection (suggests /start) ---
FRESH_PROJECT=true
-# Check if engine is configured
-if [ -f ".claude/docs/technical-preferences.md" ]; then
- ENGINE_LINE=$(grep -E "^\- \*\*Engine\*\*:" .claude/docs/technical-preferences.md 2>/dev/null)
+# Check if engine is configured (project.yaml first, fall back to technical-preferences.md)
+if [ -f "project.yaml" ] && [ -f ".claude/hooks/yaml-helper.sh" ]; then
+ source .claude/hooks/yaml-helper.sh
+ ENGINE_NAME=$(get_yaml_key project.yaml engine.name 2>/dev/null)
+ if [ -n "$ENGINE_NAME" ]; then
+ FRESH_PROJECT=false
+ fi
+fi
+if [ "$FRESH_PROJECT" = true ] && [ -f ".claude/docs/technical-preferences.md" ]; then
+ ENGINE_LINE=$(grep -E "^[[:space:]]*-[[:space:]]+\*\*Engine\*\*:" .claude/docs/technical-preferences.md 2>/dev/null)
if [ -n "$ENGINE_LINE" ] && ! echo "$ENGINE_LINE" | grep -q "TO BE CONFIGURED" 2>/dev/null; then
FRESH_PROJECT=false
fi
fi
-# Check if game concept exists
-if [ -f "design/gdd/game-concept.md" ]; then
+# Check if a design record exists.
+#
+# TWO FILES, NOT ONE. `game-concept.md` is the `standard`/`full` concept doc;
+# at `minimal` the design record is the one-page `design/game-brief.md`, which
+# `/brainstorm` writes in its place. workflow-modes.md states the rule this
+# check has to satisfy: any check, gate or glob for the minimal design artifact
+# must target `design/game-brief.md`.
+#
+# Testing only for `game-concept.md` means a minimal-tier project that has
+# already run `/start` AND `/brainstorm` is greeted with "NEW PROJECT ... Run:
+# /start" at every session start -- the banner wrong about the one artifact
+# that tier produces.
+if [ -f "design/gdd/game-concept.md" ] || [ -f "design/game-brief.md" ]; then
FRESH_PROJECT=false
fi
-# Check if source code exists
-if [ -d "src" ]; then
- SRC_CHECK=$(find src -type f \( -name "*.gd" -o -name "*.cs" -o -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.ts" \) 2>/dev/null | head -1)
+# Check if source code exists.
+#
+# All three code roots, not just `src/`. Per .claude/docs/directory-structure.md
+# `src/` is the Godot row; Unity builds from `Assets/` and Unreal from
+# `Source/`. Testing only `src/` meant a Unity project with a full codebase
+# could still be greeted with "NEW PROJECT ... Run: /start".
+#
+# Tested directly rather than through resolve_code_root: this check runs before
+# the config helper is guaranteed to be sourced, and "is there any code at all"
+# does not need the engine to be known.
+for _root in src Assets Source; do
+ [ -d "$_root" ] || continue
+ SRC_CHECK=$(find "$_root" -type f \( -name "*.gd" -o -name "*.cs" -o -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.ts" \) 2>/dev/null | head -1)
if [ -n "$SRC_CHECK" ]; then
FRESH_PROJECT=false
+ break
+ fi
+done
+
+# --- Check 0b: v1.0 project — legacy config present, project.yaml absent ---
+# The migration story depends on users discovering /adopt; UPGRADING.md only
+# reaches people who read it. An unconfigured technical-preferences.md template
+# does not count as legacy data (same rule as migrate-v1-config.sh), and legacy
+# config also means the project is not fresh — the NEW PROJECT banner below
+# would be wrong for it.
+if [ ! -f "project.yaml" ]; then
+ LEGACY_FILES=""
+ [ -f "production/stage.txt" ] && LEGACY_FILES="production/stage.txt"
+ [ -f "production/review-mode.txt" ] && LEGACY_FILES="${LEGACY_FILES:+$LEGACY_FILES, }production/review-mode.txt"
+ if [ -f ".claude/docs/technical-preferences.md" ]; then
+ TP_ENGINE=$(grep -E "^[[:space:]]*-[[:space:]]+\*\*Engine\*\*:" .claude/docs/technical-preferences.md 2>/dev/null)
+ if [ -n "$TP_ENGINE" ] && ! echo "$TP_ENGINE" | grep -q "TO BE CONFIGURED" 2>/dev/null; then
+ LEGACY_FILES="${LEGACY_FILES:+$LEGACY_FILES, }.claude/docs/technical-preferences.md"
+ fi
+ fi
+ if [ -n "$LEGACY_FILES" ]; then
+ FRESH_PROJECT=false
+ echo ""
+ echo "⬆️ v1.0 PROJECT: legacy config ($LEGACY_FILES) but no project.yaml."
+ echo " Run: /adopt — it detects this and drives the migration (non-destructive)."
+ echo " Preview first: bash .claude/scripts/migrate-v1-config.sh --dry-run"
fi
fi
@@ -43,10 +125,75 @@ if [ "$FRESH_PROJECT" = true ]; then
exit 0
fi
+# --- Resolve the workflow tier once, for the checks below ---
+#
+# Checks 1, 3 and 4 all ask "where is the design/architecture document for this
+# code?". At `minimal` the answer is that there deliberately is none:
+# workflow-modes.md requires only engine choice and a filled
+# `design/game-brief.md` before code starts, and says everything else can be
+# skipped. Reporting their absence as a GAP nags the user about work their own
+# configuration told them to skip -- and a warning that fires when nothing is
+# wrong trains the user to ignore the ones that matter.
+#
+# resolve_setting, NOT get_yaml_key: `modes.workflow` is rigor-fronted, so a
+# project that set `rigor: minimal` and nothing else has no `modes.workflow` key
+# to read. Only the full chain sees the expansion. Same pattern and same reason
+# as validate-commit.sh.
+#
+# Resolved AFTER the fresh-project early-exit above, so a brand-new project
+# never pays for the lookup.
+WORKFLOW="standard"
+if [ -f .claude/hooks/yaml-helper.sh ]; then
+ . .claude/hooks/yaml-helper.sh 2>/dev/null
+ W=$(resolve_setting modes.workflow 2>/dev/null | cut -f1)
+ [ -n "$W" ] && WORKFLOW="$W"
+fi
+
+# Check 2 is NOT gated: an undocumented prototype is a gap about the prototype
+# itself, not about the design pipeline the tier scales.
+if [ "$WORKFLOW" = "minimal" ]; then
+ DOC_CHECKS=false
+else
+ DOC_CHECKS=true
+fi
+
+# --- Resolve the engine-specific code root for checks 1, 3 and 4 ------------
+#
+# Checks 1, 3 and 4 were all hardcoded to `src/`, which .claude/docs/directory-
+# structure.md defines as the GODOT row of the code-root table -- Unity uses
+# `Assets/`, Unreal `Source/`. On those two engines every directory test below
+# failed, the source-file count came back 0, and NONE of the three checks ran.
+# A project with 200 undocumented Unity systems produced the same empty output
+# as a fully documented one.
+#
+# Only the ROOT is engine-specific. The `core/`, `engine/` and `gameplay/`
+# sub-layout is CCGS's own convention, unchanged by the engine, so it stays
+# literal.
+#
+# Resolved AFTER the fresh-project early-exit, so a brand-new project never
+# pays for the lookup.
+if command -v resolve_code_root >/dev/null 2>&1; then
+ CODE_ROOT=$(resolve_code_root 2>/dev/null | cut -f1)
+else
+ CODE_ROOT=""
+fi
+
+# A doc check that cannot locate the code root has not established that there
+# are no gaps -- it has established nothing (obligation 1 and 3 of
+# .claude/rules/skill-authoring.md). Announce it, once, and only when the checks
+# would otherwise have had somewhere to look.
+if [ "$DOC_CHECKS" = true ] && [ -z "$CODE_ROOT" ]; then
+ if [ -d src ] || [ -d Assets ] || [ -d Source ]; then
+ echo "ℹ️ NOT CHECKED: code exists but the code root is ambiguous (engine.name unset, and the tree does not name one unambiguously)."
+ echo " Checks 1, 3 and 4 (design and architecture docs for existing code) did NOT run."
+ echo " Suggested action: /setup-engine, or set engine.name in project.yaml"
+ fi
+fi
+
# --- Check 1: Substantial codebase but sparse design docs ---
-if [ -d "src" ]; then
+if [ -n "$CODE_ROOT" ] && [ -d "$CODE_ROOT" ]; then
# Count source files (cross-platform, handles Windows paths)
- SRC_FILES=$(find src -type f \( -name "*.gd" -o -name "*.cs" -o -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.ts" \) 2>/dev/null | wc -l)
+ SRC_FILES=$(find "$CODE_ROOT" -type f \( -name "*.gd" -o -name "*.cs" -o -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" -o -name "*.rs" -o -name "*.py" -o -name "*.js" -o -name "*.ts" \) 2>/dev/null | wc -l)
else
SRC_FILES=0
fi
@@ -61,9 +208,9 @@ fi
SRC_FILES=$(echo "$SRC_FILES" | tr -d ' ')
DESIGN_FILES=$(echo "$DESIGN_FILES" | tr -d ' ')
-if [ "$SRC_FILES" -gt 50 ] && [ "$DESIGN_FILES" -lt 5 ]; then
+if [ "$DOC_CHECKS" = true ] && [ "$SRC_FILES" -gt 50 ] && [ "$DESIGN_FILES" -lt 5 ]; then
echo "⚠️ GAP: Substantial codebase ($SRC_FILES source files) but sparse design docs ($DESIGN_FILES files)"
- echo " Suggested action: /reverse-document design src/[system]"
+ echo " Suggested action: /reverse-document design ${CODE_ROOT:-<code root>}/[system]"
echo " Or run: /project-stage-detect to get full analysis"
fi
@@ -95,7 +242,7 @@ if [ -d "prototypes" ]; then
fi
# --- Check 3: Core systems without architecture docs ---
-if [ -d "src/core" ] || [ -d "src/engine" ]; then
+if [ "$DOC_CHECKS" = true ] && [ -n "$CODE_ROOT" ] && { [ -d "$CODE_ROOT/core" ] || [ -d "$CODE_ROOT/engine" ]; }; then
if [ ! -d "docs/architecture" ]; then
echo "⚠️ GAP: Core engine/systems exist but no docs/architecture/ directory"
echo " Suggested action: Create docs/architecture/ and run /architecture-decision"
@@ -105,15 +252,15 @@ if [ -d "src/core" ] || [ -d "src/engine" ]; then
if [ "$ADR_COUNT" -lt 3 ]; then
echo "⚠️ GAP: Core systems exist but only $ADR_COUNT ADR(s) documented"
- echo " Suggested action: /reverse-document architecture src/core/[system]"
+ echo " Suggested action: /reverse-document architecture $CODE_ROOT/core/[system]"
fi
fi
fi
# --- Check 4: Gameplay systems without design docs ---
-if [ -d "src/gameplay" ]; then
+if [ "$DOC_CHECKS" = true ] && [ -n "$CODE_ROOT" ] && [ -d "$CODE_ROOT/gameplay" ]; then
# Find major gameplay subdirectories (those with 5+ files)
- GAMEPLAY_SYSTEMS=$(find src/gameplay -mindepth 1 -maxdepth 1 -type d 2>/dev/null)
+ GAMEPLAY_SYSTEMS=$(find "$CODE_ROOT/gameplay" -mindepth 1 -maxdepth 1 -type d 2>/dev/null)
if [ -n "$GAMEPLAY_SYSTEMS" ]; then
while IFS= read -r system_dir; do
@@ -129,9 +276,9 @@ if [ -d "src/gameplay" ]; then
design_doc_2="design/gdd/${system_name}.md"
if [ ! -f "$design_doc_1" ] && [ ! -f "$design_doc_2" ]; then
- echo "⚠️ GAP: Gameplay system 'src/gameplay/$system_name/' ($file_count files) has no design doc"
+ echo "⚠️ GAP: Gameplay system '$CODE_ROOT/gameplay/$system_name/' ($file_count files) has no design doc"
echo " Expected: design/gdd/${system_name}-system.md or design/gdd/${system_name}.md"
- echo " Suggested action: /reverse-document design src/gameplay/$system_name"
+ echo " Suggested action: /reverse-document design $CODE_ROOT/gameplay/$system_name"
fi
fi
done <<< "$GAMEPLAY_SYSTEMS"
@@ -147,6 +294,38 @@ if [ "$SRC_FILES" -gt 100 ]; then
fi
fi
+# --- Check 6: project.stage is behind what is actually on disk ---
+#
+# On the `minimal` path nothing ever advances the stage. Only
+# /gate-check writes it, and the four-step jam route never invokes one -- so a
+# project with stories and running game code keeps reporting `Concept` to the
+# status line, to /help, and to every gate checklist that branches on stage.
+#
+# This is an OBSERVATION, never a write. CLAUDE.md is explicit that the stage
+# advances on a /gate-check PASS with the user confirming, so a hook that
+# advanced it silently would be the worse bug. Say what is inconsistent and name
+# the skill that resolves it.
+STAGE=""
+if [ -f .claude/hooks/yaml-helper.sh ]; then
+ STAGE=$(get_yaml_key project.stage 2>/dev/null)
+fi
+[ -z "$STAGE" ] && [ -f production/stage.txt ] && STAGE=$(head -1 production/stage.txt 2>/dev/null | tr -d '
+' | tr -d ' ')
+
+if [ -n "$STAGE" ]; then
+ STORY_COUNT=$(find production/epics -name "story-*.md" 2>/dev/null | wc -l | tr -d ' ')
+ case "$STAGE" in
+ Concept|concept|Pre-Production|"Pre-Production")
+ if [ "$STORY_COUNT" -gt 0 ] && [ "$SRC_FILES" -gt 0 ]; then
+ echo "⚠️ GAP: project.stage says '$STAGE', but $STORY_COUNT stories and $SRC_FILES source files exist"
+ echo " The stage only advances on a /gate-check PASS, and nothing on the"
+ echo " minimal path runs one -- so the status line can sit at '$STAGE' indefinitely."
+ echo " Suggested action: /gate-check (it asks before advancing; this hook never writes the stage)"
+ fi
+ ;;
+ esac
+fi
+
# --- Summary ---
echo ""
echo "💡 To get a comprehensive project analysis, run: /project-stage-detect"
diff --git a/.claude/hooks/log-agent-stop.sh b/.claude/hooks/log-agent-stop.sh
index afbd2819..0f6c62e6 100644
--- a/.claude/hooks/log-agent-stop.sh
+++ b/.claude/hooks/log-agent-stop.sh
@@ -1,4 +1,32 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code SubagentStop hook: Log agent completion for audit trail
# Tracks when agents finish and their outcome
#
@@ -10,21 +38,41 @@
# returns null on every invocation, so the fallback "unknown" is always used
# and the audit trail captures nothing useful.
+# features.session_state: off => no audit trail. Default `on`; see
+# session_state_enabled() in yaml-helper.sh.
+if [ -f .claude/hooks/yaml-helper.sh ]; then
+ . .claude/hooks/yaml-helper.sh
+ session_state_enabled || exit 0
+fi
+
INPUT=$(cat)
# Parse agent name -- use jq if available, fall back to grep
if command -v jq >/dev/null 2>&1; then
AGENT_NAME=$(echo "$INPUT" | jq -r '.agent_type // "unknown"' 2>/dev/null)
else
- AGENT_NAME=$(echo "$INPUT" | grep -oE '"agent_type"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"agent_type"[[:space:]]*:[[:space:]]*"//;s/"$//')
- [ -z "$AGENT_NAME" ] && AGENT_NAME="unknown"
+ AGENT_NAME=$(echo "$INPUT" | grep -oE '"agent_type"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"agent_type"[[:space:]]*:[[:space:]]*"//;s/"$//')
+fi
+# OUTSIDE the branch, like SESSION_ID below. jq's `// "unknown"` substitutes for
+# null and false but NOT for an empty string, so the jq path could emit a record
+# with no agent name at all while the grep path guarded against it. One guard,
+# both paths.
+[ -z "$AGENT_NAME" ] && AGENT_NAME="unknown"
+
+# Parse session id -- keeps the completion record in the same three-field shape
+# as log-agent.sh so both sides of a spawn belong to an identifiable session.
+if command -v jq >/dev/null 2>&1; then
+ SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // "unknown"' 2>/dev/null)
+else
+ SESSION_ID=$(echo "$INPUT" | grep -oE '"session_id"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"session_id"[[:space:]]*:[[:space:]]*"//;s/"$//')
fi
+[ -z "$SESSION_ID" ] && SESSION_ID="unknown"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
SESSION_LOG_DIR="production/session-logs"
mkdir -p "$SESSION_LOG_DIR" 2>/dev/null
-echo "$TIMESTAMP | Agent completed: $AGENT_NAME" >> "$SESSION_LOG_DIR/agent-audit.log" 2>/dev/null
+echo "$TIMESTAMP | $SESSION_ID | Agent completed: $AGENT_NAME" >> "$SESSION_LOG_DIR/agent-audit.log" 2>/dev/null
exit 0
diff --git a/.claude/hooks/log-agent.sh b/.claude/hooks/log-agent.sh
index e39a5e72..9f36e27d 100644
--- a/.claude/hooks/log-agent.sh
+++ b/.claude/hooks/log-agent.sh
@@ -1,4 +1,32 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code SubagentStart hook: Log agent invocations for audit trail
# Tracks which agents are being used and when
#
@@ -9,21 +37,45 @@
# returns null on every invocation, so the fallback "unknown" is always used
# and the audit trail captures nothing useful.
+# features.session_state: off => no audit trail, no spawn tally. Default is
+# `on`, so this changes nothing unless the user opted out. Checked before
+# reading stdin: there is no point paying for the parse we are about to discard.
+if [ -f .claude/hooks/yaml-helper.sh ]; then
+ . .claude/hooks/yaml-helper.sh
+ session_state_enabled || exit 0
+fi
+
INPUT=$(cat)
# Parse agent name -- use jq if available, fall back to grep
if command -v jq >/dev/null 2>&1; then
AGENT_NAME=$(echo "$INPUT" | jq -r '.agent_type // "unknown"' 2>/dev/null)
else
- AGENT_NAME=$(echo "$INPUT" | grep -oE '"agent_type"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"agent_type"[[:space:]]*:[[:space:]]*"//;s/"$//')
- [ -z "$AGENT_NAME" ] && AGENT_NAME="unknown"
+ AGENT_NAME=$(echo "$INPUT" | grep -oE '"agent_type"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"agent_type"[[:space:]]*:[[:space:]]*"//;s/"$//')
+fi
+# OUTSIDE the branch, like SESSION_ID below. jq's `// "unknown"` substitutes for
+# null and false but NOT for an empty string, so the jq path could emit a record
+# with no agent name at all while the grep path guarded against it. One guard,
+# both paths.
+[ -z "$AGENT_NAME" ] && AGENT_NAME="unknown"
+
+# Parse session id -- session-stop.sh tallies spawns per session, so the record
+# is useless without it. Same jq/grep fallback pattern as the agent name.
+if command -v jq >/dev/null 2>&1; then
+ SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // "unknown"' 2>/dev/null)
+else
+ SESSION_ID=$(echo "$INPUT" | grep -oE '"session_id"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"session_id"[[:space:]]*:[[:space:]]*"//;s/"$//')
fi
+[ -z "$SESSION_ID" ] && SESSION_ID="unknown"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
SESSION_LOG_DIR="production/session-logs"
mkdir -p "$SESSION_LOG_DIR" 2>/dev/null
-echo "$TIMESTAMP | Agent invoked: $AGENT_NAME" >> "$SESSION_LOG_DIR/agent-audit.log" 2>/dev/null
+# Field order is timestamp | session | event -- session-stop.sh greps the
+# fixed string " | $SESSION_ID | Agent invoked: " to tally the current session.
+# Changing this format silently breaks the spawn count (nothing else reads it).
+echo "$TIMESTAMP | $SESSION_ID | Agent invoked: $AGENT_NAME" >> "$SESSION_LOG_DIR/agent-audit.log" 2>/dev/null
exit 0
diff --git a/.claude/hooks/log-instructions.sh b/.claude/hooks/log-instructions.sh
new file mode 100644
index 00000000..abc0ad09
--- /dev/null
+++ b/.claude/hooks/log-instructions.sh
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently write the WRONG TREE -- creating
+# stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
+# Claude Code InstructionsLoaded hook: record WHICH instruction file loaded and
+# WHY.
+#
+# WHAT THIS ANSWERS
+# `.claude/rules/*.md` files carry `paths:` frontmatter, and a path-scoped rule
+# loads only when Claude READS a file matching the pattern -- not on every tool
+# use, and not when it CREATES one. This framework's agents predominantly create
+# files: a new GDD, a new source file, a new test. So "does the rule for
+# src/gameplay/** ever actually reach the model?" has a real answer, and before
+# this hook the only way to get it was to infer it from behaviour afterwards.
+#
+# That inference was made once here, expensively: a data-file rule specified one
+# key casing, agents wrote the other, and nothing surfaced the disagreement.
+# Measurement replaces the inference.
+#
+# MEASURED, same repo, one session:
+# session_start CLAUDE.md
+# include its four @-imports, each carrying parent_file_path
+# path_glob_match .claude/rules/skill-authoring.md, after READING a file
+# under .claude/agents/** -- one of its declared paths
+# (nothing) after CREATING a file under prototypes/** -- a declared
+# path of .claude/rules/prototype-code.md
+# Read fires, create does not. Keep this hook wired: the behaviour is upstream
+# and can change in either direction, and this is the only thing here that would
+# notice.
+#
+# SCHEMA CONFIRMED, NOT ASSUMED
+# The common fields are documented; the event-specific ones are not. `pick()`
+# tries the confirmed name first and keeps alternates behind it, so a schema
+# change degrades to a fallback rather than to a blank column -- and the RAW
+# line carries the answer regardless. That is how `load_reason` was found: the
+# first guess (`reason`) missed, and the raw payload named the real field.
+#
+# NOT GATED ON features.session_state, deliberately. This is a diagnostic wired
+# up on purpose; silencing it from an unrelated flag would make it do nothing
+# while still looking installed -- the failure shape
+# `.claude/rules/skill-authoring.md` exists to prevent.
+#
+# The exit code is ignored for this event and it cannot block a load. Fail
+# silent, stay cheap: it fires once per instruction file per load.
+
+LOG_DIR="production/session-logs"
+LOG="$LOG_DIR/instructions-loaded.log"
+
+# stdin may be absent; an unbounded read would then hang until the hook timeout.
+[ -t 0 ] && exit 0
+if command -v timeout >/dev/null 2>&1; then
+ INPUT=$(timeout 2 cat 2>/dev/null)
+else
+ INPUT=$(cat 2>/dev/null)
+fi
+[ -n "$INPUT" ] || exit 0
+
+mkdir -p "$LOG_DIR" 2>/dev/null || exit 0
+
+TIMESTAMP=$(date +%Y%m%d_%H%M%S)
+
+# `head -1` on every grep: an unanchored match can hit the same key nested
+# deeper in the payload, and a multi-line value would break the one-record-per-
+# line format this log depends on.
+pick() { # <json> <key>...
+ _j="$1"; shift
+ for _k in "$@"; do
+ _v=$(printf '%s' "$_j" \
+ | grep -oE "\"$_k\"[[:space:]]*:[[:space:]]*\"[^\"]*\"" \
+ | head -1 \
+ | sed "s/\"$_k\"[[:space:]]*:[[:space:]]*\"//;s/\"$//")
+ if [ -n "$_v" ]; then printf '%s' "$_v"; return 0; fi
+ done
+ printf ''
+}
+
+FILE_VAL=$(pick "$INPUT" file_path path file source_path instruction_path filePath)
+REASON_VAL=$(pick "$INPUT" load_reason reason loadReason matcher trigger source)
+PARENT_VAL=$(pick "$INPUT" parent_file_path parentFilePath parent)
+
+# Paths arrive as absolute Windows paths with JSON-escaped separators. Left raw,
+# the readable line is the least readable thing in the log. Unescape, normalise
+# to forward slashes, strip the repo prefix -- so the column reads
+# `.claude/rules/gameplay-code.md`, which is what anyone scanning this is
+# looking for. The RAW line below keeps the original bytes untouched.
+# TWO forms of the repo root, because the payload and the shell disagree about
+# what a path looks like on Windows. Git Bash reports $PWD as `/c/Users/...`
+# while the payload carries `C:\Users\...`; stripping only the shell's form
+# silently strips nothing and the column stays absolute -- which is why this
+# needs checking on real payloads rather than a fixture. `pwd -W` gives the Windows
+# form where it exists and is empty elsewhere, so both are tried and neither is
+# required.
+_PWD_FWD=$(printf '%s' "$PWD" | sed 's|\\|/|g')
+_PWD_WIN=$(pwd -W 2>/dev/null | sed 's|\\|/|g')
+shorten() {
+ [ -n "$1" ] || return 0
+ printf '%s' "$1" | sed 's|\\\\|/|g; s|\\|/|g' \
+ | sed "s|^${_PWD_FWD}/||" \
+ | { if [ -n "$_PWD_WIN" ]; then sed "s|^${_PWD_WIN}/||"; else cat; fi; }
+}
+FILE_SHORT=$(shorten "$FILE_VAL")
+PARENT_SHORT=$(shorten "$PARENT_VAL")
+
+{
+ printf '%s | %-16s | %s%s\n' \
+ "$TIMESTAMP" "${REASON_VAL:-?}" "${FILE_SHORT:-?}" \
+ "${PARENT_SHORT:+ (via $PARENT_SHORT)}"
+ # Raw payload on the following line, prefixed so the log stays greppable and
+ # so an unrecognised schema is still recoverable from the file itself.
+ printf '%s RAW %s\n' "$TIMESTAMP" "$INPUT"
+} >> "$LOG" 2>/dev/null
+
+exit 0
diff --git a/.claude/hooks/notify.sh b/.claude/hooks/notify.sh
index 661b0bd6..035e496f 100644
--- a/.claude/hooks/notify.sh
+++ b/.claude/hooks/notify.sh
@@ -1,4 +1,32 @@
#!/usr/bin/env bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Notification hook — fires when Claude Code sends a notification
# Shows a Windows toast via PowerShell
@@ -9,15 +37,24 @@ INPUT=$(cat)
if command -v jq &>/dev/null; then
MESSAGE=$(echo "$INPUT" | jq -r '.message // empty' 2>/dev/null)
fi
-if [ -z "$MESSAGE" ]; then
- MESSAGE=$(echo "$INPUT" | grep -oE '"message":"[^"]*"' | sed 's/"message":"//;s/"//')
+if [ -z "${MESSAGE:-}" ]; then
+ # `[[:space:]]*` around the colon, like every other hook's fallback. This one
+ # required `"message":"` with no space, so a pretty-printed or space-separated
+ # payload fell through to the generic text below and the real notification was
+ # lost. Nothing reported that -- the hook still fired, just saying nothing.
+ MESSAGE=$(echo "$INPUT" | grep -oE '"message"[[:space:]]*:[[:space:]]*"[^"]*"' \
+ | head -1 | sed 's/"message"[[:space:]]*:[[:space:]]*"//;s/"$//')
fi
if [ -z "$MESSAGE" ]; then
MESSAGE="Claude Code needs your attention"
fi
-# Sanitize message for PowerShell string embedding (escape single quotes)
-MESSAGE_SAFE=$(echo "$MESSAGE" | sed "s/'/''/g" | head -c 200)
+# TRUNCATE FIRST, then escape. Escaping doubles each `'` into `''`, so cutting
+# at a fixed byte count afterwards can land between the two halves of a pair and
+# hand PowerShell an unbalanced quote. The command then fails to parse, and
+# because it is backgrounded with stderr discarded the only symptom is a
+# notification that never appears.
+MESSAGE_SAFE=$(printf '%s' "$MESSAGE" | head -c 200 | sed "s/'/''/g")
# Show Windows balloon tip notification (works on all Windows 10/11 without extra modules)
powershell.exe -NonInteractive -WindowStyle Hidden -Command "
diff --git a/.claude/hooks/post-compact.sh b/.claude/hooks/post-compact.sh
index 92d57fa9..9a949a1a 100644
--- a/.claude/hooks/post-compact.sh
+++ b/.claude/hooks/post-compact.sh
@@ -1,7 +1,42 @@
#!/usr/bin/env bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# post-compact.sh — fires after conversation compaction
# Reminds Claude to restore session state from the file-backed checkpoint.
+# features.session_state: off => this hook is a no-op. Default `on`; see
+# session_state_enabled() in yaml-helper.sh.
+if [ -f .claude/hooks/yaml-helper.sh ]; then
+ . .claude/hooks/yaml-helper.sh
+ session_state_enabled || exit 0
+fi
+
ACTIVE="production/session-state/active.md"
echo "=== Context Restored After Compaction ==="
diff --git a/.claude/hooks/pre-compact.sh b/.claude/hooks/pre-compact.sh
index 4d4842f5..efb02162 100644
--- a/.claude/hooks/pre-compact.sh
+++ b/.claude/hooks/pre-compact.sh
@@ -1,49 +1,126 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code PreCompact hook: Dump session state before context compression
# This output appears in the conversation right before compaction, ensuring
# critical state survives the summarization process.
+# features.session_state: off => this hook is a no-op. Default `on`; see
+# session_state_enabled() in yaml-helper.sh.
+if [ -f .claude/hooks/yaml-helper.sh ]; then
+ . .claude/hooks/yaml-helper.sh
+ session_state_enabled || exit 0
+fi
+
echo "=== SESSION STATE BEFORE COMPACTION ==="
echo "Timestamp: $(date)"
-# --- Active session state file ---
+# --- Active session state: the CHECKPOINT region, BY REFERENCE ---
+#
+# Injecting `head -n 100` of active.md here would be wrong twice over.
+#
+# First, the cap bounds the wrong dimension. active.md's lines are long, so 100
+# of them was 12.7 KB (~3,200 tokens) -- injected at the one moment context is
+# scarcest, and growing with the file.
+#
+# Second, and worse: content emitted here goes INTO the context that is about to
+# be compacted, so it is summarised like everything else rather than preserved.
+# We were paying full price for a lossy copy of a file that is already on disk
+# -- while post-compact.sh, which fires after, already tells the agent to read
+# that file. Pointer + a bounded checkpoint beats a dump on both cost and
+# fidelity.
+#
+# So: emit only the region between the CHECKPOINT markers (bounded by the schema
+# in .claude/docs/templates/session-state.md) plus a pointer to the whole file.
STATE_FILE="production/session-state/active.md"
if [ -f "$STATE_FILE" ]; then
echo ""
- echo "## Active Session State (from $STATE_FILE)"
- STATE_LINES=$(wc -l < "$STATE_FILE" 2>/dev/null | tr -d ' ')
- if [ "$STATE_LINES" -gt 100 ] 2>/dev/null; then
- head -n 100 "$STATE_FILE"
- echo "... (truncated — $STATE_LINES total lines, showing first 100)"
+ echo "## Active Session State — checkpoint from $STATE_FILE"
+ CHECKPOINT=$(sed -n '/<!-- CHECKPOINT -->/,/<!-- \/CHECKPOINT -->/p' "$STATE_FILE" 2>/dev/null \
+ | grep -v '<!-- /\?CHECKPOINT -->')
+ STATUS_BLOCK=$(sed -n '/<!-- STATUS -->/,/<!-- \/STATUS -->/p' "$STATE_FILE" 2>/dev/null \
+ | grep -v '<!-- /\?STATUS -->' | grep -E '^(Epic|Feature|Task):[[:space:]]*[^[:space:]]')
+ [ -n "$STATUS_BLOCK" ] && printf '%s\n' "$STATUS_BLOCK"
+ if [ -n "$CHECKPOINT" ]; then
+ printf '%s\n' "$CHECKPOINT"
else
- cat "$STATE_FILE"
+ # No markers: an unmigrated or hand-written file. Fall back to a small
+ # head slice rather than nothing -- but say so, because a missing
+ # checkpoint is a real problem the user should fix, not absorb silently.
+ echo "(no CHECKPOINT block — showing the first 20 lines instead;"
+ echo " re-create this file from .claude/docs/templates/session-state.md)"
+ head -n 20 "$STATE_FILE"
fi
+ echo ""
+ echo "Full detail (NOT reproduced here — read the file if you need it): $STATE_FILE"
else
echo ""
echo "## No active session state file found"
echo "Consider maintaining production/session-state/active.md for better recovery."
+ echo "Template: .claude/docs/templates/session-state.md"
fi
# --- Files modified this session (unstaged + staged + untracked) ---
echo ""
echo "## Files Modified (git working tree)"
+# BOUNDED. These three lists must never be emitted in full, one line per
+# file, with no cap -- and this output goes INTO the context that is about to be
+# compacted. The checkpoint above was redesigned to be by-reference for exactly
+# that reason (see the note at the top of this file); the lists below were left
+# unbounded, so the hook still dumped whatever the working tree happened to
+# contain at the moment context was scarcest. Measured on a tree with ~5k
+# untracked files: 181,125 bytes, roughly 45,000 tokens, of which ~4,984 lines
+# were this section. A fresh asset import or un-gitignored build output is
+# enough to trigger it.
+#
+# A count plus a sample is what this section is actually for -- orienting the
+# agent after compaction -- and the full list is one `git status` away.
+_PC_CAP=20
+_pc_list() { # $1=label $2=newline-separated paths
+ [ -n "$2" ] || return 0
+ _n=$(printf '%s\n' "$2" | grep -c .)
+ echo "$1 ($_n):"
+ printf '%s\n' "$2" | head -n "$_PC_CAP" | while read -r f; do [ -n "$f" ] && echo " - $f"; done
+ if [ "$_n" -gt "$_PC_CAP" ]; then
+ echo " ... and $((_n - _PC_CAP)) more (run: git status)"
+ fi
+}
+
CHANGED=$(git diff --name-only 2>/dev/null)
STAGED=$(git diff --staged --name-only 2>/dev/null)
UNTRACKED=$(git ls-files --others --exclude-standard 2>/dev/null)
-if [ -n "$CHANGED" ]; then
- echo "Unstaged changes:"
- echo "$CHANGED" | while read -r f; do echo " - $f"; done
-fi
-if [ -n "$STAGED" ]; then
- echo "Staged changes:"
- echo "$STAGED" | while read -r f; do echo " - $f"; done
-fi
-if [ -n "$UNTRACKED" ]; then
- echo "New untracked files:"
- echo "$UNTRACKED" | while read -r f; do echo " - $f"; done
-fi
+_pc_list "Unstaged changes" "$CHANGED"
+_pc_list "Staged changes" "$STAGED"
+_pc_list "New untracked files" "$UNTRACKED"
+
if [ -z "$CHANGED" ] && [ -z "$STAGED" ] && [ -z "$UNTRACKED" ]; then
echo " (no uncommitted changes)"
fi
@@ -53,15 +130,30 @@ echo ""
echo "## Design Docs — Work In Progress"
WIP_FOUND=false
-for f in design/gdd/*.md; do
- [ -f "$f" ] || continue
- INCOMPLETE=$(grep -n -E "TODO|WIP|PLACEHOLDER|\[TO BE|\[TBD\]" "$f" 2>/dev/null)
- if [ -n "$INCOMPLETE" ]; then
- WIP_FOUND=true
- echo " $f:"
- echo "$INCOMPLETE" | while read -r line; do echo " $line"; done
+# BOUNDED and BATCHED. One `grep -n` per design doc, printing every matching
+# line from every file, fails twice over -- the same two ways as above:
+# unbounded OUTPUT into a compacting context, and unbounded
+# COST -- ~85ms per file, crossing this hook's 10s budget at roughly 90 GDDs.
+# Measured: 220 docs 18262ms, 420 docs killed at the timeout.
+#
+# `xargs -0` bounds the spawn count by ARG_MAX rather than by file count, and
+# the NUL delimiter keeps it portable: `-d` is GNU-only, BSD xargs rejects it,
+# and the pipeline swallows that error silently. The
+# report is capped. What the agent needs after compaction is "these docs are
+# unfinished", not every TODO line in the project.
+_WIP_HITS=$(printf '%s\n' design/gdd/*.md | tr '\n' '\0' \
+ | xargs -0 grep -lE "TODO|WIP|PLACEHOLDER|\[TO BE|\[TBD\]" 2>/dev/null || true)
+if [ -n "$_WIP_HITS" ]; then
+ WIP_FOUND=true
+ _wn=$(printf '%s\n' "$_WIP_HITS" | grep -c .)
+ echo "$_wn design doc(s) contain TODO/WIP/PLACEHOLDER markers:"
+ printf '%s\n' "$_WIP_HITS" | head -n "$_PC_CAP" | while read -r f; do
+ [ -n "$f" ] && echo " - $f"
+ done
+ if [ "$_wn" -gt "$_PC_CAP" ]; then
+ echo " ... and $((_wn - _PC_CAP)) more"
fi
-done
+fi
if [ "$WIP_FOUND" = false ]; then
echo " (no WIP markers found in design docs)"
diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.sh
index 05687d19..59f17906 100644
--- a/.claude/hooks/session-start.sh
+++ b/.claude/hooks/session-start.sh
@@ -1,8 +1,53 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code SessionStart hook: Load project context at session start
# Outputs context information that Claude sees when a session begins
#
-# Input schema (SessionStart): No stdin input
+# Input schema (SessionStart): stdin IS supplied -- VERIFIED, not asserted.
+# Observed on real harness events as a single line of JSON with session_id,
+# transcript_path, cwd, hook_event_name and `source` ("clear", "compact").
+# Do NOT read stdin here unboundedly -- the harness may leave it open, and a
+# blocking read costs this hook its whole 10s budget on every session start.
+#
+# THIS HOOK MUST FINISH INSIDE ITS BUDGET. If it is killed partway, the
+# session-state block never reaches context and the session starts blind --
+# and nothing visible from inside the session says so. The early-exit gating
+# and bounded reads below are what keep it inside 2s; treat them as load-
+# bearing, not as optimisation.
+#
+# If that ever recurs, the diagnostic that works is a FIRE/DONE pair appended
+# to a gitignored log at the top and bottom of this script -- "did it run at
+# all" and "did it get here" are opposite failures with opposite fixes, and
+# nothing else distinguishes them. /compact in particular CANNOT be used as
+# evidence: PostCompact runs post-compact.sh, which prints the checkpoint
+# independently, so seeing the checkpoint proves nothing about this script.
echo "=== Claude Code Game Studios — Session Context ==="
@@ -19,6 +64,84 @@ if [ -n "$BRANCH" ]; then
done
fi
+# Resolve review_mode the same way skills do: resolve_setting applies the FULL
+# chain (project.local.yaml -> project.yaml -> legacy review-mode.txt -> modes.rigor
+# expansion -> default). modes.review_mode is rigor-fronted and locally overridable,
+# so only resolve_setting reflects both a rigor-derived value (a project that set
+# only `rigor: minimal` shows `solo`) and a local override. get_effective_yaml_key
+# returns empty for a rigor-only project, which would leave the banner showing a
+# stale `lean`.
+REVIEW_MODE=""
+if [ -f "project.yaml" ] && [ -f ".claude/hooks/yaml-helper.sh" ]; then
+ source .claude/hooks/yaml-helper.sh
+ REVIEW_MODE=$(resolve_setting modes.review_mode 2>/dev/null | cut -f1)
+fi
+if [ -z "$REVIEW_MODE" ] && [ -f "production/review-mode.txt" ]; then
+ REVIEW_MODE=$(head -1 production/review-mode.txt 2>/dev/null | tr -d '[:space:]')
+fi
+if [ -z "$REVIEW_MODE" ]; then
+ REVIEW_MODE="lean"
+fi
+echo ""
+echo "Review mode: $REVIEW_MODE"
+
+# Schema validation — surface invalid enum values in
+# project.yaml and project.local.yaml so typos like `automation: chaotic`
+# surface at session start rather than failing inside a skill.
+if [ -f ".claude/hooks/yaml-helper.sh" ]; then
+ if ! type validate_yaml_enum >/dev/null 2>&1; then
+ source .claude/hooks/yaml-helper.sh
+ fi
+ # Hard-error guard: project.local.yaml requires a project.yaml base
+ if ! BASE_ERR=$(validate_local_yaml_base 2>&1); then
+ echo ""
+ echo "[!] $BASE_ERR"
+ fi
+ if [ -f "project.yaml" ]; then
+ SCHEMA_ERRORS=$(validate_yaml_enum project.yaml 2>&1)
+ if [ -n "$SCHEMA_ERRORS" ]; then
+ echo ""
+ echo "[!] project.yaml schema errors:"
+ echo "$SCHEMA_ERRORS" | sed 's/^/ /'
+ fi
+ fi
+ if [ -f "project.local.yaml" ]; then
+ SCHEMA_ERRORS=$(validate_yaml_enum project.local.yaml 2>&1)
+ if [ -n "$SCHEMA_ERRORS" ]; then
+ echo ""
+ echo "[!] project.local.yaml schema errors:"
+ echo "$SCHEMA_ERRORS" | sed 's/^/ /'
+ fi
+ fi
+fi
+
+# --- Stage source agreement ---
+# `project.stage` in project.yaml is authoritative; production/stage.txt is a
+# legacy mirror kept for unmigrated hooks. Twelve consumers read the mirror --
+# including detect-gaps.sh and yaml-helper.sh -- so when the two disagree, part
+# of the system acts on one stage and part on the other, silently.
+#
+# Warn, never reconcile. Only /gate-check on a PASS may change a stage, so a
+# hook that "helpfully" rewrote the mirror would be advancing a phase gate
+# nobody passed. Helpers emit observations, never verdicts (CLAUDE.md).
+STAGE_YAML=""
+STAGE_TXT=""
+if [ -f "project.yaml" ] && command -v get_yaml_key >/dev/null 2>&1; then
+ STAGE_YAML=$(get_yaml_key project.yaml project.stage 2>/dev/null)
+fi
+if [ -f "production/stage.txt" ]; then
+ STAGE_TXT=$(head -1 production/stage.txt 2>/dev/null | tr -d '\r' | sed 's/[[:space:]]*$//')
+fi
+if [ -n "$STAGE_YAML" ] && [ -n "$STAGE_TXT" ] && [ "$STAGE_YAML" != "$STAGE_TXT" ]; then
+ echo ""
+ echo "[!] Stage sources disagree:"
+ echo " project.yaml project.stage : $STAGE_YAML (authoritative)"
+ echo " production/stage.txt : $STAGE_TXT (legacy mirror)"
+ echo " Twelve consumers read the mirror, so part of the system is acting on"
+ echo " each value. Only /gate-check on a PASS should change a stage — do not"
+ echo " hand-edit either file to silence this."
+fi
+
# Current sprint (find most recent sprint file)
LATEST_SPRINT=$(ls -t production/sprints/sprint-*.md 2>/dev/null | head -1)
if [ -n "$LATEST_SPRINT" ]; then
@@ -44,32 +167,122 @@ if [ "$BUG_COUNT" -gt 0 ]; then
echo "Open bugs: $BUG_COUNT"
fi
-# Code health quick check
-if [ -d "src" ]; then
- TODO_COUNT=$(grep -r "TODO" src/ 2>/dev/null | wc -l)
- FIXME_COUNT=$(grep -r "FIXME" src/ 2>/dev/null | wc -l)
+# Code health quick check.
+#
+# Reads the ENGINE-SPECIFIC code root, not a literal `src/`. Hardcoding `src/`
+# made this line Godot-only: on a Unity or Unreal project the directory test
+# failed, the banner printed no code-health line at all, and a clean project and
+# an unreadable one looked identical. See resolve_code_root in yaml-helper.sh.
+#
+# Sourcing here is defensive: the two source sites above are both conditional,
+# so by this point the function may or may not exist.
+if [ -f .claude/hooks/yaml-helper.sh ] && ! command -v resolve_code_root >/dev/null 2>&1; then
+ . .claude/hooks/yaml-helper.sh 2>/dev/null
+fi
+if command -v resolve_code_root >/dev/null 2>&1; then
+ CODE_ROOT=$(resolve_code_root 2>/dev/null | cut -f1)
+else
+ CODE_ROOT=""
+fi
+if [ -n "$CODE_ROOT" ] && [ -d "$CODE_ROOT" ]; then
+ TODO_COUNT=$(grep -r "TODO" "$CODE_ROOT/" 2>/dev/null | wc -l)
+ FIXME_COUNT=$(grep -r "FIXME" "$CODE_ROOT/" 2>/dev/null | wc -l)
if [ "$TODO_COUNT" -gt 0 ] || [ "$FIXME_COUNT" -gt 0 ]; then
echo ""
- echo "Code health: ${TODO_COUNT} TODOs, ${FIXME_COUNT} FIXMEs in src/"
+ echo "Code health: ${TODO_COUNT} TODOs, ${FIXME_COUNT} FIXMEs in ${CODE_ROOT}/"
fi
fi
# --- Active session state recovery ---
+# Only THIS block is gated by features.session_state, not the whole hook: the
+# sprint/milestone/git context above is not part of the session-state pipeline
+# and a user who turns that pipeline off still wants it. Gating the whole hook
+# (as the original spec's "exit early at the top" wording implies) would take
+# the branch and stage context away with it.
+#
+# Fail OPEN: this hook only sources yaml-helper.sh conditionally, so
+# session_state_enabled may be undefined. An undefined function is falsey, which
+# would silently suppress the recovery checkpoint -- the one piece of output
+# whose absence the user cannot notice. Show the state unless we positively
+# determined the flag is off.
STATE_FILE="production/session-state/active.md"
-if [ -f "$STATE_FILE" ]; then
+if [ -f .claude/hooks/yaml-helper.sh ] && ! command -v session_state_enabled >/dev/null 2>&1; then
+ . .claude/hooks/yaml-helper.sh
+fi
+if [ -f "$STATE_FILE" ] && { ! command -v session_state_enabled >/dev/null 2>&1 || session_state_enabled; }; then
echo ""
echo "=== ACTIVE SESSION STATE DETECTED ==="
echo "A previous session left state at: $STATE_FILE"
echo "Read this file to recover context and continue where you left off."
echo ""
- echo "Quick summary (last 20 lines):"
- tail -20 "$STATE_FILE" 2>/dev/null
- TOTAL_LINES=$(wc -l < "$STATE_FILE" 2>/dev/null)
- if [ "$TOTAL_LINES" -gt 20 ]; then
+ # The CHECKPOINT region -- the same region pre-compact.sh injects.
+ #
+ # Previewing `tail -20` here while pre-compact takes `head -100` would put two
+ # consumers on opposite ends of one file, so which slice you got would
+ # depend on which hook happened to fire. Neither was wrong, because
+ # nothing defined where the recoverable state lived. The schema in
+ # .claude/docs/templates/session-state.md defines it; both read it now.
+ CHECKPOINT=$(sed -n '/<!-- CHECKPOINT -->/,/<!-- \/CHECKPOINT -->/p' "$STATE_FILE" 2>/dev/null \
+ | grep -v '<!-- /\?CHECKPOINT -->')
+ TOTAL_LINES=$(wc -l < "$STATE_FILE" 2>/dev/null | tr -d ' ')
+ # A sed range whose END address never matches runs to EOF. So a file with an
+ # opening marker and NO closing one produced a non-empty capture of the whole
+ # remaining file and took the healthy branch below -- silently previewing
+ # narrative under a "Checkpoint:" heading, with no warning and no template
+ # named. Emptiness cannot distinguish "no block" from
+ # "unterminated block"; only the markers can, so test them directly.
+ # rotate-session-state.sh already checks the CLOSING marker and refuses.
+ # Two consumers of one region must agree on what malformed means.
+ # `<!-- CHECKPOINT -->` cannot match `<!-- /CHECKPOINT -->` -- the slash sits
+ # where the space would be -- so these two counts are independent.
+ CP_OPEN=$(grep -c '<!-- CHECKPOINT -->' "$STATE_FILE" 2>/dev/null | tr -d ' ')
+ CP_CLOSE=$(grep -c '<!-- /CHECKPOINT -->' "$STATE_FILE" 2>/dev/null | tr -d ' ')
+ if [ "${CP_OPEN:-0}" -gt 0 ] && [ "${CP_CLOSE:-0}" -eq 0 ]; then
+ echo " [!] CHECKPOINT block is not terminated — no <!-- /CHECKPOINT --> marker."
+ echo " Not previewing it: without the closing marker the checkpoint"
+ echo " cannot be told from the narrative, and everything to the end"
+ echo " of the file would be shown as if it were recoverable state."
+ echo " Re-create from .claude/docs/templates/session-state.md."
echo " ... ($TOTAL_LINES total lines — read the full file to continue)"
+ elif [ -n "$CHECKPOINT" ]; then
+ echo "Checkpoint:"
+ printf '%s\n' "$CHECKPOINT"
+ echo " ... ($TOTAL_LINES total lines — read the full file for detail)"
+ else
+ echo "Quick summary (first 20 lines — no CHECKPOINT block in this file):"
+ head -20 "$STATE_FILE" 2>/dev/null
+ echo " ... ($TOTAL_LINES total lines — read the full file to continue)"
+ echo " NOTE: re-create from .claude/docs/templates/session-state.md so"
+ echo " recovery reads a bounded checkpoint instead of a slice."
+ fi
+ # Rotation is an OBSERVATION, never an action: helpers in .claude/scripts/
+ # emit observations, never verdicts (CLAUDE.md). The user decides.
+ if [ "${TOTAL_LINES:-0}" -gt 200 ] 2>/dev/null; then
+ echo " Note: $TOTAL_LINES lines. Narrative can be rotated into"
+ echo " production/session-logs/ — bash .claude/scripts/rotate-session-state.sh"
fi
echo "=== END SESSION STATE PREVIEW ==="
fi
+# --- engine reference vs configured engine -----------------------------------
+# /setup-engine is the only thing that rewrites CLAUDE.md's ENGINE-REFERENCE-IMPORT
+# line. Edit engine.name in project.yaml by hand and the import keeps loading the
+# previous engine's reference as project instructions -- every session, silently.
+# An OBSERVATION, never an action (CLAUDE.md): it reports, the user decides.
+if [ -f project.yaml ] && [ -f CLAUDE.md ]; then
+ ERI=$(grep -m1 -E '^@docs/engine-reference/[a-z]+/VERSION\.md' CLAUDE.md 2>/dev/null \
+ | sed -n 's|^@docs/engine-reference/\([a-z]*\)/VERSION\.md.*|\1|p')
+ CFG=$(sed -n 's/^[[:space:]]*name:[[:space:]]*"\{0,1\}\([A-Za-z]*\)"\{0,1\}[[:space:]]*$/\1/p' \
+ project.yaml 2>/dev/null | head -1 | tr '[:upper:]' '[:lower:]')
+ if [ -n "$ERI" ] && [ -n "$CFG" ] && [ "$ERI" != "$CFG" ]; then
+ echo ""
+ echo "!! ENGINE REFERENCE MISMATCH"
+ echo " project.yaml engine.name : $CFG"
+ echo " CLAUDE.md imports : docs/engine-reference/$ERI/VERSION.md"
+ echo " Every session is loading the $ERI reference on a $CFG project."
+ echo " Fix: re-run /setup-engine, or edit the ENGINE-REFERENCE-IMPORT line."
+ fi
+fi
+
echo "==================================="
exit 0
diff --git a/.claude/hooks/session-stop.sh b/.claude/hooks/session-stop.sh
index 2b78ac25..d681a60f 100644
--- a/.claude/hooks/session-stop.sh
+++ b/.claude/hooks/session-stop.sh
@@ -1,7 +1,42 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code Stop hook: Log session summary when Claude finishes
# Records what was worked on for audit trail and sprint tracking
+# features.session_state: off => this hook is a no-op. Default `on`; see
+# session_state_enabled() in yaml-helper.sh.
+if [ -f .claude/hooks/yaml-helper.sh ]; then
+ . .claude/hooks/yaml-helper.sh
+ session_state_enabled || exit 0
+fi
+
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
SESSION_LOG_DIR="production/session-logs"
@@ -14,30 +49,123 @@ MODIFIED_FILES=$(git diff --name-only 2>/dev/null)
# --- Archive active session state on shutdown (do NOT delete) ---
# active.md persists across clean exits so multi-session recovery works.
# It is only valid to delete active.md manually or when explicitly superseded.
+# APPEND ONLY WHEN THE CONTENT CHANGED.
+#
+# The Stop hook fires once per RESPONSE, not once per session. Both blocks below
+# appended unconditionally, so a long session wrote the whole of active.md on
+# every turn. Measured on this repository before this guard:
+#
+# 3,187 Stop firings, 665 archived copies, session-log.md at 17.5 MB
+#
+# and session-logs/ is gitignored, so nothing ever surfaced it. The growth
+# compounds: the larger active.md gets, the more each firing appends -- and
+# rotate-session-state.sh caps active.md precisely because it grows, while the
+# log accumulating full copies of it had no cap at all.
+#
+# Content hash, not mtime: an editor that rewrites a file unchanged would
+# otherwise re-archive it. Same reasoning and same tool as review-receipts.sh --
+# git hash-object is content-addressed and git is already called above.
+#
+# A hash that cannot be computed archives ANYWAY. For an audit trail the safe
+# failure direction is a duplicate entry, never a lost one.
STATE_FILE="production/session-state/active.md"
+STATE_HASH_FILE="$SESSION_LOG_DIR/.active-state.hash"
if [ -f "$STATE_FILE" ]; then
- {
- echo "## Archived Session State: $TIMESTAMP"
- cat "$STATE_FILE"
- echo "---"
- echo ""
- } >> "$SESSION_LOG_DIR/session-log.md" 2>/dev/null
+ STATE_HASH=$(git hash-object -- "$STATE_FILE" 2>/dev/null)
+ if [ -z "$STATE_HASH" ] || [ "$STATE_HASH" != "$(cat "$STATE_HASH_FILE" 2>/dev/null)" ]; then
+ {
+ echo "## Archived Session State: $TIMESTAMP"
+ cat "$STATE_FILE"
+ echo "---"
+ echo ""
+ } >> "$SESSION_LOG_DIR/session-log.md" 2>/dev/null
+ [ -n "$STATE_HASH" ] && printf '%s\n' "$STATE_HASH" > "$STATE_HASH_FILE" 2>/dev/null
+ fi
fi
+SUMMARY_HASH_FILE="$SESSION_LOG_DIR/.session-end.hash"
if [ -n "$RECENT_COMMITS" ] || [ -n "$MODIFIED_FILES" ]; then
- {
- echo "## Session End: $TIMESTAMP"
- if [ -n "$RECENT_COMMITS" ]; then
- echo "### Commits"
- echo "$RECENT_COMMITS"
- fi
- if [ -n "$MODIFIED_FILES" ]; then
- echo "### Uncommitted Changes"
- echo "$MODIFIED_FILES"
+ # Hash the CONTENT, not the rendered block: the block carries $TIMESTAMP,
+ # which differs every firing and would defeat the comparison entirely.
+ SUMMARY_HASH=$(printf '%s\n---\n%s' "$RECENT_COMMITS" "$MODIFIED_FILES" \
+ | git hash-object --stdin 2>/dev/null)
+ if [ -z "$SUMMARY_HASH" ] || [ "$SUMMARY_HASH" != "$(cat "$SUMMARY_HASH_FILE" 2>/dev/null)" ]; then
+ {
+ echo "## Session End: $TIMESTAMP"
+ if [ -n "$RECENT_COMMITS" ]; then
+ echo "### Commits"
+ echo "$RECENT_COMMITS"
+ fi
+ if [ -n "$MODIFIED_FILES" ]; then
+ echo "### Uncommitted Changes"
+ echo "$MODIFIED_FILES"
+ fi
+ echo "---"
+ echo ""
+ } >> "$SESSION_LOG_DIR/session-log.md" 2>/dev/null
+ [ -n "$SUMMARY_HASH" ] && printf '%s\n' "$SUMMARY_HASH" > "$SUMMARY_HASH_FILE" 2>/dev/null
+ fi
+fi
+
+# --- Subagent spawn tally (cost visibility) ---
+# log-agent.sh has always written per-spawn records that nothing read, so the
+# framework's dominant cost was invisible to the user. This turns those records
+# into a running count.
+#
+# Ordering matters: everything above runs BEFORE stdin is touched. Stop hooks
+# are piped JSON, but if stdin were ever absent the read would block until the
+# 10s timeout killed the hook -- and the state archive above must not be lost
+# to that. Read last, fail silent.
+AUDIT_LOG="$SESSION_LOG_DIR/agent-audit.log"
+
+if [ ! -t 0 ] && [ -f "$AUDIT_LOG" ]; then
+ if command -v timeout >/dev/null 2>&1; then
+ INPUT=$(timeout 2 cat 2>/dev/null)
+ else
+ INPUT=$(cat 2>/dev/null)
+ fi
+
+ if command -v jq >/dev/null 2>&1; then
+ SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // ""' 2>/dev/null)
+ else
+ SESSION_ID=$(echo "$INPUT" | grep -oE '"session_id"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"session_id"[[:space:]]*:[[:space:]]*"//;s/"$//')
+ fi
+
+ # No session id means no honest per-session number. Report nothing rather
+ # than a total that silently spans every session in the log.
+ if [ -n "$SESSION_ID" ] && [ "$SESSION_ID" != "unknown" ] && [ "$SESSION_ID" != "null" ]; then
+ SPAWN_LINES=$(grep -F " | $SESSION_ID | Agent invoked: " "$AUDIT_LOG" 2>/dev/null)
+ SPAWN_COUNT=$(printf '%s' "$SPAWN_LINES" | grep -c . 2>/dev/null)
+ [ -z "$SPAWN_COUNT" ] && SPAWN_COUNT=0
+
+ if [ "$SPAWN_COUNT" -gt 0 ]; then
+ BREAKDOWN=$(printf '%s\n' "$SPAWN_LINES" \
+ | sed 's/.*Agent invoked: //' \
+ | sort | uniq -c | sort -rn)
+
+ {
+ echo "# Session Subagent Cost"
+ echo ""
+ echo "**Session:** \`$SESSION_ID\` "
+ echo "**Updated:** $TIMESTAMP"
+ echo ""
+ echo "Subagent spawns this session: **$SPAWN_COUNT**"
+ echo ""
+ echo "| Agent | Spawns |"
+ echo "|-------|--------|"
+ printf '%s\n' "$BREAKDOWN" | while read -r count name; do
+ [ -z "$name" ] && continue
+ echo "| $name | $count |"
+ done
+ echo ""
+ echo "Each spawn is a fresh context window that re-reads its own inputs."
+ echo "To reduce this: lower \`modes.review_mode\` (\`/settings modes.review_mode=solo\`)"
+ echo "or \`modes.rigor\` (\`/settings modes.rigor=minimal\`)."
+ } > "$SESSION_LOG_DIR/session-cost.md" 2>/dev/null
+
+ echo "Subagent spawns this session: $SPAWN_COUNT (see production/session-logs/session-cost.md)"
fi
- echo "---"
- echo ""
- } >> "$SESSION_LOG_DIR/session-log.md" 2>/dev/null
+ fi
fi
exit 0
diff --git a/.claude/hooks/validate-assets.sh b/.claude/hooks/validate-assets.sh
index 44685241..c4525ef4 100644
--- a/.claude/hooks/validate-assets.sh
+++ b/.claude/hooks/validate-assets.sh
@@ -1,10 +1,48 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code PostToolUse hook: Validates asset files after Write/Edit
# Checks naming conventions for files in assets/ directory
#
# Exit behavior:
-# exit 0 = success or advisory warnings only (non-blocking)
-# exit 1 = blocking error (build-breaking issues: invalid JSON, missing required fields)
+# exit 0 = success or advisory warnings only
+# exit 2 = build-breaking issue (invalid JSON, missing required fields)
+#
+# A PostToolUse hook CANNOT block -- the write has already happened by the time
+# this runs (see .claude/docs/hooks-reference/hook-input-schemas.md). The only
+# question is who hears about it, and that is what the exit code selects:
+# exit 1 -> stderr goes to the USER only. Claude never sees it, so a JSON file
+# it just corrupted looks like it wrote cleanly and it moves on.
+# exit 2 -> stderr is fed back to CLAUDE as actionable feedback, so it can fix
+# the file it just wrote.
+# Exiting 1 while printing "ERRORS (Blocking) ... fix before proceeding" would be
+# a promise the hook cannot keep, delivered to the one party who cannot act on it.
#
# Input schema (PostToolUse for Write/Edit):
# { "tool_name": "Write", "tool_input": { "file_path": "assets/data/foo.json", "content": "..." } }
@@ -15,11 +53,16 @@ INPUT=$(cat)
if command -v jq >/dev/null 2>&1; then
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
else
- FILE_PATH=$(echo "$INPUT" | grep -oE '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"file_path"[[:space:]]*:[[:space:]]*"//;s/"$//')
+ FILE_PATH=$(echo "$INPUT" | grep -oE '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"file_path"[[:space:]]*:[[:space:]]*"//;s/"$//')
fi
-# Normalize path separators (Windows backslash to forward slash)
-FILE_PATH=$(echo "$FILE_PATH" | sed 's|\\|/|g')
+# Normalize path separators (Windows backslash to forward slash).
+# Two rules, order significant -- see the long note in validate-skill-change.sh.
+# Short version: hook input is JSON, so a Windows path arrives as `\\`. Without
+# jq the fallback cannot unescape it, and a single-rule sed turns each escaped
+# pair into two slashes, so `assets/` never matches and this hook silently
+# validates nothing on Windows.
+FILE_PATH=$(printf '%s' "$FILE_PATH" | sed 's|\\\\|/|g; s|\\|/|g')
# Only check files in assets/
if ! echo "$FILE_PATH" | grep -qE '(^|/)assets/'; then
@@ -54,6 +97,13 @@ if echo "$FILE_PATH" | grep -qE '(^|/)assets/data/.*\.json$'; then
if ! "$PYTHON_CMD" -m json.tool "$FILE_PATH" > /dev/null 2>&1; then
ERRORS="$ERRORS\n FORMAT: $FILE_PATH is not valid JSON — fix syntax errors before continuing"
fi
+ else
+ # Say so rather than skipping in silence. This is the only BLOCKING
+ # check in this hook, so without an interpreter the hook exits 0 on
+ # a file it never opened -- indistinguishable from valid JSON. The
+ # sibling validate-commit.sh already warns in exactly this case;
+ # this half was the one that did not.
+ echo "WARNING: Cannot validate JSON (python not found) — $FILE_PATH unchecked" >&2
fi
fi
fi
@@ -63,10 +113,11 @@ if [ -n "$WARNINGS" ]; then
echo -e "=== Asset Validation: Warnings ===$WARNINGS\n==================================\n(Warnings are advisory. Fix before final commit.)" >&2
fi
-# Report errors and block if any build-breaking issues found
+# Report build-breaking issues. exit 2 routes this to Claude, not just the user,
+# so the file that was already written can actually be corrected.
if [ -n "$ERRORS" ]; then
- echo -e "=== Asset Validation: ERRORS (Blocking) ===$ERRORS\n===========================================\nFix these errors before proceeding." >&2
- exit 1
+ echo -e "=== Asset Validation: ERRORS ===$ERRORS\n================================\nThe file was written but is broken. Fix it now, before continuing." >&2
+ exit 2
fi
exit 0
diff --git a/.claude/hooks/validate-commit.sh b/.claude/hooks/validate-commit.sh
index 530b4337..b7a2abc9 100644
--- a/.claude/hooks/validate-commit.sh
+++ b/.claude/hooks/validate-commit.sh
@@ -1,4 +1,32 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code PreToolUse hook: Validates git commit commands
# Receives JSON on stdin with tool_input.command
# Exit 0 = allow, Exit 2 = block (stderr shown to Claude)
@@ -12,7 +40,7 @@ INPUT=$(cat)
if command -v jq >/dev/null 2>&1; then
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
else
- COMMAND=$(echo "$INPUT" | grep -oE '"command"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"command"[[:space:]]*:[[:space:]]*"//;s/"$//')
+ COMMAND=$(echo "$INPUT" | grep -oE '"command"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"command"[[:space:]]*:[[:space:]]*"//;s/"$//')
fi
# Only process git commit commands
@@ -20,6 +48,14 @@ if ! echo "$COMMAND" | grep -qE '^git[[:space:]]+commit'; then
exit 0
fi
+# Resolve a Python interpreter ONCE for every batched check below. Both the
+# blocking JSON scan and the advisory design scan must not spawn one process per
+# item; they spawn one each, and share this lookup.
+_VC_PY=""
+for _c in python python3 py; do
+ if command -v "$_c" >/dev/null 2>&1; then _VC_PY="$_c"; break; fi
+done
+
# Get staged files
STAGED=$(git diff --cached --name-only 2>/dev/null)
if [ -z "$STAGED" ]; then
@@ -28,69 +64,266 @@ fi
WARNINGS=""
-# Check design documents for required sections
-DESIGN_FILES=$(echo "$STAGED" | grep -E '^design/gdd/')
-if [ -n "$DESIGN_FILES" ]; then
- while IFS= read -r file; do
- if [[ "$file" == *.md ]] && [ -f "$file" ]; then
- for section in "Overview" "Player Fantasy" "Detailed" "Formulas" "Edge Cases" "Dependencies" "Tuning Knobs" "Acceptance Criteria"; do
- if ! grep -qi "$section" "$file"; then
- WARNINGS="$WARNINGS\nDESIGN: $file missing required section: $section"
- fi
- done
- fi
- done <<< "$DESIGN_FILES"
-fi
+# Section findings are collected through a file, not a variable: the loops below
+# run inside pipelines, and a subshell cannot assign to WARNINGS in the parent.
+# The scratch file must actually be WRITABLE, and that has to be tested rather
+# than assumed. `mktemp` and the `${TMPDIR:-/tmp}` fallback beside it both aim
+# at /tmp, which does not exist or is not writable in several environments this
+# hook runs in -- notably sandboxed Windows shells. When the redirect failed,
+# `[ -s "$TMP_DESIGN" ]` was false, the design-section scan emitted nothing, and
+# the hook exited 0: a check that could not run, reporting clean.
+#
+# So: try mktemp, then TMPDIR, then the repo own .git directory (writable by
+# definition -- `git diff --cached` has already succeeded against it), and PROVE
+# each candidate by writing to it. If none works, TMP_DESIGN stays empty and the
+# scan announces that it did not run instead of skipping in silence.
+TMP_DESIGN=""
+for _cand in "$(mktemp 2>/dev/null)" "${TMPDIR:+$TMPDIR/ccgs-commit-$$}" \
+ "$(git rev-parse --git-dir 2>/dev/null)/ccgs-commit-$$"; do
+ [ -z "$_cand" ] && continue
+ if : > "$_cand" 2>/dev/null; then TMP_DESIGN="$_cand"; break; fi
+done
+trap '[ -n "$TMP_DESIGN" ] && rm -f "$TMP_DESIGN"' EXIT
-# Validate JSON data files -- block invalid JSON
+# ---------------------------------------------------------------------------
+# BLOCKING CHECK FIRST. Everything below this block is advisory:
+# it appends to $WARNINGS and the hook still exits 0. This block is the only one
+# that can exit 2, and exit 2 is the entire reason the hook is registered.
+#
+# Running it THIRD, after the design-section scan, and validating one file
+# per `python -m json.tool` invocation -- one interpreter spawn each, ~110ms on
+# Windows -- gets the hook killed by its 15s timeout on a large commit before
+# it reaches the corrupt file, so whether a bad file is caught depends on where
+# its NAME SORTED. Measured with 201 staged files and one corrupt:
+#
+# corrupt sorts FIRST -> 730ms, rc=2, BLOCKED emitted
+# corrupt sorts LAST -> 15217ms, rc=124, nothing emitted, commit not blocked
+#
+# Two independent fixes, because either alone is a mitigation rather than a
+# guarantee:
+# (a) ORDER. The blocking check runs before any advisory work, so a starved
+# hook has already done the part that matters.
+# (b) COST. One interpreter validates every staged JSON file, so the check is
+# constant in file count instead of linear. The one-subprocess-per-item
+# shape has caused this same starvation more than once; batching is the
+# only fix that holds.
+#
+# Making it merely faster is not enough -- the cost stays linear and the hook
+# starves again at a larger file count. Batch it, or it returns.
+# ---------------------------------------------------------------------------
DATA_FILES=$(echo "$STAGED" | grep -E '^assets/data/.*\.json$')
if [ -n "$DATA_FILES" ]; then
- # Find a working Python command
- PYTHON_CMD=""
- for cmd in python python3 py; do
- if command -v "$cmd" >/dev/null 2>&1; then
- PYTHON_CMD="$cmd"
- break
+ PYTHON_CMD="$_VC_PY"
+ if [ -n "$PYTHON_CMD" ]; then
+ # One spawn, all files. The file list arrives on stdin so an unbounded
+ # number of paths cannot overflow the argument limit.
+ BAD_JSON=$(printf '%s\n' "$DATA_FILES" | "$PYTHON_CMD" -c '
+import json, sys, os
+bad = []
+for line in sys.stdin.read().splitlines():
+ path = line.strip()
+ if not path or not os.path.isfile(path):
+ continue
+ try:
+ with open(path, "r", encoding="utf-8-sig") as fh:
+ json.load(fh)
+ except Exception:
+ bad.append(path)
+# Bytes, not text. Python text-mode stdout on Windows rewrites \n as \r\n,
+# putting a CR inside every path but the last. Invisible in a terminal and in
+# a line-by-line diff -- only a byte comparison against the pre-batch
+# implementation surfaced it. get_yaml_key writes bytes for the same reason.
+sys.stdout.buffer.write("\n".join(bad).encode("utf-8"))
+' 2>/dev/null)
+ if [ -n "$BAD_JSON" ]; then
+ # Every offender at once. The per-file loop reported only the first
+ # and exited, so a commit with several bad files took several
+ # round-trips to clean up.
+ echo "$BAD_JSON" | while IFS= read -r bad; do
+ [ -n "$bad" ] && echo "BLOCKED: $bad is not valid JSON" >&2
+ done
+ exit 2
fi
- done
-
- while IFS= read -r file; do
- if [ -f "$file" ]; then
- if [ -n "$PYTHON_CMD" ]; then
- if ! "$PYTHON_CMD" -m json.tool "$file" > /dev/null 2>&1; then
- echo "BLOCKED: $file is not valid JSON" >&2
- exit 2
- fi
- else
- echo "WARNING: Cannot validate JSON (python not found): $file" >&2
- fi
+ else
+ echo "WARNING: Cannot validate JSON (python not found)" >&2
+ fi
+fi
+
+# Check design documents for the sections REQUIRED AT THIS PROJECT'S TIER.
+#
+# Demanding all 8 sections unconditionally would contradict
+# .claude/docs/coding-standards.md and workflow-modes.md: the required count is
+# a function of `modes.workflow` -- 8 at `full`, 5 (+ conditional Formulas) at
+# `standard`, and no GDD requirement at all at `minimal`. A jam project on the
+# recommended `minimal` tier was being warned about six sections its own
+# configuration says it does not need, which trains the user to ignore the hook.
+# Source the config helper ONCE, ahead of every consumer below. It was
+# previously sourced inside the design-doc branch, so the code scans further
+# down -- which now need resolve_code_root -- could not reach it on a commit
+# that staged no GDD.
+# Detect success by asking whether the function EXISTS, not by the source's exit
+# status. A sourced file returns the status of its last statement, which here is
+# incidental -- gating on it left _VC_HELPER at 0 on a perfectly good source, the
+# workflow tier silently stayed at its "standard" fallback, and the GDD section
+# check stopped scaling with the tier (caught by test LL.9).
+_VC_HELPER=0
+if [ -f .claude/hooks/yaml-helper.sh ]; then
+ . .claude/hooks/yaml-helper.sh 2>/dev/null || true
+ command -v resolve_setting >/dev/null 2>&1 && _VC_HELPER=1
+fi
+
+DESIGN_FILES=$(echo "$STAGED" | grep -E '^design/gdd/')
+if [ -n "$DESIGN_FILES" ]; then
+ WORKFLOW="standard"
+ if [ "$_VC_HELPER" = 1 ]; then
+ W=$(resolve_setting modes.workflow 2>/dev/null | cut -f1)
+ [ -n "$W" ] && WORKFLOW="$W"
+ fi
+
+ # "Detailed" (not "Detailed Rules") because the canonical heading has a
+ # documented alias, "Detailed Design" -- workflow-modes.md says not to treat
+ # one as missing when the other is present.
+ case "$WORKFLOW" in
+ minimal) REQUIRED="" ;;
+ full) REQUIRED="Overview|Player Fantasy|Detailed|Formulas|Edge Cases|Dependencies|Tuning Knobs|Acceptance Criteria" ;;
+ *) REQUIRED="Overview|Detailed|Edge Cases|Dependencies|Acceptance Criteria" ;;
+ esac
+
+ if [ -n "$REQUIRED" ]; then
+ # One pass for every file x section pair.
+ #
+ # A nested shell loop -- for each staged design doc, `echo |
+ # tr | while read` then one `grep -qi` per required section -- does not
+ # scale. At
+ # workflow=full that is 8 greps per file, and each is a process. 50
+ # design docs measured 14644ms -- 97% of this hook's 15s budget, from
+ # the ADVISORY half alone. 50 GDDs is an ordinary project, not a
+ # stress case.
+ #
+ # Matching is unchanged on purpose: case-insensitive SUBSTRING anywhere
+ # in the file, exactly what `grep -qi "$section"` did. It is looser than
+ # a heading check, and tightening it here would silently change which
+ # documents warn -- a behaviour change smuggled inside a performance
+ # fix. If that wants tightening it should be its own change with its
+ # own test.
+ printf '%s\n' "$DESIGN_FILES" | "${_VC_PY:-python}" -c '
+import sys, os
+argv = sys.argv
+required = [x for x in argv[1].split("|") if x]
+workflow = argv[2]
+out = []
+for line in sys.stdin.read().splitlines():
+ path = line.strip()
+ if not path or not path.endswith(".md") or not os.path.isfile(path):
+ continue
+ try:
+ with open(path, "r", encoding="utf-8", errors="replace") as fh:
+ body = fh.read().lower()
+ except OSError:
+ continue
+ for section in required:
+ if section.lower() not in body:
+ out.append("DESIGN: %s missing section required at workflow=%s: %s"
+ % (path, workflow, section))
+if out:
+ # Bytes, not text -- see the CRLF note in the JSON scan above.
+ sys.stdout.buffer.write(("\n".join(out) + "\n").encode("utf-8"))
+' "$REQUIRED" "$WORKFLOW" > "$TMP_DESIGN" 2>/dev/null
+ if [ -z "$TMP_DESIGN" ]; then
+ # Obligation 3 of .claude/rules/skill-authoring.md: a skipped step
+ # announces itself. Silence here is indistinguishable from a GDD
+ # that already has every section its tier requires.
+ WARNINGS="$WARNINGS\nSKIPPED: no writable scratch location, so the GDD section check did NOT run on the staged design doc(s)."
+ elif [ -s "$TMP_DESIGN" ]; then
+ WARNINGS="$WARNINGS\n$(cat "$TMP_DESIGN")"
fi
- done <<< "$DATA_FILES"
+ fi
fi
# Check for hardcoded gameplay values in gameplay code
# Uses grep -E (POSIX extended) instead of grep -P (Perl) for cross-platform compatibility
-CODE_FILES=$(echo "$STAGED" | grep -E '^src/gameplay/')
+#
+# Batched through xargs. Run one `grep` per staged file -- a process each,
+# ~60ms on Windows -- and 400 staged gameplay files blow a 15s budget on their
+# own. `xargs` packs as many
+# paths into each grep as ARG_MAX allows, so the spawn count is bounded by total
+# path length rather than by file count.
+#
+# `-l` not `-q`: with many files per invocation the exit status can no longer
+# say WHICH matched, and the warning names the file. It stays a test, not a
+# report -- `-l` prints only names, never matched lines, which is what the -q
+# comment here was guarding against.
+#
+# NUL-delimited, NOT `-d '\n'`: both `-d` and `-r` are GNU-only extensions.
+# BSD xargs (macOS) rejects `-d`, and because this pipeline ends in
+# `2>/dev/null || true` the rejection is SILENT -- the check returns empty and
+# reports nothing found, which is indistinguishable from a clean scan. README
+# claims these hooks run on macOS, so a silent no-op there is a false pass.
+# `-0` exists in both GNU and BSD xargs. `-r` is dropped, not replaced: both
+# callers below reach xargs only inside `if [ -n ... ]`, so the empty-input case
+# it guarded cannot occur. `|| true` stays -- grep exits 1 on no match, which is
+# the normal case and not an error.
+# --- resolve the code root before either scan below ------------------------
+#
+# Both scans used to be hardcoded to `^src/gameplay/` and `^src/`. Per
+# .claude/docs/directory-structure.md, `src/` is the GODOT row of the code-root
+# table -- Unity compiles only `Assets/`, Unreal builds only from `Source/`. So
+# on two of the three supported engines both greps matched nothing on every
+# commit, both checks silently did not run, and the hook exited 0. A scan that
+# cannot run and a scan that found nothing produced the identical artifact.
+#
+# The `/gameplay/` narrowing is dropped rather than translated: it describes a
+# Godot source layout and has no Unity or Unreal equivalent, so keeping it would
+# leave the check Godot-only by a second route. The hardcoded-value scan instead
+# widens to the whole code root and is bounded by source-code EXTENSION, which
+# is what actually keeps it precise -- without it, a Unity commit would drag
+# `.meta`, `.asset` and `.prefab` YAML (all full of `speed: 5`) into a scan
+# meant for code, and a hook that cries wolf gets muted rather than fixed.
+CODE_ROOT=""; CODE_ROOT_SRC="unset"
+if [ "$_VC_HELPER" = 1 ]; then
+ _CR=$(resolve_code_root 2>/dev/null)
+ CODE_ROOT=$(printf '%s' "$_CR" | cut -f1)
+ CODE_ROOT_SRC=$(printf '%s' "$_CR" | cut -f2)
+fi
+
+# Obligation 3 of .claude/rules/skill-authoring.md -- a skipped step announces
+# itself. Only fires when source code is actually being committed, so a
+# docs-only or config-only commit stays quiet and the notice keeps its meaning.
+if [ -z "$CODE_ROOT" ]; then
+ if echo "$STAGED" | grep -qiE '\.(gd|cs|cpp|cc|hpp|h|c|py|js|ts|rs|java|kt|lua|gdshader|shader|hlsl)$'; then
+ WARNINGS="$WARNINGS\nSKIPPED: source files are staged but no code root could be resolved (engine.name unset, and the tree does not name one unambiguously). The hardcoded-value and TODO-owner scans did NOT run. Run /setup-engine, or set engine.name in project.yaml."
+ fi
+fi
+
+CODE_FILES=""
+[ -n "$CODE_ROOT" ] && CODE_FILES=$(echo "$STAGED" \
+ | grep -E "^${CODE_ROOT}/" \
+ | grep -iE '\.(gd|cs|cpp|cc|hpp|h|c|py|js|ts|rs|java|kt|lua)$')
if [ -n "$CODE_FILES" ]; then
- while IFS= read -r file; do
- if [ -f "$file" ]; then
- if grep -nE '(damage|health|speed|rate|chance|cost|duration)[[:space:]]*[:=][[:space:]]*[0-9]+' "$file" 2>/dev/null; then
- WARNINGS="$WARNINGS\nCODE: $file may contain hardcoded gameplay values. Use data files."
- fi
- fi
- done <<< "$CODE_FILES"
+ HARDCODED=$(printf '%s\n' "$CODE_FILES" | tr '\n' '\0' \
+ | xargs -0 grep -lE '(damage|health|speed|rate|chance|cost|duration)[[:space:]]*[:=][[:space:]]*[0-9]+' 2>/dev/null || true)
+ if [ -n "$HARDCODED" ]; then
+ while IFS= read -r file; do
+ [ -n "$file" ] && WARNINGS="$WARNINGS\nCODE: $file may contain hardcoded gameplay values. Use data files."
+ done <<< "$HARDCODED"
+ fi
fi
# Check for TODO/FIXME without assignee -- uses grep -E instead of grep -P
-SRC_FILES=$(echo "$STAGED" | grep -E '^src/')
+# Same code root as the scan above. Not extension-bounded: an unowned TODO is
+# worth flagging in a shader or a build script too, and this scan greps for a
+# literal marker rather than a numeric pattern, so it does not misfire on
+# serialized asset YAML the way the hardcoded-value scan would.
+SRC_FILES=""
+[ -n "$CODE_ROOT" ] && SRC_FILES=$(echo "$STAGED" | grep -E "^${CODE_ROOT}/")
if [ -n "$SRC_FILES" ]; then
- while IFS= read -r file; do
- if [ -f "$file" ]; then
- if grep -nE '(TODO|FIXME|HACK)[^(]' "$file" 2>/dev/null; then
- WARNINGS="$WARNINGS\nSTYLE: $file has TODO/FIXME without owner tag. Use TODO(name) format."
- fi
- fi
- done <<< "$SRC_FILES"
+ UNOWNED=$(printf '%s\n' "$SRC_FILES" | tr '\n' '\0' \
+ | xargs -0 grep -lE '(TODO|FIXME|HACK)[^(]' 2>/dev/null || true)
+ if [ -n "$UNOWNED" ]; then
+ while IFS= read -r file; do
+ [ -n "$file" ] && WARNINGS="$WARNINGS\nSTYLE: $file has TODO/FIXME without owner tag. Use TODO(name) format."
+ done <<< "$UNOWNED"
+ fi
fi
# Print warnings (non-blocking) and allow commit
diff --git a/.claude/hooks/validate-push.sh b/.claude/hooks/validate-push.sh
index e9aff2eb..b20d17df 100644
--- a/.claude/hooks/validate-push.sh
+++ b/.claude/hooks/validate-push.sh
@@ -1,4 +1,32 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code PreToolUse hook: Validates git push commands
# Warns on pushes to protected branches
# Exit 0 = allow, Exit 2 = block
@@ -12,7 +40,7 @@ INPUT=$(cat)
if command -v jq >/dev/null 2>&1; then
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
else
- COMMAND=$(echo "$INPUT" | grep -oE '"command"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"command"[[:space:]]*:[[:space:]]*"//;s/"$//')
+ COMMAND=$(echo "$INPUT" | grep -oE '"command"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"command"[[:space:]]*:[[:space:]]*"//;s/"$//')
fi
# Only process git push commands
diff --git a/.claude/hooks/validate-skill-change.sh b/.claude/hooks/validate-skill-change.sh
index 23d657db..2ded3957 100644
--- a/.claude/hooks/validate-skill-change.sh
+++ b/.claude/hooks/validate-skill-change.sh
@@ -1,4 +1,32 @@
#!/bin/bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code PostToolUse hook: Advises running skill-test after skill file changes
# Fires when any file inside .claude/skills/ is written or edited.
#
@@ -14,11 +42,23 @@ INPUT=$(cat)
if command -v jq >/dev/null 2>&1; then
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
else
- FILE_PATH=$(echo "$INPUT" | grep -oE '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"file_path"[[:space:]]*:[[:space:]]*"//;s/"$//')
+ FILE_PATH=$(echo "$INPUT" | grep -oE '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/"file_path"[[:space:]]*:[[:space:]]*"//;s/"$//')
fi
-# Normalize path separators (Windows backslash to forward slash)
-FILE_PATH=$(echo "$FILE_PATH" | sed 's|\\|/|g')
+# Normalize path separators (Windows backslash to forward slash).
+#
+# TWO rules, and the order matters. The hook input is JSON, so a Windows path
+# arrives escaped: "C:\\Users\\x". jq unescapes it to a single backslash, but
+# the grep fallback CANNOT -- it hands back the raw two-character `\\`. A
+# single `s|\\|/|g` then turns each of those into its own slash, producing
+# `.claude//skills//help//SKILL.md`, which no path test below matches. The hook
+# went silent on every Windows edit whenever jq was absent -- and jq is absent
+# on a stock Windows Git Bash, which is this project's primary platform.
+#
+# Rule 1 collapses the escaped pair to one slash; rule 2 handles an already
+# unescaped separator (the jq path, or a POSIX caller). Running both is safe
+# for either input because rule 1 finds nothing to do on unescaped text.
+FILE_PATH=$(printf '%s' "$FILE_PATH" | sed 's|\\\\|/|g; s|\\|/|g')
# Only act on files inside .claude/skills/
if ! echo "$FILE_PATH" | grep -qE '(^|/)\.claude/skills/'; then
diff --git a/.claude/hooks/yaml-helper.sh b/.claude/hooks/yaml-helper.sh
new file mode 100644
index 00000000..9ba8d595
--- /dev/null
+++ b/.claude/hooks/yaml-helper.sh
@@ -0,0 +1,1547 @@
+#!/bin/bash
+# Hook helper: yaml-helper.sh
+# Purpose: Shared YAML reading helper for CCGS hooks and skill orchestrators.
+# Cross-platform: Windows Git Bash compatible.
+#
+# Provides:
+# get_yaml_key <file> <dotted.path>
+# Prints the scalar value at <dotted.path> in <file>, or empty string if:
+# - the file does not exist or is unreadable
+# - the path does not exist in the YAML
+# - the path resolves to a sub-map or array (caller wanted a scalar)
+# - no Python interpreter is available
+# Always exits 0 — callers can safely use it under `set -e`.
+#
+# get_yaml_array <file> <dotted.path>
+# Prints array values one per line. Handles both inline [a, b, c]
+# and block-dash forms (- a / - b on subsequent indented lines).
+# Empty output if not an array, not found, or file missing.
+#
+# get_effective_yaml_key <dotted.path>
+# get_effective_yaml_array <dotted.path>
+# Convenience wrappers that read project.local.yaml first, then
+# fall back to project.yaml. Per-leaf override (local wins) —
+# sibling keys are read independently from their own files, so the
+# effective config has deep-merge semantics across leaves.
+#
+# validate_yaml_enum <file>
+# Validates known enum-typed keys in <file> against their allowed
+# value sets (12 enums hardcoded below). Prints one error line per
+# invalid value to stderr. Returns 1 if any invalid value found,
+# 0 otherwise. Unknown-key (typo) detection is a future sub-phase —
+# enum errors are the critical-path block per the spec.
+#
+# validate_local_yaml_base
+# Hard-error guard per spec: project.local.yaml requires a project.yaml
+# base. Returns 1 with error on stderr if local exists without base.
+# Uses CWD-relative paths.
+#
+# is_locally_overridable <dotted.path>
+# Whitelist check for the /settings --local flag. Returns 0 if the
+# setting is on the personal-experience whitelist (12 settings per
+# effects-map.md), 1 otherwise. Locked settings cannot be locally
+# overridden because they affect on-disk artifacts.
+#
+# validate_enum_value <dotted.path> <value>
+# Single-key version of validate_yaml_enum — for /settings to check
+# a pending write before committing it to disk. Returns 0 if the
+# key has no enum constraint OR the value is in the enum set.
+# Returns 1 (with error on stderr) if the key is enum-typed and the
+# value is out of range. Skills call this before any Write/Edit.
+#
+# is_always_ask_category <category>
+# Membership check on modes.automation_always_ask. Returns 0 if the
+# category is in the configured list (or in the default list when
+# unset), 1 otherwise. Skills use this in autonomous mode to know
+# when to prompt anyway. Default list: scope_changes, file_deletions,
+# schema_changes.
+#
+# log_decision <skill> <point> <options> <chosen> <reason> <category>
+# Append a decision-log entry to production/session-logs/decision-log.md.
+# Creates the file and directory if absent. Used by skills in
+# autonomous mode to record decisions that would otherwise have
+# been AskUserQuestion prompts.
+#
+# Python fallback chain: python -> python3 -> py
+# Parses a YAML subset: nested maps + scalar leaves + arrays + comments
+# + quoted strings. PyYAML is NOT required.
+#
+# Usage:
+# source .claude/hooks/yaml-helper.sh
+# review_mode=$(get_yaml_key "$_YH_ROOT/project.yaml" modes.review_mode)
+# if [ -z "$review_mode" ]; then
+# # fall back to legacy .txt
+# review_mode=$(cat production/review-mode.txt 2>/dev/null || echo lean)
+# fi
+
+# Resolve a working Python interpreter once per shell, cache the result.
+_yaml_helper_python=""
+_yaml_helper_resolve_python() {
+ if [ -n "$_yaml_helper_python" ]; then return 0; fi
+ for candidate in python python3 py; do
+ if command -v "$candidate" >/dev/null 2>&1; then
+ # Require Python 3 — the parser uses py3-only open(encoding=) kwargs.
+ if "$candidate" -c "import sys; sys.exit(0 if sys.version_info[0] >= 3 else 1)" >/dev/null 2>&1; then
+ _yaml_helper_python="$candidate"
+ return 0
+ fi
+ fi
+ done
+ return 1
+}
+
+get_yaml_key() {
+ local file="$1"
+ local path="$2"
+ if [ -z "$file" ] || [ -z "$path" ]; then return 0; fi
+ if [ ! -f "$file" ]; then return 0; fi
+ if ! _yaml_helper_resolve_python; then
+ echo "yaml-helper: no python interpreter found (tried python, python3, py)" >&2
+ return 0
+ fi
+ "$_yaml_helper_python" - "$file" "$path" <<'PYEOF'
+import sys, re
+
+path_file, dotted = sys.argv[1], sys.argv[2]
+keys = dotted.split('.')
+
+def parse(lines):
+ root = {}
+ stack = [(-1, root)] # (indent, mapping)
+ for raw in lines:
+ line = raw.rstrip('\n').rstrip('\r')
+ stripped = line.lstrip(' ')
+ if not stripped.strip() or stripped.lstrip().startswith('#'):
+ continue
+ indent = len(line) - len(stripped)
+ while stack and stack[-1][0] >= indent:
+ stack.pop()
+ if not stack:
+ return root
+ parent = stack[-1][1]
+ m = re.match(r'([^:#\s][^:]*?)\s*:\s*(.*)$', stripped)
+ if not m:
+ continue
+ key = m.group(1).strip()
+ value = m.group(2).strip()
+ # Resolve the scalar: handle comment-only, quoted, and inline-comment forms.
+ if value.startswith('#'):
+ value = ''
+ elif value[:1] in ('"', "'"):
+ quote = value[0]
+ end = value.find(quote, 1)
+ if end >= 0:
+ value = value[1:end] # quoted content; any trailing comment ignored
+ else:
+ value = value[1:] # unterminated quote — take the remainder
+ else:
+ hash_pos = value.find(' #')
+ if hash_pos >= 0:
+ value = value[:hash_pos].strip()
+ if value == '':
+ new_map = {}
+ parent[key] = new_map
+ stack.append((indent, new_map))
+ else:
+ parent[key] = value
+ return root
+
+try:
+ with open(path_file, 'r', encoding='utf-8-sig', errors='replace') as f:
+ data = parse(f.readlines())
+except OSError:
+ sys.exit(0)
+
+cur = data
+for k in keys:
+ if isinstance(cur, dict) and k in cur:
+ cur = cur[k]
+ else:
+ sys.exit(0)
+
+if isinstance(cur, dict):
+ sys.exit(0)
+
+# Write raw UTF-8 bytes — bypasses the platform stdout encoding (cp1252 on
+# Windows) so unicode values round-trip intact.
+sys.stdout.buffer.write(str(cur).encode('utf-8'))
+PYEOF
+}
+
+# -----------------------------------------------------------------------------
+# Array reads, effective (deep-merged) reads, enum validation
+# -----------------------------------------------------------------------------
+
+get_yaml_array() {
+ local file="$1"
+ local path="$2"
+ if [ -z "$file" ] || [ -z "$path" ]; then return 0; fi
+ if [ ! -f "$file" ]; then return 0; fi
+ if ! _yaml_helper_resolve_python; then
+ echo "yaml-helper: no python interpreter found (tried python, python3, py)" >&2
+ return 0
+ fi
+ "$_yaml_helper_python" - "$file" "$path" <<'PYEOF'
+import sys, re
+
+path_file, dotted = sys.argv[1], sys.argv[2]
+keys = dotted.split('.')
+
+# Parser extended to recognize two YAML array forms:
+# key: [a, b, c] (inline)
+# key: (block-dash)
+# - a
+# - b
+# Block-dash detection peeks ahead at indented child lines after a key
+# whose own value is empty; if those children start with "- ", they form
+# an array, otherwise they form a sub-map (existing behavior).
+def parse(lines):
+ root = {}
+ stack = [(-1, root)]
+ i = 0
+ while i < len(lines):
+ raw = lines[i]
+ line = raw.rstrip('\n').rstrip('\r')
+ stripped = line.lstrip(' ')
+ if not stripped.strip() or stripped.lstrip().startswith('#'):
+ i += 1
+ continue
+ indent = len(line) - len(stripped)
+ while stack and stack[-1][0] >= indent:
+ stack.pop()
+ if not stack:
+ return root
+ parent = stack[-1][1]
+ m = re.match(r'([^:#\s][^:]*?)\s*:\s*(.*)$', stripped)
+ if not m:
+ i += 1
+ continue
+ key = m.group(1).strip()
+ value = m.group(2).strip()
+ if value.startswith('#'):
+ value = ''
+ elif value[:1] == '[':
+ # Inline array, scanned with QUOTE AWARENESS.
+ #
+ # A comma or a closing bracket inside a quoted element is DATA, not
+ # a delimiter. Splitting on every comma turns one quoted entry that
+ # contains commas into several bogus ones -- and because each shard
+ # is a plausible-looking string, nothing downstream can tell that it
+ # happened. Values written from hand-authored prose hit this
+ # routinely.
+ parts = []
+ buf = ''
+ quote = None
+ idx = 1
+ while idx < len(value):
+ ch = value[idx]
+ if quote is not None:
+ if ch == quote:
+ quote = None
+ else:
+ buf += ch
+ elif ch in ('"', "'"):
+ quote = ch
+ elif ch == ']':
+ break
+ elif ch == ',':
+ parts.append(buf.strip())
+ buf = ''
+ else:
+ buf += ch
+ idx += 1
+ if buf.strip():
+ parts.append(buf.strip())
+ parent[key] = [p for p in parts if p != '']
+ i += 1
+ continue
+ elif value[:1] in ('"', "'"):
+ quote = value[0]
+ end = value.find(quote, 1)
+ if end >= 0:
+ value = value[1:end]
+ else:
+ value = value[1:]
+ else:
+ hash_pos = value.find(' #')
+ if hash_pos >= 0:
+ value = value[:hash_pos].strip()
+ if value == '':
+ # Peek: block-dash list or sub-map?
+ j = i + 1
+ items = []
+ while j < len(lines):
+ pl = lines[j].rstrip('\n').rstrip('\r')
+ pstripped = pl.lstrip(' ')
+ if not pstripped.strip() or pstripped.lstrip().startswith('#'):
+ j += 1
+ continue
+ pindent = len(pl) - len(pstripped)
+ if pindent <= indent:
+ break
+ if pstripped.startswith('- '):
+ # INDENT IS NOT ENFORCED between items, deliberately.
+ #
+ # Requiring every item to sit at the first item's indent
+ # made ONE misindented entry end the list there and return
+ # the prefix, silently: three configured always-ask
+ # categories came back as one. `is_always_ask_category`
+ # compares exactly, so the dropped entries lost their
+ # prompt with nothing written anywhere -- and a partial
+ # list is non-empty, so the caller's "fall back to the
+ # defaults when unset" branch does not fire either. It
+ # failed toward LESS confirmation, which is the wrong
+ # direction for the setting that decides when to ask.
+ #
+ # Safe because this schema holds only flat scalar lists:
+ # any deeper `- ` line under the key is an item of it. A
+ # non-dash line still ends the list via the break below,
+ # so a sub-map after a list is unaffected.
+ item = pstripped[2:].strip()
+ if item[:1] in ('"', "'") and item[-1:] == item[:1] and len(item) >= 2:
+ item = item[1:-1]
+ else:
+ # Unquoted items take the same trailing-comment rule
+ # scalars take. Without it `- scope_changes # ask`
+ # parsed as the literal string INCLUDING the comment
+ # and matched no category -- the same silent loss as
+ # above, reached a different way. Quoted items are
+ # left alone: a `#` inside quotes is data.
+ hash_pos = item.find(' #')
+ if hash_pos >= 0:
+ item = item[:hash_pos].strip()
+ items.append(item)
+ j += 1
+ continue
+ break
+ if items:
+ parent[key] = items
+ i = j
+ continue
+ else:
+ new_map = {}
+ parent[key] = new_map
+ stack.append((indent, new_map))
+ else:
+ parent[key] = value
+ i += 1
+ return root
+
+try:
+ with open(path_file, 'r', encoding='utf-8-sig', errors='replace') as f:
+ data = parse(f.readlines())
+except OSError:
+ sys.exit(0)
+
+cur = data
+for k in keys:
+ if isinstance(cur, dict) and k in cur:
+ cur = cur[k]
+ else:
+ sys.exit(0)
+
+if not isinstance(cur, list):
+ sys.exit(0)
+
+for item in cur:
+ sys.stdout.buffer.write((str(item) + '\n').encode('utf-8'))
+PYEOF
+}
+
+# Guard: project.local.yaml requires a project.yaml base.
+# Per spec (effects-map.md "Creation and error handling"), the local file
+# has no meaning without a base — it only overrides values from project.yaml.
+# Prints a hard-error message to stderr and returns 1 if the orphan case
+# is detected. Returns 0 otherwise (including when neither file exists).
+# Uses CWD-relative paths — callers cd into the project root first.
+# --- project root resolution -------------------------------------------------
+#
+# Config paths must NOT be resolved against the bare current working directory.
+# Run a skill or hook from a subdirectory that way and project.yaml is
+# unfindable, so EVERY setting resolves to empty -- silently, because the guard
+# that reports a missing base cannot find its files either. From the repo root
+# `modes.rigor` returns `full`; from `src/` it would return nothing.
+#
+# Being loadable from anywhere is only half the problem: the helper must also be
+# able to do its job from anywhere. Fixing one without the other leaves it
+# sourceable everywhere and functional only at the root.
+#
+# PRECEDENCE IS LOAD-BEARING, in this order:
+# 1. cwd holds project.yaml -> cwd
+# 2. cwd holds project.local.yaml -> cwd
+# 3. CLAUDE_PROJECT_DIR has a base -> that directory
+# 4. nothing found -> cwd (unchanged behaviour)
+#
+# AN UPWARD WALK WAS IMPLEMENTED AND REMOVED, and the reason is worth keeping.
+# The intent was a fallback needing no environment variable: climb until an
+# ancestor has project.yaml. It resolves the wrong tree. A project that has a
+# legacy production/review-mode.txt and no project.yaml, sitting anywhere below
+# another project, reads the OUTER project's project.local.yaml one directory
+# up instead of its own legacy file -- the wrong answer, returned silently.
+#
+# That is not a test-harness artifact. Any real project nested inside another
+# repo that happens to carry a project.yaml would silently inherit the outer
+# project's settings, which is the same silent-wrong-answer class this whole fix
+# exists to remove. A fallback that guesses is worse than one that is absent:
+# rule 4 leaves an unconfigured directory reading its own legacy files, which is
+# exactly what a project without project.yaml should do.
+#
+# CLAUDE_PROJECT_DIR is populated in both the hook environment and the
+# skill-bootstrap environment, so rule 3 covers every way this framework
+# actually invokes the helper.
+#
+# 1 and 2 come FIRST deliberately. A project nested inside another one must read
+# ITSELF, and an ambient CLAUDE_PROJECT_DIR would otherwise point it at the
+# outer tree. Rule 2 covers the case that is easiest to lose: a directory with a
+# project.local.yaml and deliberately NO base must still raise the hard error
+# for a missing base. Without it, an upward walk finds an ancestor's
+# project.yaml and that error silently stops firing.
+#
+# Sets a variable rather than echoing a path: a $( ) per lookup would add a
+# subshell to every one of validate_yaml_enum's 23 calls, and per-lookup cost of
+# that kind is what pushes a hook past its 10s timeout.
+_yaml_helper_set_root() {
+ _YH_ROOT="."
+ [ -f "$_YH_ROOT/project.yaml" ] && return 0
+ [ -f "$_YH_ROOT/project.local.yaml" ] && return 0
+ if [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -f "$CLAUDE_PROJECT_DIR/project.yaml" ]; then
+ _YH_ROOT="$CLAUDE_PROJECT_DIR"; return 0
+ fi
+ return 0
+}
+
+validate_local_yaml_base() {
+ _yaml_helper_set_root
+ if [ -f "$_YH_ROOT/project.local.yaml" ] && [ ! -f "$_YH_ROOT/project.yaml" ]; then
+ echo "project.local.yaml exists but project.yaml is missing — run /start to create one. Local overrides require a base." >&2
+ return 1
+ fi
+ return 0
+}
+
+# Per-leaf deep-merge: read project.local.yaml first (if present),
+# fall back to project.yaml. Each leaf is resolved independently from
+# its own file, so sibling keys at the same nesting level naturally
+# come through from project.yaml when project.local.yaml only overrides
+# specific leaves.
+get_effective_yaml_key() {
+ _yaml_helper_set_root
+ local path="$1"
+ if [ -z "$path" ]; then return 0; fi
+ local val=""
+ if [ -f "$_YH_ROOT/project.local.yaml" ]; then
+ val=$(get_yaml_key "$_YH_ROOT/project.local.yaml" "$path")
+ fi
+ if [ -z "$val" ] && [ -f "$_YH_ROOT/project.yaml" ]; then
+ val=$(get_yaml_key "$_YH_ROOT/project.yaml" "$path")
+ fi
+ printf '%s' "$val"
+}
+
+get_effective_yaml_array() {
+ _yaml_helper_set_root
+ local path="$1"
+ if [ -z "$path" ]; then return 0; fi
+ local val=""
+ if [ -f "$_YH_ROOT/project.local.yaml" ]; then
+ val=$(get_yaml_array "$_YH_ROOT/project.local.yaml" "$path")
+ fi
+ if [ -z "$val" ] && [ -f "$_YH_ROOT/project.yaml" ]; then
+ val=$(get_yaml_array "$_YH_ROOT/project.yaml" "$path")
+ fi
+ printf '%s' "$val"
+}
+
+# Enum constants — the 12 settings whose values are constrained to a
+# fixed set per effects-map.md. Format: dotted.path::value1|value2|...
+# Validation: walk this list; for each key present in the file, verify
+# value is in the allowed set. Out-of-set values are hard errors per
+# spec (effects-map.md line 145-153).
+_yaml_helper_enums="\
+modes.review_mode::full|lean|solo
+modes.rigor::minimal|standard|full
+modes.workflow::minimal|standard|full
+modes.automation::collaborative|guided|autonomous
+modes.story_granularity::coarse|balanced|fine
+docs.density::terse|balanced|thorough
+qa.level::minimal|standard|full
+team.size::individual|small|studio
+performance.enforce::warn|block|off
+platform.cert_tier::none|itch|steam|console
+accessibility.target::none|standard|aaa
+engine.name::Godot|Unity|Unreal
+project.stage::Concept|Systems Design|Technical Setup|Pre-Production|Production|Polish|Release
+testing.strict.logic::true|false
+testing.strict.integration::true|false
+testing.strict.visual::true|false
+testing.strict.ui::true|false
+testing.strict.config::true|false
+features.session_state::on|off
+platform.online::true|false
+workflow_overrides.edge_cases::true|false
+workflow_overrides.tuning_knobs::true|false
+workflow_overrides.art_bible_strict::true|false"
+# The boolean keys above are enumerated for the same reason the string keys are:
+# `resolve_setting` validates every hop and DROPS a value that fails, so a key
+# absent from this table accepts anything. Before they were listed,
+# `testing.strict.logic: maybe` in project.local.yaml passed validation and won
+# over an explicit `true` in project.yaml -- and `/story-done` treats the gate as
+# BLOCKING only when the value is `true`, so a typo silently downgraded a
+# blocking test gate to advisory with no error. `performance.enforce` was
+# already enumerated and correctly rejected garbage, which is exactly the
+# asymmetry that hides this. Any NEW boolean setting must be added here too.
+#
+# Two keys deliberately NOT listed as `true|false`, both of which the config
+# test suite catches if they are -- add nothing here without checking it:
+# - `features.session_state` is an ON/OFF enum, not a boolean. It is listed
+# above as `on|off` because `session_state_enabled()` disables only on the
+# literal `off`, and effects-map documents `on`/`off`. Writing `false` there
+# means ENABLED, which is why validating it matters.
+# - `testing.strict` (the parent) is absent because its primary shape is a MAP
+# of the five type keys; the bare scalar is only a back-compat form. Its
+# effects-map `**Values:**` line documents the map, so enumerating the parent
+# as a scalar would force that line to misdescribe the real shape. The five
+# leaves below carry the validation, which is where /story-done reads.
+#
+# validate_local_scope [<file>]
+# The location check the value checks above cannot do: names keys in
+# project.local.yaml that are NOT locally overridable, which resolution
+# silently ignores. One line per key on stderr; returns 1 if any found.
+# Warns, never reconciles. Defined below is_locally_overridable.
+
+# Whitelist of locally-overridable settings (per effects-map.md
+# "Whitelist — which settings can be locally overridden"). Personal-experience
+# settings only — divergence between developers is safe because they don't
+# affect what artifacts exist on disk.
+_yaml_helper_locally_overridable="\
+modes.review_mode
+modes.automation
+modes.automation_always_ask
+team.size
+testing.strict.logic
+testing.strict.integration
+testing.strict.visual
+testing.strict.ui
+testing.strict.config
+performance.enforce
+features.session_state
+features.token_budget_warn_at"
+
+is_locally_overridable() {
+ local path="$1"
+ [ -z "$path" ] && return 1
+ local whitelisted
+ while IFS= read -r whitelisted; do
+ [ -z "$whitelisted" ] && continue
+ if [ "$path" = "$whitelisted" ]; then return 0; fi
+ done <<EOF
+$_yaml_helper_locally_overridable
+EOF
+ return 1
+}
+
+# validate_local_scope [<file>]
+# Names the keys in project.local.yaml that resolution will NEVER read,
+# because they are not on the whitelist above. One line per key on stderr;
+# returns 1 if any were found, 0 otherwise.
+#
+# Why this needs its own check, separate from validate_yaml_enum: that
+# function validates VALUES, and a locked key hand-written into the local
+# file has a perfectly legal one. `modes.rigor: strict` there passes every
+# validation in the chain — correct key, correct value — and then
+# resolve_setting never consults the local file for that path, so the
+# setting is discarded in total silence and the user sees the default they
+# were trying to override. Nothing else checks the key's LOCATION.
+# /settings --local already refuses these; only the hand-edited file is
+# unguarded, and hand-editing is what the file is for.
+#
+# WARNS, NEVER RECONCILES — the same shape as the stage-mirror check.
+# It does not edit project.local.yaml, does not begin honouring
+# the key, and does not alter resolution. A locked setting is locked
+# because it changes which artifacts exist on disk, so a helper that
+# "helpfully" applied one would let two developers' checkouts diverge —
+# precisely what the whitelist exists to prevent. The fix belongs to the
+# user: move the key to project.yaml, or delete it.
+#
+# The parser below is a third copy of the one in get_yaml_key and
+# validate_yaml_enum. That duplication is deliberate and matches the
+# established shape of this file: these helpers are sourced individually
+# and must agree on YAML edge cases exactly, and a shared copy that drifted
+# would make two functions disagree about what a file says.
+validate_local_scope() {
+ local file="${1:-project.local.yaml}"
+ [ -f "$file" ] || return 0
+ if ! _yaml_helper_resolve_python; then return 0; fi
+ local found key rc=0
+ found=$("$_yaml_helper_python" - "$file" "$_yaml_helper_locally_overridable" <<'PYEOF'
+import sys, re
+
+path_file, allowed_table = sys.argv[1], sys.argv[2]
+allowed = set(l.strip() for l in allowed_table.splitlines() if l.strip())
+
+# File metadata, not settings -- effects-map.md lists `schema_version` and
+# `framework.*` under "Locked to project.yaml" with the reason "File metadata,
+# not preferences". They are not preferences, so "you cannot override this
+# preference locally" is the wrong complaint about them: nothing was dropped
+# and nothing needs moving. This repo's own project.local.yaml carries
+# `schema_version: 1`, which is how the false positive was caught -- the check
+# was written against a hand-made fixture and only run against the real file
+# afterwards, where it immediately flagged a correct file.
+EXEMPT_EXACT = {'schema_version'}
+EXEMPT_PREFIX = ('framework.',)
+
+def parse(lines):
+ root = {}
+ stack = [(-1, root)]
+ for raw in lines:
+ line = raw.rstrip('\n').rstrip('\r')
+ stripped = line.lstrip(' ')
+ if not stripped.strip() or stripped.lstrip().startswith('#'):
+ continue
+ indent = len(line) - len(stripped)
+ while stack and stack[-1][0] >= indent:
+ stack.pop()
+ if not stack:
+ return root
+ parent = stack[-1][1]
+ m = re.match(r'([^:#\s][^:]*?)\s*:\s*(.*)$', stripped)
+ if not m:
+ continue
+ key = m.group(1).strip()
+ value = m.group(2).strip()
+ if value.startswith('#'):
+ value = ''
+ elif value[:1] in ('"', "'"):
+ quote = value[0]
+ end = value.find(quote, 1)
+ value = value[1:end] if end >= 0 else value[1:]
+ else:
+ hash_pos = value.find(' #')
+ if hash_pos >= 0:
+ value = value[:hash_pos].strip()
+ if value == '':
+ new_map = {}
+ parent[key] = new_map
+ stack.append((indent, new_map))
+ else:
+ parent[key] = value
+ return root
+
+try:
+ with open(path_file, 'r', encoding='utf-8-sig', errors='replace') as f:
+ data = parse(f.readlines())
+except OSError:
+ sys.exit(0)
+
+# An EMPTY map counts as a leaf. Array-valued keys parse that way -- the
+# `- item` lines carry no colon and are skipped -- so treating an empty map as
+# a branch would silently exempt every list-valued setting from this check.
+def walk(node, prefix):
+ for k, v in node.items():
+ dotted = prefix + k if not prefix else prefix + '.' + k
+ if isinstance(v, dict) and v:
+ walk(v, dotted)
+ elif dotted in allowed or dotted in EXEMPT_EXACT:
+ continue
+ elif dotted.startswith(EXEMPT_PREFIX):
+ continue
+ else:
+ print(dotted)
+
+walk(data, '')
+PYEOF
+)
+ [ -n "$found" ] || return 0
+ while IFS= read -r key; do
+ [ -z "$key" ] && continue
+ echo "$file: \`$key\` is not locally overridable — ignored, not applied. Move it to project.yaml (or delete it); see the whitelist in yaml-helper.sh." >&2
+ rc=1
+ done <<EOF
+$found
+EOF
+ return "$rc"
+}
+
+# session_state_enabled
+# Returns 0 when the session-state pipeline should run, 1 when the user has
+# turned it off with `features.session_state: off`. Honours the local
+# override (the key is on the whitelist above), local winning over base.
+#
+# DEFAULT IS `on`. A default of `off` would contradict practice: every project
+# runs with the pipeline active --
+# and `production/session-state/active.md` is the documented recovery
+# checkpoint that `.claude/docs/context-management.md` tells users to rely on.
+# Shipping `off` as the default would have silently removed crash recovery,
+# the session archive and the subagent spawn tally from every existing
+# project. Users who want the ~2-5k tokens per session opt out explicitly.
+#
+# Deliberately awk, not get_effective_yaml_key: this runs in log-agent.sh on
+# EVERY subagent spawn, and get_effective_yaml_key shells out to Python twice.
+# Spending 200ms of interpreter startup per spawn to check a token-saving flag
+# would be self-defeating.
+session_state_enabled() {
+ local f v
+ for f in project.local.yaml project.yaml; do
+ [ -f "$f" ] || continue
+ v=$(awk '
+ /^features:[[:space:]]*$/ { inf=1; next }
+ /^[^[:space:]#]/ { inf=0 }
+ inf && /^[[:space:]]+session_state:/ {
+ sub(/^[[:space:]]*session_state:[[:space:]]*/, "")
+ sub(/[[:space:]]*#.*$/, "")
+ gsub(/["'"'"']/, "")
+ print; exit
+ }
+ ' "$f" 2>/dev/null | tr -d '\r' | tr -d ' ')
+ if [ -n "$v" ]; then
+ [ "$v" = "off" ] && return 1
+ return 0
+ fi
+ done
+ return 0 # unset anywhere => on
+}
+
+validate_yaml_enum() {
+ local file="$1"
+ if [ -z "$file" ] || [ ! -f "$file" ]; then return 0; fi
+ if ! _yaml_helper_resolve_python; then
+ echo "yaml-helper: no python interpreter found (tried python, python3, py)" >&2
+ return 0
+ fi
+ # ONE interpreter spawn for the whole enum table.
+ #
+ # Calling `get_yaml_key` once per enum -- 23 calls -- spawns a Python
+ # interpreter each time (see get_yaml_key). At ~214ms of process startup on
+ # Windows that is ~4.9s per config file, and with project.yaml plus
+ # project.local.yaml it puts session-start.sh over its 10s hook timeout,
+ # killing it mid-write so the recovery checkpoint never reaches context.
+ #
+ # A bash pre-filter that skips lookups for keys ABSENT from the file is
+ # correct but insufficient, and the distinction is the lesson: it only removes
+ # spawns for keys you do not have. A sparse config skips nearly all of them
+ # and looks like a 35x win. A fully configured project sets all of them, every
+ # lookup survives the filter, and the cost returns in full -- ~4683ms filtered
+ # versus ~4576ms unfiltered, i.e. no improvement on the population that
+ # matters.
+ # The count of spawns was never the invariant worth fixing; the cost of one
+ # was. Parsing the document once and answering every enum from that parse is
+ # constant in the number of keys, so a denser config no longer costs more.
+ #
+ # Behaviour is unchanged by construction: the parser below is the same one
+ # get_yaml_key uses, the enum table is walked in the same order, absent keys
+ # are skipped exactly as `[ -z "$actual" ] && continue` did, and the error
+ # text is byte-identical.
+ "$_yaml_helper_python" - "$file" "$_yaml_helper_enums" <<'PYEOF'
+import sys, re
+
+path_file, enum_table = sys.argv[1], sys.argv[2]
+
+def parse(lines):
+ root = {}
+ stack = [(-1, root)] # (indent, mapping)
+ for raw in lines:
+ line = raw.rstrip('\n').rstrip('\r')
+ stripped = line.lstrip(' ')
+ if not stripped.strip() or stripped.lstrip().startswith('#'):
+ continue
+ indent = len(line) - len(stripped)
+ while stack and stack[-1][0] >= indent:
+ stack.pop()
+ if not stack:
+ return root
+ parent = stack[-1][1]
+ m = re.match(r'([^:#\s][^:]*?)\s*:\s*(.*)$', stripped)
+ if not m:
+ continue
+ key = m.group(1).strip()
+ value = m.group(2).strip()
+ if value.startswith('#'):
+ value = ''
+ elif value[:1] in ('"', "'"):
+ quote = value[0]
+ end = value.find(quote, 1)
+ if end >= 0:
+ value = value[1:end]
+ else:
+ value = value[1:]
+ else:
+ hash_pos = value.find(' #')
+ if hash_pos >= 0:
+ value = value[:hash_pos].strip()
+ if value == '':
+ new_map = {}
+ parent[key] = new_map
+ stack.append((indent, new_map))
+ else:
+ parent[key] = value
+ return root
+
+try:
+ with open(path_file, 'r', encoding='utf-8-sig', errors='replace') as f:
+ raw_lines = f.readlines()
+except OSError:
+ sys.exit(0)
+
+data = parse(raw_lines)
+
+# A TAB IN THE INDENTATION IS AN ERROR, not something to normalise away.
+#
+# The parser stripped leading SPACES only, so a tab-indented line never matched
+# the key regex and vanished -- the setting then silently resolved to its
+# default. Every enum check below passed on such a file, because a key that
+# cannot be read cannot hold an invalid value. That is rc=0 on a config that
+# configures nothing, byte-identical in outcome to a genuinely clean file.
+# Measured before this check: the same file with tabs instead of spaces
+# reported no errors while `modes.review_mode: BOGUS_VALUE` sat in it unread.
+#
+# This is the validator's own version of the rule the skills are held to --
+# absence of evidence is not evidence of absence. It cannot report "no invalid
+# values" when the real answer is "no values".
+#
+# YAML forbids tabs for indentation, so reporting rather than repairing is
+# correct; doing neither was the defect. Comment lines are exempt: a tab in
+# front of a `#` hides nothing.
+tab_lines = []
+for _n, _raw in enumerate(raw_lines, 1):
+ _line = _raw.rstrip('\n').rstrip('\r')
+ if not _line.strip() or _line.lstrip(' \t').startswith('#'):
+ continue
+ _lead = _line[:len(_line) - len(_line.lstrip(' \t'))]
+ if '\t' in _lead:
+ tab_lines.append(_n)
+
+def lookup(dotted):
+ cur = data
+ for k in dotted.split('.'):
+ if isinstance(cur, dict) and k in cur:
+ cur = cur[k]
+ else:
+ return ''
+ if isinstance(cur, dict):
+ return ''
+ return str(cur)
+
+errors = 0
+out = []
+if tab_lines:
+ _shown = ', '.join(str(n) for n in tab_lines[:5])
+ if len(tab_lines) > 5:
+ _shown += ' (and %d more)' % (len(tab_lines) - 5)
+ out.append("line %s: indented with a TAB. YAML forbids tabs for indentation, "
+ "so these lines are invisible to the config parser and their "
+ "settings silently fall back to defaults. Replace leading tabs "
+ "with spaces." % _shown)
+ errors += 1
+for line in enum_table.splitlines():
+ line = line.strip()
+ if not line or '::' not in line:
+ continue
+ enum_path, _, enum_values = line.partition('::')
+ actual = lookup(enum_path)
+ if actual == '':
+ continue
+ if actual not in enum_values.split('|'):
+ out.append("%s: '%s' is not a valid value (expected: %s)"
+ % (enum_path, actual, enum_values))
+ errors += 1
+
+if out:
+ sys.stderr.buffer.write(('\n'.join(out) + '\n').encode('utf-8'))
+sys.exit(1 if errors else 0)
+PYEOF
+}
+
+# Validate a single pending value for /settings writes. Looks up
+# the key in _yaml_helper_enums; if found, checks value membership. If
+# the key has no enum constraint, returns 0 (no validation applies).
+# Returns 1 with stderr error on invalid value.
+validate_enum_value() {
+ local key="$1"
+ local value="$2"
+ [ -z "$key" ] && return 0
+ local line enum_path enum_values v
+ while IFS= read -r line; do
+ [ -z "$line" ] && continue
+ enum_path="${line%::*}"
+ enum_values="${line##*::}"
+ if [ "$key" = "$enum_path" ]; then
+ local oldIFS="$IFS"
+ IFS='|'
+ for v in $enum_values; do
+ if [ "$value" = "$v" ]; then IFS="$oldIFS"; return 0; fi
+ done
+ IFS="$oldIFS"
+ echo "Invalid value '$value' for '$key'. Allowed: $enum_values" >&2
+ return 1
+ fi
+ done <<EOF
+$_yaml_helper_enums
+EOF
+ # Key has no enum constraint — caller decides what to do.
+ return 0
+}
+
+# automation_always_ask category check.
+# Returns 0 if the named category is in modes.automation_always_ask (or in
+# the default list when unset), 1 otherwise. Used by skills in autonomous
+# mode to know which decisions still warrant a prompt.
+# Default list (when modes.automation_always_ask absent from both files):
+# scope_changes, file_deletions, schema_changes
+_yaml_helper_always_ask_default="scope_changes
+file_deletions
+schema_changes"
+
+is_always_ask_category() {
+ local category="$1"
+ [ -z "$category" ] && return 1
+ local configured
+ configured=$(get_effective_yaml_array modes.automation_always_ask)
+ if [ -z "$configured" ]; then
+ configured="$_yaml_helper_always_ask_default"
+ fi
+ local item
+ while IFS= read -r item; do
+ [ -z "$item" ] && continue
+ if [ "$item" = "$category" ]; then return 0; fi
+ done <<EOF
+$configured
+EOF
+ return 1
+}
+
+# Append a decision-log entry. Format per effects-map.md
+# "Decision log format (autonomous mode)". Creates the file and parent
+# directory if absent. Uses ISO 8601 UTC timestamps.
+log_decision() {
+ _yaml_helper_set_root
+ local skill="$1"
+ local point="$2"
+ local options="$3"
+ local chosen="$4"
+ local reason="$5"
+ local category="$6"
+ local logfile="$_YH_ROOT/production/session-logs/decision-log.md"
+ mkdir -p "$(dirname "$logfile")"
+ if [ ! -f "$logfile" ]; then
+ printf '# Decision Log\n\nAppend-only audit trail of decisions made in autonomous mode.\n' > "$logfile"
+ fi
+ local timestamp
+ timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u)
+ cat >> "$logfile" <<EOF
+
+## $timestamp — $skill
+
+**Decision point:** $point
+**Options considered:** $options
+**Chosen:** $chosen
+**Reason:** $reason
+**Category:** $category
+EOF
+}
+
+# =============================================================================
+# Whole-config resolution.
+#
+# WHY THIS EXISTS
+# ~51 SKILL.md files each carried an English description of a deterministic
+# fallback chain ("1. If --review passed -> use that; 2. Else read
+# modes.review_mode from project.yaml; 3. Else production/review-mode.txt;
+# 4. Else lean"), re-interpreted by a model on every invocation at roughly
+# +1,360 tokens per skill. resolve_config computes the same answer once, in
+# ~150 tokens, deterministically -- and testably, which prose never was.
+#
+# CONTRACT BOUNDARY
+# This layer resolves SOURCES. It does not own per-skill policy. Anything
+# whose default legitimately differs between skills (testing.strict.*) is
+# reported as configured-or-unset and left to the skill to default.
+# =============================================================================
+
+# Terminal defaults. ONLY knobs whose default is uniform across every consumer.
+#
+# testing.strict.* is deliberately ABSENT: /smoke-check defaults it to blocking
+# (build-health gate) while /story-done and /dev-story default per story type.
+# Emitting one value here would silently pick a winner between them.
+#
+# The six knobs `rigor` fronts (modes.workflow, docs.density, qa.level,
+# modes.story_granularity, modes.review_mode, team.size) are ALSO absent: their
+# value comes from the rigor expansion below, which sits between the legacy step
+# and this table. Leaving a terminal default here as well would shadow the
+# expansion and make `rigor` a no-op for anyone who had not also set the sub-knob.
+# modes.review_mode is fronted by rigor so `rigor: minimal` resolves
+# review_mode to `solo` (skipping the ~44k-token director/specialist gates),
+# `standard` yields `lean` and `full` yields `full`. team.size joined the fronted
+# set the same way: `full` yields `studio` (the whole roster) while
+# `minimal`/`standard` yield `individual`. Both stay locally overridable (they
+# are personal-experience knobs, not on-disk artifacts): that source sits ABOVE
+# the expansion, so only the terminal fallback moved.
+#
+# --- WHY modes.rigor DEFAULTS TO `minimal` -----------------------------------
+#
+# It defaulted to `standard`. Building the same project both ways showed the
+# heavier tier costing several times as much to reach working code without
+# producing a better result, and giving nothing back when a fresh developer
+# picked the project up. A default that costs more and does not repay is the
+# wrong default, and it was what every user who never opened /settings received.
+#
+# Raising rigor stays one question in /start and one `/settings` call, and
+# settings-guidance.md's upward triggers ("system-GDD count crosses ~9",
+# "gate-check PASS into Production while rigor is minimal") are written to fire
+# from exactly this starting state. The cost of under-running is one prompt.
+#
+# ORDER MATTERS: this default is only safe while /gate-check keeps its floors.
+# `rigor: minimal` expands to `workflow: minimal` + `qa.level: minimal`, which
+# together once left the Production->Polish gate with ZERO required artifacts --
+# a vacuous PASS. That is fixed (the smoke-report floor and the "nothing
+# required -> NOT ASSESSED, never PASS" rule). Do not move this default again
+# without re-checking that the gates below it still require something.
+_yaml_helper_defaults="\
+modes.automation::collaborative
+modes.rigor::minimal
+performance.enforce::warn"
+
+# Rigor expansion — one asked-at-/start knob that supplies four.
+#
+# WHY: /start has never asked about workflow, docs.density, qa.level or
+# story_granularity, so in practice every project ran all four at their defaults.
+# Between them the latter three drive ONE behaviour each (prose verbosity, is-
+# evidence-required, story size) restated across 19 skills with 17 "we are
+# orthogonal" disclaimers. `rigor` makes the common case reachable in one
+# question while each knob stays individually settable.
+#
+# modes.workflow is fronted, NOT replaced: it drives ~5 distinct behaviours and
+# owns the only per-system override mechanism (workflow_overrides.system_
+# overrides), which continues to win over the rigor-derived value.
+_yaml_helper_rigor_expansion="\
+minimal::modes.workflow=minimal,docs.density=terse,qa.level=minimal,modes.story_granularity=coarse,modes.review_mode=solo,team.size=individual
+standard::modes.workflow=standard,docs.density=balanced,qa.level=standard,modes.story_granularity=balanced,modes.review_mode=lean,team.size=individual
+full::modes.workflow=full,docs.density=thorough,qa.level=full,modes.story_granularity=fine,modes.review_mode=full,team.size=studio"
+
+# Value for <path> implied by the project's rigor level, or '' if rigor does not
+# front that key. Never consulted for modes.rigor itself — that would recurse.
+_yaml_helper_rigor_value() {
+ _yaml_helper_set_root
+ local path="$1" level="" line pair
+ [ -z "$path" ] && return 0
+ [ "$path" = "modes.rigor" ] && return 0
+
+ # Resolve rigor WITHOUT resolve_setting, to keep the recursion impossible.
+ [ -f "$_YH_ROOT/project.yaml" ] && level=$(get_yaml_key "$_YH_ROOT/project.yaml" modes.rigor)
+ if [ -n "$level" ] && ! validate_enum_value modes.rigor "$level" 2>/dev/null; then level=""; fi
+ [ -z "$level" ] && level=$(get_yaml_default modes.rigor)
+ [ -z "$level" ] && return 0
+
+ while IFS= read -r line; do
+ [ -z "$line" ] && continue
+ [ "${line%%::*}" = "$level" ] || continue
+ local oldIFS="$IFS"; IFS=','
+ for pair in ${line##*::}; do
+ if [ "${pair%%=*}" = "$path" ]; then IFS="$oldIFS"; printf '%s' "${pair#*=}"; return 0; fi
+ done
+ IFS="$oldIFS"
+ done <<EOF
+$_yaml_helper_rigor_expansion
+EOF
+ return 0
+}
+
+# The rigor level currently in effect (for source labels and /settings).
+_yaml_helper_rigor_level() {
+ _yaml_helper_set_root
+ local level=""
+ [ -f "$_YH_ROOT/project.yaml" ] && level=$(get_yaml_key "$_YH_ROOT/project.yaml" modes.rigor)
+ if [ -n "$level" ] && ! validate_enum_value modes.rigor "$level" 2>/dev/null; then level=""; fi
+ [ -z "$level" ] && level=$(get_yaml_default modes.rigor)
+ printf '%s' "$level"
+}
+
+# Plain-text legacy mirrors — the read side of the dual-write contract.
+_yaml_helper_legacy_files="\
+modes.review_mode::production/review-mode.txt
+project.stage::production/stage.txt"
+
+# Which keys consult project.local.yaml DURING RESOLUTION.
+#
+# This list MUST equal the `/settings --local` write whitelist. If resolution
+# consults project.local.yaml for a narrower set than /settings will write to
+# it, `/settings --local modes.review_mode=solo` writes a value that /settings
+# accepts and displays, and that every skill then ignores. A write
+# list and a read list that disagree is not a design; it is a bug with a
+# plausible-looking symptom.
+#
+# Kept as its own variable rather than inlining the whitelist: "may be written
+# locally" and "is read during resolution" are distinct concepts that merely
+# coincide today. A future setting could legitimately be one and not the other.
+_yaml_helper_local_read_scope="$_yaml_helper_locally_overridable"
+
+_yaml_helper_in_local_read_scope() {
+ local path="$1" entry
+ [ -z "$path" ] && return 1
+ while IFS= read -r entry; do
+ [ -z "$entry" ] && continue
+ [ "$path" = "$entry" ] && return 0
+ done <<EOF
+$_yaml_helper_local_read_scope
+EOF
+ return 1
+}
+
+_yaml_helper_legacy_file_for() {
+ local path="$1" line
+ [ -z "$path" ] && return 0
+ while IFS= read -r line; do
+ [ -z "$line" ] && continue
+ if [ "${line%%::*}" = "$path" ]; then printf '%s' "${line##*::}"; return 0; fi
+ done <<EOF
+$_yaml_helper_legacy_files
+EOF
+ return 0
+}
+
+# Documented terminal default for a key, or '' when it has none.
+get_yaml_default() {
+ local path="$1" line
+ [ -z "$path" ] && return 0
+ while IFS= read -r line; do
+ [ -z "$line" ] && continue
+ if [ "${line%%::*}" = "$path" ]; then printf '%s' "${line##*::}"; return 0; fi
+ done <<EOF
+$_yaml_helper_defaults
+EOF
+ return 0
+}
+
+# Read a legacy plain-text mirror. Strips CR and surrounding whitespace but
+# PRESERVES INTERNAL SPACES — "Systems Design" is a legal project.stage value,
+# and a `tr -d '[:space:]'` reader collapsed it to "SystemsDesign", which
+# matched none of the phase keys downstream. Skips leading blank lines.
+get_legacy_key() {
+ local path="$1" file
+ [ -z "$path" ] && return 0
+ file=$(_yaml_helper_legacy_file_for "$path")
+ [ -z "$file" ] && return 0
+ [ -f "$file" ] || return 0
+ awk 'BEGIN{FS="\n"} { gsub(/\r/,""); sub(/^[ \t]+/,""); sub(/[ \t]+$/,"");
+ if (length($0) > 0) { print; exit } }' "$file"
+}
+
+# Resolve one setting through the full chain.
+# prints: "<value>\t<source>"
+# source: project.local.yaml | project.yaml | <legacy path> | default | unset
+# exit: always 0
+#
+# Enum-invalid values FALL THROUGH rather than winning — a typo degrades to the
+# next source and ultimately the documented default, instead of propagating a
+# nonsense mode into every skill. resolve_config surfaces what was rejected.
+resolve_setting() {
+ _yaml_helper_set_root
+ local path="$1"
+ if [ -z "$path" ]; then printf '\tunset'; return 0; fi
+ local val="" src="" legacy=""
+
+ if _yaml_helper_in_local_read_scope "$path" && [ -f "$_YH_ROOT/project.local.yaml" ]; then
+ val=$(get_yaml_key "$_YH_ROOT/project.local.yaml" "$path")
+ if [ -n "$val" ] && ! validate_enum_value "$path" "$val" 2>/dev/null; then val=""; fi
+ [ -n "$val" ] && src="project.local.yaml"
+ fi
+
+ if [ -z "$val" ] && [ -f "$_YH_ROOT/project.yaml" ]; then
+ val=$(get_yaml_key "$_YH_ROOT/project.yaml" "$path")
+ if [ -n "$val" ] && ! validate_enum_value "$path" "$val" 2>/dev/null; then val=""; fi
+ [ -n "$val" ] && src="project.yaml"
+ fi
+
+ if [ -z "$val" ]; then
+ legacy=$(_yaml_helper_legacy_file_for "$path")
+ if [ -n "$legacy" ] && [ -f "$legacy" ]; then
+ val=$(get_legacy_key "$path")
+ if [ -n "$val" ] && ! validate_enum_value "$path" "$val" 2>/dev/null; then val=""; fi
+ [ -n "$val" ] && src="$legacy"
+ fi
+ fi
+
+ # Rigor expansion sits BELOW every explicit source and ABOVE the terminal
+ # default. That ordering is the back-compat guarantee: a project.yaml that
+ # already sets docs.density resolves exactly as it did before rigor existed.
+ if [ -z "$val" ]; then
+ val=$(_yaml_helper_rigor_value "$path")
+ [ -n "$val" ] && src="rigor:$(_yaml_helper_rigor_level)"
+ fi
+
+ if [ -z "$val" ]; then
+ val=$(get_yaml_default "$path")
+ [ -n "$val" ] && src="default"
+ fi
+
+ [ -z "$src" ] && src="unset"
+ printf '%s\t%s' "$val" "$src"
+}
+
+# Resolve the ENGINE-SPECIFIC code root.
+# prints: "<dir>\t<source>"
+# source: engine.name | <legacy path> | detected | unset
+# exit: always 0
+#
+# WHY THIS EXISTS. `.claude/docs/directory-structure.md` is explicit that the
+# code root is not a style preference but a hard toolchain constraint: Unity
+# compiles only `Assets/` and `Packages/`, and UnrealBuildTool discovers modules
+# under `Source/`. `src/` is that table's GODOT row, not a universal path.
+#
+# Every hook that filtered staged or on-disk files with a literal `^src/`
+# therefore matched NOTHING on a Unity or Unreal project — and matching nothing
+# is indistinguishable from scanning cleanly. That is the exact row
+# `.claude/rules/skill-authoring.md` records for `/security-audit`
+# ("Godot-only greps returned zero hits on Unity/Unreal, and zero hits read as
+# clean"), reproduced in four more places.
+#
+# UNSET DOES NOT DEFAULT TO `src`. Obligation 2 of skill-authoring.md: an absent
+# value may not default to the permissive one. Defaulting here would re-create
+# the Godot bias this function exists to remove, and would do it invisibly. An
+# unresolvable root returns empty, and the CALLER must announce that its check
+# did not run — see the `_no_code_root` reporting in validate-commit.sh.
+#
+# Step 3 (detect) is derivation, not enumeration (obligation 5): it believes the
+# tree over the absence of config, but only when the tree is UNAMBIGUOUS. Two
+# roots present means a genuinely undecidable project, and guessing there would
+# scan half of it and report a pass.
+resolve_code_root() {
+ _yaml_helper_set_root
+ local ename="" src="" root="" legacy="" found="" d n=0
+
+ # 1. The configured engine, through the normal chain.
+ if [ -f "$_YH_ROOT/project.local.yaml" ]; then
+ ename=$(get_yaml_key "$_YH_ROOT/project.local.yaml" engine.name 2>/dev/null)
+ [ -n "$ename" ] && src="project.local.yaml"
+ fi
+ if [ -z "$ename" ] && [ -f "$_YH_ROOT/project.yaml" ]; then
+ ename=$(get_yaml_key "$_YH_ROOT/project.yaml" engine.name 2>/dev/null)
+ [ -n "$ename" ] && src="engine.name"
+ fi
+
+ # 2. The legacy mirror. `/setup-engine` wrote an `Engine:` line here before
+ # project.yaml existed, and workflow-catalog's `engine-setup` step still
+ # accepts it as an `any_of` alternative — so a v1.0 project that never
+ # migrated resolves rather than falling through to "unset".
+ legacy="$_YH_ROOT/.claude/docs/technical-preferences.md"
+ if [ -z "$ename" ] && [ -f "$legacy" ]; then
+ ename=$(grep -iE '^[[:space:]]*[-*]?[[:space:]]*\*{0,2}Engine\*{0,2}[[:space:]]*:' "$legacy" 2>/dev/null \
+ | head -1 | sed 's/.*://' | tr -d '\r' \
+ | sed 's/^[[:space:]]*//; s/[[:space:]].*$//; s/\*//g')
+ case "$ename" in
+ *"[TO BE CONFIGURED]"*|"["*) ename="" ;;
+ esac
+ [ -n "$ename" ] && src=".claude/docs/technical-preferences.md"
+ fi
+
+ case "$(printf '%s' "$ename" | tr '[:upper:]' '[:lower:]')" in
+ godot) root="src" ;;
+ unity) root="Assets" ;;
+ unreal*) root="Source" ;;
+ *) root="" ;;
+ esac
+
+ # 3. No usable engine value — believe the tree, but only if it is unambiguous.
+ if [ -z "$root" ]; then
+ for d in src Assets Source; do
+ if [ -d "$_YH_ROOT/$d" ]; then found="$d"; n=$((n + 1)); fi
+ done
+ if [ "$n" = 1 ]; then root="$found"; src="detected"; else root=""; src=""; fi
+ fi
+
+ [ -z "$src" ] && src="unset"
+ printf '%s\t%s' "$root" "$src"
+}
+
+# List the child key names of a mapping node (one per line). get_yaml_key
+# deliberately returns nothing for a mapping, so this is how the whole
+# workflow_overrides.system_overrides map gets enumerated in one shot.
+get_yaml_child_keys() {
+ local file="$1" path="$2"
+ if [ -z "$file" ] || [ -z "$path" ] || [ ! -f "$file" ]; then return 0; fi
+ _yaml_helper_resolve_python || return 0
+ "$_yaml_helper_python" - "$file" "$path" <<'PYEOF'
+import sys, re
+path_file, dotted = sys.argv[1], sys.argv[2]
+keys = dotted.split('.')
+
+def parse(lines):
+ root = {}
+ stack = [(-1, root)]
+ for raw in lines:
+ line = raw.rstrip('\n').rstrip('\r')
+ stripped = line.lstrip(' ')
+ if not stripped.strip() or stripped.lstrip().startswith('#'):
+ continue
+ indent = len(line) - len(stripped)
+ while stack and stack[-1][0] >= indent:
+ stack.pop()
+ if not stack:
+ return root
+ parent = stack[-1][1]
+ m = re.match(r'([^:#\s][^:]*?)\s*:\s*(.*)$', stripped)
+ if not m:
+ continue
+ key, value = m.group(1).strip(), m.group(2).strip()
+ if value.startswith('#'):
+ value = ''
+ elif value[:1] in ('"', "'"):
+ q = value[0]; end = value.find(q, 1)
+ value = value[1:end] if end >= 0 else value[1:]
+ else:
+ hp = value.find(' #')
+ if hp >= 0:
+ value = value[:hp].strip()
+ if value == '':
+ nm = {}; parent[key] = nm; stack.append((indent, nm))
+ else:
+ parent[key] = value
+ return root
+
+try:
+ with open(path_file, 'r', encoding='utf-8-sig', errors='replace') as f:
+ data = parse(f.readlines())
+except OSError:
+ sys.exit(0)
+
+cur = data
+for k in keys:
+ if isinstance(cur, dict) and k in cur:
+ cur = cur[k]
+ else:
+ sys.exit(0)
+if not isinstance(cur, dict):
+ sys.exit(0)
+sys.stdout.buffer.write("\n".join(cur.keys()).encode('utf-8'))
+PYEOF
+}
+
+# Emit the resolved-config block a skill reads instead of re-deriving anything.
+#
+# resolve_config [<system>]
+#
+# ALWAYS exits 0 and ALWAYS emits a complete block — a missing project.yaml,
+# malformed YAML, an orphan project.local.yaml or a missing Python interpreter
+# each degrade to defaults and surface on the notes: line rather than producing
+# a truncated block a skill might half-read.
+# resolve_config [--keys k1,k2,...] [<system>]
+#
+# --keys restricts output to the named knobs. USE IT. Emitting all 12 lines costs
+# ~188 tokens, while the resolution prose it replaces averages only ~101 tokens
+# per skill -- so a full block is a NET LOSS for any skill that reads 2-3 knobs.
+# A 3-knob block costs ~45 tokens, which is the actual win. Measured, not
+# estimated.
+# Valid key names are the output labels: rigor, review_mode, automation, workflow,
+# docs.density, story_granularity, qa.level, team.size, project.stage,
+# automation_always_ask, engine, testing.strict, system_overrides.
+resolve_config() {
+ _yaml_helper_set_root
+ local want=""
+ if [ "${1:-}" = "--keys" ]; then want=",${2},"; shift 2; fi
+ local system="${1:-}"
+ local notes="" v s pair
+ # emit <label> — true when the label was requested (or nothing was restricted)
+ _rc_want() { [ -z "$want" ] || case "$want" in *",$1,"*) return 0;; *) return 1;; esac; }
+
+ if ! _yaml_helper_resolve_python; then
+ notes="NO PYTHON INTERPRETER — YAML unreadable; legacy files and defaults only"
+ fi
+ if [ ! -f "$_YH_ROOT/project.yaml" ]; then
+ notes="${notes:+$notes; }project.yaml absent — defaults in use"
+ elif [ ! -s "$_YH_ROOT/project.yaml" ]; then
+ # An EMPTY project.yaml resolves to defaults; unannounced it is
+ # indistinguishable from a healthy fully-defaulted project. Absence is
+ # announced one line above; emptiness is the more suspicious state of the two
+ # (a truncated write, an interrupted /setup-engine) and was the silent one.
+ notes="${notes:+$notes; }project.yaml is EMPTY — defaults in use; if you configured this project, the file did not survive"
+ fi
+ local orphan
+ orphan=$(validate_local_yaml_base 2>&1) || notes="${notes:+$notes; }$orphan"
+
+ # Collect enum complaints from both files so a typo is visible, not silent.
+ local enum_err
+ enum_err=$(validate_yaml_enum project.yaml 2>&1 >/dev/null)
+ [ -n "$enum_err" ] && notes="${notes:+$notes; }$(echo "$enum_err" | tr '\n' ';' | sed 's/;$//') — ignored, chain continued"
+ if [ -f "$_YH_ROOT/project.local.yaml" ]; then
+ enum_err=$(validate_yaml_enum project.local.yaml 2>&1 >/dev/null)
+ [ -n "$enum_err" ] && notes="${notes:+$notes; }local: $(echo "$enum_err" | tr '\n' ';' | sed 's/;$//')"
+ # Locked keys in the local file. Separate from the enum check
+ # above because their VALUES are legal — it is the location that is not, so
+ # every value-shaped validation passes them and resolution then drops them
+ # in silence. Reported, never applied: see validate_local_scope.
+ # Collapsed to one note listing the keys: validate_local_scope prints a
+ # full remedy sentence per key for direct callers, and three copies of it
+ # would cost more of this block than every resolved value put together.
+ local scope_err scope_keys
+ scope_err=$(validate_local_scope project.local.yaml 2>&1 >/dev/null)
+ if [ -n "$scope_err" ]; then
+ scope_keys=$(printf '%s\n' "$scope_err" | sed -n 's/.*`\([^`]*\)`.*/\1/p' | paste -sd, - | sed 's/,/, /g')
+ notes="${notes:+$notes; }local: not locally overridable, ignored — $scope_keys (move to project.yaml or delete)"
+ fi
+ fi
+
+ # Framing costs ~81 chars. For a skill reading 1-2 knobs that is more than the
+ # inline chain it replaced, so bare lines are emitted instead -- "automation:
+ # guided (project.local.yaml)" is self-describing without a banner. Measured:
+ # single-knob skills were +226 chars WITH framing, negative without it.
+ local nkeys=0
+ if [ -n "$want" ]; then
+ nkeys=$(printf '%s' "$want" | tr ',' '\n' | grep -c '[a-z]')
+ fi
+ local bare=0
+ [ -n "$want" ] && [ "$nkeys" -le 2 ] && bare=1
+
+ if [ "$bare" = "1" ]; then
+ :
+ elif [ -n "$want" ]; then
+ echo "=== CCGS Config (resolved: local->yaml->legacy->default; use as-is) ==="
+ else
+ echo "=== CCGS Resolved Config ==="
+ fi
+ for pair in modes.rigor:rigor \
+ modes.review_mode:review_mode \
+ modes.automation:automation \
+ modes.workflow:workflow \
+ docs.density:docs.density \
+ modes.story_granularity:story_granularity \
+ qa.level:qa.level \
+ team.size:team.size \
+ project.stage:project.stage; do
+ _rc_want "${pair##*:}" || continue
+ v=$(resolve_setting "${pair%%:*}")
+ s="${v#*$(printf '\t')}"; v="${v%%$(printf '\t')*}"
+ echo "${pair##*:}: ${v:-not set} ($s)"
+ done
+
+ # automation_always_ask: array-valued, so it does not go through resolve_setting.
+ local aaa
+ if _rc_want automation_always_ask; then
+ aaa=$(get_effective_yaml_array modes.automation_always_ask 2>/dev/null)
+ if [ -n "$aaa" ]; then
+ echo "automation_always_ask: $(echo "$aaa" | tr '\n' ',' | sed 's/,$//; s/,/, /g') (configured)"
+ else
+ echo "automation_always_ask: $(echo "$_yaml_helper_always_ask_default" | tr '\n' ',' | sed 's/,$//; s/,/, /g') (default)"
+ fi
+ fi
+
+ # engine: project.yaml only. No markdown reader is built here — skills keep
+ # their existing technical-preferences.md fallback prose, and forbidden
+ # patterns / allowed libraries never migrate at all.
+ local ename eversion
+ if _rc_want engine; then
+ ename=$(get_yaml_key "$_YH_ROOT/project.yaml" engine.name 2>/dev/null)
+ eversion=$(get_yaml_key "$_YH_ROOT/project.yaml" engine.version 2>/dev/null)
+ if [ -n "$ename" ]; then
+ echo "engine: $ename${eversion:+ $eversion} (project.yaml)"
+ else
+ echo "engine: unset (fall back to .claude/docs/technical-preferences.md)"
+ fi
+ fi
+
+ # testing.strict.*: reported as CONFIGURED STATE ONLY, never defaulted here.
+ # Its unset default differs per skill by design.
+ local ts_out="" k tv
+ if _rc_want testing.strict; then
+ for k in logic integration visual ui config; do
+ tv=$(get_effective_yaml_key "testing.strict.$k" 2>/dev/null)
+ [ -z "$tv" ] && tv=$(get_yaml_key "$_YH_ROOT/project.yaml" testing.strict 2>/dev/null)
+ ts_out="$ts_out $k=${tv:-unset}"
+ done
+ echo "testing.strict:${ts_out} (unset = each skill applies its own default)"
+ fi
+
+ # performance.enforce: warn | block | off, default `warn`.
+ # Unlike testing.strict.* this DOES get defaulted here -- effects-map gives it
+ # a single terminal default (`warn`) rather than a per-skill one, so resolving
+ # it in one place keeps /perf-profile and /gate-check from disagreeing. The
+ # default lives in _yaml_helper_defaults, so resolve_setting supplies it and
+ # labels it, exactly like the nine keys in the loop above.
+ #
+ # WAS `get_effective_yaml_key`, which reads the two YAML files and NOTHING
+ # ELSE -- no enum validation and no source. That broke two invariants at the
+ # one knob whose entire job is to decide whether a breach blocks a release:
+ #
+ # 1. An invalid value WON. `enforce: nonsense` resolved to `nonsense` and
+ # was handed to /perf-profile and /gate-check under a header that says
+ # "use as-is", while the notes line simultaneously claimed it had been
+ # "ignored, chain continued". resolve_setting falls invalid values
+ # through to the default, which is what every other knob already did --
+ # `review_mode: nonsense` resolves to `lean (rigor:standard)`.
+ # 2. No provenance. Every other line names its source; this one printed a
+ # bare value with a `${pe:+}` suffix that expands to nothing -- a
+ # provenance tag someone started and never finished. The key is on the
+ # `/settings --local` whitelist and the docs stress that a teammate's
+ # stricter local setting "is meant to bite on their machine only", so
+ # "did this FAIL come from the project or from my own project.local.yaml"
+ # is exactly the question the line has to answer.
+ local pe
+ if _rc_want performance.enforce; then
+ pe=$(resolve_setting performance.enforce)
+ s="${pe#*$(printf '\t')}"; pe="${pe%%$(printf '\t')*}"
+ echo "performance.enforce: ${pe:-warn} ($s)"
+ fi
+
+ # platform.cert_tier. /launch-checklist and /release-checklist both bootstrap
+ # with `--keys rigor,stage,cert_tier` and are then told "Resolved above -- use
+ # as-is", so without a handler here they receive nothing, always, for the
+ # setting that decides which certification tracks they emit. A setting is not
+ # "wired" because skills REFERENCE it; it is wired when the plumbing that
+ # delivers it exists. Check the plumbing, not the references.
+ #
+ # NO DEFAULT SUBSTITUTED, deliberately. Unset must stay empty so the skills
+ # can take their "ask which platforms are in scope" branch -- obligation 2 of
+ # skill-authoring.md. Substituting `none` would make the question unaskable;
+ # substituting anything else would emit every track, which is the ~150-item
+ # checklist a single-platform jam project once received.
+ local ct
+ if _rc_want cert_tier || _rc_want platform.cert_tier; then
+ ct=$(get_effective_yaml_key platform.cert_tier 2>/dev/null)
+ if [ -n "$ct" ]; then
+ echo "platform.cert_tier: $ct"
+ else
+ echo "platform.cert_tier: (unset -- ask which platforms are in scope)"
+ fi
+ fi
+
+ # system_overrides: dump the whole map so the 10 per-system skills need no
+ # second call. A named <system> is echoed explicitly for convenience.
+ local so_keys so_out="" sk sv
+ if _rc_want system_overrides; then
+ so_keys=$(get_yaml_child_keys project.yaml workflow_overrides.system_overrides 2>/dev/null)
+ if [ -n "$so_keys" ]; then
+ while IFS= read -r sk; do
+ [ -z "$sk" ] && continue
+ sv=$(get_yaml_key "$_YH_ROOT/project.yaml" "workflow_overrides.system_overrides.$sk" 2>/dev/null)
+ [ -n "$sv" ] && so_out="$so_out $sk=$sv"
+ done <<EOF
+$so_keys
+EOF
+ fi
+ echo "system_overrides:${so_out:- none}"
+ fi
+ if [ -n "$system" ]; then
+ sv=$(get_yaml_key "$_YH_ROOT/project.yaml" "workflow_overrides.system_overrides.$system" 2>/dev/null)
+ if [ -n "$sv" ]; then
+ echo "workflow[$system]: $sv (system_overrides)"
+ else
+ v=$(resolve_setting modes.workflow); v="${v%%$(printf '\t')*}"
+ echo "workflow[$system]: $v (no override — project value)"
+ fi
+ fi
+
+ if [ "$bare" = "1" ]; then
+ # Bare form: values only. notes still surface, because a rejected enum value
+ # or a missing interpreter must never be silent.
+ [ -n "$notes" ] && echo "notes: $notes"
+ elif [ -n "$want" ]; then
+ # Terse form: the header already states the chain, and notes only appear
+ # when something actually went wrong. Every line here is paid on every
+ # invocation of every migrated skill.
+ [ -n "$notes" ] && echo "notes: $notes"
+ echo "=== end ==="
+ else
+ echo "notes: ${notes:-none}"
+ echo "Values above are fully resolved (local -> yaml -> legacy -> default). Use as-is."
+ echo "An inline --review flag, if passed, overrides review_mode."
+ echo "=== end CCGS config ==="
+ fi
+ return 0
+}
diff --git a/.claude/rules/agent-memory.md b/.claude/rules/agent-memory.md
new file mode 100644
index 00000000..a79c5487
--- /dev/null
+++ b/.claude/rules/agent-memory.md
@@ -0,0 +1,55 @@
+---
+paths:
+ - ".claude/agent-memory/**"
+---
+
+# Agent Memory Rules
+
+**Agent memory is the one place an agent may write without asking — and the only
+one.** `.claude/agent-memory/` is gitignored, per-agent, and never ships. That
+exemption exists because the memory is the agent's own working notes about how to
+do its job, not a project artifact.
+
+It does **not** extend anywhere else. The Collaboration Protocol still governs
+every file under `src/`, `design/`, `docs/`, `production/` and `assets/`: ask
+first, naming the path. Writing a memory is never a substitute for asking, and a
+memory must never be used to record something the user declined to have written.
+
+## Never record a temporary absence as a durable fact
+
+This is the failure this file exists to prevent, and this repo is unusually
+exposed to it.
+
+**CCGS ships as a template the user clones *as their game*.** So on day one every
+agent observes the same things — no `src/`, no GDDs, no engine configured, no
+`tests/performance/` — and every one of those observations is **guaranteed to
+stop being true**. A memory reading *"this repo is the framework, not a game;
+perf requests have no target"* is accurate when written and actively harmful two
+weeks later, when it tells a future run to return BLOCKED on a project that now
+has a build. The agent will not re-derive it; that is what memory is for.
+
+So:
+
+- **Prefer recording a method over a state.** "Confirm an engine project and a
+ captured profile exist before profiling; return BLOCKED naming what is missing
+ rather than estimating" is durable. "There is no game here" is a timestamp.
+- **If you must record a state, state what invalidates it**, on the same line:
+ `INVALIDATED WHEN: project.yaml declares an engine, or src/ contains game code.`
+ A reader with no other context must be able to tell whether the note still
+ holds.
+- **Never record absence of a game, of assets, of tests or of config as a
+ settled property of the project.** Those are the states CCGS exists to move a
+ user out of.
+
+## Disclose the write
+
+Say in your response that you recorded a memory and where. An unmentioned write
+is indistinguishable from no write, and the user cannot correct a note they do
+not know exists — the same reason a skipped check has to announce itself
+(`.claude/rules/skill-authoring.md`, obligation 3).
+
+## Verify before you trust
+
+A recalled memory reflects what was true when it was written. If it names a file,
+a path, a setting or a count, **check that it still holds before acting on it**.
+Memory is a starting point for investigation, never evidence.
diff --git a/.claude/rules/data-files.md b/.claude/rules/data-files.md
index 7928fd10..173a631d 100644
--- a/.claude/rules/data-files.md
+++ b/.claude/rules/data-files.md
@@ -9,7 +9,19 @@ paths:
- File naming: lowercase with underscores only, following `[system]_[name].json` pattern
- Every data file must have a documented schema (either JSON Schema or documented in the corresponding design doc)
- Numeric values must include comments or companion docs explaining what the numbers mean
-- Use consistent key naming: camelCase for keys within JSON files
+- Use consistent key naming: **`snake_case` for keys within JSON files**, matching
+ the `[system]_[name].json` file convention one line above and the engine idiom
+ every other standard in this repo uses.
+
+ > **On Unity and Unreal this costs you a mapping layer — budget for it rather
+ > than changing the keys.** `JsonUtility` binds by *exact field name*, and C#
+ > fields are `camelCase` per `naming.variables`, so a snake_case file cannot bind
+ > directly to the type that consumes it. Use a private nested DTO whose fields
+ > are the wire format and which maps once into your real type, or take a
+ > dependency that supports a naming policy (Newtonsoft `SnakeCaseNamingStrategy`,
+ > `System.Text.Json` `JsonNamingPolicy`). Do **not** switch the file to camelCase
+ > to avoid the DTO: keys are the cross-engine contract. Write the DTO and
+ > document it as a wire-format boundary — that is the intended shape.
- No orphaned data entries — every entry must be referenced by code or another data file
- Version data files when making breaking schema changes
- Include sensible defaults for all optional fields
@@ -21,16 +33,16 @@ paths:
```json
{
"goblin": {
- "baseHealth": 50,
- "baseDamage": 8,
- "moveSpeed": 3.5,
- "lootTable": "loot_goblin_common"
+ "base_health": 50,
+ "base_damage": 8,
+ "move_speed": 3.5,
+ "loot_table": "loot_goblin_common"
},
"goblin_chief": {
- "baseHealth": 150,
- "baseDamage": 20,
- "moveSpeed": 2.8,
- "lootTable": "loot_goblin_rare"
+ "base_health": 150,
+ "base_damage": 20,
+ "move_speed": 2.8,
+ "loot_table": "loot_goblin_rare"
}
}
```
diff --git a/.claude/rules/design-docs.md b/.claude/rules/design-docs.md
index 33ea6170..cf50a18c 100644
--- a/.claude/rules/design-docs.md
+++ b/.claude/rules/design-docs.md
@@ -5,7 +5,10 @@ paths:
# Design Document Rules
-- Every design document MUST contain these 8 sections: Overview, Player Fantasy, Detailed Rules, Formulas, Edge Cases, Dependencies, Tuning Knobs, Acceptance Criteria
+- The 8 GDD sections are: Overview, Player Fantasy, Detailed Rules, Formulas, Edge Cases, Dependencies, Tuning Knobs, Acceptance Criteria
+- **How many are required depends on `modes.workflow`** — all 8 at `full`, 5 (+ Formulas when the system **defines numeric rules**: rates, curves, thresholds, costs, damage, drop weights — anything a balance pass would tune) at `standard`, none at `minimal` (the design record there is `design/game-brief.md`). Resolve the tier before flagging a section as missing; see `.claude/docs/workflow-modes.md`
+- **The Formulas test is what the system defines, not what it is called.** A system's `Category` in `systems-index.md` is a hint — `Gameplay`, `Economy` and `Progression` almost always qualify — never the test. Do not gate Formulas on a category token: the categories `/map-systems` writes (`Core · Gameplay · Progression · Economy · Persistence · UI · Audio · Narrative · Meta`) do not include `combat` or `AI`, which are example systems *within* `Gameplay`. Every site stating this rule must state the same test.
+- **Section-name alias**: The GDD template and `/design-system` author this section as `## Detailed Design`; the design standard calls it **Detailed Rules**. These are the SAME required section — accept either heading and never rewrite one into the other.
- Formulas must include variable definitions, expected value ranges, and example calculations
- Edge cases must explicitly state what happens, not just "handle gracefully"
- Dependencies must be bidirectional — if system A depends on B, B's doc must mention A
diff --git a/.claude/rules/skill-authoring.md b/.claude/rules/skill-authoring.md
new file mode 100644
index 00000000..05848e6c
--- /dev/null
+++ b/.claude/rules/skill-authoring.md
@@ -0,0 +1,112 @@
+---
+paths:
+ - ".claude/skills/**"
+ - ".claude/agents/**"
+---
+
+# Skill and Gate Authoring
+
+**A check that cannot report that it did not run is not a check.**
+
+The same shape recurs across unrelated subsystems, so treat it as the default
+risk in any check you write, not as an unusual mistake.
+
+The failure is always the same trade: a step that could not run produces output
+indistinguishable from a step that ran and found nothing. Nobody reading the
+output can tell which happened, and the permissive reading is the one that gets
+believed, because it is the one that lets work proceed.
+
+## The five obligations
+
+### 1. Every gating verdict needs a "could not assess" value
+
+If a skill emits a verdict something else depends on, its vocabulary must include
+one — `NOT ASSESSED`, or the local equivalent — and the report must say *which*
+of the reasons applied. A vocabulary of three confident verdicts forces every
+unknown into a claim.
+
+**Rank it deliberately.** It must outrank the pass value: a run that could not
+assess part of its scope has not established that the scope is good. It must
+**not** outrank the failure values: a known problem is more actionable than an
+unknown, and demoting a real failure behind an access problem buries it.
+
+**`NOT ASSESSED` is not a gentler failure verdict.** "I looked and found nothing"
+and "I could not look" have different fixes — one needs work done, the other
+needs access granted or an input classified. Collapsing them sends the reader to
+the wrong fix.
+
+### 2. An absent value may not default to the permissive one
+
+Especially when **nothing in the framework writes that key**. Before defaulting,
+check who sets it: a key with a reader and no writer takes its default branch on
+every project that ever runs, so that branch is not an edge case — it is the
+behaviour.
+
+Over-running a check costs minutes. Under-running one ships the category unrun.
+
+### 3. A skipped step announces itself
+
+In the output, not only in the source. If a phase, category, or agent did not run
+— wrong engine, missing config, unavailable input, a `team.size` that collapses
+the pipeline — the artifact must say so by name. A silent skip and a successful
+one are the same artifact.
+
+A rule enforced in the body and never surfaced in the output is, to the reader,
+identical to no rule at all.
+
+### 4. Never assert what you cannot source — and wire the gap to the verdict
+
+Where this repo pins external facts (`docs/engine-reference/**`), do not fill a
+gap from training data. Write the gap down instead: `NOT SOURCEABLE — <what> is
+not covered by <path>`.
+
+**Flagging alone is not enough.** A named gap that does not reach the verdict is
+just a comment. Wire it: a category with no sourced inputs must force obligation
+1's value, so the gap makes the pass unreachable rather than sitting beside it.
+
+A confidently wrong pattern list is worse than an absent one — it produces a scan
+that looks thorough, finds nothing, and reads as a pass.
+
+### 5. Gates derive their covered set; they do not enumerate it
+
+An allowlist pins what was known when it was written and is silent about
+everything added since. Derive the set from what the repo actually contains, so a
+new skill or agent cannot ship outside coverage by simply not being on a list.
+
+**If the category is not mechanically crisp, say so in the gate and keep the
+list.** A gate that fires on forty files does not get fixed, it gets muted — and
+a muted gate is worse than a narrow one, because it reads as coverage. When you
+keep a list, record *why* derivation failed and state the obligation to extend it.
+
+Two further gate rules earned the hard way:
+
+- **Assert something that cannot be true by accident.** A check for the word
+ "unity" was satisfied by a file path, and case-insensitively by "community".
+ Assert a distinctive token instead.
+- **A gate you have not watched fail is not a gate.** Break the thing it guards,
+ confirm it fails, restore. One mutation per tool invocation — a batch that
+ times out leaves the repo holding a broken file, and `trap … EXIT` does not
+ survive `SIGTERM`.
+
+## Evidence
+
+Every row below is a real instance this rule was written to prevent.
+
+| Where | What was indistinguishable from success |
+|---|---|
+| `team-*` engine step | Specialist skipped when no engine configured — output identical to a run that consulted one |
+| `team-ui` accessibility gate | Passed vacuously; its criterion file did not exist |
+| `yaml-helper` | Locked key in `project.local.yaml` dropped in silence; user saw the default they were overriding |
+| all nine `team-*` | Pipeline printed six agents and ran one, with no statement of the difference |
+| `/security-audit` | Godot-only greps returned zero hits on Unity/Unreal, and zero hits read as clean |
+| `unity/VERSION.md` | "Post-cutoff" table listed pre-cutoff versions, inverting the signal it exists to send |
+| `/security-audit` | `platform.multiplayer` had a reader and no writer; the network category never ran, on any project |
+| `test-evidence-review` | No verdict for "could not check", so an unverifiable story got a verdict saying it was verified |
+| the gate meant to catch all of this | Was a hand-written list, and read green over the gap |
+
+## The test to apply
+
+Before shipping a skill or gate, ask: **if this step silently did not run, what
+would the output look like?**
+
+If the answer is "the same", it is not finished.
diff --git a/.claude/rules/test-standards.md b/.claude/rules/test-standards.md
index c58df152..d7b06fb8 100644
--- a/.claude/rules/test-standards.md
+++ b/.claude/rules/test-standards.md
@@ -12,7 +12,18 @@ paths:
- Performance tests must specify acceptable thresholds and fail if exceeded
- Test data must be defined in the test or in dedicated fixtures, never shared mutable state
- Mock external dependencies — tests should be fast and deterministic
-- Every bug fix must have a regression test that would have caught the original bug
+- Every bug fix must have a regression test that would have caught the original bug —
+ and **you must watch it fail before you trust it.** Run the new test against the
+ unfixed code, confirm it fails, then apply the fix and confirm it passes. A
+ regression test that has only ever been seen passing is not known to test anything.
+
+ > This is `.claude/rules/skill-authoring.md`'s "a gate you have not watched fail
+ > is not a gate", applied to tests. It is written out here because stating the
+ > *goal* is not enough. A regression test for an iteration-order defect can use
+ > a fixture where no cell takes part in two transfers per tick — it then passes
+ > against the very bug it was written for, and looks authoritative doing it. The
+ > fixture, not the assertion, is what makes it useless, and only running it
+ > against the unfixed code exposes that.
## Examples
diff --git a/.claude/scripts/adr-dep-graph.sh b/.claude/scripts/adr-dep-graph.sh
new file mode 100644
index 00000000..65574ce3
--- /dev/null
+++ b/.claude/scripts/adr-dep-graph.sh
@@ -0,0 +1,143 @@
+#!/usr/bin/env bash
+# adr-dep-graph.sh — build the ADR dependency graph and detect cycles.
+#
+# Replaces a full read of every ADR (to extract one table row each) plus a manual
+# cycle trace. A model tracing A→B→C→A across a dozen ADRs will eventually miss an
+# edge; Kahn's algorithm cannot. This is the deterministic half of
+# /gate-check's pre-production "ADR Circular Dependency Check".
+#
+# EMITS OBSERVATIONS, NOT A VERDICT (per .claude/docs/context-management.md rule 2).
+# The caller (gate-pre-production) decides FAIL vs CONCERNS per tier. In
+# particular NO_DEPS_SECTION is load-bearing: it makes "no cycles because the
+# graph is clean" distinguishable from "no cycles because half the ADRs have no
+# dependency section".
+#
+# Usage: bash .claude/scripts/adr-dep-graph.sh [adr-dir]
+# adr-dir defaults to docs/architecture (relative to repo root). An explicit
+# dir (used by the test suite) is taken as-is.
+#
+# Output:
+# ADRS: <n>
+# EDGES: one "adr-A -> adr-B" per Depends-On reference
+# (or " (none)")
+# NO_DEPS_SECTION: adr-X, ... ADRs with no `## ADR Dependencies` / no Depends On
+# CYCLE: adr-A -> adr-B -> adr-A one line per node in a dependency cycle
+# (absent when the graph is acyclic)
+#
+# CORRECTNESS NOTES (mirrors review-scope.sh):
+# - `while IFS= read -r` everywhere: an ADR path with a space must not split.
+# - IDs are normalised to lowercase `adr-NNNN` so a `Depends On: ADR-0003`
+# reference matches the file `adr-0003-*.md`.
+
+set -u
+
+# Default to the repo's ADR dir; an explicit arg (absolute or CWD-relative, used
+# by the suite) is taken as-is without cd-ing to the repo root.
+if [ -n "${1:-}" ]; then
+ ADR_DIR="$1"
+else
+ cd "$(dirname "$0")/../.." || { echo "adr-dep-graph: cannot reach repo root" >&2; exit 1; }
+ ADR_DIR="docs/architecture"
+fi
+
+# Normalise any adr reference (filename or "ADR-0003") to `adr-0003`.
+adr_id() {
+ printf '%s' "$1" | grep -oiE 'adr-[0-9]+' | head -1 | tr 'A-Z' 'a-z'
+}
+
+adr_files=$(find "$ADR_DIR" -maxdepth 1 -name 'adr-*.md' -type f 2>/dev/null \
+ | sed 's|\\|/|g' | sort)
+
+if [ -z "$adr_files" ]; then
+ echo "ADRS: 0"
+ echo "EDGES:"
+ echo " (none — no ADRs in $ADR_DIR)"
+ exit 0
+fi
+
+n=0; edges=""; no_deps=""
+while IFS= read -r f; do
+ [ -n "$f" ] || continue
+ n=$((n + 1))
+ from=$(adr_id "$f")
+
+ # Slice the `## ADR Dependencies` section, take the `**Depends On**` row, and
+ # pull every ADR-NNNN out of its value cell. `None` yields no matches.
+ deps_row=$(awk '
+ /^## /{ insec = ($0 ~ /## ADR Dependencies/) ? 1 : 0 }
+ insec && /\*\*Depends On\*\*/ { print }
+ ' "$f")
+
+ if [ -z "$deps_row" ]; then
+ no_deps="$no_deps $from"
+ continue
+ fi
+
+ to_ids=$(printf '%s' "$deps_row" | grep -oiE 'adr-[0-9]+' | tr 'A-Z' 'a-z' | sort -u)
+ if [ -z "$to_ids" ]; then
+ # Section present but Depends On is "None" (or empty) — a real leaf, not a
+ # missing section. Not reported under NO_DEPS_SECTION.
+ continue
+ fi
+ while IFS= read -r t; do
+ [ -n "$t" ] || continue
+ [ "$t" = "$from" ] && continue # ignore a self-reference
+ edges="$edges$from $t"$'\n'
+ done <<EOF
+$to_ids
+EOF
+done <<EOF
+$adr_files
+EOF
+
+echo "ADRS: $n"
+
+echo "EDGES:"
+if [ -z "$edges" ]; then
+ echo " (none)"
+else
+ printf '%s' "$edges" | while IFS=' ' read -r a b; do
+ [ -n "$a" ] || continue
+ echo " $a -> $b"
+ done
+fi
+
+# no_deps carries a leading space per append; strip it, then comma-join.
+[ -n "$no_deps" ] && echo "NO_DEPS_SECTION: $(printf '%s' "${no_deps# }" | sed 's/ /, /g')"
+
+# Cycle detection — Kahn's algorithm on out-degree (a node "depends on" its
+# out-neighbours; a leaf depends on nothing remaining). Whatever cannot be peeled
+# away is part of a cycle. Reported as an observation; the caller sets the verdict.
+if [ -n "$edges" ]; then
+ cyc=$(printf '%s' "$edges" | awk -F'\t' '
+ NF==2 {
+ e_from[++ne]=$1; e_to[ne]=$2
+ node[$1]=1; node[$2]=1
+ od[$1]++
+ }
+ END {
+ total=0; for (x in node) total++
+ removed=0; progress=1
+ while (progress) {
+ progress=0
+ for (x in node) {
+ if (gone[x] || od[x] > 0) continue
+ gone[x]=1; removed++; progress=1
+ for (i=1;i<=ne;i++)
+ if (e_to[i]==x && !edone[i]) { edone[i]=1; od[e_from[i]]-- }
+ }
+ }
+ if (removed < total)
+ for (x in node) if (!gone[x]) print x
+ }
+ ' | sort)
+ if [ -n "$cyc" ]; then
+ # printf '%s\n' (not '%s') so the final node isn't dropped by read.
+ printf '%s\n' "$cyc" | while IFS= read -r x; do
+ [ -n "$x" ] || continue
+ # Show each cycle node with the in-cycle edges it participates in.
+ outs=$(printf '%s' "$edges" | awk -F'\t' -v x="$x" '$1==x{printf " -> %s", $2}')
+ echo "CYCLE: $x$outs"
+ done
+ fi
+fi
diff --git a/.claude/scripts/artifact-check.sh b/.claude/scripts/artifact-check.sh
new file mode 100644
index 00000000..7b298d50
--- /dev/null
+++ b/.claude/scripts/artifact-check.sh
@@ -0,0 +1,296 @@
+#!/usr/bin/env bash
+# artifact-check.sh — evaluate every workflow-catalog step's artifact spec
+# against what is actually on disk.
+#
+# Replaces the "Use Glob and Read to verify files exist and have meaningful
+# content" loop in /gate-check (and the equivalent hand-scans in /help and
+# /project-stage-detect). workflow-catalog.yaml already encodes `glob`,
+# `pattern`, `min_count` and `any_of` per step; nothing consumed it
+# deterministically, so the model re-derived the same answers by opening files.
+#
+# EMITS OBSERVATIONS, NOT A VERDICT (per .claude/docs/context-management.md
+# rule 2). It reports what is on disk; the CALLER applies the workflow tier,
+# the required/optional distinction, and any per-system override. In
+# particular this script never says PASS or FAIL, and never decides that an
+# ABSENT artifact is a blocker — at `minimal` most of them are not.
+#
+# Usage: bash .claude/scripts/artifact-check.sh [--phase <id>] [project-root]
+# --phase <id> restrict output to one phase (concept, systems-design, ...)
+# project-root defaults to the repo root; an explicit path is taken as-is
+# (used by the test suite against fixtures).
+#
+# Output:
+# CATALOG: <path> the catalog actually read
+# ROOT: <path> the tree evaluated against
+# PHASES: <n> / STEPS: <n> denominators — see below
+# PHASE: <id>
+# STEP: <id> required=<bool> repeatable=<bool> check=<kind> status=<status> ...
+#
+# status values (observations):
+# PRESENT glob matched, count >= min_count, pattern found if specified
+# ABSENT no file matched the glob
+# SHORT files matched but fewer than min_count
+# PATTERN_MISS files matched but none contained the required pattern
+# NO_CHECK the step declares no artifact — completion is not detectable
+# from disk. NOT the same as ABSENT. A `note=` field carries the
+# catalog's human-readable fallback where one exists.
+#
+# DENOMINATOR DISCIPLINE (mirrors create-control-manifest / adr-dep-graph.sh):
+# STEPS is printed before any per-step line so a caller can tell "0 steps
+# reported because the catalog failed to parse" from "0 steps are incomplete".
+# A NO_CHECK count is printed too — a phase that is all NO_CHECK has been
+# *scanned*, not *satisfied*, and reporting it as clean would be a false pass.
+#
+# Patterns are POSIX ERE and are matched with `grep -E`, never Python `re`
+# (the catalog uses classes like [[:space:]]) and never `grep -P` (unavailable
+# on Windows Git Bash — see .claude/docs/coding-standards notes).
+
+set -u
+
+PHASE_FILTER=""
+ROOT_ARG=""
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --phase) PHASE_FILTER="${2:-}"; shift 2 ;;
+ --phase=*) PHASE_FILTER="${1#--phase=}"; shift ;;
+ -h|--help) sed -n '2,40p' "$0"; exit 0 ;;
+ *) ROOT_ARG="$1"; shift ;;
+ esac
+done
+
+if [ -n "$ROOT_ARG" ]; then
+ ROOT="$ROOT_ARG"
+else
+ cd "$(dirname "$0")/../.." || { echo "artifact-check: cannot reach repo root" >&2; exit 1; }
+ ROOT="$(pwd)"
+fi
+
+CATALOG="$ROOT/.claude/docs/workflow-catalog.yaml"
+if [ ! -f "$CATALOG" ]; then
+ echo "artifact-check: catalog not found at $CATALOG" >&2
+ exit 1
+fi
+
+# Python fallback chain: python -> python3 -> py (matches yaml-helper.sh:65).
+PYBIN=""
+for candidate in python python3 py; do
+ if command -v "$candidate" >/dev/null 2>&1; then
+ if "$candidate" -c 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)' >/dev/null 2>&1; then
+ PYBIN="$candidate"; break
+ fi
+ fi
+done
+if [ -z "$PYBIN" ]; then
+ echo "artifact-check: no python 3 interpreter found (tried python, python3, py)" >&2
+ exit 1
+fi
+
+"$PYBIN" - "$CATALOG" "$ROOT" "$PHASE_FILTER" <<'PYEOF'
+import glob as globmod
+import os
+import subprocess
+import sys
+
+catalog_path, root, phase_filter = sys.argv[1], sys.argv[2], sys.argv[3]
+
+# A gate's own output path is part of the gate: the catalog's `note:` fields
+# contain em-dashes, and on a cp1252 console an unreconfigured stdout raises
+# UnicodeEncodeError mid-report — dying after some rows have printed, which
+# reads as a short but successful run. Force UTF-8 and never crash on a glyph.
+try:
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
+except (AttributeError, ValueError):
+ pass
+
+
+def indent_of(line):
+ return len(line) - len(line.lstrip(" "))
+
+
+def strip_val(v):
+ v = v.strip()
+ if len(v) >= 2 and v[0] == v[-1] and v[0] in "\"'":
+ v = v[1:-1]
+ return v
+
+
+# --- parse ---------------------------------------------------------------
+# Hand-rolled on purpose: PyYAML is not a guaranteed dependency (yaml-helper.sh
+# promises "no external deps beyond a Python 3 interpreter"). The catalog's
+# shape is fixed and regular, so an indentation walk is sufficient and cannot
+# drag in an import that fails on a user's machine.
+with open(catalog_path, encoding="utf-8", errors="replace") as fh:
+ lines = [ln.rstrip("\n").rstrip("\r") for ln in fh]
+
+phases = [] # [(phase_id, [step, ...])]
+cur_phase = None
+cur_step = None
+ctx = None # None | "artifact" | "any_of"
+in_phases = False
+
+for raw in lines:
+ if not raw.strip() or raw.lstrip().startswith("#"):
+ continue
+ ind = indent_of(raw)
+ s = raw.strip()
+
+ if ind == 0:
+ in_phases = (s == "phases:")
+ continue
+ if not in_phases:
+ continue
+
+ if ind == 2 and s.endswith(":"):
+ cur_phase = (s[:-1].strip(), [])
+ phases.append(cur_phase)
+ cur_step = None
+ ctx = None
+ continue
+ if cur_phase is None:
+ continue
+
+ if ind == 6 and s.startswith("- id:"):
+ cur_step = {"id": strip_val(s[len("- id:"):]), "required": False,
+ "repeatable": False, "artifact": None, "note": None}
+ cur_phase[1].append(cur_step)
+ ctx = None
+ continue
+ if cur_step is None:
+ continue
+
+ if ind == 8:
+ ctx = None
+ if s == "artifact:":
+ cur_step["artifact"] = {"glob": None, "pattern": None,
+ "min_count": 1, "any_of": [], "note": None}
+ ctx = "artifact"
+ elif s.startswith("required:"):
+ cur_step["required"] = strip_val(s[len("required:"):]).lower() == "true"
+ elif s.startswith("repeatable:"):
+ cur_step["repeatable"] = strip_val(s[len("repeatable:"):]).lower() == "true"
+ continue
+
+ art = cur_step["artifact"]
+ if art is None:
+ continue
+
+ if ind == 10:
+ if s == "any_of:":
+ ctx = "any_of"
+ elif s.startswith("glob:"):
+ art["glob"] = strip_val(s[len("glob:"):]); ctx = "artifact"
+ elif s.startswith("pattern:"):
+ art["pattern"] = strip_val(s[len("pattern:"):]); ctx = "artifact"
+ elif s.startswith("min_count:"):
+ try:
+ art["min_count"] = int(strip_val(s[len("min_count:"):]))
+ except ValueError:
+ pass
+ ctx = "artifact"
+ elif s.startswith("note:"):
+ art["note"] = strip_val(s[len("note:"):]); ctx = "artifact"
+ continue
+
+ if ind >= 12 and ctx == "any_of":
+ if s.startswith("- glob:"):
+ art["any_of"].append({"glob": strip_val(s[len("- glob:"):]), "pattern": None})
+ elif s.startswith("pattern:") and art["any_of"]:
+ art["any_of"][-1]["pattern"] = strip_val(s[len("pattern:"):])
+
+# --- evaluate ------------------------------------------------------------
+def match_files(pat):
+ if not pat:
+ return []
+ full = os.path.join(root, pat.replace("/", os.sep))
+ return sorted(p for p in globmod.glob(full, recursive=True) if os.path.isfile(p))
+
+
+def pattern_hits(files, pattern):
+ """POSIX ERE via grep -E. Python's re cannot parse [[:space:]], and grep -P
+ is unavailable on Windows Git Bash."""
+ if not pattern:
+ return files
+ hits = []
+ for f in files:
+ try:
+ rc = subprocess.call(["grep", "-qE", "--", pattern, f],
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ except OSError:
+ return None # no grep — caller reports UNKNOWN rather than a false miss
+ if rc == 0:
+ hits.append(f)
+ return hits
+
+
+def evaluate(art):
+ """-> (status, kind, detail dict). Observation only; no verdict."""
+ if art is None:
+ return "NO_CHECK", "none", {}
+
+ if art["any_of"]:
+ for i, alt in enumerate(art["any_of"]):
+ files = match_files(alt["glob"])
+ if not files:
+ continue
+ hits = pattern_hits(files, alt["pattern"])
+ if hits is None:
+ return "UNKNOWN", "any_of", {"why": "grep-unavailable"}
+ if hits:
+ return "PRESENT", "any_of", {"match": alt["glob"], "alt": str(i + 1)}
+ return "ABSENT", "any_of", {"alts": str(len(art["any_of"]))}
+
+ if not art["glob"]:
+ return "NO_CHECK", "none", ({"note": art["note"]} if art["note"] else {})
+
+ files = match_files(art["glob"])
+ if not files:
+ return "ABSENT", "glob", {"glob": art["glob"]}
+
+ hits = pattern_hits(files, art["pattern"])
+ if hits is None:
+ return "UNKNOWN", "glob", {"why": "grep-unavailable"}
+ if art["pattern"] and not hits:
+ return "PATTERN_MISS", "glob", {"glob": art["glob"], "found": str(len(files))}
+
+ counted = hits if art["pattern"] else files
+ need = art["min_count"]
+ if len(counted) < need:
+ return "SHORT", "glob", {"glob": art["glob"], "count": str(len(counted)), "min": str(need)}
+ d = {"count": str(len(counted))}
+ if need > 1:
+ d["min"] = str(need)
+ return "PRESENT", "glob", d
+
+
+sel = [(pid, steps) for pid, steps in phases if not phase_filter or pid == phase_filter]
+
+if phase_filter and not sel:
+ known = ", ".join(pid for pid, _ in phases) or "(none parsed)"
+ sys.stderr.write("artifact-check: unknown phase '%s' (known: %s)\n" % (phase_filter, known))
+ sys.exit(2)
+
+total_steps = sum(len(s) for _, s in sel)
+print("CATALOG: %s" % os.path.relpath(catalog_path, root).replace(os.sep, "/"))
+print("ROOT: %s" % root.replace(os.sep, "/"))
+print("PHASES: %d" % len(sel))
+print("STEPS: %d" % total_steps)
+
+no_check = 0
+rows = []
+for pid, steps in sel:
+ rows.append("PHASE: %s" % pid)
+ for st in steps:
+ status, kind, det = evaluate(st["artifact"])
+ if status == "NO_CHECK":
+ no_check += 1
+ extra = "".join(" %s=%s" % (k, v) for k, v in sorted(det.items()) if v is not None)
+ rows.append(" STEP: %s required=%s repeatable=%s check=%s status=%s%s"
+ % (st["id"], str(st["required"]).lower(),
+ str(st["repeatable"]).lower(), kind, status, extra))
+
+# Printed BEFORE the rows so a caller reading top-down knows how much of what
+# follows is undetectable-from-disk before it reads any of it.
+print("NO_CHECK: %d" % no_check)
+for r in rows:
+ print(r)
+PYEOF
diff --git a/.claude/scripts/gdd-structure-check.sh b/.claude/scripts/gdd-structure-check.sh
new file mode 100644
index 00000000..34b2229a
--- /dev/null
+++ b/.claude/scripts/gdd-structure-check.sh
@@ -0,0 +1,94 @@
+#!/usr/bin/env bash
+# gdd-structure-check.sh — deterministic section-presence check for system GDDs.
+#
+# Replaces a full-document model read per GDD with ~2 lines of output that cannot
+# hallucinate a missing section. This is the cheapest real win available: the
+# model spends its budget judging content, not counting headings.
+#
+# REPORTS PRESENCE ONLY — IT DOES NOT JUDGE COMPLETENESS.
+# Which sections are REQUIRED depends on the workflow tier and on what the system
+# defines (/design-review Phase 2b: Player Fantasy and Tuning Knobs are advisory
+# at `standard`; Formulas is required at `standard` whenever the system defines
+# numeric rules -- rates, curves, thresholds, costs. The system's category is a
+# hint, not the test). A `standard`-tier GDD missing Player Fantasy is
+# COMPLETE, so an "N/8" score would actively misreport it. The caller applies the
+# tier; this script only says what is on disk.
+#
+# Usage:
+# bash .claude/scripts/gdd-structure-check.sh # all system GDDs
+# bash .claude/scripts/gdd-structure-check.sh design/gdd/foo.md # one GDD
+#
+# Output (per GDD; the ABSENT line is omitted when nothing is absent):
+# combat.md PRESENT: Overview,Player Fantasy,Detailed Rules,...
+# loot.md PRESENT: Overview,Detailed Rules,Edge Cases
+# loot.md ABSENT: Player Fantasy,Formulas,Tuning Knobs
+
+set -u
+
+cd "$(dirname "$0")/../.." || { echo "gdd-structure-check: cannot reach repo root" >&2; exit 1; }
+
+# Each MATCH entry is an ERE alternation of every accepted heading for one
+# required section; LABEL is the canonical name reported to the caller.
+#
+# "Detailed Rules" is authored as "## Detailed Design" by the GDD template and by
+# /design-system. They denote the SAME required section. Accepting only one name
+# reports 7/8 MISSING on every conforming GDD — the exact failure this guard
+# exists to prevent, and it is regression-tested.
+MATCH=("Overview" \
+ "Player Fantasy" \
+ "Detailed (Rules|Design)" \
+ "Formulas" \
+ "Edge Cases" \
+ "Dependencies" \
+ "Tuning Knobs" \
+ "Acceptance Criteria")
+LABEL=("Overview" "Player Fantasy" "Detailed Rules" "Formulas" "Edge Cases" \
+ "Dependencies" "Tuning Knobs" "Acceptance Criteria")
+
+# Governance and registry docs that live in design/gdd/ but are not system GDDs.
+not_a_system_gdd() {
+ case "$(basename "$1")" in
+ game-concept.md|systems-index.md|game-pillars.md|gdd-cross-review-*.md) return 0 ;;
+ gameplay-tags.md|fixture-swap-ledger.md|entity-registry.md) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+check_file() {
+ local f="$1" present="" absent="" i s
+ for i in "${!MATCH[@]}"; do
+ s="${MATCH[$i]}"
+ # [[:space:]] not [ \t] — inside double quotes the shell leaves \t literal
+ # and ERE reads the class as {space, backslash, t}, so real tabs fail to
+ # match while "##tOverview" false-positives.
+ if grep -qiE "^##+[[:space:]]+([0-9]+[.)]?[[:space:]]*)?${s}" "$f"; then
+ present="$present,${LABEL[$i]}"
+ else
+ absent="$absent,${LABEL[$i]}"
+ fi
+ done
+ local b; b="$(basename "$f")"
+ echo "$b PRESENT: ${present#,}"
+ [ -n "$absent" ] && echo "$b ABSENT: ${absent#,}"
+ return 0
+}
+
+if [ $# -gt 0 ] && [ -n "${1:-}" ]; then
+ [ -f "$1" ] || { echo "Not found: $1" >&2; exit 1; }
+ check_file "$1"
+ exit 0
+fi
+
+any=0
+# -maxdepth 1 keeps design/gdd/reviews/ out of scope — /design-review writes its
+# own output there, and sweeping it in makes the tool review its own reports.
+while IFS= read -r f; do
+ [ -n "$f" ] || continue
+ not_a_system_gdd "$f" && continue
+ any=1
+ check_file "$f"
+done <<EOF
+$(find design/gdd -maxdepth 1 -name '*.md' -type f 2>/dev/null | sort)
+EOF
+
+[ "$any" -eq 1 ] || echo "No system GDDs found in design/gdd/."
diff --git a/.claude/scripts/migrate-v1-config.sh b/.claude/scripts/migrate-v1-config.sh
new file mode 100644
index 00000000..9690d55f
--- /dev/null
+++ b/.claude/scripts/migrate-v1-config.sh
@@ -0,0 +1,740 @@
+#!/usr/bin/env bash
+#
+# migrate-v1-config.sh — convert a v1.0 CCGS project to v1.1 `project.yaml`.
+#
+# WHY THIS IS A SCRIPT AND NOT SKILL PROSE
+#
+# "Migration on a real v1.0 project loses data" is the highest-severity risk in
+# this whole area. Skill files are prose executed by a model and cannot be
+# unit-tested, so a prose migration could not be proven correct before being
+# pointed at someone's project. Every
+# failure mode the spec names — malformed file, enum mismatch, split-brain,
+# custom sections — is a testable branch here instead.
+#
+# Spec: `.claude/docs/effects-map.md` -> "Migration from v1.0 -> v1.1".
+# That section is the authority. If this script and that section disagree, the
+# section wins and this script is the bug.
+#
+# MODES
+# (default) migrate: write project.yaml + production/migration-report.md
+# --dry-run report what would happen; write nothing
+# --finalize delete legacy files, but ONLY after proving their content is
+# preserved in project.yaml
+#
+# NON-DESTRUCTIVE BY DEFAULT. Migration leaves every legacy file in place, so
+# the whole operation is reversible with `git checkout` until --finalize is run
+# deliberately. That is why --finalize is a separate invocation and not a flag
+# on the same run.
+
+set -u
+export LC_ALL=C
+
+REPO="$(cd "$(dirname "$0")/../.." && pwd)"
+cd "$REPO" || exit 1
+
+MODE="migrate"
+case "${1:-}" in
+ --dry-run) MODE="dry-run" ;;
+ --finalize) MODE="finalize" ;;
+ "") MODE="migrate" ;;
+ *) echo "usage: $0 [--dry-run|--finalize]" >&2; exit 2 ;;
+esac
+
+PY="project.yaml"
+STAGE_TXT="production/stage.txt"
+REVIEW_TXT="production/review-mode.txt"
+TP=".claude/docs/technical-preferences.md"
+REPORT="production/migration-report.md"
+
+WARN=""
+MANUAL=""
+warn() { WARN="${WARN}- $1"$'\n'; }
+manual() { MANUAL="${MANUAL}- $1"$'\n'; }
+
+# --- legacy detection -------------------------------------------------------
+
+legacy_present() {
+ [ -f "$STAGE_TXT" ] || [ -f "$REVIEW_TXT" ] || { [ -f "$TP" ] && tp_configured; }
+}
+
+# A technical-preferences.md full of [TO BE CONFIGURED] is the template default,
+# not a v1.0 project's data. Treating it as legacy content would make every
+# fresh clone look like it needs migrating.
+# Only the keys this script actually MIGRATES count as legacy data.
+#
+# `\*\*[^*]+\*\*` matched ANY bullet, and the shipped template carries one line
+# that is a prose default rather than a placeholder:
+# - **Required Tests**: Balance formulas, gameplay systems, networking
+# so a FRESH v1.1 clone satisfied this and legacy_present() returned true for it.
+# With project.yaml also present that is the split-brain branch, so `--dry-run`
+# on an ordinary v1.1 project answered "REFUSED: both project.yaml and legacy
+# files exist. Resolve which is authoritative before migrating." -- naming a
+# conflict that does not exist and blocking the preview. That is precisely the
+# case the note above says this function exists to prevent.
+#
+# Keys, not shape. A value under a key nothing reads is not data this migration
+# would carry over, so it cannot be evidence that a migration is needed.
+# `Required Tests` is guidance for a human and is never passed to tp_get.
+#
+# This list is every key handed to tp_get below -- keep the two in step. A key
+# missing from here fails safe (the file reads as unconfigured) rather than
+# resurrecting the false positive.
+_TP_KEYS='Engine|Language|Rendering|Physics|Target Platforms|Primary Input|Gamepad Support|Touch Support|Classes|Variables|Constants|Signals(/Events)?|Files|Scenes(/Prefabs)?|Target Framerate|Frame Budget|Draw Calls|Memory Ceiling|Framework|Minimum Coverage|Additional Specialists|Language/Code Specialist|Shader Specialist|UI Specialist'
+tp_configured() {
+ [ -f "$TP" ] || return 1
+ grep -qE "^[[:space:]]*-[[:space:]]+\*\*($_TP_KEYS)\*\*:[[:space:]]*[^[:space:]\[]" "$TP" 2>/dev/null
+}
+
+# --- technical-preferences.md parsing ---------------------------------------
+
+# tp_get <section> <key> -> value, or empty when absent/unconfigured.
+#
+# JOINS WRAPPED CONTINUATION LINES. Reading only the first physical line
+# truncated values mid-sentence -- a framerate budget migrated as
+# "...Pro-tier target.** *(Changed", cut exactly where the author had wrapped.
+# A continuation is indented and is not itself a new `- **Key**:` bullet.
+tp_get() {
+ [ -f "$TP" ] || return 0
+ awk -v sec="$1" -v key="$2" '
+ index($0, "## " sec) == 1 { ins = 1; next }
+ ins && index($0, "## ") == 1 { ins = 0 }
+ ins && grab {
+ if ($0 ~ /^[[:space:]]+[^[:space:]]/ && $0 !~ /^[[:space:]]*-[[:space:]]+\*\*/) {
+ cont = $0
+ sub(/^[[:space:]]+/, "", cont)
+ gsub(/[[:space:]]+$/, "", cont)
+ val = val " " cont
+ next
+ }
+ print val; grab = 0; exit
+ }
+ ins {
+ pat = "^- \\*\\*" key "\\*\\*:[[:space:]]*"
+ if ($0 ~ pat) {
+ val = $0
+ sub(pat, "", val)
+ gsub(/[[:space:]]+$/, "", val)
+ grab = 1
+ next
+ }
+ }
+ END { if (grab) print val }
+ ' "$TP" | sed 's/^\[TO BE CONFIGURED.*$//'
+}
+
+# Strip a trailing unit so "16.67ms" and "1024MB" become numbers. Non-numeric
+# input is returned untouched, which is what surfaces a forked file's prose.
+num() { printf '%s' "$1" | sed -E 's/[[:space:]]*(ms|MB|mb|fps|FPS|%)[[:space:]]*$//'; }
+
+is_num() { printf '%s' "$1" | grep -qE '^[0-9]+(\.[0-9]+)?$'; }
+
+# Escapes before quoting. These values are hand-written markdown prose, so a
+# double quote inside one is ordinary -- and wrapping it unescaped emitted
+# `key: "He said "hi""`, which is not valid YAML and takes the whole file down
+# with it. Backslashes first, or the quote's escape gets re-escaped.
+# Escapes before quoting. These values are hand-written markdown prose, so a
+# double quote inside one is ordinary -- and wrapping it unescaped emitted
+# `key: "He said "hi""`, which is not valid YAML and takes the whole file down
+# with it. Backslashes first, or the quote's escape gets re-escaped.
+yaml_str() {
+ [ -z "$1" ] && { printf 'null'; return; }
+ _ys=$1
+ _ys=${_ys//\\/\\\\}
+ _ys=${_ys//\"/\\\"}
+ printf '"%s"' "$_ys"
+}
+yaml_num() { { [ -z "$1" ] || ! is_num "$1"; } && printf 'null' || printf '%s' "$1"; }
+
+# --- shared legacy-file reader ----------------------------------------------
+
+# Trim CR and leading/trailing whitespace from the first line, but NEVER interior
+# spaces: two valid v1.1 stages contain one (`Systems Design`, `Technical Setup`).
+# A `tr -d ' \r\n'` here silently produced `SystemsDesign`, which fails the enum
+# and made the migrate-step warning misdiagnose a valid stage as a forked one.
+#
+# BOTH the migrate step and the finalize verifier below must use this. They read
+# the same legacy files and compare the results, so any divergence in trimming
+# desynchronises them: while both mangled `Systems Design` identically the
+# comparison still matched, but fixing only the writer would make finalize search
+# project.yaml for a value migrate never wrote and refuse to delete anything.
+# Quote regex metacharacters before a value is spliced into a grep -E pattern.
+# The finalize verifier builds its pattern from legacy file content, so a forked
+# value like `Alpha (draft)` would be read as a regex group and never match, so
+# the script would refuse to delete a file whose content HAD been preserved. That
+# fails closed, which is the right direction, but it fails on correct input.
+re_quote() { printf '%s' "$1" | sed 's/[][\\.*^$(){}?+|/]/\\&/g'; }
+
+trim_line() {
+ sed -e 's/\r//g' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' "$1" | head -1
+}
+
+# --- preflight --------------------------------------------------------------
+
+# A legacy file whose value project.yaml ALREADY carries is a MIRROR, not a
+# rival source of truth.
+#
+# `/start` writes production/stage.txt on every NEW v1.1 project, deliberately,
+# as a mirror for hooks that have not migrated -- its own header says so.
+# legacy_present() cannot tell that from a v1.0 leftover, so every project
+# onboarded by /start answered:
+#
+# REFUSED: both project.yaml and legacy files exist.
+# Resolve which is authoritative before migrating.
+#
+# with nothing whatever to resolve, because the two agreed. And the same message
+# points the user at --finalize, which verifies the value is preserved and then
+# DELETES the mirror /start had just created on purpose.
+#
+# The test is the one --finalize already applies, inverted: a legacy value
+# project.yaml does not carry is a genuine second source; one it does carry is a
+# mirror and needs no resolution. Only reachable when project.yaml exists, so a
+# real v1.0 project -- which has none -- takes exactly the path it did before.
+#
+# These helpers must be defined ABOVE this point. A preflight placed before them
+# can only ever call legacy_present().
+legacy_conflict() {
+ _lc=""
+ if [ -f "$STAGE_TXT" ]; then
+ _lc=$(trim_line "$STAGE_TXT")
+ [ -z "$_lc" ] || grep -qE "^[[:space:]]*stage:[[:space:]]*\"?$(re_quote "$_lc")\"?" "$PY" || return 0
+ fi
+ if [ -f "$REVIEW_TXT" ]; then
+ _lc=$(trim_line "$REVIEW_TXT")
+ # The same v1.0 `none` -> v1.1 `solo` rename the migrate step applies, or a
+ # v1.0 project that chose "no reviews" would read as a disagreement.
+ [ "$_lc" = "none" ] && _lc="solo"
+ [ -z "$_lc" ] || grep -qE "^[[:space:]]*review_mode:[[:space:]]*\"?$(re_quote "$_lc")\"?" "$PY" || return 0
+ fi
+ if [ -f "$TP" ] && tp_configured; then
+ _lc=$(tp_get "Engine & Language" "Engine" | awk '{print $1}')
+ [ -z "$_lc" ] || grep -qE "^[[:space:]]*name:[[:space:]]*\"?$(re_quote "$_lc")\"?" "$PY" || return 0
+ fi
+ return 1
+}
+
+if [ "$MODE" != "finalize" ]; then
+ if [ -f "$PY" ] && legacy_present; then
+ # THREE states share this shape and only two are problems. Collapsing them
+ # is what made a brand-new project look like a split brain.
+ if legacy_conflict; then
+ # Values differ: a real second source of truth, and no way to know which
+ # the user edited last.
+ echo "REFUSED: both $PY and legacy files exist, and their values DISAGREE."
+ echo " Resolve which is authoritative before migrating."
+ echo " If you already migrated, the next step is: $0 --finalize"
+ exit 3
+ elif [ -f "$REPORT" ]; then
+ # Values agree AND a migration ran here -- the report is written by this
+ # script and by nothing else. The legacy files are post-migration
+ # leftovers, so --finalize is the next step and a second `migrate` is not.
+ # Refusing is what keeps the user off that path.
+ echo "REFUSED: both $PY and legacy files exist."
+ echo " Resolve which is authoritative before migrating."
+ echo " If you already migrated, the next step is: $0 --finalize"
+ exit 3
+ else
+ # Values agree and no migration ever ran here. These are v1.1 mirrors --
+ # /start writes production/stage.txt on every new project by design.
+ # Nothing to resolve, and --finalize would DELETE a file /start meant to
+ # create.
+ echo "Nothing to do: $PY exists and the legacy files mirror it (values agree)."
+ exit 0
+ fi
+ fi
+ if [ -f "$PY" ]; then
+ echo "Nothing to do: $PY exists and no legacy config was found."
+ exit 0
+ fi
+ if ! legacy_present; then
+ echo "Nothing to do: no legacy config files found (not a v1.0 project)."
+ exit 0
+ fi
+fi
+
+# --- finalize ---------------------------------------------------------------
+
+if [ "$MODE" = "finalize" ]; then
+ [ -f "$PY" ] || { echo "REFUSED: $PY does not exist. Run migration first."; exit 3; }
+ FAILED=""
+ # Verify preservation before deleting anything. A legacy file is only removed
+ # once its value is demonstrably present in project.yaml.
+ if [ -f "$STAGE_TXT" ]; then
+ want=$(trim_line "$STAGE_TXT")
+ grep -qE "^[[:space:]]*stage:[[:space:]]*\"?$(re_quote "$want")\"?" "$PY" || FAILED="$FAILED $STAGE_TXT"
+ fi
+ if [ -f "$REVIEW_TXT" ]; then
+ want=$(trim_line "$REVIEW_TXT")
+ # Mirror the migrate step's v1.0 `none` -> v1.1 `solo` rename, or this check
+ # would look for `review_mode: none` (never written) and refuse to finalize.
+ [ "$want" = "none" ] && want="solo"
+ grep -qE "^[[:space:]]*review_mode:[[:space:]]*\"?$(re_quote "$want")\"?" "$PY" || FAILED="$FAILED $REVIEW_TXT"
+ fi
+ if [ -f "$TP" ] && tp_configured; then
+ want=$(tp_get "Engine & Language" "Engine" | awk '{print $1}')
+ [ -z "$want" ] || grep -qE "^[[:space:]]*name:[[:space:]]*\"?$(re_quote "$want")\"?" "$PY" || FAILED="$FAILED $TP"
+ fi
+ if [ -n "$FAILED" ]; then
+ echo "REFUSED: content not preserved in $PY for:$FAILED"
+ echo " Nothing was deleted. Re-run migration or fix $PY by hand."
+ exit 4
+ fi
+ for f in "$STAGE_TXT" "$REVIEW_TXT"; do
+ [ -f "$f" ] && rm -f "$f" && echo "deleted $f"
+ done
+ echo "NOTE: $TP is NOT deleted — it still holds Forbidden Patterns and"
+ echo " Allowed Libraries, which have no project.yaml equivalent."
+ echo "finalize complete."
+ exit 0
+fi
+
+# --- parse ------------------------------------------------------------------
+
+STAGE=""; REVIEW=""
+if [ -f "$STAGE_TXT" ]; then
+ STAGE=$(trim_line "$STAGE_TXT")
+ [ -z "$STAGE" ] && warn "$STAGE_TXT is empty — project.stage left unset"
+fi
+if [ -f "$REVIEW_TXT" ]; then
+ REVIEW=$(trim_line "$REVIEW_TXT")
+ [ -z "$REVIEW" ] && warn "$REVIEW_TXT is empty — modes.review_mode left unset, so modes.rigor supplies it"
+ # The consequential direction, which went unreported until it was measured.
+ # An explicit modes.review_mode OUTRANKS the modes.rigor expansion -- that is
+ # deliberate, so a genuine v1.0 choice survives migration. But it means rigor
+ # can never move review depth on this project again, and the user is told
+ # elsewhere that rigor "drives six settings". On a migrated project it drives
+ # five. Reporting only the empty case explained the harmless half.
+ [ -n "$REVIEW" ] && warn "$REVIEW_TXT is '$REVIEW' — modes.review_mode is now set EXPLICITLY, which outranks the modes.rigor expansion. Setting modes.rigor later will NOT change review depth on this project. To let rigor drive it, delete the modes.review_mode line from project.yaml after migrating."
+fi
+
+# Enum checks. A fork may hold values v1.1 does not know; the spec says preserve
+# them raw and flag, never silently coerce.
+case "$STAGE" in
+ ""|Concept|"Systems Design"|"Technical Setup"|Pre-Production|Production|Polish|Release) ;;
+ *) warn "project.stage \`$STAGE\` is not a v1.1 stage — preserved raw, resolve by hand"; manual "Confirm \`project.stage: $STAGE\` is intended" ;;
+esac
+# v1.0 used `none` for "no director reviews"; v1.1 renamed that tier to `solo`.
+# Map it transparently (the rename is reported below via warn()) rather than
+# writing `none`, which v1.1's enum rejects — that would silently resolve to
+# `lean`, the OPPOSITE of the user's intent. This is a documented rename, not a
+# forked value, so it is coerced-and-flagged, not preserved-raw. See
+# effects-map.md "Migration from v1.0 -> v1.1".
+if [ "$REVIEW" = "none" ]; then
+ REVIEW="solo"
+ warn "modes.review_mode \`none\` (v1.0 \"no reviews\") migrated to v1.1 \`solo\` — the renamed \"no reviews\" tier"
+fi
+case "$REVIEW" in
+ ""|full|lean|solo) ;;
+ *) warn "modes.review_mode \`$REVIEW\` is not a v1.1 value — preserved raw, resolve by hand"; manual "Confirm \`modes.review_mode: $REVIEW\` is intended" ;;
+esac
+# NO DEFAULT HERE. `production/review-mode.txt` was OPTIONAL in v1.0, so it is
+# absent for a large share of upgraders. Defaulting to `lean` wrote an explicit
+# value the user never chose, and an explicit `modes.review_mode` sits ABOVE the
+# rigor expansion in the resolution chain — so it pinned the knob permanently.
+# A project that later set `rigor: full` got workflow/qa/team.size at full and
+# `review_mode: lean`, with no error: the exact defect this release exists to
+# fix, reintroduced through the upgrade path. Leaving it unset lets
+# `modes.rigor` supply it, which is the v1.1 design. If the user genuinely
+# chose a review mode in v1.0, the file exists and its value is preserved above.
+
+ENGINE_RAW=$(tp_get "Engine & Language" "Engine")
+ENGINE_NAME=$(printf '%s' "$ENGINE_RAW" | awk '{print $1}')
+ENGINE_VER=$(printf '%s' "$ENGINE_RAW" | awk '{if (NF>1 && $NF ~ /^[0-9]+(\.[0-9]+)*[A-Za-z0-9]*$/) print $NF}')
+LANG=$(tp_get "Engine & Language" "Language")
+RENDER=$(tp_get "Engine & Language" "Rendering")
+PHYSICS=$(tp_get "Engine & Language" "Physics")
+
+TARGETS=$(tp_get "Input & Platform" "Target Platforms")
+PRIMARY_INPUT=$(tp_get "Input & Platform" "Primary Input")
+GAMEPAD=$(tp_get "Input & Platform" "Gamepad Support")
+TOUCH=$(tp_get "Input & Platform" "Touch Support")
+
+N_CLASSES=$(tp_get "Naming Conventions" "Classes")
+N_VARS=$(tp_get "Naming Conventions" "Variables")
+N_CONST=$(tp_get "Naming Conventions" "Constants")
+# The v1.0 template spells these two keys `Signals/Events` and `Scenes/Prefabs`;
+# a hand-trimmed file may carry the short form. The key is a regex, so accept both.
+N_SIG=$(tp_get "Naming Conventions" "Signals(/Events)?")
+N_FILES=$(tp_get "Naming Conventions" "Files")
+N_SCENES=$(tp_get "Naming Conventions" "Scenes(/Prefabs)?")
+
+P_FPS=$(num "$(tp_get "Performance Budgets" "Target Framerate")")
+P_BUDGET=$(num "$(tp_get "Performance Budgets" "Frame Budget")")
+P_DRAW=$(num "$(tp_get "Performance Budgets" "Draw Calls")")
+P_MEM=$(num "$(tp_get "Performance Budgets" "Memory Ceiling")")
+
+# A BUDGET THAT IS PRESENT BUT NOT A BARE NUMBER MUST BE REPORTED, NOT DROPPED.
+#
+# These four are written with yaml_num, which emits `null` for anything that is
+# not numeric -- while the report row tested only for non-empty. So a budget
+# recorded as prose ("30 FPS on the console floor; 60 FPS as a PC target") wrote
+# `null` to the file and printed as PRESERVED in the report, with Warnings: None.
+# The report is the artifact the user is told to review before --finalize, so it
+# is the one place a silent drop is least affordable.
+#
+# Real budgets routinely carry per-platform splits, ranges and rationale, none of
+# which is a bare number. The converter cannot pick one, and MUST NOT guess which
+# platform the user meant -- so it names what it found and hands the choice back.
+for _pb in "target_framerate:$P_FPS" "frame_budget_ms:$P_BUDGET" "draw_call_limit:$P_DRAW" "memory_ceiling_mb:$P_MEM"; do
+ _pk="${_pb%%:*}"; _pv="${_pb#*:}"
+ if [ -n "$_pv" ] && ! is_num "$_pv"; then
+ warn "performance.$_pk not migrated: \"$_pv\" is not a single number"
+ manual "Set \`performance.$_pk\` by hand — the legacy value was: $_pv"
+ fi
+done
+
+TEST_FW=$(tp_get "Testing" "Framework")
+# "Minimum Coverage" has a v1.1 home (`qa.coverage_minimum`, integer 0-100,
+# enforced only at qa.level: full). Same rule as the budgets: a bare number
+# migrates, prose is reported and handed back, nothing is dropped in silence.
+TEST_COV=$(num "$(tp_get "Testing" "Minimum Coverage")")
+if [ -n "$TEST_COV" ] && ! is_num "$TEST_COV"; then
+ warn "qa.coverage_minimum not migrated: \"$TEST_COV\" is not a single number"
+ manual "Set \`qa.coverage_minimum\` by hand — the legacy value was: $TEST_COV"
+fi
+
+# v1.0 /setup-engine wrote every specialist line as `agent-name (what it covers)`,
+# and the Unreal code line as `a-specialist (Blueprint) or b-specialist (C++)`.
+# Skills pass `specialists.*` straight to the Agent tool as a subagent_type, so
+# anything but the bare agent name is an agent that does not exist. Keep the
+# first agent name per entry; the prose goes to the report, not the yaml.
+S_CODE_RAW=$(tp_get "Engine Specialists" "Language/Code Specialist")
+S_SHADER_RAW=$(tp_get "Engine Specialists" "Shader Specialist")
+S_UI_RAW=$(tp_get "Engine Specialists" "UI Specialist")
+S_ADD_RAW=$(tp_get "Engine Specialists" "Additional Specialists")
+
+# agent_name <prose> -> first token that looks like an agent name, else the
+# trimmed input unchanged (a value this cannot parse is surfaced, not dropped).
+agent_name() {
+ _an=$(printf '%s' "$1" | grep -oE '[a-z][a-z0-9]*(-[a-z0-9]+)+' | head -1)
+ [ -n "$_an" ] && printf '%s' "$_an" || printf '%s' "$1" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g'
+}
+# agent_names <prose list> -> comma-separated agent names, one per top-level
+# comma-separated element (commas inside parentheses belong to the prose).
+agent_names() {
+ [ -z "$1" ] && return 0
+ printf '%s' "$1" | awk '
+ { d = 0; cur = ""
+ for (i = 1; i <= length($0); i++) { c = substr($0, i, 1)
+ if (c == "(") d++; else if (c == ")") { if (d > 0) d-- }
+ if (c == "," && d == 0) { print cur; cur = "" } else cur = cur c }
+ print cur }' | while IFS= read -r _el; do
+ _n=$(agent_name "$_el"); [ -n "$_n" ] && printf '%s, ' "$_n"
+ done | sed -E 's/, $//'
+}
+specialist_warn() { # <dotted.key> <raw> <kept>
+ [ -n "$2" ] && [ "$2" != "$3" ] || return 0
+ warn "$1 trimmed to \`$3\` — the legacy line was: $2"
+ case "$2" in
+ *" or "*) manual "\`$1\` had two candidates in $TP (\"$2\"); kept the first — change it in project.yaml if the other is right" ;;
+ esac
+}
+S_CODE=$(agent_name "$S_CODE_RAW")
+S_SHADER=$(agent_name "$S_SHADER_RAW")
+S_UI=$(agent_name "$S_UI_RAW")
+S_ADD=$(agent_names "$S_ADD_RAW")
+specialist_warn "specialists.code" "$S_CODE_RAW" "$S_CODE"
+specialist_warn "specialists.shader" "$S_SHADER_RAW" "$S_SHADER"
+specialist_warn "specialists.ui" "$S_UI_RAW" "$S_UI"
+specialist_warn "specialists.additional" "$S_ADD_RAW" "$S_ADD"
+
+# Sections a fork may have added. Not migrated — surfaced instead of dropped.
+if [ -f "$TP" ]; then
+ while IFS= read -r h; do
+ case "$h" in
+ "Engine & Language"|"Input & Platform"|"Naming Conventions"|"Performance Budgets"|"Testing"|"Forbidden Patterns"|"Allowed Libraries / Addons"|"Architecture Decisions Log"|"Engine Specialists") ;;
+ "") ;;
+ *) manual "Custom section \`## $h\` in $TP — not migrated, integrate by hand" ;;
+ esac
+ done < <(grep -E '^## ' "$TP" | sed 's/^## //; s/\r$//')
+fi
+[ -f "$TP" ] && manual "Forbidden Patterns and Allowed Libraries stay in $TP — they have no project.yaml equivalent"
+
+# v1.0 had no `modes.rigor`; its fixed process level matches v1.1's `standard`.
+# v1.1 defaults `rigor` to `minimal`, and this script writes nothing it did not
+# read, so a migrated project lands on `minimal` — fewer required GDD sections,
+# terser docs, lighter test evidence, no director panels. That is a behaviour
+# change the upgrader never chose; say so in the one artifact they read first.
+warn "modes.rigor is not written — v1.1 defaults it to \`minimal\`, which is lighter than v1.0 behaved (v1.0 matched \`standard\`). To keep v1.0's process level, add \`modes: { rigor: standard }\` to project.yaml or run \`/settings modes.rigor=standard\`"
+manual "Decide \`modes.rigor\`: leave unset for the lighter v1.1 default, or pin \`standard\` to keep v1.0's process level"
+
+# Report the STRING keys that land in the file as `null`, which the numeric
+# family above already does and this half never did.
+#
+# `yaml_str` writes `null` for an empty value exactly as `yaml_num` does. A block
+# is emitted when ANY of its members is set -- every guard in the writer below is
+# `[ -n "$A$B$C" ]` -- so PARTIAL configuration is what produces these, and
+# partial is the ordinary state of a v1.0 file: you configure what you use. A
+# project that named its code specialist and left the rest at [TO BE CONFIGURED]
+# got `shader: null` and `ui: null` written, "Warnings: None", and no report row
+# for either.
+#
+# It matters because `get_yaml_key` returns the four-character STRING "null" for
+# such a key. That is not empty, so a caller testing `[ -z ... ]` reads it as
+# CONFIGURED, and nothing in the framework tests for the string -- /code-review
+# reads `specialists.shader` to choose which agent to spawn.
+#
+# The value written is deliberately NOT changed here. `null` is the record that
+# the key was seen and held nothing, and the config suite pins that. What was
+# missing is telling the user, in the artifact they are told to read before
+# --finalize deletes anything.
+#
+# performance.* is left to its own loop above on purpose: it distinguishes "held
+# a value that would not convert" from "held nothing", and only reports the
+# first. Blurring that here would overwrite a deliberate contract.
+null_warn() { # <block-guard> <dotted.key> <value>
+ [ -n "$1" ] && [ -z "$3" ] || return 0
+ warn "$2 written as \`null\` — $TP had no value for it"
+ manual "Set \`$2\` in project.yaml, or delete the key so it resolves to its default"
+}
+_G_ENGINE="$ENGINE_NAME"
+null_warn "$_G_ENGINE" "engine.version" "$ENGINE_VER"
+null_warn "$_G_ENGINE" "engine.language" "$LANG"
+null_warn "$_G_ENGINE" "engine.rendering" "$RENDER"
+null_warn "$_G_ENGINE" "engine.physics" "$PHYSICS"
+_G_SPEC="$S_CODE$S_SHADER$S_UI$S_ADD"
+null_warn "$_G_SPEC" "specialists.code" "$S_CODE"
+null_warn "$_G_SPEC" "specialists.shader" "$S_SHADER"
+null_warn "$_G_SPEC" "specialists.ui" "$S_UI"
+_G_NAME="$N_CLASSES$N_VARS$N_CONST$N_SIG$N_FILES$N_SCENES"
+null_warn "$_G_NAME" "naming.classes" "$N_CLASSES"
+null_warn "$_G_NAME" "naming.variables" "$N_VARS"
+null_warn "$_G_NAME" "naming.constants" "$N_CONST"
+null_warn "$_G_NAME" "naming.signals" "$N_SIG"
+null_warn "$_G_NAME" "naming.files" "$N_FILES"
+null_warn "$_G_NAME" "naming.scenes" "$N_SCENES"
+_G_PLAT="$TARGETS$PRIMARY_INPUT$GAMEPAD$TOUCH"
+null_warn "$_G_PLAT" "platform.primary_input" "$PRIMARY_INPUT"
+null_warn "$_G_PLAT" "platform.gamepad_support" "$GAMEPAD"
+null_warn "$_G_PLAT" "platform.touch_support" "$TOUCH"
+
+# --- helpers for list-ish values --------------------------------------------
+
+yaml_list() {
+ # "PC, Mac" -> ["PC", "Mac"]; empty -> []
+ #
+ # Splits on top-level commas ONLY -- a comma inside parentheses stays part of
+ # its element. These values come from a hand-written document, so an entry is
+ # routinely prose: `ue-gas-specialist (abilities, effects)` is ONE specialist,
+ # not two, and splitting it produced entries like `attributes` that read as
+ # real agent names. Every element is quoted for the same reason: prose carries
+ # colons, dashes and brackets, all of which make a bare YAML scalar ambiguous
+ # or invalid.
+ [ -z "$1" ] && { printf '[]'; return; }
+ printf '%s' "$1" | awk '
+ function emit(s) {
+ sub(/^[ \t]+/, "", s); sub(/[ \t]+$/, "", s)
+ if (s == "") return
+ gsub(/\\/, "\\\\", s); gsub(/"/, "\\\"", s)
+ out = out (n++ ? ", " : "") "\"" s "\""
+ }
+ { depth = 0; buf = ""; out = ""; n = 0
+ for (i = 1; i <= length($0); i++) {
+ c = substr($0, i, 1)
+ if (c == "(") depth++
+ else if (c == ")") { if (depth > 0) depth-- }
+ if (c == "," && depth == 0) { emit(buf); buf = "" } else buf = buf c
+ }
+ emit(buf)
+ printf "[%s]", out
+ }'
+}
+
+if [ "$MODE" = "dry-run" ]; then
+ echo "DRY RUN — nothing written."
+ echo "would create: $PY"
+ echo "would create: $REPORT"
+ echo
+ echo "detected sources:"
+ [ -f "$STAGE_TXT" ] && echo " $STAGE_TXT -> project.stage: ${STAGE:-<empty>}"
+ [ -f "$REVIEW_TXT" ] && echo " $REVIEW_TXT -> modes.review_mode: ${REVIEW:-<empty>}"
+ # State the omission explicitly. Silence here is what let the invented `lean`
+ # default ship unnoticed: the preview simply had no line for it, so the one
+ # artifact a cautious user reads before migrating never mentioned the value.
+ [ -z "$REVIEW" ] && echo " (no $REVIEW_TXT — modes.review_mode left unset; modes.rigor will supply it)"
+ # And the other direction, for the same reason: the preview is the one artifact
+ # a cautious user reads before migrating, so the consequence belongs here too.
+ [ -n "$REVIEW" ] && echo " (modes.review_mode will be set EXPLICITLY to '$REVIEW' — this outranks modes.rigor, so rigor will not control review depth afterwards)"
+ [ -f "$TP" ] && tp_configured && echo " $TP -> engine/platform/naming/performance/testing/specialists"
+ [ -n "$WARN" ] && { echo; echo "warnings:"; printf '%s' "$WARN"; }
+ exit 0
+fi
+
+# --- write project.yaml -----------------------------------------------------
+
+{
+ echo "# CCGS project configuration — migrated from v1.0 legacy files."
+ echo "# Generated by .claude/scripts/migrate-v1-config.sh"
+ echo "# Review production/migration-report.md before running --finalize."
+ echo ""
+ echo "schema_version: 1"
+ echo ""
+ echo "framework:"
+ echo " version: 1.1.0"
+ echo ""
+ # Emit `project:` only when there is a stage to put in it -- same rule as the
+ # `modes:` block below. Writing `stage: null` produced a file that FAILED THIS
+ # PROJECT'S OWN SCHEMA VALIDATION: `null` is not in the stage enum, so every
+ # migrated project without a legacy stage.txt greeted its user with a schema
+ # error caused by the migration itself. An absent key resolves to unset, which
+ # is what "no stage recorded yet" means.
+ if [ -n "$STAGE" ]; then
+ echo "project:"
+ echo " stage: \"$STAGE\""
+ echo ""
+ fi
+ # Emit the `modes:` block only when there is something to put in it. An
+ # unguarded `review_mode: $REVIEW` wrote a bare `review_mode:` (empty) once
+ # the invented default was removed, which resolves no better than the default
+ # did. No legacy review mode means no `modes:` block — rigor supplies it.
+ if [ -n "$REVIEW" ]; then
+ echo "modes:"
+ echo " review_mode: $REVIEW"
+ echo ""
+ fi
+ if [ -n "$ENGINE_NAME" ]; then
+ echo "engine:"
+ echo " name: $(yaml_str "$ENGINE_NAME")"
+ echo " version: $(yaml_str "$ENGINE_VER")"
+ echo " language: $(yaml_str "$LANG")"
+ echo " rendering: $(yaml_str "$RENDER")"
+ echo " physics: $(yaml_str "$PHYSICS")"
+ echo ""
+ fi
+ if [ -n "$S_CODE$S_SHADER$S_UI$S_ADD" ]; then
+ echo "specialists:"
+ echo " code: $(yaml_str "$S_CODE")"
+ echo " shader: $(yaml_str "$S_SHADER")"
+ echo " ui: $(yaml_str "$S_UI")"
+ echo " additional: $(yaml_list "$S_ADD")"
+ echo ""
+ fi
+ if [ -n "$N_CLASSES$N_VARS$N_CONST$N_SIG$N_FILES$N_SCENES" ]; then
+ echo "naming:"
+ echo " classes: $(yaml_str "$N_CLASSES")"
+ echo " variables: $(yaml_str "$N_VARS")"
+ echo " constants: $(yaml_str "$N_CONST")"
+ echo " signals: $(yaml_str "$N_SIG")"
+ echo " files: $(yaml_str "$N_FILES")"
+ echo " scenes: $(yaml_str "$N_SCENES")"
+ echo ""
+ fi
+ if [ -n "$P_FPS$P_BUDGET$P_DRAW$P_MEM" ]; then
+ echo "performance:"
+ echo " target_framerate: $(yaml_num "$P_FPS")"
+ echo " frame_budget_ms: $(yaml_num "$P_BUDGET")"
+ echo " draw_call_limit: $(yaml_num "$P_DRAW")"
+ echo " memory_ceiling_mb: $(yaml_num "$P_MEM")"
+ echo ""
+ fi
+ if [ -n "$TARGETS$PRIMARY_INPUT$GAMEPAD$TOUCH" ]; then
+ echo "platform:"
+ echo " targets: $(yaml_list "$TARGETS")"
+ echo " primary_input: $(yaml_str "$PRIMARY_INPUT")"
+ echo " gamepad_support: $(yaml_str "$GAMEPAD")"
+ echo " touch_support: $(yaml_str "$TOUCH")"
+ echo ""
+ fi
+ if [ -n "$TEST_FW" ]; then
+ echo "testing:"
+ echo " framework: $(yaml_str "$TEST_FW")"
+ echo ""
+ fi
+ if is_num "$TEST_COV"; then
+ echo "qa:"
+ echo " coverage_minimum: $TEST_COV"
+ echo ""
+ fi
+} > "$PY"
+
+# --- write the report -------------------------------------------------------
+
+mkdir -p production 2>/dev/null
+{
+ echo "# Migration report — v1.0 to v1.1"
+ echo ""
+ echo "Generated by \`.claude/scripts/migrate-v1-config.sh\`."
+ echo "Legacy files were **not** deleted. Read this report, then run"
+ echo "\`bash .claude/scripts/migrate-v1-config.sh --finalize\` when satisfied."
+ echo ""
+ echo "## Source files detected"
+ echo ""
+ [ -f "$STAGE_TXT" ] && echo "- \`$STAGE_TXT\`"
+ [ -f "$REVIEW_TXT" ] && echo "- \`$REVIEW_TXT\`"
+ { [ -f "$TP" ] && tp_configured; } && echo "- \`$TP\`"
+ echo ""
+ echo "## Values preserved"
+ echo ""
+ echo "| Setting | Value | From |"
+ echo "|---|---|---|"
+ [ -n "$STAGE" ] && echo "| \`project.stage\` | $STAGE | $STAGE_TXT |"
+ [ -n "$REVIEW" ] && echo "| \`modes.review_mode\` | $REVIEW | ${REVIEW_TXT} |"
+ [ -n "$ENGINE_NAME" ] && echo "| \`engine.name\` | $ENGINE_NAME | $TP |"
+ [ -n "$ENGINE_VER" ] && echo "| \`engine.version\` | $ENGINE_VER | $TP |"
+ [ -n "$LANG" ] && echo "| \`engine.language\` | $LANG | $TP |"
+ [ -n "$TEST_FW" ] && echo "| \`testing.framework\` | $TEST_FW | $TP |"
+ is_num "$TEST_COV" && echo "| \`qa.coverage_minimum\` | $TEST_COV | $TP |"
+ [ -n "$S_CODE" ] && echo "| \`specialists.code\` | $S_CODE | $TP |"
+ # Every migrated value gets a row. This table is titled "Values preserved" and
+ # is what the user reviews before --finalize deletes anything -- listing 6 of
+ # the 29 keys actually written meant someone checking "did my naming
+ # conventions survive?" found nothing and could reasonably conclude they had
+ # not. Understating what was preserved is the same defect as overstating it.
+ [ -n "$RENDER" ] && echo "| \`engine.rendering\` | $RENDER | $TP |"
+ [ -n "$PHYSICS" ] && echo "| \`engine.physics\` | $PHYSICS | $TP |"
+ [ -n "$S_SHADER" ] && echo "| \`specialists.shader\` | $S_SHADER | $TP |"
+ [ -n "$S_UI" ] && echo "| \`specialists.ui\` | $S_UI | $TP |"
+ [ -n "$S_ADD" ] && echo "| \`specialists.additional\` | $S_ADD | $TP |"
+ [ -n "$N_CLASSES" ] && echo "| \`naming.classes\` | $N_CLASSES | $TP |"
+ [ -n "$N_VARS" ] && echo "| \`naming.variables\` | $N_VARS | $TP |"
+ [ -n "$N_CONST" ] && echo "| \`naming.constants\` | $N_CONST | $TP |"
+ [ -n "$N_SIG" ] && echo "| \`naming.signals\` | $N_SIG | $TP |"
+ [ -n "$N_FILES" ] && echo "| \`naming.files\` | $N_FILES | $TP |"
+ [ -n "$N_SCENES" ] && echo "| \`naming.scenes\` | $N_SCENES | $TP |"
+ [ -n "$TARGETS" ] && echo "| \`platform.targets\` | $TARGETS | $TP |"
+ [ -n "$PRIMARY_INPUT" ] && echo "| \`platform.primary_input\` | $PRIMARY_INPUT | $TP |"
+ [ -n "$GAMEPAD" ] && echo "| \`platform.gamepad_support\` | $GAMEPAD | $TP |"
+ [ -n "$TOUCH" ] && echo "| \`platform.touch_support\` | $TOUCH | $TP |"
+ # Report what was WRITTEN, not what was extracted. These rows sit under
+ # "Values preserved", so testing merely for non-empty claimed preservation for
+ # a value the file recorded as null. is_num is the same test yaml_num applies.
+ is_num "$P_FPS" && echo "| \`performance.target_framerate\` | $P_FPS | $TP |"
+ is_num "$P_BUDGET" && echo "| \`performance.frame_budget_ms\` | $P_BUDGET | $TP |"
+ is_num "$P_DRAW" && echo "| \`performance.draw_call_limit\` | $P_DRAW | $TP |"
+ is_num "$P_MEM" && echo "| \`performance.memory_ceiling_mb\` | $P_MEM | $TP |"
+ echo ""
+ echo "## Defaults applied"
+ echo ""
+ echo "Settings new in v1.1 are absent from legacy files and are NOT written."
+ echo "They resolve to their documented defaults at read time"
+ echo "(\`.claude/docs/config-resolution.md\`): \`modes.rigor\`, \`modes.workflow\`,"
+ echo "\`modes.automation\`, \`docs.density\`, \`qa.level\`, \`team.size\`,"
+ echo "\`modes.story_granularity\`, \`testing.strict\`."
+ echo ""
+ echo "Run \`/settings\` to see the effective values, or \`/start\` to be asked."
+ echo ""
+ # `modes.review_mode` is NOT new in v1.1, so the paragraph above does not
+ # cover it. Call the omission out by name: this table is the artifact the
+ # user reads before `--finalize`, and listing an invented `lean` sourced to a
+ # file that does not exist is worse than saying nothing.
+ if [ -z "$REVIEW" ]; then
+ echo "\`modes.review_mode\` is **deliberately not written**: no"
+ echo "\`$REVIEW_TXT\` was found, so you never chose one. It is now supplied by"
+ echo "\`modes.rigor\` — writing it here would pin it and shadow that expansion."
+ echo ""
+ fi
+ echo "## Warnings"
+ echo ""
+ if [ -n "$WARN" ]; then printf '%s' "$WARN"; else echo "None."; fi
+ echo ""
+ echo "## Manual review"
+ echo ""
+ if [ -n "$MANUAL" ]; then printf '%s' "$MANUAL"; else echo "None."; fi
+} > "$REPORT"
+
+echo "wrote $PY"
+echo "wrote $REPORT"
+[ -n "$WARN" ] && { echo; echo "warnings:"; printf '%s' "$WARN"; }
+echo
+echo "Legacy files left in place. Review $REPORT, then:"
+echo " bash .claude/scripts/migrate-v1-config.sh --finalize"
+exit 0
diff --git a/.claude/scripts/project-coherence.sh b/.claude/scripts/project-coherence.sh
new file mode 100644
index 00000000..b79ff644
--- /dev/null
+++ b/.claude/scripts/project-coherence.sh
@@ -0,0 +1,218 @@
+#!/usr/bin/env bash
+#
+# project-coherence.sh — compare what `project.yaml` DECLARES against what the
+# project actually IS.
+#
+# WHY THIS EXISTS
+#
+# Three defects share one shape: `project.yaml` is treated as the source of truth
+# and is never reconciled against the artifact it describes.
+#
+# 1 engine.version says 4.7.2; project.godot says 4.6; the binary is 4.6.1
+# 2 engine.rendering says Forward+; project.godot says gl_compatibility
+# 3 commands.build names an export preset with no export_presets.cfg
+#
+# The second is why this is a script and not another paragraph. `/setup-engine`
+# ALREADY carries an emphatic, source-cited warning naming both of the exact
+# mistakes that produce it ("Jolt is Godot's default 3D engine", "Forward+ is
+# desktop-focused"). Prose is in place and does not hold on its own. What was
+# missing was a step that reads back what was written.
+#
+# F1's root cause was subtler and is fixed elsewhere: `/setup-engine` is told to
+# write an `Installed at pin time` row into VERSION.md, and no VERSION.md had
+# such a row. There was no slot, so the step vanished leaving no trace. The row
+# now ships in all three reference files, and check 1 below reads it.
+#
+# OBSERVATIONS, NEVER VERDICTS
+#
+# Per CLAUDE.md: a script that scores or judges will eventually contradict a mode
+# or override it cannot see. This one prints what it compared and what it found,
+# and always exits 0. The reader decides. A check that cannot run says so by
+# name — silence is never treated as agreement.
+
+set -u
+export LC_ALL=C
+
+ROOT="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "$0")/../.." && pwd)}"
+cd "$ROOT" || exit 0
+
+DIFFERS=0
+CHECKED=0
+SKIPPED=0
+
+say() { printf '%s\n' "$*"; }
+match() { CHECKED=$((CHECKED+1)); say "[MATCH] $*"; }
+differs() { CHECKED=$((CHECKED+1)); DIFFERS=$((DIFFERS+1)); say "[DIFFERS] $*"; }
+skipped() { SKIPPED=$((SKIPPED+1)); say "[NOT CHECKED] $*"; }
+
+# Read one `key: value` from a named top-level block of project.yaml.
+# Deliberately simple: this file is machine-written and two levels deep.
+yaml_block_value() {
+ block="$1"; key="$2"
+ awk -v b="$block" -v k="$key" '
+ $0 ~ "^"b":" { inb=1; next }
+ inb && /^[a-zA-Z_]/ { inb=0 }
+ inb && $0 ~ "^[[:space:]]+"k":" {
+ sub("^[[:space:]]*"k":[[:space:]]*", "")
+ gsub(/^"|"$/, "")
+ print; exit
+ }
+ ' project.yaml 2>/dev/null
+}
+
+summarise() {
+ say ""
+ say "checked $CHECKED · differs $DIFFERS · not checked $SKIPPED"
+ say ""
+ say "Observations only — no verdict. 'not checked' is not agreement:"
+ say "each line above names why that comparison could not be made."
+ exit 0
+}
+
+say "=== project coherence ==="
+
+if [ ! -f project.yaml ]; then
+ skipped "everything — no project.yaml at the repo root. Run /start."
+ summarise
+fi
+
+ENGINE="$(yaml_block_value engine name)"
+VERSION="$(yaml_block_value engine version)"
+RENDERING="$(yaml_block_value engine rendering)"
+PHYSICS="$(yaml_block_value engine physics)"
+
+if [ -z "$ENGINE" ]; then
+ skipped "every engine check — project.yaml has no engine.name. Run /setup-engine."
+ summarise
+fi
+
+ENGINE_LC="$(printf '%s' "$ENGINE" | tr 'A-Z' 'a-z')"
+VERFILE="docs/engine-reference/$ENGINE_LC/VERSION.md"
+
+# --- 1. VERSION.md carries a recorded installed-version probe -----------------
+if [ ! -f "$VERFILE" ]; then
+ skipped "pinned-reference checks — $VERFILE does not exist"
+else
+ PINNED="$(grep -E '^\| \*\*Engine Version\*\* \|' "$VERFILE" \
+ | sed -E 's/^\| \*\*Engine Version\*\* \| *//; s/ *\|$//')"
+ INSTALLED_ROW="$(grep -E '^\| \*\*Installed at pin time\*\* \|' "$VERFILE" \
+ | sed -E 's/^\| \*\*Installed at pin time\*\* \| *//; s/ *\|$//')"
+
+ if [ -z "$INSTALLED_ROW" ]; then
+ differs "$VERFILE has no 'Installed at pin time' row. /setup-engine is required to write one; its absence means the probe result was never recorded, not that the versions agree."
+ elif printf '%s' "$INSTALLED_ROW" | grep -qE 'NOT DETERMINED'; then
+ skipped "pinned-vs-installed — $VERFILE records '$INSTALLED_ROW'. A probe that did not run has not established a match."
+ else
+ match "VERSION.md records the installed version at pin time: $INSTALLED_ROW"
+ fi
+
+ # --- 2. project.yaml version vs the pinned reference ------------------------
+ if [ -z "$PINNED" ]; then
+ skipped "project.yaml version vs pinned reference — no Engine Version row in $VERFILE"
+ elif [ -z "$VERSION" ]; then
+ skipped "project.yaml version vs pinned reference — project.yaml has no engine.version"
+ elif printf '%s' "$PINNED" | grep -qF "$VERSION"; then
+ match "engine.version ($VERSION) agrees with $VERFILE ($PINNED)"
+ else
+ differs "engine.version is '$VERSION' but $VERFILE pins '$PINNED'. Agents consult the reference file, so they will answer for a version the project does not declare."
+ fi
+fi
+
+# --- 3. Declared version vs the binary actually installed ---------------------
+PROBE=""
+case "$ENGINE_LC" in
+ godot)
+ if command -v godot >/dev/null 2>&1; then
+ PROBE="$(godot --version 2>/dev/null | head -1)"
+ fi
+ ;;
+ unity) command -v Unity >/dev/null 2>&1 && PROBE="$(Unity -version 2>/dev/null | head -1)" ;;
+ unreal) command -v UnrealEditor-Cmd >/dev/null 2>&1 && PROBE="$(UnrealEditor-Cmd -version 2>/dev/null | head -1)" ;;
+esac
+
+if [ -z "$PROBE" ]; then
+ skipped "declared version vs installed binary — no $ENGINE binary found on PATH. A probe that could not run has not established absence."
+elif [ -z "$VERSION" ]; then
+ skipped "declared version vs installed binary — project.yaml has no engine.version"
+else
+ # Compare on major.minor: a patch difference is normal and not worth a flag.
+ WANT="$(printf '%s' "$VERSION" | grep -oE '^[0-9]+\.[0-9]+')"
+ GOT="$(printf '%s' "$PROBE" | grep -oE '[0-9]+\.[0-9]+' | head -1)"
+ if [ -n "$WANT" ] && [ "$WANT" = "$GOT" ]; then
+ match "engine.version $VERSION matches the installed binary ($PROBE)"
+ else
+ differs "engine.version is '$VERSION' but the binary on PATH is '$PROBE'. Build, test and smoke commands all target the declared version."
+ fi
+fi
+
+# --- 4/5. Godot: declared rendering + physics vs the real project file --------
+if [ "$ENGINE_LC" != "godot" ]; then
+ skipped "project-file checks — implemented for Godot only; $ENGINE has no single equivalent file this script can read"
+elif [ ! -f project.godot ]; then
+ skipped "project-file checks — no project.godot in this repo"
+else
+ METHOD="$(grep -E '^renderer/rendering_method' project.godot \
+ | sed -E 's/.*= *"?([a-z_]+)"?.*/\1/' | head -1)"
+ if [ -z "$METHOD" ]; then
+ skipped "rendering — project.godot sets no renderer/rendering_method (Godot then uses its own default, which this script will not guess)"
+ elif [ -z "$RENDERING" ]; then
+ skipped "rendering — project.yaml has no engine.rendering"
+ else
+ case "$RENDERING" in
+ Compatibility|compatibility|"GL Compatibility") WANT_M="gl_compatibility" ;;
+ "Forward+"|forward_plus|"Forward Plus") WANT_M="forward_plus" ;;
+ Mobile|mobile) WANT_M="mobile" ;;
+ *) WANT_M="" ;;
+ esac
+ if [ -z "$WANT_M" ]; then
+ skipped "rendering — engine.rendering '$RENDERING' is not one this script maps to a Godot rendering_method"
+ elif [ "$WANT_M" = "$METHOD" ]; then
+ match "engine.rendering ($RENDERING) agrees with project.godot ($METHOD)"
+ else
+ differs "engine.rendering is '$RENDERING' (expects $WANT_M) but project.godot runs '$METHOD'. Whichever is wrong, an agent reading project.yaml will advise for the wrong renderer."
+ fi
+ fi
+
+ # Jolt is Godot's default 3D physics engine; 2D is unchanged (Godot Physics
+ # 2D). See docs/engine-reference/godot/modules/physics.md. Declaring Jolt on a
+ # 2D project sends the implementer to tune a backend the game does not use.
+ if [ -z "$PHYSICS" ]; then
+ skipped "physics — project.yaml has no engine.physics"
+ elif printf '%s' "$PHYSICS" | grep -qiE 'jolt'; then
+ if grep -qE '(Node2D|CharacterBody2D|RigidBody2D|Area2D|StaticBody2D)' \
+ $(find src -name '*.gd' -o -name '*.tscn' 2>/dev/null) /dev/null 2>/dev/null; then
+ differs "engine.physics is 'Jolt', but 2D nodes were found under src/. Jolt is Godot's default 3D engine; 2D still uses Godot Physics 2D (docs/engine-reference/godot/modules/physics.md)."
+ else
+ match "engine.physics ($PHYSICS) — no 2D nodes found under src/ to contradict it"
+ fi
+ else
+ match "engine.physics ($PHYSICS)"
+ fi
+fi
+
+# --- 6. Declared commands reference files that exist -------------------------
+BUILD_CMD="$(yaml_block_value commands build)"
+TEST_CMD="$(yaml_block_value commands test)"
+
+if [ -z "$BUILD_CMD" ] && [ -z "$TEST_CMD" ]; then
+ skipped "command checks — project.yaml declares no commands.build or commands.test"
+else
+ if printf '%s' "$BUILD_CMD" | grep -qE 'export-(debug|release|pack)'; then
+ if [ -f export_presets.cfg ]; then
+ match "commands.build names an export preset and export_presets.cfg exists"
+ else
+ differs "commands.build is '$BUILD_CMD' but there is no export_presets.cfg. Godot cannot resolve the preset, so this command fails the first time CI or /smoke-check runs it."
+ fi
+ fi
+
+ RUNNER="$(printf '%s' "$TEST_CMD" | grep -oE '[A-Za-z0-9_/.-]+\.(gd|cs|py|sh)' | head -1)"
+ if [ -n "$RUNNER" ]; then
+ if [ -f "$RUNNER" ]; then
+ match "commands.test runner exists ($RUNNER)"
+ else
+ differs "commands.test is '$TEST_CMD' but '$RUNNER' does not exist. At qa.level: minimal nothing ever creates it, so this command is unrunnable as written."
+ fi
+ fi
+fi
+
+summarise
diff --git a/.claude/scripts/review-receipts.sh b/.claude/scripts/review-receipts.sh
new file mode 100644
index 00000000..6354b3c5
--- /dev/null
+++ b/.claude/scripts/review-receipts.sh
@@ -0,0 +1,324 @@
+#!/usr/bin/env bash
+# review-receipts.sh — content-hash change detection for review skills.
+#
+# WHY HASHES, NOT GIT OR MTIME
+# A review baseline must not depend on the user's commit habits. `git diff`
+# needs a committed baseline; `git status` catches uncommitted edits but only
+# relative to git's own view; file mtimes lie under backup restores and cloud
+# sync (an old-mtime restore with new content silently escapes review — a
+# false NEGATIVE, the dangerous direction). Hashing the bytes has neither
+# problem: content changed <=> hash changed. The residual failure directions
+# are false POSITIVES (re-review something unchanged — wasted tokens, never a
+# missed review): a hash tool changing between stamp and check, or a receipt
+# file that was never written.
+#
+# ONE EXCEPTION, and it is deliberate. `check` stays silent on an absent
+# LITERAL path, because a caller may name an optional input on every run
+# (/design-review does exactly this with the entity registry) and reporting it
+# would block a legitimate skip. That silence is a false negative only if a
+# caller passes a literal path it believes must exist — so callers name
+# optional inputs and nothing else.
+#
+# An unexpanded GLOB is the case the same code path can swallow, and is NOT
+# covered by the above: it means a whole document class was
+# requested and none examined, which a caller could not distinguish from
+# "nothing to do". It is now reported as UNRESOLVED.
+#
+# Observation-only per the load-bearing convention in CLAUDE.md: this script
+# emits facts (UNCHANGED / CHANGED / NEW / RECEIPT: NONE), never verdicts.
+# The calling skill decides what to do — including automation-mode handling,
+# which this script cannot see.
+#
+# Usage:
+# bash .claude/scripts/review-receipts.sh hash <file> [<file>...]
+# Prints one stamp line per file:
+# Reviewed-Content-Hash: <path> <hash>
+# The calling skill pastes these lines into the review report / log
+# entry it is writing. Paths are normalised to forward slashes.
+#
+# bash .claude/scripts/review-receipts.sh check <receipt-file> <file> [<file>...]
+# First line: RECEIPT: <receipt-file> (or RECEIPT: NONE if missing/empty)
+# Then, per file:
+# UNCHANGED: <path> hash matches the LATEST stamp for that path
+# CHANGED: <path> hash differs from the latest stamp
+# NEW: <path> no stamp for that path in the receipt file
+# UNRESOLVED: <pat> the argument is a glob the shell never expanded,
+# so a whole class of documents was asked for and
+# none was examined. NOT the same as an absent
+# literal path, which stays silent on purpose --
+# see is_unexpanded_glob() for why.
+# With RECEIPT: NONE, every file is reported NEW (nothing to compare).
+#
+# A caller that skips work on "everything UNCHANGED" MUST treat an
+# UNRESOLVED line as disqualifying: the set it compared was not the set
+# it asked for.
+#
+# bash .claude/scripts/review-receipts.sh sections-hash <file>
+# Per ^## section of the file (plus __preamble__ for content before the
+# first ^##), prints:
+# Reviewed-Section-Hash: <path>#<heading> <hash>
+# Enables DELTA re-reviews: the next pass learns WHICH sections changed
+# without anything storing the old content. Duplicate headings get a
+# " #N" suffix (same algorithm on stamp and check side, so they match).
+#
+# bash .claude/scripts/review-receipts.sh sections-check <receipt-file> <file>
+# Compares the file's current sections against the LATEST section stamps
+# for that path in the receipt file. Prints, per section:
+# SECTION-UNCHANGED: <heading>
+# SECTION-CHANGED: <heading>
+# SECTION-NEW: <heading> current section with no stored stamp
+# then, for stored stamps whose section no longer exists:
+# SECTION-REMOVED: <heading>
+# With no stamps for the path at all: prints SECTIONS: NONE first and
+# every current section as SECTION-NEW.
+#
+# The LATEST stamp wins: receipt files are append-only logs, so the last
+# occurrence of a path is the most recent review of it.
+
+set -u
+export LC_ALL=C
+
+hash_file() {
+ # git hash-object is preferred (stable, content-addressed, no mtime input).
+ # sha1sum fallback produces a DIFFERENT hash for the same bytes (git
+ # prepends a blob header) — so a stamp made with one tool and checked with
+ # the other reads CHANGED. That failure direction is safe (re-review).
+ if command -v git >/dev/null 2>&1; then
+ git hash-object -- "$1" 2>/dev/null && return 0
+ fi
+ sha1sum "$1" 2>/dev/null | cut -d' ' -f1
+}
+
+norm_path() {
+ printf '%s\n' "$1" | sed 's|\\|/|g'
+}
+
+# An argument that does not name a file is one of two very different things,
+# and `check` must NOT treat them alike:
+#
+# a literal path that is absent -> an optional input the caller named on
+# purpose. /design-review passes
+# design/registry/entities.yaml on every
+# run and documents that an absent
+# registry "doesn't appear in the output
+# and doesn't block the skip". Reporting
+# it would break that skip and force a
+# full re-review (~46k tokens, measured)
+# on every project without a registry.
+# Staying silent here is DELIBERATE.
+#
+# a pattern the shell never -> the caller asked for a whole class of
+# expanded documents and got none. bash passes an
+# unmatched glob through verbatim, so the
+# wildcard surviving into argv IS the
+# evidence that nothing matched.
+#
+# Only the second is a coverage hole, and only the second is reported. The
+# discriminator is exact: a real filename cannot reach this script still
+# carrying an unexpanded wildcard, so this cannot fire on the registry case.
+is_unexpanded_glob() {
+ case "$1" in
+ *'*'*|*'?'*|*'['*) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+# Emit "start<TAB>end<TAB>heading" per ^## section of a file. Content before
+# the first ^## (if any) is a __preamble__ span; a file with no ^## at all is
+# one __preamble__ span. Duplicate headings get " #N" so keys stay unique —
+# the SAME function runs on stamp and check side, so suffixes always agree.
+section_spans() {
+ awk '
+ BEGIN { pre = 1 }
+ /^## / {
+ if (pre && NR > 1) print 1 "\t" NR-1 "\t__preamble__"
+ pre = 0
+ if (s) print s "\t" NR-1 "\t" h
+ s = NR
+ h = substr($0, 4)
+ if (seen[h]++) h = h " #" seen[h]
+ }
+ END {
+ if (pre && NR > 0) print 1 "\t" NR "\t__preamble__"
+ if (s) print s "\t" NR "\t" h
+ }
+ ' "$1"
+}
+
+section_hash() { # <file> <start> <end>
+ # Mirrors hash_file above, and for the same reason it was written that way.
+ # This called bare `sha1sum`, which is GNU coreutils and absent on macOS. The
+ # failure was not a visible error: sha1sum missing makes this return EMPTY,
+ # an empty `cur` compares EQUAL to an empty stored hash, and the check below
+ # then prints SECTION-UNCHANGED for every section however it was edited.
+ # That is the false-NEGATIVE direction this script's header names as the
+ # dangerous one -- a changed section silently escaping review -- and it was
+ # reachable on any machine without GNU coreutils.
+ _sec=""
+ if command -v git >/dev/null 2>&1; then
+ _sec=$(sed -n "$2,$3p" "$1" | git hash-object --stdin 2>/dev/null)
+ fi
+ [ -n "$_sec" ] || _sec=$(sed -n "$2,$3p" "$1" | sha1sum 2>/dev/null | cut -d' ' -f1)
+ # Never empty. An unhashable section must be visible in the receipt rather
+ # than silently equal to the next unhashable one.
+ [ -n "$_sec" ] || _sec="NO-HASH-TOOL"
+ printf '%s' "$_sec"
+}
+
+mode="${1:-}"
+case "$mode" in
+ hash)
+ shift
+ [ $# -ge 1 ] || { echo "review-receipts: hash mode needs at least one file" >&2; exit 2; }
+ rc=0
+ for f in "$@"; do
+ if [ ! -f "$f" ]; then
+ echo "review-receipts: no such file: $f" >&2
+ rc=2
+ continue
+ fi
+ h=$(hash_file "$f")
+ [ -n "$h" ] || { echo "review-receipts: could not hash: $f" >&2; rc=2; continue; }
+ printf 'Reviewed-Content-Hash: %s %s\n' "$(norm_path "$f")" "$h"
+ done
+ exit "$rc"
+ ;;
+
+ check)
+ shift
+ receipt="${1:-}"
+ shift 2>/dev/null || true
+ [ $# -ge 1 ] || { echo "review-receipts: check mode needs a receipt file and at least one file" >&2; exit 2; }
+
+ if [ ! -s "${receipt:-}" ]; then
+ echo "RECEIPT: NONE"
+ for f in "$@"; do
+ if [ ! -f "$f" ]; then
+ is_unexpanded_glob "$f" && printf 'UNRESOLVED: %s\n' "$(norm_path "$f")"
+ continue
+ fi
+ printf 'NEW: %s\n' "$(norm_path "$f")"
+ done
+ exit 0
+ fi
+
+ echo "RECEIPT: $(norm_path "$receipt")"
+ for f in "$@"; do
+ if [ ! -f "$f" ]; then
+ is_unexpanded_glob "$f" && printf 'UNRESOLVED: %s\n' "$(norm_path "$f")"
+ continue
+ fi
+ p=$(norm_path "$f")
+ # Last occurrence wins (append-only log). grep -F on the path avoids
+ # regex surprises from dots/dashes in filenames.
+ stored=$(grep -F "Reviewed-Content-Hash: $p " "$receipt" 2>/dev/null | tail -1 | awk '{print $NF}')
+ if [ -z "$stored" ]; then
+ printf 'NEW: %s\n' "$p"
+ continue
+ fi
+ current=$(hash_file "$f")
+ if [ "$current" = "$stored" ]; then
+ printf 'UNCHANGED: %s\n' "$p"
+ else
+ printf 'CHANGED: %s\n' "$p"
+ fi
+ done
+ exit 0
+ ;;
+
+ sections-hash)
+ shift
+ f="${1:-}"
+ [ -f "${f:-}" ] || { echo "review-receipts: sections-hash needs an existing file" >&2; exit 2; }
+ p=$(norm_path "$f")
+ while IFS=$(printf '\t') read -r s e h; do
+ [ -n "$h" ] || continue
+ printf 'Reviewed-Section-Hash: %s#%s %s\n' "$p" "$h" "$(section_hash "$f" "$s" "$e")"
+ done <<EOF_SH
+$(section_spans "$f")
+EOF_SH
+ exit 0
+ ;;
+
+ sections-check)
+ shift
+ receipt="${1:-}"
+ f="${2:-}"
+ [ -f "${f:-}" ] || { echo "review-receipts: sections-check needs a receipt file and an existing file" >&2; exit 2; }
+ p=$(norm_path "$f")
+
+ # Latest stamp per section key for this path (append-only log: last wins).
+ #
+ # TAB-DELIMITED ACCUMULATORS, NOT `declare -A`. Associative arrays are bash
+ # 4, and macOS ships bash 3.2 as /bin/bash. There `declare -A` fails but
+ # execution CONTINUES -- and a string subscript is then evaluated as
+ # ARITHMETIC, so every heading collapses to index 0, each stamp overwrites
+ # the last, and the UNCHANGED / CHANGED / REMOVED verdicts come out garbage
+ # with nothing reported. A review tool reporting UNCHANGED for an edited
+ # section is the false-negative direction this script's header calls the
+ # dangerous one.
+ #
+ # Safe as a delimited string because a section key is heading text, which
+ # cannot contain a TAB or a newline. Matching is field-exact via awk, never
+ # a substring grep, so one heading cannot match another that contains it.
+ _RR_TAB=$(printf '\t')
+ STORED=""
+ STORED_N=0
+ if [ -s "${receipt:-}" ]; then
+ while IFS= read -r line; do
+ case "$line" in
+ "Reviewed-Section-Hash: $p#"*) ;;
+ *) continue ;;
+ esac
+ rest="${line#Reviewed-Section-Hash: $p#}"
+ key="${rest% *}"
+ [ -n "$key" ] || continue
+ STORED="$STORED$key$_RR_TAB${rest##* }
+"
+ STORED_N=$((STORED_N + 1))
+ done <<EOF_SC
+$(grep -F "Reviewed-Section-Hash: $p#" "$receipt" 2>/dev/null)
+EOF_SC
+ fi
+ if [ "$STORED_N" -eq 0 ]; then
+ echo "SECTIONS: NONE"
+ fi
+
+ # Last occurrence wins, matching the append-only rule stated in the header.
+ stored_get() {
+ printf '%s' "$STORED" | awk -F"$_RR_TAB" -v k="$1" '$1==k{v=$2} END{printf "%s", v}'
+ }
+
+ CURRENT=""
+ while IFS="$_RR_TAB" read -r s e h; do
+ [ -n "$h" ] || continue
+ CURRENT="$CURRENT$h
+"
+ cur=$(section_hash "$f" "$s" "$e")
+ sv=$(stored_get "$h")
+ # `-z` not a key-existence test, exactly as the array version did: a
+ # stamp recorded with an empty hash reads NEW, not UNCHANGED.
+ if [ -z "$sv" ]; then
+ printf 'SECTION-NEW: %s\n' "$h"
+ elif [ "$cur" = "$sv" ]; then
+ printf 'SECTION-UNCHANGED: %s\n' "$h"
+ else
+ printf 'SECTION-CHANGED: %s\n' "$h"
+ fi
+ done <<EOF_SC2
+$(section_spans "$f")
+EOF_SC2
+
+ printf '%s' "$STORED" | awk -F"$_RR_TAB" 'NF{print $1}' | sort -u | while IFS= read -r k; do
+ [ -n "$k" ] || continue
+ printf '%s' "$CURRENT" | awk -v k="$k" '$0==k{f=1} END{exit f?0:1}' \
+ || printf 'SECTION-REMOVED: %s\n' "$k"
+ done
+ exit 0
+ ;;
+
+ *)
+ echo "Usage: review-receipts.sh hash <file>... | check <receipt-file> <file>... | sections-hash <file> | sections-check <receipt-file> <file>" >&2
+ exit 2
+ ;;
+esac
diff --git a/.claude/scripts/review-scope.sh b/.claude/scripts/review-scope.sh
new file mode 100644
index 00000000..0cad93b4
--- /dev/null
+++ b/.claude/scripts/review-scope.sh
@@ -0,0 +1,124 @@
+#!/usr/bin/env bash
+# review-scope.sh — compute the GDD scope for an incremental cross-GDD review.
+#
+# Replaces the git archaeology /review-all-gdds would otherwise reason through:
+# finds the most recent cross-review report, lists GDDs changed since it, and
+# lists each changed GDD's declared dependencies (which must also be in scope).
+#
+# Usage: bash .claude/scripts/review-scope.sh
+#
+# Output:
+# PRIOR_REVIEW: <path> (or "NONE (full review required)")
+# CHANGED: GDDs modified since that review
+# DEPS ...: declared .md dependencies of the changed GDDs
+#
+# CORRECTNESS NOTES — three silent-data-loss bugs were fixed when porting this.
+# All three dropped files without warning, which in a review tool means a changed
+# design doc quietly escapes review:
+#
+# 1. git pathspecs are fnmatch WITHOUT FNM_PATHNAME, so `*` crosses `/`:
+# 'design/gdd/*.md' also matched design/gdd/reviews/*.md, pulling the
+# review logs this script writes into the review scope. Fixed with
+# :(glob) magic, which restricts * to one path segment.
+# 2. `git status --porcelain | awk '{print $NF}'` mangles any path containing
+# a space (returns the trailing fragment) and returns the wrong field for
+# renames (`R old -> new`). Fixed with -z, which disables quoting entirely.
+# 3. `for f in $changed` word-splits on IFS and glob-expands, so a GDD whose
+# filename contains a space was split into two nonexistent paths and
+# silently discarded. Fixed with `while IFS= read -r`.
+
+set -u
+
+cd "$(dirname "$0")/../.." || { echo "review-scope: cannot reach repo root" >&2; exit 1; }
+
+GDD_GLOB=':(glob)design/gdd/*.md'
+
+# Single definition — this list is needed at three call sites and is exactly the
+# kind of thing that drifts when copied.
+not_a_system_gdd() {
+ case "$(basename "$1")" in
+ game-concept.md|systems-index.md|game-pillars.md|gdd-cross-review-*.md) return 0 ;;
+ gameplay-tags.md|fixture-swap-ledger.md|entity-registry.md) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+all_gdds() {
+ find design/gdd -maxdepth 1 -name '*.md' -type f 2>/dev/null | sed 's|\\|/|g' | sort \
+ | while IFS= read -r f; do
+ not_a_system_gdd "$f" || echo "$f"
+ done
+}
+
+# `sort | tail -1` is chronological ONLY because the report filename carries an
+# ISO 8601 date. /review-all-gdds now states that requirement at the point it
+# asks permission to write the file; if that ever loosens, this line silently
+# picks the wrong baseline and every GDD changed since the real last review
+# escapes the next one -- failure number four in the list above, reached from
+# the filename instead of the path handling.
+#
+# Not mtime: on a fresh clone every file carries the checkout time, so `ls -t`
+# here would order the reports arbitrarily. The date in the name is the only
+# ordering that survives being cloned.
+last_review=$(find design/gdd -maxdepth 1 -name 'gdd-cross-review-*.md' -type f 2>/dev/null \
+ | sed 's|\\|/|g' | sort | tail -1)
+
+if [ -z "$last_review" ]; then
+ echo "PRIOR_REVIEW: NONE (full review required)"
+ echo "CHANGED:"
+ gdds=$(all_gdds)
+ if [ -z "$gdds" ]; then
+ echo " (no system GDDs found)"
+ else
+ printf '%s\n' "$gdds" | sed 's/^/ /'
+ fi
+ exit 0
+fi
+
+echo "PRIOR_REVIEW: $last_review"
+
+# Prefer git history if the review file is committed; fall back to file mtime.
+base=$(git log -1 --format=%H -- "$last_review" 2>/dev/null)
+if [ -n "$base" ]; then
+ changed=$( {
+ git diff --name-only "$base" -- "$GDD_GLOB" 2>/dev/null
+ # -z emits NUL-delimited, unquoted paths; cut -c4- strips the fixed-width
+ # "XY " status prefix. For a rename, -z emits new NUL old, so taking the
+ # first of each pair gives the new name, which is what we want.
+ git status --porcelain -z -- "$GDD_GLOB" 2>/dev/null | tr '\0' '\n' | cut -c4-
+ } | sed 's|\\|/|g' | sort -u )
+else
+ changed=$(find design/gdd -maxdepth 1 -name '*.md' -type f -newer "$last_review" 2>/dev/null \
+ | sed 's|\\|/|g' | sort)
+fi
+
+scope=""
+while IFS= read -r f; do
+ [ -n "$f" ] || continue
+ not_a_system_gdd "$f" && continue
+ [ -f "$f" ] && scope="$scope$f"$'\n'
+done <<EOF
+$changed
+EOF
+
+echo "CHANGED:"
+if [ -z "$scope" ]; then
+ echo " (none — no GDDs modified since last review)"
+ exit 0
+fi
+printf '%s' "$scope" | sed 's/^/ /'
+
+echo "DEPS (declared in changed GDDs — include these in review scope too):"
+printf '%s' "$scope" | while IFS= read -r f; do
+ [ -n "$f" ] || continue
+ deps=$(awk '
+ /^## /{
+ h = tolower($0); sub(/^##[ \t]+/, "", h); sub(/^[0-9]+[.)]?[ \t]*/, "", h)
+ dep = (h ~ /^dependencies/) ? 1 : 0
+ }
+ dep { print }
+ ' "$f" | grep -oE '[A-Za-z0-9_-]+\.md' | sort -u)
+ if [ -n "$deps" ]; then
+ printf '%s\n' "$deps" | sed "s|^| $(basename "$f") -> |"
+ fi
+done
diff --git a/.claude/scripts/rotate-session-state.sh b/.claude/scripts/rotate-session-state.sh
new file mode 100644
index 00000000..a0665ed8
--- /dev/null
+++ b/.claude/scripts/rotate-session-state.sh
@@ -0,0 +1,128 @@
+#!/bin/bash
+# rotate-session-state.sh — move active.md's narrative into the session log,
+# leaving the checkpoint behind.
+#
+# WHY THIS EXISTS
+# active.md is two things at once: a small machine-read CHECKPOINT that hooks
+# inject, and a free-form narrative for humans. Only the first is bounded by the
+# schema. Left alone the second grows without limit -- it reached 712 lines /
+# 44 KB before this script existed -- and every session paid to preview a file
+# that was mostly history the commit log already records.
+#
+# Rotation keeps the checkpoint, appends the narrative to a dated file under
+# production/session-logs/, and starts the Notes section fresh. Nothing is
+# deleted.
+#
+# EXPLICIT INVOCATION ONLY. No hook calls this. session-start.sh observes that
+# the file is large and names this script; the user decides whether to run it.
+# Helpers here emit observations, never verdicts (CLAUDE.md) -- and silently
+# moving a user's working notes would be a verdict.
+#
+# Usage:
+# bash .claude/scripts/rotate-session-state.sh # rotate
+# bash .claude/scripts/rotate-session-state.sh --dry-run # show, change nothing
+# bash .claude/scripts/rotate-session-state.sh --help
+
+set -u
+cd "$(dirname "$0")/../.." || exit 1
+
+STATE="production/session-state/active.md"
+LOGDIR="production/session-logs"
+DRY=0
+
+case "${1:-}" in
+ --help|-h)
+ sed -n '2,30p' "$0" | sed 's/^# \?//'
+ exit 0 ;;
+ --dry-run) DRY=1 ;;
+ "") ;;
+ *) echo "unknown argument: $1 (try --help)" >&2; exit 2 ;;
+esac
+
+if [ ! -f "$STATE" ]; then
+ echo "no session state at $STATE — nothing to rotate"
+ exit 0
+fi
+
+if ! grep -q '<!-- /CHECKPOINT -->' "$STATE"; then
+ echo "REFUSED: $STATE has no <!-- /CHECKPOINT --> marker."
+ echo " Rotation splits the file at that marker, so without it this script"
+ echo " cannot tell the checkpoint from the narrative and would move both."
+ echo " Re-create the file from .claude/docs/templates/session-state.md first."
+ exit 3
+fi
+
+# Everything through the marker is the checkpoint; everything after is narrative.
+SPLIT=$(grep -n '<!-- /CHECKPOINT -->' "$STATE" | head -1 | cut -d: -f1)
+TOTAL=$(wc -l < "$STATE" | tr -d ' ')
+NARRATIVE=$((TOTAL - SPLIT))
+
+if [ "$NARRATIVE" -le 5 ]; then
+ echo "narrative is $NARRATIVE lines — nothing worth rotating"
+ exit 0
+fi
+
+# Date comes from the filesystem, not `date`, so a dry run and the real run
+# agree and repeated runs on the same day append to one file.
+STAMP=$(date +%Y-%m-%d 2>/dev/null || echo "undated")
+ARCHIVE="$LOGDIR/session-state-$STAMP.md"
+
+if [ "$DRY" = "1" ]; then
+ echo "DRY RUN — no changes written"
+ echo " checkpoint kept : lines 1-$SPLIT"
+ echo " narrative moved : lines $((SPLIT + 1))-$TOTAL ($NARRATIVE lines)"
+ echo " destination : $ARCHIVE"
+ exit 0
+fi
+
+mkdir -p "$LOGDIR" 2>/dev/null
+
+{
+ echo ""
+ echo "---"
+ echo ""
+ echo "## Rotated from active.md on $STAMP ($NARRATIVE lines)"
+ echo ""
+ tail -n "+$((SPLIT + 1))" "$STATE"
+} >> "$ARCHIVE"
+
+# Write the truncated state beside the file it replaces, not in a system temp
+# dir. `${TMPDIR:-/tmp}` assumes /tmp exists and is writable; where it is not,
+# the redirect failed, `&&` skipped the mv, and the script then printed
+# "rotated N lines" and a line count it had not produced -- reporting a
+# rotation that did not happen, while the narrative it had ALREADY appended to
+# the archive stayed in active.md and got archived again on the next run.
+# mktemp in the state directory needs no external writable location and keeps
+# the mv on one filesystem, so it stays atomic.
+TMP=$(mktemp "$(dirname "$STATE")/.ccgs-rotate-XXXXXX" 2>/dev/null) || TMP=""
+if [ -z "$TMP" ]; then
+ echo "rotate-session-state: FAILED — cannot create a temporary file in $(dirname "$STATE")" >&2
+ echo " $STATE is UNCHANGED. The narrative was appended to $ARCHIVE and is still" >&2
+ echo " in $STATE; remove one copy before rotating again." >&2
+ exit 1
+fi
+
+if ! {
+ head -n "$SPLIT" "$STATE"
+ echo ""
+ echo "---"
+ echo ""
+ echo "## Notes"
+ echo ""
+ echo "_Narrative through $STAMP rotated to \`$ARCHIVE\`._"
+ echo ""
+} > "$TMP"; then
+ rm -f "$TMP"
+ echo "rotate-session-state: FAILED — could not write $TMP" >&2
+ echo " $STATE is UNCHANGED (the narrative is now in BOTH $ARCHIVE and $STATE)." >&2
+ exit 1
+fi
+
+if ! mv "$TMP" "$STATE"; then
+ rm -f "$TMP"
+ echo "rotate-session-state: FAILED — could not replace $STATE" >&2
+ exit 1
+fi
+
+echo "rotated $NARRATIVE lines -> $ARCHIVE"
+echo "$STATE is now $(wc -l < "$STATE" | tr -d ' ') lines"
diff --git a/.claude/settings.json b/.claude/settings.json
index ee755fa4..34df85d8 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -2,9 +2,10 @@
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"statusLine": {
"type": "command",
- "command": "bash .claude/statusline.sh"
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/statusline.sh\""
},
"permissions": {
+ "defaultMode": "default",
"allow": [
"Bash(git status*)",
"Bash(git diff*)",
@@ -38,12 +39,12 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/session-start.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh\"",
"timeout": 10
},
{
"type": "command",
- "command": "bash .claude/hooks/detect-gaps.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/detect-gaps.sh\"",
"timeout": 10
}
]
@@ -55,12 +56,12 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/validate-commit.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/validate-commit.sh\"",
"timeout": 15
},
{
"type": "command",
- "command": "bash .claude/hooks/validate-push.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/validate-push.sh\"",
"timeout": 10
}
]
@@ -72,12 +73,12 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/validate-assets.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/validate-assets.sh\"",
"timeout": 10
},
{
"type": "command",
- "command": "bash .claude/hooks/validate-skill-change.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/validate-skill-change.sh\"",
"timeout": 5
}
]
@@ -89,7 +90,7 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/notify.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/notify.sh\"",
"timeout": 10
}
]
@@ -101,7 +102,7 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/pre-compact.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-compact.sh\"",
"timeout": 10
}
]
@@ -113,7 +114,7 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/post-compact.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/post-compact.sh\"",
"timeout": 10
}
]
@@ -125,7 +126,7 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/session-stop.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-stop.sh\"",
"timeout": 10
}
]
@@ -137,7 +138,7 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/log-agent.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/log-agent.sh\"",
"timeout": 5
}
]
@@ -149,7 +150,7 @@
"hooks": [
{
"type": "command",
- "command": "bash .claude/hooks/log-agent-stop.sh",
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/log-agent-stop.sh\"",
"timeout": 5
}
]
diff --git a/.claude/skills/adopt/SKILL.md b/.claude/skills/adopt/SKILL.md
index 61843a81..b5f697f2 100644
--- a/.claude/skills/adopt/SKILL.md
+++ b/.claude/skills/adopt/SKILL.md
@@ -1,13 +1,19 @@
---
name: adopt
-description: "Brownfield onboarding — audits existing project artifacts for template format compliance (not just existence), classifies gaps by impact, and produces a numbered migration plan. Run this when joining an in-progress project or upgrading from an older template version. Distinct from /project-stage-detect (which checks what exists) — this checks whether what exists will actually work with the template's skills."
+description: "Brownfield audit — do existing artifacts actually work? Numbered migration plan. Unlike /project-stage-detect, checks compliance not existence."
argument-hint: "[focus: full | gdds | adrs | stories | infra]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Bash, Write, AskUserQuestion
model: sonnet
-agent: technical-director
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,automation_always_ask,workflow`
+
+Resolved above — use as-is. `/adopt` also inspects `project.yaml` and the legacy
+config files directly when reporting and writing migration state; that raw
+inspection is deliberate and separate from the resolved values above.
+
+
# Adopt — Brownfield Template Adoption
This skill audits an existing project's artifacts for **format compliance** with
@@ -35,6 +41,16 @@ wrong internal format.
---
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`workflow`** (per `.claude/docs/workflow-modes.md`). It scopes the Phase 2 audit and
+Phase 3 severity: `full` audits all doc types at full structure; `standard` audits
+only the required docs/sections (optional sections are informational, not gaps);
+`minimal` is a `design/game-brief.md` format check — GDDs/ADRs/UX are not expected. See Phase 2.
+
## Phase 1: Detect Project State
Emit one line before reading: `"Scanning project artifacts..."` — this confirms the
@@ -43,23 +59,23 @@ skill is running during the silent read phase.
Then read silently before presenting anything else.
### Existence check
-- `production/stage.txt` — if present, read it (authoritative phase)
-- `design/gdd/game-concept.md` — concept exists?
+- `project.stage` in `project.yaml` (fallback `production/stage.txt`) — if either is present, use that value (authoritative phase)
+- `design/gdd/game-concept.md` (or, at the minimal tier, `design/game-brief.md`) — concept exists?
- `design/gdd/systems-index.md` — systems index exists?
- Count GDD files: `design/gdd/*.md` (excluding game-concept.md and systems-index.md)
- Count ADR files: `docs/architecture/adr-*.md`
- Count story files: `production/epics/**/*.md` (excluding EPIC.md)
-- `.claude/docs/technical-preferences.md` — engine configured?
+- `project.yaml` (`engine.name`) / `.claude/docs/technical-preferences.md` — engine configured?
- `docs/engine-reference/` — engine reference docs present?
- Glob `docs/adoption-plan-*.md` — note the filename of the most recent prior plan if any exist
-### Infer phase (if no stage.txt)
+### Infer phase (if no project.stage / stage.txt)
Use the same heuristic as `/project-stage-detect`:
-- 10+ source files in `src/` → Production
+- 10+ source files in the code root → Production
- Stories in `production/epics/` → Pre-Production
- ADRs exist → Technical Setup
- systems-index.md exists → Systems Design
-- game-concept.md exists → Concept
+- game-concept.md (or `design/game-brief.md`) exists → Concept
- Nothing → Fresh (not a brownfield project — suggest `/start`)
If the project appears fresh (no artifacts at all), use `AskUserQuestion`:
@@ -78,32 +94,61 @@ Report: "Detected phase: [phase]. Found: [N] GDDs, [M] ADRs, [P] stories."
## Phase 2: Format Audit
-For each artifact type in scope (based on argument mode), check not just that
-the file exists but that it contains the internal structure the template requires.
+For each artifact type in scope (based on argument mode **and the resolved
+workflow tier**), check not just that the file exists but that it contains the
+internal structure the template requires. At `minimal`, scope the audit to
+`design/game-brief.md` — do not audit for GDDs, ADRs, or UX specs (they are not expected).
### 2a: GDD Format Audit
-For each GDD file found, check for the 8 required sections by scanning headings:
+**Gather section presence deterministically — do not read the GDDs to count
+headings.** For each GDD discovered in Phase 1, pass its path explicitly to the
+structure-check script:
-| Required Section | Heading pattern to look for |
-|---|---|
-| Overview | `## Overview` |
-| Player Fantasy | `## Player Fantasy` |
-| Detailed Rules / Design | `## Detailed` or `## Core Rules` or `## Detailed Design` |
-| Formulas | `## Formulas` or `## Formula` |
-| Edge Cases | `## Edge Cases` |
-| Dependencies | `## Dependencies` or `## Depends` |
-| Tuning Knobs | `## Tuning` |
-| Acceptance Criteria | `## Acceptance` |
-
-For each GDD, record:
-- Which sections are present
-- Which sections are missing
-- Whether it has any content in present sections or just placeholder text
- (`[To be designed]` or equivalent)
-
-Also check: does each GDD have a `**Status**:` field in its header block?
-Valid values: `In Design`, `Designed`, `In Review`, `Approved`, `Needs Revision`.
+```
+Bash: bash .claude/scripts/gdd-structure-check.sh [path-to-gdd]
+```
+
+**Pass paths one at a time; do not invoke it bare.** The no-argument form sweeps
+`design/gdd/` only, and a brownfield project's GDDs are not guaranteed to live
+there — pass whatever paths Phase 1 found. The script prints a `PRESENT:` list
+and, when applicable, an `ABSENT:` list per file. It reports **presence only**
+and makes no REQUIRED/ADVISORY judgment (that is the tier logic below), and it
+already accepts `## Detailed Design` as satisfying the `Detailed Rules`
+requirement, so do not flag that alias as missing.
+
+If the script prints `Not found:` for a path or errors, that is a **discovery
+failure, not a format gap** — report it as "could not audit [path]" and do not
+count it as a missing-sections finding.
+
+**Then apply the workflow tier** resolved above to each file's PRESENT/ABSENT
+lists. Which sections are **required** (a miss = gap) vs **advisory** (a miss =
+informational):
+- **`full`** — all 8 sections are required.
+- **`standard`** — the 5 required (Overview, Detailed Rules, Edge Cases,
+ Dependencies, Acceptance Criteria) + Formulas for any system that defines
+ numeric rules (rates, curves, thresholds, costs — the system's `Category` is a
+ hint, not the test); Player Fantasy and Tuning Knobs are advisory.
+- **`minimal`** — GDDs are not expected; audit `design/game-brief.md` instead. Any GDD
+ that does exist is checked at the `standard` bar, advisorily.
+
+The script's 8 canonical labels are: Overview, Player Fantasy, Detailed Rules,
+Formulas, Edge Cases, Dependencies, Tuning Knobs, Acceptance Criteria.
+
+A section reported PRESENT can still be an empty heading. For each GDD, also
+record with a targeted grep (not a full read):
+- Placeholder-only sections — `Grep pattern="\[To be designed\]"` (or an
+ equivalent empty/single-line body) marks a present-but-unwritten section.
+- The `**Status**:` header field — `Grep pattern="^>?[[:space:]]*\*\*Status\*\*:"`.
+ Valid values: `Draft`, `In Design`, `Designed`, `In Review`, `Approved`,
+ `Implemented`, `Needs Revision`.
+
+> **The `>?` is load-bearing, and so are `Draft`/`Implemented`.** Both emitters
+> write this field inside a blockquote — `.claude/docs/templates/game-design-document.md`
+> and `/design-system` produce `> **Status**: …` — so an anchor of
+> `^\*\*Status\*\*:` matches nothing and reports *every* template-compliant GDD
+> as missing its Status. The template's own value list offers `Draft` and
+> `Implemented`, so both must count as valid.
### 2b: ADR Format Audit
@@ -154,17 +199,69 @@ For each story file found:
| Control manifest | `docs/architecture/control-manifest.md` | HIGH — no layer rules for stories |
| Manifest version stamp | In manifest header: `Manifest Version:` | MEDIUM — staleness checks blind |
| Sprint status | `production/sprint-status.yaml` | MEDIUM — `/sprint-status` falls back to markdown |
-| Stage file | `production/stage.txt` | MEDIUM — phase auto-detect unreliable |
+| Stage file | `project.stage` in `project.yaml` (fallback `production/stage.txt`) | MEDIUM — phase auto-detect unreliable |
| Engine reference | `docs/engine-reference/[engine]/VERSION.md` | HIGH — ADR engine checks blind |
-| Architecture traceability | `docs/architecture/architecture-traceability.md` | MEDIUM — no persistent matrix |
+| Architecture traceability | `docs/architecture/requirements-traceability.md` | MEDIUM — no persistent matrix |
+
+### 2f: Project Config Audit
+
+Read `project.yaml` (the primary config store) and `.claude/docs/technical-preferences.md` (legacy mirror). A setting counts as configured if EITHER source has a real value (in technical-preferences.md, `[TO BE CONFIGURED]` means unconfigured):
+- `engine.name`/`version`/`language`/`rendering`/`physics` (else the Engine/Language/Rendering/Physics fields) → HIGH if unconfigured in both (ADR skills fail)
+- `naming.*` (else Naming conventions) → MEDIUM
+- `performance.*` (else Performance budgets) → MEDIUM
+- Forbidden Patterns, Allowed Libraries (technical-preferences.md only — not migrated to project.yaml) → LOW (starts empty by design)
+
+### 2g: v1.0 Migration Check
+
+A project is a **v1.0 project needing migration** when `project.yaml` does NOT
+exist at the repo root AND at least one legacy file does: `production/stage.txt`,
+`production/review-mode.txt`, or a `.claude/docs/technical-preferences.md` with
+real values.
-### 2f: Technical Preferences Audit
+"Real values" means one of the keys the converter actually migrates — Engine,
+Language, Rendering, Physics, the naming, platform and performance fields,
+Framework, or the specialists. Not merely "some bullet is filled in": the
+shipped template ships one prose default (`- **Required Tests**: …`) that is
+never migrated, and counting it made every fresh clone read as a v1.0 project.
-Read `.claude/docs/technical-preferences.md`. Check each field for `[TO BE CONFIGURED]`:
-- Engine, Language, Rendering, Physics → HIGH if unconfigured (ADR skills fail)
-- Naming conventions → MEDIUM
-- Performance budgets → MEDIUM
-- Forbidden Patterns, Allowed Libraries → LOW (starts empty by design)
+Do not hand-migrate. Run the converter, which is deterministic and covered by
+the framework's own test suite:
+
+```bash
+bash .claude/scripts/migrate-v1-config.sh --dry-run
+```
+
+Report what it lists. If the user approves, run it without `--dry-run`. It
+writes `project.yaml` plus `production/migration-report.md` and **deletes
+nothing** — the whole operation stays reversible with `git checkout`.
+
+Then tell the user to read `production/migration-report.md` before running:
+
+```bash
+bash .claude/scripts/migrate-v1-config.sh --finalize
+```
+
+`--finalize` deletes a legacy file only after proving its value is present in
+`project.yaml`; on mismatch it deletes nothing and exits 4. It never deletes
+`technical-preferences.md`, which still holds Forbidden Patterns and Allowed
+Libraries.
+
+**If the script refuses with exit 3**, do not work around it. Exit 3 means one
+of two things, and the message says which:
+
+- **the values DISAGREE** — two sources of truth and no way to know which the
+ user edited last. Surface it and let them decide.
+- **a `production/migration-report.md` is already present** — a migration ran
+ here, so these are post-migration leftovers and `--finalize` is the next step,
+ not a second `migrate`.
+
+Both files merely *existing* is not exit 3 and must not be reported as a
+conflict: `/start` writes `production/stage.txt` on every new v1.1 project as a
+mirror, so agreement is the normal state. The script says
+`the legacy files mirror it (values agree)` and exits 0 for that.
+
+Classify as **BLOCKING** in Phase 3: until migration runs, every skill reads
+config through the legacy fallback chain, and v1.1 settings are unavailable.
---
@@ -226,7 +323,7 @@ For each affected GDD, list which sections are missing and the fix:
2. Run `/architecture-review` → bootstraps `tr-registry.yaml`
3. Run `/create-control-manifest` → creates manifest with version stamp
4. Run `/sprint-plan update` → creates `sprint-status.yaml`
-5. Run `/gate-check [phase]` → writes `stage.txt` authoritatively
+5. Run `/gate-check [phase]` → writes `project.stage` in `project.yaml` (and legacy `stage.txt`) authoritatively
**Existing stories** — note explicitly:
> "Existing stories continue to work with all template skills — all new format
@@ -330,7 +427,7 @@ Run `/sprint-plan update`
### 3d. Set authoritative project stage
Run `/gate-check [current-phase]`
**Time**: 5 min
-- [ ] production/stage.txt written
+- [ ] `project.stage` in `project.yaml` written (legacy `production/stage.txt` also updated)
---
@@ -365,12 +462,13 @@ are resolved. The new run will reflect the current state of the project.
## Phase 6b: Set Review Mode
-After writing the adoption plan (or if the user cancels writing), check whether
-`production/review-mode.txt` exists.
+After writing the adoption plan (or if the user cancels writing), check whether a
+review mode is already set — read `modes.review_mode` from `project.yaml` first,
+then legacy `production/review-mode.txt`.
-**If it exists**: Read it and note the current mode — "Review mode is already set to `[current]`." — skip the prompt.
+**If a mode is already set**: Note the current mode — "Review mode is already set to `[current]`." — skip the prompt.
-**If it does not exist**: Use `AskUserQuestion`:
+**If no mode is set**: Use `AskUserQuestion`:
- **Prompt**: "One more setup step: how much design review would you like as you work through the workflow?"
- **Options**:
@@ -378,10 +476,15 @@ After writing the adoption plan (or if the user cancels writing), check whether
- `Lean (recommended)` — Directors only at phase gate transitions (/gate-check). Skips per-skill reviews. Balanced for solo devs and small teams.
- `Solo` — No director reviews at all. Maximum speed. Best for game jams, prototypes, or if reviews feel like overhead.
-Write the choice to `production/review-mode.txt` immediately after selection — no separate "May I write?" needed:
-- `Full` → write `full`
-- `Lean (recommended)` → write `lean`
-- `Solo` → write `solo`
+Write the choice immediately after selection — no separate "May I write?" needed.
+Dual-write:
+1. Set `modes.review_mode` in `project.yaml` (primary; add the `modes:` block if absent).
+2. Also write the single word to `production/review-mode.txt` (legacy fallback).
+
+Value mapping:
+- `Full` → `full`
+- `Lean (recommended)` → `lean`
+- `Solo` → `solo`
Create the `production/` directory if it does not exist.
@@ -433,6 +536,10 @@ Use `AskUserQuestion`:
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
1. **Read silently** — complete the full audit before presenting anything
2. **Show the summary first** — let the user see scope before asking to write
3. **Ask before writing** — always confirm before creating the adoption plan file
diff --git a/.claude/skills/architecture-decision/CONTRACT.md b/.claude/skills/architecture-decision/CONTRACT.md
new file mode 100644
index 00000000..d5dd2faa
--- /dev/null
+++ b/.claude/skills/architecture-decision/CONTRACT.md
@@ -0,0 +1,94 @@
+# /architecture-decision — Handoff Contract
+
+## Role in Pipeline
+Authors a new Architecture Decision Record (ADR) by guiding a collaborative design session, cross-referencing the engine reference library and existing architectural stances, and writing a fully-structured ADR file to `docs/architecture/` — which then unblocks stories and epics that depend on the decision.
+
+Two checks inside the run emit `NOT ASSESSED` rather than passing silently, and
+a reader of the resulting ADR should expect them: **engine validation** when no
+engine is configured (`engine.name` unset and no legacy fallback), and **GDD
+sync** when the referenced design docs cannot be read. A skipped check that says
+nothing is indistinguishable from a check that passed.
+
+## Inputs Required
+
+### Files That Must Exist
+| File | Required Fields / Sections | Read-Only? |
+|------|---------------------------|-----------|
+| `docs/engine-reference/[engine]/VERSION.md` | Engine name + version, LLM knowledge cutoff date, post-cutoff risk levels per domain | Yes |
+| `docs/engine-reference/[engine]/modules/[domain].md` | Domain-specific API reference (read if exists for the decision's domain) | Yes |
+| `docs/engine-reference/[engine]/breaking-changes.md` | Post-cutoff breaking changes in the relevant domain | Yes |
+| `docs/engine-reference/[engine]/deprecated-apis.md` | APIs that must not be referenced in the new ADR | Yes |
+| `docs/registry/architecture.yaml` | All existing architectural stances (state ownership, interface contracts, forbidden patterns, performance budgets) — checked for conflicts before the design begins | Yes |
+| `docs/architecture/` (existing ADRs) | Scanned to determine the next sequential ADR number | Yes |
+| `design/gdd/[system].md` (GDDs relevant to the decision) | Specific rules, formulas, performance constraints, or integration points that motivate the decision | Yes |
+| `project.yaml` | `engine.name` — derives the primary specialist (`<engine>-specialist`) to spawn for validation (Step 4.5) | Yes |
+| `.claude/docs/technical-preferences.md` | `Engine Specialists` section — legacy fallback, used only when `engine.name` is absent or empty in `project.yaml` | Yes — required only when `engine.name` is absent |
+
+### Preconditions
+- An engine must be configured (`docs/engine-reference/[engine]/VERSION.md` must exist) — if not, the skill prompts to run `/setup-engine` first
+- The title or subject of the decision must be provided by the user before Step 0 proceeds (if no argument is given, the skill asks)
+- If in **retrofit mode** (`retrofit [path]` argument), the target ADR file must already exist on disk
+- Any conflict with a registered architectural stance in `docs/registry/architecture.yaml` must be resolved or explicitly accepted as an exception before the ADR is drafted (Step 2a is a BLOCKING gate)
+
+## Outputs Produced
+
+### Files Written
+| File | Guaranteed Fields / Sections | Notes |
+|------|------------------------------|-------|
+| `docs/architecture/adr-NNNN-[slug].md` | `## Status`, `## Date`, `## Engine Compatibility` (table with engine, domain, knowledge risk, post-cutoff APIs, verification required), `## ADR Dependencies` (table with depends-on, enables, blocks, ordering note), `## Context` (problem statement, constraints, requirements), `## Decision` (+ architecture diagram + key interfaces), `## Alternatives Considered`, `## Consequences` (positive, negative, risks), `## GDD Requirements Addressed` (table), `## Performance Implications`, `## Migration Plan`, `## Validation Criteria`, `## Related Decisions` | created after user approves ("May I write this ADR to docs/architecture/adr-NNNN-[slug].md?") |
+| `docs/registry/architecture.yaml` | New stance entries (state ownership, interface contracts, performance budgets, forbidden patterns) derived from the ADR; existing entries marked `status: superseded_by` if overridden | appended after separate user approval ("May I update docs/registry/architecture.yaml with these N new stances?") |
+
+### Output Guarantees
+- The ADR number is the next sequential integer after the highest existing `adr-NNNN-*` filename in `docs/architecture/`
+- `## Status` is always present and set to `Proposed` unless the user explicitly confirms `Accepted` during the session
+- `## Engine Compatibility` is always populated using verified data from the engine reference docs — never from training data alone when the domain carries MEDIUM or HIGH risk
+- `## GDD Requirements Addressed` is always present (if no GDD motivated the decision, it documents which GDDs the decision will constrain or enable)
+- `## ADR Dependencies` is always present (fields set to "None" if no ordering constraints exist)
+- Engine specialist validation (Step 4.5) runs before the file is written if an engine specialist is configured; blocking issues found by the specialist cause the Decision section to be revised before saving
+
+## Immutability Rules
+- READS but does NOT modify: all existing ADR files in `docs/architecture/` (including in retrofit mode — existing sections are never touched), all GDD files in `design/gdd/`, `docs/engine-reference/**`, `project.yaml`, `.claude/docs/technical-preferences.md` (legacy fallback)
+- MODIFIES: `docs/architecture/adr-NNNN-[slug].md` (new file created; or missing sections appended in retrofit mode), `docs/registry/architecture.yaml` (append only; existing entries get `status: superseded_by` annotation, never deleted or rewritten)
+- In retrofit mode: appends only the missing sections — never modifies any section that is already present in the target ADR file
+
+## Hard Constraints (Never Violate)
+- Never sets `Status: Accepted` without explicit user confirmation — the default on creation is always `Status: Proposed`
+- **Acceptance route: `/architecture-decision accept ADR-NNNN`** — the only path that sets `Accepted`. It refuses when a dependency is still Proposed, and prompts for confirmation regardless of `modes.automation`. Without this route acceptance would be enforced by ten skills, owned per the authority below, and reachable by nobody.
+- **Acceptance authority: the user, or `technical-director` on the user's explicit confirmation — no other agent, and not this skill on its own.** Recorded here because every consumer enforces the consequences of acceptance, and without this line nothing would say who can produce it. This narrows *who* may set the field; it does not relax the confirmation rule above.
+- Never assigns an ADR number that is already in use — always scan `docs/architecture/` first and use the next sequential number
+- Never proceeds past the architectural stance conflict check (Step 2a) if a conflict exists — surface the conflict and require resolution or explicit exception acknowledgment before drafting
+- Never references APIs listed in `docs/engine-reference/[engine]/deprecated-apis.md` in the Decision or Key Interfaces sections
+- Never writes the ADR file without asking: "May I write this ADR to docs/architecture/adr-NNNN-[slug].md?"
+- Never writes to `docs/registry/architecture.yaml` without a separate ask: "May I update docs/registry/architecture.yaml with these N new stances?"
+- In retrofit mode: never modifies any existing section — only appends absent sections
+
+## Downstream Skill Expects
+**Next skills:** `/create-epics`, `/create-stories`, `/dev-story`, `/architecture-review`
+
+### `/create-epics` reads ADRs expecting:
+- `## Status` field — value must be `Accepted` for epics to reference it
+- `## GDD Requirements Addressed` table — used to link epics to GDD traceability
+- `## Engine Compatibility` section — checked during the Technical Setup → Pre-Production gate
+
+### `/create-stories` reads ADRs expecting:
+- `## Implementation Guidelines` section — provides the concrete patterns programmer agents must follow (note: this section is generated during `/create-stories`, not by `/architecture-decision` itself; the ADR must have a Decision section detailed enough to derive these guidelines)
+- `## ADR Dependencies` table — stories referencing a `Depends On` ADR that is still `Proposed` are automatically set `Status: Blocked`
+
+### `/dev-story` reads ADRs expecting:
+- `## Decision` (full text, verbatim — not summarized)
+- `## Implementation Guidelines` (verbatim)
+- `## Engine Compatibility` (post-cutoff API risks, verification required)
+- `## ADR Dependencies` (to detect if this ADR's dependencies are unresolved)
+
+### `/architecture-review` reads ADRs expecting:
+- All required sections present (it flags gaps)
+- `## Status` is set (required for coverage matrix)
+- `## Engine Compatibility` is stamped with the correct engine version
+
+## Known Fragile Points
+- If the ADR number scan misses a file (e.g., a file in a subdirectory of `docs/architecture/` or with a non-standard naming pattern), a duplicate number can be assigned — all ADR files must follow the `adr-NNNN-[slug].md` naming convention at the top level of `docs/architecture/`
+- Stories that were `Status: Blocked` pending this ADR must be manually updated to `Status: Ready` after the ADR reaches `Accepted` — the skill surfaces a reminder but does not automatically update story files
+- The `## GDD Requirements Addressed` table is populated based on what the user tells the skill during the collaborative session; if the user does not know which GDDs motivated the decision, this table may be incomplete — `/create-epics` and `/gate-check` both rely on this linkage for traceability
+- Engine specialist validation (Step 4.5) is skipped only when **both** sources are unset — `engine.name` absent or empty in `project.yaml` **and** `.claude/docs/technical-preferences.md` still reading `[TO BE CONFIGURED]`. A project configured solely via `project.yaml` **does** get specialist validation. When both are unset, post-cutoff engine API risks are not caught before the ADR is written
+- `docs/registry/architecture.yaml` is append-only by design; if a stance entry becomes permanently invalid (not superseded by another ADR), it must be manually removed — there is no cleanup mechanism
+- In retrofit mode, if the existing ADR has sections present but empty (e.g., a `## Status` heading with no value), the skill treats the section as present and does not fill it — an empty Status is effectively invisible to downstream skills like `/story-readiness`
diff --git a/.claude/skills/architecture-decision/SKILL.md b/.claude/skills/architecture-decision/SKILL.md
index 4ff25bc3..180b3fb1 100644
--- a/.claude/skills/architecture-decision/SKILL.md
+++ b/.claude/skills/architecture-decision/SKILL.md
@@ -1,22 +1,50 @@
---
name: architecture-decision
-description: "Creates an Architecture Decision Record (ADR) documenting a significant technical decision, its context, alternatives considered, and consequences. Every major technical choice should have an ADR."
-argument-hint: "[title] [--review full|lean|solo]"
+description: "Create an ADR documenting a technical decision: context, alternatives considered, consequences."
+argument-hint: "[title | retrofit <path> | accept <ADR-id>] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, Agent, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,docs.density,team.size`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
When this skill is invoked:
-## 0. Parse Arguments — Detect Retrofit Mode
+## 0. Parse Arguments — Detect Retrofit / Acceptance Mode
+
+
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
-Resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
-See `.claude/docs/director-gates.md` for the full check pattern.
+**`team.size`**: which agents validate this ADR (orthogonal to review_mode/workflow).
+- **`individual`** (default): `technical-director` + `lead-programmer` + the engine-specialist.
+- **`small`**: + an engine sub-specialist where applicable.
+- **`studio`**: + an adversarial review by an alternate engine-specialist.
+Any non-core agent needed at `individual` routes through the nearest active core agent with a note.
+
+**`docs.density`** — it controls the *depth* of the ADR's prose sections, not
+which sections the skeleton emits (that is fixed). `modes.rigor` sets it
+alongside `workflow`; set `docs.density` explicitly to vary ADR verbosity alone:
+`terse` = decision + alternatives as bullets, one line of rationale each;
+`balanced` = paragraph per section with light rationale (default); `thorough` =
+full prose with trade-offs and worked rationale in Decision, Alternatives, and
+Consequences. Apply it to the prose sections; the Engine Compatibility, ADR
+Dependencies, and GDD Requirements tables are structural and stay whole at every
+density.
+
+**`workflow`** (see `.claude/docs/workflow-modes.md`):
+- `full` — all ADRs on the required ADR list must be completed.
+- `standard` — critical ADRs only (Foundation-layer systems).
+- `minimal` — not required. Can still be run voluntarily.
**If the argument starts with `retrofit` followed by a file path**
(e.g., `/architecture-decision retrofit docs/architecture/adr-0001-event-system.md`):
@@ -59,7 +87,74 @@ Enter **retrofit mode**:
7. Suggest: "Run `/architecture-review` to re-validate coverage now that this ADR
has its Status and Dependencies fields."
-If NOT in retrofit mode, proceed to Step 1 below (normal ADR authoring).
+**If the argument starts with `accept` followed by an ADR id**
+(e.g., `/architecture-decision accept ADR-0005`):
+
+Enter **acceptance mode**. This is the *only* path in the framework that moves an
+ADR from `Proposed` to `Accepted`. Authoring always produces `Proposed`
+(Step 5), while
+`/create-control-manifest`, `/create-epics`, `/create-stories` and `/gate-check`
+all require `Accepted` — so without this mode the pipeline had a state it could
+enter and never leave.
+
+1. **Resolve the id to a file, then read it.** Glob
+ `docs/architecture/adr-NNNN-*.md` for the given number. If **no** file matches,
+ or **more than one** does, stop and say which — do not pick one. If the file
+ has no `## Status` section, stop and say so; a missing Status is exactly what
+ retrofit mode is for.
+2. **Check the current status.** If it is already `Accepted`, say so and stop.
+ If it is `Deprecated` or `Superseded`, refuse: reviving a superseded decision
+ is a new ADR, not a status edit.
+3. **Check its dependencies first.** Read `## ADR Dependencies`.
+
+ **If that section is absent, empty, or reads `UNKNOWN`, do not read it as
+ "no dependencies" — refuse and say which:**
+ > "ADR-0005's dependency section is [absent / UNKNOWN], so I cannot tell what
+ > this decision rests on. An empty dependency list and an unexamined one look
+ > identical here, and only one of them is safe to accept. Run
+ > `/architecture-decision retrofit <path>` to establish it."
+
+ A dependency check reading a field that defaults to empty is the vacuous-pass
+ shape this gate exists to prevent — the check would examine nothing and report
+ clean.
+
+ If it depends on any ADR that is not itself `Accepted`, **refuse and name them**:
+ > "ADR-0005 depends on ADR-0002, which is still Proposed. Accept ADR-0002
+ > first — an accepted decision resting on an unaccepted one is not a decision,
+ > it is a deferral with a different label."
+ This is the same dependency rule `/architecture-review` already flags; here it
+ is enforced rather than reported.
+4. **Confirm with the user, always.** Per `CONTRACT.md`, acceptance authority is
+ **the user, or `technical-director` on the user's explicit confirmation — no
+ other agent, and never this skill on its own.** Use `AskUserQuestion`:
+ - Prompt: "Accept ADR-NNNN — [title]? This is what unblocks stories and epics
+ that depend on it."
+ - Options: `[A] Yes — accept it` / `[B] Not yet — leave it Proposed`
+ **This prompt fires regardless of `modes.automation`, including `autonomous`.**
+ Acceptance is the decision the whole architecture pipeline gates on; it is not
+ a step to be inferred.
+5. **Find the stories this will unblock, BEFORE the prompt in step 4.** Grep
+ `production/epics/[epic-slug]/story-*.md` — the one place stories live — for
+ files containing **both** `Status: Blocked` and this ADR's id.
+ > **Stories live only under `production/epics/`.** A flat top-level stories
+ > directory does not exist and no skill creates one — never write or match a
+ > path outside `production/epics/`. `/dev-story` matches entries *by file
+ > path*, so a story recorded under any other path silently fails to match and
+ > never gets picked up. That pairing is what "blocked pending this
+ ADR" means — a story blocked for an unrelated reason will not name it. Feed the
+ count into step 4's prompt so it reads *"3 stories become Ready"* rather than a
+ generic claim: **the user is being asked to authorise an effect, and should be
+ shown the effect.** If none match, say "no stories are waiting on this" — that
+ is useful information, not an empty result to omit.
+6. On confirmation, `Edit` the `## Status` line to `Accepted`. Set the date in the
+ ADR's `## Date` section; **if that section is absent, add it** — retrofit mode
+ already owns this shape, and acceptance must not fail on a template that
+ predates the field.
+7. Then set each story found in step 5 from `Blocked` to `Ready`. Unblocking is a
+ consequence of acceptance, never of authoring — see Step 6's note below.
+8. Report what moved: the ADR, its new date, and every story that became Ready.
+
+If NOT in retrofit or acceptance mode, proceed to Step 1 below (normal ADR authoring).
**No-argument guard**: If no argument was provided (title is empty), ask before
running Phase 0:
@@ -123,12 +218,13 @@ Scan `docs/architecture/` for existing ADRs to find the next number.
## 3. Gather context
-Read related code, existing ADRs, and relevant GDDs from `design/gdd/`.
-
-### 3a: Architecture Registry Check (BLOCKING gate)
+### 3a: Architecture Registry Check (BLOCKING gate) — do this FIRST
Read `docs/registry/architecture.yaml`. Extract entries relevant to this ADR's
domain and decision (grep by system name, domain keyword, or state being touched).
+Run this before reading any existing ADR — the registry exists specifically so a
+new ADR's author does not need to open prior ADRs to learn their binding facts
+(state ownership, interface contracts, forbidden patterns).
Present any relevant stances to the user **before** the collaborative design
begins, as locked constraints:
@@ -164,6 +260,34 @@ the conflict immediately:
Do not proceed to Step 4 (collaborative design) until any conflict is resolved
or explicitly accepted as an intentional exception.
+### 3b: Existing ADRs and Related GDDs — registry-scoped, never unbounded
+
+The registry (3a) covers *what* prior decisions bind — not always *why*. If the
+registry surfaced a directly relevant ADR and its reasoning matters here (not
+just its stated facts), read that specific ADR — never glob-and-read every
+ADR in `docs/architecture/` on the chance one is relevant:
+
+1. **Map its headings first** (cheap):
+ ```
+ Grep pattern="^## " path="docs/architecture/[adr-file].md" output_mode="content" -n
+ ```
+2. **Under ~50KB** (`Bash: wc -c "docs/architecture/[adr-file].md"`) — one full
+ `Read` is fine; per-call overhead exceeds the savings from bounded reads at
+ this size (measured elsewhere in this project).
+3. **~50KB or larger** — bounded-read only `## Context`, `## Decision`, and
+ `## Consequences` (the sections that carry reasoning, not just facts) via
+ `Read(offset, limit)` from the heading map.
+
+Read GDDs the same way `/design-system` Step 2b does: only GDDs the registry
+or the ADR list names as directly relevant, and only their `## Dependencies`,
+`## Formulas`, and `## Edge Cases` sections
+(`Grep pattern="^## (Dependencies|Formulas|Edge Cases)" ... -A 40`) — never a
+speculative full read of `design/gdd/*.md` looking for anything that might
+relate.
+
+Skip 3b entirely if the registry already answers everything this decision
+needs — most ADRs will.
+
---
## 4. Guide the decision collaboratively
@@ -175,7 +299,16 @@ a **confirm/adjust** prompt using `AskUserQuestion` — not open-ended questions
**Derive assumptions first:**
- **Problem**: Infer from the title + GDD context what decision needs to be made
- **Alternatives**: Propose 2-3 concrete options from engine reference + GDD requirements
-- **Dependencies**: Scan existing ADRs for upstream dependencies; assume None if unclear
+- **Dependencies**: Scan existing ADRs for upstream dependencies. **If the scan is
+ inconclusive, present `UNKNOWN — scan inconclusive, please confirm`, never
+ `None`.** The two are not interchangeable: `None` asserts that nothing upstream
+ constrains this decision, and a user confirming a prefilled list cannot tell an
+ assertion from a guess. This field is load-bearing — `/architecture-review`
+ flags unaccepted dependencies, `/dev-story` reads it, and the acceptance route
+ in Phase 0 **refuses to accept an ADR whose dependencies are not themselves
+ Accepted**. A dependency list that defaulted to empty makes that check pass
+ while examining nothing. `UNKNOWN` must be resolved during the confirm/adjust
+ prompt; it is a prompt state, never a value written to the file
- **GDD linkage**: Extract which GDD systems the title directly relates to
- **Status**: Always `Proposed` for new ADRs — never ask the user what the status is
@@ -239,6 +372,20 @@ Following this format:
## Date
[Date of decision]
+## Last Verified
+[YYYY-MM-DD — when this ADR was last confirmed accurate against the current
+engine version and design. Update this date when you re-read and confirm it is
+still correct, even if nothing changed.]
+
+## Decision Makers
+[Who was involved in this decision]
+
+## Summary
+[2 sentences: what problem this ADR solves, and what was decided. Written for
+tiered context loading — a skill scanning 20 ADRs uses this to decide whether to
+read the full decision. Be specific: name the system, the problem, and the
+chosen approach.]
+
## Engine Compatibility
| Field | Value |
@@ -286,6 +433,11 @@ to implement it.]
### Key Interfaces
[API contracts or interface definitions this decision creates]
+### Implementation Guidelines
+[Specific guidance for the programmer implementing this decision — the rules a
+`/create-control-manifest` or `/dev-story` run should follow. State mandates as
+"must / must never" so they extract cleanly.]
+
## Alternatives Considered
### Alternative 1: [Name]
@@ -308,7 +460,7 @@ to implement it.]
### Negative
- [Trade-offs and costs accepted]
-### Risks
+## Risks
- [Things that could go wrong]
- [Mitigation for each risk]
@@ -330,14 +482,14 @@ to implement it.]
## Validation Criteria
[How will we know this decision was correct? What metrics or tests?]
-## Related Decisions
-- [Links to related ADRs]
+## Related
+- [Links to related ADRs — note if supersedes, contradicts, or depends on]
- [Links to related design documents]
```
-5.5. **Engine Specialist Validation** — Before saving, spawn the **primary engine specialist** via Task to validate the drafted ADR:
- - Read `.claude/docs/technical-preferences.md` `Engine Specialists` section to get the primary specialist
- - If no engine is configured (`[TO BE CONFIGURED]`), skip this step
+5.5. **Engine Specialist Validation** — Before saving, spawn the **primary engine specialist** via `Agent` to validate the drafted ADR:
+ - Resolve the primary specialist: `<engine>-specialist` derived from `engine.name` in `project.yaml` (Godot→`godot-specialist`, Unity→`unity-specialist`, Unreal→`unreal-specialist`); if `engine.name` is absent or empty, read the Primary line of the `## Engine Specialists` section in `.claude/docs/technical-preferences.md`
+ - If no engine is configured (neither source yields an engine), skip this step **Record `Engine validation: NOT ASSESSED — no engine configured (`engine.name` unset in `project.yaml`)` in this run's output.** A skipped check that says nothing is indistinguishable from a check that passed; the reader cannot tell engine guidance was never sought.
- Spawn `subagent_type: [primary specialist]` with: the ADR's Engine Compatibility section, Decision section, Key Interfaces, and the engine reference docs path. Ask them to:
1. Confirm the proposed approach is idiomatic for the pinned engine version
2. Flag any APIs or patterns that are deprecated or changed post-training-cutoff
@@ -350,7 +502,7 @@ to implement it.]
- `lean` → skip (not a PHASE-GATE). Note: "TD-ADR skipped — Lean mode." Proceed to Step 5.7 (GDD sync check).
- `full` → spawn as normal.
-5.6. **Technical Director Strategic Review** — After the engine specialist validation, spawn `technical-director` via Task using gate **TD-ADR** (`.claude/docs/director-gates.md`):
+5.6. **Technical Director Strategic Review** — After the engine specialist validation, spawn `technical-director` via `Agent` using gate **TD-ADR** (`.claude/docs/director-gates/td-adr.md`):
- Pass: the ADR file path (or draft content), engine version, domain, any existing ADRs in the same domain
- The TD validates architectural coherence (is this decision consistent with the whole system?) — distinct from the engine specialist's API-level check
- If CONCERNS or REJECT: revise the Decision or Alternatives sections accordingly before proceeding
@@ -370,7 +522,21 @@ The GDD must be updated before or alongside writing this ADR to prevent
developers reading the GDD from implementing the wrong interface.
```
-If no inconsistencies: skip this block silently.
+**This check has three outcomes, not two.** The two above are "found" and "none
+found"; the third is **could not check**, and until now it fell through the
+silent branch and rendered exactly like a clean result.
+
+- **None found** — print one line, do not stay silent:
+ `GDD sync: checked [N] referenced GDD(s), no naming inconsistencies.`
+ A silent pass is indistinguishable from a check that never ran, and this one
+ guards against developers implementing the wrong interface from a stale GDD.
+- **Could not check** — the ADR has no `GDD Requirements Addressed` section, it
+ names no GDDs, or a named GDD does not exist on disk. Print:
+ `GDD sync: NOT ASSESSED — [which reason, and which files]`
+ Do **not** treat an ADR that references no GDDs as one whose GDDs are
+ consistent. Nothing was compared.
+
+Only the warning block itself is conditional; the check always reports.
5. **Write approval** — Use `AskUserQuestion`:
@@ -453,4 +619,18 @@ If there are no remaining priority ADRs and no undesigned GDD systems, offer onl
> The reviewing agent must be independent of the authoring context to give an unbiased
> assessment. Running it here would invalidate the review.
-Update any stories that were `Status: Blocked` pending this ADR to `Status: Ready`.
+**Do NOT unblock stories here.** This ADR is `Proposed` — Step 5 guarantees it,
+and a story blocked *pending this decision* is still pending it. Unblocking on
+authoring is how the deadlock stayed invisible: it defeated the guard at the
+moment the guard became relevant, so the pipeline appeared to flow while running
+on decisions nobody had accepted.
+
+Instead, tell the user what is now waiting on acceptance:
+
+> "ADR-NNNN is written and `Proposed`. [N] stories remain `Blocked` pending it.
+> Run `/architecture-decision accept ADR-NNNN` when the decision is settled —
+> that is what moves them to `Ready`."
+
+List the blocked stories by path so the cost of leaving it Proposed is visible.
+(Acceptance has consequences enforced across many skills and an authority
+recorded in only a few, so the route between them must stay explicit.)
diff --git a/.claude/skills/architecture-review/SKILL.md b/.claude/skills/architecture-review/SKILL.md
index 3ce3c6d9..c635c6c8 100644
--- a/.claude/skills/architecture-review/SKILL.md
+++ b/.claude/skills/architecture-review/SKILL.md
@@ -1,13 +1,16 @@
---
name: architecture-review
-description: "Validates completeness and consistency of the project architecture against all GDDs. Builds a traceability matrix mapping every GDD technical requirement to ADRs, identifies coverage gaps, detects cross-ADR conflicts, verifies engine compatibility consistency across all decisions, and produces a PASS/CONCERNS/FAIL verdict. The architecture equivalent of /design-review."
+description: "Traceability matrix mapping GDD requirements to ADRs. Finds gaps, cross-ADR conflicts, engine compatibility. PASS/CONCERNS/NOT ASSESSED/FAIL."
argument-hint: "[focus: full | coverage | consistency | engine | single-gdd path/to/gdd.md]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Task, AskUserQuestion
-agent: technical-director
+allowed-tools: Read, Glob, Grep, Bash, Write, Agent, AskUserQuestion
model: opus
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,workflow`
+
+
+
# Architecture Review
The architecture review validates that the complete body of architectural decisions
@@ -29,10 +32,48 @@ and Pre-Production.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`workflow`** (see `.claude/docs/workflow-modes.md`):
+- `full` — full traceability matrix across all GDDs and all ADRs.
+- `standard` — reduced scope: architecture doc + critical ADRs only.
+- `minimal` — not applicable (no architecture doc required).
+
## Phase 1: Load Everything
### Phase 1a — L0: Summary Scan (fast, low tokens)
+**Freshness check before any scan.** Locate the latest prior report — Glob
+`docs/architecture/architecture-review-*.md` and take the newest — then:
+
+```
+Bash: bash .claude/scripts/review-receipts.sh check "[latest-report]" docs/architecture/adr-*.md design/gdd/*.md
+```
+
+- **Any `UNRESOLVED`** — check this FIRST; it disqualifies every option
+ below. One of the two globs matched no file, so that whole document class
+ was never examined and the comparison covered less than it appears to.
+ Say which pattern came back unresolved and stop: an ADR or GDD directory
+ that is empty, renamed or misspelled is a finding about the project, not a
+ reason to stand on a prior report. Never read a set of `UNCHANGED` lines as
+ "everything is current" while an `UNRESOLVED` line is present — the set
+ compared was not the set requested.
+- **Everything `UNCHANGED`** (and no `UNRESOLVED`) — nothing this review
+ reads has changed since that report; re-running reproduces it. Surface the
+ prior report's date and verdict and offer via `AskUserQuestion`: `[A] Stand
+ on the prior report (Recommended)` / `[B] Re-run the full review anyway` —
+ `guided` proceeds with [A] and notes it; `autonomous` logs via
+ `log_decision` and stands on the prior report.
+- **Some `CHANGED`/`NEW`** — name them, then scope instead of re-running
+ everything: recommend `/architecture-review [system]` (single-system mode)
+ for just the changed systems. A full re-run stays available on request,
+ and structural changes (a `NEW` ADR, a deleted file) warrant one.
+- **`RECEIPT: NONE`** — no prior report, or one written before receipts
+ existed. Proceed with the full review; this run's report will carry the
+ first stamps.
+
Before reading any full document, use Grep to extract `## Summary` sections
from all GDDs and ADRs:
@@ -41,34 +82,92 @@ Grep pattern="## Summary" glob="design/gdd/*.md" output_mode="content" -A 4
Grep pattern="## Summary" glob="docs/architecture/adr-*.md" output_mode="content" -A 3
```
+**Fail open on a missing Summary.** Establish the denominator: glob
+`design/gdd/*.md` and count **N**. A scan matching fewer than N means those GDDs
+predate `## Summary` (`/design-system` emits it, but older GDDs lack it) — never
+treat an absent Summary as a system out of scope. A zero-match scan means "no GDD
+carries a Summary yet", not "nothing to review": full-read the unmatched set.
+
For `single-gdd [path]` mode: use the target GDD's summary to identify which
-ADRs reference the same system (Grep ADRs for the system name), then full-read
-only those ADRs. Skip full-reading unrelated GDDs entirely.
+ADRs reference the same system (Grep ADRs for the system name), then load only
+those ADRs' sections per Phase 1b. Skip unrelated GDDs entirely.
-For `engine` mode: only full-read ADRs — GDDs are not needed for engine checks.
+For `engine` mode: load ADR sections only — GDDs are not needed for engine checks.
+In practice this is the `## Engine Compatibility` scan alone.
-For `coverage` or `full` mode: proceed to full-read everything below.
+For `coverage` or `full` mode: proceed to Phase 1b for the full in-scope set.
+**This is a section load, not a full-file load** — see below for why, and for the
+narrow cases that still justify escalating to a whole document.
-### Phase 1b — L1/L2: Full Document Load
+### Phase 1b — L1/L2: Targeted Section Load
-Read all inputs appropriate to the mode:
+Load the sections the later phases actually consume — **not whole files**. This
+skill reads the two largest document sets in the project (every GDD *and* every
+ADR); at realistic sizes a full load of both exhausts the context window before
+Phase 2 starts, and most of what it loads is narrative this skill never uses.
+
+**Establish the denominator first.** Glob `design/gdd/*.md` and count **N_gdd**;
+glob `docs/architecture/adr-*.md` and count **N_adr**. Report both. A section
+scan matching fewer than the denominator means those documents lack the section —
+**never treat an absent section as an absent document.** The scan narrows the
+*read* set; it never shrinks the *in-scope* set.
### Design Documents
-- All in-scope GDDs in `design/gdd/` — read every file completely
-- `design/gdd/systems-index.md` — the authoritative list of systems
+
+Phase 2 extracts *technical requirements* — data structures, performance
+constraints, engine capabilities, cross-system communication, persistence,
+threading, platform needs. Those live in a known set of sections; Overview and
+Player Fantasy are narrative and yield none.
+
+```
+Grep pattern="^## (Detailed Rules|Detailed Design|Formulas|Dependencies|Tuning Knobs|Acceptance Criteria)" glob="design/gdd/*.md" output_mode="content" -A 40
+```
+
+Accept **either** `## Detailed Rules` or `## Detailed Design` — the design
+standard and the GDD template disagree on the name and they denote the same
+required section. Full-read a single GDD only when a scanned section
+cross-references material outside itself, or when a GDD matched zero sections
+(it predates the template — read it whole and say so).
+
+- `design/gdd/systems-index.md` — the authoritative list of systems; read whole (small, and it is an index)
### Architecture Documents
-- All in-scope ADRs in `docs/architecture/` — read every file completely
+
+Phases 3–5 need the traceability table, the decision itself, engine claims, and
+the dependency edges — not Context, Consequences, Alternatives, Migration Plan or
+Validation Criteria, which explain *why* a decision was made.
+
+```
+Grep pattern="^## (Status|Decision|GDD Requirements Addressed|Engine Compatibility|ADR Dependencies|Performance Implications)" glob="docs/architecture/adr-*.md" output_mode="content" -A 30
+```
+
+Interpret against **N_adr**, and distinguish the two zero-match cases — they are
+not the same finding:
+
+| Result | Meaning | Action |
+|---|---|---|
+| N_adr matches | Normal. | Proceed on the scanned sections. |
+| Some ADRs match, some do not | Those ADRs are missing sections. | Record each as a **structural gap** in the Phase 7 report — a missing `## GDD Requirements Addressed` is itself a traceability finding. |
+| **0 matches, N_adr > 0** | **Malformed ADRs**, not "no architecture". | "[N_adr] ADRs found, none carries a scannable section — run `/architecture-decision [file] retrofit` on each." Do **not** report zero coverage; that would read as a design failure when it is a format failure. |
+
+Escalate to a full read of one ADR only when judging a conflict needs its
+reasoning (Phase 4) — that is a per-ADR decision, not a blanket load.
+
- `docs/architecture/architecture.md` if it exists
### Engine Reference
- `docs/engine-reference/[engine]/VERSION.md`
- `docs/engine-reference/[engine]/breaking-changes.md`
- `docs/engine-reference/[engine]/deprecated-apis.md`
-- All files in `docs/engine-reference/[engine]/modules/`
+- **Only the module docs the in-scope ADRs actually name** — take the union of
+ each ADR's `References Consulted` and `Post-Cutoff APIs Used` fields (already
+ captured by the `## Engine Compatibility` scan above) and read those files.
+ Reading the whole `modules/` directory loads engine subsystems the project may
+ not use at all. If no ADR names any module, read none and note it: Phase 5
+ cannot cross-check engine claims that were never made.
### Project Standards
-- `.claude/docs/technical-preferences.md`
+- `project.yaml` — `naming.*` and `performance.*`; plus `.claude/docs/technical-preferences.md` for those keys when absent and for forbidden patterns / allowed libraries
Report a count: "Loaded [N] GDDs, [M] ADRs, engine: [name + version]."
@@ -137,16 +236,36 @@ architecture must cover.
For each technical requirement extracted in Phase 2, search the ADRs:
-1. Read every ADR's "GDD Requirements Addressed" section
+1. Use the ADRs **already loaded in Phase 1b** — do not re-read them. Extract each
+ ADR's "GDD Requirements Addressed" section from what is already in context.
+ (If Phase 1b ran in a mode that did not load every ADR, `Grep pattern="## GDD
+ Requirements Addressed" glob="docs/architecture/adr-*.md" output_mode="content"
+ -A 15` fills the gap without a full re-read.)
2. Check if it explicitly references the requirement or its GDD
3. Check if the ADR's decision text implicitly covers the requirement
4. Mark coverage status:
| Status | Meaning |
|--------|---------|
-| ✅ **Covered** | An ADR explicitly addresses this requirement |
+| ✅ **Covered** | An **Accepted** ADR explicitly addresses this requirement |
+| 🟡 **Covered (Proposed)** | An ADR addresses it, but that ADR is still `Proposed` |
| ⚠️ **Partial** | An ADR partially covers this, or coverage is ambiguous |
| ❌ **Gap** | No ADR addresses this requirement |
+| ❓ **Not assessed** | The ADR is unreadable, or has no `## Status` section |
+
+> **Read each ADR's `## Status` before marking coverage — an unaccepted decision
+> is not coverage.** If `✅` meant only that *an ADR addresses this*, with no
+> status qualification, a requirement covered entirely by `Proposed` ADRs would
+> count as covered and this review could return **PASS: All requirements
+> covered** over an architecture nobody had accepted. Four skills downstream
+> (`create-control-manifest`, `create-epics`, `create-stories`, `gate-check`)
+> require `Accepted`, so a PASS on that basis sends work forward that every one
+> of them will refuse.
+>
+> `🟡` is **not** a pass state: it caps the verdict at **CONCERNS**, and names the
+> route out — `/architecture-decision accept ADR-NNNN`. That route is the only
+> thing that moves an ADR to `Accepted`; without it, grading `Proposed` as
+> covered would be the only option, which is why it must never be graded so.
Build the full matrix:
@@ -174,11 +293,22 @@ Requirements Traceability Matrix (RTM).
### Step 3b-1 — Load stories
-Glob `production/epics/**/*.md` (excluding EPIC.md index files). For each
-story file:
-- Extract `TR-ID` from the story's Context section
-- Extract story file path, title, Status
-- Extract `## Test Evidence` section — the stated test file path
+Glob `production/epics/**/*.md` (excluding EPIC.md index files) to establish the
+denominator. Then collect the fields with **targeted section greps, not a full
+read of each story** — the same two-grep form `/test-evidence-review` uses for
+this identical extraction:
+
+```
+Grep pattern="## Test Evidence" glob="production/epics/**/story-*.md" output_mode="content" -A 8
+Grep pattern="TR-" glob="production/epics/**/story-*.md" output_mode="content"
+```
+
+- **TR-ID** — from the second grep.
+- **Test file path** — under `## Test Evidence`, captured by the first grep's `-A 8`.
+- **Status** — from the story header; add `Grep pattern="^> \*\*Status\*\*"` if not already captured.
+- **Story path and title** — from the file name and path; no read at all.
+
+Full-read a story only when its Test Evidence section is missing or ambiguous.
### Step 3b-2 — Load test files
@@ -250,24 +380,41 @@ Resolution options:
### ADR Dependency Ordering
-After conflict detection, analyse the dependency graph across all ADRs:
+After conflict detection, analyse the dependency graph across all ADRs.
+
+**Build the graph deterministically — do not trace it by hand:**
-1. **Collect all `Depends On` fields** from every ADR's "ADR Dependencies" section
-2. **Topological sort**: Determine the correct implementation order — ADRs with no
+```
+Bash: bash .claude/scripts/adr-dep-graph.sh
+```
+
+It collects every `Depends On` edge, runs Kahn's algorithm, and emits
+`ADRS:` / `EDGES:` / `NO_DEPS_SECTION:` / `CYCLE:`. A model tracing A→B→C→A across
+a dozen ADRs eventually misses an edge; the algorithm cannot. It reports
+observations, not a verdict — you apply the meaning below.
+
+**`NO_DEPS_SECTION` is load-bearing**: it makes "no cycles because the graph is
+clean" distinguishable from "no cycles because half the ADRs declare no
+dependencies". Report the second case as a structural gap, never as a clean graph.
+
+Then interpret:
+
+1. **Topological sort**: the emitted order — ADRs with no
dependencies come first (Foundation), ADRs that depend on those come next, etc.
-3. **Flag unresolved dependencies**: If ADR-A's "Depends On" field references an ADR
- that is still `Proposed` or does not exist, flag it:
+2. **Flag unresolved dependencies**: cross the `EDGES:` list against the `## Status`
+ values already scanned in Phase 1b. If ADR-A depends on an ADR that is still
+ `Proposed` or does not exist, flag it:
```
⚠️ ADR-0005 depends on ADR-0002 — but ADR-0002 is still Proposed.
ADR-0005 cannot be safely implemented until ADR-0002 is Accepted.
```
-4. **Cycle detection**: If ADR-A depends on ADR-B and ADR-B depends on ADR-A (directly
- or transitively), flag it as a `DEPENDENCY CYCLE`:
+3. **Cycle detection**: every `CYCLE:` line the script emitted is a
+ `DEPENDENCY CYCLE` — report each one. Do not re-derive them by hand:
```
🔴 DEPENDENCY CYCLE: ADR-0003 → ADR-0006 → ADR-0003
This cycle must be broken before either can be implemented.
```
-5. **Output recommended implementation order**:
+4. **Output recommended implementation order**:
```
### Recommended ADR Implementation Order (topologically sorted)
Foundation (no dependencies):
@@ -323,9 +470,9 @@ Post-Cutoff API Conflicts:
### Engine Specialist Consultation
-After completing the engine audit above, spawn the **primary engine specialist** via Task for a domain-expert second opinion:
-- Read `.claude/docs/technical-preferences.md` `Engine Specialists` section to get the primary specialist
-- If no engine is configured, skip this consultation
+After completing the engine audit above, spawn the **primary engine specialist** via `Agent` for a domain-expert second opinion:
+- Resolve the primary specialist: `<engine>-specialist` derived from `engine.name` in `project.yaml` (Godot→`godot-specialist`, Unity→`unity-specialist`, Unreal→`unreal-specialist`); if `engine.name` is absent or empty, read the Primary line of the `## Engine Specialists` section in `.claude/docs/technical-preferences.md`
+- If no engine is configured (neither source yields an engine), skip this consultation **Record `Engine validation: NOT ASSESSED — no engine configured (`engine.name` unset in `project.yaml`)` in this run's output.** A skipped check that says nothing is indistinguishable from a check that passed; the reader cannot tell engine guidance was never sought.
- Spawn `subagent_type: [primary specialist]` with: all ADRs that contain engine-specific decisions or `Post-Cutoff APIs Used` fields, the engine reference docs, and the Phase 5 audit findings. Ask them to:
1. Confirm or challenge each audit finding — specialists may know of engine nuances not captured in the reference docs
2. Identify engine-specific anti-patterns in the ADRs that the audit may have missed (e.g., using the wrong Godot node type, Unity component coupling, Unreal subsystem misuse)
@@ -385,7 +532,16 @@ If [B]: display the complete proposed systems-index section, then re-ask with `A
## Phase 6: Architecture Document Coverage
-If `docs/architecture/architecture.md` exists, validate it against GDDs:
+**If `docs/architecture/architecture.md` does not exist, say so in the report** —
+`Architecture document coverage: NOT ASSESSED — no docs/architecture/architecture.md`
+— and carry it into the Phase 7 verdict per the trigger list below. Phase 5
+already models this for the engine consultation (*"A skipped check that says
+nothing is indistinguishable from a check that passed"*); this phase is the one
+that did not. Silently producing no Phase 6 findings reads as an architecture
+document that was checked and found clean, which is the opposite of what
+happened.
+
+If it exists, validate it against GDDs:
- Does every system from `systems-index.md` appear in the architecture layers?
- Does the data flow section cover all cross-system communication defined in GDDs?
@@ -404,6 +560,10 @@ Engine: [name + version]
GDDs Reviewed: [N]
ADRs Reviewed: [M]
+[output of: Bash: bash .claude/scripts/review-receipts.sh hash docs/architecture/adr-*.md design/gdd/*.md
+ — one Reviewed-Content-Hash line per file reviewed; Phase 1a's freshness
+ check reads these on the next run to skip or scope an unchanged re-review]
+
---
### Traceability Summary
@@ -438,13 +598,34 @@ For each gap:
---
-### Verdict: [PASS / CONCERNS / FAIL]
+### Verdict: [PASS / NOT ASSESSED / CONCERNS / FAIL]
-PASS: All requirements covered, no conflicts, engine consistent
-CONCERNS: Some gaps or partial coverage, but no blocking conflicts
+PASS: All requirements covered by **Accepted** ADRs, no conflicts, engine consistent
+NOT ASSESSED: The review could not be performed over its stated scope — name why
+CONCERNS: Some gaps, partial coverage, or coverage resting on `Proposed` ADRs,
+ but no blocking conflicts
FAIL: Critical gaps (Foundation/Core layer requirements uncovered),
or blocking cross-ADR conflicts detected
+**`NOT ASSESSED` ranks above PASS and below CONCERNS and FAIL.** Emit it when:
+
+- **No ADRs exist, or none could be read.** Zero requirements traced is not full
+ coverage — it is an untraced architecture, and a matrix of `❌ Gap` rows at
+ least says so while an empty matrix says nothing.
+- **The requirement source is missing** — no `tr-registry.yaml` and no GDD
+ requirements to trace *from*. A review with no left-hand column cannot report
+ coverage; it can only report that it had nothing to compare.
+- **An ADR is unreadable or has no `## Status`**, so its rows are `❓` and their
+ coverage is unknown rather than absent.
+- **Phase 6 could not run** — no `docs/architecture/architecture.md`. This does
+ not by itself force NOT ASSESSED for the whole review (ADR traceability is the
+ primary scope and can still be complete), but it must appear as a named
+ `NOT ASSESSED` **line item** in the report rather than as absent findings. Emit
+ the overall NOT ASSESSED verdict only if Phase 6 was the review's stated scope.
+
+Do not resolve any of these to PASS on the grounds that no gap was *found*. No
+gap was looked for.
+
### Blocking Issues (must resolve before PASS)
[List items that must be resolved — FAIL verdict only]
@@ -634,20 +815,27 @@ Then close with `AskUserQuestion` tailored to the pre-gate checklist state:
## Error Recovery Protocol
-If any spawned agent returns BLOCKED, errors, or fails to complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "fails to complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" before continuing
-2. **Assess dependencies**: If the blocked agent's output is required by a later phase, do not proceed past that phase without user input
-3. **Offer options** via AskUserQuestion with three choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope (fewer GDDs, single-system focus)
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed so work is not lost
+If any spawned agent returns BLOCKED, errors, or fails to complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report** (retry scope here = fewer GDDs / single-system). Full procedure:
+`.claude/docs/error-recovery-protocol.md`.
---
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
1. **Read silently** — do not narrate every file read
2. **Show the matrix** — present the full traceability matrix before asking for
anything; let the user see the state
diff --git a/.claude/skills/art-bible/SKILL.md b/.claude/skills/art-bible/SKILL.md
index 1a264ba0..f734dad1 100644
--- a/.claude/skills/art-bible/SKILL.md
+++ b/.claude/skills/art-bible/SKILL.md
@@ -1,20 +1,41 @@
---
name: art-bible
-description: "Guided, section-by-section Art Bible authoring. Creates the visual identity specification that gates all asset production. Run after /brainstorm is approved and before /map-systems or any GDD authoring begins."
+description: "Author the Art Bible — visual identity gating asset production. Run before /map-systems."
argument-hint: "[--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, Agent, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,docs.density`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
## Phase 0: Parse Arguments and Context Check
-Resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
-See `.claude/docs/director-gates.md` for the full check pattern.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`docs.density`** — it controls per-section *depth*, where `workflow`
+controls which sections exist. `modes.rigor` sets both together; set
+`docs.density` explicitly to vary depth alone: `terse` = each section a bulleted list of
+constraints + references; `balanced` = paragraphs explaining each visual choice
+(default); `thorough` = full prose including style explorations, references, and
+rationale per choice. Apply it to every section you author.
+
+**`workflow`** (see `.claude/docs/workflow-modes.md`):
+- `full` — all 9 art bible sections required.
+- `standard` — required only if visual asset stories exist in the project;
+ sections 1–4 are the minimum when required. `workflow_overrides.art_bible_strict:
+ true` forces all 9 sections regardless of tier.
+- `minimal` — not required. Can still be run voluntarily.
Read `design/gdd/game-concept.md`. If it does not exist, fail with:
> "No game concept found. Run `/brainstorm` first — the art bible is authored after the game concept is approved."
@@ -26,9 +47,24 @@ Extract from game-concept.md:
- **Visual Identity Anchor** section if present (from brainstorm Phase 4 art-director output)
- Target platform (if noted)
-**Retrofit mode detection**: Glob `design/art/art-bible.md`. If the file exists:
-- Read it in full
-- For each of the 9 sections, check whether the body contains real content (more than a `[To be designed]` placeholder or similar) vs. is empty/placeholder
+**Retrofit mode detection**: Glob `design/art/art-bible.md`. If the file exists,
+build the status table **without reading the document** — you are about to author
+only the *incomplete* sections, so loading the complete ones is loading exactly
+what you will not touch:
+
+```
+Grep pattern="^## " path="design/art/art-bible.md" output_mode="content" -n
+Grep pattern="\[To be designed\]|\[TBD\]|\[To be written\]|^_?TODO" path="design/art/art-bible.md" output_mode="content" -n
+```
+
+- The first grep gives the section headings and their line numbers — the gap
+ between consecutive headings is that section's size.
+- The second gives placeholder markers and where they fall.
+- A section is **Complete** if it has substantive distance to the next heading and
+ no placeholder marker inside it; **Placeholder** if a marker falls in its range;
+ **Empty** if consecutive headings sit adjacent.
+- Where the two greps leave a section genuinely ambiguous, read *that section's*
+ line range with `Read(offset, limit)` — never the whole file.
- Build a section status table:
```
@@ -51,7 +87,7 @@ Section | Status
If the file does not exist, this is a fresh authoring session — proceed normally.
-Read `.claude/docs/technical-preferences.md` if it exists — extract performance budgets and engine for asset standard constraints.
+Extract performance budgets and the engine for asset standard constraints: read `performance.*` and `engine.name` from `project.yaml`; for any key absent or empty (including when `project.yaml` has no `performance` or `engine` block), fall back to `.claude/docs/technical-preferences.md`.
---
@@ -62,6 +98,21 @@ Present the session context and ask two questions before authoring anything:
Use `AskUserQuestion` with two tabs:
- Tab **"Scope"** — "Which sections need to be authored today?"
Options: `Full bible — all 9 sections` / `Visual identity core (sections 1–4 only)` / `Asset standards only (section 8)` / `Resume — fill in missing sections`
+
+ **Mark the option the resolved `workflow` tier actually requires as
+ (Recommended), and say why** — the tier already decides this and the user
+ should not have to know the tier table to answer:
+ - `full` → **Full bible** — all 9 sections are required at this tier.
+ - `standard` → **Visual identity core (sections 1–4 only)** — that is the
+ documented minimum when an art bible is required at all. Say: "Sections 1–4
+ are what `standard` requires; 5–9 are available if you want them."
+ - `minimal` → no art bible is required. Say so before asking, and offer
+ sections 1–4 as the useful-if-you-want-it option rather than defaulting to 9.
+ - `workflow_overrides.art_bible_strict: true` → **Full bible** regardless of tier.
+
+ This is the single biggest cost lever in this skill: every authored section
+ carries a specialist spawn, so authoring 9 sections where the tier requires 4
+ more than doubles the run for artifacts nothing downstream will check.
- Tab **"References"** — "Do you have reference games, films, or art that define the visual direction?"
(Free text — let the user type specific titles. Do NOT preset options here.)
@@ -74,6 +125,21 @@ If the game-concept.md has a Visual Identity Anchor section, note it:
These four sections define the core visual language. **All other sections flow from them.** Author and write each to file before moving to the next.
+> **Spawn policy for this phase.** Section 1 is delegated on its own — it is
+> foundational and the user chooses between anchor directions before anything
+> else can build on it. Sections 2–4 are then delegated in **one** `art-director`
+> call, not three: they are the same agent receiving the same inputs (Visual
+> Identity Statement + pillars), and mood, shape and colour are interdependent —
+> an art director defines them together, not in isolation. Three separate calls
+> re-sent the same context three times and asked the agent to reason about
+> colour without knowing the shape language it had just written.
+>
+> **This is not reduced specialist involvement** — every section is still
+> authored by the specialist, which is the point `.claude/docs/effects-map.md`
+> makes about art-bible delegation being mandatory. It is one call instead of
+> three for the same three sections. Per-section user approval and
+> write-to-file-immediately are unchanged.
+
### Section 1: Visual Identity Statement
**Goal**: A one-line visual rule plus 2–3 supporting principles that resolve visual ambiguity.
@@ -83,7 +149,7 @@ If a visual anchor exists from game-concept.md: present it and ask:
- "Revise it before expanding?"
- "Start fresh with new options?"
-**Agent delegation (MANDATORY)**: Spawn `art-director` via Task:
+**Agent delegation (MANDATORY)**: Spawn `art-director` via `Agent`:
- Provide: game concept (elevator pitch, core fantasy), full pillar set, platform target, any reference games/art from Phase 1 framing, the visual anchor if it exists
- Ask: "Draft a Visual Identity Statement for this game. Provide: (1) a one-line visual rule that could resolve any visual decision ambiguity, (2) 2–3 supporting visual principles, each with a one-sentence design test ('when X is ambiguous, this principle says choose Y'). Anchor all principles directly in the stated pillars — each principle must serve a specific pillar."
@@ -102,9 +168,21 @@ For each major game state (e.g., exploration, combat, victory, defeat, menus —
- Atmospheric descriptors (3–5 adjectives)
- Energy level (frenetic / measured / contemplative / etc.)
-**Agent delegation**: Spawn `art-director` via Task with the Visual Identity Statement and pillar set. Ask: "Define mood and atmosphere targets for each major game state in this game. Be specific — 'dark and foreboding' is not enough. Name the exact emotional target, the lighting character (warm/cool, high/low contrast, time of day direction), and at least one visual element that carries the mood. Each game state must feel visually distinct from the others."
+**Agent delegation for Sections 2–4 — one call, issued here.** Spawn
+`art-director` via `Agent` with the locked Visual Identity Statement and pillar set,
+and ask for all three sections in a single brief:
-Write the approved section to file immediately.
+1. **Mood & atmosphere** — "Define mood and atmosphere targets for each major game state in this game. Be specific — 'dark and foreboding' is not enough. Name the exact emotional target, the lighting character (warm/cool, high/low contrast, time of day direction), and at least one visual element that carries the mood. Each game state must feel visually distinct from the others."
+2. **Shape language** — "Define the shape language for this game. Connect each shape principle back to the visual identity statement and a specific game pillar. Explain what these shape choices communicate to the player emotionally."
+3. **Colour system** — "Design the color system for this game. Every semantic color assignment must be explained — why does this color mean danger/safety/reward in this world? Identify which color pairs might fail colorblind players and specify what backup cues are needed."
+
+Require the three to be **mutually consistent** — the palette must serve the mood
+targets and the shape hierarchy — and returned as three separately labelled
+blocks so each can be approved and written on its own.
+
+Then present **Section 2** to the user, approve it, and write it to file
+immediately before moving to Section 3. Do not present all three at once: the
+batching is in the delegation, not in the review.
### Section 3: Shape Language
@@ -116,7 +194,8 @@ Cover:
- UI shape grammar (does UI echo the world aesthetic, or is it a distinct HUD language?)
- Hero shapes vs. supporting shapes (what draws the eye, what recedes?)
-**Agent delegation**: Spawn `art-director` via Task with Visual Identity Statement and mood targets. Ask: "Define the shape language for this game. Connect each shape principle back to the visual identity statement and a specific game pillar. Explain what these shape choices communicate to the player emotionally."
+**Draft source**: the Sections 2–4 delegation issued under Section 2 — use the
+shape-language block it returned. Do not spawn again.
Write the approved section to file immediately.
@@ -131,7 +210,8 @@ Cover:
- UI palette (may differ from world palette — define the divergence explicitly)
- Colorblind safety: which semantic colors need shape/icon/sound backup
-**Agent delegation**: Spawn `art-director` via Task with Visual Identity Statement and mood targets. Ask: "Design the color system for this game. Every semantic color assignment must be explained — why does this color mean danger/safety/reward in this world? Identify which color pairs might fail colorblind players and specify what backup cues are needed."
+**Draft source**: the Sections 2–4 delegation issued under Section 2 — use the
+colour-system block it returned. Do not spawn again.
Write the approved section to file immediately.
@@ -143,13 +223,25 @@ These sections translate the visual identity into concrete production rules. The
### Section 5: Character Design Direction
-**Agent delegation**: Spawn `art-director` via Task with sections 1–4. Ask: "Define character design direction for this game. Cover: visual archetype for the player character (if any), distinguishing feature rules per character type (how do players tell enemies/NPCs/allies apart at a glance?), expression/pose style targets (stiff/expressive/realistic/exaggerated), and LOD philosophy (how much detail is preserved at game camera distance?)."
+**Agent delegation for Sections 5–6 — one call, issued here.** Both sections
+were separate spawns of the **same agent with the same input** (`sections 1–4`),
+which is pure duplication: the second call re-sent the whole visual identity to
+an agent that had just been given it. Spawn `art-director` once with sections
+1–4 and ask for both:
-Write the approved section to file.
+1. **Character design direction** — "Cover: visual archetype for the player character (if any), distinguishing feature rules per character type (how do players tell enemies/NPCs/allies apart at a glance?), expression/pose style targets (stiff/expressive/realistic/exaggerated), and LOD philosophy (how much detail is preserved at game camera distance?)."
+2. **Environment design language** — "Cover: architectural style and its relationship to the world's culture/history, texture philosophy (painted vs. PBR vs. stylized — why this choice for this game?), prop density rules (sparse/dense — what drives the choice per area type?), and environmental storytelling guidelines (what visual details should tell the story without text?)."
+
+Require characters and environments to be **legible against each other** — a
+character silhouette must read against the environment texture density the same
+brief defines. Return two separately labelled blocks.
+
+Present **Section 5** first, approve, write to file, then Section 6.
### Section 6: Environment Design Language
-**Agent delegation**: Spawn `art-director` via Task with sections 1–4. Ask: "Define the environment design language for this game. Cover: architectural style and its relationship to the world's culture/history, texture philosophy (painted vs. PBR vs. stylized — why this choice for this game?), prop density rules (sparse/dense — what drives the choice per area type?), and environmental storytelling guidelines (what visual details should tell the story without text?)."
+**Draft source**: the Sections 5–6 delegation issued under Section 5 — use the
+environment block it returned. Do not spawn again.
Write the approved section to file.
@@ -167,7 +259,7 @@ Write the approved section to file.
**Agent delegation**: Spawn in parallel:
- **`art-director`**: File format preferences, naming convention direction, texture resolution tiers, LOD level expectations, export settings philosophy
-- **`technical-artist`**: Engine-specific hard constraints — poly count budgets per asset category, texture memory limits, material slot counts, importer constraints, anything from the performance budgets in `.claude/docs/technical-preferences.md`
+- **`technical-artist`**: Engine-specific hard constraints — poly count budgets per asset category, texture memory limits, material slot counts, importer constraints, anything from the performance budgets (`performance.*` in `project.yaml`, falling back to `.claude/docs/technical-preferences.md`)
If any art preference conflicts with a technical constraint (e.g., art-director wants 4K textures but performance budget requires 2K for mobile), resolve the conflict explicitly — note both the ideal and the constrained standard, and explain the tradeoff. Ambiguity in asset standards is where production costs are born.
@@ -179,7 +271,7 @@ Write the approved section to file.
**Goal**: A curated reference set that is specific about what to take and what to avoid from each source.
-**Agent delegation**: Spawn `art-director` via Task with the completed sections 1–8. Ask: "Compile a reference direction for this game. Provide 3–5 reference sources (games, films, art styles, or specific artists). For each: name it, specify exactly what visual element to draw from it (not 'the general aesthetic' — a specific technique, color choice, or compositional rule), and specify what to explicitly avoid or diverge from (to prevent the 'trying to copy X' reading). References should be additive — no two references should be pointing in exactly the same direction."
+**Agent delegation**: Spawn `art-director` via `Agent` with the completed sections 1–8. Ask: "Compile a reference direction for this game. Provide 3–5 reference sources (games, films, art styles, or specific artists). For each: name it, specify exactly what visual element to draw from it (not 'the general aesthetic' — a specific technique, color choice, or compositional rule), and specify what to explicitly avoid or diverge from (to prevent the 'trying to copy X' reading). References should be additive — no two references should be pointing in exactly the same direction."
Write the approved section to file.
@@ -192,7 +284,7 @@ Write the approved section to file.
- `lean` → skip (not a PHASE-GATE). Note: "AD-ART-BIBLE skipped — Lean mode." Proceed to Phase 6.
- `full` → spawn as normal.
-After all sections are complete (or the scoped set from Phase 1 is complete), spawn `creative-director` via Task using gate **AD-ART-BIBLE** (`.claude/docs/director-gates.md`).
+After all sections are complete (or the scoped set from Phase 1 is complete), spawn `creative-director` via `Agent` using gate **AD-ART-BIBLE** (`.claude/docs/director-gates/ad-art-bible.md`).
Pass: art bible file path, game pillars, visual identity anchor.
@@ -205,7 +297,7 @@ Handle verdict per standard rules in `director-gates.md`. Record the verdict in
Before presenting next steps, check project state:
- Does `design/gdd/systems-index.md` exist? → map-systems is done, skip that option
-- Does `.claude/docs/technical-preferences.md` contain a configured engine (not `[TO BE CONFIGURED]`)? → setup-engine is done, skip that option
+- Is an engine configured — `engine.name` present in `project.yaml`, or a configured Engine field (not `[TO BE CONFIGURED]`) in `.claude/docs/technical-preferences.md`? → setup-engine is done, skip that option
- Does `design/gdd/` contain any `*.md` files? → design-system has been run, skip that option
- Does `design/gdd/gdd-cross-review-*.md` exist? → review-all-gdds is done
- Do GDDs exist (check above)? → include /consistency-check option
@@ -230,10 +322,19 @@ Assign letters A, B, C… only to the options actually included. Mark the most l
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
Every section follows: **Question → Options → Decision → Draft (from art-director agent) → Approval → Write to file**
-- Never draft a section without first spawning the relevant agent(s)
-- Write each section to file immediately after approval — do not batch
+- Never draft a section yourself — every section's content comes from the
+ relevant specialist. One delegation may cover several sections (2–4 share a
+ call, as do 5–6), but no section may be written from the orchestrator's own
+ judgement instead of an agent's.
+- Write each section to file immediately after approval — do not batch **the
+ writes or the approvals**. Batching applies only to the delegation call; the
+ user still sees, approves and commits one section at a time.
- Surface all agent disagreements to the user — never silently resolve conflicts between art-director and technical-artist
- The art bible is a constraint document: it restricts future decisions in exchange for visual coherence. Every section should feel like it narrows the solution space productively.
diff --git a/.claude/skills/asset-audit/SKILL.md b/.claude/skills/asset-audit/SKILL.md
index 055c88f4..122becf0 100644
--- a/.claude/skills/asset-audit/SKILL.md
+++ b/.claude/skills/asset-audit/SKILL.md
@@ -1,13 +1,58 @@
---
name: asset-audit
-description: "Audits game assets for compliance with naming conventions, file size budgets, format standards, and pipeline requirements. Identifies orphaned assets, missing references, and standard violations."
+description: "Audit assets against naming conventions, file size budgets, format standards. Finds orphaned assets, missing references."
argument-hint: "[category|all]"
user-invocable: true
-allowed-tools: Read, Glob, Grep
+allowed-tools: Read, Glob, Grep, Bash
model: sonnet
# Read-only diagnostic skill — no specialist agent delegation needed
---
+## Measuring file sizes and formats requires Bash
+
+This skill's report asks for **file sizes against budgets**, **texture dimensions**
+(power-of-two), **audio sample rates**, and **last-modified times** for orphan
+detection. None of those are obtainable from `Read`/`Glob`/`Grep` — they need
+`stat` or a binary header read, so `Bash` is declared above for exactly that.
+
+**If you cannot take a measurement, the cell is `NOT ASSESSED`, never an
+estimate.** A size budget table filled from guesses is worse than an empty one:
+it looks like evidence. This is a live fabrication vector even on a project full
+of real assets: if the template demands tables of numbers the tool allowlist
+cannot produce, the only way to complete it is to invent them.
+
+---
+
+## Insufficient input — check this before producing any report
+
+**If the inputs this skill needs do not exist, the answer is "could not run" —
+not a filled-in report.** Check first, and stop if the check fails.
+
+1. List the inputs this skill reads (data files, prior reports, profiler output,
+ test results, registries, source code).
+2. For each, record `FOUND` or `ABSENT` — not "assumed present".
+3. If any input required for a section is ABSENT, that section is
+ **`NOT ASSESSED — NO DATA`**. Do not estimate it, do not infer it from an
+ adjacent artifact, and do not leave a mandated cell to be filled by whoever
+ reads the template next.
+4. If **every** required input is ABSENT, stop and report
+ **`NOT ASSESSED — NO DATA`** as the whole verdict, naming what was missing and
+ which skill produces it.
+
+**A verdict of `NOT ASSESSED` is a success.** It is the correct, useful answer to
+"what does the data say?" when there is no data. The failure mode this prevents is
+specific and has been observed in practice: report templates whose verdict
+enum had no "could not run" state produced **false clean passes** — an asset audit
+returning COMPLIANT on a project with no assets and no standards, and a
+performance profile reporting ">99% headroom against a 16.67ms budget" with zero
+profiler data and no budget ever set.
+
+**Absence of evidence is never evidence of absence.** A scan that finds no
+matches because there are no files to scan has not verified anything. Say which of
+the two happened — a reader cannot tell from a green result.
+
+---
+
## Phase 1: Read Standards
Read the art bible or asset standards from the relevant design docs and the CLAUDE.md naming conventions.
@@ -56,7 +101,7 @@ Scan the target asset directory using Glob:
- **Format violations**: [N]
- **Orphaned assets**: [N]
- **Missing assets**: [N]
-- **Overall health**: [CLEAN / MINOR ISSUES / NEEDS ATTENTION]
+- **Overall health**: [NOT ASSESSED / CLEAN / MINOR ISSUES / NEEDS ATTENTION]
## Naming Violations
| File | Expected Pattern | Issue |
@@ -81,7 +126,7 @@ Scan the target asset directory using Glob:
## Recommendations
[Prioritized list of fixes]
-## Verdict: [COMPLIANT / WARNINGS / NON-COMPLIANT]
+## Verdict: [NOT ASSESSED / COMPLIANT / WARNINGS / NON-COMPLIANT]
```
This skill is read-only — it produces a report but does not write files.
diff --git a/.claude/skills/asset-spec/SKILL.md b/.claude/skills/asset-spec/SKILL.md
index 463afbcd..d33d77b6 100644
--- a/.claude/skills/asset-spec/SKILL.md
+++ b/.claude/skills/asset-spec/SKILL.md
@@ -1,12 +1,16 @@
---
name: asset-spec
-description: "Generate per-asset visual specifications and AI generation prompts from GDDs, level docs, or character profiles. Produces structured spec files and updates the master asset manifest. Run after art bible and GDD/level design are approved, before production begins."
+description: "Per-asset visual specs plus AI generation prompts from GDDs and character profiles. After the art bible."
argument-hint: "[system:<name> | level:<name> | character:<name>] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, Agent, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation`
+
+
+
If no argument is provided, check whether `design/assets/entity-inventory.md` exists:
- If it exists: read it, find the first entity or screen with status "Needed" but no spec file yet, and use `AskUserQuestion`:
- Prompt: "The next unspecced item is **[name]**. Generate specs for it?"
@@ -16,6 +20,15 @@ If no argument is provided, check whether `design/assets/entity-inventory.md` ex
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt). **Note**: actually invoking an external image
+generator (calling an image API) always prompts regardless of
+`modes.automation` — it is an irreversible external action guarded
+unconditionally, independent of whether `external_calls` is listed in
+`automation_always_ask`. (Today this skill only emits generation-prompt
+*text*; the guard applies if live generation is ever wired in.)
+
## Phase 0b: Entity & Screen Inventory (runs when no arguments and no existing inventory)
This flow produces `design/assets/entity-inventory.md` — the master list of everything
@@ -24,7 +37,16 @@ the game needs visually. Run once before asset spec work begins.
### Step 1 — Gather from docs
Read all available source material in parallel:
- `design/gdd/systems-index.md` — extract every system listed
-- All GDDs in `design/gdd/` — extract: Visual/Audio Requirements sections, UI elements mentioned, VFX events, any named entities (characters, enemies, buildings, items)
+- GDD asset content — do **not** full-read every GDD. The two wanted sections are
+ standard headings, and named entities live in the registry:
+ ```
+ Grep pattern="## (Visual/Audio Requirements|UI Requirements)" glob="design/gdd/*.md" output_mode="content" -A 25
+ ```
+ For named entities (characters, enemies, buildings, items), read
+ `design/registry/entities.yaml` (`entities`/`items`) if it exists and has
+ entries; otherwise grep the GDDs for named content. Full-read a GDD only when
+ its Visual/Audio section is missing or reads `[To be designed]` (Phase 1 already
+ handles that case). VFX events surface in the Visual/Audio grep context.
- `design/art/art-bible.md` — extract: any named visual categories, asset type expectations
- `design/narrative/` — scan for any character or world entity documents if they exist (optional — not required)
@@ -108,8 +130,13 @@ Extract:
- **Target name**: the name after the colon (normalize to kebab-case)
- **Review mode**: `--review [full|lean|solo]` if present
+The effective mode is the one already resolved at the top of this skill via
+`resolve_config --keys review_mode`, which applies the full chain and
+defaults to `lean` — not `full`. A `--review` argument overrides it for this
+run only.
+
**Mode behavior:**
-- `full` (default): spawn both `art-director` and `technical-artist` in parallel
+- `full`: spawn both `art-director` and `technical-artist` in parallel
- `lean`: spawn `art-director` only — faster, skips technical constraint pass
- `solo`: no agent spawning — main session writes specs from art bible rules alone. Use for simple asset categories or when speed matters more than depth.
@@ -122,9 +149,9 @@ Read all source material **before** asking the user anything.
### Required reads:
- **Art bible**: Read `design/art/art-bible.md` — fail if missing:
> "No art bible found. Run `/art-bible` first — asset specs are anchored to the art bible's visual rules and asset standards."
- Extract: Visual Identity Statement, Color System (semantic colors), Shape Language, Asset Standards (Section 8 — dimensions, formats, polycount budgets, texture resolution tiers).
+ Extract: Visual Identity Statement, Color System (semantic colors), Shape Language, Asset Standards (art bible Section 8 — dimensions, formats, polycount budgets, texture resolution tiers).
-- **Technical preferences**: Read `.claude/docs/technical-preferences.md` — extract performance budgets and naming conventions.
+- **Project config**: Read `performance.*` and `naming.*` from `project.yaml`; for any key absent or empty (including when `project.yaml` has no `performance` or `naming` block), fall back to `.claude/docs/technical-preferences.md`. Extract performance budgets and naming conventions.
### Source doc reads (by target type):
- **system**: Read `design/gdd/[target-name].md`. Extract the **Visual/Audio Requirements** section. If it doesn't exist or reads `[To be designed]`:
@@ -179,17 +206,17 @@ Do NOT proceed to Phase 3 without user confirmation of the asset list.
## Phase 3: Spec Generation
-Spawn specialist agents based on review mode. **Issue all Task calls simultaneously — do not wait for one before starting the next.**
+Spawn specialist agents based on review mode. **Issue all `Agent` calls simultaneously — do not wait for one before starting the next.**
### Full mode — spawn in parallel:
-**`art-director`** via Task:
+**`art-director`** via `Agent`:
- Provide: full asset list from Phase 2, art bible Visual Identity Statement, Color System, Shape Language, the source doc's visual requirements, and any reference games/art mentioned in the art bible Section 9
- Ask: "For each asset in this list, produce: (1) a 2–3 sentence visual description anchored to the art bible's shape language and color system — be specific enough that two different artists would produce consistent results; (2) a generation prompt ready for use with AI image tools (Midjourney/Stable Diffusion style — include style keywords, composition, color palette anchors, negative prompts); (3) which art bible rules directly govern this asset (cite by section). For audio assets, describe the sonic character instead of a generation prompt."
-**`technical-artist`** via Task:
-- Provide: full asset list, art bible Asset Standards (Section 8), technical-preferences.md performance budgets, engine name and version
-- Ask: "For each asset in this list, specify: (1) exact dimensions or polycount (match the art bible Asset Standards tiers — do not invent new sizes); (2) file format and export settings; (3) naming convention (from technical-preferences.md); (4) any engine-specific constraints this asset type must respect; (5) LOD requirements if applicable. Flag any asset type where the art bible's preferred standard conflicts with the engine's constraints."
+**`technical-artist`** via `Agent`:
+- Provide: full asset list, art bible Asset Standards (Section 8), performance budgets (`performance.*` from `project.yaml`, else `technical-preferences.md`), engine name and version
+- Ask: "For each asset in this list, specify: (1) exact dimensions or polycount (match the art bible Asset Standards tiers — do not invent new sizes); (2) file format and export settings; (3) naming convention (`naming.*` from `project.yaml`, else `technical-preferences.md`); (4) any engine-specific constraints this asset type must respect; (5) LOD requirements if applicable. Flag any asset type where the art bible's preferred standard conflicts with the engine's constraints."
### Lean mode — spawn art-director only (skip technical-artist).
@@ -336,6 +363,10 @@ If any spawned agent returns BLOCKED or cannot complete:
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
Every phase follows: **Identify → Confirm → Generate → Review → Approve → Write**
- Never spec assets without first confirming the asset list with the user
diff --git a/.claude/skills/balance-check/SKILL.md b/.claude/skills/balance-check/SKILL.md
index 7d5f74cf..4949f11c 100644
--- a/.claude/skills/balance-check/SKILL.md
+++ b/.claude/skills/balance-check/SKILL.md
@@ -1,11 +1,48 @@
---
name: balance-check
-description: "Analyzes game balance data files, formulas, and configuration to identify outliers, broken progressions, degenerate strategies, and economy imbalances. Use after modifying any balance-related data or design. Use when user says 'balance report', 'check game balance', 'run a balance check'."
+description: "Find balance outliers, broken progressions, degenerate strategies, economy imbalances in formulas and data. 'Check game balance'."
argument-hint: "[system-name|path-to-data-file]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, AskUserQuestion
model: sonnet
-agent: economy-designer
+---
+
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+## Insufficient input — check this before producing any report
+
+**If the inputs this skill needs do not exist, the answer is "could not run" —
+not a filled-in report.** Check first, and stop if the check fails.
+
+1. List the inputs this skill reads (data files, prior reports, profiler output,
+ test results, registries, source code).
+2. For each, record `FOUND` or `ABSENT` — not "assumed present".
+3. If any input required for a section is ABSENT, that section is
+ **`NOT ASSESSED — NO DATA`**. Do not estimate it, do not infer it from an
+ adjacent artifact, and do not leave a mandated cell to be filled by whoever
+ reads the template next.
+4. If **every** required input is ABSENT, stop and report
+ **`NOT ASSESSED — NO DATA`** as the whole verdict, naming what was missing and
+ which skill produces it.
+
+**A verdict of `NOT ASSESSED` is a success.** It is the correct, useful answer to
+"what does the data say?" when there is no data. The failure mode this prevents is
+specific and has been observed in practice: report templates whose verdict
+enum had no "could not run" state produced **false clean passes** — an asset audit
+returning COMPLIANT on a project with no assets and no standards, and a
+performance profile reporting ">99% headroom against a 16.67ms budget" with zero
+profiler data and no budget ever set.
+
+**Absence of evidence is never evidence of absence.** A scan that finds no
+matches because there are no files to scan has not verified anything. Say which of
+the two happened — a reader cannot tell from a green result.
+
---
## Phase 1: Identify Balance Domain
@@ -31,8 +68,22 @@ Note every file read — they will appear in the Data Sources section of the rep
## Phase 3: Read Design Document
-Read the GDD for the system from `design/gdd/` to understand intended design targets,
-tuning knobs, and expected value ranges. This is the baseline for "correct" behaviour.
+**Registry first.** If `design/registry/entities.yaml` exists, read it before the
+GDD. Its `constants` and `formulas` sections hold the cross-GDD named values and
+output ranges — the balance targets — already distilled, each with a `source:`
+GDD and any `revised:` date:
+```
+Grep pattern="^ - name:" path="design/registry/entities.yaml" output_mode="content" -A 6
+```
+Take the intended values from the registry for any constant or formula it lists
+(the `constants:` and `formulas:` blocks); these are the authoritative cross-doc
+figures a GDD must not contradict. **If `design/registry/entities.yaml` does not
+exist or has no entries** (it ships as an empty stub until `/design-system`
+populates it), skip this and use the GDD alone.
+
+Then read the GDD for the system from `design/gdd/` to understand intended design
+targets, tuning knobs, and expected value ranges — for anything the registry did
+not already supply. This is the baseline for "correct" behaviour.
---
@@ -77,7 +128,7 @@ Run domain-specific checks:
### Data Sources Analyzed
- [List of files read]
-### Health Summary: [HEALTHY / CONCERNS / CRITICAL ISSUES]
+### Health Summary: [NOT ASSESSED / HEALTHY / CONCERNS / CRITICAL ISSUES]
### Outliers Detected
| Item/Value | Expected Range | Actual | Issue |
diff --git a/.claude/skills/brainstorm/SKILL.md b/.claude/skills/brainstorm/SKILL.md
index d0259dca..ed31c0be 100644
--- a/.claude/skills/brainstorm/SKILL.md
+++ b/.claude/skills/brainstorm/SKILL.md
@@ -1,22 +1,99 @@
---
name: brainstorm
-description: "Guided game concept ideation — from zero idea to a structured game concept document. Uses professional studio ideation techniques, player psychology frameworks, and structured creative exploration."
+description: "Guided concept ideation using professional studio techniques, player psychology, creative exploration."
argument-hint: "[genre or theme hint, or 'open'] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, WebSearch, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, WebSearch, Agent, AskUserQuestion
model: sonnet
---
-When this skill is invoked:
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,docs.density,workflow`
+
+Resolved above — use as-is. No block → defaults in
+`.claude/docs/config-resolution.md`.
+
+
+`--review` overrides `review_mode`; store it for all gate spawns this run. See
+`.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`docs.density`** — it controls per-section *depth*, where `workflow`
+controls which sections exist. `modes.rigor` sets both together; set
+`docs.density` explicitly to vary depth alone: `terse` = pillar bullets + concept bullets;
+`balanced` = pillars + concept with brief rationale (default); `thorough` =
+pillars + concept + extensive rationale + alternatives. Apply it to every section
+you author.
+
+---
+
+## Tier branch — check `workflow` FIRST
+
+The `workflow` tier resolved above governs this skill's output:
+
+- **`standard` / `full`** → run the full flow ("When this skill is invoked" through
+ Phase 5 and the concept-document generation). No change.
+- **`minimal`** → run the **Lean Brief flow** immediately below and **STOP** — skip
+ Phases 1–5, the director gates (CD-PILLARS / AD-CONCEPT-VISUAL / TD-FEASIBILITY /
+ PR-SCOPE), and the full-length concept document entirely. Output is the one-page
+ `design/game-brief.md`, not `game-concept.md`.
+
+### Lean Brief flow (`workflow: minimal` only)
+
+A jam / small-scope session: capture the load-bearing thinking in one page, then get
+to code. Keep prompting light — a few exchanges, not fifteen. Author from the
+one-page template `.claude/docs/templates/game-brief.md` (6 required fields + 2
+one-liners). If `design/game-brief.md` already exists, read it and resume/refine
+rather than restart.
+
+1. **Concept** — from the argument hint (or one quick open question if none), propose
+ **2–3 one-line concepts** (verb-first or mashup, per Phase 2's techniques). One
+ `AskUserQuestion` to pick or combine — the only guaranteed creative prompt.
+2. **Fill the brief fields** conversationally (not one prompt each):
+ - **One-sentence pitch** — the excited one-liner.
+ - **Core loop** — the 2–4 step cycle the player repeats.
+ - **MVP** — the ruthlessly short feature list that makes it *the game* (each becomes
+ a story downstream). If it runs past ~7, push back on scope.
+ - **Out of scope** — what they're deliberately NOT building.
+ - **Build order** — sequence to build the MVP, risky / core-fun thing first.
+ - **Who it's for / what they feel** and **Art & audio direction** — one line each
+ (offer, don't force).
+ Present the filled brief back in full for a single confirmation.
+3. **Write approval** — `AskUserQuestion`: "Brief is ready. May I write it to
+ `design/game-brief.md`?" → `[A] Yes — write it` / `[B] Revise a field first`. On
+ [B], revise the named field, show before/after, re-ask; repeat until [A]. Then
+ write `design/game-brief.md` from the template, creating directories as needed.
+ Honor `modes.automation` for this write as elsewhere in the framework.
+4. **Next steps** (short — this is the point). **Read `engine.name` from
+ `project.yaml` first and list `/setup-engine` only if it is absent or empty:**
+ 1. *(only when `engine.name` is absent or empty)* "`/setup-engine` — configure
+ the engine (required before code)"
+ 2. "`/create-stories` — turn the brief's MVP list into implementable stories. The
+ epic is implicit at `minimal`; there is no separate `/create-epics` or
+ `/sprint-plan` — the brief's build order is the plan."
+ 3. "`/dev-story` — first line of game code"
+
+ > **Why the condition.** `/start`'s `minimal` path runs `/setup-engine`
+ > *before* `/brainstorm`, and `/setup-engine` Section 2 states that a missing
+ > brief is expected because the brief is authored afterwards. Listing engine
+ > setup unconditionally here tells a user who just followed that path to go
+ > back and redo step one — the only skill in the four-step path that assumes
+ > it runs first.
+ Then output a one-line summary (pitch + MVP feature count + `design/game-brief.md`).
+
+Verdict: **COMPLETE** — game brief created; next stop is code. Do NOT run Phases 1–5,
+spawn any director gate, or write `game-concept.md` at this tier.
+
+---
+
+When this skill is invoked (`standard` / `full` tier — `minimal` uses the Lean Brief
+flow above):
1. **Parse the argument** for an optional genre/theme hint (e.g., `roguelike`,
`space survival`, `cozy farming`). If `open` or no argument, start from
- scratch. Also resolve the review mode (once, store for all gate spawns this run):
- 1. If `--review [full|lean|solo]` was passed → use that
- 2. Else read `production/review-mode.txt` → use that value
- 3. Else → default to `lean`
-
- See `.claude/docs/director-gates.md` for the full check pattern.
+ scratch.
2. **Check for existing concept work**:
- Read `design/gdd/game-concept.md` if it exists (resume, don't restart)
@@ -109,6 +186,13 @@ For each concept, present:
Present all three. Then use `AskUserQuestion` to capture the selection.
+**This decision asks regardless of `modes.automation`.** Concept selection
+is the creative heart of `/brainstorm` and has no defensible autonomous
+default — there is no algorithmic way to pick which creative direction
+resonates with the user. Per `.claude/docs/automation-modes.md`, treat
+this site as exempt (it overrides the mode the same way
+`automation_always_ask` categories do).
+
**CRITICAL**: This MUST be a plain list call — no tabs, no form fields. Use exactly this structure:
```
@@ -195,19 +279,26 @@ If the user selects B, C, or D, make the revision, then use `AskUserQuestion` ag
- Prompt: "Pillars updated. Ready to lock these in?"
- Options: `[A] Lock these in` / `[B] Revise another pillar` / `[C] Something else`
-Repeat until the user selects [A] Lock these in.
+**At `collaborative`** — repeat until the user selects [A] Lock these in.
+**At `guided`** — pillars are a major decision, so ask once; apply the chosen
+revision and lock them in without a second confirmation round.
+**At `autonomous`** — do not ask. Lock in the drafted pillars and record them via
+`log_decision` with the alternatives considered.
+
+> An `autonomous` run never issues the question, so "repeat until [A]" has no
+> exit condition (`automation-modes.md:56`).
**Review mode check** — apply before spawning CD-PILLARS and AD-CONCEPT-VISUAL:
- `solo` → skip both. Note: "CD-PILLARS skipped — Solo mode. AD-CONCEPT-VISUAL skipped — Solo mode." Proceed to Phase 5.
- `lean` → skip both (not PHASE-GATEs). Note: "CD-PILLARS skipped — Lean mode. AD-CONCEPT-VISUAL skipped — Lean mode." Proceed to Phase 5.
- `full` → spawn as normal.
-**After pillars and anti-pillars are agreed, spawn BOTH `creative-director` AND `art-director` via Task in parallel before moving to Phase 5. Issue both Task calls simultaneously — do not wait for one before starting the other.**
+**After pillars and anti-pillars are agreed, spawn BOTH `creative-director` AND `art-director` via `Agent` in parallel before moving to Phase 5. Issue both `Agent` calls simultaneously — do not wait for one before starting the other.**
-- **`creative-director`** — gate **CD-PILLARS** (`.claude/docs/director-gates.md`)
+- **`creative-director`** — gate **CD-PILLARS** (`.claude/docs/director-gates/cd-pillars.md`)
Pass: full pillar set with design tests, anti-pillars, core fantasy, unique hook.
-- **`art-director`** — gate **AD-CONCEPT-VISUAL** (`.claude/docs/director-gates.md`)
+- **`art-director`** — gate **AD-CONCEPT-VISUAL** (`.claude/docs/director-gates/ad-concept-visual.md`)
Pass: game concept elevator pitch, full pillar set with design tests, target platform (if known), any reference games or visual touchstones the user mentioned.
Collect both verdicts, then present them together using a two-tab `AskUserQuestion`:
@@ -246,6 +337,12 @@ Ground the concept in reality:
- **Engine experience**: Use `AskUserQuestion` — "Do you already have an engine you work in?"
Options: `Godot` / `Unity` / `Unreal Engine 5` / `No preference — help me decide`
+ - **This decision always prompts regardless of `modes.automation` —
+ including `autonomous` mode.** Engine choice is a project-wide
+ architectural commitment that downstream tooling depends on and is
+ effectively irreversible mid-project, so this skill guards it
+ unconditionally (it is NOT left to the configurable
+ `automation_always_ask` list). The model must NOT silently pick an engine.
- If they pick an engine → record it as their preference and move on. Do NOT second-guess it.
- If "No preference" → tell them: "Run `/setup-engine` after this session — it will walk you through the full decision based on your concept and platform target." Do not make a recommendation here.
- **Art pipeline**: What's the art style and how labor-intensive is it?
@@ -260,7 +357,7 @@ Ground the concept in reality:
- `lean` → skip (not a PHASE-GATE). Note: "TD-FEASIBILITY skipped — Lean mode." Proceed directly to scope tier definition.
- `full` → spawn as normal.
-**After identifying biggest technical risks, spawn `technical-director` via Task using gate TD-FEASIBILITY (`.claude/docs/director-gates.md`) before scope tiers are defined.**
+**After identifying biggest technical risks, spawn `technical-director` via `Agent` using gate TD-FEASIBILITY (`.claude/docs/director-gates/td-feasibility.md`) before scope tiers are defined.**
Pass: core loop description, platform target, engine choice (or "undecided"), list of identified technical risks.
@@ -271,7 +368,7 @@ Present the assessment to the user. If HIGH RISK, offer to revisit scope before
- `lean` → skip (not a PHASE-GATE). Note: "PR-SCOPE skipped — Lean mode." Proceed to document generation.
- `full` → spawn as normal.
-**After scope tiers are defined, spawn `producer` via Task using gate PR-SCOPE (`.claude/docs/director-gates.md`).**
+**After scope tiers are defined, spawn `producer` via `Agent` using gate PR-SCOPE (`.claude/docs/director-gates/pr-scope.md`).**
Pass: full vision scope, MVP definition, timeline estimate, team size.
@@ -301,7 +398,13 @@ If [B]: ask which section to revise using `AskUserQuestion` with options: `Eleva
After revising, show the updated section as a diff or clear before/after, then use `AskUserQuestion` — "Ready to write the updated concept document?"
Options: `[A] Yes — write it` / `[B] Revise another section`
-Repeat until the user selects [A].
+**At `collaborative`** — repeat until the user selects [A].
+**At `guided`** — ask once; apply the requested revision and write the document
+without a further confirmation round.
+**At `autonomous`** — do not ask; write the document and record the decision via
+`log_decision`.
+
+> Same exit-condition problem as the pillars loop above (`automation-modes.md:56`).
If yes, generate the document using the template at `.claude/docs/templates/game-concept.md`, fill in ALL sections from the brainstorm conversation, and write the file, creating directories as needed.
diff --git a/.claude/skills/bug-report/SKILL.md b/.claude/skills/bug-report/SKILL.md
index 3d46fc0c..6d80951d 100644
--- a/.claude/skills/bug-report/SKILL.md
+++ b/.claude/skills/bug-report/SKILL.md
@@ -1,12 +1,20 @@
---
name: bug-report
-description: "Creates a structured bug report from a description, or analyzes code to identify potential bugs. Ensures every bug report has full reproduction steps, severity assessment, and context."
+description: "Structured bug report from a description, or analyze code for potential bugs. Reproduction steps, severity."
argument-hint: "[description] | analyze [path-to-file]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write
+allowed-tools: Read, Glob, Grep, Bash, Write, Edit
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
## Phase 1: Parse Arguments
Determine the mode from the argument:
@@ -35,7 +43,14 @@ If no argument is provided, ask the user for a bug description before proceeding
**Title**: [Concise, descriptive title]
**ID**: BUG-[NNNN]
**Severity**: [S1-Critical / S2-Major / S3-Minor / S4-Trivial]
-**Priority**: [P1-Immediate / P2-Next Sprint / P3-Backlog / P4-Wishlist]
+**Priority**: [P1-Fix this sprint / P2-Fix soon / P3-Backlog / P4-Won't fix]
+
+> **These labels must match `/bug-triage`'s priority table exactly** — it parses
+> this field out of the file you are writing. P4 is the easiest to get wrong:
+> `P4-Wishlist` ("would be nice someday") and `P4 — Won't fix / Deferred`
+> ("accepted risk, not doing it") mean opposite things, and nothing at runtime
+> surfaces a disagreement between the producer and consumer of the field. If you change this ladder, change
+> `.claude/skills/bug-triage/SKILL.md` in the same commit.
**Status**: Open
**Reported**: [Date]
**Reporter**: [Name]
diff --git a/.claude/skills/bug-triage/SKILL.md b/.claude/skills/bug-triage/SKILL.md
index 442eb0dc..c4bf8bb2 100644
--- a/.claude/skills/bug-triage/SKILL.md
+++ b/.claude/skills/bug-triage/SKILL.md
@@ -1,12 +1,20 @@
---
name: bug-triage
-description: "Read all open bugs in production/qa/bugs/, re-evaluate priority vs. severity, assign to sprints, surface systemic trends, and produce a triage report. Run at sprint start or when the bug count grows enough to need re-prioritization."
+description: "Re-evaluate open bugs — priority vs severity, assign to sprints, surface systemic trends. Run when the count grows."
argument-hint: "[sprint | full | trend]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Edit
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Bug Triage
This skill processes the open bug backlog into a prioritised, sprint-assigned
@@ -50,6 +58,18 @@ If no bug files found:
Stop and report. Do not proceed if no bugs exist.
+**In `trend` mode, do not read full bug bodies.** Trend metrics (volume, severity
+mix, by-system, by-date) are computable from the header fields alone:
+```
+Grep pattern="\*\*(Severity|Priority|Status|System|Category|Reported)\*\*" glob="production/qa/bugs/*.md" output_mode="content"
+```
+(Bug-report fields are bolded — `**Severity**:`, `- **System**:` — so match the
+`**field**` form, not a bare line-start `Field:`.)
+Full bug bodies are needed only for the priority-vs-severity **re-evaluation** in
+`sprint`/`full` modes; `trend` is a read-only report and skips it. (The one
+deviation check that needs a story's status — "bug filed against a Complete
+story" — is a targeted story-status grep either way, not a bug-body read.)
+
### Step 2b — Load sprint context
Read the most recently modified file in `production/sprints/` to understand:
diff --git a/.claude/skills/changelog/SKILL.md b/.claude/skills/changelog/SKILL.md
index 4e618cb4..cdc52ce9 100644
--- a/.claude/skills/changelog/SKILL.md
+++ b/.claude/skills/changelog/SKILL.md
@@ -1,13 +1,82 @@
---
name: changelog
-description: "Auto-generates a changelog from git commits, sprint data, and design documents. Produces both internal and player-facing versions."
+description: "Auto-generate a changelog from git commits and sprint data. Internal and player-facing versions."
argument-hint: "[version|sprint-number]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Bash, Write
-context: |
- !git log --oneline -30 2>/dev/null
- !git tag --list --sort=-v:refname 2>/dev/null | head -5
-model: haiku
+model: sonnet
+---
+
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+## Recent History
+
+Recent commits:
+
+!`git log --oneline -30 2>/dev/null`
+
+Recent tags (newest first):
+
+!`git tag --list --sort=-v:refname 2>/dev/null | head -5`
+
+## Provenance check — before trusting the history above
+
+**The commits above may not belong to this game.** This skill's history blocks are
+auto-resolved *before* the body runs, so the read has already happened — what this
+check governs is whether that output is usable, not whether it is fetched.
+
+1. Read the injected commit subjects above.
+2. **Classify each one** as **Game** (mechanics, content, balance, art, audio,
+ UI, or a bug in those), **Framework / maintenance** (subjects naming skills,
+ hooks, agents, the test plan, CI, or the framework's own docs), or **Unclear**
+ — and treat Unclear as Framework.
+3. Decide from the counts:
+ - **At least one Game commit** → proceed using only those, and state how many
+ of how many you used.
+ - **Zero Game commits** → stop, using the message below.
+
+> **Filter per commit; a repo containing maintenance work is not a wrong repo.**
+> Every project on this framework accumulates commits touching hooks, CI and
+> skills — the game repo *is* the framework repo. Listing those as a hard STOP
+> fires on virtually every real project and contradicts step 2 whenever the
+> history is mostly the game's. The harm is those commits becoming release copy,
+> and excluding them prevents that precisely.
+>
+> This rule is kept identical to `/patch-notes`' on purpose — the two read the
+> same history for different audiences, and they must not disagree about whose
+> history it is. Change both together.
+
+The genuine wrong-history signal is different: Game commits naming a product that
+`design/` and `src/` never mention. If you see that, stop.
+
+If **no** commit in the range is this game's, say so and stop:
+
+> "The git history in this repo does not appear to belong to [game]. The recent
+> commits describe [what they actually describe]. I cannot generate a changelog
+> from it — point me at the right history, or supply the change list directly."
+
+**Why this is a hard stop, not a warning.** This exact failure is real, not
+hypothetical: a batch of framework-internal commits produced player-facing copy
+reading *"Fixed an issue where progress from your last session could be lost on
+launch"* — a
+session-hook timeout rendered as a gameplay fix for a game with **no save
+system**. It was fluent, plausible, and entirely false. A reader cannot tell the
+difference; only this check can.
+
+**Do not treat the preamble's existence as evidence.** Injected output means the
+command ran, never that its subject is your game.
+
+---
+
+Both blocks are resolved before this skill runs. Use them as the starting point
+for Phase 2 rather than re-running the same commands.
+
---
## Phase 1: Parse Arguments
@@ -26,7 +95,11 @@ Read the git log since the last tag or release:
git log --oneline [last-tag]..HEAD
```
-If no tags exist, read the full log or a reasonable recent range (last 100 commits).
+If no tags exist, bound the range explicitly — `git log --oneline -n 100`. Do not
+fall back to the full log: on an established repo that is thousands of lines for
+a changelog covering one release, and the oldest of them are the least relevant.
+If 100 commits does not reach far enough back, say so and ask for a start ref
+rather than widening blindly.
Read sprint reports from `production/sprints/` for the relevant period to understand planned work and context behind changes.
diff --git a/.claude/skills/code-review/SKILL.md b/.claude/skills/code-review/SKILL.md
index 19c422af..a1e83e4f 100644
--- a/.claude/skills/code-review/SKILL.md
+++ b/.claude/skills/code-review/SKILL.md
@@ -1,11 +1,48 @@
---
name: code-review
-description: "Performs an architectural and quality code review on a specified file or set of files. Checks for coding standard compliance, architectural pattern adherence, SOLID principles, testability, and performance concerns."
+description: "Architectural code review — coding standards, SOLID, testability, performance concerns."
argument-hint: "[path-to-file-or-directory]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Bash, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Bash, Agent, AskUserQuestion
model: sonnet
-agent: lead-programmer
+---
+
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+## Insufficient input — check this before producing any report
+
+**If the inputs this skill needs do not exist, the answer is "could not run" —
+not a filled-in report.** Check first, and stop if the check fails.
+
+1. List the inputs this skill reads (data files, prior reports, profiler output,
+ test results, registries, source code).
+2. For each, record `FOUND` or `ABSENT` — not "assumed present".
+3. If any input required for a section is ABSENT, that section is
+ **`NOT ASSESSED — NO DATA`**. Do not estimate it, do not infer it from an
+ adjacent artifact, and do not leave a mandated cell to be filled by whoever
+ reads the template next.
+4. If **every** required input is ABSENT, stop and report
+ **`NOT ASSESSED — NO DATA`** as the whole verdict, naming what was missing and
+ which skill produces it.
+
+**A verdict of `NOT ASSESSED` is a success.** It is the correct, useful answer to
+"what does the data say?" when there is no data. The failure mode this prevents is
+specific and has been observed in practice: report templates whose verdict
+enum had no "could not run" state produced **false clean passes** — an asset audit
+returning COMPLIANT on a project with no assets and no standards, and a
+performance profile reporting ">99% headroom against a 16.67ms budget" with zero
+profiler data and no budget ever set.
+
+**Absence of evidence is never evidence of absence.** A scan that finds no
+matches because there are no files to scan has not verified anything. Say which of
+the two happened — a reader cannot tell from a green result.
+
---
## Phase 1: Load Target Files
@@ -16,14 +53,22 @@ Read the target file(s) in full. Read CLAUDE.md for project coding standards.
## Phase 2: Identify Engine Specialists
-Read `.claude/docs/technical-preferences.md`, section `## Engine Specialists`. Note:
+Read the `specialists` block from `project.yaml`; if it is absent, fall back to the `## Engine Specialists` section of `.claude/docs/technical-preferences.md`. Note:
-- The **Primary** specialist (used for architecture and broad engine concerns)
-- The **Language/Code Specialist** (used when reviewing the project's primary language files)
-- The **Shader Specialist** (used when reviewing shader files)
-- The **UI Specialist** (used when reviewing UI code)
+- The **Primary** specialist — `<engine>-specialist` derived from `engine.name` (Godot→`godot-specialist`, Unity→`unity-specialist`, Unreal→`unreal-specialist`); used for architecture and broad engine concerns
+- The **Language/Code Specialist** — `specialists.code` — used when reviewing the project's primary language files
+- The **Shader Specialist** — `specialists.shader` — used when reviewing shader files
+- The **UI Specialist** — `specialists.ui` — used when reviewing UI code
-If the section reads `[TO BE CONFIGURED]`, no engine is pinned — skip engine specialist steps.
+**A value of `null` means UNSET — treat that key as absent and skip its
+specialist. Never spawn it as an agent name.** The v1.0 migration writes `null`
+for any specialist the legacy file did not name, and it writes the whole block
+whenever *one* member is set — so a project that configured only its code
+specialist carries `shader: null` and `ui: null`. The config reader returns the
+four-character string `"null"` for these, which is not empty and therefore reads
+as configured. `null`, empty, and missing are the same state here.
+
+If no engine is configured (no `engine.name` in `project.yaml`, and `technical-preferences.md` reads `[TO BE CONFIGURED]` or is missing), skip engine specialist steps. **Record `Engine validation: NOT ASSESSED — no engine configured (`engine.name` unset in `project.yaml`)` in this run's output.** A skipped check that says nothing is indistinguishable from a check that passed; the reader cannot tell engine guidance was never sought.
---
@@ -40,7 +85,12 @@ Look for patterns like `ADR-NNN` or `docs/architecture/ADR-`.
If no ADR references found, note: "No ADR references found — ADR compliance check skipped. For full ADR compliance review, provide the story path: `/code-review [files] [story-path]`."
-For each referenced ADR: read the file, extract the **Decision** and **Consequences** sections, then classify any deviation:
+For each referenced ADR, load **only the sections this check needs — never an unbounded full read.** A substantial ADR exceeds the 25k-token `Read` cap, and a capped read's only recovery is paging the remainder — the most expensive way to read a file (measured ~103k vs ~54k tokens on a 34k-token ADR). Use the same pattern as `/dev-story` and `/create-stories`:
+
+1. **Map the headings** (cheap — line numbers only): `Grep pattern="^## " path="[adr-file]" output_mode="content" -n`
+2. **Bounded-read only `## Decision` and `## Consequences`**, using the line numbers to set `Read(offset, limit)` spans that end where the next heading begins. If the heading map is empty (a nonstandard ADR predating the template), fall back to one full `Read`; if that truncates at the cap, grep for the decision/consequence content directly rather than paging the remainder.
+
+From those two sections, classify any deviation:
- **ARCHITECTURAL VIOLATION** (BLOCKING): Uses a pattern explicitly rejected in the ADR
- **ADR DRIFT** (WARNING): Meaningfully diverges from the chosen approach without using a forbidden pattern
@@ -91,7 +141,26 @@ Identify the system category (engine, gameplay, AI, networking, UI, tools) and e
## Phase 7: Specialist Reviews (Parallel)
-Spawn all applicable specialists simultaneously via Task — do not wait for one before starting the next.
+Spawn all applicable specialists simultaneously via `Agent` — do not wait for one before starting the next.
+
+> **Verify every specialist finding before reporting it. Do not pass findings
+> through unchecked.** For each finding, record in the report:
+>
+> - **File and line** it refers to.
+> - **Evidence** — the quoted code, or the concrete input/state that triggers it.
+> - **Confidence** — `VERIFIED` (you checked it yourself) or `UNVERIFIED —
+> specialist claim` (you could not).
+>
+> A finding you could not verify is reported as unverified or dropped, never
+> promoted to a defect on the strength of confident phrasing.
+>
+> **Why this is mandatory.** Agents are reliable when deriving and unreliable when
+> diagnosing existing code. Measured in practice: three separate agents
+> produced three different **wrong** claims about the same six-line function,
+> every one fluent enough to pass a skim — including a spawned specialist here
+> alleging a float-precision bug that enumerating the inputs disproves. Without
+> this step the parent review is a laundering channel: a guess enters as a
+> specialist finding and leaves as a reviewed defect.
### Engine Specialists
@@ -106,7 +175,7 @@ Also spawn the **Primary Specialist** for any file touching engine architecture
### QA Testability Review
-For Logic and Integration stories, also spawn `qa-tester` via Task in parallel with the engine specialists. Pass:
+For Logic and Integration stories, also spawn `qa-tester` via `Agent` in parallel with the engine specialists. Pass:
- The implementation files being reviewed
- The story's `## QA Test Cases` section (the pre-written test specs from qa-lead)
- The story's `## Acceptance Criteria`
@@ -136,16 +205,16 @@ Collect all specialist findings before producing output.
[qa-tester findings: test hooks, coverage gaps, untestable paths, new edge cases]
[If BLOCKING: implementation must expose [X] before tests in ## QA Test Cases can run]
-### ADR Compliance: [NO ADRS FOUND / COMPLIANT / DRIFT / VIOLATION]
+### ADR Compliance: [NOT ASSESSED / NO ADRS FOUND / COMPLIANT / DRIFT / VIOLATION]
[List each ADR checked, result, and any deviations with severity]
### Standards Compliance: [X/6 passing]
[List failures with line references]
-### Architecture: [CLEAN / MINOR ISSUES / VIOLATIONS FOUND]
+### Architecture: [NOT ASSESSED / CLEAN / MINOR ISSUES / VIOLATIONS FOUND]
[List specific architectural concerns]
-### SOLID: [COMPLIANT / ISSUES FOUND]
+### SOLID: [NOT ASSESSED / COMPLIANT / ISSUES FOUND]
[List specific violations]
### Game-Specific Concerns
@@ -160,7 +229,7 @@ Collect all specialist findings before producing output.
### Suggestions
[Nice-to-have improvements]
-### Verdict: [APPROVED / APPROVED WITH SUGGESTIONS / CHANGES REQUIRED]
+### Verdict: [NOT ASSESSED / APPROVED / APPROVED WITH SUGGESTIONS / CHANGES REQUIRED]
```
This skill is read-only — no files are written.
@@ -170,7 +239,7 @@ This skill is read-only — no files are written.
## Phase 9: Next Steps
Use `AskUserQuestion`:
-- Prompt: "Code review complete — verdict: [APPROVED / CHANGES REQUIRED / MAJOR REVISION]. How would you like to proceed?"
+- Prompt: "Code review complete — verdict: [NOT ASSESSED / APPROVED / CHANGES REQUIRED / MAJOR REVISION]. How would you like to proceed?"
- Options (adjust based on verdict):
- If APPROVED:
- `[A] Run /story-done to mark the story complete`
diff --git a/.claude/skills/consistency-check/SKILL.md b/.claude/skills/consistency-check/SKILL.md
index 31c2b2da..44c0ca86 100644
--- a/.claude/skills/consistency-check/SKILL.md
+++ b/.claude/skills/consistency-check/SKILL.md
@@ -1,12 +1,16 @@
---
name: consistency-check
-description: "Scan all GDDs against the entity registry to detect cross-document inconsistencies: same entity with different stats, same item with different values, same formula with different variables. Grep-first approach — reads registry then targets only conflicting GDD sections rather than full document reads."
+description: "Scan GDDs against the entity registry for cross-document conflicts. Grep-first approach targets conflicting sections, different stats."
argument-hint: "[full | since-last-review | entity:<name> | item:<name>]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Edit, Bash, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,workflow`
+
+
+
# Consistency Check
Detects cross-document inconsistencies by comparing all GDDs against the
@@ -28,6 +32,15 @@ catches too late.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`workflow`** (see `.claude/docs/workflow-modes.md`):
+- `full` — full entity-registry cross-check against all GDD sections.
+- `standard` — cross-check against the required sections only.
+- `minimal` — not meaningful (no GDDs to check).
+
## Phase 1: Parse Arguments and Load Registry
**Modes:**
@@ -281,9 +294,15 @@ Then append the new conflict entries. Never skip logging — a missing file is n
Silently append to `production/session-state/active.md` (create the file if it does not exist):
```
-<!-- CONSISTENCY-CHECK: [date] | GDDs checked: [N] | Conflicts found: [N] | Report: docs/consistency-report-[date].md -->
+<!-- CONSISTENCY-CHECK: [date] | GDDs checked: [N] | Conflicts found: [N] | Log: docs/consistency-failures.md -->
```
+> **Point at `docs/consistency-failures.md` — the file Phase 6 actually appends
+> to.** A breadcrumb is a pointer left for a future session to follow. One that
+> names a file nothing writes sends that session looking for conflict history it
+> will never find, and nothing errors along the way. Never invent a report
+> filename here.
+
Then close with an `AskUserQuestion` widget:
- **Prompt**: "Consistency check complete — [N] conflicts found. What next?"
@@ -293,7 +312,9 @@ Then close with an `AskUserQuestion` widget:
- `[C] Run /design-review on the most conflicted GDD`
- `[D] Stop here`
-Never end the skill with plain text. Always close with this widget.
+In collaborative and guided modes, never end the skill with plain text — always
+close with this widget. In autonomous mode, print the findings and recommended
+next step, then record via `log_decision` (no widget).
---
diff --git a/.claude/skills/content-audit/SKILL.md b/.claude/skills/content-audit/SKILL.md
index 9fab061d..39271996 100644
--- a/.claude/skills/content-audit/SKILL.md
+++ b/.claude/skills/content-audit/SKILL.md
@@ -1,13 +1,31 @@
---
name: content-audit
-description: "Audit GDD-specified content counts against implemented content. Identifies what's planned vs built."
+description: "Audit GDD content counts against what's implemented — planned vs built."
argument-hint: "[system-name | --summary | (no arg = full audit)]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write
model: sonnet
-agent: producer
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys workflow,automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+Resolved above — use as-is. No block → defaults in `.claude/docs/config-resolution.md`.
+
+> This skill declares tier-dependent behaviour ("audit only specs in the required
+> sections"), which is unreachable unless the tier is actually resolved — without
+> it the skill applies whatever tier it assumed. Resolve `modes.workflow` before
+> auditing, and
+> when a required input such as `design/gdd/systems-index.md` is absent, report
+> **`NOT ASSESSED — NO DATA`** rather than computing a gap percentage (which
+> divides by zero when nothing is specified).
+
+
When this skill is invoked:
Parse the argument:
@@ -17,25 +35,97 @@ Parse the argument:
---
+**`workflow`** (see `.claude/docs/workflow-modes.md`):
+- `full` — full content-count audit against all GDD specs.
+- `standard` — audit only specs in the required sections.
+- `minimal` — cannot run (no systems index exists).
+
+## Insufficient input — check this before producing any report
+
+**If the inputs this skill needs do not exist, the answer is "could not run" —
+not a filled-in report.** Check first, and stop if the check fails.
+
+1. List the inputs this skill reads (data files, prior reports, profiler output,
+ test results, registries, source code).
+2. For each, record `FOUND` or `ABSENT` — not "assumed present".
+3. If any input required for a section is ABSENT, that section is
+ **`NOT ASSESSED — NO DATA`**. Do not estimate it, do not infer it from an
+ adjacent artifact, and do not leave a mandated cell to be filled by whoever
+ reads the template next.
+4. If **every** required input is ABSENT, stop and report
+ **`NOT ASSESSED — NO DATA`** as the whole verdict, naming what was missing and
+ which skill produces it.
+
+**A verdict of `NOT ASSESSED` is a success.** It is the correct, useful answer to
+"what does the data say?" when there is no data. The failure mode this prevents is
+specific and has been observed in practice: report templates whose verdict
+enum had no "could not run" state produced **false clean passes** — an asset audit
+returning COMPLIANT on a project with no assets and no standards, and a
+performance profile reporting ">99% headroom against a 16.67ms budget" with zero
+profiler data and no budget ever set.
+
+**Absence of evidence is never evidence of absence.** A scan that finds no
+matches because there are no files to scan has not verified anything. Say which of
+the two happened — a reader cannot tell from a green result.
+
+---
+
## Phase 1 — Context Gathering
1. **Read `design/gdd/systems-index.md`** for the full list of systems, their
categories, and MVP/priority tier.
-2. **L0 pre-scan**: Before full-reading any GDDs, Grep all GDD files for
- `## Summary` sections plus common content-count keywords:
+2. **Registry-first count**: If `design/registry/entities.yaml` exists, read it
+ first. Its `entities` and `items` sections are the cross-GDD named content
+ the audit is counting, already distilled with a `source:` GDD per entry:
```
- Grep pattern="(## Summary|N enemies|N levels|N items|N abilities|enemy types|item types)" glob="design/gdd/*.md" output_mode="files_with_matches"
+ Grep pattern="^ - name:" path="design/registry/entities.yaml" output_mode="content" -A 2
```
+ `- name:` appears in all four registry sections; keep only the names whose
+ `-A 2` context shows they sit under `entities:` or `items:` (the named
+ content this audit counts — not `formulas:`/`constants:`). Use those as the
+ **planned** named-content set without full-reading the GDDs that own them.
+ **If `design/registry/entities.yaml` does not exist or has no entries** (it
+ ships as an empty stub until `/design-system` populates it), skip this step
+ and rely on the GDD scan below — behaviour is unchanged, only more expensive.
+
+3. **L0 pre-scan**: Before full-reading any GDDs, run **two** greps — they
+ answer different questions and must not share a pattern:
+
+ a. Which GDDs carry a Summary (the denominator / fail-open check):
+ ```
+ Grep pattern="^## Summary" glob="design/gdd/*.md" output_mode="files_with_matches"
+ ```
+
+ b. Which GDDs actually declare content counts (the narrowing step):
+ ```
+ Grep pattern="[0-9]+[[:space:]]+(enemies|enemy types|levels|areas|maps|stages|items|weapons|equipment|abilities|skills|spells|cutscenes|conversations|dialogue scenes|bosses|quests)|(enemy|item|weapon|ability|level) types:" glob="design/gdd/*.md" output_mode="files_with_matches"
+ ```
+
+ > **These were one grep, and it narrowed nothing.** The old pattern was
+ > `(## Summary|N enemies|N levels|N items|N abilities|enemy types|item types)`.
+ > `N enemies` and friends are un-substituted placeholders copied from the
+ > template — no real GDD contains the literal letter `N` as a count — while
+ > `## Summary` matches every compliant GDD. So the union returned *all* GDDs
+ > and step 3's whole purpose (read-avoidance) saved zero tokens. Pattern (b)
+ > matches digits followed by the content nouns step 5 actually extracts.
+
+ **Fail open on a missing Summary.** Establish the denominator: glob
+ `design/gdd/*.md` and count **N**. **Scan (a)** matching fewer than N means
+ those GDDs predate `## Summary` — never treat an absent Summary as a system
+ out of scope; a zero-match (a) means "no GDD carries a Summary yet", not "no
+ auditable content". Full-read the unmatched in-scope GDDs.
+
For a single-system audit: skip this step and go straight to full-read.
- For a full audit: full-read only the GDDs that matched content-count keywords.
+ For a full audit: full-read only the GDDs that **scan (b)** matched
+ **and are not already fully covered by the registry entries from step 2**.
GDDs with no content-count language (pure mechanics GDDs) are noted as
"No auditable content counts" without a full read.
-3. **Full-read in-scope GDD files** (or the single system GDD if a system
+4. **Full-read in-scope GDD files** (or the single system GDD if a system
name was given).
-4. **For each GDD, extract explicit content counts or lists.** Look for patterns
+5. **For each GDD, extract explicit content counts or lists.** Look for patterns
like:
- "N enemies" / "enemy types:" / list of named enemies
- "N levels" / "N areas" / "N maps" / "N stages"
@@ -45,7 +135,7 @@ Parse the argument:
- "N quests" / "N missions" / "N objectives"
- Any explicit enumerated list (bullet list of named content pieces)
-4. **Build a content inventory table** from the extracted data:
+6. **Build a content inventory table** from the extracted data:
| System | Content Type | Specified Count/List | Source GDD |
|--------|-------------|---------------------|------------|
@@ -62,14 +152,14 @@ what has been implemented. Use Glob and Grep to locate files.
**Levels / Areas / Maps:**
- Glob `assets/**/*.tscn`, `assets/**/*.unity`, `assets/**/*.umap`
-- Glob `src/**/*.tscn`, `src/**/*.unity`
+- Glob the **code root** for scene files: `*.tscn` (Godot), `*.unity` (Unity), `*.umap` (Unreal). Resolve the root per `.claude/docs/code-root-resolution.md`. **If the code root is unresolved, report `NOT ASSESSED — code root unresolved` rather than zero hits.**
- Look for scene files in subdirectories named `levels/`, `areas/`, `maps/`,
`worlds/`, `stages/`
- Count unique files that appear to be level/scene definitions (not UI scenes)
**Enemies / Characters / NPCs:**
- Glob `assets/data/**/enemies/**`, `assets/data/**/characters/**`
-- Glob `src/**/enemies/**`, `src/**/characters/**`
+- Glob `<code root>/**/enemies/**`, `<code root>/**/characters/**`
- Look for `.json`, `.tres`, `.asset`, `.yaml` data files defining entity stats
- Look for scene/prefab files in character subdirectories
diff --git a/.claude/skills/create-architecture/SKILL.md b/.claude/skills/create-architecture/SKILL.md
index a8e26ed0..3ef3619c 100644
--- a/.claude/skills/create-architecture/SKILL.md
+++ b/.claude/skills/create-architecture/SKILL.md
@@ -1,13 +1,18 @@
---
name: create-architecture
-description: "Guided, section-by-section authoring of the master architecture document for the game. Reads all GDDs, the systems index, existing ADRs, and the engine reference library to produce a complete architecture blueprint before any code is written. Engine-version-aware: flags knowledge gaps and validates decisions against the pinned engine version."
+description: "Author the architecture blueprint before code is written. Validates decisions against the pinned engine, flags knowledge gaps."
argument-hint: "[focus-area: full | layers | data-flow | api-boundaries | adr-audit] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Bash, AskUserQuestion, Task
+allowed-tools: Read, Glob, Grep, Write, Bash, AskUserQuestion, Agent
model: sonnet
-agent: technical-director
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,docs.density`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
# Create Architecture
This skill produces `docs/architecture/architecture.md` — the master architecture
@@ -17,12 +22,26 @@ It sits between design and implementation, and must exist before sprint planning
**Distinct from `/architecture-decision`**: ADRs record individual point decisions.
This skill creates the whole-system blueprint that gives ADRs their context.
-Resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
-See `.claude/docs/director-gates.md` for the full check pattern.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`docs.density`** — it controls per-section *depth*, where `workflow`
+controls which sections exist. `modes.rigor` sets both together; set
+`docs.density` explicitly to vary depth alone: `terse` = layer diagrams + decision bullets,
+no essays; `balanced` = diagrams + paragraph explanations of layer choices
+(default); `thorough` = full prose with rationale, trade-offs, and alternatives
+considered per layer. Apply it to every section you author.
+
+**`workflow`** (see `.claude/docs/workflow-modes.md`):
+- `full` — full architecture: all layers, module ownership, data flow, API
+ boundaries, full ADR audit.
+- `standard` — simplified: system layer map + critical ADR list only.
+- `minimal` — not required. Can still be run voluntarily.
**Argument modes:**
- **No argument / `full`**: Full guided walkthrough — all sections, start to finish
@@ -39,7 +58,8 @@ Before anything else, load the full project context in this order:
### 0a. Engine Context (Critical)
-Read the engine reference library completely:
+Read the four project-wide engine documents in full — they are small, and every
+part of each is used:
1. `docs/engine-reference/[engine]/VERSION.md`
→ Extract: engine name, version, LLM cutoff, post-cutoff risk levels
@@ -49,22 +69,75 @@ Read the engine reference library completely:
→ Extract: APIs to avoid
4. `docs/engine-reference/[engine]/current-best-practices.md`
→ Extract: post-cutoff best practices that differ from training data
-5. All files in `docs/engine-reference/[engine]/modules/`
+
+Then read **only the module docs whose domain this game actually uses** —
+not the whole `modules/` directory:
+
+5. `docs/engine-reference/[engine]/modules/` — glob it to establish what exists,
+ then match against the domains present in `design/gdd/systems-index.md`
+ (the same domain vocabulary the ADR template uses: Physics, Rendering, UI,
+ Audio, Navigation, Animation, Networking, Core, Input). Read the matching
+ modules; skip the rest.
→ Extract: current API patterns per domain
+ A game with no multiplayer system does not need the networking module loaded
+ to write its architecture, and loading it costs the same as one that does.
+ **If the domain match is ambiguous, read the module** — a missed engine
+ constraint is far more expensive here than a redundant read, because this
+ phase is where those constraints get baked into the architecture.
+
If no engine is configured, stop and prompt:
> "No engine is configured. Run `/setup-engine` first. Architecture cannot be
> written without knowing which engine and version you are targeting."
### 0b. Design Context + Technical Requirements Extraction
-Read all approved design documents and extract technical requirements from each:
+Load the approved design documents and extract technical requirements from each:
1. `design/gdd/game-concept.md` — game pillars, genre, core loop
2. `design/gdd/systems-index.md` — all systems, dependencies, priority tiers
-3. `.claude/docs/technical-preferences.md` — naming conventions, performance budgets,
- allowed libraries, forbidden patterns
-4. **Every GDD in `design/gdd/`** — for each, extract technical requirements:
+
+**Check both exist before reading either. Neither is optional here, and both
+need an absence branch** — §0a stops for an unconfigured engine, and these two
+matter just as much:
+
+- **`systems-index.md` absent** — stop:
+ > "No systems index found. Run `/map-systems` first. An architecture written
+ > without it invents layers for systems nobody mapped, and every ADR, epic and
+ > story downstream inherits that invention."
+ At `minimal` the index is not required (§ tier note above) — say so and proceed
+ from the brief instead.
+- **`game-concept.md` absent** — at `standard`/`full`, stop and point at
+ `/brainstorm`. At `minimal`, read `design/game-brief.md` in its place; if that
+ is absent too, stop — there is no design record to architect against.
+- **Either present but empty or still template placeholders** — treat as absent.
+ Present-but-empty is the case that most looks like present.
+
+Do not proceed on a partial read and note it later. This phase is where design
+assumptions get baked into ADRs, and an assumption made here is re-derived by
+everything downstream rather than re-checked.
+3. Project config — `naming.*` and `performance.*` from `project.yaml` (for any
+ key absent or empty, fall back to `.claude/docs/technical-preferences.md`);
+ allowed libraries and forbidden patterns from
+ `.claude/docs/technical-preferences.md` (not migrated to project.yaml)
+4. **Every GDD in `design/gdd/`** — extract technical requirements from the
+ sections that carry them, **not from whole files**. Establish the denominator
+ first (glob `design/gdd/*.md`, count **N**), then:
+ ```
+ Grep pattern="^## (Detailed Rules|Detailed Design|Formulas|Dependencies|Tuning Knobs|Acceptance Criteria)" glob="design/gdd/*.md" output_mode="content" -A 40
+ ```
+ Overview and Player Fantasy are narrative and imply no architecture; the
+ scanned set is where rules, numbers, and cross-system contracts live. Accept
+ either `## Detailed Rules` or `## Detailed Design` — the design standard and
+ the GDD template disagree on the name and they denote the same section.
+
+ Full-read a GDD when it matched **zero** sections (it predates the template —
+ a zero-match means "unstructured", never "no requirements") or when a scanned
+ section refers to material outside itself. **Never treat an absent section as
+ an absent requirement**: report any GDD that contributed nothing, rather than
+ letting it drop silently out of the baseline below.
+
+ For each, extract:
- Data structures implied by the game rules
- Performance constraints stated or implied
- Engine capabilities the system requires
@@ -92,8 +165,17 @@ left without an architectural decision to support it by the end of this session.
### 0c. Existing Architecture Decisions
-Read all files in `docs/architecture/` to understand what has already been decided.
-List any ADRs found and their domains.
+To learn **what has already been decided and in which domain**, scan the ADR
+headers — do not full-read every ADR to produce a list of numbers and domains:
+```
+Grep pattern="^## (Status|Summary)" glob="docs/architecture/adr-*.md" output_mode="content" -A 4
+Grep pattern="\*\*Domain\*\*" glob="docs/architecture/adr-*.md" output_mode="content"
+```
+`## Summary` (a 2-sentence what-and-why) plus `## Status` and the Engine
+Compatibility `Domain` field are exactly "what was decided and its domain". List
+the ADRs found, their status, and their domains from the scan. Full-read a
+specific ADR only when a new decision this session would collide with it and you
+need its reasoning — not to build the inventory.
### 0d. Generate Knowledge Gap Inventory
@@ -346,14 +428,14 @@ After writing the master architecture document, perform an explicit sign-off bef
**Step 1 — Technical Director self-review** (this skill runs as technical-director):
-Apply gate **TD-ARCHITECTURE** (`.claude/docs/director-gates.md`) as a self-review. Check all four criteria from that gate definition against the completed document.
+Apply gate **TD-ARCHITECTURE** (`.claude/docs/director-gates/td-architecture.md`) as a self-review. Check all four criteria from that gate definition against the completed document.
**Review mode check** — apply before spawning LP-FEASIBILITY:
- `solo` → skip. Note: "LP-FEASIBILITY skipped — Solo mode." Proceed to Phase 8 handoff.
- `lean` → skip (not a PHASE-GATE). Note: "LP-FEASIBILITY skipped — Lean mode." Proceed to Phase 8 handoff.
- `full` → spawn as normal.
-**Step 2 — Spawn `lead-programmer` via Task using gate LP-FEASIBILITY (`.claude/docs/director-gates.md`):**
+**Step 2 — Spawn `lead-programmer` via `Agent` using gate LP-FEASIBILITY (`.claude/docs/director-gates/lp-feasibility.md`):**
Pass: architecture document path, technical requirements baseline summary, ADR list.
@@ -439,6 +521,10 @@ Omit this section entirely if there are no open QQs.
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
This skill follows the collaborative design principle at every phase:
1. **Load context silently** — do not narrate file reads
diff --git a/.claude/skills/create-control-manifest/SKILL.md b/.claude/skills/create-control-manifest/SKILL.md
index f6e70054..f6f7d5f8 100644
--- a/.claude/skills/create-control-manifest/SKILL.md
+++ b/.claude/skills/create-control-manifest/SKILL.md
@@ -1,13 +1,16 @@
---
name: create-control-manifest
-description: "After architecture is complete, produces a flat actionable rules sheet for programmers — what you must do, what you must never do, per system and per layer. Extracted from all Accepted ADRs, technical preferences, and engine reference docs. More immediately actionable than ADRs (which explain why)."
+description: "Flat must-do/never-do rules sheet per system and layer, extracted from Accepted ADRs. ADRs explain why; this is actionable."
argument-hint: "[update — regenerate from current ADRs]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Task
+allowed-tools: Read, Glob, Grep, Write, Agent, AskUserQuestion
model: sonnet
-agent: technical-director
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+
+
# Create Control Manifest
The Control Manifest is a flat, actionable rules sheet for programmers. It
@@ -22,18 +25,37 @@ status. Re-run whenever new ADRs are accepted or existing ADRs are revised.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
## 1. Load All Inputs
### ADRs
-- Glob `docs/architecture/adr-*.md` and read every file
-- Filter to only Accepted ADRs (Status: Accepted) — skip Proposed, Deprecated,
- Superseded
-- Note the ADR number and title for every rule sourced
+**Establish the denominator first.** Glob `docs/architecture/adr-*.md`. Call the
+count **N**. If N is 0: "No ADRs found — run `/architecture-decision` before
+building a control manifest." Stop.
+
+**Resolve status without reading the ADRs** — the filter must precede the read,
+not follow it:
+```
+Grep pattern="^## Status" glob="docs/architecture/adr-*.md" output_mode="content" -A 3
+```
+Interpret against N:
-### Technical Preferences
-- Read `.claude/docs/technical-preferences.md`
-- Extract: naming conventions, performance budgets, approved libraries/addons,
- forbidden patterns
+| Result | Meaning | Action |
+|---|---|---|
+| **N matches, some read `Accepted`** | Normal. | The Accepted set is **A**; proceed with A. |
+| **N matches, none `Accepted`** | Genuinely no Accepted ADRs. | "[N] ADRs found, none Accepted. A manifest built from Proposed ADRs would encode decisions that may still change." Ask whether to proceed with Proposed or stop. **Do not silently emit an empty manifest.** |
+| **0 matches, N > 0** | **Malformed ADRs — not an empty Accepted set.** `## Status` is BLOCKING-if-missing. | "[N] ADRs found, none has a `## Status` section — acceptance cannot be determined. Run `/architecture-decision [file] retrofit` on each." **Stop.** Do not treat all ADRs as Accepted; do not emit a manifest. |
+
+- Note the ADR number and title for every rule sourced.
+
+### Project Config
+- Read `naming.*` and `performance.*` from `project.yaml`; for any key absent or
+ empty, fall back to `.claude/docs/technical-preferences.md`
+- Read approved libraries/addons and forbidden patterns from
+ `.claude/docs/technical-preferences.md` (not migrated to project.yaml)
### Engine Reference
- Read `docs/engine-reference/[engine]/VERSION.md` for engine + version
@@ -47,10 +69,28 @@ Report: "Loaded [N] Accepted ADRs, engine: [name + version]."
## 2. Extract Rules from Each ADR
+Read **only these four sections** per Accepted ADR — not the whole file. Context,
+Consequences, Migration Plan and Validation Criteria explain *why* a decision was
+made; the manifest records *what to do*, so they are not needed here:
+```
+Grep pattern="^## (Decision|Alternatives Considered|Performance Implications|Engine Compatibility)" glob="docs/architecture/adr-*.md" output_mode="content" -A 30
+```
+Filter the results to the Accepted set **A** resolved above. If a section is
+absent for a given ADR, note it per ADR and continue; if a section is absent
+across **all** of A, report "No Accepted ADR contains a `[section]` section — the
+manifest's [category] rules will be empty. Verify this is intended." Escalate to
+a full read of one ADR only when its scanned sections cross-reference material
+outside them (e.g. a Decision that says "subject to the constraints in Context").
+
For each Accepted ADR, extract:
-### Required Patterns (from "Implementation Guidelines" section)
-- Every "must", "should", "required to", "always" statement
+### Required Patterns (from the `## Decision` section)
+- Every "must", "should", "required to", "always" statement in the Decision body
+ — including any `### Implementation Guidelines` sub-heading when the ADR has one
+ (newer ADRs emit it; older ones state mandates directly in `## Decision`). Never
+ scan for `### Implementation Guidelines` alone — it is absent from many
+ skill-authored ADRs, and scanning for it yields an empty Required Patterns
+ section on a manifest that should have been full.
- Every specific pattern or approach mandated
### Forbidden Approaches (from "Alternatives Considered" sections)
@@ -82,12 +122,21 @@ If an ADR spans multiple layers, duplicate the rule into each relevant layer.
Combine rules that apply to all layers:
-### From technical-preferences.md:
-- Naming conventions (classes, variables, signals/events, files, constants)
-- Performance budgets (target framerate, frame budget, draw call limits, memory ceiling)
+### From project config (`project.yaml`, else `technical-preferences.md`):
+- Naming conventions — `naming.*`: classes, variables, signals/events, files, constants
+- Performance budgets — `performance.*`: target framerate, frame budget, draw call limits, memory ceiling
### From deprecated-apis.md:
-- All deprecated APIs → Forbidden API entries
+- Deprecated APIs → Forbidden API entries, **filtered for relevance to this
+ project**. Do not copy the deprecation table wholesale.
+ > Each entry must apply to what this project actually builds. `deprecated-apis.md`
+ > mixes dimensions and subsystems: its `GodotPhysics3D → Jolt Physics 3D` row is
+ > **3D-only**, so emitting it unqualified gives a 2D project a global rule about
+ > a physics engine it never uses. If you cannot tell whether an entry applies —
+ > 2D vs 3D, a module the project does not include — either scope the rule
+ > ("when using 3D physics: ...") or omit it and note it as unresolved. A manifest
+ > of rules that do not apply is one nobody reads, and `/create-stories` consumes
+ > this file.
### From current-best-practices.md (if available):
- Engine-recommended patterns → Required entries
@@ -130,7 +179,7 @@ Use `AskUserQuestion`:
- `lean` → skip. Note: "TD-MANIFEST skipped — Lean mode." Proceed to Phase 5.
- `full` → spawn as normal.
-Spawn `technical-director` via Task using gate **TD-MANIFEST** (`.claude/docs/director-gates.md`).
+Spawn `technical-director` via `Agent` using gate **TD-MANIFEST** (`.claude/docs/director-gates/td-manifest.md`).
Pass: the Control Manifest Preview from Phase 4 (rule counts per layer, full extracted rule list), the list of ADRs covered, engine version, and any rules sourced from technical-preferences.md or engine reference docs.
@@ -238,19 +287,19 @@ rule, see the referenced ADR.
### Naming Conventions
| Element | Convention | Example |
|---------|-----------|---------|
-| Classes | [from technical-preferences] | [example] |
-| Variables | [from technical-preferences] | [example] |
-| Signals/Events | [from technical-preferences] | [example] |
-| Files | [from technical-preferences] | [example] |
-| Constants | [from technical-preferences] | [example] |
+| Classes | [from naming.* in project.yaml, else technical-preferences.md] | [example] |
+| Variables | [from naming.* in project.yaml, else technical-preferences.md] | [example] |
+| Signals/Events | [from naming.* in project.yaml, else technical-preferences.md] | [example] |
+| Files | [from naming.* in project.yaml, else technical-preferences.md] | [example] |
+| Constants | [from naming.* in project.yaml, else technical-preferences.md] | [example] |
### Performance Budgets
| Target | Value |
|--------|-------|
-| Framerate | [from technical-preferences] |
-| Frame budget | [from technical-preferences] |
-| Draw calls | [from technical-preferences] |
-| Memory ceiling | [from technical-preferences] |
+| Framerate | [from performance.* in project.yaml, else technical-preferences.md] |
+| Frame budget | [from performance.* in project.yaml, else technical-preferences.md] |
+| Draw calls | [from performance.* in project.yaml, else technical-preferences.md] |
+| Memory ceiling | [from performance.* in project.yaml, else technical-preferences.md] |
### Approved Libraries / Addons
- [library] — approved for [purpose]
@@ -279,6 +328,10 @@ After writing the manifest:
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
1. **Load silently** — read all inputs before presenting anything
2. **Show the summary first** — let the user see the scope before writing
3. **Ask before writing** — always confirm before creating or overwriting the manifest. On write: Verdict: **COMPLETE** — control manifest written. On decline: Verdict: **BLOCKED** — user declined write.
diff --git a/.claude/skills/create-epics/CONTRACT.md b/.claude/skills/create-epics/CONTRACT.md
new file mode 100644
index 00000000..ccecbdfb
--- /dev/null
+++ b/.claude/skills/create-epics/CONTRACT.md
@@ -0,0 +1,76 @@
+# /create-epics — Handoff Contract
+
+## Role in Pipeline
+Translates approved GDDs and architecture documents into one EPIC.md file per
+architectural module, defining scope, ADR governance, engine risk, and requirement
+traceability — sits between architecture review and story decomposition.
+
+## Inputs Required
+
+### Files That Must Exist
+| File | Required Fields / Sections | Read-Only? |
+|------|---------------------------|-----------|
+| `design/gdd/systems-index.md` | System list, layer assignments, priority order | Yes |
+| `design/gdd/[system].md` | `## Summary`, `## Acceptance Criteria`, `## Overview` (all 8 required sections) | Yes |
+| `docs/architecture/architecture.md` | Module ownership, API boundaries | Yes |
+| `docs/architecture/adr-NNNN-[slug].md` (all governing ADRs) | `Status:`, `GDD Requirements Addressed`, `Decision`, `Engine Compatibility` | Yes |
+| `docs/architecture/control-manifest.md` | `Manifest Version:` date in header | Yes |
+| `docs/architecture/tr-registry.yaml` | TR-IDs with `id`, `system`, requirement text | Yes |
+| `docs/engine-reference/[engine]/VERSION.md` | Engine name, version, risk levels | Yes |
+
+### Preconditions
+- `/create-control-manifest` has been run and `docs/architecture/control-manifest.md` exists
+- `/architecture-review` has passed (at minimum Foundation and Core ADRs are Accepted)
+- All in-scope GDDs have status `Approved` or `Designed` in `systems-index.md`
+- The target layer's GDDs are stable — do not run for Feature layer until Core is nearly complete
+
+## Outputs Produced
+
+### Files Written
+| File | Guaranteed Fields / Sections | Notes |
+|------|------------------------------|-------|
+| `production/epics/[epic-slug]/EPIC.md` | `Layer`, `GDD` path, `Architecture Module`, `Status: Ready`, `## Governing ADRs` table, `## GDD Requirements` table with TR-IDs and ADR coverage, `## Definition of Done`, `## Overview` | Created per approved epic |
+| `production/epics/index.md` | `Epic`, `Layer`, `System`, `GDD`, `Stories`, `Status` columns | Created or appended |
+
+### Output Guarantees
+- Every EPIC.md contains a `## Governing ADRs` table with at least one row (or a documented note if none apply)
+- Every EPIC.md contains a `## GDD Requirements` table where each row has a `TR-ID` and an `ADR Coverage` cell (either `ADR-NNNN ✅` or `❌ No ADR`)
+- The `GDD:` field in the EPIC.md header is a valid relative path to the source GDD
+- The `Layer:` field is one of: Foundation, Core, Feature, Presentation
+- The `Status:` field is set to `Ready`
+- The `Stories:` field reads `Not yet created — run /create-stories [epic-slug]`
+- Untraced requirements (TR-IDs with no ADR) are flagged in the GDD Requirements table with `❌ No ADR`
+- `production/epics/index.md` has an entry for every epic written in this run
+
+## Immutability Rules
+- READS but does NOT modify: `design/gdd/systems-index.md`, all GDD files, `docs/architecture/architecture.md`, all ADR files in `docs/architecture/adr-NNNN-[slug].md` pattern, `docs/architecture/control-manifest.md`, `docs/architecture/tr-registry.yaml`, `docs/engine-reference/[engine]/VERSION.md`
+- MODIFIES: `production/epics/[epic-slug]/EPIC.md` (creates), `production/epics/index.md` (creates or updates)
+
+## Hard Constraints (Never Violate)
+- Never create story files — this skill stops at the epic level
+- Never invent content not sourced from GDDs, ADRs, or architecture docs
+- Never skip the per-epic approval prompt before writing
+- Never write an EPIC.md without first presenting the epic definition to the user
+- Never mark a TR-ID as covered by an ADR unless that ADR's `Status:` is `Accepted`
+- Never create epics for a layer whose dependency layer is not yet substantially complete
+
+## Downstream Skill Expects
+**Next skill:** /create-stories
+
+It will read:
+- `production/epics/[epic-slug]/EPIC.md` — specifically: `Layer:`, `GDD:` path, `Architecture Module:`, the full `## Governing ADRs` table (ADR IDs and summaries), and the full `## GDD Requirements` table (TR-IDs and ADR coverage status)
+- `production/epics/index.md` — to enumerate available epics when no argument is given
+
+It assumes:
+- The `GDD:` path in EPIC.md resolves to a readable file
+- Every ADR listed in `## Governing ADRs` exists as a file and has an `Accepted` status
+- TR-IDs in `## GDD Requirements` match entries in `docs/architecture/tr-registry.yaml`
+- The epic slug used in the directory name matches the slug referenced in `index.md`
+- `Status: Ready` means stories have NOT yet been created (it will replace this line)
+
+## Known Fragile Points
+- If the EPIC.md template structure changes (section names, header field names, table column order), `/create-stories` will silently fail to parse governance data and may produce incomplete or incorrect stories
+- If `tr-registry.yaml` is regenerated with renumbered IDs after EPIC.md files are written, the TR-IDs in existing EPIC.md files become stale and mislead `/create-stories`
+- If an ADR is retroactively changed from `Accepted` to `Proposed` after the epic is written, the EPIC.md will still show it as governing — `/create-stories` will embed it without a BLOCKED flag
+- If `systems-index.md` layer assignments change after epics are created, the `Layer:` field in existing EPIC.md files will be incorrect and `/create-stories` will use the wrong layer context
+- `production/epics/index.md` is append-updated — if an epic is regenerated, a duplicate row may appear
diff --git a/.claude/skills/create-epics/SKILL.md b/.claude/skills/create-epics/SKILL.md
index dc2d6070..b8b23361 100644
--- a/.claude/skills/create-epics/SKILL.md
+++ b/.claude/skills/create-epics/SKILL.md
@@ -1,13 +1,18 @@
---
name: create-epics
-description: "Translate approved GDDs + architecture into epics — one epic per architectural module. Defines scope, governing ADRs, engine risk, and untraced requirements. Does NOT break into stories — run /create-stories [epic-slug] after each epic is created."
+description: "Turn GDDs plus architecture into epics — one per architectural module, with untraced requirements. Then /create-stories [epic-slug]."
argument-hint: "[system-name | layer: foundation|core|feature|presentation | all] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Agent, AskUserQuestion
model: sonnet
-agent: technical-director
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,docs.density,story_granularity,system_overrides`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
# Create Epics
An epic is a named, bounded body of work that maps to one architectural module.
@@ -22,18 +27,52 @@ will have changed.
**Next step after each epic:** `/create-stories [epic-slug]`
-**When to run:** After `/create-control-manifest` and `/architecture-review` pass.
+**When to run:** After `/create-control-manifest` and `/architecture-review` pass
+(at `full`). At `standard`, critical ADRs + a control manifest suffice. At
+`minimal`, this skill is **optional and not part of the path** — `/create-stories`
+synthesizes the epic from `design/game-brief.md` itself (Option A). If run anyway,
+it decomposes directly from the brief with no GDD/ADR/manifest prerequisite.
+
+> **At `minimal`, this skill is optional — `/create-stories` synthesizes the epic**
+> (Option A). At that tier `/create-stories` reads `design/game-brief.md`
+> directly, writes a lightweight implicit `production/epics/<slug>/EPIC.md`, and
+> generates stories from the MVP list — so the path is `/brainstorm` →
+> `/create-stories` → `/dev-story`, with no separate `/create-epics` or
+> `/sprint-plan` step. **At `standard`/`full` an epic IS required**:
+> `/create-stories` reads `production/epics/[slug]/EPIC.md`, and skipping this
+> skill there leaves `/dev-story` with no story to implement — a dead end, not a
+> shortcut.
---
## 1. Parse Arguments
-Resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
-See `.claude/docs/director-gates.md` for the full check pattern.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`workflow`** (per `.claude/docs/workflow-modes.md`):
+
+create-epics runs project-wide: it uses the project-level tier for its
+prerequisite expectations and consults
+`workflow_overrides.system_overrides.<system>` per-system when reading each
+in-scope GDD. See "Workflow tier adjustment" in Step 2.
+
+**`story_granularity`** — it sizes the
+epic's story breakdown: expect **3–5** child stories per epic at `coarse`, **5–10**
+at `balanced` (default), **10–20** at `fine`.
+
+**`docs.density`** — it controls the *depth* of each epic's written scope and
+rationale, not the story count (that is `story_granularity`). `modes.rigor` sets
+it alongside `workflow`; set `docs.density` explicitly to vary epic prose alone:
+`terse` = scope as bullets, one-line rationale; `balanced` = a scope paragraph
+with light rationale (default); `thorough` = full scope prose with governing-ADR
+rationale and risk discussion. The EPIC.md tables (GDD requirements, governing
+ADRs) are structural and stay whole at every density.
**Modes:**
- `/create-epics all` — process all systems in layer order
@@ -48,16 +87,34 @@ See `.claude/docs/director-gates.md` for the full check pattern.
## 2. Load Inputs
-### Step 2a — Summary scan (fast)
+### Step 2a — Summary scan (fast, fail-open)
+
+**Establish the denominator first.** Glob `design/gdd/*.md`, excluding the
+non-system docs (`game-concept.md`, `systems-index.md`, `game-pillars.md`,
+`gameplay-tags.md`, `entity-registry.md`, `fixture-swap-ledger.md`, and any
+`gdd-cross-review-*.md` — the same set `gdd-structure-check.sh` skips). Call the
+count **N**. If N is 0, there are no system GDDs — report "No system GDDs found
+in `design/gdd/` — run `/design-system` first" and stop.
-Grep all GDDs for their `## Summary` sections before reading anything fully:
+Scan for Summary sections:
```
-Grep pattern="## Summary" glob="design/gdd/*.md" output_mode="content" -A 5
+Grep pattern="^## Summary" glob="design/gdd/*.md" output_mode="content" -A 5
```
-For `layer:` or `[system-name]` modes: filter to only in-scope GDDs based on
-the Summary quick-reference. Skip full-reading anything out of scope.
+Interpret the **M** matches against N. These are three different outcomes, and
+a zero-match scan is **never** the same as "nothing in scope":
+
+| Result | Meaning | Action |
+|---|---|---|
+| **M = N** | Every GDD has a Summary. | For `layer:`/`[system-name]` modes, use the Summary Quick-reference (Layer/Priority) to pick the in-scope set; skip full-reading the rest. |
+| **0 < M < N** | Partial adoption — older GDDs predate `## Summary`. | Scope the M by their Summaries; determine the scope of the **N − M** unmatched from `systems-index.md` (layer/priority) and full-read those. |
+| **0 matches, N > 0** | Expected for GDDs authored before `/design-system` emitted `## Summary`. | Determine scope for **all N** from `systems-index.md` and full-read the in-scope set. This is the pre-optimization behaviour — correct, only more expensive. Note once: "No `## Summary` sections found across [N] GDDs — scoping from `systems-index.md` instead of Summary." |
+
+**Never treat an absent `## Summary` as an absent system.** The scan narrows the
+*read* set when it succeeds; it never shrinks the *in-scope* set. In `all` mode
+every system is in scope regardless of Summary, so the scan is a convenience
+only — never a filter.
### Step 2b — Full document load (in-scope systems only)
@@ -68,13 +125,38 @@ Read for in-scope systems:
- `design/gdd/systems-index.md` — authoritative system list, layers, priority
- In-scope GDDs only (Approved or Designed status, filtered by Step 2a results)
- `docs/architecture/architecture.md` — module ownership and API boundaries
-- Accepted ADRs **whose domains cover in-scope systems only** — read the "GDD Requirements Addressed", "Decision", and "Engine Compatibility" sections; skip ADRs for unrelated domains
+- Accepted ADRs **whose domains cover in-scope systems only** — skip ADRs for
+ unrelated domains entirely. For each in-scope ADR, load only the "GDD
+ Requirements Addressed", "Decision", and "Engine Compatibility" sections —
+ never an unbounded full read:
+ ```
+ Grep pattern="^## (GDD Requirements Addressed|Decision|Engine Compatibility)" path="docs/architecture/[adr-file].md" output_mode="content" -n
+ ```
+ then `Read(offset, limit)` bounded to each match through the next `## `
+ heading (or to end of file for the last match). This matters most on a
+ large ADR — measured at 47k tokens this way vs. 103k for an unbounded
+ read of the same size file.
- `docs/architecture/control-manifest.md` — manifest version date from header
- `docs/architecture/tr-registry.yaml` — for tracing requirements to ADR coverage
- `docs/engine-reference/[engine]/VERSION.md` — engine name, version, risk levels
Report: "Loaded [N] GDDs, [M] ADRs, engine: [name + version]."
+> **Workflow tier adjustment** (resolved in Step 1; per-system via
+> `system_overrides`). The inputs above are the `full` baseline:
+> - **`full`** — every in-scope GDD must be Approved with all 8 sections; TR
+> registry + control manifest are required inputs; untraced requirements
+> (Step 4) are flagged before proceeding.
+> - **`standard`** — GDDs need the 5 required sections (+ conditional Formulas)
+> approved; only **critical (Foundation-layer) ADRs** are expected; the control
+> manifest is read if present, not required. A system pinned higher via
+> `system_overrides` must still meet its higher bar.
+> - **`minimal`** — decompose against `design/game-brief.md` +
+> acceptance criteria. Do not require GDDs, ADRs, the TR registry, or the
+> manifest; skip the untraced-requirement gate. If run, the epic is still
+> produced — but note `/create-stories` also synthesizes one from the brief when
+> this skill is skipped (the default `minimal` path).
+
---
## 3. Processing Order
@@ -87,15 +169,27 @@ Process in dependency-safe layer order:
Within each layer, use the order from `systems-index.md`.
+> **At `minimal` there is no `systems-index.md`** — `/map-systems` is not required
+> at that tier, so nothing has produced one. Derive the layer split and ordering
+> from `design/game-brief.md` instead: its **Build order** field names what must
+> exist first. Do not stop, and do not send the user to `/map-systems` to satisfy
+> an ordering hint — the tier deliberately skips it.
+
---
## 4. Define Each Epic
For each system, map it to an architectural module from `architecture.md`.
-Check ADR coverage against the TR registry:
+Check ADR coverage against the TR registry **per the resolved tier** (Step 1):
+- **`full`** — trace every TR-ID; warn on each untraced requirement (below).
+- **`standard`** — only **critical (Foundation-layer) ADRs** are expected; trace
+ those. Treat untraced non-critical requirements as informational (list them, do
+ not block or emit the Blocked-story warning).
+- **`minimal`** — skip this check entirely (no TR registry / ADR expected).
+
- **Traced requirements**: TR-IDs that have an Accepted ADR covering them
-- **Untraced requirements**: TR-IDs with no ADR — warn before proceeding
+- **Untraced requirements**: TR-IDs with no ADR — warn before proceeding (full only)
Present to user before writing anything:
@@ -132,7 +226,7 @@ Use `AskUserQuestion`:
- `lean` → skip (not a PHASE-GATE). Note: "PR-EPIC skipped — Lean mode." Proceed to Step 5 (write epic files).
- `full` → spawn as normal.
-After all epics for the current layer are defined (Step 4 completed for all in-scope systems), and before writing any files, spawn `producer` via Task using gate **PR-EPIC** (`.claude/docs/director-gates.md`).
+After all epics for the current layer are defined (Step 4 completed for all in-scope systems), and before writing any files, spawn `producer` via `Agent` using gate **PR-EPIC** (`.claude/docs/director-gates/pr-epic.md`).
Pass: the full epic structure summary (all epics, their scope summaries, governing ADR counts), the layer being processed, milestone timeline and team capacity.
@@ -233,6 +327,10 @@ After writing all epics for the requested scope:
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
1. **One epic at a time** — present each epic definition before asking to create it
2. **Warn on gaps** — flag untraced requirements before proceeding
3. **Ask before writing** — per-epic approval before writing any file
diff --git a/.claude/skills/create-stories/CONTRACT.md b/.claude/skills/create-stories/CONTRACT.md
new file mode 100644
index 00000000..9b22ca93
--- /dev/null
+++ b/.claude/skills/create-stories/CONTRACT.md
@@ -0,0 +1,81 @@
+# /create-stories — Handoff Contract
+
+## Role in Pipeline
+Decomposes a single epic into implementable story files by tracing GDD acceptance
+criteria through ADR decisions and manifest rules — sits between `/create-epics`
+and `/story-readiness` + `/dev-story`.
+
+## Inputs Required
+
+### Files That Must Exist
+| File | Required Fields / Sections | Read-Only? |
+|------|---------------------------|-----------|
+| `production/epics/[epic-slug]/EPIC.md` | `Layer:`, `GDD:` path, `Architecture Module:`, `## Governing ADRs` table, `## GDD Requirements` table with TR-IDs | Yes |
+| `design/gdd/[filename].md` | All 8 required sections, especially `## Acceptance Criteria`, `## Formulas`, `## Edge Cases` | Yes |
+| `docs/architecture/adr-NNNN-[slug].md` (all governing ADRs) | `Status:`, `Decision`, `Implementation Guidelines`, `Engine Compatibility`, `Engine Notes` | Yes |
+| `docs/architecture/control-manifest.md` | Layer rules (required patterns, forbidden patterns, guardrails), `Manifest Version:` date in header | Yes |
+| `docs/architecture/tr-registry.yaml` | All TR-IDs for the epic's system, with stable `id` values | Yes |
+
+### Preconditions
+- `/create-epics` has been run and the target `EPIC.md` has `Status: Ready`
+- The EPIC.md contains a populated `## GDD Requirements` table (not empty)
+- All governing ADRs listed in the EPIC.md exist as files
+- Foundation epics have stories created before Core epics are started; Core before Feature; Feature before Presentation
+
+## Outputs Produced
+
+### Files Written
+| File | Guaranteed Fields / Sections | Notes |
+|------|------------------------------|-------|
+| `production/epics/[epic-slug]/story-NNN-[slug].md` | `Epic:`, `Status:`, `Layer:`, `Type:`, `Manifest Version:`, `## Context` (GDD path + `TR-[system]-NNN` + ADR reference + ADR Decision Summary + Engine/Risk + Engine Notes + Control Manifest Rules), `## Acceptance Criteria`, `## Implementation Notes`, `## Out of Scope`, `## Test Evidence`, `## Dependencies` | Created per story |
+| `production/epics/[epic-slug]/EPIC.md` | `## Stories` table replacing the "Not yet created" placeholder | Updated in-place |
+
+### Output Guarantees
+- Every story file contains a `TR-[system]-NNN` reference in its `## Context` section (or `TR-[system]-???` with a warning if the registry has no match)
+- Every story file contains an `ADR Governing Implementation:` line referencing at least one ADR, or an explicit `No ADR applies` note
+- Every story file has a `Status:` field — either `Ready` or `Blocked` (if the governing ADR is `Proposed`)
+- Every story file has a `Type:` field — one of: Logic, Integration, Visual/Feel, UI, Config/Data
+- Every story file has a `Manifest Version:` field matching the date from `docs/architecture/control-manifest.md`'s header at time of writing
+- Every story file has a `## Test Evidence` section stating the expected evidence location for its type
+- Every story file has a `## Acceptance Criteria` section with at least one checkbox item copied from the GDD
+- Every story file has a `## Dependencies` section (may say "None" but is never omitted)
+- The EPIC.md `## Stories` table is updated with a row per story including `#`, `Story` title, `Type`, `Status`, and `ADR`
+- Stories with a `Proposed` ADR have `Status: Blocked` and a note: `BLOCKED: ADR-NNNN is Proposed — run /architecture-decision to advance it`
+- Every story file has an `Engine` and a `Risk` field. `Risk` is taken from `docs/engine-reference/<engine>/VERSION.md`; when that file is missing or assigns no level, `Risk` is **`NOT ASSESSED (no VERSION.md risk rating)`** — never a guessed level
+- **`NOT ASSESSED` is an emittable value of the `Risk` field**, and downstream readers must handle it. `/dev-story` treats it as HIGH when deciding whether to spawn the engine specialist: an unknown risk is not a low one
+
+## Immutability Rules
+- READS but does NOT modify: the epic's GDD, all ADR files, `docs/architecture/tr-registry.yaml`, `docs/architecture/control-manifest.md`
+- MODIFIES: `production/epics/[epic-slug]/story-NNN-[slug].md` (creates), `production/epics/[epic-slug]/EPIC.md` (updates Stories section only)
+
+## Hard Constraints (Never Violate)
+- Never start implementation — this skill stops at the story file level
+- Never invent acceptance criteria — all criteria must come from the GDD
+- Never invent implementation notes — all guidance must come from the referenced ADR
+- Never write story files without presenting the full story list for approval first
+- Never mark a story `Status: Ready` if its governing ADR has `Status: Proposed`
+- Never omit the `Manifest Version:` field — downstream readiness checks depend on it
+- Never reuse a story number (NNN) that already exists in the epic directory
+
+## Downstream Skill Expects
+**Next skill:** /story-readiness (then /dev-story)
+
+It will read:
+- Each `story-NNN-[slug].md` file — specifically: `Status:`, `Type:`, `Manifest Version:` (header), `TR-[system]-NNN` (in `## Context`), `ADR Governing Implementation:` line, `## Acceptance Criteria` section, `## Test Evidence` section, `## Dependencies` section
+- `docs/architecture/control-manifest.md` — to compare its `Manifest Version:` against the story's embedded version
+- The referenced ADR file — to verify its `Status:` field is still `Accepted`
+
+It assumes:
+- `Manifest Version:` in the story header is a date string that can be compared against the manifest's current `Manifest Version:` date
+- `TR-[system]-NNN` IDs are resolvable in `docs/architecture/tr-registry.yaml`
+- The ADR referenced by name in `ADR Governing Implementation:` exists as a file in `docs/architecture/` (pattern: `adr-NNNN-[slug].md`)
+- `Status: Ready` means the story is a candidate for assignment (not Draft, not in progress)
+- `## Acceptance Criteria` contains checkbox items that are directly testable
+- `## Test Evidence` specifies an exact file path or evidence doc path where proof will be stored
+
+## Known Fragile Points
+- If the story file format (header field names, section names, checkbox syntax) changes, `/story-readiness` will silently skip checks for fields it cannot parse — stories may pass readiness that should fail
+- If `control-manifest.md` is regenerated with a new `Manifest Version:` date after stories are written, all existing stories will show a stale manifest version and fail the readiness manifest check — every story in the epic will need its `Manifest Version:` updated
+- If a governing ADR is renumbered or its file is renamed after stories are written, the `ADR Governing Implementation:` reference in story files will point to a missing file and `/story-readiness` will BLOCK those stories
+- If `tr-registry.yaml` deprecates or supersedes a TR-ID that is already embedded in story files, `/story-readiness` will flag those stories as NEEDS WORK
+- The EPIC.md Stories table update is append-style — if `/create-stories` is run twice for the same epic, duplicate rows will appear in the table
diff --git a/.claude/skills/create-stories/SKILL.md b/.claude/skills/create-stories/SKILL.md
index 796fe1ce..528f3e74 100644
--- a/.claude/skills/create-stories/SKILL.md
+++ b/.claude/skills/create-stories/SKILL.md
@@ -1,13 +1,18 @@
---
name: create-stories
-description: "Break a single epic into implementable story files. Reads the epic, its GDD, governing ADRs, and control manifest. Each story embeds its GDD requirement TR-ID, ADR guidance, acceptance criteria, story type, and test evidence path. Run after /create-epics for each epic."
+description: "Break one epic into implementable stories embedding TR-ID, ADR guidance, acceptance criteria. Reads the control manifest. After /create-epics."
argument-hint: "[epic-slug | epic-path] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Agent, AskUserQuestion
model: sonnet
-agent: lead-programmer
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,docs.density,story_granularity,system_overrides`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
# Create Stories
A story is a single implementable behaviour — small enough to complete in one
@@ -27,38 +32,135 @@ then Core, and so on — matching the dependency order.
## 1. Parse Argument
-Extract `--review [full|lean|solo]` if present and store as the review mode
-override for this run. If not provided, read `production/review-mode.txt`
-(default `lean` if missing). This resolved mode applies to all gate spawns
-in this skill — apply the check pattern from `.claude/docs/director-gates.md`
-before every gate invocation.
+
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`workflow`** for this epic's system (per `.claude/docs/workflow-modes.md`) —
+use the `system_overrides` row for `<system>` if the block lists one, else the
+project value. `<system>` is the epic slug / its GDD system. The tier sets which prerequisites block — see the note in Step 2.
+
+**`story_granularity`** — it sets each
+story's AC load: **5–10 ACs covering a whole feature** at `coarse`, **2–4 ACs
+covering one task** at `balanced` (default), **1 AC** at `fine` (the story name is
+the AC restatement). Group or split ACs into stories to hit the target.
+
+**`docs.density`** — it controls the *depth* of each story's prose (context,
+implementation notes, ADR summary), not the AC count (that is
+`story_granularity`) and never the AC text itself. `modes.rigor` sets it
+alongside `workflow`; set `docs.density` explicitly to vary story prose alone:
+`terse` = notes as bullets, no preamble; `balanced` = short context paragraph +
+notes (default); `thorough` = full context, implementation guidance, and ADR
+rationale. The embedded TR-ID reference, ADR Version stamp, and acceptance
+criteria are structural and are never trimmed by density.
- `/create-stories [epic-slug]` — e.g. `/create-stories combat`
- `/create-stories production/epics/combat/EPIC.md` — full path also accepted
-- No argument — ask: "Which epic would you like to break into stories?"
- Glob `production/epics/*/EPIC.md` and list available epics with their status.
+- No argument — at `minimal` there are no epics yet (Option A): skip to Step 2's
+ `minimal` branch and synthesize the epic from `design/game-brief.md`. At
+ `standard`/`full`, ask "Which epic would you like to break into stories?" and
+ Glob `production/epics/*/EPIC.md` to list available epics with their status.
+
+ > **If that glob returns nothing at `standard`/`full`, stop — do not build a
+ > question with no options.** Report:
+ > "No epics found under `production/epics/`. Run `/create-epics layer: foundation`
+ > first — an epic is what this skill decomposes."
+ >
+ > **The zero-epic path is load-bearing.** Asking which epic *and* globbing to
+ > list them leaves an `AskUserQuestion` with nothing to offer when the glob is
+ > empty. Route to `/create-epics` instead — it is named as **Previous step**
+ > in this skill's own header.
+ >
+ > Note what this skill guarded and what it did not. Step 2's ADR validation is
+ > thorough: three tiers, each with its own stop condition, and an explicit
+ > message naming the missing file. That is the **deepest** input. The **first**
+ > input — does an epic exist at all — went unchecked. Guarding the far end of a
+ > chain while leaving the near end open is the shape to watch for.
+ >
+ > At `minimal` this does not apply: there are deliberately no epics, and the
+ > branch above synthesizes one from the brief.
---
## 2. Load Everything for This Epic
-Read in full:
+> **`minimal` tier — synthesize the epic from the brief** (Option A). At
+> `minimal` there is no `/create-epics` step and no `EPIC.md`. Instead:
+> 1. Read `design/game-brief.md` in full (it is one page).
+> 2. Synthesize an implicit epic: write a lightweight
+> `production/epics/<slug>/EPIC.md`, where `<slug>` is the brief's slugified
+> working title (`mvp` if untitled) — goal = the brief's one-sentence pitch,
+> scope = its MVP feature list, ordering = its **Build order**. Keep it terse;
+> this is the container `/dev-story` and `/sprint-status` expect.
+> 3. Generate **one coarse story per MVP feature** (Step 3+), in Build-order
+> sequence, each traced to the brief (not a GDD/TR-ID). Leave stories unblocked
+> on ADR grounds — none exist at this tier.
+> Skip the GDD, control-manifest, TR-registry, and ADR reads below (none exist at
+> `minimal`), then continue to Step 3 with the synthesized epic.
+
+For `standard`/`full` (a `/create-epics` epic exists), read in full (these are small):
- `production/epics/[epic-slug]/EPIC.md` — epic overview, governing ADRs, GDD requirements table
-- The epic's GDD (`design/gdd/[filename].md`) — read all 8 sections, especially Acceptance Criteria, Formulas, and Edge Cases
-- All governing ADRs listed in the epic — read the Decision, Implementation Guidelines, Engine Compatibility, and Engine Notes sections
-- `docs/architecture/control-manifest.md` — extract rules for this epic's layer; note the Manifest Version date from the header
-- `docs/architecture/tr-registry.yaml` — load all TR-IDs for this system
-
-**ADR existence validation**: After reading the governing ADRs list from the epic, confirm each ADR file exists on disk. If any ADR file cannot be found, **stop immediately** before decomposing any story:
+- The epic's GDD (`design/gdd/[filename].md`) — at `full` read all 8 sections; at `standard` the 5 required sections (+ conditional Formulas); at `minimal` the GDD may not exist — work from the epic brief + acceptance criteria. Always prioritise Acceptance Criteria, Formulas, and Edge Cases where present.
+- `docs/architecture/control-manifest.md` — grep only this epic's layer (`Grep pattern="^## <layer> Layer Rules" path="docs/architecture/control-manifest.md" output_mode="content" -A 40`) plus the header Manifest Version date, not a full read of all layers
+- `docs/architecture/tr-registry.yaml` — grep only this system's entries (`Grep pattern="system: <slug>" path="docs/architecture/tr-registry.yaml" output_mode="content" -B1 -A5`, or `id: TR-<slug>-`), not the whole cross-system registry
+
+**Load each governing ADR by section — never with an unbounded full read.** A
+substantial ADR exceeds the 25k-token `Read` cap, and a capped read's only
+recovery is paging through the remainder — the most expensive possible way to
+read a file (measured at 103k tokens on a 34k-token ADR vs ~54k for targeted
+reads of the same file). Per ADR:
+
+1. **Map the headings** (cheap — line numbers only):
+ ```
+ Grep pattern="^## |^### Implementation Guidelines" path="docs/architecture/[adr-file].md" output_mode="content" -n
+ ```
+2. **Bounded-read exactly the sections this skill consumes**, using the line
+ numbers from the map to set `Read(offset, limit)` spans that end where the
+ next section begins:
+ - `## Summary` and `## Decision` (including its `### Implementation
+ Guidelines` subsection) — these feed the story's ADR Decision Summary
+ and Implementation Notes.
+ - `## Engine Compatibility` — feeds the story's Engine, Risk, and Engine
+ Notes fields. (Engine Notes is a *story* field derived from this
+ section — it is not an ADR section name; do not search for one.)
+3. **Capture the `## Last Verified` date**:
+ ```
+ Grep pattern="^## (Last Verified|Date)" path="docs/architecture/[adr-file].md" output_mode="content" -A 1
+ ```
+ Use `Last Verified`, falling back to `Date`, then to `unversioned` if both
+ are absent. This becomes the story's `ADR Version` stamp — `/dev-story`
+ uses it to decide whether it can trust this story's distilled summary
+ instead of re-opening the ADR.
+
+Skip Context, Alternatives Considered, Consequences, Risks, and any
+Amendments Log unless a section you loaded explicitly cross-references one of
+their entries — then take only the referenced entry with one more bounded
+read. If the heading map comes back empty (a nonstandard ADR predating the
+template), fall back to one full `Read` — and if that read truncates at the
+cap, do **not** page through the remainder; grep for the story-relevant
+content directly and flag the ADR for `/architecture-decision [file]
+retrofit`.
+
+**ADR existence validation** (tier-gated — resolved in Step 1): After reading the governing ADRs list from the epic, confirm each referenced ADR file exists on disk.
+
+- **`full`** — if **any** referenced ADR file cannot be found, **stop immediately** before decomposing any story.
+- **`standard`** — stop only if a **critical (Foundation-layer) ADR** is missing; for a missing non-critical ADR, **warn and continue** (the story embeds the ADR reference and is set `Status: Blocked` until the ADR exists).
+- **`minimal`** — no ADR requirement; do **not** stop. Embed any ADR references that do exist; otherwise decompose against the brief + acceptance criteria and leave stories unblocked on ADR grounds.
+
+When stopping (full / standard-critical):
> "Epic references [ADR-NNNN: title] but `docs/architecture/[adr-file].md` was not found.
> Check the filename in the epic's Governing ADRs list, or run `/architecture-decision`
> to create it. Cannot create stories until all referenced ADR files are present."
-Do not proceed to Step 3 until all referenced ADR files are confirmed present.
+At `full`, do not proceed to Step 3 until all referenced ADR files are confirmed present.
-Report: "Loaded epic [name], GDD [filename], [N] governing ADRs (all confirmed present), control manifest v[date]."
+Report: "Loaded epic [name], GDD [filename], [N] governing ADRs [ADR status], [manifest status]." State the **actual** situation for the resolved tier — e.g. "all confirmed present, control manifest v[date]" at full; "M present, K missing non-critical (embedded + Blocked)" at standard; "no ADRs / manifest required" at minimal. Do not assert "all confirmed present" if any referenced ADR was missing, or name a manifest version when none exists.
---
@@ -87,8 +189,11 @@ For each GDD acceptance criterion:
2. Each group = one story
3. Order stories: foundational behaviour first, edge cases last, UI last
-**Story sizing rule:** one story = one focused session (~2-4 hours). If a
-group of criteria would take longer, split into two stories.
+**Story sizing rule:** size each story to the resolved `modes.story_granularity`
+target (above). The "~2-4 hours / one focused session" heuristic is the
+`balanced` default — at `coarse` a story spans a whole feature (5–10 ACs,
+multi-day), at `fine` a story is a single AC. Split or group criteria to hit the
+resolved target, not a fixed session length.
For each story, determine:
- **GDD requirement**: which acceptance criterion(ia) does this satisfy?
@@ -110,24 +215,17 @@ For each story, determine:
- `lean` → skip (not a PHASE-GATE). Note: "QL-STORY-READY skipped — Lean mode." Proceed to Step 5 (present stories for review).
- `full` → spawn as normal.
-After decomposing all stories (Step 4 complete) but before presenting them for write approval, spawn `qa-lead` via Task using gate **QL-STORY-READY** (`.claude/docs/director-gates.md`).
+After decomposing all stories (Step 4 complete) but before presenting them for write approval, spawn `qa-lead` **once** via `Agent` using gate **QL-STORY-READY** (`.claude/docs/director-gates/ql-story-ready.md`). A single call returns **both** the readiness verdict and the test-case specs — do not spawn `qa-lead` a second time to generate specs.
-Pass: the full story list with acceptance criteria, story types, and TR-IDs; the epic's GDD acceptance criteria for reference.
+Pass: the full story list with acceptance criteria, story types, and TR-IDs; the epic's GDD acceptance criteria for reference. Require in the return:
+1. The QL-STORY-READY verdict per story (ADEQUATE / GAPS / INADEQUATE).
+2. For every story it marks **ADEQUATE**, its test-case spec block (formats below) — one Given/When/Then per acceptance criterion for Logic and Integration stories, or manual verification steps for Visual/Feel and UI stories.
-Present the QA lead's assessment. For each story flagged as GAPS or INADEQUATE, revise the acceptance criteria before proceeding — stories with untestable criteria cannot be implemented correctly. Once all stories reach ADEQUATE, proceed.
+Present the assessment. For each story flagged GAPS or INADEQUATE, revise the acceptance criteria before proceeding — untestable criteria cannot be implemented correctly; those stories carry no specs until they reach ADEQUATE (re-request specs for just those in a follow-up call only if a revision was needed). Once all stories are ADEQUATE, proceed with the returned specs.
-**Before generating test specs**: Glob `production/qa/qa-plan-*.md` for the most recently modified file. If found, read it and check whether it contains test case specifications for the stories in this epic (look for story titles or slugs in the plan's Automated Tests Required section). If matching specs exist:
-- Use `AskUserQuestion`:
- - Prompt: "A QA plan exists at [path] with test specs for some of these stories. How do you want to proceed?"
- - Options:
- - `Use existing specs from the QA plan — embed them into the story files (Recommended)`
- - `Ask qa-lead to generate fresh specs — override the QA plan`
- - `Skip test spec generation — I'll fill in ## QA Test Cases manually`
-- If "Use existing specs": extract the test case specs from the qa-plan for each matching story and embed them directly into the `## QA Test Cases` section. No qa-lead spawn needed for those stories. Only spawn qa-lead for stories with no coverage in the qa-plan.
-- If "Generate fresh": proceed with the qa-lead spawn below as normal.
-- If "Skip": leave `## QA Test Cases` with a placeholder: `*Test cases not yet defined — run /qa-plan to generate them.*`
+**Prefer an existing QA plan when one already covers a story** — this substitutes for the qa-lead's specs, it does not add a spawn. Glob `production/qa/qa-plan-*.md` for the most recent file; if it holds test specs for stories in this epic (match titles/slugs in its Automated Tests Required section) that differ from the qa-lead's, use `AskUserQuestion` (Use QA-plan specs / Use qa-lead specs / Skip and leave `*Test cases not yet defined — run /qa-plan to generate them.*`). Either way no additional `qa-lead` spawn occurs.
-**After ADEQUATE** (or after qa-plan import): for every Logic and Integration story, ask the qa-lead to produce concrete test case specifications — one per acceptance criterion — in this format:
+The spec block formats — Logic/Integration:
```
Test: [criterion text]
@@ -181,6 +279,34 @@ Use `AskUserQuestion`:
For each story, write `production/epics/[epic-slug]/story-[NNN]-[slug].md`:
+> **At `minimal` tier the Context/traceability inputs do not exist** (no GDD, ADR,
+> TR registry, or control manifest). Fill the template from the brief instead —
+> apply this mapping exactly, so every run is deterministic rather than improvised:
+> - **GDD** → `design/game-brief.md`
+> - **Requirement** → `Brief MVP feature N` (the feature this story implements — NOT a `TR-[system]-NNN` ID)
+> - **ADR Governing Implementation / ADR Decision Summary / ADR Version** → `N/A (minimal — no ADRs)`
+> - **Manifest Version** and **Control Manifest Rules (this layer)** → `N/A (minimal — no control manifest)`
+> - **Engine** and **Risk** → read `docs/engine-reference/<engine>/VERSION.md`
+> (engine from `engine.name`). **Engine** is `engine.name` + `engine.version`.
+> **Risk** is the risk level that file assigns to the pinned version — its
+> post-cutoff timeline row, or its stated overall risk. If the file is missing
+> or assigns no level, write `NOT ASSESSED (no VERSION.md risk rating)` — never
+> guess a level.
+>
+> > **This field is load-bearing and had no rule, so it was improvised.**
+> > `/dev-story` Phase 3 spawns the engine specialist as a mandatory secondary
+> > "when engine risk is HIGH (from the ADR or VERSION.md)". At `minimal` there
+> > is no ADR, so `VERSION.md` is the *only* source — and nothing here told this
+> > skill to read it. A story written with an invented `Risk: MEDIUM` against a
+> > `VERSION.md` rating of HIGH silently disables the specialist review. In the
+> > run that found this, that review was what caught two wrong engine defaults.
+> > Treat `NOT ASSESSED` as HIGH for the spawn decision: an unknown risk is not
+> > a low one.
+> - **Engine Notes** → `none (no ADR engine-compatibility analysis at minimal)`
+> - The Acceptance-Criteria source line → "From `design/game-brief.md` (the **Player goal & fail state** field + the MVP feature this story implements), scoped to this story" — derive concrete, testable ACs from what the user wrote there rather than inventing them from a bare MVP bullet
+> - The **`## QA Test Cases`** section → at any tier where the QL-STORY-READY / qa-lead gate is skipped (`minimal`, or `lean`/`solo` review mode) no qa-lead specs are authored; write "*N/A — no qa-lead specs at this tier; implement against the Acceptance Criteria above*" rather than improvising test cases.
+> - Any **Test Evidence / DoD** line is governed by `qa.level`, not this template — at `qa.level: minimal` it is **waived** (advisory, never "must exist and pass").
+
```markdown
# Story [NNN]: [title]
@@ -200,6 +326,7 @@ For each story, write `production/epics/[epic-slug]/story-[NNN]-[slug].md`:
**ADR Governing Implementation**: [ADR-NNNN: title]
**ADR Decision Summary**: [1-2 sentence summary of what the ADR decided]
+**ADR Version**: [the ADR's `## Last Verified` date, else its `## Date`, else `unversioned`]
**Engine**: [name + version] | **Risk**: [LOW / MEDIUM / HIGH]
**Engine Notes**: [from ADR Engine Compatibility section — post-cutoff APIs, verification required]
@@ -240,7 +367,7 @@ change meaning. This is what the programmer reads instead of the ADR.]
## QA Test Cases
-*Written by qa-lead at story creation. The developer implements against these — do not invent new test cases during implementation.*
+*Written by qa-lead at story creation. The developer implements against these — do not invent new test cases during implementation. (At tiers where the QL-STORY-READY gate is skipped — `minimal`, or `lean`/`solo` review mode — no qa-lead specs exist; see the `minimal` mapping note above.)*
**[For Logic / Integration stories — automated test specs]:**
@@ -261,9 +388,11 @@ change meaning. This is what the programmer reads instead of the ADR.]
## Test Evidence
+*Governed by `qa.level`: at `qa.level: minimal` the evidence below is **waived** (advisory, never "must exist and pass").*
+
**Story Type**: [type]
**Required evidence**:
-- Logic: `tests/unit/[system]/[story-slug]_test.[ext]` — must exist and pass
+- Logic: `tests/unit/[system]/[story-slug]_test.[ext]` — must exist and pass (`/story-done` checks that it EXISTS; pass/fail is established by `/gate-check` and `/smoke-check`, both later)
- Integration: `tests/integration/[system]/[story-slug]_test.[ext]` OR playtest doc
- Visual/Feel: `production/qa/evidence/[story-slug]-evidence.md` + sign-off
- UI: `production/qa/evidence/[story-slug]-evidence.md` or interaction test
@@ -294,7 +423,7 @@ Replace the "Stories: Not yet created" line with a populated table:
### Also update `production/epics/index.md`
-Find the row in the index table matching this epic (by epic name or slug). Update its `Stories` column from `Not yet created` to `[N] stories` (where N is the count just written). If the index file does not exist, skip silently.
+Find the row in the index table matching this epic (by epic name or slug). Update its `Stories` column from `Not yet created` to `[N] stories` (where N is the count just written). If the index file does not exist, say so in one line — `Systems index not updated: design/gdd/systems-index.md absent` — and continue. Do not skip silently: the index is what a reader consults to learn which epics have stories, so an un-updated one keeps reporting `Not yet created` for work that now exists, and nothing else would ever reveal the gap.
---
@@ -320,6 +449,10 @@ Note in output: "Work through stories in order — each story's `Depends on:` fi
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
1. **Read before presenting** — load all inputs silently before showing the story list
2. **Ask once** — present all stories for the epic in one summary, not one at a time
3. **Warn on blocked stories** — flag any story with a Proposed ADR before writing
diff --git a/.claude/skills/day-one-patch/SKILL.md b/.claude/skills/day-one-patch/SKILL.md
index 5d1601ff..b06023cc 100644
--- a/.claude/skills/day-one-patch/SKILL.md
+++ b/.claude/skills/day-one-patch/SKILL.md
@@ -1,9 +1,10 @@
---
name: day-one-patch
-description: "Prepare a day-one patch for a game launch. Scopes, prioritises, implements, and QA-gates a focused patch addressing known issues discovered after gold master but before or immediately after public launch. Treats the patch as a mini-sprint with its own QA gate and rollback plan."
+description: "Day-one launch patch — focused fix for known issues found after gold master. Mini-sprint with QA gate and rollback."
argument-hint: "[scope: known-bugs | cert-feedback | all]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion
+disable-model-invocation: true
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion
model: sonnet
---
@@ -33,15 +34,32 @@ ships. It is a mini-sprint — not a hotfix, not a full sprint.
## Phase 1: Load Release Context
Read:
-- `production/stage.txt` — confirm project is in Release stage
+- `project.stage` in `project.yaml` (fallback `production/stage.txt`) — confirm project is in Release stage
- The most recent file in `production/gate-checks/` — read the release gate verdict
- `production/qa/bugs/*.md` — load all bugs with Status: Open or Fixed — Pending Verification
- `production/sprints/` most recent — understand what shipped
- `production/security/security-audit-*.md` most recent — check for any open security items
-If `production/stage.txt` is not `Release` or `Polish`:
+If the resolved stage (project.yaml → stage.txt) is not `Release` or `Polish`:
> "Day-one patch prep is for Release-stage projects. Current stage: [stage]. This skill is not appropriate until you are approaching launch."
+**Check the premise, do not assume it.** This whole skill rests on there being a
+gold master that already passed a release gate — that premise is what justifies
+its lightweight QA pass instead of a full one. So verify it rather than inferring
+it from the stage value:
+
+- **No file in `production/gate-checks/`**, or none recording a release-gate
+ verdict: report `Release gate: NOT ASSESSED — no gate-check record found`. Do
+ not proceed silently. Say plainly that the reduced QA scope below is justified
+ by a gate nobody can find, and ask whether to run `/gate-check` first or
+ proceed with a full QA pass instead.
+- **The most recent record is FAIL, CONCERNS or NOT ASSESSED**: name it and stop.
+ A day-one patch on top of a build that never passed its gate is not a day-one
+ patch; it is the release gate, arriving late and scoped to the wrong changes.
+- `project.stage: Release` on its own does **not** establish this. The stage is a
+ claim about where the project is; the gate record is the evidence that it earned
+ the position.
+
---
## Phase 2: Scope the Patch
@@ -84,7 +102,7 @@ Use `AskUserQuestion` to confirm proceeding or reduce scope.
Before any code is written, define the rollback procedure. This is non-negotiable.
-Spawn `release-manager` via Task. Ask them to produce a rollback plan covering:
+Spawn `release-manager` via `Agent`. Ask them to produce a rollback plan covering:
- How to revert to the gold master build on each target platform
- Platform-specific rollback constraints (some platforms cannot roll back cert builds)
- Who is responsible for triggering the rollback
@@ -100,14 +118,14 @@ Do not proceed to Phase 4 until the rollback plan is written.
For each bug in the approved scope, spawn a focused implementation loop:
-1. Spawn `lead-programmer` via Task with:
+1. Spawn `lead-programmer` via `Agent` with:
- The bug report (exact reproduction steps and root cause if known)
- The constraint: minimum viable fix only, no cleanup
- The affected files (from bug report Technical Context section)
2. The lead-programmer implements and runs targeted tests.
-3. Spawn `qa-tester` via Task to verify: does the bug reproduce after the fix?
+3. Spawn `qa-tester` via `Agent` to verify: does the bug reproduce after the fix?
For config/data-only fixes: make the change directly (no programmer agent needed). Confirm the value changed and re-run any relevant smoke test.
@@ -117,7 +135,7 @@ For config/data-only fixes: make the change directly (no programmer agent needed
This is a lightweight QA pass — not a full `/team-qa`. The patch is already QA-approved from the release gate; we are only re-verifying the changed areas.
-Spawn `qa-lead` via Task with:
+Spawn `qa-lead` via `Agent` with:
- List of all changed files
- List of bugs fixed (with verification status from Phase 4)
- The smoke check scope for the affected systems
@@ -130,6 +148,14 @@ Run the required QA scope:
QA verdict must be PASS or PASS WITH WARNINGS before proceeding. If FAIL: scope the failing fix out of the day-one patch and defer to 1.1.
+**If the QA verdict is `NOT ASSESSED`, that is not a pass.** `/smoke-check` returns
+it when the suite never ran — no build, no runner, or a result nobody confirmed.
+Do not proceed on it and do not re-read it as PASS WITH WARNINGS: the warnings
+value means somebody looked and saw something minor, and this means nobody looked.
+Either obtain the result (the verdict names what would make it runnable) or defer
+the fix to 1.1. A day-one patch ships to every player who buys the game on day
+one, which is the worst possible audience for an unverified change.
+
---
## Phase 6: Generate Patch Record
@@ -161,10 +187,11 @@ QA verdict must be PASS or PASS WITH WARNINGS before proceeding. If FAIL: scope
## QA Sign-Off
**QA scope**: [Targeted smoke / Broader regression]
-**Verdict**: [PASS / PASS WITH WARNINGS]
+**Verdict**: [PASS / PASS WITH WARNINGS / NOT ASSESSED]
**QA lead**: qa-lead agent
**Date**: [date]
**Warnings (if any)**: [list or "None"]
+**Not assessed (if any)**: [what could not be checked, and why — or "None"]
---
diff --git a/.claude/skills/design-review/SKILL.md b/.claude/skills/design-review/SKILL.md
index b0b90eae..1442d634 100644
--- a/.claude/skills/design-review/SKILL.md
+++ b/.claude/skills/design-review/SKILL.md
@@ -1,17 +1,40 @@
---
name: design-review
-description: "Reviews a game design document for completeness, internal consistency, implementability, and adherence to project design standards. Run this before handing a design document to programmers."
-argument-hint: "[path-to-design-doc] [--depth full|lean|solo]"
+description: "Reviews one design document for completeness, internal consistency, implementability, and design standards. Before handing to programmers."
+argument-hint: "[path-to-design-doc] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,system_overrides`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
## Phase 0: Parse Arguments
-Extract `--depth [full|lean|solo]` if present. Default is `full` when no flag is given.
-**Note**: `--depth` controls the *analysis depth* of this skill (how many specialist agents are spawned). It is independent of the global review mode in `production/review-mode.txt`, which controls director gate spawning. These are two different concepts — `--depth` is about how thoroughly *this* skill analyses the document.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`workflow`** for the GDD under review — use the `system_overrides` row for `<system>` if the block lists one, else the project value. Validation scope follows the tier:
+- `full` — all 8 sections validated; any missing section blocks approval.
+- `standard` — the 5 required sections (Overview, Detailed Rules, Edge Cases,
+ Dependencies, Acceptance Criteria) block if missing; Formulas blocks only when
+ the system defines numeric rules (rates, curves, thresholds, costs — the
+ category is a hint, not the test); Player Fantasy and
+ Tuning Knobs are advisory (warn, never block) unless `workflow_overrides`
+ require them.
+- `minimal` — no GDD is expected; if one exists, validate the 5 standard
+ sections advisorily.
+
+Resolved mode controls how thorough this review is:
- **`full`**: Complete review — all phases + specialist agent delegation (Phase 3b)
- **`lean`**: All phases, no specialist agents — faster, single-session analysis
@@ -21,7 +44,68 @@ Extract `--depth [full|lean|solo]` if present. Default is `full` when no flag is
## Phase 1: Load Documents
-Read the target design document in full. Read CLAUDE.md to understand project context and standards. Read related design documents referenced or implied by the target doc (check `design/gdd/` for related systems).
+**Freshness check first — a re-review of an unchanged document costs full
+price (~46k tokens, measured) and reproduces the same verdict.** Run:
+
+```
+Bash: bash .claude/scripts/review-receipts.sh check "design/gdd/reviews/[doc-name]-review-log.md" "[target-doc-path]" "design/registry/entities.yaml"
+```
+
+The registry is in the check because this review consults it for
+cross-document facts — an unchanged GDD reviewed against a *changed*
+registry can reach different conclusions, so the skip is only safe when
+**every** listed line reads `UNCHANGED` (an absent registry simply doesn't
+appear in the output and doesn't block the skip).
+
+- **All `UNCHANGED`** and the log's latest entry carries a verdict — surface it:
+ *"This document is byte-identical to its last review on [date] (verdict:
+ [verdict])."* If that verdict was APPROVED, offer via `AskUserQuestion`:
+ `[A] Use the prior verdict (Recommended)` / `[B] Re-review anyway` —
+ `guided` proceeds with [A] and notes it; `autonomous` logs via
+ `log_decision` and uses the prior verdict. If it was NEEDS REVISION or
+ MAJOR REVISION NEEDED, say so plainly: the document has not changed since
+ it failed review — the prior findings stand; revising the document is the
+ next step, not re-reviewing it. Offer to display the prior findings from
+ the log.
+- **Only the registry line reads `CHANGED`** (doc `UNCHANGED`) — the prior
+ verdict stands except for cross-document facts: re-verify the doc's
+ registry-sourced values against the new registry and re-issue the verdict;
+ escalate to a full re-review only if a conflict appears.
+- **Target doc `CHANGED` or `NEW`, or `RECEIPT: NONE`** — proceed with the
+ full review below. **Do not offer a partial/delta re-review that skips
+ reading or re-analyzing unchanged sections.** Measured against a full review:
+ three independent designs (a straightforward section-scoped pass, one with
+ an explicit forced whole-document scan step, and one gated on a
+ genuinely thorough two-round prior review) each caught only 2 of 6 real
+ defects a full review found on the same document, and the most
+ careful version cost *more* tokens than the full review while catching
+ the same reduced fraction. "Unchanged since last review" only means
+ byte-identical to what was reviewed then — it says nothing about whether
+ that prior pass was itself complete, and no amount of "scan everything
+ anyway" instruction reliably overcame a model's attention naturally
+ narrowing to the flagged change.
+
+Read the target design document in full. Read CLAUDE.md to understand project context and standards.
+
+**For cross-document facts, prefer the registry over sibling GDDs.** If
+`design/registry/entities.yaml` exists **and lists entries for this system**,
+grep it — these are the established facts this GDD must not contradict, and they
+replace reading sibling GDDs to rediscover them:
+```
+Grep pattern="source: design/gdd/[system].md" path="design/registry/entities.yaml" output_mode="content" -A 6
+Grep pattern="design/gdd/[system].md" path="design/registry/entities.yaml" output_mode="content" -B 8
+```
+The first finds entries this system **owns** — the `-A 6` context includes their
+`referenced_by:` block. The second finds entries that **reference** this system —
+`referenced_by:` is a block sequence (the key and its paths are on separate
+lines), so match the path with `-B 8` context to see the owning entry, not a
+`referenced_by.*name` one-liner (which never matches the block form).
+
+**If `design/registry/entities.yaml` does not exist, or lists no entry for this
+system** — the file ships as an empty stub, so this is the default until
+`/design-system` has populated it — fall back to reading the related GDDs the
+target doc names in its Dependencies section. Bound the read to those, not to
+everything "implied". Do not glob-read all of `design/gdd/`.
**Dependency graph validation:** For every system listed in the Dependencies section, use Glob to check whether its GDD file exists in `design/gdd/`. Flag any that don't exist yet — these are broken references that downstream authors will hit.
@@ -33,16 +117,34 @@ Read the target design document in full. Read CLAUDE.md to understand project co
## Phase 2: Completeness Check
-Evaluate against the Design Document Standard checklist:
+**Step 2a — gather section presence deterministically (no document read):**
-- [ ] Has Overview section (one-paragraph summary)
-- [ ] Has Player Fantasy section (intended feeling)
-- [ ] Has Detailed Rules section (unambiguous mechanics)
-- [ ] Has Formulas section (all math defined with variables)
-- [ ] Has Edge Cases section (unusual situations handled)
-- [ ] Has Dependencies section (other systems listed)
-- [ ] Has Tuning Knobs section (configurable values identified)
-- [ ] Has Acceptance Criteria section (testable success conditions)
+```
+Bash: bash .claude/scripts/gdd-structure-check.sh [target-doc-path]
+```
+
+It prints a `PRESENT:` list and, when applicable, an `ABSENT:` list. It reports
+**presence only** and makes no REQUIRED/ADVISORY judgment — that is Step 2b's
+job. It already accepts `## Detailed Design` as satisfying the `Detailed Rules`
+requirement, so do not flag that as missing.
+
+**Step 2b — apply the tier.** Using the Step 2a lists, evaluate against the
+Design Document Standard checklist below. **Mark each section REQUIRED or
+ADVISORY per the resolved workflow tier (Phase 0).** A missing REQUIRED section
+blocks approval; a missing ADVISORY section is surfaced as a recommendation but
+does not block.
+
+A section reported PRESENT can still fail review if it is an empty heading —
+spot-read any section the verdict actually turns on.
+
+- [ ] Has Overview section (one-paragraph summary) — REQUIRED at all tiers
+- [ ] Has Player Fantasy section (intended feeling) — REQUIRED at `full`; ADVISORY at `standard`
+- [ ] Has Detailed Rules section (unambiguous mechanics) — REQUIRED at `full`/`standard`. The GDD template titles this section `## Detailed Design` (it carries Core Rules / States / Interactions sub-headings); accept **either** heading as satisfying this requirement — do not flag "Detailed Rules" as missing when a `## Detailed Design` section is present.
+- [ ] Has Formulas section (all math defined with variables) — REQUIRED at `full`; at `standard` REQUIRED whenever the system defines numeric rules (rates, curves, thresholds, costs, damage, drop weights), else ADVISORY. The system's `Category` is a hint, not the test — do not clear this on a category token alone
+- [ ] Has Edge Cases section (unusual situations handled) — REQUIRED at `full`/`standard`
+- [ ] Has Dependencies section (other systems listed) — REQUIRED at `full`/`standard`
+- [ ] Has Tuning Knobs section (configurable values identified) — REQUIRED at `full`; ADVISORY at `standard` unless `workflow_overrides.tuning_knobs`
+- [ ] Has Acceptance Criteria section (testable success conditions) — REQUIRED at `full`/`standard`
---
@@ -76,7 +178,7 @@ Evaluate against the Design Document Standard checklist:
### Step 1 — Identify all domains the GDD touches
-Read the GDD and identify every domain present. A GDD can touch multiple domains simultaneously — be thorough. Common signals:
+Using the GDD **already loaded in Phase 1** — do not re-read it — identify every domain present. A GDD can touch multiple domains simultaneously — be thorough. Common signals:
| If the GDD contains... | Spawn these agents |
|------------------------|-------------------|
@@ -91,7 +193,7 @@ Read the GDD and identify every domain present. A GDD can touch multiple domains
| Multiplayer, sync, replication | `network-programmer` |
| Audio cues, music triggers | `audio-director` |
| Performance, draw calls, memory | `performance-analyst` |
-| Engine-specific patterns or APIs | Primary engine specialist (from `.claude/docs/technical-preferences.md`) |
+| Engine-specific patterns or APIs | Primary engine specialist (`<engine>-specialist` from `engine.name` — Godot→`godot-specialist`, Unity→`unity-specialist`, Unreal→`unreal-specialist`; fall back to the Primary line of `## Engine Specialists` in `technical-preferences.md`) |
| Acceptance criteria, test coverage | `qa-lead` |
| Data schema, resource structure | `systems-designer` |
| Any gameplay system | `game-designer` (always) |
@@ -102,12 +204,12 @@ These are the most common baselines — but not required for pure UI specs, audi
### Step 2 — Spawn all relevant specialists in parallel
-**CRITICAL: Task in this skill spawns a SUBAGENT — a separate independent Claude session
+**CRITICAL: `Agent` in this skill spawns a SUBAGENT — a separate independent Claude session
with its own context window. It is NOT task tracking. Do NOT simulate specialist
perspectives internally. Do NOT reason through domain views yourself. You MUST issue
-actual Task calls. A simulated review is not a specialist review.**
+actual `Agent` calls. A simulated review is not a specialist review.**
-Issue all Task calls simultaneously. Do NOT spawn one at a time.
+Issue all `Agent` calls simultaneously. Do NOT spawn one at a time.
**Prompt each specialist adversarially:**
> "Here is the GDD for [system] and the main review's structural findings so far.
@@ -146,8 +248,18 @@ Mark every finding with its source: `[game-designer]`, `[economy-designer]`, `[c
Specialists consulted: [list agents spawned]
Re-review: [Yes — prior verdict was X on YYYY-MM-DD / No — first review]
-### Completeness: [X/8 sections present]
-[List missing sections]
+### Completeness: [X/N sections present, where N is the count REQUIRED at this project's `modes.workflow`]
+[List only sections missing that are REQUIRED at this tier. Mark ADVISORY gaps
+separately as "advisory at `standard`" — do not list them as missing.]
+
+> **N is not 8 unless `workflow: full`.** The tier table earlier in this skill is
+> authoritative: 8 required at `full`, 5 at `standard` (+ Formulas when the system
+> defines numeric rules), 0 at `minimal`. Hardcoding `/8` here
+> reintroduces the tier confusion in the presentation layer after the logic
+> layer already handles it — reporting a `standard` project as "5/8 missing Player
+> Fantasy, Formulas, Tuning Knobs" warns about three sections that project's own
+> configuration says it does not need, which trains the reader to ignore the
+> review.
### Dependency Graph
[List each declared dependency and whether its GDD file exists on disk]
@@ -179,7 +291,20 @@ systems touched, and whether new ADRs are required.
- **XL** — cross-cutting concern, 5+ dependencies, multiple new ADRs likely
Label clearly: "Rough scope signal: M (producer should verify before sprint planning)"
-### Verdict: [APPROVED / NEEDS REVISION / MAJOR REVISION NEEDED]
+### Verdict: [APPROVED / NEEDS REVISION / MAJOR REVISION NEEDED / NOT ASSESSED]
+
+> **`NOT ASSESSED` when the review could not actually be performed.**
+> The other three verdicts are all claims about the design's quality, so each one
+> asserts that the document was read and judged. Use `NOT ASSESSED` instead when
+> the target document is absent, unreadable, or empty of the sections being
+> reviewed, or when a document it depends on is missing so the criteria cannot be
+> applied. **Name what was unavailable and which skill produces it.**
+>
+> `APPROVED` is the dangerous default here: a review that could not find its
+> input has not approved anything, and this verdict is consumed downstream as a
+> sign-off. `NOT ASSESSED` outranks `APPROVED` in any aggregate — it does not
+> outrank the two revision verdicts, because a known problem is more actionable
+> than an unknown one.
```
This skill is read-only — no files are written during Phase 4.
@@ -213,7 +338,9 @@ After all revisions are complete, show a summary table (blocker → fix applied)
- `[C] Move to next system — /design-system [next-system] (#N in design order)`
- `[D] Stop here`
-Never end the revision flow with plain text. Always close with this widget.
+In collaborative and guided modes, never end the revision flow with plain text —
+always close with this widget. In autonomous mode, summarize the outcome and
+record via `log_decision`.
**Second widget — tracking records (combined, for APPROVED path):**
@@ -243,8 +370,26 @@ Specialists: [list]
Blocking items: [count] | Recommended: [count]
Summary: [2-3 sentence summary of key findings from creative-director verdict]
Prior verdict resolved: [Yes / No / First review]
+Findings:
+- [BLOCKING] [section]: [one-line finding]
+- [RECOMMENDED] [section]: [one-line finding]
+[output of: Bash: bash .claude/scripts/review-receipts.sh hash "[target-doc-path]" — plus "design/registry/entities.yaml" if the registry file exists]
```
+Findings rules: one line per finding, named by the section it lives in;
+write `- none` when the verdict carried no findings. This is documentation
+for a human reader of the revision history, not a mechanism the skill reads
+back — a delta re-review that skipped re-analyzing unchanged sections was
+tried and reverted (see Phase 1) after measuring it against a full review.
+
+The hash line is the receipt Phase 1 reads on the next run to detect a
+byte-identical re-review — the one form of skip that's actually safe,
+because the input is provably the same, not merely believed to be adequately
+covered by a prior pass. Always include it, whatever the verdict — an
+unchanged document that previously FAILED review is exactly the case where
+skipping a redundant re-review saves the most (the prior findings stand
+verbatim).
+
---
**Final closing widget — always show after all file writes complete:**
@@ -265,4 +410,6 @@ Build the option list dynamically — only include options that are genuinely ne
Assign letters A, B, C… only to included options. Mark the most pipeline-advancing option as `(recommended)`.
-Never end the skill with plain text after file writes. Always close with this widget.
+In collaborative and guided modes, never end the skill with plain text after
+file writes — always close with this widget. In autonomous mode, print the next
+step and record via `log_decision`.
diff --git a/.claude/skills/design-system/SKILL.md b/.claude/skills/design-system/SKILL.md
index 1250d3fa..0e510e3c 100644
--- a/.claude/skills/design-system/SKILL.md
+++ b/.claude/skills/design-system/SKILL.md
@@ -1,22 +1,39 @@
---
name: design-system
-description: "Guided, section-by-section GDD authoring for a single game system. Gathers context from existing docs, walks through each required section collaboratively, cross-references dependencies, and writes incrementally to file."
+description: "Section-by-section GDD authoring for one system — walks through each required section, cross-references dependencies."
argument-hint: "<system-name> [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,docs.density,system_overrides`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
When this skill is invoked:
## 1. Parse Arguments & Validate
-Resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
-See `.claude/docs/director-gates.md` for the full check pattern.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`docs.density`** — it controls per-section *depth*, where `workflow`
+controls which sections exist. `modes.rigor` sets both together; set
+`docs.density` explicitly to vary depth alone: `terse` = bullet points, 2–5 lines per section,
+skip rationale and preambles; `balanced` = paragraphs with light rationale
+(default); `thorough` = full prose with rationale, examples, and alternatives
+considered. Apply it to every section you author. Mandated structures (the
+Formulas variable table, Given-When-Then acceptance criteria) are correctness
+requirements at every density — `terse` trims the surrounding prose, never the
+required structure itself.
A system name or retrofit path is **required**. If missing:
@@ -35,9 +52,15 @@ If the argument starts with `retrofit` or the argument is a file path to an
existing `.md` file in `design/gdd/`, enter **retrofit mode**:
1. Read the existing GDD file.
-2. Identify which of the 8 required sections are present (scan for section headings).
- Required sections: Overview, Player Fantasy, Detailed Design/Rules, Formulas,
+2. Identify which of the 8 **possible** sections are present (scan for section
+ headings): Overview, Player Fantasy, Detailed Design/Rules, Formulas,
Edge Cases, Dependencies, Tuning Knobs, Acceptance Criteria.
+ **Which of them are *required* depends on the effective tier** (§1) — at
+ `standard` only 5 are, plus Formulas for math categories, and Player Fantasy
+ and Tuning Knobs are skipped **by design**. Report an absent section as a gap
+ only when the tier requires it; otherwise list it as available-to-add. Calling
+ all 8 required here reports two by-design-absent sections as gaps on every
+ `standard` project.
3. Identify which sections contain only placeholder text (`[To be designed]` or
equivalent — blank, a single line, or obviously incomplete).
4. Present to the user before doing anything:
@@ -64,6 +87,46 @@ existing `.md` file in `design/gdd/`, enter **retrofit mode**:
If NOT in retrofit mode, normalize the system name to kebab-case for the
filename (e.g., "combat system" becomes `combat-system`).
+**`workflow`** for this system (per `.claude/docs/workflow-modes.md`) — use the
+`system_overrides` row for this system if the block lists one, else the project
+value.
+
+The resolved tier determines which GDD sections are **required** (applied in §4).
+**`## Summary` is required at every tier and is not one of the 8** — §5-pre
+authors it unconditionally (*"This runs at every tier"*), but it appeared in none
+of the per-tier lists below, and these lists are what other skills and gates
+apply. A GDD checked against a tier list alone would pass with no Summary, the
+one section `/review-all-gdds` and the tiered-loading readers depend on. Read
+every list below as "`## Summary`, plus:".
+- `full` — all 8 sections
+- `standard` — Overview, Detailed Design, Edge Cases, Dependencies, Acceptance
+ Criteria (5 required); **Formulas conditional** — required when the system
+ **defines numeric rules**: rates, curves, thresholds, costs, damage, drop
+ weights, or any value a balance pass would tune. Optional only when the system
+ defines no such value. **The `Category` in `systems-index.md` is a hint, not
+ the test** — `Gameplay`, `Economy` and `Progression` systems almost always
+ qualify, and a `Core`, `UI` or `Persistence` system that defines a numeric rule
+ qualifies too. If the Detailed Design states a quantity that is not a constant
+ of the engine, Formulas is required. **Player Fantasy and Tuning Knobs skipped**
+ unless `workflow_overrides` force them (`tuning_knobs: true` forces Tuning Knobs)
+
+ > **Do not gate this on a category token.** A rule of the form "required when
+ > the system category is combat / economy / progression / AI" does not work:
+ > those four tokens are not what `/map-systems` writes — `templates/systems-index.md`
+ > defines the categories as `Core · Gameplay · Progression · Economy ·
+ > Persistence · UI · Audio · Narrative · Meta` and lists **combat and AI as
+ > example systems under `Gameplay`**. A combat system categorised exactly as the
+ > template instructs matches none of the four, and Formulas would be dropped for
+ > the system most likely to need it.
+- `minimal` — a GDD is not required (the game brief replaces it). If invoked
+ voluntarily at minimal, author exactly the 5 standard sections (Overview,
+ Detailed Design, Edge Cases, Dependencies, Acceptance Criteria) — the
+ conditional Formulas rule does NOT re-apply at minimal — and tell the user
+ the GDD is optional at this workflow level.
+
+Retrofit mode is unaffected — it fills whatever sections are missing regardless
+of tier.
+
---
## 2. Gather Context (Read Phase)
@@ -73,6 +136,48 @@ primary advantage over ad-hoc design — it arrives informed.
### 2a: Required Reads
+> **At `minimal`** (design-system is voluntary at this tier): read
+> `design/game-brief.md` in place of the game concept, and **skip the systems-index
+> read** — neither `game-concept.md` nor `systems-index.md` exists at `minimal`.
+> Author from the brief's relevant MVP feature and its core loop.
+>
+> **This callout keys on the PROJECT tier, not this system's effective tier.**
+> The two differ whenever `workflow_overrides.system_overrides` bumps one system
+> above a `minimal` project — the configuration `.claude/docs/settings-guidance.md`
+> advertises as the reason the override exists ("bump one deep system"). Those two
+> files are absent because the *project* is `minimal`; raising *this system* to
+> `standard` or `full` does not create them. So on a `minimal` project, take this
+> branch **even for an overridden system**, and read the brief.
+>
+> The effective tier still governs everything downstream — the required section
+> set (§1), the skeleton (§3), the section cycle (§4) and §5a. Only the
+> required-*reads* branch here follows the project tier.
+>
+> **Then derive `Category`, `Layer` and `Priority` from the brief, once, here.**
+> Six later steps are keyed on the systems index you just skipped — §2e's engine
+> domain, Section A's and Section B's recommended options, the Visual/Audio
+> REQUIRED table, §6 specialist routing, and §5-pre's Quick reference — and none
+> of them has an absent-index branch. An overridden system reaches all six at
+> `standard` or `full`, so "skip the index" leaves them with no input at all.
+> Derive from the brief instead:
+>
+> - **`Category`** — one of the nine in `templates/systems-index.md`
+> (`Core · Gameplay · Progression · Economy · Persistence · UI · Audio ·
+> Narrative · Meta`), chosen from what the brief says the system *does*.
+> - **`Layer`** — `Foundation` if other systems depend on it, else `Feature`.
+> - **`Priority`** — `MVP` if the brief's build order lists it, else `Post-MVP`.
+>
+> Carry all three for the rest of the run and treat them as the index's answer.
+> **Mark them inferred** in §5-pre's Quick reference (*"Category: Gameplay
+> (inferred from the brief — no systems index at this tier)"*) so a later reader
+> does not mistake a derivation for an indexed fact. Do **not** write a systems
+> index to hold them: `/map-systems` owns that file (§5d).
+>
+> Read literally without this rule, an overridden system resolves to `full`, falls
+> through to the fail-fast reads below, and aborts with *"No game concept found.
+> Run `/brainstorm` first"* — killing the escape hatch on step one of the very
+> configuration it was built for.
+
- **Game concept**: Read `design/gdd/game-concept.md` — fail if missing:
> "No game concept found. Run `/brainstorm` first."
- **Systems index**: Read `design/gdd/systems-index.md` — fail if missing:
@@ -94,25 +199,36 @@ primary advantage over ad-hoc design — it arrives informed.
### 2b: Dependency Reads
From the systems index, identify:
-- **Upstream dependencies**: Systems this one depends on. Read their GDDs if they
- exist (these contain decisions this system must respect).
-- **Downstream dependents**: Systems that depend on this one. Read their GDDs if
- they exist (these contain expectations this system must satisfy).
+- **Upstream dependencies**: Systems this one depends on (decisions this system
+ must respect).
+- **Downstream dependents**: Systems that depend on this one (expectations this
+ system must satisfy).
-For each dependency GDD that exists, extract and hold in context:
-- Key interfaces (what data flows between the systems)
+For each dependency GDD that exists, read **only the four sections that carry the
+cross-system contract** — not the whole GDD:
+```
+Grep pattern="## (Dependencies|Formulas|Edge Cases|Tuning Knobs)" glob="design/gdd/[dep].md" output_mode="content" -A 20
+```
+- Key interfaces and data flow (from Dependencies)
- Formulas that reference this system's outputs
- Edge cases that assume this system's behavior
- Tuning knobs that feed into this system
+Much of this is already in `entities.yaml` (loaded in 2a) — the registry's
+`formula_map`/`constant_map` carry the owned values with their `source:`. Use the
+registry first; the section grep fills what it does not hold.
+
### 2c: Optional Reads
- **Game pillars**: Read `design/gdd/game-pillars.md` if it exists
- **Existing GDD**: Read `design/gdd/[system-name].md` if it exists (resume, don't
restart from scratch)
-- **Related GDDs**: Glob `design/gdd/*.md` and read any that are thematically related
- (e.g., if designing a system that overlaps with another in scope, read the related GDD
- even if it's not a formal dependency)
+- **Related systems**: do **not** glob-and-read `design/gdd/*.md` hunting for
+ "thematically related" systems — there is no deterministic proxy for that and it
+ is the read the registry exists to replace. `entities.yaml` (2a) already holds
+ the cross-system facts a related GDD would supply. If a specific overlap is
+ known, treat it as a dependency above and section-grep it; otherwise rely on the
+ registry.
### 2d: Present Context Summary
@@ -147,26 +263,55 @@ constraints or knowledge gaps that will shape the design.
**Step 1 — Determine the engine domain for this system:**
Map the system's category (from systems-index.md) to an engine domain:
-| System Category | Engine Domain |
-|----------------|--------------|
-| Combat, physics, collision | Physics |
-| Rendering, visual effects, shaders | Rendering |
-| UI, HUD, menus | UI |
-| Audio, sound, music | Audio |
-| AI, pathfinding, behavior trees | Navigation / Scripting |
-| Animation, IK, rigs | Animation |
-| Networking, multiplayer, sync | Networking |
-| Input, controls, keybinding | Input |
-| Save/load, persistence, data | Core |
-| Dialogue, quests, narrative | Scripting |
+Keyed on the `Category` column of `systems-index.md`. All nine categories
+`templates/systems-index.md` defines appear here; where a category spans several
+engine domains, pick the row matching what the system actually does and say
+which you picked.
+
+| `Category` | Engine Domain |
+|-----------|--------------|
+| `Gameplay` | **Physics** for combat / collision / movement; **Navigation** for AI and pathfinding; **Scripting** for rule-only systems with no engine surface |
+| `Core` | **Core** — scene management, state, resource loading; **Input** for controls and keybinding |
+| `UI` | UI |
+| `Audio` | Audio |
+| `Narrative` | Scripting — dialogue, quests, cutscenes |
+| `Progression` | Scripting — save-adjacent rule logic, no dedicated domain |
+| `Economy` | Scripting — data and rule logic, no dedicated domain |
+| `Persistence` | Core — save/load, settings, serialization |
+| `Meta` | Core — analytics, tutorials, accessibility plumbing |
+
+> Animation, Rendering and Networking are engine domains with no category of
+> their own: a system needing them will be `Gameplay` or `Core`. Name the domain
+> you read the reference for, whichever row you came in on.
**Step 2 — Read engine context (if available):**
-- Read `.claude/docs/technical-preferences.md` to identify the engine and version
+- Identify the engine and version: read `engine.name` and `engine.version` from `project.yaml`. Resolve each field independently — if its key is absent or empty (including when `project.yaml` has no `engine:` block), fall back to `.claude/docs/technical-preferences.md` (a `[TO BE CONFIGURED]` value means not set)
- If engine is configured, read `docs/engine-reference/[engine]/VERSION.md`
-- Read `docs/engine-reference/[engine]/modules/[domain].md` if it exists
+- Read `docs/engine-reference/[engine]/modules/[domain].md` if it exists.
+ **If it does not exist, say so by name** — *"no engine reference for `[domain]`
+ under `docs/engine-reference/[engine]/modules/`; feasibility not checked against
+ the pinned engine"* — and carry that into §5-pre. A silent skip here is
+ indistinguishable from a feasibility check that ran and found nothing wrong,
+ which is the failure `.claude/rules/skill-authoring.md` obligation 3 exists to
+ stop.
+
+ > **This is not a rare branch.** The domain table above names `Scripting` and
+ > `Core` for five of the nine categories (`Narrative`, `Progression`, `Economy`
+ > → Scripting; `Persistence`, `Meta` → Core), plus a sub-row each under
+ > `Gameplay` and `Core`. The Godot reference ships `animation, audio, input,
+ > navigation, networking, physics, rendering, ui` — **there is no
+ > `scripting.md` and no `core.md`**. So the majority of non-`Gameplay` systems
+ > hit the absent branch every time, and `if it exists` turned that into
+ > silence. Either the reference gains those two files or the check reports it;
+ > until the former, do the latter.
- Read `docs/engine-reference/[engine]/breaking-changes.md` for domain-relevant entries
-- Glob `docs/architecture/adr-*.md` and read any ADRs whose domain matches
- (check the Engine Compatibility table's "Domain" field)
+- Find the domain-matching ADRs without reading every ADR to learn the field you
+ filter on — grep the Domain field first, then read only the matches:
+ ```
+ Grep pattern="\*\*Domain\*\*" glob="docs/architecture/adr-*.md" output_mode="content"
+ ```
+ Read only the ADRs whose Domain matches this system's category (its `## Decision`
+ and `## Engine Compatibility` sections); skip the rest.
**Step 3 — Present the Feasibility Brief:**
@@ -215,6 +360,18 @@ Use `AskUserQuestion`:
Once the user confirms, **immediately** create the GDD file with empty section
headers. This ensures incremental writes have a target.
+**Scaffold only the sections required at the resolved tier** (§1): at
+`standard`, omit Player Fantasy and Tuning Knobs (and Formulas only when the
+system defines no numeric rule — see §1; the category is a hint, not the test);
+at `full`, scaffold all 8.
+**Only the sections §1 named as omitted are skipped** — do not leave empty
+`[To be designed]` placeholders for those. Every other section in the template
+is scaffolded with its placeholder, including the ones §4 has not decided yet.
+This sentence governs the three tier omissions above (Player Fantasy, Tuning
+Knobs, and Formulas when no numeric rule exists) and nothing else: it is not a
+licence to strip a section because it looks optional, and §4 cannot fill a
+section §3 never created.
+
Use the template structure from `.claude/docs/templates/game-design-document.md`:
```markdown
@@ -223,8 +380,15 @@ Use the template structure from `.claude/docs/templates/game-design-document.md`
> **Status**: In Design
> **Author**: [user + agents]
> **Last Updated**: [today's date]
+> **Last Verified**: [today's date]
> **Implements Pillar**: [from context]
+## Summary
+
+[To be designed]
+
+> **Quick reference** — Layer: `[Foundation | Core | Feature | Presentation]` · Priority: `[MVP | Vertical Slice | Alpha | Full Vision]` · Key deps: `[System names or "None"]`
+
## Overview
[To be designed]
@@ -267,10 +431,18 @@ Use the template structure from `.claude/docs/templates/game-design-document.md`
[To be designed]
+## Game Feel
+
+[To be designed]
+
## UI Requirements
[To be designed]
+## Cross-References
+
+[To be designed]
+
## Acceptance Criteria
[To be designed]
@@ -280,6 +452,15 @@ Use the template structure from `.claude/docs/templates/game-design-document.md`
[To be designed]
```
+> **This skeleton and the template must stay identical in section set and
+> order.** They diverged once and it was invisible: the skeleton omitted
+> `## Game Feel` and `## Cross-References`, so §3's own rule — *"§4 cannot fill a
+> section §3 never created"* — made both unreachable **at every tier, `full`
+> included**, while §3's prose above still said *"every other section in the
+> template is scaffolded"*. Two agents authoring a combat GDD noticed the gap
+> only by opening the template. If you add a section to one file, add it to the
+> other in the same commit.
+
Ask: "May I create the skeleton file at `design/gdd/[system-name].md`?"
If the user declines: Stop with the following message:
@@ -300,7 +481,16 @@ File content:
## 4. Section-by-Section Design
-Walk through each section in order. For **each section**, follow this cycle:
+**Author only the sections required at the resolved tier** (§1). At `standard`,
+the walk covers A (Overview), C (Detailed Design), E (Edge Cases),
+F (Dependencies), H (Acceptance Criteria) — plus D (Formulas) when the system
+defines numeric rules (see §1; the category is a hint, not the test); skip B (Player Fantasy) and
+G (Tuning Knobs) unless `workflow_overrides.tuning_knobs: true` forces G. At
+`full`, walk all eight (A–H). At `minimal`, the GDD is optional — if authoring
+voluntarily, walk the standard set. Any `system_overrides.<system>` tier was
+already folded into the resolved tier in §1.
+
+Walk through each required section in order. For **each section**, follow this cycle:
### The Section Cycle
@@ -324,14 +514,26 @@ Context -> Questions -> Options -> Decision -> Draft -> Approval ->
5. **Draft**: Write the section content in conversation text for review. Flag any
provisional assumptions about undesigned dependencies.
-6. **Approval**: Immediately after the draft — in the SAME response — use
- `AskUserQuestion`. **NEVER use plain text. NEVER skip this step.**
+6. **Approval**: Per the resolved `modes.automation` mode
+ (`.claude/docs/automation-modes.md`):
+
+ **In `collaborative` mode**: Immediately after the draft — in the SAME
+ response — use `AskUserQuestion`. **NEVER use plain text. NEVER skip
+ this step.**
- Prompt: "Approve the [Section Name] section?"
- Options: `[A] Approve — write it to file` / `[B] Make changes — describe what to fix` / `[C] Start over`
**The draft and the approval widget MUST appear together in one response.
If the draft appears without the widget, the user is left at a blank prompt
- with no path forward — this is a protocol violation.**
+ with no path forward — this is a protocol violation in collaborative mode.**
+
+ **In `guided` mode**: Write the section immediately after the draft with
+ a brief one-line summary of what was decided. Skip the per-section widget;
+ the multi-section authoring rule (no per-section confirmation) applies.
+
+ **In `autonomous` mode**: Write the section directly and call
+ `log_decision` with `Decision point: Approve [Section Name] section`,
+ `Chosen: [A] Approve`, `Category: minor`.
7. **Write**: Use the Edit tool to replace the placeholder with the approved content.
**CRITICAL**: Always include the section heading in the `old_string` to ensure
@@ -369,7 +571,7 @@ Each section has unique design considerations and may benefit from specialist ag
**Goal**: One paragraph a stranger could read and understand.
**Derive recommended options before building the widget**: Read the system's category and layer from the systems index (already in context from Phase 2), then determine the recommended option for each tab:
-- **Framing tab**: Foundation/Infrastructure layer → `[A]` recommended. Player-facing categories (Combat, UI, Dialogue, Character, Animation, Visual Effects, Audio) → `[C] Both` recommended.
+- **Framing tab**: keyed on the `Category` column (`Core · Gameplay · Progression · Economy · Persistence · UI · Audio · Narrative · Meta`). Player-facing — `Gameplay`, `UI`, `Audio`, `Narrative` → `[C] Both` recommended. Internal — `Core`, `Persistence`, `Meta` → `[A]` recommended. Mixed — `Economy`, `Progression` → `[C] Both`. **Tiebreak, when Layer and Category disagree** (a `Foundation`-layer `Gameplay` system is the common case): **Category wins** — the framing describes what the section is *about*, and a player-facing system stays player-facing wherever it sits in the dependency graph.
- **ADR ref tab**: Glob `docs/architecture/adr-*.md` and grep for the system name in the GDD Requirements section of any ADR. If a matching ADR is found → `[A] Yes — cite the ADR` recommended. If none found → `[B] No` recommended.
- **Fantasy tab**: Foundation/Infrastructure layer → `[B] No` recommended. All other categories → `[A] Yes` recommended.
@@ -380,7 +582,12 @@ Append `(Recommended)` to the appropriate option text in each tab.
- Tab "ADR ref" — "Should the overview reference the existing ADR for this system?" Options: `[A] Yes — cite the ADR for implementation details` / `[B] No — keep the GDD at pure design level`
- Tab "Fantasy" — "Does this system have a player fantasy worth stating?" Options: `[A] Yes — players feel it directly` / `[B] No — pure infrastructure, players feel what it enables`
-Use the user's answers to shape the draft. Do NOT answer these questions yourself and auto-draft.
+Use the answers to shape the draft. **In `collaborative` mode, do NOT answer
+these questions yourself and auto-draft** — the widget must appear. In `guided`
+and `autonomous`, this is a MINOR framing decision: select the recommended
+option derived above, state it in one line, and proceed (that is the whole
+point of pre-deriving recommendations). Applies to every "ask BEFORE drafting"
+widget in this section walk, not just this one.
**Questions to ask**:
- What is this system in one sentence?
@@ -404,9 +611,13 @@ describes the technical approach used to achieve it.
**Goal**: The emotional target — what the player should *feel*.
**Derive recommended option before building the widget**: Read the system's category and layer from Phase 2 context:
-- Player-facing categories (Combat, UI, Dialogue, Character, Animation, Audio, Level/World) → `[A] Direct` recommended
-- Foundation/Infrastructure layer → `[B] Indirect` recommended
-- Mixed categories (Camera/input, Economy, AI with visible player effects) → `[C] Both` recommended
+Keyed on the `Category` column (`Core · Gameplay · Progression · Economy · Persistence · UI · Audio · Narrative · Meta`):
+- Player-facing — `Gameplay`, `UI`, `Audio`, `Narrative` → `[A] Direct` recommended
+- Internal — `Core`, `Persistence`, `Meta` → `[B] Indirect` recommended
+- Mixed — `Economy`, `Progression` → `[C] Both` recommended
+
+**When Layer and Category disagree, Category wins** — same tiebreak as the
+Framing tab above.
Append `(Recommended)` to the appropriate option text.
@@ -430,7 +641,7 @@ quote the relevant pillar text.
- `full` → spawn as described below.
**Agent delegation (MANDATORY)**: After the framing answer is given but before drafting,
-spawn `creative-director` via Task:
+spawn `creative-director` via `Agent`:
- Provide: system name, framing answer (direct/indirect/both), game pillars, any reference games the user mentioned, the game concept summary
- Ask: "Shape the Player Fantasy for this system. What emotion or power fantasy should it serve? What player moment should we anchor to? What tone and language fits the game's established feeling? Be specific — give me 2-3 candidate framings."
- Collect the creative-director's framings and present them to the user alongside the draft.
@@ -464,7 +675,7 @@ This is usually the largest section. Break it into sub-sections:
- `lean` → skip unless this is a section with HIGH implementation risk (Sections D and H only). For other sections, draft without the agent.
- `full` → spawn as described below.
-**Agent delegation (MANDATORY)**: Before drafting Section C, spawn specialist agents via Task in parallel:
+**Agent delegation (MANDATORY)**: Before drafting Section C, spawn specialist agents via `Agent` in parallel:
- Look up the system category in the routing table (Section 6 of this skill)
- Spawn the Primary Agent AND Supporting Agent(s) listed for this category
- Provide each agent: system name, game concept summary, pillar set, dependency GDD excerpts, the specific section being worked on
@@ -493,9 +704,9 @@ The [formula_name] formula is defined as:
`[formula_name] = [expression]`
**Variables:**
-| Variable | Symbol | Type | Range | Description |
-|----------|--------|------|-------|-------------|
-| [name] | [sym] | float/int | [min–max] | [what it represents] |
+| Variable | Type | Range | Source | Description |
+|----------|------|-------|--------|-------------|
+| [name] | float/int | [min–max] | data file / calculated / constant | [what it represents] |
**Output Range:** [min] to [max] under normal play; [behaviour at extremes]
**Example:** [worked example with real numbers]
@@ -504,6 +715,16 @@ The [formula_name] formula is defined as:
Do NOT write `[Formula TBD]` or describe a formula in prose without the variable
table. A formula without defined variables cannot be implemented without guesswork.
+> **These columns must match `templates/game-design-document.md` exactly.** They
+> did not: this block said `Symbol` where the template says `Source`, so a
+> correctly-authored GDD was wrong against whichever of the two its reader
+> happened to hold. `Source` is the column that stays, because it is what carries
+> the coding-standards rule *"gameplay values must be data-driven (external
+> config), never hardcoded"* into the design document — a variable marked
+> `data file` is a tuning knob, one marked `constant` is a deliberate exception,
+> and the distinction is invisible under a `Symbol` column. Put a symbol, where
+> one helps, in the expression itself.
+
**Questions to ask**:
- What are the core calculations this system performs?
- Should scaling be linear, logarithmic, or stepped?
@@ -514,7 +735,7 @@ table. A formula without defined variables cannot be implemented without guesswo
- `lean` → skip unless this is a section with HIGH implementation risk (Sections D and H only). For other sections, draft without the agent.
- `full` → spawn as described below.
-**Agent delegation (MANDATORY)**: Before proposing any formulas or balance values, spawn specialist agents via Task in parallel:
+**Agent delegation (MANDATORY)**: Before proposing any formulas or balance values, spawn specialist agents via `Agent` in parallel:
- **Always spawn `systems-designer`**: provide Core Rules from Section C, tuning goals from user, balance context from dependency GDDs. Ask them to propose formulas with variable tables and output ranges.
- **For economy/cost systems, also spawn `economy-designer`**: provide placement costs, upgrade cost intent, and progression goals. Ask them to validate cost curves and ratios.
- Present the specialists' proposals to the user for review via `AskUserQuestion`
@@ -551,7 +772,7 @@ design question, not a specification.
- `lean` → skip unless this is a section with HIGH implementation risk (Sections D and H only). For other sections, draft without the agent.
- `full` → spawn as described below.
-**Agent delegation (MANDATORY)**: Spawn `systems-designer` via Task before finalising edge cases. Provide: the completed Sections C and D, and ask them to identify edge cases from the formula and rule space that the main session may have missed. For narrative systems, also spawn `narrative-director`. Present their findings and ask the user which to include.
+**Agent delegation (MANDATORY)**: Spawn `systems-designer` via `Agent` before finalising edge cases. Provide: the completed Sections C and D, and ask them to identify edge cases from the formula and rule space that the main session may have missed. For narrative systems, also spawn `narrative-director`. Present their findings and ask the user which to include.
**Cross-reference**: Check edge cases against dependency GDDs. If a dependency
defines a floor, cap, or resolution rule that this system could violate, flag it.
@@ -584,9 +805,20 @@ system]". Flag any one-directional dependencies for correction.
- For each knob, what breaks if it's set too high? Too low?
- Which knobs interact with each other? (Changing A makes B irrelevant)
+**Review mode check** (apply before spawning):
+- `solo` → skip this agent spawn. Derive the knobs from Section D's variable table yourself. Add a note: "`systems-designer` not consulted — Solo mode. Review manually before production."
+- `lean` → skip unless Section D defines a formula whose knobs interact (changing one makes another inert).
+- `full` → delegate as described below.
+
**Agent delegation**: If formulas are complex, delegate to `systems-designer`
to derive tuning knobs from the formula variables.
+> The guard above was missing here while Sections B, C, D, E and H all carried
+> one — and this delegation names `systems-designer`, the same agent Section D's
+> guard has already told a `solo` run to skip. Read without it, `solo` skips the
+> specialist for the formulas and then consults it for the knobs derived from
+> those same formulas.
+
**Cross-reference**: If a dependency GDD lists tuning knobs that affect this system,
reference them here. Don't create duplicate knobs — point to the source of truth.
@@ -607,12 +839,30 @@ Include at least: one criterion per core rule from Section C, and one per formul
from Section D. Do NOT write "the system works as designed" — every criterion must
be independently verifiable by a QA tester without reading the GDD.
+> **When Section D was not authored** (Formulas optional at this tier because the
+> system defines no numeric rule), there are no formulas to cover and the
+> criteria come from Section C alone — say so in one line rather than silently
+> writing fewer criteria. **If Section D was skipped but Section C states a
+> quantity** — a rate, threshold, cost or curve — that is the §1 test being met
+> after the fact: stop, tell the user Formulas is required for this system, and
+> author it before finalising the criteria. A criterion cannot verify a number
+> the GDD never defines.
+>
+> **That escalation applies at `standard` only.** It re-runs §1's *conditional*
+> Formulas test, and §1 disables that conditional at `minimal` outright — *"the
+> conditional Formulas rule does NOT re-apply at minimal"*. At `minimal` a
+> Section C quantity is expected and does **not** pull Formulas back in: state
+> the value inline in Core Rules so it stays implementable, and move on. At
+> `full`, Section D is unconditionally required, so the case cannot arise. Read
+> without this scope, the two rules contradict each other for any `minimal`
+> system that defines a rate — which is most of them.
+
**Review mode check** (apply before spawning):
- `solo` → skip this agent spawn. Draft the section without the specialist. Add a note: "`qa-lead` not consulted — Solo mode. Review manually before production."
- `lean` → skip unless this is a section with HIGH implementation risk (Sections D and H only). For other sections, draft without the agent.
- `full` → spawn as described below.
-**Agent delegation (MANDATORY)**: Spawn `qa-lead` via Task before finalising acceptance criteria. Provide: the completed GDD sections C, D, E, and ask them to validate that the criteria are independently testable and cover all core rules and formulas. Surface any gaps or untestable criteria to the user.
+**Agent delegation (MANDATORY)**: Spawn `qa-lead` via `Agent` before finalising acceptance criteria. Provide: the completed GDD sections C, D, E, and ask them to validate that the criteria are independently testable and cover all core rules and formulas. Surface any gaps or untestable criteria to the user.
**Questions to ask**:
- What's the minimum set of tests that prove this works?
@@ -624,27 +874,91 @@ not just this system in isolation.
---
-### Optional Sections: Visual/Audio, UI Requirements, Open Questions
+### Optional Sections: Visual/Audio, Game Feel, UI Requirements, Cross-References, Open Questions
+
+These five are the template sections that are **not** among §1's eight. They are
+governed here, not by the tier: §1's per-tier lists decide the *required* set,
+and this block decides the rest independently. Adding a section here therefore
+never changes a tier's section count.
-These sections are included in the template. Visual/Audio is **REQUIRED** for visual system categories — not optional. Determine the requirement level before asking:
+Visual/Audio and Game Feel are **REQUIRED** for some categories — not optional.
+Determine the requirement level before asking:
-**Visual/Audio is REQUIRED (mandatory — do not offer to skip) for these system categories:**
-- Combat, damage, health
-- UI systems (HUD, menus)
-- Animation, character movement
-- Visual effects, particles, shaders
-- Character systems
-- Dialogue, quests, lore
-- Level/world systems
+**Keyed on the `Category` column of `systems-index.md`** — the nine values
+`templates/systems-index.md` defines. Every one of the nine appears below
+exactly once, so nothing falls through:
-For required systems: **spawn `art-director` via Task** before drafting this section. Provide: system name, game concept, game pillars, art bible sections 1–4 if they exist. Ask them to specify: (1) VFX and visual feedback requirements for this system's events, (2) any animation or visual style constraints, (3) which art bible principles most directly apply to this system. Present their output; do NOT leave this section as `[To be designed]` for visual systems.
+**Visual/Audio is REQUIRED (mandatory — do not offer to skip) for:**
+- `Gameplay` — combat, AI, stealth, movement, interaction: everything the player
+ sees resolve
+- `UI` — HUD, menus, inventory screens, dialogue UI
+- `Narrative` — dialogue, quests, cutscenes, lore delivery
+- `Audio` — by definition
-For **all other system categories** (Foundation/Infrastructure, Economy, AI/pathfinding, Camera/input), offer the optional sections after the required sections:
+> **`Gameplay` is the row this table was missing.** It is the category
+> `/map-systems` assigns to combat, AI and movement — the largest bucket in most
+> action games. If it appears in **neither** this list nor the "all other" list
+> below, the skill has no defined behaviour for it and the author has to guess.
+> All nine categories must be covered between the two lists.
+
+For required systems: **spawn `art-director` via `Agent`** before drafting this section. Provide: system name, game concept, game pillars, art bible sections 1–4 if they exist. Ask them to specify: (1) VFX and visual feedback requirements for this system's events, (2) any animation or visual style constraints, (3) which art bible principles most directly apply to this system. Present their output; do NOT leave this section as `[To be designed]` for visual systems.
+
+**Review mode check** (apply before spawning):
+- `solo` → skip this agent spawn. Draft the section without the specialist. Add a note: "`art-director` not consulted — Solo mode. Review manually before production."
+- `lean` → skip unless this system's visual feedback is central to it (a `Gameplay` or `UI` system whose events the player reads to play). Otherwise draft without the agent.
+- `full` → spawn as described above.
+
+> Sections B, C, D, E and H each carry this block and this spawn did not, while
+> being worded as mandatory (*"do NOT leave this section as `[To be designed]`"*).
+> Two agents in `solo` skipped it anyway, on the strength of the other five, and
+> both flagged the guess. `director-gates.md`'s *"solo → no director gates
+> anywhere"* governs director **gates**, not specialist spawns, so it did not
+> settle it — this block does.
+
+**Game Feel is REQUIRED (mandatory — do not offer to skip) for `Gameplay` and
+`UI`** — the categories whose systems the player directly operates, where
+responsiveness, weight and snap are design targets rather than polish. It is
+optional for the other seven. The template argues the point itself: feel *"drives
+animation budgets, input handling architecture, and hitbox timing. Retrofitting
+feel targets after implementation is expensive."*
+
+**Cross-References is REQUIRED whenever the Dependencies section names another
+GDD.** The rule is derived, not category-keyed: if this document references
+another system's mechanic, value or rule anywhere, that reference belongs in the
+table. Where Dependencies names nothing, write *"None — this system references no
+other GDD"* rather than leaving the placeholder. `/review-all-gdds` Phase 2c
+reads this table when it exists.
+
+For the remaining five categories — `Core`, `Progression`, `Economy`,
+`Persistence`, `Meta` — Visual/Audio is optional: offer the optional sections
+after the required sections.
+
+> **At `minimal`, force nothing.** §1 says a voluntary `minimal` GDD is *"exactly
+> the 5 standard sections"*, which contradicts a category rule that makes
+> Visual/Audio or Game Feel mandatory. §1 wins: at `minimal` both drop to
+> optional and the whole set goes through the widget below. The contradiction is
+> real — an agent authoring a `minimal` inventory GDD hit it and had to choose.
Use `AskUserQuestion`:
-- "The 8 required sections are complete. Do you want to also define Visual/Audio
- requirements, UI requirements, or capture open questions?"
- - Options: "Yes, all three", "Just open questions", "Skip — I'll add these later"
+- "The required sections for this workflow tier are complete. Which of the
+ remaining template sections do you want to define?"
+ - Options: "All of them", "Just Cross-References and open questions", "Skip — I'll add these later"
+ - List in the question only the ones still outstanding: Visual/Audio, Game
+ Feel, UI Requirements, Cross-References, Open Questions **minus** any this
+ system's category or dependencies already made mandatory above. Offering to
+ skip a section the rules just made required is how a mandatory section gets
+ skipped.
+ - **Recommended option**: "All of them" when the system has any dependency,
+ UI surface or player-facing feedback; "Just Cross-References and open
+ questions" otherwise. `autonomous` needs a marked recommendation to pick —
+ the three options previously carried none, unlike the Section A/B widgets,
+ so an unattended run had nothing to choose by and defaulted to skipping.
+
+ Do **not** state a section count here. The required set is tier-dependent
+ (§1: 8 at `full`, 5 + conditional Formulas at `standard`, 5 at a voluntary
+ `minimal`), so the previous hardcoded "8 required sections are complete" was
+ false on every run below `full` — it told a `standard`-tier user that 8
+ sections existed when 6 had been authored.
For **Visual/Audio** (non-required systems): Coordinate with `art-director` and `audio-director` if detail is needed. Often a brief note suffices at the GDD stage.
@@ -672,11 +986,35 @@ fully resolved. Each question should have an owner and target resolution date.
After all sections are written:
+### 5-pre: Author the Summary
+
+Write `## Summary` and its `> **Quick reference**` line now — after the design
+exists, so the summary distils real content rather than intentions. This runs
+**at every tier**, including `standard` and a voluntary `minimal` GDD: the
+Summary is what lets a later skill scan 20 GDDs and decide which to read in full
+(`/create-epics`, `/architecture-review`, `/review-all-gdds` all grep it), so a
+GDD without it silently forces those consumers back to full reads.
+
+- **Summary body**: 2–3 sentences — what this system is, what it does for the
+ player, why it exists in this game. No jargon; a reader who has not seen the
+ GDD should learn whether it is relevant to their task.
+- **Quick reference**: `Layer` and `Priority` from the systems index
+ (`design/gdd/systems-index.md`); `Key deps` from the Dependencies section just
+ written (system names, or `None`).
+
+Replace the `[To be designed]` Summary placeholder in the skeleton. Then apply
+the section cycle's Write step as for any other section.
+
### 5a: Self-Check
Read back the complete GDD from file (not from conversation memory — the file is
the source of truth). Verify:
-- All 8 required sections have real content (not placeholders)
+- The `## Summary` and its Quick reference are populated (not the placeholder)
+- Every section **required at this system's effective tier** has real content
+ (not placeholders) — §1: 8 at `full`, 5 + conditional Formulas at `standard`,
+ 5 at a voluntary `minimal`. Do not verify against a fixed count of 8: below
+ `full` that reports a correctly-authored GDD as incomplete, which is the same
+ error already corrected in the optional-sections prompt above
- Formulas reference defined variables
- Edge cases have resolutions
- Dependencies are listed with interfaces
@@ -689,7 +1027,7 @@ the source of truth). Verify:
- `lean` → skip (not a PHASE-GATE). Note: "CD-GDD-ALIGN skipped — Lean mode." Proceed to Step 5b.
- `full` → spawn as normal.
-Before finalizing the GDD, spawn `creative-director` via Task using gate **CD-GDD-ALIGN** (`.claude/docs/director-gates.md`).
+Before finalizing the GDD, spawn `creative-director` via `Agent` using gate **CD-GDD-ALIGN** (`.claude/docs/director-gates/cd-gdd-align.md`).
Pass: completed GDD file path, game pillars (from `design/gdd/game-concept.md` or `design/gdd/game-pillars.md`), MDA aesthetics target.
@@ -706,7 +1044,27 @@ Scan the completed GDD for cross-system facts that should be registered:
- Named formulas with defined variables and output ranges
- Named constants referenced by value in more than one place
-For each candidate, check if it already exists in `design/registry/entities.yaml`:
+**First check the registry exists** — §2a reads it *"if it exists"*, and this
+step never carried the same guard. At `standard` and below the file is often
+absent, and a grep against a missing path returns nothing, which is
+indistinguishable from "no candidate is registered yet":
+
+- **Absent** — say so, and ask whether to create it:
+ *"`design/registry/entities.yaml` does not exist. May I create it with these
+ [N] entries?"* If the user declines, skip 5b and say the registry was not
+ written — do not treat the skip as a clean pass.
+- **Present but empty** — every list is `[]`, or the only matches are inside
+ comment blocks. Treat it as present, register the candidates, but say which
+ state you found: *"registry exists and is empty — all [N] entries are new."*
+ The shipped template's comments carry fully-formed examples referencing
+ `design/gdd/inventory.md` with real-looking values (`base_inventory_slots: 20`,
+ `gold_carry_limit: 9999`), so §2a's prescribed
+ `grep referenced_by.*[system-name]` returns **comment lines** on an empty
+ registry — and §2d would then present those invented numbers to the user as
+ *"These values are locked."* Match entries under a live `entities:`/`items:`/
+ `formulas:`/`constants:` key, never a commented example.
+- **Present** — for each candidate, check whether it is already registered:
+
```
Grep pattern=" - name: [candidate_name]" path="design/registry/entities.yaml"
```
@@ -723,7 +1081,9 @@ Registry candidates from this GDD:
```
Ask: "May I update `design/registry/entities.yaml` with these [N] new entries
-and update `referenced_by` for the existing entries?"
+and update `referenced_by` for the existing entries?" (If the file was absent
+and the user approved creating it, the wording is *create*, not *update*, and
+there are no `referenced_by` arrays to merge.)
If yes: append new entries and update `referenced_by` arrays. Never modify
existing `value` / attribute fields without surfacing it as a conflict first.
@@ -750,6 +1110,18 @@ Present a completion summary:
After the GDD is complete (and optionally reviewed):
+**First check the systems index exists.** §2a skips it at `minimal` because it is
+never written at that tier, and this step never carried the same guard — the same
+class of bug §5b was patched for. It bites hardest on a `minimal` project with a
+`system_overrides` bump, where the effective tier is `standard` or `full` and
+nothing else in §5 hints the file may be absent.
+
+- **Absent** — say so in one line (*"no `design/gdd/systems-index.md` at this
+ workflow tier; nothing to update"*) and skip to §5e. Do **not** offer to create
+ one: `/map-systems` owns that file, and a stub written here would be a systems
+ index listing exactly one system.
+- **Present** — continue:
+
- Read the systems index
- Update the target system's row:
- If design-review was run and verdict is APPROVED: Status → "Approved"
@@ -767,7 +1139,11 @@ Update `production/session-state/active.md` with:
- Task: [system-name] GDD
- Status: Complete (or In Review if design-review was run)
- File: design/gdd/[system-name].md
-- Sections: All 8 written
+- Sections: [list the sections actually authored, by name] — **never a fixed
+ count**; §5a forbids verifying against `/8`, and the same reasoning applies to
+ recording it. Below `full` a correctly-authored GDD has fewer than 8 sections,
+ and writing "All 8 written" into session state makes the next reader believe
+ a complete GDD is incomplete
- Next: [suggest next system from design order]
### 5f: Suggest Next Steps
@@ -788,7 +1164,27 @@ Use `AskUserQuestion`:
This skill delegates to specialist agents for domain expertise. The main session
orchestrates the overall flow; agents provide expert content.
-| System Category | Primary Agent | Supporting Agent(s) |
+**Rows here are finer-grained than the nine `Category` values on purpose** — the
+right specialist for combat is not the right specialist for pathfinding, and both
+are `Gameplay`. Resolve in two steps: take the system's `Category` from
+`systems-index.md`, then pick the row within it that matches what the system
+actually does. Every category has at least one row, so nothing falls through.
+
+| `Category` | Rows below to choose from |
+|---|---|
+| `Gameplay` | Combat/damage/health · AI/pathfinding/behavior · Animation/character movement · Character systems · Camera/input/controls |
+| `Core` | Foundation/Infrastructure · Camera/input/controls |
+| `Persistence` | Foundation/Infrastructure |
+| `Economy` | Economy/loot/crafting |
+| `Progression` | Progression/XP/skills |
+| `UI` | UI systems · Visual effects (when the system is HUD-adjacent VFX) |
+| `Audio` | Audio systems |
+| `Narrative` | Dialogue/quests/lore |
+| `Meta` | Foundation/Infrastructure (analytics, tutorial plumbing) · UI systems (accessibility options screens) |
+
+If two rows fit, spawn the union of their Primary agents and say why.
+
+| System type | Primary Agent | Supporting Agent(s) |
|----------------|---------------|---------------------|
| **Foundation/Infrastructure** (event bus, save/load, scene mgmt, service locator) | `systems-designer` | `gameplay-programmer` (feasibility), `engine-programmer` (engine integration) |
| Combat, damage, health | `game-designer` | `systems-designer` (formulas), `ai-programmer` (enemy AI), `art-director` (hit feedback visual direction, VFX intent) |
@@ -804,7 +1200,7 @@ orchestrates the overall flow; agents provide expert content.
| Visual effects, particles, shaders | `game-designer` | `art-director` (VFX visual direction), `technical-artist` (performance budget, shader complexity), `systems-designer` (trigger/state integration) |
| Character systems (stats, archetypes) | `game-designer` | `art-director` (character visual archetype), `narrative-director` (character arc alignment), `systems-designer` (stat formulas) |
-**When delegating via Task tool**:
+**When delegating via the `Agent` tool**:
- Provide: system name, game concept summary, dependency GDD excerpts, the specific
section being worked on, and what question needs expert input
- The agent returns analysis/proposals to the main session
@@ -831,6 +1227,11 @@ disruption.
## Collaborative Protocol
+**In `collaborative` mode (the default).** For `guided` and `autonomous`
+modes, see the per-mode rules in `.claude/docs/automation-modes.md` — the
+"Never" lines below describe what collaborative mode requires, not what
+applies universally.
+
This skill follows the collaborative design principle at every step:
1. **Question -> Options -> Decision -> Draft -> Approval** for every section
@@ -838,7 +1239,10 @@ This skill follows the collaborative design principle at every step:
- Phase 2: "Ready to start, or need more context?"
- Phase 3: "May I create the skeleton?"
- Phase 4 (each section): Design questions, approach options, draft approval
- - Phase 5: "Run design review? Update systems index? What's next?"
+ - Phase 5: "May I update the entity registry? May I update the systems
+ index? What's next?" — **not** "Run design review?": §5c forbids offering
+ `/design-review` inline, because the reviewing agent must not inherit this
+ session's design history. Phase 5c presents the hand-off; it never asks.
3. **"May I write to [filepath]?"** before the skeleton and before each section write
4. **Incremental writing**: Each section is written to file immediately after approval
5. **Session state updates**: After every section write
diff --git a/.claude/skills/dev-story/CONTRACT.md b/.claude/skills/dev-story/CONTRACT.md
new file mode 100644
index 00000000..616a329e
--- /dev/null
+++ b/.claude/skills/dev-story/CONTRACT.md
@@ -0,0 +1,78 @@
+# /dev-story — Handoff Contract
+
+## Role in Pipeline
+Bridges planning and code by loading the full context for a single story (story file, TR registry, ADR, control manifest, engine prefs), routing to the correct programmer agent, implementing source code and tests, and leaving the story ready for `/code-review` then `/story-done`.
+
+## Inputs Required
+
+### Files That Must Exist
+| File | Required Fields / Sections | Read-Only? |
+|------|---------------------------|-----------|
+| `production/epics/**/*.md` (the story file) | `Status: Ready`, `TR-ID`, `Governing ADR`, `Manifest Version`, `## Acceptance Criteria`, `## Test Evidence`, `## Dependencies`, `## Out of Scope` | **Partially mutable.** This skill sets `Status:` to `In Progress` and updates `Last Updated:` before spawning any agent (Phase 2) — at `minimal` the story file is the only record of progress, since `sprint-status.yaml` is absent. Everything else in the story file is read-only to this skill |
+| `docs/architecture/tr-registry.yaml` | Entry matching the story's TR-ID with current `requirement` text | Yes |
+| `docs/architecture/adr-NNNN-[slug].md` (referenced ADR) | `## Decision`, `## Implementation Guidelines`, `## Engine Compatibility`, `## ADR Dependencies` | Yes |
+| `docs/architecture/control-manifest.md` | `Manifest Version:` header, layer rules (required patterns, forbidden patterns, performance guardrails) | Yes |
+| `project.yaml` | `engine.name`, `engine.version`, `naming.*`, `performance.*` — the primary source for each of these fields | Yes |
+| `.claude/docs/technical-preferences.md` | Legacy fallback for any field above that is absent or empty in `project.yaml`; **sole** source for forbidden patterns and allowed libraries (deliberately never migrated), plus the `Engine Specialists` section | Yes — required only for fields absent from `project.yaml`, and always for forbidden patterns |
+| `docs/engine-reference/[engine]/VERSION.md` | Engine version, LLM knowledge cutoff, post-cutoff risk levels | Yes |
+| `production/session-state/active.md` | (read to find active story when no argument given; created if absent) | No |
+
+### Preconditions
+- The target story must have `Status: Ready` (validated by `/story-readiness` before invocation)
+- The ADR referenced in the story must have `Status: Accepted` — if `Status: Proposed`, do not implement; surface this as a blocker and direct user to `/architecture-decision`
+- All `## Dependencies` stories listed in the story file must already have `Status: Complete` (or `Status: Done`)
+- An engine must be configured — `engine.name` in `project.yaml`, or as legacy fallback an `**Engine**:` value in `.claude/docs/technical-preferences.md` that is not `[TO BE CONFIGURED]`
+- `docs/architecture/tr-registry.yaml` must contain the story's TR-ID
+- `docs/architecture/control-manifest.md` must exist (required for layer rule enforcement)
+
+## Outputs Produced
+
+### Files Written
+| File | Guaranteed Fields / Sections | Notes |
+|------|------------------------------|-------|
+| `<code root>/[system]/[file].[ext]` | Doc-commented public APIs; no hardcoded gameplay values; follows ADR Implementation Guidelines and control-manifest required patterns | created or modified by sub-agent; code root resolved per `.claude/docs/code-root-resolution.md` |
+| `tests/unit/[system]/[story-slug]_test.[ext]` OR `tests/integration/[system]/[story-slug]_test.[ext]` | One test function per acceptance criterion (Logic/Integration stories only); naming: `test_[scenario]_[expected_outcome]`; no random seeds; no external I/O | created by sub-agent; path matches `## Test Evidence` in story |
+| `production/session-state/active.md` | `## Session Extract — /dev-story [date]` block: story path, files changed, test written path, blockers, next steps | appended (created if absent) |
+
+### Output Guarantees
+- All source files follow the naming conventions in `project.yaml` (`naming.*`), falling back to `.claude/docs/technical-preferences.md` for any convention absent there
+- Test file path matches exactly the path declared in the story's `## Test Evidence` section
+- Every acceptance criterion is mapped to a test function (Logic/Integration), an `OBSERVED` retained screenshot (the *look* half of Visual/Feel and UI), or flagged `DEFERRED` (the *feel* half only — timing, weight, responsiveness) in the implementation summary
+- No files are written outside the story's `## Out of Scope` boundary without surfacing the conflict to the user first
+- Session state records files changed and the next recommended invocations (`/code-review` then `/story-done`)
+- The implementation summary states a **verification** result — what was run against the written code (`commands.test`, `commands.smoke`, or the engine's headless import) and its outcome. When the engine binary is unavailable this is **`NOT VERIFIED — <reason>`**, never an inference that the code is fine because it reads correctly
+- The implementation summary states a **run result** — `OBSERVED — <what was on screen>` with a retained screenshot under `production/qa/evidence/[story-slug]/`, `NOT VERIFIED — <reason>`, or `N/A — <reason>` (only for a story with genuinely nothing observable). `NOT VERIFIED` is a blocker at the default gate level for Visual/Feel and UI stories. The run is **not waived at `qa.level: minimal`** — tests are, the look is not. Procedure: `.claude/docs/run-and-observe.md`
+- At `qa.level: minimal` no test file is written, and the summary says so explicitly (`Test evidence: waived at qa.level: minimal`). A waived run and a run where tests were forgotten must not produce the same artifact
+- **`NOT ASSESSED` is an accepted inbound value of the story's `Risk` field** (`/create-stories` emits it when `VERSION.md` assigns no level). This skill treats it as HIGH for the engine-specialist spawn decision
+- **Completion is not assumed.** If the programmer agent stopped early or its output fails to parse, the story is reported **INCOMPLETE** with the specific breakage named, and `Implementation Complete` is not emitted
+
+## Immutability Rules
+- READS but does NOT modify: `project.yaml`, `docs/architecture/tr-registry.yaml`, `docs/architecture/adr-NNNN-[slug].md`, all GDD files in `design/gdd/`, `docs/architecture/control-manifest.md`, `.claude/docs/technical-preferences.md` (legacy fallback), `docs/engine-reference/[engine]/VERSION.md`
+- MODIFIES: `<code root>/**` (new/updated source files, via sub-agent; code root resolved per `.claude/docs/code-root-resolution.md`), `tests/**` (new test file, via sub-agent), `production/session-state/active.md` (append only)
+- Updates the story file's `Status` field to `In Progress` only (Phase 2, before
+ spawning any agent). It writes no other `Status` value: advancing a story to
+ `Complete` is the exclusive responsibility of `/story-done`
+
+## Hard Constraints (Never Violate)
+- Never marks a story `Status: Done` or `Status: Complete` — that belongs to `/story-done`
+- Never begins implementation without loading the full context package (story, TR-ID from registry, ADR Decision + Implementation Guidelines, control-manifest layer rules, engine prefs)
+- Never implements a story whose referenced ADR has `Status: Proposed` — surface as a blocker
+- Never writes a Logic or Integration story as complete without a test file at the path declared in `## Test Evidence`
+- Never touches files listed in the story's `## Out of Scope` section without explicit user approval
+- Never deviates from the ADR's Implementation Guidelines silently — deviations must be flagged in the summary
+- Never modifies ADR files or GDD files under any circumstances
+- All file writes are delegated to sub-agents via Task; this orchestrator does not write source or test files directly
+
+## Downstream Skill Expects
+**Next skill:** `/story-done`
+- It will read: the story file (to check `Status`, `## Acceptance Criteria`, `## Test Evidence` path, `Type:`, referenced ADR, TR-ID)
+- It assumes: the test file declared in `## Test Evidence` already exists on disk (for Logic/Integration stories)
+- It assumes: `production/session-state/active.md` records the story path and files changed (used to locate the in-progress story when no argument is given)
+- It assumes: source files under the resolved code root are present and match the criterion descriptions, so Grep-based deviation checks can run
+
+## Known Fragile Points
+- If the story's embedded `Manifest Version` differs from the current `docs/architecture/control-manifest.md` header date, rules may have changed since the story was authored — the skill surfaces this, but silently proceeding would produce code that violates newer manifest rules
+- The test file path in `## Test Evidence` must be exact: `/story-done` uses that literal path for Glob checks; a typo here causes a false BLOCKING result downstream
+- If `docs/architecture/tr-registry.yaml` has a stale `requirement` text that diverges from the GDD, the implementation may satisfy the registry but fail the GDD — always treat the registry as authoritative per design, but flag if a visible discrepancy is noticed
+- Sub-agent task failures are non-fatal by design (partial reports are surfaced), but a blocked programmer sub-agent means no source files are written — `/story-done` will then fail its file-existence checks
+- Config/Data stories produce no test file; `/story-done` must see `Type: Config/Data` in the story header to classify the story correctly — otherwise it resolves the test-evidence gate for the wrong type (e.g. Logic, which is BLOCKING by default) and may flag a missing test
diff --git a/.claude/skills/dev-story/SKILL.md b/.claude/skills/dev-story/SKILL.md
index 13624ff9..e20a0a17 100644
--- a/.claude/skills/dev-story/SKILL.md
+++ b/.claude/skills/dev-story/SKILL.md
@@ -1,12 +1,19 @@
---
name: dev-story
-description: "Read a story file and implement it. Loads the full context (story, GDD requirement, ADR guidelines, control manifest), routes to the right programmer agent for the system and engine, implements the code and test, and confirms each acceptance criterion. The core implementation skill — run after /story-readiness, before /code-review and /story-done."
+description: "Implement a story: ADR guidelines, right programmer agent, code plus test. After /story-readiness, before /code-review and /story-done."
argument-hint: "[story-path]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Bash, Task, AskUserQuestion
+disable-model-invocation: true
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,workflow,story_granularity,qa.level,testing.strict,system_overrides`
+
+Resolved above — use as-is. No block → defaults in
+`.claude/docs/config-resolution.md`.
+
+
# Dev Story
This skill bridges planning and code. It reads a story file in full, assembles
@@ -24,10 +31,33 @@ drives implementation to completion — including writing the test.
**After all sprint stories are done:** run `/team-qa sprint` to execute the full QA cycle and get a sign-off verdict before advancing the project stage.
-**Output:** Source code + test file in the project's `src/` and `tests/` directories.
+**Output:** Source code under the project's **code root** + test file in `tests/`. Resolve the code root from `engine.name` (`src/` Godot, `Assets/` Unity, `Source/<Module>/` Unreal) per `.claude/docs/code-root-resolution.md`.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**Workflow tier**: resolved per the story's system (per
+`.claude/docs/workflow-modes.md`) — **the GDD filename stem** of the story's
+`GDD:` path (`design/gdd/<stem>.md` → `<stem>`), with the `[system]` segment of
+its `TR-[system]-NNN` ID accepted only as a fallback alias: use the
+`system_overrides` row for that system if the block lists one, else the
+project value. Resolve it at the start of Phase 2 (the story header is
+read there) and apply it to the prerequisite gate.
+
+**`story_granularity`** — it sets the
+expected implementation cycle: **multi-day** at `coarse` (give the programmer
+subagent longer working context), **1–2 days** at `balanced` (default), **hours**
+at `fine` (tighter context). It does not change the prerequisite gate.
+
+**`qa.level`**: controls whether the programmer brief carries
+a test requirement. At `minimal`, omit the "Test requirement" line (Phase 4 item 7)
+— tests are not required; at `standard`, include the per-type test requirement; at
+`full`, also pass a coverage target. Distinct from `workflow: minimal`. When tests
+are not required (`minimal`), the Phase 5 `testing.strict` gate is a no-op.
+
## Phase 1: Find the Story
**If a path is provided**: read that file directly.
@@ -41,23 +71,32 @@ If not found, ask: "Which story are we implementing?" Glob
## Phase 2: Load Full Context
-**Before loading any context, verify required files exist.** Extract the ADR path from the story's `ADR Governing Implementation` field, then check:
+**Before loading any context, resolve the workflow tier for this story's system** (see the Workflow tier note above), then **verify required files exist.** Extract the ADR path from the story's `ADR Governing Implementation` field. The "If missing — `full`" column is the baseline; the tier columns relax it:
-| File | Path | If missing |
-|------|------|------------|
-| TR registry | `docs/architecture/tr-registry.yaml` | **STOP** — "TR registry not found at `docs/architecture/tr-registry.yaml`. Run `/architecture-review` to bootstrap the registry from your GDDs and ADRs." |
-| Governing ADR | path from story's ADR field | **STOP** — "ADR file [path] not found. Run `/architecture-decision` to create it, or correct the filename in the story's ADR field." |
-| Control manifest | `docs/architecture/control-manifest.md` | **WARN and continue** — "Control manifest not found — layer rules cannot be checked. Run `/create-control-manifest`." |
+| File | Path | If missing — `full` | `standard` | `minimal` |
+|------|------|---------------------|-----------|-----------|
+| TR registry | `docs/architecture/tr-registry.yaml` | **STOP** — "TR registry not found at `docs/architecture/tr-registry.yaml`. Run `/architecture-review` to bootstrap the registry from your GDDs and ADRs." | optional — proceed without it | not expected — proceed |
+| Governing ADR | path from story's ADR field | **STOP** — "ADR file [path] not found. Run `/architecture-decision` to create it, or correct the filename in the story's ADR field." | **STOP only if the story references an ADR** and its file is missing/Proposed; if it references none, proceed | no ADR required — proceed |
+| Control manifest | `docs/architecture/control-manifest.md` | **WARN and continue** — "Control manifest not found — layer rules cannot be checked. Run `/create-control-manifest`." | WARN and continue | skip — not expected |
-If the TR registry or governing ADR is missing, set the story status to **BLOCKED** in the session state and do not spawn any programmer agent.
+At `full`, if the TR registry or governing ADR is missing, set the story status to **BLOCKED** in the session state and do not spawn any programmer agent. At `standard`/`minimal`, only a story that references an ADR whose file is **missing or `Proposed`** is set BLOCKED; a missing TR registry, or an absent-by-design ADR, does **not** block — implement against the story's acceptance criteria + the GDD/brief.
-Read all of the following simultaneously — these are independent reads. Do not start implementation until all context is loaded:
+Read the story file and the TR registry simultaneously — these two are
+genuinely independent, unconditional reads. **The governing ADR is not part
+of this batch — do not include it in the same parallel tool-call group as
+these two.** Its own section below is a gate, not a read: whether the ADR
+gets opened at all depends on a freshness check that itself depends on the
+story file already being read. Do not start implementation until this phase
+is fully resolved:
### The story file
Extract and hold:
- **Story title, ID, layer, type** (Logic / Integration / Visual/Feel / UI / Config/Data)
- **TR-ID** — the GDD requirement identifier
- **Governing ADR** reference
+- **ADR Version** stamp embedded in story header (absent on pre-stamp stories)
+- **ADR Decision Summary** and **Implementation Notes** — the distilled ADR
+ guidance; this is the primary source for what the ADR decided
- **Manifest Version** embedded in story header
- **Acceptance Criteria** — every checkbox item, verbatim
- **Implementation Notes** — the ADR guidance section in the story
@@ -66,19 +105,74 @@ Extract and hold:
- **Dependencies** — what must be DONE before this story
### The TR registry
-Read `docs/architecture/tr-registry.yaml`. Look up the story's TR-ID.
-Read the current `requirement` text — this is the source of truth for what the
-GDD requires now. Do not rely on any inline text in the story file (may be stale).
+Grep the story's TR-ID from `docs/architecture/tr-registry.yaml`
+(`Grep pattern="id: <TR-ID>" path="docs/architecture/tr-registry.yaml" output_mode="content" -A 6`)
+rather than reading the whole cross-system registry. Read the matched entry's current
+`requirement` text — this is the source of truth for what the GDD requires now. Do not
+rely on any inline text in the story file (may be stale).
### The governing ADR
-Read `docs/architecture/[adr-file].md`. Extract:
-- The full Decision section
-- The Implementation Guidelines section (this is what the programmer follows)
-- The Engine Compatibility section (post-cutoff APIs, known risks)
-- The ADR Dependencies section
+
+**Do not open the ADR by default.** `/create-stories` already distilled it into
+this story's `**ADR Decision Summary**` + `## Implementation Notes`, and its
+template states the contract outright: *"This is what the programmer reads
+instead of the ADR."* Re-reading the source here discards that work and, on an
+ADR past the 25k `Read` cap, costs a failed read plus offset/limit retries
+before implementation even starts.
+
+**Check freshness with one line, not one file.** Resolve the ADR path from the
+story, then:
+
+```
+Grep pattern="^## Last Verified" path="docs/architecture/[adr-file].md" output_mode="content" -A 1
+```
+
+Compare that date against the story's `**ADR Version**` field:
+
+| Result | Meaning | Action |
+|---|---|---|
+| Dates **match** | The summary was distilled from the ADR as it stands. | **Trust the story.** Do not read the ADR. |
+| Story has **no `ADR Version`** field | A story written before the stamp existed — *not* evidence of staleness. | **Trust the story**, and note in the Phase 6 summary: "Story predates the ADR Version stamp; summary trusted unverified." |
+| Grep returns **no match** and the story reads `unversioned` | The ADR carries no `## Last Verified`. Consistent, not stale. | **Trust the story**; recommend `/architecture-decision [file] retrofit` to add the field. |
+| Grep returns **no match** but the story names a date | Ambiguous — the ADR may have lost the field. | Treat as **mismatch** (below). |
+| Dates **differ** | The ADR changed after this story was written. | **Mismatch** — resolve below. |
+
+**Never treat an absent stamp as a stale one.** A missing field means "unknown",
+and the fallback for unknown is the story, not a 35k-token re-read — the two
+staleness gates that already exist (`/story-readiness` on Manifest Version,
+`/code-review` post-implementation) are what make that safe.
+
+**On mismatch**, use `AskUserQuestion` — same shape as the Manifest Version
+check below:
+- Prompt: "Story was written against ADR v[story-date]. The ADR is now
+ v[current-date]. Its decision may have changed. How do you want to proceed?"
+- Options:
+ - `[A] Re-read the changed ADR sections and implement against current guidance (Recommended)`
+ - `[B] Implement from the story's summary — I accept the drift risk`
+ - `[C] Stop — I want to review the ADR diff first`
+
+If **[A]**: first check the ADR's size — `Bash: wc -c "docs/architecture/[adr-file].md"`:
+
+- **Under ~50KB** — read the whole file with one `Read` call. Measured on this
+ branch: at this size one read is *cheaper* than the multi-grep path (48.4k
+ vs 52.1k tokens on a 16KB fixture) — per-call overhead outweighs the
+ content saved. Targeted reading only pays for itself on files big enough
+ to threaten the 25k-token `Read` cap.
+- **~50KB or larger** — read *only* the sections that govern implementation,
+ never the whole file:
+ ```
+ Grep pattern="^## (Decision|Engine Compatibility|ADR Dependencies)" path="docs/architecture/[adr-file].md" output_mode="content" -A 40
+ ```
+ Escalate to a bounded `Read(offset, limit)` on one section only if a scanned
+ section cross-references material outside itself.
+
+Then update the story's `ADR Version` to the current date so the next run is clean.
+If **[B]**: proceed on the summary; record it in the Phase 6 "Deviations" summary.
+If **[C]**: stop. Do not spawn any agent.
### The control manifest
-Read `docs/architecture/control-manifest.md`. Extract the rules for this story's layer:
+Read only this story's layer from `docs/architecture/control-manifest.md` — grep that one
+section (`Grep pattern="^## <layer> Layer Rules" path="docs/architecture/control-manifest.md" output_mode="content" -A 40`) rather than a full read of every layer. Extract the rules for this story's layer:
- Required patterns
- Forbidden patterns
- Performance guardrails
@@ -117,26 +211,29 @@ If a dependency file cannot be found: warn "Dependency story not found: [path].
---
### Engine reference
-Read `.claude/docs/technical-preferences.md`:
-- `Engine:` value — determines which programmer agents to use
-- Naming conventions (class names, file names, signal/event names)
-- Performance budgets (frame budget, memory ceiling)
-- Forbidden patterns
+Read from `project.yaml` first, falling back to `.claude/docs/technical-preferences.md` for any key absent or empty:
+- `specialists.*` — the project's chosen specialist agents; **read before**
+ `engine.name` when selecting an agent (see Phase 3)
+- `engine.name` (else the `Engine:` value) — the generic engine specialist, and
+ the fallback when `specialists` is absent
+- `naming.*` (else Naming conventions) — class names, file names, signal/event names
+- `performance.*` (else Performance budgets) — frame budget, memory ceiling
+- Forbidden patterns — from `.claude/docs/technical-preferences.md` (not migrated to project.yaml)
### Mark Story In Progress
Silently update two things before spawning any agent:
-1. **`production/sprint-status.yaml`** (if it exists): find the entry matching this story's file path and set `status: in_progress`. Update the top-level `updated` field to today's date. If the file does not exist, skip silently.
+1. **`production/sprint-status.yaml`** (if it exists): find the entry matching this story's file path and set `status: in_progress`. Update the top-level `updated` field to today's date. If the file does not exist, say so in one line — `Sprint status not updated: production/sprint-status.yaml absent` — and continue. Do not skip silently: `/sprint-status` reads that file to report progress, so a story that never gets marked `in_progress` is invisible to the very command a producer uses to ask what is moving.
-2. **The story file itself**: edit the `Last Updated:` field in the story header to today's date (format: `YYYY-MM-DD`). If the field does not exist in the story header, add it after the `Status:` line. This enables sprint-status staleness detection for this story.
+2. **The story file itself**: set the story header's `Status:` field to `In Progress`, and edit its `Last Updated:` field to today's date (format: `YYYY-MM-DD`; if the field does not exist, add it after the `Status:` line). Setting `Status:` here is what actually marks the story In Progress — at `minimal` the `sprint-status.yaml` in step 1 is absent, so the story file is the only record of progress at that tier.
---
## Phase 3: Route to the Right Programmer
Based on the story's **Layer**, **Type**, and **system name**, determine which
-specialist to spawn via Task.
+specialist to spawn via `Agent`.
**Config/Data stories — skip agent spawning entirely:**
If the story's Type is `Config/Data`, no programmer agent or engine specialist is needed. Jump directly to Phase 4 (Config/Data note). The implementation is a data file edit — no routing table evaluation, no engine specialist.
@@ -155,40 +252,111 @@ If the story's Type is `Config/Data`, no programmer agent or engine specialist i
### Engine specialist — always spawn as secondary for code stories
-Read the `Engine Specialists` section of `.claude/docs/technical-preferences.md`
-to get the configured primary specialist. Spawn them alongside the primary agent
-when the story involves engine-specific APIs, patterns, or the ADR has HIGH
-engine risk.
+**Read the `specialists` block from `project.yaml` directly — it is not in
+the `resolve_config` output at the top of this skill..** `resolve_config` does not emit
+`specialists.*`; the five skills that already consume it (`/adopt`,
+`/code-review`, `/design-system`, `/gate-check`, `/team-ui`) all read the block
+out of `project.yaml` themselves, and so does this one. Adding it to the
+frontmatter key list would fail the gate that asserts every requested key is one
+`resolve_config` actually emits.
+
+`/setup-engine` writes the block, and it is the project's own answer to "which
+specialist implements here" — resolved from the engine *and the language*, which
+`engine.name` alone cannot tell you. Resolve in this order:
+
+1. **`specialists.code`** — the language/code specialist, and the right secondary
+ for an implementation story. This is the value that distinguishes a Godot C#
+ project (`godot-csharp-specialist`) from a Godot GDScript one
+ (`godot-gdscript-specialist`); `engine.name` is `Godot` for both.
+2. **`specialists.shader`** when the story touches shaders or materials, and
+ **`specialists.ui`** when the story's Type is `UI` — in addition to, not
+ instead of, `specialists.code`.
+3. **The generic `<engine>-specialist`** — derived from `engine.name`
+ (Godot→`godot-specialist`, Unity→`unity-specialist`,
+ Unreal→`unreal-specialist`) — for architecture-level and broad engine
+ concerns, and as the fallback when the `specialists` block is absent.
+4. If `engine.name` is also absent or empty, read the Primary line of the
+ `## Engine Specialists` section of `.claude/docs/technical-preferences.md`.
+
+**A value of `null` means UNSET — treat that key as absent and fall through to
+the generic specialist. Never spawn it as an agent name.** The config reader
+returns the four-character string `"null"`, which is not empty and therefore
+reads as configured; `null`, empty and missing are the same state here. (This is
+the same caveat `/code-review` Phase 2 carries, for the same reason.)
+
+Spawn the resolved specialist alongside the primary agent when the story involves
+engine-specific APIs, patterns, or the ADR has HIGH engine risk.
+
+The full roster, for reference when no `specialists` block exists:
| Engine | Specialist agents available |
|--------|----------------------------|
-| Godot 4 | `godot-specialist`, `godot-gdscript-specialist`, `godot-shader-specialist` |
-| Unity | `unity-specialist`, `unity-ui-specialist`, `unity-shader-specialist` |
+| Godot 4 | `godot-specialist`, `godot-gdscript-specialist`, `godot-csharp-specialist`, `godot-shader-specialist`, `godot-gdextension-specialist` |
+| Unity | `unity-specialist`, `unity-ui-specialist`, `unity-shader-specialist`, `unity-dots-specialist`, `unity-addressables-specialist` |
| Unreal Engine | `unreal-specialist`, `ue-gas-specialist`, `ue-blueprint-specialist`, `ue-umg-specialist`, `ue-replication-specialist` |
+> **Do not pick from this table when `specialists` is set.** The table lists what
+> *exists* for an engine; the block records what this project *chose*. Reading the
+> table instead of the block is how a Godot C# project ends up reviewed by the
+> GDScript specialist.
+
**When engine risk is HIGH** (from the ADR or VERSION.md): always spawn the engine
specialist, even for non-engine-facing stories. High risk means the ADR records
assumptions about post-cutoff engine APIs that need expert verification.
+> **Read the risk, do not trust the story card alone.** If the story's `Risk`
+> field is absent, or says `NOT ASSESSED`, **or disagrees with
+> `docs/engine-reference/<engine>/VERSION.md`, the VERSION.md rating wins** and an
+> unknown counts as HIGH. At `minimal` there is no ADR, so VERSION.md is the only
+> source; a story card carrying an improvised `MEDIUM` against a VERSION.md
+> rating of HIGH would skip this spawn without saying so — which is how two wrong engine
+> defaults reached a project unreviewed. `/create-stories` now derives the field
+> from the same file, so the two should agree; this check is what catches it when
+> they do not.
+
---
## Phase 4: Implement
-Spawn the chosen programmer agent(s) via Task with the full context package:
-
-Brief the agent with file paths and targeted reading instructions — do not serialize document content into the Task prompt. The agent reads what it needs directly:
-
-1. **Story file**: `[story-path]` — read in full
+Spawn the chosen programmer agent(s) via `Agent` with the full context package:
+
+Brief the agent with file paths and targeted reading instructions — do not serialize document content into the `Agent` prompt. The agent reads what it needs directly.
+
+> **Tier note (from Phase 2):** items 2–4 below assume the `full` baseline. At
+> `standard`, include the TR registry only if it exists and the governing ADR
+> only where the story references one. At `minimal`, the TR registry, ADR, and
+> control manifest are typically absent — **omit items 2–4 and brief the agent to
+> implement against the story's Acceptance Criteria and the GDD/brief** (the
+> story file from item 1). Never instruct the agent to read a file Phase 2
+> confirmed missing.
+>
+> **Say which items you dropped, and say it to both readers.** The rule item 7
+> already carries applies unchanged to items 2–4: *an omitted item and a
+> forgotten one are indistinguishable to the agent.* They are equally
+> indistinguishable to the user reading the Phase 6 summary.
+> - **To the agent**, in the prompt: *"No TR registry entry is passed for this
+> story — `docs/architecture/tr-registry.yaml` does not exist at this tier.
+> Implement against the story's Acceptance Criteria and the GDD/brief. Do not
+> go looking for it."* Same form for an absent ADR or control manifest.
+> - **To the user**, one line before spawning: `Briefing omits: TR registry
+> (absent), control manifest (absent) — implementing against acceptance
+> criteria + GDD.`
+>
+> Without this, a `standard` run where the registry legitimately does not exist
+> and one where `/architecture-review` was supposed to bootstrap it and nobody
+> did produce **identical output**.
+
+1. **Story file**: `[story-path]` — the agent reads this one file; it carries the acceptance criteria, Out of Scope boundaries, and QA test cases
2. **GDD requirement**: look up TR-ID `[TR-XXX-NNN]` in `docs/architecture/tr-registry.yaml` — use the `requirement` field as source of truth
-3. **ADR**: `docs/architecture/[adr-file].md` — read the **Decision** and **Implementation Guidelines** sections only
+3. **ADR guidance**: pass the story's `**ADR Decision Summary**` and `## Implementation Notes` **inline in the prompt** — do not pass the ADR path. Phase 2 already established that this summary is current; handing the agent a path makes it re-read the whole ADR in its own context, paying the cost this skill just avoided. Pass the path *only* if Phase 2 hit the mismatch branch and the user chose `[C]`-style deferral, in which case say which sections to grep.
4. **Control manifest**: `docs/architecture/control-manifest.md` — read rules for the **[layer]** layer only
-5. **Engine preferences**: `.claude/docs/technical-preferences.md` — read naming conventions and performance budgets
+5. **Engine preferences**: `naming.*` and `performance.*` from `project.yaml` (for any key absent or empty, fall back to `.claude/docs/technical-preferences.md`)
6. **Test file path**: `[path from story's Test Evidence section]` — this file must be created as part of implementation
-7. **Test requirement** (Logic and Integration stories only): The test file MUST be created at `[path from the story's Test Evidence section]`. Write the test alongside the implementation — do not defer it. The story cannot be closed via `/story-done` without this file present. Each acceptance criterion must have at least one test function covering it. Test file naming: `[system]_[feature]_test.[ext]`. Function naming: `test_[scenario]_[expected_outcome]`. No random seeds, no time-dependent assertions, no external I/O.
+7. **Test requirement** (Logic and Integration stories only; **omit this entire item at `qa.level: minimal`** — tests are not required there. When you omit it, tell the agent so explicitly: *"Do not write a test file for this story — test evidence is waived at `qa.level: minimal`."* An omitted item and a forgotten one are indistinguishable to the agent, and a programmer briefed with no test instruction may write tests anyway, or may silently assume they were meant to): The test file MUST be created at `[path from the story's Test Evidence section]`. Write the test alongside the implementation — do not defer it. At `qa.level: standard`/`full` the story cannot be closed via `/story-done` without this file present. Each acceptance criterion must have at least one test function covering it. Test file naming: `[system]_[feature]_test.[ext]`. Function naming: `test_[scenario]_[expected_outcome]`. No random seeds, no time-dependent assertions, no external I/O.
8. **Explicit instruction**: implement this story following the ADR guidelines, respect the manifest rules, stay within the story's Out of Scope boundaries. Write clean, doc-commented public APIs.
The agent should:
-- Create or modify files in `src/` following the ADR guidelines
+- Create or modify files under the **resolved code root** following the ADR guidelines. Resolve it per `.claude/docs/code-root-resolution.md` — `src/` is the Godot row, `Assets/Scripts/<System>/` is Unity's, `Source/<Module>/<System>/` is Unreal's. **If the code root cannot be resolved, do not write: report it and stop.** Selecting the engine specialist above is NOT the same as resolving the code root
- Respect all Required and Forbidden patterns from the control manifest
- Stay within the story's Out of Scope boundaries (do not touch unrelated files)
- Write clean, doc-commented public APIs
@@ -202,9 +370,12 @@ changed from/to.
### Visual/Feel stories
-Spawn `gameplay-programmer` to implement the code/animation calls. Note that
-Visual/Feel acceptance criteria cannot be auto-verified — the "does it feel right?"
-check happens in `/story-done` via manual confirmation.
+Spawn `gameplay-programmer` to implement the code/animation calls. The *look*
+half of the acceptance criteria — layout, clipping, presence, colour — is
+verified in Phase 6 step 4 by launching the build and retaining a screenshot;
+it is not deferred. The *feel* half — timing, weight, responsiveness — is not
+something a still can show: say which half the run covered, and leave feel to
+`/team-qa`.
---
@@ -212,24 +383,117 @@ check happens in `/story-done` via manual confirmation.
The test requirement was included in the Phase 4 programmer agent brief (item 7). This phase summarizes what evidence each story type requires — used when collecting the Phase 6 summary.
-| Story Type | Required Evidence | Notes |
+**Skip this phase at `qa.level: minimal`** (resolved earlier) — no test evidence
+is required, so there is nothing to gate; do not flag the story unverifiable for a
+missing test.
+
+> **Say so in the Phase 6 summary.** A skipped phase must announce itself in the
+> output, not only in this file (`.claude/rules/skill-authoring.md`, obligation
+> 3). Emit the line:
+>
+> > *Test evidence: **waived** at `qa.level: minimal` — no test was required or
+> > written for this story.*
+>
+> Without it, a minimal-tier summary that simply lacks a tests row is
+> indistinguishable from a `standard`-tier run where the programmer forgot to
+> write them — and the permissive reading is the one that gets believed.
+
+Otherwise:
+
+**Resolve the gate level for this story's type** from `testing.strict` in
+`project.yaml`. BLOCKING means a missing test marks the story unverifiable;
+ADVISORY means a missing test is noted but does not block:
+
+1. Map the Story Type to a `testing.strict` key — Logic→`logic`,
+ Integration→`integration`, Visual/Feel→`visual`, UI→`ui`, Config/Data→`config`.
+ Take `testing.strict.<key>` from the **the resolved-config block at the top of this skill**, not from
+ `project.yaml` directly. If its value is `true` (case-insensitive) →
+ BLOCKING; if `false` → ADVISORY; `unset` → fall through.
+
+> `testing.strict.*` is locally overridable (`/settings --local
+> testing.strict.logic=false`). Reading `project.yaml` on its own ignores
+> `project.local.yaml` entirely, so the override is accepted and then does
+> nothing. `resolve_config` merges the two.
+2. Else read `testing.strict` as a plain boolean (legacy single-value form) — if
+ its value is `true` or `false`, it applies to every type.
+3. Else use the **Default Gate Level** column below.
+
+Only `true` and `false` (case-insensitive) are recognized at steps 1–2. A key
+that is present but holds any other value — `maybe`, `1`, `yes`, etc. — is
+treated as unset: continue to the next step, and surface the unrecognized value
+to the user.
+
+| Story Type | Required Evidence | Default Gate Level |
|---|---|---|
-| **Logic** | Automated unit test at path from story's Test Evidence section | BLOCKING — included in Phase 4 agent brief |
-| **Integration** | Integration test OR documented playtest record | BLOCKING — included in Phase 4 agent brief |
-| **Visual/Feel** | Evidence doc at `production/qa/evidence/[slug]-evidence.md` | ADVISORY — note in Phase 6 summary |
-| **UI** | Manual walkthrough doc or interaction test | ADVISORY — note in Phase 6 summary |
-| **Config/Data** | None — smoke check serves as evidence | N/A |
-
-For Visual/Feel and UI stories, include in the Phase 6 summary: "Manual evidence required at `production/qa/evidence/[slug]-evidence.md` before this story can be fully closed."
+| **Logic** | Automated unit test at path from story's Test Evidence section | BLOCKING |
+| **Integration** | Integration test OR documented playtest record | BLOCKING |
+| **Visual/Feel** | Retained screenshot + evidence doc at `production/qa/evidence/[slug]-evidence.md` | BLOCKING |
+| **UI** | Retained screenshot of each screen touched, in `production/qa/evidence/` | BLOCKING |
+| **Config/Data** | None — smoke check serves as evidence | ADVISORY |
+
+The test is written alongside the implementation (Phase 4, item 7) regardless of
+the gate level — strictness controls only how a *missing* test is reported in the
+Phase 6 summary. At a BLOCKING level, a missing test is flagged "story
+unverifiable — test required before `/story-done`". At an ADVISORY level it is
+noted as a recommendation. The **Default Gate Level** column applies when
+`testing.strict` is unset.
+
+Visual/Feel and UI default to **BLOCKING**: for a game the rendered result is the
+product, and an advisory visual gate gets deferred in favour of whatever does
+block. A project that genuinely does not need it sets `testing.strict.visual` or
+`testing.strict.ui` to `false`.
+
+For Visual/Feel and UI stories, include in the Phase 6 summary: "Retained screenshot required at `production/qa/evidence/[slug]-evidence.md` before this story can be closed — at the default BLOCKING level a story with no screenshot on disk is unverifiable."
---
## Phase 6: Collect and Summarise
-After the programmer agent(s) complete, collect:
+### First: did the agent actually finish?
+
+**Do not assume completion.** A programmer agent can stop at its turn limit
+mid-edit, and the work it leaves behind can be syntactically broken — a helper
+called but never defined, an import half-moved. Its partial report reads like
+progress, and this phase's summary would print "Implementation Complete" over
+code that does not load.
+
+Before collecting anything:
+
+1. **Check the agent's own terminal state.** If it reported stopping early, hit a
+ turn/step limit, or its report ends mid-task, treat the story as **INCOMPLETE**.
+2. **Verify the output parses.** Run the cheapest check the engine offers —
+ `commands.test` or `commands.smoke` from `project.yaml`, or for Godot
+ `godot --headless --path . --import`, which surfaces parse errors without
+ running the game. Report what you ran and what it said.
+3. If the engine binary is unavailable, write **`parse NOT VERIFIED — engine
+ binary not available`**. Do not infer that the code is fine because it reads
+ correctly; that inference is exactly what this step exists to replace.
+4. **Run it and look.** A parse check is not a run. For every story that
+ changes something a player can see — every Visual/Feel and UI story, and any
+ Logic, Integration or Config/Data story with a surface — launch the build
+ via `commands.run`, straight into the scene or map the story touched, and
+ retain a screenshot under `production/qa/evidence/[story-slug]/`. Then
+ `Read` the image and compare it to the acceptance criteria: clipped text,
+ an overflowing panel, a missing element are defects, and this is the only
+ step that finds them. Procedure per engine, including how to capture
+ unattended in Godot, Unity and Unreal: `.claude/docs/run-and-observe.md`.
+ Report exactly one line — `Run result: OBSERVED — <what was on screen>`
+ with the retained path, `Run result: NOT VERIFIED — <reason>`, or
+ `Run result: N/A — <reason>` for a story with genuinely nothing observable.
+ **`NOT VERIFIED` is a blocker at the default gate level for Visual/Feel and
+ UI, not a note** — `/story-done` reads this line. This step is **not waived
+ at `qa.level: minimal`**; tests are, the look is not.
+
+**If INCOMPLETE:** say so as the headline, list what exists so far, name the
+specific breakage, and offer to resume the agent. Do **not** emit
+"Implementation Complete", and do not advance the story's status.
+
+### Then collect:
- Files created or modified (with paths)
-- Test file created (path and number of test functions written)
+- **Verification result** — what was run, and its outcome (or why it could not run)
+- Test file created (path and number of test functions written) — **or**, at
+ `qa.level: minimal`, the waiver line from Phase 5
- Any deviations from the story's Out of Scope boundary (flag these)
- Any questions or blockers the agent surfaced
- Any engine-specific risks the specialist flagged
@@ -240,19 +504,24 @@ Present a concise implementation summary:
## Implementation Complete: [Story Title]
**Files changed**:
-- `src/[path]` — created / modified ([brief description])
-- `tests/[path]` — test file ([N] test functions)
+- `<code root>/[path]` — created / modified ([brief description])
+- `tests/[path]` — test file ([N] test functions) — *omit this line at
+ `qa.level: minimal` and print the Phase 5 waiver line instead*
+
+**Verification**: [what was run] — [result, or `NOT VERIFIED — <reason>`]
+**Run result**: [`OBSERVED — <what was on screen>` + retained path | `NOT VERIFIED — <reason>` | `N/A — <reason>`] — see `.claude/docs/run-and-observe.md`
**Acceptance criteria covered**:
- [x] [criterion] — implemented in [file:function]
- [x] [criterion] — covered by test [test_name]
-- [ ] [criterion] — DEFERRED: requires playtest (Visual/Feel)
+- [x] [criterion] — OBSERVED in `production/qa/evidence/[slug]/01-[what].png` (Visual/UI look)
+- [ ] [criterion] — DEFERRED: requires playtest (Visual/Feel *feel* — timing, weight; a still cannot show it)
**Deviations from scope**: [None] or [list files touched outside story boundary]
**Engine risks flagged**: [None] or [specialist finding]
**Blockers**: [None] or [describe]
-**Before running `/story-done`:** run your test suite locally and confirm the tests you wrote pass. `/story-done` will re-run them automatically, but a failing test discovered there means returning to implementation context.
+**Before running `/story-done`:** run your test suite locally and confirm the tests you wrote pass. *(At `qa.level: minimal` no tests were written — print the Phase 5 waiver line here instead of this paragraph. Telling a user to confirm the passing of tests that do not exist is worse than saying nothing.)* **`/story-done` does NOT re-run them** — its Phase 3 checks that the test FILE exists, with `Glob`, and nothing executes it. A test that exists and fails satisfies that gate. Nothing downstream makes the local run safe to skip. Pass/fail is established by `/gate-check` and `/smoke-check`, both of which execute a suite — and both come later than story closure.
Ready for: `/code-review [file1] [file2]` then `/story-done [story-path]`
```
@@ -278,26 +547,32 @@ Create `active.md` if it does not exist. Confirm: "Session state updated."
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
-- ADR status is Proposed → do not implement; run `/architecture-decision` first
+- A *referenced* ADR's status is Proposed → do not implement; run `/architecture-decision` first (at `standard`/`minimal` a story that references no ADR is not blocked on this — see Phase 2)
- Scope too large → split into two stories via `/create-stories`
- Conflicting instructions between ADR and story → surface the conflict, do not guess
- Manifest version mismatch → show diff to user, ask whether to proceed with old rules or update story first
## Collaborative Protocol
-- **File writes are delegated** — all source code, test files, and evidence docs are written by sub-agents spawned via Task. Each sub-agent enforces the "May I write to [path]?" protocol individually. This orchestrator does not write files directly.
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
+- **File writes are delegated** — all source code, test files, and evidence docs are written by sub-agents spawned via `Agent`. Each sub-agent enforces the "May I write to [path]?" protocol individually. This orchestrator does not write files directly.
- **Load before implementing** — do not start coding until all context is loaded
(story, TR-ID, ADR, manifest, engine prefs). Incomplete context produces code
that drifts from design.
@@ -308,8 +583,9 @@ Common blockers:
the story requires touching an out-of-scope file, stop and surface it:
"Implementing [criterion] requires modifying [file], which is out of scope.
Shall I proceed or create a separate story?"
-- **Test is not optional for Logic/Integration** — do not mark implementation
- complete without the test file existing
+- **Test is not optional for Logic/Integration** (at `qa.level: standard`/`full`) —
+ do not mark implementation complete without the test file existing. At
+ `qa.level: minimal` tests are not required and this does not apply.
- **Visual/Feel criteria are deferred, not skipped** — mark them as DEFERRED
in the summary; they will be manually verified in `/story-done`
- **Ask before large structural decisions** — if the story requires an
diff --git a/.claude/skills/estimate/SKILL.md b/.claude/skills/estimate/SKILL.md
index 042a2d7c..25733f4d 100644
--- a/.claude/skills/estimate/SKILL.md
+++ b/.claude/skills/estimate/SKILL.md
@@ -1,6 +1,6 @@
---
name: estimate
-description: "Estimates task effort by analyzing complexity, dependencies, historical velocity, and risk factors. Produces a structured estimate with confidence levels."
+description: "Estimate task effort from complexity, dependencies, velocity, risk. Structured estimate with confidence levels."
argument-hint: "[task-description]"
user-invocable: true
allowed-tools: Read, Glob, Grep
diff --git a/.claude/skills/gate-check/CONTRACT.md b/.claude/skills/gate-check/CONTRACT.md
new file mode 100644
index 00000000..3e0e942b
--- /dev/null
+++ b/.claude/skills/gate-check/CONTRACT.md
@@ -0,0 +1,81 @@
+# /gate-check — Handoff Contract
+
+## Role in Pipeline
+Validates whether the project is ready to advance from one development phase to the next by auditing required artifacts and quality checks, producing a PASS / NOT ASSESSED / CONCERNS / FAIL verdict (NOT ASSESSED outranks PASS — a gate that could not check part of its scope has not established readiness; see SKILL.md's verdict section for the precedence order), and — on PASS with user confirmation — writing the new stage name to `project.stage` in `project.yaml` (and legacy `production/stage.txt` for backward compatibility).
+
+## Inputs Required
+
+### Files That Must Exist
+| File | Required Fields / Sections | Read-Only? |
+|------|---------------------------|-----------|
+| `project.yaml` (`project.stage`, fallback `production/stage.txt`) | Stage name (used when no argument provided, to auto-detect current stage) | Yes |
+| `project.yaml` (`modes.workflow`, default `standard`; `workflow_overrides.system_overrides.*`, `workflow_overrides.art_bible_strict`) | Workflow tier — selects the per-gate artifact checklist (Section 2b); per-system overrides resolved when validating MVP GDDs | Yes |
+| `docs/engine-reference/[engine]/VERSION.md` | Engine version, post-cutoff risk levels (read during engine validation checks) | Yes |
+| `.claude/docs/technical-preferences.md` | Legacy fallback for `engine.*`, `naming.*` and `performance.*` when those keys are absent or empty in `project.yaml`; sole source for forbidden patterns (never migrated). Referenced in quality checks | Yes — required only for keys absent from `project.yaml` |
+| `docs/consistency-failures.md` | Domain-tagged entries surfaced as increased-scrutiny context (read if exists; skip if absent) | Yes |
+
+### Phase-specific inputs (subset read depending on target gate)
+| Target Gate | Key Files Checked |
+|-------------|------------------|
+| Concept → Systems Design | `design/gdd/game-concept.md`; pillars either inside it **or** in an optional `design/gdd/game-pillars.md` |
+| Systems Design → Technical Setup | `design/gdd/systems-index.md`, all MVP GDDs in `design/gdd/`, cross-GDD review report |
+| Technical Setup → Pre-Production | `docs/architecture/` ADRs (≥3), `docs/engine-reference/[engine]/deprecated-apis.md`, `docs/architecture/architecture.md`, `docs/architecture/requirements-traceability.md`, `design/accessibility-requirements.md`, `design/ux/interaction-patterns.md` |
+| Pre-Production → Production | `prototypes/` (≥1 concept REPORT.md), `production/sprints/` (first sprint plan), `docs/architecture/control-manifest.md`, `production/epics/` (Foundation + Core layer epics), `production/qa/playtests/` (≥3 sessions), `design/ux/hud.md`, `design/ux/` key screen specs |
+| Production → Polish | code-root subsystems (resolve per `.claude/docs/code-root-resolution.md`), `tests/unit/` + `tests/integration/` (all Logic stories covered), `production/qa/smoke-*.md` (PASS verdict), `production/qa/playtests/` (≥3 sessions) |
+| Polish → Release | Full story test evidence for all Must Have stories, QA sign-off report, localization check, `production/qa/` QA plan, release checklist output, changelog |
+
+### Preconditions
+- The target phase argument must be one of: `systems-design`, `technical-setup`, `pre-production`, `production`, `polish`, `release`; if omitted, auto-detects from `project.stage` in `project.yaml` (fallback `production/stage.txt`) and validates the next transition
+- The skill does not require any prior skill to have run in the same session, but it will surface missing prerequisites (e.g., missing ADRs, missing playtest reports) as blockers in the verdict
+
+## Outputs Produced
+
+### Files Written
+| File | Guaranteed Fields / Sections | Notes |
+|------|------------------------------|-------|
+| `production/gate-checks/gate-[phase]-[date].md` (or path chosen by user) | Full checklist with per-item status, Blockers list, Recommendations, Verdict, Chain-of-Verification note | written only after user approves ("May I write this gate check report to production/gate-checks/?") |
+| `project.yaml` (`project.stage`) + legacy `production/stage.txt` | New stage name (dual-write for backward compat) | written ONLY when verdict is PASS AND user explicitly confirms; never written on CONCERNS or FAIL |
+
+### Output Guarantees
+- The gate report always contains: artifact checklist (with file sizes or "MISSING"), quality check results, list of blockers (empty if PASS), recommendations, and the Chain-of-Verification note
+- `project.stage` (and legacy `production/stage.txt`) is updated to the new stage name only on a confirmed PASS — never speculatively
+- Any item that cannot be automatically verified is marked `MANUAL CHECK NEEDED` and the user is asked before the verdict is finalized
+
+## Immutability Rules
+- READS but does NOT modify: all GDDs in `design/gdd/`, all ADRs in `docs/architecture/`, `docs/architecture/control-manifest.md`, `docs/architecture/tr-registry.yaml`, `.claude/docs/technical-preferences.md` (legacy fallback), `docs/engine-reference/[engine]/VERSION.md`, `docs/engine-reference/[engine]/deprecated-apis.md`, all story files in `production/epics/`, all sprint files in `production/sprints/`, all playtest files in `production/qa/playtests/`, source files in the code root (Grep only), test files in `tests/` (run via Bash)
+- MODIFIES: `project.yaml` (`project.stage` only) + legacy `production/stage.txt` (both on PASS + user confirmation only), `production/gate-checks/[report].md` (new file, with user approval)
+- Does NOT modify story files, ADRs, GDDs, or any source/test code
+
+## Hard Constraints (Never Violate)
+- Never writes stage (either `project.yaml` `project.stage` or legacy `production/stage.txt`) unless the verdict is PASS and the user has explicitly confirmed advancement
+- Never writes stage on a CONCERNS or FAIL verdict under any circumstances
+- Never auto-advances stage — even a PASS verdict requires explicit user confirmation before the file is written
+- Never assumes PASS for items that cannot be automatically verified — always marks them `MANUAL CHECK NEEDED` and asks the user
+- Never blocks the user from advancing — the verdict is advisory; if the user overrides, document the risks explicitly in the gate report
+- Always runs Chain-of-Verification (5 challenge questions) after drafting the verdict before finalizing it
+- If any Vertical Slice Validation item is NO at the Pre-Production → Production gate, the verdict is automatically FAIL regardless of all other checks — and regardless of workflow tier (tier reductions relax what must *exist*, never make a broken built artifact passable)
+- Workflow-tier reductions (Section 2b) only ever *relax* a requirement (Required → CONCERNS-if-absent, or drop); they never add one. The sole exception that adds is `workflow_overrides`: a system pinned via `system_overrides` to a higher tier than the project blocks the gate until that one system's GDD meets the higher section count, and `art_bible_strict: true` forces the complete art bible regardless of tier
+- gate-check honors `modes.workflow` but is exempt from `modes.automation` — the collaborative prompting protocol (Section 8) always applies; a phase gate is never auto-run
+
+## Downstream Skill Expects
+**Next skill (on PASS):** varies by gate
+
+| Gate Passed | Enabled downstream skill |
+|-------------|-------------------------|
+| Concept → Systems Design | `/map-systems` |
+| Systems Design → Technical Setup | `/architecture-decision`, `/setup-engine` |
+| Technical Setup → Pre-Production | `/create-epics`, `/create-stories`, prototyping skills |
+| Pre-Production → Production | `/dev-story`, `/sprint-plan`, `/story-readiness` |
+| Production → Polish | `/perf-profile`, `/playtest-report`, `/smoke-check` |
+| Polish → Release | `/launch-checklist`, `/release-checklist` |
+
+- Downstream skills read `project.stage` from `project.yaml` (fallback `production/stage.txt`) to confirm their phase is active before proceeding
+- `/dev-story` specifically checks that the project is in Production stage before implementing stories; if the resolved stage is still `Pre-Production`, stories may be blocked
+- `/create-epics` requires `docs/architecture/control-manifest.md` to exist (enforced by the Technical Setup → Pre-Production gate)
+
+## Known Fragile Points
+- `project.stage` in `project.yaml` (with legacy `production/stage.txt` as fallback) is the authoritative stage indicator — if either is manually edited to a wrong value outside of `/gate-check`, auto-detection in future sessions will be incorrect; never edit them outside of a PASS gate
+- The Production → Polish gate runs the test suite via Bash. If the test runner command is not configured or fails to start (e.g. the `godot --headless --script` path is wrong), the test check now yields `NOT ASSESSED`, which outranks PASS — so the gate cannot advance a stage on the strength of a suite that never ran. Without the `NOT ASSESSED` branch this masks silent test regressions: Section 3 runs the suite "if a test runner is configured", and with no else an unconfigured runner simply contributes nothing to the verdict
+- The Pre-Production → Production gate has a hard Vertical Slice validation block; any subjective checklist item (e.g., "core mechanic feels good") requires a user response via `AskUserQuestion` — if the user answers without playing the build, a false PASS is possible
+- Gate report files in `production/gate-checks/` are not validated for completeness by any downstream skill; a partial report written due to a session interruption will look identical to a complete one
+- `docs/consistency-failures.md` is optional context that adjusts scrutiny but does not change the formal checklist; if this file exists but is stale, the increased-scrutiny signals may point at resolved issues
diff --git a/.claude/skills/gate-check/SKILL.md b/.claude/skills/gate-check/SKILL.md
index 8feb8f66..d76a28d1 100644
--- a/.claude/skills/gate-check/SKILL.md
+++ b/.claude/skills/gate-check/SKILL.md
@@ -1,12 +1,18 @@
---
name: gate-check
-description: "Validate readiness to advance between development phases. Produces a PASS/CONCERNS/FAIL verdict with specific blockers and required artifacts. Use when user says 'are we ready to move to X', 'can we advance to production', 'check if we can start the next phase', 'pass the gate'."
+description: "Ready to advance between development phases? PASS/CONCERNS/NOT ASSESSED/FAIL with blockers and required artifacts. 'Can we move to production?'"
argument-hint: "[target-phase: systems-design | technical-setup | pre-production | production | polish | release] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Bash, Write, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Bash, Write, Edit, Agent, AskUserQuestion
model: opus
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,workflow,qa.level,testing.strict,performance.enforce,team.size,project.stage,system_overrides`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
# Phase Gate Validation
This skill validates whether the project is ready to advance to the next development
@@ -27,8 +33,7 @@ The project progresses through these stages:
6. **Polish** — Performance, playtesting, bug fixing
7. **Release** — Launch prep, certification
-**When a gate passes**, write the new stage name to `production/stage.txt`
-(single line, e.g. `Production`). This updates the status line immediately.
+**When a gate passes**, update the stage in both `project.yaml` (set `project.stage: <new-stage>`) AND write the new stage name to `production/stage.txt` (single line, e.g. `Production`). Dual-write keeps backward compatibility with hooks that haven't migrated yet. This updates the status line immediately.
---
@@ -36,13 +41,40 @@ The project progresses through these stages:
**Target phase:** `$ARGUMENTS[0]` (blank = auto-detect current stage, then validate next transition)
-Also resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
Note: in `solo` mode, director spawns (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE) are skipped — gate-check becomes artifact-existence checks only. In `lean` mode, all four directors still run (phase gates are the purpose of lean mode).
+**`workflow`** (per `.claude/docs/workflow-modes.md`):
+
+`gate-check` runs project-wide, so it uses the project-level `workflow` for the
+gate's overall artifact checklist (the loaded gate file), AND consults
+`workflow_overrides.system_overrides.<system>` per-system when validating MVP
+GDDs — a system pinned to a higher tier must meet that tier's section count
+before the gate passes, regardless of the project-level workflow (see Section 2b,
+"Per-system overrides").
+
+> **gate-check honors `workflow` but is exempt from `automation`.** The artifact
+> checklist changes per tier; the collaborative prompting protocol (Section 8)
+> always applies — a phase gate is a deliberate human checkpoint, never auto-run.
+
+**`qa.level`**: controls test enforcement at phase gates, where `workflow`
+controls which artifacts are required. `modes.rigor` sets both together; set
+`qa.level` explicitly to vary enforcement alone. At `minimal`, no test gates apply — the
+test-evidence / unit-test / smoke artifact items become non-required and the
+Section 3 `testing.strict` check is a no-op. At `standard`, Logic + Integration
+tests must pass. At `full`, a full coverage check + regression suite are required
+(coverage minimum from `qa.coverage_minimum` if set).
+
+**`team.size`**: does not change how many directors spawn at a phase gate — panel
+width is `workflow`'s axis (Section 4b). This value affects only the
+**specialist depth within each director's review**.
+`individual` uses the core specialist set; `small` the standard set; `studio`
+adds engine sub-specialists. It never skips a director — skipping directors is
+`review_mode`'s job. Both `review_mode` and `team.size` are now fronted by
+`modes.rigor` — one rigor choice sets both — and each still overrides that axis
+when set explicitly (a full-rigor project gets the `studio` set; lighter tiers
+get `individual`).
+
- **With argument**: `/gate-check production` — validate readiness for that specific phase
- **No argument**: Auto-detect current stage using the same heuristics as
`/project-stage-detect`, then **confirm with the user before running**:
@@ -59,198 +91,129 @@ Note: in `solo` mode, director spawns (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GA
## 2. Phase Gate Definitions
-### Gate: Concept → Systems Design
-
-**Required Artifacts:**
-- [ ] `design/gdd/game-concept.md` exists and has content
-- [ ] Game pillars defined (in concept doc or `design/gdd/game-pillars.md`)
-- [ ] Visual Identity Anchor section exists in `design/gdd/game-concept.md` (from brainstorm Phase 4 art-director output)
-
-**Recommended (not blocking):**
-- [ ] Concept prototype exists in `prototypes/` with a REPORT.md showing PROCEED verdict
- (`/prototype [core-mechanic]`) — skipping this means GDDs may be written for an
- idea that hasn't been played. Acceptable if the concept is proven by other means.
+Each gate's checklist — required artifacts, quality checks, and its workflow-tier
+reductions — lives in its own file. **Read only the row for the target phase
+transition; never load the others.**
-**Quality Checks:**
-- [ ] Game concept has been reviewed (`/design-review` verdict not MAJOR REVISION NEEDED)
-- [ ] Core loop is described and understood
-- [ ] Target audience is identified
-- [ ] Visual Identity Anchor contains a one-line visual rule and at least 2 supporting visual principles
+| Gate | Definition file |
+|------|-----------------|
+| Concept → Systems Design | `.claude/skills/gate-check/references/gate-systems-design.md` |
+| Systems Design → Technical Setup | `.claude/skills/gate-check/references/gate-technical-setup.md` |
+| Technical Setup → Pre-Production | `.claude/skills/gate-check/references/gate-pre-production.md` |
+| Pre-Production → Production | `.claude/skills/gate-check/references/gate-production.md` |
+| Production → Polish | `.claude/skills/gate-check/references/gate-polish.md` |
+| Polish → Release | `.claude/skills/gate-check/references/gate-release.md` |
----
-
-### Gate: Systems Design → Technical Setup
-
-**Required Artifacts:**
-- [ ] Systems index exists at `design/gdd/systems-index.md` with at least MVP systems enumerated
-- [ ] All MVP-tier GDDs exist in `design/gdd/` and individually pass `/design-review`
-- [ ] A cross-GDD review report exists in `design/gdd/` (from `/review-all-gdds`)
+Each file states the `full` baseline first, then the `standard` and `minimal`
+reductions for that gate. Apply the tier resolved in Section 1.
-**Quality Checks:**
-- [ ] All MVP GDDs pass individual design review (8 required sections, no MAJOR REVISION NEEDED verdict)
-- [ ] `/review-all-gdds` verdict is not FAIL (cross-GDD consistency and design theory checks pass)
-- [ ] All cross-GDD consistency issues flagged by `/review-all-gdds` are resolved or explicitly accepted
-- [ ] System dependencies are mapped in the systems index and are bidirectionally consistent
-- [ ] MVP priority tier is defined
-- [ ] No stale GDD references flagged (older GDDs updated to reflect decisions made in later GDDs)
+## 2b. Workflow Tier Adjustment
----
-
-### Gate: Technical Setup → Pre-Production
-
-**Required Artifacts:**
-- [ ] Engine chosen (CLAUDE.md Technology Stack is not `[CHOOSE]`)
-- [ ] Technical preferences configured (`.claude/docs/technical-preferences.md` populated)
-- [ ] Art bible exists at `design/art/art-bible.md` with at least Sections 1–4 (Visual Identity Foundation)
-- [ ] At least 3 Architecture Decision Records in `docs/architecture/` covering
- Foundation-layer systems (scene management, event architecture, save/load)
-- [ ] Engine reference docs exist in `docs/engine-reference/[engine]/`
-- [ ] Test framework initialized: `tests/unit/` and `tests/integration/` directories exist
-- [ ] CI/CD test workflow exists at `.github/workflows/tests.yml` (or equivalent)
-- [ ] At least one example test file exists to confirm the framework is functional
-- [ ] Master architecture document exists at `docs/architecture/architecture.md`
-- [ ] Architecture traceability index exists at `docs/architecture/requirements-traceability.md`
-- [ ] `/architecture-review` has been run (a review report file exists in `docs/architecture/`)
-- [ ] `design/accessibility-requirements.md` exists with accessibility tier committed
-- [ ] `design/ux/interaction-patterns.md` exists (pattern library initialized, even if minimal)
-
-**Quality Checks:**
-- [ ] Architecture decisions cover core systems (rendering, input, state management)
-- [ ] Technical preferences have naming conventions and performance budgets set
-- [ ] Accessibility tier is defined and documented (even "Basic" is acceptable — undefined is not)
-- [ ] At least one screen's UX spec started (often the main menu or core HUD is designed during Technical Setup)
-- [ ] All ADRs have an **Engine Compatibility section** with engine version stamped
-- [ ] All ADRs have a **GDD Requirements Addressed section** with explicit GDD linkage
-- [ ] No ADR references APIs listed in `docs/engine-reference/[engine]/deprecated-apis.md`
-- [ ] All HIGH RISK engine domains (per VERSION.md) have been explicitly addressed
- in the architecture document or flagged as open questions
-- [ ] Architecture traceability matrix has **zero Foundation layer gaps**
- (all Foundation requirements must have ADR coverage before Pre-Production)
-
-**ADR Circular Dependency Check**: For all ADRs in `docs/architecture/`, read each ADR's
-"ADR Dependencies" / "Depends On" section. Build a dependency graph (ADR-A → ADR-B means
-A depends on B). If any cycle is detected (e.g. A→B→A, or A→B→C→A):
-- Flag as **FAIL**: "Circular ADR dependency: [ADR-X] → [ADR-Y] → [ADR-X].
- Neither can reach Accepted while the cycle exists. Remove one 'Depends On' edge to
- break the cycle."
-
-**Engine Validation** (read `docs/engine-reference/[engine]/VERSION.md` first):
-- [ ] ADRs that touch post-cutoff engine APIs are flagged with Knowledge Risk: HIGH/MEDIUM
-- [ ] `/architecture-review` engine audit shows no deprecated API usage
-- [ ] All ADRs agree on the same engine version (no stale version references)
+Each gate file carries its own tier reductions (see Section 2). Two rules apply
+across all of them:
----
-
-### Gate: Pre-Production → Production
-
-**Required Artifacts:**
-- [ ] Vertical slice exists in `prototypes/` with a REPORT.md (run `/vertical-slice`) — **recommended, not blocking**; if absent, surface as CONCERNS
-- [ ] First sprint plan exists in `production/sprints/`
-- [ ] Art bible is complete (all 9 sections) and AD-ART-BIBLE sign-off verdict is recorded in `design/art/art-bible.md`
-- [ ] Entity inventory exists at `design/assets/entity-inventory.md` (recommended — run `/asset-spec` with no arguments to generate collaboratively from GDDs + art bible)
-- [ ] All MVP-tier GDDs from systems index are complete
-- [ ] Master architecture document exists at `docs/architecture/architecture.md`
-- [ ] At least 3 ADRs covering Foundation-layer decisions exist in `docs/architecture/`
-- [ ] All Foundation and Core layer ADRs have status `Accepted` (not `Proposed`) — stories cannot be unblocked until their governing ADR is accepted
-- [ ] Control manifest exists at `docs/architecture/control-manifest.md`
- (generated by `/create-control-manifest` from Accepted ADRs)
-- [ ] Epics defined in `production/epics/` with at least Foundation and Core
- layer epics present (use `/create-epics layer: foundation` and
- `/create-epics layer: core` to create them, then `/create-stories [epic-slug]`
- for each epic)
-- [ ] Vertical Slice build exists and is playable (not just scope-defined) — **recommended, not blocking**; if absent, surface as CONCERNS
-- [ ] Vertical Slice has been playtested with at least 1 documented session — **recommended, not blocking**; if absent, surface as CONCERNS
-- [ ] Vertical Slice playtest report exists at `production/playtests/` or equivalent — **recommended, not blocking**; if absent, surface as CONCERNS
-- [ ] UX specs exist for key screens: main menu, core gameplay HUD (at `design/ux/`), pause menu
-- [ ] HUD design document exists at `design/ux/hud.md` (if game has in-game HUD)
-- [ ] All key screen UX specs have passed `/ux-review` (verdict APPROVED or NEEDS REVISION accepted)
-
-**Quality Checks:**
-- [ ] **Core loop fun is validated** — playtest data confirms the central mechanic is enjoyable, not just functional. Explicitly check the Vertical Slice playtest report.
-- [ ] UX specs cover all UI Requirements sections from MVP-tier GDDs
-- [ ] Interaction pattern library documents patterns used in key screens
-- [ ] Accessibility tier from `design/accessibility-requirements.md` is addressed in all key screen UX specs
-- [ ] Sprint plan references real story file paths from `production/epics/`
- (not just GDDs — stories must embed GDD req ID + ADR reference)
-- [ ] **Vertical Slice is COMPLETE**, not just scoped — the build demonstrates the full core loop end-to-end. At least one complete [start → challenge → resolution] cycle works.
-- [ ] Architecture document has no unresolved open questions in Foundation or Core layers
-- [ ] All ADRs have Engine Compatibility sections stamped with the engine version
-- [ ] All ADRs have ADR Dependencies sections (even if all fields are "None")
-- [ ] Manual validation confirms GDDs + architecture + epics are coherent
- (run `/review-all-gdds` and `/architecture-review` if not done recently)
-- [ ] **Core fantasy is delivered** — at least one playtester independently described an experience that matches the Player Fantasy section of the core system GDDs (without being prompted).
-
-**Vertical Slice Validation** (only run these checks if a Vertical Slice was built):
-- [ ] A human has played through the core loop without developer guidance
-- [ ] The game communicates what to do within the first 2 minutes of play
-- [ ] No critical "fun blocker" bugs exist in the Vertical Slice build
-- [ ] The core mechanic feels good to interact with (this is a subjective check — ask the user)
-
-> **Verdict rules for Vertical Slice:**
-> - **Slice was built AND any validation item is NO** → verdict is automatically FAIL. A broken
-> or unfun vertical slice should not advance to Production.
-> - **Slice was not built (skipped)** → downgrade to CONCERNS only, not FAIL. Surface the risk
-> clearly: "Advancing without a validated Vertical Slice increases the risk of late-stage design
-> pivots. Recommended before committing full production scope." The user decides.
-> - Skipping is a valid solo dev or time-constrained call. Shipping a broken one is not.
-
----
-
-### Gate: Production → Polish
-
-**Required Artifacts:**
-- [ ] `src/` has active code organized into subsystems
-- [ ] All core mechanics from GDD are implemented (cross-reference `design/gdd/` with `src/`)
-- [ ] Main gameplay path is playable end-to-end
-- [ ] Test files exist in `tests/unit/` and `tests/integration/` covering Logic and Integration stories
-- [ ] All Logic stories from this sprint have corresponding unit test files in `tests/unit/`
-- [ ] Smoke check has been run with a PASS or PASS WITH WARNINGS verdict — report exists in `production/qa/`
-- [ ] QA plan exists in `production/qa/` (generated by `/qa-plan`) covering this sprint or final production sprint
-- [ ] At least one QA plan exists in `production/qa/` covering this production phase — run `/qa-plan` if missing (CONCERNS — advisory, not blocking)
-- [ ] QA sign-off report exists in `production/qa/` (generated by `/team-qa`) with verdict APPROVED or APPROVED WITH CONDITIONS
-- [ ] At least 3 distinct playtest sessions documented in `production/playtests/`
-- [ ] Playtest reports cover: new player experience, mid-game systems, and difficulty curve
-- [ ] Fun hypothesis from Game Concept has been explicitly validated or revised
-
-**Quality Checks:**
-- [ ] Tests are passing (run test suite via Bash)
-- [ ] No critical/blocker bugs in any bug tracker or known issues
-- [ ] Core loop plays as designed (compare to GDD acceptance criteria)
-- [ ] Performance is within budget (check technical-preferences.md targets)
-- [ ] Playtest findings have been reviewed and critical fun issues addressed (not just documented)
-- [ ] No "confusion loops" identified — no point in the game where >50% of playtesters got stuck without knowing why
-- [ ] Difficulty curve matches the Difficulty Curve design doc (if one exists at `design/difficulty-curve.md`)
-- [ ] All implemented screens have corresponding UX specs (no "designed in-code" screens)
-- [ ] Interaction pattern library is up-to-date with all patterns used in implementation
-- [ ] Accessibility compliance verified against committed tier in `design/accessibility-requirements.md`
-
----
-
-### Gate: Polish → Release
-
-**Required Artifacts:**
-- [ ] All features from milestone plan are implemented
-- [ ] Content is complete (all levels, assets, dialogue referenced in design docs exist)
-- [ ] Localization strings are externalized (no hardcoded player-facing text in `src/`)
-- [ ] QA test plan exists (`/qa-plan` output in `production/qa/`)
-- [ ] QA sign-off report exists (`/team-qa` output — APPROVED or APPROVED WITH CONDITIONS)
-- [ ] All Must Have story test evidence is present (Logic/Integration: test files pass; Visual/Feel/UI: sign-off docs in `production/qa/evidence/`)
-- [ ] Smoke check passes cleanly (PASS verdict) on the release candidate build
-- [ ] No test regressions from previous sprint (test suite passes fully)
-- [ ] Balance data has been reviewed (`/balance-check` run)
-- [ ] Release checklist completed (`/release-checklist` or `/launch-checklist` run)
-- [ ] Store metadata prepared (if applicable)
-- [ ] Changelog / patch notes drafted
-
-**Quality Checks:**
-- [ ] Full QA pass signed off by `qa-lead`
-- [ ] All tests passing
-- [ ] Performance targets met across all target platforms
-- [ ] No known critical, high, or medium-severity bugs
-- [ ] Accessibility basics covered (remapping, text scaling if applicable)
-- [ ] Localization verified for all target languages
-- [ ] Legal requirements met (EULA, privacy policy, age ratings if applicable)
-- [ ] Build compiles and packages cleanly
+> **How to apply:** run the loaded gate's checklist, then apply that file's tier
+> reduction for the tier resolved in Section 1. **drop** = not checked at this
+> tier; **→ recommended** = absent surfaces as CONCERNS, never a Blocker; items
+> not named keep their baseline status. Reductions only ever *relax* a
+> requirement — the only thing that adds one is `workflow_overrides` (below).
+>
+> **`qa.level` (Section 1) further relaxes the test items independently of the
+> tier:** at `qa.level: minimal` the test-evidence / unit-test items become
+> non-required at every workflow tier (so even `workflow: full` does not require
+> them); the Section 3 `testing.strict` check is then a no-op.
+>
+> **The smoke check is excluded from that relaxation, and is the floor.**
+> `qa.level` relaxes *per-story test evidence*; a smoke check is **build health**,
+> not story evidence, and the two are already held apart on exactly this basis in
+> `.claude/docs/coding-standards.md` ("`/smoke-check` is a build-health gate, not
+> a per-story evidence gate ... This divergence is intentional"). So a gate file
+> that requires a smoke report keeps requiring it at every `qa.level`.
+>
+> Without that exclusion the Production → Polish gate had **zero required
+> artifacts at `rigor: minimal`** and could not fail on artifacts by
+> construction: `minimal` reduced the gate to the smoke check alone, `qa.level`
+> then dropped the smoke check too, and one `modes.rigor` setting fires both. Two
+> agents found it independently on the same fixture.
+
+> **A gate with no required artifacts left must say so, and may not return
+> PASS.** After applying the tier reduction and the `qa.level` relaxation, count
+> what remains required. If the count is zero, report
+> **NOT ASSESSED** naming both reducers and the gate — *"Production → Polish at
+> `workflow: minimal` + `qa.level: minimal` leaves no required artifact; this
+> gate verified nothing"* — rather than a PASS earned by having nothing to check.
+> Per `.claude/rules/skill-authoring.md` obligation 1, a run that could not
+> assess its scope has not established that the scope is good, and obligation 3
+> requires the emptiness to be visible in the output rather than inferable from
+> a silent green.
+>
+> **`performance.enforce` is likewise independent of the tier, and a tier
+> reduction never suppresses it.** The performance check in Section 3 runs at
+> every workflow tier, and `block` makes a breach a Blocker at every workflow
+> tier. Do **not** read a gate file's *"everything else drops"* as dropping it:
+> `off` is the only thing that makes budgets informational, and it is a
+> deliberate choice the user makes on the same key.
+>
+> Without this, `performance.enforce: block` is **inert on every `rigor: minimal`
+> project** — `minimal` used to reduce the Polish gate to the smoke check alone, and
+> "Performance is within budget" sits in the dropped remainder. Two independent
+> agents run against a project breaching three of four budgets both spotted the
+> contradiction, both overrode the literal reading to reach FAIL, and both
+> flagged it as the call most likely to be wrong. A setting that only works
+> because agents disregard a rule is not wired.
+
+### Per-system overrides (`workflow_overrides.system_overrides`)
+
+Independent of the project-level tier above, and applied **only** on the gates
+that validate MVP GDDs (Systems Design → Technical Setup, and the GDD-completeness
+checks at Pre-Production → Production). For each system, resolve its effective
+tier:
+
+1. If the block's `system_overrides` lists `<system>` → that tier
+2. Else the project-level `workflow`
+
+**Before applying any of them, check the block the other way round: does every
+KEY match a system?** `<system>` is the GDD filename stem
+(`.claude/docs/workflow-modes.md`), so for each key in `system_overrides`, look
+for `design/gdd/<key>.md`. Any key with no matching stem is reported, naming the
+key and listing the stems that do exist:
+
+> `system_overrides key 'no-such-system' matches no GDD in design/gdd/. Available stems: combat, inventory, hammer-heat-system. This override is doing nothing.`
+
+Surface it as a **CONCERNS**-level finding, not a Blocker — the project is still
+gateable, but an override the user believes is in force and is not is exactly how
+a documented escape hatch silently stops working.
+
+> **This is the one site that performs the check.** `workflow-modes.md:72` says
+> *"a key that matches no system is an error, not a no-op"*, and this is the only
+> skill that implements it — the three story skills resolve only in the
+> system → override direction, so an orphan key is never looked up and
+> never noticed. `/gate-check` is the right home: it already resolves the whole
+> block, and it is the project-wide audit rather than a per-story one.
+
+Validate each GDD against its own effective tier's section count:
+
+- A system pinned **higher** than the project (e.g. `system_overrides.combat:
+ full` on a `standard` project) **blocks the gate** until that system's GDD
+ meets the higher bar (combat → all 8 sections). This is the one case where a
+ per-system setting makes the gate *stricter* than the project tier.
+- A system pinned **lower** (e.g. `inventory: minimal`) relaxes only that system
+ — its GDD is checked at the lower tier; every other system stays at the project
+ level. A system pinned **`minimal` imposes no GDD section requirement at all**
+ (`minimal` = "game brief replaces GDDs" — `.claude/docs/workflow-modes.md`): it
+ never blocks the gate on a missing or incomplete GDD. Do not invent an
+ "acceptance-criteria-only" floor for it — there is none.
+
+> **Additive overrides (the only things that make the gate stricter).**
+> - `workflow_overrides.art_bible_strict: true` forces the complete (9-section)
+> art bible at the Technical Setup → Pre-Production and Pre-Production →
+> Production gates regardless of tier or whether visual-asset stories exist.
+> - `workflow_overrides.edge_cases: true` and `workflow_overrides.tuning_knobs:
+> true` force those GDD sections required when validating GDD completeness,
+> additive on top of the resolved tier (e.g. at `standard`, `tuning_knobs: true`
+> makes the otherwise-optional Tuning Knobs section blocking). These never
+> relax — a `false` value is the default/no-op, never a way to drop a section
+> the tier already requires.
---
@@ -266,27 +229,132 @@ increased scrutiny on those specific checks.
For each item in the target gate:
### Artifact Checks
-- Use `Glob` and `Read` to verify files exist and have meaningful content
-- Don't just check existence — verify the file has real content (not just a template header)
-- For code checks, verify directory structure and file counts
+
+**Resolve existence and counts deterministically — do not open files to find out
+what exists:**
+
+```
+Bash: bash .claude/scripts/artifact-check.sh --phase [source-phase]
+```
+
+Pass the phase being advanced *from* (its steps are the work that must be
+complete): `systems-design` for the Systems Design → Technical Setup gate,
+`pre-production` for Pre-Production → Production, and so on.
+
+It reads `workflow-catalog.yaml` — which already encodes each step's `glob`,
+`pattern`, `min_count` and `any_of` — and reports per step:
+
+| status | Meaning |
+|---|---|
+| `PRESENT` | glob matched, `min_count` met, `pattern` found where specified |
+| `ABSENT` | nothing matched |
+| `SHORT` | matched but fewer than `min_count` (`count=` and `min=` given) |
+| `PATTERN_MISS` | files exist but none contains the required marker |
+| `NO_CHECK` | the step declares no artifact — **not detectable from disk** |
+
+It emits observations, never a verdict: **you** apply the workflow tier and the
+required/optional split from Section 2. An `ABSENT` required artifact is a
+blocker at `full` and frequently not one at `minimal`; the script does not know
+that and does not decide it.
+
+**`NO_CHECK` is not `PRESENT`.** The header prints a `NO_CHECK:` count before any
+row precisely so this cannot be skimmed past. Those steps were *scanned*, not
+*satisfied* — carry each into Section 4 (Collaborative Assessment) and ask, or
+mark MANUAL CHECK NEEDED. A gate that reports PASS because most of its checklist
+was undetectable is the failure mode this count exists to prevent.
+
+**Existence is not adequacy.** The script cannot tell a real document from a
+template skeleton. So: for any artifact the verdict actually turns on, spot-read
+it and confirm it has real content — the same escalation rule the
+`gdd-structure-check.sh` step below uses. Do not spot-read artifacts the verdict
+does not turn on.
+
+> **A smoke report is always an artifact the verdict turns on — spot-reading it
+> is mandatory, not discretionary.** At `minimal` it is frequently the *only*
+> required artifact, so the whole gate rests on one file that nothing generated
+> and nothing verifies. Check its claims against the repo, and raise any that the
+> tree contradicts:
+>
+> - It reports a passing automated suite → `tests/` must actually contain test
+> files and the project must have a runner. "24 passed, 0 failed" in a repo
+> with no `tests/unit/`, no `tests/integration/` and no runner is a finding,
+> not evidence.
+> - It marks a critical path PASS → the code for that path must exist in the code
+> root. A PASS on "banking ends the run" with no banking code is a finding.
+> - It carries no date, or predates the newest commit touching the code root →
+> say so; a stale smoke report describes a build that no longer exists.
+>
+> Report a contradiction at the same level the artifact was required at: a
+> Blocker where the smoke check is required, CONCERNS where it is recommended.
+> This was found by handing a gate a one-page fabricated smoke report on a
+> two-file repo; it cleared on existence plus a verdict-line grep.
+
+For code checks, verify directory structure and file counts.
**Systems Design → Technical Setup gate — cross-GDD review check**:
Use `Glob('design/gdd/gdd-cross-review-*.md')` to find the `/review-all-gdds` report.
-If no file matches, mark the "cross-GDD review report exists" artifact as **FAIL** and
-surface it prominently: "No `/review-all-gdds` report found in `design/gdd/`. Run
-`/review-all-gdds` before advancing to Technical Setup."
-If a file is found, read it and check the verdict line: a FAIL verdict means the
-cross-GDD consistency check failed and must be resolved before advancing.
+If no file matches: at `full` mark the "cross-GDD review report exists" artifact as
+**FAIL** and surface it prominently ("No `/review-all-gdds` report found in
+`design/gdd/`. Run `/review-all-gdds` before advancing to Technical Setup."); at
+`standard` the report is recommended, so mark it **CONCERNS**, not a blocker; at
+`minimal` this gate is not applicable (see the gate file). If a file is found, read it and
+check the verdict line: a FAIL verdict means the cross-GDD consistency check failed
+and must be resolved before advancing.
### Quality Checks
-- For test checks: Run the test suite via `Bash` if a test runner is configured
-- For design review checks: `Read` the GDD and check for the 8 required sections
-- For performance checks: `Read` technical-preferences.md and compare against any
- profiling data in `tests/performance/` or recent `/perf-profile` output
-- For localization checks: `Grep` for hardcoded strings in `src/`
+- For test checks: Run the test suite via `Bash` if a test runner is configured.
+ **If no runner is configured, that is `NOT ASSESSED`, not a silent skip** — see
+ the trigger in the verdict section. A gate that ran no tests found no test
+ failures, which is not the same as passing.
+ A test failure's effect on the verdict depends on the `testing.strict` block
+ **resolved in Phase 1** (`resolve_config` merges `project.local.yaml` over
+ `project.yaml`; reading the file directly would drop a local override), per
+ test type:
+ - **Logic** — failures in `tests/unit/`, gated by `testing.strict.logic`.
+ - **Integration** — failures in `tests/integration/`, gated by `testing.strict.integration`.
+ - For each type: take `testing.strict.<type>` from that block; use it only
+ if its value is `true` or `false` (case-insensitive). If the key is absent,
+ empty, or holds any other value, read `testing.strict` as a plain boolean
+ (legacy single-value form); if that too is absent or invalid, default to
+ `true` (Logic and Integration are both strict by default — behavior unchanged
+ from before this setting existed). Surface any unrecognized value to the user.
+ - At a strict (`true`) gate level, failures of that type are **Blockers**
+ (verdict FAIL). At an advisory (`false`) level, they are **Concerns**
+ (verdict minimum CONCERNS, not FAIL) — list them under Recommendations, not
+ Blockers.
+- For design review checks, gather section presence **deterministically** — do not
+ read the GDDs to count headings:
+
+ ```
+ Bash: bash .claude/scripts/gdd-structure-check.sh
+ ```
+
+ It prints a `PRESENT:` / `ABSENT:` pair per GDD and already accepts
+ `## Detailed Design` as satisfying the `Detailed Rules` requirement. It reports
+ presence only and makes no REQUIRED/ADVISORY judgment.
+
+ Then apply each GDD's **effective tier** (per-system resolution below) to those
+ lists — all 8 sections at `full`, the 5 standard sections (+ conditional
+ Formulas) at `standard`. A missing *required* section blocks; a missing section
+ that is optional at the effective tier is advisory. A section reported PRESENT
+ can still fail review if it is an empty heading — spot-read any section the
+ verdict actually turns on.
+- For performance checks: read the budgets (`performance.target_framerate`,
+ `frame_budget_ms`, `draw_call_limit`, `memory_ceiling_mb`) from `project.yaml`
+ (else technical-preferences.md) and compare against any profiling data in
+ `tests/performance/` or recent `/perf-profile` output. What a breach *means*
+ is set by `performance.enforce`, taken from the Phase 1 resolved block (it is
+ locally overridable, so do not read the file for this one):
+ - `warn` (default) — breaches are **CONCERNS**, never Blockers.
+ - `block` — breaches are **Blockers** from the Polish gate onward.
+ - `off` — budgets are informational; do not surface breaches in the verdict.
+
+ Only these three values are recognized. Surface anything else to the user and
+ fall back to `warn` rather than guessing.
+- For localization checks: `Grep` for hardcoded strings in the **code root** (resolve per `.claude/docs/code-root-resolution.md`). **If the code root is unresolved, report `NOT ASSESSED — code root unresolved` rather than zero hits.**
### Cross-Reference Checks
-- Compare `design/gdd/` documents against `src/` implementations
+- Compare `design/gdd/` documents against implementations in the **code root**
- Check that every system referenced in architecture docs has corresponding code
- Verify sprint plans reference real work items
@@ -306,24 +374,54 @@ For items that can't be automatically verified, **ask the user**:
## 4b. Director Panel Assessment
-**Apply review mode before spawning any director:**
-- `solo` → skip all four directors. Note in output: "Director Panel skipped — Solo mode. Gate verdict based on artifact and quality checks only." Proceed to Phase 5.
-- `lean` → spawn all four directors (phase gates always run in lean mode — this is their purpose).
-- `full` → spawn all four directors as normal.
+The panel is set by **two independent axes**, both resolved in Phase 1: `review_mode`
+decides *whether* the panel runs, `workflow` decides *how wide* it is.
+
+**Axis 1 — `review_mode` decides whether any director spawns:**
+- `solo` → skip the panel entirely. Note in output: "Director Panel skipped — Solo mode. Gate verdict based on artifact and quality checks only." Proceed to Phase 5.
+- `lean` → run the panel (phase gates always run in lean mode — this is their purpose).
+- `full` → run the panel.
+
+**Axis 2 — `workflow` decides the panel width.** Directors are Opus-tier, so a
+fixed four-director panel costs a two-system jam exactly what it costs a
+thirty-system commercial project. The gate still runs at every tier; only its
+breadth scales:
+
+| `workflow` | Panel | Directors |
+|---|---|---|
+| `minimal` | 1 | `producer` |
+| `standard` | 2 | `technical-director`, `producer` |
+| `full` | 4 | `creative-director`, `technical-director`, `producer`, `art-director` |
-(Review mode was resolved in Phase 1. Use that stored value here.)
+`producer` is in every panel — scope and schedule readiness is the one judgment
+no tier makes optional. `technical-director` joins at `standard` because that is
+the first tier requiring architecture artifacts. `creative-director` and
+`art-director` join at `full`, the only tier requiring the full art bible and
+UX spec set for them to assess.
-Before generating the final verdict, spawn all four directors as **parallel subagents** via Task using the parallel gate protocol from `.claude/docs/director-gates.md`. Issue all four Task calls simultaneously — do not wait for one before starting the next.
+> **Width is not the same as strictness.** A narrower panel does not soften the
+> verdict: the escalation rule in `.claude/docs/director-gates.md` is unchanged —
+> the strictest verdict returned by *whoever ran* still wins. Do not infer PASS
+> from a perspective that was never consulted.
-**Spawn in parallel:**
+Before generating the final verdict, spawn the directors for the resolved tier as **parallel subagents** via `Agent` using the parallel gate protocol from `.claude/docs/director-gates.md`. Issue all the `Agent` calls simultaneously — do not wait for one before starting the next.
-1. **`creative-director`** — gate **CD-PHASE-GATE** (`.claude/docs/director-gates.md`)
-2. **`technical-director`** — gate **TD-PHASE-GATE** (`.claude/docs/director-gates.md`)
-3. **`producer`** — gate **PR-PHASE-GATE** (`.claude/docs/director-gates.md`)
-4. **`art-director`** — gate **AD-PHASE-GATE** (`.claude/docs/director-gates.md`)
+**Gate IDs:**
+
+1. **`creative-director`** — gate **CD-PHASE-GATE** (`.claude/docs/director-gates/cd-phase-gate.md`)
+2. **`technical-director`** — gate **TD-PHASE-GATE** (`.claude/docs/director-gates/td-phase-gate.md`)
+3. **`producer`** — gate **PR-PHASE-GATE** (`.claude/docs/director-gates/pr-phase-gate.md`)
+4. **`art-director`** — gate **AD-PHASE-GATE** (`.claude/docs/director-gates/ad-phase-gate.md`)
Pass to each: target phase name, list of artifacts present, and the context fields listed in that gate's definition.
+**Name the omissions in the output.** Below the Director Panel summary, when the
+panel ran narrower than four, state which perspectives did not run and how to get
+them — e.g. "Panel: 2 of 4 (`workflow: standard`). Creative and Art perspectives
+not consulted. Run `/gate-check --review full` or set `modes.workflow: full` for
+the complete panel." A silently narrow panel reads as a clean bill of health from
+reviewers who never looked.
+
**Collect all four responses, then present the Director Panel summary:**
```
@@ -376,12 +474,82 @@ Art Director: [READY / CONCERNS / NOT READY]
- [Priority actions to resolve blockers]
- [Optional improvements that aren't blocking]
-### Verdict: [PASS / CONCERNS / FAIL]
+### Verdict: [PASS / NOT ASSESSED / CONCERNS / FAIL]
- **PASS**: All required artifacts present, all quality checks passing
- **CONCERNS**: Minor gaps exist but can be addressed during the next phase
- **FAIL**: Critical blockers must be resolved before advancing
+- **NOT ASSESSED**: One or more required checks could not be run at all — name
+ which, and why, in the Blockers section
```
+**`NOT ASSESSED` — when the gate could not look.** Rank: it **outranks PASS**
+(a gate that could not check part of its scope has not established the phase is
+ready) and **ranks below CONCERNS and FAIL** (a known blocker is more actionable
+than an unknown, and demoting it behind an access problem buries it). It is not a
+softer FAIL: "I checked and found a blocker" and "I could not check" need
+different fixes — one needs work done, the other needs the input produced or made
+readable.
+
+**Verdict precedence — first matching rule wins**, evaluated in this order:
+**FAIL**, then **CONCERNS**, then **NOT ASSESSED**, then **PASS**. A gate with
+both a real blocker and an unassessable check is FAIL: the blocker is the
+actionable finding. Stating the order mechanically removes the inference — the
+rank sentence above says what outranks what, but only an ordered list says what
+to do when two conditions hold at once.
+
+Emit it when any of:
+
+- A **required artifact exists but cannot be assessed** — empty, unreadable, or
+ still entirely `[TO BE CONFIGURED]` / template placeholders. Present-but-empty
+ is the case that most looks like present.
+- A **quality check's input carries no measured data**. Section 3 compares the
+ performance budgets against "profiling data in `tests/performance/` or recent
+ `/perf-profile` output" — and `/perf-profile`'s report template pre-fills
+ `[16.67ms]` as the budget, so it can render ">99% headroom" from zero profiler
+ data. Placeholder numbers are not measurements: a budget nobody set is not a
+ budget that was met. Absent data already prompts (Section 4 offers to run
+ `/perf-profile`); this covers data that is *present and hollow*, which is the
+ case that looks like a measurement.
+- A **test check the tier requires could not be executed** — no test runner is
+ configured, or the runner is configured but failed to start. Section 3 runs the
+ suite "if a test runner is configured", and an unconfigured runner produced no
+ failures, so the test check contributed nothing to the verdict and the gate
+ could still reach PASS. Meanwhile `testing.strict.logic` and
+ `.integration` both default to `true`, so the project's own configuration
+ called those gates BLOCKING. A blocking gate that never ran is the unknown this
+ verdict exists to name. Remediation is already listed under Common Gaps
+ (`/test-setup`); this is what the verdict does with it.
+
+ > **Scope this to tiers that require tests.** At `qa.level: minimal` no test
+ > gates apply at all (see the config block above), so a missing runner there is
+ > the configured posture, not a hole — firing the trigger would make every
+ > `minimal` gate permanently NOT ASSESSED and stop stage advancement, the same
+ > over-broad reading the director trigger below warns against. Fires only where
+ > the resolved tier actually asked for the test check.
+- A **`MANUAL CHECK NEEDED` item the user never resolved**. Section 4 already
+ refuses to assume PASS for unverifiable items and marks them this way — but
+ until now the verdict vocabulary had nowhere to put one, so an unresolved
+ manual check had to land inside PASS, CONCERNS or FAIL anyway. This is where it
+ goes.
+- A director the **resolved tier was supposed to spawn** did not return — it
+ errored, produced no verdict, or was interrupted.
+
+ > **Scope this narrowly, and do not read it as "fewer than four directors ran".**
+ > Section 4b narrows the panel *by design* — 1 director at `minimal`, 2 at
+ > `standard`, 4 at `full`, and none in `solo` — and that narrowing is a
+ > deliberate, announced reduction, not a failure to assess. The broad reading
+ > makes every `minimal`, `standard` and `solo` gate permanently NOT ASSESSED,
+ > which means the verdict can never be PASS and Section 6 can never advance
+ > `project.stage`. **That would break stage advancement for most projects,**
+ > since those are the common tiers. The trigger fires only when a director the
+ > tier *did* call for fails to come back — a hole in the panel you expected,
+ > never the panel you deliberately chose.
+- A referenced upstream verdict is itself `NOT ASSESSED` — it propagates upward
+ rather than resolving to a pass.
+
+Never resolve an unknown by assuming the permissive reading. If the check could
+not run, that fact is the finding.
+
---
## 5a. Chain-of-Verification
@@ -418,7 +586,14 @@ Do NOT reference the draft verdict text — re-check specific files or ask the u
**Step 3 — Revise if needed:**
- If any answer reveals a missed blocker → upgrade verdict (PASS→CONCERNS or CONCERNS→FAIL)
+- If any answer reveals a check that **could not be run** rather than one that
+ ran and passed → PASS→NOT ASSESSED. The first two PASS-draft questions above
+ ("verified by actually reading a file, vs. inferring", "MANUAL CHECK NEEDED
+ items I marked PASS") exist to find exactly this, and until now a yes to either
+ had no verdict to move to
- If any answer reveals an over-stated blocker → downgrade only if citing specific evidence
+- Never revise NOT ASSESSED down to PASS by re-reasoning about the missing input.
+ Only obtaining the input clears it
- If answers are consistent → confirm verdict unchanged
**Step 4 — Note the verification** in the final report output:
@@ -428,23 +603,77 @@ Do NOT reference the draft verdict text — re-check specific files or ask the u
## 6. Update Stage on PASS
-When the verdict is **PASS** and the user confirms they want to advance:
-
-1. Write the new stage name to `production/stage.txt` (single line, no trailing newline)
-2. This immediately updates the status line for all future sessions
-
-Example: if passing the "Pre-Production → Production" gate:
+When the verdict is **PASS** and the user confirms they want to advance, write the
+new stage to BOTH `project.yaml` and the legacy `production/stage.txt`.
+
+### 6.1 Primary write — `project.yaml`
+
+Set `project.stage` to the new stage name in `project.yaml` at the repo root.
+
+- **If a `project:` block already exists**: Read `project.yaml` first (the Edit
+ tool requires the file to have been read in this session), then use the Edit
+ tool to change its `stage:` value.
+- **If `project.yaml` exists but has no `project:` block**: Read `project.yaml`
+ first, then use the Edit tool to insert the block immediately after the
+ `framework:` block (before `modes:`). Insert exactly (replace `<new-stage>`):
+ ```yaml
+ project:
+ stage: <new-stage>
+ ```
+- **If `project.yaml` does not exist at all**: create it with the Write tool using
+ this v1.1 minimal template (replace `<new-stage>` and the date):
+ ```yaml
+ # CCGS project configuration — single source of truth for project settings.
+ # Schema: grep the `## <key>` section of .claude/docs/effects-map.md —
+ # it is ~31k tokens whole, ~900 per section. Do not open it entire.
+
+ schema_version: 1
+
+ framework:
+ version: 1.1.0
+ last_upgraded: <YYYY-MM-DD>
+
+ project:
+ stage: <new-stage>
+ ```
+ Do not seed `modes.review_mode` here. It is a rigor-fronted knob — `modes.rigor`
+ supplies its value, so an explicit value would shadow the rigor expansion and pin
+ the review mode regardless of the project's rigor. Test Y.6 locks this in.
+
+### 6.2 Legacy fallback write — `production/stage.txt`
+
+Also write the single-line stage name (no trailing newline) so hooks that have not
+migrated still work. Ensure the `production/` directory exists first:
```bash
-echo -n "Production" > production/stage.txt
+mkdir -p production && printf '%s' "Production" > production/stage.txt
```
-**Always ask before writing**: "Gate passed. May I update `production/stage.txt` to 'Production'?"
+### 6.3 Verify both writes
+
+After both writes, Read `project.yaml` and `production/stage.txt` and confirm both
+show the new stage. If they diverge, report the discrepancy to the user and stop —
+a split stage indicator corrupts future auto-detection.
+
+**Always ask before writing**: "Gate passed. May I update `project.stage` in `project.yaml` to 'Production' (and the legacy `production/stage.txt`)?"
+
+### 6.4 Rigor-fit check (advisory — never affects the verdict)
+
+After the stage advance is confirmed, apply the raise trigger in
+`.claude/docs/settings-guidance.md § 4`: if the new stage is **Production** (or
+later) while the resolved `modes.workflow` is `minimal` (the `rigor: minimal`
+posture, from the config block above), add one line:
+
+> "You're entering [stage] on `rigor: minimal` — most projects this size run
+> `standard`. Revisit with `/settings modes.rigor=standard`?"
+
+Offer it **once**, here at the gate. Route to `/settings` — never change the
+setting yourself.
---
## 7. Closing Next-Step Widget
-After the verdict is presented and any stage.txt update is complete, close with a structured next-step prompt using `AskUserQuestion`.
+After the verdict is presented and any stage update is complete (project.yaml + stage.txt), close with a structured next-step prompt using `AskUserQuestion`.
**Tailor the options to the gate that just ran:**
@@ -515,8 +744,16 @@ Based on the verdict, suggest specific next steps:
- **Tests failing?** → delegate to `lead-programmer` or `qa-tester`
- **No playtest data?** → `/playtest-report`
- **No playtest sessions beyond the minimum?** → Additional sessions give more reliable signal. 3+ total is recommended before committing the full team. Use `/playtest-report` to structure findings.
-- **No Difficulty Curve doc?** → Create `design/difficulty-curve.md` from the template at `.claude/docs/templates/difficulty-curve.md` — or use `/quick-design "difficulty curve"` for a guided session.
-- **No player journey map?** → Create `design/player-journey.md` from the template at `.claude/docs/templates/player-journey.md` — or author it collaboratively using `/ux-design` Phase 2b.
+- **No Difficulty Curve doc?** → Author `design/difficulty-curve.md` by hand from the template at `.claude/docs/templates/difficulty-curve.md`. (`/quick-design` is a related session but writes to `design/quick-specs/`, not to this path — use it to think the curve through, then copy the outcome here.)
+- **No player journey map?** → Author `design/player-journey.md` by hand from the template at `.claude/docs/templates/player-journey.md`.
+
+> **Neither of these has a skill that writes it — the remediations must not imply
+> otherwise.** Naming "`/ux-design` Phase 2b" would point at the step that *reads*
+> `design/player-journey.md`, landing the user back at the check that just
+> failed. Naming `/quick-design` would point at a skill that writes
+> `design/quick-specs/[name]-[date].md` and would leave this gate still failing.
+> Both docs are hand-authored from their templates; say so plainly rather than
+> naming a skill that cannot produce them.
- **Need a quick sprint check?** → `/sprint-status` for current sprint progress snapshot
- **Performance unknown?** → `/perf-profile`
- **Not localized?** → `/localize`
diff --git a/.claude/skills/gate-check/references/gate-polish.md b/.claude/skills/gate-check/references/gate-polish.md
new file mode 100644
index 00000000..a333da45
--- /dev/null
+++ b/.claude/skills/gate-check/references/gate-polish.md
@@ -0,0 +1,48 @@
+> Gate definition, loaded by `/gate-check` for the TARGET PHASE ONLY.
+> Never load the other five — one gate applies per invocation.
+
+
+# Gate: Production → Polish
+
+
+**Required Artifacts:**
+- [ ] The code root has active code organized into subsystems
+- [ ] All core mechanics from GDD are implemented (cross-reference `design/gdd/` with the code root)
+- [ ] Main gameplay path is playable end-to-end
+- [ ] Test files exist in `tests/unit/` and `tests/integration/` covering Logic and Integration stories
+- [ ] All Logic stories from this sprint have corresponding unit test files in `tests/unit/`
+- [ ] Smoke check has been run with a PASS or PASS WITH WARNINGS verdict — report exists in `production/qa/`
+- [ ] At least one QA plan exists in `production/qa/` (generated by `/qa-plan`) covering this sprint, the final production sprint, or this production phase — run `/qa-plan` if missing (CONCERNS — advisory, not blocking)
+- [ ] QA sign-off report exists in `production/qa/` (generated by `/team-qa`) with verdict APPROVED or APPROVED WITH CONDITIONS
+- [ ] At least 3 distinct playtest sessions documented in `production/qa/playtests/`
+- [ ] Playtest reports cover: new player experience, mid-game systems, and difficulty curve
+- [ ] Fun hypothesis from Game Concept has been explicitly validated or revised
+
+**Quality Checks:**
+- [ ] Tests are passing (run test suite via Bash)
+- [ ] No critical/blocker bugs in any bug tracker or known issues
+- [ ] Core loop plays as designed (compare to GDD acceptance criteria)
+- [ ] Performance is within budget (check `performance.*` in `project.yaml`, else technical-preferences.md targets)
+- [ ] Playtest findings have been reviewed and critical fun issues addressed (not just documented)
+- [ ] No "confusion loops" identified — no point in the game where >50% of playtesters got stuck without knowing why
+- [ ] Difficulty curve matches the Difficulty Curve design doc (if one exists at `design/difficulty-curve.md`)
+- [ ] All implemented screens have corresponding UX specs (no "designed in-code" screens)
+- [ ] Interaction pattern library is up-to-date with all patterns used in implementation
+- [ ] Accessibility compliance verified against committed tier in `design/accessibility-requirements.md`
+
+## Workflow tier reductions
+
+The checklist above is the **`full` baseline**. At lower tiers apply the
+reduction for the resolved tier; items not named keep their status above.
+Reductions only ever *relax* a requirement — `workflow_overrides` is the
+only thing that adds one.
+
+- **`full`** — core mechanics + Logic/Integration tests + smoke check (PASS) + QA sign-off + 3+ playtests all required
+- **`standard`** — QA sign-off + per-story test coverage → recommended;
+ **core mechanics + smoke check + playable end-to-end + 1+ documented
+ playtest + no critical/blocker bugs** required
+- **`minimal`** — **smoke check + playable end-to-end + no critical/blocker
+ bugs** required; the core-mechanics cross-check → recommended; everything
+ else **drops**. Reductions relax what must *exist*, never what must *work* —
+ a gate that closes production on "it boots" alone has not asked whether the
+ game plays.
diff --git a/.claude/skills/gate-check/references/gate-pre-production.md b/.claude/skills/gate-check/references/gate-pre-production.md
new file mode 100644
index 00000000..2ba83d89
--- /dev/null
+++ b/.claude/skills/gate-check/references/gate-pre-production.md
@@ -0,0 +1,67 @@
+> Gate definition, loaded by `/gate-check` for the TARGET PHASE ONLY.
+> Never load the other five — one gate applies per invocation.
+
+
+# Gate: Technical Setup → Pre-Production
+
+
+**Required Artifacts:**
+- [ ] Engine chosen (CLAUDE.md Technology Stack is not `[CHOOSE]`)
+- [ ] Project config populated (`project.yaml` has engine/naming/performance set, or legacy `.claude/docs/technical-preferences.md` populated)
+- [ ] Art bible exists at `design/art/art-bible.md` with at least Sections 1–4 (Visual Identity Foundation)
+- [ ] At least 3 Architecture Decision Records in `docs/architecture/` covering
+ Foundation-layer systems (scene management, event architecture, save/load)
+- [ ] Engine reference docs exist in `docs/engine-reference/[engine]/`
+- [ ] Test framework initialized: `tests/unit/` and `tests/integration/` directories exist
+- [ ] CI/CD test workflow exists at `.github/workflows/tests.yml` (or equivalent)
+- [ ] At least one example test file exists to confirm the framework is functional
+- [ ] Master architecture document exists at `docs/architecture/architecture.md`
+- [ ] Architecture traceability index exists at `docs/architecture/requirements-traceability.md`
+- [ ] `/architecture-review` has been run (a review report file exists in `docs/architecture/`)
+- [ ] `design/accessibility-requirements.md` exists with accessibility tier committed
+- [ ] `design/ux/interaction-patterns.md` exists (pattern library initialized, even if minimal)
+
+**Quality Checks:**
+- [ ] Architecture decisions cover core systems (rendering, input, state management)
+- [ ] Technical preferences have naming conventions and performance budgets set
+- [ ] Accessibility tier is defined and documented (even "Basic" is acceptable — undefined is not)
+- [ ] At least one screen's UX spec started (often the main menu or core HUD is designed during Technical Setup)
+- [ ] All ADRs have an **Engine Compatibility section** with engine version stamped
+- [ ] All ADRs have a **GDD Requirements Addressed section** with explicit GDD linkage
+- [ ] No ADR references APIs listed in `docs/engine-reference/[engine]/deprecated-apis.md`
+- [ ] All HIGH RISK engine domains (per VERSION.md) have been explicitly addressed
+ in the architecture document or flagged as open questions
+- [ ] Architecture traceability matrix has **zero Foundation layer gaps**
+ (all Foundation requirements must have ADR coverage before Pre-Production)
+
+**ADR Circular Dependency Check**: run the deterministic graph builder rather than
+reading every ADR to trace the graph by hand — a manual trace across a dozen ADRs
+eventually misses an edge; the script cannot:
+```
+Bash: bash .claude/scripts/adr-dep-graph.sh
+```
+It prints `ADRS`, `EDGES` (one `adr-A -> adr-B` per Depends-On reference),
+`NO_DEPS_SECTION` (ADRs with no Depends On), and a `CYCLE:` line per node in any
+dependency cycle.
+- **Any `CYCLE:` lines → FAIL**: "Circular ADR dependency: [the nodes on the
+ `CYCLE:` lines]. Neither can reach Accepted while the cycle exists. Remove one
+ 'Depends On' edge to break the cycle."
+- No `CYCLE:` lines → this check passes. But the acyclic result is only as
+ trustworthy as the dependency sections are complete: if `NO_DEPS_SECTION` lists
+ many ADRs, surface that as a CONCERNS note rather than a clean pass.
+
+**Engine Validation** (read `docs/engine-reference/[engine]/VERSION.md` first):
+- [ ] ADRs that touch post-cutoff engine APIs are flagged with Knowledge Risk: HIGH/MEDIUM
+- [ ] `/architecture-review` engine audit shows no deprecated API usage
+- [ ] All ADRs agree on the same engine version (no stale version references)
+
+## Workflow tier reductions
+
+The checklist above is the **`full` baseline**. At lower tiers apply the
+reduction for the resolved tier; items not named keep their status above.
+Reductions only ever *relax* a requirement — `workflow_overrides` is the
+only thing that adds one.
+
+- **`full`** — engine + art bible §1–4+ + 3+ ADRs + architecture + UX specs started + accessibility doc + traceability index all required
+- **`standard`** — art bible required **only if visual-asset stories exist**; ADRs reduced to **critical (Foundation-layer) only**; UX-specs-started, accessibility doc, interaction-patterns, traceability index → recommended
+- **`minimal`** — only **engine configured** required (the minimal floor); everything else **drops**
diff --git a/.claude/skills/gate-check/references/gate-production.md b/.claude/skills/gate-check/references/gate-production.md
new file mode 100644
index 00000000..2762dcdb
--- /dev/null
+++ b/.claude/skills/gate-check/references/gate-production.md
@@ -0,0 +1,78 @@
+> Gate definition, loaded by `/gate-check` for the TARGET PHASE ONLY.
+> Never load the other five — one gate applies per invocation.
+
+
+# Gate: Pre-Production → Production
+
+
+**Required Artifacts:**
+- [ ] Vertical slice exists in `prototypes/` with a REPORT.md (run `/vertical-slice`) — **recommended, not blocking**; if absent, surface as CONCERNS
+- [ ] First sprint plan exists in `production/sprints/`
+- [ ] Art bible is complete (all 9 sections) and AD-ART-BIBLE sign-off verdict is recorded in `design/art/art-bible.md`
+- [ ] Entity inventory exists at `design/assets/entity-inventory.md` (recommended — run `/asset-spec` with no arguments to generate collaboratively from GDDs + art bible)
+- [ ] All MVP-tier GDDs from systems index are complete
+- [ ] Master architecture document exists at `docs/architecture/architecture.md`
+- [ ] At least 3 ADRs covering Foundation-layer decisions exist in `docs/architecture/`
+- [ ] All Foundation and Core layer ADRs have status `Accepted` (not `Proposed`) — stories cannot be unblocked until their governing ADR is accepted
+- [ ] Control manifest exists at `docs/architecture/control-manifest.md`
+ (generated by `/create-control-manifest` from Accepted ADRs)
+- [ ] Epics defined in `production/epics/` with at least Foundation and Core
+ layer epics present (use `/create-epics layer: foundation` and
+ `/create-epics layer: core` to create them, then `/create-stories [epic-slug]`
+ for each epic)
+- [ ] Vertical Slice build exists and is playable (not just scope-defined) — **recommended, not blocking**; if absent, surface as CONCERNS
+- [ ] Vertical Slice has been playtested with at least 1 documented session — **recommended, not blocking**; if absent, surface as CONCERNS
+- [ ] Vertical Slice playtest report exists at `production/qa/playtests/` or equivalent — **recommended, not blocking**; if absent, surface as CONCERNS
+- [ ] UX specs exist for key screens: main menu, core gameplay HUD (at `design/ux/`), pause menu
+- [ ] HUD design document exists at `design/ux/hud.md` (if game has in-game HUD)
+- [ ] All key screen UX specs have passed `/ux-review` (verdict APPROVED or NEEDS REVISION accepted)
+
+**Quality Checks:**
+- [ ] **Core loop fun is validated** — playtest data confirms the central mechanic is enjoyable, not just functional. Explicitly check the Vertical Slice playtest report.
+- [ ] UX specs cover all UI Requirements sections from MVP-tier GDDs
+- [ ] Interaction pattern library documents patterns used in key screens
+- [ ] Accessibility tier from `design/accessibility-requirements.md` is addressed in all key screen UX specs
+- [ ] Sprint plan references real story file paths from `production/epics/`
+ (not just GDDs — stories must embed GDD req ID + ADR reference)
+- [ ] **Vertical Slice is COMPLETE**, not just scoped — the build demonstrates the full core loop end-to-end. At least one complete [start → challenge → resolution] cycle works.
+- [ ] Architecture document has no unresolved open questions in Foundation or Core layers
+- [ ] All ADRs have Engine Compatibility sections stamped with the engine version
+- [ ] All ADRs have ADR Dependencies sections (even if all fields are "None")
+- [ ] Manual validation confirms GDDs + architecture + epics are coherent
+ (run `/review-all-gdds` and `/architecture-review` if not done recently)
+- [ ] **Core fantasy is delivered** — at least one playtester independently described an experience that matches the Player Fantasy section of the core system GDDs (without being prompted).
+
+**Vertical Slice Validation** (only run these checks if a Vertical Slice was built):
+- [ ] A human has played through the core loop without developer guidance
+- [ ] The game communicates what to do within the first 2 minutes of play
+- [ ] No critical "fun blocker" bugs exist in the Vertical Slice build
+- [ ] The core mechanic feels good to interact with (this is a subjective check — ask the user)
+
+> **Verdict rules for Vertical Slice:**
+> - **Slice was built AND any validation item is NO** → verdict is automatically FAIL. A broken
+> or unfun vertical slice should not advance to Production.
+> - **Slice was not built (skipped)** → downgrade to CONCERNS only, not FAIL. Surface the risk
+> clearly: "Advancing without a validated Vertical Slice increases the risk of late-stage design
+> pivots. Recommended before committing full production scope." The user decides.
+> - Skipping is a valid solo dev or time-constrained call. Shipping a broken one is not.
+
+## Workflow tier reductions
+
+The checklist above is the **`full` baseline**. At lower tiers apply the
+reduction for the resolved tier; items not named keep their status above.
+Reductions only ever *relax* a requirement — `workflow_overrides` is the
+only thing that adds one.
+
+- **`full`** — sprint plan + complete (9-section) art bible + epics + 3+ playtests + UX specs + control manifest all required; **Vertical Slice keeps its Section 2 status** (see note)
+- **`standard`** — **1+ playtest** required (not 3); epics + sprint plan required; art bible complete + UX specs + control manifest → recommended
+- **`minimal`** — only **sprint plan** required (the minimal floor); epics, playtests, art bible, UX, control manifest all **drop**
+
+> **The Vertical Slice keeps its Section 2 status at every tier.** The
+> Pre-Production → Production "prototype/Vertical Slice" floor is NOT upgraded to
+> blocking by the tier table — the Vertical Slice artifacts stay *recommended,
+> not blocking* (absent → CONCERNS, not FAIL) exactly as Section 2 defines, at
+> `full`, `standard`, and `minimal` alike. The genuinely-required floor item at
+> this gate is the **sprint plan**. The one hard rule that binds at every tier:
+> if a Vertical Slice *was built* and any of its validation items is NO, the
+> verdict is FAIL regardless of tier — tier reductions relax what must *exist*,
+> never what must *work*.
diff --git a/.claude/skills/gate-check/references/gate-release.md b/.claude/skills/gate-check/references/gate-release.md
new file mode 100644
index 00000000..376684f9
--- /dev/null
+++ b/.claude/skills/gate-check/references/gate-release.md
@@ -0,0 +1,41 @@
+> Gate definition, loaded by `/gate-check` for the TARGET PHASE ONLY.
+> Never load the other five — one gate applies per invocation.
+
+
+# Gate: Polish → Release
+
+
+**Required Artifacts:**
+- [ ] All features from milestone plan are implemented
+- [ ] Content is complete (all levels, assets, dialogue referenced in design docs exist)
+- [ ] Localization strings are externalized (no hardcoded player-facing text in the code root)
+- [ ] QA test plan exists (`/qa-plan` output in `production/qa/`)
+- [ ] QA sign-off report exists (`/team-qa` output — APPROVED or APPROVED WITH CONDITIONS)
+- [ ] All Must Have story test evidence is present (Logic/Integration: test files pass; Visual/Feel/UI: sign-off docs in `production/qa/evidence/`)
+- [ ] Smoke check passes cleanly (PASS verdict) on the release candidate build
+- [ ] No test regressions from previous sprint (test suite passes fully)
+- [ ] Balance data has been reviewed (`/balance-check` run)
+- [ ] Release checklist completed (`/release-checklist` or `/launch-checklist` run)
+- [ ] Store metadata prepared (if applicable)
+- [ ] Changelog / patch notes drafted
+
+**Quality Checks:**
+- [ ] Full QA pass signed off by `qa-lead`
+- [ ] All tests passing
+- [ ] Performance targets met across all target platforms
+- [ ] No known critical, high, or medium-severity bugs
+- [ ] Accessibility basics covered (remapping, text scaling if applicable)
+- [ ] Localization verified for all target languages
+- [ ] Legal requirements met (EULA, privacy policy, age ratings if applicable)
+- [ ] Build compiles and packages cleanly
+
+## Workflow tier reductions
+
+The checklist above is the **`full` baseline**. At lower tiers apply the
+reduction for the resolved tier; items not named keep their status above.
+Reductions only ever *relax* a requirement — `workflow_overrides` is the
+only thing that adds one.
+
+- **`full`** — all features + content complete + localization + QA sign-off + smoke (PASS) + no critical bugs all required
+- **`standard`** — content-complete audit + QA sign-off + localization → recommended; **all features + smoke + no critical bugs** required
+- **`minimal`** — only **smoke + no critical bugs** required; everything else **drops**
diff --git a/.claude/skills/gate-check/references/gate-systems-design.md b/.claude/skills/gate-check/references/gate-systems-design.md
new file mode 100644
index 00000000..c1dcdfba
--- /dev/null
+++ b/.claude/skills/gate-check/references/gate-systems-design.md
@@ -0,0 +1,33 @@
+> Gate definition, loaded by `/gate-check` for the TARGET PHASE ONLY.
+> Never load the other five — one gate applies per invocation.
+
+
+# Gate: Concept → Systems Design
+
+
+**Required Artifacts:**
+- [ ] `design/gdd/game-concept.md` exists and has content
+- [ ] Game pillars defined (in concept doc or `design/gdd/game-pillars.md`)
+- [ ] Visual Identity Anchor section exists in `design/gdd/game-concept.md` (from brainstorm Phase 4 art-director output)
+
+**Recommended (not blocking):**
+- [ ] Concept prototype exists in `prototypes/` with a REPORT.md showing PROCEED verdict
+ (`/prototype [core-mechanic]`) — skipping this means GDDs may be written for an
+ idea that hasn't been played. Acceptable if the concept is proven by other means.
+
+**Quality Checks:**
+- [ ] Game concept has been reviewed (`/design-review` verdict not MAJOR REVISION NEEDED)
+- [ ] Core loop is described and understood
+- [ ] Target audience is identified
+- [ ] Visual Identity Anchor contains a one-line visual rule and at least 2 supporting visual principles
+
+## Workflow tier reductions
+
+The checklist above is the **`full` baseline**. At lower tiers apply the
+reduction for the resolved tier; items not named keep their status above.
+Reductions only ever *relax* a requirement — `workflow_overrides` is the
+only thing that adds one.
+
+- **`full`** — game-concept.md + pillars + Visual Identity Anchor all required
+- **`standard`** — pillars + Visual Identity Anchor → recommended; `game-concept.md` stays required
+- **`minimal`** — gate target is **`design/game-brief.md`** (not `game-concept.md`); the GDD / pillars / Visual Identity Anchor checks **drop** (a brief with content = PASS). `/brainstorm` writes `design/game-brief.md` at this tier (Option A); `game-concept.md` remains the `standard`/`full` concept doc.
diff --git a/.claude/skills/gate-check/references/gate-technical-setup.md b/.claude/skills/gate-check/references/gate-technical-setup.md
new file mode 100644
index 00000000..3907f285
--- /dev/null
+++ b/.claude/skills/gate-check/references/gate-technical-setup.md
@@ -0,0 +1,36 @@
+> Gate definition, loaded by `/gate-check` for the TARGET PHASE ONLY.
+> Never load the other five — one gate applies per invocation.
+
+
+# Gate: Systems Design → Technical Setup
+
+
+**Required Artifacts:**
+- [ ] Systems index exists at `design/gdd/systems-index.md` with at least MVP systems enumerated
+- [ ] All MVP-tier GDDs exist in `design/gdd/` and individually pass `/design-review`
+- [ ] A cross-GDD review report exists in `design/gdd/` (from `/review-all-gdds`)
+
+**Quality Checks:**
+- [ ] All MVP GDDs pass individual design review (8 required sections, no MAJOR REVISION NEEDED verdict)
+- [ ] `/review-all-gdds` verdict is not FAIL (cross-GDD consistency and design theory checks pass)
+- [ ] All cross-GDD consistency issues flagged by `/review-all-gdds` are resolved or explicitly accepted
+- [ ] System dependencies are mapped in the systems index and are bidirectionally consistent
+- [ ] MVP priority tier is defined
+- [ ] No stale GDD references flagged (older GDDs updated to reflect decisions made in later GDDs)
+
+## Workflow tier reductions
+
+The checklist above is the **`full` baseline**. At lower tiers apply the
+reduction for the resolved tier; items not named keep their status above.
+Reductions only ever *relax* a requirement — `workflow_overrides` is the
+only thing that adds one.
+
+- **`full`** — systems-index + all MVP GDDs at 8 sections + cross-GDD review report all required
+- **`standard`** — MVP GDDs validated at the **5 standard sections** (+ conditional Formulas); cross-GDD review report → recommended
+- **`minimal`** — **gate not applicable** — no gate between brief and code; auto-PASS with a note (see below)
+
+> **`minimal` "not applicable" gate.** The Systems Design → Technical Setup gate
+> has no meaning at `minimal` (no GDDs exist by design). Return a PASS verdict
+> with the note: *"No design gate at minimal workflow — minimal skips the
+> Systems Design phase; advancing brief → code."* The Section 6 stage write still
+> applies on user confirmation. Do NOT flag absent GDDs as blockers.
diff --git a/.claude/skills/help/SKILL.md b/.claude/skills/help/SKILL.md
index 12757c80..e898af5a 100644
--- a/.claude/skills/help/SKILL.md
+++ b/.claude/skills/help/SKILL.md
@@ -1,11 +1,9 @@
---
name: help
-description: "Analyzes what is done and the users query and offers advice on what to do next. Use if user says what should I do next or what do I do now or I'm stuck or I don't know what to do"
+description: "What should I do next? Use when stuck or you don't know what to do."
argument-hint: "[optional: what you just finished, e.g. 'finished design-review' or 'stuck on ADRs']"
user-invocable: true
-allowed-tools: Read, Glob, Grep
-context: |
- !echo "=== Live Project State ===" && echo "Stage: $(cat production/stage.txt 2>/dev/null | tr -d '[:space:]' || echo 'not set')" && echo "Latest sprint: $(ls -t production/sprints/*.md 2>/dev/null | head -1 || echo 'none')" && echo "Session state: $(head -5 production/session-state/active.md 2>/dev/null || echo 'none')"
+allowed-tools: Read, Glob, Grep, Bash
model: haiku
---
@@ -17,6 +15,21 @@ This skill figures out exactly where you are in the game development pipeline an
tells you what comes next. It is **lightweight** — not a full audit. For a full
gap analysis, use `/project-stage-detect`.
+## Live Project State
+
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys project.stage,workflow`
+
+!`echo "Latest sprint: $(ls -t production/sprints/*.md 2>/dev/null | head -1 || echo 'none')"; echo "Session state: $(head -5 production/session-state/active.md 2>/dev/null || echo 'none')"`
+
+Both blocks are resolved before this skill runs. Use them as-is:
+
+- **`project.stage`** from the config block is the authoritative phase for Step 2
+ — it already applies the `project.yaml` → `production/stage.txt` fallback, and
+ preserves values containing spaces (`Systems Design`).
+- **`workflow`** from the config block is the tier for Step 5 — do not re-read it.
+- If no config block rendered, shell preprocessing is disabled; fall back to the
+ defaults in `.claude/docs/config-resolution.md`.
+
---
## Step 1: Read the Catalog
@@ -54,8 +67,7 @@ skills in production/polish, etc.).
Check in this order:
-1. **Read `production/stage.txt`** — if it exists and has content, this is the
- authoritative phase name. Map it to a catalog phase key:
+1. **Take `project.stage` from the config block above** — it is already resolved. Map its value to a catalog phase key:
- "Concept" → `concept`
- "Systems Design" → `systems-design`
- "Technical Setup" → `technical-setup`
@@ -64,19 +76,23 @@ Check in this order:
- "Polish" → `polish`
- "Release" → `release`
-2. **If stage.txt is missing**, infer phase from artifacts (most-advanced match wins):
- - `src/` has 10+ source files → `production`
- - `production/stories/*.md` exists → `pre-production`
+2. **If neither is set**, infer phase from artifacts (most-advanced match wins):
+ - code root has 10+ source files → `production`
+ - `production/epics/**/story-*.md` exists → `pre-production`
- `docs/architecture/adr-*.md` exists → `technical-setup`
- `design/gdd/systems-index.md` exists → `systems-design`
- - `design/gdd/game-concept.md` exists → `concept`
+ - `design/gdd/game-concept.md` (or `design/game-brief.md`) exists → `concept`
- Nothing → `concept` (fresh project)
+3. **Take `workflow` from the config block above** (per
+ `.claude/docs/workflow-modes.md`). It controls whether optional docs are
+ surfaced as next steps (Step 5).
+
---
## Step 3: Read Session Context
-Read `production/session-state/active.md` if it exists. Extract:
+Read `production/session-state/active.md` if it exists — it is append-only and grows unbounded, and only the latest block is relevant, so read just the tail rather than the whole file: grep the last heading (`Grep pattern="^## (Session Extract|STATUS)" path="production/session-state/active.md" output_mode="content" -n`, take the highest line number) and `Read(offset=that line)`. Extract:
- What was most recently worked on
- Any in-progress tasks or open questions
- Current epic/feature/task from STATUS block (if present)
@@ -92,18 +108,33 @@ For each step in the current phase (from the catalog):
### Artifact-based checks
-If the step has `artifact.glob`:
-- Use Glob to check if files matching the pattern exist
-- If `min_count` is specified, verify at least that many files match
-- If `artifact.pattern` is specified, use Grep to verify the pattern exists in the matched file
-- **Complete** = artifact condition is met
-- **Incomplete** = artifact is missing or pattern not found
+**Resolve these deterministically — one call, not a glob per step:**
+
+```
+Bash: bash .claude/scripts/artifact-check.sh --phase [current-phase]
+```
+
+It evaluates every `glob`, `pattern`, `min_count` and `any_of` in the catalog
+against the working tree and reports one line per step. Map its statuses:
+
+| status | Report as |
+|---|---|
+| `PRESENT` | **Complete** |
+| `ABSENT` | **Incomplete** |
+| `SHORT` | **Incomplete** — say how far short (`count=`/`min=` are given) |
+| `PATTERN_MISS` | **Incomplete** — the file exists but lacks its marker; say so, since "missing" would send the user to recreate a file they already have |
+| `NO_CHECK` | **MANUAL** if the step carries a `note=`, else **UNKNOWN** — completion is not trackable (e.g. repeatable implementation work) |
-If the step has `artifact.note` (no glob):
-- Mark as **MANUAL** — cannot auto-detect, will ask user
+Do not re-derive any of this with Glob/Grep. `any_of` in particular is a list of
+**alternatives** — one match is enough — and hand-evaluating it has already
+produced a false "incomplete" once: `engine-setup` is satisfied by `engine.name`
+in `project.yaml` **or** by the legacy `Engine:` line in
+`.claude/docs/technical-preferences.md`, and the script reports which alternative
+matched (`alt=`/`match=`).
-If the step has no `artifact` field:
-- Mark as **UNKNOWN** — completion not trackable (e.g. repeatable implementation work)
+**`NO_CHECK` never means done.** The script prints a `NO_CHECK:` total before the
+rows; if most of a phase is NO_CHECK, say that plainly rather than implying the
+phase is nearly complete.
### Special case: production phase — read `sprint-status.yaml`
@@ -134,7 +165,11 @@ From the completion data, determine:
2. **Current blocker** — the first incomplete *required* step (this is what the
user must do next)
3. **Optional opportunities** — incomplete *optional* steps that can be done
- before or alongside the blocker
+ before or alongside the blocker. **Surface these per the workflow tier**: at
+ `full`, list all of them; at `standard`, list an optional doc only if it is
+ required for the current system/phase (do not flag genuinely-optional docs as
+ gaps); at `minimal`, do not surface optional docs at all — once the brief,
+ engine, and a sprint plan exist, the next step is code
4. **Upcoming required steps** — required steps after the current blocker
(show as "coming up" so user can plan ahead)
@@ -211,10 +246,19 @@ Need more detail?
- `/project-stage-detect` — full gap analysis with all missing artifacts listed
- `/gate-check` — formal readiness check for your next phase
- `/start` — re-orient from scratch
+- `/settings` — if the process feels mismatched to your project, adjust
+ `modes.rigor`. Apply the change-triggers in
+ `.claude/docs/settings-guidance.md § 4`: a **lower** tier when the user sounds
+ overwhelmed by process (and rigor isn't already `minimal`), or a **higher** tier
+ when the project has outgrown it (many systems, or in Production on
+ `workflow: minimal`)
```
Only show this if the user's input suggested confusion (e.g. "I don't know", "stuck",
-"lost", "not sure"). Don't show it for simple "what's next?" queries.
+"lost", "not sure"). Don't show it for simple "what's next?" queries. Show the
+`/settings` rigor line only when a `settings-guidance.md § 4` trigger actually
+fires — the user sounds overwhelmed (and rigor isn't already `minimal`), or the
+project has outgrown its tier — not on every confused query.
---
diff --git a/.claude/skills/hotfix/SKILL.md b/.claude/skills/hotfix/SKILL.md
index 73243ade..d25c3781 100644
--- a/.claude/skills/hotfix/SKILL.md
+++ b/.claude/skills/hotfix/SKILL.md
@@ -1,9 +1,10 @@
---
name: hotfix
-description: "Emergency fix workflow that bypasses normal sprint processes with a full audit trail. Creates hotfix branch, tracks approvals, and ensures the fix is backported correctly."
+description: "Emergency fix bypassing normal sprint process — hotfix branch, approvals tracked, backport verified, full audit trail."
argument-hint: "[bug-id or description]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion
+disable-model-invocation: true
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion
model: sonnet
---
@@ -85,11 +86,17 @@ Only run `git checkout -b hotfix/[short-name] [base-ref]` if user selects [A]. I
---
-## Phase 4: Investigate and Implement
+## Phase 4: Investigate and Propose
-Focus on the minimal change that resolves the issue. Do NOT refactor, clean up, or add features alongside the hotfix.
+Find the root cause. Draft the minimal fix: which files change, what the change does, and what it deliberately leaves alone. Do NOT refactor, clean up, or add features alongside the hotfix.
-Validate the fix by running targeted tests for the affected system. Check for regressions in adjacent systems.
+Present the root cause and proposed fix, then ask: "May I implement this fix?" Do not modify any code before this approval — an emergency flow earns its audit trail by approving the change *before* it exists, not after.
+
+---
+
+## Phase 4b: Implement (only after approval)
+
+Implement the approved minimal change. Validate the fix by running targeted tests for the affected system. Check for regressions in adjacent systems.
Update the hotfix record with root cause, fix details, and test results.
@@ -97,7 +104,7 @@ Update the hotfix record with root cause, fix details, and test results.
## Phase 5: Collect Approvals
-Use the Task tool to request sign-off in parallel:
+Use the `Agent` tool to request sign-off in parallel:
- `subagent_type: lead-programmer` — Review the fix for correctness and side effects
- `subagent_type: qa-tester` — Run targeted regression tests on the affected system
@@ -109,7 +116,7 @@ All three must return APPROVE before proceeding. If any returns CONCERNS or REJE
## Phase 5b: QA Re-Entry Gate
-After approvals, determine the QA scope required before deploying the hotfix. Spawn `qa-lead` via Task with:
+After approvals, determine the QA scope required before deploying the hotfix. Spawn `qa-lead` via `Agent` with:
- The hotfix description and affected system
- The regression test results from Phase 5
- A list of all systems that touch the changed files (use Grep to find callers)
@@ -121,12 +128,43 @@ Apply the verdict:
- **Targeted QA pass required** — run `/team-qa [affected-system]` scoped to the changed system only. If QA returns APPROVED or APPROVED WITH CONDITIONS, proceed to Phase 6.
- **Full QA required** — S1 fixes that touch core systems may require a full `/team-qa sprint`. This delays deployment but prevents a bad patch.
+**If the QA step returns `NOT ASSESSED`, the gate did not run — treat it as unmet,
+not as met.** `/smoke-check` returns it when the suite never executed and
+`/team-qa` when a cycle produced no executed evidence. **A NOT ASSESSED result is
+not a pass** — from either skill — and under time pressure the permissive reading
+is the one that will feel reasonable,
+which is exactly why it is written down here. Either obtain the missing result —
+the verdict names what would make it runnable — or take the decision to the
+producer explicitly, as a decision to deploy an unverified hotfix rather than as a
+gate that quietly cleared.
+
Do not skip this gate. A hotfix that breaks something else is worse than the original bug.
---
## Phase 6: Update Bug Status and Deploy
+> **STOP — deployment requires explicit approval, unconditionally.** Merging a
+> hotfix to a release branch is the one irreversible act in this skill, so it is
+> gated even though branch creation (reversible) already is. Before any merge,
+> tag, or deploy, use `AskUserQuestion`:
+>
+> - Prompt: "Hotfix validated and approved. Merge to the release branch and
+> deploy?"
+> - Options: `[A] Yes — merge and deploy` / `[B] Merge to development only — hold
+> the release` / `[C] Stop here`
+>
+> This holds regardless of `modes.automation`, including `autonomous`. An
+> emergency process is exactly where an unreviewed irreversible step is most
+> likely and least recoverable.
+
+> **Backport is not verified unless you verify it.** The frontmatter advertises
+> "backport verified", and until this note the word `backport` appeared **once in
+> this file — in that claim**. After merging, confirm the fix is present on BOTH
+> the release branch and the development branch, and state the result. An
+> unbackported hotfix means the bug returns in the next release from development,
+> which is the single most common hotfix regression.
+
Update the original bug file if one exists:
```markdown
@@ -146,8 +184,11 @@ Output a deployment summary:
**Severity**: [S1/S2]
**Root cause**: [one line]
**Fix**: [one line]
-**QA gate**: [Smoke check PASS / Team-QA APPROVED]
+**QA gate**: [Smoke check PASS / Team-QA APPROVED / NOT ASSESSED — [why, and whose
+ explicit decision it was to deploy anyway]]
**Approvals**: lead-programmer ✓ / qa-tester ✓ / producer ✓
+**Backport**: [verified present on release AND development — or NOT VERIFIED, with
+ what was not checked]
**Rollback plan**: [from Phase 2 record]
Merge to: release branch AND development branch
diff --git a/.claude/skills/launch-checklist/SKILL.md b/.claude/skills/launch-checklist/SKILL.md
index 1dd64427..aad9f99a 100644
--- a/.claude/skills/launch-checklist/SKILL.md
+++ b/.claude/skills/launch-checklist/SKILL.md
@@ -1,11 +1,60 @@
---
name: launch-checklist
-description: "Complete launch readiness validation covering every department: code, content, store, marketing, community, infrastructure, legal, and go/no-go sign-offs."
+description: "Launch readiness across every department: code, content, store, marketing, community, infrastructure, legal, go/no-go sign-offs."
argument-hint: "[launch-date or 'dry-run']"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys rigor,project.stage,cert_tier,automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+Resolved above — use as-is. No block → defaults in `.claude/docs/config-resolution.md`.
+
+**Scope this checklist to the project.** Emitting every item for every platform
+trains the reader to skip the list, which defeats the gate:
+
+- **`project.stage`** — items for phases this project has not reached are out of
+ scope; say so rather than listing them unchecked.
+- **`modes.rigor`** — at `minimal`, drop items whose only justification is process
+ weight this project has opted out of.
+- **`platform.cert_tier`** — emit certification items **only** for the tier the
+ project targets. If it is **unset**, **ask which platforms are in scope**
+ rather than emitting all of them — an unset value is a question, not a licence
+ to emit every certification track. If it cannot be determined, mark the section
+ **`NOT ASSESSED — cert tier unknown`**. **Unset is not `none`:** `none` is a
+ decision, unset is a missing one, and they must not produce the same output.
+ Branch on the **four values this key takes** — `none | itch | steam | console` —
+ and not on platform names; `.claude/docs/effects-map.md` holds the full
+ requirement table and is the source, so read it rather than restating it.
+ - `none` — **emit no certification section at all.** Internal release, alpha or
+ jam game. Say the section was omitted and why; do not leave it blank.
+ - `itch` — itch.io upload requirements only: build size, page setup, age tags.
+ **No console and no Steamworks items.**
+ - `steam` — Steamworks: store page, depot build, achievements, system
+ requirements, common content rules. **No console certification items.**
+ - `console` — full platform certification (TRC / XR / Lotcheck), save-data
+ rules, controller-mapping rules, age-rating boards. The heaviest tier.
+
+ > **Branch on the `cert_tier` values above, not on platform names.** "Emit
+ > console/mobile certification items only for the platforms the project targets"
+ > is the wrong test: it treats an `itch` project and a `steam` project
+ > identically, conflates `none` with unset, and keys on `mobile`, which is not a
+ > `cert_tier` value at all. Use the vocabulary the config defines.
+
+If an item cannot be scoped because the config is absent, mark it
+**`NOT ASSESSED — platform/stage unknown`**. Do not silently include it: a
+`rigor: standard`, single-platform project would otherwise receive a ~150-item
+checklist demanding PC **and** console **and** mobile certification plus age
+ratings, of which ~140 are unassessable.
+
+---
+
> **Explicit invocation only**: This skill should only run when the user explicitly requests it with `/launch-checklist`. Do not auto-invoke based on context matching.
@@ -26,11 +75,34 @@ Read the argument for the launch date or `dry-run` mode. Dry-run mode generates
## Phase 3: Scan Codebase Health
+> **Every scan in this phase is a search for something bad, so a zero-hit result
+> is ambiguous by construction: it means either "searched and found none" or
+> "there was nothing to search". On a launch gate those are opposite findings,
+> and a green checkbox renders them identically.**
+>
+> **Establish the denominator before every scan below, and report it.** Each line
+> reads either `scanned [N] files, [M] hits` or
+> `NOT ASSESSED — [no src/ | no assets/ | directory empty]`. Never a bare tick.
+>
+> This is written once, over the whole phase, rather than under **one** of the
+> four bullets. All four search `src/` the same way — for placeholder assets,
+> TODOs, debug output and hardcoded test values — so if only one carries the
+> warning, an empty or absent `src/` returns zero
+> hits three times and read as three clean results. The original
+> instance shipped: with no `assets/` directory the scan returned zero hits and
+> "All placeholder art replaced" was ticked green.
+
- Count `TODO`, `FIXME`, `HACK` comments and their locations
- Check for any `console.log`, `print()`, or debug output left in production code
- Check for placeholder assets (search for `placeholder`, `temp_`, `WIP_`)
- Check for hardcoded test/dev values (localhost, test credentials, debug flags)
+**Carry the distinction into the checklist itself.** An item whose scan returned
+`NOT ASSESSED` is written `- [?]`, not `- [ ]`. An unticked box says *work
+remains*; a `[?]` says *nobody could check*, and only one of those is closed by
+doing the work. Include the legend wherever a `[?]` appears:
+`[?] = not assessed — the input to this check was absent`.
+
---
## Phase 4: Generate the Launch Checklist
@@ -114,12 +186,46 @@ Generated: [Date]
- [ ] Edge cases tested (full storage, no network, suspend/resume)
### Platform Certification
-- [ ] PC: Steam/Epic/GOG SDK requirements met
-- [ ] Console: TRC/TCR/Lotcheck submission prepared
-- [ ] Mobile: App Store/Play Store guidelines compliant
-- [ ] Accessibility: minimum standards met (remapping, text scaling, colorblind)
+
+**Emit ONLY the block matching `platform.cert_tier`** (resolved in the resolved-config block at the top of this skill — see
+the `platform.cert_tier` rule above). Do not emit this section's other blocks, and
+do not fall back to emitting all of them.
+
+**At `none`** — omit the section and say so in one line:
+`Platform Certification: omitted — cert_tier is 'none' (internal/jam release).`
+
+**At `itch`:**
+- [ ] Build size within itch.io upload limits
+- [ ] itch.io page complete (cover art, screenshots, description, tags)
+- [ ] Age/content tags set honestly
+- [ ] Downloadable vs browser build decided and tested
+
+**At `steam`:**
+- [ ] Steamworks SDK integrated and tested
+- [ ] Store page complete (capsule art, trailer, description, system requirements)
+- [ ] Depot build uploaded and installs cleanly from a fresh account
+- [ ] Achievements functional
+- [ ] Steam common content rules reviewed
+
+**At `console`:**
+- [ ] TRC/TCR/Lotcheck submission prepared
+- [ ] Save-data rules compliant (corruption, full storage, user switching)
+- [ ] Controller-mapping rules met, platform-correct button prompts
+- [ ] Suspend/resume verified
- [ ] Age ratings obtained (ESRB, PEGI, regional)
+**Every tier**, because these are not certification-gated:
+- [ ] Accessibility: minimum standards met (remapping, text scaling, colorblind)
+
+> **Keep this template gated by tier.** An ungated list — PC *and* Console *and*
+> Mobile rows emitted at every tier — contradicts the `cert_tier` rule at the top
+> of this skill, which says an `itch` project gets no console and no Steamworks
+> items. When a rule and a template disagree, the template wins in practice,
+> because a template is what gets copied.
+>
+> Changing the branching vocabulary is only half the job: the rows that branching
+> governs have to move with it, or the rule describes behaviour nothing reaches.
+
### Performance
- [ ] Target FPS met on minimum spec hardware
- [ ] Load times within budget on all platforms
diff --git a/.claude/skills/localize/SKILL.md b/.claude/skills/localize/SKILL.md
index 505286a7..79717166 100644
--- a/.claude/skills/localize/SKILL.md
+++ b/.claude/skills/localize/SKILL.md
@@ -1,13 +1,16 @@
---
name: localize
-description: "Full localization pipeline: scan for hardcoded strings, extract and manage string tables, validate translations, generate translator briefings, run cultural/sensitivity review, manage VO localization, test RTL/platform requirements, enforce string freeze, and report coverage."
+description: "Localization pipeline — find hardcoded strings, extract string tables, cultural review, VO, RTL, enforce string freeze."
argument-hint: "[scan|extract|validate|status|brief|cultural-review|vo-pipeline|rtl-check|freeze|qa]"
user-invocable: true
-agent: localization-lead
-allowed-tools: Read, Glob, Grep, Write, Bash, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Bash, Agent, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+
+
# Localization Pipeline
Localization is not just translation — it is the full process of making a game
@@ -32,9 +35,13 @@ If no subcommand is provided, output usage and stop. Verdict: **FAIL** — missi
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
## Phase 2A: Scan Mode
-Search `src/` for hardcoded user-facing strings:
+Search the **code root** (resolve per `.claude/docs/code-root-resolution.md`) for hardcoded user-facing strings. **If the code root is unresolved, report `NOT ASSESSED — code root unresolved` rather than zero hits.** Zero hits from an unresolved root reads as "nothing to localize", which is the failure this guards:
- String literals in UI code not wrapped in a localization function (`tr()`, `Tr()`, `NSLocalizedString`, `GetText`, etc.)
- Concatenated strings that should be parameterized
@@ -83,7 +90,7 @@ Read all string table files in `assets/data/strings/`. For each locale, check:
- **Placeholder mismatches** — source has `{name}` but translation omits it or adds extras
- **String length violations** — translation exceeds the character limit recorded in the source `context` field
- **Plural form count** — locale requires N plural forms; translation provides fewer
-- **Orphaned keys** — translation exists but nothing in `src/` references the key
+- **Orphaned keys** — translation exists but nothing in the code root references the key
- **Stale translations** — source string changed after translation was written (flag for re-translation)
- **Encoding** — non-ASCII characters present and font atlas supports them (flag if uncertain)
@@ -104,7 +111,15 @@ String freeze: [Active / Not yet called / Lifted]
| Locale | Total | Translated | Missing | Stale | Coverage |
|--------|-------|-----------|---------|-------|----------|
-| en (source) | [N] | [N] | 0 | 0 | 100% |
+| en (source) | [N] | [N] | [N] | [N] | [N]% |
+
+> **Every cell above is a count you must take from the string table — including
+> the source row.** Do not pre-fill the source locale as `100%`: that asserts a
+> result before counting, and on a project with no `assets/data/strings/` it
+> produces a coverage report for a table that does not exist. If the string table
+> is absent, the whole status output is
+> **`NOT ASSESSED — no string table found`**, not a matrix of zeros with a
+> confident source row.
| [locale] | [N] | [N] | [N] | [N] | [X]% |
### Issues
@@ -180,7 +195,7 @@ Ask: "May I write this translator brief to `production/localization/translator-b
## Phase 2F: Cultural Review Mode
-Spawn `localization-lead` via Task. Ask them to audit the following for cultural sensitivity across the target locales (read from `assets/data/strings/` and `assets/`):
+Spawn `localization-lead` via `Agent`. Ask them to audit the following for cultural sensitivity across the target locales (read from `assets/data/strings/` and `assets/`):
### Content Areas to Review
@@ -268,7 +283,7 @@ Glob `assets/audio/vo/[locale]/` for all `.wav`/`.ogg` files. Cross-reference ag
### VO Pipeline: Integrate
-Grep `src/` for VO audio references. Verify each referenced path exists in `assets/audio/vo/[locale]/`. Report broken references.
+Grep the code root for VO audio references. Verify each referenced path exists in `assets/audio/vo/[locale]/`. Report broken references.
---
@@ -277,7 +292,7 @@ Grep `src/` for VO audio references. Verify each referenced path exists in `asse
Right-to-left languages (Arabic, Hebrew, Persian, Urdu) require layout mirroring beyond
just translating text. This mode validates the implementation.
-Read `.claude/docs/technical-preferences.md` to determine the engine. Then check:
+Determine the engine: read `engine.name` from `project.yaml`; if that key is absent or empty (including when `project.yaml` has no `engine:` block), fall back to `.claude/docs/technical-preferences.md`. Then check:
**Layout mirroring**
- Is RTL layout enabled in the engine? (Godot: `Control.layout_direction`, Unity: `RTL Support` package, Unreal: text direction flags)
@@ -364,10 +379,10 @@ When `extract` mode finds new or modified strings and `freeze-status.md` shows S
## Phase 2J: QA Mode
Localization QA is a dedicated pass that runs after translations are delivered but
-before any locale ships. This is not the same as `/validate` (which checks completeness)
-— this is a structured playthrough-based quality check.
+before any locale ships. This is not the same as `/localize validate` (which checks
+completeness) — this is a structured playthrough-based quality check.
-Spawn `localization-lead` via Task with:
+Spawn `localization-lead` via `Agent` with:
- The target locale(s) to QA
- The list of all screens/flows in the game (from `design/gdd/` or `/content-audit` output)
- The current `/localize validate` report
diff --git a/.claude/skills/map-systems/SKILL.md b/.claude/skills/map-systems/SKILL.md
index f69ae1b3..e53f1dfe 100644
--- a/.claude/skills/map-systems/SKILL.md
+++ b/.claude/skills/map-systems/SKILL.md
@@ -1,12 +1,18 @@
---
name: map-systems
-description: "Decompose a game concept into individual systems, map dependencies, prioritize design order, and create the systems index."
+description: "Decompose a concept into individual systems, map dependencies, prioritize design order, create the systems index."
argument-hint: "[next | system-name] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion, TodoWrite, Task
+allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate, Agent
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,docs.density`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
When this skill is invoked:
## Parse Arguments
@@ -18,12 +24,46 @@ Two modes:
- **`next`**: `/map-systems next` — Pick the highest-priority undesigned system
from the index and hand off to `/design-system` (Phase 6).
-Also resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
-See `.claude/docs/director-gates.md` for the full check pattern.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`docs.density`** — it controls per-section *depth*, where `workflow`
+controls which sections exist. `modes.rigor` sets both together; set
+`docs.density` explicitly to vary depth alone: `terse` = one-line system descriptions;
+`balanced` = a brief paragraph per system + dependency notes (default);
+`thorough` = full system-by-system rationale + relationship analysis. Apply it to
+every section you author.
+
+> **Where the per-system prose goes.** `templates/systems-index.md`'s Systems
+> Enumeration is a fixed-column table with no description column, so at
+> `balanced` and `thorough` the prose belongs in `## Overview` — one short
+> paragraph per system at `balanced`, plus relationship analysis at `thorough` —
+> and in the `## Dependency Map` layer notes. **Do not add a column to the
+> enumeration table** — it is a fixed contract in
+> `.claude/docs/templates/systems-index.md`, and its consumers
+> (`/design-system` §6 and §7, `/create-epics`) are written against the columns it
+> defines. Widening it is a schema change, not a formatting choice.
+>
+> **How the consumers actually read it.** Nothing parses this table
+> positionally. The two scripts that mention `systems-index.md`
+> (`gdd-structure-check.sh:51`, `review-scope.sh:40`) match it **by filename** in a
+> `case` statement and parse no columns at all; the two skills key on the
+> **`Category` column by name** (`design-system:229`, `:780`). So `Category` is
+> the column that must never be renamed or dropped, and the table stays a fixed
+> contract because every consumer is written against the set of columns the
+> template defines.
+> At `terse`, the table plus a one-paragraph `## Overview` is the whole output.
+
+**`workflow`** (see `.claude/docs/workflow-modes.md`):
+- `full` / `standard` — required before `/design-system` (systems must be mapped
+ before per-system GDDs are authored).
+- `minimal` — not required (the game brief replaces the systems index). Can
+ still be run voluntarily.
---
@@ -33,9 +73,10 @@ Read the game concept and any existing design work. This provides the raw materi
for systems decomposition.
**Required:**
-- Read `design/gdd/game-concept.md` — **fail with a clear message if missing**:
- > "No game concept found at `design/gdd/game-concept.md`. Run `/brainstorm` first
- > to create one, then come back to decompose it into systems."
+- Read `design/gdd/game-concept.md` (at `minimal`, read `design/game-brief.md`
+ instead) — **fail with a clear message if neither is found**:
+ > "No game concept found. Run `/brainstorm` first to create one, then come back
+ > to decompose it into systems."
**Optional (read if they exist):**
- Read `design/gdd/game-pillars.md` — pillars constrain priority and scope
@@ -102,7 +143,16 @@ Then use `AskUserQuestion` to capture feedback:
- "Should any of these be combined or split?"
- "Are there systems listed that this game does NOT need?"
-Iterate until the user approves the enumeration.
+**At `collaborative`** — iterate until the user approves the enumeration.
+**At `guided`** — ask once, apply the answer, and proceed; do not loop.
+**At `autonomous`** — do not ask. Record the enumeration and its inferred systems
+via `log_decision` and proceed.
+
+> **The loop needed an exit that does not depend on being asked.**
+> `automation-modes.md:56` defines `autonomous` as *"No `AskUserQuestion`"*, so a
+> loop terminating on "the user approves" has no termination path there at all.
+> Same class as Step 5b, one level up: that was an unconditional *write* gate,
+> this is an unconditional *control-flow loop* around the question.
---
@@ -150,7 +200,7 @@ dependencies I'm missing or that should be removed?"
- `lean` → skip (not a PHASE-GATE). Note: "TD-SYSTEM-BOUNDARY skipped — Lean mode." Proceed to priority assignment.
- `full` → spawn as normal.
-**After dependency mapping is approved, spawn `technical-director` via Task using gate TD-SYSTEM-BOUNDARY (`.claude/docs/director-gates.md`) before proceeding to priority assignment.**
+**After dependency mapping is approved, spawn `technical-director` via `Agent` using gate TD-SYSTEM-BOUNDARY (`.claude/docs/director-gates/td-system-boundary.md`) before proceeding to priority assignment.**
Pass: the dependency map summary, layer assignments, bottleneck systems list, any circular dependency resolutions.
@@ -182,19 +232,37 @@ Which systems should be higher or lower priority?"
Explain reasoning in conversation: "I placed [system] in MVP because the core loop
requires it — without [system], the 30-second loop can't function."
-**"Why" column guidance**: When explaining why each system was placed in a priority tier, mix technical necessity with player-experience reasoning. Do not use purely technical justifications like "Combat needs damage math" — connect to player experience where relevant. Examples of good "Why" entries:
-- "Required for the core loop — without it, placement decisions have no consequence (Pillar 2: Placement is the Puzzle)"
-- "Ballista's punch-through identity is established here — this stat definition is what makes it feel different from Archer"
-- "Foundation for all economy decisions — players must understand upgrade costs to make meaningful placement choices"
-
-Pure technical necessity ("X depends on Y") is insufficient alone when the system directly shapes player experience.
+**How to phrase the reasoning** — this governs what you *say*, not a column you
+write. Neither table has a `Why` column: Systems Enumeration is
+`# / Name / Category / Priority / Status / Design Doc / Depends On`, and
+Recommended Design Order is `Order / System / Priority / Layer / Agent(s) /
+Est. Effort`. The rationale lives in the conversation above and, for anything
+the user should still see after the session, in the index's `## Overview`
+paragraph. Do not invent a column for it.
+
+Mix technical necessity with player-experience reasoning. A purely technical
+justification — "the damage system needs damage math" — is insufficient on its
+own when the system directly shapes what the player feels. Good reasoning names
+both, and cites the pillar it serves:
+- "Required for the core loop — without it the player's main choice has no
+ consequence (Pillar [N]: [pillar name])"
+- "This is where [system]'s identity is established — the stat definitions here
+ are what make it feel different from [the sibling system]"
+- "Foundation for every later economy decision — the player must understand
+ costs before any of the choices built on top of it mean anything"
+
+> **Fill the brackets from *this* project.** The bracketed slots are not
+> decoration. Worked examples from another genre (a tower-defense "Ballista's
+> punch-through identity… what makes it feel different from Archer", "Pillar 2:
+> Placement is the Puzzle") get reproduced verbatim by a run against a different
+> game, which then carries that game's vocabulary instead of its own.
**Review mode check** — apply before spawning PR-SCOPE:
- `solo` → skip. Note: "PR-SCOPE skipped — Solo mode." Proceed to writing the systems index.
- `lean` → skip (not a PHASE-GATE). Note: "PR-SCOPE skipped — Lean mode." Proceed to writing the systems index.
- `full` → spawn as normal.
-**After priorities are approved, spawn `producer` via Task using gate PR-SCOPE (`.claude/docs/director-gates.md`) before writing the index.**
+**After priorities are approved, spawn `producer` via `Agent` using gate PR-SCOPE (`.claude/docs/director-gates/pr-scope.md`) before writing the index.**
Pass: total system count per milestone tier, estimated implementation volume per tier (system count × average complexity), team size, stated project timeline.
@@ -233,20 +301,34 @@ Present a summary of the document:
- First 3 systems in the design order
- Any high-risk items
-Ask: "May I write the systems index to `design/gdd/systems-index.md`?"
+**At `automation: collaborative`** — ask: "May I write the systems index to
+`design/gdd/systems-index.md`?" Wait for approval. Write the file only after
+"yes."
+
+**At `automation: guided`** — present the summary above, name the destination
+(`design/gdd/systems-index.md`), and write it without waiting for an explicit
+"yes", per `.claude/docs/automation-modes.md`. Say what you wrote afterwards.
-Wait for approval. Write the file only after "yes."
+> **Keep this line scoped to its mode.** `automation-modes.md` says `guided`
+> *"proceeds after a short summary, does not wait for explicit yes"*, and this
+> skill's own Collaborative Protocol section is scoped to `collaborative`. An
+> unconditional "wait for approval" here collides with both.
**Review mode check** — apply before spawning CD-SYSTEMS:
- `solo` → skip. Note: "CD-SYSTEMS skipped — Solo mode." Proceed to Phase 7 next steps.
- `lean` → skip (not a PHASE-GATE). Note: "CD-SYSTEMS skipped — Lean mode." Proceed to Phase 7 next steps.
- `full` → spawn as normal.
-**After the systems index is written, spawn `creative-director` via Task using gate CD-SYSTEMS (`.claude/docs/director-gates.md`).**
+**After the systems index is written, spawn `creative-director` via `Agent` using gate CD-SYSTEMS (`.claude/docs/director-gates/cd-systems.md`).**
Pass: systems index path, game pillars and core fantasy (from `design/gdd/game-concept.md`), MVP priority tier system list.
-Present the assessment. If REJECT, revise the system set with the user before GDD authoring begins. If CONCERNS, record them in the systems index as a `> **Creative Director Note**` at the top of the relevant tier section.
+Present the assessment. If REJECT, revise the system set with the user before GDD authoring begins. If CONCERNS, record them in the systems index as a `> **Creative Director Note**`
+placed **directly beneath the `## Priority Tiers` table**, naming the tier each
+concern applies to — e.g. `> **Creative Director Note** (MVP): …`.
+`templates/systems-index.md` has a Priority Tiers *definition table*, not a
+section per tier, so there is no "top of the tier section" to write to — do not
+direct the writer to one.
### Step 5c: Update Session State
@@ -326,6 +408,10 @@ After any individual GDD is completed:
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
This skill follows the collaborative design principle at every phase:
1. **Question -> Options -> Decision -> Draft -> Approval** at every step
diff --git a/.claude/skills/milestone-review/SKILL.md b/.claude/skills/milestone-review/SKILL.md
index cf60b959..4fd80cbb 100644
--- a/.claude/skills/milestone-review/SKILL.md
+++ b/.claude/skills/milestone-review/SKILL.md
@@ -1,35 +1,102 @@
---
name: milestone-review
-description: "Generates a comprehensive milestone progress review including feature completeness, quality metrics, risk assessment, and go/no-go recommendation. Use at milestone checkpoints or when evaluating readiness for a milestone deadline."
+description: "Milestone progress review — completeness, quality metrics, risk, go/no-go recommendation. At checkpoints or before a deadline."
argument-hint: "[milestone-name|current] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Agent, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation`
+
+
+
+## Insufficient input — check this before producing any report
+
+**If the inputs this skill needs do not exist, the answer is "could not run" —
+not a filled-in report.** Check first, and stop if the check fails.
+
+1. List the inputs this skill reads (data files, prior reports, profiler output,
+ test results, registries, source code).
+2. For each, record `FOUND` or `ABSENT` — not "assumed present".
+3. If any input required for a section is ABSENT, that section is
+ **`NOT ASSESSED — NO DATA`**. Do not estimate it, do not infer it from an
+ adjacent artifact, and do not leave a mandated cell to be filled by whoever
+ reads the template next.
+4. If **every** required input is ABSENT, stop and report
+ **`NOT ASSESSED — NO DATA`** as the whole verdict, naming what was missing and
+ which skill produces it.
+
+**A verdict of `NOT ASSESSED` is a success.** It is the correct, useful answer to
+"what does the data say?" when there is no data. The failure mode this prevents is
+specific and has been observed in practice: report templates whose verdict
+enum had no "could not run" state produced **false clean passes** — an asset audit
+returning COMPLIANT on a project with no assets and no standards, and a
+performance profile reporting ">99% headroom against a 16.67ms budget" with zero
+profiler data and no budget ever set.
+
+**Absence of evidence is never evidence of absence.** A scan that finds no
+matches because there are no files to scan has not verified anything. Say which of
+the two happened — a reader cannot tell from a green result.
+
+---
+
## Phase 0: Parse Arguments
-Extract the milestone name (`current` or a specific name) and resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
+Extract the milestone name (`current` or a specific name).
+
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
-See `.claude/docs/director-gates.md` for the full check pattern.
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
---
## Phase 1: Load Milestone Data
-Read the milestone definition from `production/milestones/`. If the argument is `current`, use the most recently modified milestone file.
+Read the milestone definition from `production/milestones/` if it exists. If the
+argument is `current`, use the most recently modified milestone file.
+
+> **No skill writes `production/milestones/`** — definitions are authored by hand
+> from `.claude/docs/templates/milestone-definition.md`, so most projects have
+> none. When the directory is absent or empty, say so and review against the
+> sprint reports alone; do not fabricate a definition. Take care with `current`:
+> this skill writes its own output as `[milestone-name]-review.md`, so a
+> most-recently-modified match can be a previous *review* rather than a
+> definition. Skip files ending `-review.md` when selecting.
+
+Gather the sprint reports for sprints within this milestone from
+`production/sprints/`. Establish the denominator (glob them, count **N**), then
+scan the sections a milestone review actually aggregates rather than reading each
+report whole:
+
+```
+Grep pattern="^## (Sprint Goal|Capacity|Tasks|Carryover|Risks|Progress|Burndown Assessment|Emerging Risks|Definition of Done)" glob="production/sprints/sprint-*.md" output_mode="content" -A 12
+```
-Read all sprint reports for sprints within this milestone from `production/sprints/`.
+> **These alternates are copied from `/sprint-plan`'s emitted headings — keep
+> them in sync with it, not with what a milestone review wishes existed.** The
+> previous pattern asked for `Summary|Goal|Velocity|Completed|Blockers|
+> Retrospective`, none of which `/sprint-plan` writes (it emits `## Sprint
+> Goal`, not `## Goal`). Only `Carryover` matched — and that was the trap: a
+> non-zero match count meant the zero-match escape hatch below could never
+> fire, so every milestone review silently aggregated carryover tables and
+> nothing else while reporting full coverage.
+
+Full-read a single sprint report when its scanned sections point outside
+themselves, or when it matched nothing — a zero-match report predates the
+template and must be read, never silently dropped from the milestone's history.
+Report any sprint that contributed nothing: a milestone summary that quietly
+omits a sprint understates the work and the slippage both.
---
## Phase 2: Scan Codebase Health
- Scan for `TODO`, `FIXME`, `HACK` markers that indicate incomplete work
-- Check the risk register at `production/risk-register/`
+- Check the risk register at `production/risk-register/` if it exists (hand-authored from `.claude/docs/templates/risk-register-entry.md`; no skill writes it, so absence is normal — note it rather than skipping risk assessment silently)
---
@@ -92,7 +159,7 @@ Read all sprint reports for sprints within this milestone from `production/sprin
## Go/No-Go Assessment
-**Recommendation**: [GO / CONDITIONAL GO / NO-GO]
+**Recommendation**: [NOT ASSESSED / GO / CONDITIONAL GO / NO-GO]
**Conditions** (if conditional):
- [Condition 1 that must be met]
@@ -114,7 +181,7 @@ Read all sprint reports for sprints within this milestone from `production/sprin
- `lean` → skip (not a PHASE-GATE). Note: "PR-MILESTONE skipped — Lean mode." Present the Go/No-Go section without a producer verdict.
- `full` → spawn as normal.
-Before generating the Go/No-Go recommendation, spawn `producer` via Task using gate **PR-MILESTONE** (`.claude/docs/director-gates.md`).
+Before generating the Go/No-Go recommendation, spawn `producer` via `Agent` using gate **PR-MILESTONE** (`.claude/docs/director-gates/pr-milestone.md`).
Pass: milestone name and target date, current completion percentage, blocked story count, velocity data from sprint reports (if available), list of cut candidates.
diff --git a/.claude/skills/onboard/SKILL.md b/.claude/skills/onboard/SKILL.md
index 19b58aa1..ca032903 100644
--- a/.claude/skills/onboard/SKILL.md
+++ b/.claude/skills/onboard/SKILL.md
@@ -1,12 +1,50 @@
---
name: onboard
-description: "Generates a contextual onboarding document for a new contributor or agent joining the project. Summarizes project state, architecture, conventions, and current priorities relevant to the specified role or area."
+description: "Onboarding doc for a new contributor or agent — project state, conventions, priorities relevant to the specified role."
argument-hint: "[role|area]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write
model: haiku
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+## Insufficient input — check this before producing any report
+
+**If the inputs this skill needs do not exist, the answer is "could not run" —
+not a filled-in report.** Check first, and stop if the check fails.
+
+1. List the inputs this skill reads (data files, prior reports, profiler output,
+ test results, registries, source code).
+2. For each, record `FOUND` or `ABSENT` — not "assumed present".
+3. If any input required for a section is ABSENT, that section is
+ **`NOT ASSESSED — NO DATA`**. Do not estimate it, do not infer it from an
+ adjacent artifact, and do not leave a mandated cell to be filled by whoever
+ reads the template next.
+4. If **every** required input is ABSENT, stop and report
+ **`NOT ASSESSED — NO DATA`** as the whole verdict, naming what was missing and
+ which skill produces it.
+
+**A verdict of `NOT ASSESSED` is a success.** It is the correct, useful answer to
+"what does the data say?" when there is no data. The failure mode this prevents is
+specific and has been observed in practice: report templates whose verdict
+enum had no "could not run" state produced **false clean passes** — an asset audit
+returning COMPLIANT on a project with no assets and no standards, and a
+performance profile reporting ">99% headroom against a 16.67ms budget" with zero
+profiler data and no budget ever set.
+
+**Absence of evidence is never evidence of absence.** A scan that finds no
+matches because there are no files to scan has not verified anything. Say which of
+the two happened — a reader cannot tell from a green result.
+
+---
+
## Phase 1: Load Project Context
Read CLAUDE.md for project overview and standards.
@@ -17,7 +55,7 @@ Read the relevant agent definition from `.claude/agents/` if a specific role is
## Phase 2: Scan Relevant Area
-- For programmers: scan `src/` for architecture, patterns, key files
+- For programmers: scan the code root (resolve per `.claude/docs/code-root-resolution.md`) for architecture, patterns, key files
- For designers: scan `design/` for existing design documents
- For narrative: scan `design/narrative/` for world-building and story docs
- For QA: scan `tests/` for existing test coverage
diff --git a/.claude/skills/patch-notes/SKILL.md b/.claude/skills/patch-notes/SKILL.md
index c16fda83..8971d66f 100644
--- a/.claude/skills/patch-notes/SKILL.md
+++ b/.claude/skills/patch-notes/SKILL.md
@@ -1,11 +1,66 @@
---
name: patch-notes
-description: "Generate player-facing patch notes from git history, sprint data, and internal changelogs. Translates developer language into clear, engaging player communication."
+description: "Player-facing patch notes from git history and changelogs. Translates developer language into player communication."
argument-hint: "[version] [--style brief|detailed|full]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Bash
-model: haiku
-agent: community-manager
+model: sonnet
+---
+
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+## Provenance check — before reading any history
+
+**Confirm the history you are about to read belongs to THIS game.** Run this
+before Phase 2 and stop if it fails.
+
+1. Sample the recent log: `git log --oneline -20`.
+2. **Classify every commit in the range, one at a time**, into exactly one of:
+ - **Game** — changes the game the player plays: mechanics, content, balance,
+ art, audio, UI, a bug in any of those.
+ - **Framework / maintenance** — changes CCGS itself or the project's tooling:
+ subjects naming skills, hooks, agents, the test plan, CI, the framework's
+ own docs. **Excluded from player-facing notes, but not a reason to stop.**
+ - **Unclear** — treat as framework. A commit you cannot confidently place is
+ not one to write player copy from.
+3. Then decide from the counts:
+ - **At least one Game commit** → proceed, using **only** those. Say how many
+ of how many you used, so the reader can see the filter ran.
+ - **Zero Game commits** → stop, using the message below.
+
+> **Filter per commit; do not stop on a repo that merely contains maintenance
+> work.** Every project built on this framework accumulates commits touching
+> hooks, CI and skills — the game repo *is* the framework repo. An earlier
+> version of this check listed "subjects naming the framework, its skills, hooks,
+> agents or test plan" as a hard STOP, which fires on virtually every real
+> project and contradicted its own step 2 whenever a history was mostly the
+> game's. The danger was never that such commits *exist*; it is that they get
+> **rendered as player-facing copy**. Excluding them addresses that exactly, and
+> a repo-level stop does not.
+
+Corroborate before you proceed, cheaply: the Game commits should name systems
+that appear in `design/` and `src/`. If they name a product those directories
+never mention, that is the real wrong-history signal — stop.
+
+If **no** commit in the range is this game's, say so and stop:
+
+> "The git history in this repo does not appear to belong to [game]. The recent
+> commits describe [what they actually describe]. I cannot generate release notes
+> from it — point me at the right history, or supply the change list directly."
+
+**Why this is a hard stop, not a warning.** This exact failure is real, not
+hypothetical: a batch of framework-internal commits produced player-facing copy
+reading *"Fixed an issue where progress from your last session could be lost on launch"*
+— a session-hook timeout rendered as a gameplay fix for a game with **no save
+system**. It was fluent, plausible, and entirely false. A reader cannot tell the
+difference; only this check can.
+
---
## Phase 1: Parse Arguments
diff --git a/.claude/skills/perf-profile/SKILL.md b/.claude/skills/perf-profile/SKILL.md
index 68f21665..08326375 100644
--- a/.claude/skills/perf-profile/SKILL.md
+++ b/.claude/skills/perf-profile/SKILL.md
@@ -1,13 +1,71 @@
---
name: perf-profile
-description: "Structured performance profiling workflow. Identifies bottlenecks, measures against budgets, and generates optimization recommendations with priority rankings."
+description: "Performance profiling — find bottlenecks, measure against budgets, produce ranked optimization recommendations."
argument-hint: "[system-name or 'full']"
user-invocable: true
-agent: performance-analyst
allowed-tools: Read, Glob, Grep, Bash
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys performance.enforce,automation`
+
+Resolved above — use as-is. No block → defaults in
+`.claude/docs/config-resolution.md`.
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+## Insufficient input — check this before producing any report
+
+**If the inputs this skill needs do not exist, the answer is "could not run" —
+not a filled-in report.** Check first, and stop if the check fails.
+
+1. List the inputs this skill reads (data files, prior reports, profiler output,
+ test results, registries, source code).
+2. For each, record `FOUND` or `ABSENT` — not "assumed present".
+3. If any input required for a section is ABSENT, that section is
+ **`NOT ASSESSED — NO DATA`**. Do not estimate it, do not infer it from an
+ adjacent artifact, and do not leave a mandated cell to be filled by whoever
+ reads the template next.
+4. If **every** required input is ABSENT, stop and report
+ **`NOT ASSESSED — NO DATA`** as the whole verdict, naming what was missing and
+ which skill produces it.
+
+**A verdict of `NOT ASSESSED` is a success.** It is the correct, useful answer to
+"what does the data say?" when there is no data. The failure mode this prevents is
+specific and has been observed in practice: report templates whose verdict
+enum had no "could not run" state produced **false clean passes** — an asset audit
+returning COMPLIANT on a project with no assets and no standards, and a
+performance profile reporting ">99% headroom against a 16.67ms budget" with zero
+profiler data and no budget ever set.
+
+**Absence of evidence is never evidence of absence.** A scan that finds no
+matches because there are no files to scan has not verified anything. Say which of
+the two happened — a reader cannot tell from a green result.
+
+---
+
+## Phase 0: Resolve Budget Enforcement
+
+`performance.enforce` decides what a budget violation *means* in this run. It
+does not change which budgets are measured — `performance.target_framerate`,
+`frame_budget_ms`, `draw_call_limit` and `memory_ceiling_mb` are profiled the
+same way at every level:
+
+| Value | Effect on this profile's findings |
+|-------|-----------------------------------|
+| `warn` (default) | Violations are reported as findings. They do not block; CI logs them without failing. |
+| `block` | Violations are **blockers**. Say so explicitly in the report — a `block` project treats an over-budget system as release-stopping, and `/gate-check` will FAIL the Polish gate on it. |
+| `off` | Budgets are informational only. Still report measured values, but do not raise violations as findings or recommendations to fix. |
+
+Only `warn`, `block` and `off` are recognized. Surface any other value to the
+user and fall back to `warn` rather than guessing.
+
+> The value is locally overridable (`/settings --local performance.enforce=block`),
+> so use the resolved block above rather than reading `project.yaml` — a
+> teammate's stricter local setting is meant to bite on their machine only.
+
## Phase 1: Determine Scope
Read the argument:
@@ -19,7 +77,30 @@ Read the argument:
## Phase 2: Load Performance Budgets
-Check for existing performance targets in design docs or CLAUDE.md:
+**Read the committed budgets from config first** — they are the project's
+record of what it agreed to, and design docs are the fallback, not the source:
+
+```bash
+source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null
+get_effective_yaml_key performance.target_framerate
+get_effective_yaml_key performance.frame_budget_ms
+get_effective_yaml_key performance.draw_call_limit
+get_effective_yaml_key performance.memory_ceiling_mb
+```
+
+> Written as four literal keys rather than a loop over leaf names, deliberately.
+> The dead-settings audit matches the **full dotted key**, so a loop building
+> `performance.$k` leaves three of the four spelled nowhere and the audit
+> reports them DEAD while this skill reads them. Spell each key out in full.
+
+> **Resolve these budgets from `project.yaml`, not from prose.** Phase 0 above
+> states these four budgets "are profiled the same way at every level". Sending
+> the reader to *"design docs or CLAUDE.md"* instead means a user who set
+> `performance.target_framerate: 60` in `project.yaml` has it ignored by the one
+> skill that profiles against budgets. The keys resolve correctly — this phase
+> has to actually ask for them.
+
+Then fall back to design docs or CLAUDE.md for anything config does not carry:
- Target FPS (e.g., 60fps = 16.67ms frame budget)
- Memory budget (total and per-system)
@@ -27,6 +108,11 @@ Check for existing performance targets in design docs or CLAUDE.md:
- Draw call budgets
- Network bandwidth limits (if multiplayer)
+**A metric with no committed budget is `NOT ASSESSED`, not a pass.** Do not
+measure against the template's `[16.67ms]` placeholder — an unset budget is not
+a budget that was met, and reporting headroom against a number nobody chose is
+the exact fabrication this skill's own header warns about.
+
---
## Phase 3: Analyze Codebase
@@ -62,6 +148,22 @@ Check for existing performance targets in design docs or CLAUDE.md:
## Phase 4: Generate Profiling Report
+**Write the report to `production/polish/[scope]-report-[date].md`**, asking first
+per the Collaboration Protocol: *"May I write this profiling report to
+`production/polish/[scope]-report-[date].md`?"* Create the directory if absent.
+
+> **Name the destination — do not just render the template into the
+> conversation.** A profile that lives only in the transcript is gone the moment
+> the session ends, and no two runs can be compared. `production/polish/`
+> is the same location `/team-polish` writes, deliberately: a profile taken by
+> either route belongs in one place, or the comparison this skill exists to enable
+> cannot be made.
+>
+> If a `NOT ASSESSED` section survives into the report, keep it in the written
+> file. A profile whose gaps are edited out on the way to disk reads, later, as a
+> complete measurement.
+
+
```markdown
## Performance Profile: [System or Full]
Generated: [Date]
diff --git a/.claude/skills/playtest-report/SKILL.md b/.claude/skills/playtest-report/SKILL.md
index cc4c3aff..75d47970 100644
--- a/.claude/skills/playtest-report/SKILL.md
+++ b/.claude/skills/playtest-report/SKILL.md
@@ -1,20 +1,25 @@
---
name: playtest-report
-description: "Generates a structured playtest report template or analyzes existing playtest notes into a structured format. Use this to standardize playtest feedback collection and analysis."
+description: "Structured playtest report template, or turn existing playtest notes into structured feedback."
argument-hint: "[new|analyze path-to-notes] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Agent, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation`
+
+
+
## Phase 1: Parse Arguments
-Resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
-See `.claude/docs/director-gates.md` for the full check pattern.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
Determine the mode:
@@ -122,9 +127,15 @@ Present the categorized list, then route:
- `lean` → skip (not a PHASE-GATE). Note: "CD-PLAYTEST skipped — Lean mode." Proceed to Phase 4 (save the report).
- `full` → spawn as normal.
-After categorising findings, spawn `creative-director` via Task using gate **CD-PLAYTEST** (`.claude/docs/director-gates.md`).
+After categorising findings, spawn `creative-director` via `Agent` using gate **CD-PLAYTEST** (`.claude/docs/director-gates/cd-playtest.md`).
-Pass: the structured report content, game pillars and core fantasy (from `design/gdd/game-concept.md`), the specific hypothesis being tested.
+Pass: the structured report content, game pillars and core fantasy (from
+`design/gdd/game-concept.md`), the specific hypothesis being tested. **If
+`game-concept.md` does not exist** — expected at `minimal`, where
+`design/game-brief.md` replaces it — pass the brief's pillars instead, and if
+neither exists say so in the prompt: *"No pillars available — assess against
+the hypothesis alone."* A director gate handed silence about pillars will
+invent them.
Present the creative director's assessment before saving the report. If CONCERNS or REJECT, add a `## Creative Director Assessment` section to the report capturing the verdict and feedback. If APPROVE, note the approval in the report.
diff --git a/.claude/skills/project-stage-detect/SKILL.md b/.claude/skills/project-stage-detect/SKILL.md
index 148abaae..d3d1ee42 100644
--- a/.claude/skills/project-stage-detect/SKILL.md
+++ b/.claude/skills/project-stage-detect/SKILL.md
@@ -1,6 +1,6 @@
---
name: project-stage-detect
-description: "Automatically analyze project state, detect stage, identify gaps, and recommend next steps based on existing artifacts. Use when user asks 'where are we in development', 'what stage are we in', 'full project audit'."
+description: "Analyze project state, detect stage, identify gaps, recommend next steps. 'Where are we in development?'"
argument-hint: "[optional: role filter like 'programmer' or 'designer']"
user-invocable: true
allowed-tools: Read, Glob, Grep, Bash, Write
@@ -21,19 +21,62 @@ of artifacts, and gaps that need attention. It's especially useful when:
## Workflow
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys workflow,automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+Resolved above — use as-is. No block → defaults in
+`.claude/docs/config-resolution.md`.
+
+> **Resolve the tier — do not assume it.** Saying "surface gaps per the **resolved** workflow
+> tier" without resolving it — no bootstrap, no helper call — leaves
+> the tier as whatever the model assumed. The tier decides what counts as a gap
+> at all: at `full` every missing doc is one; at `minimal` none of them are,
+> because a brief plus an engine is the normal state and code is the expected
+> next step. Guessing high tells a jam project it is missing GDDs, an art bible
+> and ADRs — the exact "process feels mismatched to my project" experience
+> `modes.rigor` exists to prevent. A missing bootstrap is invisible to a static
+> read — the config block simply does not render — so verify it by running.
+
+**`workflow`** (per `.claude/docs/workflow-modes.md`). The tier governs
+which absent documents count as gaps (step 3) — below `full`, optional docs are
+not flagged.
+
### 1. Scan Key Directories
-Analyze project structure and content:
+**Start with the deterministic pass — it answers "what exists" for every
+catalogued artifact in one call:**
+
+```
+Bash: bash .claude/scripts/artifact-check.sh
+```
+
+With no `--phase` it reports every phase, so a single call covers the whole
+project: per step, `PRESENT` / `ABSENT` / `SHORT` (with `count=` and `min=`) /
+`PATTERN_MISS` / `NO_CHECK`. Use it instead of hand-globbing each artifact
+below, and treat its `NO_CHECK` total as the honest bound on what existence
+checks can tell you.
+
+It reports observations only — this skill still decides what stage those
+observations imply, and the tier still governs which absences are gaps at all
+(see the workflow-tier note below).
+
+Then analyze what the script cannot: content quality, counts it does not
+track, and the judgement calls.
**Design Documentation** (`design/`):
- Count GDD files in `design/gdd/*.md`
-- Check for game-concept.md, game-pillars.md, systems-index.md
+- Check for game-concept.md (or `design/game-brief.md` at `minimal`), game-pillars.md, systems-index.md
- If systems-index.md exists, count total systems vs. designed systems
- Analyze completeness (Overview, Detailed Design, Edge Cases, etc.)
- Count narrative docs in `design/narrative/`
- Count level designs in `design/levels/`
-**Source Code** (`src/`):
+**Source Code** (the code root — `src/` Godot, `Assets/` Unity, `Source/` Unreal; resolve per `.claude/docs/code-root-resolution.md`):
- Count source files (language-agnostic)
- Identify major systems (directories with 5+ files)
- Check for core/, gameplay/, ai/, networking/, ui/ directories
@@ -59,23 +102,46 @@ Analyze project structure and content:
### 2. Classify Project Stage
-Based on scanned artifacts, determine stage. Check `production/stage.txt` first —
-if it exists, use its value (explicit override from `/gate-check`). Otherwise,
-auto-detect using these heuristics (check from most-advanced backward):
+Based on scanned artifacts, determine stage. Check `project.stage` in `project.yaml` first (if present); else `production/stage.txt` (legacy fallback) — either is an explicit override from `/gate-check`. Otherwise, auto-detect using these heuristics (check from most-advanced backward):
+
+> **Always run the heuristics, even when a stage is configured — then COMPARE.**
+> The configured value is authoritative for what the stage *is*; it is not
+> evidence that the artifacts support it. Report both, and when they disagree say
+> so explicitly:
+>
+> > "Configured stage: **Release**. Observed artifacts indicate
+> > **Pre-Production** (2 source files, 0 ADRs, no architecture doc, no epics).
+> > These disagree — the configured stage may be stale, or work exists outside
+> > this repo."
+>
+> Reading config and reporting it back is not detection. This skill's own
+> description promises "analyze project state, detect stage", and a stage
+> detector that cannot contradict its input is the one thing it must never be.
+> Observed live: it reported `Release` for a project whose artifacts matched its
+> own Pre-Production row, four stages below, and said nothing.
| Stage | Indicators |
|-------|-----------|
| **Concept** | No game concept doc, brainstorming phase |
| **Systems Design** | Game concept exists, systems index missing or incomplete |
| **Technical Setup** | Systems index exists, engine not configured |
-| **Pre-Production** | Engine configured, `src/` has <10 source files |
-| **Production** | `src/` has 10+ source files, active development |
+| **Pre-Production** | Engine configured, code root has <10 source files |
+| **Production** | code root has 10+ source files, active development |
| **Polish** | Explicit only (set by `/gate-check` Production → Polish gate) |
| **Release** | Explicit only (set by `/gate-check` Polish → Release gate) |
### 3. Collaborative Gap Identification
-**DO NOT** just list missing files. Instead, **ask clarifying questions**:
+**Surface gaps per the resolved workflow tier:**
+- **`full`** — flag every missing doc type (GDDs, art bible, UX specs, ADRs) as a gap.
+- **`standard`** — flag only required docs: missing GDDs for built systems and
+ missing critical (Foundation-layer) ADRs. Do NOT flag an absent art bible unless
+ visual-asset stories exist, and do NOT flag non-core UX specs.
+- **`minimal`** — a `design/game-brief.md` + engine present is the normal state. Do NOT flag
+ absent GDDs, art bible, UX specs, or ADRs as gaps; the expected next step is code.
+
+**DO NOT** just list missing files. Instead, **ask clarifying questions** (only
+for gaps the tier above says to surface):
- "I see combat code (`src/gameplay/combat/`) but no `design/gdd/combat-system.md`. Was this prototyped first, or should we reverse-document?"
- "You have 15 ADRs but no architecture overview. Should I create one to help new contributors?"
@@ -171,7 +237,10 @@ Wait for user approval before creating the file.
## Follow-Up Actions
-After generating the report, suggest relevant next steps:
+After generating the report, suggest relevant next steps — **only for gaps the
+resolved workflow tier surfaces** (step 3). At `standard`/`minimal`, do not
+suggest authoring optional docs (e.g. don't suggest `/reverse-document` for an
+absent GDD at `minimal`, where code is the expected next step):
- **Concept exists but no systems index?** → `/map-systems` to decompose into systems
- **Missing design docs?** → `/reverse-document design src/[system]`
diff --git a/.claude/skills/propagate-design-change/SKILL.md b/.claude/skills/propagate-design-change/SKILL.md
index 86d50eb1..7c6585eb 100644
--- a/.claude/skills/propagate-design-change/SKILL.md
+++ b/.claude/skills/propagate-design-change/SKILL.md
@@ -1,13 +1,16 @@
---
name: propagate-design-change
-description: "When a GDD is revised, scans all ADRs and the traceability index to identify which architectural decisions are now potentially stale. Produces a change impact report and guides the user through resolution."
+description: "A GDD changed — scan ADRs and the traceability index for now-stale architectural decisions. Impact report, guides resolution."
argument-hint: "[path/to/changed-gdd.md]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Bash, Task
+allowed-tools: Read, Glob, Grep, Write, Bash, Agent, AskUserQuestion
model: sonnet
-agent: technical-director
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,workflow,system_overrides`
+
+
+
# Propagate Design Change
When a GDD changes, architectural decisions written against it may no longer be
@@ -18,6 +21,20 @@ what the GDD now says, and guides the user through resolution.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt — ADR/schema impacts here fall
+under `schema_changes` and `architecture_decisions`).
+
+**Workflow tier**: resolve for the **changed GDD's system** (per
+`.claude/docs/workflow-modes.md`): use the
+`system_overrides` row for that system if the block lists one, else the
+project value. (A system pinned `minimal` has no ADRs even on a `standard`
+project — so its change is N/A.) It scopes the cascade: `full` cascades across all
+ADRs; `standard` checks only critical (Foundation-layer) ADRs plus any ADR
+referencing the changed GDD; `minimal` is **not applicable** — no ADRs to cascade.
+See Step 4.
+
## 1. Validate Argument
A GDD path argument is **required**. If missing, fail with:
@@ -29,29 +46,46 @@ Verify the file exists. If not, fail with:
---
-## 2. Read the Changed GDD
-
-Read the current GDD in full.
+## 2. Diff the GDD Against Its Previous Version
----
+**Ask git what changed — do not read two whole documents and compare them by
+eye.** The previous form of this step read the current GDD in full *and*
+`git show`-ed the full committed version, then diffed them mentally: two entire
+documents in context to find what is usually a handful of lines, and a model
+comparing 400-line documents will eventually miss an edit. Git cannot.
-## 3. Read the Previous Version
+```bash
+git diff HEAD -- design/gdd/[filename].md
+```
-Run git to get the previous committed version:
+If that is empty, the change may already be committed — widen to the commit that
+last touched it:
```bash
-git show HEAD:design/gdd/[filename].md
+git diff HEAD~1 HEAD -- design/gdd/[filename].md
```
If the file has no git history (new file), report:
> "No previous version in git — this appears to be a new GDD, not a revision.
> Nothing to propagate."
-If git returns the previous version, do a conceptual diff:
+If the diff is empty **and** the file has history, report that plainly — "no
+uncommitted or last-commit changes to `[file]`" — and ask which revision to
+propagate. An empty diff is not "no impact"; it means nothing changed *here*.
+
+From the diff hunks:
- Identify sections that changed (new rules, removed rules, modified formulas,
- changed acceptance criteria, changed tuning knobs)
-- Identify sections that are unchanged
-- Produce a change summary:
+ changed acceptance criteria, changed tuning knobs). The `@@` hunk headers name
+ the enclosing section, so the changed-section list falls out of the diff itself.
+- Read the surrounding section from the current GDD **only** where a hunk is too
+ small to interpret on its own (a changed number whose meaning depends on the
+ rule above it). That is a targeted read of one section, not the document.
+- Sections with no hunk are unchanged — by construction, not by inspection.
+---
+
+## 3. Produce the Change Summary
+
+From the hunks resolved in step 2:
```
## Change Summary: [GDD filename]
@@ -68,23 +102,77 @@ Key changes affecting architecture:
- [Change 2]
```
+**Downstream GDD impact via the registry.** If `design/registry/entities.yaml`
+exists, it already records which other GDDs depend on this system's facts —
+compute the affected set from it rather than re-reading every GDD:
+```
+Grep pattern="source: design/gdd/[filename]" path="design/registry/entities.yaml" output_mode="content" -A 6
+```
+For each entity/constant/formula this GDD **owns** whose value the diff changed,
+its `referenced_by:` list is the set of downstream GDDs that may now be
+inconsistent — report them under "Downstream GDDs to re-check". **If
+`design/registry/entities.yaml` does not exist or has no entries** (it ships as
+an empty stub until `/design-system` populates it), skip this — the ADR cascade
+below still runs.
+
---
## 4. Load Architecture Inputs
-Read all ADRs in `docs/architecture/`:
-- For each ADR, read the full file
-- Extract the "GDD Requirements Addressed" table
-- Note which GDD documents and requirement IDs each ADR references
+Read ADRs in `docs/architecture/` **per the resolved tier**:
+- **`full`** — read **all** ADRs.
+- **`standard`** — read only **critical (Foundation-layer) ADRs** plus any ADR
+ that references the changed GDD.
+- **`minimal`** — **not applicable**: there are no ADRs to cascade. Report "No ADR
+ cascade at minimal workflow — design change recorded; no architecture impact
+ analysis." and stop here.
-Read `docs/architecture/architecture-traceability.md` if it exists.
+**Establish the denominator first.** Glob the in-scope ADRs (per the tier above).
+Call the count **N**. If N is 0: "No ADRs found in `docs/architecture/` — nothing
+to cascade." Stop.
-Report: "Loaded [N] ADRs. [M] reference [gdd filename]."
+**Scan the requirement tables — do not full-read the ADRs at this step:**
+```
+Grep pattern="## GDD Requirements Addressed" glob="docs/architecture/adr-*.md" output_mode="content" -A 15
+```
+**Recall net — an ADR may cite the changed GDD in prose without tabling it:**
+```
+Grep pattern="[changed-gdd-basename]" glob="docs/architecture/adr-*.md" output_mode="files_with_matches"
+```
+Take the **union** of the two results as the affected set **M**. This turns
+N × ~200 lines into N × ~15 lines; §5 full-reads only the M.
+
+Interpret the result — a zero-match scan is **never** "no impact" by default:
+
+| Result | Meaning | Action |
+|---|---|---|
+| **M ≥ 1** | Normal. | Proceed. The N − M non-matching ADRs are *out of scope for this cascade* — do not describe them as verified unaffected. |
+| **Both scans 0, N > 0** | Ambiguous — either no ADR references this GDD, or the ADRs lack requirement tables. | Run `Grep pattern="## GDD Requirements Addressed" glob="docs/architecture/adr-*.md" output_mode="files_with_matches"`. If that is **also** empty: "[N] ADRs found, none contains a 'GDD Requirements Addressed' section — traceability cannot be computed (a `gate-pre-production` blocker). Run `/architecture-decision [adr] retrofit`." If it is **non-empty**: the tables exist and genuinely none reference this GDD — "No ADR references [gdd] — no architecture impact." |
+
+Read `docs/architecture/requirements-traceability.md` if it exists.
+
+Report: "Loaded [N] ADRs by scan. [M] reference [gdd filename] ([X] via
+requirements table, [Y] via prose reference only)."
---
## 5. Impact Analysis
+Now read each ADR in the affected set **M** for its reasoning, not just its
+table — judging whether a decision is still valid needs the ADR's `## Context`
+and `## Decision` (and `## Consequences` where present), not scan output. **Do
+not attempt the judgement below from scan output.**
+
+This read is unbounded only up to a point — check size first
+(`Bash: wc -c "docs/architecture/[adr-file].md"`):
+- **Under ~50KB** — one full `Read` is fine and cheapest at this size.
+- **~50KB or larger** — map headings first
+ (`Grep pattern="^## " path="docs/architecture/[adr-file].md" output_mode="content" -n`),
+ then bounded-`Read` only `## Context`, `## Decision`, and `## Consequences`.
+ An unbounded `Read` on a large ADR hits the 25k-token cap and, unrecovered,
+ the only path forward is paging through the entire remainder — measured at
+ 103k tokens on a 34k-token ADR, most of it content this analysis never uses.
+
For each ADR that references the changed GDD:
Compare the ADR's "GDD Requirements Addressed" entries against the changed sections
@@ -153,7 +241,7 @@ ADRs referencing this GDD: [M]
- `lean` → skip. Note: "TD-CHANGE-IMPACT skipped — Lean mode." Proceed to Phase 7.
- `full` → spawn as normal.
-Spawn `technical-director` via Task using gate **TD-CHANGE-IMPACT** (`.claude/docs/director-gates.md`).
+Spawn `technical-director` via `Agent` using gate **TD-CHANGE-IMPACT** (`.claude/docs/director-gates/td-change-impact.md`).
Pass: the full Design Change Impact Report from Phase 6 (change summary, all affected ADRs with their Still Valid / Needs Review / Likely Superseded classifications, and recommended actions).
@@ -189,7 +277,7 @@ For ADRs marked **Superseded**:
## 8. Update Traceability Index
-If `docs/architecture/architecture-traceability.md` exists:
+If `docs/architecture/requirements-traceability.md` exists:
- Add the changed GDD requirements to the "Superseded Requirements" table:
```markdown
@@ -232,6 +320,10 @@ Based on the resolution decisions, suggest:
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
1. **Read silently** — compute the full impact before presenting anything
2. **Show the full report first** — let the user see the scope before asking for action
3. **Ask per-ADR** — don't batch decisions; each affected ADR may need different treatment
diff --git a/.claude/skills/prototype/SKILL.md b/.claude/skills/prototype/SKILL.md
index c25e3d97..f1888869 100644
--- a/.claude/skills/prototype/SKILL.md
+++ b/.claude/skills/prototype/SKILL.md
@@ -1,14 +1,17 @@
---
name: prototype
-description: "Concept prototype — validate the core idea is worth designing before writing GDDs. Run right after /brainstorm and /setup-engine. Routes to HTML, Engine, or Paper path based on game type. Produces a throwaway build and a PROCEED/PIVOT/KILL verdict."
+description: "Concept prototype before GDDs — throwaway HTML, Engine or Paper build, PROCEED/PIVOT/KILL. After /brainstorm and /setup-engine."
argument-hint: "[concept-description] [--path html|engine|paper] [--review full|lean|solo] [--spike]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion
model: sonnet
-agent: prototyper
isolation: worktree
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation`
+
+
+
## Purpose
This is the **concept prototype** — a fast, throwaway build that answers one question:
@@ -29,10 +32,10 @@ before committing to Production, run `/vertical-slice` instead.
## Phase 1: Define the Question
-Resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
**Check for spike mode:** If `--spike` was passed, skip to the **Spike Mode** section
at the bottom of this skill.
@@ -94,8 +97,11 @@ Read `design/gdd/game-concept.md` if it exists. Extract:
- Core fantasy (what the player is supposed to feel)
- Core loop (the moment-to-moment action being tested)
-Read `CLAUDE.md` and `.claude/docs/technical-preferences.md` for the engine and
-language in use.
+Determine the engine and language in use: read `engine.name` and
+`engine.language` from `project.yaml`. For each field, if its key is absent or
+empty (including when `project.yaml` has no `engine:` block), fall back to
+`CLAUDE.md` and `.claude/docs/technical-preferences.md`. Treat a
+`[TO BE CONFIGURED]` value as not set.
---
@@ -415,7 +421,7 @@ is the project's complete history of what was tried and what was learned.
**Review mode check:**
- `solo` → skip. Note: "CD-PLAYTEST skipped — Solo mode."
- `lean` → skip. Note: "CD-PLAYTEST skipped — Lean mode."
-- `full` → spawn `creative-director` via Task using gate **CD-PLAYTEST** if
+- `full` → spawn `creative-director` via `Agent` using gate **CD-PLAYTEST** if
`design/gdd/game-concept.md` exists with game pillars defined. If pillars are
not yet defined, note: "CD-PLAYTEST skipped — game pillars not yet defined at
concept prototype stage."
diff --git a/.claude/skills/qa-plan/SKILL.md b/.claude/skills/qa-plan/SKILL.md
index 0e6c52b6..0e7d3dab 100644
--- a/.claude/skills/qa-plan/SKILL.md
+++ b/.claude/skills/qa-plan/SKILL.md
@@ -1,13 +1,18 @@
---
name: qa-plan
-description: "Generate a QA test plan for a sprint or feature. Reads GDDs and story files, classifies stories by test type (Logic/Integration/Visual/UI), and produces a structured test plan covering automated tests required, manual test cases, smoke test scope, and playtest sign-off requirements. Run before sprint begins or when starting a major feature."
+description: "QA test plan for a sprint — classifies stories by Logic/Integration/Visual/UI, covers automated tests, manual cases, smoke scope."
argument-hint: "[sprint | feature: system-name | story: path]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion
model: sonnet
-agent: qa-lead
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,workflow,qa.level,system_overrides`
+
+Resolved above — use as-is. No block → defaults in
+`.claude/docs/config-resolution.md`.
+
+
# QA Plan
This skill generates a structured QA plan for a sprint, feature, or individual
@@ -24,6 +29,20 @@ plan.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**Workflow tier**: resolve per the GDD's system as each is read (per
+`.claude/docs/workflow-modes.md`): `workflow_overrides.system_overrides.<system>`
+if the block lists one, else the project value. It sets how many GDD sections
+the test plan is mined from — see Phase 2.
+
+**`qa.level`**: at `minimal`, produce only a minimal smoke
+plan — drop the automated-test-required rows and the test-file DoD; at `standard`,
+a full plan per story type; at `full`, also add per-system coverage targets.
+Distinct axis from `workflow` (which sets how many GDD sections are mined).
+
## Phase 1: Parse Scope
**Argument:** `$ARGUMENTS` (blank = ask user via AskUserQuestion)
@@ -49,32 +68,73 @@ If a story file path is referenced but the file does not exist, note it as
MISSING and continue with the remaining stories. Do not fail the entire plan
for one missing file.
+> **If the resolved scope contains ZERO stories, stop — do not build a plan.**
+> Report `NOT ASSESSED — no stories in scope`, naming which scope was searched
+> and which path was empty, and route:
+> - no file in `production/sprints/` → "No sprint plan found. Run `/sprint-plan new`."
+> - a sprint plan exists but references no stories → "Sprint plan `[path]` lists no
+> stories. Run `/create-stories [epic-slug]`."
+> - `feature:`/`story:` scope matched nothing → name the glob that came back empty.
+>
+> **The N=0 guard is mandatory.** Without it an empty scope reports "Building QA
+> plan for 0 stories" and continues into Phase 4, producing a plan document with
+> empty tables — and **a QA plan for zero stories looks exactly like a completed
+> QA plan.** This skill gates the hand-off to manual QA, so a false-clean here
+> sends a build to QA on the strength of a plan that tested nothing.
+>
+> Note the shape, because this skill already had the harder half of the rule.
+> Phase 2 states **"Never treat an absent section as an absent story"** — the
+> sophisticated inner case, correctly handled. The outer boundary, no stories at
+> all, had nothing. The same shape appears in `/story-readiness`, where `NOT ASSESSED`
+> existed for per-story failures and the empty scope could not reach it.
+>
+> The rule at the top of this block still stands: one missing file among several
+> is MISSING-and-continue. This is the different case where there is no *several*.
+
---
## Phase 2: Load Inputs
-For each in-scope story file, read the full file and extract:
+Establish the denominator first — glob the in-scope story files and count **N** —
+then collect the fields below with **targeted section greps, not a full read of
+each story**. A QA plan needs each story's type and acceptance criteria; it does
+not need its implementation notes, out-of-scope boundaries or ADR rationale, and
+reading N stories whole to reach two sections is where this phase's cost lives:
-- **Story title** and story ID (from filename or header)
-- **Story Type** field (if present in the file header — e.g., `Type: Logic`)
-- **Acceptance criteria** — the complete numbered/bulleted list
-- **Implementation files** — listed under "Files to Create / Modify" or similar
-- **Engine notes** — any engine API warnings or version-specific notes
-- **GDD reference** — the GDD path(s) cited
-- **ADR reference** — the ADR(s) cited
-- **Estimate** — hours or story points if present
-- **Dependencies** — other stories this one depends on
+```
+Grep pattern="^## Acceptance Criteria" glob="production/epics/**/story-*.md" output_mode="content" -A 15
+Grep pattern="^> \*\*(Type|Status|Estimate)\*\*" glob="production/epics/**/story-*.md" output_mode="content"
+Grep pattern="^## (Context|Dependencies)" glob="production/epics/**/story-*.md" output_mode="content" -A 8
+```
+
+(Scope the globs to the sprint plan's story paths in `sprint` mode.) From those:
+
+- **Story title** and story ID — from the file name and path; no read at all
+- **Story Type** field — from the header grep (e.g., `Type: Logic`)
+- **Acceptance criteria** — the complete numbered/bulleted list, from the first grep
+- **GDD / ADR reference** and **Dependencies** — from the `## Context` grep
+- **Estimate** — from the header grep if present
+- **Implementation files** and **Engine notes** — only needed for stories whose
+ test plan actually turns on them; full-read those individual stories
+
+**Never treat an absent section as an absent story.** If a story matched no
+`## Acceptance Criteria`, full-read that one and say so — a story with no
+testable criteria is a QA finding in its own right, not a story to skip.
After reading stories, load supporting context once (not per story):
- `design/gdd/systems-index.md` — to understand system priorities and which
GDDs are approved
-- For each unique GDD referenced across all stories: read the
- **Acceptance Criteria**, **Formulas**, and **Edge Cases** sections. Do not load
- the full GDD text. These three sections contain the testable requirements, the math
- to verify, and the boundary conditions that tests must cover. If an Edge Cases
- section is absent from the GDD, note it per GDD: "No Edge Cases section found — edge
- case coverage will be inferred from acceptance criteria only."
+- For each unique GDD referenced across all stories: mine test material per that
+ system's workflow tier (resolved above) — at `full`, mine all 8 sections; at
+ `standard`, mine the test-relevant subset of the required sections
+ (**Acceptance Criteria** and **Edge Cases** always, plus **Formulas** for any
+ system that defines numeric rules); at `minimal`, **Acceptance
+ Criteria only**. Do not load the full GDD
+ text. These sections contain the testable requirements, the math to verify, and
+ the boundary conditions tests must cover. If an Edge Cases section is absent (or
+ not expected at minimal), note per GDD: "No Edge Cases section found — edge case
+ coverage will be inferred from acceptance criteria only."
- `docs/architecture/control-manifest.md` — scan for forbidden patterns that
automated tests should guard against (if the file exists)
@@ -118,7 +178,7 @@ Assemble the full QA plan document. Use this structure:
**Date**: [date]
**Generated by**: /qa-plan
**Scope**: [N stories across [N systems]]
-**Engine**: [engine name from .claude/docs/technical-preferences.md, or "Not configured"]
+**Engine**: [engine name — `engine.name` from project.yaml if present and non-empty, else the Engine field from .claude/docs/technical-preferences.md, else "Not configured"]
**Sprint File**: [path to sprint plan if applicable]
---
@@ -137,6 +197,10 @@ Assemble the full QA plan document. Use this structure:
## Automated Tests Required
+*(At `qa.level: minimal`, omit this entire section and blank the Test Summary's
+"Automated Test Required" column — automated tests are not required there; list
+manual/smoke verification only.)*
+
### [Story Title] — [Type]
**Test file path**: `tests/[unit|integration]/[system]/[story-slug]_test.[ext]`
**What to test**:
@@ -210,13 +274,15 @@ this sprint.*
## Definition of Done — This Sprint
-A story is DONE when ALL of the following are true:
+A story is DONE when ALL of the following are true (at `qa.level: minimal`, drop
+the test-file / evidence-document / smoke rows below — only acceptance-criteria
+verification is required):
- [ ] All acceptance criteria verified — via automated test result OR documented
manual evidence (screenshot, video, or playtest notes with sign-off)
-- [ ] Test file exists at the specified path for all Logic and Integration stories
-- [ ] Manual evidence document exists for all Visual/Feel and UI stories
-- [ ] Smoke check passes (run `/smoke-check sprint` before QA hand-off)
+- [ ] Test file exists at the specified path for all Logic and Integration stories *(qa.level standard/full)*
+- [ ] Manual evidence document exists for all Visual/Feel and UI stories *(qa.level standard/full)*
+- [ ] Smoke check passes (run `/smoke-check sprint` before QA hand-off) *(qa.level standard/full)*
- [ ] No regressions introduced
- [ ] Code reviewed (via `/code-review` or documented peer review)
- [ ] Story file updated to `Status: Complete` (via `/story-done`)
@@ -265,6 +331,10 @@ Silently append to `production/session-state/active.md` (create the file if it d
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
- **Never write the plan without asking** — Phase 5 requires explicit approval.
- **Classify conservatively**: when a story is ambiguous between Logic and
Integration, classify it as Integration — it requires both unit and
diff --git a/.claude/skills/quick-design/SKILL.md b/.claude/skills/quick-design/SKILL.md
index bdb33923..d5f3dcbb 100644
--- a/.claude/skills/quick-design/SKILL.md
+++ b/.claude/skills/quick-design/SKILL.md
@@ -1,12 +1,16 @@
---
name: quick-design
-description: "Lightweight design spec for small changes — tuning adjustments, minor mechanics, balance tweaks. Skips full GDD authoring when a system GDD already exists or the change is too small to warrant one. Produces a Quick Design Spec that embeds directly into story files."
+description: "Lightweight spec for small changes — tuning adjustments, minor mechanics. Embeds directly into stories; skips full GDD."
argument-hint: "[brief description of the change]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+
+
# Quick Design
This is the **lightweight design path** for changes that don't need a full GDD.
@@ -22,6 +26,10 @@ meaningful to implement without a written rationale.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
## 1. Classify the Change
First, read the argument and determine which category this change falls into:
diff --git a/.claude/skills/regression-suite/SKILL.md b/.claude/skills/regression-suite/SKILL.md
index e0f7655b..6905b868 100644
--- a/.claude/skills/regression-suite/SKILL.md
+++ b/.claude/skills/regression-suite/SKILL.md
@@ -1,12 +1,18 @@
---
name: regression-suite
-description: "Map test coverage to GDD critical paths, identify fixed bugs without regression tests, flag coverage drift from new features, and maintain tests/regression-suite.md. Run after implementing a bug fix or before a release gate."
+description: "Map test coverage to GDD critical paths, find fixed bugs lacking regression tests, flag drift from new features."
argument-hint: "[update | audit | report]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,workflow,qa.level,system_overrides`
+
+Resolved above — use as-is. No block → defaults in
+`.claude/docs/config-resolution.md`.
+
+
# Regression Suite
This skill ensures that every bug fix is backed by a test that would have
@@ -27,8 +33,30 @@ and known failure points. This skill maintains that list.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**Workflow tier**: `modes.workflow` as resolved above — supplied by `modes.rigor`
+unless set explicitly — per `.claude/docs/workflow-modes.md`; in `audit` mode consider
+`workflow_overrides.system_overrides.<system>` per system as each GDD is read. It
+sets whether GDD critical paths are mapped or coverage is smoke-only — see Step 2c.
+
+**`qa.level`**: controls whether the suite is generated at
+all. At `minimal`, the regression suite is **not generated** (report that and
+stop); at `standard`, generate it at Polish-stage entry; at `full`, at
+Production-stage entry. Distinct axis from `workflow`.
+
## 1. Parse Arguments
+**Early `qa.level` guard (resolved above):** if `qa.level: minimal`, the
+regression suite is **not generated** — report "Regression suite not generated at
+qa.level minimal" and **STOP here, before any scan**, in every mode
+(`update` / `audit` / `report`). This is the `qa.level` axis; it is distinct from
+the `workflow`-tier `minimal` branch in Step 2c (which only changes the
+critical-path *source*, not *whether* the suite runs). Do not enter Step 2c's
+`minimal` branch on account of `qa.level`.
+
**Modes:**
- `/regression-suite update` — scan new bug fixes this sprint and check
for regression test presence; add new tests to the suite manifest
@@ -70,8 +98,21 @@ Do not read test file contents unless needed for name-to-test mapping.
### Step 2c — Load GDD critical paths
-For `audit` mode: read `design/gdd/systems-index.md` to get all systems.
-For each MVP-tier system, read its GDD and extract:
+For `audit` mode: read `design/gdd/systems-index.md` to get all systems, then
+scope the scan by each system's workflow tier (resolved above):
+- **`full`** — read the GDD and map critical paths from all sections.
+- **`standard`** — same, from the required sections (Acceptance Criteria, Edge
+ Cases, and Formulas where the system defines numeric rules).
+ A system pinned higher via `system_overrides` is mapped at its higher tier.
+- **`minimal`** — **skip the GDD critical-path scan**. Instead read the latest
+ smoke-check report in `production/qa/smoke-*.md` and take the critical paths it
+ exercises as the regression scope (Step 3 maps coverage against those, not GDD
+ acceptance criteria). If no smoke report exists, report that and stop — there is
+ no critical-path source at minimal without one.
+
+(Tier affects `audit` mode only; `update` and `report` modes are tier-independent.)
+
+For each in-scope MVP-tier system's GDD, extract:
- Acceptance Criteria (these define the critical paths)
- Formulas section (formulas must have regression tests)
- Edge Cases section (known edge cases should have regression tests)
@@ -90,7 +131,9 @@ or `Status: Fixed` field. Note:
## 3. Map Coverage — Critical Paths
-For `audit` mode only:
+For `audit` mode only. (At `minimal` the critical paths come from the smoke-check
+report identified in Step 2c, not from GDD acceptance criteria — map coverage
+against those smoke paths and skip the GDD-criterion loop below.)
For each GDD acceptance criterion, determine whether a test exists:
@@ -179,6 +222,24 @@ Check for drift indicators:
### Suite manifest format (`tests/regression-suite.md`)
+> **Before computing coverage, check the denominator.** If the GDD
+> glob returns **zero critical paths**, or the test globs return **zero test
+> files**, do not emit a percentage — report
+> `Coverage: NOT ASSESSED — [no GDDs found | no test files found]` and name which
+> side was empty and the skill that produces it (`/map-systems` and
+> `/design-system` for GDDs, `/test-setup` for the test scaffold).
+>
+> A percentage computed from an empty denominator is not a low score; it is not a
+> number. `0%` reads as "measured and terrible" and `100%` as "measured and
+> perfect" — both are claims about a comparison that never happened. This is the
+> same defect `/scope-check` carries a Phase 4 guard against, in the same words:
+> *"a percentage computed from no baseline items is not a small number; it is not
+> a number."*
+>
+> **A hand-written list of skills required to carry `NOT ASSESSED` pins what was
+> known when it was written**, so a skill added later inherits no obligation and
+> nothing notices. Derive that set rather than enumerating it.
+
The manifest is a curated index — not the tests themselves, but a registry
of which tests should always pass before a release:
@@ -245,6 +306,10 @@ Verdict: **COMPLETE** — regression suite updated. (If user declined write: Ver
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
- **Never remove existing regression tests from the manifest** without
explicit user approval — removing a test that was deliberately written is a
regression risk itself
diff --git a/.claude/skills/release-checklist/SKILL.md b/.claude/skills/release-checklist/SKILL.md
index 57d2eff0..bc8f3c8b 100644
--- a/.claude/skills/release-checklist/SKILL.md
+++ b/.claude/skills/release-checklist/SKILL.md
@@ -1,11 +1,60 @@
---
name: release-checklist
-description: "Generates a comprehensive pre-release validation checklist covering build verification, certification requirements, store metadata, and launch readiness."
+description: "Pre-release checklist — build verification, certification requirements, store metadata, launch readiness."
argument-hint: "[platform: pc|console|mobile|all]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys rigor,project.stage,cert_tier,automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+Resolved above — use as-is. No block → defaults in `.claude/docs/config-resolution.md`.
+
+**Scope this checklist to the project.** Emitting every item for every platform
+trains the reader to skip the list, which defeats the gate:
+
+- **`project.stage`** — items for phases this project has not reached are out of
+ scope; say so rather than listing them unchecked.
+- **`modes.rigor`** — at `minimal`, drop items whose only justification is process
+ weight this project has opted out of.
+- **`platform.cert_tier`** — emit certification items **only** for the tier the
+ project targets. If it is **unset**, **ask which platforms are in scope**
+ rather than emitting all of them — an unset value is a question, not a licence
+ to emit every certification track. If it cannot be determined, mark the section
+ **`NOT ASSESSED — cert tier unknown`**. **Unset is not `none`:** `none` is a
+ decision, unset is a missing one, and they must not produce the same output.
+ Branch on the **four values this key takes** — `none | itch | steam | console` —
+ and not on platform names; `.claude/docs/effects-map.md` holds the full
+ requirement table and is the source, so read it rather than restating it.
+ - `none` — **emit no certification section at all.** Internal release, alpha or
+ jam game. Say the section was omitted and why; do not leave it blank.
+ - `itch` — itch.io upload requirements only: build size, page setup, age tags.
+ **No console and no Steamworks items.**
+ - `steam` — Steamworks: store page, depot build, achievements, system
+ requirements, common content rules. **No console certification items.**
+ - `console` — full platform certification (TRC / XR / Lotcheck), save-data
+ rules, controller-mapping rules, age-rating boards. The heaviest tier.
+
+ > **Branch on the `cert_tier` values above, not on platform names.** "Emit
+ > console/mobile certification items only for the platforms the project targets"
+ > is the wrong test: it treats an `itch` project and a `steam` project
+ > identically, conflates `none` with unset, and keys on `mobile`, which is not a
+ > `cert_tier` value at all. Use the vocabulary the config defines.
+
+If an item cannot be scoped because the config is absent, mark it
+**`NOT ASSESSED — platform/stage unknown`**. Do not silently include it: a
+`rigor: standard`, single-platform project would otherwise receive a ~150-item
+checklist demanding PC **and** console **and** mobile certification plus age
+ratings, of which ~140 are unassessable.
+
+---
+
> **Explicit invocation only**: This skill should only run when the user explicitly requests it with `/release-checklist`. Do not auto-invoke based on context matching.
@@ -13,6 +62,16 @@ model: sonnet
Read the argument for the target platform (`pc`, `console`, `mobile`, or `all`). If no platform is specified, default to `all`.
+**The argument selects DEVICE requirements. It never selects the certification
+track.** Certification is decided by `platform.cert_tier`, resolved in the resolved-config block at the top of this skill —
+see the `platform.cert_tier` rule above. The two axes are different lists that
+happen to share one word: `pc`/`console`/`mobile` are hardware shapes, while
+`none|itch|steam|console` are certification regimes. They agree on `console` and
+nowhere else — `itch` and `none` have no device block at all, and `mobile` is not
+a `cert_tier` value. So emitting a device block says nothing about which
+certification block to emit, and `all` is **not** a licence to emit every
+certification track.
+
---
## Phase 2: Load Project Context
@@ -24,6 +83,17 @@ Read the argument for the target platform (`pc`, `console`, `mobile`, or `all`).
## Phase 3: Scan Codebase
+> **State the denominator with every count.** These scans look for something bad,
+> so `0` means either "searched and found none" or "there was nothing to search",
+> and on a release gate those are opposite findings. Report
+> `scanned [N] source files: [M] TODO, [M] FIXME, [M] HACK` — or, when `src/` is
+> absent or holds no source files,
+> **`NOT ASSESSED — no source files found to scan`**. A bare `0` is not a result.
+>
+> `/launch-checklist` scans the same way and is most often run beside this one.
+> Keep the two consistent: changing the rule in one and not the other leaves a
+> route to the same misleading `0`.
+
Scan for outstanding issues:
- Count `TODO` comments
@@ -32,6 +102,9 @@ Scan for outstanding issues:
- Note their locations and severity
Check for test results in any test output directories or CI logs if available.
+**If none are found, say so** — `Test results: NOT ASSESSED — no test output or
+CI logs found` — rather than omitting the line. An absent test result and a
+passing one must not produce the same release checklist.
---
@@ -75,7 +148,10 @@ Generated: [Date]
- [ ] Credits complete and accurate
```
-Add platform-specific sections based on the argument:
+Add **device** sections based on the argument. These carry no certification or
+storefront-SDK items — those are gated on `platform.cert_tier` in the next
+subsection, and duplicating them here is what let an `itch` project receive
+Steamworks rows.
**For `pc`:**
```markdown
@@ -86,24 +162,16 @@ Add platform-specific sections based on the argument:
- [ ] Resolution scaling tested (1080p, 1440p, 4K, ultrawide)
- [ ] Windowed, borderless, and fullscreen modes working
- [ ] Graphics settings save and load correctly
-- [ ] Steam/Epic/GOG SDK integrated and tested
-- [ ] Achievements functional
-- [ ] Cloud saves functional
-- [ ] Steam Deck compatibility verified (if targeting)
```
**For `console`:**
```markdown
### Platform Requirements: Console
-- [ ] TRC/TCR/Lotcheck requirements checklist complete
- [ ] Platform-specific controller prompts display correctly
- [ ] Suspend/resume works correctly
- [ ] User switching handled properly
- [ ] Network connectivity loss handled gracefully
- [ ] Storage full scenario handled
-- [ ] Parental controls respected
-- [ ] Platform-specific achievement/trophy integration tested
-- [ ] First-party certification submission prepared
```
**For `mobile`:**
@@ -121,6 +189,71 @@ Add platform-specific sections based on the argument:
- [ ] App size within store limits
```
+> **Mobile storefront rows stay here on purpose.** `platform.cert_tier` models
+> `none|itch|steam|console` and has no mobile regime, so App Store / Play Store
+> compliance cannot be gated on it. Leaving these in the device block is a
+> deliberate choice, not an oversight — do not "fix" it by inventing a `mobile`
+> tier, which is the exact wrong vocabulary the `cert_tier` rule warns against.
+
+**Certification — emit ONLY the block matching `platform.cert_tier`** (resolved in
+the resolved-config block at the top of this skill). Do not emit this subsection's other blocks, and do not fall back to
+emitting all of them because the platform argument was `all`.
+
+**At `none`** — emit no certification block at all. Emit exactly this one line in
+its place, so the omission is visible rather than looking like a missing section:
+```markdown
+Certification: omitted — cert_tier is 'none' (internal build, alpha or jam release).
+```
+
+**At `itch`:**
+```markdown
+### Certification: itch.io
+- [ ] Build size within itch.io upload limits
+- [ ] itch.io page complete (cover art, screenshots, description)
+- [ ] Age/content tags set honestly
+- [ ] Downloadable vs browser build decided and tested
+- [ ] Butler channel names correct for each platform uploaded
+```
+
+**At `steam`:**
+```markdown
+### Certification: Steamworks
+- [ ] Steamworks SDK integrated and tested
+- [ ] Depot build uploaded and installs cleanly from a fresh account
+- [ ] Achievements functional
+- [ ] Cloud saves functional
+- [ ] Steam Deck compatibility verified (if targeting)
+- [ ] Steam common content rules reviewed
+```
+
+**At `console`:**
+```markdown
+### Certification: Console
+- [ ] TRC/TCR/Lotcheck requirements checklist complete
+- [ ] First-party certification submission prepared
+- [ ] Platform-specific achievement/trophy integration tested
+- [ ] Parental controls respected
+- [ ] Save-data rules compliant (corruption, full storage, user switching)
+- [ ] Age ratings obtained (ESRB, PEGI, regional)
+```
+
+If `cert_tier` is **unset**, ask which platforms are in scope rather than
+emitting every track; if it cannot be determined, emit
+`### Certification: NOT ASSESSED — cert tier unknown` and say why. **Unset is not
+`none`** — `none` is a decision and unset is a missing one.
+
+> **Certification rows belong here, in one `cert_tier`-gated subsection.** Do not
+> spread them back through the PC, Console and Mobile device blocks: those are
+> selected by the command argument and default to `all`, so an `itch` project
+> running `/release-checklist` with no argument would be handed the Steamworks SDK
+> rows *and* the Lotcheck rows — exactly what the `cert_tier` rule at the top of
+> this skill forbids.
+>
+> **`console` means two different things in this file.** It is a device-block
+> argument value *and* a `cert_tier` value, colliding on one word out of four. A
+> `**For \`console\`:**` heading is argument-gating, not tier-gating — do not read
+> it as evidence that certification is already scoped by tier.
+
**Store and launch sections (all platforms):**
```markdown
### Store / Distribution
diff --git a/.claude/skills/retrospective/SKILL.md b/.claude/skills/retrospective/SKILL.md
index c2a8d1e2..9ec5bafa 100644
--- a/.claude/skills/retrospective/SKILL.md
+++ b/.claude/skills/retrospective/SKILL.md
@@ -1,12 +1,50 @@
---
name: retrospective
-description: "Generates a sprint or milestone retrospective by analyzing completed work, velocity, blockers, and patterns. Produces actionable insights for the next iteration."
+description: "Sprint or milestone retrospective from completed work, velocity, blockers. Actionable insights for the next iteration."
argument-hint: "[sprint-N|milestone-name]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Bash, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+## Insufficient input — check this before producing any report
+
+**If the inputs this skill needs do not exist, the answer is "could not run" —
+not a filled-in report.** Check first, and stop if the check fails.
+
+1. List the inputs this skill reads (data files, prior reports, profiler output,
+ test results, registries, source code).
+2. For each, record `FOUND` or `ABSENT` — not "assumed present".
+3. If any input required for a section is ABSENT, that section is
+ **`NOT ASSESSED — NO DATA`**. Do not estimate it, do not infer it from an
+ adjacent artifact, and do not leave a mandated cell to be filled by whoever
+ reads the template next.
+4. If **every** required input is ABSENT, stop and report
+ **`NOT ASSESSED — NO DATA`** as the whole verdict, naming what was missing and
+ which skill produces it.
+
+**A verdict of `NOT ASSESSED` is a success.** It is the correct, useful answer to
+"what does the data say?" when there is no data. The failure mode this prevents is
+specific and has been observed in practice: report templates whose verdict
+enum had no "could not run" state produced **false clean passes** — an asset audit
+returning COMPLIANT on a project with no assets and no standards, and a
+performance profile reporting ">99% headroom against a 16.67ms budget" with zero
+profiler data and no budget ever set.
+
+**Absence of evidence is never evidence of absence.** A scan that finds no
+matches because there are no files to scan has not verified anything. Say which of
+the two happened — a reader cannot tell from a green result.
+
+---
+
## Phase 1: Parse Arguments
Determine whether this is a sprint retrospective (`sprint-N`) or a milestone retrospective (`milestone-name`).
diff --git a/.claude/skills/reverse-document/SKILL.md b/.claude/skills/reverse-document/SKILL.md
index 04d4f319..3500df5a 100644
--- a/.claude/skills/reverse-document/SKILL.md
+++ b/.claude/skills/reverse-document/SKILL.md
@@ -1,6 +1,6 @@
---
name: reverse-document
-description: "Generate design or architecture documents from existing implementation. Works backwards from code/prototypes to create missing planning docs."
+description: "Generate missing design or architecture docs from existing implementation — works backwards from code and prototypes."
argument-hint: "<type> <path> (e.g., 'design src/gameplay/combat' or 'architecture src/core')"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Edit, Bash
@@ -35,6 +35,30 @@ appropriate design or architecture documentation. Use this when:
- `src/core/event-system.cpp` → Specific file
- `prototypes/stealth-mech/` → Prototype directory
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys workflow,system_overrides,automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+Resolved above — use as-is. No block → defaults in
+`.claude/docs/config-resolution.md`.
+
+**Resolve the workflow tier** for the target system: map `<path>` to a system
+name, then use the `system_overrides` row for that system if the block above
+lists one, else the project `workflow` value. It sets how much document is
+generated — see Phase 5. Semantics of each tier are in
+`.claude/docs/workflow-modes.md`.
+
+> **Resolve the tier — do not assume it.** "Resolve the tier per
+> `workflow-modes.md`" with no bootstrap names a resolution it gives no way to
+> perform: that document defines what each tier *means*, but it cannot say what
+> *this project* is set to. The consequence is large here — at `full` this skill
+> writes an 8-section GDD and at `minimal` a one-page brief, so a wrong tier
+> produces the wrong artifact entirely.
+
**Examples**:
```bash
/reverse-document design src/gameplay/magic-system
@@ -90,6 +114,35 @@ appropriate design or architecture documentation. Use this when:
- "The prototype emphasizes stealth over combat. Is that the intended pillar?"
- "Players seem to exploit the grappling hook for speed. Feature or bug?"
+## Phase 3b: Sufficiency Check — is there enough here to document?
+
+**Run this before Phase 4, and stop here if it fails.** This skill infers a
+design from an implementation, so when the implementation is thin there is
+nothing to infer *from* — and the template below will happily accept invented
+content, because every section of it is mandatory.
+
+Count what Phase 2 actually found:
+
+| Signal | What counts |
+|---|---|
+| Mechanics | A named behaviour with observable rules — not a stub, not an empty class |
+| Formulas | An expression computing a gameplay value from inputs |
+| Values | A tuning constant with a use site |
+
+**If all three counts are zero, or the target path holds fewer than ~20 lines of
+non-boilerplate code, stop and say so:**
+
+> "`[path]` does not contain enough implementation to reverse-document.
+> Found: [N] mechanics, [N] formulas, [N] tuning values.
+> Reverse-documentation infers design from behaviour; with no behaviour to read,
+> anything I produce would be invention wearing the format of a design document.
+> If the design exists only in your head, `/design-system [name]` is the skill
+> that captures it — it asks rather than infers."
+
+**Do not proceed on a partial count by filling the rest.** A path with two
+mechanics and no formulas gets a document with two mechanics and an explicit
+`FORMULAS DISCOVERED: none found in the source` — see Phase 4.
+
## Phase 4: Present Findings
Before drafting, show what you discovered:
@@ -115,8 +168,28 @@ UNCLEAR INTENT AREAS:
Before I draft the design doc, could you clarify these points?
```
+> **Every section above may be empty, and an empty one must say so.** Write
+> `none found in the source` under the heading — never omit the heading (which
+> reads as "not looked for") and never populate it from what a system like this
+> usually has. The bracketed rows are *shapes*, not quotas: a source with one
+> mechanic yields one row, not four.
+>
+> This matters more here than in a report, because the output of this skill is not
+> a report — it is a **design document**, and `/design-review`, `/create-epics` and
+> `/create-stories` will read it as a statement of authored intent. A fabricated
+> formula in a GDD does not stay a documentation error; it becomes a requirement,
+> and then a story, and then code written to satisfy it.
+
Wait for user to clarify intent before drafting.
+**If the user does not answer the `UNCLEAR INTENT AREAS` questions, do not draft
+the resolved version anyway.** Those questions exist because **code cannot tell
+you why** — it records what was built, never what was intended, and the gap
+between them is the entire content of a design document. Unanswered items are
+carried into the draft verbatim as open questions, in the document, marked
+`INTENT UNKNOWN — inferred from implementation, not confirmed`. An inferred
+intent presented as a settled one is the failure mode of this whole skill.
+
## Phase 5: Draft Document Using Template
Based on type, use appropriate template:
@@ -127,12 +200,51 @@ Based on type, use appropriate template:
| `architecture` | `templates/architecture-doc-from-code.md` | `docs/architecture/[decision-name].md` |
| `concept` | `templates/concept-doc-from-prototype.md` | `prototypes/[name]/CONCEPT.md` or `design/concepts/[name].md` |
+**The `design` output scales with the workflow tier** (resolved in Phase 1):
+- **`full`** — generate a full 8-section GDD.
+- **`standard`** — generate a 5-section GDD (Overview, Detailed Design, Edge Cases,
+ Dependencies, Acceptance Criteria; + Formulas when the recovered system defines
+ numeric rules). Skip Player Fantasy and Tuning Knobs.
+- **`minimal`** — generate a **game brief** in the one-page format
+ (`.claude/docs/templates/game-brief.md`), not a GDD. For the whole game write
+ `design/game-brief.md`; for a single reverse-engineered system write
+ `design/[system-name]-brief.md`.
+
+(`architecture` and `concept` outputs are tier-independent.)
+
**Draft structure**:
- Capture **what exists** (mechanics, patterns, implementation)
- Document **why it exists** (intent clarified with user)
- Identify **what's missing** (edge cases not handled, gaps in design)
- Flag **follow-up work** (balance tuning, missing features)
+### Stamp the provenance — required, at the top of every document this skill writes
+
+A document produced here lands at the same path, in the same format, as one a
+designer wrote by hand, and **every downstream consumer treats the two
+identically**. `/design-review` checks it for completeness, `/create-epics`
+derives epics from it, `/create-stories` turns its lines into acceptance
+criteria. Nothing anywhere asks where it came from.
+
+The difference is not cosmetic: an authored GDD states **intent**, and this one
+states **observed behaviour plus inference**. When they disagree, the code is
+what needs changing in the first case and the document in the second — and a
+reader cannot tell which they are holding unless the document says.
+
+Emit this immediately under the title:
+
+```markdown
+> **Reverse-documented from implementation** — generated by `/reverse-document`
+> from `[path]` on `[date]`, at commit `[short-sha]`.
+> This records what the code **does**; intent marked `INTENT UNKNOWN` below was
+> inferred, not confirmed by the author. Where this document and the code
+> disagree, do not assume the document is the requirement.
+```
+
+Keep the banner on revision. If a human later confirms the intent and adopts the
+document as authored design, removing it is their explicit act — not a
+side effect of the next edit.
+
## Phase 6: Show Draft and Request Approval
**Collaborative protocol**:
@@ -150,10 +262,22 @@ SECTIONS MARKED AS INCOMPLETE:
- "[System] interaction with [other-system]" (not fully implemented yet)
- "[Variant or feature]" (only [subset] implemented so far)
-May I write this to design/gdd/[system-name].md?
+May I write this to [output path]?
```
-Wait for approval. User may request changes before writing.
+Use the tier-correct output path in the prompt: `design/gdd/[system-name].md` for
+a `full`/`standard` GDD, or `design/[system-name]-brief.md` for a `minimal` brief.
+
+**At `collaborative`** — wait for approval; the user may request changes before
+writing. **At `guided`** — this is a *new* file, so `automation-modes.md:81`
+still has it asked ("May I write?" is asked for new files only); if the target
+already exists, present the diff and proceed without waiting for an explicit
+"yes". **At `autonomous`** — write and log the decision.
+
+> **Keep this line scoped to its mode.** The skill header defers every file
+> write to `automation-modes.md`, so an unconditional "wait for approval" here
+> collides with it at both `guided` and `autonomous`. Same class as
+> `/map-systems` Step 5b.
## Phase 7: Write Document with Metadata
@@ -200,11 +324,11 @@ Would you like me to tackle any of these now?
| If analyzing... | Use template... | Because... |
|----------------|-----------------|------------|
-| `src/gameplay/*` | design-doc-from-implementation.md | Gameplay mechanics → GDD |
-| `src/core/*`, `src/ai/*` | architecture-doc-from-code.md | Core systems → ADR |
+| `<code root>/gameplay/*` | design-doc-from-implementation.md | Gameplay mechanics → GDD |
+| `<code root>/core/*`, `<code root>/ai/*` | architecture-doc-from-code.md | Core systems → ADR |
| `prototypes/*` | concept-doc-from-prototype.md | Experiments → concept doc |
-| `src/networking/*` | architecture-doc-from-code.md | Technical systems → ADR |
-| `src/ui/*` | design-doc-from-implementation.md | UI/UX → design spec |
+| `<code root>/networking/*` | architecture-doc-from-code.md | Technical systems → ADR |
+| `<code root>/ui/*` | design-doc-from-implementation.md | UI/UX → design spec |
---
diff --git a/.claude/skills/review-all-gdds/SKILL.md b/.claude/skills/review-all-gdds/SKILL.md
index 67b604f3..8e213a41 100644
--- a/.claude/skills/review-all-gdds/SKILL.md
+++ b/.claude/skills/review-all-gdds/SKILL.md
@@ -1,12 +1,16 @@
---
name: review-all-gdds
-description: "Holistic cross-GDD consistency and game design review. Reads all system GDDs simultaneously and checks for contradictions between them, stale references, ownership conflicts, formula incompatibilities, and game design theory violations (dominant strategies, economic imbalance, cognitive overload, pillar drift). Run after all MVP GDDs are written, before architecture begins."
+description: "Holistic cross-GDD review — contradictions between systems, dominant strategies, economic imbalance, cognitive overload, pillar drift."
argument-hint: "[focus: full | consistency | design-theory | since-last-review]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Bash, AskUserQuestion, Task
+allowed-tools: Read, Glob, Grep, Write, Bash, AskUserQuestion, Agent
model: opus
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,workflow,system_overrides`
+
+
+
# Review All GDDs
This skill reads every system GDD simultaneously and performs two complementary
@@ -27,6 +31,10 @@ completeness. This skill reviews the *relationships* between all GDDs.
- Before `/create-architecture` begins (architecture built on inconsistent GDDs
inherits those inconsistencies)
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
**Argument modes:**
**Focus:** `$ARGUMENTS[0]` (blank = `full`)
@@ -38,6 +46,13 @@ completeness. This skill reviews the *relationships* between all GDDs.
---
+**`workflow`** per GDD (per `.claude/docs/workflow-modes.md`): each GDD validates
+against its effective tier — the project value, overridden per system by the
+`system_overrides` row for that system when the block lists one. At `full`, validate all 8
+sections across all GDDs. At `standard`, validate the 5 required sections;
+optional sections (Player Fantasy, Tuning Knobs, conditional Formulas) are
+surfaced as advisory only. At `minimal`, this skill is not applicable (no GDDs).
+
## Phase 1: Load Everything
### Phase 1a — L0: Summary Scan (fast, low tokens)
@@ -49,6 +64,14 @@ from all GDD files:
Grep pattern="## Summary" glob="design/gdd/*.md" output_mode="content" -A 5
```
+**Fail open on a missing Summary.** Establish the denominator: glob
+`design/gdd/*.md` and count **N**. A scan matching fewer than N means those GDDs
+predate `## Summary` — never treat an absent Summary as a system out of scope.
+A zero-match scan means "no GDD carries a Summary yet", not "nothing to review".
+This review is holistic and loads its in-scope GDDs regardless (see Phase 1c);
+the Summary scan only builds the manifest and narrows `since-last-review`, it
+never shrinks the review set.
+
Display a manifest to the user:
```
Found [N] GDDs. Summaries:
@@ -57,10 +80,22 @@ Found [N] GDDs. Summaries:
...
```
-For `since-last-review` mode: run `git log --name-only` to identify GDDs
-modified since the last review report file was written. Show the user which
-GDDs are in scope based on summaries before doing any full reads. Only
-proceed to L1 for those GDDs plus any GDDs listed in their "Key deps".
+For `since-last-review` mode, compute the scope deterministically instead of
+reasoning through git history:
+
+```
+Bash: bash .claude/scripts/review-scope.sh
+```
+
+It prints `PRIOR_REVIEW:`, a `CHANGED:` list, and a `DEPS ...:` list of each
+changed GDD's declared dependencies. Use those lists as the scope — the
+dependency lines are already the "Key deps" expansion, so no second pass is
+needed. If `PRIOR_REVIEW: NONE`, a full review is required; fall back to `full`
+mode.
+
+Show the user which GDDs are in scope based on summaries before doing any full
+reads. Only proceed to L1 for the `CHANGED` set plus the GDDs named on the
+`DEPS` lines.
### Phase 1b — Registry Pre-Load (fast baseline)
@@ -80,15 +115,38 @@ If the registry is empty or absent: proceed without it. Note in the report:
"Entity registry is empty — consistency checks rely on full GDD reads only.
Run `/consistency-check` after this review to populate the registry."
-### Phase 1c — L1/L2: Full Document Load
+### Phase 1c — L1/L2: Section Load
-Full-read the in-scope documents:
+Read whole (small, and every part is used):
1. `design/gdd/game-concept.md` — game vision, core loop, MVP definition
2. `design/gdd/game-pillars.md` if it exists — design pillars and anti-pillars
3. `design/gdd/systems-index.md` — authoritative system list, layers, dependencies, status
-4. **Every in-scope system GDD in `design/gdd/`** — read completely (skip
- game-concept.md and systems-index.md — those are read above)
+
+Then, for **every in-scope system GDD**, load the sections this review actually
+consumes — **not the whole file**:
+
+```
+Grep pattern="^## (Dependencies|Detailed Rules|Detailed Design|Formulas|Tuning Knobs|Acceptance Criteria|Player Fantasy)" glob="design/gdd/*.md" output_mode="content" -A 40
+```
+
+That list is not a guess — it is exactly the union the Parallel Execution
+contract below already enumerates: Phase 2 needs Dependencies, Detailed
+Design/Rules, Formulas, Tuning Knobs and Acceptance Criteria; Phase 3 needs
+Player Fantasy and progression/reward structure. Overview is narrative restated
+by the Summary this skill already scanned in Phase 1a, and Edge Cases feeds no
+checklist item here (`/design-review` owns per-GDD completeness). Loading them
+put content in three context windows — this one and both sub-agents' — that no
+checklist item ever read.
+
+Accept **either** `## Detailed Rules` or `## Detailed Design`; the design standard
+and the GDD template disagree on the name and they denote the same section.
+
+**Escalate to a full read of one GDD** when a scanned section cross-references
+material outside itself, or when a GDD matched **zero** sections — that GDD
+predates the template, and a zero-match there means "unstructured", not "empty".
+Never let a zero-match silently drop a system: the scan narrows the *read*, it
+never shrinks the *review set*.
Report: "Loaded [N] system GDDs covering [M] systems. Pillars: [list]. Anti-pillars: [list]."
@@ -101,17 +159,26 @@ If fewer than 2 system GDDs exist, stop:
### Parallel Execution
Phase 2 (Consistency) and Phase 3 (Design Theory) are independent — they read
-the same GDD inputs but produce separate reports. Spawn both as parallel Task
+the same GDD inputs but produce separate reports. Spawn both as parallel `Agent`
agents simultaneously rather than waiting for Phase 2 to complete before
starting Phase 3. Collect both results before writing the combined report.
-**When spawning parallel Task agents for Phase 2 and Phase 3, always pass:**
-- The complete list of GDD file paths loaded in Phase 1 (explicit paths, not just counts)
+Spawn both as `game-designer` sub-agents (`subagent_type: game-designer`) — GDD
+consistency and design-theory review is its domain.
+
+**When spawning the Phase 2 and Phase 3 agents, always pass:**
+- The loaded GDD **content** each phase needs — **not file paths**. Paste the
+ sections; the sub-agent has its own context and cannot re-read Phase 1's
+ results, so a path forces a full re-read (and contradicts the "do not re-read"
+ rule below). Pass only the phase's slice: Phase 2 (consistency) needs each GDD's
+ Dependencies, Detailed Design/Rules, Formulas, Tuning Knobs and Acceptance
+ Criteria; Phase 3 (design theory) needs Player Fantasy, progression/reward
+ structure and the game pillars.
- The full TR registry contents if loaded in Phase 1b (paste the registry text, not just a file path)
- The specific checklist items assigned to that agent's phase (Phase 2 gets 2a–2f; Phase 3 gets 3a–3g)
-- The engine name and version from `.claude/docs/technical-preferences.md` and `docs/engine-reference/[engine]/VERSION.md`
+- The engine name and version — `engine.name` and `engine.version` from `project.yaml`, resolving each field independently (if its key is absent or empty, use `.claude/docs/technical-preferences.md`) — plus `docs/engine-reference/[engine]/VERSION.md`
-Do not rely on the subagent to re-read these files — it has its own context window and cannot access Phase 1 results unless they are explicitly passed in the Task prompt.
+Do not rely on the subagent to re-read these files — it has its own context window and cannot access Phase 1 results unless they are explicitly passed in the `Agent` prompt.
---
@@ -158,6 +225,21 @@ Categories to scan:
### 2c: Stale References
+**Start from the `## Cross-References` table where a GDD has one.** That table is
+the document's own declaration of what it depends on — `templates/game-design-document.md`
+tells authors it is machine-checked here, and `/design-system` requires it
+whenever Dependencies names another GDD. For each row, confirm the `Target GDD`
+exists and the `Specific Element Referenced` is still present in it under that
+name, with the declared `Nature` still accurate.
+
+A table that is absent, or still holding the template's bracketed examples, is
+itself reportable: say the GDD declares no cross-references and that the prose
+scan below was the only check applied. Do not treat an absent table as "no
+dependencies" — it far more often means the section was never authored.
+
+**Then scan the prose regardless**, table or no table: a declared table catches
+what the author remembered, and the scan below catches what they did not.
+
For every cross-document reference (GDD-A mentions a mechanic, value, or
system name from GDD-B), verify the referenced element still exists in GDD-B
with the same name and behaviour:
@@ -538,16 +620,42 @@ Scenarios walked: [N]
---
-### Verdict: [PASS / CONCERNS / FAIL]
+### Verdict: [PASS / NOT ASSESSED / CONCERNS / FAIL]
PASS: No blocking issues. Warnings present but don't prevent architecture.
+NOT ASSESSED: One or more review phases could not run — named below.
CONCERNS: Warnings present that should be resolved but are not blocking.
FAIL: One or more blocking issues must be resolved before architecture begins.
+### If NOT ASSESSED — what could not be reviewed, and why:
+[Name each phase that did not run and the input it needed]
+
### If FAIL — required actions before re-running:
[Specific list of what must change in which GDD]
```
+**`NOT ASSESSED` — a cross-review is only as wide as what it could read.** Rank:
+**above PASS**, **below CONCERNS and FAIL**. This skill's whole value is
+comparing systems *against each other*, so it is unusually easy for it to look
+thorough while covering a fraction of the surface. Emit it when any of:
+
+- **Fewer than two GDDs were readable.** Contradiction-hunting across one document
+ is not a cross-review; a clean result there means only that nothing was
+ compared. This is the single most important trigger in this skill.
+- **A whole review phase did not run** — consistency, design theory, economy,
+ pillar drift. A parallel phase that returned nothing has to be distinguished
+ from one that returned no findings; if a spawned agent produced no report, that
+ phase is NOT ASSESSED, not clean — an agent can return a fluent sentence,
+ write nothing, and consume a phase.
+- **The design pillars are undefined**, so pillar-drift has no reference to drift
+ from — the same shape as an accessibility gate with no committed tier.
+- **A GDD is present but empty** (headings only, or all placeholders). Present is
+ not the same as reviewable, and a stub contradicts nothing.
+
+Report the covered set explicitly either way: `GDDs reviewed: [N] of [M] present`.
+A cross-review that silently skipped half the systems is indistinguishable from
+one that found them consistent.
+
---
## Phase 6: Write Report and Flag GDDs
@@ -556,6 +664,16 @@ Use `AskUserQuestion` for write permission:
- Prompt: "May I write this review to `design/gdd/gdd-cross-review-[date].md`?"
- Options: `[A] Yes — write the report` / `[B] No — skip`
+> **`[date]` here means ISO 8601 — `YYYY-MM-DD`, e.g.
+> `gdd-cross-review-2026-08-19.md`. This is not a style preference.**
+> `.claude/scripts/review-scope.sh` picks the prior review with
+> `sort | tail -1`, so lexical order IS chronological order only for ISO dates.
+> Written as `aug-19-2026` or `19-08-2026`, the wrong file is chosen as the
+> baseline, the changed-set is computed from it, and GDDs modified since the
+> real last review silently escape the next one. That is the same
+> quiet-escape failure the three fixes documented at the top of that script
+> exist to prevent.
+
If any GDDs are flagged for revision, use a second `AskUserQuestion`:
- Prompt: "Should I update the systems index to mark these GDDs as needing revision? ([list of flagged GDDs])"
- Options: `[A] Yes — update systems index` / `[B] No — leave as-is`
@@ -569,8 +687,9 @@ After writing the report (and updating systems index if approved), silently
append to `production/session-state/active.md`:
## Session Extract — /review-all-gdds [date]
- - Verdict: [PASS / CONCERNS / FAIL]
- - GDDs reviewed: [N]
+ - Verdict: [PASS / NOT ASSESSED / CONCERNS / FAIL]
+ - GDDs reviewed: [N of M present]
+ - Phases not run: [names, or "None"]
- Flagged for revision: [comma-separated list, or "None"]
- Blocking issues: [N — brief one-line descriptions, or "None"]
- Recommended next: [the Phase 7 handoff action, condensed to one line]
@@ -606,26 +725,36 @@ Build the option list dynamically — only include options that apply:
Assign letters A, B, C… only to included options. Mark the most pipeline-advancing option as `(recommended)`.
-Never end the skill with plain text. Always close with this widget.
+In collaborative and guided modes, never end the skill with plain text — always
+close with this widget. In autonomous mode, print the verdict and recommended
+next step, then record via `log_decision` (no widget).
---
## Error Recovery Protocol
-If any spawned agent returns BLOCKED, errors, or fails to complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "fails to complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" before continuing
-2. **Assess dependencies**: If the blocked agent's output is required by a later phase, do not proceed past that phase without user input
-3. **Offer options** via AskUserQuestion with three choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope (fewer GDDs, single-system focus)
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed so work is not lost
+If any spawned agent returns BLOCKED, errors, or fails to complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report** (retry scope here = fewer GDDs / single-system). Full procedure:
+`.claude/docs/error-recovery-protocol.md`.
---
## Collaborative Protocol
+**In `collaborative` mode (the default).** For `guided` and `autonomous` modes,
+see `.claude/docs/automation-modes.md`. In `autonomous` mode the
+PASS/CONCERNS/FAIL verdict is still printed and logged — only the closing
+handoff widget is skipped.
+
1. **Read silently** — load all GDDs before presenting anything
2. **Show everything** — present the full consistency and design theory analysis
before asking for any action
diff --git a/.claude/skills/scope-check/SKILL.md b/.claude/skills/scope-check/SKILL.md
index ccffc910..25ffd688 100644
--- a/.claude/skills/scope-check/SKILL.md
+++ b/.claude/skills/scope-check/SKILL.md
@@ -1,6 +1,6 @@
---
name: scope-check
-description: "Analyze a feature or sprint for scope creep by comparing current scope against the original plan. Flags additions, quantifies bloat, and recommends cuts. Use when user says 'any scope creep', 'scope review', 'are we staying in scope'."
+description: "Scope creep check — current scope versus the original plan. Flags additions, quantifies bloat, recommends cuts. 'Any scope creep?'"
argument-hint: "[feature-name or sprint-N]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Bash
@@ -56,6 +56,13 @@ Generated: [Date]
### Current Scope
[List of items currently implemented or in progress]
+> **If Phase 4 will return NOT ASSESSED, do not render the numeric block below.**
+> Replace the counts and the Bloat Score with
+> `Baseline unusable — see verdict` and give the reason. A rendered
+> `Original items: 0 / Net scope change: 0%` one section above a NOT ASSESSED
+> verdict re-creates the exact "0% reads as on track" hazard Phase 4 exists to
+> kill, one phase earlier — and readers trust a number over a caveat.
+
### Scope Additions (not in original plan)
| Addition | Source | When | Justified? | Effort |
|----------|--------|------|------------|--------|
@@ -98,11 +105,30 @@ Assign a canonical verdict based on net scope change:
| 25–50% | **FAIL** | Significant Creep — must cut or formally extend timeline |
| >50% | **FAIL** | Out of Control — stop, re-plan, escalate to producer |
+**Before applying that table, check that the percentage means something.** Emit
+**NOT ASSESSED** instead — never a computed percentage — when any of:
+
+- The **baseline document exists but enumerates no scope items** (all headings,
+ placeholders, or `[TO BE CONFIGURED]`). Phase 1 stops when the file is *absent*;
+ this is the case where it is present and empty, and it is the more dangerous
+ one, because zero items yields a 0% net change that renders as **PASS — On
+ Track**. Nothing was compared. Nothing was on track.
+- The **current state cannot be determined** — no related source files, no commits
+ in the window, nothing in progress to read. Comparing a real baseline against an
+ unreadable present is not a 0% change.
+- The denominator would be zero for any other reason. A percentage computed from
+ no baseline items is not a small number; it is not a number.
+
+`NOT ASSESSED` **outranks PASS** (a comparison that never happened has not shown
+scope is on track) and **ranks below CONCERNS and FAIL** (measured creep is more
+actionable than an unmeasurable baseline).
+
Output the verdict prominently:
```
-**Scope Verdict: [PASS / CONCERNS / FAIL]**
+**Scope Verdict: [PASS / CONCERNS / NOT ASSESSED / FAIL]**
Net change: [+X%] — [On Track / Minor Creep / Significant Creep / Out of Control]
+ [or: NOT ASSESSED — [which side could not be read, and why]]
```
---
@@ -112,6 +138,10 @@ Net change: [+X%] — [On Track / Minor Creep / Significant Creep / Out of Contr
After presenting the report, offer concrete follow-up:
- **PASS** → no action required. Suggest re-running before next milestone.
+- **NOT ASSESSED** → say which side was unreadable and what would fix it (populate
+ the baseline document, or point the skill at where the work actually lives).
+ Do not offer a re-run against the same inputs — it will produce the same
+ non-answer.
- **CONCERNS** → offer to identify the 2–3 additions with best cut ratio. Reference `/sprint-plan update` to formally re-scope.
- **FAIL** → recommend escalating to producer. Reference `/sprint-plan update` for re-planning or `/estimate` to re-baseline timeline.
diff --git a/.claude/skills/security-audit/SKILL.md b/.claude/skills/security-audit/SKILL.md
index d77b678b..a774a109 100644
--- a/.claude/skills/security-audit/SKILL.md
+++ b/.claude/skills/security-audit/SKILL.md
@@ -1,13 +1,20 @@
---
name: security-audit
-description: "Audit the game for security vulnerabilities: save tampering, cheat vectors, network exploits, data exposure, and input validation gaps. Produces a prioritised security report with remediation guidance. Run before any public release or multiplayer launch."
+description: "Security audit — save tampering, cheat vectors, network exploits, data exposure, input validation. Before public or multiplayer release."
argument-hint: "[full | network | save | input | quick]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Bash, Write, Task
+allowed-tools: Read, Glob, Grep, Bash, Write, Agent
model: sonnet
-agent: security-engineer
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Security Audit
Security is not optional for any shipped game. Even single-player games have
@@ -36,19 +43,46 @@ remediation plan.
- `quick` — high-severity checks only (fastest, for iterative use)
- No argument — run `full`
-Read `.claude/docs/technical-preferences.md` to determine:
-- Engine and language (affects which patterns to search for)
-- Target platforms (affects which attack surfaces apply)
-- Whether multiplayer/networking is in scope
+Read `project.yaml` to determine the following, falling back to `.claude/docs/technical-preferences.md` for engine/language/platforms when a key is absent or empty:
+- `engine.name` and `engine.language` — **load-bearing: they select the Phase 3
+ pattern set, and an engine with no sourced set for a category forces
+ `NOT ASSESSED` for it.** If `engine.name` is absent or empty, say so in the
+ report and treat every grep category as `NOT ASSESSED`; do not fall back to
+ the Godot lists because they are the ones written out in full
+- `platform.targets` (affects which attack surfaces apply)
+- `platform.multiplayer` and `platform.online` — whether multiplayer/networking is
+ in scope. `technical-preferences.md` has no equivalent fields, so the legacy
+ fallback cannot supply them.
+
+ > **ABSENT DOES NOT MEAN `false`.** These keys have a reader —
+ > this skill — and **no writer anywhere in the framework**: neither
+ > `/setup-engine` nor `/start` nor any other skill emits a `platform:` block,
+ > so on essentially every CCGS project both keys are absent. The previous rule
+ > here defaulted them to `false`, which meant **Category 2 (Network and
+ > Multiplayer Security) was skipped on every project including genuinely
+ > multiplayer ones** — a security category failing open on a value nothing
+ > sets.
+ >
+ > When either key is absent or empty: **do not assume single-player, and do not
+ > skip Category 2.** Ask the user whether the game has multiplayer or online
+ > features. If you cannot ask, run Category 2 anyway and mark it
+ > `NOT ASSESSED — multiplayer scope unconfirmed (platform.multiplayer unset,
+ > and no skill sets it)`, which makes `CLEAR TO SHIP` unreachable per Phase 5.
+ > Over-scanning a single-player game costs a few minutes; under-scanning a
+ > multiplayer one ships the category unrun.
+ >
+ > Set them explicitly with `/settings platform.multiplayer=true` (they are
+ > project-wide, so `--local` is refused). Recording it in `project.yaml` is the
+ > fix; this rule is the guard for until someone does.
---
## Phase 2: Spawn Security Engineer
-Spawn `security-engineer` via Task. Pass:
+Spawn `security-engineer` via `Agent`. Pass:
- The audit scope/mode
-- Engine and language from technical preferences
-- A manifest of all source directories: `src/`, `assets/data/`, any config files
+- Engine and language (from `project.yaml`, else technical preferences)
+- A manifest of all source directories: the resolved **code root** (per `.claude/docs/code-root-resolution.md`), `assets/data/`, any config files
The security-engineer runs the audit across 6 categories (see Phase 3). Collect their full findings before proceeding.
@@ -58,6 +92,39 @@ The security-engineer runs the audit across 6 categories (see Phase 3). Collect
The security-engineer evaluates each of the following. Skip categories not applicable to the project scope.
+### Engine pattern sets — read this before any Category below
+
+**Every pattern list in Categories 1–3 was written for Godot.** On a Unity or
+Unreal project they match nothing, and this skill already states what a zero-hit
+scan means: it renders the report clean, "the most dangerous possible failure for
+a security audit". That warning was earned along the **version** axis
+(`File.open` vs `FileAccess`) and the identical hole along the **engine** axis
+shipped anyway. Use the table for `engine.name` resolved in Phase 1.
+
+| Category | Godot | Unity | Unreal |
+|---|---|---|---|
+| 1 — Save / serialization | the Godot list below | **NOT SOURCEABLE** | **NOT SOURCEABLE** |
+| 2 — Network / multiplayer | the Godot list below | `ServerRpc`, `ClientRpc`, `NetworkVariable`, `NetworkObject`, `NetworkManager`, `NetworkBehaviour`, `IsServer`, `IsOwner` | `UFUNCTION`, `Server`, `Client`, `NetMulticast`, `Replicated`, `DOREPLIFETIME`, `GetLifetimeReplicatedProps`, `HasAuthority` |
+| 3 — Input | the Godot list below | `InputSystem`, `PlayerInput`, `ReadValue`, `InputValue` | `EnhancedInput`, `UInputAction`, `InputMappingContext`, `BindAction`, `FInputActionValue` |
+| 4 — Data exposure | engine-agnostic — the list below applies to all three | | |
+| 5, 6 | judgement and manifests, not greps — no engine set needed | | |
+
+The Unity and Unreal names above are **sourced from this repo's pinned
+references** (`docs/engine-reference/unity/modules/{networking,input}.md`,
+`docs/engine-reference/unreal/modules/{networking,input}.md`), not from recall.
+Verify them against the pin before use and add what the reference documents that
+this table omits — it is a floor, not a complete set.
+
+> **`NOT SOURCEABLE` is a verdict, not a gap to fill from memory.** Neither
+> reference tree carries a serialization/save module, so the save-API names for
+> Unity and Unreal cannot be confirmed here. **Do not write them from training
+> data.** A confidently wrong pattern list is worse in this skill than in any
+> other: it produces a scan that looks thorough, finds nothing, and reads as a
+> pass. Where the table says NOT SOURCEABLE, that category is **`NOT ASSESSED`**
+> for this engine — see Phase 5. To close it properly, add the module to
+> `docs/engine-reference/<engine>/` first; then this table can cite it.
+
+
### Category 1: Save File and Serialization Security
- Are save files validated before loading? (no blind deserialization)
- Are save file paths constructed from user input? (path traversal risk)
@@ -65,7 +132,22 @@ The security-engineer evaluates each of the following. Skip categories not appli
- Does the game trust numeric values from save files without bounds checking?
- Are there any eval() or dynamic code execution calls near save loading?
-Grep patterns: `File.open`, `load`, `deserialize`, `JSON.parse`, `from_json`, `read_file` — check each for validation.
+Grep patterns — **check the pinned engine reference before trusting this list**
+(see the API-name warning below): `FileAccess`, `File.open`, `open(`, `load`,
+`deserialize`, `parse`, `parse_string`, `from_json`, `read_file`, `get_var`,
+`bytes_to_var` — check each for validation.
+
+> **API names are version-specific and this list is a starting point, not a
+> complete set.** `File.open` is **Godot 3.x**; Godot 4 renamed the class to
+> `FileAccess` (`docs/engine-reference/godot/breaking-changes.md`). Before relying
+> on these patterns, read `docs/engine-reference/<engine>/` for the version this
+> project pins and add the names it documents. A grep for a class that no longer
+> exists returns zero hits, and **zero hits in this category renders the report
+> clean** — which is the most dangerous possible failure for a security audit.
+> Searching only `File.open` against a Godot 4 project finds nothing and reports
+> CLEAR TO SHIP on a codebase nobody checked. If you cannot confirm the correct
+> names for the pinned version, say so in the report rather than presenting a
+> zero-hit scan as a pass.
### Category 2: Network and Multiplayer Security (skip if single-player only)
- Is game state authoritative on the server, or does the client dictate outcomes?
@@ -75,7 +157,14 @@ Grep patterns: `File.open`, `load`, `deserialize`, `JSON.parse`, `from_json`, `r
- Are authentication tokens handled correctly (never sent in plaintext)?
- Does the game expose any debug endpoints in release builds?
-Grep for: `recv`, `receive`, `PacketPeer`, `socket`, `NetworkedMultiplayerPeer`, `rpc`, `rpc_id` — check each call site for validation.
+Grep for: `recv`, `receive`, `PacketPeer`, `socket`, `MultiplayerPeer`,
+`ENetMultiplayerPeer`, `NetworkedMultiplayerPeer`, `rpc`, `rpc_id`,
+`@rpc` — check each call site for validation.
+
+> Same version caveat as Category 1. `NetworkedMultiplayerPeer` is **Godot 3.x**;
+> Godot 4 uses `ENetMultiplayerPeer`
+> (`docs/engine-reference/godot/modules/networking.md`). The bare substring
+> `MultiplayerPeer` matches both and is the safer probe.
### Category 3: Input Validation
- Are any player-supplied strings used in file paths? (path traversal)
@@ -86,7 +175,7 @@ Grep for: `recv`, `receive`, `PacketPeer`, `socket`, `NetworkedMultiplayerPeer`,
Grep for: `get_input`, `Input.get_`, `input_map`, user-facing text fields — check validation.
### Category 4: Data Exposure
-- Are any API keys, credentials, or secrets hardcoded in `src/` or `assets/`?
+- Are any API keys, credentials, or secrets hardcoded in the code root or `assets/`?
- Are debug symbols or verbose error messages included in release builds?
- Does the game log sensitive player data to disk or console?
- Are any internal file paths or system information exposed to players?
@@ -148,7 +237,21 @@ For each finding, assign:
| MEDIUM | [N] | Recommended |
| LOW | [N] | Optional |
-**Release recommendation**: [CLEAR TO SHIP / FIX CRITICALS FIRST / DO NOT SHIP]
+**Release recommendation**: [NOT ASSESSED — INSUFFICIENT IMPLEMENTATION / CLEAR TO SHIP / FIX CRITICALS FIRST / DO NOT SHIP]
+
+> **`NOT ASSESSED` is required when there was not enough implemented surface to
+> audit**, or when the API names for the pinned engine version could not be
+> confirmed. A zero-finding scan over two files of source is not a clean bill of
+> health, and `CLEAR TO SHIP` must never be reachable by having nothing to look
+> at. Name what was missing and which skill produces it.
+>
+> **The engine axis is part of that rule, not a separate one.** If
+> the Phase 3 table marks a category `NOT SOURCEABLE` for this project's
+> `engine.name`, that category is `NOT ASSESSED` — state it by name in the
+> Executive Summary, and **`CLEAR TO SHIP` is unreachable for the run**. Report
+> `NOT ASSESSED — <category> has no sourced pattern set for <engine>` instead.
+> A scan that could not look is not a scan that found nothing, and only the
+> report can tell the reader which of the two happened.
---
diff --git a/.claude/skills/settings/SKILL.md b/.claude/skills/settings/SKILL.md
new file mode 100644
index 00000000..6d8e85f6
--- /dev/null
+++ b/.claude/skills/settings/SKILL.md
@@ -0,0 +1,459 @@
+---
+name: settings
+description: "View or change project config — effective merged values, or set locally in project.local.yaml."
+argument-hint: "[key | key=value | --local key=value]"
+user-invocable: true
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, AskUserQuestion
+model: sonnet
+---
+
+# /settings — view or change project config
+
+Manages `project.yaml` (team-wide config, committed) and `project.local.yaml`
+(per-developer overrides, gitignored). Use this skill to inspect current
+settings or change them without manually editing YAML.
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). The approval gates in Phase 4 and
+Phase 5 follow the pattern in `.claude/docs/automation-modes.md`. **Note**:
+writing to `project.yaml` is a `schema_changes` decision (a default
+`automation_always_ask` category), so `/settings` confirms config writes even
+in `autonomous` mode unless the user has removed `schema_changes` from their
+always-ask list.
+
+## Phase 0: Parse Arguments
+
+Determine which of the four forms the user invoked:
+
+| Form | Mode |
+|------|------|
+| `/settings` (no args) | **View-all** (Phase 2) |
+| `/settings <key>` (single arg, no `=`) | **View-one** (Phase 3) |
+| `/settings <key>=<value>` (single arg with `=`) | **Set-yaml** (Phase 4) |
+| `/settings --local <key>=<value>` (`--local` prefix) | **Set-local** (Phase 5) |
+
+For Set-yaml and Set-local, `<key>` is a dotted YAML path (e.g.
+`modes.review_mode`, `testing.strict.logic`) and `<value>` is the new value.
+
+**Empty-operand validation:** After splitting the `key=value` operand on
+`=`, if either `<key>` or `<value>` is empty, this is malformed — route to
+Phase 6 (usage) rather than attempting the write. The rule applies in both
+Set-yaml and Set-local routing: for `--local`, strip the `--local` token
+first, then check the remaining operand the same way (so `/settings --local =foo`
+and `/settings --local key=` both go to Phase 6).
+
+Anything else that doesn't match the four forms above → Phase 6 (usage).
+
+## Phase 1: Load Helper
+
+All four subcommands need `yaml-helper.sh`. Source it once via Bash:
+
+```bash
+source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh"
+```
+
+If `.claude/hooks/yaml-helper.sh` is missing, this is not a CCGS project.
+Report the error and exit.
+
+## Phase 1b: Reserved-setting detection
+
+Some settings are fully documented, enum-validated and settable, and **no skill
+or hook reads them** — setting one changes nothing. **This skill must say so.**
+Returning an ordinary success lets a user reasonably believe the behaviour the
+setting describes is now enforced — an accessibility tier being the case that
+motivates this. (The key is not named here on purpose; see the note below.)
+The banner exists only in
+`.claude/docs/effects-map.md`, which someone
+configuring their project will never open. A setting that does nothing must never look
+exactly like one that works — `.claude/rules/skill-authoring.md` obligation 3.
+
+Derive the set; do not hardcode it (obligation 5):
+
+```bash
+grep -B14 '^> ### RESERVED' .claude/docs/effects-map.md | grep -E '^## '
+```
+
+**Match the banner HEADING (`> ### RESERVED`), never the bare word "RESERVED".**
+`platform.cert_tier`'s section *mentions* the banner in prose, to record that it
+carried one and later became a live setting. A looser match re-reports a working
+setting as dead — the direction that understates what the framework does, and
+why the dead-settings gate asserts both directions.
+
+A heading may name **two keys joined by " and "** — split on that separator so
+both are captured, or the second one silently escapes the set. Let
+`RESERVED_SET` be the result.
+
+> Deliberately phrased without naming those keys. The dead-settings gate asserts
+> that a setting on the allowlist has **no** readers, and it counts any skill
+> file that spells the key. Naming them here to illustrate the split would make
+> `/settings` register as a reader of two settings nothing reads, and the gate
+> would fail — correctly. Spelling a dead path out while explaining why not to
+> use it trips the same wire. Reword instead of adding an exemption: the
+> strictness is the point, so do not re-introduce the literal names to make an
+> example clearer.
+
+Never refuse a write to a reserved key. Storing the value a user intends is
+legitimate; storing it *silently* is the defect.
+
+## Phase 2: View-all Mode
+
+(when no arguments)
+
+1. Confirm `project.yaml` exists. If missing, report:
+ > "No `project.yaml` found — run `/start` to create one."
+ And exit.
+
+2. Check if `project.local.yaml` exists.
+
+3. Run `validate_yaml_enum project.yaml` and capture any errors.
+ If `project.local.yaml` exists, also run `validate_yaml_enum project.local.yaml`.
+ Tag each error with its source file so the user can tell them apart.
+
+4. **Enumerate leaves.** Use the `Read` tool to read both YAML files as
+ text. Walk through each file's structure and collect every leaf key
+ into a deduplicated list of dotted paths. A leaf is a `key: value`
+ line whose value is non-empty (a scalar or inline-array) — NOT a
+ parent block that introduces a nested map. Maintain insertion order
+ per file; merge by appending leaves from `project.local.yaml` that
+ aren't already present from `project.yaml`. The resulting list is
+ the set of leaves to display.
+
+ **Then append the rigor family** — `modes.rigor`, `modes.workflow`,
+ `docs.density`, `qa.level`, `modes.story_granularity`, `modes.review_mode`,
+ `team.size` — for any of the seven the merged list does not already
+ contain. These are normally leaves of neither file: `modes.rigor` has a
+ terminal default and the other six are supplied by the rigor expansion
+ (`modes.review_mode` and `team.size` may also appear as file leaves when set
+ locally, but must still be appended so their *derived* value shows). Enumerating
+ only file leaves would hide exactly the settings a user just chose, in the one
+ view meant to show them.
+
+5. **For each leaf**, perform three reads and one check:
+ - `resolve_setting <path>` → `<value>`, TAB, `<source>`. This walks the
+ whole chain (`project.local.yaml` → `project.yaml` → legacy file →
+ `rigor` expansion → default), so it is the only read that can report
+ a derived value or name what supplied it.
+ - `get_yaml_key project.yaml <path>` → yaml-only value (needed only to
+ show what a local override is shadowing)
+ - `is_locally_overridable <path>` → 0 (overridable) or 1 (locked)
+
+ Compute the **source annotation** from `<source>`:
+
+ | `<source>` | Annotation |
+ |---|---|
+ | `project.local.yaml`, yaml-only value non-empty | `(LOCAL OVERRIDE — yaml has: <yamlvalue>)` |
+ | `project.local.yaml`, yaml-only value empty | `(project.local.yaml)` |
+ | `project.yaml` | `(project.yaml)` |
+ | a legacy file path (e.g. `production/review-mode.txt`) | `(<path>, legacy)` |
+ | `rigor:<level>` | `(derived from rigor: <level>)` |
+ | `default` | `(default)` |
+ | `unset` | skip the leaf (don't print unset keys) |
+
+ Append `, locked` to the annotation when `is_locally_overridable`
+ returned 1.
+
+ **Append `, reserved` when the leaf is in `RESERVED_SET` (Phase 1b)**, and
+ print this line with the legend below the block:
+
+ ```
+ reserved = stored and validated, but nothing reads it. Setting it changes
+ no behaviour today.
+ ```
+
+ > **All four phases must carry the reserved marking — view-one, view-all,
+ > and both write paths.** Marking view-one and the writes while leaving
+ > view-all — **the most-used form of this skill** — unmarked means a user who
+ > set a reserved key sees it listed beside working settings with an ordinary
+ > `(project.yaml)` annotation, in the view most people actually run. Guard
+ > all four: view-one and view-all are twins in exactly the way the two write
+ > paths are.
+
+6. **Print**, grouped by top-level section (`framework`, `modes`,
+ `engine`, etc.) in the order leaves first appeared. The grouping is
+ determined by the dotted path, not by which file the leaf came from
+ — e.g. `modes.automation` groups under `modes:` even if only
+ `project.local.yaml` defines it. Within each section, indent leaves
+ by 2 spaces; nest further for sub-blocks (e.g. `testing.strict.*`).
+ Example output:
+
+```
+project.yaml: present
+project.local.yaml: present
+
+Schema validation: ok
+
+Effective config:
+
+framework:
+ version: 1.1.0 (project.yaml, locked)
+
+modes:
+ review_mode: lean (project.yaml)
+ automation: autonomous (LOCAL OVERRIDE — yaml has: collaborative)
+ rigor: full (project.yaml, locked)
+ workflow: full (derived from rigor: full, locked)
+ story_granularity: fine (derived from rigor: full, locked)
+
+docs:
+ density: terse (project.yaml, locked)
+
+qa:
+ level: full (derived from rigor: full, locked)
+
+engine:
+ name: Godot (project.yaml, locked)
+ version: 4.6 (project.yaml, locked)
+
+testing:
+ strict:
+ logic: false (LOCAL OVERRIDE — yaml has: true)
+ integration: true (project.yaml)
+
+locked = cannot be overridden in project.local.yaml (project-wide setting).
+It does NOT mean fixed: a derived value can still be set explicitly with
+/settings <key>=<value>, and an explicit value wins over rigor.
+```
+
+Print that two-line legend after the config block whenever any rendered
+line carries `locked`. Without it users read `locked` as "immutable" and
+conclude a rigor-derived knob cannot be changed — the opposite of what
+Phase 3's view-one tells them for the same knob ("an explicit value wins
+over rigor"). The two views must not leave contradictory impressions of
+the same knob's mutability.
+
+The `docs.density` line above is the precedence rule made visible: an
+explicit `project.yaml` value keeps winning over the level `rigor` would
+otherwise derive, so "comprehensive but compact" stays expressible.
+
+If schema errors exist, print them in this form before the effective
+config block:
+
+```
+Schema validation: ERRORS
+ [project.yaml] modes.review_mode: 'chaotic' is not a valid value (expected: full|lean|solo)
+ [project.local.yaml] engine.name: 'Pygame' is not a valid value (expected: Godot|Unity|Unreal)
+```
+
+## Phase 3: View-one Mode
+
+(when single arg, no `=`)
+
+**If `<key>` is in `RESERVED_SET`, print this BEFORE the value block** — above,
+not below. A caveat under a value reads as a footnote on a working setting:
+
+> **`<key>` is RESERVED — nothing reads it.** The value below is stored and
+> validated; it changes no behaviour today.
+
+Let `<key>` be the argument. Perform four reads:
+
+1. `resolve_setting <key>` → `<value>`, TAB, `<source>` (effective value + provenance)
+2. `get_yaml_key project.yaml <key>` → yaml-only value
+3. `get_yaml_key project.local.yaml <key>` → local-only value (skip if file absent)
+4. `is_locally_overridable <key>` → 0 (overridable) or 1 (locked)
+
+Determine the **source** from `<source>` (same table as Phase 2 step 5)
+and the **Locally overridden** status:
+- `yes` if the local-only value is non-empty
+- `no` otherwise
+
+Print:
+
+```
+<key>
+
+ Effective value: <effective-value or "(not set)" if <source> is unset>
+ Source: <project.yaml | project.local.yaml | project.local.yaml (overrides project.yaml) | derived from rigor: <level> | default>
+ Locally overridden: <yes | no>
+ Whitelist: <"can be locally overridden" if is_locally_overridable returned 0, else "locked — project-wide">
+```
+
+When both files set the key (the LOCAL OVERRIDE case), add two more
+lines under Source:
+
+```
+ project.yaml value: <yamlvalue>
+ project.local.yaml value: <localvalue>
+```
+
+When `<source>` is `rigor:<level>`, add one line under Source so the user
+knows the value is settable and how:
+
+```
+ Set explicitly with: /settings <key>=<value> (an explicit value wins over rigor)
+```
+
+When the effective value is empty (key not set anywhere), print just:
+
+```
+<key>
+
+ Effective value: (not set)
+ Locally overridden: no
+ Whitelist: <"can be locally overridden" | "locked — project-wide">
+```
+
+## Phase 4: Set-yaml Mode
+
+(when `<key>=<value>`, no `--local`)
+
+1. **Schema validation**: call `validate_enum_value <key> <value>`. If
+ it returns 1, the stderr line is shown to the user verbatim
+ (`Invalid value '<value>' for '<key>'. Allowed: ...`) and the skill
+ exits without writing. If it returns 0, the value is either valid
+ or the key has no enum constraint — proceed.
+
+2. **Reserved warning**: if `<key>` is in `RESERVED_SET` (Phase 1b), print
+ BEFORE the approval prompt:
+ > "Note: `<key>` is RESERVED — no skill or hook reads it, so setting it will
+ > not change any behaviour. Your value is stored either way."
+
+ Then continue to the approval gate as normal. Phase 5 carries the identical
+ warning. Warning on one write path and not the other leaves a silent route
+ to the same outcome, which is the whole failure this guards against.
+
+3. **Shadow warning**: read `get_yaml_key project.local.yaml <key>`. If
+ it returns a non-empty value, print BEFORE the approval prompt:
+ > "Note: this setting is currently locally overridden in `project.local.yaml` (value: `<localvalue>`). Writing to `project.yaml` will not change your effective value."
+
+4. **Approval gate**: use `AskUserQuestion`:
+ - Prompt: ``Set `<key>=<value>` in `project.yaml`?``
+ - Options: `[A] Yes, write` / `[B] No, cancel`
+
+5. **Write** using the `Edit` tool. The edit strategy depends on what
+ already exists in `project.yaml`:
+
+ **Case A — key exists**: Read `project.yaml`. Locate the line
+ `<lastsegment>: <oldvalue>` and the line immediately above it that
+ introduces its parent block (e.g. `modes:` for `modes.review_mode`).
+ Construct the `Edit` with `old_string` that includes the parent
+ block line PLUS the leaf line, so the match is unique even if
+ `<lastsegment>: <oldvalue>` appears elsewhere. Example for
+ `modes.review_mode=full`:
+ ```
+ old_string:
+ modes:
+ review_mode: lean
+ new_string:
+ modes:
+ review_mode: full
+ ```
+
+ **Case B — parent block exists, leaf doesn't**: Find the last line
+ of the parent block. Use `Edit` to append the new leaf line at the
+ correct indentation, using the last existing leaf as the `old_string`
+ anchor.
+
+ **Case C — parent block doesn't exist**: Append a new top-level
+ block at end-of-file (deterministic — always end-of-file, never
+ between blocks). Use `Edit` with the last non-empty line of the
+ file as `old_string` and append the new block after it.
+
+ **Case D — file structure is unusual** (commented-out keys with the
+ same name, ambiguous nesting, malformed YAML): STOP and ask via
+ `AskUserQuestion`:
+ > "Couldn't find a clean insertion point for `<key>` in `project.yaml`. Show me what to do."
+
+6. Confirm: ``Set `<key>=<value>` in `project.yaml`.``
+
+ **When `<key>` is `modes.rigor`**, the write also moves six other
+ knobs, so print what they resolve to now — re-read each with
+ `resolve_setting` rather than reciting the expansion table, since any
+ of them may carry an explicit value that still wins:
+
+ ```
+ Set modes.rigor=full in project.yaml. It now supplies:
+ modes.workflow: full (derived from rigor: full)
+ docs.density: terse (project.yaml — explicit, unchanged)
+ qa.level: full (derived from rigor: full)
+ modes.story_granularity: fine (derived from rigor: full)
+ modes.review_mode: full (derived from rigor: full)
+ team.size: studio (derived from rigor: full)
+ ```
+
+## Phase 5: Set-local Mode
+
+(when `--local <key>=<value>`)
+
+1. **Whitelist check**: call `is_locally_overridable <key>`.
+ - If it returns 1 (locked), print one line:
+ > ``<key> cannot be locally overridden — it's a project-wide setting. Use `/settings <key>=<value>` (no `--local`) to change it for the whole team.``
+ - Exit without writing.
+
+2. **Schema validation**: call `validate_enum_value <key> <value>`. If
+ it returns 1, show the stderr message verbatim and exit without
+ writing.
+
+2b. **Reserved warning**: if `<key>` is in `RESERVED_SET` (Phase 1b), print
+ BEFORE the approval prompt:
+ > "Note: `<key>` is RESERVED — no skill or hook reads it, so setting it will
+ > not change any behaviour. Your value is stored either way."
+
+ Identical to Phase 4 step 2, and deliberately so. Both write paths reach the
+ same file-of-record for a user's intent; warning on one only would leave
+ `--local` as the silent route.
+
+3. **Base check**: if `project.yaml` doesn't exist:
+ > "Cannot create `project.local.yaml` — `project.yaml` is missing. Run `/start` to create one first."
+ Exit. (Local overrides require a base, per spec.)
+
+4. **Approval gate**: use `AskUserQuestion`:
+ - Prompt: ``Set `<key>=<value>` in `project.local.yaml` (your personal override, gitignored)?``
+ - Options: `[A] Yes, write` / `[B] No, cancel`
+
+5. **Write**:
+ - If `project.local.yaml` doesn't exist, use `Write` to create it
+ with the new setting wrapped in its parent block(s). Minimal
+ example for `--local modes.automation=autonomous`:
+ ```yaml
+ # project.local.yaml — per-developer overrides (gitignored)
+ modes:
+ automation: autonomous
+ ```
+ - If it exists, use `Edit` with the same Case A/B/C strategy from
+ Phase 4 step 4.
+
+6. Confirm: ``Set `<key>=<value>` in `project.local.yaml` (your override).``
+
+## Phase 6: Usage
+
+When the argument doesn't match any of the four valid forms (or has
+empty operands), print:
+
+```
+Usage:
+ /settings — view all effective config
+ /settings <key> — view a single setting
+ /settings <key>=<value> — change a setting (project.yaml)
+ /settings --local <key>=<value> — change a setting locally
+ (project.local.yaml, gitignored)
+
+Examples:
+ /settings modes.review_mode
+ /settings modes.review_mode=full
+ /settings --local modes.automation=autonomous
+```
+
+## Notes
+
+- All YAML writes go through `Edit` (existing keys/blocks) or `Write`
+ (new files). The skill does not depend on `yq` or any external YAML library.
+- The whitelist is enforced in `yaml-helper.sh`
+ (`is_locally_overridable` function). To extend it, edit the
+ `_yaml_helper_locally_overridable` constant — do not duplicate the list here.
+- **Derived values are not stored anywhere.** `modes.workflow`, `docs.density`,
+ `qa.level`, `modes.story_granularity`, `modes.review_mode` and `team.size` have no
+ terminal default; when no file sets them their value comes from the `modes.rigor`
+ expansion in `yaml-helper.sh`
+ (`_yaml_helper_rigor_expansion`). Report them via `resolve_setting` — a
+ `get_yaml_key` read returns empty and would render them "(not set)" while every
+ skill is in fact acting on a real value.
+- The schema-validation enum constants are in `yaml-helper.sh`
+ (`_yaml_helper_enums`). `validate_enum_value` is the single-key
+ validator for pending writes; `validate_yaml_enum` validates whole
+ files (used by `session-start.sh`).
+- `project.local.yaml` is gitignored. These
+ overrides never propagate to teammates.
+- For **which value to choose** for a given game type or situation — and when to
+ suggest changing one — see `.claude/docs/settings-guidance.md` (advisory presets
+ + change triggers). `effects-map.md` says what each setting does; that doc says
+ which to pick.
diff --git a/.claude/skills/setup-engine/SKILL.md b/.claude/skills/setup-engine/SKILL.md
index 5dcf61b0..74c62bb7 100644
--- a/.claude/skills/setup-engine/SKILL.md
+++ b/.claude/skills/setup-engine/SKILL.md
@@ -1,14 +1,27 @@
---
name: setup-engine
-description: "Configure the project's game engine and version. Pins the engine in CLAUDE.md, detects knowledge gaps, and populates engine reference docs via WebSearch when the version is beyond the LLM's training data."
+description: "Configure engine and version. Pins it in CLAUDE.md; WebSearch fills reference docs when the version is beyond LLM training data."
argument-hint: "[engine] | [engine version] | refresh | upgrade [old-version] [new-version] | no args for guided selection"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, WebSearch, WebFetch, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, WebSearch, WebFetch, Agent, AskUserQuestion
model: sonnet
---
When this skill is invoked:
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys workflow`
+
+**Tier awareness.** The `workflow` tier resolved above governs which design
+artifact this skill expects and the finish path it recommends in §12:
+- **`minimal`** — the design artifact is the one-page `design/game-brief.md`
+ (no GDDs, systems decomposition, or per-system design at this tier).
+ `/setup-engine` runs *first* in the minimal path, so a missing brief here is
+ normal, not a gap. The finish path is the 4-step floor.
+- **`standard` / `full`** — the design artifact is `design/gdd/game-concept.md`
+ and the finish path is the full pipeline.
+
+If the block did not render (shell preprocessing disabled), assume `standard`.
+
## 1. Parse Arguments
Four modes:
@@ -26,13 +39,22 @@ Four modes:
If no engine is specified, run an interactive engine selection process:
### Check for existing game concept
-- Read `design/gdd/game-concept.md` if it exists — extract genre, scope, platform
- targets, art style, team size, and any engine recommendation from `/brainstorm`
-- If no concept exists, inform the user:
+Read the design artifact for the resolved tier (see **Tier awareness** above):
+- **`standard` / `full`**: read `design/gdd/game-concept.md` if it exists —
+ extract genre, scope, platform targets, art style, team size, and any engine
+ recommendation from `/brainstorm`.
+- **`minimal`**: read `design/game-brief.md` if it exists — extract genre,
+ scope, platform, and art direction from its fields. Its absence is **expected**
+ at `minimal` (the brief is authored *after* engine setup in the minimal path), so
+ do not treat a missing brief as a gap — proceed straight to guided selection.
+- If no concept **or** brief exists, inform the user:
> "No game concept found. Consider running `/brainstorm` first to discover what
> you want to build — it will also recommend an engine. Or tell me about your
> game and I can help you pick."
+ (At `minimal` this is optional, not a prerequisite — you can pick an engine now
+ and write the brief next.)
+
### If the user wants to pick without a concept, ask in this order:
**Question 1 — Prior experience** (ask this first, always, via `AskUserQuestion`):
@@ -123,6 +145,33 @@ Once the engine is chosen:
- Search: `"[engine] latest stable version [current year]"`
- Confirm with the user: "The latest stable [engine] is [version]. Use this?"
+### Check the chosen version against what is actually installed
+
+A version found by web search is what exists, not what the developer has. Pinning
+one they cannot run means every later instruction — build, test, smoke, the
+engine reference docs — targets an engine that is not on the machine.
+
+Probe for the binary (Bash), and treat failure as unknown, never as absent:
+
+| Engine | Probe |
+|--------|-------|
+| Godot | `godot --version`, else look for `godot`/`Godot_v*` on PATH or in the platform's usual install location |
+| Unity | `Unity -version`, else the Hub's editor directory |
+| Unreal | `UnrealEditor-Cmd -version`, else the launcher's install directory |
+
+Then:
+- **Match** — say so in one line and continue.
+- **Mismatch** — state both versions and ask, offering three options: pin the
+ installed version, pin the newer one and upgrade later, or pin the newer one
+ deliberately. Record the answer; do not pick silently.
+- **Not found / probe failed** — report `installed version NOT DETERMINED` and
+ continue with the chosen version. Do **not** report this as "no engine
+ installed": a probe that could not run has not established absence.
+
+Whatever the outcome, write it into Section 7's `VERSION.md` as an
+`Installed at pin time` row, so a later reader can tell a deliberate
+version-ahead pin from an accident.
+
---
## 4. Update CLAUDE.md Technology Stack
@@ -150,7 +199,7 @@ Wait for confirmation before making any edits.
Update the Technology Stack section, replacing the `[CHOOSE]` placeholders with the actual values:
-**For Godot** — use the template matching the language chosen above. See **Appendix A** at the bottom of this skill for all three variants (GDScript, C#, Both).
+**For Godot** — use the template matching the language chosen above. See `.claude/skills/setup-engine/references/godot-language-config.md` (**A1**) for all three variants (GDScript, C#, Both).
**For Unity:**
```markdown
@@ -168,6 +217,21 @@ Update the Technology Stack section, replacing the `[CHOOSE]` placeholders with
- **Asset Pipeline**: Unreal Content Pipeline
```
+### Engine reference import
+
+In the same CLAUDE.md write, set the **Engine Version Reference** import to the
+chosen engine. Find the line marked `ENGINE-REFERENCE-IMPORT` (an
+`@docs/engine-reference/<engine>/VERSION.md` line under its comment) and Edit it
+to point at the configured engine:
+- Godot → `@docs/engine-reference/godot/VERSION.md`
+- Unity → `@docs/engine-reference/unity/VERSION.md`
+- Unreal → `@docs/engine-reference/unreal/VERSION.md`
+
+This is why a fresh Unity or Unreal project no longer loads the Godot reference in
+every session. It is idempotent — re-running `/setup-engine` for a different
+engine rewrites the same line. (The target `docs/engine-reference/<engine>/`
+directory is created in Section 8 below if it does not yet exist.)
+
---
## 5. Populate Technical Preferences
@@ -180,7 +244,7 @@ engine-appropriate defaults. Read the existing template first, then fill in:
### Naming Conventions (engine defaults)
-**For Godot** — see **Appendix A** for GDScript, C#, and Both variants.
+**For Godot** — see `.claude/skills/setup-engine/references/godot-language-config.md` (**A2**) for GDScript, C#, and Both variants.
**For Unity (C#):**
- Classes: PascalCase (e.g., `PlayerController`)
@@ -217,6 +281,22 @@ For **Primary Input**, use the dominant input for the game genre:
- Mobile game → Touch
- Cross-platform → ask the user
+> **Genre may not exist yet — check before deriving from it.** At `minimal` the
+> design artifact is `design/game-brief.md`, and it is authored *after* this
+> skill runs (Section 2 says so explicitly). There is no genre to map. The same
+> is true at any tier when `/setup-engine` is run before the concept exists.
+>
+> When genre is unavailable, **ask** — do not infer one from the platform, and do
+> not leave the field silently blank:
+> - Prompt: "Primary input for a [2D/3D] [platform] game? Genre isn't established
+> yet — the brief comes next — so this can't be derived."
+> - Options: the plausible inputs for that platform, plus
+> `Leave as [TO BE CONFIGURED]` — a legitimate answer here, revisited via
+> `/settings` once the brief exists.
+>
+> Gamepad Support and Touch Support still come from the platform table above;
+> only Primary Input depends on genre.
+
Present the derived values and ask the user to confirm or adjust before writing.
Example filled section:
@@ -235,7 +315,13 @@ Example filled section:
- Prompt: "Should I set default performance budgets now, or leave them for later?"
- Options: `[A] Set defaults now (60fps, 16.6ms frame budget, engine-appropriate draw call limit)` / `[B] Leave as [TO BE CONFIGURED] — I'll set these when I know my target hardware`
- If [A]: populate with the suggested defaults. If [B]: leave as placeholder.
-- **Testing**: Suggest engine-appropriate framework (GUT for Godot, NUnit for Unity, etc.) — ask before adding.
+- **Testing**: Suggest the engine-appropriate framework — **gdUnit4** for Godot,
+ NUnit for Unity, Automation Spec for Unreal — and ask before adding.
+ > **Must match `commands.test` in Section 5.5.1, which writes
+ > `godot --headless --script tests/gdunit4_runner.gd`, and
+ > `.claude/docs/coding-standards.md`, which names the same runner.** Naming GUT
+ > here would have the skill recommend one framework and configure another in the
+ > same run.
- **Forbidden Patterns**: Leave as placeholder — do NOT pre-populate.
- **Allowed Libraries**: Leave as placeholder — do NOT pre-populate dependencies the project does not currently need. Only add a library here when it is actively being integrated, not speculatively.
@@ -245,7 +331,7 @@ Example filled section:
Also populate the `## Engine Specialists` section in `technical-preferences.md` with the correct routing for the chosen engine:
-**For Godot** — see **Appendix A** for the routing table matching the language chosen.
+**For Godot** — see `.claude/skills/setup-engine/references/godot-language-config.md` (**A3**) for the routing table matching the language chosen.
**For Unity:**
```markdown
@@ -294,7 +380,7 @@ Also populate the `## Engine Specialists` section in `technical-preferences.md`
### Collaborative Step
Present the filled-in preferences to the user. For Godot, include the chosen language and note where the full naming conventions and routing tables live:
-> "Here are the default technical preferences for [engine] ([language if Godot]). The naming conventions and specialist routing are in Appendix A of this skill — I'll apply the [GDScript/C#/Both] variant. Want to customize any of these, or shall I save the defaults?"
+> "Here are the default technical preferences for [engine] ([language if Godot]). The naming conventions and specialist routing are in this skill's references directory — I'll apply the [GDScript/C#/Both] variant. Want to customize any of these, or shall I save the defaults?"
For all other engines, present the defaults directly without referencing the appendix.
@@ -302,15 +388,398 @@ Wait for approval before writing the file.
---
+## 5.5 Populate `project.yaml` (Primary Config Store)
+
+> **v1.1:** `project.yaml` at the repo root is the **primary** store for project
+> configuration. The `.claude/docs/technical-preferences.md` file written in
+> Section 5 is kept as a **legacy mirror** for backward compatibility. This step
+> is a **dual-write** — the same engine facts go into both files, and
+> `project.yaml` wins when a skill reads a key present in both.
+
+After `technical-preferences.md` is written and approved, dual-write the
+structured config into `project.yaml`. Four blocks are written: `engine`,
+`specialists`, `naming`, and `commands`.
+
+### 5.5.1 Build the four blocks
+
+Derive every value from the engine and language already chosen in Sections 3–4.
+Do NOT re-ask for the **engine, version or language** — reuse those decisions.
+
+> **That is not a blanket "never ask".** `rendering` and `physics` below depend on
+> two further inputs — target platform and 2D-vs-3D — which **Section 2 collects on
+> only one of the four entry paths**. When they were never collected, ask; the
+> unavailable-branch under the project-shape table says how.
+
+**`engine` block:**
+
+```yaml
+engine:
+ name: "<Godot|Unity|Unreal>"
+ version: "<version from Section 3>"
+ language: "<GDScript|C#|C++|Blueprint>"
+ rendering: "<engine default — see table>"
+ physics: "<engine default — see table>"
+```
+
+**On Godot these two values depend on the answers Section 2 already collected —
+the target platform and 2D-vs-3D — so do not pick them from the engine name
+alone.** On Unity and Unreal the table has a single `any` row and the engine name
+*is* sufficient; take those rows directly.
+
+| Engine | Project shape | `rendering` default | `physics` default |
+|--------|---------------|---------------------|-------------------|
+| Godot 4.x | 2D · web target | Compatibility | Godot Physics 2D |
+| Godot 4.x | 2D · non-web | Forward+ | Godot Physics 2D |
+| Godot 4.x | 3D · web target | Compatibility | Jolt |
+| Godot 4.x | 3D · non-web | Forward+ | Jolt |
+| Unity | any | URP | PhysX |
+| Unreal | any | Lumen + Nanite (deferred) | Chaos |
+
+> **Why this table has a shape column and the others do not.** Both Godot
+> defaults were wrong for a 2D browser game, and both were wrong from data this
+> skill had already collected and then discarded.
+> - **Jolt is Godot's default *3D* engine.** `docs/engine-reference/godot/modules/physics.md`:
+> "Jolt Physics is the DEFAULT 3D engine" and "2D physics UNCHANGED (still
+> Godot Physics 2D)". Writing `Jolt` on a 2D project sends the implementer to
+> tune a backend their game does not use.
+> - **Forward+ is desktop-focused.** `docs/engine-reference/godot/modules/rendering.md`:
+> Forward+ is "Full featured, desktop-focused"; Compatibility is
+> "OpenGL 3.3 / WebGL 2, broadest hardware support" — the browser path.
+>
+> If Section 2's platform answer was `Multiple platforms` **including** web, use
+> the web row: the renderer must work everywhere the game ships.
+
+> **Godot only — Unity and Unreal have one row each, keyed `any`.** Shape cannot
+> change `rendering` or `physics` for those two, so do **not** run the resolution
+> below for them: asking an operator a question whose answer you will discard is
+> exactly what §5.5.1 opens by forbidding. On Unity write `URP`/`PhysX` and on
+> Unreal write `Lumen + Nanite (deferred)`/`Chaos` straight from the table.
+>
+> **Section 2 did not necessarily run — check before reading its answers.**
+> Target platform and 2D-vs-3D are collected under *Questions 2–6, only if no
+> prior engine experience*. **Three of the four entry paths never reach them:**
+> `/setup-engine <engine> <version>` and `/setup-engine <engine>` skip Section 2
+> outright, and guided mode skips the matrix as soon as the user names an engine
+> they have worked in before. Only guided mode answered `None` or `Multiple`
+> collects both.
+>
+> Resolve each input in this order and stop at the first that answers:
+> 1. **Section 2's answers**, if that path ran.
+> 2. **The design artifact** — `design/gdd/game-concept.md` at `standard`/`full`,
+> `design/game-brief.md` at `minimal`. Section 2 already extracts platform
+> targets from these; extract 2D-vs-3D the same way when it is stated.
+> 3. **Ask.** Do not infer the shape from the engine name, and do not write a row
+> you could not justify:
+> - Prompt: "`rendering` and `physics` depend on the project's shape, which
+> hasn't been established yet. Is this 2D or 3D, and does it ship to web?"
+> - Options: `2D · non-web` / `2D · web` / `3D · non-web` / `3D · web`, plus
+> `Leave as [TO BE CONFIGURED]` — a legitimate answer here, revisited via
+> `/settings` once the concept exists.
+>
+> `[TO BE CONFIGURED]` is a valid value for both keys. A wrong `Jolt` on a 2D
+> project is worse than an unset one, because nothing downstream questions it.
+
+- `rendering` and `physics` are engine-typical defaults — tell the user they can
+ be changed later via `/settings` if the project uses a different setup.
+- For Godot **Both**, write `language: "GDScript"` (the primary gameplay
+ language); the C# usage is recorded in `technical-preferences.md`.
+- For Unreal, write `language: "C++"` — or `"Blueprint"` only if the project is
+ Blueprint-primary. Blueprint as a secondary tool does not change this value.
+
+**`specialists` block** — copy directly from the routing table chosen in
+Section 5 (**A3** in `.claude/skills/setup-engine/references/godot-language-config.md` for Godot):
+
+| Engine / language | `code` | `shader` | `ui` | `additional` |
+|-------------------|--------|----------|------|--------------|
+| Godot — GDScript | godot-gdscript-specialist | godot-shader-specialist | godot-specialist | [godot-gdextension-specialist] |
+| Godot — C# | godot-csharp-specialist | godot-shader-specialist | godot-specialist | [godot-gdextension-specialist] |
+| Godot — Both | godot-gdscript-specialist | godot-shader-specialist | godot-specialist | [godot-csharp-specialist, godot-gdextension-specialist] |
+| Unity | unity-specialist | unity-shader-specialist | unity-ui-specialist | [unity-dots-specialist, unity-addressables-specialist] |
+| Unreal | unreal-specialist | unreal-specialist | ue-umg-specialist | [ue-gas-specialist, ue-blueprint-specialist, ue-replication-specialist] |
+
+```yaml
+specialists:
+ code: "<code specialist>"
+ shader: "<shader specialist>"
+ ui: "<ui specialist>"
+ additional: ["<...>"]
+```
+
+**`naming` block** — enum values (NOT the prose form used in
+`technical-preferences.md`). Use the column matching the engine and, for Godot,
+the language:
+
+| Field | Godot GDScript | Godot C# | Unity | Unreal |
+|-------|----------------|----------|-------|--------|
+| `classes` | PascalCase | PascalCase | PascalCase | PascalCase |
+| `variables` | snake_case | camelCase | camelCase | **PascalCase** |
+| `constants` | SCREAMING_SNAKE | PascalCase | SCREAMING_SNAKE | SCREAMING_SNAKE |
+| `signals` | past_tense | on_event_name | **PascalCase `On<Event>`** | **PascalCase `On<Event>`** |
+| `files` | snake_case | PascalCase | PascalCase | PascalCase |
+| `scenes` | snake_case | PascalCase | PascalCase | PascalCase |
+
+> **The Unreal column is sourced, not inherited from the table's generic shape.**
+> `variables: camelCase` and `signals: on_event_name` are the two rows that shape
+> would produce, and both are wrong for Unreal. Checked against this repo's
+> pinned reference: `docs/engine-reference/unreal/` contains **zero** camelCase
+> variable declarations and uses PascalCase throughout (`int32 Health;`,
+> `FVector ServerPosition;`), and the word "signal" **never appears in it at all** —
+> it is Godot vocabulary. Unreal has delegates and events, and the reference's
+> handlers are PascalCase `On<Event>`.
+>
+> Two caveats kept rather than smoothed over. (1) `classes: PascalCase` is
+> **incomplete** for Unreal, not wrong: UE requires a mandatory type prefix
+> (`U`/`A`/`F`/`E`/`I`/`T`) that this enum cannot express, so an Unreal project's
+> coding standards must state it separately. (2) `scenes` is a **category
+> mismatch** — Unreal has Levels and Maps under World Partition, not scenes — left
+> in place because the key is shared across engines and renaming it is a schema
+> change, not a value fix.
+>
+> The blast radius is limited: `naming.*` is currently a
+> **documented-but-unread** setting, so wrong values misinform a human reading
+> `project.yaml` rather than driving any automated check — today. That is a
+> reason to get them right now, while it is cheap.
+
+> **Three further rules for this table.**
+>
+> **The Unity `build` row must not hardcode `-buildTarget StandaloneLinux64`.**
+> A hardcoded target gives every Unity project a **Linux** build command, whatever
+> platform it actually ships on. The row reads `<TARGET>`: **ask the operator for
+> the build target and write the value they give.** The correct `-buildTarget` identifiers
+> are not sourceable from `docs/engine-reference/unity/`, so this skill must not
+> emit one from recall — the same call made for `/security-audit`'s save
+> patterns and for Unity's release dates. A wrong-but-plausible default is worse
+> than an explicit question: it produces a `commands.build` that runs, succeeds,
+> and builds the wrong artifact.
+>
+> **The Godot `build` row must not hardcode `'Linux/X11'` either — same defect,
+> same remedy.** A Godot export preset name is **project-defined**: it is whatever
+> string the operator typed into `export_presets.cfg`, and the shipped defaults are
+> per-platform (`Windows Desktop`, `macOS`, `Web`, `Linux/X11`). Writing
+> `'Linux/X11'` gives a Windows-targeting project a build command that fails with
+> `Unknown export preset`, and gives a project that *does* have a Linux preset a
+> command that silently builds the wrong platform. The row reads `<PRESET>`:
+> **ask the operator which export preset to build and write the value they give**,
+> exactly as the Unity row does. If no presets exist yet — common, since
+> `/setup-engine` usually runs before the Godot project has any — write
+> `[TO BE CONFIGURED]` and say so, rather than guessing a name that does not exist.
+>
+> **The `constants` row must not contradict this skill's own prose.** The table says
+> `SCREAMING_SNAKE` for Unity; the Unity section of this same file says
+> "Constants: PascalCase or UPPER_SNAKE_CASE". Both cannot be authoritative, and
+> an agent following one produces config the other rejects. The row is **left
+> unchanged pending sourcing** rather than picked by preference — neither
+> `docs/engine-reference/unity/` nor `unreal/` contains a SCREAMING_SNAKE constant
+> to confirm or refute it, and the Unreal run flagged the same row as wrong for
+> Unreal on the same grounds. Resolve by adding a naming section to the engine
+> references, then correct table and prose together. Until then, treat
+> `naming.constants` as unverified for Unity and Unreal.
+>
+> **Write that caveat into `project.yaml`, do not leave it here.** On Unity and
+> Unreal, emit the `constants` line with a trailing comment:
+> ```yaml
+> naming:
+> constants: SCREAMING_SNAKE # UNVERIFIED — not sourceable from
+> # docs/engine-reference/<engine>/; confirm before relying on it
+> ```
+> Without it, a value the skill *knows* is unsourced is recorded as flatly as
+> `classes: PascalCase`, which is sourced, and the reader of the primary config
+> store cannot tell them apart. The `commands` block nine lines below already does
+> exactly this with its `# TODO: confirm these` line — this is the same pattern,
+> applied to the value that needs it just as much.
+
+For Godot **Both**, use the GDScript column — `.gd` files dominate gameplay
+scripting; `.cs` files follow C# conventions per-file (see **A2** in `.claude/skills/setup-engine/references/godot-language-config.md`).
+
+```yaml
+naming:
+ classes: <value>
+ variables: <value>
+ constants: <value>
+ signals: <value>
+ files: <value>
+ scenes: <value>
+```
+
+**`commands` block** — engine-default shell commands, simple-string form:
+
+| Engine | `build` | `test` | `run` | `smoke` |
+|--------|---------|--------|-------|---------|
+| Godot | `godot --headless --export-debug '<PRESET>'` **(ASK — do not default)** | `godot --headless --script tests/gdunit4_runner.gd` | `godot --path . --windowed --resolution 1280x720` | `godot --headless --quit-after 5` |
+| Unity | `Unity -batchmode -quit -projectPath . -buildTarget <TARGET>` **(ASK — do not default)** | `Unity -runTests -projectPath . -testPlatform PlayMode` | `Builds/<Target>/<Game>.exe -screen-width 1280 -screen-height 720 -screen-fullscreen 0` | `Unity -batchmode -quit -projectPath . -executeMethod SmokeCheck.Run` |
+
+> **`commands.run` is the one the run-and-observe step depends on.** It must
+> launch the **game**, windowed, at a fixed resolution — never the editor, and
+> never with a headless / batch / null-RHI flag, which exist to skip rendering.
+> `/dev-story` Phase 6 step 4 appends the per-engine capture flags to it
+> (`.claude/docs/run-and-observe.md`). `test` and `smoke` feed the parse check
+> and `/smoke-check`; `build` is the one row you must ask for.
+
+> **YAML quoting rule — applies to EVERY command value.** `yaml-helper.sh` — the
+> parser every config read in this framework goes through — decodes **no**
+> escape sequences: neither `\"` inside a double-quoted scalar nor `''` inside a
+> single-quoted scalar. It takes the first matching quote character as the end of
+> the value and discards the rest, so `"he said \"hi\" now"` parses as
+> `he said \`. Verified against the parser, not inferred. The rule is
+> preventative here — it applies the moment anything does read `commands.*`, and
+> to every other quoted value in `project.yaml` today.
+> Pick the quote style that needs **no escaping**:
+> - value contains a single quote `'` (e.g. the Godot `build` above) → wrap it in
+> a **double-quoted** YAML scalar: `"... 'Linux/X11' ..."`
+> - value contains a double quote `"` (e.g. the Unreal `test`/`smoke` below) →
+> wrap it in a **single-quoted** YAML scalar: `'... "Quit" ...'`
+> - value contains neither → use a double-quoted scalar for consistency.
+> Never use a quote style that forces an escape (`\"` or `''`) — the parser
+> truncates the value at the escape. A value containing BOTH quote types cannot
+> be represented for this parser; rewrite the command to drop one.
+
+**Godot / Unity** — write the table values directly, substituting the operator's
+answer for `<PRESET>` / `<TARGET>`. Godot's `build` contains a single quote, so it
+takes a double-quoted scalar (`Windows Desktop` below is the *example* answer, not
+a default — write what the operator said):
+
+```yaml
+commands:
+ build: "godot --headless --export-debug 'Windows Desktop'"
+ test: "godot --headless --script tests/gdunit4_runner.gd"
+ run: "godot --path . --windowed --resolution 1280x720"
+ smoke: "godot --headless --quit-after 5"
+```
+
+> **Also write `engine.path` if the editor is not on `PATH`.** These commands name
+> the executable bare, which assumes it resolves — and on Windows none of the three
+> engines installs onto `PATH` by default. Ask for or probe the install location and
+> record it:
+>
+> ```yaml
+> engine:
+> path: "C:/Program Files/Epic Games/UE_5.7" # omit if the editor is on PATH
+> ```
+>
+> **This is not cosmetic.** Without it, an agent reports *"no editor on this
+> machine"* and ships C++ it never compiled — on a machine where that engine WAS
+> installed. Nothing in the project told it where to look, so absence of a path read
+> as absence of an engine.
+
+For **Unreal**, UE build/test commands vary by version and project setup. Write
+best-effort values and add a `# TODO` comment so the user knows to confirm them.
+The `test`/`smoke` commands embed double quotes, so they take single-quoted
+scalars:
+
+```yaml
+commands:
+ # TODO: confirm these for your UE version and project — adjust via /settings
+ build: 'RunUAT.bat BuildCookRun -project=<project>.uproject -platform=Win64 -build -cook'
+ test: 'UnrealEditor-Cmd.exe <project>.uproject -ExecCmds="Automation RunTests <project>; Quit" -unattended -nullrhi'
+ run: 'UnrealEditor.exe <project>.uproject -game -windowed -ResX=1280 -ResY=720'
+ smoke: 'UnrealEditor-Cmd.exe <project>.uproject -game -nullrhi -unattended -ExecCmds="Quit"'
+```
+
+**Two details are load-bearing.** `smoke` needs `-game`: without it
+`UnrealEditor-Cmd` boots the *editor*, where a bare `Quit` console command only
+ends a play-in-editor session — the process stays resident and the command
+never returns; with `-game` the same line boots headless and exits in seconds.
+`test` needs the `; Quit` inside the `Automation` string: the automation
+runner handles that trailing `Quit` itself and exits the editor once the tests
+finish, and without it the run also never returns.
+
+### 5.5.2 Write the blocks to `project.yaml`
+
+Show the user the full set of four blocks and ask:
+
+> "May I write the `engine`, `specialists`, `naming`, and `commands` blocks to `project.yaml`?"
+
+Wait for confirmation, then apply based on the file's current state:
+
+- **`project.yaml` does not exist** — create it with the Write tool using this
+ v1.1 template (the four blocks appended after `framework`; replace `<...>` and
+ the date):
+
+ ```yaml
+ # CCGS project configuration — single source of truth for project settings.
+ # Schema: grep the `## <key>` section of .claude/docs/effects-map.md —
+ # it is ~31k tokens whole, ~900 per section. Do not open it entire.
+
+ schema_version: 1
+
+ framework:
+ version: 1.1.0
+ last_upgraded: <today's date>
+
+ engine:
+ name: "<...>"
+ version: "<...>"
+ language: "<...>"
+ rendering: "<...>"
+ physics: "<...>"
+
+ specialists:
+ code: "<...>"
+ shader: "<...>"
+ ui: "<...>"
+ additional: ["<...>"]
+
+ naming:
+ classes: <...>
+ variables: <...>
+ constants: <...>
+ signals: <...>
+ files: <...>
+ scenes: <...>
+
+ commands:
+ build: "<...>"
+ test: "<...>"
+ run: "<...>"
+ smoke: "<...>"
+ ```
+
+ Do not seed `modes.review_mode` here. It is a rigor-fronted knob — `modes.rigor`
+ supplies its value, so an explicit value would shadow the rigor expansion and pin
+ the review mode regardless of the project's rigor. Test Y.6 locks this in.
+
+- **`project.yaml` exists** — Read it first (the Edit tool requires the file to
+ have been read this session), then, processing the blocks in the order
+ `engine` → `specialists` → `naming` → `commands`, for each block:
+ - **Block absent** — insert the whole block, appended after the last existing
+ top-level block.
+ - **Block already present** (a re-run of `/setup-engine`) — Edit the existing
+ keys in place, and add any keys the block is missing (a partial block must
+ end up with its full key set). Do NOT add a second copy of the block.
+
+Preserve all other content in `project.yaml` (`schema_version`, `framework`,
+`modes`, `project`, etc.) — only the four blocks are touched.
+
+### 5.5.3 Verify the dual-write
+
+Read `project.yaml` back and confirm the four blocks are present and that
+`engine.name`, `engine.language`, and the naming values match what was written
+to `technical-preferences.md`. If they diverge, report the discrepancy to the
+user and stop — a split config corrupts skill and hook reads.
+
+---
+
## 6. Determine Knowledge Gap
Check whether the engine version is likely beyond the LLM's training data.
-**Known approximate coverage** (update this as models change):
-- LLM knowledge cutoff: **May 2025**
-- Godot: training data likely covers up to ~4.3
-- Unity: training data likely covers up to ~2023.x / early 6000.x
-- Unreal: training data likely covers up to ~5.3 / early 5.4
+**Known approximate coverage** — *last re-checked 2026-08-28*:
+- LLM knowledge cutoff: **May 2026**
+- Godot: training data likely covers up to ~4.6
+- Unity: training data likely covers up to ~6000.x
+- Unreal: training data likely covers up to ~5.5
+
+> **This table goes stale silently, and a stale table fails in the dangerous
+> direction only if it is too *new*.** A cutoff left unchanged for a year after
+> it stopped being true over-classifies risk — safe, but every project then pays
+> for full reference docs it may not have needed.
+> The opposite error is the harmful one: a cutoff claimed *later* than the model's
+> actual one marks post-cutoff versions LOW RISK and suppresses the reference
+> docs that exist to stop invented APIs.
+>
+> **If the date above is more than six months old, do not trust it.** Say so, and
+> treat the engine version as `HIGH RISK` regardless of the comparison — an
+> unverifiable cutoff is not a cutoff that was met.
Compare the user's chosen version against these baselines:
@@ -324,6 +793,53 @@ Inform the user which category they're in and why.
## 7. Populate Engine Reference Docs
+### First: does a reference set already exist for this engine?
+
+**Check before doing anything else.** The template ships
+`docs/engine-reference/godot/`, `unity/` and `unreal/` **already populated**, so
+"the directory exists and pins a version" is the state of *every* fresh project,
+not an edge case. Both branches below say "create", and following either one
+literally on a pre-populated directory either overwrites curated content or
+leaves `project.yaml` and the CLAUDE.md-imported reference disagreeing.
+
+Read `docs/engine-reference/<engine>/VERSION.md` and compare its
+**Engine Version** to the version chosen in Section 3:
+
+- **No directory, or no `VERSION.md`** → create, using the risk branch below.
+- **Same version** → nothing to do. Refresh `Last Docs Verified` only if you
+ actually re-verified against the docs this run. Do not restamp a date you did
+ not check.
+- **Directory pins an OLDER version than the one chosen** → **update, do not
+ replace.** This is the common case.
+ 1. Edit `VERSION.md` in place: new **Engine Version**, new **Project Pinned**
+ and **Last Docs Verified**, the `Installed at pin time` row from Section 3,
+ and a new row in the post-cutoff timeline for each version added.
+ 2. **Append** to `breaking-changes.md`, `deprecated-apis.md` and
+ `current-best-practices.md` under a heading naming the version span
+ (`## 4.6 → 4.7`). Never truncate the older spans — a project migrating
+ across two versions still needs the earlier one.
+ 3. Re-grade the older timeline rows if the cutoff moved past them.
+- **Directory pins a NEWER version than the one chosen** → stop and ask. Someone
+ pinned forward deliberately, or the version choice is wrong. Do not silently
+ downgrade a curated reference.
+
+### Sourcing rule for everything written in this section
+
+**Never fill a gap from training data. Write the gap down instead.**
+
+The whole purpose of these files is to be the thing agents consult *instead of*
+their training data. A confidently wrong entry here is worse than no entry: it
+produces work that looks verified and is not.
+
+- Every claim must come from a page you fetched this run. Record the URL.
+- If the official docs do not state something the template asks for — a release
+ date, a subsystem's behaviour, web-export specifics — write
+ **`NOT SOURCEABLE — <what>, not stated at <url>`** and move on.
+- A `NOT SOURCEABLE` line is a successful outcome, not a failure to finish.
+- Do not infer one fact from an adjacent one. "The migration guide lists no
+ physics change" is not "the physics default is unchanged"; if you record the
+ inference, label it as an inference and name what it rests on.
+
### If WITHIN training data (LOW RISK):
Create a minimal `docs/engine-reference/<engine>/VERSION.md`:
@@ -387,21 +903,140 @@ Wait for confirmation before writing any files.
---
-## 8. Update CLAUDE.md Import
+## 7.5 Scaffold the Engine Project
-Ask: "May I update the `@` import in `CLAUDE.md` to point to the new engine reference?"
+**Without this step the framework produces source files no engine can open.**
+`/dev-story` writes `.gd`/`.cs`/`.cpp` under the resolved code root, and the `minimal` path
+advertises "four steps to running code" — but nothing anywhere created a project
+for the engine to load. Verified by grep across every skill: no `project.godot`,
+no Unity project, no `.uproject` was ever written. The files were real and
+orphaned.
-Wait for confirmation, then update the `@` import under "Engine Version Reference" to point to the
-correct engine:
+### Godot — write `project.godot` if one is absent
-```markdown
-## Engine Version Reference
+**Never overwrite an existing `project.godot`.** If the file is already there,
+say so and skip to Section 8 — the developer has a project and its settings are
+theirs.
+
+Show the proposed file, then ask: *"May I create `project.godot` at the repo
+root?"* On approval, write:
+
+```ini
+config_version=5
+
+[application]
+
+config/name="<project name>"
+config/features=PackedStringArray("<major.minor>", "<renderer feature>")
+
+[rendering]
+
+renderer/rendering_method="<rendering method>"
+```
+
+Fill it from decisions already made — do not ask again:
+
+| Field | Source |
+|-------|--------|
+| `config/name` | the brief's working title, else the repo directory name |
+| `<major.minor>` | `engine.version` from Section 3, major and minor only (`4.7.2` → `4.7`) |
+| `<renderer feature>` / `<rendering method>` | the `rendering` value chosen in Section 5.5.1 — Compatibility → `"GL Compatibility"` / `gl_compatibility`; Forward+ → `"Forward Plus"` / `forward_plus`; Mobile → `"Mobile"` / `mobile` |
+
+**Leave `run/main_scene` unset.** There is no scene yet at engine-setup time.
+Add a comment saying `/dev-story` or the developer sets it once a scene exists;
+an empty project with no main scene opens fine in the editor.
+
+**Then verify, and report what the verification actually was.** If the engine
+binary was found in Section 3, run its headless import
+(`godot --headless --path . --import`) and report the result. If the binary was
+not found, or its version differs from the pinned one, write
+**`project.godot NOT VERIFIED — <reason>`**. The `config_version` and feature
+strings are stable across Godot 4.x, but "stable in the versions I know" is not
+the same as "checked against the version you pinned", and only the run
+establishes the latter.
+
+### Unity and Unreal — instruct, do not fabricate
+
+A Unity project and an `.uproject` are editor-generated and span many files,
+several of them binary or machine-specific. This repo cannot source their
+correct contents, and a hand-written scaffold would be the exact failure
+Section 7's sourcing rule forbids — something that looks finished and is quietly
+wrong.
+
+Tell the user, in one short block, that CCGS does not create the project for
+these engines and they should create it first:
+
+- **Unity** — create the project in Unity Hub at the repo root, choosing the
+ template matching the 2D/3D answer from Section 2, then re-run `/setup-engine`.
+- **Unreal** — create the project in the Epic launcher or via `UnrealEditor`,
+ then re-run.
+
+Report the outcome in the Section 12 summary either way — created, already
+present, or "not created, engine requires the editor" — so the user leaves this
+skill knowing whether a runnable project exists.
+
+> **Deliberately not a `project.yaml` key.** An `engine.project_scaffolded` flag
+> would be written here and read by nothing, which is a dead setting — the same
+> writer-without-reader defect the config gates exist to catch. The filesystem is
+> the source of truth: any skill that needs to know globs for `project.godot`,
+> `*.uproject`, or `ProjectSettings/ProjectVersion.txt`.
+
+---
+## 8. Verify the CLAUDE.md Import
+
+**This import was already written in Section 4 — do not edit it again and do not
+ask again.** Section 4 sets it as part of the same CLAUDE.md write, anchored to
+the `ENGINE-REFERENCE-IMPORT` marker. This step only confirms the result.
+
+Read `CLAUDE.md` and confirm the line under the marker reads:
+
+```markdown
@docs/engine-reference/<engine>/VERSION.md
```
-If the previous import pointed to a different engine (e.g., switching from
-Godot to Unity), update it.
+with `<engine>` the engine just configured. If it still points at a different
+engine, Section 4 did not complete — go back and finish it rather than patching
+the line here.
+
+> **Why this is a check and not a second write.** Repeating the edit here with
+> its own approval prompt would ask the user twice for one change, and the second
+> ask would be for work already done. Locate the line by its marker, never by the
+> `## Engine Version Reference` heading — the marker exists precisely so the line
+> can still be found when the heading moves or is reworded.
+
+---
+
+## 8.5 Read Back What You Just Wrote
+
+This section exists because prose did not hold. Section 5.5.1's rendering/physics
+table already carries an emphatic, source-cited warning naming the two mistakes
+most often made here -- and it is still entirely possible to make **both** of
+them anyway, writing `Forward+` and `Jolt` for a 2D browser game. Section 3's
+`Installed at pin time` row is just as easy to drop silently, because a missing
+row leaves no trace.
+
+Neither is fixed by adding more instructions. They are fixed by verifying the
+files after writing them:
+
+```bash
+bash .claude/scripts/project-coherence.sh
+```
+
+It compares `project.yaml` against `docs/engine-reference/<engine>/VERSION.md`,
+against `project.godot`, and against the engine binary actually on PATH, and it
+checks that the files `commands.build` and `commands.test` name exist.
+
+**Report every `[DIFFERS]` line to the user and resolve it before finishing.**
+Each one means two files this skill just wrote disagree, or describe something
+that is not there.
+
+**`[NOT CHECKED]` is not a pass.** Each such line names why a comparison could
+not be made -- an absent binary, a missing `project.godot`. Say which ones
+applied. A comparison that could not run has not established agreement.
+
+The script emits observations and never a verdict, per the convention in
+CLAUDE.md. The judgement is yours and the user's.
---
@@ -463,7 +1098,7 @@ any "must migrate" items.
### Step 3 — Pre-Upgrade Audit
-Scan `src/` for code that uses APIs known to be deprecated or changed in the
+Scan the **code root** (resolve per `.claude/docs/code-root-resolution.md`) for code that uses APIs known to be deprecated or changed in the
target version:
- Use Grep to search for deprecated API names extracted from the migration
@@ -492,8 +1127,8 @@ Recommended migration order (dependency-sorted):
...
```
-If no deprecated APIs are found in `src/`, report: "No deprecated API usage
-found in src/ — upgrade may be low-risk."
+If no deprecated APIs are found in the code root, report: "No deprecated API usage
+found in the code root — upgrade may be low-risk."
### Step 4 — Confirm Before Updating
@@ -523,6 +1158,10 @@ After confirmation:
2. If `breaking-changes.md` or `deprecated-apis.md` exist in the engine
reference directory, append the new version's changes to those files.
+3. If `project.yaml` exists at the repo root and has an `engine` block, Read it
+ first, then update `engine.version` to `[new-version]` so the primary config
+ store stays in sync with VERSION.md.
+
### Step 6 — Post-Upgrade Reminder
After updating VERSION.md, output:
@@ -555,10 +1194,26 @@ Knowledge Risk: [LOW/MEDIUM/HIGH]
Reference Docs: [created/skipped]
CLAUDE.md: [updated]
Tech Prefs: [created/updated]
+project.yaml: [created/updated]
Agent Config: [verified]
Next Steps:
1. Review docs/engine-reference/<engine>/VERSION.md
+```
+
+Then print **one** Next-Steps list, matching the resolved `workflow` tier:
+
+**`minimal` — the lean 4-step floor (you are on step 1):**
+```
+2. Run /brainstorm to produce your one-page design/game-brief.md (the lean-tier design artifact)
+3. Run /create-stories to turn the brief's MVP list into stories
+4. Run /dev-story — first line of game code
+```
+(No `/map-systems`, `/design-system`, `/prototype`, or `/sprint-plan` at
+`minimal` — the brief replaces the GDDs and its build order is the plan.)
+
+**`standard` / `full` — the full pipeline:**
+```
2. [If from /brainstorm] Run /map-systems to decompose your concept into individual systems
3. [If from /brainstorm] Run /design-system to author per-system GDDs (guided, section-by-section)
4. [If from /brainstorm] Run /prototype [core-mechanic] to validate the core idea before writing GDDs
@@ -573,144 +1228,27 @@ Verdict: **COMPLETE** — engine configured and reference docs populated.
## Guardrails
- NEVER guess an engine version — always verify via WebSearch or user confirmation
+- `project.yaml` is the primary config store (v1.1). Always dual-write engine
+ config to BOTH `project.yaml` (primary) and `technical-preferences.md` (legacy
+ mirror). If the two ever diverge, `project.yaml` is authoritative.
- NEVER overwrite existing reference docs without asking — append or update
- If reference docs already exist for a different engine, ask before replacing
- Always show the user what you're about to change before making CLAUDE.md edits
- If WebSearch returns ambiguous results, show the user and let them decide
-- When the user chose **GDScript**: copy the GDScript CLAUDE.md template from Appendix A1 exactly. NEVER add "C++ via GDExtension" to the Language field. GDScript projects may use GDExtension, but it is not a primary project language. The `godot-gdextension-specialist` in the routing table is available for when native extensions are needed — it does not make C++ a project language.
+- When the user chose **GDScript**: copy the GDScript CLAUDE.md template from **A1** in `.claude/skills/setup-engine/references/godot-language-config.md` exactly. NEVER add "C++ via GDExtension" to the Language field. GDScript projects may use GDExtension, but it is not a primary project language. The `godot-gdextension-specialist` in the routing table is available for when native extensions are needed — it does not make C++ a project language.
---
## Appendix A — Godot Language Configuration
-All Godot-specific variants for language-dependent configuration. Referenced from Sections 4 and 5 — only relevant when Godot is the chosen engine. Use the subsection matching the language chosen in Section 4.
-
----
-
-### A1. CLAUDE.md Technology Stack Templates
-
-**GDScript:**
-```markdown
-- **Engine**: Godot [version]
-- **Language**: GDScript
-- **Build System**: SCons (engine), Godot Export Templates
-- **Asset Pipeline**: Godot Import System + custom resource pipeline
-```
-
-> **Guardrail**: When using this GDScript template, write the Language field as exactly "`GDScript`" — no additions. Do NOT append "C++ via GDExtension" or any other language. The C# template below includes GDExtension because C# projects commonly wrap native code; GDScript projects do not.
-
-**C#:**
-```markdown
-- **Engine**: Godot [version]
-- **Language**: C# (.NET 8+, primary), C++ via GDExtension (native plugins only)
-- **Build System**: .NET SDK + Godot Export Templates
-- **Asset Pipeline**: Godot Import System + custom resource pipeline
-```
+Moved out of this file so it costs nothing on non-Godot runs.
-**Both — GDScript + C#:**
-```markdown
-- **Engine**: Godot [version]
-- **Language**: GDScript (gameplay/UI scripting), C# (performance-critical systems), C++ via GDExtension (native only)
-- **Build System**: .NET SDK + Godot Export Templates
-- **Asset Pipeline**: Godot Import System + custom resource pipeline
-```
+**When the chosen engine is Godot, read**
+`.claude/skills/setup-engine/references/godot-language-config.md`
+and use the subsection for the chosen language:
----
+- **A1** — CLAUDE.md Technology Stack templates (GDScript / C# / Both)
+- **A2** — naming conventions
+- **A3** — engine specialist routing and file-extension tables
-### A2. Naming Conventions
-
-**GDScript:**
-- Classes: PascalCase (e.g., `PlayerController`)
-- Variables/functions: snake_case (e.g., `move_speed`)
-- Signals: snake_case past tense (e.g., `health_changed`)
-- Files: snake_case matching class (e.g., `player_controller.gd`)
-- Scenes: PascalCase matching root node (e.g., `PlayerController.tscn`)
-- Constants: UPPER_SNAKE_CASE (e.g., `MAX_HEALTH`)
-
-**C#:**
-- Classes: PascalCase (`PlayerController`) — must also be `partial`
-- Public properties/fields: PascalCase (`MoveSpeed`, `JumpVelocity`)
-- Private fields: `_camelCase` (`_currentHealth`, `_isGrounded`)
-- Methods: PascalCase (`TakeDamage()`, `GetCurrentHealth()`)
-- Signal delegates: PascalCase + `EventHandler` suffix (`HealthChangedEventHandler`)
-- Files: PascalCase matching class (`PlayerController.cs`)
-- Scenes: PascalCase matching root node (`PlayerController.tscn`)
-- Constants: PascalCase (`MaxHealth`, `DefaultMoveSpeed`)
-
-**Both — GDScript + C#:**
-Use GDScript conventions for `.gd` files and C# conventions for `.cs` files. Mixed-language files do not exist — the boundary is per-file. When in doubt about which language a new system should use, ask the user and record the decision in `technical-preferences.md`.
-
----
-
-### A3. Engine Specialists Routing
-
-**GDScript:**
-```markdown
-## Engine Specialists
-- **Primary**: godot-specialist
-- **Language/Code Specialist**: godot-gdscript-specialist (all .gd files)
-- **Shader Specialist**: godot-shader-specialist (.gdshader files, VisualShader resources)
-- **UI Specialist**: godot-specialist (no dedicated UI specialist — primary covers all UI)
-- **Additional Specialists**: godot-gdextension-specialist (GDExtension / native C++ bindings only)
-- **Routing Notes**: Invoke primary for architecture decisions, ADR validation, and cross-cutting code review. Invoke GDScript specialist for code quality, signal architecture, static typing enforcement, and GDScript idioms. Invoke shader specialist for material design and shader code. Invoke GDExtension specialist only when native extensions are involved.
-
-### File Extension Routing
-
-| File Extension / Type | Specialist to Spawn |
-|-----------------------|---------------------|
-| Game code (.gd files) | godot-gdscript-specialist |
-| Shader / material files (.gdshader, VisualShader) | godot-shader-specialist |
-| UI / screen files (Control nodes, CanvasLayer) | godot-specialist |
-| Scene / prefab / level files (.tscn, .tres) | godot-specialist |
-| Native extension / plugin files (.gdextension, C++) | godot-gdextension-specialist |
-| General architecture review | godot-specialist |
-```
-
-**C#:**
-```markdown
-## Engine Specialists
-- **Primary**: godot-specialist
-- **Language/Code Specialist**: godot-csharp-specialist (all .cs files)
-- **Shader Specialist**: godot-shader-specialist (.gdshader files, VisualShader resources)
-- **UI Specialist**: godot-specialist (no dedicated UI specialist — primary covers all UI)
-- **Additional Specialists**: godot-gdextension-specialist (GDExtension / native C++ bindings only)
-- **Routing Notes**: Invoke primary for architecture decisions, ADR validation, and cross-cutting code review. Invoke C# specialist for code quality, [Signal] delegate patterns, [Export] attributes, .csproj management, and C#-specific Godot idioms. Invoke shader specialist for material design and shader code. Invoke GDExtension specialist only when native C++ plugins are involved.
-
-### File Extension Routing
-
-| File Extension / Type | Specialist to Spawn |
-|-----------------------|---------------------|
-| Game code (.cs files) | godot-csharp-specialist |
-| Shader / material files (.gdshader, VisualShader) | godot-shader-specialist |
-| UI / screen files (Control nodes, CanvasLayer) | godot-specialist |
-| Scene / prefab / level files (.tscn, .tres) | godot-specialist |
-| Project config (.csproj, NuGet) | godot-csharp-specialist |
-| Native extension / plugin files (.gdextension, C++) | godot-gdextension-specialist |
-| General architecture review | godot-specialist |
-```
-
-**Both — GDScript + C#:**
-```markdown
-## Engine Specialists
-- **Primary**: godot-specialist
-- **GDScript Specialist**: godot-gdscript-specialist (.gd files — gameplay/UI scripts)
-- **C# Specialist**: godot-csharp-specialist (.cs files — performance-critical systems)
-- **Shader Specialist**: godot-shader-specialist (.gdshader files, VisualShader resources)
-- **UI Specialist**: godot-specialist (no dedicated UI specialist — primary covers all UI)
-- **Additional Specialists**: godot-gdextension-specialist (GDExtension / native C++ bindings only)
-- **Routing Notes**: Invoke primary for cross-language architecture decisions and which systems belong in which language. Invoke GDScript specialist for .gd files. Invoke C# specialist for .cs files and .csproj management. Prefer signals over direct cross-language method calls at the boundary.
-
-### File Extension Routing
-
-| File Extension / Type | Specialist to Spawn |
-|-----------------------|---------------------|
-| Game code (.gd files) | godot-gdscript-specialist |
-| Game code (.cs files) | godot-csharp-specialist |
-| Cross-language boundary decisions | godot-specialist |
-| Shader / material files (.gdshader, VisualShader) | godot-shader-specialist |
-| UI / screen files (Control nodes, CanvasLayer) | godot-specialist |
-| Scene / prefab / level files (.tscn, .tres) | godot-specialist |
-| Project config (.csproj, NuGet) | godot-csharp-specialist |
-| Native extension / plugin files (.gdextension, C++) | godot-gdextension-specialist |
-| General architecture review | godot-specialist |
-```
+**Load discipline.** On any engine other than Godot, **never load it** — nothing in Sections 4, 5 or 5.5 needs it, and reading it anyway spends the tokens the split exists to save. On Godot, read it once when you first reach Section 4 and keep using it for Sections 5 and 5.5; do not re-read it at each reference.
diff --git a/.claude/skills/setup-engine/references/godot-language-config.md b/.claude/skills/setup-engine/references/godot-language-config.md
new file mode 100644
index 00000000..16ebd6b3
--- /dev/null
+++ b/.claude/skills/setup-engine/references/godot-language-config.md
@@ -0,0 +1,147 @@
+# Godot Language Configuration — setup-engine reference
+
+Lookup tables for `/setup-engine`, split out of the skill body so they cost
+nothing on invocations that are not Godot. Read this file only when the
+chosen engine is Godot, and then only the subsection for the chosen language.
+
+Referenced from Sections 4, 5 and 5.5 of
+`.claude/skills/setup-engine/SKILL.md` by the names A1, A2 and A3.
+
+---
+
+### A1. CLAUDE.md Technology Stack Templates
+
+**GDScript:**
+```markdown
+- **Engine**: Godot [version]
+- **Language**: GDScript
+- **Build System**: SCons (engine), Godot Export Templates
+- **Asset Pipeline**: Godot Import System + custom resource pipeline
+```
+
+> **Guardrail**: When using this GDScript template, write the Language field as exactly "`GDScript`" — no additions. Do NOT append "C++ via GDExtension" or any other language. The C# template below includes GDExtension because C# projects commonly wrap native code; GDScript projects do not.
+
+**C#:**
+```markdown
+- **Engine**: Godot [version]
+- **Language**: C# (.NET 8+, primary), C++ via GDExtension (native plugins only)
+- **Build System**: .NET SDK + Godot Export Templates
+- **Asset Pipeline**: Godot Import System + custom resource pipeline
+```
+
+**Both — GDScript + C#:**
+```markdown
+- **Engine**: Godot [version]
+- **Language**: GDScript (gameplay/UI scripting), C# (performance-critical systems), C++ via GDExtension (native only)
+- **Build System**: .NET SDK + Godot Export Templates
+- **Asset Pipeline**: Godot Import System + custom resource pipeline
+```
+
+---
+
+### A2. Naming Conventions
+
+**GDScript:**
+- Classes: PascalCase (e.g., `PlayerController`)
+- Variables/functions: snake_case (e.g., `move_speed`)
+- Signals: snake_case past tense (e.g., `health_changed`)
+- Files: snake_case matching class (e.g., `player_controller.gd`)
+- Scenes: snake_case matching the file (e.g., `player_controller.tscn`)
+- Constants: UPPER_SNAKE_CASE (e.g., `MAX_HEALTH`)
+
+> **This list and the `naming` enum table in Section 5.5.1 of the skill must
+> agree, value for value.** They are written into two different files —
+> `technical-preferences.md` from here, `project.yaml` from there — and Section
+> 5.5.3 compares them and **stops the skill** on any mismatch. They disagreed on
+> `scenes` (this list said PascalCase, the enum table said snake_case) for the
+> GDScript column only, which halted `/setup-engine` on the most common Godot
+> configuration there is. Changing a value in one place without the other
+> reintroduces that halt.
+
+**C#:**
+- Classes: PascalCase (`PlayerController`) — must also be `partial`
+- Public properties/fields: PascalCase (`MoveSpeed`, `JumpVelocity`)
+- Private fields: `_camelCase` (`_currentHealth`, `_isGrounded`)
+- Methods: PascalCase (`TakeDamage()`, `GetCurrentHealth()`)
+- Signal delegates: PascalCase + `EventHandler` suffix (`HealthChangedEventHandler`)
+- Files: PascalCase matching class (`PlayerController.cs`)
+- Scenes: PascalCase matching root node (`PlayerController.tscn`)
+- Constants: PascalCase (`MaxHealth`, `DefaultMoveSpeed`)
+
+**Both — GDScript + C#:**
+Use GDScript conventions for `.gd` files and C# conventions for `.cs` files. Mixed-language files do not exist — the boundary is per-file. When in doubt about which language a new system should use, ask the user and record the decision in `technical-preferences.md`.
+
+---
+
+### A3. Engine Specialists Routing
+
+**GDScript:**
+```markdown
+## Engine Specialists
+- **Primary**: godot-specialist
+- **Language/Code Specialist**: godot-gdscript-specialist (all .gd files)
+- **Shader Specialist**: godot-shader-specialist (.gdshader files, VisualShader resources)
+- **UI Specialist**: godot-specialist (no dedicated UI specialist — primary covers all UI)
+- **Additional Specialists**: godot-gdextension-specialist (GDExtension / native C++ bindings only)
+- **Routing Notes**: Invoke primary for architecture decisions, ADR validation, and cross-cutting code review. Invoke GDScript specialist for code quality, signal architecture, static typing enforcement, and GDScript idioms. Invoke shader specialist for material design and shader code. Invoke GDExtension specialist only when native extensions are involved.
+
+### File Extension Routing
+
+| File Extension / Type | Specialist to Spawn |
+|-----------------------|---------------------|
+| Game code (.gd files) | godot-gdscript-specialist |
+| Shader / material files (.gdshader, VisualShader) | godot-shader-specialist |
+| UI / screen files (Control nodes, CanvasLayer) | godot-specialist |
+| Scene / prefab / level files (.tscn, .tres) | godot-specialist |
+| Native extension / plugin files (.gdextension, C++) | godot-gdextension-specialist |
+| General architecture review | godot-specialist |
+```
+
+**C#:**
+```markdown
+## Engine Specialists
+- **Primary**: godot-specialist
+- **Language/Code Specialist**: godot-csharp-specialist (all .cs files)
+- **Shader Specialist**: godot-shader-specialist (.gdshader files, VisualShader resources)
+- **UI Specialist**: godot-specialist (no dedicated UI specialist — primary covers all UI)
+- **Additional Specialists**: godot-gdextension-specialist (GDExtension / native C++ bindings only)
+- **Routing Notes**: Invoke primary for architecture decisions, ADR validation, and cross-cutting code review. Invoke C# specialist for code quality, [Signal] delegate patterns, [Export] attributes, .csproj management, and C#-specific Godot idioms. Invoke shader specialist for material design and shader code. Invoke GDExtension specialist only when native C++ plugins are involved.
+
+### File Extension Routing
+
+| File Extension / Type | Specialist to Spawn |
+|-----------------------|---------------------|
+| Game code (.cs files) | godot-csharp-specialist |
+| Shader / material files (.gdshader, VisualShader) | godot-shader-specialist |
+| UI / screen files (Control nodes, CanvasLayer) | godot-specialist |
+| Scene / prefab / level files (.tscn, .tres) | godot-specialist |
+| Project config (.csproj, NuGet) | godot-csharp-specialist |
+| Native extension / plugin files (.gdextension, C++) | godot-gdextension-specialist |
+| General architecture review | godot-specialist |
+```
+
+**Both — GDScript + C#:**
+```markdown
+## Engine Specialists
+- **Primary**: godot-specialist
+- **GDScript Specialist**: godot-gdscript-specialist (.gd files — gameplay/UI scripts)
+- **C# Specialist**: godot-csharp-specialist (.cs files — performance-critical systems)
+- **Shader Specialist**: godot-shader-specialist (.gdshader files, VisualShader resources)
+- **UI Specialist**: godot-specialist (no dedicated UI specialist — primary covers all UI)
+- **Additional Specialists**: godot-gdextension-specialist (GDExtension / native C++ bindings only)
+- **Routing Notes**: Invoke primary for cross-language architecture decisions and which systems belong in which language. Invoke GDScript specialist for .gd files. Invoke C# specialist for .cs files and .csproj management. Prefer signals over direct cross-language method calls at the boundary.
+
+### File Extension Routing
+
+| File Extension / Type | Specialist to Spawn |
+|-----------------------|---------------------|
+| Game code (.gd files) | godot-gdscript-specialist |
+| Game code (.cs files) | godot-csharp-specialist |
+| Cross-language boundary decisions | godot-specialist |
+| Shader / material files (.gdshader, VisualShader) | godot-shader-specialist |
+| UI / screen files (Control nodes, CanvasLayer) | godot-specialist |
+| Scene / prefab / level files (.tscn, .tres) | godot-specialist |
+| Project config (.csproj, NuGet) | godot-csharp-specialist |
+| Native extension / plugin files (.gdextension, C++) | godot-gdextension-specialist |
+| General architecture review | godot-specialist |
+```
diff --git a/.claude/skills/skill-improve/SKILL.md b/.claude/skills/skill-improve/SKILL.md
index c9a0f2bb..08a87f12 100644
--- a/.claude/skills/skill-improve/SKILL.md
+++ b/.claude/skills/skill-improve/SKILL.md
@@ -1,12 +1,20 @@
---
name: skill-improve
-description: "Improve a skill using a test-fix-retest loop. Runs static checks, proposes targeted fixes, rewrites the skill, re-tests, and keeps or reverts based on score change."
+description: "Improve a skill via a test-fix-retest loop — static checks, targeted fixes, keep or revert on score change."
argument-hint: "[skill-name]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Bash
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Skill Improve
Runs an improvement loop on a single skill:
diff --git a/.claude/skills/skill-test/SKILL.md b/.claude/skills/skill-test/SKILL.md
index e6748d86..9ef6294f 100644
--- a/.claude/skills/skill-test/SKILL.md
+++ b/.claude/skills/skill-test/SKILL.md
@@ -1,12 +1,20 @@
---
name: skill-test
-description: "Validate skill files for structural compliance and behavioral correctness. Three modes: static (linter), spec (behavioral), audit (coverage report)."
+description: "Validate skill files for structural compliance and behavioral correctness. Four modes: static linter, spec, category rubric, audit."
argument-hint: "static [skill-name | all] | spec [skill-name] | category [skill-name | all] | audit"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Skill Test
Validates `.claude/skills/*/SKILL.md` files for structural compliance and
@@ -62,10 +70,29 @@ The skill must have ≥2 numbered phase headings. Look for patterns like:
**FAIL** if fewer than 2 phase-like headings are found.
### Check 3 — Verdict Keywords
-The skill must contain at least one of: `PASS`, `FAIL`, `CONCERNS`, `APPROVED`,
-`BLOCKED`, `COMPLETE`, `READY`, `COMPLIANT`, `NON-COMPLIANT`
-**FAIL** if none are present.
+The skill must communicate a clear outcome. Accept any of:
+
+- **Gate / review verdicts** — `PASS`, `FAIL`, `CONCERNS`, `APPROVED`,
+ `BLOCKED`, `COMPLETE`, `READY`, `COMPLIANT`, `NON-COMPLIANT`
+- **Go / no-go verdicts** — `PROCEED`, `PIVOT`, `KILL`, `GO`, `NO-GO`
+- **Severity scales** — `CRITICAL`, `HIGH`, `MEDIUM`, `LOW`. Audit skills rank
+ findings by severity instead of issuing one verdict for the whole run.
+
+**FAIL** if none are present **and** the skill produces an assessment — its
+description or body promises a review, audit, check, gate, or readiness
+judgement.
+
+**WARN** (never FAIL) if none are present and the skill's output is an artifact
+or a value rather than a judgement. `/settings` is the reference case: it prints
+and writes configuration and has no verdict to give. Do not invent one to
+satisfy this check.
+
+> The narrow earlier list (gate verdicts only, hard FAIL) failed 5 of 74 skills
+> for reasons that were not their fault — `/prototype` and `/vertical-slice`
+> advertise `PROCEED`/`PIVOT`/`KILL` in their own descriptions, `/adopt` and
+> `/security-audit` rank by severity, and `/settings` has no verdict by design.
+> A linter that cries wolf on 7% of the corpus stops being read.
### Check 4 — Collaborative Protocol Language
The skill must contain ask-before-write language. Look for:
@@ -120,7 +147,7 @@ Recommended: Add a "Follow-Up Actions" section at the end of the skill.
For `static all`, produce a summary table then list any non-compliant skills:
```
-=== Skill Static Check: All 52 Skills ===
+=== Skill Static Check: All 74 Skills ===
Skill | Result | Issues
-----------------------|--------------|-------
@@ -129,10 +156,20 @@ design-review | COMPLIANT |
story-readiness | WARNINGS | Check 5: no handoff
...
-Summary: 48 COMPLIANT, 3 WARNINGS, 1 NON-COMPLIANT
-Aggregate Verdict: N WARNINGS / N FAILURES
+Summary: 48 COMPLIANT, 3 WARNINGS, 1 NON-COMPLIANT, 1 NOT ASSESSED
+Aggregate Verdict: N WARNINGS / N FAILURES / N NOT ASSESSED
```
+**`NOT ASSESSED` is a per-skill result here, not only an aggregate line.** A skill
+whose file could not be read or parsed, or whose checks could not run, is reported
+as `NOT ASSESSED` with the reason — never omitted from the table and never counted
+as COMPLIANT. Ranked **above COMPLIANT**, **below WARNINGS and NON-COMPLIANT**.
+
+**And state the denominator.** `All 74 Skills` in the header must be the number
+actually examined, not the number that exist: report `[N] of [M] skills checked`
+whenever they differ. A summary whose counts silently sum to less than its own
+title is the failure this skill is supposed to catch in others.
+
---
## Phase 2B: Spec Mode — Behavioral Verifier
@@ -169,6 +206,14 @@ Mark each assertion:
- **PASS** — skill instructions clearly satisfy this assertion
- **PARTIAL** — skill instructions partially address it, but with ambiguity
- **FAIL** — skill instructions would NOT satisfy this assertion given the fixture
+- **NOT ASSESSED** — the assertion could not be evaluated at all: it names a
+ fixture state the spec never defines, depends on runtime behavior no static
+ read can settle, or references a file or section that does not exist. Rank it
+ **above PASS** (an assertion nobody could evaluate has not been satisfied) and
+ **below PARTIAL and FAIL** (an ambiguity somebody identified is more actionable
+ than one nobody could reach). Do not resolve an unevaluable assertion to PASS
+ because the skill "probably" handles it — that judgement is what the spec exists
+ to replace.
For **Protocol Compliance** assertions (always present):
- Check whether the skill requires "May I write" before file writes
@@ -308,8 +353,8 @@ For each agent in catalog's `agents:` section:
=== Skill Test Coverage Audit ===
Date: [date]
-SKILLS (72 total)
-Specs written: 72 (100%) | Never static tested: 72 | Never category tested: 72
+SKILLS (74 total)
+Specs written: 72 (97%) | Never static tested: 74 | Never category tested: 74
Skill | Cat | Has Spec | Last Static | S.Result | Last Cat | C.Result | Priority
-----------------------|----------|----------|-------------|----------|----------|----------|----------
diff --git a/.claude/skills/smoke-check/SKILL.md b/.claude/skills/smoke-check/SKILL.md
index 2f5d073b..b1fb2de7 100644
--- a/.claude/skills/smoke-check/SKILL.md
+++ b/.claude/skills/smoke-check/SKILL.md
@@ -1,12 +1,16 @@
---
name: smoke-check
-description: "Run the critical path smoke test gate before QA hand-off. Executes the automated test suite, verifies core functionality, and produces a PASS/FAIL report. Run after a sprint's stories are implemented and before manual QA begins. A failed smoke check means the build is not ready for QA."
+description: "Critical-path smoke gate before QA hand-off — runs the automated suite. A failed check means the build is not QA-ready."
argument-hint: "[sprint | quick | --platform pc|console|mobile|all]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Bash, Write, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,qa.level,testing.strict`
+
+
+
# Smoke Check
This skill is the gate between "implementation done" and "ready for QA
@@ -21,6 +25,16 @@ Handing a broken build to QA wastes their time and demoralises the team.
---
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`qa.level`**: at `minimal`, smoke-check is **optional** — if
+run, a FAIL is advisory and never blocks hand-off; at `standard`, it is required
+before a phase transition; at `full`, before every commit. This sits in front of
+the Phase 6 `testing.strict.config` resolution (which only matters once a smoke run
+gates). Distinct axis from `workflow`.
+
## Parse Arguments
Arguments can be combined: `/smoke-check sprint --platform console`
@@ -46,17 +60,50 @@ Phase 5 outputs a per-platform verdict table in addition to the overall verdict.
Before running anything, understand the environment:
-1. **Test framework check**: verify `tests/` directory exists.
- If it does not: "No test directory found at `tests/`. Run `/test-setup`
- to scaffold the testing infrastructure, or create the directory manually
- if tests live elsewhere." Then stop.
+0. **Config coherence**: run `bash .claude/scripts/project-coherence.sh`.
+
+ It compares what `project.yaml` declares against the real project file, the
+ installed engine binary, and the files `commands.*` name. This runs first
+ because two of its checks are about *this skill's own inputs*: a
+ `commands.test` naming a runner that does not exist, or a `commands.build`
+ naming an export preset with no `export_presets.cfg`, will fail here and read
+ as a broken build rather than as broken config.
+
+ Report any `[DIFFERS]` lines in the report's Environment section. They do not
+ by themselves decide the verdict -- but a smoke check run against a project
+ whose declared engine is not the installed one is worth saying out loud.
+
+1. **Test framework check**: verify that **game** test files exist — not merely
+ that `tests/` does. Check `tests/unit/`, `tests/integration/` and
+ `tests/smoke/` for actual test files.
+ If none are found, **deliver a NOT ASSESSED verdict — do not merely stop.**
+ "Smoke check: **NOT ASSESSED — no game tests found** under
+ `tests/unit|integration|smoke`. Run `/test-setup` to scaffold the testing
+ infrastructure, or point me at where tests live." Then stop.
+
+ > A bare halt is the wrong shape here.
+ > This is the state with the **least** information about build health, so it is
+ > the last one that should exit without a verdict: the caller gets no
+ > machine-readable outcome, and "the skill said nothing" is easy to read as
+ > "nothing was wrong". Replacing a *wrong* verdict with *no* verdict is not an
+ > improvement either — the honest result is the one that names what could not
+ > be established.
+
+ > **Do not gate on `tests/` existing.** `/test-setup` creates `tests/unit/`
+ > and `tests/integration/` with placeholder files, so the directory tree is
+ > present on any project that ran setup — whether or not a single game test
+ > was ever written. Count actual test files instead. That is not
+ > hypothetical: a fixture with no build and zero game tests passed this step
+ > and went on to score **PASS WITH WARNINGS**.
2. **CI check**: check whether `.github/workflows/` contains a workflow file
referencing tests. Note in the report whether CI is configured.
-3. **Engine detection**: read `.claude/docs/technical-preferences.md` and
- extract the `Engine:` value. Store this for test command selection in
- Phase 2.
+3. **Engine detection**: read `engine.name` from `project.yaml`; if that key
+ is absent or empty (including when `project.yaml` has no `engine:` block),
+ fall back to the `Engine:` value in `.claude/docs/technical-preferences.md`
+ (a `[TO BE CONFIGURED]` value means not configured). Store this for test
+ command selection in Phase 2.
4. **Smoke test list**: check whether `production/qa/smoke-tests.md` or
`tests/smoke/` exists. If a smoke test list is found, load it for use in
@@ -90,16 +137,26 @@ If neither path exists, note: "GDUnit4 runner not found — confirm the runner
path for your test framework."
**Unity:**
-Unity tests require the editor and cannot be run headlessly via shell in most
-environments. Check for recent test result artifacts:
+Unity **can** run tests headlessly via shell. Do not skip to reading artifacts.
+
+First confirm the Unity Test Framework is installed. A project without it does
+not fail cleanly — it **hangs** until something kills it, which is the
+observation the old "Unity cannot test headlessly" advice was generalised from:
+```bash
+grep -q 'com.unity.test-framework' Packages/manifest.json && echo present || echo ABSENT
+```
+If ABSENT, report `NOT ASSESSED — Unity Test Framework not installed` and
+give the one-line fix (add `com.unity.test-framework` to `Packages/manifest.json`).
+**Do not fall through to reading stale artifacts** — an unknown-age XML
+reported as a pass is worse than no gate.
+
+If present, run the suite with an explicit timeout:
```bash
-# List most recent test results (bash) — on Windows PowerShell use the fallback below
-ls -t test-results/ 2>/dev/null | head -5 \
- || powershell -Command "Get-ChildItem test-results/ -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 5 -ExpandProperty Name"
+timeout 900 "<Unity.exe>" -batchmode -runTests -projectPath . -testPlatform EditMode -testResults test-results/results.xml
```
-If test result files exist (XML or JSON), read the most recent one and parse
-PASS/FAIL counts. If no artifacts exist: "Unity tests must be run from the
-editor or CI pipeline. Please confirm test status manually before proceeding."
+Parse `test-results/results.xml` for the `passed` and `failed` counts on the
+`<test-run>` element. **A timeout (exit 124) is a gate FAILURE, never a pass** —
+the run never completed and nothing was verified.
**Unreal Engine:**
```bash
@@ -111,19 +168,23 @@ If no matching log found: "UE automation tests must be run via the Session
Frontend or CI pipeline. Please confirm test status manually."
**Unknown engine / not configured:**
-"Engine not configured in `.claude/docs/technical-preferences.md`. Run
-`/setup-engine` to specify the engine, then re-run `/smoke-check`."
+"Engine not configured in `project.yaml` or
+`.claude/docs/technical-preferences.md`. Run `/setup-engine` to specify the
+engine, then re-run `/smoke-check`."
**If the test runner is not available in this environment** (engine binary not
on PATH, runner script not found, etc.), report clearly:
"Automated tests could not be executed — engine binary not found on PATH.
Status will be recorded as NOT RUN. Confirm test results from your local IDE
-or CI pipeline. Unconfirmed NOT RUN is treated as PASS WITH WARNINGS, not
-FAIL — the developer must manually confirm results."
+or CI pipeline. Until you do, the verdict is NOT ASSESSED — not FAIL, and not
+a pass either: nothing has been observed about this build yet."
-Do not treat NOT RUN as an automatic FAIL. Record it as a warning. The
-developer's manual confirmation in Phase 4 can resolve it.
+Do not treat NOT RUN as an automatic FAIL. Record it, and let the developer's
+manual confirmation in Phase 4 resolve it. Until that confirmation arrives the
+verdict is **NOT ASSESSED** (see the verdict rules in Phase 5), which ranks
+above both pass values and below FAIL. An unrun suite is not a healthy build; it
+is an unknown one, and the two need different follow-ups.
Parse runner output and extract:
- Total tests run
@@ -178,6 +239,15 @@ Draw the smoke test checklist from, in priority order:
3. `tests/smoke/` directory contents (if it exists)
4. The standard fallback list below (used only when none of the above exist)
+**Name the source you used in the report**, on its own line — *"Checklist source:
+`production/qa/smoke-tests.md`"*, or *"Checklist source: standard fallback list —
+no QA plan scope, no `production/qa/smoke-tests.md`, no `tests/smoke/`."* The
+fallback is a real fallback, so nothing is silently skipped here; what was
+missing is that a report drawn from the generic list and one drawn from this
+project's own smoke definitions were indistinguishable. `/gate-check` now
+validates a smoke report's claims against the repo, and it cannot weigh them
+without knowing what the checklist was drawn from.
+
Tailor batches 2 and 3 to the actual systems identified from the sprint or QA
plan. Replace bracketed placeholders with real mechanic names from the current
sprint's stories.
@@ -301,7 +371,7 @@ will determine whether the automated test row contributes to a FAIL verdict."
| Story | Type | Test File | Coverage Status |
|-------|------|-----------|----------------|
| [title] | Logic | `tests/unit/[system]/[slug]_test.[ext]` | COVERED |
-| [title] | Visual/Feel | `tests/evidence/[slug]-screenshots.md` | MANUAL |
+| [title] | Visual/Feel | `production/qa/evidence/[slug]-screenshots.md` | MANUAL |
| [title] | Logic | — | MISSING ⚠ |
| [title] | Config/Data | — | EXPECTED |
@@ -346,7 +416,7 @@ Any platform with one or more FAIL checks contributes to the overall FAIL verdic
---
-### Verdict: [PASS | PASS WITH WARNINGS | FAIL]
+### Verdict: [PASS | PASS WITH WARNINGS | NOT ASSESSED | FAIL]
[Verdict rules — first matching rule wins:]
@@ -355,8 +425,21 @@ Any platform with one or more FAIL checks contributes to the overall FAIL verdic
- Any Batch 1 (core stability) check returned FAIL
- Any Batch 2 (primary sprint mechanic or regression check) returned FAIL
+**NOT ASSESSED** if ANY of:
+- The automated suite is **unconfirmed NOT RUN** — nobody has reported a result
+- A Batch 1 or Batch 2 check could not be executed (no build, engine not
+ configured, platform unavailable) as opposed to executing and failing
+- **Any story's coverage row is `UNKNOWN`** (Phase 3: story file missing or
+ unreadable). A story nobody could read is not a story with no gaps — without
+ this line, a run where *every* row is UNKNOWN and the suite passes matches
+ **PASS**, because PASS only requires "no MISSING entries"
+- **Batch 3 was offered and skipped** ("Performance not checked this session").
+ It is not a FAIL, not an execution failure, and not "PASS or N/A", so without
+ this line it matches no rule at all and renders as `[-]` beside a PASS
+
**PASS WITH WARNINGS** if ALL of:
-- Automated tests PASS or NOT RUN (developer has not yet confirmed)
+- Automated tests PASS, or NOT RUN **and the developer has confirmed the result
+ from their local IDE or CI**
- All Batch 1 and Batch 2 smoke checks PASS
- One or more Logic/Integration stories have MISSING test evidence
@@ -366,6 +449,19 @@ Any platform with one or more FAIL checks contributes to the overall FAIL verdic
- No MISSING test evidence entries
````
+**`NOT ASSESSED` — the build nobody could check.** Rank: it **outranks PASS and
+PASS WITH WARNINGS** and **ranks below FAIL**. A suite that never ran has not
+shown the build is healthy; a suite that ran and failed is the more actionable
+finding and must not be demoted behind one that did not run.
+
+This is a change in where unconfirmed `NOT RUN` lands, and it is deliberate. The
+rule below — **never treat NOT RUN as an automatic FAIL** — is unchanged and
+still correct: NOT ASSESSED is not a FAIL, and it ranks below one. What changes
+is that an unrun suite no longer resolves to a *pass* verdict while waiting for a
+confirmation that may never come. Confirmed NOT RUN (the developer reports the
+result from their own IDE or CI) still lands at PASS WITH WARNINGS, because
+somebody did look.
+
---
## Phase 6: Write and Gate
@@ -376,9 +472,36 @@ Present the full report in conversation, then ask:
Write only after approval.
+**First apply `qa.level` (resolved earlier).** At `qa.level: minimal`, a FAIL is
+**advisory** regardless of `testing.strict.config` — skip the resolution below and
+deliver the advisory-FAIL outcome (smoke-check is optional at minimal and never
+blocks hand-off). Otherwise:
+
+**Resolve the gate enforcement level.** A FAIL verdict either *blocks* QA
+hand-off or is *flagged while hand-off proceeds*, governed by the
+`testing.strict` block **resolved in the resolved-config block at the top of this skill** (which merges
+`project.local.yaml` over `project.yaml` — read that block, not the file, or a
+developer's local override is silently ignored):
+
+1. Take `testing.strict.config` from that resolved block. If its value is `true`
+ (case-insensitive) → blocking; if `false` → advisory; `unset` → fall through.
+2. Else read `testing.strict` as a plain boolean (legacy single-value form) — if
+ its value is `true` or `false`, it applies.
+3. Else default to **blocking** — an unset `testing.strict.config` keeps
+ smoke-check's FAIL gate blocking (behavior unchanged from before this setting
+ existed). Smoke check is a build-health gate, so its unset default is strict
+ even though the `config` test type defaults to advisory elsewhere. The
+ reciprocal carve-out is recorded in `.claude/skills/story-done/SKILL.md` and
+ `.claude/docs/coding-standards.md`, which own the per-story evidence table.
+
+Only `true` and `false` (case-insensitive) are recognized at steps 1–2. A key
+that is present but holds any other value — `maybe`, `1`, `yes`, etc. — is
+treated as unset: continue to the next step, and surface the unrecognized value
+to the user.
+
After writing, deliver the gate verdict:
-**If verdict is FAIL:**
+**If verdict is FAIL and the gate is blocking:**
"The smoke check failed. Do not hand off to QA until these failures are
resolved:
@@ -387,6 +510,37 @@ resolved:
Fix the failures and run `/smoke-check` again to re-gate before QA hand-off."
+**If verdict is FAIL and the gate is advisory** (`testing.strict.config: false`):
+
+"The smoke check failed, but `testing.strict.config` is set to advisory — QA
+hand-off is not blocked. Resolve these before release:
+
+[List each failing automated test or smoke check with a one-line description]
+
+QA hand-off: share `production/qa/qa-plan-[sprint].md` with the qa-tester
+agent to begin manual verification. Re-run `/smoke-check` once the failures
+are fixed."
+
+**If verdict is NOT ASSESSED:**
+
+"The smoke check could not establish build health — it did not fail, it did not
+run. Do not hand off to QA on this result:
+
+[Name each check that could not execute, and why: suite unconfirmed NOT RUN,
+engine binary absent, no build, platform unavailable]
+
+[For each, the one thing that would make it runnable — e.g. 'confirm the suite
+result from your IDE or CI', 'run `/setup-engine`', 'produce a build'.]
+
+Re-run `/smoke-check` once any of those is resolved."
+
+This outcome is **not governed by `testing.strict.config`**. That setting decides
+whether a *failure* blocks hand-off; it has nothing to say about a check that
+never produced a result, and reading an unrun check as advisory-therefore-fine is
+the exact substitution this verdict exists to prevent. Say what could not be
+checked and let the user decide — do not resolve it to either pass or FAIL on
+their behalf.
+
**If verdict is PASS WITH WARNINGS:**
"Smoke check passed with warnings. The build is ready for manual QA.
@@ -408,9 +562,14 @@ agent to begin manual verification."
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
- **Never treat NOT RUN as automatic FAIL** — record it as NOT RUN and let
- the developer confirm status manually. Unconfirmed NOT RUN contributes to
- PASS WITH WARNINGS, not FAIL.
+ the developer confirm status manually. Unconfirmed NOT RUN yields **NOT
+ ASSESSED**, not FAIL — and not a pass verdict either, which is what it used to
+ yield.
- **Never auto-fix failures** — report them and state what must be resolved.
Do not attempt to edit source code or test files.
- **PASS WITH WARNINGS does not block QA hand-off** — it records advisory
diff --git a/.claude/skills/soak-test/SKILL.md b/.claude/skills/soak-test/SKILL.md
index e09c5195..7b324878 100644
--- a/.claude/skills/soak-test/SKILL.md
+++ b/.claude/skills/soak-test/SKILL.md
@@ -1,12 +1,20 @@
---
name: soak-test
-description: "Generate a soak test protocol for extended play sessions. Defines what to observe, measure, and log during long play sessions to surface slow leaks, fatigue effects, and edge cases that only appear after sustained play. Primarily used in Polish and Release phases."
+description: "Soak test protocol for extended play — what to observe and log for slow leaks, fatigue, late-appearing edge cases."
argument-hint: "[duration: 30m | 1h | 2h | 4h] [focus: memory | stability | balance | all]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Soak Test
A soak test (also called an endurance test) is an extended play session run
@@ -53,16 +61,18 @@ human does the actual playing.**
## 2. Load Context
Read:
-- `.claude/docs/technical-preferences.md` — engine (for engine-specific memory
- monitoring guidance), performance budgets (memory ceiling, target FPS)
+- `project.yaml` — `engine.name` (for engine-specific memory monitoring
+ guidance) and `performance.*` budgets (memory ceiling, target FPS); for any
+ key absent or empty (including when `project.yaml` has no `performance` or
+ `engine` block), fall back to `.claude/docs/technical-preferences.md`
- `design/gdd/game-concept.md` — intended session length (for comparison against
soak duration), core loop description
-- Most recent file in `production/playtests/` — prior playtest findings
+- Most recent file in `production/qa/playtests/` — prior playtest findings
(to avoid re-documenting known issues)
- Most recent file in `production/qa/qa-plan-*.md` — current sprint test coverage
(to understand what has been formally tested vs. what the soak covers)
-Note any performance budget targets from technical-preferences.md:
+Note any performance budget targets (`performance.*` from `project.yaml`, else `.claude/docs/technical-preferences.md`):
- Memory ceiling: [N MB, or "not set"]
- Target FPS: [N, or "not set"]
- Frame budget: [N ms, or "not set"]
@@ -87,26 +97,46 @@ Phase 4.
### Memory / Stability observation items (if focus = memory or all)
-Engine-specific monitoring guidance:
+Engine-specific monitoring guidance.
+
+> **Record the unit the tool shows; never convert, and never assume one.**
+> A soak test looks for **growth**, so every threshold below is a *ratio or a
+> delta against this session's own T+0 baseline* — which is unit-agnostic and
+> stays correct however the editor reports the number. Write the unit down at
+> T+0 exactly as displayed and use it consistently for the rest of the run.
+>
+> This replaces a note asserting the return units of
+> `Performance.get_monitor` — **NOT SOURCEABLE from `docs/engine-reference/`**,
+> the identifier appears nowhere in it — a claim that sat one line under a row asking
+> the tester to record "Static Memory (**KB**)". A wrong units claim in a leak
+> detector is off by 1024× in the one measurement the protocol exists to take,
+> and it would read as a plausible instruction throughout. Deltas need no such
+> claim, so the safest fix was to stop needing it.
**Godot 4:**
- Open Debugger → Monitors tab; track `Memory → Static Memory` and
`Object Count → Objects` across checkpoints
-- Record: Static Memory (KB), Object Count, Orphan Nodes count
+- Record: Static Memory (**unit as displayed**), Object Count, Orphan Nodes count
- Alert threshold: Memory growth > 20% from T+0 after the first 15 minutes
(some growth on load is expected; sustained growth indicates a leak)
-- Note: `Performance.get_monitor(Performance.MEMORY_STATIC)` returns bytes
- in Godot 4.6
+- **Orphan Nodes is the one absolute number worth watching**: it should return to
+ its T+0 value after a scene unload. A ratio hides that; a non-zero floor that
+ keeps rising is a leak regardless of units
**Unity:**
- Open Memory Profiler (Window → Analysis → Memory Profiler)
-- Record: Total Reserved Memory (MB), GC Allocated (MB), Object Count at each checkpoint
-- Alert threshold: GC Allocated growing monotonically across 3+ checkpoints
+- Record: Total Reserved Memory, GC Allocated, Object Count at each checkpoint
+ (**units as displayed**)
+- Alert threshold: GC Allocated growing monotonically across 3+ checkpoints —
+ a monotonicity check, deliberately unit-free
**Unreal Engine:**
- Use `stat memory` console command at each checkpoint
-- Record: Physical Memory Used (MB), Physical Memory Available
-- Alert threshold: Physical Memory Used growth > 50MB over the full soak
+- Record: Physical Memory Used, Physical Memory Available (**units as displayed**)
+- Alert threshold: Physical Memory Used growth **> 20% over the full soak**,
+ measured against this run's T+0. The previous threshold was an absolute
+ "> 50MB", which silently assumes both the unit *and* a project scale — 50MB is
+ a rounding error for one game and a catastrophe for another
### Stability observation items (if focus = stability or all)
@@ -235,12 +265,26 @@ Difficulty arc: [appropriate / too easy throughout / difficulty spike at T+N]
---
-## Verdict: PASS / PASS WITH CONCERNS / FAIL
+## Verdict: PASS / PASS WITH CONCERNS / NOT ASSESSED / FAIL
**PASS**: No leaks detected, stability maintained, fun factor consistent
**PASS WITH CONCERNS**: Minor drift or fatigue noted; addressable in Polish
+**NOT ASSESSED**: The soak did not run to a length that could show what it looks
+for — say how far it got and which checkpoints were never reached
**FAIL**: Memory leak confirmed, stability breach, or severe fun fatigue
+> **A short soak cannot return PASS.** Everything this protocol exists to detect
+> — slow leaks, fatigue, late-appearing edge cases — is by definition invisible
+> early, so a session that ended before the checkpoints it was built around has
+> not shown stability; it has shown nothing yet. Record `NOT ASSESSED — reached
+> T+[N] of [duration]; checkpoints [list] not reached`. Ranks **above both pass
+> values** and **below FAIL**: a crash observed at T+20 is a real finding no
+> matter how short the run, and must not be demoted behind the run's length.
+> The same applies when the build crashed for reasons unrelated to the soak, when
+> no memory instrumentation was available (nothing was measured, so "no leaks
+> detected" means "no leaks could have been detected"), or when the protocol was
+> written but never executed — a protocol document is not a result.
+
---
## Sign-Off
diff --git a/.claude/skills/sprint-plan/SKILL.md b/.claude/skills/sprint-plan/SKILL.md
index 65254a94..9a8dcabb 100644
--- a/.claude/skills/sprint-plan/SKILL.md
+++ b/.claude/skills/sprint-plan/SKILL.md
@@ -1,47 +1,110 @@
---
name: sprint-plan
-description: "Generates a new sprint plan or updates an existing one based on the current milestone, completed work, and available capacity. Pulls context from production documents and design backlogs."
+description: "New or updated sprint plan from the current milestone, completed work, and available capacity."
argument-hint: "[new|update|status] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, Agent, AskUserQuestion
model: sonnet
-context: |
- !ls production/sprints/ 2>/dev/null
+---
+
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,story_granularity,workflow`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
+## Existing Sprints
+
+!`ls production/sprints/ 2>/dev/null || echo "(no production/sprints/ directory yet)"`
+
+Resolved before this skill runs — use it to identify the previous sprint in
+Phase 1 rather than re-globbing.
+
---
## Phase 0: Parse Arguments
-Extract the mode argument (`new`, `update`, or `status`) and resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
+Extract the mode argument (`new`, `update`, or `status`).
+
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
-See `.claude/docs/director-gates.md` for the full check pattern.
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**`story_granularity`** — it sets how
+many stories to allocate per sprint, scaled by velocity: **2–4** at `coarse`,
+**6–10** at `balanced` (default), **15–25** at `fine`.
**Review mode check** (before gates run):
-- Read `production/review-mode.txt` if it exists. Use that mode.
-- If the file doesn't exist and this is a `new` sprint: use `AskUserQuestion`:
+- The review mode was already resolved in steps 1–4 above — do not re-resolve it.
+- **Special case:** if steps 1–3 all found nothing configured (no `--review`
+ flag, no `modes.review_mode` in `project.yaml`, no `production/review-mode.txt`)
+ **and** this is a `new` sprint, do not silently take the step-4 `lean` default
+ — instead use `AskUserQuestion`:
- Prompt: "No review mode is set. Which review depth would you like for this sprint?"
- Options:
- `[A] full — spawn all director and lead gates`
- `[B] lean — skip non-phase-gate director reviews (recommended for most sprints)`
- `[C] solo — skip all gate spawning`
- - After selection: write `production/review-mode.txt` with the chosen mode. Say: "Review mode set to [mode] and saved to production/review-mode.txt."
-- If the file doesn't exist and this is NOT a `new` sprint (e.g., updating an existing sprint): default to `lean` silently.
+ - After selection: dual-write the chosen mode — set `modes.review_mode` in `project.yaml` (primary; add the `modes:` block if absent) AND write `production/review-mode.txt` (legacy fallback). Say: "Review mode set to [mode] and saved to project.yaml (and production/review-mode.txt)."
+- In every other case the value resolved in steps 1–4 stands (for a non-`new`
+ sprint with nothing configured, that is the `lean` default).
+
+> **Do not write until Phase 1 confirms the sprint can be planned.** This write
+> lands in Phase 0, before the Phase 1 backlog check that aborts the run —
+> observed live: the run correctly BLOCKED on "No stories found under
+> `production/epics/`" and `project.yaml` had *already* gained
+> `review_mode: lean`. A skill that decides it cannot run must not have edited
+> config on the way to deciding. Hold the selection in memory, complete Phase 1,
+> and write only if planning proceeds.
+> **Confirm the destination before writing.** The question above asks for review
+> depth "for this sprint"; the write is permanent project config on a
+> rigor-fronted knob. Ask explicitly: "Set `modes.review_mode: [mode]` in
+> `project.yaml` (persists beyond this sprint), or use it for this sprint only?"
---
## Phase 1: Gather Context
-1. **Read the current milestone** from `production/milestones/`.
+1. **Read the current milestone** from `production/milestones/` **if it exists**.
+ No skill writes this directory — it is authored by hand from
+ `.claude/docs/templates/milestone-definition.md`. On the majority of projects
+ it is absent, which is the normal state, not a gap: note "no milestone
+ defined — planning against the story backlog alone" and continue. Never block
+ sprint planning on it, and never infer a milestone from the sprint files.
2. **Read the previous sprint** (if any) from `production/sprints/` to
understand velocity and carryover.
-3. **Scan design documents** in `design/gdd/` for features tagged as ready
- for implementation.
-
-4. **Check the risk register** at `production/risk-register/`.
+3. **Find the stories to plan** — this is the actual backlog, and it is the one
+ input this phase cannot do without:
+ ```
+ Glob production/epics/**/story-*.md
+ Grep pattern="^> \*\*Status\*\*" glob="production/epics/**/story-*.md" output_mode="content"
+ ```
+ Stories live at `production/epics/[epic-slug]/story-NNN-[slug].md` — that is
+ where `/create-stories` writes them and where `/dev-story` looks for them. Plan
+ from the ones marked `Ready`. Use the grep rather than reading each story: at
+ this stage you need status and title, not the body.
+
+ If the glob returns nothing: "No stories found under `production/epics/`. Run
+ `/create-stories` first (at `standard`/`full`, `/create-epics` before it)."
+ Do not proceed to invent work items — a sprint plan that references stories
+ which do not exist cannot be implemented.
+
+4. **Scan design documents** in `design/gdd/` for additional context on the
+ features those stories implement. At `workflow: minimal` there are no
+ per-system GDDs — use `design/game-brief.md` instead, and do not treat the
+ absent GDDs as missing work. (Note: `/sprint-plan` is **optional** at
+ `minimal` — the brief's Build order already is the plan.)
+
+5. **Check the risk register** at `production/risk-register/` **if it exists**.
+ Like the milestone above, no skill writes it — entries are authored by hand
+ from `.claude/docs/templates/risk-register-entry.md`. If the directory is
+ absent, say so once ("no risk register — risks assessed from the sprint
+ contents only") rather than skipping risk assessment silently.
---
@@ -49,7 +112,7 @@ See `.claude/docs/director-gates.md` for the full check pattern.
For `new`:
-**Generate a sprint plan** following this format and present it to the user. Do NOT ask to write yet — the producer feasibility gate (Phase 4) runs first and may require revisions before the file is written.
+**Generate a sprint plan** following this format and present it to the user. Do NOT ask to write yet — the gate phases run first and may require revisions before the file is written: the producer feasibility gate (Phase 4, spawned only in `full` review mode — skipped in `lean`/`solo`) and the QA plan check (Phase 5, all modes).
```markdown
# Sprint [N] — [Start Date] to [End Date]
@@ -153,7 +216,7 @@ After generating a new sprint plan, also prepare the `production/sprint-status.y
This is the machine-readable source of truth for story status — read by
`/sprint-status`, `/story-done`, and `/help` without markdown parsing.
-**Do not write the yaml yet** — hold it in context. The producer feasibility gate (Phase 4) may revise the story list. Both files will be written together after Phase 4 in a single write approval.
+**Do not write the yaml yet** — hold it in context. The producer feasibility gate (Phase 4, `full` review mode only) may revise the story list; the QA plan check (Phase 5) runs in every mode. Both files are written together after Phase 5 in a single write approval.
Format:
@@ -179,7 +242,7 @@ updated: "[YYYY-MM-DD]"
stories:
- id: "[epic-story, e.g. 1-1]"
name: "[story name]"
- file: "[production/stories/path.md]"
+ file: "[production/epics/[epic-slug]/story-NNN-[slug].md]" # the real path, verbatim from the Glob above
priority: must-have # must-have | should-have | nice-to-have
status: ready-for-dev # backlog | ready-for-dev | in-progress | review | done | blocked
owner: ""
@@ -205,7 +268,7 @@ stories that haven't changed, add new stories, remove dropped ones.
- `lean` → skip (not a PHASE-GATE). Note: "PR-SPRINT skipped — Lean mode." Proceed to Phase 5 (QA plan gate).
- `full` → spawn as normal.
-Before finalising the sprint plan, spawn `producer` via Task using gate **PR-SPRINT** (`.claude/docs/director-gates.md`).
+Before finalising the sprint plan, spawn `producer` via `Agent` using gate **PR-SPRINT** (`.claude/docs/director-gates/pr-sprint.md`).
Pass: proposed story list (titles, estimates, dependencies), total team capacity in hours/days, any carryover from the previous sprint, milestone constraints and deadline.
@@ -273,9 +336,9 @@ After the sprint plan is written and QA plan status is resolved:
- `/sprint-status` — check progress mid-sprint
- `/scope-check [epic]` — verify no scope creep before implementation begins
-**Review mode configuration:** All director gates (producer feasibility, QA review, code review) respect the project review mode. The review mode is set in Phase 0 when the file does not exist (for `new` sprints), or can be overridden per-run with `--review full|lean|solo` as an argument. The file `production/review-mode.txt` contains one of:
-- `lean` — skip automated director gates (default if file is absent — fastest for solo dev)
+**Review mode configuration:** All director gates (producer feasibility, QA review, code review) respect the project review mode, resolved by the Phase 0 chain (`--review` flag → `modes.review_mode` in `project.yaml` → `production/review-mode.txt` → the `modes.rigor` expansion, which yields `lean` at standard rigor and `solo` at minimal). For a `new` sprint with nothing configured, Phase 0 prompts for it and dual-writes the choice. The mode is one of:
+- `lean` — skip non-phase-gate director gates (default — fastest for solo dev)
- `full` — run all director gates as spawned sub-agents
-- `solo` — skip all gates unconditionally (single-developer, no review)
+- `solo` — skip all gate spawning unconditionally (single developer, no review)
-This file is read by `/sprint-plan`, `/story-readiness`, `/story-done`, and other skills at startup.
+`modes.review_mode` in `project.yaml` is the primary source; `production/review-mode.txt` is the legacy fallback. Both are read by `/sprint-plan`, `/story-readiness`, `/story-done`, and other gate-using skills at startup.
diff --git a/.claude/skills/sprint-status/SKILL.md b/.claude/skills/sprint-status/SKILL.md
index 0f82f4d7..09875006 100644
--- a/.claude/skills/sprint-status/SKILL.md
+++ b/.claude/skills/sprint-status/SKILL.md
@@ -1,12 +1,16 @@
---
name: sprint-status
-description: "Fast sprint status check. Reads the current sprint plan, scans story files for status, and produces a concise progress snapshot with burndown assessment and emerging risks. Run at any time during a sprint for quick situational awareness. Use when user asks 'how is the sprint going', 'sprint update', 'show sprint progress'."
+description: "Fast, concise sprint snapshot — burndown and emerging risks for situational awareness. 'How is the sprint going?'"
argument-hint: "[sprint-number or blank for current]"
user-invocable: true
allowed-tools: Read, Glob, Grep
model: haiku
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys story_granularity`
+
+
+
# Sprint Status
This is a fast situational awareness check, not a sprint review. It reads the
@@ -17,6 +21,10 @@ concise snapshot in under 30 lines. For detailed sprint management, use
**This skill is read-only.** It never proposes changes, never asks to write
files, and makes at most one concrete recommendation.
+**`story_granularity`** — it sets the
+grain of the burn-down read: **feature-sized** chunks at `coarse`, **task-sized**
+at `balanced` (default), **AC-sized** at `fine`.
+
---
## 1. Find the Sprint
@@ -74,7 +82,7 @@ fall back to markdown scanning:
When using the fallback, add a note at the bottom of the output:
"⚠ No `sprint-status.yaml` found — status inferred from markdown. Run `/sprint-plan update` to generate one."
-Optionally (fast check only — do not do a deep scan): grep `src/` for a
+Optionally (fast check only — do not do a deep scan): grep the code root for a
directory or file name that matches the story's system slug to check for
implementation evidence. This is a hint only, not a definitive status.
@@ -82,10 +90,22 @@ implementation evidence. This is a hint only, not a definitive status.
After collecting status for all stories, check each IN PROGRESS story for staleness:
-- For each story that has a referenced file, read the file and look for a
- `Last Updated:` field in the frontmatter or header (e.g., `Last Updated: 2026-04-01`
- or `updated: 2026-04-01`). Accept any reasonable date field name: `Last Updated`,
- `Updated`, `last-updated`, `updated_at`.
+- Resolve the dates with **one grep across the story set, not a read per story**
+ — a date is a single line, and opening every in-progress story to find it is
+ the whole cost of this check:
+ ```
+ Grep pattern="\*{0,2}(Last Updated|Updated|last-updated|updated_at)\*{0,2}[[:space:]]*:" glob="production/epics/**/story-*.md" output_mode="content"
+ ```
+ That one pattern accepts every field-name variant. A story with no match has
+ **no date**, which is not the same as being stale — report it as "never
+ stamped" and do not compute an age for it.
+
+> **The `\*{0,2}` wrappers are why this works at all.** `/create-stories` emits
+> `> **Last Updated**: …`, so a pattern requiring `:` immediately after the word
+> matched no story ever written. Combined with the "no match = never stamped"
+> rule directly above — which is correct in itself — the failure was completely
+> silent: every in-progress story reported as never stamped, and stale-story
+> detection never once fired. A bare `Updated:` anchor will regress it.
- Calculate days since that date using today's date.
- If the date is more than 4 days ago, flag the story as **STALE**. (4-day threshold accounts for weekends — a story last touched on Friday won't appear stale until Wednesday.)
- If no date field is found in the story file, note "no timestamp — cannot check staleness."
diff --git a/.claude/skills/start/SKILL.md b/.claude/skills/start/SKILL.md
index 0cb102dc..30d2e5d9 100644
--- a/.claude/skills/start/SKILL.md
+++ b/.claude/skills/start/SKILL.md
@@ -1,28 +1,53 @@
---
name: start
-description: "First-time onboarding — asks where you are, then guides you to the right workflow. No assumptions."
+description: "First-time onboarding — asks where you are, then guides you to the right workflow."
argument-hint: "[no arguments]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion
model: sonnet
---
# Guided Onboarding
-This skill writes one file: `production/review-mode.txt` (review mode config set in Phase 3b).
+This skill writes `project.yaml` — the `project.stage`, `modes.rigor` and
+`modes.automation` settings — plus one legacy mirror, `production/stage.txt`,
+for backward compatibility with hooks that have not migrated. `modes.rigor` and
+`modes.automation` have no legacy mirror; they are written to `project.yaml`
+only.
+
+> **`/start` never writes `modes.review_mode`, in either location.** It is a
+> rigor-fronted knob: writing it explicitly pins it and shadows the `modes.rigor`
+> expansion, so the Phase 3d question would stop changing director-review depth
+> (see Phase 3d, and the same rule in `project.yaml`'s header comment). It must
+> **not** write `production/review-mode.txt` either — the legacy step sits
+> **above** the rigor expansion in the resolution chain, deliberately, so a genuine
+> v1.0 project's explicit choice survives migration. On a new project that
+> ordering works against you: a mirror file written here would outrank the
+> expansion permanently. Verified: `rigor: minimal` plus a `review-mode.txt`
+> containing `lean` resolves to `lean`, not the expected `solo`.
This skill is the entry point for new users. It does NOT assume you have a game idea, an engine preference, or any prior experience. It asks first, then routes you to the right workflow.
---
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). **Note**: on a fresh project no
+`modes.automation` is set yet, so `/start` runs collaboratively — it is
+creating the config. Its core onboarding questions (starting point, rigor,
+automation) are project-shaping and always prompt regardless
+of mode. Engine choice is **not** among them — it is deferred to
+`/setup-engine`, which Phase 4 hands off to.
+If `/start` is re-run on an already-configured project, the resolved mode
+applies per `.claude/docs/automation-modes.md`.
+
## Phase 1: Detect Project State
Before asking anything, silently gather context so you can tailor your guidance. Do NOT show these results unprompted — they inform your recommendations, not the conversation opener.
Check:
-- **Engine configured?** Read `.claude/docs/technical-preferences.md`. If the Engine field contains `[TO BE CONFIGURED]`, the engine is not set.
-- **Game concept exists?** Check for `design/gdd/game-concept.md`.
-- **Source code exists?** Glob for source files in `src/` (`*.gd`, `*.cs`, `*.cpp`, `*.h`, `*.rs`, `*.py`, `*.js`, `*.ts`).
+- **Engine configured?** Read `engine.name` from `project.yaml`; if that key is absent or empty (including when `project.yaml` has no `engine:` block), fall back to `.claude/docs/technical-preferences.md` (an Engine field of `[TO BE CONFIGURED]`, or no file, means not set). The engine is configured if either source yields a real engine name.
+- **Game concept exists?** Check for `design/gdd/game-concept.md` (or `design/game-brief.md` at the `minimal` tier).
+- **Source code exists?** Resolve the code root from the `engine.name` read above (`src/` Godot, `Assets/` Unity, `Source/` Unreal; full order in `.claude/docs/code-root-resolution.md`), then Glob it for source files (`*.gd`, `*.cs`, `*.cpp`, `*.h`, `*.rs`, `*.py`, `*.js`, `*.ts`). **If the code root is unresolved, say so rather than concluding there is no code** — a Unity or Unreal project scanned as `src/` returns zero files and reads as greenfield.
- **Prototypes exist?** Check for subdirectories in `prototypes/`.
- **Design docs exist?** Count markdown files in `design/gdd/`.
- **Production artifacts?** Check for files in `production/sprints/` or `production/milestones/`.
@@ -53,60 +78,32 @@ Wait for the user's selection. Do not proceed until they respond.
The user needs creative exploration before anything else.
1. Acknowledge that starting from zero is completely fine
-2. Briefly explain what `/brainstorm` does (guided ideation using professional frameworks — MDA, player psychology, verb-first design). Mention that it has two modes: `/brainstorm open` for fully open exploration, or `/brainstorm [hint]` if they have even a vague theme (e.g., "space", "cozy", "horror").
+2. Briefly explain what `/brainstorm` does: it turns "no idea" into a written design your next step can build from. Mention that it has two modes: `/brainstorm open` for fully open exploration, or `/brainstorm [hint]` if they have even a vague theme (e.g., "space", "cozy", "horror").
+
+ > **Describe it tier-neutrally here.** Phase 3d has not run, so you do not yet
+ > know how much process this project wants — and `/brainstorm` changes shape
+ > completely on that answer. At `minimal` it runs a short Lean Brief flow and
+ > stops, producing a one-page `design/game-brief.md`; at `standard`/`full` it
+ > runs the full ideation walk (MDA, player psychology, verb-first design) and
+ > produces the concept document. Naming the full walk here, then having Phase 4
+ > describe the same skill as "produce the one-page brief", gives the user two
+ > contradicting accounts of one skill inside a single `/start` run. Phase 4 is
+ > where the tier-specific description belongs.
3. Recommend running `/brainstorm open` as the next step, but invite them to use a hint if something comes to mind
-4. Show the recommended path:
- **Concept phase:**
- - `/brainstorm open` — discover your game concept
- - `/setup-engine` — configure the engine (brainstorm will recommend one)
- - `/prototype` — throwaway concept build: validate the core idea is fun before designing (1–3 days)
- - `/art-bible` — define visual identity (uses the Visual Identity Anchor brainstorm produces)
- - `/map-systems` — decompose the concept into systems
- - `/design-system` — author a GDD for each MVP system
- - `/review-all-gdds` — cross-system consistency check
- - `/gate-check` — validate readiness before architecture work
- **Architecture phase:**
- - `/create-architecture` — produce the master architecture blueprint and Required ADR list
- - `/architecture-decision (×N)` — record key technical decisions, following the Required ADR list
- - `/create-control-manifest` — compile decisions into an actionable rules sheet
- - `/architecture-review` — validate architecture coverage
- **Pre-Production phase:**
- - `/ux-design` — author UX specs for key screens (main menu, HUD, core interactions)
- - `/vertical-slice` — production-quality end-to-end build to validate the full game loop
- - `/playtest-report (×1+)` — document each vertical slice playtest session
- - `/create-epics` — map systems to epics
- - `/create-stories` — break epics into implementable stories
- - `/sprint-plan` — plan the first sprint
- **Production phase:** → pick up stories with `/dev-story`
+4. Name the **immediate next step only** — `/brainstorm open`. Do not list the
+ full pipeline here. Phase 3d has not yet asked how much process the user
+ wants, and that answer changes the path substantially. Say: "I'll lay out the
+ full path once I know how much process you want — two quick questions away."
#### If B: Vague idea
1. Ask them to share their vague idea — even a few words is enough
2. Validate the idea as a starting point (don't judge or redirect)
3. Recommend running `/brainstorm [their hint]` to develop it
-4. Show the recommended path:
- **Concept phase:**
- - `/brainstorm [hint]` — develop the idea into a full concept
- - `/setup-engine` — configure the engine
- - `/prototype` — throwaway concept build: validate the core idea is fun before designing (1–3 days)
- - `/art-bible` — define visual identity (uses the Visual Identity Anchor brainstorm produces)
- - `/map-systems` — decompose the concept into systems
- - `/design-system` — author a GDD for each MVP system
- - `/review-all-gdds` — cross-system consistency check
- - `/gate-check` — validate readiness before architecture work
- **Architecture phase:**
- - `/create-architecture` — produce the master architecture blueprint and Required ADR list
- - `/architecture-decision (×N)` — record key technical decisions, following the Required ADR list
- - `/create-control-manifest` — compile decisions into an actionable rules sheet
- - `/architecture-review` — validate architecture coverage
- **Pre-Production phase:**
- - `/ux-design` — author UX specs for key screens (main menu, HUD, core interactions)
- - `/vertical-slice` — production-quality end-to-end build to validate the full game loop
- - `/playtest-report (×1+)` — document each vertical slice playtest session
- - `/create-epics` — map systems to epics
- - `/create-stories` — break epics into implementable stories
- - `/sprint-plan` — plan the first sprint
- **Production phase:** → pick up stories with `/dev-story`
+4. Name the **immediate next step only** — `/brainstorm [their hint]`. Do not
+ list the full pipeline here; Phase 3d has not yet asked how much process the
+ user wants, and that answer changes the path. Say: "I'll lay out the full
+ path once I know how much process you want — two quick questions away."
#### If C: Clear concept
@@ -116,29 +113,10 @@ The user needs creative exploration before anything else.
- **Options**:
- `Formalize it first` — Run `/brainstorm [concept]` to structure it into a proper game concept document
- `Jump straight in` — Go to `/setup-engine` now and write the GDD manually afterward
-3. Show the recommended path:
- **Concept phase:**
- - `/brainstorm` or `/setup-engine` — (their pick from step 2)
- - `/prototype` — throwaway concept build: validate the core idea is fun before designing (1–3 days)
- - `/art-bible` — define visual identity (after brainstorm if run, or after concept doc exists)
- - `/design-review` — validate the concept doc
- - `/map-systems` — decompose the concept into individual systems
- - `/design-system` — author a GDD for each MVP system
- - `/review-all-gdds` — cross-system consistency check
- - `/gate-check` — validate readiness before architecture work
- **Architecture phase:**
- - `/create-architecture` — produce the master architecture blueprint and Required ADR list
- - `/architecture-decision (×N)` — record key technical decisions, following the Required ADR list
- - `/create-control-manifest` — compile decisions into an actionable rules sheet
- - `/architecture-review` — validate architecture coverage
- **Pre-Production phase:**
- - `/ux-design` — author UX specs for key screens (main menu, HUD, core interactions)
- - `/vertical-slice` — production-quality end-to-end build to validate the full game loop
- - `/playtest-report (×1+)` — document each vertical slice playtest session
- - `/create-epics` — map systems to epics
- - `/create-stories` — break epics into implementable stories
- - `/sprint-plan` — plan the first sprint
- **Production phase:** → pick up stories with `/dev-story`
+3. Name the **immediate next step only** — their pick from step 2. Do not list
+ the full pipeline here; Phase 3d has not yet asked how much process the user
+ wants, and that answer changes the path. Say: "I'll lay out the full path
+ once I know how much process you want — two quick questions away."
#### If D: Existing work
@@ -167,9 +145,38 @@ The user needs creative exploration before anything else.
---
-## Phase 3c: Write Initial Stage File
+## Phase 3c: Write Initial Stage
+
+After confirming the starting path, write the initial stage to BOTH `project.yaml` (primary) AND `production/stage.txt` (legacy fallback for hooks that haven't migrated yet). Create the `production/` directory if it does not exist.
+
+In `project.yaml`, ensure a `project:` block exists with `stage: [value]`.
+- **If `project.yaml` already exists**: Read it first (the Edit tool requires the
+ file to have been read in this session), then use the Edit tool to add/update
+ the `project:` block, placing it immediately after the `framework:` block.
+- **If `project.yaml` does not exist** at the repo root: create it with the Write
+ tool using this v1.1 minimal template (replace `[value]` and the date):
+ ```yaml
+ # CCGS project configuration — single source of truth for project settings.
+ # Schema: grep the `## <key>` section of .claude/docs/effects-map.md —
+ # it is ~31k tokens whole, ~900 per section. Do not open it entire.
+
+ schema_version: 1
+
+ framework:
+ version: 1.1.0
+ last_upgraded: <YYYY-MM-DD>
+
+ project:
+ stage: [value]
+ ```
+ **Do not seed `modes.review_mode` here.** It is a rigor-fronted knob —
+ `modes.rigor` supplies its value, so an explicit value here would shadow the
+ rigor expansion and pin the review mode regardless of the rigor the user picks
+ in Phase 3d. `modes.rigor` itself is omitted for a related reason: Phase 3d skips
+ its question when the key is already set, so seeding it would suppress that
+ question. Tests Y.3 and Y.6 lock both in.
-After confirming the starting path (and before asking about review mode), write the initial stage to `production/stage.txt`. Create the `production/` directory if it does not exist.
+Then also write the same single-line stage name to `production/stage.txt` (no trailing newline) so legacy tooling still works.
Stage mapping:
- **Path A, B, or C (starting from scratch)**: write `Concept`
@@ -177,40 +184,156 @@ Stage mapping:
- **Path D, existing project with GDDs but no architecture documents**: write `Systems Design`
- **Path D, existing project with full architecture (ADRs, architecture doc)**: write `Technical Setup`
-Do this silently — no "May I write?" needed for this single-line file.
+Do this silently — no "May I write?" needed for these stage anchors.
-Say: "I've set `production/stage.txt` to `[stage]` — this anchors your status line and stage detection."
+Say: "I've set `project.stage` to `[stage]` (and updated `production/stage.txt`) — this anchors your status line and stage detection."
---
-## Phase 3b: Set Review Mode
+## Phase 3d: Set Rigor
+
+Check whether `modes.rigor` is already set in `project.yaml`. **If it is**, show
+it — "Rigor is set to `[current]`." — and proceed to **Phase 3e**. Do not ask
+again. Either way, **carry the resolved value forward** — Phase 4 branches its
+recommended path on it.
+
+**If it is not set**: first pick a recommendation, then ask.
+
+**Seed the recommendation** from what the user described in Phase 2, using the
+archetype presets in `.claude/docs/settings-guidance.md § 2–3`:
+- Map their concept to an archetype (e.g. "open-world RPG with crafting and
+ factions" → systems-heavy → `full`; "a small weekend puzzler" → `minimal`).
+- If the user has **no concept at all** (Path A, or a Path B hint with nothing in
+ §3's signal table), recommend the jam/prototype option (`minimal`) and add:
+ "You can raise this after `/brainstorm` once the concept is clearer —
+ `/settings` changes it anytime."
+- **A Path B hint still counts as a description.** "Still exploring" is about
+ having no signal, not about which path the user picked. If the vague idea trips
+ §3's signals — "some kind of open-world survival sim" hits open-world, sim and
+ survival — seed from the signal, not from the path, and say why in the user's
+ own terms. Recommending `minimal` for a described systems-heavy game is the
+ mismatch Phase 4 would then have to flag, caused here.
+- If nothing in the description points either way, recommend the middle option
+ (`standard`, the documented default).
+
+Then use `AskUserQuestion`. Order the options so the **recommended** archetype is
+first and append ` (Recommended)` to its label (per the AskUserQuestion
+convention); the other two follow in any order.
+
+- **Prompt**: "What best describes what you're building? This sets how much process
+ the project carries — you can change it anytime with `/settings`."
+- **Options** (base labels — the recommended one also gets ` (Recommended)`):
+ - `Jam / prototype / first game` — Short docs, coarse stories, evidence optional. **~4 steps to your first line of code instead of ~18.** Shipping beats recording; design lives in your head. The trade: no GDDs, so design problems surface in code rather than before it.
+ - `Several systems that affect each other` — Balanced docs, normal story size, standard QA evidence. **Expect ~8 design documents and roughly an hour of design work before your first line of code.** Worth paying when systems interact and a design mistake is expensive to unpick once it is in code. **Intending to finish is not the test** — most small games ship faster on the jam path and can move up later with `/settings`.
+ - `Big systems-heavy or team project` — Thorough docs, fine-grained stories, evidence required everywhere. Many interacting systems (open-world, sim, RPG), a firm release date, or shared ownership.
+
+Value mapping (ignore any ` (Recommended)` suffix on the first option):
+`Jam / prototype / first game` → `minimal`, `Several systems that affect each other` → `standard`,
+`Big systems-heavy or team project` → `full`.
+
+Write `modes.rigor` to `project.yaml` immediately after the user selects — no
+separate "May I write?" needed, as the write is a direct consequence of the
+selection. Use the Edit tool to add it under the `modes:` block. There is **no
+legacy mirror file** for this setting, so this is a single write, not a dual-write.
+
+Then say: "Set `modes.rigor` to `[choice]`. That drives six settings —
+`modes.workflow`, `docs.density`, `qa.level`, `modes.story_granularity`,
+`modes.review_mode` (director-review depth), and `team.size` (how many agents are
+active on team tasks) — a lighter rigor means fewer reviews, a smaller active
+team, and fewer tokens. Run `/settings` to see the exact value each one takes, or
+set any of them explicitly to override just that one."
+
+**Why this is asked here.** These six knobs each change what skills produce, and
+before `rigor` existed `/start` never asked about any of them — so every project
+silently ran at defaults the user had never seen. Asking once, at onboarding, is
+the only point where the answer is cheap; skipping this question puts the project
+back where it was.
-Check if `production/review-mode.txt` already exists.
-
-**If it exists**: Read it and show the current mode — "Review mode is set to `[current]`." — then proceed to Phase 4. Do not ask again.
+---
-**If it does not exist**: Use `AskUserQuestion`:
+## Phase 3e: Set Automation Mode
-- **Prompt**: "One setup choice: how much design review would you want as you work through the workflow?"
-- **Options**:
- - `Full` — Director specialists review at each key workflow step. Best for teams, learning the workflow, or when you want thorough feedback on every decision.
- - `Lean (recommended)` — Directors only at phase gate transitions (/gate-check). Skips per-skill reviews. Balanced approach for solo devs and small teams.
- - `Solo` — No director reviews at all. Maximum speed. Best for game jams, prototypes, or if the reviews feel like overhead.
+Check whether `modes.automation` is already set in `project.yaml`. **If it is**,
+show it — "Automation is set to `[current]`." — and proceed to Phase 4. Do not
+ask again.
-Write the choice to `production/review-mode.txt` immediately after the user
-selects — no separate "May I write?" needed, as the write is a direct
-consequence of the selection:
-- `Full` → write `full`
-- `Lean (recommended)` → write `lean`
-- `Solo` → write `solo`
+**If it is not set**: Use `AskUserQuestion`:
-Create the `production/` directory if it does not exist.
+- **Prompt**: "Last one: how much should I confirm with you as we work?"
+- **Options**:
+ - `Collaborative` — I ask before each significant step and show drafts before writing. Most control; best while you are learning the workflow and want to see everything.
+ - `Guided (recommended)` — I decide the small stuff and proceed, but still stop for the big calls (scope changes, file deletions, schema changes). Far fewer interruptions than collaborative, without giving up control of the decisions that matter.
+ - `Autonomous` — I proceed and log decisions rather than asking, except for the always-ask categories. Fastest to run, but it makes every call itself and costs more tokens; best for trusted, well-scoped runs.
+
+Value mapping: `Collaborative` → `collaborative`, `Guided (recommended)` →
+`guided`, `Autonomous` → `autonomous`.
+
+Write `modes.automation` to `project.yaml` immediately after the user selects —
+no separate "May I write?" needed, as the write is a direct consequence of the
+selection. Use the Edit tool to add it under the `modes:` block. There is **no
+legacy mirror file** for this setting.
+
+Then say: "Set `modes.automation` to `[choice]`. See
+`.claude/docs/automation-modes.md` for exactly what each mode asks vs. proceeds
+on. `guided` and `autonomous` still always stop for the `automation_always_ask`
+categories (scope changes, file deletions, schema changes)."
+
+**Why this is asked here.** `modes.automation` controls how often every skill
+stops to confirm. A project that wants to move fast should not have to discover
+the knob after fifty approval prompts — that is the frustration this setting
+answers. Asked once, at onboarding, like the others. Do **not** seed
+`modes.automation` into the Phase 3c template: Phase 3e skips when the key is
+already set, so seeding it would suppress its own question (the collision Y.3
+and Y.6 guard for the other knobs).
---
-## Phase 4: Confirm Before Proceeding
-
-After presenting the recommended path, use `AskUserQuestion` to ask the user which step they'd like to take first. Never auto-run the next skill.
+## Phase 4: Show the Path, Then Confirm
+
+**Now** present the recommended path — after Phase 3d, so it can match the rigor
+the user actually chose. Print **one** of the three below, using the `modes.rigor`
+value resolved or written in Phase 3d; if it is somehow still unset, use
+`standard` (its documented default) rather than skipping the path. (Paths A/B/C
+only; path D users are retrofitting an existing project and were given their
+path in Phase 3.)
+
+Say first: "Here's your path at `rigor: [chosen]`. Every skill still runs at any
+level — rigor changes what's *required*, not what's allowed. So at `minimal` you can
+still call `/art-bible`, `/ux-design`, `/qa-plan` or anything else the moment you want
+it — nothing is locked, it simply is not demanded up front. And if one system alone
+deserves more care, raise just that one with
+`workflow_overrides.system_overrides.<system>` rather than the whole project."
+
+**If `minimal` — 4 steps to running code:**
+- `/setup-engine` — configure the engine
+- `/brainstorm` — produce the one-page `design/game-brief.md` (the lean-tier design artifact; it replaces the full concept doc, systems decomposition, and per-system GDDs)
+- `/create-stories` — turn the brief's MVP list into implementable stories (the epic is implicit — no separate `/create-epics` or `/sprint-plan`; the brief's build order is the plan)
+- `/dev-story` — **first line of game code**
+
+**If `standard` (default) — the full pipeline:**
+- **Concept:** `/setup-engine` → `/brainstorm` → `/prototype` → `/art-bible` → `/map-systems` → `/design-system` (×N systems) → `/review-all-gdds` → `/gate-check`
+- **Architecture:** `/create-architecture` → `/architecture-decision` (×N) → `/create-control-manifest` → `/architecture-review`
+- **Pre-Production:** `/ux-design` → `/create-epics` → `/create-stories` → `/sprint-plan`
+- **Production:** `/dev-story`
+
+**If `full` — the full pipeline plus validation builds:**
+- Everything in `standard`, plus `/vertical-slice` and `/playtest-report` (×1+)
+ in Pre-Production, and `/design-review` after each GDD.
+
+> **Do not present the minimal path as lesser.** It is the tier's documented
+> floor (`.claude/docs/workflow-modes.md` — "engine choice and a filled
+> `design/game-brief.md` are required before code starts … everything else can
+> be skipped"), not a degraded mode. Equally, do not oversell it: at `minimal`
+> there are no GDDs to catch design problems before they reach code, which is
+> the trade being made.
+
+If the user picked a rigor that contradicts what they described in Phase 2 —
+overriding the seeded recommendation, e.g. choosing `minimal` after describing a
+multi-year commercial project, or `full` for a weekend jam — apply the "mismatch"
+trigger in `.claude/docs/settings-guidance.md § 4`: say so once, in one sentence,
+and offer `/settings` to change it. Do not re-ask.
+
+Then use `AskUserQuestion` to ask which step they'd like to take first. Never auto-run the next skill.
- **Prompt**: "Would you like to start with [recommended first step]?"
- **Options**:
@@ -230,14 +353,18 @@ Verdict: **COMPLETE** — user oriented and handed off to next step.
## Edge Cases
- **User picks D but project is empty**: Gently redirect — "It looks like the project is a fresh template with no artifacts yet. Would Path A or B be a better fit?"
-- **User picks A but project has code**: Mention what you found — "I noticed there's already code in `src/`. Did you mean to pick D (existing work)?"
-- **User is returning (engine configured, concept exists)**: Skip onboarding entirely — "It looks like you're already set up! Your engine is [X] and you have a game concept at `design/gdd/game-concept.md`. Review mode: `[read from production/review-mode.txt, or 'lean (default)' if missing]`. Want to pick up where you left off? Try `/sprint-plan` or just tell me what you'd like to work on."
+- **User picks A but project has code**: Mention what you found — "I noticed there's already code in `[code root]`. Did you mean to pick D (existing work)?"
+- **User is returning (engine configured, concept exists)**: Skip onboarding entirely — "It looks like you're already set up! Your engine is [X] and you have a game concept at `design/gdd/game-concept.md` (or a game brief at `design/game-brief.md`). Review mode: `[resolve modes.review_mode — an explicit value if set, otherwise it follows modes.rigor: minimal→solo, standard→lean, full→full]`. Want to pick up where you left off? Try `/sprint-plan` or just tell me what you'd like to work on."
- **User doesn't fit any option**: Let them describe their situation in their own words and adapt.
---
## Collaborative Protocol
+**Applies in `collaborative` mode (the default).** For `guided` and
+`autonomous` modes, see `.claude/docs/automation-modes.md` — the rules below
+describe what collaborative mode requires, not universal behavior.
+
1. **Ask first** — never assume the user's state or intent
2. **Present options** — give clear paths, not mandates
3. **User decides** — they pick the direction
diff --git a/.claude/skills/story-done/CONTRACT.md b/.claude/skills/story-done/CONTRACT.md
new file mode 100644
index 00000000..cc1d92cf
--- /dev/null
+++ b/.claude/skills/story-done/CONTRACT.md
@@ -0,0 +1,86 @@
+# /story-done — Handoff Contract
+
+## Role in Pipeline
+Closes the implementation loop for a single story by verifying every acceptance criterion, checking test evidence, detecting GDD/ADR deviations, and — after user approval — updating the story file to `Status: Complete` with a `## Completion Notes` section.
+
+## Inputs Required
+
+### Files That Must Exist
+| File | Required Fields / Sections | Read-Only? |
+|------|---------------------------|-----------|
+| `production/epics/**/*.md` (the story file) | `Status:` (expected: `In Progress`, or `Ready` if `/dev-story` was skipped — `/dev-story` sets `In Progress`, and `/story-done` is the only skill that writes `Status: Complete`), `Type:`, `Manifest Version`, TR-ID(s), ADR reference(s), `## Acceptance Criteria`, list of files to create/modify, `## Test Evidence` path | No — status and completion notes written after approval |
+| `docs/architecture/tr-registry.yaml` | Entry per TR-ID with current `requirement` text | Yes |
+| GDD section referenced by each TR-ID | Acceptance criteria and key rules for cross-check | Yes |
+| `docs/architecture/adr-NNNN-[slug].md` (referenced ADR) | `## Decision`, `## Consequences` | Yes |
+| `docs/architecture/control-manifest.md` | `Manifest Version:` header date, forbidden patterns | Yes (existence checked; absent = skip staleness check) |
+| `production/session-state/active.md` | Active story path (used when no argument given) | No — session extract appended |
+
+### Test Evidence Files (presence checked, not pre-required to exist — absence triggers gate)
+| Story Type | Expected Location |
+|------------|------------------|
+| Logic | `tests/unit/[system]/[story-slug]_test.[ext]` |
+| Integration | `tests/integration/[system]/[story-slug]_test.[ext]` OR `production/session-logs/` playtest record |
+| Visual/Feel | `production/qa/evidence/[story-slug]-evidence.md` + a retained screenshot |
+| UI | `production/qa/evidence/[story-slug]-evidence.md` + a retained screenshot of each screen touched |
+| Config/Data | `production/qa/smoke-*.md` |
+
+### Preconditions
+- The story file must be findable either by argument path, in `production/session-state/active.md`, or in the current sprint file as `IN PROGRESS`
+- Implementation must have been attempted (source files listed in the story's "files to create/modify" should exist) — this skill does not implement; it verifies
+- For Logic and Integration stories, the test file at the `## Test Evidence` path must **exist** before a COMPLETE verdict is possible — unless `testing.strict` in `project.yaml` sets that type to advisory (`testing.strict.logic`/`.integration: false`), in which case a missing test is recorded as a warning but does not block
+- For Visual/Feel and UI stories, a retained screenshot **and** an evidence doc must exist under `production/qa/evidence/` before a COMPLETE verdict is possible — unless `testing.strict.visual`/`.ui` is set to `false`, in which case the gap is recorded as a warning but does not block
+- **This skill does not execute the test.** Phase 3 checks existence with `Glob`; nothing runs. A test that exists and FAILS satisfies the gate, so a failing test cannot block a COMPLETE verdict here — this gate is existence, not "exist and pass". Pass/fail is established by `/gate-check` and `/smoke-check`, both of which run a suite and both of which come after story closure. See the note under Phase 3 of `SKILL.md`.
+
+## Verdicts Emitted
+`COMPLETE` / `COMPLETE WITH NOTES` / `NOT ASSESSED` / `BLOCKED`.
+
+`NOT ASSESSED` outranks `COMPLETE` — one or more acceptance criteria could not
+be evaluated at all, which is not the same as evaluating them and finding them
+met. Precedence is `BLOCKED`, then `NOT ASSESSED`, then `COMPLETE WITH NOTES`,
+then `COMPLETE`; see the verdict section of `SKILL.md`. This contract listed no
+verdict set at all, so a reader had nothing to branch on.
+
+## Outputs Produced
+
+### Files Written
+| File | Guaranteed Fields / Sections | Notes |
+|------|------------------------------|-------|
+| `production/epics/**/*.md` (the story file) | `Status: Complete`, `## Completion Notes` block (date, criteria count, deviations, test evidence path, code review status) | updated after explicit user approval |
+| `production/sprint-status.yaml` | `status: done`, `completed: [date]`, top-level `updated` field | updated silently alongside story file if file exists |
+| `docs/tech-debt-register.md` | Advisory deviation entries (if user confirms) | appended if advisory deviations exist and user agrees |
+| `production/session-state/active.md` | `## Session Extract — /story-done [date]` block: verdict, story path, tech debt count, next recommended story | appended (created if absent) |
+
+### Output Guarantees
+- `Status: Complete` is written only when verdict is COMPLETE or COMPLETE WITH NOTES and the user explicitly approves
+- `## Completion Notes` always contains: completion date, criteria pass count, deviation summary, test evidence path (or "None required"), code review status
+- Session state always records the final verdict and the next recommended story path
+
+## Immutability Rules
+- READS but does NOT modify: `docs/architecture/tr-registry.yaml`, `docs/architecture/adr-NNNN-[slug].md` (Decision + Consequences only), GDD sections, `docs/architecture/control-manifest.md`, source files in `src/` (Grep only), test files in `tests/` (run via Bash; not edited)
+- MODIFIES: the story `.md` file (status + completion notes), `production/sprint-status.yaml` (if exists), `production/session-state/active.md` (append), `docs/tech-debt-register.md` (append, only with user approval)
+- Does NOT write to the code root or `tests/` under any circumstances
+
+## Hard Constraints (Never Violate)
+- Never sets `Status: Complete` without explicit user approval ("May I update the story file?")
+- Never marks a Logic story Complete on a missing unit test when its resolved gate level is BLOCKING — the level is BLOCKING by default and whenever `testing.strict.logic` is `true`; it is ADVISORY only when `testing.strict.logic` is explicitly `false`
+- Never marks an Integration story Complete on missing evidence (integration test file or playtest session log) when its resolved gate level is BLOCKING — BLOCKING by default and under `testing.strict.integration: true`; ADVISORY only under an explicit `false`
+- Never marks a Visual/Feel or UI story Complete on a missing retained screenshot in `production/qa/evidence/` when its resolved gate level is BLOCKING — BLOCKING by default and under `testing.strict.visual`/`.ui: true`; ADVISORY only under an explicit `false`. A written description of a visual check is not a substitute for the image
+- Never auto-fixes failing acceptance criteria — report failures and ask the user what to do
+- Never proceeds to Phase 7 (file update) when the verdict is BLOCKED — list blockers and offer help resolving them
+- Never silently overrides a BLOCKED verdict — if the user insists on advancing despite blockers, document the override risk explicitly in `## Completion Notes`
+
+## Downstream Skill Expects
+**Next skill:** `/gate-check` (Production → Polish gate, or end-of-sprint review)
+- It will read: story files in `production/epics/` checking `Status: Complete` and presence of `## Completion Notes`
+- It will read: `tests/unit/` and `tests/integration/` for test file presence and will run the test suite via Bash
+- It assumes: every Complete Logic story whose `testing.strict.logic` gate resolved to BLOCKING (the default) has a corresponding test file that **exists**; under an explicit `testing.strict.logic: false` a Logic story may be Complete with the test gap documented in `## Completion Notes`
+ > **Existence, not passing.** `/story-done` checks that the test file exists with `Glob` and runs nothing, so a Complete Logic story may carry a test that fails. `/gate-check` running the suite is the FIRST point at which pass/fail is established, so it must never treat a Complete status as evidence the tests passed — it has to run them. That is also why an unconfigured test runner is `NOT ASSESSED` there rather than a silent skip: with no run, nothing upstream has verified the story either.
+- It assumes: Visual/Feel and UI stories that are Complete have both an evidence doc and a retained screenshot in `production/qa/evidence/` — that gate is BLOCKING by default; only under an explicit `testing.strict.visual`/`.ui: false` may such a story be Complete with the deviation documented in `## Completion Notes`
+- It will read: `production/sprint-status.yaml` for `status: done` entries if that file exists
+
+## Known Fragile Points
+- The story's `## Test Evidence` section must contain the exact file path written by `/dev-story`; a path mismatch causes a false BLOCKING result even if the test file exists under a slightly different name
+- If `Type:` is absent from the story header, test evidence gate enforcement is ADVISORY only — stories can slip through without tests
+- Manifest version staleness check is skipped if `docs/architecture/control-manifest.md` does not exist; the check being skipped is noted in the report but is non-blocking
+- `production/sprint-status.yaml` update is silent (no separate approval); if that file uses a different key structure than expected, the update silently fails and sprint tracking becomes stale
+- The traceability table escalation rule (>50% UNTESTED = BLOCKING) can be triggered by deferred Visual/Feel criteria that are legitimately not automatable — ensure deferred criteria are explicitly marked `DEFERRED` (not left as unchecked) to avoid false escalation
diff --git a/.claude/skills/story-done/SKILL.md b/.claude/skills/story-done/SKILL.md
index 851a496c..0a3fd8cd 100644
--- a/.claude/skills/story-done/SKILL.md
+++ b/.claude/skills/story-done/SKILL.md
@@ -1,12 +1,19 @@
---
name: story-done
-description: "End-of-story completion review. Reads the story file, verifies each acceptance criterion against the implementation, checks for GDD/ADR deviations, prompts code review, updates story status to Complete, and surfaces the next ready story from the sprint."
+description: "End-of-story completion review — verifies each acceptance criterion, checks GDD/ADR deviations, prompts code review, updates status."
argument-hint: "[story-file-path] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Bash, Write, Edit, AskUserQuestion, Task
+disable-model-invocation: true
+allowed-tools: Read, Glob, Grep, Bash, Write, Edit, AskUserQuestion, Agent
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,story_granularity,qa.level,testing.strict,system_overrides`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
# Story Done
This skill closes the loop between design and implementation. Run it at the end
@@ -21,12 +28,37 @@ forgotten, and the story file reflects actual completion status.
## Phase 1: Find the Story
-Resolve the review mode (once, store for all gate spawns this run):
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
-See `.claude/docs/director-gates.md` for the full check pattern.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**Workflow tier**: resolved per the story's system (per
+`.claude/docs/workflow-modes.md`) — **the GDD filename stem** of the story's
+`GDD:` path (`design/gdd/<stem>.md` → `<stem>`), with the `[system]` segment of
+its `TR-[system]-NNN` ID accepted only as a fallback alias: use the
+`system_overrides` row for that system if the block lists one, else the
+project value. It governs which Phase 4 deviation checks run — see Phase 4.
+
+**Workflow companion — `modes.story_granularity`** (resolved above — supplied by
+`modes.rigor` unless set explicitly): cadence expectation only — story-done fires **every 3–5 days** at
+`coarse`, **every 1–2 days** at `balanced`, **multiple times/day** at `fine`. It
+does not change any completion check.
+
+**`qa.level`**: controls whether test *evidence is required*, where
+`testing.strict` controls whether a failure blocks and `workflow` controls which
+docs exist. `modes.rigor` sets `qa.level` and `workflow` together; set either
+explicitly to vary it alone. `testing.strict` is not fronted by `rigor` at all.
+At `minimal`, no evidence is required → skip the Test Evidence
+Requirement check (Phase 3), the >50%-untested traceability escalation, and the
+Phase 4b QA gate entirely; the acceptance-criteria verification still runs. At
+`standard`, the story's own type requires evidence; at `full`, every type does.
+`testing.strict` then decides whether present-but-failing evidence blocks.
+(`rigor: minimal` sets both; `qa.level: minimal` on its own leaves the workflow
+tier where it was.)
**If a file path is provided** (e.g., `/story-done production/epics/core/story-damage-calculator.md`):
read that file directly.
@@ -59,13 +91,19 @@ Read the full story file. Extract and hold in context:
- **Estimated vs actual scope** — if an estimate was noted
Also read:
-- `docs/architecture/tr-registry.yaml` — look up each TR-ID in the story.
- Read the *current* `requirement` text from the registry entry. This is the
- source of truth for what the GDD required — do not use any requirement text
- that may be quoted inline in the story (it may be stale).
+- `docs/architecture/tr-registry.yaml` — grep the story's TR-IDs
+ (`Grep pattern="id: <each TR-ID>" path="docs/architecture/tr-registry.yaml" output_mode="content" -A 6`),
+ not a full read of the registry. Read the *current* `requirement` text from each
+ matched entry. This is the source of truth for what the GDD required — do not use any
+ requirement text that may be quoted inline in the story (it may be stale).
- The referenced GDD section — just the acceptance criteria and key rules, not
the full document. Use this to cross-check the registry text is still accurate.
-- The referenced ADR(s) — just the Decision and Consequences sections
+- The referenced ADR(s) — **just the `## Decision` and `## Consequences`
+ sections, never an unbounded full read.** Map headings first
+ (`Grep pattern="^## " path="docs/architecture/[adr-file].md" output_mode="content" -n`),
+ then bounded-`Read` only those two spans. This is the exact same content
+ Phase 4 item 3's ADR constraints check needs — hold it here, do not
+ re-read it there.
- `docs/architecture/control-manifest.md` header — extract the current
`Manifest Version:` date (used in Phase 4 staleness check)
@@ -82,7 +120,7 @@ three methods:
- **Test pass check**: if a test file path is mentioned, run it via `Bash`.
- **No hardcoded values check**: `Grep` for numeric literals in gameplay code
paths that should be in config files.
-- **No hardcoded strings check**: `Grep` for player-facing strings in `src/`
+- **No hardcoded strings check**: `Grep` for player-facing strings in the **code root** (resolve per `.claude/docs/code-root-resolution.md`). **If the code root is unresolved, report `NOT ASSESSED — code root unresolved` rather than zero hits.**
that should be in localization files.
- **Dependency check**: if a criterion says "depends on X", check that X exists.
@@ -118,6 +156,12 @@ For each acceptance criterion in the story:
- **Integration test**: check `tests/integration/` similarly
- **Manual confirmation**: if the criterion was verified via `AskUserQuestion`
above with a "Yes — passes" answer, count that as a manual test
+ - **Retained screenshot**: if the criterion names something on screen and a
+ retained image under `production/qa/evidence/[story-slug]/` shows it (the
+ `Run result: OBSERVED` from `/dev-story` Phase 6 step 4), count that as
+ covered — put the image path in the Test column. A visual criterion
+ verified by looking is not UNTESTED; without this row every UI story
+ reads as >50% untested and false-escalates.
2. Produce a traceability table:
@@ -126,10 +170,12 @@ For each acceptance criterion in the story:
|-----------|------|--------|
| AC-1: [criterion text] | tests/unit/test_foo.gd::test_bar | COVERED |
| AC-2: [criterion text] | Manual playtest confirmation | COVERED |
-| AC-3: [criterion text] | — | UNTESTED |
+| AC-3: [criterion text] | production/qa/evidence/[slug]/01-shop-open.png | COVERED |
+| AC-4: [criterion text] | — | UNTESTED |
```
-3. Apply these escalation rules:
+3. Apply these escalation rules (skip entirely at `qa.level: minimal` — no
+ evidence is required, so untested criteria never escalate):
- If **>50% of criteria are UNTESTED**: escalate to **BLOCKING** — test
coverage is insufficient to confirm the story is actually done. The verdict
@@ -144,38 +190,118 @@ For each acceptance criterion in the story:
### Test Evidence Requirement
-Based on the Story Type extracted in Phase 2, check for required evidence:
-
-| Story Type | Required Evidence | Gate Level |
+**First apply `qa.level` (resolved in Phase 1).** At `minimal`, no evidence is
+required — skip this entire subsection (no gate from test evidence; the verdict
+rests on acceptance-criteria verification alone). At `standard`, require evidence
+for the story's own type. At `full`, require evidence for every story type. Only
+when evidence is required does the `testing.strict` resolution below apply.
+
+Based on the Story Type extracted in Phase 2, check for required evidence.
+
+**Resolve the gate level for this story's type.** A gate level is either
+BLOCKING (a gap prevents the COMPLETE verdict in Phase 6) or ADVISORY (a gap is
+noted in the Completion Notes but does not block). Resolve it from the
+`testing.strict` block **already resolved in the resolved-config block at the top of this skill** — not by reading
+`project.yaml` yourself:
+
+1. Map the Story Type to a `testing.strict` key — Logic→`logic`,
+ Integration→`integration`, Visual/Feel→`visual`, UI→`ui`, Config/Data→`config`.
+ Take `testing.strict.<key>` from that resolved block. If its value is `true`
+ (case-insensitive) → BLOCKING; if `false` → ADVISORY; `unset` → fall through.
+2. Else read `testing.strict` as a plain boolean (legacy single-value form). If
+ its value is `true` → BLOCKING or `false` → ADVISORY, it applies to every type.
+3. Else use the default in the table below.
+
+> **Use that resolved block, never `project.yaml` directly.** `testing.strict.*` is
+> on the `/settings --local` whitelist, so a developer can set
+> `testing.strict.logic=false` in `project.local.yaml` for fast WIP commits —
+> `effects-map.md` specifies exactly this ("stricter dev's local `/story-done`
+> blocks earlier"). Reading `project.yaml` alone silently ignores that file: the
+> setting is accepted, displayed by `/settings`, and has no effect. The
+> `resolve_config` block at the top of this skill already merges local over base.
+
+Only `true` and `false` (case-insensitive) are recognized at steps 1–2. A key
+that is present but holds any other value — `maybe`, `1`, `yes`, etc. — is
+treated as unset: continue to the next step, and surface the unrecognized value
+to the user.
+
+| Story Type | Required Evidence | Default Gate Level |
|---|---|---|
-| **Logic** | Automated unit test in `tests/unit/[system]/` — must exist and pass | BLOCKING |
+| **Logic** | Automated unit test in `tests/unit/[system]/` — must exist and pass (this skill verifies **existence**; see the note below Phase 3) | BLOCKING |
| **Integration** | Integration test in `tests/integration/[system]/` OR playtest doc | BLOCKING |
-| **Visual/Feel** | Screenshot + sign-off in `production/qa/evidence/` | ADVISORY |
-| **UI** | Manual walkthrough doc OR interaction test in `production/qa/evidence/` | ADVISORY |
+| **Visual/Feel** | Retained screenshot + sign-off in `production/qa/evidence/` | BLOCKING |
+| **UI** | Retained screenshot of each screen touched, in `production/qa/evidence/` | BLOCKING |
| **Config/Data** | Smoke check pass report in `production/qa/smoke-*.md` | ADVISORY |
+The **Default Gate Level** column applies when `testing.strict` is unset (the
+common case). When `testing.strict` is configured, the resolved value from
+steps 1–2 overrides it. Visual/Feel and UI default to BLOCKING because for a
+game the rendered result is the product; set `testing.strict.visual` or
+`testing.strict.ui` to `false` for an advisory gate.
+
+> **Exception — `/smoke-check`.** The ADVISORY default for **Config/Data** above
+> governs *per-story evidence* gates, which is what this skill checks.
+> `/smoke-check` is a build-health gate, not a per-story evidence gate, so its own
+> unset default for `testing.strict.config` is **BLOCKING** — see
+> `.claude/skills/smoke-check/SKILL.md` § "Resolve the gate enforcement level".
+> The divergence is intentional; do not "fix" either side to match the other.
+
+> **This phase checks that evidence EXISTS. It does not run anything.** The
+> `Default Gate Level` table above, and `.claude/docs/coding-standards.md`, both
+> say a Logic story's test "must exist **and pass**". The checks below establish
+> only the first half — every one of them is a `Glob` or a `Grep`. A unit test
+> that exists and fails, or that contains no assertions, satisfies them.
+>
+> Say which half you verified when you report. "Test file present at `<path>`"
+> is the honest claim; "tests pass" is not one this phase can make. Pass/fail is
+> established by `/gate-check` (runs the suite at a phase gate) and
+> `/smoke-check` (runs it before QA hand-off), both of which do execute.
+>
+> Unlike `/regression-suite` and `/launch-checklist`, which stop at existence
+> because their `allowed-tools` has no `Bash`, this skill HAS `Bash` — the limit
+> here is the instruction, not the grant. Running the story's own test before
+> closing it is a live option; it is not enabled because it needs a configured
+> runner and a decision about what a missing runner should mean.
+
**For Logic stories**: first read the story's **Test Evidence** section to extract the
exact required file path. Use `Glob` to check that exact path. If the exact path is not
found, also search `tests/unit/[system]/` broadly (the file may have been placed at a
slightly different location). If no test file is found at either location:
-- Flag as **BLOCKING**: "Logic story has no unit test file. Story requires it at
- `[exact-path-from-Test-Evidence-section]`. Create and run the test before marking
- this story Complete."
+- Flag at the resolved gate level: "Logic story has no unit test file. Story
+ requires it at `[exact-path-from-Test-Evidence-section]`. Create and run the
+ test before marking this story Complete."
**For Integration stories**: read the story's **Test Evidence** section for the exact
required path. Use `Glob` to check that exact path first, then search
`tests/integration/[system]/` broadly, then check `production/session-logs/` for a
playtest record referencing this story.
-If none found: flag as **BLOCKING** (same rule as Logic).
-
-**For Visual/Feel and UI stories**: glob `production/qa/evidence/` for a file
-referencing this story.
-- If none: flag as **ADVISORY** — "No manual test evidence found. Create `production/qa/evidence/[story-slug]-evidence.md` using the test-evidence template and obtain sign-off before final closure."
-- If found: read the file and check the sign-off table for unchecked boxes. Grep for lines matching `| .* | .* | .* | \[ \] Approved` (a sign-off row with an unchecked checkbox). If any unchecked sign-off rows are found: flag as **ADVISORY** — "Evidence file found at `[path]` but [N] sign-off(s) are still pending (shown as `[ ] Approved` in the sign-off table). Obtain required sign-offs before final closure. Note: for solo developers, all roles may be signed off by the same person."
-- If all sign-off rows show `[x] Approved` or equivalent: note "Evidence file found and all sign-offs complete — ADVISORY passed."
+If none found: flag at the resolved gate level (same rule as Logic).
+
+**For Visual/Feel and UI stories**: glob `production/qa/evidence/` for both an
+evidence doc referencing this story and a retained screenshot for it (`*.png`,
+`*.jpg`, `*.gif`).
+- If neither is found: flag at the resolved gate level — "No visual evidence found. Capture a screenshot of each screen or effect this story touched, save it under `production/qa/evidence/`, create `production/qa/evidence/[story-slug]-evidence.md` using the test-evidence template, and obtain sign-off before final closure."
+- If the evidence doc exists but no screenshot is retained beside it: flag at the resolved gate level — "Evidence doc found at `[path]` but no screenshot is retained. A described check is an assertion, not evidence — capture the screen and save the image under `production/qa/evidence/` before final closure."
+- If found: read the file and check the sign-off table for unchecked boxes. Grep for lines matching `| .* | .* | .* | \[ \] Approved` (a sign-off row with an unchecked checkbox). If any unchecked sign-off rows are found: flag at the resolved gate level — "Evidence file found at `[path]` but [N] sign-off(s) are still pending (shown as `[ ] Approved` in the sign-off table). Obtain required sign-offs before final closure. Note: for solo developers, all roles may be signed off by the same person."
+- If the doc, the screenshot and all `[x] Approved` sign-off rows are present: note "Evidence doc and retained screenshot found, all sign-offs complete — gate satisfied."
+
+The retained image **is** the `Run result: OBSERVED` from `/dev-story` Phase 6
+step 4 (`.claude/docs/run-and-observe.md`); its absence means the run was
+`NOT VERIFIED` or never happened, and the flag above is the consequence. The
+run is not waived at `qa.level: minimal`.
+
+**For every other story type**, read the `Run result:` line from the
+`/dev-story` summary (the session extract in `production/session-state/active.md`,
+or the story's `## Completion Notes`). `OBSERVED` with a retained path: note
+it. `N/A — <reason>`: accept only if the reason names why nothing is
+observable — "it's a Logic story" is not a reason. `NOT VERIFIED — <reason>`
+on a story whose acceptance criteria name anything on screen: flag at the
+resolved gate level for the story's type. No `Run result:` line at all: flag
+as ADVISORY — "the implementation summary carries no run result; confirm the
+build was launched and looked at before closure."
**For Config/Data stories**: check for any `production/qa/smoke-*.md` file.
-If none: flag as **ADVISORY** — "No smoke check report found. Run `/smoke-check`."
+If none: flag at the resolved gate level — "No smoke check report found. Run `/smoke-check`."
**If no Story Type is set**: flag as **ADVISORY** —
"Story Type not declared. Add `Type: [Logic|Integration|Visual/Feel|UI|Config/Data]`
@@ -189,6 +315,20 @@ Any BLOCKING test evidence gap prevents the COMPLETE verdict in Phase 6.
Compare the implementation against the design documents.
+> **Workflow tier adjustment** (resolved in Phase 1, per the story's system).
+> Checks 1 (GDD rules) and 3 (ADR constraints) below are the `full` baseline:
+> - **`full`** — run both: full GDD traceability against the current TR text +
+> the ADR constraints check.
+> - **`standard`** — run the GDD rules check against the **5 required sections**;
+> run the ADR constraints check only where a **critical ADR** governs the story.
+> - **`minimal`** — **acceptance-criteria check only**: skip checks 1 and 3 (no
+> GDD/ADR traceability expected). Checks 2 (manifest), 4 (hardcoded values), and
+> 5 (scope) still run as written.
+>
+> This adjustment governs only the Phase 4 *deviation* checks. The test-evidence
+> gates (Phase 3 traceability, Phase 4b QA coverage) are governed by `qa.level`
+> and `testing.strict`, not `workflow` — they run independently of the tier here.
+
Run these checks automatically:
1. **GDD rules check**: Using the current requirement text from `tr-registry.yaml`
@@ -206,9 +346,10 @@ Run these checks automatically:
is v[current-date]. New rules may apply. Run /story-readiness to check.`
- If control-manifest.md does not exist → skip this check.
-3. **ADR constraints check**: Read the referenced ADR's Decision section. Check
- for forbidden patterns from `docs/architecture/control-manifest.md` (if it
- exists). `Grep` for patterns explicitly forbidden in the ADR.
+3. **ADR constraints check**: Use the ADR's `## Decision` section already
+ loaded in Phase 2 — do not read the ADR file again. Check for forbidden
+ patterns from `docs/architecture/control-manifest.md` (if it exists).
+ `Grep` for patterns explicitly forbidden in the ADR.
4. **Hardcoded values check**: `Grep` the implemented files for numeric literals
in gameplay logic that should be in data files.
@@ -229,12 +370,16 @@ For each deviation found, categorize:
## Phase 4b: QA Coverage Gate
+**Skip this phase entirely at `qa.level: minimal`** (resolved in Phase 1) — no
+test evidence is required, so there is no coverage to review. Note: "QL-TEST-COVERAGE
+skipped — qa.level minimal." Proceed to Phase 5.
+
**Review mode check** — apply before spawning QL-TEST-COVERAGE:
- `solo` → skip. Note: "QL-TEST-COVERAGE skipped — Solo mode." Proceed to Phase 5.
- `lean` → skip (not a PHASE-GATE). Note: "QL-TEST-COVERAGE skipped — Lean mode." Proceed to Phase 5.
- `full` → spawn as normal.
-After completing the deviation checks in Phase 4, spawn `qa-lead` via Task using gate **QL-TEST-COVERAGE** (`.claude/docs/director-gates.md`).
+After completing the deviation checks in Phase 4, spawn `qa-lead` via `Agent` using gate **QL-TEST-COVERAGE** (`.claude/docs/director-gates/ql-test-coverage.md`).
Pass:
- The story file path and story type
@@ -266,7 +411,7 @@ Skip this phase for Config/Data stories (no code tests required).
- Record the answer in the completion notes (Phase 7). All three options proceed to Phase 6.
- `full` → spawn as normal.
-Spawn `lead-programmer` via Task using gate **LP-CODE-REVIEW** (`.claude/docs/director-gates.md`).
+Spawn `lead-programmer` via `Agent` using gate **LP-CODE-REVIEW** (`.claude/docs/director-gates/lp-code-review.md`).
Pass: implementation file paths, story file path, relevant GDD section, governing ADR.
@@ -314,21 +459,92 @@ Before updating any files, present the full report:
[All changes within stated scope] OR:
- Extra files touched: [list] — [note whether valid or scope creep]
-### Verdict: COMPLETE / COMPLETE WITH NOTES / BLOCKED
+### Verdict: COMPLETE / COMPLETE WITH NOTES / NOT ASSESSED / BLOCKED
```
**Verdict definitions:**
- **COMPLETE**: all criteria pass, no blocking deviations
- **COMPLETE WITH NOTES**: all criteria pass, advisory deviations documented
+- **NOT ASSESSED**: one or more acceptance criteria could not be evaluated at
+ all — name which, and why
- **BLOCKED**: failing criteria or blocking deviations must be resolved first
-If the verdict is **BLOCKED**: do not proceed to Phase 7. List what must be
-fixed. Offer to help fix the blocking items.
+**`NOT ASSESSED` — the story nobody could verify.** Rank: it **outranks COMPLETE
+and COMPLETE WITH NOTES** (a review that could not evaluate a criterion has not
+shown the criterion is met) and **ranks below BLOCKED** (a criterion known to
+fail is more actionable than one nobody could check, and demoting it would bury
+it). It is not a gentler BLOCKED: "this acceptance criterion fails" and "I could
+not tell whether it passes" send the reader to different fixes.
+
+**Verdict precedence — first matching rule wins**, evaluated in this order:
+**BLOCKED**, then **NOT ASSESSED**, then **COMPLETE WITH NOTES**, then
+**COMPLETE**. A run with both a failing criterion and an unassessable one is
+BLOCKED. Stating the order mechanically, rather than leaving it to be inferred
+from the rank sentence, is what keeps two reviewers from grading the same story
+differently.
+
+Emit it when any of:
+
+- An acceptance criterion **cannot be evaluated at all** — it names no observable
+ outcome, so no evidence could settle it either way.
+ > **Not the same as Phase 3's `DEFERRED`.** A criterion that is evaluable but
+ > needs a playtest is `DEFERRED — requires playtest session`, it does **not**
+ > block, and Phase 3 keeps ownership of it. This trigger is for a criterion no
+ > session could ever settle as written. If Phase 3 already marked it DEFERRED,
+ > that classification stands and this trigger does not fire.
+- The **test evidence is present but unreadable or unclassifiable** — corrupt,
+ empty, or of a type that cannot be determined.
+ > **Absent evidence is Phase 3's, not this trigger's.** Phase 3 resolves a
+ > missing file through `testing.strict`: BLOCKING types produce **BLOCKED**,
+ > ADVISORY types produce **COMPLETE WITH NOTES**. Both outrank or are already
+ > decided, so re-routing "absent" here would silently override an explicit
+ > advisory ruling. *Unreadable* is the genuinely unassessable case, and it is
+ > the only one this trigger claims.
+- **`/test-evidence-review` returned `NOT ASSESSED`** for this story — applicable
+ only when that skill was actually run against it, which this skill does not do
+ itself. It
+ propagates: that skill's whole point is that "could not check" is not
+ "checked and fine", and collapsing its unknown into a COMPLETE here would undo
+ the distinction one skill downstream. `coding-standards.md` marks Logic and
+ Integration evidence BLOCKING, so this is the path where an unverifiable story
+ would otherwise acquire a verdict saying somebody verified it.
+- A **deviation's severity cannot be determined** because the GDD or ADR it
+ would be judged against is missing.
+
+A `NOT ASSESSED` verdict takes the same Phase 7 path as BLOCKED: do not
+automatically proceed, list what could not be checked and what would make it
+checkable. Closing anyway remains the user's explicit call, and stays gated by
+Phase 7's `scope_changes` always-ask rule.
+
+If the verdict is **BLOCKED**: do not *automatically* proceed to Phase 7. List
+what must be fixed and offer to help fix the blocking items. This is the
+default path, not an absolute stop — the user may still explicitly ask to
+close the story anyway despite the blockers. That request is what routes to
+Phase 7's menu below, and Phase 7's own `scope_changes` always-ask rule is
+exactly what stands between that request and a silent close in autonomous
+mode. Do not treat "do not automatically proceed" as "Phase 7 is now
+unreachable" — it is reachable, on request, and gated when reached.
---
## Phase 7: Update Story Status
+**Reached one of two ways**: normally, immediately after a COMPLETE or
+COMPLETE-WITH-NOTES verdict in Phase 6; or, after a BLOCKED **or NOT ASSESSED**
+verdict, only if the user explicitly asks to close the story despite the
+blockers (Phase 6 does not advance here on its own in either case).
+
+**Automation note**: This is the story-completion gate. Closing a story whose
+verdict is BLOCKED (failing acceptance criteria) **or NOT ASSESSED** (criteria
+nobody could evaluate) — the "Accept deviations as-is and close anyway" option —
+is a `scope_changes` decision. Call
+`is_always_ask_category scope_changes`; when it returns 0 (the default), this
+gate prompts via `AskUserQuestion` **regardless of `modes.automation`** —
+autonomous mode must NOT silently close a BLOCKED story, even when the user's
+own request is what got you here. For a COMPLETE or COMPLETE-WITH-NOTES
+verdict, autonomous mode may pick "Close the story (Recommended)" and record
+it via `log_decision`.
+
Use `AskUserQuestion` before writing anything:
- Prompt: "Verification complete. How do you want to proceed?"
- Options:
@@ -370,7 +586,7 @@ If "Fix first": stop here and list what the user flagged. Do not write any files
```
Suggested commit:
-git add [src/ and tests/ files changed during implementation] [story-file-path]
+git add [code-root and tests/ files changed during implementation] [story-file-path]
git commit -m "feat: [story title] ([TR-ID])"
```
@@ -382,7 +598,7 @@ After updating the story file, silently append to
`production/session-state/active.md`:
## Session Extract — /story-done [date]
- - Verdict: [COMPLETE / COMPLETE WITH NOTES / BLOCKED]
+ - Verdict: [COMPLETE / COMPLETE WITH NOTES / NOT ASSESSED / BLOCKED]
- Story: [story file path] — [story title]
- Tech debt logged: [N items, or "None"]
- Next recommended: [next ready story title and path, or "None identified"]
@@ -440,13 +656,21 @@ If no more stories are ready but Must Have stories are still In Progress (not Co
## Collaborative Protocol
+**In `collaborative` mode (the default).** For `guided` and `autonomous` modes,
+see `.claude/docs/automation-modes.md` — the rules below describe collaborative
+behavior. The BLOCKED-override close (Phase 7) always prompts regardless of mode
+(it's a `scope_changes` always-ask decision).
+
- **Never mark a story complete without user approval** — Phase 7 requires an
explicit "yes" before any file is edited.
- **Never auto-fix failing criteria** — report them and ask what to do.
- **Deviations are facts, not judgments** — present them neutrally; the user
decides if they are acceptable.
-- **BLOCKED verdict is advisory** — the user can override and mark complete
- anyway; document the risk explicitly if they do.
+- **BLOCKED and NOT ASSESSED verdicts are advisory** — the user can override and
+ mark complete anyway; document the risk explicitly if they do. For NOT
+ ASSESSED, the documented risk is that the criterion was never evaluated, not
+ that it failed — record which criteria those were, so the gap is recoverable
+ later rather than closed over.
- Use `AskUserQuestion` for the code review prompt and for batching manual
criteria confirmations.
diff --git a/.claude/skills/story-readiness/CONTRACT.md b/.claude/skills/story-readiness/CONTRACT.md
new file mode 100644
index 00000000..28431f39
--- /dev/null
+++ b/.claude/skills/story-readiness/CONTRACT.md
@@ -0,0 +1,71 @@
+# /story-readiness — Handoff Contract
+
+## Role in Pipeline
+Validates that a story file contains everything a developer needs to begin
+implementation and produces a READY / NEEDS WORK / BLOCKED / NOT ASSESSED verdict — sits between
+`/create-stories` and `/dev-story`, acting as a blocking gate before any code is written.
+
+## Inputs Required
+
+### Files That Must Exist
+| File | Required Fields / Sections | Read-Only? |
+|------|---------------------------|-----------|
+| `production/epics/[epic-slug]/story-NNN-[slug].md` | All header fields (`Status:`, `Layer:`, `Type:`, `Manifest Version:`), `## Context` (GDD path, TR-ID, ADR reference, Engine Notes, Control Manifest Rules), `## Acceptance Criteria`, `## Test Evidence`, `## Dependencies`, `## Out of Scope` | Yes |
+| `docs/architecture/control-manifest.md` | `Manifest Version:` date in header, layer rules | Yes (if exists) |
+| `docs/architecture/tr-registry.yaml` | `id`, `status` fields per TR entry | Yes (if exists) |
+| `docs/architecture/adr-NNNN-[slug].md` (all ADRs referenced in stories) | `Status:` field | Yes |
+| `design/gdd/systems-index.md` | Which systems have approved GDDs | Yes |
+
+### Preconditions
+- The story file being validated was produced by `/create-stories` (or follows the same format)
+- For `sprint` scope: a sprint file exists in `production/sprints/` with story path references
+- For `all` scope: `production/epics/` directory exists and contains story files
+
+## Outputs Produced
+
+### Files Written
+None. This skill is strictly read-only and produces no file modifications under any circumstance.
+
+### Output Guarantees
+- A verdict of READY, NEEDS WORK, BLOCKED or NOT ASSESSED is produced for every story file evaluated. `NOT ASSESSED` is not a synonym for `BLOCKED`: BLOCKED names a real, listable obstacle, while NOT ASSESSED means the story could not be evaluated at all. An empty scope yields `NOT ASSESSED — no stories in scope`, never a `Ready: 0 / Needs Work: 0 / Blocked: 0` summary over an empty list
+- Every non-READY verdict includes a specific gap list with fix instructions for each failing checklist item
+- Every BLOCKED verdict names the specific blocker (missing dependency story path, Proposed ADR ID, or unresolved design question marker)
+- For `sprint` scope: a sprint-level escalation warning is prepended if any Must Have story is not READY
+- The skill offers to draft missing sections in conversation but never uses Write or Edit tools
+
+## Immutability Rules
+- READS but does NOT modify: story files, `docs/architecture/control-manifest.md`, `docs/architecture/tr-registry.yaml`, all ADR files, `design/gdd/systems-index.md`, sprint files, any referenced asset files (existence-only Glob checks)
+- MODIFIES: nothing
+
+## Hard Constraints (Never Violate)
+- Never use Write or Edit tools under any circumstances
+- Never draft corrections directly into files — offer drafts in conversation only
+- Never mark a story READY if its governing ADR has `Status: Proposed`
+- Never mark a story READY if a dependency story file is missing or has `Status: Draft`
+- Never re-read the same ADR file multiple times in one run — cache ADR statuses after the first read
+- Never penalize a story for missing `Manifest Version:` if `control-manifest.md` does not exist
+- Never penalize a story for missing TR-ID if `tr-registry.yaml` does not exist
+
+## Downstream Skill Expects
+**Next skill:** /dev-story
+
+It will rely on this skill's verdict as follows:
+- If verdict is READY: `/dev-story` proceeds with implementation using the story file as its source of truth
+- If verdict is NEEDS WORK or BLOCKED: `/dev-story` must not be run until the story is corrected and re-validated
+- `/dev-story` reads the same story fields this skill validates — a READY verdict is an implicit guarantee that those fields are present, parseable, and internally consistent:
+ - `Type:` field is set to a valid story type
+ - `## Acceptance Criteria` contains specific, testable checkbox items
+ - `## Test Evidence` specifies a concrete evidence path
+ - The governing ADR exists and has `Status: Accepted`
+ - `Manifest Version:` matches the current control manifest
+ - `TR-ID` in `## Context` is present and resolves in `docs/architecture/tr-registry.yaml` (when the registry exists)
+ - `## Dependencies` section is present (may say "None")
+ - `## Out of Scope` section is present (checked for existence; `/dev-story` uses it to enforce implementation boundaries)
+
+## Known Fragile Points
+- If `control-manifest.md` is regenerated with a new `Manifest Version:` date, every story that embeds the old date will fail the manifest version check — a bulk update of all story `Manifest Version:` fields is required before stories can pass readiness again
+- If an ADR is silently renamed or moved after stories reference it by ID, the ADR file-existence check will BLOCK those stories even though the decision content is unchanged
+- The manifest version comparison is a string date match, not a semantic version comparison — if the date format changes (e.g., from `2026-01-15` to `Jan 15 2026`), all stories will fail the check regardless of actual currency
+- Asset existence checks use Glob — on Windows, path separator mismatches (`\` vs `/`) may cause a Glob miss that incorrectly flags an asset as missing
+- The TR-ID status check auto-passes if the registry does not exist, which means stories written before TR tracking was introduced will always pass this check even if they contain invalid or placeholder IDs like `TR-[system]-???`
+- For `sprint` scope, the skill depends on sprint file formatting to extract story paths — if the sprint file format changes, story paths may not be parsed and the scope silently reduces to zero stories validated
diff --git a/.claude/skills/story-readiness/SKILL.md b/.claude/skills/story-readiness/SKILL.md
index 8ddabcfb..40b2cf33 100644
--- a/.claude/skills/story-readiness/SKILL.md
+++ b/.claude/skills/story-readiness/SKILL.md
@@ -1,12 +1,18 @@
---
name: story-readiness
-description: "Validate that a story file is implementation-ready. Checks for embedded GDD requirements, ADR references, engine notes, clear acceptance criteria, and no open design questions. Produces READY / NEEDS WORK / BLOCKED verdict with specific gaps. Use when user says 'is this story ready', 'can I start on this story', 'is story X ready to implement'."
+description: "Is a story implementation-ready? Checks clear acceptance criteria, open questions, ADR refs. READY/NEEDS WORK/BLOCKED/NOT ASSESSED."
argument-hint: "[story-file-path or 'all' or 'sprint']"
user-invocable: true
-allowed-tools: Read, Glob, Grep, AskUserQuestion, Task
+allowed-tools: Read, Glob, Grep, AskUserQuestion, Agent
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,workflow,qa.level,testing.strict,system_overrides`
+
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+
# Story Readiness
This skill validates that a story file contains everything a developer needs
@@ -16,20 +22,53 @@ no ambiguous acceptance criteria. Run it before assigning a story.
**This skill is read-only.** It never edits story files. It reports findings
and asks whether the user wants help filling gaps.
-**Output:** Verdict per story (READY / NEEDS WORK / BLOCKED) with a specific
+**Output:** Verdict per story (READY / NEEDS WORK / BLOCKED / NOT ASSESSED) with a specific
+
+> **`NOT ASSESSED` is not a synonym for `BLOCKED`.** `BLOCKED` is a
+> finding about the story — a Proposed ADR, an unresolved dependency — and it
+> tells the reader exactly what to clear. Use `NOT ASSESSED` when the story could
+> not be evaluated at all: the file is unreadable or unparseable, or a referenced
+> ADR or design document cannot be located, so the checks below cannot run.
+> Collapsing that into `BLOCKED` reports a blocker that does not exist and hides
+> the one that does — the reader chases a phantom ADR instead of a missing file.
+> `READY` must never be reachable for a story that was not actually evaluated.
+>
+> **Precedence — first matching rule wins**, in this order: **BLOCKED**, then
+> **NEEDS WORK**, then **NOT ASSESSED**, then **READY**. `NOT ASSESSED` outranks
+> `READY` (a story that could not be evaluated has not been shown ready) and
+> ranks **below** both failure verdicts (a known blocker is more actionable than
+> an unknown, and demoting it behind an access problem buries it). A story with
+> both a real blocker and an unevaluable check is `BLOCKED` — the blocker is the
+> actionable finding. This half of the rank has to be stated: the rule above
+> establishes only that `READY` is unreachable, which would leave the ordering
+> against `BLOCKED` to inference.
gap list for each non-ready story.
---
## Phase 0: Resolve Review Mode
-Resolve the review mode once at startup (store for all gate spawns this run):
-1. If skill was called with `--review [full|lean|solo]` → use that value
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
+See `.claude/docs/director-gates.md` for the full check pattern and mode definitions. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
-See `.claude/docs/director-gates.md` for the full check pattern and mode definitions.
+**Resolve the workflow tier per story** (per `.claude/docs/workflow-modes.md`):
+for the system a story belongs to (**the GDD filename stem** of its `GDD:` path;
+the `[system]` segment of a `TR-[system]-NNN` ID is a fallback alias only), use the
+`system_overrides` row for that system if the block lists one, else the
+project value. When validating multiple stories (`all` / `sprint` scope),
+resolve **per story** — different systems may sit at different tiers. The tier
+sets which checklist sections block — see the note in Section 3.
+
+**`qa.level`**: controls whether a test requirement is
+validated. At `minimal`, the "Test evidence requirement is clear" item
+auto-passes (no requirement validated); at `standard`, validate the per-type test
+requirement (strictness from `testing.strict`); at `full`, also validate a
+coverage target. Distinct axis from `workflow`.
---
@@ -52,6 +91,31 @@ If no argument is given, use `AskUserQuestion`:
Report the scope before proceeding: "Validating [N] story files."
+> **If the scope resolves to ZERO story files, stop and report
+> `NOT ASSESSED — no stories in scope`.** Name which scope was searched and
+> which path was empty (`production/epics/**/*.md`, the sprint file's story
+> list, or the specific path given), and route: `/create-epics [layer]` then
+> `/create-stories [epic-slug]`.
+>
+> **The zero-scope path is mandatory.** Without it an empty glob falls through
+> to the Section 5 aggregate template and renders `Ready: 0 /
+> Needs Work: 0 / Blocked: 0` above an empty list — **indistinguishable from
+> "I checked every story and none needed work"**. It is the core failure of this
+> framework exactly: a scan that finds nothing because there was nothing to
+> scan, reported the same way as a clean result. Three zeros read as a healthy
+> sprint.
+>
+> Note what made this survive: `NOT ASSESSED` was already in this skill's
+> vocabulary, but the body scoped it to **per-story** evaluation failures (an
+> unreadable or unparseable file, a missing referenced ADR). The verdict existed;
+> the case that most needs it had no route to it. It is a recurring shape — a
+> correct fix that did not reach one surface.
+>
+> **A zero-story sprint scope is not the same as an absent sprint file.** If
+> `production/sprints/` has no file at all, say that instead — "no sprint plan
+> found" and "the sprint plan lists no stories" send the reader to different
+> fixes, and Section 7 already draws that distinction for the handoff block.
+
---
## 2. Load Supporting Context
@@ -59,16 +123,27 @@ Report the scope before proceeding: "Validating [N] story files."
Before checking any stories, load reference documents once (not per-story):
- `design/gdd/systems-index.md` — to know which systems have approved GDDs
-- `docs/architecture/control-manifest.md` — to know which manifest rules exist
- (if the file does not exist, note it as missing once; do not re-flag per story)
- Also extract the `Manifest Version:` date from the header block if the file exists.
+- `docs/architecture/control-manifest.md` — story-readiness needs only the header
+ `Manifest Version:` date (its manifest check is existence + version, not the rule
+ bodies), so grep it (`Grep pattern="Manifest Version" path="docs/architecture/control-manifest.md"`)
+ rather than a full read. If the file does not exist, note it as missing once; do not
+ re-flag per story.
- `docs/architecture/tr-registry.yaml` — index all entries by `id`. Used to
validate TR-IDs in stories. If the file does not exist, note it once; TR-ID
checks will auto-pass for all stories (registry predates stories, so missing
registry means stories are from before TR tracking was introduced).
-- All ADR status fields — for each unique ADR referenced across the stories being
- checked, read the ADR file and note its `Status:` field. Cache these so you
- don't re-read the same ADR for every story.
+- All ADR status fields — resolve these with **one scan, not one read per ADR**.
+ A `Status:` value is a single line; reading whole ADR files to find it costs the
+ entire architecture corpus, and in `all` scope that multiplies across every
+ story in the repo:
+ ```
+ Grep pattern="^## Status" glob="docs/architecture/adr-*.md" output_mode="content" -A 3
+ ```
+ Establish the denominator first (glob `docs/architecture/adr-*.md`, count **N**)
+ and interpret against it: **0 matches with N > 0 means malformed ADRs, not
+ "no Accepted ADRs"** — report "run `/architecture-decision [file] retrofit`"
+ rather than failing every story's ADR check. Never treat an unreadable status as
+ a failed one. Cache the resulting map; do not re-scan per story.
- The current sprint file (if scope is `sprint`) — to identify Must Have /
Should Have priority for escalation decisions
@@ -79,6 +154,19 @@ Before checking any stories, load reference documents once (not per-story):
For each story file, evaluate every item below. A story is READY only if all
items pass or are explicitly marked N/A with a stated reason.
+> **Workflow tier adjustment** (resolved in Phase 0, per the story's system). The
+> full checklist below is the `full` baseline:
+> - **`full`** — every item is blocking (TR registry + ADR + control manifest
+> fully validated).
+> - **`standard`** — **Design Completeness** and **Scope Clarity** stay blocking.
+> In **Architecture Completeness**, only a **critical (Foundation-layer) ADR**
+> that is missing or `Proposed` BLOCKS; a missing non-critical ADR, or an absent
+> "ADR referenced" note, is **advisory** (NEEDS WORK note, not BLOCKED). The
+> TR-ID and manifest items are advisory.
+> - **`minimal`** — **acceptance-criteria check only**: evaluate Design
+> Completeness and Scope Clarity. Treat the entire **Architecture Completeness**
+> section as N/A — do not flag missing ADR / TR-ID / manifest references.
+
### Design Completeness
- [ ] **GDD requirement referenced**: The story includes a `design/gdd/` path
@@ -103,6 +191,10 @@ items pass or are explicitly marked N/A with a stated reason.
### Architecture Completeness
+> The `BLOCKED` / fail outcomes in this section are the `full` baseline. Apply the
+> tier note above: at `standard` only a missing/Proposed **critical** ADR BLOCKS
+> (other items advisory); at `minimal` treat this entire section as N/A.
+
- [ ] **ADR referenced or N/A stated**: The story references at least one ADR,
OR explicitly states "No ADR applies" with a brief reason.
A story with no ADR reference and no explicit N/A note fails this check.
@@ -192,9 +284,24 @@ items pass or are explicitly marked N/A with a stated reason.
identifying the test category (Logic / Integration / Visual/Feel / UI / Config/Data).
Without this, test evidence requirements cannot be enforced at story close.
Fix: Add `Type: [Logic|Integration|Visual/Feel|UI|Config/Data]` to the story header.
-- [ ] **Test evidence requirement is clear**: If the Story Type is set, the story
- includes a `## Test Evidence` section stating where evidence will be stored
+- [ ] **Test evidence requirement is clear** *(auto-pass at `qa.level: minimal` — no
+ test evidence is required, so this item never blocks)*: If the Story Type is set,
+ the story includes a `## Test Evidence` section stating where evidence will be stored
(test file path for Logic/Integration, or evidence doc path for Visual/Feel/UI).
+ Resolve this item's gate level from the `testing.strict` block **resolved in
+ Phase 0** — not by reading `project.yaml`, which would ignore a developer's
+ locally-overridden value. Map the Story Type to a key (Logic→`logic`,
+ Integration→`integration`, Visual/Feel→`visual`, UI→`ui`,
+ Config/Data→`config`) and take
+ `testing.strict.<key>`; use it only if its value is `true` or `false`
+ (case-insensitive). If the key is absent, empty, or holds any other value, read
+ `testing.strict` as a plain boolean (legacy single-value form); if that too is
+ absent or invalid, default to strict for Logic, Integration, Visual/Feel and UI,
+ and advisory for Config/Data. Surface any unrecognized value to the user.
+ - At a **strict** gate level, a missing `## Test Evidence` section marks the
+ story **NEEDS WORK**.
+ - At an **advisory** gate level, a missing section is listed as a gap but does
+ not by itself downgrade the verdict from READY.
Fix: Add `## Test Evidence` with the expected evidence location for the story's type.
---
@@ -203,7 +310,9 @@ items pass or are explicitly marked N/A with a stated reason.
Assign one of three verdicts per story:
-**READY** — All checklist items pass or have explicit N/A justifications.
+**READY** — All checklist items pass, have explicit N/A justifications, or are
+advisory-level gaps (a checklist item whose gate level resolved to advisory via
+`testing.strict`). Advisory gaps are still listed under Gaps in the output.
The story can be assigned immediately.
**NEEDS WORK** — One or more checklist items fail, but all dependency stories
@@ -320,7 +429,7 @@ If any are found, surface up to 3:
Run `/story-readiness [path]` to validate before starting.
```
-If no sprint file exists or no other ready stories are found, skip this section silently.
+If no sprint file exists, or no other ready stories are found, say which — `Next ready stories: no sprint file found` or `Next ready stories: none ready in [sprint]` — rather than omitting the section. The two mean different things (nothing to read versus nothing ready) and an omitted section reads as neither.
---
@@ -332,7 +441,7 @@ Apply the review mode resolved in Phase 0 before spawning QL-STORY-READY:
- `lean` → skip. Note: "QL-STORY-READY skipped — Lean mode." Proceed to close.
- `full` → spawn as normal.
-Spawn `qa-lead` via Task using gate **QL-STORY-READY** (`.claude/docs/director-gates.md`).
+Spawn `qa-lead` via `Agent` using gate **QL-STORY-READY** (`.claude/docs/director-gates/ql-story-ready.md`).
Pass the following context:
- Story title
diff --git a/.claude/skills/team-audio/SKILL.md b/.claude/skills/team-audio/SKILL.md
index c93e7081..7cd6bd44 100644
--- a/.claude/skills/team-audio/SKILL.md
+++ b/.claude/skills/team-audio/SKILL.md
@@ -1,9 +1,9 @@
---
name: team-audio
-description: "Orchestrate audio team: audio-director + sound-designer + technical-artist + gameplay-programmer for full audio pipeline from direction to implementation."
+description: "Orchestrate the audio team — audio-director, sound-designer, technical-artist, gameplay-programmer — direction through implementation."
argument-hint: "[feature or area to design audio for] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
@@ -15,20 +15,58 @@ When this skill is invoked with an argument, orchestrate the audio team through
**Decision Points:** At each step transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next step.
+In `collaborative` mode, the user must approve before moving to the next step.
+In `guided` mode the pipeline advances automatically unless a step is BLOCKED;
+in `autonomous` mode it runs end to end, recording each step outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `sound-designer` only. Other agents consulted via the sound-designer, not spawned separately.
+- **`small`**: + `audio-director` + `technical-artist`.
+- **`studio`**: + `localization-lead` + per-system audio reviewers.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Step 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
1. **Read the argument** for the target feature or area (e.g., `combat`,
`main menu`, `forest biome`, `boss encounter`).
@@ -41,14 +79,18 @@ Store the resolved mode for use in all subsequent phases.
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: audio-director` — Sonic identity, emotional tone, audio palette
- `subagent_type: sound-designer` — SFX specifications, audio events, mixing groups
- `subagent_type: technical-artist` — Audio middleware, bus structure, memory budgets
- `subagent_type: [primary engine specialist]` — Validate audio integration patterns for the engine
- `subagent_type: gameplay-programmer` — Audio manager, gameplay triggers, adaptive music
-Always provide full context in each agent's prompt (feature description, existing audio assets, design doc references).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
3. **Orchestrate the audio team** in sequence:
@@ -83,13 +125,13 @@ Spawn the `technical-artist` agent to:
- Plan streaming vs preloaded asset strategy
- Design any audio-reactive visual effects
-Spawn the **primary engine specialist** in parallel (from `.claude/docs/technical-preferences.md` Engine Specialists) to validate the integration approach:
+Spawn the **primary engine specialist** in parallel (`<engine>-specialist` derived from `engine.name` — Godot→`godot-specialist`, Unity→`unity-specialist`, Unreal→`unreal-specialist`; fall back to the Primary line of `## Engine Specialists` in `.claude/docs/technical-preferences.md`) to validate the integration approach:
- Is the proposed audio middleware integration idiomatic for the engine? (e.g., Godot's built-in AudioStreamPlayer vs FMOD, Unity's Audio Mixer vs Wwise, Unreal's MetaSounds vs FMOD)
- Any engine-specific audio node/component patterns that should be used?
- Known audio system changes in the pinned engine version that affect the integration plan?
- Output: engine audio integration notes to merge with the technical-artist's plan
-If no engine is configured, skip the specialist spawn.
+If no engine is configured, skip the specialist spawn. **Record `Engine validation: NOT ASSESSED — no engine configured (`engine.name` unset in `project.yaml`)` in this run's output.** A skipped check that says nothing is indistinguishable from a check that passed; the reader cannot tell engine guidance was never sought.
### Step 4: Code Integration (gameplay-programmer)
Spawn the `gameplay-programmer` agent to:
@@ -101,7 +143,16 @@ Spawn the `gameplay-programmer` agent to:
4. **Compile the audio design document** combining all team outputs.
-5. **Save to** `design/audio/audio-[feature].md`.
+5. **Save to** `design/audio/audio-[feature].md` — **but ask first.** `design/` is
+ NOT one of the three directories the bounded write exception covers
+ (`production/`, `docs/`, `tests/`), so a sub-agent handed this path must
+ prompt, and one has done exactly that. Do not
+ resolve that by widening the exception. Instead, follow the same pattern
+ `team-level` uses: **you** already hold every sub-agent's output, so compile
+ the document yourself and ask directly via `AskUserQuestion` — "May I write the
+ audio design to `design/audio/audio-[feature].md`?" — then write it on
+ approval. Sub-agent working artifacts stay under `production/` where the
+ exception does reach them.
Note: If `design/audio/` does not exist, the sub-agent writing the document should create it (the directory will be created automatically when the file is written).
@@ -117,8 +168,12 @@ Verdict: **BLOCKED** — [reason]
## File Write Protocol
All file writes (audio design docs, SFX specs, implementation files) are delegated
-to sub-agents spawned via Task. Each sub-agent enforces the "May I write to [path]?"
-protocol. This orchestrator does not write files directly.
+to sub-agents spawned via `Agent`. Those writes follow the **bounded exception**
+documented above under "Why this does not violate the Collaboration Protocol" —
+the path is one you named, the artifact is new under `production/`, `docs/` or
+`tests/`, and the phase is gated by an `AskUserQuestion`. A sub-agent does **not**
+prompt per write inside those bounds; outside them it must ask. This orchestrator
+does not write files directly.
## Next Steps
@@ -128,15 +183,17 @@ protocol. This orchestrator does not write files directly.
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
-
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
+
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
diff --git a/.claude/skills/team-combat/SKILL.md b/.claude/skills/team-combat/SKILL.md
index 201014be..121d081e 100644
--- a/.claude/skills/team-combat/SKILL.md
+++ b/.claude/skills/team-combat/SKILL.md
@@ -1,9 +1,9 @@
---
name: team-combat
-description: "Orchestrate the combat team: coordinates game-designer, gameplay-programmer, ai-programmer, technical-artist, sound-designer, and qa-tester to design, implement, and validate a combat feature end-to-end."
+description: "Orchestrate the combat team — game-designer, gameplay-programmer, ai-programmer, technical-artist, sound-designer, qa-tester — design through implement and validate."
argument-hint: "[combat feature description] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
**Argument check:** If no combat feature description is provided, output:
@@ -15,20 +15,58 @@ When this skill is invoked with a valid argument, orchestrate the combat team th
**Decision Points:** At each phase transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next phase.
+In `collaborative` mode, the user must approve before moving to the next phase.
+In `guided` mode the pipeline advances automatically unless a phase is BLOCKED;
+in `autonomous` mode it runs end to end, recording each phase outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `gameplay-programmer` runs the pipeline; escalate `ai-programmer` only if the feature flags AI work. Other Team Composition agents are consulted via the gameplay-programmer, not spawned separately.
+- **`small`**: the full Team Composition pipeline below, as documented.
+- **`studio`**: full pipeline + engine sub-specialists + an adversarial review pass.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Phase 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
## Team Composition
- **game-designer** — Design the mechanic, define formulas and edge cases
@@ -36,12 +74,12 @@ Store the resolved mode for use in all subsequent phases.
- **ai-programmer** — Implement NPC/enemy AI behavior for the feature
- **technical-artist** — Create VFX, shader effects, and visual feedback
- **sound-designer** — Define audio events, impact sounds, and ambient combat audio
-- **engine specialist** (primary) — Validate architecture and implementation patterns are idiomatic for the engine (read from `.claude/docs/technical-preferences.md` Engine Specialists section)
+- **engine specialist** (primary) — Validate architecture and implementation patterns are idiomatic for the engine (the primary specialist is `<engine>-specialist` from `engine.name` — Godot→`godot-specialist`, Unity→`unity-specialist`, Unreal→`unreal-specialist`; fall back to the Primary line of `## Engine Specialists` in `technical-preferences.md`)
- **qa-tester** — Write test cases and validate the implementation
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: game-designer` — Design the mechanic, define formulas and edge cases
- `subagent_type: gameplay-programmer` — Implement the core gameplay code
- `subagent_type: ai-programmer` — Implement NPC/enemy AI behavior
@@ -50,7 +88,36 @@ Use the Task tool to spawn each team member as a subagent:
- `subagent_type: [primary engine specialist]` — Engine idiom validation for architecture and implementation
- `subagent_type: qa-tester` — Write test cases and validate implementation
-Always provide full context in each agent's prompt (design doc path, relevant code files, constraints). Launch independent agents in parallel where the pipeline allows it (e.g., Phase 3 agents can run simultaneously).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+**Substitute a real path for `[path]`.** Every phase that produces an artifact
+names one; most are fixed by the skill that already reads them:
+
+| Phase / agent | Writes to | Destination fixed by |
+|---|---|---|
+| 1 game-designer | `design/gdd/[feature].md` | the GDD convention |
+| 2 gameplay-programmer | `docs/architecture/[feature]-sketch.md` | see note below |
+| 2 engine specialist | `docs/architecture/[feature]-engine-notes.md` | see note below |
+| 5 qa-tester (test cases) | `production/qa/test-cases/[feature]-cases.md` | `/team-qa` Phase 4 |
+| 5 qa-tester (bugs) | `production/qa/bugs/BUG-[NNN]-[slug].md` | `/team-qa` Phase 5 |
+
+Phase 6 is a spoken status report, not an artifact — no path, and none needed.
+
+> **Every phase above names a concrete destination, deliberately.** The Error
+> Recovery Protocol below says "a named artifact that is not on disk is a failed
+> phase" — a check that cannot run when no path was named.
+>
+> **The two `docs/architecture/` entries are a judgement call, not a convention.**
+> That directory holds ADRs (`adr-NNNN-*.md`); a sketch is a precursor to one, not
+> one itself, and **nothing in the repo reads either file**. Say so when
+> reporting, so the sketch is understood as a record rather than an input to a
+> later gate.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
+
+Launch independent agents in parallel where the pipeline allows it (e.g., Phase 3 agents can run simultaneously).
## Pipeline
@@ -79,7 +146,11 @@ Use `AskUserQuestion`:
- `[B] Revise the architecture first — I'll describe what needs to change`
- `[C] Stop here — I'll continue later`
-Only spawn implementation agents if user selects [A].
+Only spawn implementation agents if user selects [A]. (In `guided`/`autonomous`
+mode this architecture gate is a normal phase transition — proceed to
+implementation unless the architecture sketch came back BLOCKED, recording the
+decision via `log_decision` in autonomous mode. The gate is not a release-
+critical or irreversible decision, so it follows the standard pipeline rule.)
### Phase 3: Implementation (parallel where possible)
Delegate in parallel:
@@ -107,15 +178,17 @@ Delegate to **qa-tester**:
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
@@ -126,8 +199,12 @@ Common blockers:
## File Write Protocol
All file writes (design documents, implementation files, test cases) are
-delegated to sub-agents spawned via Task. Each sub-agent enforces the
-"May I write to [path]?" protocol. This orchestrator does not write files directly.
+delegated to sub-agents spawned via `Agent`. Those writes follow the **bounded
+exception** documented above under "Why this does not violate the Collaboration
+Protocol" — the path is one you named, the artifact is new under `production/`,
+`docs/` or `tests/`, and the phase is gated by an `AskUserQuestion`. A sub-agent
+does **not** prompt per write inside those bounds; outside them it must ask.
+This orchestrator does not write files directly.
## Output
diff --git a/.claude/skills/team-level/SKILL.md b/.claude/skills/team-level/SKILL.md
index 3e53c93a..d2a248a1 100644
--- a/.claude/skills/team-level/SKILL.md
+++ b/.claude/skills/team-level/SKILL.md
@@ -1,9 +1,9 @@
---
name: team-level
-description: "Orchestrate level design team: level-designer + narrative-director + world-builder + art-director + systems-designer + qa-tester for complete area/level creation."
+description: "Orchestrate the level team — level-designer, narrative-director, world-builder, art-director, systems-designer, qa-tester — for complete area creation."
argument-hint: "[level name or area to design] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
@@ -12,20 +12,58 @@ When this skill is invoked:
**Decision Points:** At each step transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next step.
+In `collaborative` mode, the user must approve before moving to the next step.
+In `guided` mode the pipeline advances automatically unless a step is BLOCKED;
+in `autonomous` mode it runs end to end, recording each step outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `level-designer` + `gameplay-programmer`. Other agents consulted via these two, not spawned separately.
+- **`small`**: + `systems-designer` + `art-director`.
+- **`studio`**: + `narrative-director` + `world-builder` + `accessibility-specialist`.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Step 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
1. **Read the argument** for the target level or area (e.g., `tutorial`,
`forest dungeon`, `hub town`, `final boss arena`).
@@ -39,7 +77,7 @@ Store the resolved mode for use in all subsequent phases.
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: narrative-director` — Narrative purpose, characters, emotional arc
- `subagent_type: world-builder` — Lore context, environmental storytelling, world rules
- `subagent_type: level-designer` — Spatial layout, pacing, encounters, navigation
@@ -48,13 +86,17 @@ Use the Task tool to spawn each team member as a subagent:
- `subagent_type: accessibility-specialist` — Navigation clarity, colorblind safety, cognitive load
- `subagent_type: qa-tester` — Test cases, boundary testing, playtest checklist
-Always provide full context in each agent's prompt (game concept, pillars, existing level docs, narrative docs).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
3. **Orchestrate the level design team** in sequence:
### Step 1: Narrative + Visual Direction (narrative-director + world-builder + art-director, parallel)
-Spawn all three agents simultaneously — issue all three Task calls before waiting for any result.
+Spawn all three agents simultaneously — issue all three `Agent` calls before waiting for any result.
Spawn the `narrative-director` agent to:
- Define the narrative purpose of this area (what story beats happen here?)
@@ -148,12 +190,15 @@ Spawn the `qa-tester` agent to:
4. **Compile the level design document** combining all team outputs into the
level design template format.
-After all subagent outputs are collected, spawn `level-designer` via Task to compile and write the final document:
-- Pass: all subagent outputs (verbatim), the level brief, game pillars, relevant GDD sections
-- Ask level-designer to: compile into the level design document format, then request user approval before writing ("May I write the compiled level design to design/levels/[level-name].md?")
-- The orchestrator does NOT call Write directly for the final document.
+The orchestrator already holds every sub-agent's output — **compile the document
+itself; do not re-spawn `level-designer` and re-send all outputs verbatim.** That
+second spawn pays a fresh agent's overhead plus a full re-transmission of context
+the orchestrator already has, to move text it is already holding. After compiling
+into the level-design template format, ask the user directly via
+`AskUserQuestion`: "May I write the compiled level design to
+`design/levels/[level-name].md`?" On approval, write it.
-5. **Save to** `design/levels/[level-name].md` (handled by the level-designer subagent after user approval — see above).
+5. **Save to** `design/levels/[level-name].md` after that approval.
6. **Output a summary** with: area overview, encounter count, estimated asset
list, narrative beats, any cross-team dependencies or open questions, open
@@ -162,9 +207,16 @@ After all subagent outputs are collected, spawn `level-designer` via Task to com
## File Write Protocol
-All file writes (level design docs, narrative docs, test checklists) are delegated
-to sub-agents spawned via Task. Each sub-agent enforces the "May I write to [path]?"
-protocol. This orchestrator does not write files directly.
+Per-agent artifacts (narrative docs, test checklists) are written by the
+sub-agent that produced them, under the **bounded exception** documented above
+under "Why this does not violate the Collaboration Protocol" — the path is one
+you named, the artifact is new under `production/`, `docs/` or `tests/`, and the
+phase is gated by an `AskUserQuestion`. A sub-agent does **not** prompt per write
+inside those bounds; outside them it must ask. The **one exception is the final
+compiled level-design document**: the
+orchestrator already holds every input, so it compiles and writes that file
+itself after its own "May I write …?" prompt (Step 4) — re-spawning an agent
+just to write text the orchestrator is already holding is pure overhead.
Verdict: **COMPLETE** — level design document produced and all team outputs compiled.
Verdict: **BLOCKED** — one or more agents blocked; partial report produced with unresolved items listed.
@@ -177,15 +229,17 @@ Verdict: **BLOCKED** — one or more agents blocked; partial report produced wit
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
-
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
+
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
diff --git a/.claude/skills/team-live-ops/SKILL.md b/.claude/skills/team-live-ops/SKILL.md
index 553e09d2..6c579ab8 100644
--- a/.claude/skills/team-live-ops/SKILL.md
+++ b/.claude/skills/team-live-ops/SKILL.md
@@ -1,9 +1,9 @@
---
name: team-live-ops
-description: "Orchestrate the live-ops team for post-launch content planning: coordinates live-ops-designer, economy-designer, analytics-engineer, community-manager, writer, and narrative-director to design and plan a season, event, or live content update."
+description: "Orchestrate the live-ops team — live-ops-designer, economy-designer, analytics-engineer, community-manager, writer — for a season or live event."
argument-hint: "[season name or event description] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
**Argument check:** If no season name or event description is provided, output:
@@ -15,20 +15,58 @@ When this skill is invoked with a valid argument, orchestrate the live-ops team
**Decision Points:** At each phase transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next phase.
+In `collaborative` mode, the user must approve before moving to the next phase.
+In `guided` mode the pipeline advances automatically unless a phase is BLOCKED;
+in `autonomous` mode it runs end to end, recording each phase outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `live-ops-designer` + `economy-designer`. Other agents consulted via these two, not spawned separately.
+- **`small`**: + `analytics-engineer` + `community-manager` (the full pipeline as documented).
+- **`studio`**: + `writer` + `narrative-director` + per-season reviews.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Phase 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
## Team Composition
- **live-ops-designer** — Season structure, event cadence, retention mechanics, battle pass
@@ -40,7 +78,7 @@ Store the resolved mode for use in all subsequent phases.
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: live-ops-designer` — Season/event structure and retention mechanics
- `subagent_type: economy-designer` — Live economy balance and reward pricing
- `subagent_type: analytics-engineer` — Success metrics, A/B tests, event instrumentation
@@ -48,7 +86,13 @@ Use the Task tool to spawn each team member as a subagent:
- `subagent_type: narrative-director` — Seasonal theme and narrative framing
- `subagent_type: writer` — All player-facing text: event descriptions, item names, copy
-Always provide full context in each agent's prompt (game concept path, existing season docs, ethics policy path, current economy state). Launch independent agents in parallel where the pipeline allows it (Phases 3 and 4 can run simultaneously).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
+
+Launch independent agents in parallel where the pipeline allows it (Phases 3 and 4 can run simultaneously).
## Pipeline
@@ -121,30 +165,45 @@ Ask the user to approve the season plan before delegating to production teams. I
## Output Documents
-All documents save to `design/live-ops/`:
+All documents save to `design/live-ops/` — **but the orchestrator asks before
+writing them.** `design/` is NOT one of the three directories the bounded write
+exception covers (`production/`, `docs/`, `tests/`), so a sub-agent handed one of
+these paths must prompt. Do not widen the exception to silence that.
+Follow `team-level`'s pattern instead: sub-agents write their working artifacts
+under `production/`, where the exception does reach them; **you** compile the
+final documents and ask via `AskUserQuestion` — "May I write the season plan to
+`design/live-ops/…`?" — writing them only on approval.
+
+Paths:
- `seasons/S[N]_[name].md` — Season design document (from Phase 1-3)
- `seasons/S[N]_[name]_analytics.md` — Analytics plan (from Phase 4)
- `seasons/S[N]_[name]_comms.md` — Communication calendar (from Phase 6)
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
If a BLOCKED state is unresolvable, end with Verdict: **BLOCKED** instead of COMPLETE.
## File Write Protocol
All file writes (season design docs, analytics plans, communication calendars) are
-delegated to sub-agents spawned via Task. Each sub-agent enforces the
-"May I write to [path]?" protocol. This orchestrator does not write files directly.
+delegated to sub-agents spawned via `Agent`. Those writes follow the **bounded
+exception** documented above under "Why this does not violate the Collaboration
+Protocol" — the path is one you named, the artifact is new under `production/`,
+`docs/` or `tests/`, and the phase is gated by an `AskUserQuestion`. A sub-agent
+does **not** prompt per write inside those bounds; outside them it must ask.
+This orchestrator does not write files directly.
## Output
diff --git a/.claude/skills/team-narrative/SKILL.md b/.claude/skills/team-narrative/SKILL.md
index 45f2833b..c3990161 100644
--- a/.claude/skills/team-narrative/SKILL.md
+++ b/.claude/skills/team-narrative/SKILL.md
@@ -1,9 +1,9 @@
---
name: team-narrative
-description: "Orchestrate the narrative team: coordinates narrative-director, writer, world-builder, and level-designer to create cohesive story content, world lore, and narrative-driven level design."
+description: "Orchestrate the narrative team — narrative-director, writer, world-builder, level-designer — for story, world lore, narrative-driven levels."
argument-hint: "[narrative content description] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
If no argument is provided, output usage guidance and exit without spawning any agents:
@@ -14,20 +14,58 @@ When this skill is invoked with an argument, orchestrate the narrative team thro
**Decision Points:** At each phase transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next phase.
+In `collaborative` mode, the user must approve before moving to the next phase.
+In `guided` mode the pipeline advances automatically unless a phase is BLOCKED;
+in `autonomous` mode it runs end to end, recording each phase outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `writer` only; `narrative-director` invoked only on an explicit pillar conflict. Other agents consulted via the writer, not spawned separately.
+- **`small`**: `narrative-director` + `writer` + (per review_mode) `localization-lead`, `world-builder`.
+- **`studio`**: all narrative agents active + per-system writer reviews.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Phase 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
## Team Composition
- **narrative-director** — Story arcs, character design, dialogue strategy, narrative vision
@@ -39,7 +77,7 @@ Store the resolved mode for use in all subsequent phases.
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: narrative-director` — Story arcs, character design, narrative vision
- `subagent_type: writer` — Dialogue writing, lore entries, in-game text
- `subagent_type: world-builder` — World rules, faction design, history, geography
@@ -47,7 +85,33 @@ Use the Task tool to spawn each team member as a subagent:
- `subagent_type: level-designer` — Level layouts that serve the narrative, pacing
- `subagent_type: localization-lead` — Localization readiness — flags non-localizable strings, cultural assumptions, and i18n gaps
-Always provide full context in each agent's prompt (narrative brief, lore dependencies, character profiles). Launch independent agents in parallel where the pipeline allows it (e.g., Phase 2 agents can run simultaneously).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+**Substitute a real path for `[path]` — this skill's destination is
+`design/narrative/`.** Name it per agent, one file each:
+
+| Agent | Writes to |
+|---|---|
+| narrative-director | `design/narrative/[content-slug]-brief.md` |
+| world-builder | `design/narrative/lore/[topic].md` |
+| writer | `design/narrative/dialogue/[scene-slug].md` |
+| art-director | `design/narrative/[content-slug]-visual-direction.md` |
+
+> **The destination is not a free choice.** `design/narrative/` is read by
+> `/asset-spec`, `/design-review`, `/localize`, `/onboard`,
+> `/project-stage-detect`, `/team-level` and the `cd-narrative` director gate.
+> An artifact written anywhere else is invisible to all seven.
+>
+> The `[path]` contract above has a precondition: the path is one *you* named. A
+> skill that states the contract but names no concrete destination leaves every
+> run to invent one, which defeats it. `/team-qa` Phase 4 carries the same
+> requirement for the same reason.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
+
+Launch independent agents in parallel where the pipeline allows it (e.g., Phase 2 agents can run simultaneously).
## Pipeline
@@ -60,11 +124,17 @@ Delegate to **narrative-director**:
- Output: narrative brief with story requirements
### Phase 2: World Foundation (parallel)
-Delegate in parallel — issue all three Task calls simultaneously before waiting for any result:
+Delegate in parallel — issue all three `Agent` calls simultaneously before waiting for any result:
- **world-builder**: Create or update lore entries for factions, locations, and history relevant to this content. Cross-reference against existing lore for contradictions. Set canon level for new entries.
- **writer**: Draft character dialogue using voice profiles. Ensure all lines are under 120 characters, use named placeholders for variables, and are localization-ready.
- **art-director**: Define character visual design direction for key characters appearing in this content (silhouette, visual archetype, distinguishing features). Specify environmental visual storytelling elements for each key space (prop composition, lighting notes, spatial arrangement). Define tone palette and cinematic direction for any cutscenes or scripted sequences.
+**Phase gate:** collect all three Phase 2 outputs, then apply the Decision Points
+rule before starting Phase 3 — present the lore, dialogue, and visual direction
+summaries and capture approval via `AskUserQuestion` in `collaborative` mode
+(auto-advance in `guided` unless a result is BLOCKED; `log_decision` in
+`autonomous`).
+
### Phase 3: Level Narrative Integration
Delegate to **level-designer**:
- Review the narrative brief and lore foundation
@@ -87,15 +157,17 @@ Delegate in parallel:
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
@@ -106,8 +178,12 @@ Common blockers:
## File Write Protocol
All file writes (narrative docs, dialogue files, lore entries) are delegated to
-sub-agents spawned via Task. Each sub-agent enforces the "May I write to [path]?"
-protocol. This orchestrator does not write files directly.
+sub-agents spawned via `Agent`. Those writes follow the **bounded exception**
+documented above under "Why this does not violate the Collaboration Protocol" —
+the path is one you named, the artifact is new under `production/`, `docs/` or
+`tests/`, and the phase is gated by an `AskUserQuestion`. A sub-agent does **not**
+prompt per write inside those bounds; outside them it must ask. This orchestrator
+does not write files directly.
## Output
diff --git a/.claude/skills/team-polish/SKILL.md b/.claude/skills/team-polish/SKILL.md
index 41fe1e21..6e2f358b 100644
--- a/.claude/skills/team-polish/SKILL.md
+++ b/.claude/skills/team-polish/SKILL.md
@@ -1,9 +1,9 @@
---
name: team-polish
-description: "Orchestrate the polish team: coordinates performance-analyst, technical-artist, sound-designer, and qa-tester to optimize, polish, and harden a feature or area for release quality."
+description: "Orchestrate the polish team — performance-analyst, technical-artist, sound-designer, qa-tester — to optimize and harden a feature or area."
argument-hint: "[feature or area to polish] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
If no argument is provided, output usage guidance and exit without spawning any agents:
@@ -14,20 +14,58 @@ When this skill is invoked with an argument, orchestrate the polish team through
**Decision Points:** At each phase transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next phase.
+In `collaborative` mode, the user must approve before moving to the next phase.
+In `guided` mode the pipeline advances automatically unless a phase is BLOCKED;
+in `autonomous` mode it runs end to end, recording each phase outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `performance-analyst` + `technical-artist`. Other agents consulted via these two, not spawned separately.
+- **`small`**: + `sound-designer` + `qa-tester` (the full pipeline as documented).
+- **`studio`**: full pipeline + engine sub-specialists + an adversarial review pass.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Phase 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
**Director gate skip rule**: Before spawning any Tier 1 director or lead for review (outside of PHASE-GATE triggers), apply the resolved mode: skip if solo mode; skip if lean mode and this is not a PHASE-GATE.
@@ -41,7 +79,7 @@ Store the resolved mode for use in all subsequent phases.
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: performance-analyst` — Profiling, optimization, memory analysis
- `subagent_type: engine-programmer` — Engine-level fixes for rendering, memory, resource loading
- `subagent_type: technical-artist` — VFX polish, shader optimization, visual quality
@@ -49,7 +87,36 @@ Use the Task tool to spawn each team member as a subagent:
- `subagent_type: tools-programmer` — Content pipeline and editor tool verification
- `subagent_type: qa-tester` — Edge case testing, regression testing, soak testing
-Always provide full context in each agent's prompt (target feature/area, performance budgets, known issues). Launch independent agents in parallel where the pipeline allows it (e.g., Phases 3 and 4 can run simultaneously).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+**Substitute a real path for `[path]` — this skill's destination is
+`production/polish/`.** Name it per agent, one file each:
+
+| Agent | Writes to |
+|---|---|
+| performance-analyst | `production/polish/[area]-report-[date].md` |
+| technical-artist | `production/polish/[area]-render-notes-[date].md` |
+| engine-programmer | `production/polish/[area]-engine-fixes-[date].md` |
+| sound-designer | `production/polish/[area]-audio-notes-[date].md` |
+| qa-tester | `production/polish/[area]-verification-[date].md` |
+
+> **Why `production/` and not `docs/`.** These are date-stamped measurements of
+> one run, the same shape as `production/qa/smoke-[date].md` — not durable
+> specifications like `docs/architecture/`. Keeping them beside the other
+> point-in-time process artifacts is what makes a later comparison possible.
+>
+> The `[path]` contract above has a precondition: the path is one *you* named, so
+> a concrete destination must be stated here or every run invents one. Unlike
+> `/team-qa` and `/team-narrative`, whose destinations are fixed by their
+> consumers, this location has no reader in the repo and was chosen deliberately.
+> **Nothing reads `production/polish/` yet** — say so when reporting, so the user
+> knows the report is a record rather than an input to a later gate.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
+
+Launch independent agents in parallel where the pipeline allows it (e.g., Phases 3 and 4 can run simultaneously).
## Pipeline
@@ -107,15 +174,17 @@ Delegate to **qa-tester**:
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
@@ -126,8 +195,12 @@ Common blockers:
## File Write Protocol
All file writes (performance reports, test results, evidence docs) are delegated to
-sub-agents spawned via Task. Each sub-agent enforces the "May I write to [path]?"
-protocol. This orchestrator does not write files directly.
+sub-agents spawned via `Agent`. Those writes follow the **bounded exception**
+documented above under "Why this does not violate the Collaboration Protocol" —
+the path is one you named, the artifact is new under `production/`, `docs/` or
+`tests/`, and the phase is gated by an `AskUserQuestion`. A sub-agent does **not**
+prompt per write inside those bounds; outside them it must ask. This orchestrator
+does not write files directly.
## Output
diff --git a/.claude/skills/team-qa/SKILL.md b/.claude/skills/team-qa/SKILL.md
index 55e0c73f..acb04c4a 100644
--- a/.claude/skills/team-qa/SKILL.md
+++ b/.claude/skills/team-qa/SKILL.md
@@ -1,11 +1,10 @@
---
name: team-qa
-description: "Orchestrate the QA team through a full testing cycle. Coordinates qa-lead (strategy + test plan) and qa-tester (test case writing + bug reporting) to produce a complete QA package for a sprint or feature. Covers: test plan generation, test case writing, smoke check gate, manual QA execution, and sign-off report."
+description: "Orchestrate the QA team through a full testing cycle — qa-lead strategy and test plan, qa-tester case writing, execution, sign-off."
argument-hint: "[sprint | feature: system-name] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Agent, AskUserQuestion
model: sonnet
-agent: qa-lead
---
When this skill is invoked, orchestrate the QA team through a structured testing cycle.
@@ -13,20 +12,58 @@ When this skill is invoked, orchestrate the QA team through a structured testing
**Decision Points:** At each phase transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next phase.
+In `collaborative` mode, the user must approve before moving to the next phase.
+In `guided` mode the pipeline advances automatically unless a phase is BLOCKED;
+in `autonomous` mode it runs end to end, recording each phase outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `qa-tester` only; `qa-lead` invoked at phase gates only.
+- **`small`**: `qa-lead` + `qa-tester` pipeline (as documented).
+- **`studio`**: `qa-lead` + per-story `qa-tester` spawn + sign-off.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Phase 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
## Team Composition
@@ -35,11 +72,17 @@ Store the resolved mode for use in all subsequent phases.
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: qa-lead` — Strategy, planning, classification, sign-off
- `subagent_type: qa-tester` — Test case writing and bug report writing
-Always provide full context in each agent's prompt (story file paths, QA plan path, scope constraints). Launch independent qa-tester tasks in parallel where possible (e.g., multiple stories in Phase 5 can be scaffolded simultaneously).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
+
+Launch independent qa-tester tasks in parallel where possible (e.g., multiple stories in Phase 5 can be scaffolded simultaneously).
## Pipeline
@@ -52,14 +95,14 @@ Before doing anything else, gather the full scope:
- If argument is `feature: [system-name]`: glob story files tagged for that system
- If no argument: read `production/session-state/active.md` and `production/sprint-status.yaml` (if present) to infer the active sprint
-2. Read `production/stage.txt` to confirm the current project phase.
+2. Read `project.stage` from `project.yaml` (fallback `production/stage.txt`) to confirm the current project phase.
3. Count stories found and report to the user:
> "QA cycle starting for [sprint/feature]. Found [N] stories. Current stage: [stage]. Ready to begin QA strategy?"
### Phase 2: QA Strategy (qa-lead)
-Spawn `qa-lead` via Task to review all in-scope stories and produce a QA strategy.
+Spawn `qa-lead` via `Agent` to review all in-scope stories and produce a QA strategy.
Prompt the qa-lead to:
- Read each story file
@@ -117,11 +160,20 @@ Write only after receiving approval.
For each story requiring manual QA (Visual/Feel, UI, Integration without automated tests):
-Spawn `qa-tester` via Task for each story (run in parallel where possible), providing:
+Spawn `qa-tester` via `Agent` for each story (run in parallel where possible), providing:
- The story file path
- The relevant section of the QA plan for that story
- The GDD acceptance criteria for the system being tested (if available)
- Instructions to write detailed test cases covering all acceptance criteria
+- **The output path: `production/qa/test-cases/[story-slug]-cases.md`.** Name it
+ explicitly in the prompt, one per story.
+
+> **Why the path is stated here rather than left to the orchestrator.** The
+> bounded write exception above holds only when "the path is one **you** named in
+> the prompt". This is the phase that spawns agents *in parallel*, so it is where
+> an unnamed destination does the most damage: each agent improvises its own, and
+> two runs file the same artifact in two places. The phase reads correctly right
+> up until two agents need somewhere to put their output.
Each test case set should include:
- **Preconditions**: game state required before testing begins
@@ -157,7 +209,28 @@ options:
- "BLOCKED — cannot test yet (reason)"
```
-After each FAIL result: use `AskUserQuestion` to collect the failure description, then spawn `qa-tester` via Task to write a formal bug report in `production/qa/bugs/`.
+After each FAIL result: use `AskUserQuestion` to collect the failure description, then spawn `qa-tester` via `Agent` to write a formal bug report in `production/qa/bugs/`.
+
+**After each PASS or PASS WITH NOTES on a Visual/Feel or UI story, write the
+evidence artifact** to `production/qa/evidence/[story-slug]-evidence.md`, from
+`.claude/docs/templates/test-evidence.md`, carrying the sign-off table intact.
+Save the screenshot you took while testing into the same directory and reference
+it from the doc — `/story-done` checks for a retained image, not just the
+write-up.
+
+> **This is not optional bookkeeping — it is the artifact the next skill gates
+> on.** `/story-done` globs `production/qa/evidence/` for Visual/Feel and UI
+> stories and reads the sign-off table; `/story-readiness`,
+> `/test-evidence-review` and `gate-release` read the same directory. Write
+> anywhere else and a story can pass a full manual QA cycle here, then be told by
+> `/story-done` that no visual evidence exists. Visual/Feel and UI gates are
+> **BLOCKING by default**, so that is a deadlock — QA passed, story cannot
+> close. It is a merely confusing flag only where `testing.strict.ui` or
+> `.visual` has been explicitly set to `false`.
+>
+> Leave the sign-off rows **unchecked** unless the sign-off actually happened in
+> this session. An evidence file with pre-ticked approvals is worse than none: it
+> converts a missing signature into a recorded one.
Bug report naming: `BUG-[NNN]-[short-slug].md` (increment NNN from existing bugs in the directory).
@@ -169,7 +242,7 @@ After collecting all results, summarize:
### Phase 6: QA Sign-Off Report
-Spawn `qa-lead` via Task to produce the sign-off report using all results from Phases 4–6.
+Spawn `qa-lead` via `Agent` to produce the sign-off report using all results from Phases 4–6.
The sign-off report format:
@@ -188,7 +261,7 @@ The sign-off report format:
|----|-------|----------|--------|
| BUG-001 | [story] | S2 | Open |
-### Verdict: APPROVED / APPROVED WITH CONDITIONS / NOT APPROVED
+### Verdict: NOT ASSESSED / APPROVED / APPROVED WITH CONDITIONS / NOT APPROVED
**Conditions** (if any): [list what must be fixed before the build advances]
@@ -197,11 +270,33 @@ The sign-off report format:
```
Verdict rules:
+
+**Precondition, checked first.** APPROVED and APPROVED WITH CONDITIONS both
+require that **every story in scope produced executed evidence** — a test that
+ran, or a manual case that was walked. If any story is BLOCKED, unexecuted, or
+has no evidence, the verdict is **NOT ASSESSED** and the other three rules are
+not evaluated.
+
+- **NOT ASSESSED — NO EVIDENCE**: One or more stories produced no executed
+ evidence (BLOCKED, tests not written, cases not walked, or smoke check FAIL /
+ UNKNOWN). This is **not** a pass and **not** a fail; it means QA did not
+ happen. Say which stories and why.
- **APPROVED**: All stories PASS or PASS WITH NOTES; no S1/S2 bugs open
- **APPROVED WITH CONDITIONS**: S3/S4 bugs open, or PASS WITH NOTES issues documented; no S1/S2 bugs
- **NOT APPROVED**: Any S1/S2 bugs open; or stories FAIL without documented workaround
+> **Why the precondition exists.** The three rules below it assume
+> every story resolves to PASS or FAIL. A sprint where nothing was executed
+> trips none of the NOT APPROVED conditions and **vacuously satisfies "no S1/S2
+> bugs open"** — because zero executed tests means zero observed failures. Read
+> literally, and without this precondition, the rules let a completely untested
+> build reach APPROVED — a `qa-lead` reaching NOT APPROVED on intent would find
+> the letter of the rules did not support it. A
+> sign-off asserts verified quality; without this precondition the rules cannot
+> tell "verified good" from "never looked".
+
Next step guidance by verdict:
+- NOT ASSESSED: "QA did not run to completion. Produce the missing evidence — write the Logic tests, walk the manual cases, run `/smoke-check` — then re-run `/team-qa`. Do not advance the build on this verdict."
- APPROVED: "Build is ready for the next phase. Run `/gate-check` to validate advancement."
- APPROVED WITH CONDITIONS: "Resolve conditions before advancing. S3/S4 bugs may be deferred to polish."
- NOT APPROVED: "Resolve S1/S2 bugs and re-run `/team-qa` or targeted manual QA before advancing."
@@ -212,15 +307,17 @@ Write only after receiving approval.
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
-
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
+
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
diff --git a/.claude/skills/team-release/SKILL.md b/.claude/skills/team-release/SKILL.md
index b002091f..39596fd9 100644
--- a/.claude/skills/team-release/SKILL.md
+++ b/.claude/skills/team-release/SKILL.md
@@ -1,9 +1,9 @@
---
name: team-release
-description: "Orchestrate the release team: coordinates release-manager, qa-lead, devops-engineer, and producer to execute a release from candidate to deployment."
+description: "Orchestrate the release team — release-manager, qa-lead, devops-engineer, producer — to execute a release from candidate to deployment."
argument-hint: "[version number or 'next'] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
**Argument check:** If no version number is provided:
@@ -16,20 +16,58 @@ When this skill is invoked, orchestrate the release team through a structured pi
**Decision Points:** At each phase transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next phase.
+In `collaborative` mode, the user must approve before moving to the next phase.
+In `guided` mode the pipeline advances automatically unless a phase is BLOCKED;
+in `autonomous` mode it runs end to end, recording each phase outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `release-manager` only. Other agents consulted via the release-manager, not spawned separately.
+- **`small`**: + `producer` + `devops-engineer` + `qa-lead`.
+- **`studio`**: + `security-engineer` + `analytics-engineer` + `localization-lead`.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Phase 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
## Team Composition
- **release-manager** — Release branch, versioning, changelog, deployment
@@ -42,7 +80,7 @@ Store the resolved mode for use in all subsequent phases.
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: release-manager` — Release branch, versioning, changelog, deployment
- `subagent_type: qa-lead` — Test sign-off, regression suite, release quality gate
- `subagent_type: devops-engineer` — Build pipeline, artifacts, deployment automation
@@ -52,7 +90,35 @@ Use the Task tool to spawn each team member as a subagent:
- `subagent_type: producer` — Go/no-go decision, stakeholder communication
- `subagent_type: network-programmer` — Netcode stability sign-off (invoke if game has multiplayer)
-Always provide full context in each agent's prompt (version number, milestone status, known issues). Launch independent agents in parallel where the pipeline allows it (e.g., Phase 3 agents can run simultaneously).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+**Substitute a real path for `[path]`.** One file per phase under
+`production/releases/`, except the two whose homes are fixed elsewhere:
+
+| Phase / agent | Writes to | Destination fixed by |
+|---|---|---|
+| 1 producer | `production/releases/release-plan-[version].md` | this skill |
+| 2 release-manager | `production/releases/release-checklist-[version].md` | `/release-checklist` |
+| 3 qa-lead | `production/releases/qa-gate-[version].md` | this skill |
+| 4 specialists | `production/releases/signoff-[version].md` | this skill |
+| 5 go/no-go | `production/releases/go-no-go-[version].md` | this skill |
+| 6 community-manager | `docs/patch-notes/[version].md` | `/patch-notes` |
+| 7 release-manager | `production/releases/release-report-[version].md` | this skill |
+
+> **Every one of those seven outputs needs a stated destination.**
+> `production/releases/` is where `/release-checklist` already writes, and
+> `docs/patch-notes/[version].md` is where `/patch-notes` already writes, so the
+> release record lands in one place regardless of which skill produced it.
+>
+> **A separate file per phase, not one appended record.** Phase 3 and Phase 4
+> spawn agents in parallel; two agents appending to one file race, and the loser's
+> section vanishes silently.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
+
+Launch independent agents in parallel where the pipeline allows it (e.g., Phase 3 agents can run simultaneously).
## Pipeline
@@ -109,11 +175,21 @@ After the user selects "Override NO-GO with documented rationale":
- Only then proceed to Phase 6.
### Phase 6: Deployment (if GO)
-Delegate to **release-manager** + **devops-engineer**:
+
+**This phase always requires explicit user approval regardless of
+`modes.automation` — including `autonomous` mode.** Production deployment is
+irreversible and high-stakes; it is NOT covered by the configurable
+`automation_always_ask` categories, so this skill guards it unconditionally.
+Before tagging or deploying, use `AskUserQuestion`:
+- Prompt: "Producer verdict is GO. Execute Phase 6 — tag, deploy to staging,
+ deploy to production?"
+- Options: `[A] Yes, deploy` / `[B] Staging only — hold production` / `[C] Stop here`
+
+Only after explicit approval, delegate to **release-manager** + **devops-engineer**:
- Tag the release in version control
- Generate changelog using `/changelog`
- Deploy to staging for final smoke test
-- Deploy to production
+- Deploy to production (only if the user approved production above)
- Human team action: Monitor dashboards and error rates for 48 hours post-release. Schedule a follow-up retrospective using `/retrospective` at the 48-hour mark.
Delegate to **community-manager** (in parallel with deployment):
@@ -132,15 +208,17 @@ Delegate to **community-manager** (in parallel with deployment):
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
@@ -151,8 +229,20 @@ Common blockers:
## File Write Protocol
All file writes (release checklists, changelogs, patch notes, deployment scripts) are
-delegated to sub-agents and sub-skills. Each enforces the "May I write to [path]?"
-protocol. This orchestrator does not write files directly.
+delegated to sub-agents and sub-skills. The two follow **different** rules, and the
+distinction matters here more than anywhere else in the pipeline:
+
+- **Sub-agents spawned via `Agent`** follow the **bounded exception** documented above
+ under "Why this does not violate the Collaboration Protocol" — the path is one you
+ named, the artifact is new under `production/`, `docs/` or `tests/`, and the phase
+ is gated by an `AskUserQuestion`. A sub-agent does **not** prompt per write inside
+ those bounds; outside them it must ask.
+- **Sub-skills** are not sub-agents and the exception does not reach them. They
+ follow the normal Collaboration Protocol and ask before writing.
+
+This orchestrator does not write files directly. Nothing here authorises an
+outward-facing or irreversible action — tags, pushes, builds and storefront changes
+require explicit confirmation regardless of which rule above applies.
## Output
@@ -165,4 +255,4 @@ Verdict: **BLOCKED** — release halted; go/no-go was NO or a hard blocker is un
- Monitor post-release dashboards for 48 hours.
- Run `/retrospective` if significant issues occurred during the release.
-- Update `production/stage.txt` to `Live` after successful deployment.
+- Update `project.stage` in `project.yaml` to `Release` after successful deployment (also write `Release` to `production/stage.txt` for backward compatibility with hooks that haven't migrated). `Release` is the terminal stage in the `project.stage` enum — there is no post-launch stage value. Record live/post-launch status in the release report, not in `project.stage`.
diff --git a/.claude/skills/team-ui/SKILL.md b/.claude/skills/team-ui/SKILL.md
index 50707bd0..26dee90b 100644
--- a/.claude/skills/team-ui/SKILL.md
+++ b/.claude/skills/team-ui/SKILL.md
@@ -1,9 +1,9 @@
---
name: team-ui
-description: "Orchestrate the UI team through the full UX pipeline: from UX spec authoring through visual design, implementation, review, and polish. Integrates with /ux-design, /ux-review, and studio UX templates."
+description: "Orchestrate the UI team through the UX pipeline — authoring, visual design, implementation, review, polish. Uses /ux-design, /ux-review, studio templates."
argument-hint: "[UI feature description] [--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion, TodoWrite
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion, TaskCreate, TaskGet, TaskList, TaskUpdate
model: sonnet
---
When this skill is invoked, orchestrate the UI team through a structured pipeline.
@@ -11,20 +11,58 @@ When this skill is invoked, orchestrate the UI team through a structured pipelin
**Decision Points:** At each phase transition, use `AskUserQuestion` to present
the user with the subagent's proposals as selectable options. Write the agent's
full analysis in conversation, then capture the decision with concise labels.
-The user must approve before moving to the next phase.
+In `collaborative` mode, the user must approve before moving to the next phase.
+In `guided` mode the pipeline advances automatically unless a phase is BLOCKED;
+in `autonomous` mode it runs end to end, recording each phase outcome via
+`log_decision`. Decisions in `automation_always_ask` categories
+(`is_always_ask_category` helper) always prompt regardless of mode. See
+`.claude/docs/automation-modes.md`.
-## Phase 0: Resolve Review Mode
+## Phase 0: Resolve Config
-1. If `--review [mode]` was passed as an argument, use that mode.
-2. Else read `production/review-mode.txt` — use whatever is written there.
-3. Else default to `lean`.
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation,team.size`
-Modes:
+Resolved above — use as-is; `--review` overrides `review_mode`. No block →
+defaults in `.claude/docs/config-resolution.md`.
+
+`review_mode` sets gate depth:
- `full` — spawn all director and lead gates as described
- `lean` — skip director gates unless they are PHASE-GATE type (CD-PHASE-GATE, TD-PHASE-GATE, PR-PHASE-GATE, AD-PHASE-GATE)
- `solo` — skip all director gate spawning entirely; run the skill without any agent gates
-Store the resolved mode for use in all subsequent phases.
+`automation` drives the Decision Points note above. See the Decision Points note above and
+`.claude/docs/automation-modes.md` for how each mode changes pipeline behavior.
+
+**`team.size`**: which agents are active (orthogonal to review_mode gate-depth and workflow docs).
+- **`individual`** (default): `ui-programmer` + `ux-designer`. Other agents consulted via these two, not spawned separately.
+- **`small`**: + `accessibility-specialist` + `art-director`.
+- **`studio`**: + engine UI specialist + an adversarial review pass.
+Directors (CD/TD/PR) still spawn at phase gates regardless of size; a non-core agent needed at `individual` routes through the nearest active core agent with an informational note. **"Phase gate" means any phase that ends in an `AskUserQuestion` decision point before the pipeline advances** — not every phase. Apply the test literally: if the phase below has no decision point, it is not a gate, and an agent restricted to "phase gates only" is not spawned for it. This active-set scoping applies throughout the pipeline below: any phase that names an agent outside the active set routes through the nearest core agent rather than spawning it.
+
+**Announce the active set before Step 1 — never let the collapse be silent.**
+Before spawning anything, state in one line which agents this run will actually
+spawn, and which the pipeline below names but will **not** spawn at the resolved
+`team.size`. For example:
+
+> `Active set (team.size: <resolved>): <the agents listed for that size above>.`
+> `Not spawned this run: <every other agent this pipeline names> — consulted`
+> `through <nearest active core agent>. Raise team.size (or modes.rigor) to widen.`
+
+Fill it from the `team.size` list directly above and the agents this file's own
+pipeline names — not from an example. Both sets differ per orchestrator.
+
+The pipeline below reads as a multi-agent fan-out and at the shipped default it
+is one or two agents — `team-release` names eight and runs one, `team-narrative`
+names six across five phases and runs `writer` alone. **The collapse is correct**:
+`team.size` is rigor-fronted and the narrow default is the token lever, measured
+at roughly 10x. What was wrong is that nothing said so, so a reader could not
+distinguish a correctly-collapsed run from a broken pipeline, and the per-agent
+"routes through the nearest core agent with an informational note" rule above
+fires at routing time and never states the shape of the run as a whole.
+
+This is the same rule as the skipped-check reporting elsewhere in this file: **a constraint that is enforced but never surfaced is
+indistinguishable, to the person reading the output, from one that was never
+enforced.**
**Director gate skip rule**: Before spawning creative-director, art-director, or any other Tier 1/2 director for review (outside of PHASE-GATE triggers), apply the resolved mode: skip if solo mode; skip if lean mode and this is not a PHASE-GATE.
@@ -32,9 +70,14 @@ Store the resolved mode for use in all subsequent phases.
- **ux-designer** — User flows, wireframes, accessibility, input handling
- **ui-programmer** — UI framework, screens, widgets, data binding, implementation
- **art-director** — Visual style, layout polish, consistency with art bible
-- **engine UI specialist** — Validates UI implementation patterns against engine-specific best practices (read from `.claude/docs/technical-preferences.md` Engine Specialists → UI Specialist)
+- **engine UI specialist** — Validates UI implementation patterns against engine-specific best practices (`specialists.ui` from `project.yaml`; if absent, the UI Specialist line of `## Engine Specialists` in `.claude/docs/technical-preferences.md`)
- **accessibility-specialist** — Audits accessibility compliance at Phase 4
+> **`specialists.ui: null` means UNSET.** Treat it as absent and skip the engine
+> UI specialist; never spawn `null` as an agent name. The v1.0 migration writes
+> the whole `specialists` block whenever any one member is set, so `null` here is
+> ordinary — and the config reader returns it as the non-empty string `"null"`.
+
**Templates used by this pipeline:**
- `ux-spec.md` — Standard screen/flow UX specification
- `hud-design.md` — HUD-specific UX specification
@@ -43,14 +86,20 @@ Store the resolved mode for use in all subsequent phases.
## How to Delegate
-Use the Task tool to spawn each team member as a subagent:
+Use the `Agent` tool to spawn each team member as a subagent:
- `subagent_type: ux-designer` — User flows, wireframes, accessibility, input handling
- `subagent_type: ui-programmer` — UI framework, screens, widgets, data binding
- `subagent_type: art-director` — Visual style, layout polish, art bible consistency
- `subagent_type: [UI engine specialist]` — Engine-specific UI pattern validation (e.g., unity-ui-specialist, ue-umg-specialist, godot-specialist)
- `subagent_type: accessibility-specialist` — Accessibility compliance audit
-Always provide full context in each agent's prompt (feature requirements, existing UI patterns, platform targets). Launch independent agents in parallel where the pipeline allows it (e.g., Phase 4 review agents can run simultaneously).
+**Brief each agent — do not dump context.** Read the shared inputs **once** and pass a distilled brief inline: the lines each agent actually needs, never a file path for a document you have already read (an agent handed a path re-reads the whole file). Pass a path only for a document you have not read and only that agent needs.
+
+**End every agent prompt with a return contract:** "Write your full output to `[path]` — that named path is your write authorisation under the bounded exception below, so write it without a separate approval prompt. Return **only** (1) the path written, (2) a ≤5-bullet summary of decisions, (3) any BLOCKED/CONCERNS items, one line each. Do not restate the documents you read." Without it, an agent returns everything it read back into this session.
+
+> **Why this does not violate the Collaboration Protocol.** `CLAUDE.md` requires an agent to ask "May I write this to [filepath]?" before Write/Edit. A subagent spawned here writes **without** asking, and that is a deliberate, bounded exception rather than an oversight — the same call already made for `consistency-check` appending to `active.md`. The exception holds only when all three are true: (1) the path is one **you** named in the prompt, so the user approved the destination when they approved the phase; (2) it is a new artifact under `production/`, `docs/` or `tests/`, never an edit to existing source or config; (3) the phase that produced it is itself gated by an `AskUserQuestion` before the pipeline advances. Outside those three, the agent must ask. **Do not "fix" this by asking per subagent** — a prompt per agent per phase makes an orchestrator unusable, which is why the exception exists.
+
+Launch independent agents in parallel where the pipeline allows it (e.g., Phase 4 review agents can run simultaneously).
## Pipeline
@@ -63,6 +112,30 @@ Before designing anything, read and synthesize:
- `design/ux/interaction-patterns.md` — existing patterns to reuse (not reinvent)
- `design/accessibility-requirements.md` — committed accessibility tier (e.g., Basic, Enhanced, Full)
+**Report the status of every document above before designing anything.** Phase 1a
+reads five inputs; for a long time only the pattern library was guarded, and the
+other four could be absent without anything noticing. List each as
+present or ABSENT.
+
+**`design/accessibility-requirements.md` is the one that must not pass silently.**
+It carries the committed accessibility tier, which **Phase 3 implements against**
+and **Phase 4 gates on** ("verify compliance against the committed accessibility
+tier … flag any violations as blockers"). If the file is missing there is no tier,
+so that gate has no criterion and would pass while checking nothing — a gate made
+of an absent standard, the same shape as an assertion that can never fail. When it
+is absent:
+- Say so here, and carry it forward: **Phase 4 must report
+ `Accessibility: NOT ASSESSED — no committed tier (design/accessibility-requirements.md absent)`
+ and must NOT report the accessibility gate as passed.**
+- The ux-designer states which tier they designed against as an explicit
+ assumption, so a later reader can see it was assumed rather than committed.
+- Recommend `/ux-design accessibility` to establish the tier.
+
+Absence of `design/gdd/game-concept.md`, `design/player-journey.md` or
+`design/ux/hud.md` is not blocking, but name each missing one in the brief you
+pass to the ux-designer so they design knowing what context they lack, rather
+than inferring it.
+
**If `design/ux/interaction-patterns.md` does not exist**, surface the gap immediately:
> "interaction-patterns.md does not exist — no existing patterns to reuse."
@@ -104,13 +177,13 @@ Delegate to **art-director**:
### Phase 3: Implementation
-Before implementation begins, spawn the **engine UI specialist** (from `.claude/docs/technical-preferences.md` Engine Specialists → UI Specialist) to review the UX spec and visual design spec for engine-specific implementation guidance:
+Before implementation begins, spawn the **engine UI specialist** (`specialists.ui` from `project.yaml`; if absent, the UI Specialist line of `## Engine Specialists` in `.claude/docs/technical-preferences.md`) to review the UX spec and visual design spec for engine-specific implementation guidance:
- Which engine UI framework should be used for this screen? (e.g., UI Toolkit vs UGUI in Unity, Control nodes vs CanvasLayer in Godot, UMG vs CommonUI in Unreal)
- Any engine-specific gotchas for the proposed layout or interaction patterns?
- Recommended widget/node structure for the engine?
- Output: engine UI implementation notes to hand off to ui-programmer before they begin
-If no engine is configured, skip this step.
+If no engine is configured, skip this step. **Record `Engine validation: NOT ASSESSED — no engine configured (`engine.name` unset in `project.yaml`)` in this run's output.** A skipped check that says nothing is indistinguishable from a check that passed; the reader cannot tell engine guidance was never sought.
Delegate to **ui-programmer**:
- Implement the UI following the UX spec and visual design spec
@@ -128,7 +201,7 @@ Delegate to **ui-programmer**:
Delegate in parallel:
- **ux-designer**: Verify implementation matches wireframes and interaction spec. Test keyboard-only and gamepad-only navigation. Check accessibility features function correctly.
- **art-director**: Verify visual consistency with art bible. Check at minimum and maximum supported resolutions.
-- **accessibility-specialist**: Verify compliance against the committed accessibility tier documented in `design/accessibility-requirements.md`. Flag any violations as blockers.
+- **accessibility-specialist**: Verify compliance against the committed accessibility tier documented in `design/accessibility-requirements.md`. Flag any violations as blockers. **If that file is absent there is no committed tier, so this gate has no criterion: report `Accessibility: NOT ASSESSED — no committed tier (design/accessibility-requirements.md absent)` and do NOT report the gate as passed**. Carry forward whatever tier Phase 1a recorded as assumed, and say plainly that it was assumed.
All three review streams must report before proceeding to Phase 5.
@@ -150,15 +223,17 @@ All three review streams must report before proceeding to Phase 5.
## Error Recovery Protocol
-If any spawned agent (via Task) returns BLOCKED, errors, or cannot complete:
+**First, verify the artifact.** If the return contract named a path, check the
+path exists before treating the phase as done — **a named artifact that is not
+on disk is a failed phase, however fluent the response reads.** An agent can
+burn a full phase and return a plausible preamble having written nothing, which
+is neither BLOCKED nor an error nor "cannot complete", so the trigger below
+never fires. Resume it naming the unmet contract; the context is
+usually still there.
-1. **Surface immediately**: Report "[AgentName]: BLOCKED — [reason]" to the user before continuing to dependent phases
-2. **Assess dependencies**: Check whether the blocked agent's output is required by subsequent phases. If yes, do not proceed past that dependency point without user input.
-3. **Offer options** via AskUserQuestion with choices:
- - Skip this agent and note the gap in the final report
- - Retry with narrower scope
- - Stop here and resolve the blocker first
-4. **Always produce a partial report** — output whatever was completed. Never discard work because one agent blocked.
+If any spawned agent returns BLOCKED, errors, or cannot complete: **surface it
+immediately, don't proceed past a dependency it blocks, and always produce a
+partial report.** Full procedure: `.claude/docs/error-recovery-protocol.md`.
Common blockers:
- Input file missing (story not found, GDD absent) → redirect to the skill that creates it
@@ -169,8 +244,17 @@ Common blockers:
## File Write Protocol
All file writes (UX specs, interaction pattern library updates, implementation files) are
-delegated to sub-agents and sub-skills (`/ux-design`, `ui-programmer`). Each enforces the
-"May I write to [path]?" protocol. This orchestrator does not write files directly.
+delegated to sub-agents and sub-skills. The two follow **different** rules:
+
+- **Sub-agents spawned via `Agent`** (e.g. `ui-programmer`) follow the **bounded
+ exception** documented above under "Why this does not violate the Collaboration
+ Protocol" — the path is one you named, the artifact is new under `production/`,
+ `docs/` or `tests/`, and the phase is gated by an `AskUserQuestion`. A sub-agent
+ does **not** prompt per write inside those bounds; outside them it must ask.
+- **Sub-skills** (`/ux-design`) are not sub-agents and the exception does not reach
+ them. They follow the normal Collaboration Protocol and ask before writing.
+
+This orchestrator does not write files directly.
## Output
diff --git a/.claude/skills/tech-debt/SKILL.md b/.claude/skills/tech-debt/SKILL.md
index 5d624dcc..a419d28b 100644
--- a/.claude/skills/tech-debt/SKILL.md
+++ b/.claude/skills/tech-debt/SKILL.md
@@ -1,12 +1,20 @@
---
name: tech-debt
-description: "Track, categorize, and prioritize technical debt across the codebase. Scans for debt indicators, maintains a debt register, and recommends repayment scheduling."
+description: "Track, categorize and prioritize technical debt across the codebase — scans for debt indicators, maintains a register."
argument-hint: "[scan|add|prioritize|report]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, AskUserQuestion
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
## Phase 1: Parse Subcommand
Determine the mode from the argument:
@@ -41,6 +49,22 @@ Categorize each finding:
- **Dependency Debt**: Outdated packages, deprecated APIs, version conflicts
- **Performance Debt**: Known slow paths, unoptimized queries, memory issues
+**Before presenting anything, establish that there was something to scan.**
+Count the source files the scan actually covered. If that count is **zero** —
+no `src/` directory, or it holds no source files — report:
+
+> **NOT ASSESSED — no source files to scan.** `src/` contains no code, so
+> "no debt indicators found" would be a statement about an empty search, not
+> about the codebase. Run this once implementation is under way.
+
+and stop. Do not write to the register and do not emit a COMPLETE verdict.
+
+The distinction is the whole point of the scan: **zero findings over 400 files
+is a clean codebase; zero findings over zero files is no information at all.**
+Rendering both as "COMPLETE — scan findings written to register" reads as the
+first. State the denominator whenever findings are reported,
+including when it is large and the count is genuinely zero.
+
Present the findings to the user.
Ask: "May I write these findings to `docs/tech-debt-register.md`?"
diff --git a/.claude/skills/test-evidence-review/SKILL.md b/.claude/skills/test-evidence-review/SKILL.md
index 279cd388..9eafef2b 100644
--- a/.claude/skills/test-evidence-review/SKILL.md
+++ b/.claude/skills/test-evidence-review/SKILL.md
@@ -1,12 +1,20 @@
---
name: test-evidence-review
-description: "Quality review of test files and manual evidence documents. Goes beyond existence checks — evaluates assertion coverage, edge case handling, naming conventions, and evidence completeness. Produces ADEQUATE/INCOMPLETE/MISSING verdict per story. Run before QA sign-off or on demand."
+description: "Quality review of test files and evidence — goes beyond existence, evaluates assertion coverage. ADEQUATE/INCOMPLETE/MISSING/NOT ASSESSED per story."
argument-hint: "[story-path | sprint | system-name]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Test Evidence Review
`/smoke-check` verifies that test files **exist** and **pass**. This skill
@@ -40,17 +48,45 @@ Based on the argument:
**Single story**: Read the story file directly. Extract: Story Type, Test
Evidence section, story slug, system name.
-**Sprint**: Read the most recently modified file in `production/sprints/`.
-Extract the list of story file paths from the sprint plan. Read each story file.
-
-**System**: Glob `production/epics/[system-name]/story-*.md`. Read each.
-
-For each story, collect:
-- `Type:` field (Logic / Integration / Visual/Feel / UI / Config/Data)
-- `## Test Evidence` section — the stated expected test file path or evidence doc
-- Story slug (from file name)
-- System name (from directory path)
-- Acceptance Criteria list (all checkbox items)
+**Sprint**: Read the most recently modified file in `production/sprints/`; extract
+the list of story file paths from the sprint plan.
+
+**System**: Glob `production/epics/[system-name]/story-*.md`.
+
+> **If the resolved scope contains ZERO stories, stop here.** Report
+> `NOT ASSESSED — no stories in scope`, name which scope was searched and which
+> path was empty, and route: no sprint file → `/sprint-plan new`; a sprint plan
+> listing no stories → `/create-stories [epic-slug]`; a `[system-name]` glob that
+> matched nothing → name the glob. Do not continue to Section 3.
+>
+> **Guard the empty scope, not just the per-story unknown.** The verdict
+> vocabulary here — ADEQUATE / INCOMPLETE / MISSING — needs a "could not check"
+> value, or an unverifiable story acquires a verdict claiming somebody verified
+> it; that is what `NOT ASSESSED` is for. **But giving the per-story unknown a
+> home does nothing for the empty-scope unknown.** With no stories
+> the Section 6 report renders an empty Summary table and ends
+> `BLOCKING items: 0 / ADVISORY items: 0` — which reads as *everything reviewed,
+> all fine*. This skill gates story closure, and `coding-standards.md` marks Logic,
+> Integration, Visual/Feel and UI evidence BLOCKING, so a false-clean closes stories nobody
+> reviewed.
+>
+> This is a recurring shape: the sophisticated inner rule present, the outer
+> boundary unguarded. Ask it of any skill that aggregates —
+> **what does this emit when the set is empty?**
+
+For the resulting story set, collect the fields below with **targeted section
+greps, not a full read of each story**:
+```
+Grep pattern="## Test Evidence" glob="production/epics/**/story-*.md" output_mode="content" -A 8
+Grep pattern="## Acceptance Criteria" glob="production/epics/**/story-*.md" output_mode="content" -A 15
+```
+- **Story Type** (Logic / Integration / Visual/Feel / UI / Config/Data) and the
+ stated evidence path — both live under `## Test Evidence`, so the first grep's
+ `-A 8` captures them.
+- Acceptance Criteria list — the `## Acceptance Criteria` block from the second grep.
+- Story slug (from the file name) and System (from the directory path) — no read.
+Full-read a story only when its Test Evidence section is missing or ambiguous.
+(In Sprint mode, scope the globs to the sprint plan's story paths.)
---
@@ -141,11 +177,13 @@ closed without all required sign-offs.
### Screenshot / artefact completeness
-For Visual/Feel stories: check whether screenshot file paths are referenced
-in the evidence doc. If referenced, Glob for them to confirm they exist.
+For Visual/Feel stories: Glob `production/qa/evidence/` for a retained image
+(`*.png`, `*.jpg`, `*.gif`) belonging to this story. A doc that describes a
+visual check but retains no image is INCOMPLETE — this gate is BLOCKING by
+default, and a description is an assertion rather than evidence.
-For UI stories: check whether a walkthrough sequence (step-by-step interaction
-log) is present.
+For UI stories: require the same retained screenshot of each screen touched,
+plus a walkthrough sequence (step-by-step interaction log).
### Date coverage
@@ -165,8 +203,36 @@ For each story, assign a verdict:
| **ADEQUATE** | Test/evidence exists, passes quality checks, all criteria covered |
| **INCOMPLETE** | Test/evidence exists but has quality gaps (thin assertions, missing sign-offs) |
| **MISSING** | No test or evidence found for a story type that requires it |
-
-The overall sprint/system verdict is the worst story verdict present.
+| **NOT ASSESSED** | The review could not be performed for this story — see below |
+
+> **`NOT ASSESSED` is required, and it is not a softer `MISSING`.**
+> The other three verdicts all presume the review actually ran. `MISSING` means
+> *I looked and there was nothing there* — a real, reportable failure. It must
+> never be used for *I could not look*, which is not a finding about the story
+> at all. Use `NOT ASSESSED` when:
+>
+> - the story's **type cannot be determined**, so the required evidence is
+> unknown (the type→evidence mapping in `.claude/docs/coding-standards.md` is
+> what makes any other verdict meaningful);
+> - the evidence path is named but **unreadable or outside this run's scope**;
+> - the story file itself could not be parsed.
+>
+> **Say which of those it was, per story.** A reader cannot act on a bare
+> `NOT ASSESSED`, and the whole point of separating it from `MISSING` is that
+> the two have different fixes: one needs a test written, the other needs the
+> reviewer given access or the story classified.
+
+The overall sprint/system verdict is the worst story verdict present, and
+**`NOT ASSESSED` outranks `ADEQUATE`**: a run that could not assess part of its
+scope has not established that the scope is adequate. It does not outrank
+`INCOMPLETE` or `MISSING` — a known failure is more actionable than an unknown,
+and demoting a real failure behind an access problem would bury it.
+
+> Why this needed saying: evidence review **gates story completion**, and
+> `coding-standards.md` makes Logic, Integration, Visual/Feel and UI evidence BLOCKING. A verdict
+> vocabulary with no way to express "I could not check" forces every unknown
+> into one of three claims about the story — which is how a story nobody
+> verified acquires a verdict that says somebody did.
```markdown
## Test Evidence Review
@@ -174,13 +240,13 @@ The overall sprint/system verdict is the worst story verdict present.
> **Date**: [date]
> **Scope**: [single story path | Sprint [N] | [system name]]
> **Stories reviewed**: [N]
-> **Overall verdict**: ADEQUATE / INCOMPLETE / MISSING
+> **Overall verdict**: ADEQUATE / INCOMPLETE / MISSING / NOT ASSESSED
---
### Story-by-Story Results
-#### [Story Title] — [Type] — [ADEQUATE/INCOMPLETE/MISSING]
+#### [Story Title] — [Type] — [ADEQUATE/INCOMPLETE/MISSING/NOT ASSESSED]
**Test/evidence path**: `[path]` (found) / (not found)
diff --git a/.claude/skills/test-flakiness/SKILL.md b/.claude/skills/test-flakiness/SKILL.md
index 099a1934..7c08984d 100644
--- a/.claude/skills/test-flakiness/SKILL.md
+++ b/.claude/skills/test-flakiness/SKILL.md
@@ -1,12 +1,20 @@
---
name: test-flakiness
-description: "Detect non-deterministic (flaky) tests by reading CI run logs or test result history. Aggregates pass rates per test, identifies intermittent failures, recommends quarantine or fix, and maintains a flaky test registry. Best run during Polish phase or after multiple CI runs."
+description: "Find flaky tests from CI logs — aggregates pass rates, spots intermittent failures, recommends quarantine. After multiple runs."
argument-hint: "[ci-log-path | scan | registry]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write, Edit, Bash
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Test Flakiness Detection
A flaky test is one that sometimes passes and sometimes fails without any code
diff --git a/.claude/skills/test-helpers/SKILL.md b/.claude/skills/test-helpers/SKILL.md
index 0592ac9e..d50547d0 100644
--- a/.claude/skills/test-helpers/SKILL.md
+++ b/.claude/skills/test-helpers/SKILL.md
@@ -1,12 +1,20 @@
---
name: test-helpers
-description: "Generate engine-specific test helper libraries for the project's test suite. Reads existing test patterns and produces tests/helpers/ with assertion utilities, factory functions, and mock objects tailored to the project's systems. Reduces boilerplate in new test files."
+description: "Generate engine-specific test helper libraries — assertion utilities, factory functions, mocks in tests/helpers/. Reduces boilerplate."
argument-hint: "[system-name | all | scaffold]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Write
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Test Helpers
Writing test cases is faster and more consistent when common setup, teardown,
@@ -23,6 +31,36 @@ and systems — so every developer writes less boilerplate and more assertions.
---
+## Assertions: use the project's test framework, never bare `assert()`
+
+**Generated helpers must assert through the configured test framework's assertion
+API**, resolved from `testing.framework` — not through GDScript's built-in
+`assert()`.
+
+Two things go wrong with a bare `assert()` in a helper, and both are silent:
+
+1. **It aborts the run instead of failing the test.** A framework assertion
+ records a failure and continues, so one broken expectation yields one red test.
+ A bare `assert()` halts execution, so the first failure hides every result
+ after it.
+2. **It is stripped in release builds.** A helper library built on `assert()`
+ stops asserting entirely in exactly the build you most want checked, and does
+ so without any error — the tests still "pass".
+
+**Look up the assertion form for the configured framework before generating
+code.** Do not copy the forms in this file or in other skills' examples as
+authoritative — they are illustrative and have drifted (`assert_eq`,
+`assert_true` and `assert_that` all appear across the repo). If you cannot
+confirm the correct API for the project's framework, say so and generate no
+helper rather than guessing.
+
+**Helpers must not extend the framework's test-suite base class.** A file in
+`tests/helpers/` that extends the suite type is discovered by the runner as a
+test suite containing zero tests. Helpers are plain classes; only real test files
+extend the suite.
+
+---
+
## 1. Parse Arguments
**Modes:**
@@ -37,12 +75,12 @@ and systems — so every developer writes less boilerplate and more assertions.
## 2. Detect Engine and Language
-Read `.claude/docs/technical-preferences.md` and extract:
-- `Engine:` value
-- `Language:` value
-- `Framework:` from the Testing section
+Read from `project.yaml` first, falling back to `.claude/docs/technical-preferences.md` for any key that is absent or empty:
+- `engine.name` (else the `Engine:` value)
+- `engine.language` (else the `Language:` value)
+- `testing.framework` (else `Framework:` from the Testing section)
-If engine is not configured: "Engine not configured. Run `/setup-engine` first."
+If the engine is not configured in either source: "Engine not configured. Run `/setup-engine` first."
---
@@ -74,15 +112,32 @@ Also read:
### Godot 4 (GDUnit4 / GDScript)
+> **`FAIL_IF(...)` in the example below is a PLACEHOLDER, not an API.** It marks
+> the one line you must resolve from the project's actual test framework before
+> emitting any of this, per the rule in §2. Substitute the framework's real
+> failure call — the form that **registers a failure with the runner and lets the
+> suite continue** — and delete the marker comment.
+>
+> **It is deliberately not spelled `assert_that`, `assert_eq` or `assert_true`.**
+> All three appear somewhere in this repo, they disagree, and **GdUnit4's API is
+> not covered by `docs/engine-reference/`** — so writing any of them here would be
+> asserting an API this repo cannot source, in the file whose whole job is to stop
+> people doing that. If you cannot confirm the correct call for the configured
+> framework, §2 already tells you the answer: **generate no helper.** An
+> unresolved `FAIL_IF` reaching disk is a bug; a missing helper is a task.
+>
+> Worked examples must obey §2 too — a bare `assert()` here would be the exact
+> form §2 forbids, sixty lines below §2 forbidding it. A rule stated in prose
+> does not reach its own worked example unless someone makes it.
+
**Base helper** (`tests/helpers/game_assertions.gd`):
```gdscript
## Game-specific assertion utilities for [Project Name] tests.
-## Extends GdUnitAssertions with domain-specific helpers.
+## Domain-specific helpers built on the project's test framework.
##
-## Usage:
-## var assert = GameAssertions.new()
-## assert.health_in_range(entity, 0, entity.max_health)
+## Usage (static — no instance needed):
+## GameAssertions.assert_in_range(entity.health, 0, entity.max_health, "health")
class_name GameAssertions
extends RefCounted
@@ -95,8 +150,9 @@ static func assert_in_range(
max_val: float,
label: String = "value"
) -> void:
- assert(
- value >= min_val and value <= max_val,
+ # FRAMEWORK ASSERT — resolve per the rule above; do not emit `assert()`.
+ FAIL_IF(
+ not (value >= min_val and value <= max_val),
"%s %.2f is outside expected range [%.2f, %.2f]" % [label, value, min_val, max_val]
)
@@ -110,7 +166,8 @@ static func assert_signal_emitted(
var emitted := false
obj.connect(signal_name, func(_args): emitted = true)
action.call()
- assert(emitted, "Expected signal '%s' to be emitted, but it was not." % signal_name)
+ # FRAMEWORK ASSERT — resolve per the rule above; do not emit `assert()`.
+ FAIL_IF(not emitted, "Expected signal '%s' to be emitted, but it was not." % signal_name)
## Assert that a callable does NOT emit a signal.
static func assert_signal_not_emitted(
@@ -121,12 +178,14 @@ static func assert_signal_not_emitted(
var emitted := false
obj.connect(signal_name, func(_args): emitted = true)
action.call()
- assert(not emitted, "Expected signal '%s' NOT to be emitted, but it was." % signal_name)
+ # FRAMEWORK ASSERT — resolve per the rule above; do not emit `assert()`.
+ FAIL_IF(emitted, "Expected signal '%s' NOT to be emitted, but it was." % signal_name)
## Assert a node exists at path within a parent.
static func assert_node_exists(parent: Node, path: NodePath) -> void:
- assert(
- parent.has_node(path),
+ # FRAMEWORK ASSERT — resolve per the rule above; do not emit `assert()`.
+ FAIL_IF(
+ not parent.has_node(path),
"Expected node at path '%s' to exist." % str(path)
)
```
@@ -303,7 +362,7 @@ namespace GameTestHelpers
For `[system-name]` or `all` modes, generate a helper per system:
-Read the system's GDD to extract:
+Read only the GDD sections this needs — `Grep pattern="^## (Formulas|Edge Cases|Detailed Rules|Detailed Design)" path="design/gdd/[system].md" output_mode="content" -A 30` — rather than a full read (every peer skill section-greps GDDs; in `all` mode a full read multiplies across each system's 400+-line GDD). Extract:
- Data types (entity types, component names)
- Formula variables and their bounds
- Common test scenarios mentioned in Edge Cases
diff --git a/.claude/skills/test-setup/SKILL.md b/.claude/skills/test-setup/SKILL.md
index 634128b8..dc5188b5 100644
--- a/.claude/skills/test-setup/SKILL.md
+++ b/.claude/skills/test-setup/SKILL.md
@@ -1,12 +1,20 @@
---
name: test-setup
-description: "Scaffold the test framework and CI/CD pipeline for the project's engine. Creates the tests/ directory structure, engine-specific test runner configuration, and GitHub Actions workflow. Run once during Technical Setup phase before the first sprint begins."
+description: "Scaffold the test framework and CI — tests/ directory, engine test runner, GitHub Actions workflow. Once, before the first sprint."
argument-hint: "[force]"
user-invocable: true
allowed-tools: Read, Glob, Grep, Bash, Write
model: sonnet
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation`
+
+**Automation mode**: Resolve `modes.automation` (`project.local.yaml` →
+`project.yaml` → default `collaborative`). Every `AskUserQuestion` call and
+every file write follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
# Test Setup
This skill scaffolds the automated testing infrastructure for the project.
@@ -25,8 +33,12 @@ A test framework installed at sprint four costs 3 sprints.
## Phase 1: Detect Engine and Existing State
1. **Read engine config**:
- - Read `.claude/docs/technical-preferences.md` and extract the `Engine:` value.
- - If engine is not configured (`[TO BE CONFIGURED]`), stop:
+ - Read `engine.name` from `project.yaml`; if that key is absent or empty
+ (including when `project.yaml` has no `engine:` block), fall back to the
+ `Engine:` value in `.claude/docs/technical-preferences.md`.
+ - If neither source yields a configured engine (project.yaml `engine.name`
+ absent/empty and technical-preferences.md shows `[TO BE CONFIGURED]` or is
+ missing), stop:
"Engine not configured. Run `/setup-engine` first, then re-run `/test-setup`."
2. **Check for existing test infrastructure**:
@@ -61,9 +73,11 @@ tests/
unit/ — Isolated unit tests for formulas, state, and logic
integration/ — Cross-system tests and save/load round-trips
smoke/ — Critical path test list (15-minute manual gate)
- evidence/ — Screenshot and manual test sign-off records
README.md — Test framework documentation
+production/qa/
+ evidence/ — Screenshot and manual test sign-off records
+
[Engine-specific files — see per-engine details below]
.github/workflows/tests.yml — CI: run tests on every push to main
@@ -74,7 +88,11 @@ Estimated time: ~5 minutes to create all files.
Ask: "May I create these files? I will not overwrite any test files that
already exist at these paths."
-Do not proceed without approval.
+**At `collaborative` and `guided`** — do not proceed without approval. These are
+**new** files, and `automation-modes.md:81` gates new-file writes in `guided` too,
+so the answer is the same in both modes. **At `autonomous`** — create them and log
+the decision; do not block. An unconditional gate here would read as "block even
+in autonomous" and contradict this skill's own header.
---
@@ -99,9 +117,20 @@ tests/
unit/ # Isolated unit tests (formulas, state machines, logic)
integration/ # Cross-system and save/load tests
smoke/ # Critical path test list for /smoke-check gate
+```
+
+```
+production/qa/
evidence/ # Screenshot logs and manual test sign-off records
```
+> **Manual evidence lives under `production/qa/evidence/`, not `tests/`.** That is
+> where every consumer reads it — `/smoke-check`, `/test-evidence-review`,
+> `/qa-plan`, and the evidence table in `.claude/docs/coding-standards.md`. This
+> scaffold and this skill's completion summary must name the same path: listing
+> `tests/evidence/` here while the summary reports `production/qa/evidence/`
+> creates a directory nothing reads and skips the one everything does.
+
## Running Tests
[Engine-specific command — see below]
@@ -118,8 +147,8 @@ tests/
|---|---|---|
| Logic | Automated unit test — must pass | `tests/unit/[system]/` |
| Integration | Integration test OR playtest doc | `tests/integration/[system]/` |
-| Visual/Feel | Screenshot + lead sign-off | `tests/evidence/` |
-| UI | Manual walkthrough OR interaction test | `tests/evidence/` |
+| Visual/Feel | Screenshot + lead sign-off | `production/qa/evidence/` |
+| UI | Manual walkthrough OR interaction test | `production/qa/evidence/` |
| Config/Data | Smoke check pass | `production/qa/smoke-*.md` |
## CI
@@ -391,7 +420,7 @@ Files created:
- tests/unit/ (directory)
- tests/integration/ (directory)
- tests/smoke/critical-paths.md
-- tests/evidence/ (directory)
+- production/qa/evidence/ (directory)
[engine-specific files]
- .github/workflows/tests.yml
diff --git a/.claude/skills/ux-design/SKILL.md b/.claude/skills/ux-design/SKILL.md
index ce3389a2..9a77f5f2 100644
--- a/.claude/skills/ux-design/SKILL.md
+++ b/.claude/skills/ux-design/SKILL.md
@@ -1,29 +1,73 @@
---
name: ux-design
-description: "Guided, section-by-section UX spec authoring for a screen, flow, or HUD. Reads game concept, player journey, and relevant GDDs to provide context-aware design guidance. Produces ux-spec.md (per screen/flow) or hud-design.md using the studio templates."
-argument-hint: "[screen/flow name] or 'hud' or 'patterns'"
+description: "Section-by-section UX spec authoring for a screen, flow or HUD. Reads the player journey to provide context; also project-wide accessibility."
+argument-hint: "[screen/flow name] or 'hud' or 'patterns' or 'accessibility'"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion, Task
+allowed-tools: Read, Glob, Grep, Write, Edit, AskUserQuestion, Agent
model: sonnet
-agent: ux-designer
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys automation,workflow,docs.density`
+
+Resolved above — use as-is. No block → defaults in
+`.claude/docs/config-resolution.md`.
+
+
When this skill is invoked:
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
+
+**Authoring guidance**: the skeletons below are self-contained — author from them
+directly. When a section needs depth (worked examples, pattern catalogs,
+accessibility criteria), the matching guide has it:
+
+| Producing | Guide |
+|---|---|
+| UX spec | `.claude/docs/templates/guidance/ux-spec-guide.md` |
+| HUD design | `.claude/docs/templates/guidance/hud-design-guide.md` |
+| Interaction patterns | `.claude/docs/templates/guidance/interaction-pattern-library-guide.md` (routes to three topic files) |
+| Accessibility requirements | `.claude/docs/templates/guidance/accessibility-requirements-guide.md` |
+
+**Load a guide per-section, never whole** — each is organised by section and the
+pointers in the templates name the exact section to read.
+
+**`workflow`** (see `.claude/docs/workflow-modes.md`):
+- `full` — a UX spec is required per screen.
+- `standard` — core screens only (main menu, HUD, primary game loop).
+- `minimal` — not required. Can still be run voluntarily.
+
+**`docs.density`** — it controls per-section *depth*, where `workflow`
+controls which screens are specced. `modes.rigor` sets both together; set
+`docs.density` explicitly to vary depth alone: `terse` = wireframe descriptions +
+interaction bullets; `balanced` = wireframes + paragraph descriptions of flows
+(default); `thorough` = full prose including user-research summaries and
+alternative flow considerations. Apply it to every section you author.
+
## 1. Parse Arguments & Determine Mode
-Three authoring modes exist based on the argument:
+Four authoring modes exist based on the argument:
| Argument | Mode | Output file |
|----------|------|-------------|
| `hud` | HUD design | `design/ux/hud.md` |
| `patterns` | Interaction pattern library | `design/ux/interaction-patterns.md` |
+| `accessibility` | Project-wide accessibility requirements | `design/accessibility-requirements.md` |
| Any other value (e.g., `main-menu`, `inventory`) | UX spec for a screen or flow | `design/ux/[argument].md` |
| No argument | Ask the user | (see below) |
+> **`accessibility` is the only mode that writes outside `design/ux/`.** Its
+> output is a project-wide standard the per-screen specs consult, not a spec for
+> one screen — `.claude/docs/workflow-catalog.yaml`, the Pre-Production and
+> Polish gates, and `/architecture-review` all check
+> `design/accessibility-requirements.md` at that exact path. Do not "tidy" it
+> under `design/ux/`: every one of those checks would stop matching, and the
+> Technical Setup → Pre-Production gate would become unpassable again.
+
**If no argument is provided**, do not fail — ask instead. Use `AskUserQuestion`:
- "What are we designing today?"
- - Options: "A specific screen or flow (I'll name it)", "The game HUD", "The interaction pattern library", "I'm not sure — help me figure it out"
+ - Options: "A specific screen or flow (I'll name it)", "The game HUD", "The interaction pattern library", "The project-wide accessibility requirements", "I'm not sure — help me figure it out"
If the user selects "I'll name it" or types a screen name, normalize it to kebab-case
for the filename (e.g., "Main Menu" becomes `main-menu`).
@@ -56,7 +100,12 @@ If the player journey file does not exist, note the gap and proceed:
> journey session after this spec is drafted."
Also add to the UX spec's Open Questions section:
-> "Player journey map not yet created. Template available at `.claude/docs/templates/player-journey.md`. Run `/ux-design` Phase 2b or create it manually to establish player context for this screen."
+> "Player journey map not yet created. Author it from the template at `.claude/docs/templates/player-journey.md` to establish player context for this screen."
+
+> **Do not tell the user to "run `/ux-design` Phase 2b" to create it.** Phase 2b
+> is this step — the one that *reads* the file. That remediation is circular: it
+> sends the user back to the check that just reported the gap. No skill
+> writes `design/player-journey.md`; it is hand-authored from its template.
### 2c: GDD UI Requirements
@@ -66,8 +115,19 @@ UI Requirements section references this screen by name or category.
These GDD UI Requirements are the **requirements input** to this spec. Collect them
as a list of constraints the spec must satisfy.
-If designing the HUD, read ALL GDD UI Requirements sections — the HUD aggregates
-requirements from every system.
+If designing the HUD, you need the UI Requirements of **every** system — the HUD
+aggregates them. Collect them with one scan rather than opening each GDD:
+
+```
+Grep pattern="^#+ .*UI Requirements" glob="design/gdd/*.md" output_mode="content" -A 20
+```
+
+Establish the denominator first (glob `design/gdd/*.md`, count **N**) and check
+the match count against it. **A GDD with no UI Requirements section is not a GDD
+with no UI needs** — it may predate the section. List the unmatched ones and
+confirm with the user that they are genuinely headless before excluding them
+from the HUD's requirement set; a HUD that silently omits a system's readout is
+the exact failure this aggregation exists to prevent.
### 2d: Existing UX Specs
@@ -94,17 +154,23 @@ must satisfy the accessibility tier committed to there.
### 2h: Input Method (from Project Config)
-Read `.claude/docs/technical-preferences.md` and extract the `## Input & Platform`
-section. Store these values for use throughout the skill — they drive the
-Interaction Map and inform accessibility requirements:
-
-- **Input Methods** — e.g., Keyboard/Mouse, Gamepad, Touch, Mixed
-- **Primary Input** — the dominant input for this game
-- **Gamepad Support** — Full / Partial / None
-- **Touch Support** — Full / Partial / None
-- **Target Platforms** — for safe zone and aspect ratio decisions
-
-If the section is unconfigured (`[TO BE CONFIGURED]`), ask once:
+Read the `platform` block from `project.yaml`; if `project.yaml` has no
+`platform` block, fall back to the `## Input & Platform` section of
+`.claude/docs/technical-preferences.md`. Store these values for use throughout
+the skill — they drive the Interaction Map and inform accessibility
+requirements:
+
+- **Primary Input** — `platform.primary_input` — the dominant input for this game
+- **Gamepad Support** — `platform.gamepad_support` — Full / Partial / None
+- **Touch Support** — `platform.touch_support` — Full / Partial / None
+- **Target Platforms** — `platform.targets` — for safe zone and aspect ratio decisions
+- **Input Methods** — the set of supported methods. When reading from
+ `project.yaml`, derive it: keyboard/mouse if `PC` or `Web` is in `targets`;
+ gamepad if gamepad support is Full/Partial; touch if touch support is
+ Full/Partial; plus the primary input. When falling back to
+ `technical-preferences.md`, use its explicit Input Methods field.
+
+If neither source is configured, ask once:
> "Input methods aren't configured yet. What does this game target?"
> Options: "Keyboard/Mouse only", "Gamepad only", "Both (PC + Console)", "Touch (mobile)", "All of the above"
>
@@ -124,7 +190,7 @@ Before any design work, present a brief summary to the user:
> - Related screens already specced: [list, or "none yet"]
> - Known patterns available: [count, or "no pattern library yet"]
> - Accessibility tier: [from requirements doc, or "not yet defined"]
-> - Input methods: [from technical-preferences.md, or "asked above"]
+> - Input methods: [derived from the `project.yaml` platform block, or "asked above"]
Then ask: "Anything else I should read before we start, or shall we proceed?"
@@ -170,7 +236,9 @@ Proceed to Phase 3 (Create File Skeleton) as normal.
Once the user confirms, **immediately** create the output file with empty section
headers. This ensures incremental writes have a target and work survives interruptions.
-Ask: "May I create the skeleton file at `design/ux/[filename].md`?"
+Ask: "May I create the skeleton file at `design/ux/[filename].md`?" — except in
+`accessibility` mode, where the path is `design/accessibility-requirements.md`
+(see the mode table in Section 1; it is deliberately not under `design/ux/`).
---
@@ -396,449 +464,155 @@ Ask: "May I create the skeleton file at `design/ux/[filename].md`?"
---
-After writing the skeleton, update `production/session-state/active.md` with:
-- Task: Designing [screen/flow name] UX spec
-- Current section: Starting (skeleton created)
-- File: design/ux/[filename].md
+### Skeleton for Accessibility Requirements
----
+Section list mirrors `.claude/docs/templates/accessibility-requirements.md` — if
+the template gains or loses a section, this skeleton follows it, not the reverse.
-## 4. Section-by-Section Authoring
+```markdown
+# Accessibility Requirements
-Walk through each section in order. For **each section**, follow this cycle:
+> **Status**: In Design
+> **Author**: [user + ux-designer]
+> **Last Updated**: [today's date]
+> **Template**: Accessibility Requirements
-```
-Context -> Questions -> Options -> Decision -> Draft -> Approval -> Write
-```
+## Accessibility Tier Definition
-1. **Context**: State what this section needs to contain and surface any relevant
- constraints from context gathered in Phase 2.
-2. **Questions**: Ask what is needed to draft this section. Use `AskUserQuestion`
- for constrained choices, conversational text for open-ended exploration.
-3. **Options**: Where design choices exist, present 2-4 approaches with pros/cons.
- Explain reasoning in conversation, then use `AskUserQuestion` to capture the decision.
-4. **Decision**: User picks an approach or provides custom direction.
-5. **Draft**: Write the section content in conversation for review. Flag provisional
- assumptions explicitly.
-6. **Approval**: Use `AskUserQuestion`:
- - "Does this capture the [section name] correctly?"
- - Options: "Yes — write it to the file", "Small changes needed (describe below)", "Major rethink needed"
- Do not proceed to step 7 until the user selects "Yes".
-7. **Write**: Use `AskUserQuestion`: "May I write the [section name] section to `[filepath]`?"
- - Options: "Yes, write it", "Wait — one more change"
- Once confirmed, use `Edit` to replace the `[To be designed]` placeholder with approved content.
-
-After writing each section, update `production/session-state/active.md`.
+[To be designed]
---
-### Section Guidance: UX Spec Mode
+## Visual Accessibility
-#### Section A: Purpose & Player Need
-
-This section is the foundation. Every other decision flows from it.
-
-**Questions to ask**:
-- "What player goal does this screen serve? What is the player trying to DO here?"
-- "What would go wrong if this screen didn't exist or was hard to use?"
-- "Complete this sentence: 'The player arrives at this screen wanting to ___.' "
-
-Cross-reference the player journey context gathered in Phase 2. The stated purpose
-must align with the journey phase and emotional state.
+[To be designed]
---
-#### Section B: Player Context on Arrival
-
-**Questions to ask**:
-- "When in the game does a player first encounter this screen?"
-- "What were they just doing immediately before reaching this screen?"
-- "What emotional state should the design assume? (calm, stressed, curious, time-pressured)"
-- "Do players arrive at this screen voluntarily, or are they sent here by the game?"
+## Motor Accessibility
-Offer to map this against the journey phases if the player journey doc exists.
+[To be designed]
---
-#### Section B2: Navigation Position
-
-Where does this screen sit in the game's navigation hierarchy? This is a one-paragraph orientation map — not a full flow diagram.
-
-**Questions to ask**:
-- "Is this screen accessed from the main menu, from pause, from within gameplay, or from another screen?"
-- "Is it a top-level destination (always reachable) or a context-dependent one (only accessible in certain states)?"
-- "Can the player reach this screen from more than one place in the game?"
+## Cognitive Accessibility
-Present as: "This screen lives at: [root] → [parent] → [this screen]" plus any alternate entry paths.
+[To be designed]
---
-#### Section B3: Entry & Exit Points
-
-Map every way the player can arrive at and leave this screen.
-
-**Questions to ask**:
-- "What are all the ways a player can reach this screen?" (List each trigger: button press, game event, redirect from another screen, etc.)
-- "What can the player do to exit? What happens when they do?" (Back button, confirm action, timeout, game event)
-- "Are there any exits that are one-way — where the player cannot return to this screen without starting over?"
+## Auditory Accessibility
-Present as two tables:
-
-| Entry Source | Trigger | Player carries this context |
-|---|---|---|
-| [screen/event] | [how] | [state/data they arrive with] |
-
-| Exit Destination | Trigger | Notes |
-|---|---|---|
-| [screen/event] | [how] | [any irreversible state changes] |
+[To be designed]
---
-#### Section C: Layout Specification
-
-This is the largest and most interactive section. Work through it in sub-sections:
-
-**Sub-section 1 — Information Hierarchy** (establish this before any layout):
-- Ask the user to list every piece of information this screen must communicate.
-- Then ask them to rank the items: "What is the single most important thing a player
- needs to see first? What is second? What can be discovered rather than immediately visible?"
-- Present the resulting hierarchy for approval before moving to zones.
+## Platform Accessibility API Integration
-**Sub-section 2 — Layout Zones**:
-- Based on the information hierarchy, propose rough screen zones (header, content
- area, action bar, sidebar, etc.).
-- Offer 2-3 zone arrangements with rationale for each. Reference platform and
- input context gathered from game concept.
-- Use `AskUserQuestion` to capture the choice:
- - "Which zone arrangement fits best?"
- - Options: [the 2-3 named arrangements you just presented] + "None — build a custom arrangement"
-
-**Sub-section 3 — Component Inventory**:
-- For each zone, list the UI components it contains. For each component, note:
- - Component type (button, list, card, stat display, input field, etc.)
- - Content it displays
- - Whether it is interactive
- - If it uses an existing pattern from the library (reference by pattern name)
- - If it introduces a new pattern (flag for later addition to the library)
-
-**Sub-section 4 — ASCII Wireframe**:
-- Offer to generate an ASCII wireframe based on the zone layout and component list.
-- Use `AskUserQuestion`: "Want an ASCII wireframe as part of this spec?"
- - Options: "Yes, include one", "No, I'll attach a separate file"
-- If yes, produce the wireframe in conversation first. Ask for feedback before
- writing it to file.
+[To be designed]
---
-#### Section D: States & Variants
-
-Guide the user to think beyond the happy path.
-
-**Questions to ask** (work through these one at a time):
-- "What does this screen look like the very first time a player sees it, when there
- is no data yet? (empty state)"
-- "What happens when something goes wrong — an error, a failed action, a missing
- resource? (error state)"
-- "Is there ever a loading wait on this screen? If so, what does it show? (loading state)"
-- "Are there any player progression states that change what this screen shows? For
- example, locked content, premium content, or tutorial-mode overlays?"
-- "Does this screen behave differently on any supported platform? (platform variant)"
-
-Present the collected states as a table for approval:
+## Per-Feature Accessibility Matrix
-| State / Variant | Trigger | What Changes |
-|-----------------|---------|--------------|
-| Default | Normal load | — |
-| Empty | No data available | [content area description] |
-| [etc.] | [trigger] | [changes] |
+[To be designed]
---
-#### Section E: Interaction Map
-
-For each interactive component identified in the Layout Specification, define:
-- The action (tap, click, press, hold, scroll, drag)
-- The platform input(s) that trigger it (mouse click, gamepad A, keyboard Enter)
-- The immediate feedback (visual, audio, haptic)
-- The outcome (navigation target, state change, data write)
-
-Use the input methods loaded from `technical-preferences.md` in Phase 2h — do
-not ask the user again. State them upfront: "Mapping interactions for:
-[Input Methods from tech-prefs]. Covering [Gamepad Support] gamepad support."
+## Accessibility Test Plan
-Work through components one at a time rather than asking for all at once.
-For navigation actions (going to another screen), verify the target matches
-an existing UX spec or note it as a spec dependency.
+[To be designed]
---
-#### Section E2: Events Fired
-
-For every player action in the Interaction Map, document the corresponding event the game or analytics system should fire — or explicitly note "no event" if none applies.
+## Known Intentional Limitations
-**Questions to ask**:
-- "For each action, should the game fire an analytics event, trigger a game-state change, or both?"
-- "Are there any actions that should NOT fire an event — and is that a deliberate choice?"
-
-Present as a table alongside the Interaction Map:
-
-| Player Action | Event Fired | Payload / Data |
-|---|---|---|
-| [action] | [EventName] or none | [data passed with event] |
-
-Flag any action that modifies persistent game state (save data, progress, economy) — these need explicit attention from the architecture team.
+[To be designed]
---
-#### Section E3: Transitions & Animations
-
-Specify how the screen enters and exits, and how it responds to state changes.
+## Audit History
-**Questions to ask**:
-- "How does this screen appear? (fade in, slide from right, instant pop, scale from button)"
-- "How does it dismiss? (fade out, slide back, cut)"
-- "Are there any in-screen state transitions that need animation? (loading spinner, success state, error flash)"
-- "Is there any animation that could cause motion sickness — and does the game have a reduced-motion option?"
-
-Minimum required:
-- Screen enter transition
-- Screen exit transition
-- At least one state-change animation if the screen has multiple states
+[To be designed]
---
-#### Section F: Data Requirements
-
-Cross-reference the GDD UI Requirements sections gathered in Phase 2.
-
-For each piece of information the screen displays, ask:
-- "Where does this data come from? Which system owns it?"
-- "Does this screen need to write data back, or is it read-only?"
-- "Is any of this data time-sensitive or real-time? (health bars, cooldown timers)"
-
-Flag any case where the UI would need to own or manage game state as an architectural
-concern. UX specs define what the UI needs; they do not dictate how the data is
-delivered. That is an architecture decision.
+## External Resources
-Present the data requirements as a table:
-
-| Data | Source System | Read / Write | Notes |
-|------|--------------|--------------|-------|
-| [item] | [system] | Read | — |
-| [item] | [system] | Write | [concern if any] |
+[To be designed]
---
-#### Section G: Accessibility
-
-Cross-reference `design/accessibility-requirements.md` if it exists.
+## Open Questions
-Walk through the ux-designer agent's standard checklist for this screen:
-- Keyboard-only navigation path through all interactive elements
-- Gamepad navigation order (if applicable)
-- Text contrast and minimum readable font sizes
-- Color-independent communication (no information conveyed by color alone)
-- Screen reader considerations for any non-text elements
-- Any motion or animation that needs a reduced-motion alternative
+[To be designed]
+```
-If no accessibility tier has been defined for this project, note the gap in the UX spec's Open Questions section:
-> "Accessibility tier not yet defined — consider WCAG-AA as a baseline. Run `/gate-check` to see whether this blocks any phase gates."
-Then continue to the next section without stopping.
+> **The tier commitment is the gated part.** `gate-pre-production.md` requires
+> the file to exist *with an accessibility tier committed*, and
+> `gate-production.md` checks that tier is addressed in every key screen spec.
+> A skeleton whose Tier Definition is still `[To be designed]` satisfies the
+> glob but not the gate — author that section first.
---
-#### Section H: Localization Considerations
-
-Document constraints that affect how this screen behaves when text is translated.
-
-**Questions to ask**:
-- "Which text elements on this screen are the longest? What is the maximum character count that fits the layout?"
-- "Are there any elements where text length is layout-critical — e.g., a button label that must stay on one line?"
-- "Are there any elements that display numbers, dates, or currencies that need locale-specific formatting?"
-
-Note: aim to flag any element where a 40% text expansion (common in translations from English to German or French) would break the layout. Mark those as HIGH PRIORITY for the localization engineer.
+After writing the skeleton, update `production/session-state/active.md` with:
+- Task: Designing [screen/flow name] UX spec
+- Current section: Starting (skeleton created)
+- File: design/ux/[filename].md (or `design/accessibility-requirements.md` in `accessibility` mode)
---
-#### Section I: Acceptance Criteria
-
-Write at least 5 specific, testable criteria that a QA tester can verify without reading any other design document. These become the pass/fail conditions for `/story-done`.
+## 4. Section-by-Section Authoring
-**Format**: Use checkboxes. Each criterion must be verifiable by a human tester:
+Walk through each section in order. For **each section**, follow this cycle:
```
-- [ ] Screen opens within [X]ms from [trigger]
-- [ ] [Element] displays correctly at [minimum] and [maximum] values
-- [ ] [Navigation action] correctly routes to [destination screen]
-- [ ] Error state appears when [condition] and shows [specific message or icon]
-- [ ] Keyboard/gamepad navigation reaches all interactive elements in logical order
-- [ ] [Accessibility requirement] is met — e.g., "all interactive elements have focus indicators"
+Context -> Questions -> Options -> Decision -> Draft -> Approval -> Write
```
-**Minimum required**:
-- 1 performance criterion (load/open time)
-- 1 navigation criterion (at least one entry or exit path verified)
-- 1 error/empty state criterion
-- 1 accessibility criterion (per committed tier)
-- 1 criterion specific to this screen's core purpose
-
-Use `AskUserQuestion` to confirm:
-- "Do these acceptance criteria cover what would make this screen 'done' for your QA process?"
-- Options: "Yes — these are solid", "Add one more criterion", "Remove or rephrase one"
-
----
-
-### Section Guidance: HUD Design Mode
-
-HUD design follows a different order from UX spec mode. Begin with philosophy;
-do not touch layout until the information architecture is complete.
-
-#### Section A: HUD Philosophy
-
-Ask the user to describe the game's relationship with on-screen information in
-1-2 sentences.
-
-Offer framing examples to help:
-- "Nearly HUD-free — atmosphere requires unobstructed immersion (e.g., Hollow Knight, Firewatch)"
-- "Minimal but present — only critical information visible, everything else contextual (e.g., Dark Souls)"
-- "Information-dense — all decision-relevant data always visible (e.g., Diablo IV, StarCraft II)"
-- "Adaptive — HUD density responds to combat state, exploration mode, menus (e.g., God of War)"
-
-This philosophy becomes the design constraint for every subsequent HUD decision.
-If a proposed element conflicts with the stated philosophy, surface that conflict.
-
----
-
-#### Section B: Information Architecture
-
-Complete this before any layout work. Do not skip it.
-
-**Step 1 — Full information inventory**:
-Pull all information from GDD UI Requirements sections gathered in Phase 2.
-Present the full list: "These are all the things your game systems say they need
-to communicate to the player on screen."
-
-**Step 2 — Categorization**:
-For each item, ask the user to categorize it:
-
-| Category | Description |
-|----------|-------------|
-| **Must Show** | Always visible, player needs it for core decisions |
-| **Contextual** | Visible only when relevant (in combat, near interactable, etc.) |
-| **On Demand** | Player must actively request it (toggle, hold button) |
-| **Hidden** | Communicated through world/audio, never on-screen text |
-
-Use `AskUserQuestion` to step through items in groups of 3-4, not all at once.
-This is the most consequential design decision in the HUD — do not rush it.
-
-**Conflict check**: If the information philosophy (Section A) says "nearly HUD-free"
-but the Must Show list is growing long, surface the conflict explicitly:
-> "The current Must Show list has [N] items. That may conflict with the HUD-free
-> philosophy. Options: reduce the Must Show list, revise the philosophy, or define
-> a hybrid approach where HUD is absent in exploration and present in combat."
-
----
-
-#### Section C: Layout Zones
-
-Only after the information architecture is approved, design layout zones.
-
-Base layout on:
-- Which items are Must Show (they drive the permanent zone decisions)
-- Where player attention naturally goes during gameplay (center-screen for action games,
- corners for strategy games)
-- Platform and aspect ratio targets
-
-Offer 2-3 zone arrangements. Include rationale based on the HUD philosophy and the
-categorization from Section B.
-
----
-
-#### Section D: HUD Elements
-
-For each element in the layout, specify:
-- Element name and category (Must Show / Contextual / On Demand)
-- Content displayed
-- Visual form (bar, number, icon, counter, map)
-- Update behavior (real-time, event-driven, player-queried)
-- Contextual trigger (if not always visible)
-- Animation behavior (does it pulse when low? Fade in? Slam in?)
-
-Work element by element. Reference the interaction pattern library if relevant patterns
-exist for status displays, resource bars, or cooldown indicators.
-
----
-
-#### Sections E, F, G: Dynamic Behaviors, Platform Variants, Accessibility
-
-These follow the same structure as the UX spec equivalents. See UX Spec section
-guidance for D (States/Variants), E (Interactions), and G (Accessibility).
-
-For the HUD specifically, emphasize:
-- Dynamic Behaviors: what causes the HUD to change density mid-gameplay?
-- Platform Variants: does mobile/console require different element sizes or positions?
-
----
-
-### Section Guidance: Interaction Pattern Library Mode
-
-Pattern library authoring is additive and catalog-driven, not linear.
-
-#### Phase 1: Catalog Existing Patterns
-
-Glob `design/ux/*.md` (excluding `interaction-patterns.md`) and read the Component
-Inventory and Interaction Map sections of each spec. Extract every interaction
-pattern used.
-
-Present the extracted list: "Based on existing UX specs, these patterns are already
-in use in the game:"
-- [Pattern name]: used in [screen], [screen]
-- [etc.]
+1. **Context**: State what this section needs to contain and surface any relevant
+ constraints from context gathered in Phase 2.
+2. **Questions**: Ask what is needed to draft this section. Use `AskUserQuestion`
+ for constrained choices, conversational text for open-ended exploration.
+3. **Options**: Where design choices exist, present 2-4 approaches with pros/cons.
+ Explain reasoning in conversation, then use `AskUserQuestion` to capture the decision.
+4. **Decision**: User picks an approach or provides custom direction.
+5. **Draft**: Write the section content in conversation for review. Flag provisional
+ assumptions explicitly.
+6. **Approval**: Use `AskUserQuestion`:
+ - "Does this capture the [section name] correctly?"
+ - Options: "Yes — write it to the file", "Small changes needed (describe below)", "Major rethink needed"
+ Do not proceed to step 7 until the user selects "Yes".
+7. **Write**: Use `AskUserQuestion`: "May I write the [section name] section to `[filepath]`?"
+ - Options: "Yes, write it", "Wait — one more change"
+ Once confirmed, use `Edit` to replace the `[To be designed]` placeholder with approved content.
-Ask: "Are there patterns you know exist but aren't in existing specs yet? List any
-additional ones now."
+After writing each section, update `production/session-state/active.md`.
---
-#### Phase 2: Formalize Each Pattern
+### Section guidance — read the ONE file for the active mode
-For each pattern (existing or new), document:
-
-```markdown
-### [Pattern Name]
+Per-section authoring guidance lives in its own file per mode. **When you reach
+Phase 4, read only the file matching the mode resolved in Section 1; never load
+the other two.**
-**Category**: Navigation / Input / Feedback / Data Display / Modal / Overlay / [other]
-**Used In**: [list of screens]
+| Mode | Guidance file |
+|------|---------------|
+| UX Spec (screen or flow) | `.claude/skills/ux-design/references/sections-ux-spec.md` |
+| HUD Design | `.claude/skills/ux-design/references/sections-hud.md` |
+| Interaction Pattern Library | `.claude/skills/ux-design/references/sections-patterns.md` |
+| Accessibility Requirements | `.claude/docs/templates/guidance/accessibility-requirements-guide.md` |
-**Description**: [One paragraph explaining what this pattern is and when to use it]
+> The accessibility guidance lives under `templates/guidance/` rather than this
+> skill's `references/` because the template it documents
+> (`.claude/docs/templates/accessibility-requirements.md`) is consumed by
+> `/ux-review` and the gate files too. Same rule applies: load only the part
+> covering the section you are authoring, never the whole file.
-**Specification**:
-- [Component behavior]
-- [Input mapping]
-- [Visual/audio feedback]
-- [Accessibility requirements for this pattern]
-
-**When to Use**: [Conditions where this pattern is appropriate]
-**When NOT to Use**: [Conditions where another pattern is more appropriate]
-
-**Reference**: [Screenshot path or ASCII example, if available]
-```
-
-Work through patterns in groups. Use `AskUserQuestion`:
-- "How do you want to work through these patterns?"
-- Options: "Draft the first batch from existing specs (faster)", "Define them one by one (more control)", "Start with the most-used pattern first"
-
----
-
-#### Phase 3: Identify Gaps
-
-After cataloging known patterns, ask:
-- "Are there screens or interactions planned that would need patterns not yet
- in this library?"
-- "Are there any patterns in existing specs that feel inconsistent with each
- other and should be consolidated?"
-
-Document gaps in the Gaps section for follow-up.
+Apply `docs.density` (Section 1) to whatever that file tells you to author — it
+controls the depth of each section, not which sections exist.
---
@@ -942,7 +716,7 @@ specific sub-topics, additional context or coordination may be needed:
| Narrative/lore visible in the UI | `narrative-director` — for flavor text, item names, lore panels |
| Accessibility tier decisions | Handled by this session — owned by ux-designer |
-When delegating to another agent via the Task tool:
+When delegating to another agent via the `Agent` tool:
- Provide: screen name, game concept summary, the specific question needing expert input
- The agent returns analysis to this session
- This session presents the agent's output to the user
@@ -953,6 +727,10 @@ When delegating to another agent via the Task tool:
## Collaborative Protocol
+**In `collaborative` mode (the default).** For `guided` and `autonomous` modes,
+see the per-mode rules in `.claude/docs/automation-modes.md` — the steps below
+describe what collaborative mode requires, not what applies universally.
+
This skill follows the collaborative design principle at every step:
1. **Question -> Options -> Decision -> Draft -> Approval** for every section
diff --git a/.claude/skills/ux-design/references/sections-hud.md b/.claude/skills/ux-design/references/sections-hud.md
new file mode 100644
index 00000000..d3f0426b
--- /dev/null
+++ b/.claude/skills/ux-design/references/sections-hud.md
@@ -0,0 +1,120 @@
+> Section-authoring guidance, loaded by `/ux-design` for the ACTIVE MODE ONLY.
+> Never load the other two — one mode applies per invocation.
+
+# Section Guidance — HUD Design Mode
+
+
+HUD design follows a different order from UX spec mode. Begin with philosophy;
+do not touch layout until the information architecture is complete.
+
+#### Section A: HUD Philosophy
+
+Ask the user to describe the game's relationship with on-screen information in
+1-2 sentences.
+
+Offer framing examples to help:
+- "Nearly HUD-free — atmosphere requires unobstructed immersion (e.g., Hollow Knight, Firewatch)"
+- "Minimal but present — only critical information visible, everything else contextual (e.g., Dark Souls)"
+- "Information-dense — all decision-relevant data always visible (e.g., Diablo IV, StarCraft II)"
+- "Adaptive — HUD density responds to combat state, exploration mode, menus (e.g., God of War)"
+
+This philosophy becomes the design constraint for every subsequent HUD decision.
+If a proposed element conflicts with the stated philosophy, surface that conflict.
+
+---
+
+#### Section B: Information Architecture
+
+Complete this before any layout work. Do not skip it.
+
+**Step 1 — Full information inventory**:
+Pull all information from GDD UI Requirements sections gathered in Phase 2.
+Present the full list: "These are all the things your game systems say they need
+to communicate to the player on screen."
+
+**Step 2 — Categorization**:
+For each item, ask the user to categorize it:
+
+| Category | Description |
+|----------|-------------|
+| **Must Show** | Always visible, player needs it for core decisions |
+| **Contextual** | Visible only when relevant (in combat, near interactable, etc.) |
+| **On Demand** | Player must actively request it (toggle, hold button) |
+| **Hidden** | Communicated through world/audio, never on-screen text |
+
+Use `AskUserQuestion` to step through items in groups of 3-4, not all at once.
+This is the most consequential design decision in the HUD — do not rush it.
+
+**Conflict check**: If the information philosophy (Section A) says "nearly HUD-free"
+but the Must Show list is growing long, surface the conflict explicitly:
+> "The current Must Show list has [N] items. That may conflict with the HUD-free
+> philosophy. Options: reduce the Must Show list, revise the philosophy, or define
+> a hybrid approach where HUD is absent in exploration and present in combat."
+
+---
+
+#### Section C: Layout Zones
+
+Only after the information architecture is approved, design layout zones.
+
+Base layout on:
+- Which items are Must Show (they drive the permanent zone decisions)
+- Where player attention naturally goes during gameplay (center-screen for action games,
+ corners for strategy games)
+- Platform and aspect ratio targets
+
+Offer 2-3 zone arrangements. Include rationale based on the HUD philosophy and the
+categorization from Section B.
+
+---
+
+#### Section D: HUD Elements
+
+For each element in the layout, specify:
+- Element name and category (Must Show / Contextual / On Demand)
+- Content displayed
+- Visual form (bar, number, icon, counter, map)
+- Update behavior (real-time, event-driven, player-queried)
+- Contextual trigger (if not always visible)
+- Animation behavior (does it pulse when low? Fade in? Slam in?)
+
+Work element by element. Reference the interaction pattern library if relevant patterns
+exist for status displays, resource bars, or cooldown indicators.
+
+---
+
+#### Sections E, F, G: Dynamic Behaviors, Platform Variants, Accessibility
+
+These parallel the UX spec's States, Interaction, and Accessibility sections.
+The guidance you need is below — **do not load `sections-ux-spec.md`; one mode
+file applies per invocation.** For the HUD, apply it as follows.
+
+**Dynamic Behaviors (states over time).** Beyond the happy path, capture what
+changes the HUD mid-gameplay and present it as a table for approval:
+
+| State / Variant | Trigger | What Changes |
+|-----------------|---------|--------------|
+| Default | Normal play | — |
+| Low-resource | Health/ammo/etc. below threshold | [element pulses, recolors, …] |
+| Empty / no-data | Element has nothing to show | [hidden, or placeholder] |
+| [etc.] | [trigger] | [changes] |
+
+Ask specifically: what causes the HUD to change density mid-gameplay
+(combat vs. exploration), and what fades, pulses, or slams in on each transition?
+
+**Platform Variants.** Does mobile/console require different element sizes or
+positions? Note per-platform overrides — touch targets, safe-area insets, and
+whether any element moves or is dropped on a given platform.
+
+**Accessibility.** Cross-reference `design/accessibility-requirements.md` if it
+exists, then walk this checklist for the HUD:
+- Gamepad/keyboard focus order for any interactive HUD element
+- Text contrast and minimum readable font sizes at gameplay distance
+- Color-independent communication (no state conveyed by color alone — a
+ low-health cue must not be red-only)
+- Reduced-motion alternative for any pulsing/flashing HUD animation
+- Screen-reader considerations for non-text indicators
+
+If no accessibility tier has been defined for this project, note the gap in the
+HUD design's Open Questions section (WCAG-AA is a reasonable baseline) and
+continue without stopping.
diff --git a/.claude/skills/ux-design/references/sections-patterns.md b/.claude/skills/ux-design/references/sections-patterns.md
new file mode 100644
index 00000000..9ef4d61c
--- /dev/null
+++ b/.claude/skills/ux-design/references/sections-patterns.md
@@ -0,0 +1,63 @@
+> Section-authoring guidance, loaded by `/ux-design` for the ACTIVE MODE ONLY.
+> Never load the other two — one mode applies per invocation.
+
+# Section Guidance — Interaction Pattern Library Mode
+
+
+Pattern library authoring is additive and catalog-driven, not linear.
+
+#### Phase 1: Catalog Existing Patterns
+
+Glob `design/ux/*.md` (excluding `interaction-patterns.md`) and read the Component
+Inventory and Interaction Map sections of each spec. Extract every interaction
+pattern used.
+
+Present the extracted list: "Based on existing UX specs, these patterns are already
+in use in the game:"
+- [Pattern name]: used in [screen], [screen]
+- [etc.]
+
+Ask: "Are there patterns you know exist but aren't in existing specs yet? List any
+additional ones now."
+
+---
+
+#### Phase 2: Formalize Each Pattern
+
+For each pattern (existing or new), document:
+
+```markdown
+### [Pattern Name]
+
+**Category**: Navigation / Input / Feedback / Data Display / Modal / Overlay / [other]
+**Used In**: [list of screens]
+
+**Description**: [One paragraph explaining what this pattern is and when to use it]
+
+**Specification**:
+- [Component behavior]
+- [Input mapping]
+- [Visual/audio feedback]
+- [Accessibility requirements for this pattern]
+
+**When to Use**: [Conditions where this pattern is appropriate]
+**When NOT to Use**: [Conditions where another pattern is more appropriate]
+
+**Reference**: [Screenshot path or ASCII example, if available]
+```
+
+Work through patterns in groups. Use `AskUserQuestion`:
+- "How do you want to work through these patterns?"
+- Options: "Draft the first batch from existing specs (faster)", "Define them one by one (more control)", "Start with the most-used pattern first"
+
+---
+
+#### Phase 3: Identify Gaps
+
+After cataloging known patterns, ask:
+- "Are there screens or interactions planned that would need patterns not yet
+ in this library?"
+- "Are there any patterns in existing specs that feel inconsistent with each
+ other and should be consolidated?"
+
+Document gaps in the Gaps section for follow-up.
diff --git a/.claude/skills/ux-design/references/sections-ux-spec.md b/.claude/skills/ux-design/references/sections-ux-spec.md
new file mode 100644
index 00000000..e588400f
--- /dev/null
+++ b/.claude/skills/ux-design/references/sections-ux-spec.md
@@ -0,0 +1,257 @@
+> Section-authoring guidance, loaded by `/ux-design` for the ACTIVE MODE ONLY.
+> Never load the other two — one mode applies per invocation.
+
+# Section Guidance — UX Spec Mode
+
+
+#### Section A: Purpose & Player Need
+
+This section is the foundation. Every other decision flows from it.
+
+**Questions to ask**:
+- "What player goal does this screen serve? What is the player trying to DO here?"
+- "What would go wrong if this screen didn't exist or was hard to use?"
+- "Complete this sentence: 'The player arrives at this screen wanting to ___.' "
+
+Cross-reference the player journey context gathered in Phase 2. The stated purpose
+must align with the journey phase and emotional state.
+
+---
+
+#### Section B: Player Context on Arrival
+
+**Questions to ask**:
+- "When in the game does a player first encounter this screen?"
+- "What were they just doing immediately before reaching this screen?"
+- "What emotional state should the design assume? (calm, stressed, curious, time-pressured)"
+- "Do players arrive at this screen voluntarily, or are they sent here by the game?"
+
+Offer to map this against the journey phases if the player journey doc exists.
+
+---
+
+#### Section B2: Navigation Position
+
+Where does this screen sit in the game's navigation hierarchy? This is a one-paragraph orientation map — not a full flow diagram.
+
+**Questions to ask**:
+- "Is this screen accessed from the main menu, from pause, from within gameplay, or from another screen?"
+- "Is it a top-level destination (always reachable) or a context-dependent one (only accessible in certain states)?"
+- "Can the player reach this screen from more than one place in the game?"
+
+Present as: "This screen lives at: [root] → [parent] → [this screen]" plus any alternate entry paths.
+
+---
+
+#### Section B3: Entry & Exit Points
+
+Map every way the player can arrive at and leave this screen.
+
+**Questions to ask**:
+- "What are all the ways a player can reach this screen?" (List each trigger: button press, game event, redirect from another screen, etc.)
+- "What can the player do to exit? What happens when they do?" (Back button, confirm action, timeout, game event)
+- "Are there any exits that are one-way — where the player cannot return to this screen without starting over?"
+
+Present as two tables:
+
+| Entry Source | Trigger | Player carries this context |
+|---|---|---|
+| [screen/event] | [how] | [state/data they arrive with] |
+
+| Exit Destination | Trigger | Notes |
+|---|---|---|
+| [screen/event] | [how] | [any irreversible state changes] |
+
+---
+
+#### Section C: Layout Specification
+
+This is the largest and most interactive section. Work through it in sub-sections:
+
+**Sub-section 1 — Information Hierarchy** (establish this before any layout):
+- Ask the user to list every piece of information this screen must communicate.
+- Then ask them to rank the items: "What is the single most important thing a player
+ needs to see first? What is second? What can be discovered rather than immediately visible?"
+- Present the resulting hierarchy for approval before moving to zones.
+
+**Sub-section 2 — Layout Zones**:
+- Based on the information hierarchy, propose rough screen zones (header, content
+ area, action bar, sidebar, etc.).
+- Offer 2-3 zone arrangements with rationale for each. Reference platform and
+ input context gathered from game concept.
+- Use `AskUserQuestion` to capture the choice:
+ - "Which zone arrangement fits best?"
+ - Options: [the 2-3 named arrangements you just presented] + "None — build a custom arrangement"
+
+**Sub-section 3 — Component Inventory**:
+- For each zone, list the UI components it contains. For each component, note:
+ - Component type (button, list, card, stat display, input field, etc.)
+ - Content it displays
+ - Whether it is interactive
+ - If it uses an existing pattern from the library (reference by pattern name)
+ - If it introduces a new pattern (flag for later addition to the library)
+
+**Sub-section 4 — ASCII Wireframe**:
+- Offer to generate an ASCII wireframe based on the zone layout and component list.
+- Use `AskUserQuestion`: "Want an ASCII wireframe as part of this spec?"
+ - Options: "Yes, include one", "No, I'll attach a separate file"
+- If yes, produce the wireframe in conversation first. Ask for feedback before
+ writing it to file.
+
+---
+
+#### Section D: States & Variants
+
+Guide the user to think beyond the happy path.
+
+**Questions to ask** (work through these one at a time):
+- "What does this screen look like the very first time a player sees it, when there
+ is no data yet? (empty state)"
+- "What happens when something goes wrong — an error, a failed action, a missing
+ resource? (error state)"
+- "Is there ever a loading wait on this screen? If so, what does it show? (loading state)"
+- "Are there any player progression states that change what this screen shows? For
+ example, locked content, premium content, or tutorial-mode overlays?"
+- "Does this screen behave differently on any supported platform? (platform variant)"
+
+Present the collected states as a table for approval:
+
+| State / Variant | Trigger | What Changes |
+|-----------------|---------|--------------|
+| Default | Normal load | — |
+| Empty | No data available | [content area description] |
+| [etc.] | [trigger] | [changes] |
+
+---
+
+#### Section E: Interaction Map
+
+For each interactive component identified in the Layout Specification, define:
+- The action (tap, click, press, hold, scroll, drag)
+- The platform input(s) that trigger it (mouse click, gamepad A, keyboard Enter)
+- The immediate feedback (visual, audio, haptic)
+- The outcome (navigation target, state change, data write)
+
+Use the input methods resolved in Phase 2h — do
+not ask the user again. State them upfront: "Mapping interactions for:
+[Input Methods resolved in Phase 2h]. Covering [Gamepad Support] gamepad support."
+
+Work through components one at a time rather than asking for all at once.
+For navigation actions (going to another screen), verify the target matches
+an existing UX spec or note it as a spec dependency.
+
+---
+
+#### Section E2: Events Fired
+
+For every player action in the Interaction Map, document the corresponding event the game or analytics system should fire — or explicitly note "no event" if none applies.
+
+**Questions to ask**:
+- "For each action, should the game fire an analytics event, trigger a game-state change, or both?"
+- "Are there any actions that should NOT fire an event — and is that a deliberate choice?"
+
+Present as a table alongside the Interaction Map:
+
+| Player Action | Event Fired | Payload / Data |
+|---|---|---|
+| [action] | [EventName] or none | [data passed with event] |
+
+Flag any action that modifies persistent game state (save data, progress, economy) — these need explicit attention from the architecture team.
+
+---
+
+#### Section E3: Transitions & Animations
+
+Specify how the screen enters and exits, and how it responds to state changes.
+
+**Questions to ask**:
+- "How does this screen appear? (fade in, slide from right, instant pop, scale from button)"
+- "How does it dismiss? (fade out, slide back, cut)"
+- "Are there any in-screen state transitions that need animation? (loading spinner, success state, error flash)"
+- "Is there any animation that could cause motion sickness — and does the game have a reduced-motion option?"
+
+Minimum required:
+- Screen enter transition
+- Screen exit transition
+- At least one state-change animation if the screen has multiple states
+
+---
+
+#### Section F: Data Requirements
+
+Cross-reference the GDD UI Requirements sections gathered in Phase 2.
+
+For each piece of information the screen displays, ask:
+- "Where does this data come from? Which system owns it?"
+- "Does this screen need to write data back, or is it read-only?"
+- "Is any of this data time-sensitive or real-time? (health bars, cooldown timers)"
+
+Flag any case where the UI would need to own or manage game state as an architectural
+concern. UX specs define what the UI needs; they do not dictate how the data is
+delivered. That is an architecture decision.
+
+Present the data requirements as a table:
+
+| Data | Source System | Read / Write | Notes |
+|------|--------------|--------------|-------|
+| [item] | [system] | Read | — |
+| [item] | [system] | Write | [concern if any] |
+
+---
+
+#### Section G: Accessibility
+
+Cross-reference `design/accessibility-requirements.md` if it exists.
+
+Walk through the ux-designer agent's standard checklist for this screen:
+- Keyboard-only navigation path through all interactive elements
+- Gamepad navigation order (if applicable)
+- Text contrast and minimum readable font sizes
+- Color-independent communication (no information conveyed by color alone)
+- Screen reader considerations for any non-text elements
+- Any motion or animation that needs a reduced-motion alternative
+
+If no accessibility tier has been defined for this project, note the gap in the UX spec's Open Questions section:
+> "Accessibility tier not yet defined — consider WCAG-AA as a baseline. Run `/gate-check` to see whether this blocks any phase gates."
+Then continue to the next section without stopping.
+
+---
+
+#### Section H: Localization Considerations
+
+Document constraints that affect how this screen behaves when text is translated.
+
+**Questions to ask**:
+- "Which text elements on this screen are the longest? What is the maximum character count that fits the layout?"
+- "Are there any elements where text length is layout-critical — e.g., a button label that must stay on one line?"
+- "Are there any elements that display numbers, dates, or currencies that need locale-specific formatting?"
+
+Note: aim to flag any element where a 40% text expansion (common in translations from English to German or French) would break the layout. Mark those as HIGH PRIORITY for the localization engineer.
+
+---
+
+#### Section I: Acceptance Criteria
+
+Write at least 5 specific, testable criteria that a QA tester can verify without reading any other design document. These become the pass/fail conditions for `/story-done`.
+
+**Format**: Use checkboxes. Each criterion must be verifiable by a human tester:
+
+```
+- [ ] Screen opens within [X]ms from [trigger]
+- [ ] [Element] displays correctly at [minimum] and [maximum] values
+- [ ] [Navigation action] correctly routes to [destination screen]
+- [ ] Error state appears when [condition] and shows [specific message or icon]
+- [ ] Keyboard/gamepad navigation reaches all interactive elements in logical order
+- [ ] [Accessibility requirement] is met — e.g., "all interactive elements have focus indicators"
+```
+
+**Minimum required**:
+- 1 performance criterion (load/open time)
+- 1 navigation criterion (at least one entry or exit path verified)
+- 1 error/empty state criterion
+- 1 accessibility criterion (per committed tier)
+- 1 criterion specific to this screen's core purpose
+
+Use `AskUserQuestion` to confirm:
+- "Do these acceptance criteria cover what would make this screen 'done' for your QA process?"
+- Options: "Yes — these are solid", "Add one more criterion", "Remove or rephrase one"
diff --git a/.claude/skills/ux-review/SKILL.md b/.claude/skills/ux-review/SKILL.md
index c65bc8e5..b665e5fb 100644
--- a/.claude/skills/ux-review/SKILL.md
+++ b/.claude/skills/ux-review/SKILL.md
@@ -1,11 +1,10 @@
---
name: ux-review
-description: "Validates a UX spec, HUD design, or interaction pattern library for completeness, accessibility compliance, GDD alignment, and implementation readiness. Produces APPROVED / NEEDS REVISION / MAJOR REVISION NEEDED verdict with specific gaps."
+description: "Validate a UX spec, HUD design or pattern library — accessibility, GDD alignment, readiness. APPROVED / NOT ASSESSED / NEEDS REVISION / MAJOR REVISION NEEDED."
argument-hint: "[file-path or 'all' or 'hud' or 'patterns']"
user-invocable: true
allowed-tools: Read, Glob, Grep
model: sonnet
-agent: ux-designer
---
## Overview
@@ -23,10 +22,19 @@ the `/team-ui` pipeline.
**Verdict levels:**
- **APPROVED** — spec is complete, consistent, and implementation-ready
+- **NOT ASSESSED** — one or more review dimensions had no criterion to check
+ against, or the spec could not be read; name which
- **NEEDS REVISION** — specific gaps found; fix before handoff but not a full redesign
- **MAJOR REVISION NEEDED** — fundamental issues with scope, player need, or
completeness; needs significant rework
+**`NOT ASSESSED` ranks above APPROVED and below the two revision verdicts.** A
+review that could not evaluate a dimension has not shown the spec is
+implementation-ready; but a gap somebody found is more actionable than one nobody
+could look for, so it must not displace them. Emit it when the spec file cannot
+be read, when a checklist dimension has no source of truth to compare against, or
+when the accessibility tier is uncommitted (below).
+
---
## Phase 1: Parse Arguments
@@ -47,10 +55,18 @@ full detail for each.
Before validating any spec, load:
-1. **Input & Platform config**: Read `.claude/docs/technical-preferences.md` and
- extract `## Input & Platform`. This is the authoritative source for which input
- methods the game supports — use it to drive the Input Method Coverage checks in
- Phase 3A, not the spec's own header. If unconfigured, fall back to the spec header.
+1. **Input & Platform config**: Read the `platform` block from `project.yaml`
+ (`platform.targets`, `platform.primary_input`, `platform.gamepad_support`,
+ `platform.touch_support`); if `project.yaml` has no `platform` block, fall
+ back to the `## Input & Platform` section of
+ `.claude/docs/technical-preferences.md`. For the set of supported input
+ methods: when reading from `project.yaml`, derive it — keyboard/mouse if
+ `PC` or `Web` is in `targets`; gamepad if `gamepad_support` is Full or
+ Partial; touch if `touch_support` is Full or Partial; plus `primary_input`.
+ When falling back to `technical-preferences.md`, use its explicit Input
+ Methods field instead. This is the authoritative source for the Input Method
+ Coverage checks in Phase 3A — not the spec's own header. If neither source is
+ configured, fall back to the spec header.
2. The accessibility tier committed to in `design/accessibility-requirements.md`
(if it exists)
3. The interaction pattern library at `design/ux/interaction-patterns.md` (if
@@ -223,20 +239,36 @@ Run all checks against a `hud-design.md`-based document.
- GDD [name] UI Requirements — [X/Y requirements covered]
- Missing: [list any uncovered GDD requirements]
-### Accessibility: [COMPLIANT / GAPS / NON-COMPLIANT]
+### Accessibility: [COMPLIANT / GAPS / NON-COMPLIANT / NOT ASSESSED]
- Target tier: [tier]
- [list specific accessibility findings]
+> **If `design/accessibility-requirements.md` is absent there is no committed
+> tier, so this dimension has no criterion.** Report
+> `Accessibility: NOT ASSESSED — no committed tier (design/accessibility-requirements.md absent)`
+> and do NOT report it as COMPLIANT — a gate compared against an absent standard
+> passes the way an assertion that can never fail passes. The same rule lives in
+> `/team-ui` Phase 4 and is mirrored here so the two cannot drift. If the spec's own
+> header states a tier, carry it forward as an **assumption** and say plainly that
+> it was assumed rather than committed. Recommend `/ux-design accessibility` to
+> establish the tier.
+
### Pattern Library: [CONSISTENT / INCONSISTENCIES FOUND]
- [findings]
-### Verdict: APPROVED / NEEDS REVISION / MAJOR REVISION NEEDED
+### Verdict: APPROVED / NOT ASSESSED / NEEDS REVISION / MAJOR REVISION NEEDED
**Blocking issues**: [N] — must be resolved before implementation
**Advisory issues**: [N] — recommended but not blocking
+**Dimensions not assessed**: [N] — [name each, and what would make it checkable]
[For APPROVED]: This spec is ready for handoff to `/team-ui` Phase 2
(Visual Design).
+[For NOT ASSESSED]: [N] of the four review dimensions could not be evaluated:
+[name them]. The spec may well be sound — this review cannot say either way for
+those dimensions. [For each: the one input that would make it checkable.]
+Handoff to `/team-ui` is not recommended on this result.
+
[For NEEDS REVISION]: Address the [N] blocking issues above, then re-run
`/ux-review`.
@@ -252,6 +284,10 @@ This skill is READ-ONLY — it never edits or writes files. It reports findings
After delivering the verdict:
- For **APPROVED**: suggest running `/team-ui` to begin implementation coordination
+- For **NOT ASSESSED**: name the missing input per dimension and offer to help
+ produce it (`/ux-design accessibility` for an uncommitted tier, the GDD path
+ for absent UI requirements). Do not re-run the review against the same missing
+ inputs and report a different verdict — only new inputs change this one
- For **NEEDS REVISION**: offer to help fix specific gaps ("Would you like me to
help draft the missing error state?") — but do not auto-fix; wait for user
instruction
diff --git a/.claude/skills/vertical-slice/SKILL.md b/.claude/skills/vertical-slice/SKILL.md
index 03083a7b..9b3d821a 100644
--- a/.claude/skills/vertical-slice/SKILL.md
+++ b/.claude/skills/vertical-slice/SKILL.md
@@ -1,14 +1,17 @@
---
name: vertical-slice
-description: "Pre-Production validation — build a production-quality end-to-end build to confirm the full game loop is achievable before committing to Production. Run after GDDs, architecture, and UX specs are complete. Produces a PROCEED/PIVOT/KILL verdict that gates the Pre-Production → Production transition."
+description: "Pre-production validation — end-to-end build to confirm the full loop is achievable before committing to Production. After GDDs, architecture, UX specs."
argument-hint: "[--review full|lean|solo]"
user-invocable: true
-allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion
+allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Agent, AskUserQuestion
model: sonnet
-agent: prototyper
isolation: worktree
---
+!`source "${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/yaml-helper.sh" 2>/dev/null && resolve_config --keys review_mode,automation`
+
+
+
## Purpose
The **vertical slice** answers a different question from the concept prototype:
@@ -36,12 +39,13 @@ whether the core idea is worth designing, run `/prototype` (concept prototype) i
## Phase 1: Resolve Review Mode and Load Context
-Resolve the review mode:
-1. If `--review [full|lean|solo]` was passed → use that
-2. Else read `production/review-mode.txt` → use that value
-3. Else → default to `lean`
-See `.claude/docs/director-gates.md` for the full check pattern.
+See `.claude/docs/director-gates.md` for the full check pattern. Individual gate definitions live in `.claude/docs/director-gates/[gate-id].md` — the spawned agent reads its own gate file; do not read it in the parent session.
+
+
+Every `AskUserQuestion` call follows `.claude/docs/automation-modes.md`
+(collaborative asks always · guided major-only · autonomous logs and proceeds;
+`automation_always_ask` categories always prompt).
Read the following files to understand the full design intent:
- `CLAUDE.md` — tech stack and engine
@@ -118,7 +122,7 @@ If yes, create the directory. Every file must begin with:
**Quality standards** — higher than concept prototype, not full production:
- Follow architecture layers from `docs/architecture/control-manifest.md`
-- Naming conventions from `.claude/docs/technical-preferences.md`
+- Naming conventions — `naming.*` from `project.yaml`; for any key absent or empty (including when `project.yaml` has no `naming` block), from `.claude/docs/technical-preferences.md`
- No hardcoded gameplay values — use constants or config files
- Basic error handling on critical paths
- Placeholder art acceptable; representative art preferred
@@ -260,8 +264,8 @@ the project — cross-reference it with sprint estimates.
**Review mode check:**
- `solo` → skip. Note: "CD-PLAYTEST skipped — Solo mode."
- `lean` → skip (not a PHASE-GATE). Note: "CD-PLAYTEST skipped — Lean mode."
-- `full` → spawn `creative-director` via Task using gate **CD-PLAYTEST**
- (`.claude/docs/director-gates.md`).
+- `full` → spawn `creative-director` via `Agent` using gate **CD-PLAYTEST**
+ (`.claude/docs/director-gates/cd-playtest.md`).
Pass: the full REPORT.md content, the validation question, game pillars and core
fantasy from `design/gdd/game-concept.md`.
diff --git a/.claude/statusline.sh b/.claude/statusline.sh
index 62ccaac1..9e24e31a 100644
--- a/.claude/statusline.sh
+++ b/.claude/statusline.sh
@@ -1,4 +1,32 @@
#!/usr/bin/env bash
+
+# --- work from the project root ----------------------------------------------
+# Every path below is repo-relative, so a hook invoked with a working directory
+# that is not the repo root would silently read and write the WRONG TREE --
+# returning a near-empty result instead of the session-recovery block, and
+# creating stray trees such as docs/production/session-logs/ on write.
+#
+# PRECEDENCE IS LOAD-BEARING. A cwd that IS a project root carries real
+# information and must win: a caller sitting inside another project means that
+# project, not this one. Resolving to the script's own location first would
+# override them. So, in order:
+# 1. cwd holds project.yaml -> cwd (a project root)
+# 2. cwd holds .claude/ -> cwd (a project root not yet configured)
+# 3. CLAUDE_PROJECT_DIR -> that (populated in the hook environment)
+# 4. this script's location -> <root>/.claude/hooks/../.. by construction
+# Rule 4 always works and needs no environment at all; rules 1-2 stop it from
+# overriding a caller that legitimately means somewhere else.
+#
+# NOT an upward search: that resolves a nested project to its parent's config.
+if [ -f "project.yaml" ] || [ -d ".claude" ]; then
+ CCGS_ROOT="$PWD"
+elif [ -n "${CLAUDE_PROJECT_DIR:-}" ] && [ -d "${CLAUDE_PROJECT_DIR}" ]; then
+ CCGS_ROOT="$CLAUDE_PROJECT_DIR"
+else
+ CCGS_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." 2>/dev/null && pwd)"
+fi
+[ -n "$CCGS_ROOT" ] && cd "$CCGS_ROOT" 2>/dev/null || true
+
# Claude Code Game Studios — Status Line
# Receives JSON on stdin, outputs a single-line status.
#
@@ -12,9 +40,9 @@ if command -v jq &>/dev/null; then
used_pct=$(echo "$input" | jq -r '.context_window.used_percentage // empty')
cwd=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // ""')
else
- model=$(echo "$input" | grep -oE '"display_name"\s*:\s*"[^"]*"' | head -1 | sed 's/.*: *"//;s/"//')
- used_pct=$(echo "$input" | grep -oE '"used_percentage"\s*:\s*[0-9]+' | head -1 | sed 's/.*: *//')
- cwd=$(echo "$input" | grep -oE '"current_dir"\s*:\s*"[^"]*"' | head -1 | sed 's/.*: *"//;s/"//')
+ model=$(echo "$input" | grep -oE '"display_name"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*: *"//;s/"//')
+ used_pct=$(echo "$input" | grep -oE '"used_percentage"[[:space:]]*:[[:space:]]*[0-9]+' | head -1 | sed 's/.*: *//')
+ cwd=$(echo "$input" | grep -oE '"current_dir"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*: *"//;s/"//')
[ -z "$model" ] && model="Unknown"
fi
@@ -30,14 +58,23 @@ else
fi
# --- Production stage ---
-# Priority 1: Explicit stage from stage.txt
-stage_file="$cwd/production/stage.txt"
+# Priority 1: project.stage from project.yaml
stage=""
-if [ -f "$stage_file" ]; then
- stage=$(head -1 "$stage_file" | tr -d '\r\n')
+project_yaml="$cwd/project.yaml"
+yaml_helper="$cwd/.claude/hooks/yaml-helper.sh"
+if [ -f "$project_yaml" ] && [ -f "$yaml_helper" ]; then
+ source "$yaml_helper"
+ stage=$(get_yaml_key "$project_yaml" project.stage 2>/dev/null)
+fi
+# Priority 2: legacy stage.txt fallback
+if [ -z "$stage" ]; then
+ stage_file="$cwd/production/stage.txt"
+ if [ -f "$stage_file" ]; then
+ stage=$(head -1 "$stage_file" | tr -d '\r\n')
+ fi
fi
-# Priority 2: Auto-detect from artifacts
+# Priority 3: Auto-detect from artifacts
if [ -z "$stage" ]; then
concept_file="$cwd/design/gdd/game-concept.md"
systems_file="$cwd/design/gdd/systems-index.md"
@@ -51,9 +88,21 @@ if [ -z "$stage" ]; then
[ -f "$concept_file" ] && has_concept=true
[ -f "$systems_file" ] && has_systems=true
- # Check if engine is configured (not placeholder)
- if [ -f "$tech_prefs" ]; then
- engine_line=$(grep -m1 '^\*\*Engine\*\*:' "$tech_prefs" 2>/dev/null || true)
+ # Check if engine is configured (project.yaml first, fall back to technical-preferences.md)
+ if [ -f "$project_yaml" ] && [ -f "$yaml_helper" ]; then
+ # yaml-helper may have been sourced above for stage; sourcing again is idempotent
+ source "$yaml_helper"
+ engine_name=$(get_yaml_key "$project_yaml" engine.name 2>/dev/null)
+ [ -n "$engine_name" ] && engine_configured=true
+ fi
+ if [ "$engine_configured" = false ] && [ -f "$tech_prefs" ]; then
+ # Leading whitespace tolerated, matching detect-gaps.sh and the migrator.
+ # This is the THIRD copy of "is the engine configured in
+ # technical-preferences.md" in the tree, and it was the last one still
+ # anchored to column 0 -- an indented bullet read as unconfigured here while
+ # the other two read it as configured, so the auto-detect ladder below
+ # dropped the project to an earlier stage than the rest of the system saw.
+ engine_line=$(grep -m1 -E '^[[:space:]]*-[[:space:]]+\*\*Engine\*\*:' "$tech_prefs" 2>/dev/null || true)
if [ -n "$engine_line" ] && ! echo "$engine_line" | grep -q "TO BE CONFIGURED"; then
engine_configured=true
fi
@@ -86,6 +135,45 @@ if [ -z "$stage" ]; then
fi
fi
+# --- Process posture (modes.rigor) ---
+# Locked to project.yaml (not locally overridable) with a plain terminal default
+# of 'standard', so a direct get_yaml_key read + default is exact. Deliberately
+# NOT resolve_setting: that assumes PWD is the project root, unsafe here since the
+# status line works from an absolute $cwd and never cd's.
+#
+# The 'standard' default applies ONLY when nothing contradicts it. If `rigor` is
+# unset but a knob it fronts is set explicitly, the project's real process weight
+# is whatever that knob says, and printing 'standard' actively misreports it —
+# migration is the common case, writing `modes.review_mode` and no `modes.rigor`,
+# so every v1.0 upgrader running full director reviews read 'Production · standard'.
+# Suppress instead of guessing, matching the unconfigured-project behaviour: no
+# config, no claim. Suppression is correct rather than lossy — the fronted knobs
+# disagree with each other in this state, so there is no single honest posture.
+rigor=""
+if [ -f "$project_yaml" ] && [ -f "$yaml_helper" ]; then
+ source "$yaml_helper"
+ rigor=$(get_yaml_key "$project_yaml" modes.rigor 2>/dev/null)
+ if [ -z "$rigor" ]; then
+ rigor="standard"
+ # Cheap pre-filter first. This hook runs every turn, and the common case
+ # (nothing fronted set) must not cost a get_yaml_key subprocess per key.
+ # The grep is a deliberate SUPERSET — it matches the leaf names anywhere at
+ # depth, so a false positive only costs the precise checks below, while a
+ # miss is impossible. Never let it decide on its own: a bare `size:` under
+ # some unrelated block would suppress the posture with no reason.
+ _fronted='^[[:space:]]+(review_mode|workflow|density|level|story_granularity|size):[[:space:]]*[^[:space:]#]'
+ for _f in "$project_yaml" "$cwd/project.local.yaml"; do
+ [ -f "$_f" ] || continue
+ grep -qE "$_fronted" "$_f" 2>/dev/null || continue
+ for _k in modes.review_mode modes.workflow docs.density qa.level \
+ modes.story_granularity team.size; do
+ if [ -n "$(get_yaml_key "$_f" "$_k" 2>/dev/null)" ]; then rigor=""; break; fi
+ done
+ [ -z "$rigor" ] && break
+ done
+ fi
+fi
+
# --- Epic/Feature/Task breadcrumb (Production+ only) ---
breadcrumb=""
if [ "$stage" = "Production" ] || [ "$stage" = "Polish" ] || [ "$stage" = "Release" ]; then
@@ -118,4 +206,4 @@ if [ "$stage" = "Production" ] || [ "$stage" = "Polish" ] || [ "$stage" = "Relea
fi
# --- Assemble ---
-printf "%s" "${ctx_label} | ${model} | ${stage}${breadcrumb}"
+printf "%s" "${ctx_label} | ${model} | ${stage}${rigor:+ · $rigor}${breadcrumb}"
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..54899c5e
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,21 @@
+# Shell scripts must use LF line endings. core.autocrlf=true would otherwise
+# convert them to CRLF on checkout, which breaks bash on Windows Git Bash
+# (stray \r corrupts commands and string comparisons). This applies to the
+# .claude/hooks/*.sh hooks and .claude/scripts/*.sh.
+*.sh text eol=lf
+
+# Tabular data is compared byte-for-byte by tooling that diffs it against
+# freshly-generated output (which is always LF). A CRLF checkout would make
+# every line differ, silently breaking any such comparison.
+*.tsv text eol=lf
+
+# Markdown under .claude/ is authored LF. Two concrete reasons, both hit during
+# v1.1 development:
+# - tooling that flattens SKILL.md files and substring-matches sentences
+# breaks on a stray \r mid-sentence: every multi-line match fails.
+# Before this was found it produced 262 false "lost rule" reports.
+# - a CRLF file produces a whole-file diff the first time anyone edits it,
+# which buries real changes.
+# .gitattributes governs the INDEX. It does not retro-fix a working tree that
+# predates the rule -- run `git add --renormalize .` for that.
+.claude/**/*.md text eol=lf
diff --git a/.gitignore b/.gitignore
index 5830aabd..2225c99f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,14 +12,22 @@ Desktop.ini
# === Claude Code Local ===
.claude/settings.local.json
CLAUDE.local.md
+project.local.yaml
production/session-logs/
+# Ephemeral per-session checkpoint. directory-structure.md documents this as
+# gitignored; the rule was missing, so active.md would have been committed.
+production/session-state/
+.scratch/
+# Per-agent working memory written at runtime — not release material
+.claude/agent-memory/
-# === Internal Planning (not for public) ===
-expansions/
-
-# === Marrow (eval tooling — never commit) ===
-marrow/
+# === Local sandboxes and scratch work ===
+examples/
+sandbox/
+sandboxes/
+tests/sandboxes/
+qa-sandbox/
# === Runtime Artifacts (auto-generated, start empty on fresh clone) ===
# Created on first use by /consistency-check and /architecture-review
@@ -39,7 +47,19 @@ dist/
*.app
# === Engine: Godot ===
-.godot/
+# Two subtleties, both of which produced a silently-wrong rule before this:
+# 1. A pattern with an internal `/` is anchored to THIS directory, so `.godot/*`
+# would only match a top-level `.godot` and miss `examples/<game>/.godot`.
+# `**/` makes it match at any depth.
+# 2. Git cannot re-include a file whose PARENT DIRECTORY is excluded, so
+# `**/.godot/` plus a `!` negation is inert. Exclude the CONTENTS instead.
+**/.godot/*
+# ...except the script class registry. `class_name` declarations resolve from this
+# one file, so on a FRESH CLONE every script referencing a class_name fails to
+# parse — while `godot --headless --path . --quit` still exits 0, so no CI check
+# catches it. Fresh clones hit this trap reliably.
+# Keep this un-ignore, or run `godot --headless --import` once after cloning.
+!**/.godot/global_script_class_cache.cfg
*.translation
export_presets.cfg
# Uncomment if using Godot:
diff --git a/CCGS Skill Testing Framework/CLAUDE.md b/CCGS Skill Testing Framework/CLAUDE.md
index ef1334bc..1fae86bf 100644
--- a/CCGS Skill Testing Framework/CLAUDE.md
+++ b/CCGS Skill Testing Framework/CLAUDE.md
@@ -7,7 +7,7 @@ framework. It is self-contained and separate from any game project.
| File | Purpose |
|------|---------|
-| `catalog.yaml` | Master registry for all 73 skills and 49 agents. Contains category, spec path, and last-test tracking fields. Always read this first when running any test command. |
+| `catalog.yaml` | Master registry for all 74 skills and 49 agents. Contains category, spec path, and last-test tracking fields. Always read this first when running any test command. |
| `quality-rubric.md` | Category-specific pass/fail metrics. Read the matching `###` section for the skill's category when running `/skill-test category`. |
| `skills/[category]/[name].md` | Behavioral spec for a skill — 5 test cases + protocol compliance assertions. |
| `agents/[tier]/[name].md` | Behavioral spec for an agent — 5 test cases + protocol compliance assertions. |
@@ -34,7 +34,7 @@ authoring → design-system, quick-design, architecture-decision, art-bible,
create-architecture, ux-design, ux-review
readiness → story-readiness, story-done
pipeline → create-epics, create-stories, dev-story, create-control-manifest,
- propagate-design-change, map-systems
+ propagate-design-change, map-systems, vertical-slice
analysis → consistency-check, balance-check, content-audit, code-review,
tech-debt, scope-check, estimate, perf-profile, asset-audit,
security-audit, test-evidence-review, test-flakiness
@@ -48,22 +48,23 @@ utility → all remaining skills
## Agent tiers
```
-directors → creative-director, technical-director, producer, art-director
-leads → lead-programmer, narrative-director, audio-director, ux-designer,
- qa-lead, release-manager, localization-lead
-specialists → gameplay-programmer, engine-programmer, ui-programmer,
- tools-programmer, network-programmer, ai-programmer,
- level-designer, sound-designer, technical-artist
-godot → godot-specialist, godot-gdscript-specialist, godot-csharp-specialist,
- godot-shader-specialist, godot-gdextension-specialist
-unity → unity-specialist, unity-ui-specialist, unity-shader-specialist,
- unity-dots-specialist, unity-addressables-specialist
-unreal → unreal-specialist, ue-gas-specialist, ue-replication-specialist,
- ue-umg-specialist, ue-blueprint-specialist
-operations → devops-engineer, security-engineer, performance-analyst,
- analytics-engineer, community-manager
-creative → writer, world-builder, game-designer, economy-designer,
- systems-designer, prototyper
+directors → creative-director, technical-director, producer, art-director
+leads → lead-programmer, narrative-director, audio-director, game-designer,
+ systems-designer, level-designer, qa-lead
+specialists → gameplay-programmer, engine-programmer, network-programmer,
+ ai-programmer, tools-programmer, ui-programmer, ux-designer,
+ technical-artist, sound-designer, performance-analyst, prototyper,
+ writer, world-builder
+engine/godot → godot-specialist, godot-gdscript-specialist, godot-csharp-specialist,
+ godot-shader-specialist, godot-gdextension-specialist
+engine/unity → unity-specialist, unity-ui-specialist, unity-shader-specialist,
+ unity-dots-specialist, unity-addressables-specialist
+engine/unreal → unreal-specialist, ue-gas-specialist, ue-replication-specialist,
+ ue-umg-specialist, ue-blueprint-specialist
+operations → devops-engineer, release-manager, live-ops-designer,
+ community-manager, analytics-engineer, economy-designer,
+ localization-lead
+qa → qa-tester, security-engineer, accessibility-specialist
```
## Workflow for testing a skill
diff --git a/CCGS Skill Testing Framework/README.md b/CCGS Skill Testing Framework/README.md
index f674a6ab..70d48fce 100644
--- a/CCGS Skill Testing Framework/README.md
+++ b/CCGS Skill Testing Framework/README.md
@@ -3,9 +3,27 @@
Quality assurance infrastructure for the **Claude Code Game Studios** framework.
Tests the skills and agents themselves — not any game built with them.
-> **This folder is self-contained and optional.**
-> Game developers using CCGS don't need it. To remove it entirely:
-> `rm -rf "CCGS Skill Testing Framework"` — nothing in `.claude/` depends on it.
+**This ships as part of the template, and it is meant to.** CCGS is a template
+you are expected to customize — edit a skill, add your own, retune an agent. This
+folder is how you check that what you changed still holds up: `catalog.yaml`
+tracks all 74 skills and 49 agents, `quality-rubric.md` defines per-category
+pass/fail metrics, and `templates/` gives you the spec format for anything new
+you write. Driven by `/skill-test` and `/skill-improve`.
+
+> **If you remove it, two of the four `/skill-test` modes stop working.**
+>
+> | Mode | Without this folder |
+> |------|---------------------|
+> | `/skill-test static` | **Works** — the 7 structural checks read `SKILL.md` only |
+> | `/skill-test audit` | **Degrades** — reports that no catalog exists |
+> | `/skill-test spec` | **Breaks** — the behavioral specs live here |
+> | `/skill-test category` | **Breaks** — reads `quality-rubric.md` from here |
+> | `/skill-improve` | **Degrades** — its test-fix-retest loop loses the spec pass |
+>
+> Earlier revisions of this file called the folder "optional" and said "nothing
+> in `.claude/` depends on it." That was wrong — `/skill-test` references this
+> directory 16 times and `/skill-improve` once. Removing it is a real trade, not
+> a free cleanup, so the table above states the actual cost.
---
@@ -15,7 +33,7 @@ Tests the skills and agents themselves — not any game built with them.
CCGS Skill Testing Framework/
├── README.md ← you are here
├── CLAUDE.md ← tells Claude how to use this framework
-├── catalog.yaml ← master registry: all 73 skills + 49 agents, coverage tracking
+├── catalog.yaml ← master registry: all 74 skills + 49 agents, coverage tracking
├── quality-rubric.md ← category-specific pass/fail metrics for /skill-test category
│
├── skills/ ← behavioral spec files for skills (one per skill)
@@ -31,13 +49,14 @@ CCGS Skill Testing Framework/
│
├── agents/ ← behavioral spec files for agents (one per agent)
│ ├── directors/ ← creative-director, technical-director, producer, art-director
-│ ├── leads/ ← lead-programmer, narrative-director, audio-director, etc.
-│ ├── specialists/ ← engine/code/shader/UI specialists
-│ ├── godot/ ← Godot-specific specialists
-│ ├── unity/ ← Unity-specific specialists
-│ ├── unreal/ ← Unreal-specific specialists
-│ ├── operations/ ← QA, live-ops, release, localization, etc.
-│ └── creative/ ← writer, world-builder, game-designer, etc.
+│ ├── leads/ ← lead-programmer, narrative-director, audio-director, game-designer, systems-designer, level-designer, qa-lead
+│ ├── specialists/ ← gameplay/engine/network/AI/tools/UI programmers, technical-artist, sound-designer, ux-designer, performance-analyst, prototyper, writer, world-builder
+│ ├── engine/ ← engine-specific specialists, split per engine:
+│ │ ├── godot/ ← Godot-specific specialists
+│ │ ├── unity/ ← Unity-specific specialists
+│ │ └── unreal/ ← Unreal-specific specialists
+│ ├── operations/ ← devops, release, live-ops, community, analytics, economy, localization
+│ └── qa/ ← qa-tester, security-engineer, accessibility-specialist
│
├── templates/ ← spec file templates for writing new specs
│ ├── skill-test-spec.md ← template for skill behavioral specs
@@ -56,7 +75,7 @@ All testing is driven by two skills already in the framework:
```
/skill-test static [skill-name] # Check one skill (7 checks)
-/skill-test static all # Check all 73 skills
+/skill-test static all # Check all 74 skills
```
### Run a behavioral spec test
@@ -105,16 +124,16 @@ All testing is driven by two skills already in the framework:
## Agent tiers
-| Tier | Agents |
+| Tier (directory) | Agents |
|------|--------|
| `directors` | creative-director, technical-director, producer, art-director |
-| `leads` | lead-programmer, narrative-director, audio-director, ux-designer, qa-lead, release-manager, localization-lead |
-| `specialists` | gameplay-programmer, engine-programmer, ui-programmer, tools-programmer, network-programmer, ai-programmer, level-designer, sound-designer, technical-artist |
-| `godot` | godot-specialist, godot-gdscript-specialist, godot-csharp-specialist, godot-shader-specialist, godot-gdextension-specialist |
-| `unity` | unity-specialist, unity-ui-specialist, unity-shader-specialist, unity-dots-specialist, unity-addressables-specialist |
-| `unreal` | unreal-specialist, ue-gas-specialist, ue-replication-specialist, ue-umg-specialist, ue-blueprint-specialist |
-| `operations` | devops-engineer, security-engineer, performance-analyst, analytics-engineer, community-manager |
-| `creative` | writer, world-builder, game-designer, economy-designer, systems-designer, prototyper |
+| `leads` | lead-programmer, narrative-director, audio-director, game-designer, systems-designer, level-designer, qa-lead |
+| `specialists` | gameplay-programmer, engine-programmer, network-programmer, ai-programmer, tools-programmer, ui-programmer, ux-designer, technical-artist, sound-designer, performance-analyst, prototyper, writer, world-builder |
+| `engine/godot` | godot-specialist, godot-gdscript-specialist, godot-csharp-specialist, godot-shader-specialist, godot-gdextension-specialist |
+| `engine/unity` | unity-specialist, unity-ui-specialist, unity-shader-specialist, unity-dots-specialist, unity-addressables-specialist |
+| `engine/unreal` | unreal-specialist, ue-gas-specialist, ue-replication-specialist, ue-umg-specialist, ue-blueprint-specialist |
+| `operations` | devops-engineer, release-manager, live-ops-designer, community-manager, analytics-engineer, economy-designer, localization-lead |
+| `qa` | qa-tester, security-engineer, accessibility-specialist |
---
diff --git a/CCGS Skill Testing Framework/agents/directors/art-director.md b/CCGS Skill Testing Framework/agents/directors/art-director.md
index 9218f3d4..6087b787 100644
--- a/CCGS Skill Testing Framework/agents/directors/art-director.md
+++ b/CCGS Skill Testing Framework/agents/directors/art-director.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/art-director.md` frontmatter:
- [ ] `description:` field is present and domain-specific (references visual identity, art bible, asset standards — not generic)
- [ ] `allowed-tools:` list is read-focused; image review capability if supported; no Bash unless asset pipeline checks are justified
-- [ ] Model tier is `claude-sonnet-4-6` (NOT Opus — coordination-rules.md assigns Sonnet to art-director)
+- [ ] Model tier is `claude-sonnet-5` (NOT Opus — coordination-rules.md assigns Sonnet to art-director)
- [ ] Agent definition does not claim authority over UX interaction flows or audio direction
---
diff --git a/CCGS Skill Testing Framework/agents/directors/creative-director.md b/CCGS Skill Testing Framework/agents/directors/creative-director.md
index bcd05af9..d8ec99c9 100644
--- a/CCGS Skill Testing Framework/agents/directors/creative-director.md
+++ b/CCGS Skill Testing Framework/agents/directors/creative-director.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/creative-director.md` frontmatte
- [ ] `description:` field is present and domain-specific (references creative vision, pillars, GDD alignment — not generic)
- [ ] `allowed-tools:` list is read-heavy; should not include Bash unless justified by a creative workflow need
-- [ ] Model tier is `claude-opus-4-6` per coordination-rules.md (directors with gate synthesis = Opus)
+- [ ] Model tier is `claude-opus-4-8` per coordination-rules.md (directors with gate synthesis = Opus)
- [ ] Agent definition does not claim authority over technical architecture or production scheduling
---
diff --git a/CCGS Skill Testing Framework/agents/directors/producer.md b/CCGS Skill Testing Framework/agents/directors/producer.md
index 9f584bec..f4925ffa 100644
--- a/CCGS Skill Testing Framework/agents/directors/producer.md
+++ b/CCGS Skill Testing Framework/agents/directors/producer.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/producer.md` frontmatter:
- [ ] `description:` field is present and domain-specific (references scope, sprint, milestone, production — not generic)
- [ ] `allowed-tools:` list is primarily read-focused; Bash only if sprint/milestone files require parsing
-- [ ] Model tier is `claude-opus-4-6` per coordination-rules.md (directors with gate synthesis = Opus)
+- [ ] Model tier is `claude-opus-4-8` per coordination-rules.md (directors with gate synthesis = Opus)
- [ ] Agent definition does not claim authority over design decisions or technical architecture
---
diff --git a/CCGS Skill Testing Framework/agents/directors/technical-director.md b/CCGS Skill Testing Framework/agents/directors/technical-director.md
index 9ed25bdb..febdde4b 100644
--- a/CCGS Skill Testing Framework/agents/directors/technical-director.md
+++ b/CCGS Skill Testing Framework/agents/directors/technical-director.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/technical-director.md` frontmatt
- [ ] `description:` field is present and domain-specific (references architecture, feasibility, ADR — not generic)
- [ ] `allowed-tools:` list may include Read for architecture documents; Bash only if required for technical checks
-- [ ] Model tier is `claude-opus-4-6` per coordination-rules.md (directors with gate synthesis = Opus)
+- [ ] Model tier is `claude-opus-4-8` per coordination-rules.md (directors with gate synthesis = Opus)
- [ ] Agent definition does not claim authority over game design decisions or creative direction
---
diff --git a/CCGS Skill Testing Framework/agents/leads/audio-director.md b/CCGS Skill Testing Framework/agents/leads/audio-director.md
index acff9463..9b9d47da 100644
--- a/CCGS Skill Testing Framework/agents/leads/audio-director.md
+++ b/CCGS Skill Testing Framework/agents/leads/audio-director.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/audio-director.md` frontmatter:
- [ ] `description:` field is present and domain-specific (references music direction, sound design, mix, audio implementation — not generic)
- [ ] `allowed-tools:` list is read-focused; no Bash unless audio asset pipeline checks are justified
-- [ ] Model tier is `claude-sonnet-4-6` per coordination-rules.md
+- [ ] Model tier is `claude-sonnet-5` per coordination-rules.md
- [ ] Agent definition does not claim authority over visual design, code implementation, or narrative content
---
diff --git a/CCGS Skill Testing Framework/agents/leads/game-designer.md b/CCGS Skill Testing Framework/agents/leads/game-designer.md
index 17a11733..383ced00 100644
--- a/CCGS Skill Testing Framework/agents/leads/game-designer.md
+++ b/CCGS Skill Testing Framework/agents/leads/game-designer.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/game-designer.md` frontmatter:
- [ ] `description:` field is present and domain-specific (references core loop, progression, combat rules, economy, player-facing design — not generic)
- [ ] `allowed-tools:` list is read-focused; includes Read for GDDs and design docs; no Bash unless design tooling requires it
-- [ ] Model tier is `claude-sonnet-4-6` per coordination-rules.md
+- [ ] Model tier is `claude-sonnet-5` per coordination-rules.md
- [ ] Agent definition does not claim authority over code implementation, visual art style, or standalone narrative lore decisions
---
diff --git a/CCGS Skill Testing Framework/agents/leads/lead-programmer.md b/CCGS Skill Testing Framework/agents/leads/lead-programmer.md
index 4d41f550..38e5451b 100644
--- a/CCGS Skill Testing Framework/agents/leads/lead-programmer.md
+++ b/CCGS Skill Testing Framework/agents/leads/lead-programmer.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/lead-programmer.md` frontmatter:
- [ ] `description:` field is present and domain-specific (references code architecture, feasibility, code review, coding standards — not generic)
- [ ] `allowed-tools:` list includes Read for source files; Bash may be included for static analysis or test runs; no write access outside `src/` without explicit delegation
-- [ ] Model tier is `claude-sonnet-4-6` per coordination-rules.md
+- [ ] Model tier is `claude-sonnet-5` per coordination-rules.md
- [ ] Agent definition does not claim authority over game design, creative direction, or production scheduling
---
diff --git a/CCGS Skill Testing Framework/agents/leads/level-designer.md b/CCGS Skill Testing Framework/agents/leads/level-designer.md
index 8d1e66eb..155a0439 100644
--- a/CCGS Skill Testing Framework/agents/leads/level-designer.md
+++ b/CCGS Skill Testing Framework/agents/leads/level-designer.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/level-designer.md` frontmatter:
- [ ] `description:` field is present and domain-specific (references level layout, encounter design, pacing, environmental storytelling — not generic)
- [ ] `allowed-tools:` list is read-focused; includes Read for level design documents and GDDs; no Bash unless level tooling requires it
-- [ ] Model tier is `claude-sonnet-4-6` per coordination-rules.md
+- [ ] Model tier is `claude-sonnet-5` per coordination-rules.md
- [ ] Agent definition does not claim authority over narrative dialogue, AI behavior code, or visual art style
---
diff --git a/CCGS Skill Testing Framework/agents/leads/narrative-director.md b/CCGS Skill Testing Framework/agents/leads/narrative-director.md
index 4e774440..165721b2 100644
--- a/CCGS Skill Testing Framework/agents/leads/narrative-director.md
+++ b/CCGS Skill Testing Framework/agents/leads/narrative-director.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/narrative-director.md` frontmatt
- [ ] `description:` field is present and domain-specific (references story, character, world-building, consistency — not generic)
- [ ] `allowed-tools:` list is read-focused; includes Read for lore documents, GDDs, and narrative docs; no Bash unless justified
-- [ ] Model tier is `claude-sonnet-4-6` per coordination-rules.md
+- [ ] Model tier is `claude-sonnet-5` per coordination-rules.md
- [ ] Agent definition does not claim authority over visual style, technical systems, or production scheduling
---
diff --git a/CCGS Skill Testing Framework/agents/leads/qa-lead.md b/CCGS Skill Testing Framework/agents/leads/qa-lead.md
index e4325b32..a768b201 100644
--- a/CCGS Skill Testing Framework/agents/leads/qa-lead.md
+++ b/CCGS Skill Testing Framework/agents/leads/qa-lead.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/qa-lead.md` frontmatter:
- [ ] `description:` field is present and domain-specific (references test strategy, story readiness, coverage, bug triage — not generic)
- [ ] `allowed-tools:` list is read-focused; may include Read for story files, test files, and coding-standards; Bash only if running test commands is required
-- [ ] Model tier is `claude-sonnet-4-6` per coordination-rules.md
+- [ ] Model tier is `claude-sonnet-5` per coordination-rules.md
- [ ] Agent definition does not claim authority over implementation decisions or game design
---
@@ -57,7 +57,7 @@ Verified by reading the agent's `.claude/agents/qa-lead.md` frontmatter:
- [ ] Does not abandon the coverage requirement — asks for a deterministic alternative if the current approach is ruled flaky
### Case 5: Context pass — uses provided context
-**Scenario:** Agent receives a gate context block that includes the coding-standards.md testing standards section, which specifies: Logic stories require blocking automated unit tests, Visual/Feel stories require screenshots + lead sign-off (advisory), Config/Data stories require smoke check pass (advisory). A story classified as "Logic" type is submitted with only a manual walkthrough document as evidence.
+**Scenario:** Agent receives a gate context block that includes the coding-standards.md testing standards section, which specifies: Logic stories require blocking automated unit tests, Visual/Feel stories require a blocking retained screenshot + lead sign-off, Config/Data stories require smoke check pass (advisory). A story classified as "Logic" type is submitted with only a manual walkthrough document as evidence.
**Expected:** Assessment references the specific test evidence requirements from coding-standards.md, identifies that a "Logic" story requires an automated unit test (not just a manual walkthrough), and returns INADEQUATE with the specific requirement cited.
**Assertions:**
- [ ] References the specific story type classification ("Logic") from the provided context
diff --git a/CCGS Skill Testing Framework/agents/leads/systems-designer.md b/CCGS Skill Testing Framework/agents/leads/systems-designer.md
index 64212037..7b89382a 100644
--- a/CCGS Skill Testing Framework/agents/leads/systems-designer.md
+++ b/CCGS Skill Testing Framework/agents/leads/systems-designer.md
@@ -14,7 +14,7 @@ Verified by reading the agent's `.claude/agents/systems-designer.md` frontmatter
- [ ] `description:` field is present and domain-specific (references formulas, progression curves, balance math, economy — not generic)
- [ ] `allowed-tools:` list is read-focused; may include Bash for formula evaluation scripts if the project uses them; no write access outside `design/balance/` without delegation
-- [ ] Model tier is `claude-sonnet-4-6` per coordination-rules.md
+- [ ] Model tier is `claude-sonnet-5` per coordination-rules.md
- [ ] Agent definition does not claim authority over narrative, visual design, or conceptual mechanic rule ownership
---
diff --git a/CCGS Skill Testing Framework/catalog.yaml b/CCGS Skill Testing Framework/catalog.yaml
index cd6b2482..8c78042c 100644
--- a/CCGS Skill Testing Framework/catalog.yaml
+++ b/CCGS Skill Testing Framework/catalog.yaml
@@ -146,6 +146,17 @@ skills:
priority: high
category: pipeline
+ - name: vertical-slice
+ spec: ""
+ last_static: ""
+ last_static_result: ""
+ last_spec: ""
+ last_spec_result: ""
+ last_category: ""
+ last_category_result: ""
+ priority: high
+ category: pipeline
+
- name: design-system
spec: CCGS Skill Testing Framework/skills/authoring/design-system.md
last_static: ""
@@ -797,6 +808,17 @@ skills:
priority: low
category: utility
+ - name: settings
+ spec: ""
+ last_static: ""
+ last_static_result: ""
+ last_spec: ""
+ last_spec_result: ""
+ last_category: ""
+ last_category_result: ""
+ priority: low
+ category: utility
+
agents:
# Tier 1 Directors (Opus)
- name: creative-director
diff --git a/CCGS Skill Testing Framework/quality-rubric.md b/CCGS Skill Testing Framework/quality-rubric.md
index c490650d..00e1e06a 100644
--- a/CCGS Skill Testing Framework/quality-rubric.md
+++ b/CCGS Skill Testing Framework/quality-rubric.md
@@ -90,7 +90,7 @@ multi-dimensional verdicts and integrate correctly with director gate mode.
### `pipeline`
-**Skills**: create-epics, create-stories, dev-story, create-control-manifest, propagate-design-change, map-systems
+**Skills**: create-epics, create-stories, dev-story, create-control-manifest, propagate-design-change, map-systems, vertical-slice
Pipeline skills produce artifacts that other skills consume. They must write files
with correct schema, respect layer/priority ordering, and gate before writing.
diff --git a/CCGS Skill Testing Framework/skills/gate/gate-check.md b/CCGS Skill Testing Framework/skills/gate/gate-check.md
index 545bc8ea..e1c54195 100644
--- a/CCGS Skill Testing Framework/skills/gate/gate-check.md
+++ b/CCGS Skill Testing Framework/skills/gate/gate-check.md
@@ -169,12 +169,11 @@ Verified automatically by `/skill-test static` — no fixture needed.
- [ ] Each skipped gate is explicitly noted in output: "[GATE-ID] skipped — Solo mode"
- [ ] Verdict is based on artifact and quality checks only
-**Note on Case 3 correction:**
-The Case 3 assertions previously stated "Skill does not ask the user which gate to check
-if current stage is determinable." This is correct. However, the skill DOES use
-AskUserQuestion to confirm the auto-detected transition before running full checks —
-this is a confirmation step, not a gate selection. Assertions for Case 3 should not
-treat this confirmation as a failure.
+**Note on Case 3:**
+The skill does not ask which gate to check when the current stage is determinable.
+It DOES use AskUserQuestion to confirm the auto-detected transition before running
+full checks — that is a confirmation step, not a gate selection. Assertions for
+Case 3 must not treat this confirmation as a failure.
---
diff --git a/CCGS Skill Testing Framework/skills/utility/qa-plan.md b/CCGS Skill Testing Framework/skills/utility/qa-plan.md
index 0b0ec221..ddfc77c3 100644
--- a/CCGS Skill Testing Framework/skills/utility/qa-plan.md
+++ b/CCGS Skill Testing Framework/skills/utility/qa-plan.md
@@ -51,8 +51,8 @@ None. `/qa-plan` is a planning utility. Story readiness gates are separate.
3. Skill assigns test types per coding-standards.md table:
- Logic story → Unit test (BLOCKING)
- Integration story → Integration test (BLOCKING)
- - Visual story → Screenshot + lead sign-off (ADVISORY)
- - UI story → Manual walkthrough doc (ADVISORY)
+ - Visual story → Retained screenshot + lead sign-off (BLOCKING)
+ - UI story → Retained screenshot of each screen (BLOCKING)
4. Skill drafts QA plan with story-by-story test type breakdown
5. Skill asks "May I write to `production/qa/qa-plan-sprint-003.md`?"
6. File is written on approval; verdict is COMPLETE
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..b3dedaf3
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,244 @@
+# Changelog
+
+What's new in Claude Code Game Studios, written for the people using it.
+
+See [UPGRADING.md](UPGRADING.md) for step-by-step upgrade instructions, and
+[docs/migration-guide-v1.1.md](docs/migration-guide-v1.1.md) if you have an
+existing project on the older config files.
+
+---
+
+## [1.1.0] — 2026-09-23
+
+**One config file, and a process weight you choose — one you can see and adjust,
+not a question you answer once at setup and forget.** A solo game jam and a
+studio production no longer have to carry the same overhead.
+
+### Added
+
+- **Ask-before-write now holds, whatever your personal settings say.** CCGS
+ sets Claude Code's permission mode to `default` in the project settings, so
+ every approval gate in the framework actually fires. If your own Claude Code
+ config runs in an auto-accept mode, that used to switch the whole
+ collaboration protocol off silently and agents would write files you never
+ approved. Override it in `.claude/settings.local.json` if you really want to,
+ but read `.claude/docs/setup-requirements.md` first.
+
+- **`project.yaml` — one place for your project's configuration.** Engine,
+ naming conventions, specialists and process settings all live here. It
+ replaces three separate files that used to hold this between them.
+
+- **`project.local.yaml` — your personal settings, not your team's.** Git
+ ignores it, so you can run leaner reviews or fewer confirmations on your own
+ machine without changing anything for anyone else.
+
+- **`modes.rigor` — one question instead of six.** Set `minimal`, `standard` or
+ `full` and it configures six underlying settings at once. You can still
+ override any single one; the rest stay where rigor put them.
+ - **`minimal`** — no design documents required, terse writing, light test
+ evidence. The fastest route from setup to running code.
+ - **`standard`** — 5 required design sections, balanced depth.
+ - **`full`** — all 8 design sections, thorough docs, full test evidence on
+ every story.
+
+- **Per-system exceptions.** One system can be held to a higher standard than
+ the rest of the project — your combat system can require the full treatment
+ while everything else stays light. Exceptions can only make requirements
+ stricter, never looser.
+
+- **A real jam path, not the full pipeline with switches turned off.**
+ `minimal` now rests on a one-page game brief with six fields, replacing the
+ 30-section concept document, the systems breakdown and the per-system design
+ docs. Four steps to running code: pick your engine → write the brief →
+ `/create-stories` → `/dev-story`. On Godot, `/setup-engine` now also creates
+ the `project.godot` the engine needs to open what those steps produce — until
+ it did, the path delivered real source files with no project to load them, and
+ the claim above was not true. **Unity and Unreal projects must still be created
+ in their own editor first**; CCGS will not fabricate one, because it cannot
+ source what those files should contain.
+
+- **`modes.review_mode`** — how many director agents review your work.
+ **On the `team-*` orchestrators, `full` and `lean` currently behave the same.**
+ Those nine skills only ever call phase-gate reviewers, and `lean` is defined as
+ "skip the director gates that aren't phase gates" — so it has nothing to skip.
+ `solo` does differ: it turns director gates off entirely. Elsewhere (design and
+ architecture review) all three levels differ as described.
+- **`modes.automation`** — how often you're asked to confirm before something
+ happens. In `autonomous` mode, decisions are written to a log instead of
+ interrupting you. You can always list categories that must ask regardless.
+ **Four skills ignore this setting on purpose and always ask:** `/setup-engine`,
+ `/gate-check`, `/hotfix` and `/day-one-patch` — engine choice is a one-time
+ irreversible decision, a gate verdict nobody reads defeats the gate, and the
+ two release skills need explicit sign-off. See
+ `.claude/docs/automation-modes.md` for the full list and reasons.
+- **`qa.level`** — how much test evidence is required before a story is done.
+- **`docs.density`** — how deeply written sections go.
+- **`team.size`** — which agents take part by default. Affects review depth
+ only; it never changes what a story has to deliver.
+- **`testing.strict` per test type** — a logic story can block on a failing
+ test while a visual story stays advisory.
+
+- **`/settings`** — see your effective configuration, check one value, or
+ change it. `/settings --local` writes to your personal file. It warns you when
+ a change would be overridden by something else.
+
+- **`/start` rework** — asks everything it needs up front and writes a complete
+ config in one pass, instead of scattering questions across later steps.
+
+- **Migration tooling for existing projects.** A converter moves a v1.0 project
+ onto `project.yaml`. It previews by default, only deletes old files once it
+ has proved every value survived, and deletes nothing if anything is missing.
+ `/adopt` spots an older project and runs it for you, and you'll get a reminder
+ at session start if you have old config files and no `project.yaml`.
+
+- **Recommendations for how much process your project needs.** Describe the
+ game you're making and CCGS suggests a level, instead of asking you to guess
+ what "standard" means for a weekend jam versus a two-year production.
+
+### Changed
+
+- **Claude no longer starts the four risky commands by itself.** `/hotfix`,
+ `/day-one-patch`, `/dev-story` and `/story-done` now run only when you type
+ them. They bypass the sprint process, patch shipped builds, write game code
+ and close out stories — none of that should begin because a conversation
+ drifted near the topic. Everything else still gets suggested as before.
+- **Engine specialists can only hand work to their own sub-specialists.** The
+ Godot, Unity and Unreal specialists are now limited to the four
+ sub-specialists under each of them. Previously any of them could call any
+ agent in the studio. This was already the documented rule; now it is enforced
+ rather than trusted.
+- **Fifteen agents that never delegated no longer can.** They were carrying the
+ ability to spawn other agents and never using it.
+
+- **Light is now the default, not just the recommendation.** `modes.rigor`
+ defaults to `minimal` instead of `standard`, so a project that never opens
+ `/settings` gets the fast path: a one-page brief instead of a full design
+ pipeline, terse writing, light test evidence, no director review panels.
+ We changed this because we measured the old default. Built both ways, the
+ heavier tier cost several times more to reach working code, did not produce a
+ better result, and gave nothing back when someone else picked the project up.
+ It was not buying more; it was buying nothing we could detect. If your project
+ outgrows the light
+ path, `/help` and `/gate-check` will say so, and `/settings
+ modes.rigor=standard` is one command. Projects that already set `rigor`
+ explicitly are completely unaffected.
+- **Setup steers light by default.** `/start` now recommends the minimal,
+ guided path for new projects, so you land somewhere light and step up if you
+ need to.
+- **Setup asks about your game, not about the framework.** The question is
+ "what best describes what you're building?" — a game jam, a focused project,
+ something systems-heavy — rather than "how much process do you want?"
+- **Your process level is always visible.** The status line shows it next to
+ your project stage, e.g. `Concept · minimal`.
+- **Advice goes both ways.** `/help` can suggest tightening up as a project
+ grows, not just lightening up when you sound overwhelmed.
+- **Moving into Production offers a check-in** on whether the level you chose at
+ the start still fits. It's a suggestion — it never changes the verdict.
+- **`team.size: solo` is now `team.size: individual`**, so it isn't confused
+ with `review_mode: solo`, which means something different.
+- **Less of your session is spent on the framework itself.** Roughly 40% of the
+ per-turn overhead was removed, leaving more room for your actual game.
+- **Picking up after a `/clear` or `/compact` is more reliable.** Your session
+ checkpoint is now a defined part of your session notes rather than an
+ ever-growing file, so what comes back is the same every time and leaves far
+ more room for actual work. Older notes can be archived without losing
+ anything.
+
+### Fixed
+
+- **Unity and Unreal projects were silently skipping three commit and
+ session checks.** The hooks that look for hardcoded gameplay values,
+ unowned TODOs, undocumented gameplay systems and missing architecture
+ docs all searched `src/` — which is where Godot keeps code. Unity keeps
+ it in `Assets/` and Unreal in `Source/`, so on those engines the searches
+ matched nothing, every check quietly did nothing, and the result was
+ indistinguishable from a clean pass. They now resolve the code root from
+ your engine, and if they cannot work out where your code lives they say
+ so instead of reporting nothing found.
+
+- **Godot C# projects can now hand C# work to the C# specialist.** The Godot
+ specialist listed only three of its four sub-specialists, leaving
+ `godot-csharp-specialist` unreachable — even though setup routes every `.cs`
+ file to it. If you chose C# or Both, your game code had no specialist path.
+- **The rules badge in the README said 11. There are 13.**
+
+- **`/hotfix` now gets your approval before touching code.** It used to
+ implement the fix first and collect approvals afterwards.
+- **`/sprint-plan` no longer promises a review step that your settings skip.**
+ It now says which reviews run at which levels.
+- **`/story-done` can no longer close a story with failing acceptance criteria
+ in autonomous mode.** The safeguard existed but couldn't be reached.
+- **`/settings` no longer shows rigor-derived values as "locked"**, which read
+ as "you can't change this" when you can.
+- **`/design-system` no longer insists on 8 design sections** at levels that
+ require fewer.
+- **`/localize`** pointed at a command that doesn't exist.
+- **`/team-narrative`** ran two phases together with no checkpoint between them.
+- **Upgrade instructions no longer suggest a merge that conflicts on every
+ file** for projects that don't share history with the template.
+- **Upgrade instructions now tell you to check for your own customisations
+ first.** Replacing the framework overwrites your edits to any file it also
+ ships — agent definitions and hook registrations especially. The steps show
+ you how to find those before you start, and how to keep the ones you want.
+- **Re-running a review on unchanged work now offers to skip it** instead of
+ repeating the whole thing at full cost.
+- **Several documented settings quietly did nothing.** They looked correct and
+ matched nothing.
+- **Jam and prototype projects are no longer warned about design-document
+ sections they were never meant to write.** The check now respects the level
+ you picked.
+- **Two file checks were silently doing nothing on Windows.** They ran, found
+ nothing, and reported success. They now work.
+- **Passing a phase gate can actually advance your project stage.** `/gate-check`
+ reached the right verdict but couldn't record it.
+- **`/bug-report` can now run tests**, which it always said it would.
+- **Committing gameplay code no longer prints a wall of raw search output**
+ alongside the warning.
+- **The status line can show what you're working on** — the epic, feature and
+ task breadcrumb was described in the docs but never actually appeared.
+- **Fixed broken links** in the Unity reference documentation.
+
+### Removed
+
+- **The bundled example game and the sample session transcripts.** They
+ described a project that didn't match the current workflow. Both are
+ recoverable from git history if you want them.
+
+### Deprecated
+
+- `production/stage.txt`, `production/review-mode.txt` and
+ `.claude/docs/technical-preferences.md` are superseded by `project.yaml`.
+ **Nothing breaks if you keep them** — they're still read when `project.yaml`
+ doesn't have a value. Run the migration script with `--finalize` when you're
+ ready to retire the first two. The third is kept on purpose: it still holds
+ your Forbidden Patterns and Allowed Libraries, which have no `project.yaml`
+ equivalent yet.
+
+### Known limitations
+
+- **Windows is the verified platform.** Everything was checked on Windows.
+ macOS and Linux should work but haven't been confirmed.
+- **No Unity or Unreal project was compiled.** Configuration, routing and
+ documentation were verified for both engines, but nothing here builds or
+ launches a real project in either.
+- **Some engine reference details are marked unverified rather than guessed.**
+ Where a version number or API detail couldn't be confirmed from a real source,
+ it's flagged in place instead of filled in with something plausible. You'll
+ see the flag where it matters.
+
+### Settings that don't do anything yet
+
+These six are documented and accepted, but nothing reads them. **Setting one
+today has no effect.** `/settings` says so when you view or change one, so you
+won't configure something expecting a result:
+
+`accessibility.target` · `cadence.sprint_length` · `cadence.milestone_length` ·
+`strict_gate_checks` · `project.kind` · `features.token_budget_warn_at`
+
+---
+
+## Earlier releases
+
+For v1.0 and earlier, see the version history in
+[UPGRADING.md](UPGRADING.md) — each release has its own "What Changed" section
+written at the time it shipped.
diff --git a/CLAUDE.md b/CLAUDE.md
index d365d5ee..f7f869ce 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -20,11 +20,25 @@ Each agent owns a specific domain, enforcing separation of concerns and quality.
## Engine Version Reference
+<!-- ENGINE-REFERENCE-IMPORT: the line below is engine-specific. /setup-engine
+ rewrites it to @docs/engine-reference/<engine>/VERSION.md for the chosen
+ engine, so a Unity or Unreal project stops loading the Godot reference every
+ session. It defaults to Godot (the template's example engine); skills that
+ need the pinned version read docs/engine-reference/<engine>/VERSION.md on
+ demand regardless of this import. -->
@docs/engine-reference/godot/VERSION.md
+
## Technical Preferences
[email protected]/docs/technical-preferences.md
+`project.yaml` at the repo root is the primary config store — engine, specialists,
+naming, platform, performance, modes. Skills resolve it via `resolve_config`
+(see `.claude/docs/config-resolution.md`).
+
+`.claude/docs/technical-preferences.md` is the **legacy fallback**, read on demand
+when a key is absent from `project.yaml`. It is no longer imported here: before
+`/setup-engine` runs it is almost entirely `[TO BE CONFIGURED]` placeholders, and
+after it runs `project.yaml` holds the real values.
## Coordination Rules
@@ -51,4 +65,13 @@ See `docs/COLLABORATIVE-DESIGN-PRINCIPLE.md` for full protocol and examples.
## Context Management
[email protected]/docs/context-management.md
+Read `.claude/docs/context-management.md` on demand — it is a reference, not
+session context. Two of its conventions are load-bearing and cited by name
+elsewhere in the repo, so they are restated here rather than lost:
+
+- **`production/session-state/active.md` is the session checkpoint.** The file is
+ the memory, not the conversation. Read it first after any compaction, crash, or
+ `/clear`.
+- **Helpers in `.claude/scripts/` emit observations, never verdicts.** A script
+ that scores or judges will eventually contradict a mode or override it cannot
+ see. (Cited by `artifact-check.sh` and `adr-dep-graph.sh`.)
diff --git a/README.md b/README.md
index c08cec9c..3f67faea 100644
--- a/README.md
+++ b/README.md
@@ -3,16 +3,16 @@
<p align="center">
Turn a single Claude Code session into a full game development studio.
<br />
- 49 agents. 73 skills. One coordinated AI team.
+ 49 agents. 74 skills. One coordinated AI team.
</p>
</p>
<p align="center">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License"></a>
<a href=".claude/agents"><img src="https://img.shields.io/badge/agents-49-blueviolet" alt="49 Agents"></a>
- <a href=".claude/skills"><img src="https://img.shields.io/badge/skills-73-green" alt="73 Skills"></a>
+ <a href=".claude/skills"><img src="https://img.shields.io/badge/skills-74-green" alt="74 Skills"></a>
<a href=".claude/hooks"><img src="https://img.shields.io/badge/hooks-12-orange" alt="12 Hooks"></a>
- <a href=".claude/rules"><img src="https://img.shields.io/badge/rules-11-red" alt="11 Rules"></a>
+ <a href=".claude/rules"><img src="https://img.shields.io/badge/rules-13-red" alt="13 Rules"></a>
<a href="https://docs.anthropic.com/en/docs/claude-code"><img src="https://img.shields.io/badge/built%20for-Claude%20Code-f5f5f5?logo=anthropic" alt="Built for Claude Code"></a>
<a href="https://www.buymeacoffee.com/donchitos3"><img src="https://img.shields.io/badge/Buy%20Me%20a%20Coffee-Support%20this%20project-FFDD00?logo=buymeacoffee&logoColor=black" alt="Buy Me a Coffee"></a>
<a href="https://github.com/sponsors/Donchitos"><img src="https://img.shields.io/badge/GitHub%20Sponsors-Support%20this%20project-ea4aaa?logo=githubsponsors&logoColor=white" alt="GitHub Sponsors"></a>
@@ -35,7 +35,9 @@ The result: you still make every decision, but now you have a team that asks the
- [What's Included](#whats-included)
- [Studio Hierarchy](#studio-hierarchy)
- [Slash Commands](#slash-commands)
+- [Does it produce games, or documents?](#does-it-produce-games-or-documents)
- [Getting Started](#getting-started)
+- [Configuration](#configuration)
- [Upgrading](#upgrading)
- [Project Structure](#project-structure)
- [How It Works](#how-it-works)
@@ -53,25 +55,25 @@ The result: you still make every decision, but now you have a team that asks the
| Category | Count | Description |
|----------|-------|-------------|
| **Agents** | 49 | Specialized subagents across design, programming, art, audio, narrative, QA, and production |
-| **Skills** | 73 | Slash commands for every workflow phase (`/start`, `/design-system`, `/create-epics`, `/create-stories`, `/dev-story`, `/story-done`, etc.) |
+| **Skills** | 74 | Slash commands for every workflow phase (`/start`, `/design-system`, `/create-epics`, `/create-stories`, `/dev-story`, `/story-done`, etc.) |
| **Hooks** | 12 | Automated validation on commits, pushes, asset changes, session lifecycle, agent audit trail, and gap detection |
-| **Rules** | 11 | Path-scoped coding standards enforced when editing gameplay, engine, AI, UI, network code, and more |
-| **Templates** | 41 | Document templates for GDDs, UX specs, ADRs, sprint plans, HUD design, accessibility, and more |
+| **Rules** | 13 | Path-scoped coding standards enforced when editing gameplay, engine, AI, UI, network code, and more |
+| **Templates** | 39 | Document templates for GDDs, UX specs, ADRs, sprint plans, HUD design, accessibility, and more |
## Studio Hierarchy
Agents are organized into three tiers, matching how real studios operate:
```
-Tier 1 — Directors (Opus)
+Tier 1 — Directors
creative-director technical-director producer
-Tier 2 — Department Leads (Sonnet)
+Tier 2 — Department Leads
game-designer lead-programmer art-director
audio-director narrative-director qa-lead
release-manager localization-lead
-Tier 3 — Specialists (Sonnet/Haiku)
+Tier 3 — Specialists
gameplay-programmer engine-programmer ai-programmer
network-programmer tools-programmer ui-programmer
systems-designer level-designer economy-designer
@@ -82,6 +84,11 @@ Tier 3 — Specialists (Sonnet/Haiku)
live-ops-designer community-manager
```
+Each agent declares a model in its frontmatter: the three directors ask for
+Opus, sixteen specialists name Sonnet or Haiku, and the remaining thirty
+**inherit your session's model**. Treat the tiers as seniority of role, not as
+a billing plan — most of the studio runs on whatever model you are already using.
+
### Engine Specialists
The template includes agent sets for all three major engines. Use the set that matches your project:
@@ -94,10 +101,10 @@ The template includes agent sets for all three major engines. Use the set that m
## Slash Commands
-Type `/` in Claude Code to access all 73 skills:
+Type `/` in Claude Code to access all 74 skills:
**Onboarding & Navigation**
-`/start` `/help` `/project-stage-detect` `/setup-engine` `/adopt`
+`/start` `/help` `/project-stage-detect` `/setup-engine` `/adopt` `/settings`
**Game Design**
`/brainstorm` `/map-systems` `/design-system` `/quick-design` `/review-all-gdds` `/propagate-design-change`
@@ -127,11 +134,40 @@ Type `/` in Claude Code to access all 73 skills:
`/release-checklist` `/launch-checklist` `/changelog` `/patch-notes` `/hotfix` `/day-one-patch`
**Creative & Content**
-`/prototype` `/onboard` `/localize`
+`/prototype` `/vertical-slice` `/onboard` `/localize`
**Team Orchestration** (coordinate multiple agents on a single feature)
`/team-combat` `/team-narrative` `/team-ui` `/team-release` `/team-polish` `/team-audio` `/team-level` `/team-live-ops` `/team-qa`
+## Does it produce games, or documents?
+
+A fair question, and the answer is a measurement rather than a sample project.
+Four games were built from one brief at different `modes.rigor` levels and the
+documents each wrote **before its first line of game code** were counted:
+
+| `modes.rigor` | Docs before first line of game code | Time |
+|---|---:|---:|
+| `minimal` | **1** (the one-page brief) | 0 min |
+| `standard` | 30 | 58 min |
+
+All of them produced a running, tested game. Two blind reviewers and a human
+playtest then ranked the `standard` build **last** — the extra 29 documents
+bought traceability, not a better game.
+
+### It runs the game and looks at it
+
+The measurement above is about cost. The other half is whether the thing works,
+and for a game that means someone has to *look* at it — a passing test says
+nothing about a menu drawn off-screen. So a story that changes anything the
+player sees is not closed until the game has been launched, observed, and a
+screenshot retained in `production/qa/evidence/`. A parse check is not a run.
+This holds at every rigor level, including `minimal`, where automated tests are
+waived but the look is not.
+
+The games themselves are deliberately **not** shipped here: this is a template
+you clone to start your own project, and somebody else's game in your repo is
+clutter, not evidence.
+
## Getting Started
### Prerequisites
@@ -163,6 +199,54 @@ All hooks fail gracefully if optional tools are missing — nothing breaks, you
- `/setup-engine godot 4.6` — configure your engine if you already know
- `/project-stage-detect` — analyze an existing project
+## Configuration
+
+`project.yaml` at the repo root is the single source of truth for how the
+studio behaves on your project — engine, naming conventions, and a `modes`
+block that controls how much process every skill enforces. `/start` writes it
+for you; you rarely need to hand-edit it.
+
+The one question that matters most is **`modes.rigor`** — `minimal`, `standard`,
+or `full`. It's a single front door over six separate knobs (`workflow` —
+which GDD sections are required, `docs.density`, `qa.level`,
+`story_granularity`, `review_mode` — how many director agents review your work,
+and `team.size`), so `/start` asks it once instead of six times:
+
+- **`minimal`** (default) — jam-game speed. No GDDs required, terse docs, minimal QA evidence, solo review. `/start` → `/setup-engine` → `/dev-story` in a handful of steps.
+- **`standard`** — 5 required GDD sections, balanced doc depth, standard QA evidence, lean review.
+- **`full`** — all 8 GDD sections, thorough docs, full QA evidence on every story type, full director review.
+
+`minimal` is the default because it was measured against the alternatives: the
+heavier tier cost several times more to reach working code, was ranked last on
+play quality, and returned nothing measurable when a fresh developer inherited
+the project. Raise it in one `/settings` call when your project grows — `/help`
+and `/gate-check` will suggest it when they see the signs.
+
+Two escape hatches keep one setting from being a blunt instrument.
+**`system_overrides`** holds a single system to a higher standard than the rest
+of the project — your combat system gets the full treatment while everything
+else stays light. **`testing.strict`** sets, per test type (logic, integration,
+visual, UI, config), whether missing evidence blocks a story or merely warns.
+
+Any of the six underlying knobs can still be set individually if you want a mix
+(e.g. `workflow: full` with `docs.density: terse` — comprehensive but compact).
+Two of them — `review_mode` (`full` / `lean` / `solo`) and `team.size` — are
+also **personal**: rigor sets the team-wide default, but you can override them
+per-developer in a gitignored `project.local.yaml` without touching the shared
+config. `modes.automation` (how often the AI pauses to ask before it acts) sits
+outside rigor and is likewise personally overridable.
+
+View or change any setting with the `/settings` skill:
+
+```
+/settings # view effective config
+/settings modes.review_mode # view one setting
+/settings modes.rigor=full # write to project.yaml (team-wide)
+/settings --local modes.review_mode=solo # write to project.local.yaml (just you)
+```
+
+Full schema and per-setting behavior: `.claude/docs/effects-map.md`.
+
## Upgrading
Already using an older version of this template? See [UPGRADING.md](UPGRADING.md)
@@ -176,14 +260,17 @@ CLAUDE.md # Master configuration
.claude/
settings.json # Hooks, permissions, safety rules
agents/ # 49 agent definitions (markdown + YAML frontmatter)
- skills/ # 73 slash commands (subdirectory per skill)
- hooks/ # 12 hook scripts (bash, cross-platform)
- rules/ # 11 path-scoped coding standards
+ skills/ # 74 slash commands (subdirectory per skill)
+ hooks/ # 14 scripts (bash) — 12 event hooks, yaml-helper.sh,
+ # and one opt-in diagnostic you wire yourself
+ rules/ # 13 path-scoped coding standards
statusline.sh # Status line script (context%, model, stage, epic breadcrumb)
docs/
workflow-catalog.yaml # 7-phase pipeline definition (read by /help)
- templates/ # 41 document templates
-src/ # Game source code
+ templates/ # 39 document templates (+ per-section guidance)
+src/ # Game source code (Godot). The code root is
+ # ENGINE-SPECIFIC: Unity compiles only
+ # Assets/, Unreal builds from Source/<Module>/
assets/ # Art, audio, VFX, shaders, data files
design/ # GDDs, narrative docs, level designs
docs/ # Technical documentation and ADRs
@@ -191,8 +278,26 @@ tests/ # Test suites (unit, integration, performanc
tools/ # Build and pipeline tools
prototypes/ # Throwaway prototypes (isolated from src/)
production/ # Sprint plans, milestones, release tracking
+CCGS Skill Testing Framework/ # QA for the skills and agents themselves — see below
```
+### Testing your customizations
+
+CCGS is a template you are meant to edit. `CCGS Skill Testing Framework/` is how
+you check that an edited or newly written skill still holds up — a catalog of all
+74 skills and 49 agents, per-category quality rubrics, behavioral specs, and
+templates for writing specs of your own.
+
+```
+/skill-test static [name] # structural linter — 7 compliance checks
+/skill-test category [name] # category-specific quality rubric
+/skill-test spec [name] # behavioral spec assertions
+/skill-test audit # coverage report across skills and agents
+/skill-improve [name] # test-fix-retest loop; keeps or reverts on score change
+```
+
+It tests the *framework*, never your game — game tests live in `tests/`.
+
## How It Works
### Agent Coordination
@@ -242,7 +347,10 @@ You stay in control. The agents provide structure and expertise, not autonomy.
### Path-Scoped Rules
-Coding standards are automatically enforced based on file location:
+Coding standards are automatically enforced based on file location. The paths
+below show the Godot code root; on Unity read `src/` as `Assets/`, and on
+Unreal as `Source/<Module>/` — the engine's toolchain fixes that choice, and
+`/setup-engine` resolves it for you.
| Path | Enforces |
|------|----------|
@@ -251,7 +359,10 @@ Coding standards are automatically enforced based on file location:
| `src/ai/**` | Performance budgets, debuggability, data-driven parameters |
| `src/networking/**` | Server-authoritative, versioned messages, security |
| `src/ui/**` | No game state ownership, localization-ready, accessibility |
-| `design/gdd/**` | Required 8 sections, formula format, edge cases |
+| `design/gdd/**` | Required sections per `modes.workflow`, formula format, edge cases |
+| `design/narrative/**` | Lore consistency, character voice, canon levels |
+| `assets/data/**` | JSON validity, naming conventions, schema rules |
+| `assets/shaders/**` | Naming conventions, performance targets, cross-platform rules |
| `tests/**` | Test naming, coverage requirements, fixture patterns |
| `prototypes/**` | Relaxed standards, README required, hypothesis documented |
@@ -275,7 +386,7 @@ This is a **template**, not a locked framework. Everything is meant to be custom
- **Add rules** — create new path-scoped rules for your project's directory structure
- **Tune hooks** — adjust validation strictness, add new checks
- **Pick your engine** — use the Godot, Unity, or Unreal agent set (or none)
-- **Set review intensity** — `full` (all director gates), `lean` (phase gates only), or `solo` (none). Set during `/start` or edit `production/review-mode.txt`. Override per-run with `--review solo` on any skill.
+- **Tune process weight** — `modes.rigor` and its underlying knobs in `project.yaml` (see [Configuration](#configuration)). Override per-run with `--review solo` on any skill.
## Platform Support
diff --git a/UPGRADING.md b/UPGRADING.md
index 9cd6f1dd..a07d694c 100644
--- a/UPGRADING.md
+++ b/UPGRADING.md
@@ -14,6 +14,7 @@ Or check `README.md` for the version badge.
## Table of Contents
- [Upgrade Strategies](#upgrade-strategies)
+- [v1.0 → v1.1](#v10--v11)
- [v1.0.0-beta → v1.0](#v100-beta--v10)
- [v0.4.x → v1.0](#v04x--v10)
- [v0.4.0 → v0.4.1](#v040--v041)
@@ -25,12 +26,13 @@ Or check `README.md` for the version badge.
## Upgrade Strategies
-There are three ways to pull in template updates. Choose based on how your
+There are four ways to pull in template updates. Choose based on how your
repo is set up.
### Strategy A — Git Remote Merge (recommended)
-Best when: you cloned the template and have your own commits on top of it.
+Best when: you cloned the template and have your own commits on top of it —
+your repo shares history with the template.
```bash
# Add the template as a remote (one-time setup)
@@ -40,17 +42,96 @@ git remote add template https://github.com/Donchitos/Claude-Code-Game-Studios.gi
git fetch template main
# Merge into your branch
-git merge template/main --allow-unrelated-histories
+git merge template/main
```
Git will flag conflicts only in files that both the template *and* you have
changed. Resolve each one — your game content goes in, structural improvements
come along for the ride. Then commit the merge.
-**Tip:** The files most likely to conflict are `CLAUDE.md` and
+**Tip:** The files most likely to conflict are `CLAUDE.md`, `project.yaml`, and
`.claude/docs/technical-preferences.md`, because you've filled them in with
your engine and project settings. Keep your content; accept the structural changes.
+**If git refuses with `fatal: refusing to merge unrelated histories`**, your
+repo did not start as a clone of the template (zip download, `git init` from
+scratch). Do **not** force it with `--allow-unrelated-histories` — with no
+common ancestor, git flags *every* template file as a conflict and you'll be
+resolving hundreds of files by hand. Use Strategy A2 instead.
+
+### Strategy A2 — Selective checkout (no shared history)
+
+Best when: your repo has no common history with the template but you do use git.
+
+> **First, check whether you have edited any framework files.** The checkout
+> below **replaces** everything under `.claude/`. Files *you added* survive, but
+> your edits to files the framework also ships are overwritten — agent
+> definitions and director gates are the ones people customise most.
+>
+> ```bash
+> git log --oneline -- .claude # commits here mean you have customisations
+> ```
+>
+> If that lists anything beyond your initial import, work through the restore
+> step below rather than skipping it.
+
+```bash
+git remote add template https://github.com/Donchitos/Claude-Code-Game-Studios.git
+git fetch template main
+
+# Take the framework-owned paths wholesale from the new version.
+# This overwrites/adds template files but never deletes files you added.
+git checkout template/main -- .claude UPGRADING.md CHANGELOG.md docs/migration-guide-v1.1.md
+
+# The checkout is STAGED, not committed — so nothing is lost yet, and this
+# lists every framework file it changed:
+git diff --cached --stat -- .claude
+
+# Restore any file whose local edits you want to keep. This is one command per
+# file, deliberately: each is a decision between your version and the new one.
+git checkout HEAD -- .claude/docs/technical-preferences.md # v1.0 config; v1.1 keeps config in project.yaml
+git checkout HEAD -- <any other file you customised>
+
+git status # review what changed before committing
+```
+
+> **Restoring a file keeps your version of it in full — including whatever the
+> new release changed there.** For a file you edited lightly, it is usually
+> better to take the new version and re-apply your change on top than to keep
+> the old one wholesale. `git diff HEAD template/main -- <file>` shows what you
+> would be giving up.
+
+For `CLAUDE.md`, don't checkout — diff and merge by hand, keeping your
+engine/project content:
+
+```bash
+git diff HEAD template/main -- CLAUDE.md
+```
+
+`project.yaml` depends on where you are coming from, and the two cases need
+opposite actions:
+
+- **Upgrading from v1.0** (the case this section is about): you have no
+ `project.yaml` — it did not exist in v1.0. There is nothing to merge by hand,
+ and the checkout above deliberately does not fetch it. Build it from your
+ legacy files instead, which is what the converter is for:
+
+ ```bash
+ bash .claude/scripts/migrate-v1-config.sh --dry-run # preview
+ bash .claude/scripts/migrate-v1-config.sh # writes project.yaml
+ ```
+
+ If you skip this, `detect-gaps.sh` will nudge you at the next session start —
+ but do it here rather than discovering it later.
+
+- **Upgrading from v1.1 or later:** you already have a `project.yaml` holding
+ your settings. Treat it like `CLAUDE.md` — diff and merge by hand, never
+ checkout, or you will overwrite your own configuration:
+
+ ```bash
+ git diff HEAD template/main -- project.yaml
+ ```
+
---
### Strategy B — Cherry-pick specific commits
@@ -81,6 +162,154 @@ Best when: you didn't use git to set up the template (just downloaded a zip).
---
+## v1.0 → v1.1
+
+**Released:** 2026-09-23
+**Key themes:** `project.yaml` as the single source of truth, a modes system
+(`modes.rigor` fronting `workflow`/`docs.density`/`qa.level`/`story_granularity`,
+plus `review_mode` and `automation`), `/settings`, `project.local.yaml`
+per-developer overrides, migration tooling, token-efficiency cuts.
+
+This is the biggest config change since the template's `production/stage.txt`
+/ `production/review-mode.txt` era. Read
+[CHANGELOG.md](CHANGELOG.md#110--2026-09-23) for the full list of additions —
+this section covers what to do about it.
+
+### What Changed
+
+See [CHANGELOG.md](CHANGELOG.md#110--2026-09-23) for the complete list. The
+short version: `project.yaml` replaces `production/stage.txt`,
+`production/review-mode.txt`, and `.claude/docs/technical-preferences.md` as
+the primary config store (all three still work as a fallback — nothing is
+force-deleted), a new `modes` block controls how much process the project
+carries (`modes.rigor: minimal | standard | full`), and a new `/settings`
+skill views and edits any of it, including a gitignored
+`project.local.yaml` for settings that should vary per developer.
+
+### Heads-up: the process level you get by default has changed
+
+`modes.rigor` now defaults to **`minimal`**, not `standard`. If your
+`project.yaml` sets `modes.rigor` explicitly, nothing changes for you and you
+can skip this.
+
+If it does not, the upgrade is visible: any of the six knobs `rigor` fronts that
+you never set moves from the `standard` row to the `minimal` row. In practice
+that means fewer required GDD sections, terser writing, coarser stories, no
+director review panels, and `qa.level` dropping from `standard` to `minimal`.
+Knobs you *did* set explicitly are untouched.
+
+**To keep the old behaviour, pin it in one line:**
+
+```yaml
+modes:
+ rigor: standard
+```
+
+We changed the default because we measured it. Built both ways, `standard` cost
+several times more to reach working code, did not produce a better result, and
+gave nothing back when a fresh developer picked the project up. Most projects
+were paying for process that did not repay.
+If yours is one that does -- several interacting systems, or a design someone
+else has to implement -- `standard` and `full` are one `/settings` call away,
+and `/help` and `/gate-check` will suggest raising it as your project grows.
+
+### Files: Safe to Overwrite
+
+**Take `.claude/` as a whole. Do not copy a subset.** v1.1 adds around 73 new
+files under that directory — `automation-modes.md`, `workflow-modes.md`,
+`config-resolution.md`, `effects-map.md`, 28 director gates, the game-brief
+template, 7 guidance templates, 8 scripts, 6 gate-check references, 10
+`CONTRACT.md` files — and the skills cross-reference each other across all of
+them. A partial copy leaves skills pointing at documents you do not have, which
+fails at the moment you run them rather than at the moment you copy. That is why
+there is no short file list here.
+
+```
+.claude/ (the whole directory — new and changed files alike)
+ EXCEPT .claude/docs/technical-preferences.md — see the note below.
+ The template ships a placeholder copy of that file; overwriting
+ yours silently discards your Forbidden Patterns and Allowed
+ Libraries, which have no project.yaml equivalent. Back it up
+ before you copy and restore it afterwards.
+README.md
+CHANGELOG.md
+UPGRADING.md
+.gitignore (adds project.local.yaml)
+```
+
+> **Strategy A (git merge) protects you here automatically** — git flags that file
+> as a conflict because you both changed it. The manual-copy strategies do not:
+> a recursive copy overwrites it without a word.
+
+Your own tests under `tests/` and any tooling under `tools/` are yours; the
+template ships nothing into either, so nothing there is at risk.
+
+Copying is additive: files *you* added under `.claude/` survive, because nothing
+is deleted. Only files the template also ships get replaced.
+
+All 74 `SKILL.md` files changed in v1.1, and 66 of them now resolve config via
+`resolve_config`. If you have not hand-edited any skill file, taking them all is
+safe.
+
+> **Two things under `.claude/` are yours — check them before you copy.**
+>
+> - `.claude/docs/technical-preferences.md` still holds your Forbidden Patterns
+> and Allowed Libraries, which have no `project.yaml` equivalent. Keep your
+> copy; see [Merge Carefully](#claudedocstechnical-preferencesmd) below.
+> - Anything else you customised — agent definitions and director gates are the
+> usual ones. If your project is in git, `git log --oneline -- .claude` lists
+> whether you have any. Re-apply your edits on top of the new version rather
+> than keeping your old file wholesale; the new version almost certainly
+> changed there too.
+
+(`project.yaml` itself is not copied from the template — `/start` generates it
+for new projects, and `.claude/scripts/migrate-v1-config.sh` builds it from
+your legacy config files for existing ones.)
+
+### Files: Merge Carefully
+
+#### `project.yaml` (new — this is YOUR data, not template infrastructure)
+
+This file does not exist in v1.0. If you have an existing project with
+`production/stage.txt`, `production/review-mode.txt`, or a filled-in
+`.claude/docs/technical-preferences.md`, **do not hand-author
+`project.yaml`** — those files hold your project's actual configuration and
+migrating them by hand risks transcription errors the tooling is built to
+avoid. Follow the dedicated
+[migration guide](docs/migration-guide-v1.1.md) instead, which walks
+`.claude/scripts/migrate-v1-config.sh` end to end.
+
+If you're starting fresh (no legacy files with real values), just run
+`/start` — it writes a complete `project.yaml` for you.
+
+#### `.claude/docs/technical-preferences.md`
+
+Stays in place. Most of its content (engine, naming, performance budgets,
+testing framework, specialists) has a `project.yaml` equivalent now and is
+read from there first. Two sections — Forbidden Patterns and Allowed
+Libraries — have no `project.yaml` equivalent and this file remains their
+home permanently; `--finalize` migration never deletes it.
+
+### After Upgrading
+
+1. If you have an existing project (not starting fresh), read
+ [docs/migration-guide-v1.1.md](docs/migration-guide-v1.1.md) and run
+ `.claude/scripts/migrate-v1-config.sh --dry-run` to see what migration
+ would do before committing to it.
+2. Run `/settings` to see your effective configuration once `project.yaml`
+ exists — it shows you the value, source, and whether each setting is
+ locally overridable.
+3. Consider setting `modes.rigor` explicitly if your project doesn't match
+ the `minimal` default — `/settings modes.rigor=standard` to keep the
+ process level v1.0 had, `modes.rigor=full` for a project that wants every
+ gate. The migration report says this too.
+4. If you customised any skill, re-read it against the new version before
+ relying on it — a skill that resolves config differently from the rest of
+ the framework fails quietly, by taking a default branch rather than by
+ erroring.
+
+---
+
## v0.4.1
**Released:** 2026-04-02
@@ -140,7 +369,7 @@ None — all changes are to infrastructure files with no user content.
| **New skill** | `/vertical-slice` — Pre-Production gate that validates the full game loop with a production-quality end-to-end build before Production. Pairs with the overhauled `/prototype` (concept validation right after `/brainstorm`). |
| **New flow** | Entity inventory step in `/map-systems` — surfaces all named entities up front for cleaner downstream GDD authoring. |
| **UX polish** | Added missing `AskUserQuestion` widgets to 7 skills; comprehensive skill audit for consistency, prompts, and flow gaps; exposed `--review` flag in `argument-hints` for all `team-*` skills. |
-| **Bug fixes** | `#21` log-agent hooks logged "unknown" `agent_type`; `#36` missing `allowed-tools` in `/architecture-decision` and `/story-done`; `#42` `rg --type gdscript` is invalid (now uses `--glob *.gd`); `#43` session-start preview showed oldest state instead of newest; `#45` duplicate `## 0.` heading and broken step numbering in `/architecture-decision`. |
+| **Bug fixes** | log-agent hooks logged "unknown" `agent_type`; missing `allowed-tools` in `/architecture-decision` and `/story-done`; `rg --type gdscript` is invalid (now uses `--glob *.gd`); session-start preview showed oldest state instead of newest; duplicate `## 0.` heading and broken step numbering in `/architecture-decision`. |
| **Project docs** | Added `CONTRIBUTING.md` (framework contribution guidelines) and `SECURITY.md` (coordinated disclosure policy). |
| **Counts/refs** | Synced agent/skill/hook counts across `WORKFLOW-GUIDE.md`, `README.md`, and agent rosters; fixed stale agent names and skill model-tier fields. |
@@ -157,8 +386,8 @@ SECURITY.md
**Existing files to overwrite (no user content):**
- All files under `.claude/skills/` modified in the commit range (skill audit + AskUserQuestion widgets + `--review` argument-hints)
-- `.claude/hooks/log-agent.sh` (fix #21)
-- `README.md`, `docs/WORKFLOW-GUIDE.md`, `docs/examples/skill-flow-diagrams.md`
+- `.claude/hooks/log-agent.sh` (`agent_type` logging fix)
+- `README.md`, `docs/WORKFLOW-GUIDE.md`, `docs/skill-flow-diagrams.md`
- `UPGRADING.md`
---
@@ -637,14 +866,14 @@ is safe. Otherwise, add this block manually:
the terminal status line:
```
-ctx: 42% | claude-sonnet-4-6 | Systems Design
+ctx: 42% | claude-sonnet-5 | Systems Design
```
In Production/Polish/Release stages, it also shows the active Epic/Feature/Task
from `production/session-state/active.md` if a `<!-- STATUS -->` block is present:
```
-ctx: 42% | claude-sonnet-4-6 | Production | Combat System > Melee Combat > Hitboxes
+ctx: 42% | claude-sonnet-5 | Production | Combat System > Melee Combat > Hitboxes
```
The current stage is auto-detected from project artifacts, or can be pinned by
@@ -709,9 +938,6 @@ versions directly with no risk to your project content.
.claude/skills/map-systems/SKILL.md
.claude/skills/design-system/SKILL.md
.claude/docs/templates/systems-index.md
-.claude/docs/templates/collaborative-protocols/design-agent-protocol.md
-.claude/docs/templates/collaborative-protocols/implementation-agent-protocol.md
-.claude/docs/templates/collaborative-protocols/leadership-agent-protocol.md
.claude/hooks/detect-gaps.sh
.claude/hooks/session-start.sh
production/session-state/.gitkeep
diff --git a/design/CLAUDE.md b/design/CLAUDE.md
index d293c3b9..766fb8b8 100644
--- a/design/CLAUDE.md
+++ b/design/CLAUDE.md
@@ -4,7 +4,7 @@ When authoring or editing files in this directory, follow these standards.
## GDD Files (`design/gdd/`)
-Every GDD must include all **8 required sections** in this order:
+The 8 GDD sections, in order:
1. Overview — one-paragraph summary
2. Player Fantasy — intended feeling and experience
3. Detailed Rules — unambiguous mechanics
@@ -14,6 +14,23 @@ Every GDD must include all **8 required sections** in this order:
7. Tuning Knobs — configurable values identified
8. Acceptance Criteria — testable success conditions
+**How many are REQUIRED depends on `modes.workflow`** — all 8 at `full`; 5 at
+`standard` (Overview, Detailed Rules, Edge Cases, Dependencies, Acceptance
+Criteria, plus Formulas when the system has math); none at `minimal`, where
+`design/game-brief.md` is the design record instead of a GDD. Resolve the tier
+before flagging a section as missing — see `.claude/docs/workflow-modes.md`.
+
+> **Three other places already encode the tier rule** —
+> `.claude/docs/coding-standards.md`, `.claude/rules/design-docs.md` and
+> `.claude/hooks/validate-commit.sh`. This file is the copy a session working in
+> `design/` reads first, so it must agree with them: demanding all 8 at
+> `minimal` warns a jam project about six sections its own configuration says it
+> does not need, which trains the user to ignore the warning.
+
+**Section-name alias:** the GDD template and `/design-system` author section 3
+as `## Detailed Design`; the standard calls it **Detailed Rules**. Same required
+section — accept either heading, never rewrite one into the other.
+
**File naming:** `[system-slug].md` (e.g. `movement-system.md`, `combat-system.md`)
**Systems index:** `design/gdd/systems-index.md` — update when adding a new GDD.
@@ -33,6 +50,14 @@ Use `/quick-design` to author.
- Per-screen specs: `design/ux/[screen-name].md`
- HUD design: `design/ux/hud.md`
- Interaction pattern library: `design/ux/interaction-patterns.md`
-- Accessibility requirements: `design/ux/accessibility-requirements.md`
+- Accessibility requirements: `design/accessibility-requirements.md`
Use `/ux-design` to author. Validate with `/ux-review` before passing to `/team-ui`.
+
+> **Accessibility requirements sit OUTSIDE `design/ux/` on purpose.** They are a
+> project-wide standard the per-screen specs consult, not a spec for one screen.
+> `.claude/docs/workflow-catalog.yaml`, the Pre-Production, Production and Polish
+> gates, and `/architecture-review` all check `design/accessibility-requirements.md`
+> at that exact path. Do not "tidy" it under `design/ux/` — every one of those
+> checks would stop matching, and the Technical Setup → Pre-Production gate would
+> become unpassable. `/ux-design` states the same rule at its `accessibility` mode.
diff --git a/design/registry/entities.yaml b/design/registry/entities.yaml
index bcf9a95a..b318786c 100644
--- a/design/registry/entities.yaml
+++ b/design/registry/entities.yaml
@@ -21,7 +21,10 @@
# Section C/D writes to conflict-check new entities/formulas)
# /consistency-check (primary input — grep-first, GDD-second)
# /review-all-gdds (Phase 1 — baseline for Phase 2 checks)
-# /architecture-review (data structure and interface validation)
+# /design-review (Phase 1 — cross-doc facts, in place of sibling GDDs)
+# /content-audit (Step 2 — planned named-content count)
+# /balance-check (Phase 3 — intended constant/formula values)
+# /propagate-design-change (Step 3 — downstream GDD impact via referenced_by)
#
# SEARCH PATTERNS (for skills using Grep):
# All entity names: Grep pattern="^ - name:" path="design/registry/entities.yaml"
diff --git a/docs/COLLABORATIVE-DESIGN-PRINCIPLE.md b/docs/COLLABORATIVE-DESIGN-PRINCIPLE.md
index c81f38c4..a5a383c6 100644
--- a/docs/COLLABORATIVE-DESIGN-PRINCIPLE.md
+++ b/docs/COLLABORATIVE-DESIGN-PRINCIPLE.md
@@ -681,7 +681,7 @@ WHEN implementing:
This principle has been fully embedded across the project:
- **CLAUDE.md** — Collaboration protocol section added
-- **All 48 agent definitions** — Updated to enforce question-asking and approval
+- **All 49 agent definitions** — Updated to enforce question-asking and approval
- **All skills** — Updated to require approval before writing
- **WORKFLOW-GUIDE.md** — Rewritten with collaborative examples
- **README.md** — Clarifies collaborative (not autonomous) design
diff --git a/docs/WORKFLOW-GUIDE.md b/docs/WORKFLOW-GUIDE.md
index 30a11c9f..a492a4e9 100644
--- a/docs/WORKFLOW-GUIDE.md
+++ b/docs/WORKFLOW-GUIDE.md
@@ -88,9 +88,10 @@ At any point, run:
/help
```
-This reads your current phase from `production/stage.txt`, checks which
-artifacts exist, and tells you exactly what to do next. It distinguishes
-between REQUIRED next steps and OPTIONAL opportunities.
+This reads your current phase from `project.stage` in `project.yaml` (falling
+back to `production/stage.txt`), checks which artifacts exist, and tells you
+exactly what to do next. It distinguishes between REQUIRED next steps and
+OPTIONAL opportunities.
### Step 5: Create Your Directory Structure
@@ -155,7 +156,7 @@ with defined pillars and a player journey. This is where you figure out
| | |
v v v
10 concepts Concept doc with Validation Engine pinned in
- MDA analysis pillars, MDA, of concept technical-preferences.md
+ MDA analysis pillars, MDA, of concept project.yaml
Player motiv. core loop, USP document
|
v
@@ -230,8 +231,9 @@ Or with a specific engine:
**What /setup-engine does:**
-- Populates `.claude/docs/technical-preferences.md` with naming conventions,
- performance budgets, and engine-specific defaults
+- Writes engine, language, specialists, naming conventions, and performance
+ budgets to `project.yaml` (the source of truth) and mirrors them to
+ `.claude/docs/technical-preferences.md` (the human-readable legacy fallback)
- Detects knowledge gaps (engine version newer than LLM training data) and
advises cross-referencing `docs/engine-reference/`
- Creates version-pinned reference docs in `docs/engine-reference/`
@@ -268,7 +270,7 @@ production.
**Requirements to pass:**
-- Engine configured in `technical-preferences.md`
+- Engine configured in `project.yaml` (`engine.*`)
- `design/gdd/game-concept.md` exists with pillars
- `design/gdd/systems-index.md` exists with dependency ordering
@@ -357,7 +359,8 @@ Before the next system starts, validate the current one:
/design-review design/gdd/combat-system.md
```
-Checks all 8 sections for completeness, formula clarity, edge case resolution,
+Checks the sections your `modes.workflow` tier requires (all 8 at `full`, 5 at
+`standard`) for completeness, formula clarity, edge case resolution,
bidirectional dependencies, and testable acceptance criteria.
**Verdict:** APPROVED / NEEDS REVISION / MAJOR REVISION. Only APPROVED GDDs
@@ -599,8 +602,9 @@ Three modes: screen/flow, HUD, and interaction patterns. Output goes to
interaction map, data requirements, events fired, accessibility, localization.
Reads your `accessibility-requirements.md` (written in Phase 3) and your
-input method config from `technical-preferences.md` to drive accessibility
-and input coverage checks — no need to re-specify them per screen.
+input method config from `project.yaml` (the `platform.*` block, falling back
+to `technical-preferences.md`) to drive accessibility and input coverage
+checks — no need to re-specify them per screen.
> **Tip:** `/design-system` emits a 📌 UX Flag for every system with UI
> requirements. Use those flags as a checklist for which screens need specs.
@@ -1156,7 +1160,8 @@ These topics apply across all phases.
Director gates are specialist agents that review your work at key workflow steps.
By default they run at every checkpoint. You can control how much review you get.
-**Set your review intensity once during `/start`.** Saved to `production/review-mode.txt`.
+**Set your review intensity once during `/start`.** Saved to `modes.review_mode`
+in `project.yaml` (mirrored to `production/review-mode.txt` as a legacy fallback).
| Mode | What runs | Best for |
|------|-----------|----------|
@@ -1172,7 +1177,7 @@ By default they run at every checkpoint. You can control how much review you get
```
The `--review` flag works on all gate-using skills. Change the global mode at any
-time by editing `production/review-mode.txt` directly or re-running `/start`.
+time by editing `modes.review_mode` in `project.yaml` or re-running `/start`.
Full gate definitions and check pattern: `.claude/docs/director-gates.md`
@@ -1256,7 +1261,7 @@ The system has 12 hooks that run automatically:
| `validate-skill-change.sh` | Skill file written | Advises running `/skill-test` after `.claude/skills/` changes |
| `log-agent.sh` | Agent start | Logs agent invocations for audit trail |
| `log-agent-stop.sh` | Agent stop | Completes agent audit trail (start + stop) |
-| `session-stop.sh` | Session end | Final session logging |
+| `session-stop.sh` | **Every response ends** | Session logging and the subagent spawn tally. Despite the name it fires once per response, not once per session. |
### Context Resilience
@@ -1327,8 +1332,9 @@ Phase gates are formal checkpoints. Run `/gate-check` with the transition name:
- **CONCERNS** -- requirements met with acknowledged risks, passable
- **FAIL** -- requirements not met, blocks advancement with specific remediation
-When a gate passes, `production/stage.txt` is updated (only then), which
-controls the status line and `/help` behavior.
+When a gate passes, `project.stage` in `project.yaml` is updated (only then) —
+mirrored to `production/stage.txt` — which controls the status line and `/help`
+behavior.
### Reverse Documentation
diff --git a/docs/engine-reference/godot/VERSION.md b/docs/engine-reference/godot/VERSION.md
index b008a9b3..95eef504 100644
--- a/docs/engine-reference/godot/VERSION.md
+++ b/docs/engine-reference/godot/VERSION.md
@@ -3,6 +3,7 @@
| Field | Value |
|-------|-------|
| **Engine Version** | Godot 4.6 |
+| **Installed at pin time** | NOT DETERMINED — `/setup-engine` §3 probes the installed editor and records the result here. |
| **Release Date** | January 2026 |
| **Project Pinned** | 2026-02-12 |
| **Last Docs Verified** | 2026-02-12 |
@@ -14,6 +15,15 @@ The LLM's training data likely covers Godot up to ~4.3. Versions 4.4, 4.5,
and 4.6 introduced significant changes that the model does NOT know about.
Always cross-reference this directory before suggesting Godot API calls.
+## Installed-Version Gap Warning
+
+The warning above is one-directional — it covers the **model** knowing less than
+this pin. The reverse gap is real and `/setup-engine` §3 creates it deliberately
+("pin the newer one and upgrade later"): this reference can sit **ahead of the
+installed editor**, and an agent citing it correctly then emits APIs that do not
+compile locally. **Check `Installed at pin time` above before trusting a
+version-qualified claim** — `NOT DETERMINED` means the gap is unknown, not absent.
+
## Post-Cutoff Version Timeline
| Version | Release | Risk Level | Key Theme |
diff --git a/docs/engine-reference/unity/PLUGINS.md b/docs/engine-reference/unity/PLUGINS.md
index bb29ce43..8d99063a 100644
--- a/docs/engine-reference/unity/PLUGINS.md
+++ b/docs/engine-reference/unity/PLUGINS.md
@@ -57,7 +57,7 @@ These are NOT part of the core engine but are commonly used for specific game ty
- **Purpose:** Modern input handling (rebindable, cross-platform)
- **Status:** Production-Ready (default in Unity 6)
- **Package:** `com.unity.inputsystem`
-- **Docs:** See [modules/input.md](../modules/input.md)
+- **Docs:** See [modules/input.md](modules/input.md)
- **Official:** https://docs.unity3d.com/Packages/[email protected]/manual/index.html
---
@@ -66,7 +66,7 @@ These are NOT part of the core engine but are commonly used for specific game ty
- **Purpose:** Modern runtime UI (HTML/CSS-like, performant)
- **Status:** Production-Ready (Unity 6)
- **Package:** Built-in
-- **Docs:** See [modules/ui.md](../modules/ui.md)
+- **Docs:** See [modules/ui.md](modules/ui.md)
- **Official:** https://docs.unity3d.com/Packages/[email protected]/manual/index.html
---
diff --git a/docs/engine-reference/unity/VERSION.md b/docs/engine-reference/unity/VERSION.md
index 2ba702d2..6f80f32d 100644
--- a/docs/engine-reference/unity/VERSION.md
+++ b/docs/engine-reference/unity/VERSION.md
@@ -3,6 +3,7 @@
| Field | Value |
|-------|-------|
| **Engine Version** | Unity 6.3 LTS |
+| **Installed at pin time** | NOT DETERMINED — `/setup-engine` §3 probes the installed editor and records the result here. |
| **Release Date** | December 2025 |
| **Project Pinned** | 2026-02-13 |
| **Last Docs Verified** | 2026-02-13 |
@@ -15,8 +16,44 @@ Unity 6 release series (formerly Unity 2023 Tech Stream) introduced significant
changes that the model does NOT know about. Always cross-reference this directory
before suggesting Unity API calls.
+## Installed-Version Gap Warning
+
+The warning above is one-directional — it covers the **model** knowing less than
+this pin. The reverse gap is real and `/setup-engine` §3 creates it deliberately
+("pin the newer one and upgrade later"): this reference can sit **ahead of the
+installed editor**, and an agent citing it correctly then emits APIs that do not
+compile locally. **Check `Installed at pin time` above before trusting a
+version-qualified claim** — `NOT DETERMINED` means the gap is unknown, not absent.
+
## Post-Cutoff Version Timeline
+<!-- timeline-unverified -->
+
+> **⚠ THIS TABLE IS INTERNALLY INCONSISTENT AND MUST NOT BE TRUSTED FOR RISK
+> JUDGEMENTS UNTIL RE-VERIFIED (flagged 2026-08-10).** It is titled
+> *Post-Cutoff* and the stated cutoff above is **May 2025**, yet three of its four
+> rows are dated **Oct, Nov and Dec 2024** — before that cutoff — followed by a
+> twelve-month gap to 6.3 in Dec 2025. Both cannot be right. The sibling files
+> `godot/VERSION.md` and `unreal/VERSION.md` list only genuinely post-cutoff
+> versions, so this is a defect in this file, not in the format.
+>
+> **Why it matters more than a wrong date.** This table's entire job is to tell an
+> agent what it does *not* already know. Rows that predate the cutoff invert that
+> signal: take an installed `6000.1.0f1` (**Unity 6.1**) — this
+> table dates it to Nov 2024 and labels it post-cutoff MEDIUM risk, while by its own
+> cutoff a Nov 2024 release would be *inside* training data. An agent reading this
+> either over-trusts the reference or mis-scopes what is new, and the `6.2+`
+> boundaries cited elsewhere in this directory are anchored to these rows.
+>
+> **The dates are NOT corrected here, deliberately.** Real Unity release dates
+> cannot be sourced from this repo — this directory *is* the source — and writing
+> them from training data is the failure this whole directory exists to prevent
+> (`/security-audit` makes the same call). Re-verify against Unity's
+> published release notes and update the row dates, the `Release Date` field, and
+> `Last Docs Verified` together. Until then, treat every version-qualified claim in
+> `docs/engine-reference/unity/` as **unconfirmed**, and prefer APIs that are not
+> version-boundary-dependent.
+
| Version | Release | Risk Level | Key Theme |
|---------|---------|------------|-----------|
| 6.0 | Oct 2024 | HIGH | Unity 6 rebrand, new rendering features, Entities 1.3, DOTS improvements |
diff --git a/docs/engine-reference/unreal/VERSION.md b/docs/engine-reference/unreal/VERSION.md
index 4d91e86d..91c5a8e3 100644
--- a/docs/engine-reference/unreal/VERSION.md
+++ b/docs/engine-reference/unreal/VERSION.md
@@ -3,6 +3,7 @@
| Field | Value |
|-------|-------|
| **Engine Version** | Unreal Engine 5.7 |
+| **Installed at pin time** | NOT DETERMINED — `/setup-engine` §3 probes the installed editor and records the result here. |
| **Release Date** | November 2025 |
| **Project Pinned** | 2026-02-13 |
| **Last Docs Verified** | 2026-02-13 |
@@ -14,6 +15,15 @@ The LLM's training data likely covers Unreal Engine up to ~5.3. Versions 5.4, 5.
5.6, and 5.7 introduced significant changes that the model does NOT know about.
Always cross-reference this directory before suggesting Unreal API calls.
+## Installed-Version Gap Warning
+
+The warning above is one-directional — it covers the **model** knowing less than
+this pin. The reverse gap is real and `/setup-engine` §3 creates it deliberately
+("pin the newer one and upgrade later"): this reference can sit **ahead of the
+installed editor**, and an agent citing it correctly then emits APIs that do not
+compile locally. **Check `Installed at pin time` above before trusting a
+version-qualified claim** — `NOT DETERMINED` means the gap is unknown, not absent.
+
## Post-Cutoff Version Timeline
| Version | Release | Risk Level | Key Theme |
diff --git a/docs/engine-reference/unreal/current-best-practices.md b/docs/engine-reference/unreal/current-best-practices.md
index bdc44caa..0a75c273 100644
--- a/docs/engine-reference/unreal/current-best-practices.md
+++ b/docs/engine-reference/unreal/current-best-practices.md
@@ -267,6 +267,18 @@ void AMyCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLife
```cpp
// ✅ Reuse objects instead of Spawn/Destroy
+//
+// ⚠ INCONSISTENT WITH THIS FILE'S OWN RULE (flagged 2026-08-10).
+// The GC section above states that an unmarked raw UObject pointer is
+// "Dangerous! May be garbage collected" and requires UPROPERTY() +
+// TObjectPtr<T>. This pooling example then holds raw AActor* in a bare TArray,
+// which is exactly the shape that section forbids. FOLLOW THE RULE, NOT THIS
+// SNIPPET: declare the pool UPROPERTY() TArray<TObjectPtr<AActor>>.
+//
+// Left visible rather than silently rewritten: the corrected form has not been
+// verified against Epic's docs for 5.7, and this directory is the offline
+// substitute for them -- editing a code sample here from memory is the failure
+// mode the whole reference exists to prevent. Re-verify, then fix both together.
TArray<AActor*> ProjectilePool;
AActor* GetPooledProjectile() {
diff --git a/docs/engine-reference/unreal/plugins/gameplay-ability-system.md b/docs/engine-reference/unreal/plugins/gameplay-ability-system.md
index 25292cc0..c655b2ff 100644
--- a/docs/engine-reference/unreal/plugins/gameplay-ability-system.md
+++ b/docs/engine-reference/unreal/plugins/gameplay-ability-system.md
@@ -196,6 +196,14 @@ public:
NetExecutionPolicy = EGameplayAbilityNetExecutionPolicy::ServerInitiated;
// Tags
+ // ⚠️ UNVERIFIED FOR 5.7 — `AbilityTags` may be deprecated in favour of
+ // SetAssetTags()/GetAssetTags(). Reported by the `unreal-specialist`
+ // agent (2026-08-12), which believed the change landed around 5.5 and
+ // correctly REFUSED to emit code on a symbol it could not verify.
+ // NOT SOURCEABLE offline: this repo has no 5.7 API dump to check against,
+ // and the same knowledge-gap warning that governs the agent governs this
+ // file. Verify against the UE 5.7 docs before using this snippet, and
+ // correct both occurrences (here and ~line 328) together.
AbilityTags.AddTag(FGameplayTag::RequestGameplayTag(FName("Ability.Attack.Fireball")));
}
diff --git a/docs/examples/README.md b/docs/examples/README.md
deleted file mode 100644
index 1a0f6371..00000000
--- a/docs/examples/README.md
+++ /dev/null
@@ -1,357 +0,0 @@
-# Collaborative Session Examples
-
-This directory contains realistic, end-to-end session transcripts showing how the Game Studio Agent Architecture works in practice. Each example demonstrates the **collaborative workflow** where agents ask questions, present options, and wait for user approval rather than autonomously generating content.
-
----
-
-## Visual Reference
-
-**New to the system? Start here:**
-[Skill Flow Diagrams](skill-flow-diagrams.md) — visual maps of all 7 phases and how skills chain together.
-
----
-
-## 📚 **Available Examples**
-
-### CORE WORKFLOW
-
-### [Skill Flow Diagrams](skill-flow-diagrams.md)
-**Type:** Visual Reference
-**Complexity:** All levels
-
-Full pipeline overview (zero to ship), plus detailed chain diagrams for:
-design-system, story lifecycle, UX pipeline, and brownfield onboarding.
-**Start here if you want to understand how the pieces fit together.**
-
----
-
-### [Session: Authoring a GDD with /design-system](session-design-system-skill.md)
-**Type:** Design (skill-driven)
-**Skill:** `/design-system`
-**Duration:** ~60 minutes (14 turns)
-**Complexity:** Medium
-
-**Scenario:**
-Dev runs `/design-system movement` after `/map-systems` produced the systems index. The skill loads context from the game concept and dependency GDDs, runs a technical feasibility pre-check, then guides through all 8 GDD sections one at a time — drafting, approving, and writing each section to disk before moving to the next.
-
-**Key Moments:**
-- Technical feasibility pre-check flags Jolt physics default change (Godot 4.6)
-- Incremental writing: each section on disk immediately after approval
-- Session crash during section 5 → agent resumes from first empty section
-- Dependency signals (stamina, inventory) surfaced during the Dependencies section
-- Ends with explicit handoff: "run `/design-review` before the next system"
-
-**Learn:**
-- How `/design-system` is different from asking an agent to "write a GDD"
-- How the section-by-section cycle prevents 30k-token context bloat
-- How incremental file writing survives session crashes
-- How the skill surfaces downstream dependency contracts
-
----
-
-### [Session: Full Story Lifecycle](session-story-lifecycle.md)
-**Type:** Full Workflow
-**Skills:** `/story-readiness` → implementation → `/story-done`
-**Duration:** ~50 minutes (13 turns)
-**Complexity:** Medium
-
-**Scenario:**
-Dev picks up a story from the sprint backlog. `/story-readiness` catches a roll-direction ambiguity before any code is written. After implementation, `/story-done` verifies 9 acceptance criteria, identifies 2 deferred criteria (inventory not integrated yet), and closes the story with notes.
-
-**Key Moments:**
-- `/story-readiness` catches spec ambiguity in Turn 2 — resolved before implementation starts
-- ADR status check: story would be BLOCKED if ADR was still Proposed
-- Manifest version check: confirms story's guidance hasn't drifted from current architecture
-- Deferred criteria tracked (not lost) when integration not yet possible
-- `sprint-status.yaml` updated at story close, next ready story surfaced automatically
-
-**Learn:**
-- Why `/story-readiness` prevents late-implementation ambiguity
-- How deferred criteria work (COMPLETE WITH NOTES vs. BLOCKED)
-- How TR-ID references prevent false deviation flags
-- The full loop from backlog → implemented → closed
-
----
-
-### [Session: Gate Check and Phase Transition](session-gate-check-phase-transition.md)
-**Type:** Phase Gate
-**Skill:** `/gate-check`
-**Duration:** ~20 minutes (7 turns)
-**Complexity:** Low
-
-**Scenario:**
-Dev completes the Systems Design phase and runs `/gate-check` to advance. The gate finds all 6 MVP GDDs complete, cross-review passed with one low-severity concern. Gate passes, `stage.txt` updated, and the agent provides a specific ordered checklist for Technical Setup.
-
-**Key Moments:**
-- Gate validates artifact presence AND internal completeness (8 sections per GDD)
-- CONCERNS ≠ FAIL: low-severity cross-review note passes the gate
-- stage.txt update changes what `/help`, `/sprint-status`, and all skills see going forward
-- Agent surfaces the cross-review concern as a concrete ADR to write next
-- Next phase checklist is specific and ordered, not generic
-
-**Learn:**
-- What a gate check actually validates (not just "do files exist?")
-- How PASS/CONCERNS/FAIL verdicts work
-- Why stage.txt is the authority for phase tracking
-- What changes after a phase transition
-
----
-
-### [Session: UX Pipeline — /ux-design → /ux-review → /team-ui](session-ux-pipeline.md)
-**Type:** UX Design Pipeline
-**Skills:** `/ux-design`, `/ux-review`, `/team-ui`
-**Duration:** ~90 minutes (16 turns)
-**Complexity:** Medium-High
-
-**Scenario:**
-Dev designs the HUD and inventory screen. `/ux-design` reads the player journey and GDDs to ground decisions in player emotional state. `/ux-review` catches a blocking accessibility gap (no keyboard alternative to drag-drop) and an advisory colorblind issue. After fixes, `/team-ui` accepts the handoff.
-
-**Key Moments:**
-- HUD philosophy choice (diegetic vs. persistent vs. tactical) grounded in survival genre conventions
-- `/ux-review` distinguishes BLOCKING (stops handoff) vs. ADVISORY (can fix in visual pass)
-- Accessibility caught before implementation, not during QA
-- Keyboard alternative added in one turn; review re-runs and passes
-- `/team-ui` checks for a passing `/ux-review` before starting visual design
-
-**Learn:**
-- How `/ux-design` uses player journey context to ground UI decisions
-- What `/ux-review` actually checks (not just "does a spec exist?")
-- The difference between HUD doc (`design/ux/hud.md`) and per-screen specs
-- How accessibility issues are handled at design time vs. implementation time
-
----
-
-### [Session: Brownfield Onboarding with /adopt](session-adopt-brownfield.md)
-**Type:** Brownfield Adoption
-**Skill:** `/adopt`
-**Duration:** ~30 minutes (8 turns)
-**Complexity:** Low-Medium
-
-**Scenario:**
-Dev has 3 months of existing code and rough design notes but nothing in the right format. `/adopt` audits format compliance (not just file existence), classifies 4 gaps by severity, builds an ordered 7-step migration plan, and immediately fixes the BLOCKING gap (missing systems index) by inferring it from the codebase.
-
-**Key Moments:**
-- FORMAT audit distinguishes "file exists" from "file has required internal structure"
-- BLOCKING gap identified: missing systems index prevents 4+ skills from running
-- Migration plan is ordered: blocking gaps first, then high, then medium
-- Systems index bootstrapped from code structure — brownfield code contains the answer
-- Retrofit mode vs. new authoring: `/design-system retrofit` fills gaps without overwriting
-
-**Learn:**
-- The difference between `/adopt` and `/project-stage-detect`
-- How format compliance is checked (section detection, not just file presence)
-- How brownfield projects can onboard without losing existing work
-- When to use retrofit mode vs. full authoring
-
----
-
-### FOUNDATIONAL EXAMPLES
-
-### [Session: Designing the Crafting System](session-design-crafting-system.md)
-**Type:** Design
-**Agent:** game-designer
-**Duration:** ~45 minutes (12 turns)
-**Complexity:** Medium
-
-**Scenario:**
-Solo dev needs to design a crafting system that serves Pillar 2 ("Emergent Discovery Through Experimentation"). The agent guides them through question/answer, presents 3 design options with game theory analysis, incorporates user modifications, and iteratively drafts the GDD with approval at each step.
-
-**Key Collaborative Moments:**
-- Agent asks 5 clarifying questions upfront
-- Presents 3 distinct options with pros/cons + MDA alignment
-- User modifies recommended option, agent incorporates immediately
-- Edge case flagged proactively ("what if non-recipe combo?")
-- Each GDD section shown for approval before moving to next
-- Explicit "May I write to [file]?" before creating file
-
-**Learn:**
-- How design agents ask about goals, constraints, references
-- How to present options using game design theory (MDA, SDT, Bartle)
-- How to iterate on drafts section-by-section
-- When to delegate to specialists (systems-designer, economy-designer)
-
----
-
-### [Session: Implementing Combat Damage Calculation](session-implement-combat-damage.md)
-**Type:** Implementation
-**Agent:** gameplay-programmer
-**Duration:** ~30 minutes (10 turns)
-**Complexity:** Low-Medium
-
-**Scenario:**
-User has a complete design doc and wants the damage calculation implemented. Agent reads the spec, identifies 7 ambiguities/gaps, asks clarifying questions, proposes architecture for approval, implements with rule enforcement, and proactively writes tests.
-
-**Key Collaborative Moments:**
-- Agent reads design doc first, identifies 7 spec ambiguities
-- Architecture proposed with code samples BEFORE implementation
-- User requests type safety, agent refines and re-proposes
-- Rules catch issues (hardcoded values), agent fixes transparently
-- Tests written proactively following verification-driven development
-- Agent offers options for next steps rather than assuming
-
-**Learn:**
-- How implementation agents clarify specs before coding
-- How to propose architecture with code samples for approval
-- How rules enforce standards automatically
-- How to handle spec gaps (ask, don't assume)
-- Verification-driven development (tests prove it works)
-
----
-
-### [Session: Scope Crisis - Strategic Decision Making](session-scope-crisis-decision.md)
-**Type:** Strategic Decision
-**Agent:** creative-director
-**Duration:** ~25 minutes (8 turns)
-**Complexity:** High
-
-**Scenario:**
-Solo dev faces crisis: Alpha milestone in 2 weeks, crafting system needs 3 weeks, investor demo is make-or-break. Creative director gathers context, frames the decision, presents 3 strategic options with honest trade-off analysis, makes recommendation but defers to user, then documents decision with ADR and demo script.
-
-**Key Collaborative Moments:**
-- Agent reads context docs before proposing solutions
-- Asks 5 questions to understand decision constraints
-- Frames decision properly (what's at stake, evaluation criteria)
-- Presents 3 options with risk analysis and historical precedent
-- Makes strong recommendation but explicitly: "this is your call"
-- Documents decision + provides demo script to support user
-
-**Learn:**
-- How leadership agents frame strategic decisions
-- How to present options with trade-off analysis
-- How to use game dev precedent and theory in recommendations
-- How to document decisions (ADRs)
-- How to cascade decisions to affected departments
-
----
-
-### [Reverse Documentation Workflow](reverse-document-workflow-example.md)
-**Type:** Brownfield Documentation
-**Agent:** game-designer
-**Duration:** ~20 minutes
-**Complexity:** Low
-
-**Scenario:**
-Developer built a skill tree system but never wrote a design doc. Agent reads the code, infers the design intent, asks clarifying questions about ambiguous decisions, and produces a retroactive GDD.
-
----
-
-## 🎯 **What These Examples Demonstrate**
-
-All examples follow the **collaborative workflow pattern:**
-
-```
-Question → Options → Decision → Draft → Approval
-```
-
-> **Note:** These examples show the collaborative pattern as conversational text.
-> In practice, agents now use the `AskUserQuestion` tool at decision points to
-> present structured option pickers (with labels, descriptions, and multi-select).
-> The pattern is **Explain → Capture**: agents explain their analysis in
-> conversation first, then present a structured UI picker for the user's decision.
-
-### ✅ **Collaborative Behaviors Shown:**
-
-1. **Agents Ask Before Assuming**
- - Design agents ask about goals, constraints, references
- - Implementation agents clarify spec ambiguities
- - Leadership agents gather full context before recommending
-
-2. **Agents Present Options, Not Dictates**
- - 2-4 options with pros/cons
- - Reasoning based on theory, precedent, project pillars
- - Recommendation made, but user decides
-
-3. **Agents Show Work Before Finalizing**
- - Design drafts shown section-by-section
- - Architecture proposals shown before implementation
- - Strategic analysis presented before decisions
-
-4. **Agents Get Approval Before Writing Files**
- - Explicit "May I write to [file]?" before using Write/Edit tools
- - Multi-file changes list all affected files first
- - User says "Yes" before any file is created
-
-5. **Agents Iterate on Feedback**
- - User modifications incorporated immediately
- - No defensiveness when user changes recommendations
- - Celebrate when user improves agent's suggestion
-
----
-
-## 📖 **How to Use These Examples**
-
-### For New Users:
-Read these examples BEFORE your first session. They show realistic expectations for how agents work:
-- Agents are consultants, not autonomous executors
-- You make all creative/strategic decisions
-- Agents provide expert guidance and options
-
-### For Understanding Specific Workflows:
-- **New to the system?** → Read skill-flow-diagrams.md first
-- **Running /design-system for the first time?** → Read session-design-system-skill.md
-- **Picking up a story?** → Read session-story-lifecycle.md
-- **Finishing a phase?** → Read session-gate-check-phase-transition.md
-- **Starting UI work?** → Read session-ux-pipeline.md
-- **Have an existing project?** → Read session-adopt-brownfield.md
-- **Designing a system (agent-driven)?** → Read session-design-crafting-system.md
-- **Implementing code?** → Read session-implement-combat-damage.md
-- **Making strategic decisions?** → Read session-scope-crisis-decision.md
-
-### For Training:
-If you're teaching someone to use this system, walk through one example turn-by-turn to show:
-- What good questions look like
-- How to evaluate presented options
-- When to approve vs. request changes
-- How to maintain creative control while leveraging AI expertise
-
----
-
-## 🔍 **Common Patterns Across All Examples**
-
-### Turn 1-2: **Understand Before Acting**
-- Agent reads context (design docs, specs, constraints)
-- Agent asks clarifying questions
-- No assumptions or guesses
-
-### Turn 3-5: **Present Options with Reasoning**
-- 2-4 distinct approaches
-- Pros/cons for each
-- Theory/precedent supporting the analysis
-- Recommendation made, decision deferred to user
-
-### Turn 6-8: **Iterate on Drafts**
-- Show work incrementally
-- Incorporate feedback immediately
-- Flag edge cases or ambiguities proactively
-
-### Turn 9-10: **Approval and Completion**
-- "May I write to [file]?"
-- User: "Yes"
-- Agent writes files
-- Agent offers next steps (tests, review, integration)
-
----
-
-## 🚀 **Try It Yourself**
-
-After reading these examples, try this exercise:
-
-1. Pick one of your game systems (combat, inventory, progression, etc.)
-2. Ask the relevant agent to design or implement it
-3. Notice if the agent:
- - ✅ Asks clarifying questions upfront
- - ✅ Presents options with reasoning
- - ✅ Shows drafts before finalizing
- - ✅ Requests approval before writing files
-
-If the agent skips any of these, remind it:
-> "Please follow the collaborative protocol from docs/COLLABORATIVE-DESIGN-PRINCIPLE.md"
-
----
-
-## 📝 **Additional Resources**
-
-- **Full Principle Documentation:** [docs/COLLABORATIVE-DESIGN-PRINCIPLE.md](../COLLABORATIVE-DESIGN-PRINCIPLE.md)
-- **Workflow Guide:** [docs/WORKFLOW-GUIDE.md](../WORKFLOW-GUIDE.md)
-- **Agent Roster:** [.claude/docs/agent-roster.md](../../.claude/docs/agent-roster.md)
-- **CLAUDE.md (Collaboration Protocol):** [CLAUDE.md](../../CLAUDE.md#collaboration-protocol)
diff --git a/docs/examples/reverse-document-workflow-example.md b/docs/examples/reverse-document-workflow-example.md
deleted file mode 100644
index 8f900ae4..00000000
--- a/docs/examples/reverse-document-workflow-example.md
+++ /dev/null
@@ -1,121 +0,0 @@
-# Reverse Documentation Workflow Example
-
-## Scenario
-Developer built a working skill tree system but never wrote a design doc.
-Code exists in `src/gameplay/skills/`, but `design/gdd/` has no skill-system.md.
-
----
-
-## Session Transcript
-
-**User:**
-```
-I have a working skill tree system in src/gameplay/skills/ with about 1200 lines
-of code. I never wrote a design doc. Can we create one from the implementation?
-```
-
-**Game-Designer (reads code, analyzes):**
-```
-I've analyzed your skill tree implementation. Here's what I found:
-
-STRUCTURE:
-- 3 skill trees: Combat, Survival, Tech
-- 5 tiers per tree (unlock via level + prerequisites)
-- Total 45 skills (15 per tree)
-- Cost: skill points (1 per level, can respec for gold)
-
-MECHANICS:
-- Passive skills (stat bonuses)
-- Active skills (abilities with cooldowns)
-- Synergy bonuses (cross-tree unlocks at tier 4+)
-
-IMPLEMENTATION DETAILS:
-- Data-driven (JSON files in assets/data/skills/)
-- Save-compatible (skill state serialized)
-- UI shows locked/unlocked/available states
-
-QUESTIONS before I draft the design doc:
-
-1. **Design Intent:** Was the 3-tree structure meant to represent player archetypes
- (fighter/survivor/engineer) or playstyle flexibility?
-
-2. **Respec Cost:** Respec costs gold - is this meant to:
- - Discourage frequent respecs (commitment to builds)?
- - Create a gold sink (economy balance)?
- - Or should it be free (experimentation encouraged)?
-
-3. **Synergy System:** Cross-tree synergies appear at tier 4. Was this:
- - Intentional (reward hybrid builds late-game)?
- - Or emergent (accidentally creates hybrid meta)?
-
-4. **Balance Philosophy:** I see some skills are clearly better (tier-5 passive
- is +50% damage). Is this:
- - Power fantasy (late-game should feel OP)?
- - Or unbalanced (needs tuning)?
-```
-
-**User:**
-```
-Good questions! Here's the intent:
-
-1. Yes, the 3 trees are archetypes but I want flexibility
-2. Respec should be cheap - I want experimentation
-3. Synergies were intentional - hybrid builds are a feature
-4. Yeah, tier 5 is meant to be powerful, but +50% might be too much
-```
-
-**Game-Designer:**
-```
-Perfect, that clarifies the vision. Let me draft the design doc:
-
-[Shows draft of design/gdd/skill-system.md]
-
-SECTIONS:
-1. Overview (3-tree system, hybrid-friendly, respec-encouraged)
-2. Design Pillars:
- - Archetype clarity (each tree has identity)
- - Build flexibility (no lock-in, cheap respec)
- - Synergy rewards (cross-tree combinations viable)
-3. Detailed Design (tree structure, unlock rules, respec)
-4. Balance Framework (tier power curve, synergy limits)
-5. Edge Cases (respec during combat? max skills? cap?)
-6. Dependencies (UI, save system, tutorial)
-7. Acceptance Criteria (all trees viable, 10+ hybrid builds, clear tooltips)
-8. Open Questions:
- - Should respec cost scale with level or stay flat?
- - Tier 5 damage bonus: tune to +30% or keep +50%?
-
-**May I write this to design/gdd/skill-system.md?**
-```
-
-**User:**
-```
-Yes, write it. But let's tune tier 5 to +30% and make respec cost scale.
-```
-
-**Game-Designer:**
-```
-✅ Written to design/gdd/skill-system.md
-✅ Marked as [REVERSE-DOCUMENTED FROM IMPLEMENTATION]
-✅ Added TODO: Update tier-5 passive to +30% in assets/data/skills/combat-tree.json
-✅ Added TODO: Implement scaling respec cost formula
-
-Next steps:
-- Run /balance-check to validate skill tree progression curve?
-- Create ADR documenting why 3 trees instead of 5?
-- Update tutorial to explain hybrid synergies?
-```
-
----
-
-## Key Observations
-
-1. **Agent asked clarifying questions** - didn't just describe code
-2. **Separated intent from implementation** - user corrected "accidental" imbalance
-3. **Design doc captures "why"** - not just "what the code does"
-4. **Identified missing pieces** - edge cases not in code
-5. **Flagged follow-up work** - balance tuning, ADRs, tutorial
-
-## Outcome
-
-The design doc now exists and **matches reality** while also capturing the **intended vision**. Future changes will reference this doc, and new team members understand the *why* behind decisions.
diff --git a/docs/examples/session-adopt-brownfield.md b/docs/examples/session-adopt-brownfield.md
deleted file mode 100644
index 143f9daf..00000000
--- a/docs/examples/session-adopt-brownfield.md
+++ /dev/null
@@ -1,197 +0,0 @@
-# Example Session: /adopt — Brownfield Project Onboarding
-
-**Context:** Developer has been building a game for 3 months before discovering this agent system. They have code, some design docs, and rough notes — but nothing in the right format for the skills to use.
-
-**Starting State:**
-- `src/gameplay/` — ~4000 lines of Godot 4.6 GDScript
-- `design/` — 3 markdown files with rough design notes (not in GDD template format)
-- No `design/gdd/` directory
-- No `docs/architecture/` directory
-- No `production/` directory
-- No `design/gdd/systems-index.md`
-- CLAUDE.md exists (engine configured: Godot 4.6)
-
-**Session Duration:** ~30 minutes
-**Turns:** 8
-**Outcome:** Adoption plan written, most urgent gap (missing system index) fixed immediately
-
----
-
-## Turn 1: User Invokes /adopt
-
-**User:**
-> /adopt
-
-## Turn 2: Agent Detects Project State
-
-**Agent (technical-director, via /adopt, context: fork):**
-> Running brownfield audit...
->
-> **Phase 1: Project State Detection**
->
-> | Artifact Category | Found | Notes |
-> |------------------|-------|-------|
-> | Engine configuration | ✅ | Godot 4.6 in CLAUDE.md |
-> | Source code | ✅ | ~4000 lines in `src/gameplay/` |
-> | Design docs | ⚠️ | 3 files in `design/`, not in GDD format |
-> | Architecture docs | ❌ | `docs/architecture/` missing |
-> | Systems index | ❌ | `design/gdd/systems-index.md` missing |
-> | Production tracking | ❌ | `production/` directory missing |
-> | Sprint/story files | ❌ | None |
->
-> **Phase 2: Format Audit (existing files)**
->
-> Checking internal structure of the 3 design files...
->
-> *`design/combat-notes.md`:*
-> - Has informal notes, no GDD template sections
-> - Contains: some rule descriptions, a damage formula, rough balance numbers
-> - Missing from GDD template: Overview, Player Fantasy, Edge Cases, Dependencies, Tuning Knobs, Acceptance Criteria (6 of 8 sections)
->
-> *`design/crafting-ideas.md`:*
-> - Brainstorm-style notes, no structure
-> - No formulas, no acceptance criteria
-> - Represents early concept thinking — useful as input for a GDD, not yet a GDD
->
-> *`design/inventory.md`:*
-> - Closest to a GDD — has Overview and Rules sections
-> - Missing: Player Fantasy, Formulas, Edge Cases, Tuning Knobs, Acceptance Criteria (5 of 8 sections)
->
-> **Phase 3: Gap Classification**
->
-> | Gap | Severity | Reason |
-> |-----|----------|--------|
-> | No systems index | BLOCKING | `/design-system`, `/create-stories`, `/gate-check` all require it |
-> | GDD files not in template format | HIGH | Skills cannot reference TR-IDs from malformed GDDs |
-> | No architecture docs | HIGH | Cannot run `/architecture-review` or `/create-control-manifest` |
-> | No production tracking | MEDIUM | Sprint and story skills won't work, but not needed until production phase |
-> | `design/crafting-ideas.md` — pre-GDD content | LOW | Useful as input; needs full GDD authoring before it blocks anything |
-
-## Turn 3: Agent Presents the Migration Plan
-
-**Agent:**
-> **Phase 4: Migration Plan**
->
-> 7 ordered steps to bring your project into full alignment. NEVER overwrites your existing content — each step fills gaps only.
->
-> | # | Step | Skill | Priority | Notes |
-> |---|------|-------|----------|-------|
-> | 1 | Create `design/gdd/systems-index.md` | `/map-systems` or `/adopt` inline | BLOCKING | Unblocks all downstream skills |
-> | 2 | Retrofit `design/inventory.md` → GDD format | `/design-system retrofit design/inventory.md` | HIGH | Adds 5 missing sections, keeps your existing content |
-> | 3 | Retrofit `design/combat-notes.md` → GDD format | `/design-system retrofit design/combat-notes.md` | HIGH | Adds 6 missing sections |
-> | 4 | Convert `design/crafting-ideas.md` → full GDD | `/design-system crafting` (new authoring, uses ideas as input) | MEDIUM | Not a retrofit — too informal to retrofit |
-> | 5 | Create architecture ADRs from existing code | `/reverse-document` + `/architecture-decision` | HIGH | Captures decisions already made in code |
-> | 6 | Create master architecture document | `/create-architecture` | HIGH | After ADRs |
-> | 7 | Set up production tracking | `/sprint-plan new` | MEDIUM | After architecture phase |
->
-> **Important:** Step 1 must happen before any other step. Everything else can be done in parallel or reordered based on your priorities.
->
-> May I write this plan to `docs/adoption-plan-2026-03-12.md`?
-
-**User:**
-> Yes. Write it.
-
-**Agent writes adoption plan.**
-
-## Turn 4: Agent Offers to Fix the Most Urgent Gap
-
-**Agent:**
-> The BLOCKING gap is the missing `design/gdd/systems-index.md`.
->
-> I can create one now by reading your existing code and design docs to infer what systems you've built. This is faster than running `/map-systems` from scratch — I'll populate it based on what already exists, then you confirm or adjust.
->
-> Would you like me to do that now?
-
-**User:**
-> Yes, do it.
-
-## Turn 5: Agent Reads Codebase and Drafts Systems Index
-
-**Agent:**
-> Reading `src/gameplay/` to infer systems...
->
-> Found these system boundaries in the code:
->
-> - `src/gameplay/combat/` — damage calculation, hit detection, status effects
-> - `src/gameplay/inventory/` — item management, weight, stacks
-> - `src/gameplay/crafting/` — recipe lookup, result generation (references inventory)
-> - `src/gameplay/movement/` — CharacterBody2D, terrain modifiers (referenced by combat for positioning)
-> - `src/gameplay/ui/` — HUD, inventory screen, dialogue box
-> - `src/gameplay/world/` — tile map, terrain types, chunk loading
->
-> **Draft systems index:**
->
-> | System | Category | Priority | Dependencies | GDD Status |
-> |--------|----------|----------|--------------|------------|
-> | Movement | Foundation | MVP | None | ❌ Missing |
-> | World/Terrain | Foundation | MVP | Movement | ❌ Missing |
-> | Combat | Core | MVP | Movement | ⚠️ Needs retrofit |
-> | Inventory | Core | MVP | None | ⚠️ Needs retrofit |
-> | Crafting | Feature | MVP | Inventory | ❌ Pre-GDD only |
-> | UI / HUD | Presentation | MVP | Combat, Inventory, Movement | ❌ Missing |
->
-> Does this look right? Anything I missed or miscategorized?
-
-**User:**
-> Looks right. Add a Stamina system — it's in combat/ but should be its own system.
-
-**Agent:**
-> Added Stamina as a Core / MVP system:
->
-> | Stamina | Core | MVP | Movement, Combat | ❌ Missing |
->
-> Updated dependency: Movement depends on Stamina (movement drains it).
->
-> May I write this to `design/gdd/systems-index.md`?
-
-## Turn 6: User Approves
-
-**User:**
-> Yes
-
-**Agent writes `design/gdd/systems-index.md`.**
-
-## Turn 7: Agent Shows What's Now Unlocked
-
-**Agent:**
-> `design/gdd/systems-index.md` created.
->
-> **BLOCKING gap resolved.** The following skills can now run:
->
-> - ✅ `/design-system [name]` — guided GDD authoring for any system
-> - ✅ `/design-system retrofit [path]` — fill missing sections in existing docs
-> - ✅ `/gate-check` — now has a systems index to validate
-> - ✅ `/help` — can now show correct phase workflow
->
-> **Recommended next steps (from adoption plan):**
->
-> 1. Run `/design-system retrofit design/inventory.md` — your most complete existing doc, easiest win
-> 2. Run `/design-system retrofit design/combat-notes.md`
-> 3. Run `/design-system crafting` — author crafting GDD using your ideas file as input
->
-> After those 3, you'll have 5 of 7 systems with complete GDDs. Then run `/review-all-gdds` to catch cross-system consistency issues before architecture work.
-
-## Turn 8: User Confirms Plan
-
-**User:**
-> Perfect. I'll start with the inventory retrofit.
-
-**Agent:**
-> Run:
-> ```
-> /design-system retrofit design/inventory.md
-> ```
->
-> The skill will detect your existing Overview and Rules sections, show you which of the 8 sections are missing, and run the section cycle only for the gaps. Your existing content won't be touched.
-
----
-
-## What This Example Demonstrates
-
-- **FORMAT audit, not existence audit**: `/adopt` doesn't just check whether files exist — it checks whether their internal structure matches what skills expect. A file named `gdd.md` with no template sections is flagged as a gap.
-- **Migration, not replacement**: existing content is never overwritten. The plan fills gaps only.
-- **BLOCKING gaps surface first**: the missing systems index is identified as BLOCKING because it prevents the most skills from functioning.
-- **Inline creation of the urgent gap**: rather than just reporting the gap, the agent offers to fix it immediately in the same session.
-- **Inferred from code**: the systems index is bootstrapped from the codebase structure, not written from scratch — brownfield code already contains the answer.
-- **Retrofit vs. new authoring**: `/design-system retrofit` handles existing-but-incomplete docs; full `/design-system` handles net-new docs. The adoption plan distinguishes which applies to each file.
-- **Context: fork**: `/adopt` runs in a forked context to avoid polluting the main session with large file reads across the whole codebase.
diff --git a/docs/examples/session-design-crafting-system.md b/docs/examples/session-design-crafting-system.md
deleted file mode 100644
index a68c10da..00000000
--- a/docs/examples/session-design-crafting-system.md
+++ /dev/null
@@ -1,262 +0,0 @@
-# Example Session: Designing the Crafting System
-
-**Context:** Solo indie dev, week 2 of project, needs to design the crafting system mentioned in the game pillars.
-
-**Starting State:**
-- Game concept and pillars defined
-- Engine set up (Godot 4.6)
-- Core combat system designed but not implemented yet
-- Pillar 2: "Emergent Discovery Through Experimentation"
-
-**Session Duration:** ~45 minutes
-**Turns:** 12
-**Outcome:** Complete crafting system GDD ready for implementation
-
----
-
-## Turn 1: User Initiates Design
-
-**User:**
-> I need to design the crafting system. Pillar 2 is "Emergent Discovery Through Experimentation", so I want players to discover recipes by trying combinations.
-
-## Turn 2: Agent Asks Clarifying Questions
-
-**Agent (game-designer):**
-> I'll help design the crafting system with discovery at its core. Before proposing mechanics, I need to understand your vision:
->
-> 1. **Discovery Method**: Should recipes be pure trial-and-error, or should there be hints/clues to guide players?
-> 2. **Failure Punishment**: When players try an invalid combination, what happens?
-> - Materials completely lost (harsh)
-> - Materials partially refunded (moderate)
-> - No cost to experiment (forgiving)
-> 3. **Progression**: Does crafting skill improve over time? If so, what does higher skill unlock?
-> 4. **Scope**: How central is crafting to the game? Core pillar feature or supporting system?
-> 5. **Reference Games**: Any crafting systems you love or hate? (Minecraft, Terraria, Stardew Valley, Potion Craft?)
-
-## Turn 3: User Provides Context
-
-**User:**
-> 1. I want hints that unlock gradually - start with pure discovery, earn hints through skill
-> 2. Moderate punishment - waste materials but gain partial XP
-> 3. Yes, skill unlocks hint system and improves success rates
-> 4. Core feature - one of the three main loops (combat, exploration, crafting)
-> 5. Love Potion Craft's deduction mechanic. Hate Minecraft wikis being mandatory.
-
-## Turn 4: Agent Presents Options
-
-**Agent:**
-> Perfect context! Based on "emergent discovery" + "deduction over wikis" + "Potion Craft inspiration", here are three mechanical approaches:
->
-> **Option A: Pure Randomized Discovery**
-> - **Mechanics**: Try any 2-4 ingredient combo, roll for success based on compatibility
-> - **Hint System**: None - players document discoveries manually
-> - **Pros**:
-> - Maximum emergent discovery
-> - Community can share findings without breaking core loop
-> - Aligns strongly with "experimentation" pillar
-> - **Cons**:
-> - High frustration for completionists
-> - Low skill expression (mostly RNG)
-> - Players may feel "wiki is required" despite your intent
-> - **Aligns with Pillars**: ✅✅ Emergent Discovery, ⚠️ Meaningful Choices (randomness reduces agency)
->
-> **Option B: Tag-Based Deduction System (Potion Craft-style)**
-> - **Mechanics**: Each ingredient has hidden "tags" (Fire, Water, Healing, Damage, etc.)
-> - Recipes require specific tag combinations
-> - At Skill 0: No tags visible, pure experimentation
-> - At Skill 5: Can inspect items to see 1 tag
-> - At Skill 10: See 2 tags, etc.
-> - **Hint System**: Tags ARE the hint system, unlocked by skill
-> - **Pros**:
-> - Rewards observation and pattern recognition (skill expression!)
-> - Progressive scaffolding - accessible to all player types
-> - Creates "aha!" moments when patterns click
-> - No wiki needed - everything discoverable in-game
-> - **Cons**:
-> - More complex to implement (tag system + UI)
-> - Requires careful tag design to avoid degeneracy
-> - **Aligns with Pillars**: ✅✅ Emergent Discovery, ✅✅ Meaningful Choices
->
-> **Option C: Ingredient Compatibility Matrix**
-> - **Mechanics**: Each ingredient pairs well/poorly with others
-> - Success rate = compatibility score
-> - Skill 0: No compatibility shown, ~30% base success
-> - Higher skill: See color-coded compatibility (red/yellow/green)
-> - **Hint System**: Visual compatibility indicators unlock with skill
-> - **Pros**:
-> - Simple to implement and understand
-> - Clear progression arc (skill = more information)
-> - Feels fair (players understand why they failed)
-> - **Cons**:
-> - Less emergent than tag system (more prescriptive)
-> - Optimal recipes more obvious once you have hints
-> - **Aligns with Pillars**: ✅ Emergent Discovery, ✅ Meaningful Choices
->
-> **My Recommendation: Option B (Tag-Based Deduction)**
->
-> **Reasoning:**
-> - It's the only option that creates TRUE emergent discovery through systems interaction
-> - Players develop mastery by learning tag patterns, not memorizing recipes
-> - The progressive reveal (tags unlock with skill) serves both Explorers (discovery) and Achievers (progression)
-> - Potion Craft proved this works and is satisfying
-> - Avoids wiki-dependency because the deduction is solvable in-game
->
-> Which option resonates with your vision? Or should I explore a hybrid?
-
-## Turn 5: User Decides with Modification
-
-**User:**
-> Option B feels perfect, but I want to add: failed attempts should give hints about which tags were WRONG, not just which were right. Like "You added Fire, but this recipe needs Water instead."
-
-## Turn 6: Agent Incorporates Feedback and Drafts
-
-**Agent:**
-> Excellent modification! That adds a deduction game on TOP of the tag discovery. Now failed attempts aren't just "waste" - they're valuable information.
->
-> Let me draft the **Overview** and **Player Fantasy** sections:
->
-> ---
->
-> ## Overview
->
-> The crafting system uses a tag-based deduction mechanic where players experiment with ingredient combinations to discover recipes. Each ingredient has 1-3 hidden tags (Fire, Water, Earth, Air, Healing, Damage, Poison, etc.). Recipes require specific tag combinations. Failed attempts waste materials but provide feedback ("This needs Water, not Fire") that teaches players tag patterns. As crafting skill increases, players unlock the ability to inspect ingredients to see their tags directly, transforming pure experimentation into informed deduction.
->
-> ## Player Fantasy
->
-> "I'm an alchemist-scientist discovering nature's hidden patterns. Each failed potion teaches me something new about how elements interact. Over time, I develop intuition - I can look at a mushroom and KNOW it contains Earth and Poison tags before even testing it. I don't need recipes from a wiki; I understand the RULES that generate recipes, and I can create my own solutions."
->
-> **Target MDA Aesthetics**:
-> - Discovery (primary): Uncovering hidden tag patterns
-> - Challenge (secondary): Deduction puzzle
-> - Expression (tertiary): Creating custom recipes once rules are mastered
->
-> ---
->
-> Does this capture your intent? Should I continue to **Detailed Rules**?
-
-## Turn 7: User Approves and Requests Next Section
-
-**User:**
-> Yes, that's perfect! Continue to Detailed Rules.
-
-## Turn 8: Agent Drafts Rules, Asks About Edge Case
-
-**Agent:**
-> Drafting Detailed Rules...
->
-> ---
->
-> ## Detailed Rules
->
-> ### Core Loop
-> 1. Player selects 2-4 ingredients from inventory
-> 2. Player activates crafting station
-> 3. System checks ingredient tags against recipe database
-> 4. **If exact tag match**: Success! Recipe learned, item created, full XP awarded
-> 5. **If partial match** (some tags correct): Failure. Feedback: "Close! This needs [missing tag]." Materials consumed, 40% XP awarded, recipe marked as "Discovered (Incomplete)"
-> 6. **If no match**: Failure. Feedback: "Incompatible. Try replacing [wrong tag] with [needed tag]." Materials consumed, 15% XP awarded
->
-> ### Tag System
-> - 12 core tags: Fire, Water, Earth, Air, Healing, Damage, Poison, Light, Dark, Metal, Plant, Magic
-> - Each ingredient has 1-3 tags (simple ingredients have 1, rare ingredients have 3)
-> - Each recipe requires 2-6 total tags (basic potions need 2, advanced need 6)
-> - Tag combinations must be unique (no two recipes with identical tag sets)
->
-> ### Skill Progression
-> - Skill 0-4: No inspection ability. Pure experimentation.
-> - Skill 5-9: Can inspect ingredients to see 1 tag
-> - Skill 10-14: Can see 2 tags per ingredient
-> - Skill 15+: Can see all tags per ingredient
->
-> ### XP Gain
-> ```
-> success_xp = base_xp * recipe_complexity^1.3
-> failure_xp_partial = success_xp * 0.40
-> failure_xp_none = success_xp * 0.15
-> ```
->
-> Where `recipe_complexity` = number of unique tags required (2-6)
->
-> ---
->
-> **Question before I continue:** What happens if a player discovers a tag combination that DOESN'T match any recipe in the database? Should we:
-> A) Allow it and create "junk items" (player wasted materials)
-> B) Always provide feedback steering toward valid recipes
-> C) Procedurally generate a minor potion for any valid tag combo not in the DB
->
-> This affects the "experimentation" feel - option A is harsh but realistic, option C rewards all experimentation.
-
-## Turn 9: User Resolves Edge Case
-
-**User:**
-> Option C - let's procedurally generate minor potions. If someone finds Fire+Water (not a designed recipe), give them "Warm Water" that restores 5 HP. Rewards experimentation even when "off the beaten path."
-
-## Turn 10: Agent Completes Remaining Sections
-
-**Agent:**
-> Perfect! That keeps experimentation always rewarding. Updating rules with that edge case...
->
-> [Agent continues drafting Formulas, Edge Cases, Dependencies, Tuning Knobs, and Acceptance Criteria sections, showing each and incorporating minor feedback]
->
-> [After all sections complete]
->
-> Complete crafting system GDD ready. Here's the summary:
->
-> **8 Required Sections:**
-> ✅ Overview - Tag-based deduction system
-> ✅ Player Fantasy - Alchemist-scientist discovering patterns
-> ✅ Detailed Rules - Core loop with tag matching and feedback system
-> ✅ Formulas - XP curves, success rates, skill thresholds
-> ✅ Edge Cases - Procedural minor potions for non-recipe combos, inventory full, skill at max
-> ✅ Dependencies - Requires inventory system, integrates with progression system
-> ✅ Tuning Knobs - XP rates, skill thresholds, tag count per ingredient, feedback verbosity
-> ✅ Acceptance Criteria - Players discover 10 recipes in 30 minutes without wiki, skill progression feels meaningful
->
-> **Delegations Made:**
-> - Consulted `systems-designer` for XP curve formula validation
-> - Consulted `economy-designer` for material cost balancing
->
-> May I write this to `design/gdd/crafting-system.md`?
-
-## Turn 11: User Approves Writing
-
-**User:**
-> Yes, write it!
-
-## Turn 12: Agent Writes File and Offers Next Steps
-
-**Agent:**
-> ✅ Created `design/gdd/crafting-system.md`
->
-> **Next Steps:**
-> 1. Run `/design-review design/gdd/crafting-system.md` to validate against 8-section standard
-> 2. Create data file structure in `assets/data/` for ingredients and recipes
-> 3. When ready to implement, use `/team-combat` pattern but for crafting (game-designer → gameplay-programmer → ui-programmer → qa-tester)
->
-> Would you like me to run the design review now, or would you prefer to read it first?
-
----
-
-## Session Summary
-
-**What Worked Well:**
-- Agent asked clarifying questions upfront instead of guessing
-- Presented 3 distinct options with clear pros/cons and pillar alignment
-- User's modification ("wrong tag feedback") was incorporated immediately
-- Edge case (non-recipe combos) was flagged proactively, not assumed
-- Each section was shown for approval before moving to next
-- Explicit permission requested before writing file
-
-**Key Collaborative Moments:**
-- Turn 2: Agent asked 5 questions to understand vision
-- Turn 4: Agent presented 3 options, made recommendation but deferred to user
-- Turn 5: User modified recommended option, agent incorporated it
-- Turn 8: Agent caught edge case and asked rather than assuming
-- Turn 9: User's choice (procedural potions) changed design direction
-- Turn 10: Agent requested approval before writing file
-
-**Files Created:**
-- `design/gdd/crafting-system.md` (complete 8-section GDD)
-
-**Context Usage:** ~35% (estimated)
-**User Satisfaction:** High - user made all creative decisions, agent provided expert guidance
diff --git a/docs/examples/session-design-system-skill.md b/docs/examples/session-design-system-skill.md
deleted file mode 100644
index 6bd1fb81..00000000
--- a/docs/examples/session-design-system-skill.md
+++ /dev/null
@@ -1,269 +0,0 @@
-# Example Session: Using /design-system to Author a GDD
-
-**Context:** Solo indie dev, week 3 of project. `/map-systems` already ran and produced `design/gdd/systems-index.md`. The movement system is listed as MVP tier, Foundation priority.
-
-**Starting State:**
-- `design/gdd/game-concept.md` exists (survival-crafting game, 2D, Godot 4.6)
-- `design/gdd/systems-index.md` exists (15 systems identified, movement is first in design order)
-- No per-system GDDs written yet
-- No upstream dependencies for movement (it is the foundation)
-
-**Session Duration:** ~60 minutes
-**Turns:** 14
-**Outcome:** Complete `design/gdd/movement-system.md` with all 8 required sections written to file, ready for `/design-review`
-
----
-
-## Turn 1: User Invokes the Skill
-
-**User:**
-> /design-system movement
-
-## Turn 2: Agent Loads Context and Presents the Plan
-
-**Agent (game-designer, via /design-system):**
-> I'm loading context before we start:
->
-> - Read `design/gdd/game-concept.md` — survival-crafting, exploration-heavy, lone survivor stranded on alien planet
-> - Read `design/gdd/systems-index.md` — movement is **Foundation / MVP**, no upstream deps, downstream: combat, exploration, stamina
-> - No prior GDD found for movement — starting fresh
->
-> **Technical Feasibility Pre-Check:**
->
-> | Domain | Signal |
-> |--------|--------|
-> | Engine | Godot 4.6 — CharacterBody2D with move_and_slide() is well-supported |
-> | Physics | Jolt is now the default in 4.6 — 2D movement unaffected, but note for future 3D work |
-> | Downstream risk | Stamina system listed as downstream dep — movement must expose a stamina callback hook |
->
-> The GDD template has **8 required sections**. We'll go one at a time:
-> `Overview → Player Fantasy → Detailed Rules → Formulas → Edge Cases → Dependencies → Tuning Knobs → Acceptance Criteria`
->
-> I'll show you a draft of each section, you approve or revise, then I write it to the file before we move on.
->
-> Creating the file skeleton now with empty section headers — may I write `design/gdd/movement-system.md` with placeholders?
-
-**User:**
-> Yes
-
-**Agent writes** `design/gdd/movement-system.md` with 8 empty section headers.
-
----
-
-## Turn 3: Section 1 — Overview
-
-**Agent:**
-> **Section 1 draft — Overview:**
->
-> > The movement system is the player's primary interface with the world. It governs how the lone survivor walks, runs, rolls, and traverses alien terrain. Movement is physically grounded — the planet has heavier-than-Earth gravity, and the survivor is physically exhausted — but remains responsive enough to stay out of the player's way. The system feeds directly into exploration pacing, combat positioning, and the stamina system.
->
-> Does this capture what you want?
-
-**User:**
-> Good but add something about the terrain — surfaces slow you down or have friction modifiers.
-
-**Agent:**
-> Revised:
->
-> > The movement system is the player's primary interface with the world. It governs how the lone survivor walks, runs, rolls, and traverses alien terrain. Movement is physically grounded — the planet has heavier-than-Earth gravity, and the survivor is physically exhausted — but remains responsive enough to stay out of the player's way. Terrain surfaces apply friction and speed modifiers (slick rock, sand, shallow water) that make navigation a meaningful skill. The system feeds directly into exploration pacing, combat positioning, and the stamina system.
->
-> May I write this to Section 1 in the file?
-
-**User:**
-> Yes
-
-**Agent writes Section 1 to file.**
-
----
-
-## Turn 4: Section 2 — Player Fantasy
-
-**Agent:**
-> **Section 2 draft — Player Fantasy:**
->
-> > The player should feel like a tired but capable survivor — not a superhero, not helpless. Early game movement is deliberate and taxing; the player earns fluency over time. When traversing alien terrain, the goal is careful navigation with moments of urgency (running from threats, leaping a gap). The fantasy is "I know this terrain" — every surface type becomes readable and manageable as the player internalizes the friction system.
->
-> Approve, revise, or change direction?
-
-**User:**
-> Love it. Write it.
-
-**Agent writes Section 2 to file.**
-
----
-
-## Turn 5: Section 3 — Detailed Rules
-
-**Agent:**
-> **Section 3 draft — Detailed Rules:**
->
-> > **Base States:**
-> > - **Walk** (default): Full directional control, moderate speed, low stamina drain
-> > - **Run** (hold Shift): Faster, medium stamina drain per second — cancels automatically when stamina hits 0
-> > - **Roll/Dodge** (tap Space): Quick burst in movement direction, brief invincibility frames, high stamina cost (flat)
-> > - **Idle**: Zero movement input, stamina regenerates at full rate
-> >
-> > **Terrain Modifiers:**
-> > - Normal ground: 1.0x speed multiplier, standard friction
-> > - Sand/loose soil: 0.8x speed, 1.1x stamina drain (harder to move)
-> > - Slick rock (wet): 1.1x speed, reduced stop friction (player overshoots)
-> > - Shallow water (ankle-deep): 0.7x speed, no friction modifier
-> > - Deep water: movement disabled, replaced by swimming (separate system, out of scope)
-> >
-> > **Collision:**
-> > - CharacterBody2D + move_and_slide(); wall slide enabled
-> > - Slopes up to 45° walked normally; >45° blocked
-> > - One-way platforms supported (drop-through with Down + Jump)
->
-> A lot here — want me to trim or expand anything?
-
-**User:**
-> Add that running is disabled when carrying a heavy object (like a large resource chunk).
-
-**Agent:**
-> Added to Run rule:
-> > - **Run** (hold Shift): Faster, medium stamina drain per second — cancels automatically when stamina hits 0. **Disabled when carrying heavy objects** (signals broadcast by inventory system).
->
-> Write to file?
-
-**User:**
-> Yes
-
-**Agent writes Section 3 to file.**
-
----
-
-## Turn 6: Section 4 — Formulas
-
-**Agent:**
-> **Section 4 draft — Formulas:**
->
-> Let me define variables first, then the formulas:
->
-> | Variable | Type | Description |
-> |----------|------|-------------|
-> | `base_walk_speed` | float | Base walk speed in px/s (tunable) |
-> | `run_multiplier` | float | Run speed = walk × this |
-> | `terrain_speed_mod` | float | Per-terrain multiplier (0.7–1.1) |
-> | `stamina_drain_walk` | float | Stamina units/sec while walking |
-> | `stamina_drain_run` | float | Stamina units/sec while running |
-> | `stamina_cost_roll` | float | Flat stamina cost per roll |
-> | `terrain_drain_mod` | float | Per-terrain stamina drain multiplier |
->
-> **Effective Speed:**
-> ```
-> effective_speed = base_walk_speed × run_multiplier (if running, else 1.0) × terrain_speed_mod
-> ```
->
-> **Stamina Drain (per second):**
-> ```
-> drain_per_sec = stamina_drain_walk (or stamina_drain_run if running) × terrain_drain_mod
-> ```
->
-> **Roll Stamina Cost (flat):**
-> ```
-> stamina_after_roll = current_stamina - stamina_cost_roll
-> (clamped to 0 — roll still executes, but player lands with 0 stamina)
-> ```
->
-> Approve or adjust variable names/formulas?
-
-**User:**
-> Looks right. Write it.
-
-**Agent writes Section 4 to file.**
-
----
-
-## Turn 7–9: Sections 5, 6, 7
-
-*(These follow the same pattern — agent drafts, user approves or requests minor tweaks, agent writes each section to file before moving on. Abbreviated here.)*
-
-**Section 5 — Edge Cases** covered:
-- Player rolls into a wall (animation completes, no movement bonus)
-- Stamina hits 0 mid-run (transitions to walk, no lurch)
-- Two terrain types overlapping (lower multiplier wins)
-- Roll on slick rock (still applies slick friction to stopping, not to the roll itself)
-
-**Section 6 — Dependencies** covered:
-- **Stamina system** (downstream): movement exposes `on_stamina_event(type: String, amount: float)` signal
-- **Inventory system** (downstream): listens to `carrying_heavy_object_changed(is_heavy: bool)` signal
-- **Input system**: movement direction from `InputMap` — standard Godot action names (`ui_left`, `ui_right`, etc.)
-- **Terrain layer**: tile metadata drives terrain modifier lookup
-
-**Section 7 — Tuning Knobs** covered:
-- `base_walk_speed` (default: 120 px/s)
-- `run_multiplier` (default: 1.7)
-- Per-terrain speed and drain modifiers (table of 4 terrain types)
-- `stamina_drain_walk`, `stamina_drain_run`, `stamina_cost_roll`
-
----
-
-## Turn 10: Section 8 — Acceptance Criteria
-
-**Agent:**
-> **Section 8 draft — Acceptance Criteria:**
->
-> These are the testable conditions that prove this system is complete:
->
-> - [ ] Player walks at `base_walk_speed` on normal ground (measured with debug overlay)
-> - [ ] Player runs at `base_walk_speed × run_multiplier` on normal ground
-> - [ ] Run automatically cancels when stamina reaches 0, no input required
-> - [ ] Roll executes with correct invincibility frames (verify via hitbox debug mode)
-> - [ ] Each terrain type applies the correct speed modifier (QA table in sprint plan)
-> - [ ] Carrying heavy object disables run (test with inventory integration)
-> - [ ] Stamina system receives `on_stamina_event` signals during walk, run, and roll
-> - [ ] All movement values come from exported variables — no hardcoded numbers in code
->
-> Does this cover what "done" means to you?
-
-**User:**
-> Add one for slopes — make sure >45 degree slopes block movement.
-
-**Agent:**
-> Added:
-> - [ ] Slopes ≤45° traversed normally; slopes >45° block movement (player slides back)
->
-> Write to file?
-
-**User:**
-> Yes. Write it.
-
-**Agent writes Section 8 to file.**
-
----
-
-## Turn 11: Completion Summary
-
-**Agent:**
-> All 8 sections written to `design/gdd/movement-system.md`.
->
-> **GDD Status:**
-> - ✅ Overview
-> - ✅ Player Fantasy
-> - ✅ Detailed Rules
-> - ✅ Formulas
-> - ✅ Edge Cases
-> - ✅ Dependencies (exposes 2 signals: stamina_event, carrying_heavy)
-> - ✅ Tuning Knobs
-> - ✅ Acceptance Criteria
->
-> **Key decisions made:**
-> - Terrain modifiers as tile metadata (not code constants)
-> - Rolling has a flat stamina cost (not per-second)
-> - Heavy carry disables run (signal-driven, not hardcoded check)
->
-> **Recommended next step:** Run `/design-review design/gdd/movement-system.md` before moving to the next system in your queue (stamina is next in dependency order, per systems-index).
->
-> The review will validate completeness, internal consistency, and catch anything that needs revision before you build on this GDD.
-
----
-
-## What This Example Demonstrates
-
-- **Incremental file writing**: each section written to disk immediately after approval — a session crash loses at most one in-progress section
-- **Template population**: the GDD template's 8 sections become concrete content through dialogue, not bulk generation
-- **Dependency signaling**: agent proactively surfaces downstream signal contracts (stamina, inventory) during the Dependencies section
-- **Technical feasibility pre-check**: agent notes Jolt physics change before design starts, not after implementation breaks
-- **Section-by-section cycle**: no full draft dumped at once — each section is a small, reviewable unit
-- **Recovery**: if the session crashes, the agent re-reads the file on restart and resumes from the first empty section
diff --git a/docs/examples/session-gate-check-phase-transition.md b/docs/examples/session-gate-check-phase-transition.md
deleted file mode 100644
index 6d77258f..00000000
--- a/docs/examples/session-gate-check-phase-transition.md
+++ /dev/null
@@ -1,152 +0,0 @@
-# Example Session: /gate-check Phase Transition — Systems Design → Technical Setup
-
-**Context:** Solo indie dev, end of week 5. The Systems Design phase feels complete — 6 MVP GDDs written, cross-review done, engine set up. User wants to formally advance to Technical Setup.
-
-**Starting State:**
-- `production/stage.txt` — currently `systems-design`
-- `design/gdd/systems-index.md` — 6 MVP systems listed, all marked `Status: GDD Complete`
-- `design/gdd/` — 6 GDD files present
-- `design/gdd/gdd-cross-review-2026-03-10.md` — cross-review report, verdict: CONCERNS (1 low-priority note)
-- Engine configured (Godot 4.6, `/setup-engine` complete)
-
-**Session Duration:** ~20 minutes
-**Turns:** 7
-**Outcome:** Gate passed, `stage.txt` updated to `technical-setup`, clear list of what comes next
-
----
-
-## Turn 1: User Initiates Gate Check
-
-**User:**
-> /gate-check
-
-## Turn 2: Agent Detects Current Phase and Runs the Check
-
-**Agent (via /gate-check):**
-> Reading `production/stage.txt` — current phase: **systems-design**
->
-> Running gate: **Systems Design → Technical Setup**
->
-> ---
-> **Required Artifacts Checklist:**
->
-> | Artifact | Requirement | Status |
-> |----------|-------------|--------|
-> | `design/gdd/systems-index.md` | Exists, all MVP systems listed | ✅ |
-> | Per-system GDDs | All MVP systems have a GDD | ✅ (6/6) |
-> | `/design-review` per GDD | Each GDD reviewed | ✅ (6/6 review comments found) |
-> | Cross-GDD review report | `design/gdd/gdd-cross-review-*.md` exists | ✅ |
-> | Cross-review verdict | PASS or CONCERNS (not FAIL) | ✅ CONCERNS |
-> | Engine configured | `production/stage.txt` or CLAUDE.md engine entry | ✅ Godot 4.6 |
->
-> ---
-> **Content Scan:**
->
-> Checking GDD completeness (8 required sections each)...
->
-> | GDD | Missing Sections |
-> |-----|-----------------|
-> | movement-system.md | None ✅ |
-> | stamina-system.md | None ✅ |
-> | combat-system.md | None ✅ |
-> | inventory-system.md | None ✅ |
-> | crafting-system.md | None ✅ |
-> | exploration-system.md | None ✅ |
->
-> ---
-> **Cross-Review Concerns (from `gdd-cross-review-2026-03-10.md`):**
->
-> 1. ⚠️ LOW — Crafting and inventory both define "item stack size" independently with different defaults (crafting: 99, inventory: 64). One system should be the authority; the other should reference it. Not blocking — can resolve in ADR.
->
-> ---
-> **Verdict: PASS**
->
-> All required artifacts present. Cross-review concern is LOW severity and can be resolved during Technical Setup via an ADR. This is a normal finding at this stage.
->
-> **May I advance `production/stage.txt` to `technical-setup`?**
-
-## Turn 3: User Confirms
-
-**User:**
-> Yes, advance it.
-
-## Turn 4: Agent Updates Stage and Presents Next Steps
-
-**Agent:**
-> Updated `production/stage.txt` → `technical-setup`
->
-> ---
-> **You are now in: Technical Setup**
->
-> This phase establishes the technical foundation before production coding starts. Your goal is a complete, approved architecture so that every story written in Pre-Production has clear, unambiguous technical guidance.
->
-> **Required steps this phase (in order):**
->
-> 1. **`/create-architecture`** — Author the master architecture document. Covers system decomposition, data flow, layer boundaries, and module responsibilities.
->
-> 2. **`/architecture-decision` (one per significant technical choice)** — At minimum:
-> - Rendering approach (2D camera, viewport, etc.)
-> - Save/load strategy
-> - Audio bus architecture
-> - The "item stack size authority" issue from cross-review (crafting vs inventory)
->
-> 3. **`/architecture-review`** — Validates all ADRs for completeness, dependency ordering, and GDD traceability. Produces the TR-registry.
->
-> 4. **`/create-control-manifest`** — Converts Accepted ADRs into a flat programmer rules sheet. This is what implementation agents will consult during coding.
->
-> 5. **`/gate-check`** — Technical Setup → Pre-Production gate. Requires: architecture doc, all ADRs Accepted, control manifest, and dependency ordering resolved.
->
-> **Optional but recommended:**
-> - `/tech-debt` scan if you have any prototype code you plan to carry forward
-> - `/setup-engine` re-run if you haven't yet fetched Godot 4.6 API snapshots
->
-> **Tip:** Start with `/architecture-decision` for the item stack size conflict. It's a quick win that closes an open question before it creates ambiguity in two ADRs later.
-
-## Turn 5: User Asks About the Cross-Review Concern
-
-**User:**
-> What do I actually write in the ADR for the stack size conflict?
-
-## Turn 6: Agent Advises
-
-**Agent:**
-> The ADR decision is: **which system owns the canonical `max_stack_size` value?**
->
-> Two options to consider:
->
-> **Option A: Inventory owns it**
-> - `ItemData` resource (owned by inventory) gets `max_stack_size: int = 64`
-> - Crafting system reads from `ItemData`, never sets its own value
-> - Pros: inventory is the source of truth for all item properties
-> - Cons: crafting team needs to know to look at inventory data
->
-> **Option B: Item data resource owns it (shared resource)**
-> - `ItemData.max_stack_size` is the authority for both systems
-> - Both crafting and inventory import from `ItemData`
-> - Pros: single source, no coupling between crafting and inventory modules
-> - Cons: one more thing in the shared data layer
->
-> Most studios go with B (shared resource) once they have >2 systems touching item data. But either is valid for a solo project.
->
-> Run `/architecture-decision` and it will guide you through the ADR format, including the Dependencies section that links this ADR back to the two GDDs.
-
-## Turn 7: User Wraps Up
-
-**User:**
-> Got it. I'll start with /architecture-decision for this.
-
-**Agent:**
-> Good starting point. The ADR will document the decision, the reasoning, and the GDD requirements it addresses — so when you write code months from now, the rationale is preserved.
->
-> Your phase gate is logged. Run `/help` at any time during Technical Setup to see your current progress against the required checklist.
-
----
-
-## What This Example Demonstrates
-
-- **Gate check is automated, not manual**: agent reads artifacts and checks them — user doesn't fill out a form
-- **CONCERNS ≠ FAIL**: the cross-review concern is LOW severity and passes the gate. A FAIL would require resolution before advancing.
-- **Stage.txt is the authority**: the status line, `/help`, and all skills read from `production/stage.txt` — updating it here changes what every subsequent skill sees
-- **Next steps are phase-specific**: the agent doesn't give a generic "good luck" — it gives the ordered checklist for Technical Setup specifically
-- **Gate check surfaces carry-forward work**: the stack size conflict was a cross-review note; the gate check ensures it becomes a concrete ADR rather than getting lost
-- **One advance per gate**: the user confirmed advancement explicitly. The gate doesn't auto-advance; human confirmation is required.
diff --git a/docs/examples/session-implement-combat-damage.md b/docs/examples/session-implement-combat-damage.md
deleted file mode 100644
index 27c86652..00000000
--- a/docs/examples/session-implement-combat-damage.md
+++ /dev/null
@@ -1,296 +0,0 @@
-# Example Session: Implementing Combat Damage Calculation
-
-**Context:** Solo indie dev, week 4 of project, implementing gameplay systems.
-
-**Starting State:**
-- `design/gdd/combat-system.md` exists and reviewed
-- Godot 4.6 project set up with basic scene structure
-- No gameplay code written yet
-- Sprint goal: "Implement core combat damage calculation"
-
-**Session Duration:** ~30 minutes
-**Turns:** 10
-**Outcome:** Working damage calculator with tests, ready for integration
-
----
-
-## Turn 1: User Requests Implementation
-
-**User:**
-> Implement the damage calculation system from design/gdd/combat-system.md. The formula is in section 4.
-
-## Turn 2: Agent Reads Design and Asks Clarifying Questions
-
-**Agent (gameplay-programmer):**
-> I've read `design/gdd/combat-system.md`. The damage formula is:
->
-> ```
-> final_damage = base_damage * (1 + attack_stat * 0.1) * crit_multiplier * type_effectiveness * (1 - target_defense)
-> ```
->
-> Before implementing, I need to clarify some details that aren't specified in the doc:
->
-> **Architecture Questions:**
-> 1. Should `DamageCalculator` be a static utility class (no state, just calculations) or an autoload singleton?
-> 2. Where should `base_damage` come from? (Weapon data? Character stats? Ability data?)
-> 3. Where should `type_effectiveness` values live? (Per weapon? Per damage type? Separate data file?)
->
-> **Spec Ambiguities:**
-> 4. Should `attack_stat` be clamped to a range? (Prevents exponential scaling bugs)
-> 5. The doc says "critical hits do 2x damage" but doesn't specify rounding. Should I `floor()`, `ceil()`, or `round()` the final damage?
-> 6. What happens if `target_defense` >= 1.0? (100% mitigation or higher) Should damage go negative or clamp to 0?
->
-> **Integration:**
-> 7. I don't see a design doc for the Health/HP system. Should I create a minimal one, or is that coming separately?
->
-> Please clarify so I can implement this correctly the first time.
-
-## Turn 3: User Resolves Ambiguities
-
-**User:**
-> 1. Static utility - no state needed
-> 2. Base damage from Weapon resource. I'll create a simple Weapon class.
-> 3. Type effectiveness in a separate data file `assets/data/combat_damage.json`
-> 4. Yes, clamp attack_stat to 0-100
-> 5. Use `floor()` to round down to integers
-> 6. Clamp damage to minimum of 1 (always do at least 1 damage, even with 100% defense)
-> 7. Create a minimal health component - just current_hp, max_hp, and take_damage() method
-
-## Turn 4: Agent Proposes Architecture
-
-**Agent:**
-> Got it! Here's my proposed architecture:
->
-> **Files I'll create:**
-> ```
-> src/gameplay/combat/damage_calculator.gd # Static damage formula
-> src/gameplay/combat/health_component.gd # HP tracking node component
-> src/gameplay/combat/weapon.gd # Weapon resource
-> assets/data/combat_damage.json # Type effectiveness values
-> design/gdd/health-system.md # Minimal health doc
-> tests/combat/test_damage_calculator.gd # Unit tests
-> ```
->
-> **Architecture Details:**
->
-> **DamageCalculator** (static class):
-> ```gdscript
-> class_name DamageCalculator
-> extends RefCounted
->
-> static func calculate_damage(
-> attacker_stats: Dictionary,
-> weapon: Weapon,
-> defender_stats: Dictionary,
-> is_crit: bool = false
-> ) -> int:
-> # Implementation here
-> return floori(final_damage)
-> ```
->
-> **HealthComponent** (node component):
-> ```gdscript
-> extends Node
-> class_name HealthComponent
->
-> signal health_changed(old_hp: int, new_hp: int)
-> signal died()
->
-> @export var max_hp: int = 100
-> var current_hp: int:
-> set(value):
-> # Clamp and emit signals
->
-> func take_damage(amount: int) -> void:
-> current_hp -= amount
-> if current_hp <= 0:
-> died.emit()
-> ```
->
-> **Weapon** (resource):
-> ```gdscript
-> extends Resource
-> class_name Weapon
->
-> @export var base_damage: float
-> @export var damage_type: String # "physical", "fire", "ice", etc.
-> ```
->
-> **combat_damage.json**:
-> ```json
-> {
-> "crit_multiplier": 2.0,
-> "attack_stat_min": 0,
-> "attack_stat_max": 100,
-> "type_effectiveness": {
-> "physical": { "armored": 0.5, "flesh": 1.0, "crystal": 1.5 },
-> "fire": { "armored": 1.0, "flesh": 1.2, "crystal": 0.3 }
-> }
-> }
-> ```
->
-> **Question:** This architecture makes `DamageCalculator` easily testable (pure function, no dependencies). The `HealthComponent` uses signals for VFX/SFX hookup. Does this match your expectations, or should I change anything before implementing?
-
-## Turn 5: User Approves with Minor Change
-
-**User:**
-> Looks good, but change `attacker_stats` and `defender_stats` to proper typed dictionaries or classes. I don't want untyped Dictionary bags floating around.
-
-## Turn 6: Agent Refines Architecture
-
-**Agent:**
-> Absolutely - type safety is important. I'll create a `CharacterStats` resource:
->
-> ```gdscript
-> extends Resource
-> class_name CharacterStats
->
-> @export var attack_stat: int = 0 # 0-100
-> @export var defense: float = 0.0 # 0.0-1.0 (0-100% mitigation)
-> @export var armor_type: String = "flesh" # for type effectiveness lookup
-> ```
->
-> Then `DamageCalculator.calculate_damage()` signature becomes:
-> ```gdscript
-> static func calculate_damage(
-> attacker: CharacterStats,
-> weapon: Weapon,
-> defender: CharacterStats,
-> is_crit: bool = false
-> ) -> int
-> ```
->
-> Much cleaner. May I proceed with implementation?
-
-## Turn 7: User Approves Implementation
-
-**User:**
-> Yes, implement it.
-
-## Turn 8: Agent Implements and Reports
-
-**Agent:**
-> Implementation complete! Here's what I created:
->
-> **Files Created:**
-> - ✅ `src/gameplay/combat/damage_calculator.gd` (82 lines)
-> - ✅ `src/gameplay/combat/health_component.gd` (45 lines)
-> - ✅ `src/gameplay/combat/weapon.gd` (12 lines)
-> - ✅ `src/gameplay/combat/character_stats.gd` (16 lines)
-> - ✅ `assets/data/combat_damage.json` (validated JSON)
-> - ✅ `design/gdd/health-system.md` (minimal 8-section doc)
->
-> **Rules Enforcement Results:**
->
-> The `gameplay-code` rule automatically flagged 2 issues during implementation:
-> 1. ❌ `crit_multiplier` was hardcoded as `2.0` in damage_calculator.gd
-> - **Fixed:** Moved to `combat_damage.json` and loaded from config
-> 2. ❌ `HealthComponent` had direct `print()` debug output
-> - **Fixed:** Removed hardcoded debug, added proper signals instead
->
-> The `data-files` rule validated:
-> - ✅ `combat_damage.json` is valid JSON
-> - ✅ Naming convention matches `[system]_[name].json`
-> - ✅ All values have comment documentation
->
-> **Implementation Notes:**
-> - Attack stat is clamped in `calculate_damage()` before use
-> - Damage always returns minimum of 1 (per your requirement)
-> - Type effectiveness defaults to 1.0 if combo not found in config
-> - All numeric values loaded from `combat_damage.json` for designer tuning
->
-> **Manual Testing:**
-> I created a quick test scene and validated:
-> - Base damage: 10, attack_stat: 50 → Damage: 15 ✓
-> - Same but with crit → Damage: 30 ✓
-> - With 50% defense → Damage: 15 (before defense) → 7 (after) ✓
-> - With 100% defense → Damage: 1 (clamped) ✓
->
-> **Next Steps - Your Choice:**
-> A) I can write formal unit tests now (recommended - verification-driven development)
-> B) You can review the code first via `/code-review src/gameplay/combat/damage_calculator.gd`
-> C) Skip tests for now and integrate into actual combat
->
-> What would you like?
-
-## Turn 9: User Requests Tests
-
-**User:**
-> A - write unit tests. Cover all the edge cases.
-
-## Turn 10: Agent Writes Tests and Completes
-
-**Agent:**
-> Unit tests created: `tests/combat/test_damage_calculator.gd`
->
-> **Test Coverage (8 tests):**
-> ```
-> ✓ test_damage_basic_calculation() - Verify formula with known values
-> ✓ test_damage_with_crit() - Critical hits double damage
-> ✓ test_damage_with_defense() - Defense reduces damage correctly
-> ✓ test_damage_type_effectiveness() - Type modifiers apply
-> ✓ test_damage_min_clamp() - Never goes below 1
-> ✓ test_damage_attack_stat_clamp() - Attack stat clamped to 0-100
-> ✓ test_damage_missing_type_combo() - Defaults to 1.0 if not in config
-> ✓ test_damage_rounding() - Verifies floor() behavior
-> ```
->
-> **Test Results:**
-> ```
-> Running tests/combat/test_damage_calculator.gd...
-> ✓ All 8 tests PASSED
-> Execution time: 12ms
-> ```
->
-> **Code Review Self-Check:**
-> - ✅ All tests follow `test_[system]_[scenario]_[expected]` naming
-> - ✅ Arrange/Act/Assert structure used
-> - ✅ No external state dependencies
-> - ✅ Each test is independent and can run in any order
->
-> **System is ready for integration!**
->
-> Files you can now commit:
-> ```bash
-> git add src/gameplay/combat/*.gd
-> git add assets/data/combat_damage.json
-> git add design/gdd/health-system.md
-> git add tests/combat/test_damage_calculator.gd
-> git commit -m "Implement damage calculation system per design/gdd/combat-system.md"
-> ```
->
-> The `validate-commit` hook will check:
-> - ✅ Design doc referenced in message
-> - ✅ JSON validity
-> - ✅ No hardcoded values (already fixed)
->
-> Ready to commit?
-
----
-
-## Session Summary
-
-**What Worked Well:**
-- Agent read design doc first, identified 7 ambiguities upfront
-- Didn't assume or guess - asked for clarification on every unclear point
-- Proposed full architecture for user approval before writing code
-- Incorporated user's type safety feedback immediately
-- Rules caught issues automatically and agent fixed them transparently
-- Tests written proactively following verification-driven development
-- Agent offered next-step options rather than assuming what user wants
-
-**Key Collaborative Moments:**
-- Turn 2: Agent identified 7 spec gaps and asked rather than guessing
-- Turn 4: Full architecture proposal shown before implementation
-- Turn 5: User requested type safety, agent adapted
-- Turn 8: Agent transparently reported rule violations and fixes
-- Turn 10: Agent verified all acceptance criteria with tests
-
-**Files Created:**
-- 4 source files (damage_calculator, health_component, weapon, character_stats)
-- 1 config file (combat_damage.json)
-- 1 design doc (health-system.md)
-- 1 test file (test_damage_calculator.gd)
-
-**Context Usage:** ~25% (focused implementation task)
-**User Satisfaction:** High - spec ambiguities resolved early, no rework needed
diff --git a/docs/examples/session-scope-crisis-decision.md b/docs/examples/session-scope-crisis-decision.md
deleted file mode 100644
index 435f0d11..00000000
--- a/docs/examples/session-scope-crisis-decision.md
+++ /dev/null
@@ -1,360 +0,0 @@
-# Example Session: Scope Crisis - Strategic Decision Making
-
-**Context:** Solo indie dev, week 8 of project (month 2), approaching Alpha milestone.
-
-**Crisis:**
-- Alpha milestone is in 2 weeks
-- Crafting system (Pillar 2) not yet implemented
-- Lead programmer says full crafting will take 3 weeks
-- Investor demo at Alpha - must show all pillars
-
-**Session Duration:** ~25 minutes
-**Turns:** 8
-**Outcome:** Strategic scope decision with documented ADR
-
----
-
-## Turn 1: User Escalates Problem to Creative Director
-
-**User:**
-> We have a problem. Alpha is in 2 weeks. The crafting system (Pillar 2 "Emergent Discovery") isn't implemented yet. Lead programmer says it'll take 3 weeks to implement fully. But the investor demo is at Alpha and they need to see both pillars (Combat + Crafting). What should I do?
-
-## Turn 2: Creative Director Gathers Full Context
-
-**Agent (creative-director):**
-> This is a classic pillar vs. schedule conflict - exactly what I'm here to help resolve. Let me gather the full context before recommending options.
->
-> First, let me review the relevant documents:
-> - `production/milestones/alpha.md` (milestone definition)
-> - `design/pillars.md` (what's non-negotiable)
-> - `design/gdd/crafting-system.md` (what was designed)
-> - `production/sprints/sprint-current.md` (current work)
->
-> [Reads documents]
->
-> **Context Understood:**
-> - Pillar 2: "Emergent Discovery Through Experimentation" (crafting is primary expression)
-> - Alpha success criteria: "All pillars demonstrated in playable form"
-> - Investor demo purpose: Validate vision and secure next funding round
-> - Current crafting design: Tag-based deduction system with 12 tags, ~50 recipes, progressive hint unlocking
->
-> **Clarifying Questions:**
-> 1. Is the Alpha date **hard** (investor won't reschedule) or **soft** (we could ask for 1 more week)?
-> 2. What's the **minimum crafting** that still demonstrates Pillar 2? (One recipe? Ten recipes? Full tag system?)
-> 3. What **breaks** if crafting is cut entirely from Alpha? (Does the game still make sense?)
-> 4. How **critical** is this investor relationship? (Nice-to-have funding vs. make-or-break for project survival?)
-> 5. What's the **team status**? (Burned out from crunch? Fresh and could push if needed?)
-
-## Turn 3: User Provides Decision Context
-
-**User:**
-> 1. Hard date - investor flying in specifically for demo, can't reschedule
-> 2. I think minimum is: discovery mechanic working (tag system) + 10 recipes. Doesn't need polish.
-> 3. Without crafting, Alpha only shows combat. That's 50% of the vision - investor might think it's just another combat game
-> 4. Make-or-break. This investor is our only lead. No funding = project dies.
-> 5. Just me solo, I'm not burned out yet.
-
-## Turn 4: Creative Director Frames the Decision
-
-**Agent:**
-> Thank you. Now I understand what's truly at stake. Let me frame this decision properly:
->
-> **The Core Question:**
-> Do we deliver full crafting and slip Alpha, deliver simplified crafting and make Alpha, or cut crafting and risk the investor not seeing our full vision?
->
-> **What's Really at Stake:**
-> - **Vision Integrity**: Can investor see Pillar 2 at all?
-> - **Schedule Trust**: Do we keep our commitment to Alpha date?
-> - **Project Survival**: No funding = no game
-> - **Quality Standards**: Is "rough but working" acceptable for this demo?
->
-> **Decision Criteria (in priority order for this scenario):**
-> 1. **Investor Confidence** (highest - project survival depends on this)
-> 2. **Pillar Representation** (high - they need to see the full vision)
-> 3. **Schedule Integrity** (medium - matters, but less than funding)
-> 4. **Polish Quality** (lowest - vertical slice can be rough)
->
-> Now let me present three strategic options...
-
-## Turn 5: Creative Director Presents Options with Analysis
-
-**Agent:**
-> **Option A: Implement Full Crafting System (3 weeks, slip Alpha by 1 week)**
->
-> **Execution:**
-> - Implement complete tag-based system with all 50 recipes
-> - Full UI polish, all features from GDD
-> - Miss Alpha date, reschedule investor demo (+1 week)
->
-> **Pros:**
-> - ✅ Pillar 2 fully represented with production quality
-> - ✅ No design compromises
-> - ✅ First impression is polished
->
-> **Cons:**
-> - ❌ Breaks investor commitment (they're flying in for the original date)
-> - ❌ Signals schedule management issues ("if they slipped Alpha, will they slip release?")
-> - ❌ May damage investor trust more than rough demo would
->
-> **Risk: CRITICAL**
-> - Investor may not reschedule (busy schedule, other opportunities)
-> - Even if they do, the slip damages credibility
-> - Unlikely to succeed given hard date constraint
->
-> **Verdict: NOT RECOMMENDED** - The date is hard and non-negotiable
->
-> ---
->
-> **Option B: Simplify Crafting to Core Pillar (1.5 weeks, make Alpha)**
->
-> **Execution:**
-> - Implement core tag discovery mechanic ONLY
-> - 10 recipes instead of 50 (enough to demonstrate the system)
-> - Basic UI (functional, not polished)
-> - No progressive hint unlock (all tags visible at Skill 0 for demo clarity)
-> - No failed-attempt feedback system (just success/fail)
->
-> **Scope: "Vertical Slice of Pillar 2"**
-> - Players CAN discover recipes by combining tagged ingredients
-> - Players CAN learn tag patterns and deduce new recipes
-> - The SOUL of Pillar 2 is present, just unpolished
->
-> **Pros:**
-> - ✅ Makes Alpha deadline (schedule integrity maintained)
-> - ✅ Pillar 2 demonstrated (investor sees full vision)
-> - ✅ Core mechanic is playable and provable
-> - ✅ Can use "Alpha → Beta improvement" as narrative ("here's rough, here's polished")
->
-> **Cons:**
-> - ⚠️ First impression is "rough" (but vertical slices are expected to be rough)
-> - ⚠️ Investor might think "this feels small" (mitigation: present roadmap showing post-Alpha expansion)
->
-> **Risk: MEDIUM**
-> - Investor might not "get" the pillar from 10 recipes (mitigation: good demo script explaining the vision)
-> - Might feel incomplete (mitigation: frame as "vertical slice proving the concept")
->
-> **Verdict: RECOMMENDED** - Balances all constraints
->
-> ---
->
-> **Option C: Cut Crafting from Alpha, Focus on Combat Polish (0 weeks, make Alpha)**
->
-> **Execution:**
-> - Deliver Alpha with only Pillar 1 (Combat) fully polished
-> - Use extra 2 weeks to super-polish combat, add content, make it shine
-> - Present crafting as "design doc + concept art" (not playable)
->
-> **Pros:**
-> - ✅ Makes deadline with zero stress
-> - ✅ What's there is AAA-polished
-> - ✅ No risk of "half-baked" perception
->
-> **Cons:**
-> - ❌ Pillar 2 not demonstrated (50% of vision missing)
-> - ❌ Investor sees "another combat game" - not differentiated
-> - ❌ Harder to secure funding for "potential" vs. "proven concept"
-> - ❌ If combat alone doesn't wow them, we have no fallback
->
-> **Risk: HIGH**
-> - Investor won't see what makes this game special
-> - They might think "Combat is fine, but where's the hook?"
-> - Competing games have combat - we need to show our differentiator
->
-> **Verdict: NOT RECOMMENDED** - Too risky for make-or-break demo
->
-> ---
->
-> ## My Recommendation: Option B (Simplified Crafting Core)
->
-> **Reasoning:**
-> 1. **Investor Confidence**: Making the date we committed to shows reliability
-> 2. **Pillar Visibility**: Rough but working > polished but missing. Investors back VISION, not polish.
-> 3. **Demo Narrative**: "Here's Alpha vs. Beta progression" is compelling - shows trajectory
-> 4. **Risk Mitigation**: If crafting doesn't land, combat is still solid. If we cut crafting (Option C) and combat doesn't wow them alone, we have nothing.
-> 5. **Historical Precedent**: Hades, Dead Cells, Slay the Spire all showed rough Early Access verticals and investors loved the SYSTEMS over polish
->
-> **What Option B Sacrifices:**
-> - Polish (acceptable for vertical slice)
-> - Feature completeness (50 recipes → 10)
-> - Progressive unlocks (deferred to post-Alpha)
->
-> **What Option B Protects:**
-> - Schedule trust
-> - Pillar representation
-> - Vision clarity
-> - Project survival (funding secured)
->
-> **Implementation Plan if you choose Option B:**
-> 1. I'll create an ADR documenting this scope decision
-> 2. I'll update `design/gdd/crafting-system.md` with "Alpha Scope" markers
-> 3. I'll brief gameplay-programmer on simplified implementation
-> 4. I'll create a demo script for you: how to PRESENT the 10-recipe system to show the 50-recipe vision
->
-> **But this is your call.** You know this investor better than I do. If you believe they'll value polish over pillar representation, Option C might be right. If you think they'll forgive a 1-week slip, Option A is safest creatively.
->
-> What's your decision?
-
-## Turn 6: User Makes Decision
-
-**User:**
-> Option B. The investor is technical and will appreciate the systems thinking even if it's rough. Let's simplify the crafting scope to make Alpha. Can you create the ADR and update the GDD?
-
-## Turn 7: Creative Director Documents Decision
-
-**Agent:**
-> Excellent decision. I'll document this thoroughly so future-you understands why we made this choice.
->
-> **Creating:**
-> 1. ADR-007: Alpha Crafting Scope Reduction
-> 2. Updated design/gdd/crafting-system.md with Alpha/Beta scope markers
-> 3. Updated production/milestones/alpha.md success criteria
-> 4. Demo script guidance for investor presentation
->
-> [Creates documents]
->
-> **ADR Summary:**
-> ```markdown
-> ## Decision
-> Simplify crafting system to core tag discovery mechanic (10 recipes)
-> for Alpha milestone. Defer full implementation (50 recipes + progressive
-> unlocks) to post-Alpha.
->
-> ## Context
-> - Alpha in 2 weeks (hard date, investor demo)
-> - Full crafting requires 3 weeks
-> - Investor demo is make-or-break for funding
->
-> ## Consequences
-> Positive:
-> - Makes Alpha deadline, preserves investor trust
-> - Both pillars demonstrated (rough but playable)
-> - Can show Alpha→Beta improvement narrative
->
-> Negative:
-> - First impression is "rough"
-> - Limited recipe variety
-> - Missing progressive unlock system
->
-> ## Validation Criteria
-> We'll know this was the right choice if:
-> - Investor demo successfully shows both pillars
-> - Funding secured for next development phase
-> - Post-Alpha sprint can implement full system without rework
-> ```
->
-> **Updated GDD Markers:**
-> ```markdown
-> ## Detailed Rules
->
-> ### Core Loop (**ALPHA SCOPE**)
-> [Core mechanic description]
->
-> ### Progressive Unlocks (**POST-ALPHA**)
-> [Skill-based hint system - deferred]
->
-> ### Recipe Catalog
-> - Alpha: 10 recipes (demonstrates tag variety)
-> - Beta: 50 recipes (full content)
-> ```
->
-> **Demo Script Guidance:**
-> ```markdown
-> ## Presenting Crafting to Investor (10-recipe Alpha)
->
-> **Frame it as proof-of-concept:**
-> "This is a vertical slice of the crafting pillar. You'll see 10 recipes
-> here, but the SYSTEM supports unlimited recipes through tag combinations.
-> Watch how players deduce patterns..."
->
-> **Show, don't tell:**
-> - Live demo: Discover 2 recipes on the fly
-> - Explain: "Notice Fire+Water made Steam Potion. Now the player knows
-> Fire+Water is valid. They can deduce that Fire+Earth might work..."
-> - Connect to pillar: "This is Emergent Discovery - the game teaches rules,
-> players become scientists."
->
-> **Roadmap slide:**
-> "Alpha: 10 recipes (proof of concept)
-> Beta: 50 recipes (content expansion)
-> Release: 100+ recipes (includes community-designed recipes)"
->
-> **Emphasize systems:**
-> "We're not making a content game, we're making a systems game. The tag
-> system can generate endless combinations. We're building a platform for
-> discovery, not a recipe database."
-> ```
->
-> May I proceed to write these documents?
-
-## Turn 8: User Approves and Agent Completes
-
-**User:**
-> Yes, create all those documents and also notify the gameplay-programmer about the scope change.
-
-**Agent:**
-> ✅ Complete! Created/Updated:
-> - `docs/architecture/adr-007-alpha-crafting-scope.md`
-> - `design/gdd/crafting-system.md` (added Alpha/Beta scope markers)
-> - `production/milestones/alpha.md` (updated success criteria)
-> - `production/demo-script-investor-alpha.md` (new file with presentation guide)
->
-> **Notifications Sent:**
->
-> To `gameplay-programmer`:
-> > "Crafting scope simplified for Alpha: Core tag mechanic + 10 recipes only.
-> > Progressive unlocks and full recipe set deferred to post-Alpha. Updated
-> > GDD has implementation guidance. Estimated 1.5 weeks to implement Alpha scope."
->
-> To `producer`:
-> > "Strategic decision made: Simplified crafting to make Alpha deadline.
-> > ADR-007 documents rationale. Sprint plan needs updating to reflect new scope."
->
-> **Next Steps:**
-> 1. Gameplay-programmer can start implementing simplified crafting
-> 2. You can practice demo script before investor meeting
-> 3. Producer will update sprint plan with new task breakdown
->
-> **Validation:**
-> We'll know this decision was correct when:
-> - Alpha ships on time with both pillars playable
-> - Investor demo successfully communicates the vision
-> - Funding secured for continued development
->
-> Good luck with the demo! This was the right call - vision over polish for this audience.
-
----
-
-## Session Summary
-
-**What Worked Well:**
-- Creative director read context docs before proposing solutions
-- Asked 5 clarifying questions to understand constraints
-- Framed decision properly (what's at stake, evaluation criteria)
-- Presented 3 distinct options with honest pros/cons
-- Made clear recommendation with reasoning, but deferred to user
-- Documented decision thoroughly with ADR and updated all affected docs
-- Provided demo script to help user present the decision positively
-
-**Key Collaborative Moments:**
-- Turn 2: Agent gathered full context before jumping to solutions
-- Turn 3: User provided decision criteria priority (funding > schedule > polish)
-- Turn 5: Agent presented 3 options, made recommendation, but explicitly "this is your call"
-- Turn 6: User made strategic decision
-- Turn 7: Agent provided demo script to support user's presentation
-- Turn 8: Agent cascaded decision to affected parties
-
-**Strategic Decision Quality:**
-- User made the final call
-- Agent provided expert analysis using game dev theory and precedent
-- Trade-offs were explicit and honest
-- Decision was documented for future reference
-- Success criteria defined for validation
-
-**Files Created/Updated:**
-- ADR-007 (decision record)
-- Updated crafting GDD with scope markers
-- Updated Alpha milestone definition
-- Demo script for investor presentation
-
-**Context Usage:** ~30%
-**User Satisfaction:** High - confident decision made with full information
diff --git a/docs/examples/session-story-lifecycle.md b/docs/examples/session-story-lifecycle.md
deleted file mode 100644
index 0df3df51..00000000
--- a/docs/examples/session-story-lifecycle.md
+++ /dev/null
@@ -1,245 +0,0 @@
-# Example Session: Full Story Lifecycle — /story-readiness → Implement → /story-done
-
-**Context:** Solo indie dev, mid-production sprint. The movement system GDD and architecture are complete. A story for movement's core implementation has been generated by `/create-stories`.
-
-**Starting State:**
-- `design/gdd/movement-system.md` — complete, all 8 sections
-- `docs/architecture/movement-adr-001.md` — Status: Accepted
-- `production/sprints/sprint-03.md` — lists STORY-MOV-001 in backlog
-- `production/stories/STORY-MOV-001.md` — exists but not yet validated
-- No implementation code yet
-
-**Session Duration:** ~50 minutes
-**Turns:** 13
-**Outcome:** Story validated ready, implemented, verified complete with `/story-done`
-
----
-
-## Phase 1: Story Readiness Check
-
-### Turn 1: User Runs Readiness Check
-
-**User:**
-> /story-readiness production/stories/STORY-MOV-001.md
-
-### Turn 2: Agent Validates the Story
-
-**Agent (via /story-readiness):**
-> Reading `production/stories/STORY-MOV-001.md`...
->
-> **STORY-MOV-001: Implement CharacterBody2D movement with terrain modifiers**
->
-> Running 4 validation checks:
->
-> **1. Design Completeness**
-> - GDD referenced: `design/gdd/movement-system.md` ✅
-> - GDD section coverage: Detailed Rules ✅, Formulas ✅, Edge Cases ✅
-> - TR-IDs embedded: TR-MOV-001 through TR-MOV-008 ✅
->
-> **2. Architecture Completeness**
-> - ADR referenced: `docs/architecture/movement-adr-001.md` ✅
-> - ADR status: **Accepted** ✅ *(Would be BLOCKED if Proposed)*
-> - Control manifest version in story: `2026-03-10` — current manifest is `2026-03-10` ✅
->
-> **3. Scope Clarity**
-> - Acceptance criteria: 9 items, all measurable ✅
-> - Out-of-scope items listed: swimming, climbing ✅
-> - Ambiguities found: **1**
-> - ⚠️ Story says "roll direction follows last input direction" but GDD says "roll in movement direction" — these conflict when player stops and immediately rolls. Clarify before pickup.
->
-> **4. Definition of Done**
-> - Tests required: unit tests for formula functions ✅
-> - Integration signal: `on_stamina_event` must fire correctly ✅
->
-> ---
-> **Verdict: NEEDS WORK**
->
-> One ambiguity must be resolved before implementation starts. Would you like to resolve it now so I can mark the story as ready?
-
-### Turn 3: User Resolves the Ambiguity
-
-**User:**
-> Roll uses last movement direction. If player is standing still, roll uses facing direction instead.
-
-### Turn 4: Agent Updates the Story
-
-**Agent:**
-> Updating the story's Detailed Rules section:
->
-> > Roll direction: last movement direction. If velocity is zero at roll input, roll uses current facing direction.
->
-> May I write this to `production/stories/STORY-MOV-001.md` and set Status to `ready-for-dev`?
-
-**User:**
-> Yes
-
-**Agent writes update. Story status: `ready-for-dev`.**
-
-> **Verdict: READY**
-> Story is implementation-ready. Pick it up when you're ready to build.
-
----
-
-## Phase 2: Implementation
-
-### Turn 5: User Starts Implementation
-
-**User:**
-> Let's implement STORY-MOV-001. I'm ready to start coding.
-
-### Turn 6: Agent Reads Story and ADR
-
-**Agent (gameplay-programmer):**
-> Reading `production/stories/STORY-MOV-001.md`, `design/gdd/movement-system.md`, and `docs/architecture/movement-adr-001.md`...
->
-> **Architecture (from ADR-001):**
-> - `MovementComponent.gd` — attached to player scene, not a singleton
-> - Terrain modifier lookup via `TerrainLayer.get_modifier(tile_position)` helper
-> - Stamina events via signal (not direct call to StaminaSystem)
->
-> **My proposed file structure:**
-> ```
-> src/gameplay/movement/
-> movement_component.gd # CharacterBody2D logic, state machine
-> terrain_modifier_table.gd # Const table: terrain_type -> {speed_mod, drain_mod}
-> tests/unit/
-> test_movement_formulas.gd # Unit tests for speed/drain calculations
-> ```
->
-> May I proceed with this structure?
-
-**User:**
-> Yes
-
-### Turn 7: Agent Implements and Shows Key Code
-
-**Agent:**
-> Implementing `movement_component.gd`. Key excerpt for your review before I write the file:
->
-> ```gdscript
-> class_name MovementComponent
-> extends Node
->
-> signal stamina_event(type: String, amount: float)
->
-> @export var base_walk_speed: float = 120.0
-> @export var run_multiplier: float = 1.7
-> @export var stamina_drain_walk: float = 2.0
-> @export var stamina_drain_run: float = 6.0
-> @export var stamina_cost_roll: float = 15.0
->
-> var _is_carrying_heavy: bool = false
->
-> func _physics_process(delta: float) -> void:
-> var terrain_mod := _get_terrain_modifier()
-> var effective_speed := _calculate_speed(terrain_mod)
-> # ...
-> ```
->
-> All values are `@export` — none hardcoded. Is this the direction you want?
-
-**User:**
-> Looks good. Write it.
-
-### Turn 8–9: Agent Writes Files and Tests
-
-**Agent writes:**
-- `src/gameplay/movement/movement_component.gd`
-- `src/gameplay/movement/terrain_modifier_table.gd`
-- `tests/unit/test_movement_formulas.gd`
-
-**Agent:**
-> Files written. Running available linting checks...
->
-> No errors. Tests file created with 6 unit tests covering:
-> - Walk speed formula (3 terrain types)
-> - Run speed formula
-> - Stamina drain calculation
-> - Roll stamina cost (with and without zero-velocity edge case)
->
-> Manual testing needed for: invincibility frames, slope blocking, terrain integration (requires running scene).
-
----
-
-## Phase 3: Story Completion
-
-### Turn 10: User Tests Manually and Runs /story-done
-
-**User:**
-> I've tested it in the scene — everything works. /story-done production/stories/STORY-MOV-001.md
-
-### Turn 11: Agent Runs Completion Review
-
-**Agent (via /story-done):**
-> Reading story, GDD, ADRs...
->
-> **Phase 1: Story Located** ✅ `production/stories/STORY-MOV-001.md`
->
-> **Phase 2: Acceptance Criteria Verification**
->
-> | # | Criterion | Verification | Status |
-> |---|-----------|--------------|--------|
-> | 1 | Walk speed correct on normal ground | Auto: formula unit tests pass | ✅ AUTO |
-> | 2 | Run speed correct | Auto: formula unit tests pass | ✅ AUTO |
-> | 3 | Run cancels at stamina 0 | Manual: user confirmed | ✅ MANUAL |
-> | 4 | Roll invincibility frames work | Manual: user confirmed | ✅ MANUAL |
-> | 5 | Terrain modifiers apply correctly | Manual: user confirmed | ✅ MANUAL |
-> | 6 | Heavy carry disables run | Auto: not yet testable (inventory not integrated) | ⏳ DEFERRED |
-> | 7 | Stamina signals fire correctly | Auto: integration test pending | ⏳ DEFERRED |
-> | 8 | No hardcoded values | Auto: grep for magic numbers → 0 found | ✅ AUTO |
-> | 9 | Slopes >45° block movement | Manual: user confirmed | ✅ MANUAL |
->
-> **Phase 3: GDD/ADR Deviations**
->
-> Scanning implementation against TR-IDs...
->
-> - TR-MOV-001 through TR-MOV-007: ✅ Implemented as specified
-> - TR-MOV-008 (heavy carry signal): ⚠️ ADVISORY — deferred to inventory integration story. Not a deviation, just unverifiable now.
->
-> **Phase 4: Manifest Staleness Check**
->
-> Story control manifest version `2026-03-10` matches current manifest `2026-03-10`. ✅
->
-> **Phase 5: Code Review Prompt**
->
-> Suggest running `/code-review src/gameplay/movement/` before marking complete. Not blocking.
->
-> ---
-> **Completion Report: COMPLETE WITH NOTES**
->
-> Story is complete. Two criteria deferred to inventory integration — log as deferred, not blocked.
->
-> May I update the story status to `Status: Complete` and add Completion Notes, and update `production/sprint-status.yaml`?
-
-**User:**
-> Yes
-
-### Turn 12: Agent Closes the Story
-
-**Agent writes:**
-- Story `Status: Complete` + Completion Notes (deferred criteria noted)
-- `production/sprint-status.yaml` — STORY-MOV-001 set to `done`
-
-**Agent:**
-> STORY-MOV-001 closed.
->
-> **Deferred criteria logged** (will auto-surface in inventory integration story):
-> - Heavy carry disables run (requires inventory signal)
-> - Stamina signal integration test (requires stamina system)
->
-> **Next ready story from sprint:**
-> - STORY-MOV-002: Stamina system — this is the logical next story (downstream dep now unblocked)
-> - STORY-HUD-001: Movement HUD indicators — also unblocked
->
-> Run `/story-readiness` on whichever you pick up next.
-
----
-
-## What This Example Demonstrates
-
-- **Readiness gate catches real issues**: the roll direction ambiguity would have caused a late implementation decision without `/story-readiness`
-- **ADR status is a hard gate**: if `movement-adr-001.md` had been `Proposed` instead of `Accepted`, story would be `BLOCKED` and implementation wouldn't start
-- **Deferred criteria**: not every acceptance criterion can be verified at story close — `/story-done` tracks deferred items rather than blocking completion
-- **TR-ID references**: story stores `TR-MOV-001` IDs, not quoted GDD text — avoids false deviation flags when GDD wording is cleaned up later
-- **sprint-status.yaml**: single source of truth for sprint state, updated by `/story-done` and read by `/sprint-status`
-- **Manifest version check**: ensures story's implementation guidance hasn't drifted from current architecture decisions
diff --git a/docs/examples/session-ux-pipeline.md b/docs/examples/session-ux-pipeline.md
deleted file mode 100644
index 05a0e9a1..00000000
--- a/docs/examples/session-ux-pipeline.md
+++ /dev/null
@@ -1,210 +0,0 @@
-# Example Session: UX Pipeline — /ux-design → /ux-review → /team-ui
-
-**Context:** Solo indie dev, Pre-Production phase. The HUD and inventory screen are the first UI to design. The game has a player journey doc and GDDs for inventory and combat.
-
-**Starting State:**
-- `design/gdd/inventory-system.md` — complete
-- `design/gdd/combat-system.md` — complete
-- `design/player-journey.md` — complete (6-phase arc defined)
-- No UX specs yet
-- `design/ux/` directory does not exist
-
-**Session Duration:** ~90 minutes across two sessions (HUD design, then inventory screen)
-**Turns:** 16
-**Outcome:** `design/ux/hud.md` and `design/ux/screens/inventory.md` created and reviewed; team-ui handed off for visual implementation
-
----
-
-## Part 1: HUD Design with /ux-design
-
-### Turn 1: User Starts HUD Design
-
-**User:**
-> /ux-design hud
-
-### Turn 2: Agent Loads Context and Presents the Approach
-
-**Agent (ux-designer, via /ux-design):**
-> Starting HUD design. Loading context...
->
-> - `design/player-journey.md` read — key states: Calm Exploration, Tension (threat detected), Crisis (low HP/stamina), Combat
-> - `design/gdd/combat-system.md` — HUD needs: HP bar, stamina bar, active ability cooldowns (up to 3), damage numbers
-> - `design/gdd/inventory-system.md` — HUD needs: quick slots (4 slots), active item indicator
->
-> **HUD Philosophy question:** What is the player's primary attention focus during play?
->
-> This determines how aggressive the HUD should be:
-> - **Option A: Diegetic (low presence)** — HP shown only when damaged, stamina shown only when draining. World-first, HUD recedes unless urgent.
-> - **Option B: Persistent minimal** — HP and stamina always visible, small and unobtrusive. Quick reference without mode-switching.
-> - **Option C: Full tactical** — All info always visible (HP, stamina, cooldowns, map, inventory slots). Player always has full awareness.
->
-> Given your survival game and "lone survivor" fantasy, A or B is most consistent with the genre.
-
-**User:**
-> B — I want it always there but minimal. The player is always managing resources.
-
-### Turn 3: Agent Drafts HUD Philosophy Section
-
-**Agent:**
-> **HUD Philosophy draft:**
->
-> > **Approach: Persistent Minimal**
-> > The HUD is always visible but occupies minimal screen real estate. The player is a resource-managing survivor — denying HP/stamina visibility creates frustration, not tension. All critical stats are readable at a glance without interrupting exploration focus. Elements scale in visual weight when they become urgent (HP below 30% pulses, stamina at 0 flashes), then return to minimal state.
->
-> May I write this to `design/ux/hud.md` as the Philosophy section?
-
-**User:**
-> Yes
-
-**Agent creates `design/ux/hud.md` and writes Philosophy section.**
-
-*(Turns 4–7 continue the section-by-section HUD authoring: Info Architecture, Zones, Element Specs, State Machine, Visual Budget, Platform Adaptation — each drafted, approved, and written to file.)*
-
----
-
-**Final HUD structure after all sections:**
-
-```
-design/ux/hud.md
- - Philosophy: Persistent Minimal
- - Info Architecture: HP (top-left), Stamina (top-left below HP), Quick Slots (bottom-center),
- Ability Cooldowns (bottom-right), Damage Numbers (world-space)
- - Zones: 4 defined (top-left vitals, bottom-center interaction, bottom-right abilities, world-space)
- - Element Specs: 6 elements with dimensions, font sizes, opacity rules
- - State Machine: Calm / Tension / Crisis / Combat (4 states, transition triggers)
- - Visual Budget: Max 8% screen coverage, 3 simultaneous animations
- - Platform Adaptation: Controller (aim reticle added), Mobile (out of scope v1)
-```
-
----
-
-## Part 2: Inventory Screen with /ux-design
-
-### Turn 8: User Starts Inventory Screen
-
-**User:**
-> /ux-design screen inventory
-
-### Turn 9: Agent Scans GDD and Player Journey
-
-**Agent:**
-> Loading context for inventory screen...
->
-> From `design/gdd/inventory-system.md`:
-> - Grid inventory, 6×8 slots
-> - Items have weight (affects movement) and stack size
-> - Player can equip, drop, inspect, split stacks
->
-> From `design/player-journey.md`:
-> - Inventory opens frequently during Calm Exploration
-> - Players should feel "organized and in control" when opening inventory
-> - Anxiety moment: "I need to decide what to drop" — should be clear, not panicked
->
-> **Player Need (from journey):** *I need to quickly assess what I'm carrying, decide what to keep or drop, and get back into the world.*
->
-> **Key design question:** How do players navigate to inventory actions?
-> - **Option A: Right-click context menu** — hover item → right-click → menu appears (Escape/common)
-> - **Option B: Drag-based** — drag to drop zone to drop; drag to equipment slot to equip (Stardew Valley)
-> - **Option C: Inspect panel** — click item → details panel appears on right with action buttons
-
-**User:**
-> B — drag-based. I want it tactile.
-
-*(Turns 10–12 continue section-by-section for the inventory screen spec: Player Need, Layout Zones, States, Interaction Map, Data Requirements, Events Fired, Accessibility, Localization.)*
-
----
-
-## Part 3: /ux-review
-
-### Turn 13: User Runs Review
-
-**User:**
-> /ux-review design/ux/
-
-### Turn 14: Agent Reviews Both Documents
-
-**Agent (via /ux-review):**
-> Reviewing all UX specs in `design/ux/`...
->
-> ---
-> **HUD Review (`hud.md`):**
->
-> | Check | Status | Notes |
-> |-------|--------|-------|
-> | GDD alignment — all required elements present | ✅ | HP, stamina, quick slots, cooldowns all specced |
-> | State machine coverage | ✅ | All 4 gameplay states covered |
-> | Accessibility tier | ⚠️ | No colorblind mode specified for HP/stamina bars (red/yellow convention) |
-> | Visual budget | ✅ | 8% screen coverage, within budget |
-> | Platform notes | ✅ | Controller variant documented |
->
-> **Inventory Screen Review (`screens/inventory.md`):**
->
-> | Check | Status | Notes |
-> |-------|--------|-------|
-> | Player Need stated | ✅ | |
-> | All GDD actions covered | ✅ | Equip, drop, inspect, split all in interaction map |
-> | Drag-drop interaction fully specified | ⚠️ | Drop target behavior when inventory is full not defined — what happens? |
-> | Accessibility: keyboard alternative for drag | ❌ | MISSING — drag-only with no keyboard path fails motor accessibility |
-> | Localization: all strings tagged | ✅ | |
-> | Data events fired | ✅ | `item_equipped`, `item_dropped`, `stack_split` all mapped |
->
-> ---
-> **Verdict: NEEDS REVISION**
->
-> Two issues must be resolved before handoff to /team-ui:
->
-> 1. **BLOCKING (Accessibility):** Inventory screen has no keyboard alternative to drag-drop. Motor accessibility requires a non-drag interaction path. Add a "press X to pick up / press X again to place" toggle, or a details panel with keyboard-accessible action buttons.
->
-> 2. **ADVISORY (HUD):** HP/stamina bars use color alone to convey state. Add a secondary indicator (shape, icon, or pattern) for colorblind users. Can be resolved in visual pass.
-> 3. **ADVISORY (Inventory):** Full-inventory drop behavior is unspecified. Resolve in GDD before implementation, or document as out-of-scope.
-
-### Turn 15: User Resolves Blocking Issue
-
-**User:**
-> For keyboard: press F to pick up item at cursor, press F again on target slot to place it. Add this to the inventory spec.
-
-**Agent:**
-> Adding to Interaction Map under "Keyboard / Controller Path":
->
-> > Press F (or South button) to pick up item at cursor. Item enters "held" state with visual indicator. Press F again on target slot to place. Press Escape to cancel and return item.
->
-> May I write this to `design/ux/screens/inventory.md` and re-run the accessibility check?
-
-**User:**
-> Yes
-
-**Agent writes update. Re-checks accessibility — now passes.**
-
----
-
-## Part 4: Handoff to /team-ui
-
-### Turn 16: User Kicks Off Team UI
-
-**User:**
-> /team-ui
-
-**Agent (via /team-ui):**
-> Running UX pipeline context check...
->
-> - `design/ux/hud.md` — reviewed ✅
-> - `design/ux/screens/inventory.md` — reviewed ✅
-> - `/ux-review` verdict: NEEDS REVISION was resolved — current state: APPROVED ✅
->
-> Proceeding to **Phase 2: Visual Design**
->
-> Handing off to `art-director` for visual spec (color palette, typography, iconography aligned to art bible)...
->
-> *(team-ui continues through visual design → layout implementation → accessibility audit → final review)*
-
----
-
-## What This Example Demonstrates
-
-- **Context-driven design**: agent reads player-journey.md to ground HUD decisions in player emotional state, not just feature lists
-- **UX review is a hard gate**: `/team-ui` checks for a passing `/ux-review` before proceeding to visual design
-- **Accessibility caught early**: the missing keyboard alternative was flagged by review, not discovered by a QA tester in the final week
-- **Blocking vs. advisory**: the missing keyboard path was BLOCKING (stops handoff); the colorblind colors were ADVISORY (can be fixed in visual pass)
-- **Section-by-section UX authoring**: same incremental pattern as `/design-system` — each section written to file before moving on
-- **Separate HUD and screen files**: `design/ux/hud.md` is the whole-game HUD; per-screen specs live in `design/ux/screens/`
-- **Pattern library enforced by /team-ui**: after this session, inventory drag-drop becomes a documented pattern in `design/ux/interaction-patterns.md` for all future screens to reference
diff --git a/docs/migration-guide-v1.1.md b/docs/migration-guide-v1.1.md
new file mode 100644
index 00000000..cc1100af
--- /dev/null
+++ b/docs/migration-guide-v1.1.md
@@ -0,0 +1,135 @@
+# Migration Guide: v1.0 → v1.1 project.yaml
+
+This guide covers converting an **existing project's config files** to
+`project.yaml`. It is distinct from the template-diff instructions in
+[UPGRADING.md](../UPGRADING.md) — that file tells you which *skill and agent
+files* changed between releases and whether they're safe to overwrite. This
+guide covers your *project's own data*: the values you configured in
+`production/stage.txt`, `production/review-mode.txt`, and
+`.claude/docs/technical-preferences.md`.
+
+If you're setting up a **brand-new** project on v1.1, you don't need this —
+`/start` writes `project.yaml` directly and none of the legacy files apply.
+
+---
+
+## Do you need to migrate?
+
+You have a v1.0 project needing migration if `project.yaml` does **not**
+exist at your repo root, and at least one of these does:
+
+- `production/stage.txt`
+- `production/review-mode.txt`
+- `.claude/docs/technical-preferences.md` with real values (a copy still
+ full of `[TO BE CONFIGURED]` placeholders is the untouched template
+ default, not migratable data, and doesn't count)
+
+Run `/adopt` and it will detect this automatically (Phase 2g) and walk you
+through the steps below. You can also run the converter directly.
+
+---
+
+## What gets preserved
+
+| From | To (`project.yaml`) |
+|---|---|
+| `production/stage.txt` | `project.stage` |
+| `production/review-mode.txt` | `modes.review_mode` |
+| `technical-preferences.md` → Engine & Language | `engine.name`, `engine.version`, `engine.language`, `engine.rendering`, `engine.physics` |
+| `technical-preferences.md` → Input & Platform | `platform.targets`, `platform.primary_input`, `platform.gamepad_support`, `platform.touch_support` |
+| `technical-preferences.md` → Naming Conventions | `naming.classes`, `naming.variables`, `naming.constants`, `naming.signals`, `naming.files`, `naming.scenes` |
+| `technical-preferences.md` → Performance Budgets | `performance.target_framerate`, `performance.frame_budget_ms`, `performance.draw_call_limit`, `performance.memory_ceiling_mb` |
+| `technical-preferences.md` → Testing | `testing.framework`, `qa.coverage_minimum` |
+| `technical-preferences.md` → Engine Specialists | `specialists.code`, `specialists.shader`, `specialists.ui`, `specialists.additional` |
+
+Settings that don't exist in v1.0 at all (`modes.rigor`, `qa.level`,
+`docs.density`, `team.size`, `modes.story_granularity`, and the rest of the
+v1.1 modes system) get their hardcoded v1.1 defaults — there's nothing to
+preserve for them.
+
+**One value was renamed:** v1.0's `review-mode.txt: none` ("no director
+reviews") becomes `modes.review_mode: solo` in v1.1, which is the same tier
+under its new name. The converter maps it and calls it out in the migration
+report's Warnings, so you'll see the rename rather than have it happen silently.
+
+**Not migrated, on purpose:** `technical-preferences.md`'s Forbidden Patterns
+and Allowed Libraries sections have no `project.yaml` equivalent. The
+converter never deletes this file for that reason — see "Finalizing," below.
+
+---
+
+## Running the migration
+
+The conversion is a tested script, not something the AI hand-edits — the
+v1.1 plan rated data loss during migration as its highest-severity risk, and
+prose migration can't be unit-tested the way a script can. `/adopt` drives
+it for you, or you can run it yourself:
+
+```bash
+# 1. Preview — writes nothing, just reports what it would do
+bash .claude/scripts/migrate-v1-config.sh --dry-run
+
+# 2. Migrate — writes project.yaml + production/migration-report.md
+# Every legacy file is left in place, untouched.
+bash .claude/scripts/migrate-v1-config.sh
+
+# 3. Read the report before finalizing
+cat production/migration-report.md
+
+# 4. Finalize — deletes legacy files, ONLY after re-verifying each one's
+# value made it into project.yaml. Refuses (exit 4) and deletes nothing
+# on any mismatch.
+bash .claude/scripts/migrate-v1-config.sh --finalize
+```
+
+Step 4 is optional and separate on purpose. Skipping it is completely fine —
+every skill and hook falls back to the legacy files for any key
+`project.yaml` doesn't have, so the two can coexist indefinitely. Run it when
+you're confident `project.yaml` is correct and want one config file instead
+of three.
+
+**`technical-preferences.md` is never deleted**, even with `--finalize` —
+Forbidden Patterns and Allowed Libraries still live there and always will,
+since v1.1 has no equivalent structure for them yet.
+
+### Reading `production/migration-report.md`
+
+The report has five sections:
+
+- **Source files detected** — which legacy files the converter found
+- **Values preserved** — per source file, per setting, what was written to
+ `project.yaml`
+- **Defaults applied** — new v1.1 settings that had nothing to migrate from
+- **Warnings** — anything the converter couldn't parse cleanly (see below)
+- **Manual review** — content it found but declined to guess at (e.g. custom
+ sections in a forked `technical-preferences.md`)
+
+---
+
+## What can go wrong (and what the script does about it)
+
+| Situation | Behavior |
+|---|---|
+| A legacy file is malformed / unparsable | Warns per-file, leaves it alone, continues migrating everything else it *can* parse. `project.yaml` gets the values it could read plus defaults for the rest. |
+| A parsed value doesn't match a v1.1 enum (e.g. a custom fork's `stage: Alpha`) | Written as-is with a warning comment, flagged for manual resolution — the converter does not silently coerce or drop it. |
+| Both `project.yaml` **and** legacy files already exist | Refuses to run (exit code 3). Two sources of truth with no way to know which you last edited is not something the script will guess at — resolve it yourself first (decide which is authoritative, delete or rename the other). |
+| Custom sections in a forked `technical-preferences.md` | Logged to the migration report as "not migrated — integrate manually." Nothing is silently dropped. |
+
+If you hit the split-brain case (both present), that usually means you
+either ran `/start` on a project that also had old legacy files lying
+around, or partially migrated by hand. Pick the one with your real values,
+remove or back up the other, then re-run `--dry-run`.
+
+---
+
+## After migrating
+
+1. Spot-check `project.yaml` against your old `technical-preferences.md` —
+ engine, naming, and performance values in particular.
+2. Run `/settings` to see the effective config the way skills will read it.
+3. Everything else in the framework works identically whether or not you've
+ run `--finalize` — there's no rush.
+
+For the new settings that didn't exist in v1.0 (`modes.rigor` above all),
+see the [Configuration section of the README](../README.md#configuration)
+and the full spec in `.claude/docs/effects-map.md`.
diff --git a/docs/examples/skill-flow-diagrams.md b/docs/skill-flow-diagrams.md
similarity index 97%
rename from docs/examples/skill-flow-diagrams.md
rename to docs/skill-flow-diagrams.md
index c5a7062e..8ce0d368 100644
--- a/docs/examples/skill-flow-diagrams.md
+++ b/docs/skill-flow-diagrams.md
@@ -11,7 +11,7 @@ These show what runs before and after each skill, and what artifacts flow betwee
PHASE 1: CONCEPT
/start ──────────────────────────────────────────────────────► routes to A/B/C/D
/brainstorm ──────────────────────────────────────────────────► design/gdd/game-concept.md
- /setup-engine ────────────────────────────────────────────────► CLAUDE.md + technical-preferences.md
+ /setup-engine ────────────────────────────────────────────────► project.yaml + CLAUDE.md
/prototype [core-mechanic] ───────────────────────────────────► prototypes/[name]-concept/REPORT.md
│ PROCEED (validate idea BEFORE writing GDDs)
▼
@@ -260,11 +260,12 @@ How a story gets from backlog to closed (summary view):
│
├── Reads: story files, GDDs, acceptance criteria
├── Classifies each story by test type:
- │ Logic → automated unit test (BLOCKING)
- │ Integration → integration test or documented playtest (BLOCKING)
- │ Visual/Feel → screenshot + lead sign-off (ADVISORY)
- │ UI → manual walkthrough or interaction test (ADVISORY)
- │ Config/Data → smoke check (ADVISORY)
+ │ Logic → automated unit test (BLOCKING by default)
+ │ Integration → integration test or documented playtest (BLOCKING by default)
+ │ Visual/Feel → retained screenshot + lead sign-off (BLOCKING by default)
+ │ UI → retained screenshot of each screen (BLOCKING by default)
+ │ Config/Data → smoke check (ADVISORY by default)
+ │ (gate levels are overridable per type via testing.strict in project.yaml)
└── Output: production/qa/qa-plan-sprint-NN.md
│
▼
diff --git a/project.yaml b/project.yaml
new file mode 100644
index 00000000..0b3f4cde
--- /dev/null
+++ b/project.yaml
@@ -0,0 +1,26 @@
+# CCGS project configuration — single source of truth for project settings.
+# See .claude/docs/effects-map.md for full schema.
+
+schema_version: 1
+
+framework:
+ version: 1.1.0
+ last_upgraded: 2026-09-23
+
+# NOTE: this template ships with no `modes:` block, and the six knobs below must
+# never be added to one.
+#
+# `/start` DOES add `modes.rigor` and `modes.automation` here — that is its job,
+# and a `modes:` block containing those two is the expected state of a configured
+# project, not a mistake.
+#
+# What must stay absent is the six knobs `modes.rigor` FRONTS:
+# `modes.review_mode`, `modes.workflow`, `docs.density`, `qa.level`,
+# `modes.story_granularity` and `team.size`. Seeding any of them in this file
+# pins that value and shadows the rigor expansion, so `/start` asking "what are
+# you building?" would stop changing anything. `/start` Phase 3c documents the
+# same rule for the file it writes.
+#
+# Per-developer preferences belong in `project.local.yaml` (gitignored), not
+# here. `/settings <key>=<value>` writes there. See
+# `.claude/docs/config-resolution.md` for the full precedence order.
diff --git a/src/CLAUDE.md b/src/CLAUDE.md
index 0e87d3a9..8739a4fa 100644
--- a/src/CLAUDE.md
+++ b/src/CLAUDE.md
@@ -13,7 +13,9 @@ Do not guess at post-cutoff API signatures — look them up first.
- All public APIs require doc comments
- Gameplay values must be **data-driven** (external config files), never hardcoded
- Prefer dependency injection over singletons for testability
-- Every new system needs a corresponding ADR in `docs/architecture/`
+- Architecture decisions go in `docs/architecture/` as ADRs — **how many depends on
+ `modes.workflow`**: all at `full`, critical only at `standard`, none required at
+ `minimal` (the decision log carries them)
- Commits must reference the relevant story ID or design document
## File Routing