universal-dev-standards 5.14.0 → 5.15.1

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 (71) hide show
  1. package/bin/uds.js +2 -0
  2. package/bundled/ai/standards/ai-instruction-standards.ai.yaml +190 -3
  3. package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +83 -0
  4. package/bundled/core/ai-instruction-standards.md +136 -11
  5. package/bundled/core/knowledge-graph-memory.md +119 -0
  6. package/bundled/locales/COVERAGE.md +226 -0
  7. package/bundled/locales/zh-CN/CHANGELOG.md +32 -3
  8. package/bundled/locales/zh-CN/README.md +1 -1
  9. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  10. package/bundled/locales/zh-CN/core/ai-instruction-standards.md +111 -5
  11. package/bundled/locales/zh-TW/CHANGELOG.md +36 -3
  12. package/bundled/locales/zh-TW/README.md +1 -1
  13. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  14. package/bundled/locales/zh-TW/core/ai-instruction-standards.md +130 -5
  15. package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +127 -0
  16. package/bundled/locales/zh-TW/core/self-review-protocol.md +9 -1
  17. package/bundled/locales/zh-TW/skills/ac-coverage/SKILL.md +192 -0
  18. package/bundled/locales/zh-TW/skills/ai-collaboration-standards/SKILL.md +5 -1
  19. package/bundled/locales/zh-TW/skills/deploy-assistant/SKILL.md +187 -0
  20. package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +108 -0
  21. package/bundled/locales/zh-TW/skills/journey-test-assistant/SKILL.md +222 -0
  22. package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +56 -0
  23. package/bundled/locales/zh-TW/skills/orchestrate/SKILL.md +172 -0
  24. package/bundled/locales/zh-TW/skills/plan/SKILL.md +239 -0
  25. package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +5 -1
  26. package/bundled/locales/zh-TW/skills/push/SKILL.md +241 -0
  27. package/bundled/locales/zh-TW/skills/skill-builder/SKILL.md +165 -0
  28. package/bundled/locales/zh-TW/skills/spec-derivation/SKILL.md +83 -0
  29. package/bundled/locales/zh-TW/skills/sweep/SKILL.md +149 -0
  30. package/bundled/skills/adr-assistant/SKILL.md +1 -1
  31. package/bundled/skills/ai-collaboration-standards/SKILL.md +1 -1
  32. package/bundled/skills/ai-friendly-architecture/SKILL.md +1 -1
  33. package/bundled/skills/ai-instruction-standards/SKILL.md +1 -1
  34. package/bundled/skills/api-design-assistant/SKILL.md +1 -1
  35. package/bundled/skills/audit-assistant/SKILL.md +1 -1
  36. package/bundled/skills/ci-cd-assistant/SKILL.md +1 -1
  37. package/bundled/skills/contract-test-assistant/SKILL.md +1 -1
  38. package/bundled/skills/database-assistant/SKILL.md +1 -1
  39. package/bundled/skills/deploy-assistant/SKILL.md +1 -1
  40. package/bundled/skills/documentation-guide/SKILL.md +1 -1
  41. package/bundled/skills/error-code-guide/SKILL.md +1 -1
  42. package/bundled/skills/git-workflow-guide/SKILL.md +1 -1
  43. package/bundled/skills/incident-response-assistant/SKILL.md +1 -1
  44. package/bundled/skills/journey-test-assistant/SKILL.md +1 -1
  45. package/bundled/skills/knowledge-graph/SKILL.md +58 -0
  46. package/bundled/skills/knowledge-graph/guide.md +69 -0
  47. package/bundled/skills/logging-guide/SKILL.md +1 -1
  48. package/bundled/skills/observability-assistant/SKILL.md +1 -1
  49. package/bundled/skills/orchestrate/SKILL.md +1 -1
  50. package/bundled/skills/plan/SKILL.md +1 -1
  51. package/bundled/skills/pr-automation-assistant/SKILL.md +1 -1
  52. package/bundled/skills/project-structure-guide/SKILL.md +1 -1
  53. package/bundled/skills/push/SKILL.md +1 -1
  54. package/bundled/skills/retrospective-assistant/SKILL.md +1 -1
  55. package/bundled/skills/reverse-engineer/SKILL.md +1 -1
  56. package/bundled/skills/runbook-assistant/SKILL.md +1 -1
  57. package/bundled/skills/security-assistant/SKILL.md +1 -1
  58. package/bundled/skills/security-scan-assistant/SKILL.md +1 -1
  59. package/bundled/skills/slo-assistant/SKILL.md +1 -1
  60. package/bundled/skills/sweep/SKILL.md +1 -1
  61. package/bundled/skills/testing-guide/SKILL.md +1 -1
  62. package/package.json +1 -1
  63. package/src/commands/check.js +71 -0
  64. package/src/commands/init.js +8 -1
  65. package/src/commands/update.js +49 -14
  66. package/src/i18n/messages.js +32 -5
  67. package/src/installers/skills-installer.js +49 -0
  68. package/src/lint/i18n.js +338 -0
  69. package/src/utils/config-manager.js +39 -0
  70. package/src/utils/skills-installer.js +39 -7
  71. package/standards-registry.json +16 -4
