universal-dev-standards 6.8.0 → 6.9.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 (194) hide show
  1. package/bin/uds.js +12 -2
  2. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +14 -2
  3. package/bundled/ai/standards/adr-standards.ai.yaml +14 -2
  4. package/bundled/ai/standards/code-review.ai.yaml +13 -3
  5. package/bundled/ai/standards/commit-message.ai.yaml +8 -4
  6. package/bundled/ai/standards/deferred-item-exit.ai.yaml +225 -0
  7. package/bundled/ai/standards/feature-discovery-standards.ai.yaml +14 -2
  8. package/bundled/ai/standards/governance-layer.ai.yaml +128 -2
  9. package/bundled/ai/standards/logging.ai.yaml +2 -2
  10. package/bundled/ai/standards/retrospective-standards.ai.yaml +14 -2
  11. package/bundled/ai/standards/reverse-engineering-standards.ai.yaml +73 -2
  12. package/bundled/ai/standards/security-standards.ai.yaml +2 -2
  13. package/bundled/ai/standards/spec-driven-development.ai.yaml +14 -2
  14. package/bundled/ai/standards/tech-debt-standards.ai.yaml +87 -3
  15. package/bundled/ai/standards/turn-completion-integrity.ai.yaml +131 -0
  16. package/bundled/core/acceptance-criteria-traceability.md +5 -2
  17. package/bundled/core/adr-standards.md +26 -2
  18. package/bundled/core/code-review-checklist.md +5 -2
  19. package/bundled/core/context-aware-loading.md +1 -1
  20. package/bundled/core/deferred-item-exit.md +254 -0
  21. package/bundled/core/feature-discovery-standards.md +5 -1
  22. package/bundled/core/governance-layer.md +114 -2
  23. package/bundled/core/retrospective-standards.md +4 -2
  24. package/bundled/core/reverse-engineering-standards.md +81 -2
  25. package/bundled/core/spec-driven-development.md +8 -2
  26. package/bundled/core/tech-debt-standards.md +67 -8
  27. package/bundled/core/turn-completion-integrity.md +196 -0
  28. package/bundled/hooks/check-dangerous-cmd.mjs +60 -0
  29. package/bundled/hooks/check-logging-standard.mjs +59 -0
  30. package/bundled/hooks/check-turn-completion.mjs +233 -0
  31. package/bundled/hooks/inject-standards.mjs +183 -0
  32. package/bundled/hooks/telemetry-wrapper.mjs +77 -0
  33. package/bundled/hooks/turn-completion/detect.mjs +99 -0
  34. package/bundled/hooks/turn-completion/locales/en.mjs +159 -0
  35. package/bundled/hooks/turn-completion/locales/zh-TW.mjs +166 -0
  36. package/bundled/hooks/validate-commit-msg.mjs +104 -0
  37. package/bundled/locales/zh-CN/CHANGELOG.md +47 -3
  38. package/bundled/locales/zh-CN/CLAUDE.md +1 -1
  39. package/bundled/locales/zh-CN/README.md +2 -2
  40. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  41. package/bundled/locales/zh-CN/core/adr-standards.md +1 -1
  42. package/bundled/locales/zh-CN/core/governance-layer.md +118 -6
  43. package/bundled/locales/zh-CN/core/retrospective-standards.md +1 -1
  44. package/bundled/locales/zh-CN/core/tech-debt-standards.md +71 -4
  45. package/bundled/locales/zh-CN/core/turn-completion-integrity.md +190 -0
  46. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +8 -1
  47. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +29 -68
  48. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +25 -15
  49. package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +1 -2
  50. package/bundled/locales/zh-CN/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
  51. package/bundled/locales/zh-CN/integrations/google-antigravity/README.md +3 -3
  52. package/bundled/locales/zh-CN/skills/atdd-assistant/SKILL.md +2 -0
  53. package/bundled/locales/zh-CN/skills/bdd-assistant/SKILL.md +2 -0
  54. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +22 -12
  55. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +12 -9
  56. package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +1 -0
  57. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +17 -13
  58. package/bundled/locales/zh-CN/skills/commands/config.md +0 -1
  59. package/bundled/locales/zh-CN/skills/commands/init.md +1 -2
  60. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +2 -0
  61. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +1 -0
  62. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +2 -0
  63. package/bundled/locales/zh-CN/skills/observability-assistant/SKILL.md +1 -0
  64. package/bundled/locales/zh-CN/skills/project-structure-guide/SKILL.md +1 -0
  65. package/bundled/locales/zh-CN/skills/release-standards/SKILL.md +3 -0
  66. package/bundled/locales/zh-CN/skills/requirement-assistant/SKILL.md +2 -0
  67. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +3 -0
  68. package/bundled/locales/zh-CN/skills/runbook-assistant/SKILL.md +1 -0
  69. package/bundled/locales/zh-CN/skills/slo-assistant/SKILL.md +1 -0
  70. package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +2 -0
  71. package/bundled/locales/zh-TW/CHANGELOG.md +47 -3
  72. package/bundled/locales/zh-TW/CLAUDE.md +1 -1
  73. package/bundled/locales/zh-TW/README.md +2 -2
  74. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  75. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +2 -0
  76. package/bundled/locales/zh-TW/core/adr-standards.md +26 -5
  77. package/bundled/locales/zh-TW/core/code-review-checklist.md +2 -0
  78. package/bundled/locales/zh-TW/core/container-image-standards.md +2 -2
  79. package/bundled/locales/zh-TW/core/contract-testing-standards.md +2 -2
  80. package/bundled/locales/zh-TW/core/cross-flow-regression.md +8 -7
  81. package/bundled/locales/zh-TW/core/data-contract.md +2 -2
  82. package/bundled/locales/zh-TW/core/data-migration-testing.md +2 -2
  83. package/bundled/locales/zh-TW/core/data-pipeline.md +2 -2
  84. package/bundled/locales/zh-TW/core/deferred-item-exit.md +251 -0
  85. package/bundled/locales/zh-TW/core/documentation-writing-standards.md +228 -3
  86. package/bundled/locales/zh-TW/core/full-coverage-testing.md +15 -2
  87. package/bundled/locales/zh-TW/core/governance-layer.md +118 -5
  88. package/bundled/locales/zh-TW/core/iac-design-principles.md +2 -2
  89. package/bundled/locales/zh-TW/core/incident-response.md +2 -2
  90. package/bundled/locales/zh-TW/core/model-provenance.md +4 -2
  91. package/bundled/locales/zh-TW/core/pii-classification.md +42 -6
  92. package/bundled/locales/zh-TW/core/prd-standards.md +4 -2
  93. package/bundled/locales/zh-TW/core/product-metrics-standards.md +4 -2
  94. package/bundled/locales/zh-TW/core/release-readiness-gate.md +2 -2
  95. package/bundled/locales/zh-TW/core/resource-cost-boundary.md +2 -2
  96. package/bundled/locales/zh-TW/core/retrospective-standards.md +5 -3
  97. package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +83 -5
  98. package/bundled/locales/zh-TW/core/runbook.md +2 -2
  99. package/bundled/locales/zh-TW/core/schema-evolution.md +2 -2
  100. package/bundled/locales/zh-TW/core/secret-management-standards.md +2 -2
  101. package/bundled/locales/zh-TW/core/slo-sli.md +2 -2
  102. package/bundled/locales/zh-TW/core/spec-driven-development.md +2 -0
  103. package/bundled/locales/zh-TW/core/tech-debt-standards.md +71 -4
  104. package/bundled/locales/zh-TW/core/turn-completion-integrity.md +190 -0
  105. package/bundled/locales/zh-TW/core/user-journey-testing.md +2 -2
  106. package/bundled/locales/zh-TW/core/user-story-mapping.md +2 -2
  107. package/bundled/locales/zh-TW/core/verification-oracle.md +2 -2
  108. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +8 -1
  109. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +29 -68
  110. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +25 -15
  111. package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +1 -2
  112. package/bundled/locales/zh-TW/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
  113. package/bundled/locales/zh-TW/integrations/google-antigravity/README.md +3 -3
  114. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +1 -1
  115. package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +2 -0
  116. package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +2 -0
  117. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +22 -12
  118. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +12 -9
  119. package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +1 -0
  120. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +17 -13
  121. package/bundled/locales/zh-TW/skills/commands/config.md +0 -1
  122. package/bundled/locales/zh-TW/skills/commands/init.md +1 -2
  123. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +2 -0
  124. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +2 -1
  125. package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +2 -0
  126. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +1 -1
  127. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +2 -2
  128. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +1 -1
  129. package/bundled/locales/zh-TW/skills/observability-assistant/SKILL.md +1 -0
  130. package/bundled/locales/zh-TW/skills/project-discovery/SKILL.md +1 -0
  131. package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +1 -0
  132. package/bundled/locales/zh-TW/skills/release-standards/SKILL.md +3 -0
  133. package/bundled/locales/zh-TW/skills/requirement-assistant/SKILL.md +2 -0
  134. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +3 -0
  135. package/bundled/locales/zh-TW/skills/runbook-assistant/SKILL.md +1 -0
  136. package/bundled/locales/zh-TW/skills/slo-assistant/SKILL.md +1 -0
  137. package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +2 -0
  138. package/bundled/skills/atdd-assistant/SKILL.md +2 -0
  139. package/bundled/skills/bdd-assistant/SKILL.md +2 -0
  140. package/bundled/skills/brainstorm-assistant/SKILL.md +31 -13
  141. package/bundled/skills/brainstorm-assistant/guide.md +9 -6
  142. package/bundled/skills/code-review-assistant/SKILL.md +1 -0
  143. package/bundled/skills/commands/brainstorm.md +12 -9
  144. package/bundled/skills/commands/config.md +0 -1
  145. package/bundled/skills/commands/init.md +2 -3
  146. package/bundled/skills/commit-standards/SKILL.md +2 -0
  147. package/bundled/skills/contract-test-assistant/SKILL.md +1 -0
  148. package/bundled/skills/dev-methodology/SKILL.md +4 -0
  149. package/bundled/skills/observability-assistant/SKILL.md +1 -0
  150. package/bundled/skills/project-discovery/SKILL.md +1 -0
  151. package/bundled/skills/project-structure-guide/SKILL.md +1 -0
  152. package/bundled/skills/release-standards/SKILL.md +3 -0
  153. package/bundled/skills/requirement-assistant/SKILL.md +2 -0
  154. package/bundled/skills/reverse-engineer/SKILL.md +3 -0
  155. package/bundled/skills/runbook-assistant/SKILL.md +1 -0
  156. package/bundled/skills/slo-assistant/SKILL.md +1 -0
  157. package/bundled/skills/tdd-assistant/SKILL.md +2 -0
  158. package/bundled/templates/.ai-context.yaml.template +194 -0
  159. package/bundled/templates/CLAUDE.md.template +145 -0
  160. package/bundled/templates/DESIGN.md +237 -0
  161. package/bundled/templates/SKILL-BRIEF-TEMPLATE.md +57 -0
  162. package/bundled/templates/SKILL-CANDIDATES.md +39 -0
  163. package/bundled/templates/gates/check-error-exit.mjs +309 -0
  164. package/bundled/templates/mcp-config.json +10 -0
  165. package/bundled/templates/methodology-template.yaml +209 -0
  166. package/bundled/templates/migration-template.md +408 -0
  167. package/bundled/templates/requirement-checklist.md +410 -0
  168. package/bundled/templates/requirement-document-template.md +591 -0
  169. package/bundled/templates/requirement-template.md +881 -0
  170. package/bundled/templates/reverse-spec-template.md +409 -0
  171. package/bundled/templates/test-case-template.md +74 -0
  172. package/bundled/templates/test-plan-template.md +74 -0
  173. package/package.json +7 -5
  174. package/src/commands/audit.js +82 -0
  175. package/src/commands/check.js +66 -10
  176. package/src/commands/init.js +161 -16
  177. package/src/commands/update.js +286 -14
  178. package/src/compilers/claude-code-compiler.js +4 -1
  179. package/src/config/ai-agent-paths.js +62 -17
  180. package/src/core/constants.js +42 -11
  181. package/src/core/manifest.js +201 -3
  182. package/src/core/paths.js +2 -2
  183. package/src/i18n/messages.js +6 -29
  184. package/src/installers/hooks-installer.js +167 -75
  185. package/src/installers/integration-installer.js +9 -5
  186. package/src/prompts/init.js +14 -14
  187. package/src/utils/detector.js +21 -1
  188. package/src/utils/effect-boundary.js +1093 -0
  189. package/src/utils/hasher.js +166 -1
  190. package/src/utils/hook-stats.js +1 -1
  191. package/src/utils/integration-generator.js +79 -1
  192. package/src/utils/reference-sync.js +4 -1
  193. package/src/utils/yaml-generator.js +51 -9
  194. package/standards-registry.json +31 -8
