forge-workflow 0.0.3 → 0.0.4

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 (83) hide show
  1. package/.claude/commands/dev.md +26 -0
  2. package/.claude/commands/plan.md +48 -5
  3. package/.claude/commands/premerge.md +0 -3
  4. package/.claude/commands/rollback.md +4 -4
  5. package/.claude/commands/ship.md +71 -41
  6. package/.claude/commands/status.md +9 -38
  7. package/.claude/commands/validate.md +47 -2
  8. package/.cline/workflows/dev.md +26 -0
  9. package/.cline/workflows/plan.md +48 -5
  10. package/.cline/workflows/premerge.md +0 -3
  11. package/.cline/workflows/rollback.md +4 -4
  12. package/.cline/workflows/ship.md +71 -41
  13. package/.cline/workflows/status.md +9 -38
  14. package/.cline/workflows/validate.md +47 -2
  15. package/.codex/skills/dev/SKILL.md +26 -0
  16. package/.codex/skills/plan/SKILL.md +48 -5
  17. package/.codex/skills/premerge/SKILL.md +0 -3
  18. package/.codex/skills/rollback/SKILL.md +4 -4
  19. package/.codex/skills/ship/SKILL.md +71 -41
  20. package/.codex/skills/status/SKILL.md +9 -38
  21. package/.codex/skills/validate/SKILL.md +47 -2
  22. package/.cursor/commands/dev.md +26 -0
  23. package/.cursor/commands/plan.md +48 -5
  24. package/.cursor/commands/premerge.md +0 -3
  25. package/.cursor/commands/rollback.md +4 -4
  26. package/.cursor/commands/ship.md +71 -41
  27. package/.cursor/commands/status.md +9 -38
  28. package/.cursor/commands/validate.md +47 -2
  29. package/.cursor/hooks/state/continual-learning-index.json +19 -0
  30. package/.cursor/hooks/state/continual-learning.json +8 -0
  31. package/.github/prompts/dev.prompt.md +26 -0
  32. package/.github/prompts/plan.prompt.md +48 -5
  33. package/.github/prompts/premerge.prompt.md +0 -3
  34. package/.github/prompts/rollback.prompt.md +4 -4
  35. package/.github/prompts/ship.prompt.md +71 -41
  36. package/.github/prompts/status.prompt.md +9 -38
  37. package/.github/prompts/validate.prompt.md +47 -2
  38. package/.kilocode/workflows/dev.md +26 -0
  39. package/.kilocode/workflows/plan.md +48 -5
  40. package/.kilocode/workflows/premerge.md +0 -3
  41. package/.kilocode/workflows/rollback.md +4 -4
  42. package/.kilocode/workflows/ship.md +71 -41
  43. package/.kilocode/workflows/status.md +9 -38
  44. package/.kilocode/workflows/validate.md +47 -2
  45. package/.opencode/commands/dev.md +26 -0
  46. package/.opencode/commands/plan.md +48 -5
  47. package/.opencode/commands/premerge.md +0 -3
  48. package/.opencode/commands/rollback.md +4 -4
  49. package/.opencode/commands/ship.md +71 -41
  50. package/.opencode/commands/status.md +9 -38
  51. package/.opencode/commands/validate.md +47 -2
  52. package/.roo/commands/dev.md +26 -0
  53. package/.roo/commands/plan.md +48 -5
  54. package/.roo/commands/premerge.md +0 -3
  55. package/.roo/commands/rollback.md +4 -4
  56. package/.roo/commands/ship.md +71 -41
  57. package/.roo/commands/status.md +9 -38
  58. package/.roo/commands/validate.md +47 -2
  59. package/AGENTS.md +7 -1
  60. package/CLAUDE.md +5 -4
  61. package/LICENSE +21 -21
  62. package/README.md +21 -19
  63. package/bin/{forge-validate.js → forge-preflight.js} +21 -15
  64. package/bin/forge.js +209 -138
  65. package/docs/AGENT_INSTALL_PROMPT.md +1 -1
  66. package/docs/BEADS_GITHUB_SYNC.md +251 -0
  67. package/docs/ENHANCED_ONBOARDING.md +6 -6
  68. package/docs/EXAMPLES.md +4 -4
  69. package/docs/GREPTILE_SETUP.md +1 -1
  70. package/docs/MANUAL_REVIEW_GUIDE.md +1 -1
  71. package/docs/ROADMAP.md +6 -6
  72. package/docs/SETUP.md +1 -2
  73. package/docs/VALIDATION.md +11 -11
  74. package/install.sh +1 -3
  75. package/lib/agents-config.js +3 -3
  76. package/lib/detect-agent.js +191 -0
  77. package/lib/detect-worktree.js +47 -0
  78. package/lib/file-hash.js +26 -0
  79. package/lib/setup-action-log.js +139 -0
  80. package/lib/setup-summary-renderer.js +106 -0
  81. package/lib/setup.js +75 -1
  82. package/package.json +3 -4
  83. package/docs/WORKFLOW.md +0 -400
