relay-cc 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.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +428 -0
  3. package/agents/relay-codebase-mapper.md +761 -0
  4. package/agents/relay-debugger.md +1203 -0
  5. package/agents/relay-estimator.md +257 -0
  6. package/agents/relay-executor.md +823 -0
  7. package/agents/relay-plan-checker.md +812 -0
  8. package/agents/relay-planner.md +1418 -0
  9. package/agents/relay-reviewer.md +279 -0
  10. package/agents/relay-ticket-researcher.md +287 -0
  11. package/agents/relay-verifier.md +778 -0
  12. package/bin/install.js +1667 -0
  13. package/commands/relay/add-todo.md +193 -0
  14. package/commands/relay/check-todos.md +200 -0
  15. package/commands/relay/debug.md +169 -0
  16. package/commands/relay/estimate.md +182 -0
  17. package/commands/relay/help.md +328 -0
  18. package/commands/relay/history.md +203 -0
  19. package/commands/relay/map-codebase.md +71 -0
  20. package/commands/relay/pause-work.md +128 -0
  21. package/commands/relay/pr.md +223 -0
  22. package/commands/relay/quick.md +307 -0
  23. package/commands/relay/resume-work.md +40 -0
  24. package/commands/relay/resume.md +181 -0
  25. package/commands/relay/review.md +322 -0
  26. package/commands/relay/rollback.md +248 -0
  27. package/commands/relay/set-profile.md +116 -0
  28. package/commands/relay/settings.md +165 -0
  29. package/commands/relay/setup.md +247 -0
  30. package/commands/relay/status.md +131 -0
  31. package/commands/relay/tickets.md +106 -0
  32. package/commands/relay/update.md +200 -0
  33. package/commands/relay/work.md +398 -0
  34. package/hooks/dist/relay-check-update.js +61 -0
  35. package/hooks/dist/relay-statusline.js +91 -0
  36. package/package.json +47 -0
  37. package/relay/references/checkpoints.md +1078 -0
  38. package/relay/references/continuation-format.md +249 -0
  39. package/relay/references/git-integration.md +209 -0
  40. package/relay/references/model-profiles.md +57 -0
  41. package/relay/references/planning-config.md +189 -0
  42. package/relay/references/questioning.md +141 -0
  43. package/relay/references/tdd.md +263 -0
  44. package/relay/references/ui-brand.md +162 -0
  45. package/relay/references/verification-patterns.md +612 -0
  46. package/relay/templates/DEBUG.md +159 -0
  47. package/relay/templates/UAT.md +247 -0
  48. package/relay/templates/analysis.md +101 -0
  49. package/relay/templates/codebase/architecture.md +255 -0
  50. package/relay/templates/codebase/concerns.md +310 -0
  51. package/relay/templates/codebase/conventions.md +307 -0
  52. package/relay/templates/codebase/integrations.md +280 -0
  53. package/relay/templates/codebase/stack.md +186 -0
  54. package/relay/templates/codebase/structure.md +285 -0
  55. package/relay/templates/codebase/testing.md +480 -0
  56. package/relay/templates/config.json +40 -0
  57. package/relay/templates/context.md +283 -0
  58. package/relay/templates/continue-here.md +78 -0
  59. package/relay/templates/debug-subagent-prompt.md +91 -0
  60. package/relay/templates/estimate.md +108 -0
  61. package/relay/templates/phase-prompt.md +567 -0
  62. package/relay/templates/planner-subagent-prompt.md +117 -0
  63. package/relay/templates/research.md +552 -0
  64. package/relay/templates/state.md +127 -0
  65. package/relay/templates/summary.md +246 -0
  66. package/relay/templates/verification-report.md +322 -0
  67. package/relay/workflows/analyze-ticket.md +42 -0
  68. package/relay/workflows/diagnose-issues.md +231 -0
  69. package/relay/workflows/execute-phase.md +700 -0
  70. package/relay/workflows/execute-plan.md +1851 -0
  71. package/relay/workflows/map-codebase.md +357 -0
  72. package/relay/workflows/resume-project.md +307 -0
  73. package/relay/workflows/sync-ticket.md +58 -0
  74. package/relay/workflows/verify-phase.md +628 -0
  75. package/relay/workflows/verify-ticket.md +596 -0
  76. package/scripts/build-hooks.js +42 -0