@@ -3,8 +3,8 @@
3
3
 
4
4
  id: reverse-engineering
5
5
  meta:
6
- version: "1.2.0"
7
- updated: "2026-06-27"
6
+ version: "1.3.0"
7
+ updated: "2026-08-20"
8
8
  source: core/reverse-engineering-standards.md
9
9
  description: Standards for reverse engineering code into structured specifications
10
10
 
@@ -54,6 +54,49 @@ workflow:
54
54
  - "PHP-specific: flag loose-comparison / type-juggling (==, truthy/falsy of \"0\"/\"\"/null/0, string-to-number coercion) — no equivalent under strongly-typed targets"
55
55
  gate: pre-flight; unanswered three-question field marked not_implemented and blocks cutover
56
56
 
57
+ - stage: AUTH_SCOPE_EXTRACTION
58
+ description: >
59
+ Extract every legacy query predicate that limits results by the OPERATOR'S OWN
60
+ identity (tenant / org / dept / owner boundary) and verify the ported code has an
61
+ equivalent predicate — not merely an equivalent output shape.
62
+ output: Self-scoping predicate inventory, each locked by a negative cross-tenant test
63
+ certainty: "[Confirmed]/[Inferred]/[Unknown]"
64
+ position: alongside IMPLICIT_RULE_SCAN — after CODE_SCAN/TEST_ANALYSIS, before GAP_IDENTIFICATION
65
+ why_its_own_stage:
66
+ - "The security-critical line looks like a filter: the boundary lives in a WHERE clause, not in the request/response contract"
67
+ - "Shape-based assertions cannot see scope: '200 + non-empty list' passes identically with the scoping clause deleted"
68
+ - "A shared scope resolver existing elsewhere is not evidence THIS call site uses it"
69
+ derive:
70
+ - "Direct self-binding: WHERE <col> = :currentUser / :uid / $operatorId / session.user_id"
71
+ - "Tenant/org/owner columns (tenant_id, org_id, master_account, owner_id, dept_id, company_id) compared against a caller-derived value"
72
+ - "Subquery resolving the caller's own scope: WHERE dept_id = (SELECT dept_id FROM member WHERE account = :uid)"
73
+ - "Role-branched query construction — enumerate EVERY branch, not just the happy path"
74
+ - "Scope applied outside SQL: ORM global scopes, query-builder mixins, repository base classes, row-level-security policies, filter-injecting middleware"
75
+ derive_warning: >
76
+ A grep over SQL alone reports a SMALLER set than exists, because a predicate can be
77
+ enforced by something the SELECT never mentions — and a smaller set here reads exactly
78
+ like a safer one.
79
+ record_per_match:
80
+ - "Location (file:line in legacy source)"
81
+ - "The exact predicate text"
82
+ - "Self-binding: which caller-derived value it resolves to, and how that value is obtained"
83
+ - "Triggering branch: which role / parameter / code path reaches it"
84
+ - "Certainty [Confirmed] (file:line required) / [Inferred] / [Unknown]"
85
+ oracle_predicate_equivalence:
86
+ - "A literal equivalent exists in the ported code — same field, same notion of 'self'. A different field that happens to return the same rows today is a coincidence with an expiry date"
87
+ - "Every role branch is covered. Collapsing five role branches into one coarse 'is this an administrator?' check replaces a boundary with a permission"
88
+ - "THIS call site invokes the shared scope resolver, if one exists. The utility existing elsewhere is not evidence about this endpoint"
89
+ mandatory_negative_test: >
90
+ Operator A issues the request; the assertion is that operator B's records are ABSENT
91
+ from the response, with A and B both valid and authenticated. The assertion must be
92
+ about ABSENCE — a 200 / non-empty-list / matching-schema assertion is not sufficient
93
+ evidence and must not be counted as coverage. Self-check: delete the scoping predicate
94
+ in a scratch copy and re-run; if the test still passes it is not testing scope.
95
+ gate: >
96
+ Pre-flight for extraction, pre-UAT for the negative tests. A self-scoping predicate
97
+ whose ported equivalent is unverified, or which has no negative test, is marked
98
+ not_implemented and blocks cutover.
99
+
57
100
  - stage: GAP_IDENTIFICATION