@@ -25,7 +25,13 @@ Before ANY planning work begins:
25
25
  a. bd worktree create .worktrees/<slug> --branch feat/<slug>
26
26
  b. cd .worktrees/<slug>
27
27
  4. Confirm: "Working in isolated worktree: .worktrees/<slug> (branch: feat/<slug>)"
28
- 5. ONLY THEN begin Phase 1.
28
+ 5. Create the epic issue and record the stage transition:
29
+ ```bash
30
+ bd create --title="<feature-name>" --type=epic
31
+ bd update <id> --status=in_progress
32
+ bash scripts/beads-context.sh stage-transition <id> none plan
33
+ ```
34
+ 6. ONLY THEN begin Phase 1.
29
35
 
30
36
  Rationale: Planning commits (design docs, task lists) belong only to this feature's branch.
31
37
  If planning runs in the main directory on a non-master branch, those commits contaminate
@@ -46,6 +52,32 @@ between parallel features or sessions.
46
52
 
47
53
  ---
48
54
 
55
+
56
+ ### Multi-developer conflict check (soft block)
57
+
58
+ Before proceeding to Phase 1, check for cross-developer conflicts:
59
+
60
+ ```bash
61
+ # Auto-sync to get latest team state
62
+ bash scripts/sync-utils.sh auto-sync
63
+
64
+ # Check for conflicts with this issue's planned work area
65
+ bash scripts/conflict-detect.sh --issue <beads-id>
66
+ ```
67
+
68
+ If exit code 2 (validation error): show error message, abort — do not show conflict prompt.
69
+
70
+ If exit code 1 (conflicts found):
71
+ - Display the conflict output to the developer
72
+ - Ask: "Other developers are working in overlapping areas. Proceed anyway? (y/n)"
73
+ - If `n`: exit cleanly, no side effects
74
+ - If `y`: log override via `bd comments add <id> "Conflict override: proceeding despite overlap with <conflicting-issues>"`, then continue to Phase 1
75
+ - Audit: record conflict override per OWASP A09
76
+
77
+ If exit code 0: proceed silently to Phase 1.
78
+
79
+ ---
80
+
49
81
  ## Phase 1: Design Intent (Brainstorming)
50
82
 
51
83
  **Goal**: Capture WHAT to build — purpose, constraints, success criteria, edge cases, approach.
@@ -183,6 +215,11 @@ Do NOT begin Phase 2 (web research) until:
183
215
 
184
216
  **Goal**: Find HOW to build it — best practices, known issues, security risks, TDD scenarios.
185
217
 
218
+ Record the phase transition before starting research:
219
+ ```bash
220
+ bash scripts/beads-context.sh stage-transition <id> plan research
221
+ ```
222
+
186
223
  Run these in parallel:
187
224
 
188
225
  ### Web research (parallel-deep-research skill)
@@ -273,13 +310,19 @@ Do NOT begin Phase 3 (setup) until:
273
310
 
274
311
  ## Phase 3: Setup + Task List
275
312
 
