murmur8 4.2.0 → 4.3.1
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/.blueprint/agents/AGENT_SPECIFICATION_ALEX.md +33 -3
- package/.blueprint/features/feature_config-factory/FEATURE_SPEC.md +138 -0
- package/.blueprint/features/feature_config-factory/IMPLEMENTATION_PLAN.md +187 -0
- package/.blueprint/features/feature_config-factory/handoff-nigel.md +57 -0
- package/.blueprint/features/feature_cost-tracking/FEATURE_SPEC.md +216 -0
- package/.blueprint/features/feature_cost-tracking/IMPLEMENTATION_PLAN.md +50 -0
- package/.blueprint/features/feature_diff-preview/FEATURE_SPEC.md +182 -0
- package/.blueprint/features/feature_diff-preview/IMPLEMENTATION_PLAN.md +42 -0
- package/.blueprint/features/feature_extract-prompt-util/FEATURE_SPEC.md +42 -0
- package/.blueprint/features/feature_fix-status-icons/FEATURE_SPEC.md +37 -0
- package/.blueprint/features/feature_murm-subagent/FEATURE_SPEC.md +137 -0
- package/.blueprint/features/feature_murm-subagent/SKILL_CHANGES.md +345 -0
- package/.blueprint/features/feature_split-cli-commands/FEATURE_SPEC.md +125 -0
- package/.blueprint/features/feature_split-cli-commands/IMPLEMENTATION_PLAN.md +119 -0
- package/.blueprint/features/feature_split-cli-commands/handoff-nigel.md +45 -0
- package/.blueprint/features/feature_theme-adoption/FEATURE_SPEC.md +143 -0
- package/.blueprint/features/feature_theme-adoption/IMPLEMENTATION_PLAN.md +68 -0
- package/.blueprint/features/feature_theme-adoption/handoff-nigel.md +35 -0
- package/.blueprint/templates/BACKLOG_TEMPLATE.md +46 -0
- package/README.md +79 -12
- package/SKILL.md +377 -3
- package/bin/cli.js +20 -411
- package/package.json +1 -1
- package/src/commands/cost-config.js +28 -0
- package/src/commands/feedback-config.js +32 -0
- package/src/commands/help.js +86 -0
- package/src/commands/history.js +42 -0
- package/src/commands/init.js +12 -0
- package/src/commands/insights.js +23 -0
- package/src/commands/murm-config.js +52 -0
- package/src/commands/murm.js +109 -0
- package/src/commands/queue.js +19 -0
- package/src/commands/retry-config.js +28 -0
- package/src/commands/stack-config.js +32 -0
- package/src/commands/update.js +12 -0
- package/src/commands/utils.js +25 -0
- package/src/commands/validate.js +15 -0
- package/src/config-factory.js +190 -0
- package/src/cost.js +122 -0
- package/src/diff-preview.js +165 -0
- package/src/feedback.js +5 -2
- package/src/history.js +51 -3
- package/src/index.js +25 -0
- package/src/init.js +1 -15
- package/src/insights.js +19 -16
- package/src/retry.js +5 -2
- package/src/stack.js +4 -1
- package/src/theme.js +6 -5
- package/src/update.js +2 -15
- package/src/utils.js +26 -0
- package/src/validate.js +5 -12
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Implementation Plan — Cost Tracking
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Implement a cost tracking module (`src/cost.js`) that calculates token costs using configurable pricing, integrate it with the existing history module to persist cost data per stage, and add CLI commands for displaying costs (`history --cost`) and managing pricing configuration (`cost-config`).
|
|
6
|
+
|
|
7
|
+
## Files to Create/Modify
|
|
8
|
+
|
|
9
|
+
| Path | Action | Purpose |
|
|
10
|
+
|------|--------|---------|
|
|
11
|
+
| `src/cost.js` | Create | Core module: cost calculation, formatting, pricing config |
|
|
12
|
+
| `src/commands/cost-config.js` | Create | CLI command for managing pricing configuration |
|
|
13
|
+
| `src/history.js` | Modify | Add `--cost` display support, cost data in formatters |
|
|
14
|
+
| `src/commands/history.js` | Modify | Parse `--cost` flag and pass to display functions |
|
|
15
|
+
| `src/commands/help.js` | Modify | Add `cost-config` command to help output |
|
|
16
|
+
| `.gitignore` | Modify | Add `.claude/cost-config.json` entry |
|
|
17
|
+
|
|
18
|
+
## Implementation Steps
|
|
19
|
+
|
|
20
|
+
1. **Create `src/cost.js`** — Implement core functions using `config-factory.js` pattern:
|
|
21
|
+
- `getDefaultPricing()` — Returns `{ inputPricePerMillion: 3, outputPricePerMillion: 15 }`
|
|
22
|
+
- `loadPricingConfig()` / `savePricingConfig()` — Read/write `.claude/cost-config.json`
|
|
23
|
+
- `calculateCost(inputTokens, outputTokens, pricing)` — Formula per FEATURE_SPEC.md Section 6
|
|
24
|
+
- `formatCost(cost)` — Returns `$X.XXX` or `N/A` for null/undefined
|
|
25
|
+
- `formatTokens(tokens)` — Returns number with thousands separator or `N/A`
|
|
26
|
+
- `getCostSummary(stages)` — Generates formatted cost summary table
|
|
27
|
+
|
|
28
|
+
2. **Create `src/commands/cost-config.js`** — CLI command following `retry-config.js` pattern:
|
|
29
|
+
- `cost-config` — Display current pricing
|
|
30
|
+
- `cost-config set <key> <value>` — Update pricing
|
|
31
|
+
- `cost-config reset` — Reset to defaults
|
|
32
|
+
|
|
33
|
+
3. **Modify `src/history.js`** — Extend `displayHistory()` and `showStats()`:
|
|
34
|
+
- Add `cost` option parameter to `displayHistory()`
|
|
35
|
+
- Display `TOTAL COST` column when `--cost` flag present
|
|
36
|
+
- Add cost statistics to `showStats()` when cost data available
|
|
37
|
+
- Handle legacy entries gracefully (display N/A for missing token data)
|
|
38
|
+
|
|
39
|
+
4. **Modify `src/commands/history.js`** — Parse `--cost` flag:
|
|
40
|
+
- Pass `{ cost: flags.cost }` to `displayHistory()` and `showStats()`
|
|
41
|
+
|
|
42
|
+
5. **Modify `src/commands/help.js`** — Add `cost-config` to command list
|
|
43
|
+
|
|
44
|
+
6. **Update `.gitignore`** — Add `.claude/cost-config.json` entry
|
|
45
|
+
|
|
46
|
+
## Risks/Questions
|
|
47
|
+
|
|
48
|
+
- **Token data availability**: Claude Code must expose token usage in Task tool responses. If unavailable, gracefully degrade to N/A.
|
|
49
|
+
- **History schema migration**: No migration needed — new fields are additive and missing data displays as N/A.
|
|
50
|
+
- **Pricing accuracy**: Costs are estimates only; document this in CLI output.
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Feature Specification — Diff Preview
|
|
2
|
+
|
|
3
|
+
## 1. Feature Intent
|
|
4
|
+
|
|
5
|
+
Provide transparency into pipeline-generated changes before committing them.
|
|
6
|
+
|
|
7
|
+
**Problem:** The auto-commit stage (Step 11) commits all changes without showing users what will be committed. Users may want to review file additions, modifications, and deletions before they become part of the git history.
|
|
8
|
+
|
|
9
|
+
**Solution:** Before auto-commit, display a summary of all pending changes (staged and unstaged) so users can review and approve or abort.
|
|
10
|
+
|
|
11
|
+
**System alignment:** Supports the system spec's "Observability" cross-cutting concern and empowers the Human User actor who has "final arbiter" authority over scope and quality.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 2. Scope
|
|
16
|
+
|
|
17
|
+
### In Scope
|
|
18
|
+
- Show diff summary before auto-commit (single-feature pipeline)
|
|
19
|
+
- Show diff summary before worktree commit (murmuration mode, Step M5.5)
|
|
20
|
+
- Display file counts: additions, modifications, deletions
|
|
21
|
+
- Display file paths for each category
|
|
22
|
+
- Display actual diff content (optionally truncated for large changes)
|
|
23
|
+
- Prompt user to confirm commit, abort, or review full diff
|
|
24
|
+
- `--no-diff-preview` flag to skip (for automation)
|
|
25
|
+
- Integration with `--no-commit` flag (skip preview when commit is skipped)
|
|
26
|
+
|
|
27
|
+
### Out of Scope
|
|
28
|
+
- Interactive editing of changes before commit
|
|
29
|
+
- Selective staging/unstaging from the preview
|
|
30
|
+
- Diff viewing in external tools (editor integration)
|
|
31
|
+
- Syntax highlighting in diff output
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 3. Actors Involved
|
|
36
|
+
|
|
37
|
+
### Human User
|
|
38
|
+
- **Can:** View diff summary, approve commit, abort commit, request full diff
|
|
39
|
+
- **Cannot:** Edit changes from the preview screen
|
|
40
|
+
|
|
41
|
+
### Pipeline Orchestrator
|
|
42
|
+
- **Can:** Trigger diff preview, pass result to commit stage
|
|
43
|
+
- **Cannot:** Auto-approve on user's behalf (unless `--no-diff-preview`)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 4. Behaviour Overview
|
|
48
|
+
|
|
49
|
+
### Single-Feature Pipeline (Step 11)
|
|
50
|
+
|
|
51
|
+
Before committing, the pipeline:
|
|
52
|
+
|
|
53
|
+
1. Runs `git status --porcelain` to detect changes
|
|
54
|
+
2. Categorizes changes: Added (A/??), Modified (M), Deleted (D)
|
|
55
|
+
3. Displays summary:
|
|
56
|
+
```
|
|
57
|
+
Changes to commit for feature_user-auth:
|
|
58
|
+
|
|
59
|
+
Added (3 files):
|
|
60
|
+
+ .blueprint/features/feature_user-auth/FEATURE_SPEC.md
|
|
61
|
+
+ test/feature_user-auth.test.js
|
|
62
|
+
+ src/auth.js
|
|
63
|
+
|
|
64
|
+
Modified (1 file):
|
|
65
|
+
~ src/index.js
|
|
66
|
+
|
|
67
|
+
Deleted (0 files):
|
|
68
|
+
(none)
|
|
69
|
+
|
|
70
|
+
Total: 4 files changed
|
|
71
|
+
|
|
72
|
+
[c]ommit / [a]bort / [d]iff (show full diff)?
|
|
73
|
+
```
|
|
74
|
+
4. On 'c': proceed to commit
|
|
75
|
+
5. On 'a': abort pipeline, exit cleanly
|
|
76
|
+
6. On 'd': show full `git diff --staged` output, then re-prompt
|
|
77
|
+
|
|
78
|
+
### Murmuration Mode (Step M5.5)
|
|
79
|
+
|
|
80
|
+
For each successful worktree, before committing:
|
|
81
|
+
|
|
82
|
+
1. Change to worktree directory
|
|
83
|
+
2. Run same diff preview flow
|
|
84
|
+
3. If user aborts one worktree, mark it as "user-aborted" (not "failed")
|
|
85
|
+
4. Continue to next worktree
|
|
86
|
+
|
|
87
|
+
### Skip Conditions
|
|
88
|
+
|
|
89
|
+
Diff preview is skipped when:
|
|
90
|
+
- `--no-commit` flag is set (no commit will happen)
|
|
91
|
+
- `--no-diff-preview` flag is set (user opted out)
|
|
92
|
+
- `--yes` flag is set (non-interactive mode)
|
|
93
|
+
- No changes detected (`git status` returns empty)
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 5. State & Lifecycle Interactions
|
|
98
|
+
|
|
99
|
+
**States touched:**
|
|
100
|
+
- Feature enters a new transient state: `awaiting-commit-review`
|
|
101
|
+
- Exits to: `committing` (on approve) or `aborted` (on abort)
|
|
102
|
+
|
|
103
|
+
**This feature is:** state-constraining (adds a gate before commit)
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 6. Rules & Decision Logic
|
|
108
|
+
|
|
109
|
+
| Rule | Description | Deterministic |
|
|
110
|
+
|------|-------------|---------------|
|
|
111
|
+
| Empty diff | Skip preview if no changes detected | Yes |
|
|
112
|
+
| Truncation | Show first 20 files per category; "... and N more" for overflow | Yes |
|
|
113
|
+
| Large diff | For full diff view, paginate if >100 lines | Yes |
|
|
114
|
+
| Abort handling | Exit code 0 (user choice, not error) | Yes |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 7. Dependencies
|
|
119
|
+
|
|
120
|
+
- Git CLI (`git status`, `git diff`)
|
|
121
|
+
- readline module (for interactive prompt)
|
|
122
|
+
- Existing orchestrator.js or SKILL.md commit flow
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 8. Non-Functional Considerations
|
|
127
|
+
|
|
128
|
+
- **Performance:** `git status` and `git diff` are fast; no significant overhead
|
|
129
|
+
- **Error tolerance:** If git commands fail, show error and proceed with prompt
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 9. Assumptions & Open Questions
|
|
134
|
+
|
|
135
|
+
### Assumptions
|
|
136
|
+
- Git working tree is accessible at commit time
|
|
137
|
+
- Terminal supports interactive prompts (or flags are used for CI)
|
|
138
|
+
|
|
139
|
+
### Open Questions
|
|
140
|
+
- Should diff preview show binary files differently? (Assume: just note "[binary]")
|
|
141
|
+
- Should large diffs auto-truncate in full view? (Assume: yes, with option to show all)
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 10. Impact on System Specification
|
|
146
|
+
|
|
147
|
+
**Reinforces:**
|
|
148
|
+
- Observability (users see what's happening)
|
|
149
|
+
- Human User authority (explicit confirmation)
|
|
150
|
+
|
|
151
|
+
**Stretches:**
|
|
152
|
+
- Pipeline lifecycle adds a transient state (`awaiting-commit-review`)
|
|
153
|
+
- May need to document this in system spec's lifecycle section
|
|
154
|
+
|
|
155
|
+
**No contradictions identified.**
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 11. Handover to BA (Cass)
|
|
160
|
+
|
|
161
|
+
### Story Themes
|
|
162
|
+
1. **Preview display:** Show diff summary before commit
|
|
163
|
+
2. **User choice:** Confirm, abort, or view full diff
|
|
164
|
+
3. **Skip conditions:** Honor flags to bypass preview
|
|
165
|
+
4. **Murmuration integration:** Per-worktree preview in parallel mode
|
|
166
|
+
|
|
167
|
+
### Expected Story Boundaries
|
|
168
|
+
- Keep preview display and user interaction in one story
|
|
169
|
+
- Separate story for murmuration integration if complex
|
|
170
|
+
- Flags/skip conditions can be part of the main preview story
|
|
171
|
+
|
|
172
|
+
### Areas Needing Careful Framing
|
|
173
|
+
- Abort behavior should clearly distinguish user-abort from pipeline failure
|
|
174
|
+
- Full diff view interaction: single prompt or back-and-forth?
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 12. Change Log
|
|
179
|
+
|
|
180
|
+
| Date | Change | Reason |
|
|
181
|
+
|------|--------|--------|
|
|
182
|
+
| 2026-03-04 | Initial spec | Add transparency before auto-commit |
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Implementation Plan: Diff Preview
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Create a new `src/diff-preview.js` module that provides transparency before auto-commit by displaying pending changes and prompting for user confirmation. The module exports pure functions for parsing git status, formatting summaries, and handling user choices, plus integration functions for the pipeline commit flow.
|
|
6
|
+
|
|
7
|
+
## Files to Create/Modify
|
|
8
|
+
|
|
9
|
+
| Path | Action | Purpose |
|
|
10
|
+
|------|--------|---------|
|
|
11
|
+
| `src/diff-preview.js` | Create | Core module with all exported functions |
|
|
12
|
+
| `src/index.js` | Modify | Export diff-preview functions |
|
|
13
|
+
| `src/theme.js` | Modify | Add `user-aborted` status icon |
|
|
14
|
+
| `SKILL.md` | Modify | Document `--no-diff-preview` flag and Step 10.5 |
|
|
15
|
+
|
|
16
|
+
## Implementation Steps
|
|
17
|
+
|
|
18
|
+
1. **Create `src/diff-preview.js` skeleton** with all required exports: `parseGitStatus`, `formatDiffSummary`, `shouldSkipPreview`, `parseUserChoice`, `createAbortResult`, `truncateDiff`, `getPreviewState`, `markWorktreeAborted`, `getPromptText`, `hasChanges`, `formatFeatureHeader`.
|
|
19
|
+
|
|
20
|
+
2. **Implement `parseGitStatus(porcelainOutput)`** - Parse `git status --porcelain` output into `{ added: [], modified: [], deleted: [], total: number }`. Handle status codes: `A`/`??` (added), `M`/` M` (modified), `D`/` D` (deleted).
|
|
21
|
+
|
|
22
|
+
3. **Implement display functions** - `formatDiffSummary(changes, slug)` with 20-file truncation per category, `formatFeatureHeader(slug)`, and `hasChanges(changes)`.
|
|
23
|
+
|
|
24
|
+
4. **Implement skip logic** - `shouldSkipPreview({ noCommit, noDiffPreview, yes, hasChanges })` returns true if any skip condition met.
|
|
25
|
+
|
|
26
|
+
5. **Implement user choice handling** - `parseUserChoice(input)` maps `c/C` to `'commit'`, `a/A` to `'abort'`, `d/D` to `'diff'`, else `null`.
|
|
27
|
+
|
|
28
|
+
6. **Implement abort/state functions** - `createAbortResult(slug)` returns `{ exitCode: 0, reason: 'user-aborted', slug }`, `getPreviewState()` returns `'awaiting-commit-review'`, `markWorktreeAborted(worktree)` sets status to `'user-aborted'`.
|
|
29
|
+
|
|
30
|
+
7. **Implement truncation** - `truncateDiff(diffOutput, threshold)` limits to threshold lines with "... N more lines" message.
|
|
31
|
+
|
|
32
|
+
8. **Implement `getPromptText()`** - Return the interactive prompt string `[c]ommit / [a]bort / [d]iff`.
|
|
33
|
+
|
|
34
|
+
9. **Update `src/theme.js`** - Add `'user-aborted': '\u25a1'` (or similar) to STATUS_ICONS for murmuration display consistency.
|
|
35
|
+
|
|
36
|
+
10. **Update `src/index.js`** - Import and export diff-preview functions for programmatic access.
|
|
37
|
+
|
|
38
|
+
## Risks/Questions
|
|
39
|
+
|
|
40
|
+
- Git command execution not part of pure functions (caller provides porcelain output)
|
|
41
|
+
- Interactive prompt loop (re-prompt after 'd') handled by integration layer, not tested in unit tests
|
|
42
|
+
- Binary file detection (`[binary]` note) deferred to display integration
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Feature Specification — Extract Prompt Utility
|
|
2
|
+
|
|
3
|
+
## 1. Feature Intent
|
|
4
|
+
|
|
5
|
+
The `prompt()` function is duplicated identically in `src/init.js` and `src/update.js`. Extract to a shared utility module to eliminate duplication and make the pattern reusable.
|
|
6
|
+
|
|
7
|
+
## 2. Scope
|
|
8
|
+
|
|
9
|
+
### In Scope
|
|
10
|
+
- Create `src/utils.js` with `prompt()` function
|
|
11
|
+
- Update `src/init.js` to import from utils.js
|
|
12
|
+
- Update `src/update.js` to import from utils.js
|
|
13
|
+
- Remove duplicate function definitions
|
|
14
|
+
|
|
15
|
+
### Out of Scope
|
|
16
|
+
- Adding new utility functions
|
|
17
|
+
- Changing prompt behavior
|
|
18
|
+
- Adding tests for prompt (interactive, hard to test)
|
|
19
|
+
|
|
20
|
+
## 3. Files to Modify
|
|
21
|
+
|
|
22
|
+
| File | Change |
|
|
23
|
+
|------|--------|
|
|
24
|
+
| `src/utils.js` | Create new file with prompt() |
|
|
25
|
+
| `src/init.js` | Remove prompt(), add import |
|
|
26
|
+
| `src/update.js` | Remove prompt(), add import |
|
|
27
|
+
|
|
28
|
+
## 4. Function Signature
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
async function prompt(question) {
|
|
32
|
+
// Creates readline interface
|
|
33
|
+
// Asks question
|
|
34
|
+
// Returns answer.toLowerCase().trim()
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 5. Change Log
|
|
39
|
+
|
|
40
|
+
| Date | Change | Reason | Raised By |
|
|
41
|
+
|------|--------|--------|-----------|
|
|
42
|
+
| 2026-03-03 | Initial spec | DRY refactoring | Alex |
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Feature Specification — Fix Status Icons
|
|
2
|
+
|
|
3
|
+
## 1. Feature Intent
|
|
4
|
+
|
|
5
|
+
The `STATUS_ICONS` object in `src/theme.js` uses legacy `parallel_*` keys, but the actual status strings in `src/murm.js` use `murm_*`. This creates a mismatch where icon lookups fail silently.
|
|
6
|
+
|
|
7
|
+
## 2. Scope
|
|
8
|
+
|
|
9
|
+
### In Scope
|
|
10
|
+
- Rename `parallel_queued` → `murm_queued`
|
|
11
|
+
- Rename `parallel_running` → `murm_running`
|
|
12
|
+
- Rename `parallel_complete` → `murm_complete`
|
|
13
|
+
- Rename `parallel_failed` → `murm_failed`
|
|
14
|
+
- Update tests that reference these keys
|
|
15
|
+
|
|
16
|
+
### Out of Scope
|
|
17
|
+
- Adding new icons
|
|
18
|
+
- Changing icon characters
|
|
19
|
+
- Refactoring theme.js structure
|
|
20
|
+
|
|
21
|
+
## 3. Actors
|
|
22
|
+
- **Developer**: Uses STATUS_ICONS for CLI output formatting
|
|
23
|
+
|
|
24
|
+
## 4. Behaviour Overview
|
|
25
|
+
After this change, `STATUS_ICONS[status]` will return the correct icon when `status` is one of the `murm_*` values from the state machine.
|
|
26
|
+
|
|
27
|
+
## 5. Files to Modify
|
|
28
|
+
| File | Change |
|
|
29
|
+
|------|--------|
|
|
30
|
+
| `src/theme.js` | Rename 4 keys in STATUS_ICONS |
|
|
31
|
+
| `test/feature_murmuration-theme.test.js` | Update key references |
|
|
32
|
+
| `test/feature_theme-adoption.test.js` | Update key references |
|
|
33
|
+
|
|
34
|
+
## 6. Change Log
|
|
35
|
+
| Date | Change | Reason | Raised By |
|
|
36
|
+
|------|--------|--------|-----------|
|
|
37
|
+
| 2026-03-03 | Initial spec | Complete v4.0 murm theming | Alex |
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Feature Specification — Murmuration Sub-Agent Architecture
|
|
2
|
+
|
|
3
|
+
## 1. Feature Intent
|
|
4
|
+
**Why this feature exists.**
|
|
5
|
+
|
|
6
|
+
- Current murmuration spawns separate CLI processes (`npx claude`) which fails inside existing Claude sessions
|
|
7
|
+
- The `/implement-feature` skill already uses Task sub-agents for Alex/Cass/Nigel/Codey
|
|
8
|
+
- Extending this pattern to run multiple feature pipelines in parallel is natural and efficient
|
|
9
|
+
- Enables true parallel execution without leaving the current Claude Code session
|
|
10
|
+
|
|
11
|
+
> This feature changes how murmuration works: from process spawning to Task sub-agent orchestration.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 2. Scope
|
|
16
|
+
### In Scope
|
|
17
|
+
- Modify SKILL.md to accept multiple slugs
|
|
18
|
+
- Add worktree creation/cleanup logic to the skill
|
|
19
|
+
- Spawn parallel Task sub-agents (one full pipeline per feature)
|
|
20
|
+
- Merge results back to main branch
|
|
21
|
+
- Handle conflicts and failures gracefully
|
|
22
|
+
|
|
23
|
+
### Out of Scope
|
|
24
|
+
- Changing the single-feature pipeline flow
|
|
25
|
+
- Removing CLI process spawning (keep for CI/automation use cases)
|
|
26
|
+
- Adding new agent types
|
|
27
|
+
- Changing worktree locations or branch naming
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 3. Actors Involved
|
|
32
|
+
|
|
33
|
+
- **User**: Invokes `/implement-feature slug-a slug-b slug-c`
|
|
34
|
+
- **Orchestrator (Claude)**: Reads skill, creates worktrees, spawns parallel Tasks
|
|
35
|
+
- **Task Sub-agents**: Each runs a complete pipeline in isolation
|
|
36
|
+
- **Git**: Provides worktree isolation and branch merging
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 4. Behaviour Overview
|
|
41
|
+
|
|
42
|
+
**Single slug (existing):**
|
|
43
|
+
```
|
|
44
|
+
/implement-feature "slug"
|
|
45
|
+
→ Sequential: Alex → Cass → Nigel → Codey
|
|
46
|
+
→ Commit to current branch
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Multiple slugs (new):**
|
|
50
|
+
```
|
|
51
|
+
/implement-feature slug-a slug-b slug-c
|
|
52
|
+
→ Create worktrees for isolation
|
|
53
|
+
→ Parallel Tasks: each runs full pipeline
|
|
54
|
+
→ Merge successful branches to main
|
|
55
|
+
→ Cleanup worktrees
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 5. State & Lifecycle Interactions
|
|
61
|
+
|
|
62
|
+
- **Worktree creation**: New state - `.claude/worktrees/feat-{slug}/`
|
|
63
|
+
- **Branch creation**: New branches `feature/{slug}` per feature
|
|
64
|
+
- **Merge state**: Successful features merged to main
|
|
65
|
+
- **Conflict state**: Failed merges preserved for manual resolution
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 6. Rules & Decision Logic
|
|
70
|
+
|
|
71
|
+
| Rule | Description |
|
|
72
|
+
|------|-------------|
|
|
73
|
+
| Multi-feature detection | `slugs.length > 1` triggers murmuration mode |
|
|
74
|
+
| Worktree isolation | Each feature gets dedicated worktree |
|
|
75
|
+
| Parallel execution | All Task sub-agents spawned in single message |
|
|
76
|
+
| No cross-contamination | Sub-agents work only in their worktree |
|
|
77
|
+
| Merge order | First-completed = first-merged |
|
|
78
|
+
| Conflict handling | Preserve branch, don't force |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 7. Dependencies
|
|
83
|
+
|
|
84
|
+
- Git 2.5+ (worktree support)
|
|
85
|
+
- Clean working tree before starting
|
|
86
|
+
- Task tool supports concurrent invocations
|
|
87
|
+
- Sufficient context window for multiple sub-agent prompts
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 8. Non-Functional Considerations
|
|
92
|
+
|
|
93
|
+
- **Context usage**: Each parallel Task adds ~2-3k tokens to the prompt
|
|
94
|
+
- **Parallelism limit**: Recommend max 3-5 concurrent features
|
|
95
|
+
- **Failure isolation**: One feature's failure doesn't affect others
|
|
96
|
+
- **Recovery**: Failed worktrees preserved for debugging/retry
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 9. Assumptions & Open Questions
|
|
101
|
+
|
|
102
|
+
**Assumptions:**
|
|
103
|
+
- Task tool executes concurrent calls truly in parallel
|
|
104
|
+
- Sub-agents can write to worktree paths
|
|
105
|
+
- Git merge from worktree branches works as expected
|
|
106
|
+
|
|
107
|
+
**Open Questions:**
|
|
108
|
+
- What's the practical limit on concurrent Task sub-agents?
|
|
109
|
+
- Should there be a `--max-concurrency` flag?
|
|
110
|
+
- How to handle partial success (some merge, some conflict)?
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 10. Impact on System Specification
|
|
115
|
+
|
|
116
|
+
- Extends the skill's capabilities without changing core agent behavior
|
|
117
|
+
- Murmuration becomes an in-session feature rather than external process
|
|
118
|
+
- CLI `murm` command could detect in-session mode and delegate to skill
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 11. Handover to BA (Cass)
|
|
123
|
+
|
|
124
|
+
**Skip Cass stage** — this is a technical/infrastructure feature.
|
|
125
|
+
|
|
126
|
+
Direct handover to Nigel:
|
|
127
|
+
- Test multi-slug parsing
|
|
128
|
+
- Test worktree creation/cleanup
|
|
129
|
+
- Test parallel execution (mock Task tool)
|
|
130
|
+
- Test merge success/conflict handling
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 12. Change Log
|
|
135
|
+
| Date | Change | Reason | Raised By |
|
|
136
|
+
|------|--------|--------|-----------|
|
|
137
|
+
| 2026-03-03 | Initial spec | Enable parallel features via sub-agents | Alex |
|