58
101
  description: List unknowns requiring human input
59
102
  output: Gap analysis document
@@ -284,6 +327,32 @@ rules:
284
327
  is marked not_implemented and blocks cutover.
285
328
  priority: required
286
329
 
330
+ - id: auth-scope-extraction
331
+ trigger: reverse engineering or migrating a system whose data layer is multi-tenant, role-scoped, or owner-scoped
332
+ instruction: >
333
+ Run AUTH_SCOPE_EXTRACTION alongside IMPLICIT_RULE_SCAN. Mechanically derive every legacy
334
+ query predicate that bounds results by the operator's own identity — direct self-bindings,
335
+ tenant/org/owner columns compared to a caller-derived value, subqueries resolving the
336
+ caller's scope, every branch of role-branched query construction, and scope enforced
337
+ outside SQL (ORM global scopes, repository base classes, RLS policies, filter-injecting
338
+ middleware). Record each with file:line, the exact predicate, its self-binding, the
339
+ triggering branch, and a certainty tag; route [Unknown] to gap analysis, never assume
340
+ absent. For each, verify the ported code has a LITERAL equivalent (same field, same notion
341
+ of self) on EVERY branch, and that this specific call site invokes the shared scope
342
+ resolver if one exists — the resolver existing elsewhere is not evidence about this
343
+ endpoint.
344
+ priority: required
345
+ - id: auth-scope-negative-test
346
+ trigger: locking a confirmed self-scoping predicate as a verifiable oracle
347
+ instruction: >
348
+ Require a negative test: operator A's request must NOT return operator B's records, with
349
+ A and B both valid and authenticated. The assertion must be about the ABSENCE of the other
350
+ operator's records. A "200 with data" or matching-schema assertion is not sufficient
351
+ evidence and must not be counted as coverage — it passes identically with the scoping
352
+ clause deleted. Any predicate with an unverified ported equivalent or no negative test is
353
+ marked not_implemented and blocks cutover.
354
+ priority: required
355
+
287
356
  - id: human-review-required