276
- **Goal**: Create branch, worktree, Beads issue, and a complete task list ready for /dev.
313
+ **Goal**: Create branch, worktree, and a complete task list ready for /dev.
314
+
315
+ Record the phase transition before starting setup:
316
+ ```bash
317
+ bash scripts/beads-context.sh stage-transition <id> research setup
318
+ ```
319
+
320
+ ### Step 1: Link child issues to the epic
277
321
 
278
- ### Step 1: Beads issue
322
+ The epic was created in the Entry HARD-GATE (Phase 1 entry). If this feature requires child issues (sub-tasks tracked separately), create them now and link to the epic:
279
323
 
280
324
  ```bash
281
- bd create --title="<feature-name>" --type=feature
282
- bd update <id> --status=in_progress
325
+ bd create --title="<sub-task-name>" --type=feature --parent=<epic-id>
283
326
  ```
284
327
 
285
328
  ### Step 2: Branch + worktree
@@ -84,9 +84,6 @@ Check each of the following and update if the feature affects it. Be selective
84
84
  **F. `AGENTS.md`** (if agent config, skills, or cross-agent workflow changed):
85
85
  - Update relevant sections describing agent capabilities or workflow
86
86
 
87
- **G. `docs/WORKFLOW.md`** (if the workflow itself changed):
88
- - Update stage descriptions or workflow tables
89
-
90
87
  **Commit doc updates to feature branch**:
91
88
 
92
89
  ```bash
@@ -188,18 +188,18 @@ git commit -m "Rollback: <files>"
188
188
  ```bash
189
189
  bunx forge rollback
190
190
  # Select: 4. Rollback specific files
191
- # Enter: AGENTS.md,docs/WORKFLOW.md
191
+ # Enter: AGENTS.md,CLAUDE.md
192
192
 
193
193
  ✓ Validating file paths...
194
194
  ✓ Working directory is clean
195
195
  ✓ Extracting USER sections...
196
- ✓ Executing: git checkout HEAD~1 -- AGENTS.md docs/WORKFLOW.md
196
+ ✓ Executing: git checkout HEAD~1 -- AGENTS.md CLAUDE.md
197
197
  ✓ Committing changes...
198
198
  ✓ Restoring USER sections...
199
199
  ✓ Amended commit to preserve USER content
200
200
 
201
201
  Rollback complete!
202
- Commit: q4r5s6t "Rollback: AGENTS.md, docs/WORKFLOW.md"
202
+ Commit: q4r5s6t "Rollback: AGENTS.md, CLAUDE.md"
203
203
  Files affected: 2
204
204
  ```
205
205
 
@@ -719,5 +719,5 @@ bunx forge rollback
719
719
 
720
720
  - [/dev](.claude/commands/dev.md) - TDD development workflow
721
721
  - [/validate](.claude/commands/validate.md) - Validation before shipping
722
- - [docs/WORKFLOW.md](../../docs/WORKFLOW.md) - Complete workflow guide
722
+ - [AGENTS.md](../../AGENTS.md) - Complete workflow guide
723
723
  - [Beads](https://github.com/beadshq/beads) - Issue tracking integration
@@ -31,60 +31,97 @@ Do NOT create PR until:
31
31
  ### Step 1: Verify /validate Passed
32
32
  Ensure all four validation checks completed successfully with fresh output in this session.
33
33
 
34
- ### Step 2: Update Beads
34
+ ### Step 2: Freshness Check — Is Branch Still Current?
35
+
36
+ Even though /validate rebased onto the base branch, time may have passed since then (user reviewed design doc, took a break, etc.). This lightweight check catches staleness before pushing.
37
+
38
+ ```bash
39
+ BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
40
+ if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
41
+ git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify freshness"; exit 1; }
42
+ BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
43
+ ```
44
+
45
+ - If `BEHIND > 0`: **STOP**. Print: "$BASE has advanced since /validate ($BEHIND new commits). Run /validate again to rebase and re-check."
46
+ - If `BEHIND = 0`: Continue to push.
47
+ - If fetch fails: the `|| { ...; exit 1; }` guard catches this — **STOP**. Do NOT push without confirming freshness.
48
+
49
+ This is NOT a full rebase — just a check. The rebase happens in /validate where the full test suite runs afterward.
50
+
51
+ ### Step 3: Update Beads
35
52
  ```bash
