@ancleto/spec 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,150 +1,150 @@
1
- ---
2
- name: openspec-sync-specs
3
- description: Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
4
- license: MIT
5
- compatibility: Requires openspec CLI.
6
- metadata:
7
- author: ancleto
8
- version: '1.0'
9
- ---
10
-
11
- Sync delta specs from a change to main specs.
12
-
13
- This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
14
-
15
- **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
16
-
17
- **Steps**
18
-
19
- 1. **If no change name provided, prompt for selection**
20
-
21
- Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
22
-
23
- Show changes that have delta specs (under `specs/` directory).
24
-
25
- **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
26
-
27
- 2. **Find delta specs**
28
-
29
- Look for delta spec files in `openspec/changes/<name>/specs/*/spec.md`.
30
-
31
- Each delta spec file contains sections like:
32
-
33
- - `## ADDED Requirements` - New requirements to add
34
- - `## MODIFIED Requirements` - Changes to existing requirements
35
- - `## REMOVED Requirements` - Requirements to remove
36
- - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
37
-
38
- If no delta specs found, inform user and stop.
39
-
40
- 3. **For each delta spec, apply changes to main specs**
41
-
42
- For each capability with a delta spec at `openspec/changes/<name>/specs/<capability>/spec.md`:
43
-
44
- a. **Read the delta spec** to understand the intended changes
45
-
46
- b. **Read the main spec** at `openspec/specs/<capability>/spec.md` (may not exist yet)
47
-
48
- c. **Apply changes intelligently**:
49
-
50
- **ADDED Requirements:**
51
-
52
- - If requirement doesn't exist in main spec → add it
53
- - If requirement already exists → update it to match (treat as implicit MODIFIED)
54
-
55
- **MODIFIED Requirements:**
56
-
57
- - Find the requirement in main spec
58
- - Apply the changes - this can be:
59
- - Adding new scenarios (don't need to copy existing ones)
60
- - Modifying existing scenarios
61
- - Changing the requirement description
62
- - Preserve scenarios/content not mentioned in the delta
63
-
64
- **REMOVED Requirements:**
65
-
66
- - Remove the entire requirement block from main spec
67
-
68
- **RENAMED Requirements:**
69
-
70
- - Find the FROM requirement, rename to TO
71
-
72
- d. **Create new main spec** if capability doesn't exist yet:
73
-
74
- - Create `openspec/specs/<capability>/spec.md`
75
- - Add Purpose section (can be brief, mark as TBD)
76
- - Add Requirements section with the ADDED requirements
77
-
78
- 4. **Show summary**
79
-
80
- After applying all changes, summarize:
81
-
82
- - Which capabilities were updated
83
- - What changes were made (requirements added/modified/removed/renamed)
84
-
85
- **Delta Spec Format Reference**
86
-
87
- ```markdown
88
- ## ADDED Requirements
89
-
90
- ### Requirement: New Feature
91
-
92
- The system SHALL do something new.
93
-
94
- #### Scenario: Basic case
95
-
96
- - **WHEN** user does X
97
- - **THEN** system does Y
98
-
99
- ## MODIFIED Requirements
100
-
101
- ### Requirement: Existing Feature
102
-
103
- #### Scenario: New scenario to add
104
-
105
- - **WHEN** user does A
106
- - **THEN** system does B
107
-
108
- ## REMOVED Requirements
109
-
110
- ### Requirement: Deprecated Feature
111
-
112
- ## RENAMED Requirements
113
-
114
- - FROM: `### Requirement: Old Name`
115
- - TO: `### Requirement: New Name`
116
- ```
117
-
118
- **Key Principle: Intelligent Merging**
119
-
120
- Unlike programmatic merging, you can apply **partial updates**:
121
-
122
- - To add a scenario, just include that scenario under MODIFIED - don't copy existing scenarios
123
- - The delta represents _intent_, not a wholesale replacement
124
- - Use your judgment to merge changes sensibly
125
-
126
- **Output On Success**
127
-
128
- ```
129
- ## Specs Synced: <change-name>
130
-
131
- Updated main specs:
132
-
133
- **<capability-1>**:
134
- - Added requirement: "New Feature"
135
- - Modified requirement: "Existing Feature" (added 1 scenario)
136
-
137
- **<capability-2>**:
138
- - Created new spec file
139
- - Added requirement: "Another Feature"
140
-
141
- Main specs are now updated. The change remains active - archive when implementation is complete.
142
- ```
143
-
144
- **Guardrails**
145
-
146
- - Read both delta and main specs before making changes
147
- - Preserve existing content not mentioned in delta
148
- - If something is unclear, ask for clarification
149
- - Show what you're changing as you go
1
+ ---
2
+ name: openspec-sync-specs
3
+ description: Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
4
+ license: MIT
5
+ compatibility: Requires openspec CLI.
6
+ metadata:
7
+ author: ancleto
8
+ version: '1.0'
9
+ ---
10
+
11
+ Sync delta specs from a change to main specs.
12
+
13
+ This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
14
+
15
+ **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
16
+
17
+ **Steps**
18
+
19
+ 1. **If no change name provided, prompt for selection**
20
+
21
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
22
+
23
+ Show changes that have delta specs (under `specs/` directory).
24
+
25
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
26
+
27
+ 2. **Find delta specs**
28
+
29
+ Look for delta spec files in `openspec/changes/<name>/specs/*/spec.md`.
30
+
31
+ Each delta spec file contains sections like:
32
+
33
+ - `## ADDED Requirements` - New requirements to add
34
+ - `## MODIFIED Requirements` - Changes to existing requirements
35
+ - `## REMOVED Requirements` - Requirements to remove
36
+ - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
37
+
38
+ If no delta specs found, inform user and stop.
39
+
40
+ 3. **For each delta spec, apply changes to main specs**
41
+
42
+ For each capability with a delta spec at `openspec/changes/<name>/specs/<capability>/spec.md`:
43
+
44
+ a. **Read the delta spec** to understand the intended changes
45
+
46
+ b. **Read the main spec** at `openspec/specs/<capability>/spec.md` (may not exist yet)
47
+
48
+ c. **Apply changes intelligently**:
49
+
50
+ **ADDED Requirements:**
51
+
52
+ - If requirement doesn't exist in main spec → add it
53
+ - If requirement already exists → update it to match (treat as implicit MODIFIED)
54
+
55
+ **MODIFIED Requirements:**
56
+
57
+ - Find the requirement in main spec
58
+ - Apply the changes - this can be:
59
+ - Adding new scenarios (don't need to copy existing ones)
60
+ - Modifying existing scenarios
61
+ - Changing the requirement description
62
+ - Preserve scenarios/content not mentioned in the delta
63
+
64
+ **REMOVED Requirements:**
65
+
66
+ - Remove the entire requirement block from main spec
67
+
68
+ **RENAMED Requirements:**
69
+
70
+ - Find the FROM requirement, rename to TO
71
+
72
+ d. **Create new main spec** if capability doesn't exist yet:
73
+
74
+ - Create `openspec/specs/<capability>/spec.md`
75
+ - Add Purpose section (can be brief, mark as TBD)
76
+ - Add Requirements section with the ADDED requirements
77
+
78
+ 4. **Show summary**
79
+
80
+ After applying all changes, summarize:
81
+
82
+ - Which capabilities were updated
83
+ - What changes were made (requirements added/modified/removed/renamed)
84
+
85
+ **Delta Spec Format Reference**
86
+
87
+ ```markdown
88
+ ## ADDED Requirements
89
+
90
+ ### Requirement: New Feature
91
+
92
+ The system SHALL do something new.
93
+
94
+ #### Scenario: Basic case
95
+
96
+ - **WHEN** user does X
97
+ - **THEN** system does Y
98
+
99
+ ## MODIFIED Requirements
100
+
101
+ ### Requirement: Existing Feature
102
+
103
+ #### Scenario: New scenario to add
104
+
105
+ - **WHEN** user does A
106
+ - **THEN** system does B
107
+
108
+ ## REMOVED Requirements
109
+
110
+ ### Requirement: Deprecated Feature
111
+
112
+ ## RENAMED Requirements
113
+
114
+ - FROM: `### Requirement: Old Name`
115
+ - TO: `### Requirement: New Name`
116
+ ```
117
+
118
+ **Key Principle: Intelligent Merging**
119
+
120
+ Unlike programmatic merging, you can apply **partial updates**:
121
+
122
+ - To add a scenario, just include that scenario under MODIFIED - don't copy existing scenarios
123
+ - The delta represents _intent_, not a wholesale replacement
124
+ - Use your judgment to merge changes sensibly
125
+
126
+ **Output On Success**
127
+
128
+ ```
129
+ ## Specs Synced: <change-name>
130
+
131
+ Updated main specs:
132
+
133
+ **<capability-1>**:
134
+ - Added requirement: "New Feature"
135
+ - Modified requirement: "Existing Feature" (added 1 scenario)
136
+
137
+ **<capability-2>**:
138
+ - Created new spec file
139
+ - Added requirement: "Another Feature"
140
+
141
+ Main specs are now updated. The change remains active - archive when implementation is complete.
142
+ ```
143
+
144
+ **Guardrails**
145
+
146
+ - Read both delta and main specs before making changes
147
+ - Preserve existing content not mentioned in delta
148
+ - If something is unclear, ask for clarification
149
+ - Show what you're changing as you go
150
150
  - The operation should be idempotent - running twice should give same result
@@ -1,101 +1,101 @@
1
- ---
2
- name: triage-clarifier
3
- description: Clarification-needed triage helper. Use when the request sits between direct-implementation, direct-test-only, and spec-required, or when visible behavior impact is unclear.
4
- ---
5
-
6
- # Triage Clarifier
7
-
8
- ## Goal
9
-
10
- Reduce ambiguity during triage without replacing the orchestrator or starting a spec workflow.
11
-
12
- ## Use only when
13
-
14
- - the request is not clearly `direct-implementation`, `direct-test-only`, or `spec-required`
15
- - it is unclear whether the change affects visible behavior, acceptance criteria, or product code
16
- - a single high-value clarification can materially improve classification confidence
17
-
18
- ## Do not use when
19
-
20
- - the request already fits one category clearly
21
- - the request is already clearly large enough for `spec-required`
22
- - the user explicitly asked to open the structured/spec path
23
-
24
- ## Inputs to preserve
25
-
26
- - the user's original wording
27
- - any repo-specific context already gathered by the orchestrator
28
- - any existing constraints, references, or acceptance criteria already present in the request
29
-
30
- ## Repository-context boundary
31
-
32
- Triage classifies the request; it does not reconstruct the repository.
33
-
34
- If repository context is needed to classify safely, do not sweep source files, broaden a
35
- search, or inspect the implementation yourself. Ask the orchestrator to delegate one focused
36
- question to `@technical-discovery`. That subagent reads the repository's technical-discovery
37
- documents and returns the relevant, cited context for triage.
38
-
39
- Never replace unavailable technical-discovery documents with a manual repository scan. Use the
40
- context already provided, ask the one permitted clarification question when it resolves the
41
- dominant ambiguity, or favor `spec-required` when material uncertainty remains.
42
-
43
- ## Internal evaluation
44
-
45
- Before asking anything, evaluate these questions silently:
46
-
47
- 1. Is the request strictly about tests, or is product code likely to change?
48
- 2. Is the expected behavior already clear, or would implementation require assumptions?
49
- 3. Could the change alter visible behavior, business rules, contracts, shared types, architecture, or integrations?
50
- 4. Is the request small and local, or does it risk expanding once implementation starts?
51
- 5. If the team guessed wrong and under-classified it, would that create rework or architecture risk?
52
- 6. Is the change low-risk, or does its small size hide a behavior change or high-stakes logic (auth, payments, data integrity, security, shared contracts)? If small but high-risk, prefer `spec-required`.
53
-
54
- ## Classification rules
55
-
56
- Classify without asking a question whenever possible:
57
-
58
- - choose `direct-test-only` when the request is clearly limited to tests for existing behavior
59
- - choose `direct-implementation` when the change is small, local, and the expected result is already clear
60
- - choose `spec-required` when the request affects visible behavior, business rules, shared contracts, architecture, or scope is already meaningfully broad
61
-
62
- ## Single-question policy
63
-
64
- Ask at most one question.
65
-
66
- That question must:
67
-
68
- - target the highest-value ambiguity only
69
- - be short and concrete
70
- - help separate exactly one boundary, such as:
71
- - test-only vs product change
72
- - local bugfix vs behavior change
73
- - small direct change vs structured/spec change
74
-
75
- Do not ask multi-part questions.
76
- Do not ask for implementation details unless they are required to classify safely.
77
- Do not start an interview.
78
-
79
- ## Fallback policy
80
-
81
- If one clarification still leaves meaningful ambiguity or risk, favor `spec-required`.
82
-
83
- When in doubt, prefer the safer classification over an under-scoped direct path.
84
-
85
- ## Expected outcome
86
-
87
- After applying this skill, the orchestrator should do exactly one of these:
88
-
89
- 1. classify directly as `direct-test-only`
90
- 2. classify directly as `direct-implementation`
91
- 3. classify directly as `spec-required`
92
- 4. ask one concise clarification question
93
-
94
- If option 4 happened and the answer still does not remove the main ambiguity, classify as `spec-required`.
95
-
96
- ## What not to do
97
-
98
- - do not create specs, design, tasks, or proposals
99
- - do not trigger opsx or any workflow handoff
100
- - do not ask more than one clarification question
1
+ ---
2
+ name: triage-clarifier
3
+ description: Clarification-needed triage helper. Use when the request sits between direct-implementation, direct-test-only, and spec-required, or when visible behavior impact is unclear.
4
+ ---
5
+
6
+ # Triage Clarifier
7
+
8
+ ## Goal
9
+
10
+ Reduce ambiguity during triage without replacing the orchestrator or starting a spec workflow.
11
+
12
+ ## Use only when
13
+
14
+ - the request is not clearly `direct-implementation`, `direct-test-only`, or `spec-required`
15
+ - it is unclear whether the change affects visible behavior, acceptance criteria, or product code
16
+ - a single high-value clarification can materially improve classification confidence
17
+
18
+ ## Do not use when
19
+
20
+ - the request already fits one category clearly
21
+ - the request is already clearly large enough for `spec-required`
22
+ - the user explicitly asked to open the structured/spec path
23
+
24
+ ## Inputs to preserve
25
+
26
+ - the user's original wording
27
+ - any repo-specific context already gathered by the orchestrator
28
+ - any existing constraints, references, or acceptance criteria already present in the request
29
+
30
+ ## Repository-context boundary
31
+
32
+ Triage classifies the request; it does not reconstruct the repository.
33
+
34
+ If repository context is needed to classify safely, do not sweep source files, broaden a
35
+ search, or inspect the implementation yourself. Ask the orchestrator to delegate one focused
36
+ question to `@technical-discovery`. That subagent reads the repository's technical-discovery
37
+ documents and returns the relevant, cited context for triage.
38
+
39
+ Never replace unavailable technical-discovery documents with a manual repository scan. Use the
40
+ context already provided, ask the one permitted clarification question when it resolves the
41
+ dominant ambiguity, or favor `spec-required` when material uncertainty remains.
42
+
43
+ ## Internal evaluation
44
+
45
+ Before asking anything, evaluate these questions silently:
46
+
47
+ 1. Is the request strictly about tests, or is product code likely to change?
48
+ 2. Is the expected behavior already clear, or would implementation require assumptions?
49
+ 3. Could the change alter visible behavior, business rules, contracts, shared types, architecture, or integrations?
50
+ 4. Is the request small and local, or does it risk expanding once implementation starts?
51
+ 5. If the team guessed wrong and under-classified it, would that create rework or architecture risk?
52
+ 6. Is the change low-risk, or does its small size hide a behavior change or high-stakes logic (auth, payments, data integrity, security, shared contracts)? If small but high-risk, prefer `spec-required`.
53
+
54
+ ## Classification rules
55
+
56
+ Classify without asking a question whenever possible:
57
+
58
+ - choose `direct-test-only` when the request is clearly limited to tests for existing behavior
59
+ - choose `direct-implementation` when the change is small, local, and the expected result is already clear
60
+ - choose `spec-required` when the request affects visible behavior, business rules, shared contracts, architecture, or scope is already meaningfully broad
61
+
62
+ ## Single-question policy
63
+
64
+ Ask at most one question.
65
+
66
+ That question must:
67
+
68
+ - target the highest-value ambiguity only
69
+ - be short and concrete
70
+ - help separate exactly one boundary, such as:
71
+ - test-only vs product change
72
+ - local bugfix vs behavior change
73
+ - small direct change vs structured/spec change
74
+
75
+ Do not ask multi-part questions.
76
+ Do not ask for implementation details unless they are required to classify safely.
77
+ Do not start an interview.
78
+
79
+ ## Fallback policy
80
+
81
+ If one clarification still leaves meaningful ambiguity or risk, favor `spec-required`.
82
+
83
+ When in doubt, prefer the safer classification over an under-scoped direct path.
84
+
85
+ ## Expected outcome
86
+
87
+ After applying this skill, the orchestrator should do exactly one of these:
88
+
89
+ 1. classify directly as `direct-test-only`
90
+ 2. classify directly as `direct-implementation`
91
+ 3. classify directly as `spec-required`
92
+ 4. ask one concise clarification question
93
+
94
+ If option 4 happened and the answer still does not remove the main ambiguity, classify as `spec-required`.
95
+
96
+ ## What not to do
97
+
98
+ - do not create specs, design, tasks, or proposals
99
+ - do not trigger opsx or any workflow handoff
100
+ - do not ask more than one clarification question
101
101
  - do not replace the orchestrator's final responsibility for classification