288
357
  trigger: completing spec generation
289
358
  instruction: Always mark specification as requiring human review; [Unknown] sections MUST be filled by humans
@@ -320,6 +389,7 @@ quick_reference:
320
389
  - [Code Scan, Technical inventory, "[Confirmed]"]
321
390
  - [Test Analysis, Draft AC, "[Confirmed]/[Inferred]"]
322
391
  - [Implicit Rule Scan, Non-HTTP implicit-rule inventory, "[Confirmed]/[Inferred]/[Unknown]"]
392
+ - [Auth Scope Extraction, Self-scoping predicate inventory + negative tests, "[Confirmed]/[Inferred]/[Unknown]"]
323
393
  - [Gap ID, Gap analysis, "[Unknown] items"]
324
394
  - [Spec Gen, Draft SPEC, Mixed]
325
395
  - [Human Review, Validated spec, "[Confirmed]"]
@@ -341,6 +411,7 @@ quick_reference:
341
411
  - ["/reverse-tdd", Analyze test coverage against BDD]
342
412
 
343
413
  related_standards:
414
+ - test-completeness-dimensions.md # Dimension 4 names the cross-tenant test; AUTH_SCOPE_EXTRACTION decides which ones you need
344
415
  - anti-hallucination.md
345
416
  - spec-driven-development.md
346
417
  - behavior-driven-development.md
@@ -153,7 +153,7 @@ enforcement:
153
153
  trigger: PreToolUse
154
154
  matcher:
155
155
  tool: Bash
156
- script_ref: "scripts/hooks/check-dangerous-cmd.js"
157
- hook_script: "scripts/hooks/check-dangerous-cmd.js"
156
+ script_ref: "scripts/hooks/check-dangerous-cmd.mjs"
157
+ hook_script: "scripts/hooks/check-dangerous-cmd.mjs"
158
158
  severity: error
159
159
  timeout_ms: 500
@@ -3,8 +3,8 @@
3
3
 
4
4
  id: spec-driven-development
5
5
  meta:
6
- version: "1.4.0"
7
- updated: "2026-08-12"
6
+ version: "1.5.0"
7
+ updated: "2026-08-24"
8
8
  source: methodologies/guides/sdd-guide.md
9
9
  description: Spec-Driven Development workflow where documentation precedes implementation
10
10
 
@@ -254,3 +254,15 @@ quick_reference:
254
254
  - [OpenSpec, "/openspec proposal, /openspec approve"]
255
255
  - [Spec Kit, "/spec create, /spec close"]
256
256
  - [Manual, "specs/SPEC-XXX.md"]