package/bin/uds.js CHANGED
@@ -175,6 +175,7 @@ program
175
175
  .option('--migrate', 'Migrate legacy manifest to hash-based tracking')
176
176
  .option('--offline', 'Skip npm registry check for CLI updates')
177
177
  .option('--force', 'Bypass UDS source-repo self-adoption guard (DEC-044 / XSPEC-071)')
178
+ .option('--i18n', 'Run i18n lint rules (XSPEC-239) across canonical + locale variants')
178
179
  .action(checkCommand);
179
180
 
180
181
  program
@@ -207,6 +208,7 @@ program
207
208
  .option('--plan', 'Show reconciliation plan without executing (like terraform plan)')
208
209
  .option('--force', 'Force update all files, ignoring hash comparison')
209
210
  .option('--rollback', 'Rollback to the most recent backup')
211
+ .option('--locale <locale>', 'Override locale for skills install (zh-tw, zh-cn, en); also reads .uds/install.yaml + UDS_LOCALE env')
210
212
  .action(updateCommand);
211
213
 
212
214
  program
@@ -3,10 +3,10 @@
3
3
 
4
4
  id: ai-instruction-standards
5
5
  meta:
6
- version: "1.0.0"
7
- updated: "2026-01-14"
6
+ version: "1.1.0"
7
+ updated: "2026-05-28"
8
8
  source: core/ai-instruction-standards.md
9
- description: Best practices for creating AI instruction files with universal vs project-specific separation
9
+ description: Best practices for creating AI instruction files (root and skill level) with universal/project-specific separation and i18n strategy
10
10
 
11
11
  supported_tools:
12
12
  - tool: Claude Code
@@ -117,6 +117,26 @@ rules:
117
117
  grep -n "npm\|yarn\|pip\|cargo" CLAUDE.md | head -20
118
118
  priority: required
119
119
 
120
+ - id: i18n-canonical-english-only
121
+ trigger: editing canonical AI instruction file
122
+ instruction: Keep description and metadata in English; localize via locales/{lang}/ variants
123
+ priority: required
124
+
125
+ - id: i18n-locale-must-match-language
126
+ trigger: creating or editing locale variant
127
+ instruction: Description must be in the locale's language; include source/source_version/translation_version frontmatter
128
+ priority: required
129
+
130
+ - id: i18n-l3-template-language-controls-output
131
+ trigger: writing output templates / examples
132
+ instruction: L3 templates determine AI output language; localize L3 in locale variants, never in canonical
133
+ priority: required
134
+
135
+ - id: i18n-no-manual-canonical-edits-by-adopters
136
+ trigger: adopter wants to customize an installed instruction file
137
+ instruction: Use uds install --locale or overlays; do not modify canonical files in-place
138
+ priority: required
139
+
120
140
  maintenance_checklist:
121
141
  - item: Universal sections contain no project-specific paths, commands, or versions
122
142
  required: true
@@ -127,6 +147,173 @@ maintenance_checklist:
127
147
  - item: Format matches existing sections
128
148
  required: true
129
149
 