36
53
  bd update <id> --status done
37
54
  bd sync
38
55
  ```
39
56
 
40
- ### Step 3: Push Branch
57
+ ### Step 4: Push Branch
58
+
59
+ Use `--force-with-lease` because `/validate` may have rebased the branch, rewriting history. This is safe: it only forces the push if the remote branch hasn't been updated by someone else since the last fetch.
60
+
41
61
  ```bash
42
- git push -u origin <branch-name>
62
+ git push --force-with-lease -u origin <branch-name>
43
63
  ```
44
64
 
45
- ### Step 4: Create PR
65
+ ### Step 5: Create PR
66
+
67
+ Use the narrative PR template below. Lead with WHY (Problem/Root Cause/Fix/Value) — this is what reviewers need to understand first. Keep implementation details (test coverage, security review, design doc) in a collapsible section so they're available but don't clutter the summary.
68
+
69
+ If no Beads issue exists (hotfix, external contribution), skip the "Closes" line.
46
70
 
47
71
  ```bash
48
- gh pr create --title "feat: <feature-name>" --body "$(cat <<'EOF'
49
- ## Summary
50
- [Auto-generated from commits and design doc]
72
+ gh pr create --title "<type>: <concise description>" --body "$(cat <<'EOF'
73
+ ## Problem
74
+ [What was broken, what need existed, or what user pain this addresses]
51
75
 
52
- ## Design Doc
53
- See: docs/plans/YYYY-MM-DD-<slug>-design.md
76
+ ## Root Cause
77
+ [Why it happened, why it was missing, or what gap existed]
54
78
 
55
- ## Decisions Log
56
- See: docs/plans/YYYY-MM-DD-<slug>-decisions.md (if any undocumented decisions arose during /dev)
79
+ ## Fix
80
+ [What this PR does to solve it approach, not implementation details]
81
+
82
+ ## Value
83
+ [Who benefits, what improves, what risk is removed]
57
84
 
58
- ## Beads Issue
85
+ ## Beads
59
86
  Closes: <issue-id>
60
87
 
61
- ## Key Decisions
62
- [From design doc - 3-5 key decisions with reasoning]
88
+ <details>
89
+ <summary>Implementation Details</summary>
63
90
 
64
- ## TDD Test Coverage
65
- - Unit tests: [count] tests, [X] scenarios
66
- - Integration tests: [count] tests
67
- - E2E tests: [count] tests
68
- - All tests passing ✓
91
+ ### Test Coverage
92
+ - Tests: [count] passing
93
+ - Scenarios covered: [list key scenarios]
69
94
 
70
- ## Security Review
71
- - OWASP Top 10: All mitigations implemented
72
- - Security tests: [count] scenarios passing
73
- - Automated scan: No vulnerabilities
95
+ ### Security Review
96
+ - OWASP Top 10: [summary — applicable risks and mitigations]
97
+ - Automated scan: [result]
74
98
 
75
- ## Test Plan
99
+ ### Design Doc
100
+ See: docs/plans/YYYY-MM-DD-<slug>-design.md
101
+
102
+ ### Decisions Log
103
+ See: docs/plans/YYYY-MM-DD-<slug>-decisions.md (if any undocumented decisions arose during /dev)
104
+
105
+ ### Key Decisions
106
+ [From design doc — 3-5 key decisions with reasoning]
107
+
108
+ ### Documentation Updated
109
+ [List docs updated in this PR, or "None — no doc-facing changes"]
110
+
111
+ ### Validation
76
112
  - [x] Type check passing
77
- - [x] Lint passing
78
- - [x] Code review passing
79
- - [x] E2E tests passing
113
+ - [x] Lint passing (0 errors, 0 warnings)
114
+ - [x] All tests passing
80
115
  - [x] Security review completed