257
+
258
+ # ── Deferred items produced here ─────────────────────────────────────────────
259
+ # Pointer, not a summary: the exit invariant is stated once, in deferred-item-exit.
260
+ deferred_items:
261
+ produced_here:
262
+ - "out-of-scope / not-in-this-version entries"
263
+ - "open questions"
264
+ - "assumptions awaiting confirmation"
265
+ governed_by: deferred-item-exit
266
+ note: >
267
+ 規則只在 core/deferred-item-exit.md 一處陳述;此處放指標不放摘要。
268
+ 摘要會腐壞,指標不會。
@@ -3,10 +3,10 @@
3
3
 
4
4
  id: tech-debt-standards
5
5
  meta:
6
- version: "1.0.0"
7
- updated: "2026-03-31"
6
+ version: "1.1.0"
7
+ updated: "2026-08-20"
8
8
  source: core/tech-debt-standards.md
9
- description: Tech debt taxonomy, registry, budget, impact matrix, and metrics
9
+ description: Tech debt taxonomy, registry, budget, impact matrix, metrics, and overdue handling
10
10
 
11
11
  taxonomy:
12
12
  design: "Architecture/design decisions — impacts maintainability, scalability"
@@ -34,6 +34,50 @@ registry_fields:
34
34
  - "Target resolution date"
35
35
  - "Status (Open→Scheduled→In Progress→Resolved→Verified)"
36
36
 
37
+ registry_storage_options:
38
+ # Each option is legal ONLY if it also satisfies its overdue-check condition.
39
+ options:
40
+ - option: "docs/tech-debt-registry.md"
41
+ best_for: "Small teams, simple tracking"
42
+ overdue_check_condition: "A repository check parses the table and fails on rows past Target Resolution Date — OR an Unattended Declaration is present"
43
+ - option: "Issue tracker (GitHub Issues, Jira)"
44
+ best_for: "Larger teams, workflow integration"
45
+ overdue_check_condition: "A scheduled due-date query that actually RUNS and raises; a saved filter nobody opens is not a check — OR an Unattended Declaration"
46
+ - option: "Dedicated spreadsheet"
47
+ best_for: "Non-technical stakeholders"
48
+ overdue_check_condition: "Only if exported on a stated cadence to a location a check reads — OR an Unattended Declaration"
49
+ rationale: >
50
+ A registry no program can read satisfies every other requirement (11 fields, Owner,
51
+ Target Resolution Date). Nothing is wrong with it until the date passes and nothing
52
+ happens. The spreadsheet option is deliberately kept; what is forbidden is any storage
53
+ option being a place where dates expire unobserved.
54
+
55
+ overdue_handling:
56
+ principle: "A Target Resolution Date that passes with no consequence is indistinguishable from no date at all"
57
+ legal_dispositions:
58
+ resolve:
59
+ meaning: "Do the work"
60
+ trace: "Registry entry closed + `Tech-Debt: TD-NNN resolved` commit footer"
61
+ withdraw:
62
+ meaning: "Decide not to do it, and delete the record"
63
+ trace: "Entry marked withdrawn with a reason and a date"
64
+ extend:
65
+ meaning: "Set a new Target Resolution Date"
66
+ trace: "New date AND a written reason recorded together; earlier dates stay visible (append, never overwrite)"
67
+ no_fourth_disposition: "'Still open, date passed, nobody looked' is not a permitted state"
68
+ registry_states:
69
+ checked: "A named, runnable check reads the registry and fails on items past Target Resolution Date"
70
+ unattended: "No such check exists; an Unattended Declaration naming owner + review cadence + last-review date is present"
71
+ neither: "Non-compliant"
72
+ unattended_declaration_template: >
73
+ Unattended — no automated check reads this registry for overdue items.
74
+ Reviewed manually by <owner> on a <cadence> cadence. Last reviewed: <date>.
75
+ known_cost: >
76
+ This standard ships no checker. Adopters wanting the Checked state must write it
77
+ themselves and most will not — the same failure mode the section describes. The minimum
78
+ bar is therefore not "build a checker" but "never let a registry be silently unattended":
79
+ declaring Unattended is fully compliant; being unattended without declaring it is not.
80
+
37
81
  budget:
38
82
  new_project: "10% of dev time"
39
83
  mature_project: "15% of dev time"
@@ -54,3 +98,43 @@ metrics:
54
98
  - "High priority ratio (P0+P1 < 20%)"
55
99
 
56
100
  commit_marking: "Tech-Debt: TD-NNN (introduced|resolved: description)"
