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,249 @@
1
+ # Continuation Format
2
+
3
+ Standard format for presenting next steps after completing a command or workflow.
4
+
5
+ ## Core Structure
6
+
7
+ ```
8
+ ---
9
+
10
+ ## ▶ Next Up
11
+
12
+ **{identifier}: {name}** — {one-line description}
13
+
14
+ `{command to copy-paste}`
15
+
16
+ <sub>`/clear` first → fresh context window</sub>
17
+
18
+ ---
19
+
20
+ **Also available:**
21
+ - `{alternative option 1}` — description
22
+ - `{alternative option 2}` — description
23
+
24
+ ---
25
+ ```
26
+
27
+ ## Format Rules
28
+
29
+ 1. **Always show what it is** — name + description, never just a command path
30
+ 2. **Pull context from source** — ROADMAP.md for phases, PLAN.md `<objective>` for plans
31
+ 3. **Command in inline code** — backticks, easy to copy-paste, renders as clickable link
32
+ 4. **`/clear` explanation** — always include, keeps it concise but explains why
33
+ 5. **"Also available" not "Other options"** — sounds more app-like
34
+ 6. **Visual separators** — `---` above and below to make it stand out
35
+
36
+ ## Variants
37
+
38
+ ### Execute Next Plan
39
+
40
+ ```
41
+ ---
42
+
43
+ ## ▶ Next Up
44
+
45
+ **02-03: Refresh Token Rotation** — Add /api/auth/refresh with sliding expiry
46
+
47
+ `/relay:execute-phase 2`
48
+
49
+ <sub>`/clear` first → fresh context window</sub>
50
+
51
+ ---
52
+
53
+ **Also available:**
54
+ - Review plan before executing
55
+ - `/relay:list-phase-assumptions 2` — check assumptions
56
+
57
+ ---
58
+ ```
59
+
60
+ ### Execute Final Plan in Phase
61
+
62
+ Add note that this is the last plan and what comes after:
63
+
64
+ ```
65
+ ---
66
+
67
+ ## ▶ Next Up
68
+
69
+ **02-03: Refresh Token Rotation** — Add /api/auth/refresh with sliding expiry
70
+ <sub>Final plan in Phase 2</sub>
71
+
72
+ `/relay:execute-phase 2`
73
+
74
+ <sub>`/clear` first → fresh context window</sub>
75
+
76
+ ---
77
+
78
+ **After this completes:**
79
+ - Phase 2 → Phase 3 transition
80
+ - Next: **Phase 3: Core Features** — User dashboard and settings
81
+
82
+ ---
83
+ ```
84
+
85
+ ### Plan a Phase
86
+
87
+ ```
88
+ ---
89
+
90
+ ## ▶ Next Up
91
+
92
+ **Phase 2: Authentication** — JWT login flow with refresh tokens
93
+
94
+ `/relay:plan-phase 2`
95
+
96
+ <sub>`/clear` first → fresh context window</sub>
97
+
98
+ ---
99
+
100
+ **Also available:**
101
+ - `/relay:discuss-phase 2` — gather context first
102
+ - `/relay:research-phase 2` — investigate unknowns
103
+ - Review roadmap
104
+
105
+ ---
106
+ ```
107
+
108
+ ### Phase Complete, Ready for Next
109
+
110
+ Show completion status before next action:
111
+
112
+ ```
113
+ ---
114
+
115
+ ## ✓ Phase 2 Complete
116
+
117
+ 3/3 plans executed
118
+
119
+ ## ▶ Next Up
120
+
121
+ **Phase 3: Core Features** — User dashboard, settings, and data export
122
+
123
+ `/relay:plan-phase 3`
124
+
125
+ <sub>`/clear` first → fresh context window</sub>
126
+
127
+ ---
128
+
129
+ **Also available:**
130
+ - `/relay:discuss-phase 3` — gather context first
131
+ - `/relay:research-phase 3` — investigate unknowns
132
+ - Review what Phase 2 built
133
+
134
+ ---
135
+ ```
136
+
137
+ ### Multiple Equal Options
138
+
139
+ When there's no clear primary action:
140
+
141
+ ```
142
+ ---
143
+
144
+ ## ▶ Next Up
145
+
146
+ **Phase 3: Core Features** — User dashboard, settings, and data export
147
+
148
+ **To plan directly:** `/relay:plan-phase 3`
149
+
150
+ **To discuss context first:** `/relay:discuss-phase 3`
151
+
152
+ **To research unknowns:** `/relay:research-phase 3`
153
+
154
+ <sub>`/clear` first → fresh context window</sub>
155
+
156
+ ---
157
+ ```
158
+
159
+ ### Milestone Complete
160
+
161
+ ```
162
+ ---
163
+
164
+ ## 🎉 Milestone v1.0 Complete
165
+
166
+ All 4 phases shipped
167
+
168
+ ## ▶ Next Up
169
+
170
+ **Start v1.1** — questioning → research → requirements → roadmap
171
+
172
+ `/relay:new-milestone`
173
+
174
+ <sub>`/clear` first → fresh context window</sub>
175
+
176
+ ---
177
+ ```
178
+
179
+ ## Pulling Context
180
+
181
+ ### For phases (from ROADMAP.md):
182
+
183
+ ```markdown
184
+ ### Phase 2: Authentication
185
+ **Goal**: JWT login flow with refresh tokens
186
+ ```
187
+
188
+ Extract: `**Phase 2: Authentication** — JWT login flow with refresh tokens`
189
+
190
+ ### For plans (from ROADMAP.md):
191
+
192
+ ```markdown
193
+ Plans:
194
+ - [ ] 02-03: Add refresh token rotation
195
+ ```
196
+
197
+ Or from PLAN.md `<objective>`:
198
+
199
+ ```xml
200
+ <objective>
201
+ Add refresh token rotation with sliding expiry window.
202
+
203
+ Purpose: Extend session lifetime without compromising security.
204
+ </objective>
205
+ ```
206
+
207
+ Extract: `**02-03: Refresh Token Rotation** — Add /api/auth/refresh with sliding expiry`
208
+
209
+ ## Anti-Patterns
210
+
211
+ ### Don't: Command-only (no context)
212
+
213
+ ```
214
+ ## To Continue
215
+
216
+ Run `/clear`, then paste:
217
+ /relay:execute-phase 2
218
+ ```
219
+
220
+ User has no idea what 02-03 is about.
221
+
222
+ ### Don't: Missing /clear explanation
223
+
224
+ ```
225
+ `/relay:plan-phase 3`
226
+
227
+ Run /clear first.
228
+ ```
229
+
230
+ Doesn't explain why. User might skip it.
231
+
232
+ ### Don't: "Other options" language
233
+
234
+ ```
235
+ Other options:
236
+ - Review roadmap
237
+ ```
238
+
239
+ Sounds like an afterthought. Use "Also available:" instead.
240
+
241
+ ### Don't: Fenced code blocks for commands
242
+
243
+ ```
244
+ ```
245
+ /relay:plan-phase 3
246
+ ```
247
+ ```
248
+
249
+ Fenced blocks inside templates create nesting ambiguity. Use inline backticks instead.
@@ -0,0 +1,209 @@
1
+ <overview>
2
+ Git integration for Relay framework.
3
+ </overview>
4
+
5
+ <core_principle>
6
+
7
+ **Commit outcomes, not process.**
8
+
9
+ The git log should read like a changelog of what shipped, not a diary of planning activity.
10
+ </core_principle>
11
+
12
+ <commit_points>
13
+
14
+ | Event | Commit? | Why |
15
+ | ----------------------- | ------- | ------------------------------------------------ |
16
+ | ANALYSIS.md created | NO | Intermediate - analysis of ticket |
17
+ | PLAN.md created | NO | Intermediate - commit with plan completion |
18
+ | **Task completed** | YES | Atomic unit of work (1 commit per task) |
19
+ | **Ticket completed** | YES | Metadata commit (SUMMARY + STATE) |
20
+ | Handoff created | YES | WIP state preserved |
21
+
22
+ </commit_points>
23
+
24
+ <git_check>
25
+
26
+ ```bash
27
+ [ -d .git ] && echo "GIT_EXISTS" || echo "NO_GIT"
28
+ ```
29
+
30
+ If NO_GIT: Run `git init` silently.
31
+ </git_check>
32
+
33
+ <branching>
34
+
35
+ ## Ticket Branches
36
+
37
+ When branching is enabled, each ticket gets its own branch:
38
+
39
+ ```bash
40
+ # Branch template from config.git.ticket_branch_template
41
+ # Default: "{ticket_id}/{slug}"
42
+ # Example: PROJ-123/add-user-validation
43
+
44
+ SLUG=$(echo "${TITLE}" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-40)
45
+ BRANCH="${TICKET_ID}/${SLUG}"
46
+ git checkout -b "${BRANCH}"
47
+ ```
48
+
49
+ </branching>
50
+
51
+ <commit_formats>
52
+
53
+ <format name="task-completion">
54
+ ## Task Completion (During Plan Execution)
55
+
56
+ Each task gets its own commit immediately after completion. Include ticket ID in commit message.
57
+
58
+ ```
59
+ {type}({ticket_id}): {task-name}
60
+
61
+ - [Key change 1]
62
+ - [Key change 2]
63
+ - [Key change 3]
64
+ ```
65
+
66
+ **Commit types:**
67
+ - `feat` - New feature/functionality
68
+ - `fix` - Bug fix
69
+ - `test` - Test-only (TDD RED phase)
70
+ - `refactor` - Code cleanup (TDD REFACTOR phase)
71
+ - `perf` - Performance improvement
72
+ - `chore` - Dependencies, config, tooling
73
+
74
+ **Examples:**
75
+
76
+ ```bash
77
+ # Standard task
78
+ git add src/api/auth.ts src/types/user.ts
79
+ git commit -m "feat(PROJ-123): create user registration endpoint
80
+
81
+ - POST /auth/register validates email and password
82
+ - Checks for duplicate users
83
+ - Returns JWT token on success
84
+ "
85
+
86
+ # Bug fix task
87
+ git add src/utils/validation.ts
88
+ git commit -m "fix(BUG-456): prevent null pointer in email validation
89
+
90
+ - Added null check before regex match
91
+ - Returns early with error for empty input
92
+ "
93
+ ```
94
+
95
+ </format>
96
+
97
+ <format name="ticket-completion">
98
+ ## Ticket Completion (After All Tasks Done)
99
+
100
+ After all tasks committed, one final metadata commit captures ticket completion.
101
+
102
+ ```
103
+ docs({ticket_id}): complete {ticket-title}
104
+
105
+ Tasks completed: [N]/[N]
106
+ - [Task 1 name]
107
+ - [Task 2 name]
108
+ - [Task 3 name]
109
+
110
+ SUMMARY: .relay/tickets/{TICKET_ID}/SUMMARY.md
111
+ ```
112
+
113
+ What to commit:
114
+
115
+ ```bash
116
+ git add .relay/tickets/{TICKET_ID}/PLAN.md
117
+ git add .relay/tickets/{TICKET_ID}/SUMMARY.md
118
+ git add .relay/tickets/{TICKET_ID}/VERIFICATION.md
119
+ git add .relay/STATE.md
120
+ git commit
121
+ ```
122
+
123
+ **Note:** Code files NOT included - already committed per-task.
124
+
125
+ </format>
126
+
127
+ <format name="handoff">
128
+ ## Handoff (WIP)
129
+
130
+ ```
131
+ wip({ticket_id}): paused at task [X]/[Y]
132
+
133
+ Current: [task name]
134
+ [If blocked:] Blocked: [reason]
135
+ ```
136
+
137
+ What to commit:
138
+
139
+ ```bash
140
+ git add .relay/
141
+ git commit
142
+ ```
143
+
144
+ </format>
145
+ </commit_formats>
146
+
147
+ <example_log>
148
+
149
+ ```
150
+ # Ticket PROJ-125 - Checkout Flow
151
+ 1a2b3c docs(PROJ-125): complete checkout flow
152
+ 4d5e6f feat(PROJ-125): add webhook signature verification
153
+ 7g8h9i feat(PROJ-125): implement payment session creation
154
+ 0j1k2l feat(PROJ-125): create checkout page component
155
+
156
+ # Ticket PROJ-124 - Product Catalog
157
+ 3m4n5o docs(PROJ-124): complete product catalog
158
+ 6p7q8r feat(PROJ-124): add pagination controls
159
+ 9s0t1u feat(PROJ-124): implement search and filters
160
+
161
+ # Ticket BUG-200 - Login Validation
162
+ 5y6z7a fix(BUG-200): prevent crash on empty email input
163
+ ```
164
+
165
+ Each ticket produces 2-5 commits (tasks + metadata). Clear, granular, bisectable.
166
+
167
+ </example_log>
168
+
169
+ <anti_patterns>
170
+
171
+ **Still don't commit (intermediate artifacts):**
172
+ - ANALYSIS.md creation (intermediate)
173
+ - PLAN.md creation (commit with ticket completion)
174
+ - Minor planning tweaks
175
+
176
+ **Do commit (outcomes):**
177
+ - Each task completion (feat/fix/test/refactor)
178
+ - Ticket completion metadata (docs)
179
+ - Handoff state (wip)
180
+
181
+ **Key principle:** Commit working code and shipped outcomes, not planning process.
182
+
183
+ </anti_patterns>
184
+
185
+ <commit_strategy_rationale>
186
+
187
+ ## Why Per-Task Commits?
188
+
189
+ **Context engineering for AI:**
190
+ - Git history becomes primary context source for future Claude sessions
191
+ - `git log --grep="{ticket_id}"` shows all work for a ticket
192
+ - `git diff <hash>^..<hash>` shows exact changes per task
193
+ - Less reliance on parsing SUMMARY.md = more context for actual work
194
+
195
+ **Failure recovery:**
196
+ - Task 1 committed, Task 2 failed
197
+ - Claude in next session: sees task 1 complete, can retry task 2
198
+ - Can `git reset --hard` to last successful task
199
+
200
+ **Debugging:**
201
+ - `git bisect` finds exact failing task
202
+ - `git blame` traces line to specific task context
203
+ - Each commit is independently revertable
204
+
205
+ **Observability:**
206
+ - Ticket ID in every commit links back to external system
207
+ - Atomic commits are git best practice
208
+
209
+ </commit_strategy_rationale>
@@ -0,0 +1,57 @@
1
+ # Model Profiles
2
+
3
+ Model profiles control which Claude model each Relay agent uses. This allows balancing quality vs token spend.
4
+
5
+ ## Profile Definitions
6
+
7
+ | Agent | `quality` | `balanced` | `budget` |
8
+ |-------|-----------|------------|----------|
9
+ | relay-planner | opus | opus | sonnet |
10
+ | relay-ticket-researcher | opus | sonnet | haiku |
11
+ | relay-executor | opus | sonnet | sonnet |
12
+ | relay-debugger | opus | sonnet | sonnet |
13
+ | relay-codebase-mapper | sonnet | haiku | haiku |
14
+ | relay-verifier | sonnet | sonnet | haiku |
15
+ | relay-plan-checker | sonnet | sonnet | haiku |
16
+ | relay-estimator | opus | sonnet | sonnet |
17
+ | relay-reviewer | opus | sonnet | sonnet |
18
+
19
+ ## Profile Philosophy
20
+
21
+ **quality** - Maximum reasoning power
22
+ - Opus for all decision-making agents
23
+ - Sonnet for read-only verification
24
+ - Use when: quota available, critical architecture work
25
+
26
+ **balanced** (default) - Smart allocation
27
+ - Opus only for planning (where architecture decisions happen)
28
+ - Sonnet for execution and research (follows explicit instructions)
29
+ - Sonnet for verification (needs reasoning, not just pattern matching)
30
+ - Use when: normal development, good balance of quality and cost
31
+
32
+ **budget** - Minimal Opus usage
33
+ - Sonnet for anything that writes code
34
+ - Haiku for research and verification
35
+ - Use when: conserving quota, high-volume work, less critical tasks
36
+
37
+ ## Resolution Logic
38
+
39
+ Orchestrators resolve model before spawning:
40
+
41
+ ```
42
+ 1. Read .relay/config.json
43
+ 2. Get model_profile (default: "balanced")
44
+ 3. Look up agent in table above
45
+ 4. Pass model parameter to Task call
46
+ ```
47
+
48
+ ## Switching Profiles
49
+
50
+ Runtime: `/relay:set-profile <profile>`
51
+
52
+ Per-project default: Set in `.relay/config.json`:
53
+ ```json
54
+ {
55
+ "model_profile": "balanced"
56
+ }
57
+ ```
@@ -0,0 +1,189 @@
1
+ <planning_config>
2
+
3
+ Configuration options for `.relay/` directory behavior.
4
+
5
+ <config_schema>
6
+ ```json
7
+ "planning": {
8
+ "commit_docs": true,
9
+ "search_gitignored": false
10
+ },
11
+ "git": {
12
+ "branching_strategy": "none",
13
+ "phase_branch_template": "relay/phase-{phase}-{slug}",
14
+ "milestone_branch_template": "relay/{milestone}-{slug}"
15
+ }
16
+ ```
17
+
18
+ | Option | Default | Description |
19
+ |--------|---------|-------------|
20
+ | `commit_docs` | `true` | Whether to commit planning artifacts to git |
21
+ | `search_gitignored` | `false` | Add `--no-ignore` to broad rg searches |
22
+ | `git.branching_strategy` | `"none"` | Git branching approach: `"none"`, `"phase"`, or `"milestone"` |
23
+ | `git.phase_branch_template` | `"relay/phase-{phase}-{slug}"` | Branch template for phase strategy |
24
+ | `git.milestone_branch_template` | `"relay/{milestone}-{slug}"` | Branch template for milestone strategy |
25
+ </config_schema>
26
+
27
+ <commit_docs_behavior>
28
+
29
+ **When `commit_docs: true` (default):**
30
+ - Planning files committed normally
31
+ - SUMMARY.md, STATE.md, ROADMAP.md tracked in git
32
+ - Full history of planning decisions preserved
33
+
34
+ **When `commit_docs: false`:**
35
+ - Skip all `git add`/`git commit` for `.relay/` files
36
+ - User must add `.relay/` to `.gitignore`
37
+ - Useful for: OSS contributions, client projects, keeping planning private
38
+
39
+ **Checking the config:**
40
+
41
+ ```bash
42
+ # Check config.json first
43
+ COMMIT_DOCS=$(cat .relay/config.json 2>/dev/null | grep -o '"commit_docs"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
44
+
45
+ # Auto-detect gitignored (overrides config)
46
+ git check-ignore -q .relay 2>/dev/null && COMMIT_DOCS=false
47
+ ```
48
+
49
+ **Auto-detection:** If `.relay/` is gitignored, `commit_docs` is automatically `false` regardless of config.json. This prevents git errors when users have `.relay/` in `.gitignore`.
50
+
51
+ **Conditional git operations:**
52
+
53
+ ```bash
54
+ if [ "$COMMIT_DOCS" = "true" ]; then
55
+ git add .relay/STATE.md
56
+ git commit -m "docs: update state"
57
+ fi
58
+ ```
59
+
60
+ </commit_docs_behavior>
61
+
62
+ <search_behavior>
63
+
64
+ **When `search_gitignored: false` (default):**
65
+ - Standard rg behavior (respects .gitignore)
66
+ - Direct path searches work: `rg "pattern" .relay/` finds files
67
+ - Broad searches skip gitignored: `rg "pattern"` skips `.relay/`
68
+
69
+ **When `search_gitignored: true`:**
70
+ - Add `--no-ignore` to broad rg searches that should include `.relay/`
71
+ - Only needed when searching entire repo and expecting `.relay/` matches
72
+
73
+ **Note:** Most Relay operations use direct file reads or explicit paths, which work regardless of gitignore status.
74
+
75
+ </search_behavior>
76
+
77
+ <setup_uncommitted_mode>
78
+
79
+ To use uncommitted mode:
80
+
81
+ 1. **Set config:**
82
+ ```json
83
+ "planning": {
84
+ "commit_docs": false,
85
+ "search_gitignored": true
86
+ }
87
+ ```
88
+
89
+ 2. **Add to .gitignore:**
90
+ ```
91
+ .relay/
92
+ ```
93
+
94
+ 3. **Existing tracked files:** If `.relay/` was previously tracked:
95
+ ```bash
96
+ git rm -r --cached .relay/
97
+ git commit -m "chore: stop tracking planning docs"
98
+ ```
99
+
100
+ </setup_uncommitted_mode>
101
+
102
+ <branching_strategy_behavior>
103
+
104
+ **Branching Strategies:**
105
+
106
+ | Strategy | When branch created | Branch scope | Merge point |
107
+ |----------|---------------------|--------------|-------------|
108
+ | `none` | Never | N/A | N/A |
109
+ | `phase` | At `execute-phase` start | Single phase | User merges after phase |
110
+ | `milestone` | At first `execute-phase` of milestone | Entire milestone | At `complete-milestone` |
111
+
112
+ **When `git.branching_strategy: "none"` (default):**
113
+ - All work commits to current branch
114
+ - Standard Relay behavior
115
+
116
+ **When `git.branching_strategy: "phase"`:**
117
+ - `execute-phase` creates/switches to a branch before execution
118
+ - Branch name from `phase_branch_template` (e.g., `relay/phase-03-authentication`)
119
+ - All plan commits go to that branch
120
+ - User merges branches manually after phase completion
121
+ - `complete-milestone` offers to merge all phase branches
122
+
123
+ **When `git.branching_strategy: "milestone"`:**
124
+ - First `execute-phase` of milestone creates the milestone branch
125
+ - Branch name from `milestone_branch_template` (e.g., `relay/v1.0-mvp`)
126
+ - All phases in milestone commit to same branch
127
+ - `complete-milestone` offers to merge milestone branch to main
128
+
129
+ **Template variables:**
130
+
131
+ | Variable | Available in | Description |
132
+ |----------|--------------|-------------|
133
+ | `{phase}` | phase_branch_template | Zero-padded phase number (e.g., "03") |
134
+ | `{slug}` | Both | Lowercase, hyphenated name |
135
+ | `{milestone}` | milestone_branch_template | Milestone version (e.g., "v1.0") |
136
+
137
+ **Checking the config:**
138
+
139
+ ```bash
140
+ # Get branching strategy (default: none)
141
+ BRANCHING_STRATEGY=$(cat .relay/config.json 2>/dev/null | grep -o '"branching_strategy"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*:.*"\([^"]*\)"/\1/' || echo "none")
142
+
143
+ # Get phase branch template
144
+ PHASE_BRANCH_TEMPLATE=$(cat .relay/config.json 2>/dev/null | grep -o '"phase_branch_template"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*:.*"\([^"]*\)"/\1/' || echo "relay/phase-{phase}-{slug}")
145
+
146
+ # Get milestone branch template
147
+ MILESTONE_BRANCH_TEMPLATE=$(cat .relay/config.json 2>/dev/null | grep -o '"milestone_branch_template"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*:.*"\([^"]*\)"/\1/' || echo "relay/{milestone}-{slug}")
148
+ ```
149
+
150
+ **Branch creation:**
151
+
152
+ ```bash
153
+ # For phase strategy
154
+ if [ "$BRANCHING_STRATEGY" = "phase" ]; then
155
+ PHASE_SLUG=$(echo "$PHASE_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
156
+ BRANCH_NAME=$(echo "$PHASE_BRANCH_TEMPLATE" | sed "s/{phase}/$PADDED_PHASE/g" | sed "s/{slug}/$PHASE_SLUG/g")
157
+ git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
158
+ fi
159
+
160
+ # For milestone strategy
161
+ if [ "$BRANCHING_STRATEGY" = "milestone" ]; then
162
+ MILESTONE_SLUG=$(echo "$MILESTONE_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
163
+ BRANCH_NAME=$(echo "$MILESTONE_BRANCH_TEMPLATE" | sed "s/{milestone}/$MILESTONE_VERSION/g" | sed "s/{slug}/$MILESTONE_SLUG/g")
164
+ git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
165
+ fi
166
+ ```
167
+
168
+ **Merge options at complete-milestone:**
169
+
170
+ | Option | Git command | Result |
171
+ |--------|-------------|--------|
172
+ | Squash merge (recommended) | `git merge --squash` | Single clean commit per branch |
173
+ | Merge with history | `git merge --no-ff` | Preserves all individual commits |
174
+ | Delete without merging | `git branch -D` | Discard branch work |
175
+ | Keep branches | (none) | Manual handling later |
176
+
177
+ Squash merge is recommended — keeps main branch history clean while preserving the full development history in the branch (until deleted).
178
+
179
+ **Use cases:**
180
+
181
+ | Strategy | Best for |
182
+ |----------|----------|
183
+ | `none` | Solo development, simple projects |
184
+ | `phase` | Code review per phase, granular rollback, team collaboration |
185
+ | `milestone` | Release branches, staging environments, PR per version |
186
+
187
+ </branching_strategy_behavior>
188
+
189
+ </planning_config>