@oxgeneral/orch 1.0.6 → 1.0.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.
Files changed (72) hide show
  1. package/dist/{App-LEVUTWQN.js → App-5OVBVRCD.js} +1 -1
  2. package/dist/{agent-Q34L27AY.js → agent-SI4JF5MV.js} +1 -1
  3. package/dist/{agent-shop-D2RS4BZK.js → agent-shop-JHDTCWCD.js} +1 -1
  4. package/dist/chunk-3AXNSYCM.js +2 -0
  5. package/dist/{chunk-BCPUTULS.js → chunk-HWEMBO36.js} +83 -54
  6. package/dist/chunk-J7ITYXE6.js +116 -0
  7. package/dist/chunk-J7ITYXE6.js.map +1 -0
  8. package/dist/{chunk-4TDXD3LA.js → chunk-SWNSNPBO.js} +12 -2
  9. package/dist/chunk-SWNSNPBO.js.map +1 -0
  10. package/dist/chunk-U2JVMD2G.js +66 -0
  11. package/dist/chunk-U2JVMD2G.js.map +1 -0
  12. package/dist/{chunk-EH3HRQP4.js → chunk-W3J7CURM.js} +8 -116
  13. package/dist/chunk-W3J7CURM.js.map +1 -0
  14. package/dist/chunk-ZMLF5HI5.js +11 -0
  15. package/dist/cli.js +1 -1
  16. package/dist/container-SEIWOLHY.js +4 -0
  17. package/dist/doctor-Q3GHJNZL.js +2 -0
  18. package/dist/index.d.ts +32 -1
  19. package/dist/index.js +12 -5
  20. package/dist/index.js.map +1 -1
  21. package/dist/init-D4356W7G.js +73 -0
  22. package/dist/orchestrator-G3Y7THMG.js +6 -0
  23. package/dist/{orchestrator-XPEMMBOO.js.map → orchestrator-G3Y7THMG.js.map} +1 -1
  24. package/dist/{orchestrator-JOTMB5XT.js → orchestrator-GQLNLOXB.js} +8 -4
  25. package/dist/{org-WAK3CDPG.js → org-KLYK6MMJ.js} +1 -1
  26. package/dist/skill-loader-IGRIELEM.js +9 -0
  27. package/dist/skill-loader-RHCFIK74.js +4 -0
  28. package/dist/skill-loader-RHCFIK74.js.map +1 -0
  29. package/dist/{task-QFLIIRKZ.js → task-3R2IX4HM.js} +1 -1
  30. package/dist/{tui-BJHZBCIR.js → tui-47O2OCKC.js} +1 -1
  31. package/dist/{workspace-manager-5EYCMAEO.js → workspace-manager-RH24FSNT.js} +4 -3
  32. package/dist/workspace-manager-RH24FSNT.js.map +1 -0
  33. package/dist/workspace-manager-VJ4FN5PJ.js +3 -0
  34. package/package.json +4 -3
  35. package/readme.md +11 -0
  36. package/scripts/{postinstall.js → postinstall.cjs} +24 -5
  37. package/skills/library/autoplan.md +315 -0
  38. package/skills/library/benchmark.md +242 -0
  39. package/skills/library/browse.md +266 -0
  40. package/skills/library/canary.md +248 -0
  41. package/skills/library/careful.md +42 -0
  42. package/skills/library/codex.md +431 -0
  43. package/skills/library/design-consultation.md +367 -0
  44. package/skills/library/design-review.md +744 -0
  45. package/skills/library/document-release.md +365 -0
  46. package/skills/library/freeze.md +60 -0
  47. package/skills/library/guard.md +55 -0
  48. package/skills/library/investigate.md +171 -0
  49. package/skills/library/land-and-deploy.md +636 -0
  50. package/skills/library/office-hours.md +746 -0
  51. package/skills/library/plan-ceo-review.md +1029 -0
  52. package/skills/library/plan-design-review.md +428 -0
  53. package/skills/library/plan-eng-review.md +420 -0
  54. package/skills/library/qa-only.md +388 -0
  55. package/skills/library/qa.md +766 -0
  56. package/skills/library/retro.md +532 -0
  57. package/skills/library/review.md +421 -0
  58. package/skills/library/setup-browser-cookies.md +86 -0
  59. package/skills/library/setup-deploy.md +211 -0
  60. package/skills/library/ship.md +1018 -0
  61. package/skills/library/unfreeze.md +31 -0
  62. package/skills/library/upgrade.md +220 -0
  63. package/skills/orch/SKILL.md +416 -0
  64. package/dist/chunk-4TDXD3LA.js.map +0 -1
  65. package/dist/chunk-EH3HRQP4.js.map +0 -1
  66. package/dist/chunk-WVJTXBPL.js +0 -11
  67. package/dist/container-FXUUV6PP.js +0 -4
  68. package/dist/doctor-P2J6VAUX.js +0 -2
  69. package/dist/init-PTAYCSMO.js +0 -53
  70. package/dist/orchestrator-XPEMMBOO.js +0 -6
  71. package/dist/workspace-manager-5EYCMAEO.js.map +0 -1
  72. package/dist/workspace-manager-XKOZ5WM6.js +0 -3