101
+
102
+ rules:
103
+ - id: td-exp-001
104
+ trigger: an item is past its Target Resolution Date
105
+ instruction: >
106
+ Treat it as a finding, not a neutral background condition. Apply exactly one of the
107
+ three dispositions (resolve / withdraw / extend-with-reason). A registry holding an
108
+ overdue item with no disposition applied is non-compliant.
109
+ priority: required
110
+ - id: td-exp-002
111
+ trigger: designing or reviewing any automation over the tech debt registry
112
+ instruction: >
113
+ Never implement expiry as automatic extension or automatic closure. Automatic extension
114
+ makes the date unfalsifiable so it measures nothing; automatic closure deletes the record
115
+ without anyone deciding to. Both stop the clock and neither leaves a trace.
116
+ priority: required
117
+ - id: td-exp-003
118
+ trigger: extending a Target Resolution Date
119
+ instruction: >
120
+ Record the reason next to the new date. Changing only the date is not an extension, it is
121
+ an erasure with a timestamp on it.
122
+ priority: required
123
+ - id: td-exp-004
124
+ trigger: an item has been extended three or more times with no progress between extensions
125
+ instruction: Re-triage it as a Withdraw candidate rather than issuing a fourth date.
126
+ priority: recommended
127
+ - id: td-exp-005
128
+ trigger: creating or auditing a tech debt registry, in any storage format
129
+ instruction: >
130
+ Put the registry in exactly one of two states and make which one visible inside the
131
+ registry: Checked (a named runnable check fails on overdue items) or Unattended (an
132
+ Unattended Declaration naming owner, review cadence, and last-review date). Neither state
133
+ declared means non-compliant.
134
+ priority: required
135
+ - id: td-exp-006
136
+ trigger: reading an Unattended Declaration
137
+ instruction: >
138
+ Apply the declaration's own cadence to its "Last reviewed" date. A declaration whose last
139
+ review is older than its stated cadence is itself an overdue item.
140
+ priority: required
@@ -0,0 +1,131 @@
1
+ # Turn Completion Integrity - AI Optimized
2
+ # Source: core/turn-completion-integrity.md
3
+
4
+ id: turn-completion-integrity
5
+ meta:
6
+ version: "1.3.0"
7
+ updated: "2026-09-08"
8
+ source: core/turn-completion-integrity.md
9
+ description: An agent must not end a turn having stated a next action it did not take; enforced at turn end, not by instruction
10
+ related:
11
+ - agent-behavior-discipline
12
+ - ai-response-navigation
13
+ - anti-hallucination
14
+
15
+ rules:
16
+ r1_commitment_must_be_kept:
17
+ summary: A stated next action is not optional
18
+ rule: If the final message states a first-person commitment to a next action, the turn must not end until that action is taken or the blocker is named
19
+ do:
20
+ - Take the action before ending the turn
21
+ - Or name, per item, the person or input it waits on
22
+ do_not:
23
+ - End on "the main parts are done"
24
+ - End on a sentence describing work that was not performed
25
+
26
+ r2_blocker_statement_is_itemized:
27
+ summary: A blocker statement names who or what each item waits on
28
+ rule: Ending without acting is permitted only when every remaining item is listed with its blocker
29
+ do:
30
+ - "State: item X waits on the user's key; item Y waits on nothing and is being done now"
31
+ do_not:
32
+ - Summarize progress in place of listing blockers
33
+
34
+ r3_enforce_at_the_decision_point:
35
+ summary: An instruction is not enforcement
36
+ rule: R1 must be evaluated at turn end by something that is not the agent
37
+ rationale: The instruction form of this rule was violated inside the same session that read it, and again seven days after being published as an optional standard with no checker
38
+
39
+ r4_never_block_on_standing_work:
40
+ summary: Fire only on a commitment made in this message
41
+ rule: The check must not consult repository state such as open TODOs or backlog items
42
+ rationale: A gate that is true on every turn gets disabled, and then protects nothing
43
+
44
+ r5_fail_open:
45
+ summary: Any error lets the turn end
46
+ rule: Unreadable transcript, missing field, malformed JSON, or unexpected schema must all exit without blocking
47
+ rationale: A hook that can trap a session is worse than none — the human's only recovery is to disable it permanently
48
+
49
+ r6_bound_the_blocking:
50
+ summary: Cooldown plus a rolling-window cap
51
+ rule: Enforce a cooldown between blocks and a maximum number of blocks per rolling time window
52
+ do_not:
53
+ - Count the cap per session with no reset — that is an off switch on a delay, and it disarms silently in long sessions
54
+
55
+ r7_each_language_ships_its_own_corpus:
56
+ summary: Language coverage is a correctness property
57
+ rule: Each supported language ships as a locale pack with its own must-block and must-pass corpus, and that corpus runs in CI
58
+ rationale: A detector carrying one language's patterns, shipped to an adopter working in another, is installed, runs, exits 0, and can never fire — indistinguishable from good behavior
59
+
60
+ r9_exempt_a_human_directed_stop:
61
+ summary: The human can end the turn, and the agent's words cannot say so
62
+ rule: The check must exempt a turn the human asked to end, decided from the human's own most recent message
63
+ rationale: Measured on the first real firing after shipping — a turn ending by instruction and a turn ending on an abandoned commitment produce the same words from the agent, because in both the agent names work it is not doing now
64
+
65
+ r10_keep_the_stop_pattern_narrow:
66
+ summary: A false exemption silences the check for the rest of the session
67
+ rule: The stop-request pattern must be narrow, and its corpus must include work instructions that merely contain a stopping word
68
+ rationale: During implementation the pattern matched "stop using the hardcoded list and walk the registry instead" — an instruction to do work, read as an instruction to stop
69
+
70
+ r11_recognise_your_own_block_message:
71
+ summary: The check's own output re-enters the input it reads
72
+ rule: The block message must carry a fixed marker, and any human turn containing it must be skipped when looking for the human's last message
73
+ rationale: Without this R9 works exactly once — the block message becomes "the human's most recent message" on the next run, hiding the real instruction to stop, silently and only in the situation the exemption was built for
74
+
75
+ r12_recognise_the_ending_you_demand:
76
+ summary: A check that cannot see the ending R2 defines punishes correct behaviour
77
+ rule: The check must recognise an itemized blocker list and must not block it
78
+ requires:
79
+ - two or more list items — one item with an attribution is a sentence, not an itemization
80
+ - a blocker attribution anywhere in the message, not per item (real writing puts it in the preamble)
81
+ - no vague-completion phrase ("the rest are done" is the summary R2 rejects)
82
+ - the attribution search must exclude the check's own headings, or a heading containing "you" satisfies it
83
+ rationale: Blocking the one ending the standard asks for gets the check uninstalled faster than missing a violation
84
+
85
+ r8_declare_unsupported_languages:
86
+ summary: Say when the check is inactive
87
+ rule: An adopter whose language has no locale pack must be told the check cannot fire for them
88
+
89
+ detector_shape:
90
+ match: first-person future marker plus an action verb within one sentence
91
+ exclusions:
92
+ - reporting verbs (say, note, mention) — describing is not doing
93
+ - negation — a refusal is a decision, not a commitment
94
+ - quoted or tabular text — examples of the pattern are not instances of it
95
+ scope: sentence, not paragraph
96
+ rationale: Each exclusion was added because its absence produced a false block in testing
97
+
98
+ prohibited_behaviors:
99
+ - id: stated-but-undone
100
+ description: Do NOT end a turn on a sentence describing a next action that was not performed
101
+ correct_action: Perform it, or list every remaining item with its blocker
102
+
103
+ - id: instruction-as-enforcement
104
+ description: Do NOT treat a rule in the agent's instructions as enforcement of that rule
105
+ correct_action: Evaluate it at the decision point with an external check
106
+
107
+ - id: monolingual-detector
108
+ description: Do NOT ship a prose detector without a corpus for every language it claims to cover
109
+ correct_action: Ship a locale pack per language, each with a corpus that runs in CI
110
+
111
+ enforcement:
112
+ hook_type: Stop
113
+ trigger: Stop
114
+ matcher: ""
115
+ script_ref: "scripts/hooks/check-turn-completion.mjs"
116
+ hook_script: "scripts/hooks/check-turn-completion.mjs"
117
+ severity: warning
118
+ timeout_ms: 2000
119
+
120
+ checklist:
121
+ - The check runs at turn end, not as an instruction to the agent
122
+ - Every failure path exits without blocking
123
+ - A cooldown and a rolling-window cap are both present
124
+ - Each shipped language has a corpus, and the corpus runs in CI
125
+ - Adopters in unsupported languages are told the check is inactive
126
+ - The check does not consult repository state
127
+ - A turn the human asked to end is exempt, decided from the human's message
128
+ - The stop-request corpus includes work instructions containing a stopping word
129
+ - The check recognises its own block message and does not read it as the human's
130
+ - The check recognises the itemized blocker ending R2 defines, and does not block it
131
+ - The attribution search excludes the check's own headings and scaffolding
@@ -2,8 +2,8 @@
2
2
 
