universal-dev-standards 5.1.0-beta.6 → 5.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 (108) hide show
  1. package/README.md +6 -0
  2. package/bin/uds.js +14 -0
  3. package/bundled/ai/standards/agent-communication-protocol.ai.yaml +34 -0
  4. package/bundled/ai/standards/anti-sycophancy-prompting.ai.yaml +111 -0
  5. package/bundled/ai/standards/capability-declaration.ai.yaml +113 -0
  6. package/bundled/ai/standards/circuit-breaker.ai.yaml +93 -0
  7. package/bundled/ai/standards/developer-memory.ai.yaml +13 -0
  8. package/bundled/ai/standards/dual-phase-output.ai.yaml +108 -0
  9. package/bundled/ai/standards/failure-source-taxonomy.ai.yaml +115 -0
  10. package/bundled/ai/standards/frontend-design-standards.ai.yaml +305 -0
  11. package/bundled/ai/standards/health-check-standards.ai.yaml +140 -0
  12. package/bundled/ai/standards/immutability-first.ai.yaml +112 -0
  13. package/bundled/ai/standards/model-selection.ai.yaml +111 -3
  14. package/bundled/ai/standards/packaging-standards.ai.yaml +142 -0
  15. package/bundled/ai/standards/recovery-recipe-registry.ai.yaml +200 -0
  16. package/bundled/ai/standards/retry-standards.ai.yaml +134 -0
  17. package/bundled/ai/standards/security-decision.ai.yaml +87 -0
  18. package/bundled/ai/standards/skill-standard-alignment-check.ai.yaml +119 -0
  19. package/bundled/ai/standards/standard-admission-criteria.ai.yaml +107 -0
  20. package/bundled/ai/standards/standard-lifecycle-management.ai.yaml +144 -0
  21. package/bundled/ai/standards/timeout-standards.ai.yaml +104 -0
  22. package/bundled/ai/standards/token-budget.ai.yaml +108 -0
  23. package/bundled/ai/standards/translation-lifecycle-standards.ai.yaml +145 -0
  24. package/bundled/core/anti-sycophancy-prompting.md +184 -0
  25. package/bundled/core/capability-declaration.md +59 -0
  26. package/bundled/core/circuit-breaker.md +58 -0
  27. package/bundled/core/developer-memory.md +29 -1
  28. package/bundled/core/dual-phase-output.md +56 -0
  29. package/bundled/core/failure-source-taxonomy.md +72 -0
  30. package/bundled/core/frontend-design-standards.md +474 -0
  31. package/bundled/core/health-check-standards.md +72 -0
  32. package/bundled/core/immutability-first.md +105 -0
  33. package/bundled/core/model-selection.md +80 -0
  34. package/bundled/core/packaging-standards.md +216 -0
  35. package/bundled/core/recovery-recipe-registry.md +69 -0
  36. package/bundled/core/retry-standards.md +62 -0
  37. package/bundled/core/security-decision.md +65 -0
  38. package/bundled/core/skill-standard-alignment-check.md +79 -0
  39. package/bundled/core/standard-admission-criteria.md +84 -0
  40. package/bundled/core/standard-lifecycle-management.md +94 -0
  41. package/bundled/core/timeout-standards.md +63 -0
  42. package/bundled/core/token-budget.md +58 -0
  43. package/bundled/core/translation-lifecycle-standards.md +162 -0
  44. package/bundled/locales/zh-CN/CHANGELOG.md +51 -3
  45. package/bundled/locales/zh-CN/README.md +1 -1
  46. package/bundled/locales/zh-CN/core/anti-hallucination.md +22 -3
  47. package/bundled/locales/zh-CN/core/anti-sycophancy-prompting.md +192 -0
  48. package/bundled/locales/zh-CN/core/capability-declaration.md +123 -0
  49. package/bundled/locales/zh-CN/core/circuit-breaker.md +106 -0
  50. package/bundled/locales/zh-CN/core/dual-phase-output.md +103 -0
  51. package/bundled/locales/zh-CN/core/failure-source-taxonomy.md +99 -0
  52. package/bundled/locales/zh-CN/core/frontend-design-standards.md +289 -0
  53. package/bundled/locales/zh-CN/core/health-check-standards.md +144 -0
  54. package/bundled/locales/zh-CN/core/immutability-first.md +96 -0
  55. package/bundled/locales/zh-CN/core/packaging-standards.md +224 -0
  56. package/bundled/locales/zh-CN/core/recovery-recipe-registry.md +146 -0
  57. package/bundled/locales/zh-CN/core/retry-standards.md +131 -0
  58. package/bundled/locales/zh-CN/core/security-decision.md +104 -0
  59. package/bundled/locales/zh-CN/core/skill-standard-alignment-check.md +112 -0
  60. package/bundled/locales/zh-CN/core/standard-admission-criteria.md +104 -0
  61. package/bundled/locales/zh-CN/core/standard-lifecycle-management.md +116 -0
  62. package/bundled/locales/zh-CN/core/timeout-standards.md +117 -0
  63. package/bundled/locales/zh-CN/core/token-budget.md +108 -0
  64. package/bundled/locales/zh-CN/core/translation-lifecycle-standards.md +159 -0
  65. package/bundled/locales/zh-TW/CHANGELOG.md +51 -3
  66. package/bundled/locales/zh-TW/README.md +1 -1
  67. package/bundled/locales/zh-TW/core/anti-sycophancy-prompting.md +192 -0
  68. package/bundled/locales/zh-TW/core/capability-declaration.md +111 -0
  69. package/bundled/locales/zh-TW/core/circuit-breaker.md +111 -0
  70. package/bundled/locales/zh-TW/core/dual-phase-output.md +132 -0
  71. package/bundled/locales/zh-TW/core/failure-source-taxonomy.md +146 -0
  72. package/bundled/locales/zh-TW/core/frontend-design-standards.md +460 -0
  73. package/bundled/locales/zh-TW/core/health-check-standards.md +144 -0
  74. package/bundled/locales/zh-TW/core/immutability-first.md +159 -0
  75. package/bundled/locales/zh-TW/core/packaging-standards.md +224 -0
  76. package/bundled/locales/zh-TW/core/recovery-recipe-registry.md +146 -0
  77. package/bundled/locales/zh-TW/core/retry-standards.md +140 -0
  78. package/bundled/locales/zh-TW/core/security-decision.md +120 -0
  79. package/bundled/locales/zh-TW/core/skill-standard-alignment-check.md +112 -0
  80. package/bundled/locales/zh-TW/core/standard-admission-criteria.md +104 -0
  81. package/bundled/locales/zh-TW/core/standard-lifecycle-management.md +116 -0
  82. package/bundled/locales/zh-TW/core/timeout-standards.md +117 -0
  83. package/bundled/locales/zh-TW/core/token-budget.md +143 -0
  84. package/bundled/locales/zh-TW/core/translation-lifecycle-standards.md +159 -0
  85. package/bundled/skills/e2e-assistant/SKILL.md +19 -5
  86. package/bundled/skills/testing-guide/SKILL.md +5 -0
  87. package/bundled/skills/testing-guide/test-skeleton-templates.md +316 -0
  88. package/package.json +2 -1
  89. package/src/commands/check.js +6 -0
  90. package/src/commands/config.js +9 -0
  91. package/src/commands/init.js +97 -46
  92. package/src/commands/mcp.js +26 -0
  93. package/src/commands/run-intent.js +66 -0
  94. package/src/commands/update.js +41 -4
  95. package/src/core/command-router.js +85 -0
  96. package/src/core/project-config.js +91 -0
  97. package/src/flows/init-flow.js +6 -1
  98. package/src/i18n/messages.js +6 -6
  99. package/src/mcp/__tests__/server.test.js +251 -0
  100. package/src/mcp/server.js +352 -0
  101. package/src/prompts/init.js +157 -1
  102. package/src/reconciler/actual-state-scanner.js +24 -0
  103. package/src/uninstallers/hook-uninstaller.js +32 -1
  104. package/src/utils/detect-self-adoption.js +173 -0
  105. package/src/utils/e2e-analyzer.js +88 -5
  106. package/src/utils/e2e-detector.js +73 -1
  107. package/src/utils/integration-generator.js +22 -3
  108. package/standards-registry.json +203 -4
