@zrg-sh/studio 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/LICENSE +21 -0
  2. package/ONBOARDING.html +270 -0
  3. package/README.md +82 -0
  4. package/bin/zrg-studio.mjs +67 -0
  5. package/package.json +29 -0
  6. package/src/commands/doctor.mjs +60 -0
  7. package/src/commands/init.mjs +44 -0
  8. package/src/lib/copy-template.mjs +42 -0
  9. package/src/lib/merge-claude-settings.mjs +54 -0
  10. package/template/.claude/agents/studio-analyst.md +109 -0
  11. package/template/.claude/agents/studio-designer.md +172 -0
  12. package/template/.claude/agents/studio-domain-framer.md +109 -0
  13. package/template/.claude/agents/studio-domain-merger.md +264 -0
  14. package/template/.claude/agents/studio-pm.md +169 -0
  15. package/template/.claude/agents/studio-reviewer.md +156 -0
  16. package/template/.claude/agents/studio-scenario-writer.md +152 -0
  17. package/template/.claude/commands/studio-analyst.md +45 -0
  18. package/template/.claude/commands/studio-designer.md +34 -0
  19. package/template/.claude/commands/studio-domain-framer.md +30 -0
  20. package/template/.claude/commands/studio-onboard.md +98 -0
  21. package/template/.claude/commands/studio-pm.md +39 -0
  22. package/template/.claude/commands/studio-scenario-writer.md +44 -0
  23. package/template/product-specs/CLAUDE.md +53 -0
  24. package/template/product-specs/agents/studio-analyst.md +109 -0
  25. package/template/product-specs/agents/studio-codebase-mapper.md +217 -0
  26. package/template/product-specs/agents/studio-conflict-resolver.md +169 -0
  27. package/template/product-specs/agents/studio-designer.md +172 -0
  28. package/template/product-specs/agents/studio-domain-extractor.md +365 -0
  29. package/template/product-specs/agents/studio-domain-framer.md +109 -0
  30. package/template/product-specs/agents/studio-domain-interviewer.md +246 -0
  31. package/template/product-specs/agents/studio-domain-merger.md +264 -0
  32. package/template/product-specs/agents/studio-god.md +779 -0
  33. package/template/product-specs/agents/studio-meta-god.md +335 -0
  34. package/template/product-specs/agents/studio-pm.md +169 -0
  35. package/template/product-specs/agents/studio-reviewer.md +156 -0
  36. package/template/product-specs/agents/studio-scenario-writer.md +152 -0
  37. package/template/product-specs/agents/studio-verifier.md +222 -0
  38. package/template/product-specs/docs/_meta/capability-map.example.md +103 -0
  39. package/template/product-specs/docs/_meta/doc-schema.md +134 -0
  40. package/template/product-specs/docs/_meta/domain-map.example.md +106 -0
  41. package/template/product-specs/docs/_meta/glossary.example.md +72 -0
  42. package/template/product-specs/docs/_meta/onboarding.example.md +142 -0
  43. package/template/product-specs/docs/_meta/product-vision.example.md +136 -0
  44. package/template/product-specs/hooks/studio-conflict-detect.sh +59 -0
  45. package/template/product-specs/hooks/studio-context-monitor.js +37 -0
  46. package/template/product-specs/hooks/studio-domain-guard.sh +40 -0
  47. package/template/product-specs/hooks/studio-prompt-guard.js +36 -0
  48. package/template/product-specs/hooks/studio-session-state.sh +55 -0
  49. package/template/product-specs/hooks/studio-stage-gate.sh +180 -0
  50. package/template/product-specs/references/checkpoints.md +27 -0
  51. package/template/product-specs/references/ddd-conventions.md +38 -0
  52. package/template/product-specs/references/gates.md +50 -0
  53. package/template/product-specs/references/model-profiles.md +28 -0
  54. package/template/product-specs/references/obsidian-conventions.md +51 -0
  55. package/template/product-specs/references/stage-pipeline.md +65 -0
  56. package/template/product-specs/rules/change-management.md +159 -0
  57. package/template/product-specs/rules/docs-conventions.md +81 -0
  58. package/template/product-specs/rules/domain-conventions.md +69 -0
  59. package/template/product-specs/rules/id-numbering.md +51 -0
  60. package/template/product-specs/rules/obsidian-conventions.md +51 -0
  61. package/template/product-specs/templates/change/01-intent.md +40 -0
  62. package/template/product-specs/templates/change/02-scenarios.md +66 -0
  63. package/template/product-specs/templates/change/03-analysis.md +64 -0
  64. package/template/product-specs/templates/change/04-domain.md +47 -0
  65. package/template/product-specs/templates/change/05-ux.md +46 -0
  66. package/template/product-specs/templates/change/metadata.yaml +26 -0
  67. package/template/product-specs/templates/config.json +19 -0
  68. package/template/product-specs/templates/domain/README.md +31 -0
  69. package/template/product-specs/templates/domain/aggregates.md +37 -0
  70. package/template/product-specs/templates/domain/api-contracts.md +29 -0
  71. package/template/product-specs/templates/domain/business-rules.md +30 -0
  72. package/template/product-specs/templates/domain/changelog.md +25 -0
  73. package/template/product-specs/templates/domain/data-model.md +34 -0
  74. package/template/product-specs/templates/domain/events.md +24 -0
  75. package/template/product-specs/templates/domain/integrations.md +27 -0
  76. package/template/product-specs/templates/domain/invariants.md +14 -0
  77. package/template/product-specs/templates/domain/links.yaml +20 -0
  78. package/template/product-specs/templates/domain/operational-sla.md +32 -0
  79. package/template/product-specs/templates/domain/ownership.md +13 -0
  80. package/template/product-specs/templates/domain/scenarios.md +65 -0
  81. package/template/product-specs/templates/domain/surfaces.md +51 -0
  82. package/template/product-specs/templates/domain/ubiquitous-language.md +12 -0
  83. package/template/product-specs/templates/meta/capability-map.md +55 -0
  84. package/template/product-specs/templates/meta/doc-schema.md +134 -0
  85. package/template/product-specs/templates/meta/domain-map.md +67 -0
  86. package/template/product-specs/templates/meta/glossary.md +30 -0
  87. package/template/product-specs/templates/meta/onboarding.md +108 -0
  88. package/template/product-specs/templates/state.md +19 -0
  89. package/template/product-specs/workflows/conflict-resolution.md +10 -0
  90. package/template/product-specs/workflows/domain-update.md +15 -0
  91. package/template/product-specs/workflows/map-codebase.md +17 -0
  92. package/template/product-specs/workflows/onboard-project.md +575 -0
  93. package/template/product-specs/workflows/pipeline-full.md +258 -0
  94. package/template/product-specs/workflows/pipeline-resume.md +21 -0
  95. package/template/product-specs/workflows/verify-change.md +12 -0