150
+ i18n:
151
+ scope:
152
+ description: |
153
+ Defines language-handling policy for AI instruction files at two levels:
154
+ root-level (CLAUDE.md, .cursorrules, etc.) and skill-level
155
+ (Claude Code SKILL.md, OpenCode plugin instructions, etc.)
156
+ levels:
157
+ - level: root
158
+ files:
159
+ - CLAUDE.md
160
+ - .cursorrules
161
+ - .windsurfrules
162
+ - .clinerules
163
+ - .github/copilot-instructions.md
164
+ - .opencode/instructions.md
165
+ i18n_pattern: single_file_with_inline_language_sections
166
+ - level: skill
167
+ files:
168
+ - .claude/skills/{name}/SKILL.md
169
+ - .opencode/plugins/{name}/instructions.md
170
+ i18n_pattern: canonical_plus_locale_variants
171
+
172
+ layered_strategy:
173
+ description: |
174
+ Every AI instruction file has 4 layers. L3 (output templates) is the only
175
+ layer that directly affects AI output language; L1/L2 are processing
176
+ instructions for the AI. Enforce L3 strictly, L1 as a clear convention.
177
+ layers:
178
+ - id: L1
179
+ name: metadata
180
+ content:
181
+ - YAML frontmatter description
182
+ - argument-hint
183
+ - allowed-tools
184
+ canonical_language: english
185
+ locale_language: must_match_locale
186
+ rationale: AI-trigger signal; English has highest training-data density and token efficiency
187
+ impact_on_ai_output: none
188
+ - id: L2
189
+ name: instructions
190
+ content:
191
+ - imperative rules for AI
192
+ - steps
193
+ - behavior rules
194
+ canonical_language: english
195
+ locale_language: locale_optional
196
+ rationale: AI reads English instructions most precisely
197
+ impact_on_ai_output: none
198
+ - id: L3
199
+ name: output_templates
200
+ content:
201
+ - example outputs
202
+ - response format templates
203
+ - scenario examples
204
+ canonical_language: english
205
+ locale_language: must_match_locale_mandatory
206
+ rationale: AI mirrors the language of templates it sees — this is the only layer that controls output language
207
+ impact_on_ai_output: direct
208
+ - id: L4
209
+ name: human_docs
210
+ content:
211
+ - maintainer comments
212
+ - contributor walkthroughs
213
+ canonical_language: english
214
+ locale_language: locale_recommended
215
+ rationale: Read by human maintainers, not by AI
216
+ impact_on_ai_output: none
217
+
218
+ file_structure:
219
+ canonical:
220
+ - core/{name}.md
221
+ - core/{name}.ai.yaml
222
+ - skills/{name}/SKILL.md
223
+ locale:
224
+ - locales/{lang}/core/{name}.md
225
+ - locales/{lang}/ai/standards/{name}.ai.yaml
226
+ - locales/{lang}/skills/{name}/SKILL.md
227
+ locale_naming: BCP_47 # zh-TW, zh-CN, ja, ko, en-US, etc.
228
+
229
+ locale_variant_frontmatter:
230
+ required_fields:
231
+ - field: name
232
+ value: same as canonical
233
+ - field: source
234
+ value: relative path to canonical file
235
+ - field: source_version
236
+ value: version of canonical at time of translation
237
+ - field: translation_version
238
+ value: version of this translation
239
+ drift_alert:
240
+ condition: source_version gap > 2 minor versions behind canonical
241
+ severity: warn
242
+
243
+ responsibility_boundaries:
244
+ - role: canonical_owner
245
+ owns:
246
+ - core/{name}.md
247
+ - core/{name}.ai.yaml
248
+ - skills/{name}/SKILL.md
249
+ duties:
250
+ - Keep L1/L2/L3/L4 in English
251
+ - Bump source_version on every breaking change
252
+ - role: locale_maintainer
253
+ owns:
254
+ - locales/{lang}/...
255
+ duties:
256
+ - Keep translation_version aligned with source_version
257
+ - Translate L1 (required), L2 (optional), L3 (required), L4 (recommended)
258
+ - role: adopter
259
+ owns:
260
+ - their own .claude/skills/, CLAUDE.md
261
+ duties:
262
+ - Install via uds install --locale {lang}
263
+ - Never manually modify canonical files
264
+ - Use overlays or locale variants for customization
265
+
266
+ chimera_prevention:
267
+ rules:
268
+ - id: canonical-description-must-be-ascii
269
+ trigger: canonical file with CJK in description field
270
+ severity: error
271
+ instruction: Canonical files must keep description in English; move localized description to locale variant
272
+ - id: locale-description-must-match-language
273
+ trigger: locale variant with ASCII-only description
274
+ severity: error
275
+ instruction: Locale variant description must use the locale's language
276
+ - id: locale-must-have-source-frontmatter
277
+ trigger: locale variant missing source/source_version/translation_version
278
+ severity: error
279
+ instruction: Add traceability frontmatter pointing to canonical
280
+ - id: canonical-l3-language-consistency
281
+ trigger: canonical L3 output template contains non-English example
282
+ severity: warn
283
+ instruction: Localize L3 templates in locale variants, not canonical
284
+ - id: adopter-must-match-installed-locale
285
+ trigger: adopter file in .claude/skills/ differs from both canonical and any locale variant
286
+ severity: warn
287
+ instruction: Use uds install --locale or overlays instead of manual canonical edits
288
+ - id: translation-drift-warn
289
+ trigger: translation_version lag > 2 minor versions behind source_version
290
+ severity: warn
291
+ instruction: Re-sync translation from current canonical version
292
+
293
+ installation_model:
294
+ cli: uds install --locale {lang}
295
+ locale_resolution_priority:
296
+ - --locale CLI flag
297
+ - .uds/install.yaml locale field
298
+ - environment variable UDS_LOCALE
299
+ - fallback to en
300
+ missing_locale_behavior:
301
+ action: fallback_to_canonical_with_warn
302
+ block_install: false
303
+ coverage_visibility: locales/COVERAGE.md
304
+
305
+ migration:
306
+ name: adopter_chimera_cleanup
307
+ steps:
308
+ - id: identify
309
+ description: Compare adopter files against UDS canonical and locale variants
310
+ - id: install_proper_variants
311
+ description: Run uds install --locale {lang} to replace chimera
312
+ - id: preserve_legitimate_customization
313
+ description: Extract project-specific (non-translation) customization into overlay or UDS-CUSTOMIZATION.md
314
+ - id: discard_pure_translations
315
+ description: Chimera changes that were only translations are superseded by locale variants
316
+
130
317
  quick_reference:
