universal-dev-standards 5.0.0-rc.5 → 5.0.0-rc.8
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.
- package/bin/uds.js +16 -1
- package/bundled/ai/options/documentation/api-docs.ai.yaml +17 -2
- package/bundled/ai/standards/context-aware-loading.ai.yaml +17 -0
- package/bundled/ai/standards/documentation-structure.ai.yaml +66 -3
- package/bundled/ai/standards/documentation-writing-standards.ai.yaml +74 -3
- package/bundled/ai/standards/spec-driven-development.ai.yaml +5 -1
- package/bundled/ai/standards/structured-task-definition.ai.yaml +108 -0
- package/bundled/ai/standards/workflow-state-protocol.ai.yaml +121 -0
- package/bundled/core/context-aware-loading.md +44 -4
- package/bundled/core/documentation-structure.md +148 -2
- package/bundled/core/documentation-writing-standards.md +188 -9
- package/bundled/core/spec-driven-development.md +2 -1
- package/bundled/core/structured-task-definition.md +245 -0
- package/bundled/core/workflow-state-protocol.md +287 -0
- package/bundled/locales/zh-CN/CLAUDE.md +2 -2
- package/bundled/locales/zh-CN/README.md +2 -2
- package/bundled/locales/zh-CN/adoption/DAILY-WORKFLOW-GUIDE.md +3 -2
- package/bundled/locales/zh-CN/ai/standards/spec-driven-development.ai.yaml +1 -1
- package/bundled/locales/zh-CN/core/documentation-structure.md +5 -5
- package/bundled/locales/zh-CN/core/documentation-writing-standards.md +5 -5
- package/bundled/locales/zh-CN/core/spec-driven-development.md +10 -9
- package/bundled/locales/zh-CN/core/structured-task-definition.md +255 -0
- package/bundled/locales/zh-CN/core/test-driven-development.md +1 -1
- package/bundled/locales/zh-CN/core/workflow-state-protocol.md +297 -0
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +8 -1
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +17 -9
- package/bundled/locales/zh-CN/docs/OPERATION-WORKFLOW.md +5 -5
- package/bundled/locales/zh-CN/integrations/spec-kit/AGENTS.md +9 -8
- package/bundled/locales/zh-CN/skills/README.md +1 -0
- package/bundled/locales/zh-CN/skills/commands/methodology.md +1 -1
- package/bundled/locales/zh-CN/skills/documentation-guide/SKILL.md +5 -5
- package/bundled/locales/zh-CN/skills/methodology-system/guide.md +1 -1
- package/bundled/locales/zh-CN/skills/spec-driven-dev/guide.md +9 -8
- package/bundled/locales/zh-TW/CLAUDE.md +2 -2
- package/bundled/locales/zh-TW/MAINTENANCE.md +9 -734
- package/bundled/locales/zh-TW/README.md +2 -2
- package/bundled/locales/zh-TW/adoption/DAILY-WORKFLOW-GUIDE.md +3 -2
- package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +1 -1
- package/bundled/locales/zh-TW/ai/standards/spec-driven-development.ai.yaml +1 -1
- package/bundled/locales/zh-TW/core/documentation-structure.md +146 -5
- package/bundled/locales/zh-TW/core/documentation-writing-standards.md +191 -12
- package/bundled/locales/zh-TW/core/spec-driven-development.md +1 -1
- package/bundled/locales/zh-TW/core/structured-task-definition.md +247 -0
- package/bundled/locales/zh-TW/core/workflow-state-protocol.md +289 -0
- package/bundled/locales/zh-TW/docs/CHEATSHEET.md +8 -1
- package/bundled/locales/zh-TW/docs/DEV-WORKFLOW-MAPPING.md +224 -0
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +17 -9
- package/bundled/locales/zh-TW/docs/OPERATION-WORKFLOW.md +5 -5
- package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +407 -0
- package/bundled/locales/zh-TW/integrations/spec-kit/AGENTS.md +9 -8
- package/bundled/locales/zh-TW/methodologies/guides/sdd-guide.md +10 -9
- package/bundled/locales/zh-TW/methodologies/guides/tdd-guide.md +1 -1
- package/bundled/locales/zh-TW/skills/README.md +1 -0
- package/bundled/locales/zh-TW/skills/commands/methodology.md +1 -1
- package/bundled/locales/zh-TW/skills/documentation-guide/SKILL.md +6 -5
- package/bundled/locales/zh-TW/skills/methodology-system/guide.md +1 -1
- package/bundled/locales/zh-TW/skills/spec-driven-dev/guide.md +9 -8
- package/bundled/skills/agents/README.md +65 -0
- package/bundled/skills/agents/spec-analyst.md +32 -0
- package/bundled/skills/commands/methodology.md +1 -1
- package/bundled/skills/commands/sdd.md +128 -2
- package/bundled/skills/documentation-guide/SKILL.md +56 -6
- package/bundled/skills/methodology-system/guide.md +1 -1
- package/bundled/skills/spec-driven-dev/guide.md +10 -9
- package/bundled/skills/workflows/README.md +141 -0
- package/bundled/skills/workflows/feature-dev.workflow.yaml +6 -1
- package/package.json +1 -1
- package/src/commands/check.js +23 -6
- package/src/commands/update.js +9 -2
- package/src/i18n/messages.js +21 -0
- package/src/installers/manifest-installer.js +4 -0
- package/src/utils/config-manager.js +4 -0
- package/src/utils/hasher.js +27 -1
- package/src/utils/integration-generator.js +5 -2
- package/src/utils/npm-registry.js +1 -1
- package/src/utils/standard-validator.js +1 -1
- package/src/utils/update-checker.js +139 -0
- package/standards-registry.json +27 -3
package/bin/uds.js
CHANGED
|
@@ -20,7 +20,8 @@ import { auditCommand } from '../src/commands/audit.js';
|
|
|
20
20
|
import { uninstallCommand } from '../src/commands/uninstall.js';
|
|
21
21
|
import { specCreateCommand, specListCommand, specShowCommand, specConfirmCommand, specArchiveCommand, specDeleteCommand } from '../src/commands/spec.js';
|
|
22
22
|
import { startCommand, missionStatusCommand, missionPauseCommand, missionResumeCommand, missionCancelCommand, missionListCommand } from '../src/commands/start.js';
|
|
23
|
-
import { setLanguage, setLanguageExplicit, detectLanguage } from '../src/i18n/messages.js';
|
|
23
|
+
import { setLanguage, setLanguageExplicit, detectLanguage, t } from '../src/i18n/messages.js';
|
|
24
|
+
import { maybeCheckForUpdates, formatUpdateNotice } from '../src/utils/update-checker.js';
|
|
24
25
|
|
|
25
26
|
const require = createRequire(import.meta.url);
|
|
26
27
|
const pkg = require('../package.json');
|
|
@@ -40,6 +41,19 @@ program
|
|
|
40
41
|
// Explicit setting: mark as explicitly set to prevent override
|
|
41
42
|
setLanguageExplicit(uiLang);
|
|
42
43
|
}
|
|
44
|
+
})
|
|
45
|
+
.hook('postAction', async (thisCommand) => {
|
|
46
|
+
const cmd = thisCommand.name();
|
|
47
|
+
const notifyCommands = ['init', 'list', 'add', 'config'];
|
|
48
|
+
if (!notifyCommands.includes(cmd)) return;
|
|
49
|
+
try {
|
|
50
|
+
const result = await maybeCheckForUpdates(pkg.version);
|
|
51
|
+
if (result?.shouldNotify) {
|
|
52
|
+
console.log(formatUpdateNotice(result, t()));
|
|
53
|
+
}
|
|
54
|
+
} catch {
|
|
55
|
+
// Silent failure — update check should never break CLI
|
|
56
|
+
}
|
|
43
57
|
});
|
|
44
58
|
|
|
45
59
|
program
|
|
@@ -106,6 +120,7 @@ program
|
|
|
106
120
|
.option('--restore', 'Restore all modified and missing files')
|
|
107
121
|
.option('--restore-missing', 'Restore only missing files')
|
|
108
122
|
.option('--no-interactive', 'Disable interactive mode')
|
|
123
|
+
.option('--ci', 'CI mode: disable interactive prompts and set exit code on issues')
|
|
109
124
|
.option('--migrate', 'Migrate legacy manifest to hash-based tracking')
|
|
110
125
|
.option('--offline', 'Skip npm registry check for CLI updates')
|
|
111
126
|
.action(checkCommand);
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
id: api-docs
|
|
5
5
|
meta:
|
|
6
6
|
parent: documentation-structure
|
|
7
|
-
version: "1.
|
|
8
|
-
description: API reference documentation standards
|
|
7
|
+
version: "1.1.0"
|
|
8
|
+
description: API reference documentation standards (enhanced automation)
|
|
9
9
|
|
|
10
10
|
best_for:
|
|
11
11
|
- REST APIs
|
|
@@ -145,6 +145,21 @@ example_endpoint_doc: |
|
|
|
145
145
|
| 400 | Invalid request body |
|
|
146
146
|
| 409 | Email already exists |
|
|
147
147
|
|
|
148
|
+
automation:
|
|
149
|
+
validation:
|
|
150
|
+
- name: Link check
|
|
151
|
+
tool: markdown-link-check
|
|
152
|
+
stage: pre-commit
|
|
153
|
+
- name: OpenAPI lint
|
|
154
|
+
tool: spectral
|
|
155
|
+
stage: PR check
|
|
156
|
+
- name: Example validation
|
|
157
|
+
tool: Custom script (extract + run code blocks)
|
|
158
|
+
stage: PR check
|
|
159
|
+
llm_discovery:
|
|
160
|
+
description: Include API endpoints in llms.txt for LLM-assisted integration
|
|
161
|
+
format: "- [Endpoint Group](docs/api.md#section): Description"
|
|
162
|
+
|
|
148
163
|
tools:
|
|
149
164
|
generators:
|
|
150
165
|
- name: swagger-codegen
|
|
@@ -153,6 +153,23 @@ standard:
|
|
|
153
153
|
/release, /commit → workflow
|
|
154
154
|
priority: required
|
|
155
155
|
|
|
156
|
+
- id: version-check-on-uds-operation
|
|
157
|
+
trigger: "user invokes a UDS slash command or UDS-related operation"
|
|
158
|
+
instruction: >
|
|
159
|
+
When the user invokes a UDS-related slash command (/commit, /sdd,
|
|
160
|
+
/review, /release, /tdd, /bdd, /docs, /changelog, etc.) for the
|
|
161
|
+
FIRST TIME in the current conversation, check for UDS updates:
|
|
162
|
+
|
|
163
|
+
1. Read .standards/manifest.json → extract upstream.version
|
|
164
|
+
2. Run: npm view universal-dev-standards dist-tags --json
|
|
165
|
+
3. Compare upstream.version with the "latest" tag from npm
|
|
166
|
+
4. If a newer version exists, display ONE line before your response:
|
|
167
|
+
"ℹ UDS v{latest} 已發布(目前 v{current})— 執行 `uds update` 更新"
|
|
168
|
+
5. If versions match or npm is unreachable, skip silently
|
|
169
|
+
6. Only check ONCE per conversation — do not repeat on subsequent
|
|
170
|
+
UDS operations in the same session
|
|
171
|
+
priority: optional
|
|
172
|
+
|
|
156
173
|
architecture:
|
|
157
174
|
classification: always-on-protocol
|
|
158
175
|
note: >
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
id: documentation-structure
|
|
5
5
|
meta:
|
|
6
|
-
version: "1.
|
|
7
|
-
updated: "
|
|
6
|
+
version: "1.4.0"
|
|
7
|
+
updated: "2026-03-17"
|
|
8
8
|
source: core/documentation-structure.md
|
|
9
|
-
description: Consistent documentation structure for software projects
|
|
9
|
+
description: Consistent documentation structure for software projects (Diátaxis classification, LLM discovery, doc testing)
|
|
10
10
|
|
|
11
11
|
options:
|
|
12
12
|
documentation_style:
|
|
@@ -68,7 +68,70 @@ structure:
|
|
|
68
68
|
purpose: Architecture diagrams
|
|
69
69
|
formats: [".mmd", ".puml", ".drawio"]
|
|
70
70
|
|
|
71
|
+
diataxis_classification:
|
|
72
|
+
types:
|
|
73
|
+
- id: tutorial
|
|
74
|
+
purpose: Learning-oriented
|
|
75
|
+
user_need: "I want to learn"
|
|
76
|
+
examples: [getting-started.md, first-project-walkthrough.md]
|
|
77
|
+
- id: how-to
|
|
78
|
+
purpose: Task-oriented
|
|
79
|
+
user_need: "I want to accomplish X"
|
|
80
|
+
examples: [deployment.md, migration.md, troubleshooting.md]
|
|
81
|
+
- id: reference
|
|
82
|
+
purpose: Information-oriented
|
|
83
|
+
user_need: "I need to look up Y"
|
|
84
|
+
examples: [api-reference.md, CHANGELOG.md, configuration.md]
|
|
85
|
+
- id: explanation
|
|
86
|
+
purpose: Understanding-oriented
|
|
87
|
+
user_need: "I want to understand why"
|
|
88
|
+
examples: [architecture.md, ADR/, design-rationale.md]
|
|
89
|
+
|
|
90
|
+
llm_discovery:
|
|
91
|
+
files:
|
|
92
|
+
- name: llms.txt
|
|
93
|
+
location: project root
|
|
94
|
+
purpose: Structured index for LLM retrieval systems
|
|
95
|
+
when: Public projects or projects using AI tools
|
|
96
|
+
- name: llms-full.txt
|
|
97
|
+
location: project root
|
|
98
|
+
purpose: Full concatenated docs for complete context
|
|
99
|
+
when: Optional
|
|
100
|
+
|
|
101
|
+
doc_testing:
|
|
102
|
+
layers:
|
|
103
|
+
- name: Link Validation
|
|
104
|
+
tools: [markdown-link-check, lychee]
|
|
105
|
+
ci_stage: pre-commit
|
|
106
|
+
- name: Code Sample Testing
|
|
107
|
+
tools: [doctest, custom scripts]
|
|
108
|
+
ci_stage: PR check
|
|
109
|
+
- name: Structure Validation
|
|
110
|
+
tools: [remark-lint, custom linter]
|
|
111
|
+
ci_stage: pre-commit
|
|
112
|
+
- name: Content Freshness
|
|
113
|
+
tools: [custom date-check script]
|
|
114
|
+
ci_stage: release
|
|
115
|
+
- name: Traceability
|
|
116
|
+
tools: [traceability matrix]
|
|
117
|
+
ci_stage: release
|
|
118
|
+
|
|
71
119
|
rules:
|
|
120
|
+
- id: diataxis-classify
|
|
121
|
+
trigger: creating new documentation
|
|
122
|
+
instruction: Classify document as Tutorial, How-to, Reference, or Explanation and add Document Type header
|
|
123
|
+
priority: recommended
|
|
124
|
+
|
|
125
|
+
- id: llm-discovery
|
|
126
|
+
trigger: creating public project documentation
|
|
127
|
+
instruction: Consider adding llms.txt for LLM discoverability
|
|
128
|
+
priority: recommended
|
|
129
|
+
|
|
130
|
+
- id: doc-testing-links
|
|
131
|
+
trigger: adding documentation
|
|
132
|
+
instruction: Validate all links before committing
|
|
133
|
+
priority: required
|
|
134
|
+
|
|
72
135
|
- id: root-uppercase
|
|
73
136
|
trigger: creating root documentation
|
|
74
137
|
instruction: Use UPPERCASE for root-level docs (README, CONTRIBUTING, CHANGELOG)
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
id: documentation-writing-standards
|
|
5
5
|
meta:
|
|
6
|
-
version: "1.0
|
|
7
|
-
updated: "
|
|
6
|
+
version: "1.1.0"
|
|
7
|
+
updated: "2026-03-17"
|
|
8
8
|
source: core/documentation-writing-standards.md
|
|
9
|
-
description: Documentation requirements based on project types
|
|
9
|
+
description: Documentation requirements based on project types (enhanced ADR, LLM writing, quality metrics, translation-friendly)
|
|
10
10
|
|
|
11
11
|
project_types:
|
|
12
12
|
new_project:
|
|
@@ -127,14 +127,85 @@ document_categories:
|
|
|
127
127
|
naming: "NNN-kebab-case-title.md"
|
|
128
128
|
required_sections:
|
|
129
129
|
- Title
|
|
130
|
+
- Date (YYYY-MM-DD)
|
|
130
131
|
- Status (proposed/accepted/deprecated/superseded)
|
|
132
|
+
- Deciders (who participated)
|
|
131
133
|
- Context
|
|
132
134
|
- Decision
|
|
133
135
|
- Consequences
|
|
134
136
|
recommended_sections:
|
|
137
|
+
- Drivers (key factors)
|
|
135
138
|
- Alternatives Considered
|
|
139
|
+
- Related ADRs (supersedes/superseded-by)
|
|
140
|
+
lifecycle: "proposed → accepted → [deprecated | superseded]"
|
|
141
|
+
decision_matrix:
|
|
142
|
+
description: "When to write ADR (impact × reversibility)"
|
|
143
|
+
adr_required: "High impact + Hard to reverse"
|
|
144
|
+
optional: "High impact + Easy to reverse OR Low impact + Hard to reverse"
|
|
145
|
+
not_needed: "Low impact + Easy to reverse"
|
|
146
|
+
|
|
147
|
+
llm_writing:
|
|
148
|
+
rules:
|
|
149
|
+
- Short paragraphs (3-5 lines)
|
|
150
|
+
- Consistent terminology throughout
|
|
151
|
+
- Always specify language in code blocks
|
|
152
|
+
- Avoid pronoun ambiguity across paragraphs
|
|
153
|
+
- Each H2 section should be context-self-sufficient
|
|
154
|
+
- State explicit negation when distinctions matter
|
|
155
|
+
chunking:
|
|
156
|
+
max_h2_size: "4K-8K tokens (~3000 words)"
|
|
157
|
+
principle: "One topic per H2, front-load summaries"
|
|
158
|
+
retrieval_metadata: [title, scope, difficulty, tags, last_validated]
|
|
159
|
+
|
|
160
|
+
translation_friendly:
|
|
161
|
+
writing_rules:
|
|
162
|
+
- Complete sentences (avoid fragments)
|
|
163
|
+
- Avoid idioms and slang
|
|
164
|
+
- Consistent terminology (follow glossary)
|
|
165
|
+
- Simple SVO sentence structure
|
|
166
|
+
- Explicit references (avoid ambiguous pronouns)
|
|
167
|
+
glossary_file: glossary.md
|
|
168
|
+
translation_status_fields: [translation_status, source_version, source_hash, translated_by, last_synced]
|
|
169
|
+
|
|
170
|
+
quality_metrics:
|
|
171
|
+
leading:
|
|
172
|
+
- name: Coverage
|
|
173
|
+
target: "≥90% public APIs documented"
|
|
174
|
+
- name: Freshness
|
|
175
|
+
target: "All docs updated within 90 days"
|
|
176
|
+
- name: Link Health
|
|
177
|
+
target: "100% valid links"
|
|
178
|
+
- name: Example Validity
|
|
179
|
+
target: "100% code examples run"
|
|
180
|
+
- name: Structure Compliance
|
|
181
|
+
target: "All docs have required sections"
|
|
182
|
+
lagging:
|
|
183
|
+
- Support ticket reduction
|
|
184
|
+
- Onboarding time
|
|
185
|
+
- Doc-related PR comments
|
|
186
|
+
tools: [markdown-link-check, lychee, remark-lint, textstat, vale]
|
|
136
187
|
|
|
137
188
|
rules:
|
|
189
|
+
- id: llm-writing
|
|
190
|
+
trigger: writing documentation
|
|
191
|
+
instruction: Follow LLM-optimized writing rules (short paragraphs, consistent terms, context self-sufficiency)
|
|
192
|
+
priority: recommended
|
|
193
|
+
|
|
194
|
+
- id: translation-friendly
|
|
195
|
+
trigger: writing documentation for multilingual projects
|
|
196
|
+
instruction: Use complete sentences, avoid idioms, follow glossary, use simple sentence structure
|
|
197
|
+
priority: recommended
|
|
198
|
+
|
|
199
|
+
- id: quality-metrics
|
|
200
|
+
trigger: documentation review
|
|
201
|
+
instruction: Check documentation quality metrics (coverage, freshness, link health)
|
|
202
|
+
priority: recommended
|
|
203
|
+
|
|
204
|
+
- id: adr-enhanced
|
|
205
|
+
trigger: creating ADR
|
|
206
|
+
instruction: Include Date, Deciders, Drivers fields; use decision matrix (impact × reversibility) to decide if ADR is needed
|
|
207
|
+
priority: required
|
|
208
|
+
|
|
138
209
|
- id: project-type-docs
|
|
139
210
|
trigger: starting a project
|
|
140
211
|
instruction: Identify project type and create required documents
|
|
@@ -10,6 +10,10 @@ meta:
|
|
|
10
10
|
|
|
11
11
|
workflow:
|
|
12
12
|
stages:
|
|
13
|
+
- stage: Discuss
|
|
14
|
+
description: Capture gray areas, lock scope, establish canonical refs
|
|
15
|
+
artifacts: read_first list, scope definition, gray area log
|
|
16
|
+
|
|
13
17
|
- stage: Proposal
|
|
14
18
|
description: Define what to change and why
|
|
15
19
|
artifacts: proposal.md
|
|
@@ -41,7 +45,7 @@ principles:
|
|
|
41
45
|
|
|
42
46
|
methodology_over_tooling:
|
|
43
47
|
rule: SDD is a methodology, not bound to a single tool
|
|
44
|
-
universal_flow: Proposal -> Review -> Implementation -> Verification -> Archive
|
|
48
|
+
universal_flow: Discuss -> Proposal -> Review -> Implementation -> Verification -> Archive
|
|
45
49
|
|
|
46
50
|
spec_first:
|
|
47
51
|
rule: No functional code changes without approved specification
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Structured Task Definition - AI Optimized
|
|
2
|
+
# Source: core/structured-task-definition.md
|
|
3
|
+
|
|
4
|
+
id: structured-task-definition
|
|
5
|
+
meta:
|
|
6
|
+
version: "1.0.0"
|
|
7
|
+
updated: "2026-03-17"
|
|
8
|
+
source: core/structured-task-definition.md
|
|
9
|
+
description: Standard structure for AI task definitions with 4 required fields
|
|
10
|
+
|
|
11
|
+
principles:
|
|
12
|
+
grounded_execution:
|
|
13
|
+
rule: Every AI task must read specified files before acting
|
|
14
|
+
rationale: Prevents hallucination by establishing ground truth from actual code
|
|
15
|
+
|
|
16
|
+
concrete_actions:
|
|
17
|
+
rule: Task actions must specify exact files, locations, and operations
|
|
18
|
+
rationale: Eliminates vague instructions like "improve" or "enhance"
|
|
19
|
+
|
|
20
|
+
measurable_completion:
|
|
21
|
+
rule: Acceptance criteria must use Given/When/Then format
|
|
22
|
+
rationale: Every criterion is independently verifiable
|
|
23
|
+
|
|
24
|
+
executable_verification:
|
|
25
|
+
rule: Verification uses commands (grep, test, ls), not subjective judgment
|
|
26
|
+
rationale: Machine-verifiable outcomes eliminate ambiguity
|
|
27
|
+
|
|
28
|
+
required_fields:
|
|
29
|
+
read_first:
|
|
30
|
+
description: Files that MUST be read before task execution
|
|
31
|
+
purpose: Establish ground truth, prevent hallucination
|
|
32
|
+
format: "List of {path, reason} entries"
|
|
33
|
+
rules:
|
|
34
|
+
- All listed files must exist
|
|
35
|
+
- Include implementation files AND their tests
|
|
36
|
+
- Include relevant spec documents (if SDD active)
|
|
37
|
+
|
|
38
|
+
action:
|
|
39
|
+
description: Concrete steps with exact file paths and operations
|
|
40
|
+
purpose: Remove all ambiguity about what to do
|
|
41
|
+
format: "List of {step, file, operation, location, description}"
|
|
42
|
+
operations: [add, modify, delete, move, rename]
|
|
43
|
+
rules:
|
|
44
|
+
- Each step specifies a single file
|
|
45
|
+
- Line numbers provide context (approximate OK)
|
|
46
|
+
- No step should be "do whatever seems right"
|
|
47
|
+
|
|
48
|
+
acceptance_criteria:
|
|
49
|
+
description: GWT-format completion conditions
|
|
50
|
+
purpose: Testable conditions with no room for "it seems to work"
|
|
51
|
+
format: "List of {id, given, when, then}"
|
|
52
|
+
rules:
|
|
53
|
+
- Use Given/When/Then format
|
|
54
|
+
- Each AC independently verifiable
|
|
55
|
+
- Include regression criteria
|
|
56
|
+
- Number for traceability (AC-1, AC-2)
|
|
57
|
+
|
|
58
|
+
verification:
|
|
59
|
+
description: Executable commands that verify completion
|
|
60
|
+
purpose: Machine-verifiable outcomes
|
|
61
|
+
format: "List of {command, expect}"
|
|
62
|
+
rules:
|
|
63
|
+
- Every AC has at least one verification command
|
|
64
|
+
- Prefer deterministic checks (grep, test, ls)
|
|
65
|
+
- Include test execution
|
|
66
|
+
- Failed verification = task not complete
|
|
67
|
+
|
|
68
|
+
rules:
|
|
69
|
+
- id: task-must-have-read-first
|
|
70
|
+
trigger: creating AI task or sub-task
|
|
71
|
+
instruction: >
|
|
72
|
+
Every task must include a read_first field listing files to read
|
|
73
|
+
before execution. This establishes ground truth and prevents
|
|
74
|
+
hallucination about code structure or API signatures.
|
|
75
|
+
priority: required
|
|
76
|
+
|
|
77
|
+
- id: task-must-have-concrete-actions
|
|
78
|
+
trigger: defining task actions
|
|
79
|
+
instruction: >
|
|
80
|
+
Task actions must specify exact file paths, line locations,
|
|
81
|
+
and operations (add/modify/delete/move/rename). Vague instructions
|
|
82
|
+
like "improve error handling" or "add validation" are not acceptable.
|
|
83
|
+
priority: required
|
|
84
|
+
|
|
85
|
+
- id: task-must-have-verification
|
|
86
|
+
trigger: completing task definition
|
|
87
|
+
instruction: >
|
|
88
|
+
Every task must include verification commands that can objectively
|
|
89
|
+
confirm completion. Use grep, test commands, file existence checks,
|
|
90
|
+
or test suite execution — never subjective judgment like "looks good."
|
|
91
|
+
priority: required
|
|
92
|
+
|
|
93
|
+
- id: task-scope-matching
|
|
94
|
+
trigger: evaluating whether to apply full structure
|
|
95
|
+
instruction: >
|
|
96
|
+
Apply full 4-field structure for features, bug fixes, and refactoring.
|
|
97
|
+
Trivial changes (typos, formatting) may skip. Hotfixes need at minimum
|
|
98
|
+
read_first + verification.
|
|
99
|
+
priority: recommended
|
|
100
|
+
|
|
101
|
+
quick_reference:
|
|
102
|
+
fields:
|
|
103
|
+
columns: [Field, Purpose, Anti-Pattern Prevented]
|
|
104
|
+
rows:
|
|
105
|
+
- [read_first, Establish ground truth, Anti-hallucination]
|
|
106
|
+
- [action, Concrete steps, Anti-ambiguity]
|
|
107
|
+
- [acceptance_criteria, GWT conditions, Anti-omission]
|
|
108
|
+
- [verification, Executable checks, Anti-subjectivity]
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Workflow State Protocol - AI Optimized
|
|
2
|
+
# Source: core/workflow-state-protocol.md
|
|
3
|
+
|
|
4
|
+
id: workflow-state-protocol
|
|
5
|
+
meta:
|
|
6
|
+
version: "1.0.0"
|
|
7
|
+
updated: "2026-03-17"
|
|
8
|
+
source: core/workflow-state-protocol.md
|
|
9
|
+
description: Protocol for persisting and restoring workflow state across AI sessions
|
|
10
|
+
|
|
11
|
+
principles:
|
|
12
|
+
state_persistence:
|
|
13
|
+
rule: Multi-phase workflows must save state at phase transitions
|
|
14
|
+
rationale: Enables resumption after session boundaries without state loss
|
|
15
|
+
|
|
16
|
+
event_sourcing:
|
|
17
|
+
rule: Important decisions and transitions are logged in append-only event log
|
|
18
|
+
rationale: Provides audit trail and enables understanding of workflow history
|
|
19
|
+
|
|
20
|
+
session_independence:
|
|
21
|
+
rule: Each AI session should be able to resume any workflow from saved state
|
|
22
|
+
rationale: Context window limits make single-session completion unreliable
|
|
23
|
+
|
|
24
|
+
state_file:
|
|
25
|
+
location: ".workflow-state/{workflow}-{id}.yaml"
|
|
26
|
+
required_fields:
|
|
27
|
+
- workflow # Workflow type (sdd, feature-dev, etc.)
|
|
28
|
+
- spec_id # Spec or task identifier
|
|
29
|
+
- current_phase # Active phase ID
|
|
30
|
+
- status # in-progress | paused | blocked | completed | abandoned
|
|
31
|
+
- updated # Last update timestamp (ISO 8601)
|
|
32
|
+
- phases_completed # Ordered list of completed phase IDs
|
|
33
|
+
optional_fields:
|
|
34
|
+
- title
|
|
35
|
+
- iteration_count
|
|
36
|
+
- created
|
|
37
|
+
- artifacts
|
|
38
|
+
- progress_summary
|
|
39
|
+
- completed_steps
|
|
40
|
+
- next_steps
|
|
41
|
+
- open_questions
|
|
42
|
+
- decisions
|
|
43
|
+
|
|
44
|
+
event_log:
|
|
45
|
+
location: ".workflow-state/{workflow}-{id}.log.yaml"
|
|
46
|
+
format: append-only YAML list
|
|
47
|
+
event_types:
|
|
48
|
+
- phase_enter # Workflow enters a new phase
|
|
49
|
+
- phase_exit # Workflow exits a phase
|
|
50
|
+
- checkpoint # Notable milestone
|
|
51
|
+
- decision # Important decision made
|
|
52
|
+
- error # Error or failure
|
|
53
|
+
- interruption # Workflow paused (HITL or context limit)
|
|
54
|
+
- resumption # Workflow resumed from saved state
|
|
55
|
+
required_event_fields:
|
|
56
|
+
- timestamp
|
|
57
|
+
- event_type
|
|
58
|
+
- phase
|
|
59
|
+
- summary
|
|
60
|
+
|
|
61
|
+
rules:
|
|
62
|
+
- id: state-save-on-phase-transition
|
|
63
|
+
trigger: workflow phase changes
|
|
64
|
+
instruction: >
|
|
65
|
+
When a workflow transitions between phases, update the state file
|
|
66
|
+
with new current_phase, add the completed phase to phases_completed,
|
|
67
|
+
and update the timestamp. Also append a phase_exit and phase_enter
|
|
68
|
+
event to the event log.
|
|
69
|
+
priority: required
|
|
70
|
+
|
|
71
|
+
- id: state-load-on-resume
|
|
72
|
+
trigger: session start or workflow command invocation
|
|
73
|
+
instruction: >
|
|
74
|
+
At session start, check .workflow-state/ for any files with
|
|
75
|
+
status 'in-progress' or 'paused'. If found, inform the user
|
|
76
|
+
of active workflows and offer to resume. When a workflow command
|
|
77
|
+
is invoked (e.g., /sdd implement SPEC-042), check for existing
|
|
78
|
+
state before starting fresh.
|
|
79
|
+
priority: required
|
|
80
|
+
|
|
81
|
+
- id: state-save-on-session-end
|
|
82
|
+
trigger: AI session ending with active workflow
|
|
83
|
+
instruction: >
|
|
84
|
+
Before ending a session during an active workflow, save current
|
|
85
|
+
progress to the state file. Update progress_summary, next_steps,
|
|
86
|
+
and open_questions to enable seamless resumption.
|
|
87
|
+
priority: required
|
|
88
|
+
|
|
89
|
+
- id: event-log-on-decision
|
|
90
|
+
trigger: important design or scope decision made
|
|
91
|
+
instruction: >
|
|
92
|
+
When a significant decision is made during a workflow (design choice,
|
|
93
|
+
scope change, technology selection), append a 'decision' event to the
|
|
94
|
+
event log with the decision summary and reasoning.
|
|
95
|
+
priority: recommended
|
|
96
|
+
|
|
97
|
+
- id: state-staleness-warning
|
|
98
|
+
trigger: loading state file older than 7 days
|
|
99
|
+
instruction: >
|
|
100
|
+
If a state file's 'updated' timestamp is more than 7 days old,
|
|
101
|
+
warn the user that the workflow state may be stale and suggest
|
|
102
|
+
reviewing it before continuing.
|
|
103
|
+
priority: recommended
|
|
104
|
+
|
|
105
|
+
- id: gitignore-workflow-state
|
|
106
|
+
trigger: creating .workflow-state/ directory
|
|
107
|
+
instruction: >
|
|
108
|
+
Recommend adding .workflow-state/ to .gitignore as workflow state
|
|
109
|
+
is session-specific. Exception: teams sharing state across developers
|
|
110
|
+
may version-control it but should clean up completed workflows.
|
|
111
|
+
priority: recommended
|
|
112
|
+
|
|
113
|
+
quick_reference:
|
|
114
|
+
state_lifecycle:
|
|
115
|
+
columns: [Event, Action]
|
|
116
|
+
rows:
|
|
117
|
+
- [Phase transition, Update state file + append event log]
|
|
118
|
+
- [Important decision, Record in state decisions + event log]
|
|
119
|
+
- [Session ending, Save progress_summary and next_steps]
|
|
120
|
+
- [Session starting, Check .workflow-state/ for active workflows]
|
|
121
|
+
- [Workflow complete, Set status to completed]
|
|
@@ -95,23 +95,63 @@ Projects configure domain mappings in `manifest.json`:
|
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
-
## 3.
|
|
98
|
+
## 3. Custom Domains
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
Projects can define custom domains in `manifest.json` using the `extensions` array. Custom domains are **additive only** — they cannot override built-in domains.
|
|
101
|
+
|
|
102
|
+
### 3.1 Extension Format
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"extensions": [
|
|
107
|
+
{
|
|
108
|
+
"type": "custom-domain",
|
|
109
|
+
"domain": "ml-pipeline",
|
|
110
|
+
"description": "Standards for ML pipeline workflows",
|
|
111
|
+
"triggers": ["pipeline", "model training", "dataset", "*.pipeline.*"],
|
|
112
|
+
"standards": ["ai/standards/custom-ml-pipeline.ai.yaml"]
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 3.2 Custom Domain Rules
|
|
119
|
+
|
|
120
|
+
| Rule | Description |
|
|
121
|
+
|------|-------------|
|
|
122
|
+
| **Additive only** | Custom domains cannot override or shadow built-in domains |
|
|
123
|
+
| **Unique names** | Domain names must not conflict with built-in domain names |
|
|
124
|
+
| **Standard paths** | Referenced standards must exist in the project |
|
|
125
|
+
| **Trigger format** | Same format as built-in domain triggers (keywords, file patterns, commands) |
|
|
126
|
+
|
|
127
|
+
### 3.3 Hook-Based Enforcement (Optional)
|
|
128
|
+
|
|
129
|
+
For Claude Code users, a `UserPromptSubmit` hook can automatically inject relevant standards based on the user's prompt. The hook reads the prompt, matches it against manifest domain triggers (both built-in and custom), and outputs matching standard file paths as context.
|
|
130
|
+
|
|
131
|
+
**Requirements:**
|
|
132
|
+
- Hook execution must complete in < 500ms
|
|
133
|
+
- Hook failures must not block the user's prompt
|
|
134
|
+
- See `scripts/hooks/inject-standards.js` for reference implementation
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 4. Implementation Guidelines
|
|
139
|
+
|
|
140
|
+
### 4.1 For Standard Authors
|
|
101
141
|
|
|
102
142
|
- Register new standards in `manifest.json` under the appropriate domain
|
|
103
143
|
- Choose `always-on` only for standards that genuinely apply to every interaction
|
|
104
144
|
- Define specific, actionable triggers in the domain configuration (not vague keywords)
|
|
105
145
|
- Assign each standard to exactly one domain
|
|
106
146
|
|
|
107
|
-
###
|
|
147
|
+
### 4.2 For AI Tool Integrations
|
|
108
148
|
|
|
109
149
|
- At session start, always load the `always-on` domain
|
|
110
150
|
- Parse user's first message for trigger keywords before loading additional standards
|
|
111
151
|
- When in doubt, load the standard — false positives are better than missing context
|
|
112
152
|
- Cache domain membership for the session duration
|
|
113
153
|
|
|
114
|
-
###
|
|
154
|
+
### 4.3 Backward Compatibility
|
|
115
155
|
|
|
116
156
|
- Existing `manifest.json` without `domains` continues to work (all standards loaded)
|
|
117
157
|
- The `domains` field is additive — it does not remove existing `standards` list behavior
|