3
3
  > **Language**: English | [繁體中文](../locales/zh-TW/core/acceptance-criteria-traceability.md)
4
4
 
5
- **Version**: 1.1.0
6
- **Last Updated**: 2026-06-19
5
+ **Version**: 1.2.0
6
+ **Last Updated**: 2026-08-24
7
7
  **Applicability**: All software projects using specification-driven or test-driven workflows
8
8
  **Scope**: universal
9
9
 
@@ -231,6 +231,8 @@ Exceptions to coverage requirements MUST be documented:
231
231
  | Infrastructure limitation | Test environment constraint | Workaround plan |
232
232
  | Deferred to next iteration | Agreed with stakeholders | Ticket reference |
233
233
 
234
+ > **Deferred items** this standard produces — `Gaps` (Uncovered AC / Partial AC), the exceptions above, and the report's `Action Items` — are governed by [deferred-item-exit](deferred-item-exit.md). | 本標準產出的**延後項目**(`Gaps` 的 Uncovered AC/Partial AC、上表的例外、報告的 `Action Items`)適用 [deferred-item-exit](deferred-item-exit.md)。
235
+
234
236
  ---
235
237
 
236
238
  ## AC Coverage Report Format
@@ -382,3 +384,4 @@ Generated spec MUST include:
382
384
  |---------|------|---------|
383
385
  | 1.0.0 | 2026-03-18 | Initial version — traceability matrix, coverage calculation, spec generation rules |
384
386
  | 1.1.0 | 2026-05-12 | Add `not_implemented` 4th status; update CI gate formula; add decision tree (XSPEC-199) |
387
+ | 1.2.0 | 2026-08-24 | Pointer to `deferred-item-exit` for coverage gaps, threshold exceptions and report action items (XSPEC-391 R5) |
@@ -2,8 +2,8 @@
2
2
 
3
3
  > **Language**: English | [繁體中文](../locales/zh-TW/core/adr-standards.md)
4
4
 
5
- **Version**: 1.0.0
6
- **Last Updated**: 2026-03-26
5
+ **Version**: 1.1.0
6
+ **Last Updated**: 2026-08-24
7
7
  **Applicability**: All software projects making architectural decisions
8
8
  **Scope**: universal
9
9
  **Industry Standards**: ISO/IEC/IEEE 42010 (Architecture Description), TOGAF ADR
@@ -81,6 +81,26 @@ Chosen option: **[Option N]**, because [justification].
81
81
  - [Related ADRs, SPECs, PRs, or external references]