@@ -0,0 +1,532 @@
1
+ ---
2
+ name: retro
3
+ version: 2.0.0
4
+ description: |
5
+ Weekly engineering retrospective. Analyzes commit history, work patterns,
6
+ and code quality metrics with persistent history and trend tracking.
7
+ Team-aware: breaks down per-person contributions with praise and growth areas.
8
+ Use when asked to "weekly retro", "what did we ship", or "engineering retrospective".
9
+ Proactively suggest at the end of a work week or sprint.
10
+ ---
11
+
12
+ ## Detect default branch
13
+
14
+ Before gathering data, detect the repo's default branch name:
15
+ `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`
16
+
17
+ If this fails, fall back to `main`. Use the detected name wherever the instructions
18
+ say `origin/<default>` below.
19
+
20
+ ---
21
+
22
+ # /retro — Weekly Engineering Retrospective
23
+
24
+ Generates a comprehensive engineering retrospective analyzing commit history, work patterns, and code quality metrics. Team-aware: identifies the user running the command, then analyzes every contributor with per-person praise and growth opportunities. Designed for a senior IC/CTO-level builder using Claude Code as a force multiplier.
25
+
26
+ ## User-invocable
27
+ When the user types `/retro`, run this skill.
28
+
29
+ ## Arguments
30
+ - `/retro` — default: last 7 days
31
+ - `/retro 24h` — last 24 hours
32
+ - `/retro 14d` — last 14 days
33
+ - `/retro 30d` — last 30 days
34
+ - `/retro compare` — compare current window vs prior same-length window
35
+ - `/retro compare 14d` — compare with explicit window
36
+
37
+ ## Instructions
38
+
39
+ Parse the argument to determine the time window. Default to 7 days if no argument given. All times should be reported in the user's **local timezone** (use the system default — do NOT set `TZ`).
40
+
41
+ **Midnight-aligned windows:** For day (`d`) and week (`w`) units, compute an absolute start date at local midnight, not a relative string. For example, if today is 2026-03-18 and the window is 7 days: the start date is 2026-03-11. Use `--since="2026-03-11T00:00:00"` for git log queries — the explicit `T00:00:00` suffix ensures git starts from midnight. Without it, git uses the current wall-clock time (e.g., `--since="2026-03-11"` at 11pm means 11pm, not midnight). For week units, multiply by 7 to get days (e.g., `2w` = 14 days back). For hour (`h`) units, use `--since="N hours ago"` since midnight alignment does not apply to sub-day windows.
42
+
43
+ **Argument validation:** If the argument doesn't match a number followed by `d`, `h`, or `w`, the word `compare`, or `compare` followed by a number and `d`/`h`/`w`, show this usage and stop:
44
+ ```
45
+ Usage: /retro [window]
46
+ /retro — last 7 days (default)
47
+ /retro 24h — last 24 hours
48
+ /retro 14d — last 14 days
49
+ /retro 30d — last 30 days
50
+ /retro compare — compare this period vs prior period
51
+ /retro compare 14d — compare with explicit window
52
+ ```
53
+
54
+ ### Step 1: Gather Raw Data
55
+
56
+ First, fetch origin and identify the current user:
57
+ ```bash
58
+ git fetch origin <default> --quiet
59
+ # Identify who is running the retro
60
+ git config user.name
61
+ git config user.email
62
+ ```
63
+
64
+ The name returned by `git config user.name` is **"you"** — the person reading this retro. All other authors are teammates. Use this to orient the narrative: "your" commits vs teammate contributions.
65
+
66
+ Run ALL of these git commands in parallel (they are independent):
67
+
68
+ ```bash
69
+ # 1. All commits in window with timestamps, subject, hash, AUTHOR, files changed, insertions, deletions
70
+ git log origin/<default> --since="<window>" --format="%H|%aN|%ae|%ai|%s" --shortstat
71
+
72
+ # 2. Per-commit test vs total LOC breakdown with author
73
+ # Each commit block starts with COMMIT:<hash>|<author>, followed by numstat lines.
74
+ # Separate test files (matching test/|spec/|__tests__/) from production files.
75
+ git log origin/<default> --since="<window>" --format="COMMIT:%H|%aN" --numstat
76
+
77
+ # 3. Commit timestamps for session detection and hourly distribution (with author)
78
+ git log origin/<default> --since="<window>" --format="%at|%aN|%ai|%s" | sort -n
79
+
80
+ # 4. Files most frequently changed (hotspot analysis)
81
+ git log origin/<default> --since="<window>" --format="" --name-only | grep -v '^$' | sort | uniq -c | sort -rn
82
+
83
+ # 5. PR numbers from commit messages (extract #NNN patterns)
84
+ git log origin/<default> --since="<window>" --format="%s" | grep -oE '#[0-9]+' | sed 's/^#//' | sort -n | uniq | sed 's/^/#/'
85
+
86
+ # 6. Per-author file hotspots (who touches what)
87
+ git log origin/<default> --since="<window>" --format="AUTHOR:%aN" --name-only
88
+
89
+ # 7. Per-author commit counts (quick summary)
90
+ git shortlog origin/<default> --since="<window>" -sn --no-merges
91
+
92
+ # 8. Greptile triage history (if available)
93
+ cat ~/.orch/greptile-history.md 2>/dev/null || true
94
+
95
+ # 9. TODOS.md backlog (if available)
96
+ cat TODOS.md 2>/dev/null || true
97
+
98
+ # 10. Test file count
99
+ find . -name '*.test.*' -o -name '*.spec.*' -o -name '*_test.*' -o -name '*_spec.*' 2>/dev/null | grep -v node_modules | wc -l
100
+
101
+ # 11. Regression test commits in window
102
+ git log origin/<default> --since="<window>" --oneline --grep="test(qa):" --grep="test(design):" --grep="test: coverage"
103
+
104
+ # 12. Skill usage telemetry (if available)
105
+ cat ~/.orch/analytics/skill-usage.jsonl 2>/dev/null || true
106
+
107
+ # 12. Test files changed in window
108
+ git log origin/<default> --since="<window>" --format="" --name-only | grep -E '\.(test|spec)\.' | sort -u | wc -l
109
+ ```
110
+
111
+ ### Step 2: Compute Metrics
112
+
113
+ Calculate and present these metrics in a summary table:
114
+
115
+ | Metric | Value |
116
+ |--------|-------|
117
+ | Commits to main | N |
118
+ | Contributors | N |
119
+ | PRs merged | N |
120
+ | Total insertions | N |
121
+ | Total deletions | N |
122
+ | Net LOC added | N |
123
+ | Test LOC (insertions) | N |
124
+ | Test LOC ratio | N% |
125
+ | Version range | vX.Y.Z.W → vX.Y.Z.W |
126
+ | Active days | N |
127
+ | Detected sessions | N |
128
+ | Avg LOC/session-hour | N |
129
+ | Greptile signal | N% (Y catches, Z FPs) |
130
+ | Test Health | N total tests · M added this period · K regression tests |
131
+
132
+ Then show a **per-author leaderboard** immediately below:
133
+
134
+ ```
135
+ Contributor Commits +/- Top area
136
+ You (garry) 32 +2400/-300 browse/
137
+ alice 12 +800/-150 app/services/
138
+ bob 3 +120/-40 tests/
139
+ ```
140
+
141
+ Sort by commits descending. The current user (from `git config user.name`) always appears first, labeled "You (name)".
142
+
143
+ **Greptile signal (if history exists):** Read `~/.orch/greptile-history.md` (fetched in Step 1, command 8). Filter entries within the retro time window by date. Count entries by type: `fix`, `fp`, `already-fixed`. Compute signal ratio: `(fix + already-fixed) / (fix + already-fixed + fp)`. If no entries exist in the window or the file doesn't exist, skip the Greptile metric row. Skip unparseable lines silently.
144
+
145
+ **Backlog Health (if TODOS.md exists):** Read `TODOS.md` (fetched in Step 1, command 9). Compute:
146
+ - Total open TODOs (exclude items in `## Completed` section)
147
+ - P0/P1 count (critical/urgent items)
148
+ - P2 count (important items)
149
+ - Items completed this period (items in Completed section with dates within the retro window)
150
+ - Items added this period (cross-reference git log for commits that modified TODOS.md within the window)
151
+
152
+ Include in the metrics table:
153
+ ```
154
+ | Backlog Health | N open (X P0/P1, Y P2) · Z completed this period |
155
+ ```
156
+
157
+ If TODOS.md doesn't exist, skip the Backlog Health row.
158
+
159
+ **Skill Usage (if analytics exist):** Read `~/.orch/analytics/skill-usage.jsonl` if it exists. Filter entries within the retro time window by `ts` field. Separate skill activations (no `event` field) from hook fires (`event: "hook_fire"`). Aggregate by skill name. Present as:
160
+
161
+ ```
162
+ | Skill Usage | /ship(12) /qa(8) /review(5) · 3 safety hook fires |
163
+ ```
164
+
165
+ If the JSONL file doesn't exist or has no entries in the window, skip the Skill Usage row.
166
+
167
+ **Eureka Moments (if logged):** Read `~/.orch/analytics/eureka.jsonl` if it exists. Filter entries within the retro time window by `ts` field. For each eureka moment, show the skill that flagged it, the branch, and a one-line summary of the insight. Present as:
168
+
169
+ ```
170
+ | Eureka Moments | 2 this period |
171
+ ```
172
+
173
+ If moments exist, list them:
174
+ ```
175
+ EUREKA /office-hours (branch: garrytan/auth-rethink): "Session tokens don't need server storage — browser crypto API makes client-side JWT validation viable"
176
+ EUREKA /plan-eng-review (branch: garrytan/cache-layer): "Redis isn't needed here — Bun's built-in LRU cache handles this workload"
177
+ ```
178
+
179
+ If the JSONL file doesn't exist or has no entries in the window, skip the Eureka Moments row.
180
+
181
+ ### Step 3: Commit Time Distribution
182
+
183
+ Show hourly histogram in local time using bar chart:
184
+
185
+ ```
186
+ Hour Commits ████████████████
187
+ 00: 4 ████
188
+ 07: 5 █████
189
+ ...
190
+ ```
191
+
192
+ Identify and call out:
193
+ - Peak hours
194
+ - Dead zones
195
+ - Whether pattern is bimodal (morning/evening) or continuous
196
+ - Late-night coding clusters (after 10pm)
197
+
198
+ ### Step 4: Work Session Detection
199
+
200
+ Detect sessions using **45-minute gap** threshold between consecutive commits. For each session report:
201
+ - Start/end time (Pacific)
202
+ - Number of commits
203
+ - Duration in minutes
204
+
205
+ Classify sessions:
206
+ - **Deep sessions** (50+ min)
207
+ - **Medium sessions** (20-50 min)
208
+ - **Micro sessions** (<20 min, typically single-commit fire-and-forget)
209
+
210
+ Calculate:
211
+ - Total active coding time (sum of session durations)
212
+ - Average session length
213
+ - LOC per hour of active time
214
+
215
+ ### Step 5: Commit Type Breakdown
216
+
217
+ Categorize by conventional commit prefix (feat/fix/refactor/test/chore/docs). Show as percentage bar:
218
+
219
+ ```
220
+ feat: 20 (40%) ████████████████████
221
+ fix: 27 (54%) ███████████████████████████
222
+ refactor: 2 ( 4%) ██
223
+ ```
224
+
225
+ Flag if fix ratio exceeds 50% — this signals a "ship fast, fix fast" pattern that may indicate review gaps.
226
+
227
+ ### Step 6: Hotspot Analysis
228
+
229
+ Show top 10 most-changed files. Flag:
230
+ - Files changed 5+ times (churn hotspots)
231
+ - Test files vs production files in the hotspot list
232
+ - VERSION/CHANGELOG frequency (version discipline indicator)
233
+
234
+ ### Step 7: PR Size Distribution
235
+
236
+ From commit diffs, estimate PR sizes and bucket them:
237
+ - **Small** (<100 LOC)
238
+ - **Medium** (100-500 LOC)
239
+ - **Large** (500-1500 LOC)
240
+ - **XL** (1500+ LOC)
241
+
242
+ ### Step 8: Focus Score + Ship of the Week
243
+
244
+ **Focus score:** Calculate the percentage of commits touching the single most-changed top-level directory (e.g., `app/services/`, `app/views/`). Higher score = deeper focused work. Lower score = scattered context-switching. Report as: "Focus score: 62% (app/services/)"
245
+
246
+ **Ship of the week:** Auto-identify the single highest-LOC PR in the window. Highlight it:
247
+ - PR number and title
248
+ - LOC changed
249
+ - Why it matters (infer from commit messages and files touched)
250
+
251
+ ### Step 9: Team Member Analysis
252
+
253
+ For each contributor (including the current user), compute:
254
+
255
+ 1. **Commits and LOC** — total commits, insertions, deletions, net LOC
256
+ 2. **Areas of focus** — which directories/files they touched most (top 3)
257
+ 3. **Commit type mix** — their personal feat/fix/refactor/test breakdown
258
+ 4. **Session patterns** — when they code (their peak hours), session count
259
+ 5. **Test discipline** — their personal test LOC ratio
260
+ 6. **Biggest ship** — their single highest-impact commit or PR in the window
261
+
262
+ **For the current user ("You"):** This section gets the deepest treatment. Include all the detail from the solo retro — session analysis, time patterns, focus score. Frame it in first person: "Your peak hours...", "Your biggest ship..."
263
+
264
+ **For each teammate:** Write 2-3 sentences covering what they worked on and their pattern. Then:
265
+
266
+ - **Praise** (1-2 specific things): Anchor in actual commits. Not "great work" — say exactly what was good. Examples: "Shipped the entire auth middleware rewrite in 3 focused sessions with 45% test coverage", "Every PR under 200 LOC — disciplined decomposition."
267
+ - **Opportunity for growth** (1 specific thing): Frame as a leveling-up suggestion, not criticism. Anchor in actual data. Examples: "Test ratio was 12% this week — adding test coverage to the payment module before it gets more complex would pay off", "5 fix commits on the same file suggest the original PR could have used a review pass."
268
+
269
+ **If only one contributor (solo repo):** Skip the team breakdown and proceed as before — the retro is personal.
270
+
271
+ **If there are Co-Authored-By trailers:** Parse `Co-Authored-By:` lines in commit messages. Credit those authors for the commit alongside the primary author. Note AI co-authors (e.g., `noreply@anthropic.com`) but do not include them as team members — instead, track "AI-assisted commits" as a separate metric.
272
+
273
+ ### Step 10: Week-over-Week Trends (if window >= 14d)
274
+
275
+ If the time window is 14 days or more, split into weekly buckets and show trends:
276
+ - Commits per week (total and per-author)
277
+ - LOC per week
278
+ - Test ratio per week
279
+ - Fix ratio per week
280
+ - Session count per week
281
+
282
+ ### Step 11: Streak Tracking
283
+
284
+ Count consecutive days with at least 1 commit to origin/<default>, going back from today. Track both team streak and personal streak:
285
+
286
+ ```bash
287
+ # Team streak: all unique commit dates (local time) — no hard cutoff
288
+ git log origin/<default> --format="%ad" --date=format:"%Y-%m-%d" | sort -u
289
+
290
+ # Personal streak: only the current user's commits
291
+ git log origin/<default> --author="<user_name>" --format="%ad" --date=format:"%Y-%m-%d" | sort -u
292
+ ```
293
+
294
+ Count backward from today — how many consecutive days have at least one commit? This queries the full history so streaks of any length are reported accurately. Display both:
295
+ - "Team shipping streak: 47 consecutive days"
296
+ - "Your shipping streak: 32 consecutive days"
297
+
298
+ ### Step 12: Load History & Compare
299
+
300
+ Before saving the new snapshot, check for prior retro history:
301
+
302
+ ```bash
303
+ ls -t .context/retros/*.json 2>/dev/null
304
+ ```
305
+
306
+ **If prior retros exist:** Load the most recent one using the Read tool. Calculate deltas for key metrics and include a **Trends vs Last Retro** section:
307
+ ```
308
+ Last Now Delta
309
+ Test ratio: 22% → 41% ↑19pp
310
+ Sessions: 10 → 14 ↑4
311
+ LOC/hour: 200 → 350 ↑75%
312
+ Fix ratio: 54% → 30% ↓24pp (improving)
313
+ Commits: 32 → 47 ↑47%
314
+ Deep sessions: 3 → 5 ↑2
315
+ ```
316
+
317
+ **If no prior retros exist:** Skip the comparison section and append: "First retro recorded — run again next week to see trends."
318
+
319
+ ### Step 13: Save Retro History
320
+
321
+ After computing all metrics (including streak) and loading any prior history for comparison, save a JSON snapshot:
322
+
323
+ ```bash
324
+ mkdir -p .context/retros
325
+ ```
326
+
327
+ Determine the next sequence number for today (substitute the actual date for `$(date +%Y-%m-%d)`):
328
+ ```bash
329
+ # Count existing retros for today to get next sequence number
330
+ today=$(date +%Y-%m-%d)
331
+ existing=$(ls .context/retros/${today}-*.json 2>/dev/null | wc -l | tr -d ' ')
332
+ next=$((existing + 1))
333
+ # Save as .context/retros/${today}-${next}.json
334
+ ```
335
+
336
+ Use the Write tool to save the JSON file with this schema:
337
+ ```json
338
+ {
339
+ "date": "2026-03-08",
340
+ "window": "7d",
341
+ "metrics": {
342
+ "commits": 47,
343
+ "contributors": 3,
344
+ "prs_merged": 12,
345
+ "insertions": 3200,
346
+ "deletions": 800,
347
+ "net_loc": 2400,
348
+ "test_loc": 1300,
349
+ "test_ratio": 0.41,
350
+ "active_days": 6,
351
+ "sessions": 14,
352
+ "deep_sessions": 5,
353
+ "avg_session_minutes": 42,
354
+ "loc_per_session_hour": 350,
355
+ "feat_pct": 0.40,
356
+ "fix_pct": 0.30,
357
+ "peak_hour": 22,
358
+ "ai_assisted_commits": 32
359
+ },
360
+ "authors": {
361
+ "Garry Tan": { "commits": 32, "insertions": 2400, "deletions": 300, "test_ratio": 0.41, "top_area": "browse/" },
362
+ "Alice": { "commits": 12, "insertions": 800, "deletions": 150, "test_ratio": 0.35, "top_area": "app/services/" }
363
+ },
364
+ "version_range": ["1.16.0.0", "1.16.1.0"],
365
+ "streak_days": 47,
366
+ "tweetable": "Week of Mar 1: 47 commits (3 contributors), 3.2k LOC, 38% tests, 12 PRs, peak: 10pm",
367
+ "greptile": {
368
+ "fixes": 3,
369
+ "fps": 1,
370
+ "already_fixed": 2,
371
+ "signal_pct": 83
372
+ }
373
+ }
374
+ ```
375
+
376
+ **Note:** Only include the `greptile` field if `~/.orch/greptile-history.md` exists and has entries within the time window. Only include the `backlog` field if `TODOS.md` exists. Only include the `test_health` field if test files were found (command 10 returns > 0). If any has no data, omit the field entirely.
377
+
378
+ Include test health data in the JSON when test files exist:
379
+ ```json
380
+ "test_health": {
381
+ "total_test_files": 47,
382
+ "tests_added_this_period": 5,
383
+ "regression_test_commits": 3,
384
+ "test_files_changed": 8
385
+ }
386
+ ```
387
+
388
+ Include backlog data in the JSON when TODOS.md exists:
389
+ ```json
390
+ "backlog": {
391
+ "total_open": 28,
392
+ "p0_p1": 2,
393
+ "p2": 8,
394
+ "completed_this_period": 3,
395
+ "added_this_period": 1
396
+ }
397
+ ```
398
+
399
+ ### Step 14: Write the Narrative
400
+
401
+ Structure the output as:
402
+
403
+ ---
404
+
405
+ **Tweetable summary** (first line, before everything else):
406
+ ```
407
+ Week of Mar 1: 47 commits (3 contributors), 3.2k LOC, 38% tests, 12 PRs, peak: 10pm | Streak: 47d
408
+ ```
409
+
410
+ ## Engineering Retro: [date range]
411
+
412
+ ### Summary Table
413
+ (from Step 2)
414
+
415
+ ### Trends vs Last Retro
416
+ (from Step 11, loaded before save — skip if first retro)
417
+
418
+ ### Time & Session Patterns
419
+ (from Steps 3-4)
420
+
421
+ Narrative interpreting what the team-wide patterns mean:
422
+ - When the most productive hours are and what drives them
423
+ - Whether sessions are getting longer or shorter over time
424
+ - Estimated hours per day of active coding (team aggregate)
425
+ - Notable patterns: do team members code at the same time or in shifts?
426
+
427
+ ### Shipping Velocity
428
+ (from Steps 5-7)
429
+
430
+ Narrative covering:
431
+ - Commit type mix and what it reveals
432
+ - PR size distribution and what it reveals about shipping cadence
433
+ - Fix-chain detection (sequences of fix commits on the same subsystem)
434
+ - Version bump discipline
435
+
436
+ ### Code Quality Signals
437
+ - Test LOC ratio trend
438
+ - Hotspot analysis (are the same files churning?)
439
+ - Greptile signal ratio and trend (if history exists): "Greptile: X% signal (Y valid catches, Z false positives)"
440
+
441
+ ### Test Health
442
+ - Total test files: N (from command 10)
443
+ - Tests added this period: M (from command 12 — test files changed)
444
+ - Regression test commits: list `test(qa):` and `test(design):` and `test: coverage` commits from command 11
445
+ - If prior retro exists and has `test_health`: show delta "Test count: {last} → {now} (+{delta})"
446
+ - If test ratio < 20%: flag as growth area — "100% test coverage is the goal. Tests make vibe coding safe."
447
+
448
+ ### Focus & Highlights
449
+ (from Step 8)
450
+ - Focus score with interpretation
451
+ - Ship of the week callout
452
+
453
+ ### Your Week (personal deep-dive)
454
+ (from Step 9, for the current user only)
455
+
456
+ This is the section the user cares most about. Include:
457
+ - Their personal commit count, LOC, test ratio
458
+ - Their session patterns and peak hours
459
+ - Their focus areas
460
+ - Their biggest ship
461
+ - **What you did well** (2-3 specific things anchored in commits)
462
+ - **Where to level up** (1-2 specific, actionable suggestions)
463
+
464
+ ### Team Breakdown
465
+ (from Step 9, for each teammate — skip if solo repo)
466
+
467
+ For each teammate (sorted by commits descending), write a section:
468
+
469
+ #### [Name]
470
+ - **What they shipped**: 2-3 sentences on their contributions, areas of focus, and commit patterns
471
+ - **Praise**: 1-2 specific things they did well, anchored in actual commits. Be genuine — what would you actually say in a 1:1? Examples:
472
+ - "Cleaned up the entire auth module in 3 small, reviewable PRs — textbook decomposition"
473
+ - "Added integration tests for every new endpoint, not just happy paths"
474
+ - "Fixed the N+1 query that was causing 2s load times on the dashboard"
475
+ - **Opportunity for growth**: 1 specific, constructive suggestion. Frame as investment, not criticism. Examples:
476
+ - "Test coverage on the payment module is at 8% — worth investing in before the next feature lands on top of it"
477
+ - "Most commits land in a single burst — spacing work across the day could reduce context-switching fatigue"
478
+ - "All commits land between 1-4am — sustainable pace matters for code quality long-term"
479
+
480
+ **AI collaboration note:** If many commits have `Co-Authored-By` AI trailers (e.g., Claude, Copilot), note the AI-assisted commit percentage as a team metric. Frame it neutrally — "N% of commits were AI-assisted" — without judgment.
481
+
482
+ ### Top 3 Team Wins
483
+ Identify the 3 highest-impact things shipped in the window across the whole team. For each:
484
+ - What it was
485
+ - Who shipped it
486
+ - Why it matters (product/architecture impact)
487
+
488
+ ### 3 Things to Improve
489
+ Specific, actionable, anchored in actual commits. Mix personal and team-level suggestions. Phrase as "to get even better, the team could..."
490
+
491
+ ### 3 Habits for Next Week
492
+ Small, practical, realistic. Each must be something that takes <5 minutes to adopt. At least one should be team-oriented (e.g., "review each other's PRs same-day").
493
+
494
+ ### Week-over-Week Trends
495
+ (if applicable, from Step 10)
496
+
497
+ ---
498
+
499
+ ## Compare Mode
500
+
501
+ When the user runs `/retro compare` (or `/retro compare 14d`):
502
+
503
+ 1. Compute metrics for the current window (default 7d) using the midnight-aligned start date (same logic as the main retro — e.g., if today is 2026-03-18 and window is 7d, use `--since="2026-03-11T00:00:00"`)
504
+ 2. Compute metrics for the immediately prior same-length window using both `--since` and `--until` with midnight-aligned dates to avoid overlap (e.g., for a 7d window starting 2026-03-11: prior window is `--since="2026-03-04T00:00:00" --until="2026-03-11T00:00:00"`)
505
+ 3. Show a side-by-side comparison table with deltas and arrows
506
+ 4. Write a brief narrative highlighting the biggest improvements and regressions
507
+ 5. Save only the current-window snapshot to `.context/retros/` (same as a normal retro run); do **not** persist the prior-window metrics.
508
+
509
+ ## Tone
510
+
511
+ - Encouraging but candid, no coddling
512
+ - Specific and concrete — always anchor in actual commits/code
513
+ - Skip generic praise ("great job!") — say exactly what was good and why
514
+ - Frame improvements as leveling up, not criticism
515
+ - **Praise should feel like something you'd actually say in a 1:1** — specific, earned, genuine
516
+ - **Growth suggestions should feel like investment advice** — "this is worth your time because..." not "you failed at..."
517
+ - Never compare teammates against each other negatively. Each person's section stands on its own.
518
+ - Keep total output around 3000-4500 words (slightly longer to accommodate team sections)
519
+ - Use markdown tables and code blocks for data, prose for narrative
520
+ - Output directly to the conversation — do NOT write to filesystem (except the `.context/retros/` JSON snapshot)
521
+
522
+ ## Important Rules
523
+
524
+ - ALL narrative output goes directly to the user in the conversation. The ONLY file written is the `.context/retros/` JSON snapshot.
525
+ - Use `origin/<default>` for all git queries (not local main which may be stale)
526
+ - Display all timestamps in the user's local timezone (do not override `TZ`)
527
+ - If the window has zero commits, say so and suggest a different window
528
+ - Round LOC/hour to nearest 50
529
+ - Treat merge commits as PR boundaries
530
+ - Do not read CLAUDE.md or other docs — this skill is self-contained
531
+ - On first run (no prior retros), skip comparison sections gracefully
532
+