@@ -151,3 +151,83 @@ Escalation means using a more capable model, not repeating the same action. The
151
151
 
152
152
  - **Superpowers**: [subagent-driven-development](https://github.com/obra/superpowers) (MIT)
153
153
  - **Cost-Effective AI**: Principle of using the minimum capability needed
154
+
155
+ ---
156
+
157
+ ## LLM 能力管理(XSPEC-027)
158
+
159
+ > **Version**: 2.0.0 — 本節於 2026-04-13 新增,對應 XSPEC-027 Phase 1。
160
+
161
+ 三層模型選擇策略處理「任務複雜度」維度;本節新增「模型能力維度」管理,用於多模型池環境。
162
+
163
+ ### capability_dimensions — 能力維度分類
164
+
165
+ 能力維度分為四大類,共 9 個子維度:
166
+
167
+ | 大類 | 子維度 | 說明 | 基準測試 |
168
+ |------|--------|------|---------|
169
+ | modality | vision | 圖片/截圖理解(UI 分析、圖表解讀) | internal-vision-bench |
170
+ | modality | audio | 語音理解能力 | future-audio-bench |
171
+ | modality | image_generation | 圖片生成能力 | provider-specific |
172
+ | reasoning | code_reasoning | 程式碼理解與生成品質 | humaneval-plus |
173
+ | reasoning | math_reasoning | 數學推理準確率 | gsm8k |
174
+ | reasoning | instruction_following | 複雜多步驟指令遵循率 | internal-instruction-bench |
175
+ | reasoning | long_context_quality | 長文件中間段資訊存取 | needle-in-haystack |
176
+ | output | structured_output | JSON/Schema 格式輸出成功率 | internal-json-bench |
177
+ | output | tool_use | Function Calling 正確率 | internal-tool-bench |
178
+ | language | multilingual_zh_tw | 繁體中文品質(本系統優先語言) | internal-zh-tw-bench |
179
+
180
+ **評分量表(1–5)**:
181
+
182
+ | 分數 | 意義 |
183
+ |------|------|
184
+ | 5 | 生產就緒 — 高準確率,可直接使用 |
185
+ | 4 | 良好 — 偶有遺漏,可接受 |
186
+ | 3 | 基本可用 — 需人工補充 |
187
+ | 2 | 部分可用 — 僅供參考 |
188
+ | 1 | 不可靠 — 不建議使用 |
189
+
190
+ ### capability_registry — 模型能力登記表
191
+
192
+ 各子專案依實際測試,在自己的 `capability_registry` 中維護每個模型的能力分數。
193
+
194
+ **格式**:
195
+ ```yaml
196
+ - model_id: "provider/model-name"
197
+ version_pinned: "版本鎖定識別(SHA、日期戳或 model_version)"
198
+ pin_date: "YYYY-MM-DD"
199
+ eol_date: "YYYY-MM-DD" # 可選
200
+ capabilities:
201
+ "modality.vision": 4
202
+ "reasoning.instruction_following": 5
203
+ "output.structured_output": 5
204
+ ```
205
+
206
+ **版本鎖定(DEC-031 D1)**:必須記錄 `version_pinned` 與 `pin_date`,避免模型靜默升級造成能力變化。
207
+
208
+ ### routing_rules — 路由策略決策樹
209
+
210
+ 根據模型能力分數,路由規則分三態:
211
+
212
+ ```
213
+ 任務需要 capability X
214
+ ├── 模型得分 ≥ min_score → SUPPORTED — 正常執行
215
+ ├── 模型得分 2–3(低於 min_score) → DEGRADED — 降級執行,產出標記 [DEGRADED]
216
+ └── 模型得分 ≤ 1 或未登記 → UNSUPPORTED — 替代流程或提示用戶
217
+ ```
218
+
219
+ **降智偵測(DEC-033)額外規則**:
220
+
221
+ | 規則 | 條件 | 動作 |
222
+ |------|------|------|
223
+ | CAP-004 | 降智偵測觸發 moderate 信號 | 啟動金絲雀測試,記錄降智警告 |
224
+ | CAP-005 | 降智偵測觸發 critical 信號 | 自動切換備用模型,上報 P1 Issue |
225
+
226
+ **選擇策略**:`pareto_weighted` — 優先選擇在所需維度得分最高、成本最低的模型。
227
+
228
+ ### 與三層分級的關係
229
+
230
+ - **三層分級(Tier 1/2/3)** — 基於任務複雜度(How hard is the task?)
231
+ - **能力維度(XSPEC-027)** — 基於模型能力(Can this model do it?)
232
+
233
+ 兩者並用:先依複雜度選擇 Tier,再依能力維度確認選中的模型支援任務所需的 capability。
@@ -0,0 +1,216 @@
1
+ # Packaging Standards
2
+
3
+ > **Language**: English | [繁體中文](../locales/zh-TW/core/packaging-standards.md)
4
+
5
+ **Version**: 1.0.0
6
+ **Last Updated**: 2026-04-15
7
+ **Applicability**: Projects using UDS/DevAP toolchain
8
+ **Scope**: universal
9
+
10
+ ---
11
+
12
+ ## Purpose
13
+
14
+ This standard defines a Recipe-based packaging framework that enables user projects to declare packaging targets in `.devap/packaging.yaml`. UDS provides the Recipe definitions and built-in Recipe library; DevAP executes the orchestration at pipeline time.
15
+
16
+ The framework separates concerns:
17
+ - **User project**: declares *what* to package (targets + config overrides)
18
+ - **UDS**: defines *how* to package (Recipe structure + built-in Recipes)
19
+ - **DevAP**: executes *when* to package (pipeline stage between Review and Deploy)
20
+
21
+ ---
22
+
23
+ ## Core Principles
24
+
25
+ | Principle | Description |
26
+ |-----------|-------------|
27
+ | **Recipe-based** | Every packaging target references a named Recipe; no ad-hoc scripts in pipeline YAML |
28
+ | **Declarative targets** | Projects declare targets in `.devap/packaging.yaml`; DevAP resolves and executes |
29
+ | **Customizable** | Four customization layers allow config overrides, hook injection, custom Recipes, and escape hatches |
30
+ | **Pipeline-integrated** | Packaging runs as a named stage between Review and Deploy in the VibeOps pipeline |
31
+
32
+ ---
33
+
34
+ ## Recipe Structure
35
+
36
+ A Recipe is a YAML file that defines how to package a project. The following fields are defined:
37
+
38
+ ```yaml
39
+ # Recipe: <name>.yaml
40
+ name: <string> # REQUIRED — unique recipe identifier (kebab-case)
41
+ description: <string> # OPTIONAL — human-readable description
42
+ requires: # OPTIONAL — files that must exist before execution
43
+ - <file-path>
44
+ steps: # REQUIRED — ordered list of build/package steps
45
+ - run: <shell-command>
46
+ description: <string> # OPTIONAL — human-readable step description
47
+ config: # OPTIONAL — default configuration values (overridable)
48
+ <key>: <value>
49
+ hooks: # OPTIONAL — lifecycle hooks (null = no-op)
50
+ preBuild: ~
51
+ postBuild: ~
52
+ prePublish: ~
53
+ postPublish: ~
54
+ ```
55
+
56
+ ### Required vs Optional Fields
57
+
58
+ | Field | Required | Description |
59
+ |-------|----------|-------------|
60
+ | `name` | Yes | Unique recipe identifier, kebab-case |
61
+ | `steps` | Yes | At least one step must be defined |
62
+ | `description` | No | Human-readable description |
63
+ | `requires` | No | Pre-condition file checks |
64
+ | `config` | No | Default config values; all keys are overridable by user project |
65
+ | `hooks` | No | Lifecycle hook points; `~` means no-op |
66
+
67
+ ### Step Variables
68
+
69
+ Config values and runtime context are available as `{variable}` placeholders in `run` commands:
70
+
71
+ | Variable | Source | Example |
72
+ |----------|--------|---------|
73
+ | `{registry}` | `config.registry` | `ghcr.io` |
74
+ | `{name}` | `package.json#name` or `config.name` | `my-app` |
75
+ | `{version}` | `package.json#version` or `config.version` | `1.2.3` |
76
+ | `{platforms}` | `config.platforms` | `linux/amd64,linux/arm64` |
77
+ | `{output_dir}` | `config.output_dir` | `dist/installers` |
78
+
79
+ ---
80
+
81
+ ## Built-in Recipes
82
+
83
+ UDS ships four built-in Recipes located in the `recipes/` directory:
84
+
85
+ | Recipe | File | Use Case |
86
+ |--------|------|----------|
87
+ | `npm-library` | `recipes/npm-library.yaml` | npm package without a binary entry point |
88
+ | `npm-cli` | `recipes/npm-cli.yaml` | npm package with a `bin` field (CLI tool) |
89
+ | `docker-service` | `recipes/docker-service.yaml` | Docker container image build and push |
90
+ | `windows-installer` | `recipes/windows-installer.yaml` | Windows installer (.msi / .exe) via user script |
91
+
92
+ ### When to Use Each Recipe
93
+
94
+ ```
95
+ Is the output an npm package?
96
+ ├── Yes → Does package.json contain a "bin" field?
97
+ │ ├── Yes → npm-cli
98
+ │ └── No → npm-library
99
+ └── No → Is the output a container image?
100
+ ├── Yes → docker-service
101
+ └── No → Is the output a Windows installer?
102
+ ├── Yes → windows-installer
103
+ └── No → write a custom recipe (see Customization Layers)
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Customization Layers
109
+
110
+ Projects that need to deviate from built-in Recipe defaults should use the lowest applicable layer:
111
+
112
+ | Layer | Mechanism | When to Use |
113
+ |-------|-----------|-------------|
114
+ | **L1 — Config Override** | `config:` block in `.devap/packaging.yaml` | Change default values (registry URL, tag, output dir) |
115
+ | **L2 — Hook Injection** | `hooks:` block in `.devap/packaging.yaml` | Run extra commands before/after build or publish |
116
+ | **L3 — Custom Recipe** | New `.yaml` file in project's `.devap/recipes/` | Entirely different build process; built-ins don't apply |
117
+ | **L4 — Escape Hatch** | `script:` key replacing `recipe:` in target definition | Raw shell script when no Recipe abstraction is suitable |
118
+
119
+ ### L1 Example — Config Override
120
+
121
+ ```yaml
122
+ # .devap/packaging.yaml
123
+ targets:
124
+ - name: publish-npm
125
+ recipe: npm-library
126
+ config:
127
+ registry: https://npm.pkg.github.com
128
+ access: restricted
129
+ tag: beta
130
+ ```
131
+
132
+ ### L2 Example — Hook Injection
133
+
134
+ ```yaml
135
+ # .devap/packaging.yaml
136
+ targets:
137
+ - name: docker-push
138
+ recipe: docker-service
139
+ hooks:
140
+ postPush: |
141
+ curl -X POST https://hooks.example.com/deploy-notify \
142
+ -d "{\"version\": \"{version}\"}"
143
+ ```
144
+
145
+ ### L3 Example — Custom Recipe
146
+
147
+ ```yaml
148
+ # .devap/recipes/electron-app.yaml
149
+ name: electron-app
150
+ description: Build Electron desktop application
151
+ requires:
152
+ - package.json
153
+ - electron-builder.yml
154
+ steps:
155
+ - run: npm run build
156
+ - run: npx electron-builder --publish never
157
+ config:
158
+ output_dir: dist
159
+ ```
160
+
161
+ ### L4 Example — Escape Hatch
162
+
163
+ ```yaml
164
+ # .devap/packaging.yaml
165
+ targets:
166
+ - name: legacy-bundle
167
+ script: |
168
+ ./scripts/legacy-bundle.sh
169
+ mv output/ dist/bundle/
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Acceptance Criteria for Packaging
175
+
176
+ A packaging run is considered **successful** when ALL of the following conditions are met:
177
+
178
+ | Criterion | Threshold | Notes |
179
+ |-----------|-----------|-------|
180
+ | All `requires` files exist | 100% | Checked before any step runs |
181
+ | All steps exit with code 0 | 100% | Any non-zero exit fails the run |
182
+ | `postBuild` artifact exists | Present in expected path | Verified by DevAP after build step |
183
+ | Hook commands exit with code 0 | 100% | Hook failure propagates as step failure |
184
+ | Published artifact is retrievable | HTTP 200 / registry query succeeds | Verified by DevAP post-publish smoke check |
185
+
186
+ ### Failure Handling
187
+
188
+ | Failure Type | Action | Retry? |
189
+ |--------------|--------|--------|
190
+ | Missing `requires` file | Fail immediately, report missing path | No |
191
+ | Step non-zero exit | Fail immediately, run `postBuild` hook if defined | Configurable (default: no) |
192
+ | Hook non-zero exit | Fail immediately | No |
193
+ | Publish unreachable | Retry up to 3 times with exponential backoff | Yes (3×) |
194
+
195
+ ---
196
+
197
+ ## Related Standards
198
+
199
+ - [Deployment Standards](deployment-standards.md) — Deploy stage that follows packaging
200
+ - [Pipeline Integration Standards](pipeline-integration-standards.md) — CI/CD pipeline configuration
201
+ - [Checkin Standards](checkin-standards.md) — Quality gates before packaging
202
+ - [Versioning Standards](versioning.md) — Version numbers used in package artifacts
203
+
204
+ ---
205
+
206
+ ## Version History
207
+
208
+ | Version | Date | Changes |
209
+ |---------|------|---------|
210
+ | 1.0.0 | 2026-04-15 | Initial release — XSPEC-034 Phase 1 |
211
+
212
+ ---
213
+
214
+ ## License
215
+
216
+ This standard is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
@@ -0,0 +1,69 @@
1
+ # Recovery Recipe Registry Standard
2
+
3
+ > **Source**: XSPEC-046 | **Borrowed from**: ultraworkers/claw-code ROADMAP Phase 3 Recovery Recipes
4
+ > **Depends on**: failure-source-taxonomy (XSPEC-045)
5
+
6
+ ## Overview
7
+
8
+ The Recovery Recipe Registry unifies scattered recovery logic (Fix Loop, Circuit Breaker, Guardian auto-repair, staging retry) into an externalized YAML-configurable Recipe format. Each Recipe uses `failureSource` (XSPEC-045) as the match key, selects the corresponding recovery strategy, and defines an escalation path. When no Recipe matches, the system falls back to existing behavior (backward compatible).
9
+
10
+ ## 6 Recovery Strategies
11
+
12
+ | Strategy | Description | Best For |
13
+ |----------|-------------|----------|
14
+ | `fix_loop` | Inject structured error feedback and retry the task | compilation, test_failure |
15
+ | `circuit_breaker` | Three-state circuit breaker (XSPEC-036), open after consecutive failures | tool_failure, prompt_delivery |
16
+ | `rebase_and_retry` | Run git rebase to sync base branch, then retry | branch_divergence |
17
+ | `model_switch` | Switch to fallback model then retry | model_degradation, prompt_delivery |
18
+ | `degraded_mode` | Continue in degraded mode (skip quality validation, partial results) | resource_exhaustion, model_degradation |
19
+ | `human_checkpoint` | Pause execution, wait for human intervention | policy_violation, branch_divergence |
20
+
21
+ ## Recipe Format
22
+
23
+ ```yaml
24
+ id: RR-001 # RR-NNN format, required
25
+ name: "Fix Loop for Compilation" # required
26
+ match:
27
+ failure_source: compilation # FailureSource, required
28
+ severity: [high, medium] # optional, empty = match all
29
+ strategy: fix_loop # RecoveryStrategy, required
30
+ config: # optional, overrides strategy defaults
31
+ max_attempts: 3
32
+ budget_usd: 0.50
33
+ escalation: # required
34
+ on_exhaust: human_checkpoint # must not reference self
35
+ message: "..." # optional notification message
36
+ ```
37
+
38
+ ## Default Recipes (RR-001 ~ RR-005)
39
+
40
+ | ID | Trigger | Strategy | Escalation |
41
+ |----|---------|----------|------------|
42
+ | RR-001 | compilation | fix_loop (3 attempts, $0.50) | human_checkpoint |
43
+ | RR-002 | test_failure | fix_loop (3 attempts, $0.50) | human_checkpoint |
44
+ | RR-003 | model_degradation | model_switch (2 attempts) | degraded_mode |
45
+ | RR-004 | branch_divergence | rebase_and_retry (1 attempt) | human_checkpoint |
46
+ | RR-005 | resource_exhaustion | degraded_mode | human_checkpoint |
47
+
48
+ ## Guidelines
49
+
50
+ - Every Recovery Recipe must have a unique ID (RR-NNN format)
51
+ - `match.failure_source` must be one of the 8 classes defined in failure-source-taxonomy
52
+ - `escalation.on_exhaust` must be defined — infinite loops are forbidden (escalation must not reference self)
53
+ - When no Recipe matches, system must fallback to existing default behavior (must not throw errors)
54
+ - User-defined Recipes take priority over built-in Recipes (when `failureSource` matches, user config is matched first)
55
+ - Recipe config format errors fallback to strategy defaults (do not interrupt execution)
56
+
57
+ ## Applicable Scenarios
58
+
59
+ - DevAP Orchestrator selects recovery strategy before fix loop
60
+ - VibeOps PipelineRunner handles `agent:error` with registry lookup
61
+ - Custom `recovery-recipes.yaml` for project-level recipe override
62
+ - Telemetry tracking recovery strategy effectiveness
63
+
64
+ ## References
65
+
66
+ - AI-optimized: [ai/standards/recovery-recipe-registry.ai.yaml](../ai/standards/recovery-recipe-registry.ai.yaml)
67
+ - XSPEC-046: Cross-project specification
68
+ - Depends on: Failure Source Taxonomy (XSPEC-045)
69
+ - Borrowed from: [ultraworkers/claw-code](https://github.com/ultraworkers/claw-code) ROADMAP Phase 3 Recovery Recipes
@@ -0,0 +1,62 @@
1
+ # Retry Standards
2
+
3
+ > **Source**: XSPEC-067 | **Driven by**: DEC-043 Wave 1 Reliability Pack | **Status**: Trial (2026-04-17 ~ 2026-10-17)
4
+
5
+ ## Overview
6
+
7
+ 重試策略標準 — 延伸既有 `circuit-breaker` 與 `failure-source-taxonomy`,補齊 retry 層的標準化規則。避免各元件各自實作重試造成行為不一致(無上限重試、無 jitter 導致 thundering herd)。與 `failure-source-taxonomy` 深度整合:依失敗類型決定是否重試、重試幾次、退避多久。
8
+
9
+ ## Key Principles
10
+
11
+ - **指數退避加 full jitter**:所有重試邏輯必須使用 exponential + jitter,禁止固定間隔或無 jitter 的純指數
12
+ - **明確重試上限**:必須有 `max_attempts`(預設 5),禁止無限重試
13
+ - **依 failureSource 分類**:先查 `failure-source-taxonomy`,fail-fast 類別不得重試
14
+ - **與 circuit-breaker 整合**:OPEN 狀態下 fail-fast,不消耗 `max_attempts`;`retry_exhausted` 計入 failure count
15
+ - **重試可觀察**:每次重試上報 `retry_attempted` / `retry_exhausted` 遙測事件
16
+
17
+ ## Backoff Formula
18
+
19
+ ```
20
+ wait_ms = min(cap_ms, base_ms * 2^attempt) * (0.5 + random() * 0.5)
21
+ ```
22
+
23
+ | Parameter | Default | Description |
24
+ |-----------|---------|-------------|
25
+ | `base_ms` | 100 | 基礎退避時間 |
26
+ | `cap_ms` | 30000 | 單次最長等待上限 |
27
+ | `max_attempts` | 5 | 最多重試次數(不含第 0 次原始呼叫)|
28
+ | `jitter_ratio` | 0.5 | Jitter 比例(±50%)|
29
+
30
+ ## Failure Source Retry Rules
31
+
32
+ | Failure Source | Retry? | Max Attempts | Base ms | Note |
33
+ |----------------|--------|--------------|---------|------|
34
+ | `transient_network` | Yes | 5 | 100 | 短暫網路抖動 |
35
+ | `rate_limit` | Yes | 3 | 1000 | 依 `Retry-After` 優先 |
36
+ | `upstream_unavailable` | Yes | 3 | 500 | 連續失敗觸發 breaker OPEN |
37
+ | `tool_failure` | Yes | 2 | 200 | 工具層失敗多半非 transient |
38
+ | `prompt_delivery` | Yes | 2 | 100 | 超過改走 model_switch |
39
+ | `authentication` | **No** | — | — | Fail-fast,重試不會變對 |
40
+ | `validation` | **No** | — | — | Fail-fast,input 錯不改 |
41
+ | `policy_violation` | **No** | — | — | Fail-fast,禁止繞過 |
42
+ | `quota_exhausted` | **No** | — | — | Fail-fast,等 reset |
43
+
44
+ ## Usage Examples
45
+
46
+ - **Scenario 1 — 指數退避**:`failure_source=transient_network`,已重試 2 次。第 3 次 wait 範圍 = `min(30000, 100 * 2^3) * [0.5..1.0] = 400~800ms`
47
+ - **Scenario 2 — 401 Fail-fast**:API 回 401 Unauthorized,`failure_source=authentication`。立即 fail-fast,不進退避、不計入 breaker failure count
48
+ - **Scenario 3 — Circuit Open 跳過**:breaker 為 OPEN,發起重試時立即回 `CircuitOpenError`,不消耗 `max_attempts`
49
+
50
+ ## Error Codes
51
+
52
+ - `RETRY-001` — `RETRY_EXHAUSTED`(達到 max_attempts 仍失敗)
53
+ - `RETRY-002` — `RETRY_SKIPPED_NON_RETRYABLE`(failureSource 屬 fail-fast 類別)
54
+ - `RETRY-003` — `RETRY_SKIPPED_CIRCUIT_OPEN`(breaker OPEN 狀態下跳過)
55
+
56
+ ## References
57
+
58
+ - AI-optimized: [ai/standards/retry-standards.ai.yaml](../ai/standards/retry-standards.ai.yaml)
59
+ - XSPEC-067: DEC-043 Wave 1 Reliability Pack 跨專案規格
60
+ - DEC-043: UDS 覆蓋完整性路線圖(驅動來源)
61
+ - Related: `circuit-breaker`, `failure-source-taxonomy`, `timeout-standards`, `recovery-recipe-registry`
62
+ - Industry: Netflix Hystrix retry, Google SRE Book Ch.22, AWS Architecture Blog — exponential backoff and jitter
@@ -0,0 +1,65 @@
1
+ # Security Decision Standard
2
+
3
+ > **Source**: XSPEC-037 | **Borrowed from**: claude-code-book Ch.4
4
+
5
+ ## Overview
6
+
7
+ The Security Decision Standard defines a three-state decision model (`deny` / `ask` / `allow`) with an iron-law priority: **deny always wins**, regardless of the source's priority level. This means a low-priority user setting with `deny` overrides a high-priority policy setting with `allow`.
8
+
9
+ ## Three States
10
+
11
+ | Decision | Priority | Behavior |
12
+ |----------|----------|----------|
13
+ | `deny` | 1 (highest) | Block immediately, no further evaluation |
14
+ | `ask` | 2 | Pause and request user confirmation |
15
+ | `allow` | 3 (lowest) | Permit operation to proceed |
16
+
17
+ ## Arbitration Rule
18
+
19
+ ```
20
+ if any rule has deny → final decision: deny
21
+ else if any rule has ask → final decision: ask
22
+ else → final decision: allow
23
+ ```
24
+
25
+ **Invariant**: deny wins regardless of source priority level.
26
+
27
+ ## CI Mode
28
+
29
+ In non-interactive (CI/CD) environments, `ask` is treated as `deny` — there is no mechanism to provide human confirmation, so the operation must be blocked.
30
+
31
+ ## projectSettings Trust Radius
32
+
33
+ Configuration from `projectSettings` (`.devap/`, `.vibeops/`) is excluded from security-sensitive operations to prevent malicious repository injection:
34
+
35
+ **Blocked operations from projectSettings**:
36
+ - Setting `requiresUserConfirmation: false`
37
+ - Redirecting memory paths outside project directory
38
+ - Expanding tool allowlist beyond userSettings scope
39
+ - Downgrading deny rules to allow
40
+
41
+ Log: `[WARN] projectSettings security override rejected: {operation}`
42
+
43
+ ## Interface
44
+
45
+ ```typescript
46
+ type SecurityDecision = "deny" | "ask" | "allow";
47
+
48
+ interface SecurityDecisionRule {
49
+ source: string; // user | project | policy | builtin
50
+ decision: SecurityDecision;
51
+ reason?: string;
52
+ }
53
+
54
+ function arbitrate(rules: SecurityDecisionRule[]): SecurityDecision {
55
+ if (rules.some(r => r.decision === "deny")) return "deny";
56
+ if (rules.some(r => r.decision === "ask")) return "ask";
57
+ return "allow";
58
+ }
59
+ ```
60
+
61
+ ## References
62
+
63
+ - AI-optimized: [ai/standards/security-decision.ai.yaml](../ai/standards/security-decision.ai.yaml)
64
+ - XSPEC-037: Cross-project specification
65
+ - Borrowed from: [claude-code-book](https://github.com/lintsinghua/claude-code-book) Ch.4 four-stage permission pipeline
@@ -0,0 +1,79 @@
1
+ # Skill-Standard Alignment Check
2
+
3
+ > **Source**: XSPEC-070 | **Driven by**: DEC-043 Wave 1 Governance Meta Pack | **Status**: Trial (2026-04-17 ~ 2026-10-17)
4
+
5
+ ## Overview
6
+
7
+ Skill 必有 Standard 作為錨點,Standard 可無 Skill;定期識別孤兒 Skill。Skill 是 UX 糖衣,Standard 是 standards-of-truth。若 Skill 無錨定 Standard,其行為就沒有明文依據,會隨作者口味飄移。本標準規範 Skill 必須指明錨定哪個 Standard,並定期識別「孤兒 Skill」(無對應 Standard),觸發補 Standard 的流程。反向允許 Standard 無 Skill(不強制每個 Standard 都造 Skill)。
8
+
9
+ ## Key Principles
10
+
11
+ - **Skill 必錨 Standard**:所有 Skill frontmatter 必須含 `anchor_standard`(至少一個)
12
+ - **Anchor 有效性**:必須指向 Trial / Active / Deprecated 狀態的標準 id
13
+ - **Standard 可獨立**:Standard 無對應 Skill 是合法的(非錯誤,僅資訊)
14
+ - **Orphan 治理**:無 anchor 的 Skill 列為 orphan,下一版必補或降 Proposed
15
+ - **定期檢查**:建議季度執行 alignment check,產出 orphan 清單
16
+
17
+ ## Alignment Rules
18
+
19
+ ### Skill must have Standard
20
+
21
+ - Frontmatter 必須含 `anchor_standard: <standard-id>` 或 `[<id1>, <id2>, ...]`
22
+ - CI / pre-release 強制,缺欄位視為 fail
23
+ - **例外**:純 utility Skill(如 docs-generator)可標 `anchor_standard: none` + 填 `utility_reason`
24
+
25
+ ### Standard may have Skill
26
+
27
+ - Standard 獨立存在合法(可被 QualityGate / Agent 直接消費)
28
+ - 強制每 Standard 造 Skill 會導致 Skill 庫膨脹
29
+ - 範例:`immutability-first` 無對應 Skill 合法
30
+
31
+ ### Orphan Detection
32
+
33
+ - 無 `anchor_standard` 的 Skill → orphan
34
+ - 偵測後動作:列入季度報告 → 建立對應 Standard 的 XSPEC(走 admission 流程) → 無法建立則降 Skill 為 Proposed
35
+
36
+ ## Known Orphans (as of 2026-04)
37
+
38
+ 本 XSPEC-070 識別的現存 orphan Skill(由 XSPEC-063~069 補齊):
39
+
40
+ | Skill | Needs Standard | Planned XSPEC |
41
+ |-------|----------------|---------------|
42
+ | `slo-assistant` | slo-standards | XSPEC-063 |
43
+ | `runbook-assistant` | runbook-standards | XSPEC-064 |
44
+ | `incident-response-assistant` | incident-response-standards | XSPEC-063 |
45
+ | `observability-assistant` | observability-standards | XSPEC-063 |
46
+ | `metrics-dashboard-assistant` | metrics-dashboard-standards | XSPEC-063 |
47
+ | `ci-cd-assistant` | ci-cd-standards | XSPEC-066 |
48
+
49
+ 清單將隨 XSPEC-063~069 實作逐步清空。
50
+
51
+ ## Alignment Check Workflow
52
+
53
+ 1. 掃描 `skills/**/*.md` 抽取 frontmatter `anchor_standard`
54
+ 2. 掃描 `ai/standards/*.ai.yaml` 抽取所有 `standard.id`
55
+ 3. 計算差集:Skill without anchor → orphan 清單
56
+ 4. 計算反向差集:Standard without Skill → informational
57
+ 5. 驗證 anchor 指向存在且非 Archived 的 id
58
+ 6. 產出 `alignment-report.json` / `alignment-report.md`
59
+
60
+ ## Usage Examples
61
+
62
+ - **Scenario 1 — 健康對齊**:`retry-assistant` frontmatter 含 `anchor_standard: retry-standards`,指向 Trial 狀態標準 → 檢查通過
63
+ - **Scenario 2 — Orphan 偵測**:`slo-assistant` 無 `anchor_standard` → 列入 orphan 清單,報告標註「需建立 slo-standards 或降 Proposed」
64
+ - **Scenario 3 — 孤立 Standard 合法**:`immutability-first.ai.yaml` 存在但無 Skill → `standalone-standard` 計數 +1,非錯誤
65
+
66
+ ## Error Codes
67
+
68
+ - `ALIGN-001` — `SKILL_MISSING_ANCHOR`
69
+ - `ALIGN-002` — `BROKEN_ANCHOR`(指向不存在的 standard id)
70
+ - `ALIGN-003` — `ARCHIVED_ANCHOR`(指向已 Archived 的標準)
71
+ - `ALIGN-004` — `UTILITY_MISSING_REASON`
72
+
73
+ ## References
74
+
75
+ - AI-optimized: [ai/standards/skill-standard-alignment-check.ai.yaml](../ai/standards/skill-standard-alignment-check.ai.yaml)
76
+ - XSPEC-070: DEC-043 Wave 1 Governance Meta Pack 跨專案規格
77
+ - DEC-043: UDS 覆蓋完整性路線圖(XSPEC-063~069 目的之一即清空本標準識別的 orphan 清單)
78
+ - Related: `standard-admission-criteria`, `standard-lifecycle-management`
79
+ - Internal: AsiaOstrich DEC-043 七主題缺口分析(slo/runbook/observability 等 40+ Skill 部分無 Standard 錨點)
@@ -0,0 +1,84 @@
1
+ # Standard Admission Criteria
2
+
3
+ > **Source**: XSPEC-070 | **Driven by**: DEC-043 Wave 1 Governance Meta Pack | **Status**: Trial (2026-04-17 ~ 2026-10-17)
4
+
5
+ ## Overview
6
+
7
+ 新標準納入 UDS 的四項條件。在 DEC-043 提出 60+ 候選新標準的背景下,需要一個明文的納入檢查清單,避免標準庫膨脹(重疊、未使用)與降低品質。本標準是 UDS 的治理層 meta 標準 — 用來「決定標準的標準」。每個候選新標準必須通過四項條件才能從 Proposed 進入 Trial。
8
+
9
+ ## Key Principles
10
+
11
+ - **四項硬性條件**:所有候選新標準必須同時通過 Evidence / Scope / Non-overlapping / AI-executable
12
+ - **拒絕理由必須具體**:不得以「不合適」之類籠統用詞結案,必須指出未通過的 criterion
13
+ - **Admission ≠ Active**:通過 admission 僅代表可進 Trial,不代表直接 Active
14
+ - **Self-applicability**:本標準也必須符合四項條件
15
+ - **Backward compat**:既有 66 個 Active 標準不溯及既往
16
+
17
+ ## The Four Criteria
18
+
19
+ ### 1. Evidence(具體場景)
20
+
21
+ 至少 2 個具體使用場景(非 hypothetical):
22
+
23
+ - 場景來自實際專案、Repo、論文或 DEC 記錄
24
+ - 描述具體(可舉出檔案 / 函式 / commit)
25
+ - 至少 1 個來自 AsiaOstrich 內部痛點或外部產業佐證
26
+
27
+ **拒絕範例**:「未來可能用到」— 無具體場景
28
+
29
+ ### 2. Scope(明確作用域)
30
+
31
+ - `meta.scope` 標示 `universal` / `partial` / `uds-specific`
32
+ - frontmatter 列出適用的活動類型(development / deployment / testing)
33
+ - 若為 partial 或 uds-specific,說明不通用的原因
34
+
35
+ **拒絕範例**:「所有場合都適用」— 過度泛化
36
+
37
+ ### 3. Non-overlapping(無重大重疊)
38
+
39
+ 與既有 UDS 標準內容重複 < 30%:
40
+
41
+ - 列出最接近的 3 個既有標準,說明差異
42
+ - 若有 ≥ 30% 重疊,應改為擴充既有標準
43
+ - 明確定義 `integration_points`
44
+
45
+ **拒絕範例**:與 `retry-standards` 80% 內容重複 — 應合併
46
+
47
+ ### 4. AI-executable(AI 可消費)
48
+
49
+ 至少一個 DevAP QualityGate / VibeOps Agent prompt / Skill 能消費:
50
+
51
+ - 定義清楚的 guidelines(每條可驗證)
52
+ - 至少 2 個 Given-When-Then scenarios
53
+ - 需型別時提供 interface / types 區塊
54
+ - 明確的 `integration_points`
55
+
56
+ **拒絕範例**:只有抽象原則,無任何 AI 可執行的規則
57
+
58
+ ## Rejection Protocol
59
+
60
+ 1. 拒絕理由必須指出未通過的 criterion(evidence / scope / non-overlapping / ai-executable)
61
+ 2. 拒絕記錄寫入 `cross-project/decisions/` 或 DEC 的 rejection log
62
+ 3. 候選者可依理由修正後重新申請(不永久封鎖)
63
+ 4. 若拒絕理由涉及重疊,應建議改為擴充既有標準
64
+
65
+ ## Usage Examples
66
+
67
+ - **Scenario 1 — 通過**:`retry-standards` 申請。Evidence(XSPEC-067 Scenario 1-1/1-2)、Scope(universal)、Non-overlapping(與 circuit-breaker 互補)、AI-executable(9 guidelines + 3 scenarios)全通過 → 進入 Trial
68
+ - **Scenario 2 — 因重疊拒絕**:`advanced-retry-with-jitter` 申請。與 `retry-standards` 重疊 > 30% → 拒絕,建議改為 Phase 2 擴充
69
+ - **Scenario 3 — 因證據不足拒絕**:`universal-best-practices` 申請。僅「未來可能用到」類描述 → 拒絕,要求至少 2 個已發生案例
70
+
71
+ ## Error Codes
72
+
73
+ - `ADMISSION-001` — `MISSING_EVIDENCE`
74
+ - `ADMISSION-002` — `SCOPE_UNDEFINED`
75
+ - `ADMISSION-003` — `OVERLAP_EXCEEDED`(> 30%)
76
+ - `ADMISSION-004` — `NOT_AI_EXECUTABLE`
77
+
78
+ ## References
79
+
80
+ - AI-optimized: [ai/standards/standard-admission-criteria.ai.yaml](../ai/standards/standard-admission-criteria.ai.yaml)
81
+ - XSPEC-070: DEC-043 Wave 1 Governance Meta Pack 跨專案規格
82
+ - DEC-043: UDS 覆蓋完整性路線圖(本標準是 Wave 1 前置條件)
83
+ - Related: `standard-lifecycle-management`, `skill-standard-alignment-check`, `adr-standards`
84
+ - Industry: IETF RFC admission criteria, Python PEP process, W3C Recommendation Track