131
318
  content_types:
132
319
  columns: [Type, Contains, Example]
@@ -0,0 +1,83 @@
1
+ # Knowledge Graph Memory Standards - AI Optimized
2
+ # Source: core/knowledge-graph-memory.md
3
+
4
+ standard:
5
+ id: knowledge-graph-memory
6
+ name: Knowledge Graph Memory Standards
7
+ description: Relationship schema for traversing specs, decisions, and code as a graph; complements vector memory with structural multi-hop queries, engine-optional with Markdown degradation
8
+ guidelines:
9
+ - "Express relationships as optional, additive YAML front-matter (related/impacts/impacted_by/supersedes/implements)"
10
+ - "Derive IMPACTS (Decision->Spec) and SUPERSEDES (Decision->Decision) edges from front-matter or [[ref]] links"
11
+ - "Support two modes: degraded (AI reads linked Markdown) and service (graph engine multi-hop query) with the same answer shape"
12
+ - "Keep the graph engine opt-in; always degrade gracefully to Markdown reading"
13
+ - "Treat vector/semantic memory as complementary (similarity) to graph traversal (structure), not replaced"
14
+
15
+ meta:
16
+ version: "1.0.0"
17
+ updated: "2026-05-30"
18
+ source: core/knowledge-graph-memory.md
19
+ description: Relationship schema for traversing specs, decisions, and code as a graph; complements vector memory with structural multi-hop queries, engine-optional with Markdown degradation
20
+
21
+ schema:
22
+ format: "YAML front-matter on spec/decision Markdown documents"
23
+ optional_fields:
24
+ - field: related
25
+ type: list
26
+ direction: undirected
27
+ description: "Loosely associated artifact ids"
28
+ - field: impacts
29
+ type: list
30
+ direction: "this(Decision) -> Spec"
31
+ description: "Specs this decision changes"
32
+ - field: impacted_by
33
+ type: list
34
+ direction: "Decision -> this(Spec)"
35
+ description: "Decisions that change this spec"
36
+ - field: supersedes
37
+ type: list
38
+ direction: "this(Decision) -> Decision"
39
+ description: "Decisions this one replaces"
40
+ - field: implements
41
+ type: list
42
+ direction: "code/spec -> Spec"
43
+ description: "Specs this artifact realises"
44
+ node_kinds:
45
+ - prefix: "XSPEC-* / SPEC-*"
46
+ kind: Spec
47
+ - prefix: "DEC-* / ADR-*"
48
+ kind: Decision
49
+ - prefix: "function / class / module"
50
+ kind: Code
51
+
52
+ edges:
53
+ - rule: "Decision impacts:[SPEC] => IMPACTS (Decision -> Spec)"
54
+ - rule: "Spec impacted_by:[DEC] => IMPACTS (Decision -> Spec)"
55
+ - rule: "Decision supersedes:[DEC] => SUPERSEDES (Decision -> Decision)"
56
+ - rule: "[[XSPEC-NNN]] link in a Decision body => IMPACTS (Decision -> Spec)"
57
+ idempotent: "Declaring a relationship from both ends yields one edge, not two"
58
+
59
+ modes:
60
+ degraded:
61
+ description: "No engine: AI reads the target doc, follows front-matter/[[ref]] links by reading files, assembles the chain manually"
62
+ always_available: true
63
+ service:
64
+ description: "Graph engine indexed: a single multi-hop query (impact-analysis {nodeId, maxHops}) returns the full cross-domain chain"
65
+ example_engine: "CodeSage (@asiaostrich/codesage)"
66
+
67
+ confidence:
68
+ optional: true
69
+ range: "0.1 - 1.0"
70
+ floor: 0.1
71
+ note: "Feedback signals (test pass/fail, human correction, status change) evolve confidence; floor prevents erasing important nodes (SAGE)"
72
+
73
+ rules:
74
+ - "Relationship fields are optional and additive; absence never breaks tooling"
75
+ - "Reference ids that do not exist yet become stub nodes, resolved when the target appears"
76
+ - "Declare each relationship from the owning side, but accept either"
77
+ - "Graph engine is opt-in; degrade gracefully to Markdown reading"
78
+ - "Vector/semantic memory is complementary, not replaced"
79
+
80
+ related_standards:
81
+ - project-context-memory
82
+ - developer-memory
83
+ - adr-standards
@@ -2,8 +2,8 @@
2
2
 