@@ -0,0 +1,246 @@
1
+ # Summary Template
2
+
3
+ Template for `.relay/tickets/XX-name/{phase}-{plan}-SUMMARY.md` - phase completion documentation.
4
+
5
+ ---
6
+
7
+ ## File Template
8
+
9
+ ```markdown
10
+ ---
11
+ phase: XX-name
12
+ plan: YY
13
+ subsystem: [primary category: auth, payments, ui, api, database, infra, testing, etc.]
14
+ tags: [searchable tech: jwt, stripe, react, postgres, prisma]
15
+
16
+ # Dependency graph
17
+ requires:
18
+ - phase: [prior phase this depends on]
19
+ provides: [what that phase built that this uses]
20
+ provides:
21
+ - [bullet list of what this phase built/delivered]
22
+ affects: [list of phase names or keywords that will need this context]
23
+
24
+ # Tech tracking
25
+ tech-stack:
26
+ added: [libraries/tools added in this phase]
27
+ patterns: [architectural/code patterns established]
28
+
29
+ key-files:
30
+ created: [important files created]
31
+ modified: [important files modified]
32
+
33
+ key-decisions:
34
+ - "Decision 1"
35
+ - "Decision 2"
36
+
37
+ patterns-established:
38
+ - "Pattern 1: description"
39
+ - "Pattern 2: description"
40
+
41
+ # Metrics
42
+ duration: Xmin
43
+ completed: YYYY-MM-DD
44
+ ---
45
+
46
+ # Phase [X]: [Name] Summary
47
+
48
+ **[Substantive one-liner describing outcome - NOT "phase complete" or "implementation finished"]**
49
+
50
+ ## Performance
51
+
52
+ - **Duration:** [time] (e.g., 23 min, 1h 15m)
53
+ - **Started:** [ISO timestamp]
54
+ - **Completed:** [ISO timestamp]
55
+ - **Tasks:** [count completed]
56
+ - **Files modified:** [count]
57
+
58
+ ## Accomplishments
59
+ - [Most important outcome]
60
+ - [Second key accomplishment]
61
+ - [Third if applicable]
62
+
63
+ ## Task Commits
64
+
65
+ Each task was committed atomically:
66
+
67
+ 1. **Task 1: [task name]** - `abc123f` (feat/fix/test/refactor)
68
+ 2. **Task 2: [task name]** - `def456g` (feat/fix/test/refactor)
69
+ 3. **Task 3: [task name]** - `hij789k` (feat/fix/test/refactor)
70
+
71
+ **Plan metadata:** `lmn012o` (docs: complete plan)
72
+
73
+ _Note: TDD tasks may have multiple commits (test → feat → refactor)_
74
+
75
+ ## Files Created/Modified
76
+ - `path/to/file.ts` - What it does
77
+ - `path/to/another.ts` - What it does
78
+
79
+ ## Decisions Made
80
+ [Key decisions with brief rationale, or "None - followed plan as specified"]
81
+
82
+ ## Deviations from Plan
83
+
84
+ [If no deviations: "None - plan executed exactly as written"]
85
+
86
+ [If deviations occurred:]
87
+
88
+ ### Auto-fixed Issues
89
+
90
+ **1. [Rule X - Category] Brief description**
91
+ - **Found during:** Task [N] ([task name])
92
+ - **Issue:** [What was wrong]
93
+ - **Fix:** [What was done]
94
+ - **Files modified:** [file paths]
95
+ - **Verification:** [How it was verified]
96
+ - **Committed in:** [hash] (part of task commit)
97
+
98
+ [... repeat for each auto-fix ...]
99
+
100
+ ---
101
+
102
+ **Total deviations:** [N] auto-fixed ([breakdown by rule])
103
+ **Impact on plan:** [Brief assessment - e.g., "All auto-fixes necessary for correctness/security. No scope creep."]
104
+
105
+ ## Issues Encountered
106
+ [Problems and how they were resolved, or "None"]
107
+
108
+ [Note: "Deviations from Plan" documents unplanned work that was handled automatically via deviation rules. "Issues Encountered" documents problems during planned work that required problem-solving.]
109
+
110
+ ## User Setup Required
111
+
112
+ [If USER-SETUP.md was generated:]
113
+ **External services require manual configuration.** See [{phase}-USER-SETUP.md](./{phase}-USER-SETUP.md) for:
114
+ - Environment variables to add
115
+ - Dashboard configuration steps
116
+ - Verification commands
117
+
118
+ [If no USER-SETUP.md:]
119
+ None - no external service configuration required.
120
+
121
+ ## Next Phase Readiness
122
+ [What's ready for next phase]
123
+ [Any blockers or concerns]
124
+
125
+ ---
126
+ *Phase: XX-name*
127
+ *Completed: [date]*
128
+ ```
129
+
130
+ <frontmatter_guidance>
131
+ **Purpose:** Enable automatic context assembly via dependency graph. Frontmatter makes summary metadata machine-readable so plan-phase can scan all summaries quickly and select relevant ones based on dependencies.
132
+
133
+ **Fast scanning:** Frontmatter is first ~25 lines, cheap to scan across all summaries without reading full content.
134
+
135
+ **Dependency graph:** `requires`/`provides`/`affects` create explicit links between phases, enabling transitive closure for context selection.
136
+
137
+ **Subsystem:** Primary categorization (auth, payments, ui, api, database, infra, testing) for detecting related phases.
138
+
139
+ **Tags:** Searchable technical keywords (libraries, frameworks, tools) for tech stack awareness.
140
+
141
+ **Key-files:** Important files for @context references in PLAN.md.
142
+
143
+ **Patterns:** Established conventions future phases should maintain.
144
+
145
+ **Population:** Frontmatter is populated during summary creation in execute-plan.md. See `<step name="create_summary">` for field-by-field guidance.
146
+ </frontmatter_guidance>
147
+
148
+ <one_liner_rules>
149
+ The one-liner MUST be substantive:
150
+
151
+ **Good:**
152
+ - "JWT auth with refresh rotation using jose library"
153
+ - "Prisma schema with User, Session, and Product models"
154
+ - "Dashboard with real-time metrics via Server-Sent Events"
155
+
156
+ **Bad:**
157
+ - "Phase complete"
158
+ - "Authentication implemented"
159
+ - "Foundation finished"
160
+ - "All tasks done"
161
+
162
+ The one-liner should tell someone what actually shipped.
163
+ </one_liner_rules>
164
+
165
+ <example>
166
+ ```markdown
167
+ # Phase 1: Foundation Summary
168
+
169
+ **JWT auth with refresh rotation using jose library, Prisma User model, and protected API middleware**
170
+
171
+ ## Performance
172
+
173
+ - **Duration:** 28 min
174
+ - **Started:** 2025-01-15T14:22:10Z
175
+ - **Completed:** 2025-01-15T14:50:33Z
176
+ - **Tasks:** 5
177
+ - **Files modified:** 8
178
+
179
+ ## Accomplishments
180
+ - User model with email/password auth
181
+ - Login/logout endpoints with httpOnly JWT cookies
182
+ - Protected route middleware checking token validity
183
+ - Refresh token rotation on each request
184
+
185
+ ## Files Created/Modified
186
+ - `prisma/schema.prisma` - User and Session models
187
+ - `src/app/api/auth/login/route.ts` - Login endpoint
188
+ - `src/app/api/auth/logout/route.ts` - Logout endpoint
189
+ - `src/middleware.ts` - Protected route checks
190
+ - `src/lib/auth.ts` - JWT helpers using jose
191
+
192
+ ## Decisions Made
193
+ - Used jose instead of jsonwebtoken (ESM-native, Edge-compatible)
194
+ - 15-min access tokens with 7-day refresh tokens
195
+ - Storing refresh tokens in database for revocation capability
196
+
197
+ ## Deviations from Plan
198
+
199
+ ### Auto-fixed Issues
200
+
201
+ **1. [Rule 2 - Missing Critical] Added password hashing with bcrypt**
202
+ - **Found during:** Task 2 (Login endpoint implementation)
203
+ - **Issue:** Plan didn't specify password hashing - storing plaintext would be critical security flaw
204
+ - **Fix:** Added bcrypt hashing on registration, comparison on login with salt rounds 10
205
+ - **Files modified:** src/app/api/auth/login/route.ts, src/lib/auth.ts
206
+ - **Verification:** Password hash test passes, plaintext never stored
207
+ - **Committed in:** abc123f (Task 2 commit)
208
+
209
+ **2. [Rule 3 - Blocking] Installed missing jose dependency**
210
+ - **Found during:** Task 4 (JWT token generation)
211
+ - **Issue:** jose package not in package.json, import failing
212
+ - **Fix:** Ran `npm install jose`
213
+ - **Files modified:** package.json, package-lock.json
214
+ - **Verification:** Import succeeds, build passes
215
+ - **Committed in:** def456g (Task 4 commit)
216
+
217
+ ---
218
+
219
+ **Total deviations:** 2 auto-fixed (1 missing critical, 1 blocking)
220
+ **Impact on plan:** Both auto-fixes essential for security and functionality. No scope creep.
221
+
222
+ ## Issues Encountered
223
+ - jsonwebtoken CommonJS import failed in Edge runtime - switched to jose (planned library change, worked as expected)
224
+
225
+ ## Next Phase Readiness
226
+ - Auth foundation complete, ready for feature development
227
+ - User registration endpoint needed before public launch
228
+
229
+ ---
230
+ *Phase: 01-foundation*
231
+ *Completed: 2025-01-15*
232
+ ```
233
+ </example>
234
+
235
+ <guidelines>
236
+ **Frontmatter:** MANDATORY - complete all fields. Enables automatic context assembly for future planning.
237
+
238
+ **One-liner:** Must be substantive. "JWT auth with refresh rotation using jose library" not "Authentication implemented".
239
+
240
+ **Decisions section:**
241
+ - Key decisions made during execution with rationale
242
+ - Extracted to STATE.md accumulated context
243
+ - Use "None - followed plan as specified" if no deviations
244
+
245
+ **After creation:** STATE.md updated with position, decisions, issues.
246
+ </guidelines>
@@ -0,0 +1,322 @@
1
+ # Verification Report Template
2
+
3
+ Template for `.relay/tickets/XX-name/{phase}-VERIFICATION.md` — phase goal verification results.
4
+
5
+ ---
6
+
7
+ ## File Template
8
+
9
+ ```markdown
10
+ ---
11
+ phase: XX-name
12
+ verified: YYYY-MM-DDTHH:MM:SSZ
13
+ status: passed | gaps_found | human_needed
14
+ score: N/M must-haves verified
15
+ ---
16
+
17
+ # Phase {X}: {Name} Verification Report
18
+
19
+ **Phase Goal:** {goal from ROADMAP.md}
20
+ **Verified:** {timestamp}
21
+ **Status:** {passed | gaps_found | human_needed}
22
+
23
+ ## Goal Achievement
24
+
25
+ ### Observable Truths
26
+
27
+ | # | Truth | Status | Evidence |
28
+ |---|-------|--------|----------|
29
+ | 1 | {truth from must_haves} | ✓ VERIFIED | {what confirmed it} |
30
+ | 2 | {truth from must_haves} | ✗ FAILED | {what's wrong} |
31
+ | 3 | {truth from must_haves} | ? UNCERTAIN | {why can't verify} |
32
+
33
+ **Score:** {N}/{M} truths verified
34
+
35
+ ### Required Artifacts
36
+
37
+ | Artifact | Expected | Status | Details |
38
+ |----------|----------|--------|---------|
39
+ | `src/components/Chat.tsx` | Message list component | ✓ EXISTS + SUBSTANTIVE | Exports ChatList, renders Message[], no stubs |
40
+ | `src/app/api/chat/route.ts` | Message CRUD | ✗ STUB | File exists but POST returns placeholder |
41
+ | `prisma/schema.prisma` | Message model | ✓ EXISTS + SUBSTANTIVE | Model defined with all fields |
42
+
43
+ **Artifacts:** {N}/{M} verified
44
+
45
+ ### Key Link Verification
46
+
47
+ | From | To | Via | Status | Details |
48
+ |------|----|----|--------|---------|
49
+ | Chat.tsx | /api/chat | fetch in useEffect | ✓ WIRED | Line 23: `fetch('/api/chat')` with response handling |
50
+ | ChatInput | /api/chat POST | onSubmit handler | ✗ NOT WIRED | onSubmit only calls console.log |
51
+ | /api/chat POST | database | prisma.message.create | ✗ NOT WIRED | Returns hardcoded response, no DB call |
52
+
53
+ **Wiring:** {N}/{M} connections verified
54
+
55
+ ## Requirements Coverage
56
+
57
+ | Requirement | Status | Blocking Issue |
58
+ |-------------|--------|----------------|
59
+ | {REQ-01}: {description} | ✓ SATISFIED | - |
60
+ | {REQ-02}: {description} | ✗ BLOCKED | API route is stub |
61
+ | {REQ-03}: {description} | ? NEEDS HUMAN | Can't verify WebSocket programmatically |
62
+
63
+ **Coverage:** {N}/{M} requirements satisfied
64
+
65
+ ## Anti-Patterns Found
66
+
67
+ | File | Line | Pattern | Severity | Impact |
68
+ |------|------|---------|----------|--------|
69
+ | src/app/api/chat/route.ts | 12 | `// TODO: implement` | ⚠️ Warning | Indicates incomplete |
70
+ | src/components/Chat.tsx | 45 | `return <div>Placeholder</div>` | 🛑 Blocker | Renders no content |
71
+ | src/hooks/useChat.ts | - | File missing | 🛑 Blocker | Expected hook doesn't exist |
72
+
73
+ **Anti-patterns:** {N} found ({blockers} blockers, {warnings} warnings)
74
+
75
+ ## Human Verification Required
76
+
77
+ {If no human verification needed:}
78
+ None — all verifiable items checked programmatically.
79
+
80
+ {If human verification needed:}
81
+
82
+ ### 1. {Test Name}
83
+ **Test:** {What to do}
84
+ **Expected:** {What should happen}
85
+ **Why human:** {Why can't verify programmatically}
86
+
87
+ ### 2. {Test Name}
88
+ **Test:** {What to do}
89
+ **Expected:** {What should happen}
90
+ **Why human:** {Why can't verify programmatically}
91
+
92
+ ## Gaps Summary
93
+
94
+ {If no gaps:}
95
+ **No gaps found.** Phase goal achieved. Ready to proceed.
96
+
97
+ {If gaps found:}
98
+
99
+ ### Critical Gaps (Block Progress)
100
+
101
+ 1. **{Gap name}**
102
+ - Missing: {what's missing}
103
+ - Impact: {why this blocks the goal}
104
+ - Fix: {what needs to happen}
105
+
106
+ 2. **{Gap name}**
107
+ - Missing: {what's missing}
108
+ - Impact: {why this blocks the goal}
109
+ - Fix: {what needs to happen}
110
+
111
+ ### Non-Critical Gaps (Can Defer)
112
+
113
+ 1. **{Gap name}**
114
+ - Issue: {what's wrong}
115
+ - Impact: {limited impact because...}
116
+ - Recommendation: {fix now or defer}
117
+
118
+ ## Recommended Fix Plans
119
+
120
+ {If gaps found, generate fix plan recommendations:}
121
+
122
+ ### {phase}-{next}-PLAN.md: {Fix Name}
123
+
124
+ **Objective:** {What this fixes}
125
+
126
+ **Tasks:**
127
+ 1. {Task to fix gap 1}
128
+ 2. {Task to fix gap 2}
129
+ 3. {Verification task}
130
+
131
+ **Estimated scope:** {Small / Medium}
132
+
133
+ ---
134
+
135
+ ### {phase}-{next+1}-PLAN.md: {Fix Name}
136
+
137
+ **Objective:** {What this fixes}
138
+
139
+ **Tasks:**
140
+ 1. {Task}
141
+ 2. {Task}
142
+
143
+ **Estimated scope:** {Small / Medium}
144
+
145
+ ---
146
+
147
+ ## Verification Metadata
148
+
149
+ **Verification approach:** Goal-backward (derived from phase goal)
150
+ **Must-haves source:** {PLAN.md frontmatter | derived from ROADMAP.md goal}
151
+ **Automated checks:** {N} passed, {M} failed
152
+ **Human checks required:** {N}
153
+ **Total verification time:** {duration}
154
+
155
+ ---
156
+ *Verified: {timestamp}*
157
+ *Verifier: Claude (subagent)*
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Guidelines
163
+
164
+ **Status values:**
165
+ - `passed` — All must-haves verified, no blockers
166
+ - `gaps_found` — One or more critical gaps found
167
+ - `human_needed` — Automated checks pass but human verification required
168
+
169
+ **Evidence types:**
170
+ - For EXISTS: "File at path, exports X"
171
+ - For SUBSTANTIVE: "N lines, has patterns X, Y, Z"
172
+ - For WIRED: "Line N: code that connects A to B"
173
+ - For FAILED: "Missing because X" or "Stub because Y"
174
+
175
+ **Severity levels:**
176
+ - 🛑 Blocker: Prevents goal achievement, must fix
177
+ - ⚠️ Warning: Indicates incomplete but doesn't block
178
+ - ℹ️ Info: Notable but not problematic
179
+
180
+ **Fix plan generation:**
181
+ - Only generate if gaps_found
182
+ - Group related fixes into single plans
183
+ - Keep to 2-3 tasks per plan
184
+ - Include verification task in each plan
185
+
186
+ ---
187
+
188
+ ## Example
189
+
190
+ ```markdown
191
+ ---
192
+ phase: 03-chat
193
+ verified: 2025-01-15T14:30:00Z
194
+ status: gaps_found
195
+ score: 2/5 must-haves verified
196
+ ---
197
+
198
+ # Phase 3: Chat Interface Verification Report
199
+
200
+ **Phase Goal:** Working chat interface where users can send and receive messages
201
+ **Verified:** 2025-01-15T14:30:00Z
202
+ **Status:** gaps_found
203
+
204
+ ## Goal Achievement
205
+
206
+ ### Observable Truths
207
+
208
+ | # | Truth | Status | Evidence |
209
+ |---|-------|--------|----------|
210
+ | 1 | User can see existing messages | ✗ FAILED | Component renders placeholder, not message data |
211
+ | 2 | User can type a message | ✓ VERIFIED | Input field exists with onChange handler |
212
+ | 3 | User can send a message | ✗ FAILED | onSubmit handler is console.log only |
213
+ | 4 | Sent message appears in list | ✗ FAILED | No state update after send |
214
+ | 5 | Messages persist across refresh | ? UNCERTAIN | Can't verify - send doesn't work |
215
+
216
+ **Score:** 1/5 truths verified
217
+
218
+ ### Required Artifacts
219
+
220
+ | Artifact | Expected | Status | Details |
221
+ |----------|----------|--------|---------|
222
+ | `src/components/Chat.tsx` | Message list component | ✗ STUB | Returns `<div>Chat will be here</div>` |
223
+ | `src/components/ChatInput.tsx` | Message input | ✓ EXISTS + SUBSTANTIVE | Form with input, submit button, handlers |
224
+ | `src/app/api/chat/route.ts` | Message CRUD | ✗ STUB | GET returns [], POST returns { ok: true } |
225
+ | `prisma/schema.prisma` | Message model | ✓ EXISTS + SUBSTANTIVE | Message model with id, content, userId, createdAt |
226
+
227
+ **Artifacts:** 2/4 verified
228
+
229
+ ### Key Link Verification
230
+
231
+ | From | To | Via | Status | Details |
232
+ |------|----|----|--------|---------|
233
+ | Chat.tsx | /api/chat GET | fetch | ✗ NOT WIRED | No fetch call in component |
234
+ | ChatInput | /api/chat POST | onSubmit | ✗ NOT WIRED | Handler only logs, doesn't fetch |
235
+ | /api/chat GET | database | prisma.message.findMany | ✗ NOT WIRED | Returns hardcoded [] |
236
+ | /api/chat POST | database | prisma.message.create | ✗ NOT WIRED | Returns { ok: true }, no DB call |
237
+
238
+ **Wiring:** 0/4 connections verified
239
+
240
+ ## Requirements Coverage
241
+
242
+ | Requirement | Status | Blocking Issue |
243
+ |-------------|--------|----------------|
244
+ | CHAT-01: User can send message | ✗ BLOCKED | API POST is stub |
245
+ | CHAT-02: User can view messages | ✗ BLOCKED | Component is placeholder |
246
+ | CHAT-03: Messages persist | ✗ BLOCKED | No database integration |
247
+
248
+ **Coverage:** 0/3 requirements satisfied
249
+
250
+ ## Anti-Patterns Found
251
+
252
+ | File | Line | Pattern | Severity | Impact |
253
+ |------|------|---------|----------|--------|
254
+ | src/components/Chat.tsx | 8 | `<div>Chat will be here</div>` | 🛑 Blocker | No actual content |
255
+ | src/app/api/chat/route.ts | 5 | `return Response.json([])` | 🛑 Blocker | Hardcoded empty |
256
+ | src/app/api/chat/route.ts | 12 | `// TODO: save to database` | ⚠️ Warning | Incomplete |
257
+
258
+ **Anti-patterns:** 3 found (2 blockers, 1 warning)
259
+
260
+ ## Human Verification Required
261
+
262
+ None needed until automated gaps are fixed.
263
+
264
+ ## Gaps Summary
265
+
266
+ ### Critical Gaps (Block Progress)
267
+
268
+ 1. **Chat component is placeholder**
269
+ - Missing: Actual message list rendering
270
+ - Impact: Users see "Chat will be here" instead of messages
271
+ - Fix: Implement Chat.tsx to fetch and render messages
272
+
273
+ 2. **API routes are stubs**
274
+ - Missing: Database integration in GET and POST
275
+ - Impact: No data persistence, no real functionality
276
+ - Fix: Wire prisma calls in route handlers
277
+
278
+ 3. **No wiring between frontend and backend**
279
+ - Missing: fetch calls in components
280
+ - Impact: Even if API worked, UI wouldn't call it
281
+ - Fix: Add useEffect fetch in Chat, onSubmit fetch in ChatInput
282
+
283
+ ## Recommended Fix Plans
284
+
285
+ ### 03-04-PLAN.md: Implement Chat API
286
+
287
+ **Objective:** Wire API routes to database
288
+
289
+ **Tasks:**
290
+ 1. Implement GET /api/chat with prisma.message.findMany
291
+ 2. Implement POST /api/chat with prisma.message.create
292
+ 3. Verify: API returns real data, POST creates records
293
+
294
+ **Estimated scope:** Small
295
+
296
+ ---
297
+
298
+ ### 03-05-PLAN.md: Implement Chat UI
299
+
300
+ **Objective:** Wire Chat component to API
301
+
302
+ **Tasks:**
303
+ 1. Implement Chat.tsx with useEffect fetch and message rendering
304
+ 2. Wire ChatInput onSubmit to POST /api/chat
305
+ 3. Verify: Messages display, new messages appear after send
306
+
307
+ **Estimated scope:** Small
308
+
309
+ ---
310
+
311
+ ## Verification Metadata
312
+
313
+ **Verification approach:** Goal-backward (derived from phase goal)
314
+ **Must-haves source:** 03-01-PLAN.md frontmatter
315
+ **Automated checks:** 2 passed, 8 failed
316
+ **Human checks required:** 0 (blocked by automated failures)
317
+ **Total verification time:** 2 min
318
+
319
+ ---
320
+ *Verified: 2025-01-15T14:30:00Z*
321
+ *Verifier: Claude (subagent)*
322
+ ```
@@ -0,0 +1,42 @@
1
+ # Analyze Ticket Workflow
2
+
3
+ How to produce ANALYSIS.md from a ticket + codebase context.
4
+
5
+ ## Trigger
6
+
7
+ Called during Stage 2 (ANALYZE) of `/relay:work`.
8
+
9
+ ## Input
10
+
11
+ - Ticket data from external system (ID, title, description, type, priority, acceptance criteria)
12
+ - Codebase context from `.relay/codebase/` (if available)
13
+
14
+ ## Process
15
+
16
+ 1. **Parse ticket** — extract requirements, acceptance criteria, type
17
+ 2. **Explore codebase** — find related files, existing patterns, test structure
18
+ 3. **Map impact** — which files need changes, what tests need updates
19
+ 4. **Assess risks** — breaking changes, dependencies, performance
20
+ 5. **Propose approach** — high-level technical strategy
21
+ 6. **Surface questions** — ambiguities needing answers
22
+ 7. **Write ANALYSIS.md** — to `.relay/tickets/{TICKET_ID}/ANALYSIS.md`
23
+
24
+ ## Output
25
+
26
+ `ANALYSIS.md` in the ticket directory, consumed by `relay-planner` for plan creation.
27
+
28
+ ## Agent
29
+
30
+ Spawns `relay-ticket-researcher` agent which:
31
+ - Has full codebase access (Read, Grep, Glob, Bash)
32
+ - Can research via WebSearch/WebFetch/Context7
33
+ - Writes ANALYSIS.md directly to disk
34
+ - Returns structured result to orchestrator
35
+
36
+ ## Quality Criteria
37
+
38
+ - Acceptance criteria are explicit and verifiable
39
+ - Impact table references actual files in the codebase
40
+ - Technical approach follows existing codebase patterns
41
+ - Risks have concrete mitigations
42
+ - Questions are specific and actionable