81
116
 
117
+ </details>
118
+
82
119
  🤖 Generated with [Claude Code](https://claude.com/claude-code)
83
120
  EOF
84
121
  )"
85
122
  ```
86
123
 
87
- ### Step 5: Record Stage Transition
124
+ ### Step 6: Record Stage Transition
88
125
  ```bash
89
126
  bash scripts/beads-context.sh stage-transition <id> ship review
90
127
  ```
@@ -93,20 +130,13 @@ bash scripts/beads-context.sh stage-transition <id> ship review
93
130
 
94
131
  ```
95
132
  ✓ Validation: /validate passed (all 4 checks — fresh output confirmed)
133
+ ✓ Freshness: Branch is up-to-date with master
96
134
  ✓ Beads: Marked done & synced (forge-xyz)
97
135
  ✓ Pushed: feat/stripe-billing
98
136
  ✓ PR created: https://github.com/.../pull/123
137
+ - PR body: Problem → Root Cause → Fix → Value (narrative format)
99
138
  - Beads linked: forge-xyz
100
- - Design doc linked: docs/plans/2026-02-26-stripe-billing-design.md
101
- - Decisions log linked: docs/plans/2026-02-26-stripe-billing-decisions.md
102
- - Test coverage documented
103
- - Security review documented
104
-
105
- PR Summary:
106
- - 12 commits
107
- - 18 test cases, all passing
108
- - OWASP Top 10 security review completed
109
- - 3 key architectural decisions documented
139
+ - Implementation details in collapsible section
110
140
 
111
141
  ⏸️ PR created, awaiting automated checks (Greptile, SonarCloud, GitHub Actions)
112
142
 
@@ -128,9 +158,9 @@ Stage 7: /verify → Post-merge CI check on main
128
158
 
129
159
  ## Tips
130
160
 
131
- - **Complete PR body**: Include design doc, decisions log, and test coverage
132
- - **Link everything**: Design doc, decisions log, Beads issue
133
- - **Document security**: OWASP Top 10 review in PR body
161
+ - **Lead with why**: Problem Root Cause Fix Value is what reviewers need first
162
+ - **Collapsible details**: Design doc, decisions log, test coverage go in `<details>` — available but not in the way
163
+ - **Document security**: OWASP Top 10 review in collapsible section
134
164
  - **Test coverage**: Show all test scenarios passing
135
165
  - **Wait for checks**: Let GitHub Actions, Greptile, SonarCloud run
136
166
  - **NO auto-merge**: Always wait for /review phase
@@ -18,60 +18,31 @@ This command helps you understand the current state of the project before starti
18
18
 
19
19
  ## What This Command Does
20
20
 
21
- ### Step 1: Check Project Health
22
- ```bash
23
- bd stats
24
- ```
25
- - How many open / in-progress / completed issues?
26
- - Any blocked issues?
21
+ ## Step 0: Sync team state
27
22
 
28
- ### Step 2: Check Active Work
29
23
  ```bash
30
- # Active Beads issues
31
- bd list --status in_progress
24
+ # Sync team state before showing status
25
+ bash scripts/sync-utils.sh auto-sync
32
26
  ```
33
27
 
34
- For each in-progress issue, show compact progress:
28
+ ### Step 1: Smart Status (ranked issues with conflict detection)
35
29
  ```bash
36
- bash scripts/beads-context.sh parse-progress <issue-id>
30
+ bash scripts/smart-status.sh
37
31
  ```
38
- Display the compact output (e.g., "3/7 tasks done | Last: Validation logic (def5678)")
32
+ This script dynamically computes and displays all issues ranked by composite score (priority, dependency impact, type, staleness, epic proximity). Output includes active sessions, conflict risk annotations, and grouped categories. No manual querying needed — the script handles everything.
39
33
 
40
- Hint: `bd show <id>` for full context on any issue.
34
+ For full context on any issue: `bd show <id>`
41
35
 