3
3
  > **Language**: English | [繁體中文](../locales/zh-TW/core/ai-instruction-standards.md) | [简体中文](../locales/zh-CN/core/ai-instruction-standards.md)
4
4
 
5
- **Version**: 1.0.0
6
- **Last Updated**: 2026-01-14
5
+ **Version**: 1.1.0
6
+ **Last Updated**: 2026-05-28
7
7
  **Applicability**: All projects using AI coding assistants
8
8
  **Scope**: partial
9
9
  **Industry Standards**: None (Emerging AI tool practice)
@@ -12,20 +12,20 @@
12
12
 
13
13
  ## Purpose
14
14
 
15
- This standard defines best practices for creating and maintaining AI instruction files (also known as "system prompt files"). These files guide AI assistants in understanding project-specific conventions, standards, and workflows.
15
+ This standard defines best practices for creating and maintaining AI instruction files (also known as "system prompt files"). These files guide AI assistants in understanding project-specific conventions, standards, and workflows. This v1.1.0 extends scope to skill-level instruction files (SKILL.md) and adds i18n strategy.
16
16
 
17
17
  ---
18
18
 
19
19
  ## Supported AI Tools
20
20
 
21
- | AI Tool | Instruction File | Format |
22
- |---------|-----------------|--------|
23
- | Claude Code | `CLAUDE.md` | Markdown |
24
- | Cursor | `.cursorrules` | Markdown |
25
- | Windsurf | `.windsurfrules` | Markdown |
26
- | Cline | `.clinerules` | Markdown |
27
- | GitHub Copilot | `.github/copilot-instructions.md` | Markdown |
28
- | OpenCode | `.opencode/instructions.md` | Markdown |
21
+ | AI Tool | Instruction File | Format | Skill-Level Instruction |
22
+ |---------|-----------------|--------|------------------------|
23
+ | Claude Code | `CLAUDE.md` | Markdown | `.claude/skills/{name}/SKILL.md` |
24
+ | Cursor | `.cursorrules` | Markdown | n/a |
25
+ | Windsurf | `.windsurfrules` | Markdown | n/a |
26
+ | Cline | `.clinerules` | Markdown | n/a |
27
+ | GitHub Copilot | `.github/copilot-instructions.md` | Markdown | n/a |
28
+ | OpenCode | `.opencode/instructions.md` | Markdown | n/a |
29
29
 
30
30
  ---
31
31
 
@@ -145,6 +145,130 @@ Use clear markers to distinguish content types:
145
145
 
146
146
  ---
147
147
 
