golem-cc 2.0.0 → 2.1.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.
package/bin/golem CHANGED
@@ -132,9 +132,11 @@ OTHER:
132
132
  help Show this help
133
133
 
134
134
  CLAUDE COMMANDS (inside Claude Code):
135
- /golem:spec Define specs interactively
136
- /golem:plan Create implementation plan
137
- /golem:build Run build loop (one task at a time)
135
+ /golem:spec Define specs (agent team: UX, Architect, Devil's Advocate)
136
+ /golem:plan Create implementation plan (agent team per layer)
137
+ /golem:build Build lead + builders (observable, interruptible)
138
+ /golem:security Run security scans (gitleaks, semgrep, pnpm audit, trivy)
139
+ /golem:review Security + code review (runs security first, then agent team)
138
140
  /golem:simplify Run code simplifier
139
141
  /golem:status Show current status
140
142
  /golem:help Show help
@@ -424,19 +426,30 @@ Files to simplify: $files"
424
426
  }
425
427
 
426
428
  cmd_squash() {
427
- local ticket_id
429
+ local ticket_id message=""
428
430
  ticket_id=$(get_current_ticket)
429
431
  [[ -z "$ticket_id" ]] && die "Not in a ticket worktree"
430
432
 
433
+ # Parse arguments for -m flag
434
+ while [[ $# -gt 0 ]]; do
435
+ case "$1" in
436
+ -m|--message)
437
+ message="$2"
438
+ shift 2
439
+ ;;
440
+ *)
441
+ shift
442
+ ;;
443
+ esac
444
+ done
445
+
431
446
  check_api
432
447
  load_env
433
448
 
434
- # Find current stage commit message from plan
435
449
  if [[ ! -f .golem/IMPLEMENTATION_PLAN.md ]]; then
436
450
  die "No implementation plan found"
437
451
  fi
438
452
 
439
- # Get the commit message for current stage (simplified - just prompt user)
440
453
  echo -e "${BOLD}Squashing commits for $ticket_id${NC}"
441
454
  echo ""
442
455
 
@@ -449,9 +462,12 @@ cmd_squash() {
449
462
  return 0
450
463
  fi
451
464
 
452
- echo ""
453
- read -p "Commit message: " message
454
- [[ -z "$message" ]] && die "Commit message required"
465
+ # If message not provided via flag, prompt interactively
466
+ if [[ -z "$message" ]]; then
467
+ echo ""
468
+ read -p "Commit message: " message
469
+ [[ -z "$message" ]] && die "Commit message required"
470
+ fi
455
471
 
456
472
  info "Squashing..."
457
473
  $GOLEM_API git:squash "$ticket_id" -m "$message"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: golem:build
3
- description: Run autonomous build loop - implement, test, simplify, commit
3
+ description: Run autonomous build loop with observability
4
4
  allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, Task]
5
5
  ---
6
6
 
7
7
  <objective>
8
- Execute the autonomous build loop: select a task, implement it, validate with tests, simplify the code, and commit. Each task gets its own commit. When a stage is complete, all commits in that stage are squashed into one.
8
+ Act as a build lead that orchestrates sequential builder teammates. Each task gets its own builder with fresh context. You coordinate the work, track progress, and handle issues. The user can observe progress and intervene when needed.
9
9
  </objective>
10
10
 
11
11
  <execution_context>
@@ -20,6 +20,7 @@ TICKET_ID=$(basename "$(pwd)" | grep -oE '(INC|SR)-[0-9]+' || echo "")
20
20
  if [ -n "$TICKET_ID" ]; then
21
21
  cat .golem/tickets/$TICKET_ID.yaml 2>/dev/null
22
22
  fi
23
+ echo "TICKET_ID=$TICKET_ID"
23
24
  ```
24
25
 
25
26
  Load specs:
@@ -39,7 +40,11 @@ cat .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "No plan - run /golem:plan
39
40
 
40
41
  Check remaining tasks:
41
42
  ```bash
43
+ echo "Remaining tasks:"
42
44
  grep -c '^\- \[ \]' .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0"
45
+ echo ""
46
+ echo "Completed tasks:"
47
+ grep -c '^\- \[x\]' .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0"
43
48
  ```
44
49
  </context>
45
50
 
@@ -54,117 +59,177 @@ grep -c '^\- \[ \]' .golem/IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0"
54
59
 
55
60
  If missing prerequisites, instruct user to run appropriate command first.
56
61
 
57
- ## Build Loop
62
+ ## Build Lead Role
58
63
 
59
- For each iteration:
64
+ You are the **build lead**. Your job is to:
65
+ - Track overall progress through the implementation plan
66
+ - Spawn builder teammates for each task (one at a time, fresh context)
67
+ - Monitor builder progress and relay status to the user
68
+ - Handle failures and blocked tasks
69
+ - Squash commits when a stage completes
70
+ - Keep the user informed so they can intervene if needed
60
71
 
61
- ### 1. Orient
62
- - Read the current .golem/IMPLEMENTATION_PLAN.md
63
- - Identify current stage and task
64
- - Review relevant specs for context
72
+ You do NOT implement tasks yourself. You delegate to builders.
65
73
 
66
- ### 2. Select Task
67
- - Pick the **first** incomplete task in the current stage
68
- - Skip only if it has unmet dependencies
69
- - Never cherry-pick based on preference
74
+ ## The Build Loop
70
75
 
71
- ### 3. Investigate
72
- - Search relevant source code
73
- - Understand existing patterns
74
- - Identify files to modify
76
+ For each task in the current stage:
75
77
 
76
- ### 4. Implement
77
- - Make changes required for this task ONLY
78
- - Follow existing code patterns and conventions
79
- - Write tests alongside implementation
80
- - Keep changes minimal and focused
78
+ ### 1. Identify Next Task
81
79
 
82
- ### 5. Validate (Backpressure)
83
- Run ALL gates from .golem/AGENTS.md. ALL must pass:
80
+ Read .golem/IMPLEMENTATION_PLAN.md and find the first incomplete task (`- [ ]`).
84
81
 
85
- ```bash
86
- # Run test command
87
- {test_command from .golem/AGENTS.md}
82
+ Announce to the user:
83
+ ```
84
+ === Task {N.M}: {task title} ===
85
+ Files: {expected files}
86
+ Spawning builder...
87
+ ```
88
88
 
89
- # Run typecheck if configured
90
- {typecheck_command from .golem/AGENTS.md}
89
+ ### 2. Spawn Builder Teammate
90
+
91
+ Create a builder teammate for this specific task:
91
92
 
92
- # Run lint if configured
93
- {lint_command from .golem/AGENTS.md}
94
93
  ```
94
+ Spawn a builder teammate with this prompt:
95
95
 
96
- If any gate fails:
97
- - Read the error carefully
98
- - Fix the issue
99
- - Re-run ALL gates from start
100
- - Repeat until all pass
96
+ "You are a builder. Complete this ONE task, then shut down.
101
97
 
102
- ### 6. Simplify
103
- After tests pass, simplify modified files:
98
+ TASK: {task title}
99
+ FILES: {expected files}
100
+ NOTES: {implementation hints from plan}
101
+ TESTS: {what tests verify this}
104
102
 
105
- Use the code-simplifier agent principles:
106
- - Remove unnecessary comments
107
- - Flatten nested conditionals
108
- - Improve variable/function names
109
- - Remove dead code
110
- - **Preserve ALL behavior**
103
+ WORKFLOW:
104
+ 1. Write tests first (red phase)
105
+ 2. Implement minimum code to pass tests (green phase)
106
+ 3. Run validation gates from .golem/AGENTS.md
107
+ 4. If gates fail: fix and retry (up to 3 attempts)
108
+ 5. Simplify code (remove comments, flatten logic, improve names)
109
+ 6. Re-run validation after simplification
110
+ 7. Report back: SUCCESS or BLOCKED with reason
111
111
 
112
- Re-run tests after simplification.
112
+ DO NOT commit. The lead handles commits.
113
+ DO NOT modify the implementation plan. The lead handles that.
113
114
 
114
- ### 7. Update Plan & Commit
115
- Edit `.golem/IMPLEMENTATION_PLAN.md`:
116
- - Change `[ ]` to `[x]` for completed task
115
+ If you get stuck (DB not running, missing dependency, unclear requirement),
116
+ report BLOCKED immediately with a clear explanation. Do not retry forever."
117
117
 
118
- Create task commit:
119
- ```bash
120
- git add -A
121
- git commit -m "wip: {task description} [{TICKET_ID}]"
118
+ Require plan approval before implementation.
122
119
  ```
123
120
 
124
- ### 8. Check Stage Completion
121
+ ### 3. Monitor Builder
122
+
123
+ Watch the builder's progress. The user can see this too.
124
+
125
+ **If builder reports SUCCESS:**
126
+ - Mark task complete in .golem/IMPLEMENTATION_PLAN.md
127
+ - Create atomic commit:
128
+ ```bash
129
+ git add -A
130
+ git commit -m "wip: {brief task description}"
131
+ ```
132
+ - Announce: `✓ Task {N.M} complete`
133
+ - Shut down the builder
134
+ - Continue to next task
135
+
136
+ **If builder reports BLOCKED:**
137
+ - Announce to user:
138
+ ```
139
+ ⚠ Task {N.M} BLOCKED
140
+ Reason: {builder's explanation}
141
+
142
+ Options:
143
+ 1. I can skip this task and continue
144
+ 2. You can provide guidance and I'll retry
145
+ 3. You can fix the issue and tell me to retry
146
+ ```
147
+ - Wait for user input before proceeding
148
+ - Do NOT auto-retry blocked tasks
149
+
150
+ **If builder is struggling (3+ failed attempts):**
151
+ - Message the builder: "What's blocking you?"
152
+ - Relay the answer to the user
153
+ - Ask user how to proceed
154
+
155
+ ### 4. Stage Completion
125
156
 
126
- If current stage is complete (all tasks marked `[x]`):
157
+ When all tasks in a stage are marked `[x]`:
127
158
 
128
- 1. **Squash stage commits** into one clean commit:
159
+ 1. Announce: `=== Stage {N} Complete ===`
160
+
161
+ 2. Squash all wip commits:
129
162
  ```bash
130
- golem-api git:squash $TICKET_ID -m "{stage commit message from plan} [{TICKET_ID}]"
163
+ golem-api git:squash "{TICKET_ID}" -m "{stage commit message from plan}"
131
164
  ```
132
165
 
133
- 2. **Update ticket status** with progress:
166
+ 3. Update ticket status:
134
167
  ```bash
135
- golem-api ticket:status $TICKET_ID in-progress --note "Stage N complete: {stage name}"
168
+ golem-api ticket:status "{TICKET_ID}" in-progress --note "Stage {N} complete: {stage name}"
136
169
  ```
137
170
 
138
- 3. **Update plan** to mark stage complete
171
+ 4. If more stages remain: announce and continue
172
+ 5. If all stages complete: proceed to completion
173
+
174
+ ### 5. Overall Completion
139
175
 
140
- 4. Continue to next stage
176
+ When all stages are complete:
177
+ ```
178
+ === BUILD COMPLETE ===
141
179
 
142
- ### 9. Check Overall Completion
180
+ All {N} stages complete.
181
+ Ticket: {TICKET_ID}
182
+
183
+ Next steps:
184
+ 1. Run /golem:review for code review
185
+ 2. Run golem pr to create pull request
186
+ ```
143
187
 
144
- - If remaining tasks > 0: continue to next iteration
145
- - If all stages complete:
146
- - Update ticket status to "review"
147
- - Announce completion
148
- - Suggest creating PR
149
- - If stuck for 3+ attempts on same task: mark blocked and move on
188
+ Update ticket status to "review".
150
189
 
151
190
  </process>
152
191
 
192
+ <user_controls>
193
+
194
+ The user can intervene at any time:
195
+
196
+ - **"skip"** - Skip the current blocked task, continue to next
197
+ - **"retry"** - Tell the current builder to try again
198
+ - **"stop"** - Stop the build loop, keep progress
199
+ - **"status"** - Show current progress summary
200
+ - **Message the builder directly** - Use Shift+Up/Down to select and message
201
+
202
+ As lead, relay these commands appropriately and keep the user informed.
203
+
204
+ </user_controls>
205
+
153
206
  <success_criteria>
154
- - [ ] Task selected from plan
207
+ For each task:
208
+ - [ ] Builder spawned with fresh context
209
+ - [ ] Tests written first
155
210
  - [ ] Implementation complete
156
- - [ ] All tests passing
211
+ - [ ] All gates passing
157
212
  - [ ] Code simplified
158
- - [ ] Plan updated
159
- - [ ] Task committed
160
- - [ ] Stage squashed when complete
161
- - [ ] Ticket status synced
213
+ - [ ] Atomic commit created
214
+ - [ ] Builder shut down
215
+
216
+ For each stage:
217
+ - [ ] All tasks complete
218
+ - [ ] Commits squashed
219
+ - [ ] Ticket status updated
220
+
221
+ Overall:
222
+ - [ ] User can observe progress
223
+ - [ ] User can intervene when needed
224
+ - [ ] Blocked tasks surfaced immediately
162
225
  </success_criteria>
163
226
 
164
227
  <important>
165
- - Complete ONE task per message, then check if user wants to continue
166
- - Fresh context helps - don't accumulate too much in one session
167
- - Trust the tests - if they pass, implementation is correct
168
- - Each task gets a wip commit, each stage gets squashed
169
- - Keep ticket status updated throughout
228
+ - You are the LEAD, not the implementer - delegate to builders
229
+ - Each builder gets ONE task, then shuts down (fresh context)
230
+ - Surface blockers immediately - don't let builders spin
231
+ - Keep the user informed at every step
232
+ - The user can always intervene - that's the point
233
+ - Builders should NOT commit or modify the plan
234
+ - YOU handle commits, plan updates, and squashing
170
235
  </important>
@@ -11,62 +11,202 @@ Display help information for all golem commands.
11
11
  <response>
12
12
  # Golem - Personal Workflow Manager
13
13
 
14
- Golem integrates Freshworks tickets, Gitea issues, and local development into a unified workflow.
14
+ Golem integrates Freshworks tickets, Gitea issues, and local development into a unified workflow. Uses Claude Code agent teams for collaborative spec/plan/review phases.
15
15
 
16
- ## Claude Code Commands (inside Claude)
16
+ ## Commands
17
17
 
18
18
  | Command | Description |
19
19
  |---------|-------------|
20
- | `/golem:spec` | Define specs through guided conversation |
21
- | `/golem:plan` | Create implementation plan from specs |
22
- | `/golem:build` | Run build loop (implement test → simplify → commit) |
20
+ | `/golem:spec` | Define specs with agent team (UX, Architect, Devil's Advocate) |
21
+ | `/golem:plan` | Create implementation plan with agent team (per-layer + Devil's Advocate) |
22
+ | `/golem:build` | Build lead + sequential builders (observable, interruptible) |
23
+ | `/golem:security` | Run automated security scans (gitleaks, semgrep, pnpm audit, trivy) |
24
+ | `/golem:review` | Security scans + code review agent team |
23
25
  | `/golem:simplify` | Run code simplifier on files |
24
26
  | `/golem:status` | Show current ticket/project status |
25
27
  | `/golem:help` | Show this help |
26
28
 
27
- ## CLI Commands (terminal)
29
+ ---
30
+
31
+ ## Default Workflow
32
+
33
+ ### 1. Setup (CLI)
34
+ ```bash
35
+ golem import INC-1234 # Import ticket from Freshservice
36
+ golem worktree # Create isolated worktree for this ticket
37
+ cd .golem/worktrees/INC-1234 # Enter the worktree
38
+ claude # Start Claude Code
39
+ ```
40
+
41
+ ### 2. Spec Phase (`/golem:spec`)
42
+
43
+ Agent team explores requirements from multiple angles:
44
+
45
+ ```
46
+ You: /golem:spec
47
+
48
+ [Agent team spawns]
49
+ ├── UX Advocate: "Who are the users? What's the simplest solution?"
50
+ ├── Architect: "What's the technical approach? What patterns fit?"
51
+ └── Devil's Advocate: "Do we need this? What's the simpler alternative?"
52
+
53
+ [Team debates and synthesizes]
54
+
55
+ Output:
56
+ ├── .golem/specs/authentication.md
57
+ ├── .golem/specs/validation.md
58
+ └── .golem/AGENTS.md (test/build/lint commands)
59
+ ```
60
+
61
+ ### 3. Plan Phase (`/golem:plan`)
62
+
63
+ Agent team creates staged implementation plan:
64
+
65
+ ```
66
+ You: /golem:plan
67
+
68
+ [Agent team spawns based on project layers]
69
+ ├── Frontend Planner: "Component structure, state management"
70
+ ├── Backend Planner: "API design, business logic"
71
+ ├── Data Planner: "Schema, migrations, queries"
72
+ └── Devil's Advocate: "Too complex? Better patterns?"
73
+
74
+ [Team maps requirements to tasks]
75
+
76
+ Output:
77
+ └── .golem/IMPLEMENTATION_PLAN.md
78
+ ├── Stage 1: Setup (3 tasks) → "feat(auth): add login endpoint"
79
+ ├── Stage 2: Core Logic (5 tasks) → "feat(auth): implement validation"
80
+ └── Stage 3: Integration (2 tasks) → "feat(auth): wire up frontend"
81
+ ```
82
+
83
+ ### 4. Build Phase (`/golem:build`)
84
+
85
+ Lead orchestrates builders, you observe and intervene:
86
+
87
+ ```
88
+ You: /golem:build
89
+
90
+ [Build lead starts]
91
+ === Task 1.1: Create auth service ===
92
+ Spawning builder...
93
+
94
+ [Builder works - you can watch]
95
+ ├── Writing tests (red phase)
96
+ ├── Implementing (green phase)
97
+ ├── Running validation gates
98
+ ├── Simplifying code
99
+ └── Reporting: SUCCESS
28
100
 
101
+ ✓ Task 1.1 complete
102
+ === Task 1.2: Add password validation ===
103
+ Spawning builder...
104
+
105
+ [If something breaks]
106
+ ⚠ Task 1.3 BLOCKED
107
+ Reason: Cannot connect to database
108
+
109
+ Options:
110
+ 1. Skip and continue
111
+ 2. Provide guidance
112
+ 3. Fix and retry
113
+
114
+ You: The DB is on port 5433, not 5432
115
+ [Lead relays to builder, continues]
116
+
117
+ [Stage complete]
118
+ === Stage 1 Complete ===
119
+ Squashing commits...
120
+ ```
121
+
122
+ **Build controls:**
123
+ - `skip` - Skip blocked task
124
+ - `retry` - Retry current task
125
+ - `stop` - Pause build
126
+ - `status` - Show progress
127
+ - `Shift+Up/Down` - Message builder directly
128
+
129
+ ### 5. Review Phase (`/golem:review`)
130
+
131
+ Security scans first, then agent team review:
132
+
133
+ ```
134
+ You: /golem:review
135
+
136
+ [Security gate - automated tools]
137
+ === SECRETS SCAN (gitleaks) ===
138
+ ✓ No secrets detected
139
+
140
+ === SAST SCAN (semgrep) ===
141
+ ✓ 0 findings
142
+
143
+ === DEPENDENCY SCAN (pnpm audit) ===
144
+ ✓ 0 high, 0 critical
145
+
146
+ [Agent team spawns for code review]
147
+ ├── Security Patterns: Auth logic, input validation
148
+ ├── Performance: Query patterns, algorithms
149
+ ├── Correctness: Spec match, edge cases
150
+ ├── Tests: Coverage, quality
151
+ └── Devil's Advocate: Overengineered? Maintainable?
152
+
153
+ [Team reports findings]
154
+
155
+ Output:
156
+ └── .golem/REVIEW_REPORT.md
157
+ ├── Verdict: APPROVED (or BLOCKED)
158
+ ├── 0 critical, 1 major, 3 minor issues
159
+ └── Recommendations for future work
160
+ ```
161
+
162
+ ### 6. Ship (CLI)
29
163
  ```bash
30
- # Ticket Management
31
- golem new "description" # Create new ticket + issue
32
- golem import INC-1234 # Import existing Fresh ticket
33
- golem list # List all tickets
34
- golem status # Show current ticket status
35
-
36
- # Worktree Management
37
- golem worktree # Create worktree for current ticket
38
- golem worktree INC-1234 # Create worktree for specific ticket
39
- golem worktrees # List all worktrees
40
-
41
- # Build Loop
42
- golem build # Run build loop (spawns Claude)
43
- golem plan # Generate plan (spawns Claude)
44
-
45
- # Utilities
46
- golem simplify [files] # Run simplifier
47
- golem sync # Sync ticket status to Fresh/Gitea
164
+ golem pr # Create pull request
165
+ # Review, merge, done
48
166
  ```
49
167
 
50
- ## Typical Workflow
168
+ ---
169
+
170
+ ## Files Generated
51
171
 
52
- 1. **Get a ticket**: `golem import INC-1234` or `golem new "fix api timeout"`
53
- 2. **Create worktree**: `golem worktree`
54
- 3. **Define specs**: `/golem:spec` (in Claude)
55
- 4. **Create plan**: `/golem:plan` (in Claude)
56
- 5. **Build**: `/golem:build` (in Claude) or `golem build` (CLI loop)
57
- 6. **Review**: Create PR, sync status
58
- 7. **Done**: Merge, close ticket
172
+ | File | Created By | Purpose |
173
+ |------|------------|---------|
174
+ | `.golem/specs/*.md` | /golem:spec | Requirements for each topic |
175
+ | `.golem/AGENTS.md` | /golem:spec | Test/build/lint commands |
176
+ | `.golem/IMPLEMENTATION_PLAN.md` | /golem:plan | Staged task list |
177
+ | `.golem/SECURITY_REPORT.md` | /golem:security | Scan results |
178
+ | `.golem/REVIEW_REPORT.md` | /golem:review | Code review findings |
59
179
 
60
- ## Environment Variables
180
+ ---
61
181
 
62
- Set in `~/.golem/.env`:
182
+ ## Agent Teams
183
+
184
+ All phases use a **Devil's Advocate** who:
185
+ - Must articulate WHY something is problematic
186
+ - Must propose a concrete alternative
187
+ - Must back down when concern is addressed
188
+ - Goal: better thinking, not blocking progress
189
+
190
+ ---
191
+
192
+ ## Environment Setup
63
193
 
64
194
  ```bash
195
+ # ~/.golem/.env
65
196
  FRESH_DOMAIN=yourcompany.freshservice.com
66
197
  FRESH_API_KEY=your_api_key
67
- GITEA_URL=https://dev.pearlriverresort.com
198
+ GITEA_URL=https://gitea.example.com
68
199
  GITEA_TOKEN=your_token
69
- GITEA_ORG=CRDE
70
- GITEA_REPO=default-repo
200
+ GITEA_ORG=your-org
201
+ GITEA_REPO=your-repo
202
+ ```
203
+
204
+ ```json
205
+ // Claude Code settings.json - enable agent teams
206
+ {
207
+ "env": {
208
+ "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
209
+ }
210
+ }
71
211
  ```
72
212
  </response>