42
- ### Step 3: Review Recent Work
36
+ ### Step 2: Review Recent Commits
43
37
  ```bash
44
- # Recent commits
45
38
  git log --oneline -10
46
-
47
- # Recently completed Beads
48
- bd list --status completed --limit 5
49
39
  ```
50
40
 
51
- ### Step 4: Determine Context
41
+ ### Step 3: Determine Context
52
42
  - **New feature**: No active work, ready to start fresh
53
43
  - **Continuing work**: In-progress issues found, resume where left off
54
44
  - **Review needed**: Work marked complete, needs review/merge
55
45
 
56
- ## Example Output
57
-
58
- ```
59
- ✓ Project Health: 3 open, 1 in-progress, 12 completed
60
-
61
- Active Work:
62
- - forge-ctc: Clean up stale workflow refs (in_progress)
63
- 3/7 tasks done | Last: Validation logic (def5678)
64
- → bd show forge-ctc for full context
65
-
66
- Recent Completions:
67
- - forge-uto: Sync AGENTS.md with agent cleanup (closed 2 days ago)
68
- - forge-abc: Auth refresh tokens (closed 5 days ago)
69
-
70
- Context: Continuing work
71
-
72
- Next: Resume with /dev or /validate (check issue status)
73
- ```
74
-
75
46
  ## Next Steps
76
47
 
77
48
  - **If starting new work**: Run `/plan <feature-name>`
@@ -4,6 +4,11 @@ description: Complete validation (type/lint/tests/security)
4
4
  tools: []
5
5
  ---
6
6
 
7
+ > **Note:** Three things share the "validate" name in Forge:
8
+ > - `/validate` (this command): Workflow Stage 3 — rebases onto the base branch, then runs type/lint/test/security checks
9
+ > - `forge-preflight` (formerly forge-validate): CLI tool — checks prerequisites before a stage
10
+ > - `bun run check` (scripts/validate.sh): Local quality gate — runs type/lint/test/security checks only (does NOT rebase; assumes branch is already current with the base branch)
11
+
7
12
  Run comprehensive validation including type checking, linting, code review, security review, and tests.
8
13
 
9
14
  # Validate
@@ -16,10 +21,50 @@ This command validates all code before creating a pull request.
16
21
  /validate
17
22
  ```
18
23
 
19
- Or use the unified validation script:
24
+ Or use the validation script (checks only — no rebase):
20
25
 
21
26
  ```bash