148
+ ## Internationalization (i18n)
149
+
150
+ AI instruction files often need to be available in multiple languages — both for international adopters and for projects with non-English-speaking maintainers. This section defines how to organize, validate, and install multi-language instruction files.
151
+
152
+ ### Scope of AI Instruction Files
153
+
154
+ This standard covers instruction files at two levels:
155
+
156
+ | Level | Examples | i18n Pattern |
157
+ |-------|----------|--------------|
158
+ | **Root-level** | `CLAUDE.md`, `.cursorrules`, `.windsurfrules`, `.opencode/instructions.md` | Single file with inline language sections (e.g., `## 中文` / `## English`) |
159
+ | **Skill-level** | Claude Code `.claude/skills/{name}/SKILL.md`, OpenCode plugin instructions | Canonical (English) + `locales/{lang}/` variants |
160
+
161
+ > Note: skill-level multi-file structure is most relevant to Claude Code. Other tools use single root files; for them, only the layered language strategy (below) and the chimera-prevention rules apply.
162
+
163
+ ### Layered Language Strategy
164
+
165
+ Every AI instruction file conceptually has **four layers**, each with different language responsibilities:
166
+
167
+ | Layer | Content | Canonical (en) | Locale ({lang}) | Why |
168
+ |-------|---------|---------------|----------------|-----|
169
+ | **L1 — Metadata** | YAML frontmatter `description`, `argument-hint`, `allowed-tools` | **Must be English** | **Must match locale** | AI-trigger signal; English has highest training-data density and token efficiency |
170
+ | **L2 — Instructions** | Imperative rules for the AI (steps, behavior, allowed-tools rationale) | **Must be English** | Locale language (optional; may stay English) | AI reads English instructions most precisely; locale only useful if maintainers need to read instructions in their language |
171
+ | **L3 — Output Templates** | Example outputs, response formats, scenario templates | English (locale-pinned to English in canonical) | **Mandatory locale match** | **Only layer that directly controls AI output language** — AI inherits the language of templates it sees |
172
+ | **L4 — Human Docs** | Comments for maintainers, walkthroughs, contributor notes | English | Locale language (strongly recommended) | Read by human maintainers, not by AI |
173
+
174
+ **Critical insight**: L1 (description) is the trigger signal AI uses to decide *whether to invoke* a skill — it does **not** affect what the AI says afterwards. L3 (output templates) is the only layer that controls AI output language, because AI mirrors the language of templates it sees. **i18n enforcement should focus on L3 — strengthening L1 enforcement is a common mistake that solves the wrong problem.**
175
+
176
+ ### Canonical / Locale File Structure
177
+
178
+ For UDS standards and skills with locale variants:
179
+
180
+ ```text
181
+ core/{name}.md ← canonical (English) — single source of truth
182
+ core/{name}.ai.yaml ← canonical structured (English)
183
+ locales/{lang}/core/{name}.md ← locale variant (matches lang)
184
+ locales/{lang}/ai/standards/{name}.ai.yaml ← locale .ai.yaml (matches lang)
185
+ skills/{name}/SKILL.md ← canonical skill (English)
186
+ locales/{lang}/skills/{name}/SKILL.md ← locale skill variant
187
+ ```
188
+
189
+ **Naming convention**: use BCP 47 language tags — `zh-TW`, `zh-CN`, `ja`, `ko`, `en-US`, etc.
190
+
191
+ ### Locale Variant Frontmatter Requirements
192
+
193
+ Every locale variant must include traceability frontmatter so drift can be detected:
194
+
195
+ ```yaml
196
+ ---
197
+ name: {same name as canonical}
198
+ source: {relative path back to canonical}
199
+ source_version: {version of canonical at time of translation}
200
+ translation_version: {version of this translation}
201
+ ---
202
+ ```
203
+
204
+ When canonical is updated (bumping `source_version`), locale maintainers should re-sync and bump `translation_version`. A `source_version` gap of more than 2 minor versions triggers a drift warning (see Chimera Prevention).
205
+
206
+ ### Responsibility Boundaries
207
+
208
+ | Role | Owns | Must do |
209
+ |------|------|---------|
210
+ | **Canonical owner** | `core/{name}.md`, `core/{name}.ai.yaml`, `skills/{name}/SKILL.md` | Keep L1/L2/L3/L4 in English; bump `source_version` on every breaking change |
211
+ | **Locale maintainer** | `locales/{lang}/...` files | Keep `translation_version` aligned with `source_version`; translate L1 (required) / L2 (optional) / L3 (required) / L4 (recommended) |
212
+ | **Adopter (downstream project)** | Their own `.claude/skills/`, `CLAUDE.md`, etc. | Install via `uds install --locale {lang}`; **never** manually modify canonical files (always edit locale variants or use overlays) |
213
+
214
+ ### Chimera Prevention
215
+
216
+ A **chimera** is a file that mixes languages in violation of layer rules. Common chimera patterns:
217
+
218
+ | Pattern | Severity | Detection |
219
+ |---------|----------|-----------|
220
+ | Canonical file with CJK in `description` field | ❌ Error | Lint: `canonical:description-must-be-ascii` |
221
+ | Locale variant with ASCII-only `description` field | ❌ Error | Lint: `locale:description-must-match-language` |
222
+ | Locale variant missing `source:` frontmatter | ❌ Error | Lint: `locale:must-have-source-frontmatter` |
223
+ | Canonical L3 output template containing non-English example response | ⚠️ Warn | Lint: `canonical:l3-language-consistency` |
224
+ | Adopter file in `.claude/skills/` differs from both canonical and any locale variant | ⚠️ Warn | Sync check: `adopter:must-match-installed-locale` |
225
+ | `translation_version` lag > 2 minor versions behind `source_version` | ⚠️ Warn | Drift check |
226
+
227
+ Pre-commit / CI lint should enforce error-level rules; warn-level rules surface in dashboards but don't block.
228
+
229
+ ### Adopter Installation Model
230
+
231
+ Adopters install instruction files via the UDS CLI:
232
+
233
+ ```bash
234
+ uds install --locale zh-TW # install skills + standards in Traditional Chinese
235
+ ```
236
+
237
+ **Locale resolution order**:
238
+ 1. `--locale` CLI flag (highest priority)
239
+ 2. `.uds/install.yaml` field `locale:`
240
+ 3. Environment variable `UDS_LOCALE`
241
+ 4. Fallback: `en`
242
+
243
+ **Missing locale fallback**: when a requested locale variant doesn't exist for a specific skill, the CLI:
244
+ - Installs the canonical (English) file
245
+ - Emits a WARN listing skills that fell back
246
+ - Does **not** block installation
247
+
248
+ This keeps installation usable for adopters even when locale coverage is incomplete. Adopters can consult `locales/COVERAGE.md` for the canonical list of what is and isn't translated.
249
+
250
+ ### Migration: Adopters With Existing Chimera
251
+
252
+ If an adopter has already manually modified canonical files in their project (e.g. translated descriptions in `.claude/skills/`):
253
+
254
+ 1. **Identify the chimera**: compare adopter files against UDS canonical and canonical's locale variants.
255
+ 2. **Install proper variants**: run `uds install --locale {lang}` to replace chimera files with locale variants.
256
+ 3. **Preserve project-specific customization**: if the chimera contained legitimate project-specific customization (not just translation), extract it into an overlay or document it in the adopter's customization log (e.g. `UDS-CUSTOMIZATION.md`).
257
+ 4. **Discard pure translations**: chimera changes that were only translations should be discarded — the proper locale variant supersedes them.
258
+
259
+ ### Quick Reference
260
+
261
+ | Action | When | Tool / File |
262
+ |--------|------|-------------|
263
+ | Add new language | Want to support a new locale | Create `locales/{lang}/...` mirroring canonical structure |
264
+ | Update canonical | Improving English source | Bump `source_version`; notify locale maintainers |
265
+ | Translate / sync locale | Adding or updating locale content | Bump `translation_version`; reference current `source_version` |
266
+ | Check coverage | Periodic review | View auto-generated `locales/COVERAGE.md` |
267
+ | Install with locale | Adopter setup or re-sync | `uds install --locale {lang}` |
268
+ | Lint i18n rules | Before commit / in CI | `uds lint --i18n` |
269
+
270
+ ---
271
+
148
272
  ## Maintenance Checklist
