5-phase-workflow 1.9.1 → 1.9.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5-phase-workflow",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "A 5-phase feature development workflow for Claude Code",
5
5
  "bin": {
6
6
  "5-phase-workflow": "bin/install.js"
@@ -163,44 +163,92 @@ Task tool call:
163
163
 
164
164
  For duplicates, note which local finding covers it.
165
165
 
166
+ For every actionable_fix and manual comment, also provide:
167
+ - **recommendation**: one of `address`, `defer`, `decline`, or `discuss`
168
+ - `address` — should be fixed now, clear and reasonable
169
+ - `defer` — valid concern but low urgency, can wait
170
+ - `decline` — out of scope or disagree with the suggestion
171
+ - `discuss` — needs more context before deciding
172
+ - **reasoning**: one plain-English sentence explaining the recommendation
173
+
166
174
  ## Output Format
167
175
  Return a structured list:
168
176
 
169
177
  ---PR-COMMENTS---
170
- {id} | {file}:{line} | {category} | {description} | {duplicate_of or "none"}
178
+ {id} | {file}:{line} | {category} | {description} | {duplicate_of or "none"} | {recommendation or "n/a"} | {one-sentence reasoning or "n/a"}
171
179
  ---END-PR-COMMENTS---
172
180
 
173
181
  Rules:
174
182
  - DO NOT apply fixes
175
183
  - DO NOT interact with user
176
184
  - Include every comment in the output
185
+ - recommendation and reasoning are required for actionable_fix and manual; use "n/a" for skip and duplicate
177
186
  ```
178
187
 
179
- Parse the `---PR-COMMENTS---` block. Collect:
180
- - `pr_to_fix` — actionable_fix items
181
- - `pr_duplicates` — duplicate items
182
- - `pr_manual` — manual items
188
+ Parse the `---PR-COMMENTS---` block. For each line extract all seven fields. Build:
189
+ - `pr_actionable` — actionable_fix items (with recommendation + reasoning)
190
+ - `pr_manual` — manual items (with recommendation + reasoning)
191
+ - `pr_duplicates` — duplicate items (auto-assign `decision: wont_fix`, no Q&A)
192
+ - `pr_skip` — skip items (auto-assign `decision: wont_fix`, no Q&A)
193
+
194
+ Initialize `pr_decisions` as an empty list. Append all `pr_duplicates` and `pr_skip` entries with `decision: wont_fix` and `user_note: ""`.
183
195
 
184
- **Present PR comment summary to user:**
196
+ **Display count summary:**
185
197
  ```
186
- PR Review Comments:
187
- - Actionable (new): {N}
188
- - Duplicates (covered by local findings): {N}
189
- - Manual/Discussion: {N}
190
- - Skipped (bot/resolved): {N}
198
+ PR Review Comments found:
199
+ - Actionable (new): {N}
200
+ - Manual/Discussion: {N}
201
+ - Duplicates (covered by local): {N}
202
+ - Skipped (bot/resolved): {N}
191
203
 
192
- Actionable PR comments:
193
- {#} {file}:{line} — {description}
204
+ You will now be asked to decide on each actionable and manual comment individually.
205
+ ```
194
206
 
195
- Manual PR comments:
196
- {#} {file}:{line} — {description}
207
+ If there are no `pr_actionable` and no `pr_manual` items, display `"No actionable or manual PR comments to review."` and skip the loop below.
208
+
209
+ **Per-comment decision loop** — iterate over all items in `pr_actionable + pr_manual` in order, using a counter `i` from 1 to total:
210
+
211
+ For each comment:
212
+
213
+ 1. Display:
214
+ ```
215
+ ── PR Comment {i} of {total} ──────────────────────────
216
+ Category: {category}
217
+ File: {file}:{line}
218
+ Comment: {description}
219
+
220
+ Recommendation: {recommendation} — {reasoning}
221
+ ──────────────────────────────────────────────────────
222
+ ```
223
+
224
+ 2. Ask via AskUserQuestion:
225
+ - Question: `"[{i}/{total}] {file}:{line} — How do you want to handle this comment?"`
226
+ - Options: `"fix — apply the suggested change"` / `"won't fix — decline"` / `"wait — defer for later"`
227
+
228
+ 3. Record the decision (map to internal values: `fix`, `wont_fix`, `wait`).
229
+
230
+ 4. Ask via AskUserQuestion:
231
+ - Question: `"Add a note for this comment? (shown in PR reply and summary report)"`
232
+ - Options: `"No note"` / `"Add a note"`
233
+ - If "Add a note": ask via AskUserQuestion with free-text input (no fixed options):
234
+ - Question: `"Enter your note for: {file}:{line}"`
235
+
236
+ 5. Append to `pr_decisions`:
237
+ ```
238
+ { comment_id, file_line, category, description, decision, user_note (or ""), recommendation, reasoning }
239
+ ```
240
+
241
+ After the loop, display:
197
242
  ```
243
+ Decision summary:
244
+ - fix: {N} comments
245
+ - won't fix: {N} comments
246
+ - wait: {N} comments
198
247
 
199
- Ask via AskUserQuestion for each actionable PR comment batch:
200
- - "Apply actionable PR fixes?" Options: "All" / "None" / "Let me choose"
201
- - If "Let me choose": present each one and ask Fix / Skip per item.
248
+ Proceeding to apply fixes...
249
+ ```
202
250
 
203
- Collect final `pr_approved_fixes` list.
251
+ Derive `pr_approved_fixes` as the subset of `pr_decisions` where `decision == fix`. This list is used by Step 5.
204
252
 
205
253
  ### Step 5: Apply Fixes
206
254
 
@@ -265,9 +313,7 @@ For each `[MANUAL]` item with custom instructions:
265
313
 
266
314
  ### Step 6: Reply to GitHub PR Comments
267
315
 
268
- For each PR comment that was processed (from `pr_approved_fixes`, `pr_duplicates`, and `pr_manual`):
269
-
270
- Post a reply using the GitHub API:
316
+ Iterate over every entry in `pr_decisions` (excluding entries with category `skip` — do not reply to those). For each entry, post a reply using the GitHub API.
271
317
 
272
318
  **For review comments (inline):**
273
319
  ```bash
@@ -283,12 +329,22 @@ gh api repos/{owner}/{repo}/issues/{number}/comments \
283
329
  --field body="{reply text}"
284
330
  ```
285
331
 
286
- Reply templates:
287
- - **Fixed:** `Applied fix: {description}. Will be included in the next push.`
288
- - **Skipped:** `Reviewed not addressing: {reason if known, else "will handle separately"}`
289
- - **Duplicate (applied):** `Covered by local review findings fix applied.`
290
- - **Duplicate (skipped):** `Covered by local review findings marked as skip.`
291
- - **Manual/Discussion:** `Noted. This requires manual review: {description}`
332
+ **Template selection logic:**
333
+
334
+ 1. If `category == "duplicate"`: use the auto-duplicate template below
335
+ 2. Else if `decision == "fix"`: use fix template, with or without note based on `user_note` presence
336
+ 3. Else if `decision == "wont_fix"`: use wont_fix template, with or without note based on `user_note` presence
337
+ 4. Else if `decision == "wait"`: use wait template, with or without note based on `user_note` presence
338
+
339
+ **Templates:**
340
+
341
+ - **`fix` (with user note):** `Applied fix: {description}. Will be included in the next push. Note: {user_note}`
342
+ - **`fix` (no note):** `Applied fix: {description}. Will be included in the next push.`
343
+ - **`wont_fix` (with user note):** `Reviewed — not addressing: {user_note}`
344
+ - **`wont_fix` (no note):** `Reviewed — not addressing: will handle separately`
345
+ - **`wait` (with user note):** `Noted for later: {user_note}`
346
+ - **`wait` (no note):** `Noted for later: deferring for now`
347
+ - **`wont_fix` (auto, duplicate):** `Covered by local review findings — {local_decision}` where `{local_decision}` is `"fix applied"` if the matched local finding has action `[FIX]`, otherwise `"marked as skipped"` or `"flagged for manual review"` accordingly
292
348
 
293
349
  If `gh api` is unavailable or fails, log the failure and continue. Do NOT abort for reply failures.
294
350
 
@@ -317,15 +373,16 @@ Use the template structure from `.claude/templates/workflow/REVIEW-SUMMARY.md`.
317
373
 
318
374
  **Reviewed:** {feature} — findings from {findings-filename}
319
375
  **Timestamp:** {ISO-timestamp}
320
- **User Decisions:** Applied {N} fixes, skipped {N}, {N} manual
376
+ **User Decisions:** Applied {N} fixes, declined {N}, deferred {N}
321
377
 
322
378
  ## Summary
323
379
 
324
380
  - **Local Fixes Applied:** {N}
325
381
  - **Local Fixes Skipped:** {N}
326
382
  - **Manual Items Applied:** {N}
327
- - **PR Comments Fixed:** {N}
328
- - **PR Comments Skipped:** {N}
383
+ - **PR Comments Fixed:** {N} (decision = fix)
384
+ - **PR Comments Deferred:** {N} (decision = wait)
385
+ - **PR Comments Declined:** {N} (decision = won't fix, excluding auto)
329
386
  - **Build:** {passed/failed}
330
387
  - **Tests:** {passed/failed}
331
388
 
@@ -338,6 +395,12 @@ Use the template structure from `.claude/templates/workflow/REVIEW-SUMMARY.md`.
338
395
  ## Manual Items
339
396
  ...
340
397
 
398
+ ## PR Comment Decisions
399
+
400
+ | # | File:Line | Description | Decision | Note |
401
+ |---|-----------|-------------|----------|------|
402
+ | {i} | {file}:{line} | {description} | {fix/won't fix/wait} | {user_note or "—"} |
403
+
341
404
  ## PR Comment Replies
342
405
  ...
343
406
  ```
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: 5:analyze-feature
3
+ description: Analyze any feature, dataflow, or domain concept in the codebase and generate comprehensive documentation with mermaid diagrams. Use when you need to understand how a feature works end-to-end, trace a dataflow, or document a domain area.
4
+ allowed-tools: Read, Write, Glob, Grep, Task, AskUserQuestion
5
+ user-invocable: true
6
+ ---
7
+
8
+ <role>
9
+ You are a Codebase Analyst. Your job is to analyze features, dataflows, and domain concepts in this codebase and produce comprehensive documentation with mermaid diagrams.
10
+ You do NOT write code. You do NOT refactor. You only read, analyze, and document.
11
+ </role>
12
+
13
+ # Analyze Feature
14
+
15
+ Generate comprehensive documentation for any feature, dataflow, or domain concept by analyzing the codebase.
16
+
17
+ ## Arguments
18
+
19
+ - `$ARGUMENTS`: Description of what to analyze (e.g., "user authentication flow", "how orders get processed", "payment integration")
20
+
21
+ ## Step 0: Validate Input
22
+
23
+ If `$ARGUMENTS` is empty, vague, or ambiguous (e.g., "analyze this", "the thing", or a single word without clear context), use AskUserQuestion to clarify:
24
+ - What specific feature, dataflow, or domain concept should be analyzed?
25
+ - Optionally: which modules or layers are most relevant?
26
+
27
+ Do NOT proceed until you have a clear understanding of what to analyze.
28
+
29
+ ## Step 1: Determine Scope and Output Name
30
+
31
+ 1. Derive a short kebab-case name from the analysis subject (e.g., `user-auth`, `order-processing`, `payment-integration`). This becomes the filename: `{name}-analysis.md`.
32
+
33
+ 2. Identify the relevant modules and layers to analyze. If `.5/index/` exists, read the index files for a quick structural overview. Otherwise, use Glob to understand the project layout.
34
+
35
+ 3. Use Glob and Grep to locate the relevant source files. Search for key classes, interfaces, functions, and types related to the analysis subject.
36
+
37
+ ## Step 2: Analyze the Codebase
38
+
39
+ Spawn Explore agents (one or more in parallel depending on scope) to thoroughly read all relevant files. Tailor the agents to the analysis subject:
40
+
41
+ ### For Domain/Feature Analysis
42
+
43
+ Read across the relevant layers following the project's dependency flow (e.g., models -> services -> controllers -> routes, or entities -> repositories -> handlers -> endpoints). Identify the layer structure from the codebase scan.
44
+
45
+ ### For Dataflow Analysis
46
+
47
+ Trace the data path through all involved components. Follow inputs from entry points (API endpoints, event handlers, CLI commands) through processing layers to outputs (database writes, API responses, events published).
48
+
49
+ ### For Cross-Cutting Analysis
50
+
51
+ Examine shared concerns as relevant: validation, authentication, error handling, logging, caching, event publishing.
52
+
53
+ Request structured output from each agent covering the entities, flows, relationships, and patterns found.
54
+
55
+ ## Step 3: Generate Documentation
56
+
57
+ Using the analysis results, create a comprehensive markdown document.
58
+
59
+ **The document MUST follow this structure** (omit sections that don't apply to the analysis subject):
60
+
61
+ ```markdown
62
+ # {Analysis Title}
63
+
64
+ {1-3 sentence summary of what this feature/dataflow does and why it exists}
65
+
66
+ ---
67
+
68
+ ## Table of Contents
69
+ {auto-generated links to sections below}
70
+
71
+ ---
72
+
73
+ ## Overview
74
+ {High-level description of the feature/concept, its purpose, and where it fits in the system}
75
+ {Mention the involved modules and their roles}
76
+
77
+ ---
78
+
79
+ ## Data Flow
80
+ {For each major operation, create a mermaid sequence diagram}
81
+ {Show the path from entry point through processing layers to output}
82
+ {Include relevant function/method names and payload types}
83
+
84
+ ---
85
+
86
+ ## Domain Model
87
+ {mermaid classDiagram or erDiagram showing entities and their relationships}
88
+ {Include: key fields, types, relationships with cardinality}
89
+ {Show: value objects, enums, and aggregate boundaries where relevant}
90
+
91
+ ---
92
+
93
+ ## Operations
94
+
95
+ ### Writes (Commands/Mutations)
96
+ {Table: Operation | Handler/Service | Description | Key Validation}
97
+
98
+ ### Reads (Queries)
99
+ {Table: Query | Handler/Service | Description | Return Type}
100
+
101
+ ---
102
+
103
+ ## API / Entry Points
104
+ {Table: Method | Path/Topic/Command | Handler | Description}
105
+
106
+ ---
107
+
108
+ ## Event Flow
109
+ {If async events are involved (Kafka, RabbitMQ, webhooks, etc.)}
110
+ {mermaid sequence diagram showing event production/consumption}
111
+ {Include: event names, topics, consumer handlers}
112
+
113
+ ---
114
+
115
+ ## Module Dependencies
116
+ {mermaid graph showing which modules depend on which}
117
+ {Use subgraphs to group by domain or layer}
118
+
119
+ ---
120
+
121
+ ## Key Implementation Details
122
+ {Notable patterns, edge cases, business rules worth highlighting}
123
+ {Reference specific classes/functions and file paths}
124
+ ```
125
+
126
+ ### Mermaid Diagram Guidelines
127
+
128
+ - **Sequence diagrams** (`sequenceDiagram`): For request/response flows across layers
129
+ - **Class diagrams** (`classDiagram`): For domain model relationships and aggregate structure
130
+ - **ER diagrams** (`erDiagram`): For persistence model relationships
131
+ - **Flowcharts** (`flowchart TD`): For decision trees, validation flows, state machines
132
+ - **Graph diagrams** (`graph LR` or `graph TD`): For module dependencies, component trees
133
+ - Keep node labels short but descriptive
134
+ - Use subgraphs to group related nodes by module or layer
135
+ - Use dotted lines (`-.->`) for optional/indirect relationships
136
+
137
+ ## Step 4: Write File
138
+
139
+ 1. Write the documentation using the Write tool to `.5/analysis/{name}-analysis.md`.
140
+
141
+ 2. Report to the user:
142
+ ```
143
+ Analysis saved to .5/analysis/{name}-analysis.md
144
+
145
+ Sections included:
146
+ - {list of sections that were generated}
147
+ - {N} mermaid diagrams
148
+
149
+ Modules analyzed: {list of modules examined}
150
+ ```
151
+
152
+ ## Important Notes
153
+
154
+ - Read ALL relevant files thoroughly before writing -- do not guess or assume
155
+ - Every mermaid diagram must be syntactically valid
156
+ - Reference specific class/function names and file paths so the reader can navigate to the source
157
+ - Focus on the specific feature/dataflow requested, not the entire codebase
158
+ - Follow the data through all layers from entry point to output
159
+ - Document both the happy path and notable error/validation paths
@@ -14,20 +14,22 @@ After creating the spec, you are FINISHED. You do not continue. You do not offer
14
14
  </role>
15
15
 
16
16
  <constraints>
17
- HARD CONSTRAINTS — violations waste tokens and get blocked by plan-guard:
18
- - NEVER write code, pseudo-code, or implementation snippets in any output
19
- - NEVER describe HOW something will be implemented (file contents, signatures, class structures)
20
- - NEVER create an implementation plan, file list, component breakdown, or step-by-step build guide that is Phase 2's job
21
- - NEVER suggest "shall I continue with implementation planning?" or "let me create the plan" — you are DONE after feature.md
22
- - NEVER offer to proceed to the next phase the user will invoke `/5:plan-implementation` themselves
23
- - NEVER spawn Task agents with subagent_type other than Explore
24
- - NEVER write to any file except .5/.planning-active, .5/features/{name}/codebase-scan.md, and .5/features/{name}/feature.md
25
- - NEVER call EnterPlanMode the workflow has its own planning process
26
- - NEVER use Bash to create, write, or modify files — this bypasses the plan-guard and is a constraint violation
27
- - NEVER continue past the completion message — when you output "Feature spec created at...", you are FINISHED
28
- - The feature spec describes WHAT and WHY, never HOW
29
- - If you feel the urge to plan implementation or write code, STOP — ask a clarifying question instead
30
- - Your output is a SPECIFICATION, not a design document. No code. No file layouts. No API shapes. No implementation plans.
17
+ HARD CONSTRAINTS:
18
+ - Do NOT write code or pseudo-code describe behavior and data shapes in natural language or tables
19
+ - Do NOT create implementation plans, file lists, or step-by-step build guides — that is Phase 2's job
20
+ - Do NOT offer to proceed to the next phase the user will invoke `/5:plan-implementation` themselves
21
+ - Do NOT spawn Task agents with subagent_type other than Explore
22
+ - Do NOT write to any file except .5/.planning-active, .5/features/{name}/codebase-scan.md, and .5/features/{name}/feature.md
23
+ - Do NOT call EnterPlanMode the workflow has its own planning process
24
+ - Do NOT use Bash to create, write, or modify files — this bypasses the plan-guard
25
+ - Do NOT continue past the completion message when you output "Feature spec created at...", you are FINISHED
26
+
27
+ WHAT IS ALLOWED:
28
+ - Name existing classes, modules, services, and patterns
29
+ - Describe entity fields with domain types
30
+ - Reference existing patterns as models
31
+ - Mention affected methods or APIs by name
32
+ - Include data shape tables with field names and types — these are part of the requirement
31
33
  </constraints>
32
34
 
33
35
  <write-rules>
@@ -42,11 +44,10 @@ Any other Write target WILL be blocked by the plan-guard hook. Do not attempt it
42
44
  Use the template structure from `.claude/templates/workflow/FEATURE-SPEC.md`.
43
45
 
44
46
  **Content rules for feature.md:**
45
- - Requirements use natural language ("The system shall..."), NOT code
46
- - Affected Components lists module/domain names, NOT file paths
47
- - NO code snippets, NO pseudo-code, NO type definitions
48
- - Entity definitions describe data CONCEPTS, not DB schemas or TypeScript interfaces
49
- - Acceptance criteria describe observable behavior, NOT test code
47
+ - Write naturally reference existing classes, modules, and patterns by name for precision
48
+ - Entity definitions include field names and domain types — these define the requirement
49
+ - Acceptance criteria describe observable behavior
50
+ - No code blocks, no pseudo-code, no class hierarchy designs
50
51
  </output-format>
51
52
 
52
53
  <collaboration-strategy>
@@ -193,7 +194,7 @@ Targeted exploration for feature planning.
193
194
 
194
195
  ### Step 4: Create Feature Specification
195
196
 
196
- > **ROLE CHECK:** You are writing a SPECIFICATION (WHAT/WHY), not a design document (HOW). Zero code, zero file paths to create, zero signatures. After writing feature.md you are DONE — do NOT proceed to implementation planning or coding.
197
+ > **ROLE CHECK:** You are writing a FEATURE SPECIFICATION. After writing feature.md you are DONE — do NOT proceed to implementation planning or coding.
197
198
 
198
199
  **Extract ticket ID from git branch:**
199
200
  - The Explore agent from Step 2 already ran `git branch --show-current` — find the branch name in its results
@@ -209,25 +210,14 @@ Write to `.5/features/{name}/feature.md` using Write tool, where `{name}` is eit
209
210
 
210
211
  Use the template structure from `.claude/templates/workflow/FEATURE-SPEC.md`.
211
212
 
212
- Populate all sections:
213
- - Ticket ID & Summary
214
- - Problem Statement
215
- - Visual Overview (optional mermaid diagramssee below)
216
- - Requirements (functional and non-functional)
217
- - Constraints
218
- - Affected Components (from exploration)
219
- - Acceptance Criteria
220
- - Alternatives Considered
221
- - Decisions (from the conversation) — label each with **[DECIDED]**, **[FLEXIBLE]**, or **[DEFERRED]**
222
-
223
- **Visual Overview (optional mermaid diagrams):**
224
- Include mermaid diagrams in the spec when they add clarity. Use your judgment:
225
- - **Flow diagrams**: When the feature involves a multi-step process or state transitions
226
- - **Entity relationship diagrams**: When new data concepts relate to existing ones
227
- - **Component interaction diagrams**: When multiple modules/services communicate
228
- - **Sequence diagrams**: When the order of operations between actors matters
229
-
230
- Simple features (single-component changes, straightforward CRUD) typically do not need diagrams. Do not add diagrams for the sake of having them. Diagrams describe WHAT happens, not HOW it is implemented. No class diagrams, no file-level architecture diagrams, no code-level sequence diagrams.
213
+ Populate the sections from the template. Key guidance:
214
+ - **Overview**: Write a short narrative (3-5 sentences) merging the problem and the solution
215
+ - **What Changes**: Group by logical concern, not by module layer. Name existing classes and patterns. Use entity tables where new data models are introduced
216
+ - **Existing Patterns to Follow**: Be specific these are the highest-value pointers for Phase 2
217
+ - **Scope**: Be explicit about what's in and what's out
218
+ - **Decisions**: Label each from the conversation
219
+ - **Diagrams**: Include only when they add clarity. Simple features don't need them
220
+ - **Alternatives**: Only include if genuinely discussed and the reasoning matters. Delete if empty
231
221
 
232
222
  **Decision labeling rules:**
233
223
  - **[DECIDED]**: The user gave a clear, specific answer → Phase 2 planner and Phase 3 agents MUST honor exactly
@@ -110,11 +110,11 @@ This activates (or refreshes) the plan-guard hook which prevents accidental sour
110
110
 
111
111
  ### Step 1: Load Feature Spec *(skip if live context)*
112
112
 
113
- **If live context:** You already have the feature spec discussion in your conversation history. Extract ticket ID, requirements, acceptance criteria, affected components, and decisions from what was discussed. Output `✓ Step 1 skipped (live context)` and proceed to Step 1b.
113
+ **If live context:** You already have the feature spec discussion in your conversation history. Extract ticket ID, what changes (by logical concern), acceptance criteria, existing patterns to follow, scope, and decisions from what was discussed. Output `✓ Step 1 skipped (live context)` and proceed to Step 1b.
114
114
 
115
115
  **If no live context:** Read `.5/features/{feature-name}/feature.md` (where `{feature-name}` is the argument provided).
116
116
 
117
- Extract: Ticket ID, requirements (functional and non-functional), acceptance criteria, affected components, and **decisions**.
117
+ Extract: Ticket ID, overview, what changes (each logical concern), existing patterns to follow, constraints, scope, acceptance criteria, and **decisions**.
118
118
 
119
119
  **Decision labels from feature spec:**
120
120
  - **[DECIDED]** items are locked — your plan MUST honor them exactly. Do not override or reinterpret.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: 5:synchronize-agents
3
+ description: Synchronize user-generated skills, rules, and custom content between Claude Code and Codex runtimes
4
+ allowed-tools: Bash, Read, AskUserQuestion
5
+ user-invocable: true
6
+ model: haiku
7
+ context: fork
8
+ ---
9
+
10
+ <role>
11
+ You are a Runtime Synchronizer. You run the sync script and report results.
12
+ You do NOT modify files manually. After reporting, you are DONE.
13
+ </role>
14
+
15
+ # Synchronize Agent Runtimes
16
+
17
+ Synchronizes user-generated content (skills, commands, agents, rules) between the Claude Code (`.claude/`) and Codex (`.codex/`) runtimes.
18
+
19
+ ## Step 1: Locate the Sync Script
20
+
21
+ The script is `bin/sync-agents.js` in the workflow package. Find it by checking these paths in order:
22
+
23
+ 1. `./bin/sync-agents.js` (development checkout / project root)
24
+ 2. `./node_modules/5-phase-workflow/bin/sync-agents.js` (local npm install)
25
+
26
+ Read `.5/version.json` if available — its location confirms the project root.
27
+
28
+ Store the resolved path for the following steps.
29
+
30
+ If the script cannot be found, tell the user: "Sync script not found. Update the workflow first: `npx 5-phase-workflow --upgrade`" and **stop**.
31
+
32
+ ## Step 2: Dry Run
33
+
34
+ Run the script in dry-run mode to preview what will be synced:
35
+
36
+ ```bash
37
+ node {script-path} --dry-run
38
+ ```
39
+
40
+ If the script exits with a non-zero code (missing runtime, no content), show the output and **stop**.
41
+
42
+ If there are no actionable changes (everything in sync), report that and **stop**.
43
+
44
+ ## Step 3: Confirm with User
45
+
46
+ Show the dry-run output. Ask: "Proceed with synchronization?"
47
+
48
+ If the user declines, stop.
49
+
50
+ ## Step 4: Execute Sync
51
+
52
+ ```bash
53
+ node {script-path}
54
+ ```
55
+
56
+ ## Step 5: Report
57
+
58
+ Show the script output. Summarize what was synced.
59
+
60
+ Note: This command works identically from both Claude Code (`/5:synchronize-agents`) and Codex (`$5-synchronize-agents`). The script auto-detects the project root.