22
- bun run check # Runs all validation steps automatically (check is the npm script name; /validate is the workflow command)
27
+ bun run check # Runs lint/test/security checks only. Does NOT rebase onto the base branch.
28
+ # Use /validate for the full workflow (rebase + checks).
29
+ ```
30
+
31
+ ```
32
+ <HARD-GATE: /validate entry — rebase onto latest base branch>
33
+ Before running ANY validation checks:
34
+
35
+ 0. Resolve the base branch dynamically (do NOT hardcode master or main):
36
+ BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
37
+ if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
38
+
39
+ This handles repos using main, master, or any other default branch.
40
+ Falls back to "master" when HEAD is unresolved (detached remote, empty repo).
41
+
42
+ 1. Fetch latest base branch:
43
+ git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify branch freshness"; exit 1; }
44
+
45
+ The `|| { ...; exit 1; }` guard ensures fetch failures are never silently skipped.
46
+
47
+ 2. Check if branch is behind:
48
+ BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
49
+
50
+ 3. If BEHIND > 0:
51
+ a. Run: git rebase origin/"$BASE" || REBASE_FAILED=1
52
+ b. If rebase succeeds (REBASE_FAILED unset): print "✓ Rebased onto latest $BASE ($BEHIND commits integrated)"
53
+ c. If rebase fails (REBASE_FAILED=1 — conflicts or any other error):
54
+ - Capture conflicting files BEFORE aborting: git diff --name-only --diff-filter=U
55
+ - Run: git rebase --abort
56
+ - Print the captured conflicting file list
57
+ - Print: "✗ Rebase conflict — resolve manually, then re-run /validate"
58
+ - STOP. Do NOT proceed to any validation checks.
59
+
60
+ 4. If BEHIND = 0:
61
+ Print "✓ Branch is up-to-date with $BASE" and continue.
62
+
63
+ Rationale: Without this step, validation checks run against stale code that doesn't
64
+ include recent base branch changes. Integration issues are only caught after the PR is
65
+ created, wasting CI cycles and review time. Rebasing here ensures /validate results
66
+ reflect the true state of what will be merged.
67
+ </HARD-GATE>
23
68
  ```
24
69
 
25
70
  ## What This Command Does
@@ -64,6 +64,32 @@ Do NOT write any code until ALL confirmed:
64
64
 
65
65
  ---
66
66
 
67
+
68
+ ### Multi-developer conflict check (soft block)
69
+
70
+ Before starting the per-task loop, check for cross-developer conflicts:
71
+
72
+ ```bash
73
+ # Auto-sync to get latest team state
74
+ bash scripts/sync-utils.sh auto-sync
75
+
76
+ # Check for conflicts with the current beads issue
77
+ bash scripts/conflict-detect.sh --issue <beads-id>
78
+ ```
79
+
80
+ If exit code 2 (validation error): show error message, abort — do not show conflict prompt.
81
+
82
+ If exit code 1 (conflicts found):
83
+ - Display the conflict output to the developer
84
+ - Ask: "Other developers are working in overlapping areas. Proceed anyway? (y/n)"
85
+ - If `n`: exit cleanly, no side effects
86
+ - If `y`: log override via `bd comments add <id> "Conflict override: proceeding despite overlap with <conflicting-issues>"`, then continue to Per-Task Loop
87
+ - Audit: record conflict override per OWASP A09
88
+
89
+ If exit code 0: proceed silently to Per-Task Loop.
90
+
91
+ ---
92
+
67
93
  ## Per-Task Loop
68
94
 
69
95
  Repeat for each task in the task list, in order:
@@ -24,7 +24,13 @@ Before ANY planning work begins:
24
24
  a. bd worktree create .worktrees/<slug> --branch feat/<slug>
25
25
  b. cd .worktrees/<slug>
26
26
  4. Confirm: "Working in isolated worktree: .worktrees/<slug> (branch: feat/<slug>)"
27
- 5. ONLY THEN begin Phase 1.
27
+ 5. Create the epic issue and record the stage transition:
28
+ ```bash
29
+ bd create --title="<feature-name>" --type=epic
30
+ bd update <id> --status=in_progress
31
+ bash scripts/beads-context.sh stage-transition <id> none plan
32
+ ```
33
+ 6. ONLY THEN begin Phase 1.
28
34
 
29
35
  Rationale: Planning commits (design docs, task lists) belong only to this feature's branch.
30
36
  If planning runs in the main directory on a non-master branch, those commits contaminate
@@ -45,6 +51,32 @@ between parallel features or sessions.
45
51
 
46
52
  ---
47
53
 
54
+
55
+ ### Multi-developer conflict check (soft block)
56
+
57
+ Before proceeding to Phase 1, check for cross-developer conflicts:
58
+
59
+ ```bash
60
+ # Auto-sync to get latest team state
61
+ bash scripts/sync-utils.sh auto-sync
62
+
63
+ # Check for conflicts with this issue's planned work area
64
+ bash scripts/conflict-detect.sh --issue <beads-id>
65
+ ```
66
+
67
+ If exit code 2 (validation error): show error message, abort — do not show conflict prompt.
68
+
69
+ If exit code 1 (conflicts found):
70
+ - Display the conflict output to the developer
71
+ - Ask: "Other developers are working in overlapping areas. Proceed anyway? (y/n)"
72
+ - If `n`: exit cleanly, no side effects
73
+ - If `y`: log override via `bd comments add <id> "Conflict override: proceeding despite overlap with <conflicting-issues>"`, then continue to Phase 1
74
+ - Audit: record conflict override per OWASP A09
75
+
76
+ If exit code 0: proceed silently to Phase 1.
77
+
78
+ ---
79
+
48
80
  ## Phase 1: Design Intent (Brainstorming)
49
81
 
50
82
  **Goal**: Capture WHAT to build — purpose, constraints, success criteria, edge cases, approach.
@@ -182,6 +214,11 @@ Do NOT begin Phase 2 (web research) until:
182
214
 
183
215
  **Goal**: Find HOW to build it — best practices, known issues, security risks, TDD scenarios.
184
216
 
217
+ Record the phase transition before starting research:
218
+ ```bash
219
+ bash scripts/beads-context.sh stage-transition <id> plan research
220
+ ```
221
+
185
222
  Run these in parallel:
186
223
 
187
224
  ### Web research (parallel-deep-research skill)
@@ -272,13 +309,19 @@ Do NOT begin Phase 3 (setup) until:
272
309
 
273
310
  ## Phase 3: Setup + Task List
274
311
 
275
- **Goal**: Create branch, worktree, Beads issue, and a complete task list ready for /dev.
312
+ **Goal**: Create branch, worktree, and a complete task list ready for /dev.
313
+
314
+ Record the phase transition before starting setup:
315
+ ```bash
316
+ bash scripts/beads-context.sh stage-transition <id> research setup
317
+ ```
318
+
319
+ ### Step 1: Link child issues to the epic
276
320
 
277
- ### Step 1: Beads issue
321
+ The epic was created in the Entry HARD-GATE (Phase 1 entry). If this feature requires child issues (sub-tasks tracked separately), create them now and link to the epic:
278
322
 
279
323
  ```bash