149
273
 
150
274
  Before committing changes to AI instruction files:
@@ -199,6 +323,7 @@ Review each match to ensure it's in a project-specific section.
199
323
  | Version | Date | Changes |
200
324
  |---------|------|---------|
201
325
  | 1.0.0 | 2026-01-14 | Initial release |
326
+ | 1.1.0 | 2026-05-28 | Add i18n section; extend scope to skill-level files |
202
327
 
203
328
  ---
204
329
 
@@ -0,0 +1,119 @@
1
+ # Knowledge Graph Memory Standards
2
+
3
+ > **Language**: English | [繁體中文](../locales/zh-TW/core/knowledge-graph-memory.md)
4
+
5
+ **Version**: 1.0.0
6
+ **Last Updated**: 2026-05-30
7
+ **Applicability**: Projects using AI assistants across code + specification/decision corpora
8
+ **Scope**: uds-specific
9
+
10
+ ---
11
+
12
+ ## Purpose
13
+
14
+ This standard defines a **relationship schema** so that specifications, decisions, and code can be traversed as a graph — answering questions like *"if I change `execute()`, which specs and decisions are affected?"*. It complements vector/semantic memory (which finds *similar* artifacts) with **structural traversal** (which finds *connected* artifacts).
15
+
16
+ The schema is engine-agnostic: it is expressed as plain Markdown front-matter that an AI assistant can read directly (degraded mode), and that an optional graph engine (e.g. [CodeSage](https://github.com/AsiaOstrich/CodeSage)) can index for multi-hop queries (service mode).
17
+
18
+ ---
19
+
20
+ ## Quick Reference
21
+
22
+ ### Relationship Front-Matter Schema
23
+
24
+ Add these optional fields to a spec/decision document's YAML front-matter:
25
+
26
+ | Field | Type | Direction | Meaning |
27
+ |-------|------|-----------|---------|
28
+ | `related` | list of ids | undirected | Loosely associated artifacts |
29
+ | `impacts` | list of spec ids | this → spec | This decision changes those specs |
30
+ | `impacted_by` | list of decision ids | decision → this | Those decisions change this spec |
31
+ | `supersedes` | list of decision ids | this → decision | This decision replaces those |
32
+ | `implements` | list of spec ids | code/spec → spec | This artifact realises those specs |
33
+
34
+ Ids are artifact identifiers (e.g. `XSPEC-205`, `DEC-062`, `ADR-001`). Inline `[[XSPEC-NNN]]` wiki-links in the body are an equivalent, lower-fidelity signal.
35
+
36
+ ### Node Kinds
37
+
38
+ | Prefix | Node kind |
39
+ |--------|-----------|
40
+ | `XSPEC-*` / `SPEC-*` | Spec |
41
+ | `DEC-*` / `ADR-*` | Decision |
42
+ | function / class / module (from code) | Code node |
43
+
44
+ ---
45
+
46
+ ## 1. Schema
47
+
48
+ ### 1.1 Front-Matter Example
49
+
50
+ ```markdown
51
+ ---
52
+ id: XSPEC-205
53
+ title: Agent/Role Spec SDD Variant
54
+ status: Implemented
55
+ impacted_by: [DEC-062]
56
+ related: [XSPEC-204]
57
+ ---
58
+ ```
59
+
60
+ ```markdown
61
+ ---
62
+ id: DEC-069
63
+ title: CodeSage Architecture
64
+ date: 2026-05-27
65
+ supersedes: [DEC-057]
66
+ impacts: [XSPEC-237]
67
+ ---
68
+ ```
69
+
70
+ ### 1.2 Edge Derivation
71
+
72
+ | Front-matter on doc | Derived edge |
73
+ |---------------------|--------------|
74
+ | Decision `impacts: [SPEC]` | `IMPACTS` (Decision → Spec) |
75
+ | Spec `impacted_by: [DEC]` | `IMPACTS` (Decision → Spec) |
76
+ | Decision `supersedes: [DEC]` | `SUPERSEDES` (Decision → Decision) |
77
+ | `[[XSPEC-NNN]]` link in a Decision body | `IMPACTS` (Decision → Spec) |
78
+
79
+ Edges are **idempotent**: declaring the same relationship from both ends (a decision's `impacts` and the spec's `impacted_by`) yields one edge, not two.
80
+
81
+ ---
82
+
83
+ ## 2. Two Operating Modes
84
+
85
+ A consumer of this standard MUST work in both modes:
86
+
87
+ ### 2.1 Degraded Mode (no engine)
88
+
89
+ The AI assistant reads the target document, follows its front-matter / `[[ref]]` links by reading the linked files, and assembles the impact chain manually. Always available; bounded by how many files the assistant can read.
90
+
91
+ ### 2.2 Service Mode (graph engine available)
92
+
93
+ The corpus is indexed into a graph engine; the assistant issues a single multi-hop query (e.g. `impact-analysis { nodeId, maxHops }`) and receives the full chain — including cross-domain links (code → spec → decision) that degraded mode would miss.
94
+
95
+ > A correct implementation produces the **same answer shape** in both modes; service mode is faster and more complete, not different in kind.
96
+
97
+ ---
98
+
99
+ ## 3. Confidence (optional)
100
+
101
+ Nodes MAY carry a `confidence` in `[0.1, 1.0]`. Feedback signals (test pass/fail, human correction, status changes) evolve confidence so that reads can surface the most-reinforced artifacts first. Confidence has a floor (never zero) so a run of failures cannot erase an important node. This is the basis of self-evolving graph memory (SAGE).
102
+
103
+ ---
104
+
105
+ ## 4. Rules
106
+
107
+ 1. Relationship fields are **optional** and **additive** — absence never breaks tooling.
108
+ 2. Reference ids that do not (yet) exist are allowed; they become stub nodes resolved when the target document appears.
109
+ 3. Declare each relationship from the side that *owns* it (a decision owns `impacts`/`supersedes`; a spec owns `impacted_by`), but either side is accepted.
110
+ 4. The graph engine is **opt-in**. Tools MUST degrade gracefully to Markdown reading when no engine is configured.
111
+ 5. Vector/semantic memory is **complementary**, not replaced — use graph traversal for structure, vectors for similarity.
112
+
113
+ ---
114
+
115
+ ## Related Standards
116
+
117
+ - [Project Context Memory](project-context-memory.md) — per-project long-term facts
118
+ - [Developer Memory](developer-memory.md) — universal, transferable preferences
119
+ - [ADR Standards](adr-standards.md) — decision record format that feeds Decision nodes