Enable multiple Claude Code instances to work on the same codebase
simultaneously by scoping .planning/ state into workstreams.
Core changes:
- planningDir(cwd, ws?) and planningPaths(cwd, ws?) are now workstream-aware
via GSD_WORKSTREAM env var (auto-detected from --ws flag or active-workstream file)
- All bin/lib modules use planningDir(cwd) for scoped paths (STATE.md, ROADMAP.md,
phases/, REQUIREMENTS.md) and planningRoot(cwd) for shared paths (milestones/,
PROJECT.md, config.json, codebase/)
- New workstream.cjs module: create, list, status, complete, set, get, progress
- gsd-tools.cjs: --ws flag parsing with priority chain
(--ws > GSD_WORKSTREAM env > active-workstream file > flat mode)
- Collision detection: transition.md checks for other active workstreams before
suggesting next-milestone continuation (prevents WS A from trampling WS B)
- ${GSD_WS} routing propagation across all 9 workflow files ensures workstream
scope chains automatically through the workflow lifecycle
New files:
- get-shit-done/bin/lib/workstream.cjs (CRUD + collision detection)
- get-shit-done/commands/gsd/workstreams.md (slash command)
- get-shit-done/references/workstream-flag.md (documentation)
- tests/workstream.test.cjs (20 tests covering CRUD, env var routing, --ws flag)
All 1062 tests passing (1042 existing + 20 new workstream tests).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
59 lines
1.7 KiB
Markdown
59 lines
1.7 KiB
Markdown
# Workstream Flag (`--ws`)
|
|
|
|
## Overview
|
|
|
|
The `--ws <name>` flag scopes GSD operations to a specific workstream, enabling
|
|
parallel milestone work by multiple Claude Code instances on the same codebase.
|
|
|
|
## Resolution Priority
|
|
|
|
1. `--ws <name>` flag (explicit, highest priority)
|
|
2. `GSD_WORKSTREAM` environment variable (per-instance)
|
|
3. `.planning/active-workstream` file (shared, last-writer-wins)
|
|
4. `null` — flat mode (no workstreams)
|
|
|
|
## Routing Propagation
|
|
|
|
All workflow routing commands include `${GSD_WS}` which:
|
|
- Expands to `--ws <name>` when a workstream is active
|
|
- Expands to empty string in flat mode (backward compatible)
|
|
|
|
This ensures workstream scope chains automatically through the workflow:
|
|
`new-milestone → discuss-phase → plan-phase → execute-phase → transition`
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
.planning/
|
|
├── PROJECT.md # Shared
|
|
├── config.json # Shared
|
|
├── milestones/ # Shared
|
|
├── codebase/ # Shared
|
|
├── active-workstream # Points to current ws
|
|
└── workstreams/
|
|
├── feature-a/ # Workstream A
|
|
│ ├── STATE.md
|
|
│ ├── ROADMAP.md
|
|
│ ├── REQUIREMENTS.md
|
|
│ └── phases/
|
|
└── feature-b/ # Workstream B
|
|
├── STATE.md
|
|
├── ROADMAP.md
|
|
├── REQUIREMENTS.md
|
|
└── phases/
|
|
```
|
|
|
|
## CLI Usage
|
|
|
|
```bash
|
|
# All gsd-tools commands accept --ws
|
|
node gsd-tools.cjs state json --ws feature-a
|
|
node gsd-tools.cjs find-phase 3 --ws feature-b
|
|
|
|
# Workstream CRUD
|
|
node gsd-tools.cjs workstream create <name>
|
|
node gsd-tools.cjs workstream list
|
|
node gsd-tools.cjs workstream status <name>
|
|
node gsd-tools.cjs workstream complete <name>
|
|
```
|