shapeup-sdlc 1.6.2

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 (135) hide show
  1. package/.claude/settings.local.example.json +20 -0
  2. package/.claude-plugin/marketplace.json +16 -0
  3. package/.claude-plugin/plugin.json +18 -0
  4. package/.env.shapeup.example +14 -0
  5. package/AGENTS.md +133 -0
  6. package/LICENSE +21 -0
  7. package/README.md +362 -0
  8. package/SECURITY.md +72 -0
  9. package/bin/init.mjs +329 -0
  10. package/commands/build.md +14 -0
  11. package/commands/eval.md +15 -0
  12. package/commands/hammer.md +12 -0
  13. package/commands/orient.md +11 -0
  14. package/commands/qa.md +12 -0
  15. package/commands/retro.md +13 -0
  16. package/commands/scopes.md +14 -0
  17. package/commands/shape.md +12 -0
  18. package/commands/ship.md +53 -0
  19. package/commands/wire.md +11 -0
  20. package/hooks/anti-rationalization.mjs +244 -0
  21. package/hooks/compact-snapshot.mjs +47 -0
  22. package/hooks/gate-deadline.mjs +151 -0
  23. package/hooks/gate-intake.mjs +110 -0
  24. package/hooks/gate-l2.mjs +161 -0
  25. package/hooks/gate-zerowork.mjs +264 -0
  26. package/hooks/hooks.json +118 -0
  27. package/hooks/lib/decision.mjs +183 -0
  28. package/hooks/safety-spine.mjs +296 -0
  29. package/hooks/sandbox-guard.mjs +172 -0
  30. package/hooks/session-rehydrate.mjs +109 -0
  31. package/hooks/slop-cleaner.mjs +176 -0
  32. package/oracles/_shared.mjs +46 -0
  33. package/oracles/http-oracle.mjs +155 -0
  34. package/oracles/index.mjs +36 -0
  35. package/oracles/process-oracle.mjs +146 -0
  36. package/oracles/snapshot-oracle.mjs +119 -0
  37. package/oracles/test-oracle.mjs +138 -0
  38. package/package.json +49 -0
  39. package/skills/advisor-protocol/SKILL.md +171 -0
  40. package/skills/ba-pitch-analyzer/SKILL.md +175 -0
  41. package/skills/ba-pitch-analyzer/assets/templates/_index.tmpl.md +84 -0
  42. package/skills/ba-pitch-analyzer/assets/templates/api-feasibility.tmpl.md +65 -0
  43. package/skills/ba-pitch-analyzer/assets/templates/assess-report.tmpl.md +127 -0
  44. package/skills/ba-pitch-analyzer/assets/templates/contracts/be-service.contract.tmpl.md +62 -0
  45. package/skills/ba-pitch-analyzer/assets/templates/contracts/offline-storage.contract.tmpl.md +92 -0
  46. package/skills/ba-pitch-analyzer/assets/templates/contracts/third-party-api.contract.tmpl.md +66 -0
  47. package/skills/ba-pitch-analyzer/assets/templates/cross-context/context-map.tmpl.md +64 -0
  48. package/skills/ba-pitch-analyzer/assets/templates/cross-context/event-choreography.tmpl.md +77 -0
  49. package/skills/ba-pitch-analyzer/assets/templates/cross-context/migration-plan.tmpl.md +104 -0
  50. package/skills/ba-pitch-analyzer/assets/templates/cross-context/team-handoff.tmpl.md +79 -0
  51. package/skills/ba-pitch-analyzer/assets/templates/domain-model.tmpl.md +79 -0
  52. package/skills/ba-pitch-analyzer/assets/templates/feedback.tmpl.md +87 -0
  53. package/skills/ba-pitch-analyzer/assets/templates/integration.tmpl.md +64 -0
  54. package/skills/ba-pitch-analyzer/assets/templates/run-state.tmpl.md +77 -0
  55. package/skills/ba-pitch-analyzer/assets/templates/scope-summary.tmpl.md +105 -0
  56. package/skills/ba-pitch-analyzer/assets/templates/synthesis.tmpl.md +215 -0
  57. package/skills/ba-pitch-analyzer/assets/templates/task-board.tmpl.md +35 -0
  58. package/skills/ba-pitch-analyzer/assets/templates/task-spike.tmpl.md +86 -0
  59. package/skills/ba-pitch-analyzer/assets/templates/task.tmpl.md +84 -0
  60. package/skills/ba-pitch-analyzer/assets/templates/usecase.tmpl.md +105 -0
  61. package/skills/ba-pitch-analyzer/assets/templates/ux-behavior.tmpl.md +65 -0
  62. package/skills/ba-pitch-analyzer/references/contract-patterns.md +152 -0
  63. package/skills/ba-pitch-analyzer/references/ddd-patterns.md +173 -0
  64. package/skills/ba-pitch-analyzer/references/doc-schemas.md +275 -0
  65. package/skills/ba-pitch-analyzer/references/integration-analysis.md +152 -0
  66. package/skills/ba-pitch-analyzer/references/task-generation.md +623 -0
  67. package/skills/ba-pitch-analyzer/references/test-surface.md +102 -0
  68. package/skills/ba-pitch-analyzer/references/ux-behavior-patterns.md +269 -0
  69. package/skills/ba-pitch-analyzer/scripts/board-derive.mjs +241 -0
  70. package/skills/ba-pitch-analyzer/scripts/spec-lint.mjs +239 -0
  71. package/skills/coach/SKILL.md +202 -0
  72. package/skills/orient/SKILL.md +262 -0
  73. package/skills/qa-edge-hunter/SKILL.md +369 -0
  74. package/skills/scope-architect/SKILL.md +111 -0
  75. package/skills/scope-hammer/SKILL.md +186 -0
  76. package/skills/shapeup/SKILL.md +403 -0
  77. package/skills/shapeup/resources/breadboard-reflection.md +88 -0
  78. package/skills/shapeup/resources/breadboarding.md +334 -0
  79. package/skills/shapeup/resources/context-compaction.md +240 -0
  80. package/skills/shapeup/resources/framing-doc.md +92 -0
  81. package/skills/shapeup/resources/kickoff-doc.md +95 -0
  82. package/skills/shapeup/resources/shaping.md +194 -0
  83. package/skills/shapeup/resources/spike.md +86 -0
  84. package/skills/solution-architect/SKILL.md +129 -0
  85. package/skills/spec-evaluator/README.md +93 -0
  86. package/skills/spec-evaluator/SKILL.md +213 -0
  87. package/skills/spec-evaluator/references/anti-leniency.md +50 -0
  88. package/skills/spec-evaluator/references/dimension-contract.md +126 -0
  89. package/skills/spec-evaluator/references/dimensions/_registry.md +40 -0
  90. package/skills/spec-evaluator/references/dimensions/completeness.md +102 -0
  91. package/skills/spec-evaluator/references/dimensions/integration.md +129 -0
  92. package/skills/spec-evaluator/references/dimensions/performance.md +48 -0
  93. package/skills/spec-evaluator/references/dimensions/security.md +60 -0
  94. package/skills/spec-evaluator/references/dimensions/spec-conformance.md +134 -0
  95. package/skills/spec-evaluator/references/dimensions/tdd-surface.md +110 -0
  96. package/skills/spec-evaluator/references/dimensions/test-surface-conformance.md +100 -0
  97. package/skills/spec-evaluator/references/probing.md +177 -0
  98. package/skills/spec-evaluator/references/report-schema.md +101 -0
  99. package/skills/spec-evaluator/references/verdict-ledger.md +92 -0
  100. package/skills/spec-evaluator/scripts/verdict-ledger.mjs +166 -0
  101. package/skills/task-executor/SKILL.md +194 -0
  102. package/skills/tech-lead/README.md +71 -0
  103. package/skills/tech-lead/SKILL.md +459 -0
  104. package/skills/tech-lead/references/delegation.md +254 -0
  105. package/skills/tech-lead/references/gates.md +379 -0
  106. package/skills/tech-lead/references/invocation.md +45 -0
  107. package/skills/tech-lead/references/ledger-schema.md +214 -0
  108. package/skills/tech-lead/references/round-protocol.md +184 -0
  109. package/skills/tech-lead/references/state-model.md +66 -0
  110. package/skills/tech-lead/references/tiny-lane.md +52 -0
  111. package/skills/tech-lead/schemas/domain.schema.json +2294 -0
  112. package/skills/tech-lead/schemas/gate-answers.schema.json +92 -0
  113. package/skills/tech-lead/schemas/work-order.schema.json +21 -0
  114. package/skills/tech-lead/schemas/work-result.schema.json +40 -0
  115. package/skills/tech-lead/scripts/aegis-digest.mjs +124 -0
  116. package/skills/tech-lead/scripts/budget-check.mjs +156 -0
  117. package/skills/tech-lead/scripts/compile-order.mjs +518 -0
  118. package/skills/tech-lead/scripts/fit-check.mjs +196 -0
  119. package/skills/tech-lead/scripts/gate-answers.mjs +338 -0
  120. package/skills/tech-lead/scripts/ingest-result.mjs +270 -0
  121. package/skills/tech-lead/scripts/init-run.mjs +326 -0
  122. package/skills/tech-lead/scripts/lib/argv.mjs +224 -0
  123. package/skills/tech-lead/scripts/lib/contract-md.mjs +481 -0
  124. package/skills/tech-lead/scripts/lib/is-main.mjs +82 -0
  125. package/skills/tech-lead/scripts/lib/paths.mjs +278 -0
  126. package/skills/tech-lead/scripts/lib/ratchet-tree.mjs +112 -0
  127. package/skills/tech-lead/scripts/run-snapshot.mjs +269 -0
  128. package/skills/tech-lead/scripts/ship-report.mjs +275 -0
  129. package/skills/tech-lead/scripts/stats.mjs +423 -0
  130. package/skills/tech-lead/scripts/t0-verify.mjs +470 -0
  131. package/skills/tech-lead/scripts/trace-lint.mjs +367 -0
  132. package/skills/tech-lead/scripts/validate-envelope.mjs +283 -0
  133. package/skills/translator/README.md +66 -0
  134. package/skills/translator/SKILL.md +258 -0
  135. package/skills/translator/references/preservation-rules.md +102 -0
