@thatix.io/context-first-agents-cli 0.1.0 → 0.2.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 (89) hide show
  1. package/README.md +189 -7
  2. package/dist/commands/create-orchestrator.js +4 -1
  3. package/dist/commands/doctor.js +21 -5
  4. package/dist/commands/init.js +3 -1
  5. package/dist/templates/commands/en/engineer/plan.md +301 -0
  6. package/dist/templates/commands/en/engineer/pr.md +194 -0
  7. package/dist/templates/commands/en/engineer/pre-pr.md +325 -0
  8. package/dist/templates/commands/en/engineer/start.md +285 -0
  9. package/dist/templates/commands/en/engineer/work.md +256 -0
  10. package/dist/templates/commands/en/products/check.md +237 -0
  11. package/dist/templates/commands/en/products/collect.md +170 -0
  12. package/dist/templates/commands/en/products/refine.md +231 -0
  13. package/dist/templates/commands/en/products/spec.md +273 -0
  14. package/dist/templates/commands/en/quality/metrics.md +266 -0
  15. package/dist/templates/commands/en/quality/observe.md +172 -0
  16. package/dist/templates/commands/en/warm-up.md +59 -0
  17. package/dist/templates/commands/es/agents/CONTEXT-CONTRACT.md +63 -0
  18. package/dist/templates/commands/es/agents/implementer.md +27 -0
  19. package/dist/templates/commands/es/agents/integrator.md +24 -0
  20. package/dist/templates/commands/es/agents/reviewer.md +31 -0
  21. package/dist/templates/commands/es/agents/tester.md +22 -0
  22. package/dist/templates/commands/es/engineer/plan.md +335 -0
  23. package/dist/templates/commands/es/engineer/pr.md +228 -0
  24. package/dist/templates/commands/es/engineer/pre-pr.md +359 -0
  25. package/dist/templates/commands/es/engineer/start.md +318 -0
  26. package/dist/templates/commands/es/engineer/work.md +290 -0
  27. package/dist/templates/commands/es/orchestrate.md +125 -0
  28. package/dist/templates/commands/es/products/check.md +271 -0
  29. package/dist/templates/commands/es/products/collect.md +218 -0
  30. package/dist/templates/commands/es/products/refine.md +265 -0
  31. package/dist/templates/commands/es/products/spec.md +306 -0
  32. package/dist/templates/commands/es/quality/metrics.md +300 -0
  33. package/dist/templates/commands/es/quality/observe.md +205 -0
  34. package/dist/templates/commands/es/warm-up.md +59 -0
  35. package/dist/templates/commands/pt-BR/engineer/plan.md +335 -0
  36. package/dist/templates/commands/pt-BR/engineer/pr.md +228 -0
  37. package/dist/templates/commands/pt-BR/engineer/pre-pr.md +359 -0
  38. package/dist/templates/commands/pt-BR/engineer/start.md +319 -0
  39. package/dist/templates/commands/pt-BR/engineer/work.md +290 -0
  40. package/dist/templates/commands/pt-BR/products/check.md +271 -0
  41. package/dist/templates/commands/pt-BR/products/collect.md +219 -0
  42. package/dist/templates/commands/pt-BR/products/refine.md +265 -0
  43. package/dist/templates/commands/pt-BR/products/spec.md +307 -0
  44. package/dist/templates/commands/pt-BR/quality/metrics.md +300 -0
  45. package/dist/templates/commands/pt-BR/quality/observe.md +206 -0
  46. package/dist/templates/commands/pt-BR/warm-up.md +59 -0
  47. package/package.json +7 -3
  48. package/templates/commands/en/engineer/plan.md +301 -0
  49. package/templates/commands/en/engineer/pr.md +194 -0
  50. package/templates/commands/en/engineer/pre-pr.md +325 -0
  51. package/templates/commands/en/engineer/start.md +285 -0
  52. package/templates/commands/en/engineer/work.md +256 -0
  53. package/templates/commands/en/products/check.md +237 -0
  54. package/templates/commands/en/products/collect.md +170 -0
  55. package/templates/commands/en/products/refine.md +231 -0
  56. package/templates/commands/en/products/spec.md +273 -0
  57. package/templates/commands/en/quality/metrics.md +266 -0
  58. package/templates/commands/en/quality/observe.md +172 -0
  59. package/templates/commands/en/warm-up.md +59 -0
  60. package/templates/commands/es/agents/CONTEXT-CONTRACT.md +63 -0
  61. package/templates/commands/es/agents/implementer.md +27 -0
  62. package/templates/commands/es/agents/integrator.md +24 -0
  63. package/templates/commands/es/agents/reviewer.md +31 -0
  64. package/templates/commands/es/agents/tester.md +22 -0
  65. package/templates/commands/es/engineer/plan.md +335 -0
  66. package/templates/commands/es/engineer/pr.md +228 -0
  67. package/templates/commands/es/engineer/pre-pr.md +359 -0
  68. package/templates/commands/es/engineer/start.md +318 -0
  69. package/templates/commands/es/engineer/work.md +290 -0
  70. package/templates/commands/es/orchestrate.md +125 -0
  71. package/templates/commands/es/products/check.md +271 -0
  72. package/templates/commands/es/products/collect.md +218 -0
  73. package/templates/commands/es/products/refine.md +265 -0
  74. package/templates/commands/es/products/spec.md +306 -0
  75. package/templates/commands/es/quality/metrics.md +300 -0
  76. package/templates/commands/es/quality/observe.md +205 -0
  77. package/templates/commands/es/warm-up.md +59 -0
  78. package/templates/commands/pt-BR/engineer/plan.md +335 -0
  79. package/templates/commands/pt-BR/engineer/pr.md +228 -0
  80. package/templates/commands/pt-BR/engineer/pre-pr.md +359 -0
  81. package/templates/commands/pt-BR/engineer/start.md +319 -0
  82. package/templates/commands/pt-BR/engineer/work.md +290 -0
  83. package/templates/commands/pt-BR/products/check.md +271 -0
  84. package/templates/commands/pt-BR/products/collect.md +219 -0
  85. package/templates/commands/pt-BR/products/refine.md +265 -0
  86. package/templates/commands/pt-BR/products/spec.md +307 -0
  87. package/templates/commands/pt-BR/quality/metrics.md +300 -0
  88. package/templates/commands/pt-BR/quality/observe.md +206 -0
  89. package/templates/commands/pt-BR/warm-up.md +59 -0
