@sppg2001/atomize 1.2.4 → 2.0.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.
@@ -0,0 +1,324 @@
1
+ # Story Learner
2
+
3
+ The Story Learner analyzes existing work items with their tasks and generates a reusable Atomize template. This is the fastest way to capture your team's proven task breakdown patterns.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Learn from a Single Story](#learn-from-a-single-story)
9
+ - [Learn from Multiple Stories](#learn-from-multiple-stories)
10
+ - [How Pattern Detection Works](#how-pattern-detection-works)
11
+ - [Normalization](#normalization)
12
+ - [Output Template](#output-template)
13
+ - [Examples](#examples)
14
+ - [Tips and Best Practices](#tips-and-best-practices)
15
+ - [Troubleshooting](#troubleshooting)
16
+
17
+ ---
18
+
19
+ ## Overview
20
+
21
+ Instead of building a template from scratch, the Story Learner:
22
+
23
+ 1. Fetches one or more work items that already have child tasks
24
+ 2. Analyzes task titles, estimations, activities, and tags
25
+ 3. Detects common patterns across stories (when using multiple stories)
26
+ 4. Generates a YAML template you can use immediately
27
+
28
+ This is ideal when your team has a well-established workflow and you want to replicate it consistently.
29
+
30
+ ---
31
+
32
+ ## Learn from a Single Story
33
+
34
+ Pass a single story ID to capture its task breakdown as a template directly — no pattern detection, no confidence scoring. The tasks are taken as-is and normalized to 100%.
35
+
36
+ ```bash
37
+ atomize template create --from-stories STORY-123 --save-as my-template
38
+ ```
39
+
40
+ This is useful when one story was broken down particularly well and you want to replicate it exactly. The generated template will include a note in its metadata that it was learned from a single story.
41
+
42
+ > **When to use more stories:** With a single source story, the template reflects that story's specific breakdown, including any idiosyncrasies. Use [multiple stories](#learn-from-multiple-stories) to get a template that reflects your team's general pattern rather than one instance.
43
+
44
+ ---
45
+
46
+ ## Learn from Multiple Stories
47
+
48
+ Use `--from-stories` to analyze multiple stories at once. This produces higher-quality templates because it detects patterns, filters out outliers, and generates confidence scores.
49
+
50
+ ```bash
51
+ atomize template create --from-stories STORY-1,STORY-2,STORY-3
52
+ ```
53
+
54
+ **With options:**
55
+
56
+ ```bash
57
+ atomize template create \
58
+ --from-stories STORY-123,STORY-456,STORY-789 \
59
+ --platform azure-devops \
60
+ --save-as backend-pattern
61
+ ```
62
+
63
+ ### Options
64
+
65
+ | Option | Description |
66
+ |--------|-------------|
67
+ | `--from-stories <ids>` | Comma-separated list of story IDs |
68
+ | `--platform <name>` | Platform to fetch from |
69
+ | `--profile <name>` | Azure DevOps connection profile to use |
70
+ | `--save-as <name>` | Catalog name to save the generated template under |
71
+
72
+ ### Minimum Requirements
73
+
74
+ - At least **1 story** required (3+ recommended for pattern detection)
75
+ - Each story must have **at least 1 child task**
76
+ - Stories should be similar in type and complexity
77
+
78
+ ---
79
+
80
+ ## How Pattern Detection Works
81
+
82
+ When analyzing multiple stories, Atomize performs several steps:
83
+
84
+ ### 1. Task Similarity Analysis
85
+
86
+ Tasks across stories are grouped by similarity. Task titles are compared to identify tasks that represent the same kind of work (e.g., "Design API", "API Design Phase", "Design REST endpoints" are all grouped as "design" tasks).
87
+
88
+ ### 2. Confidence Scoring
89
+
90
+ Each pattern receives a confidence score based on how consistently it appears across stories:
91
+
92
+ | Confidence | Meaning | Threshold |
93
+ |------------|---------|-----------|
94
+ | **High** | Task appears in most stories with consistent estimation | ≥ 70% of stories |
95
+ | **Medium** | Task appears in some stories | 40-69% of stories |
96
+ | **Low** | Task appears in few stories | < 40% of stories |
97
+
98
+ Only high and medium confidence patterns are included in the generated template by default.
99
+
100
+ ### 3. Outlier Detection
101
+
102
+ Stories that are significantly different from the others (e.g., have many more or fewer tasks, or very different estimation ratios) are flagged as outliers. You'll see a report of which stories were considered outliers and why.
103
+
104
+ ### 4. Estimation Averaging
105
+
106
+ For tasks that appear in multiple stories, the estimation percentage is averaged across all instances (excluding outliers).
107
+
108
+ ### 5. Condition Pattern Detection
109
+
110
+ If certain tasks only appear when stories have specific tags or properties, Atomize may suggest conditional task logic:
111
+
112
+ ```yaml
113
+ tasks:
114
+ - title: "Security Review"
115
+ estimationPercent: 10
116
+ condition:
117
+ field: "tags"
118
+ operator: "contains"
119
+ value: "security" # Suggested based on pattern
120
+ ```
121
+
122
+ ### 6. Tag Pattern Analysis
123
+
124
+ Tags that consistently appear on matching stories are incorporated into the template's filter criteria.
125
+
126
+ ---
127
+
128
+ ## Normalization
129
+
130
+ Task percentages are adjusted to sum to exactly 100% so the generated template is ready to validate and use.
131
+
132
+ **Normalization behavior:**
133
+ - Percentages are scaled proportionally to sum to 100%
134
+ - Remainder is added to the largest task
135
+ - Result always validates against `totalEstimationMustBe: 100`
136
+
137
+ **Example:**
138
+
139
+ Original tasks: Design 18%, Implementation 45%, Testing 20%, Review 8% = 91%
140
+
141
+ After normalization:
142
+ - Design: 20% (18/91 × 100)
143
+ - Implementation: 49% (45/91 × 100)
144
+ - Testing: 22% (20/91 × 100)
145
+ - Review: 9% (8/91 × 100)
146
+
147
+ ---
148
+
149
+ ## Output Template
150
+
151
+ The generated template includes:
152
+
153
+ - **Basic info** — Name and description derived from the analyzed stories
154
+ - **Filter criteria** — Based on story types, states, and detected tags
155
+ - **Tasks** — One task per detected pattern, with averaged estimation
156
+ - **Estimation settings** — Percentage strategy with nearest rounding
157
+ - **Metadata** — Notes about the learning process, confidence scores
158
+
159
+ **Example output:**
160
+
161
+ ```yaml
162
+ version: "1.0"
163
+ name: "Learned: Backend API Pattern"
164
+ description: "Generated from 3 stories (STORY-123, STORY-456, STORY-789)"
165
+ author: "Atomize Story Learner"
166
+ tags: ["backend", "api", "learned"]
167
+
168
+ filter:
169
+ workItemTypes: ["User Story"]
170
+ states: ["New", "Active"]
171
+ tags:
172
+ include: ["backend"]
173
+ excludeIfHasTasks: true
174
+
175
+ tasks:
176
+ - title: "Design API"
177
+ estimationPercent: 18
178
+ activity: "Design"
179
+ # Confidence: high (3/3 stories)
180
+
181
+ - title: "Implementation"
182
+ estimationPercent: 47
183
+ activity: "Development"
184
+ # Confidence: high (3/3 stories)
185
+
186
+ - title: "Unit Tests"
187
+ estimationPercent: 20
188
+ activity: "Testing"
189
+ # Confidence: high (3/3 stories)
190
+
191
+ - title: "Integration Tests"
192
+ estimationPercent: 10
193
+ activity: "Testing"
194
+ # Confidence: medium (2/3 stories)
195
+
196
+ - title: "Code Review"
197
+ estimationPercent: 5
198
+ activity: "Documentation"
199
+ # Confidence: high (3/3 stories)
200
+
201
+ estimation:
202
+ strategy: "percentage"
203
+ rounding: "nearest"
204
+ minimumTaskPoints: 0.5
205
+
206
+ metadata:
207
+ category: "Learned"
208
+ estimationGuidelines: "Learned from stories with avg estimation of 9.3 points"
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Examples
214
+
215
+ ### Learn from Multiple Stories
216
+
217
+ ```bash
218
+ # Gather your best-structured stories
219
+ atomize template create \
220
+ --from-stories STORY-100,STORY-115,STORY-132,STORY-148 \
221
+ --platform azure-devops \
222
+ --save-as backend-standard
223
+
224
+ # Validate the result
225
+ atomize validate template:backend-standard --strict
226
+
227
+ # Apply to new stories
228
+ atomize generate template:backend-standard
229
+ ```
230
+
231
+ ---
232
+
233
+ ## Tips and Best Practices
234
+
235
+ ### Choosing Good Source Stories
236
+
237
+ - Pick stories that were broken down **after sprint planning**, not ad-hoc
238
+ - Use stories where the task breakdown was considered **high quality** by your team
239
+ - Choose stories of **similar complexity** (similar story point range)
240
+ - Use **at least 5 stories** for the most reliable patterns
241
+
242
+ ### Reviewing the Output
243
+
244
+ After generating, always:
245
+
246
+ 1. **Validate the template:**
247
+ ```bash
248
+ atomize validate template:my-learned-template --strict
249
+ ```
250
+
251
+ 2. **Review the YAML** — the learner may suggest conditions or patterns you want to refine
252
+
253
+ 3. **Test with mock data:**
254
+ ```bash
255
+ atomize generate template:my-learned-template --platform mock
256
+ ```
257
+
258
+ 4. **Preview against real data before executing:**
259
+ ```bash
260
+ atomize generate template:my-learned-template
261
+ ```
262
+
263
+ ### Improving Generated Templates
264
+
265
+ After generation, consider:
266
+ - Renaming generic task titles to be more specific
267
+ - Adding structured `condition` fields for tasks that don't always apply
268
+ - Adding `dependsOn` to enforce task ordering
269
+ - Adding `assignTo` patterns appropriate for your team
270
+ - Adding `${story.title}` variable interpolation to task titles
271
+ - Adjusting the `filter` section to be more or less restrictive
272
+
273
+ ---
274
+
275
+ ## Troubleshooting
276
+
277
+ ### "Story not found"
278
+
279
+ ```
280
+ Error: Work item STORY-123 not found
281
+ ```
282
+
283
+ - Verify the story ID exists in your project
284
+ - Check your platform credentials are configured correctly
285
+ - Ensure the story is accessible with your PAT permissions
286
+
287
+ ### "Story has no child tasks"
288
+
289
+ ```
290
+ Warning: STORY-123 has no child tasks — cannot learn from it
291
+ ```
292
+
293
+ - The selected story must already have child task work items
294
+ - Add tasks to the story manually first, then run the learner
295
+
296
+ ### "Not enough stories with tasks"
297
+
298
+ ```
299
+ Error: Only 1 of 3 provided stories had child tasks
300
+ ```
301
+
302
+ - Check that all provided story IDs have child tasks
303
+ - The learner needs stories that already have a task breakdown
304
+
305
+ ### "Low confidence patterns only"
306
+
307
+ If all detected patterns have low confidence:
308
+ - Try providing more stories (5+ recommended)
309
+ - Ensure the stories have similar structures
310
+ - Check that stories are of the same work item type
311
+
312
+ ### "Generated template has estimation ≠ 100%"
313
+
314
+ - Manually edit the saved catalog template to balance estimations
315
+ - Run `atomize validate template:<name> --strict` again before using it
316
+
317
+ ---
318
+
319
+ ## See Also
320
+
321
+ - [CLI Reference](./Cli-Reference.md) - Full `template create` options
322
+ - [Template Reference](./Template-Reference.md) - Template schema for refining output
323
+ - [Validation Modes](./Validation-Modes.md) - Validate generated templates
324
+ - [Platform Guide](./Platform-Guide.md) - Setting up Azure DevOps credentials