@@ -0,0 +1,55 @@
1
+ #!/bin/bash
2
+ # Studio Session State
3
+ # PostToolUse hook: updates .planning/STATE.md after significant writes
4
+ # Exit 0 always (non-blocking)
5
+
6
+ INPUT=$(cat)
7
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
8
+
9
+ # Only track docs/ writes
10
+ if [[ ! "$FILE_PATH" == *"docs/"* ]]; then
11
+ exit 0
12
+ fi
13
+
14
+ # Skip templates
15
+ if [[ "$FILE_PATH" == *"_template/"* ]] || [[ "$FILE_PATH" == *"_example/"* ]] || [[ "$FILE_PATH" == *"_golden/"* ]]; then
16
+ exit 0
17
+ fi
18
+
19
+ STATE_FILE=".planning/STATE.md"
20
+
21
+ # Create .planning/ if needed
22
+ mkdir -p .planning 2>/dev/null
23
+
24
+ # Determine what was written
25
+ if [[ "$FILE_PATH" == *"product-specs/docs/changes/"* ]]; then
26
+ PRDCT_DIR=$(echo "$FILE_PATH" | grep -oE "PRDCT-[0-9]+")
27
+ if [[ -n "$PRDCT_DIR" ]] && [[ -f "product-specs/docs/changes/$PRDCT_DIR/metadata.yaml" ]]; then
28
+ STATUS=$(grep "^status:" "product-specs/docs/changes/$PRDCT_DIR/metadata.yaml" | head -1 | sed 's/^status:[[:space:]]*//' | sed 's/[[:space:]]*#.*//')
29
+
30
+ # Update STATE.md
31
+ cat > "$STATE_FILE" << EOF
32
+ # Studio State
33
+
34
+ ## Status: active
35
+ ## Current PRDCT: $PRDCT_DIR
36
+ ## Current Phase: $STATUS
37
+ ## Last Activity: $(date +%Y-%m-%dT%H:%M:%S)
38
+ ## Last File: $(basename "$FILE_PATH")
39
+
40
+ ## Session Continuity
41
+ - Last stopped: $(date +%Y-%m-%dT%H:%M:%S)
42
+ - Resume point: /studio-resume $PRDCT_DIR
43
+ EOF
44
+ fi
45
+ elif [[ "$FILE_PATH" == *"product-specs/docs/domains/"* ]]; then
46
+ DOMAIN=$(echo "$FILE_PATH" | sed 's|.*/product-specs/docs/domains/||' | cut -d/ -f1)
47
+ if [[ -n "$DOMAIN" ]] && [[ "$DOMAIN" != "_template" ]]; then
48
+ # Append domain activity to STATE.md if exists
49
+ if [[ -f "$STATE_FILE" ]]; then
50
+ echo "## Last Domain Activity: $DOMAIN ($(basename "$FILE_PATH")) at $(date +%H:%M)" >> "$STATE_FILE"
51
+ fi
52
+ fi
53
+ fi
54
+
55
+ exit 0
@@ -0,0 +1,180 @@
1
+ #!/bin/bash
2
+ # Hook: PostToolUse for Write/Edit in product-specs/docs/changes/
3
+ # Stage gate validation for 5-file change package
4
+ # Validates change package conventions and stage gate transitions
5
+ #
6
+ # Input: JSON on stdin with tool_input
7
+ # Exit 0 = ok, Exit 2 = block with message
8
+
9
+ INPUT=$(cat)
10
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
11
+
12
+ # Only check docs/changes files
13
+ if [[ ! "$FILE_PATH" == *"product-specs/docs/changes/"* ]]; then
14
+ exit 0
15
+ fi
16
+
17
+ # Skip templates, examples, and golden
18
+ if [[ "$FILE_PATH" == *"_template/"* ]] || [[ "$FILE_PATH" == *"_example/"* ]] || [[ "$FILE_PATH" == *"_golden/"* ]]; then
19
+ exit 0
20
+ fi
21
+
22
+ CHANGE_DIR=$(dirname "$FILE_PATH")
23
+ FILE_NAME=$(basename "$FILE_PATH")
24
+
25
+ # If metadata.yaml doesn't exist yet, skip (being created)
26
+ if [[ ! -f "$CHANGE_DIR/metadata.yaml" ]]; then
27
+ exit 0
28
+ fi
29
+
30
+ # --- Basic metadata validation ---
31
+ if ! grep -q "^id:" "$CHANGE_DIR/metadata.yaml"; then
32
+ echo "metadata.yaml missing 'id' field" >&2
33
+ exit 2
34
+ fi
35
+ if ! grep -q "^status:" "$CHANGE_DIR/metadata.yaml"; then
36
+ echo "metadata.yaml missing 'status' field" >&2
37
+ exit 2
38
+ fi
39
+
40
+ # --- Placeholder detection for any written file ---
41
+ PLACEHOLDER_PATTERNS=(
42
+ "PRDCT-XXXX"
43
+ "YYYY-MM-DD"
44
+ "\[Feature name\]"
45
+ "\[Flow name\]"
46
+ "\[Aggregate name\]"
47
+ "\[Decision title\]"
48
+ "\[Surface name\]"
49
+ )
50
+
51
+ if [[ "$FILE_NAME" != "metadata.yaml" ]] && [[ -f "$FILE_PATH" ]]; then
52
+ for pattern in "${PLACEHOLDER_PATTERNS[@]}"; do
53
+ if grep -q "$pattern" "$FILE_PATH"; then
54
+ echo "WARNING: '$FILE_PATH' contains placeholder '$pattern'. Replace before advancing stage." >&2
55
+ # Warning only, don't block
56
+ break
57
+ fi
58
+ done
59
+ fi
60
+
61
+ # --- Stage gate validation on status transition ---
62
+ if [[ "$FILE_NAME" == "metadata.yaml" ]]; then
63
+ NEW_STATUS=$(grep "^status:" "$FILE_PATH" | head -1 | sed 's/^status:[[:space:]]*//' | sed 's/[[:space:]]*#.*//')
64
+
65
+ # Helper: check file has content beyond template
66
+ has_content() {
67
+ local file="$CHANGE_DIR/$1"
68
+ if [[ ! -f "$file" ]]; then
69
+ return 1
70
+ fi
71
+ local content_lines
72
+ content_lines=$(grep -v "^---$" "$file" | grep -v "^#" | grep -v "^$" | grep -v "^<!--" | grep -v "^-$" | grep -v "^|---|" | wc -l | tr -d ' ')
73
+ [[ "$content_lines" -gt 3 ]]
74
+ }
75
+
76
+ # Helper: count list items in a section
77
+ list_items_in_section() {
78
+ local file="$CHANGE_DIR/$1"
79
+ local section="$2"
80
+ if [[ ! -f "$file" ]]; then
81
+ echo 0
82
+ return
83
+ fi
84
+ # Section ends at next h2 (^## ), not at h3+ subheaders (which are still part of the section).
85
+ # Counts items: numbered list, dash-bullet, OR h3/h4 scenario subheaders (e.g. "### Scenario HP-1").
86
+ awk "/^###? $section/{found=1;next} /^## /{if(found)exit} found" "$file" | grep -cE "^[0-9]+\.|^- \S|^###+ " | tr -d ' '
87
+ }
88
+
89
+ # Helper: check YAML field is not empty
90
+ field_not_empty() {
91
+ local field="$1"
92
+ local val
93
+ val=$(grep "^[[:space:]]*$field:" "$CHANGE_DIR/metadata.yaml" | head -1 | sed "s/^[[:space:]]*$field:[[:space:]]*//" | sed 's/[[:space:]]*#.*//' | sed 's/"//g')
94
+ [[ -n "$val" ]] && [[ "$val" != "\"\"" ]] && [[ "$val" != "''" ]]
95
+ }
96
+
97
+ # Helper: check YAML array field is not empty
98
+ array_not_empty() {
99
+ local field="$1"
100
+ local val
101
+ val=$(grep "^$field:" "$CHANGE_DIR/metadata.yaml" | head -1 | sed "s/^$field:[[:space:]]*//" | sed 's/[[:space:]]*#.*//')
102
+ [[ "$val" != "[]" ]] && [[ -n "$val" ]]
103
+ }
104
+
105
+ # Helper: count HTML files in mockups/ directory
106
+ mockup_html_count() {
107
+ local mockups_dir="$CHANGE_DIR/mockups"
108
+ if [[ ! -d "$mockups_dir" ]]; then
109
+ echo 0
110
+ return
111
+ fi
112
+ find "$mockups_dir" -maxdepth 1 -name "*.html" | wc -l | tr -d ' '
113
+ }
114
+
115
+ # Helper: count gherkin scenarios
116
+ gherkin_count() {
117
+ local file="$CHANGE_DIR/$1"
118
+ if [[ ! -f "$file" ]]; then
119
+ echo 0
120
+ return
121
+ fi
122
+ grep -cE "^Given|^Scenario(:| )|^### Scenario(:| )" "$file" | tr -d ' '
123
+ }
124
+
125
+ ERRORS=""
126
+
127
+ case "$NEW_STATUS" in
128
+ scenarios)
129
+ # Exit criteria for intent stage: intent → scenarios
130
+ has_content "01-intent.md" || ERRORS="$ERRORS\n - 01-intent.md not filled"
131
+ field_not_empty "title" || ERRORS="$ERRORS\n - metadata.yaml: title is empty"
132
+ field_not_empty "product" || ERRORS="$ERRORS\n - metadata.yaml: product owner not set"
133
+ ;;
134
+
135
+ analysis)
136
+ # Exit criteria for scenarios stage: scenarios → analysis
137
+ has_content "02-scenarios.md" || ERRORS="$ERRORS\n - 02-scenarios.md not filled"
138
+ local happy
139
+ happy=$(list_items_in_section "02-scenarios.md" "Happy path scenarios")
140
+ [[ "$happy" -ge 3 ]] || ERRORS="$ERRORS\n - 02-scenarios.md: Happy path scenarios < 3 (found: $happy)"
141
+ local edges
142
+ edges=$(list_items_in_section "02-scenarios.md" "Edge case scenarios")
143
+ [[ "$edges" -ge 5 ]] || ERRORS="$ERRORS\n - 02-scenarios.md: Edge case scenarios < 5 (found: $edges)"
144
+ ;;
145
+
146
+ domain)
147
+ # Exit criteria for analysis stage: analysis → domain
148
+ has_content "03-analysis.md" || ERRORS="$ERRORS\n - 03-analysis.md not filled"
149
+ # Iron rule 1: scenarios must be complete before domain
150
+ has_content "02-scenarios.md" || ERRORS="$ERRORS\n - IRON RULE: 02-scenarios.md must be complete before domain"
151
+ ;;
152
+
153
+ ux)
154
+ # Exit criteria for domain stage: domain → ux
155
+ has_content "04-domain.md" || ERRORS="$ERRORS\n - 04-domain.md not filled"
156
+ array_not_empty "domains" || ERRORS="$ERRORS\n - metadata.yaml: domains is empty"
157
+ # Iron rule 2: analysis must be complete
158
+ has_content "03-analysis.md" || ERRORS="$ERRORS\n - IRON RULE: 03-analysis.md must be complete before UX"
159
+ # Iron rule 3: domain must be complete
160
+ has_content "04-domain.md" || ERRORS="$ERRORS\n - IRON RULE: 04-domain.md must be complete before UX"
161
+ ;;
162
+
163
+ done)
164
+ # Exit criteria for ux stage: ux → done
165
+ has_content "05-ux.md" || ERRORS="$ERRORS\n - 05-ux.md not filled"
166
+ local html_count
167
+ html_count=$(mockup_html_count)
168
+ [[ "$html_count" -ge 1 ]] || ERRORS="$ERRORS\n - mockups/: no HTML files found (need at least 1)"
169
+ # Iron rule 4: scenarios must be complete
170
+ has_content "02-scenarios.md" || ERRORS="$ERRORS\n - IRON RULE: 02-scenarios.md must be complete before done"
171
+ ;;
172
+ esac
173
+
174
+ if [[ -n "$ERRORS" ]]; then
175
+ echo "Stage gate BLOCKED: transition to '$NEW_STATUS' not possible:$ERRORS" >&2
176
+ exit 2
177
+ fi
178
+ fi
179
+
180
+ exit 0
@@ -0,0 +1,27 @@
1
+ # Checkpoint protocol
2
+
3
+ Точки взаимодействия с человеком. Золотое правило: **если AI может автоматизировать — AI автоматизирует**. Человек только подтверждает.
4
+
5
+ ## 3 типа чекпоинтов
6
+
7
+ ### checkpoint:human-verify (90% случаев)
8
+ AI сделал всё автоматически. Человек подтверждает результат.
9
+ - Пример: "Я создал 03-domain-impact.md. Проверь что домены определены верно."
10
+ - Протокол: показать summary → ждать "ок" → продолжить
11
+
12
+ ### checkpoint:decision (9% случаев)
13
+ Есть несколько валидных вариантов. Человек выбирает.
14
+ - Пример: "Это новый домен или расширение существующего? Варианты: A) новый домен assessment, B) расширить training-session"
15
+ - Протокол: показать варианты с trade-offs → ждать выбора → записать в 09-decisions.md
16
+
17
+ ### checkpoint:human-action (1% случаев)
18
+ Действие, которое может выполнить только человек.
19
+ - Пример: "Нужен API key для Stripe. Создай в dashboard и вставь в .env"
20
+ - Протокол: описать что нужно → ждать подтверждения → продолжить
21
+
22
+ ## Когда НЕ останавливаться
23
+ - Создание файлов и директорий
24
+ - Обновление metadata.yaml
25
+ - Обновление domain docs
26
+ - Git commit
27
+ - Linear sync
@@ -0,0 +1,38 @@
1
+ # DDD conventions
2
+
3
+ ## Domain docs structure
4
+ Каждый домен = папка с 13 файлами:
5
+
6
+ ### Core (бизнес-знание)
7
+ 1. README.md — что делает, границы (inside/outside)
8
+ 2. ubiquitous-language.md — термины, определения, запрещённые синонимы
9
+ 3. aggregates.md — корень агрегата, state machine, ER diagram
10
+ 4. business-rules.md — правила с rationale и edge cases
11
+ 5. events.md — события, producers, consumers, payload, guarantees
12
+ 6. invariants.md — неломаемые правила (чеклист)
13
+ 7. scenarios.md — каноничные Gherkin сценарии (happy path, edge, error, permissions, concurrent)
14
+ 8. integrations.md — upstream/downstream, контракты, SLA
15
+ 9. ownership.md — кто владеет, кто апрувит, эскалация
16
+
17
+ ### Technical (реализация)
18
+ 10. api-contracts.md — owned/consumed endpoints
19
+ 11. data-model.md — DB schema, таблицы, индексы
20
+ 12. operational-sla.md — performance targets, timeouts, monitoring
21
+
22
+ ### History
23
+ 13. changelog.md — автоистория изменений домена
24
+
25
+ ## Principles
26
+ - Aggregate = consistency boundary, one transaction
27
+ - References between aggregates ONLY by ID
28
+ - Each term defined in EXACTLY one domain
29
+ - Invariants are STRONGER than business rules (invariants cannot be broken, rules can have exceptions)
30
+ - Events in PastTense format (SessionStarted, TurnCompleted)
31
+ - Prefer many small domains over one god-domain
32
+
33
+ ## Domain docs contain ONLY business knowledge
34
+ - NO UI components
35
+ - NO service names
36
+ - NO implementation details
37
+ - NO code snippets
38
+ - After PRDCT merge: only business rules, aggregates, events, invariants go to domain docs
@@ -0,0 +1,50 @@
1
+ # Gate types
2
+
3
+ Gates control transitions between pipeline stages. Each gate is a check before admission to the next stage.
4
+
5
+ ## 4 gate types
6
+
7
+ ### Pre-flight gate
8
+ Validates preconditions BEFORE work begins.
9
+ - Example: Before 02-scenarios -> check that 01-intent.md exists and is filled
10
+ - On failure: BLOCK entry, report what is missing
11
+
12
+ ### Revision gate
13
+ Evaluates OUTPUT quality after completion. May send back for rework.
14
+ - Example: After 02-scenarios -> check that >= 5 edge cases exist
15
+ - On failure: RETURN to author with feedback (max 3 iterations)
16
+ - Stall detection: if after 3 iterations quality has not improved -> escalation
17
+
18
+ ### Escalation gate
19
+ Problem that AI cannot resolve on its own.
20
+ - Example: Domain invariant violated, conflict between PRDCTs
21
+ - Action: STOP, show to user, wait for decision
22
+
23
+ ### Abort gate
24
+ Immediate stop to prevent damage.
25
+ - Example: Context < 25%, iron rule violated
26
+ - Action: Save state, halt execution
27
+
28
+ ## 5 iron rules (abort gates)
29
+
30
+ These are non-negotiable. Violation triggers an immediate abort.
31
+
32
+ 1. **No scenarios -> can't analyze.** If 02-scenarios.md is not complete, stage 03 is blocked.
33
+ 2. **No analysis -> can't model domain.** If 03-analysis.md is not complete, stage 04 is blocked.
34
+ 3. **No domain -> can't do UX.** If 04-domain.md is not complete, stage 05 is blocked.
35
+ 4. **No scenarios -> can't finalize UX.** If 02-scenarios.md is not complete, 05-ux cannot be finalized.
36
+ 5. **Canon not edited directly.** Domain docs are only updated through merger after change is done.
37
+
38
+ ## Gate matrix
39
+
40
+ | Transition | Pre-flight | Revision | Escalation | Abort |
41
+ |---|---|---|---|---|
42
+ | intent -> scenarios | 01-intent.md filled, metadata.yaml has title + owners | -- | -- | -- |
43
+ | scenarios -> analysis | 02-scenarios.md filled, >= 5 edge cases | Cross-review by Analyst (technically possible?) | -- | **Iron rule 1**: no scenarios |
44
+ | analysis -> domain | 03-analysis.md filled, system impact assessed | Analysis consistent with scenarios | -- | context < 25% |
45
+ | domain -> ux | 04-domain.md filled, domains identified | Domain model consistent | Domain invariant violated | **Iron rule 2**: no analysis |
46
+ | ux -> done | 05-ux.md filled, >= 1 mockup HTML | Surfaces cover all scenarios, all states represented | -- | **Iron rule 3**: no domain, **Iron rule 4**: no scenarios |
47
+
48
+ ## Placeholder detection
49
+ Gate hooks warn (without blocking) if a file contains placeholder text from templates:
50
+ `PRDCT-XXXX`, `YYYY-MM-DD`, `[Feature name]`, `[Flow name]`, `[Aggregate name]`, `[Decision title]`, `[Surface name]`
@@ -0,0 +1,28 @@
1
+ # Model profiles
2
+
3
+ Каждый agent может использовать разную модель в зависимости от сложности задачи.
4
+
5
+ ## Profiles
6
+
7
+ | Profile | Description | Use case |
8
+ |---------|-------------|----------|
9
+ | quality | Всегда Opus 4.6 | Критические решения, архитектура |
10
+ | balanced | Opus для reasoning, Sonnet для execution | Стандартная работа |
11
+ | budget | Sonnet для reasoning, Haiku для execution | Высокий объём, низкая сложность |
12
+ | inherit | Модель текущей сессии | Sub-agents внутри сессии |
13
+
14
+ ## Agent → model mapping (balanced profile)
15
+
16
+ | Agent | Model tier | Reasoning |
17
+ |-------|-----------|-----------|
18
+ | studio-pm | opus | Извлечение бизнес-требований — reasoning-heavy |
19
+ | studio-analyst | opus | DDD, инварианты — высокая сложность |
20
+ | studio-designer | sonnet | HTML/CSS генерация — execution-heavy |
21
+ | studio-backend | opus | Архитектурные решения |
22
+ | studio-frontend | sonnet | UI states — structured output |
23
+ | studio-qa | sonnet | Test cases — structured output |
24
+ | studio-verifier | opus | Goal-backward verification — reasoning-heavy |
25
+ | studio-reviewer | sonnet | Cross-reference — pattern matching |
26
+ | studio-codebase-mapper | sonnet | Code reading — high volume |
27
+ | studio-domain-extractor | opus | Domain modeling — reasoning-heavy |
28
+ | studio-conflict-resolver | opus | Conflict analysis — judgment |
@@ -0,0 +1,51 @@
1
+ ---
2
+ paths:
3
+ - "docs/**"
4
+ ---
5
+
6
+ # Obsidian-specific conventions
7
+
8
+ ## Vault structure
9
+ - Obsidian — основной инструмент для работы с документацией
10
+ - Vault root: `docs/`
11
+ - Canvas файлы (`.canvas`): в `_meta/` для визуальных карт
12
+ - Dataview дашборды: `domains-dashboard.md`, `changes-dashboard.md`
13
+
14
+ ## Graph view optimization
15
+ - Каждый файл ДОЛЖЕН иметь осмысленное имя (НЕ `index.md`)
16
+ - Frontmatter `tags:` используются для группировки и цветов в graph view
17
+ - Рекомендуемые группы в graph:
18
+ - `path:"domains"` → синий (бизнес-домены)
19
+ - `path:"changes"` → зелёный (change packages)
20
+ - `path:"adrs"` → фиолетовый (решения)
21
+ - `path:"contexts"` → оранжевый (платформа)
22
+ - `path:"_meta"` → серый (метаданные)
23
+
24
+ ## Canvas files
25
+ - Формат: JSON Canvas (открытый стандарт)
26
+ - Nodes: embed domain README.md через `type: "file"`
27
+ - Edges: подписи = domain events или API contracts
28
+ - Colors: `"4"` = active, `"6"` = planned, `"0"` = infrastructure
29
+
30
+ ## Dataview patterns
31
+ ```
32
+ # Таблица из frontmatter:
33
+ TABLE field1, field2 FROM "folder" WHERE type = "X" SORT field1
34
+
35
+ # Задачи из чеклистов:
36
+ TASK FROM "folder" WHERE file.name = "invariants"
37
+
38
+ # Группировка:
39
+ TABLE status FROM "changes" WHERE type = "change" GROUP BY status
40
+ ```
41
+
42
+ ## Embeds
43
+ - Используй `![[file]]` для встраивания в дашборды
44
+ - Используй `![[file#heading]]` для встраивания секции
45
+ - Canvas: `type: "file"` для embed из vault
46
+
47
+ ## Plugins required
48
+ - **Dataview** — живые дашборды, запросы по frontmatter
49
+ - **Templater** (optional) — динамическое создание файлов из шаблонов
50
+ - **Kanban** (optional) — kanban-доски из markdown
51
+ - **Mermaid** — встроен в Obsidian, доп. плагин не нужен
@@ -0,0 +1,65 @@
1
+ # Stage pipeline
2
+
3
+ ## Three layers
4
+
5
+ ```
6
+ LAYER 1 — WHAT & WHY (problem space)
7
+ 01-intent.md PM
8
+ 02-scenarios.md Scenario Writer + QA
9
+
10
+ LAYER 2 — HOW IT WORKS (system space)
11
+ 03-analysis.md Analyst
12
+ 04-domain.md Domain Framer + PM
13
+
14
+ LAYER 3 — HOW IT LOOKS (solution space)
15
+ 05-ux.md + mockups/ Designer
16
+ ```
17
+
18
+ After UX is complete, the change package is DONE.
19
+ Executor writes code from domain docs + scenarios + UX.
20
+ Merger updates domain docs after code is merged.
21
+
22
+ ## Status flow
23
+ `intent -> scenarios -> analysis -> domain -> ux -> done`
24
+
25
+ ## Naming convention
26
+ `PRDCT-XXXX-feature-name` (e.g. `PRDCT-0001-user-invites`)
27
+
28
+ ## Parallel stages
29
+ After 02-scenarios is complete:
30
+ - Analyst (03-analysis) and Domain Framer (04-domain) work sequentially
31
+ - Designer (05-ux) can start exploring but requires completed 04-domain before finalizing
32
+
33
+ ## Iron rules (gate rules)
34
+
35
+ 1. **No scenarios -> can't analyze.** Stage 03 requires completed 02-scenarios.md. Without scenarios, analysis has no behavior to ground on.
36
+ 2. **No analysis -> can't model domain.** Stage 04 requires completed 03-analysis.md. Without system analysis, domain modeling lacks technical grounding.
37
+ 3. **No domain -> can't do UX.** Stage 05 requires completed 04-domain.md. Without domain boundaries, UX decisions have no grounding.
38
+ 4. **No scenarios -> can't finalize UX.** Stage 05 requires completed 02-scenarios.md. Without scenarios, UX has no behavior to show.
39
+ 5. **Canon not edited directly.** Domain docs are ONLY updated through merger after change is done. Direct edits are forbidden.
40
+
41
+ ## Cross-review matrix
42
+
43
+ Each stage output is reviewed by a different role before the next stage begins.
44
+
45
+ | Stage output | Reviewed by | Review question |
46
+ |---|---|---|
47
+ | 01-intent (PM) | Analyst | Is the problem clear? Are boundaries well-defined? |
48
+ | 02-scenarios (Scenario Writer) | Analyst | Are all scenarios technically possible? Edge cases covered? |
49
+ | 03-analysis (Analyst) | PM | Does the system analysis match the business intent? |
50
+ | 04-domain (Domain Framer) | Analyst | Does the domain model cover all scenarios? Invariants correct? |
51
+ | 05-ux (Designer) | QA | Do surfaces cover all scenarios? All states represented? |
52
+
53
+ ## Iteration rules
54
+ If a later role finds a problem in a previous stage:
55
+ 1. Record in the relevant stage document under an `## Open questions` section
56
+ 2. If critical (changes scope) -> STOP, escalation gate
57
+ 3. If non-critical -> record, continue
58
+ 4. On return -> cascade update all downstream documents
59
+
60
+ ## Post-change flow
61
+
62
+ After status becomes `done`:
63
+ 1. **Executor** reads domain docs + scenarios + UX -> writes code
64
+ 2. **Merger** reads change package -> updates domain docs (aggregates, rules, events, invariants, UL, scenarios, surfaces)
65
+ 3. Change package is FROZEN after merge
@@ -0,0 +1,159 @@
1
+ ---
2
+ paths:
3
+ - "product-specs/docs/changes/**"
4
+ ---
5
+
6
+ # Change management rules
7
+
8
+ ## Change package structure
9
+ Each change package is a folder `PRDCT-XXXX-feature-name/` with the following files:
10
+ ```
11
+ metadata.yaml -> Machine-readable metadata
12
+ 01-intent.md -> What and why (PM)
13
+ 02-scenarios.md -> User scenarios, edge cases (Scenario Writer + QA)
14
+ 03-analysis.md -> System analysis (Analyst)
15
+ 04-domain.md -> Domain impact (Domain Framer + PM)
16
+ 05-ux.md -> UX design decisions (Designer)
17
+ mockups/ -> HTML mockup files
18
+ ```
19
+
20
+ ## Naming convention
21
+ - Format: `PRDCT-XXXX-feature-name` (e.g. `PRDCT-0001-user-invites`)
22
+ - XXXX is zero-padded, incrementing
23
+ - Feature name is kebab-case, descriptive
24
+
25
+ ## Status flow
26
+ ```
27
+ intent -> scenarios -> analysis -> domain -> ux -> done
28
+ ```
29
+
30
+ ## Stage pipeline
31
+ ```
32
+ LAYER 1 -- WHAT & WHY
33
+ 01-intent.md PM
34
+ 02-scenarios.md Scenario Writer + QA
35
+
36
+ LAYER 2 -- HOW IT WORKS
37
+ 03-analysis.md Analyst
38
+ 04-domain.md Domain Framer + PM
39
+
40
+ LAYER 3 -- HOW IT LOOKS
41
+ 05-ux.md + mockups/ Designer
42
+ ```
43
+
44
+ ## Iron rules (gate rules)
45
+
46
+ These are non-negotiable. Violation blocks the pipeline.
47
+
48
+ 1. **No scenarios -> can't analyze.** Stage 03 requires completed 02-scenarios.md.
49
+ 2. **No analysis -> can't model domain.** Stage 04 requires completed 03-analysis.md.
50
+ 3. **No domain -> can't do UX.** Stage 05 requires completed 04-domain.md.
51
+ 4. **No scenarios -> can't finalize UX.** Stage 05 requires completed 02-scenarios.md.
52
+ 5. **Canon not edited directly.** Domain docs are ONLY updated through merger after change is done.
53
+
54
+ ID numbering is governed by [`id-numbering.md`](./id-numbering.md). Stage agents allocate via `_id-counters.json`. Merger verifies preservation.
55
+
56
+ ## Cross-review rules
57
+
58
+ Each stage output is reviewed by a different role before the next stage begins.
59
+
60
+ | Stage output | Reviewed by | Review question |
61
+ |---|---|---|
62
+ | 01-intent (PM) | Analyst | Is the problem clear? Are boundaries well-defined? |
63
+ | 02-scenarios (Scenario Writer) | Analyst | Are all scenarios technically possible? Edge cases covered? |
64
+ | 03-analysis (Analyst) | PM | Does the system analysis match the business intent? |
65
+ | 04-domain (Domain Framer) | Analyst | Does the domain model cover all scenarios? Invariants correct? |
66
+ | 05-ux (Designer) | QA | Do surfaces cover all scenarios? All states represented? |
67
+
68
+ ## Stage gates
69
+
70
+ Transition between stages is controlled by validation hooks. When `status` changes in metadata.yaml, the hook checks exit criteria.
71
+
72
+ ### intent -> scenarios
73
+ - [ ] `01-intent.md` filled (not placeholder)
74
+ - [ ] `metadata.yaml` -> title not empty
75
+ - [ ] `metadata.yaml` -> owners.product specified
76
+
77
+ ### scenarios -> analysis
78
+ - [ ] `02-scenarios.md` filled
79
+ - [ ] Happy path contains >= 3 steps
80
+ - [ ] Edge cases contain >= 5 items
81
+ - [ ] Cross-review by Analyst complete (technically possible?)
82
+
83
+ ### analysis -> domain
84
+ - [ ] `03-analysis.md` filled
85
+ - [ ] System impact assessed
86
+ - [ ] Analysis consistent with scenarios
87
+
88
+ ### domain -> ux
89
+ - [ ] `04-domain.md` filled
90
+ - [ ] Domains identified and listed
91
+ - [ ] Domain model is internally consistent
92
+ - [ ] **Iron rule 2**: 03-analysis.md must be complete
93
+
94
+ ### ux -> done
95
+ - [ ] `05-ux.md` filled
96
+ - [ ] >= 1 mockup HTML in `mockups/`
97
+ - [ ] Surfaces cover all scenarios from 02-scenarios.md
98
+ - [ ] All surface states represented (loading, success, error, empty)
99
+ - [ ] Cross-review by QA complete
100
+
101
+ ## Post-change flow
102
+
103
+ After status becomes `done`:
104
+ 1. **Executor** reads domain docs + scenarios + UX -> writes code
105
+ 2. **Merger** reads change package -> updates domain docs
106
+ 3. Change package is FROZEN after merge
107
+
108
+ ## Iteration rules
109
+ - If a later stage discovers a problem in a previous stage:
110
+ 1. Record the issue in the relevant document under `## Open questions`
111
+ 2. Update the source document
112
+ 3. Cascade update all downstream documents
113
+ 4. If the issue changes scope -> STOP, escalation gate
114
+ - Cascade updates are mandatory -- no downstream doc may reference stale upstream content
115
+
116
+ ## Metadata rules
117
+ - `id`: unique, incrementing PRDCT-XXXX
118
+ - `status`: updated at each transition (intent|scenarios|analysis|domain|ux|done)
119
+ - `owners`: filled at intent stage
120
+ - `domains`: filled at domain stage
121
+
122
+ ## Immutability
123
+ - After merge, a change package is FROZEN
124
+ - Fixes go into a new PRDCT with `related_changes` reference
125
+ - No retroactive edits to merged packages
126
+
127
+ ## Conflict resolution
128
+
129
+ Two change packages may modify the same domain simultaneously. This is normal but requires explicit management.
130
+
131
+ ### Detection
132
+ When creating or updating a change package, the AI role MUST:
133
+ 1. Scan all active PRDCTs (status != done) via `ls product-specs/docs/changes/`
134
+ 2. Read `metadata.yaml` of each active PRDCT
135
+ 3. Compare `domains` and `capabilities` fields
136
+ 4. If overlap found -> declare CONFLICT
137
+
138
+ ### Notification
139
+ On conflict detection:
140
+ 1. Add entry to `metadata.yaml` -> `conflicts_with`
141
+ 2. Add question in the relevant stage doc with tag `[CONFLICT]`
142
+ 3. Notify user: which PRDCT conflicts and on which domains
143
+
144
+ ### Resolution
145
+ 1. Identify domain owner from `product-specs/docs/domains/[name]/ownership.md`
146
+ 2. Domain owner is arbiter, decides priority
147
+ 3. Lower-priority PRDCT gets `blocked_by: PRDCT-XXXX`
148
+ 4. After higher-priority PRDCT merges, lower-priority must:
149
+ - Rebase domain impact (04-domain.md)
150
+ - Re-check invariants
151
+
152
+ ### Tracking
153
+ Update `conflicts_with` entry:
154
+ - `resolution: resolved`
155
+ - `resolution_note: "description of how it was resolved"`
156
+
157
+ ## Placeholder detection
158
+ Gate hooks warn (without blocking) if a file contains placeholder text from templates:
159
+ `PRDCT-XXXX`, `YYYY-MM-DD`, `[Feature name]`, `[Flow name]`, `[Aggregate name]`, `[Decision title]`, `[Surface name]`