280
- bd create --title="<feature-name>" --type=feature
281
- bd update <id> --status=in_progress
324
+ bd create --title="<sub-task-name>" --type=feature --parent=<epic-id>
282
325
  ```
283
326
 
284
327
  ### Step 2: Branch + worktree
@@ -83,9 +83,6 @@ Check each of the following and update if the feature affects it. Be selective
83
83
  **F. `AGENTS.md`** (if agent config, skills, or cross-agent workflow changed):
84
84
  - Update relevant sections describing agent capabilities or workflow
85
85
 
86
- **G. `docs/WORKFLOW.md`** (if the workflow itself changed):
87
- - Update stage descriptions or workflow tables
88
-
89
86
  **Commit doc updates to feature branch**:
90
87
 
91
88
  ```bash
@@ -187,18 +187,18 @@ git commit -m "Rollback: <files>"
187
187
  ```bash
188
188
  bunx forge rollback
189
189
  # Select: 4. Rollback specific files
190
- # Enter: AGENTS.md,docs/WORKFLOW.md
190
+ # Enter: AGENTS.md,CLAUDE.md
191
191
 
192
192
  ✓ Validating file paths...
193
193
  ✓ Working directory is clean
194
194
  ✓ Extracting USER sections...
195
- ✓ Executing: git checkout HEAD~1 -- AGENTS.md docs/WORKFLOW.md
195
+ ✓ Executing: git checkout HEAD~1 -- AGENTS.md CLAUDE.md
196
196
  ✓ Committing changes...
197
197
  ✓ Restoring USER sections...
198
198
  ✓ Amended commit to preserve USER content
199
199
 
200
200
  Rollback complete!
201
- Commit: q4r5s6t "Rollback: AGENTS.md, docs/WORKFLOW.md"
201
+ Commit: q4r5s6t "Rollback: AGENTS.md, CLAUDE.md"
202
202
  Files affected: 2
203
203
  ```
204
204
 
@@ -718,5 +718,5 @@ bunx forge rollback
718
718
 
719
719
  - [/dev](.claude/commands/dev.md) - TDD development workflow
720
720
  - [/validate](.claude/commands/validate.md) - Validation before shipping
721
- - [docs/WORKFLOW.md](../../docs/WORKFLOW.md) - Complete workflow guide
721
+ - [AGENTS.md](../../AGENTS.md) - Complete workflow guide
722
722
  - [Beads](https://github.com/beadshq/beads) - Issue tracking integration