82
82
  ```
83
83
 
84
+ > **Deferred items** recorded in this template — accepted risks and negative consequences under `Consequences`, and options considered but not taken up — are governed by [deferred-item-exit](deferred-item-exit.md). | 此範本中記下的**延後項目**(`Consequences` 下的既受風險與負面後果、被考慮而未採用的選項)適用 [deferred-item-exit](deferred-item-exit.md)。
85
+
86
+ ---
87
+
88
+ ## Acceptance Criteria Live in the SPEC
89
+
90
+ An ADR records a **decision**. It does not carry acceptance criteria of its own. Where a decision has acceptance criteria, they are maintained in **exactly one place — the SPEC** — and the ADR reaches them by link, from `Technical Story` or `Links`.
91
+
92
+ A copied AC list has two owners and only one of them is ever updated. The measured consequence: implementation completed, the SPEC's checkboxes ticked, and the ADR's copy left entirely unticked — so a reader of the ADR concludes nothing was built, while AC coverage tooling, which reads the SPEC, cannot see the ADR's copy at all.
93
+
94
+ 一份 ADR 記錄的是**決策**,它不帶自己的一份驗收標準。當一個決策有驗收標準時,
95
+ 它們**只在一處維護——SPEC**,而 ADR 以連結(`Technical Story` 或 `Links`)指向它。
96
+
97
+ 一份被複製的 AC 清單有兩個擁有者,而只有其中一個會被更新。實測後果是:
98
+ 實作完成、SPEC 的勾選框打勾,ADR 那一份**整份留在未勾選狀態**——
99
+ 讀 ADR 的人於是認為什麼都沒做,而讀 SPEC 的 AC 覆蓋率工具**根本看不到 ADR 裡那一份**。
100
+
101
+ > This is a boundary rule about **where an AC is maintained**, not about how ACs are written or labelled. For the AC format itself see [spec-driven-development](spec-driven-development.md); for AC-to-verification traceability see [acceptance-criteria-traceability](acceptance-criteria-traceability.md).
102
+ > 本條是關於 **AC 在哪裡維護**的邊界規則,不涉及 AC 的寫法或標註慣例。
103
+
84
104
  ---
85
105
 
86
106
  ## ADR Numbering
@@ -179,6 +199,8 @@ Before accepting an ADR, verify:
179
199
  - [ ] **Status** is set correctly
180
200
  - [ ] **Links** to related artifacts are included
181
201
  - [ ] File is stored in `docs/adr/` with correct naming
202
+ - [ ] **No acceptance criteria are copied into the ADR** — they are linked to the SPEC that maintains them
203
+ - [ ] Every **deferred item** carries the identifier of its exit ([deferred-item-exit](deferred-item-exit.md))
182
204
 
183
205
  ---
184
206
 
@@ -192,6 +214,8 @@ Before accepting an ADR, verify:
192
214
  | No consequences | Incomplete analysis | Always list good and bad outcomes |
193
215
  | Vague context | Useless for future readers | Include specific constraints and drivers |
194
216
  | Editing accepted ADRs | Lost history | Supersede instead of editing |
217
+ | Copying the SPEC's acceptance criteria into the ADR | Two owners, one updated; the ADR's copy stays unticked and coverage tooling never sees it | Keep one copy in the SPEC; link to it |
218
+ | An accepted risk with no exit | The ADR is the only carrier, and it is now approved | Give it an exit and name the exit here |
195
219
 
196
220
  ---
197
221
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  > **Language**: English | [繁體中文](../locales/zh-TW/core/code-review-checklist.md)
4
4
 
5
- **Version**: 1.4.0
6
- **Last Updated**: 2026-06-18
5
+ **Version**: 1.5.0
6
+ **Last Updated**: 2026-08-24
7
7
  **Applicability**: All software projects with code review processes
8
8
  **Scope**: universal
9
9
  **Industry Standards**: SWEBOK v4.0 Chapter 10
@@ -281,6 +281,8 @@ Is there a specific reason for this approach?
281
281
 
282
282
  > This comment prefix approach aligns with the [Conventional Comments](https://conventionalcomments.org/) specification, which standardizes review feedback across teams and tools.
283
283
 
284
+ > **Deferred items** a review produces — non-blocking comments (`⚠️ IMPORTANT`, `💡 SUGGESTION`, `[SUGGESTION]`, `[NIT]`) accepted without a change in this change — are governed by [deferred-item-exit](deferred-item-exit.md). | Review 產出的**延後項目**(本次未改而被接受的非阻斷留言:`⚠️ IMPORTANT`、`💡 SUGGESTION`、`[SUGGESTION]`、`[NIT]`)適用 [deferred-item-exit](deferred-item-exit.md)。
285
+
284
286
  ### Alternative: Text Labels
285
287
 
286
288
  For teams preferring plain text labels without emojis:
@@ -664,6 +666,7 @@ Comment Prefixes:
664
666
 
665
667
  | Version | Date | Changes |
666
668
  |---------|------|---------|
669
+ | 1.5.0 | 2026-08-24 | Added: pointer to `deferred-item-exit` for non-blocking comments accepted without a change (XSPEC-391 R5) |
667
670
  | 1.4.0 | 2026-06-18 | Added: source + configurability note for PR-size/response-time thresholds (SmartBear/Cisco study, Google practices) + bulk-change exception (XSPEC-292 T8) |
668
671
  | 1.3.0 | 2026-01-12 | Added: Comprehensive Refactoring PRs section with pre-review checklist, review focus areas, large refactoring guidelines, red flags, and best practices |
669
672
  | 1.2.0 | 2026-01-05 | Added: SWEBOK v4.0 Chapter 10 (Software Quality) to References |
@@ -131,7 +131,7 @@ For Claude Code users, a `UserPromptSubmit` hook can automatically inject releva
131
131
  **Requirements:**
132
132
  - Hook execution must complete in < 500ms
133
133
  - Hook failures must not block the user's prompt
134
- - See `scripts/hooks/inject-standards.js` for reference implementation
134
+ - See `scripts/hooks/inject-standards.mjs` for reference implementation
135
135
 
136
136
  ---
137
137