@@ -0,0 +1,237 @@
1
+ # Validation Against MetaSpecs
2
+
3
+ This command validates requirements, decisions, or implementations against the project's metaspecs.
4
+
5
+ ## ⚠️ IMPORTANT: Mode of Operation
6
+
7
+ **This command is for VALIDATION:**
8
+ - ✅ Validate against metaspecs
9
+ - ✅ **READ** files from repositories (read-only)
10
+ - ✅ Generate validation report
11
+ - ❌ **DO NOT checkout branches in main repositories**
12
+ - ❌ **DO NOT modify code**
13
+ - ❌ **DO NOT modify `context.md` or `architecture.md`**
14
+
15
+ ## Configuration
16
+
17
+ Read `context-manifest.json` and `ai.properties.md` from the orchestrator to get repositories, base_path, and task_management_system.
18
+
19
+ ## 🎯 Objective
20
+
21
+ Ensure alignment with:
22
+ - Product strategy
23
+ - Technical architecture
24
+ - Standards and conventions
25
+ - ADRs (Architecture Decision Records)
26
+
27
+ ## 📋 When to Use
28
+
29
+ Run this command:
30
+ - After `/spec` - validate PRD
31
+ - After `/plan` - validate technical plan
32
+ - During `/work` - validate implementation decisions
33
+ - Before `/pr` - final validation
34
+
35
+ ## 📚 Load MetaSpecs
36
+
37
+ **Automatically locate MetaSpecs**:
38
+ 1. Read `context-manifest.json` from the orchestrator
39
+ 2. Find the repository with `"role": "metaspecs"`
40
+ 3. Read `ai.properties.md` to get the `base_path`
41
+ 4. The metaspecs are located at: `{base_path}/{metaspecs-repo-id}/`
42
+
43
+ ## 🔍 Validation Process
44
+
45
+ ### 1. Identify Available MetaSpecs
46
+
47
+ Navigate to the metaspecs directory and identify which metaspecs exist:
48
+
49
+ ```bash
50
+ ls -la {base_path}/{metaspecs-repo-id}/
51
+ ```
52
+
53
+ ### 2. Business Validation
54
+
55
+ If business metaspecs exist (`MetaSpecs repository (business section)`):
56
+
57
+ ```markdown
58
+ ## Business Validation
59
+
60
+ ### Product Strategy
61
+ - **File**: `MetaSpecs repository (business section)PRODUCT_STRATEGY.md`
62
+ - **Validation**: [Is this feature aligned with the strategy?]
63
+ - **Status**: ✅ Aligned / ⚠️ Partial / ❌ Misaligned
64
+ - **Notes**: [Observations]
65
+
66
+ ### Personas
67
+ - **File**: `MetaSpecs repository (business section)CUSTOMER_PERSONAS.md`
68
+ - **Validation**: [Does it meet the correct persona?]
69
+ - **Status**: ✅ Aligned / ⚠️ Partial / ❌ Misaligned
70
+ - **Notes**: [Observations]
71
+
72
+ ### Metrics
73
+ - **File**: `MetaSpecs repository (business section)PRODUCT_METRICS.md`
74
+ - **Validation**: [Is the success metric documented?]
75
+ - **Status**: ✅ Aligned / ⚠️ Partial / ❌ Misaligned
76
+ - **Notes**: [Observations]
77
+ ```
78
+
79
+ ### 3. Technical Validation
80
+
81
+ If technical metaspecs exist (`MetaSpecs repository (technical section)`):
82
+
83
+ ```markdown
84
+ ## Technical Validation
85
+
86
+ ### Technology Stack
87
+ - **File**: `MetaSpecs repository (technical section)meta/stack.md`
88
+ - **Validation**: [Uses only approved technologies?]
89
+ - **Status**: ✅ Compliant / ⚠️ Justified exception / ❌ Non-compliant
90
+ - **Notes**: [Technologies used and justifications]
91
+
92
+ ### Architecture
93
+ - **File**: `MetaSpecs repository (technical section)ARCHITECTURE.md`
94
+ - **Validation**: [Follows architectural standards?]
95
+ - **Status**: ✅ Compliant / ⚠️ Partial / ❌ Non-compliant
96
+ - **Notes**: [Observations]
97
+
98
+ ### ADRs (Architecture Decision Records)
99
+ - **Directory**: `MetaSpecs repository (technical section)adr/`
100
+ - **Validation**: [Respects documented architectural decisions?]
101
+ - **Relevant ADRs**: [List of verified ADRs]
102
+ - **Status**: ✅ Compliant / ⚠️ Minor conflict / ❌ Critical conflict
103
+ - **Notes**: [Observations]
104
+
105
+ ### Business Rules
106
+ - **File**: `MetaSpecs repository (technical section)BUSINESS_LOGIC.md`
107
+ - **Validation**: [Implements business rules correctly?]
108
+ - **Status**: ✅ Compliant / ⚠️ Partial / ❌ Non-compliant
109
+ - **Notes**: [Observations]
110
+ ```
111
+
112
+ ### 4. Standards Validation
113
+
114
+ ```markdown
115
+ ## Standards Validation
116
+
117
+ ### Code
118
+ - **File**: `MetaSpecs repository (technical section)CODE_STANDARDS.md`
119
+ - **Validation**: [Follows code standards?]
120
+ - **Status**: ✅ Compliant / ⚠️ Minor deviations / ❌ Non-compliant
121
+
122
+ ### Tests
123
+ - **File**: `MetaSpecs repository (technical section)TEST_STANDARDS.md`
124
+ - **Validation**: [Adequate testing strategy?]
125
+ - **Status**: ✅ Compliant / ⚠️ Partial / ❌ Non-compliant
126
+
127
+ ### Documentation
128
+ - **File**: `MetaSpecs repository (technical section)DOC_STANDARDS.md`
129
+ - **Validation**: [Adequate documentation?]
130
+ - **Status**: ✅ Compliant / ⚠️ Partial / ❌ Non-compliant
131
+ ```
132
+
133
+ ### 5. Conflict Identification
134
+
135
+ If conflicts or misalignments exist:
136
+
137
+ ```markdown
138
+ ## Identified Conflicts
139
+
140
+ ### Conflict 1: [Description]
141
+ - **Severity**: Critical / High / Medium / Low
142
+ - **Metaspec**: [Violated file]
143
+ - **Description**: [Conflict details]
144
+ - **Recommendation**: [How to resolve]
145
+
146
+ ### Conflict 2: [Description]
147
+ [Same format as above]
148
+ ```
149
+
150
+ ### 6. Justified Exceptions
151
+
152
+ If there are justified deviations:
153
+
154
+ ```markdown
155
+ ## Justified Exceptions
156
+
157
+ ### Exception 1: [Description]
158
+ - **Metaspec**: [Deviated file]
159
+ - **Deviation**: [What is different]
160
+ - **Justification**: [Why it is necessary]
161
+ - **Approval**: [Who approved]
162
+ - **Documentation**: [Where it was documented]
163
+ ```
164
+
165
+ ## 📄 Saving the Validation Report
166
+
167
+ **PRIORITY 1: Use MCP (Model Context Protocol)**
168
+
169
+ - Read `ai.properties.md` from the orchestrator to identify the `task_management_system`
170
+ - Use the appropriate MCP to add the report to the issue:
171
+ - Add as a comment on the issue
172
+ - Update labels/tags according to the result (e.g., "validated", "needs-adjustment", "blocked")
173
+ - If critical conflicts exist, update the issue status
174
+ - Inform the user: "✅ Validation report added to issue [ID]"
175
+
176
+ **FALLBACK: Create .md file only if MCP fails**
177
+
178
+ If MCP is unavailable or fails, create `./.sessions/<ISSUE-ID>/check-report.md`:
179
+
180
+ ```markdown
181
+ # Validation Report - [ISSUE-ID]
182
+
183
+ **Date**: [date/time]
184
+ **Phase**: [spec/plan/work/pre-pr]
185
+
186
+ ## Overall Status
187
+ ✅ Validated / ⚠️ Validated with reservations / ❌ Not validated
188
+
189
+ ## Validations Performed
190
+ - Business: ✅ / ⚠️ / ❌
191
+ - Technical: ✅ / ⚠️ / ❌
192
+ - Standards: ✅ / ⚠️ / ❌
193
+
194
+ ## Conflicts
195
+ [List of conflicts, if any]
196
+
197
+ ## Exceptions
198
+ [List of justified exceptions, if any]
199
+
200
+ ## Recommendations
201
+ 1. [Recommendation 1]
202
+ 2. [Recommendation 2]
203
+
204
+ ## Approval
205
+ - [ ] Approved to proceed
206
+ - [ ] Requires adjustments
207
+ - [ ] Blocked
208
+ ```
209
+
210
+ Inform the user: "⚠️ Report saved locally in .sessions/ (task manager not available)"
211
+
212
+ ## 🚨 Action in Case of Conflicts
213
+
214
+ If critical conflicts are found:
215
+ 1. 🛑 **STOP** the current process
216
+ 2. 📝 **DOCUMENT** all conflicts
217
+ 3. 💬 **ALERT** the user and stakeholders
218
+ 4. **Via MCP**: Update issue status to "Blocked" or "Requires Adjustments"
219
+ 5. 🔄 **ADJUST** plan/implementation as needed
220
+ 6. ✅ **REVALIDATE** after adjustments
221
+
222
+ ---
223
+
224
+ **Provided arguments**:
225
+
226
+ ```
227
+ #$ARGUMENTS
228
+ ```
229
+
230
+ ---
231
+
232
+ ## 🎯 Outcome
233
+
234
+ After validation:
235
+ - If ✅: Proceed to the next phase
236
+ - If ⚠️: Document reservations and proceed with approval
237
+ - If ❌: Fix conflicts before proceeding
@@ -0,0 +1,170 @@
1
+ # Idea and Requirements Gathering
2
+
3
+ You are a product specialist responsible for collecting and documenting new ideas, features, or bugs.
4
+
5
+ ## ⚠️ IMPORTANT: This Command DOES NOT Implement Code
6
+
7
+ **This command is ONLY for planning and documentation:**
8
+ - ✅ Collect and understand requirements
9
+ - ✅ Create issue in the task manager via MCP
10
+ - ✅ Ask clarification questions
11
+ - ✅ **READ** files from main repositories (read-only)
12
+ - ❌ **DO NOT implement code**
13
+ - ❌ **DO NOT edit code files**
14
+ - ❌ **DO NOT checkout branches in main repositories**
15
+ - ❌ **DO NOT commit**
16
+
17
+ **Next step**: `/refine [ISSUE-ID]` to refine the collected requirements.
18
+
19
+ ---
20
+
21
+ ## Configuration
22
+
23
+ Read `context-manifest.json` and `ai.properties.md` from the orchestrator to get repositories, base_path, and task_management_system.
24
+
25
+ ## Objective
26
+
27
+ Understand the user's request and capture it as an issue in the task manager (via MCP).
28
+
29
+ **At this stage, you DO NOT need to:**
30
+ - ❌ Write a complete specification
31
+ - ❌ Validate against metaspecs (this is done in `/refine` or `/spec`)
32
+ - ❌ Detail technical implementation
33
+
34
+ Just ensure the idea is **adequately understood**.
35
+
36
+ ## Issue Format
37
+
38
+ ```markdown
39
+ # [Clear and Descriptive Title]
40
+
41
+ ## Description
42
+ [2-3 paragraphs explaining what the feature/bug is and why it is important]
43
+
44
+ ## Type
45
+ - [ ] New Feature
46
+ - [ ] Existing Feature Improvement
47
+ - [ ] Bug
48
+ - [ ] Tech Debt
49
+ - [ ] Documentation
50
+
51
+ ## Additional Context
52
+ [Relevant information: where the bug occurs, inspiration for the feature, etc.]
53
+
54
+ ## Affected Repositories
55
+ [List which project repositories will be impacted]
56
+
57
+ ## Suggested Priority
58
+ - [ ] 🔴 Critical
59
+ - [ ] 🟡 High
60
+ - [ ] 🟢 Medium
61
+ - [ ] ⚪ Low (Backlog)
62
+ ```
63
+
64
+ ## Collection Process
65
+
66
+ 1. **Initial Understanding**
67
+ - Ask clarification questions if needed
68
+ - Identify: Is it a new feature? Improvement? Bug?
69
+ - Identify which repositories will be affected
70
+
71
+ 2. **Issue Draft**
72
+ - Clear title (max 10 words)
73
+ - Objective description (2-3 paragraphs)
74
+ - Relevant additional context
75
+ - Affected repositories
76
+ - Suggested priority
77
+
78
+ 3. **Complexity Assessment and Suggestion to Split**
79
+
80
+ Before finalizing, assess the issue complexity:
81
+
82
+ **If the implementation seems large** (> 5 days estimated effort):
83
+ - 🚨 **Suggest splitting into multiple smaller issues**
84
+ - Explain the rationale for the split (e.g., "This feature involves 3 distinct areas: authentication, processing, and notification")
85
+ - Propose a **logical** split (by functionality, repository, layer, etc.)
86
+ - Example split:
87
+ ```
88
+ Original Issue: "Complete payment system"
89
+
90
+ Suggested Split:
91
+ - FIN-101: Payment gateway integration (backend)
92
+ - FIN-102: Checkout interface (frontend)
93
+ - FIN-103: Confirmation webhook and notifications (backend + jobs)
94
+ ```
95
+ - **Important**: The final decision is the user's - they can accept the split or keep it as a single issue
96
+
97
+ **If the user accepts the split**:
98
+ - Create each issue separately using the same process
99
+ - Add cross-references between related issues
100
+ - Suggest implementation order if dependencies exist
101
+
102
+ 4. **User Approval**
103
+ - Present the draft (or drafts, if split)
104
+ - Make adjustments according to feedback
105
+ - Obtain final approval
106
+
107
+ 5. **Issue Saving**
108
+
109
+ **PRIORITY 1: Use MCP (Model Context Protocol)**
110
+
111
+ Check if MCP is configured for the task manager:
112
+ - Read `ai.properties.md` from the orchestrator to identify the `task_management_system`
113
+ - If `task_management_system=jira`: Use Jira MCP to create the issue
114
+ - If `task_management_system=linear`: Use Linear MCP to create the issue
115
+ - If `task_management_system=github`: Use GitHub MCP to create the issue
116
+ - If `task_management_system=azure`: Use Azure Boards MCP to create the issue
117
+
118
+ **When using MCP:**
119
+ - Create the issue directly in the task manager
120
+ - Obtain the created issue ID (e.g., FIN-123, LIN-456)
121
+ - Inform the user: "✅ Issue [ID] created in [task manager]"
122
+ - **DO NOT create a .md file**
123
+
124
+ **FALLBACK: Create .md file only if MCP fails**
125
+
126
+ If MCP is not available or fails:
127
+ - Create a file in `./.sessions/<ISSUE-ID>/collect.md`
128
+ - Use manual ID format: `LOCAL-001`, `LOCAL-002`, etc.
129
+ - Include date, type, and full content
130
+ - Inform the user: "⚠️ Issue saved locally in .sessions/ (task manager not available)"
131
+
132
+ ## Clarification Questions
133
+
134
+ **For Features**:
135
+ - What problem does it solve?
136
+ - Who benefits?
137
+ - Is it a visible functionality or infrastructure?
138
+ - Is it related to any existing feature?
139
+ - Which repositories need modification?
140
+
141
+ **For Bugs**:
142
+ - Where does the bug occur? (repository, component, flow)
143
+ - How to reproduce?
144
+ - Expected vs current behavior?
145
+ - Severity of impact?
146
+
147
+ **For Improvements**:
148
+ - What is working but can be improved?
149
+ - Which metric do we want to impact?
150
+ - Is it a technical or business optimization?
151
+
152
+ ---
153
+
154
+ **Provided arguments**:
155
+
156
+ ```
157
+ #$ARGUMENTS
158
+ ```
159
+
160
+ ---
161
+
162
+ ## 🎯 Next Step
163
+
164
+ After approval and saving the issue:
165
+
166
+ ```bash
167
+ /refine [ISSUE-ID]
168
+ ```
169
+
170
+ This command will transform the collected issue into refined and validated requirements.
@@ -0,0 +1,231 @@
1
+ # Requirements Refinement
2
+
3
+ You are a product expert responsible for helping to refine requirements for the project.
4
+
5
+ ## ⚠️ IMPORTANT: This Command DOES NOT Implement Code
6
+
7
+ **This command is ONLY for planning and documentation:**
8
+ - ✅ Validate requirements against metaspecs
9
+ - ✅ Create refined specification
10
+ - ✅ Save documentation in `.sessions/`
11
+ - ✅ Update issue in task manager
12
+ - ❌ **DO NOT implement code**
13
+ - ❌ **DO NOT edit code files**
14
+ - ❌ **DO NOT run tests or deploy**
15
+
16
+ **Next step**: `/spec [ISSUE-ID]` to create a complete PRD based on the refined requirements.
17
+
18
+ ---
19
+
20
+ ## Configuration
21
+
22
+ Read `context-manifest.json` and `ai.properties.md` from the orchestrator to get repositories, base_path, and task_management_system.
23
+
24
+ ## Objective
25
+
26
+ Transform an initial requirement into a refined and validated specification, ready to become a complete PRD.
27
+
28
+ ## Process
29
+
30
+ ### 1. Clarification Phase
31
+
32
+ Read the initial requirement and ask questions to achieve full clarity about:
33
+ - **Goal**: Why build this?
34
+ - **Business Value**: Which metric/persona does it impact?
35
+ - **Scope**: What is included and what is NOT included?
36
+ - **Interactions**: Which existing features/components are affected?
37
+
38
+ Keep asking questions until you have complete understanding.
39
+
40
+ ### 2. Validation Against Metaspecs
41
+
42
+ **IMPORTANT**: First read `ai.properties.md` to get the `base_path`. The indexes should ALREADY be in context (you ran `/warm-up`). Consult the indexes and read ONLY relevant documents to validate the requirement.
43
+
44
+ **Validation Process**:
45
+
46
+ 1. **Consult the loaded indexes** from `/warm-up`:
47
+ - Read `context-manifest.json` to find the repository with `role: "metaspecs"`
48
+ - Obtain the `id` of that repository (e.g., "my-project-metaspecs")
49
+ - Read `ai.properties.md` to get the `base_path`
50
+ - The metaspecs repository is at: `{base_path}/{metaspecs-id}/`
51
+ - Consult `{base_path}/{metaspecs-id}/index.md` - Project overview
52
+ - Consult specific indexes (e.g., `specs/business/index.md`, `specs/technical/index.md`)
53
+
54
+ 2. **Identify relevant documents** for this specific requirement:
55
+ - In `specs/business/`: Which business documents are relevant?
56
+ - In `specs/technical/`: Which technical documents are relevant?
57
+
58
+ 3. **Read ONLY the identified relevant documents** (do not read everything!)
59
+
60
+ 4. **Validate the requirement** against the read metaspecs:
61
+ - ✅ Alignment with product strategy and vision
62
+ - ✅ Meets needs of the correct personas
63
+ - ✅ Compatible with approved technology stack
64
+ - ✅ Respects architectural decisions (ADRs)
65
+ - ✅ Follows existing business rules
66
+ - ⚠️ Identify conflicts or violations
67
+
68
+ **If violations are identified**: 🛑 **STOP** and ask the user for clarification before proceeding (Jidoka Principle).
69
+
70
+ ### 3. Summary and Approval Phase
71
+
72
+ Once you have gathered sufficient information and validated against metaspecs, present a structured summary with:
73
+ - **Feature**: Feature name
74
+ - **Goal**: Why build it (1-2 sentences)
75
+ - **Business Value**: Metric, persona, roadmap phase (consult metaspecs)
76
+ - **Scope**: What IS included and what IS NOT included
77
+ - **Affected Components**: List based on current architecture (consult technical metaspecs)
78
+ - **Validation against Metaspecs**: ✅ Approved / ⚠️ Attention needed
79
+ - **Effort Estimate**: Small (< 1 day) / Medium (1-3 days) / Large (3-5 days) / Very Large (> 5 days)
80
+
81
+ **Complexity Assessment and Suggestion to Split**:
82
+
83
+ **If implementation seems large** (> 5 days estimated effort):
84
+ - 🚨 **Suggest splitting into multiple smaller issues**
85
+ - Explain the rationale for splitting (e.g., "This feature involves 3 distinct areas that can be implemented independently")
86
+ - Propose a **logical** split based on:
87
+ - Independent functionalities
88
+ - Different repositories
89
+ - Application layers (backend, frontend, infra)
90
+ - Implementation phases (MVP, improvements, optimizations)
91
+ - Example split:
92
+ ```
93
+ Original Issue: "Multi-channel notification system"
94
+
95
+ Suggested Split:
96
+ - FIN-201: Queue and worker infrastructure (backend)
97
+ - FIN-202: Email notifications (backend + templates)
98
+ - FIN-203: Push notifications (backend + mobile)
99
+ - FIN-204: Notification preferences (frontend + backend)
100
+ ```
101
+ - **Important**: Final decision is the user's - they may accept the split or keep it as a single issue
102
+
103
+ **If the user accepts the split**:
104
+ - Document each issue separately
105
+ - Add cross-references between related issues
106
+ - Suggest implementation order if dependencies exist
107
+ - Each split issue must go through the same refinement process
108
+
109
+ Request user approval and incorporate feedback if needed.
110
+
111
+ **Tip**: You may search the codebase or internet before finalizing, if necessary.
112
+
113
+ ### 4. Saving the Refined Requirements
114
+
115
+ Once the user approves, save the requirements:
116
+
117
+ **IMPORTANT**: Always create a local backup AND update the task manager (if configured).
118
+
119
+ **Saving Process**:
120
+
121
+ 1. **ALWAYS create local backup first**:
122
+ - Create a complete file at `./.sessions/<ISSUE-ID>/refined.md` (e.g., `./.sessions/FIN-5/refined.md`)
123
+ - Where `<ISSUE-ID>` is the issue ID (e.g., FIN-5, FIN-123)
124
+ - Include ALL refinement details (full backup)
125
+
126
+ 2. **If task manager is configured** (read `ai.properties.md` to identify `task_management_system`):
127
+ - Identify the MCP tool of the task manager
128
+ - **Update the BODY (description) of the issue** with a CONCISE version of the refined requirements
129
+ - For Jira: Use Jira MCP with `description` field
130
+ - For Linear: Use Linear MCP with `description` field
131
+ - For GitHub: Use GitHub MCP with `body` field
132
+ - For Azure Boards: Use Azure Boards MCP with `description` field
133
+ - Include all refined content in the issue description/body field
134
+ - If content is too long and API errors occur, consider creating a summarized version
135
+ - **ALWAYS overwrite** the existing body (do not append)
136
+
137
+ **Note**:
138
+ - Local backup is ALWAYS saved and complete
139
+ - If API error occurs, manually verify if the issue was updated in the task manager
140
+
141
+ **Output Template**:
142
+
143
+ **IMPORTANT**: The standard template for refined requirements may be documented in the metaspecs repository. Consult `{base_path}/{metaspecs-id}/specs/refined/` or similar.
144
+
145
+ **FULL Template** (for local backup `.sessions/<ISSUE-ID>/refined.md`):
146
+ - **Metadata**: Issue, ID, Task Manager, Project, Date, Sprint, Priority
147
+ - **🎯 WHY**: Reasons, business value, metric, persona, strategic alignment
148
+ - **📦 WHAT**: Detailed features, affected components, integrations, full negative scope
149
+ - **🔧 HOW**: Stack, coding patterns, file structure, dependencies, implementation order, failure modes, performance/cost/UX considerations
150
+ - **✅ Validation against Metaspecs**: Consulted documents (business and technical), verified ADRs, validation result
151
+ - **📊 Success Metrics**: Technical, product/UX, acceptance criteria
152
+ - **🔄 Product Impact**: Alignment with objectives, enablers, mitigated risks
153
+ - **⚠️ Known Limitations**: MVP limitations
154
+ - **📝 Implementation Checklist**: Tasks by area (backend, frontend, tests, security, etc.)
155
+
156
+ **Task Manager Template**:
157
+ ```markdown
158
+ # [Feature Name] - Refined Requirements
159
+
160
+ **Sprint X** | **Y days** | **Priority**
161
+
162
+ ## Goal
163
+ [1-2 paragraphs: what it is and why]
164
+
165
+ ## Scope
166
+
167
+ ### Main Features
168
+ - Feature 1: [summary]
169
+ - Feature 2: [summary]
170
+ - Validations/Guards: [summary]
171
+
172
+ ### Affected Components
173
+ - Component 1: [type of change]
174
+ - Component 2: [type of change]
175
+
176
+ ### Security
177
+ ✅ [item 1] ✅ [item 2] ✅ [item 3]
178
+
179
+ ## Negative Scope
180
+ ❌ [item 1] ❌ [item 2] ❌ [item 3]
181
+
182
+ ## Stack
183
+ [Tech stack summarized by area]
184
+
185
+ ## Structure
186
+ [SUMMARIZED file tree - main modules only]
187
+
188
+ ## Failure Modes (Avoid)
189
+ 🔴 [critical 1] 🔴 [critical 2]
190
+ 🟡 [medium 1] 🟡 [medium 2]
191
+
192
+ ## Acceptance Criteria
193
+ - [ ] [item 1]
194
+ - [ ] [item 2]
195
+ - [ ] [item 3]
196
+
197
+ ## Validation
198
+ **ADRs**: [list]
199
+ **Specs**: [main]
200
+ **Status**: ✅ Approved
201
+
202
+ **Impact**: [summary]
203
+ **Limitations**: [summary]
204
+
205
+ ---
206
+ 📄 **Full document**: `.sessions/<ISSUE-ID>/refined.md`
207
+ ```
208
+
209
+ **Audience**: AI Developer with capabilities similar to yours. Be concise but complete.
210
+
211
+ ---
212
+
213
+ **Requirement to Refine**:
214
+
215
+ ```
216
+ #$ARGUMENTS
217
+ ```
218
+
219
+ ---
220
+
221
+ ## 🎯 Next Step
222
+
223
+ **After user approval and saving the refined requirements**, the natural flow is:
224
+
225
+ ```bash
226
+ /spec [ISSUE-ID]
227
+ ```
228
+
229
+ **Example**: `/spec FIN-3`
230
+
231
+ This command will create a PRD (Product Requirements Document) complete based on the refined requirements, detailing features, user stories, acceptance criteria, and final validations.