@@ -0,0 +1,66 @@
1
+ # translator
2
+
3
+ The language gate upstream of the harness. It turns the PO's non-English intake (pitch /
4
+ PRD / requirement / transcript) into faithful **English** copies the harness can consume,
5
+ then proves the result is English and structurally identical to the source. It is **narrow
6
+ by design** — it normalizes language, nothing else.
7
+
8
+ ```
9
+ PO intake (any language) → TRANSLATOR → <name>.en.md (+ glossary.md + report) → ba-pitch-analyzer → …
10
+ ```
11
+
12
+ **Why it exists:** the harness (ba-pitch-analyzer → task-executor → spec-evaluator) is
13
+ English-only end to end and HARD-FAILs on anything else. Previously `tech-lead` was expected
14
+ to cover this; that conflated orchestration with language normalization. This skill owns the
15
+ language concern so the orchestrator stays thin.
16
+
17
+ **What it does NOT do:** plan, build, judge, or translate harness output back to the PO's
18
+ language. Input-normalization only.
19
+
20
+ ## Resource map
21
+ ```
22
+ translator/
23
+ ├── SKILL.md # entry — GATE T0–T2, the detect→glossary→translate→verify flow, flags, hard rules
24
+ ├── README.md # this file
25
+ └── references/
26
+ └── preservation-rules.md # ★ translate-vs-preserve table, 1:1 structure rule, glossary protocol, verification scan
27
+ ```
28
+
29
+ | Resource | Loaded at | Purpose |
30
+ |----------|-----------|---------|
31
+ | `SKILL.md` | always | T-gates, phase sequence, invocation, hard rules |
32
+ | `references/preservation-rules.md` | before translating | what stays verbatim, glossary format, the 3 verification checks |
33
+
34
+ ## Install
35
+ ```bash
36
+ cp -r translator <repo>/.claude/skills/ # or ~/.claude/skills/
37
+ ```
38
+ Pairs with the harness skills (`ba-pitch-analyzer`, `task-executor`, `spec-evaluator`,
39
+ `tech-lead`). `tech-lead` auto-invokes it at GATE L0 when intake is non-English.
40
+
41
+ ## Invoke
42
+ ```bash
43
+ /translator docs/pitch.md # → docs/pitch.en.md (+ glossary.md, report)
44
+ /translator docs/intake/ # folder; already-English files skipped
45
+ /translator --glossary docs/glossary.md docs/pitch.md # reuse vocabulary across docs/runs
46
+ /translator --check docs/pitch.md # detect-only (what tech-lead L0 calls)
47
+ /translator --auto docs/pitch.md # headless; still stops on a dirty residual scan
48
+ ```
49
+
50
+ ## Gate map
51
+ | Gate | When | Decision |
52
+ |------|------|----------|
53
+ | T0 | intake | detect source language per file; scope what to translate; `--check` stops here |
54
+ | T1 | after glossary | PO confirms term mappings; ambiguous terms resolved (never guessed) |
55
+ | T2 | after verify | sign off only on a clean residual scan + matching structure |
56
+
57
+ ## Output
58
+ - `<name>.en.md` — the English copy (original never overwritten)
59
+ - `glossary.md` — source→English term map (persisted, reusable)
60
+ - `translation-report.md` — detect table, glossary diff, verification result
61
+
62
+ ## Version
63
+ 0.1 — initial language gate. Detect → glossary → translate → verify → sign-off. Strict
64
+ English-only for the whole harness; faithful 1:1 with structure/frontmatter/wikilink/code/
65
+ number preservation; reusable glossary; idempotent already-English no-op; `--check` mode;
66
+ residual-non-English scan blocks sign-off even under `--auto`.
@@ -0,0 +1,258 @@
1
+ ---
2
+ name: translator
3
+ description: "Use this skill whenever intake for the harness (pitch, PRD, requirement, transcript, or any spec input) is in a non-English language and must be normalized to English BEFORE planning/building. The single language gate for the planner→generator→judge harness. Triggers on: \"translate this pitch\", \"normalize to English\", \"this requirement is in Vietnamese\", \"prepare intake for the harness\", \"make the spec English\", \"check if this is English\", and Vietnamese \"dịch sang tiếng Anh\", \"chuẩn hoá tiếng Anh\", \"dịch pitch\", \"chuyển yêu cầu sang tiếng Anh\". Produces faithful English copies (original never overwritten) plus a glossary and verification report. tech-lead auto-invokes it at GATE L0 when intake is non-English; also runs standalone."
4
+ ---
5
+
6
+ # Translator (harness language gate)
7
+
8
+ The one job upstream of the whole harness: **make the input English, faithfully, once.**
9
+ The harness is English-only end to end — the planner, generator, and judge all assume
10
+ English and HARD-FAIL on anything else. This skill is the single component that guarantees
11
+ that assumption holds. It is **not** a translator that rewrites; it normalizes language
12
+ while preserving every requirement, number, boundary, and structural element 1:1.
13
+
14
+ ```
15
+ PO writes intake (any language) → TRANSLATOR → <name>.en.md (English) → ba-pitch-analyzer → …
16
+ (this skill) + glossary.md + report
17
+ ```
18
+
19
+ **Scope is deliberately narrow (simplicity first):**
20
+ - ✅ Translate **input** docs (pitch / PRD / requirement / transcript) into English copies.
21
+ - ✅ Emit a persisted **glossary** so domain terms map consistently across docs and runs.
22
+ - ✅ **Verify** the output is English and structurally identical to the source.
23
+ - 🚫 Does NOT plan, build, or judge — that is the harness's job.
24
+ - 🚫 Does NOT translate harness **output** back to the PO's language (input-normalization only).
25
+ - 🚫 Does NOT summarize, add, drop, or "improve" content — faithful 1:1 only.
26
+
27
+ > **What is preserved verbatim vs translated, glossary protocol, verification scan**
28
+ > → `references/preservation-rules.md` — read it before translating any file.
29
+
30
+ ---
31
+
32
+ ## Workflow Overview
33
+
34
+ ```
35
+ INPUT: doc(s) in any language
36
+
37
+ ⏸ GATE T0 │ Detect & Scope ──────► per-file source-language detection; list files to
38
+ │ translate; already-English files → skipped (idempotent)
39
+
40
+ ▶ Phase 1 │ Glossary ────────────► extract domain terms + proper nouns + do-not-translate
41
+ │ tokens; map source→English; reuse existing glossary.md
42
+ ⏸ GATE T1 │ Glossary Review ──────► PO confirms term mappings; ambiguous terms resolved here
43
+ │ (never guessed). lite/auto: auto-proceed on unambiguous.
44
+
45
+ ▶ Phase 2 │ Translate ───────────► WRITE <name>.en.md (original untouched): prose → English,
46
+ │ glossary applied; frontmatter keys, wikilinks, code, URLs,
47
+ │ numbers preserved
48
+
49
+ ▶ Phase 3 │ Verify ──────────────► residual-non-English scan + structural diff (heading /
50
+ │ link / code-block / list-item counts must match source)
51
+ ⏸ GATE T2 │ Output Sign-off ──────► confirm clean scan + matching structure, then emit
52
+ │ glossary.md + translation-report.md (the .en.md is already
53
+ │ written in Phase 2)
54
+ ✅ Done └─► English intake ready for the harness
55
+ ```
56
+
57
+ ---
58
+
59
+ ## GATE T0 — Detect & Scope
60
+
61
+ **Purpose:** Decide what needs translating before spending tokens, and stay idempotent.
62
+
63
+ ```
64
+ T0.1 For each input file/path, detect source language (sample headings + body prose,
65
+ ignore code blocks / identifiers / URLs).
66
+ T0.2 Classify:
67
+ already-English → SKIP (no .en.md written; report it as pass-through)
68
+ non-English → queue for translation
69
+ mixed → queue; flag the English spans to keep verbatim
70
+ T0.3 In --check mode: print the classification table and STOP. Write nothing.
71
+ (This is the mode tech-lead calls at GATE L0 to decide whether to run a full pass.)
72
+ ```
73
+
74
+ **GATE T0 Output:**
75
+ ```
76
+ ⏸ GATE T0 — Detect & Scope
77
+ Files : [N] (translate: [k] · already-English: [N-k])
78
+ Source lang : [vi | mixed | …]
79
+ Glossary : [reuse docs/glossary.md | build new]
80
+ Mode : [full | --check (detect only)]
81
+ ```
82
+ Under `--check`: stop here. Otherwise proceed to Phase 1 (auto) or wait for confirm (interactive).
83
+
84
+ ---
85
+
86
+ ## Phase 1 — Glossary
87
+
88
+ **Goal:** One consistent English term per source term, across every doc and every run.
89
+ Inconsistent vocabulary is the failure that poisons downstream DDD extraction (the planner
90
+ treats two spellings as two concepts). Read `references/preservation-rules.md#Glossary` first.
91
+
92
+ ```
93
+ 1. Reuse: if a glossary.md exists (or --glossary <path> given), load it as the base map.
94
+ 2. Extract from the source: domain nouns, actor names, status/enum values, screen names,
95
+ feature jargon. Propose source→English for each new term.
96
+ 3. Mark do-not-translate tokens: proper nouns, brand/product names, code identifiers, API
97
+ names, env vars, file paths — these pass through verbatim (see preservation-rules).
98
+ 4. Flag ambiguous terms (one source word → multiple valid English terms) for GATE T1.
99
+ ```
100
+
101
+ **Output:** draft `glossary.md` (source term · English · note/do-not-translate flag).
102
+
103
+ ---
104
+
105
+ ## GATE T1 — Glossary Review
106
+
107
+ **Purpose:** Lock vocabulary with the PO before it propagates into every translated doc.
108
+
109
+ ```
110
+ Print the new/changed term rows + any ambiguous terms.
111
+ Ask (max 2): confirm the English term for each ambiguous entry; any term to force
112
+ verbatim (do-not-translate)?
113
+ ```
114
+ Never guess an ambiguous domain term — a wrong canonical term cascades into the spec.
115
+ `--auto` / `--lite`: auto-proceed when no term is ambiguous; if any is, still pause (a
116
+ wrong term is more expensive than a pause).
117
+
118
+ ---
119
+
120
+ ## Phase 2 — Translate
121
+
122
+ **Goal:** Faithful English copy. Read `references/preservation-rules.md` first.
123
+
124
+ ```
125
+ For each queued file, write <name>.en.md (sibling of the source; original untouched):
126
+ - Translate prose values only. Apply the glossary to every domain term.
127
+ - PRESERVE verbatim: YAML frontmatter KEYS, [[wikilink]] targets, `code`/```fenced```,
128
+ URLs, file paths, numbers, units, appetite/boundary values, do-not-translate tokens.
129
+ - Keep document structure 1:1: same headings, same table rows, same list items, same
130
+ order. No merging, no reordering, no summarizing.
131
+ - Mixed-language source: leave already-English spans as they are.
132
+ ```
133
+ Faithfulness rule: the `.en.md` must carry exactly the requirements of the source — nothing
134
+ added, nothing dropped, no editorializing. Translation ≠ rewriting.
135
+
136
+ ---
137
+
138
+ ## Phase 3 — Verify
139
+
140
+ **Goal:** Prove the output is English and structurally identical before sign-off.
141
+
142
+ ```
143
+ 3.1 Residual-non-English scan: scan every .en.md for source-language characters/words
144
+ outside code blocks / do-not-translate tokens. Any hit → list file:line, do NOT pass.
145
+ 3.2 Structural diff vs source: heading count, table-row count, list-item count, wikilink
146
+ count, code-block count must match. Mismatch → a requirement was dropped/added → fail.
147
+ 3.3 Glossary coverage: every extracted term resolved (no "⏳ TBD" left in glossary.md).
148
+ ```
149
+ A failing scan blocks GATE T2 — emit the residual list and fix before signing off.
150
+
151
+ ---
152
+
153
+ ## GATE T2 — Output Sign-off
154
+
155
+ ```
156
+ ⏸ GATE T2 — Output Sign-off
157
+ Translated : [k] files → <name>.en.md
158
+ Glossary : glossary.md ([t] terms, [a] resolved-ambiguous)
159
+ Residual scan: ✅ clean | 🔴 [n] non-English spans → [file:line …]
160
+ Structure : ✅ matches source | 🔴 [diff]
161
+ ```
162
+ On clean → `✅ Intake English-ready: [files]. Point the harness at the .en.md copies.`
163
+ Under `--auto`/`--unattended`: auto-sign-off only if the residual scan is clean; a dirty
164
+ scan always stops (never ship half-translated intake to the harness).
165
+
166
+ ---
167
+
168
+ ## Output files
169
+
170
+ | File | Purpose | Notes |
171
+ |------|---------|-------|
172
+ | `<name>.en.md` | The English copy the harness consumes | One per translated source; **original is never overwritten** |
173
+ | `glossary.md` | source→English term map | Persisted + reused; the shared vocabulary for this feature |
174
+ | `translation-report.md` | detect table, glossary diff, verification result | Audit trail; what was skipped/flagged |
175
+
176
+ **Destinations (two-root workspace).** `<name>.en.md` is always written as a sibling
177
+ of its source — when the source already lives under the SHARED root
178
+ `shapeup/<slug>/shaping/`, the copy lands there too. `glossary.md` is durable
179
+ shared vocabulary → write it to `shapeup/<slug>/shaping/glossary.md`.
180
+ `translation-report.md` is run-trace (audit) → write it to the LOCAL root
181
+ `.shapeup/<slug>/translation-report.md`. When run standalone on loose intake files
182
+ (no slug yet), all three default to siblings of the source.
183
+
184
+ ---
185
+
186
+ ## Envelope contract — the domain layer
187
+
188
+ Orchestrated, this skill is dispatched like every worker: a **WorkOrder** in (`--order <path>`,
189
+ operation `translate`), a **WorkResult** out. The standalone arguments below map 1:1 onto the
190
+ payload fields registered for this worker in the central domain registry
191
+ (`skills/tech-lead/schemas/domain.schema.json`, `x-payload-by-worker`):
192
+
193
+ | Payload field | Standalone form | Meaning |
194
+ |---|---|---|
195
+ | `payload.intake[]` | positional path(s) | Source docs to normalize to English — originals never overwritten |
196
+ | `payload.glossary` | `--glossary` | An existing `glossary.md` to reuse as the base term map |
197
+
198
+ The WorkResult may carry only `files_touched`, `artifacts`, `assumptions`, `deviations`
199
+ (`x-result-by-worker`): the `.en.md` copies, glossary, and verification report return as
200
+ `artifacts`; ambiguous-term resolutions made without a PO land in `assumptions`.
201
+
202
+ ---
203
+
204
+ ## Invocation
205
+
206
+ ```bash
207
+ # Translate one intake file → docs/pitch.en.md (+ glossary.md, translation-report.md)
208
+ /translator docs/pitch.md
209
+
210
+ # Translate a folder of intake docs (already-English files are skipped)
211
+ /translator docs/intake/
212
+
213
+ # Reuse / extend an existing glossary for consistent vocabulary across runs
214
+ /translator --glossary docs/glossary.md docs/pitch.md
215
+
216
+ # Detect-only: is this English? print the table and stop (what tech-lead L0 calls)
217
+ /translator --check docs/pitch.md
218
+
219
+ # Headless: skip gates; still HARD-STOPS on a dirty residual scan
220
+ /translator --auto docs/pitch.md
221
+ ```
222
+
223
+ ### Flags
224
+ | Flag | Effect |
225
+ |------|--------|
226
+ | `--check` | Detect source language and report; write nothing, stop at GATE T0 |
227
+ | `--glossary <path>` | Load an existing glossary as the base map (consistency across docs/runs) |
228
+ | `--auto` | Skip T0/T1 confirmation gates; still pauses on ambiguous terms + dirty scan |
229
+ | `--unattended` | Auto-sign-off all gates; stop only on a dirty residual scan or hard error |
230
+ | `--out <dir>` | Write `.en.md` copies into a target dir instead of beside the source |
231
+
232
+ ---
233
+
234
+ ## Hard Rules (never override without explicit user instruction)
235
+
236
+ | Rule | Rationale |
237
+ |------|-----------|
238
+ | Never overwrite the source; always write a `.en.md` copy | The PO still needs to read their original |
239
+ | Never summarize, add, or drop content — faithful 1:1 | The harness builds exactly what the spec says; drift here is silent scope change |
240
+ | Preserve frontmatter keys, wikilink targets, code, URLs, numbers verbatim | Structure is load-bearing for downstream parsing; translating it breaks the spec tree |
241
+ | One source term → one English term, via the glossary | Two spellings read as two concepts to the planner's DDD pass |
242
+ | Ambiguous term → ask at GATE T1, never guess | A wrong canonical term cascades into every doc and every build round |
243
+ | Already-English input → no-op (idempotent) | Re-runs and `--check` must be safe and cheap |
244
+ | Dirty residual scan blocks sign-off, even under `--auto` | Half-translated intake makes the harness HARD-FAIL mid-run — worse than stopping here |
245
+ | Input-normalization only — never translate harness output back | This is the upstream gate; output language is a separate, out-of-scope concern |
246
+
247
+ ---
248
+
249
+ ## Relationship to the harness
250
+
251
+ ```
252
+ TRANSLATOR (this skill) → ba-pitch-analyzer (PLAN) → task-executor (BUILD) → spec-evaluator (JUDGE)
253
+ language gate English-only specs English-only code English-only verdict
254
+ ```
255
+ - The harness is **English-only end to end**; the downstream skills HARD-FAIL on non-English.
256
+ - `tech-lead` does **not** translate — at GATE L0 it runs `/translator --check`, and if intake
257
+ is non-English it runs a full `/translator` pass first, then orchestrates against the `.en.md`
258
+ copies. Orchestration and language normalization are separate single-purpose concerns.
@@ -0,0 +1,102 @@
1
+ # Preservation Rules
2
+
3
+ What the translator touches, what it must never touch, and how it proves the result.
4
+ Read this before translating any file. The governing principle: **translate meaning,
5
+ preserve everything that machines parse.** A `.en.md` that reads well but breaks the spec
6
+ tree's wikilinks or drops a table row is a failed translation.
7
+
8
+ ---
9
+
10
+ ## 1. Translate vs preserve verbatim
11
+
12
+ | Element | Action | Why |
13
+ |---------|--------|-----|
14
+ | Prose, headings (text), table cell text, list items | **Translate** | The human-readable content the harness reasons over |
15
+ | YAML frontmatter **keys** (`appetite:`, `lens:`, `feature:`) | **Preserve** | Parsed by downstream skills; translating a key breaks the schema |
16
+ | YAML frontmatter **values** that are prose | Translate | e.g. a description value |
17
+ | YAML frontmatter **values** that are enums/slugs/IDs (`lens: standard`, `feature: checkout-vnpay`) | **Preserve** | Machine-matched; must stay byte-identical |
18
+ | `[[wikilink]]` targets | **Preserve** | They resolve to filenames; translating breaks the graph. (A wikilink *alias* shown to humans may be translated: `[[UC-Login\|đăng nhập]]` → `[[UC-Login\|log in]]`) |
19
+ | `` `inline code` `` and ```` ```fenced``` ```` blocks | **Preserve** | Code, identifiers, commands — not natural language |
20
+ | Code identifiers, type names, API names, env vars, file paths | **Preserve** | `UserRepository`, `VNPAY_SECRET`, `src/modules/canvas/` stay as-is |
21
+ | URLs | **Preserve** | Links, not prose |
22
+ | Numbers, units, currency, dates, appetite/boundary values | **Preserve** | `~3 tuần` → translate the unit word only if prose (`~3 weeks`); never alter the number |
23
+ | Proper nouns / brand / product names | **Preserve** (unless an established English name exists) | VNPAY, Supabase, ReactFlow |
24
+
25
+ **Mixed-language source:** leave already-English spans exactly as written. Do not
26
+ "re-translate" English into different English.
27
+
28
+ ---
29
+
30
+ ## 2. Structure is 1:1
31
+
32
+ The `.en.md` must mirror the source's structure exactly:
33
+
34
+ - Same number of headings, at the same levels, in the same order.
35
+ - Same number of table rows and columns.
36
+ - Same number of list items and nesting.
37
+ - Same number of code blocks and wikilinks.
38
+ - No merging paragraphs, no reordering sections, no "tightening" prose.
39
+
40
+ Rationale: the planner extracts boundaries, rabbit holes, and breadboard elements
41
+ positionally and by count. Dropping or fusing items is silent scope change — the single
42
+ most dangerous failure mode of a translation step.
43
+
44
+ ---
45
+
46
+ ## 3. Glossary protocol
47
+
48
+ A `glossary.md` is the contract that keeps one source term mapped to one English term across
49
+ every doc and every run. Without it, "phiếu giảm giá" becomes "voucher" in one file and
50
+ "discount coupon" in another, and the planner's DDD pass sees two aggregates.
51
+
52
+ **Format** (`glossary.md`):
53
+
54
+ ```markdown
55
+ # Glossary — <feature-slug>
56
+
57
+ | Source term | English | Note |
58
+ |-------------|---------|------|
59
+ | phiếu giảm giá | voucher | domain noun — aggregate candidate |
60
+ | người dùng | user | actor |
61
+ | VNPAY | VNPAY | do-not-translate (brand) |
62
+ | đơn hàng | order | domain noun |
63
+ ```
64
+
65
+ **Rules:**
66
+ - Reuse an existing glossary (`--glossary <path>`) as the base — extend, don't replace.
67
+ - One source term → exactly one English term. If the source uses a term two ways, that is
68
+ an **ambiguity** → resolve at GATE T1, then record both senses as distinct rows with notes.
69
+ - `do-not-translate` rows pin proper nouns / identifiers that must pass through verbatim.
70
+ - No `⏳ TBD` may remain at sign-off — every extracted term is resolved (Phase 3.3).
71
+
72
+ ---
73
+
74
+ ## 4. Verification scan (Phase 3)
75
+
76
+ Three checks, all must pass before GATE T2 sign-off:
77
+
78
+ 1. **Residual-non-English scan.** Scan each `.en.md` for source-language characters or words
79
+ *outside* code blocks and do-not-translate tokens. For Vietnamese: diacritic ranges
80
+ (à á ả ã ạ â ầ … đ …) and common function words (và, của, người, là, được, …). Any hit →
81
+ report `file:line` + the span. Does NOT pass with residuals.
82
+ 2. **Structural diff vs source.** Compare counts: headings, table rows, list items,
83
+ wikilinks, code blocks. Any mismatch → a requirement was added or dropped → fail.
84
+ 3. **Glossary coverage.** Every term extracted in Phase 1 appears resolved in `glossary.md`.
85
+
86
+ A failing scan blocks sign-off even under `--auto`/`--unattended` — half-translated intake
87
+ makes the harness HARD-FAIL mid-run, which is worse and more expensive than stopping here.
88
+
89
+ ---
90
+
91
+ ## 5. Faithfulness (the non-negotiable)
92
+
93
+ Translation is **not** an editing pass. The `.en.md` carries exactly the requirements of the
94
+ source:
95
+
96
+ - ❌ Do not add clarifications, assumptions, or "missing" requirements (that is the planner's
97
+ GATE 0 job, downstream).
98
+ - ❌ Do not drop content that seems redundant or unclear — translate it faithfully and let
99
+ the planner flag it.
100
+ - ❌ Do not summarize or shorten.
101
+ - ✅ If a source sentence is genuinely ambiguous to translate, keep the most literal English
102
+ rendering and note it in `translation-report.md` for the PO — never silently pick a meaning.