golem-cc 0.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/README.md +240 -0
- package/bin/golem +555 -0
- package/bin/install.cjs +338 -0
- package/commands/golem/build.md +145 -0
- package/commands/golem/help.md +58 -0
- package/commands/golem/plan.md +125 -0
- package/commands/golem/simplify.md +131 -0
- package/commands/golem/spec.md +159 -0
- package/commands/golem/status.md +89 -0
- package/golem/agents/code-simplifier.md +113 -0
- package/golem/agents/spec-builder.md +152 -0
- package/golem/prompts/PROMPT_build.md +60 -0
- package/golem/prompts/PROMPT_plan.md +84 -0
- package/package.json +31 -0
package/bin/install.cjs
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const readline = require('readline');
|
|
7
|
+
|
|
8
|
+
// Colors
|
|
9
|
+
const cyan = '\x1b[36m';
|
|
10
|
+
const green = '\x1b[32m';
|
|
11
|
+
const yellow = '\x1b[33m';
|
|
12
|
+
const dim = '\x1b[2m';
|
|
13
|
+
const reset = '\x1b[0m';
|
|
14
|
+
|
|
15
|
+
// Get version from package.json
|
|
16
|
+
const pkg = require('../package.json');
|
|
17
|
+
|
|
18
|
+
const banner = `
|
|
19
|
+
${cyan} ██████╗ ██████╗ ██╗ ███████╗███╗ ███╗
|
|
20
|
+
██╔════╝ ██╔═══██╗██║ ██╔════╝████╗ ████║
|
|
21
|
+
██║ ███╗██║ ██║██║ █████╗ ██╔████╔██║
|
|
22
|
+
██║ ██║██║ ██║██║ ██╔══╝ ██║╚██╔╝██║
|
|
23
|
+
╚██████╔╝╚██████╔╝███████╗███████╗██║ ╚═╝ ██║
|
|
24
|
+
╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝${reset}
|
|
25
|
+
|
|
26
|
+
Golem ${dim}v${pkg.version}${reset}
|
|
27
|
+
Autonomous coding loop with Claude
|
|
28
|
+
Structured specs → Ralph loop → Code simplification
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
// Parse args
|
|
32
|
+
const args = process.argv.slice(2);
|
|
33
|
+
const hasGlobal = args.includes('--global') || args.includes('-g');
|
|
34
|
+
const hasLocal = args.includes('--local') || args.includes('-l');
|
|
35
|
+
const hasHelp = args.includes('--help') || args.includes('-h');
|
|
36
|
+
|
|
37
|
+
console.log(banner);
|
|
38
|
+
|
|
39
|
+
// Show help if requested
|
|
40
|
+
if (hasHelp) {
|
|
41
|
+
console.log(` ${yellow}Usage:${reset} npx golem-cc [options]
|
|
42
|
+
|
|
43
|
+
${yellow}Options:${reset}
|
|
44
|
+
${cyan}-g, --global${reset} Install globally (to ~/.claude)
|
|
45
|
+
${cyan}-l, --local${reset} Install locally (to ./.claude in current directory)
|
|
46
|
+
${cyan}-h, --help${reset} Show this help message
|
|
47
|
+
|
|
48
|
+
${yellow}Examples:${reset}
|
|
49
|
+
${dim}# Install to default ~/.claude directory${reset}
|
|
50
|
+
npx golem-cc --global
|
|
51
|
+
|
|
52
|
+
${dim}# Install to current project only${reset}
|
|
53
|
+
npx golem-cc --local
|
|
54
|
+
|
|
55
|
+
${yellow}After Installation:${reset}
|
|
56
|
+
golem Launch Claude Code
|
|
57
|
+
golem --yolo Launch with --dangerously-skip-permissions
|
|
58
|
+
golem --install Install/update golem
|
|
59
|
+
|
|
60
|
+
${yellow}Commands (in Claude):${reset}
|
|
61
|
+
/golem:spec Build project specs through conversation
|
|
62
|
+
/golem:plan Create implementation plan
|
|
63
|
+
/golem:build Run autonomous build loop
|
|
64
|
+
/golem:simplify Simplify code
|
|
65
|
+
/golem:status Show project status
|
|
66
|
+
/golem:help Show all commands
|
|
67
|
+
`);
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Install golem shell alias to user's shell config
|
|
73
|
+
*/
|
|
74
|
+
function installShellAlias() {
|
|
75
|
+
const homeDir = os.homedir();
|
|
76
|
+
|
|
77
|
+
const shellConfigs = [
|
|
78
|
+
{ file: '.zshrc', shell: 'zsh' },
|
|
79
|
+
{ file: '.bashrc', shell: 'bash' },
|
|
80
|
+
{ file: '.bash_profile', shell: 'bash' },
|
|
81
|
+
{ file: '.profile', shell: 'sh' }
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const golemFunction = `
|
|
85
|
+
# Golem - Autonomous coding loop
|
|
86
|
+
# Installed by: npx golem-cc
|
|
87
|
+
golem() {
|
|
88
|
+
local GOLEM_SCRIPT="$HOME/.golem/bin/golem"
|
|
89
|
+
if [[ -f "$GOLEM_SCRIPT" ]]; then
|
|
90
|
+
"$GOLEM_SCRIPT" "$@"
|
|
91
|
+
elif [[ "$1" == "--install" ]]; then
|
|
92
|
+
shift
|
|
93
|
+
npx golem-cc "$@"
|
|
94
|
+
else
|
|
95
|
+
echo "Golem not installed. Run: npx golem-cc --global"
|
|
96
|
+
fi
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
let configPath = null;
|
|
101
|
+
let configName = null;
|
|
102
|
+
|
|
103
|
+
for (const { file } of shellConfigs) {
|
|
104
|
+
const fullPath = path.join(homeDir, file);
|
|
105
|
+
if (fs.existsSync(fullPath)) {
|
|
106
|
+
configPath = fullPath;
|
|
107
|
+
configName = file;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!configPath) {
|
|
113
|
+
const defaultShell = process.env.SHELL || '/bin/zsh';
|
|
114
|
+
if (defaultShell.includes('zsh')) {
|
|
115
|
+
configPath = path.join(homeDir, '.zshrc');
|
|
116
|
+
configName = '.zshrc';
|
|
117
|
+
} else {
|
|
118
|
+
configPath = path.join(homeDir, '.bashrc');
|
|
119
|
+
configName = '.bashrc';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
let content = '';
|
|
125
|
+
if (fs.existsSync(configPath)) {
|
|
126
|
+
content = fs.readFileSync(configPath, 'utf8');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Remove old golem function/alias
|
|
130
|
+
if (content.includes('golem()') || content.includes('# Golem alias')) {
|
|
131
|
+
content = content.replace(/\n# Golem alias for Claude Code\ngolem\(\) \{[\s\S]*?\n\}\n/g, '');
|
|
132
|
+
content = content.replace(/\n# Golem alias.*\nalias golem=.*\n/g, '');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
content = content.trimEnd() + '\n' + golemFunction;
|
|
136
|
+
fs.writeFileSync(configPath, content);
|
|
137
|
+
|
|
138
|
+
console.log(` ${green}✓${reset} Installed golem alias to ~/${configName}`);
|
|
139
|
+
return configName;
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.log(` ${yellow}⚠${reset} Could not install shell alias: ${e.message}`);
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Recursively copy directory, replacing paths in .md files
|
|
148
|
+
*/
|
|
149
|
+
function copyWithPathReplacement(srcDir, destDir, pathPrefix) {
|
|
150
|
+
if (fs.existsSync(destDir)) {
|
|
151
|
+
fs.rmSync(destDir, { recursive: true });
|
|
152
|
+
}
|
|
153
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
154
|
+
|
|
155
|
+
const entries = fs.readdirSync(srcDir, { withFileTypes: true });
|
|
156
|
+
|
|
157
|
+
for (const entry of entries) {
|
|
158
|
+
const srcPath = path.join(srcDir, entry.name);
|
|
159
|
+
const destPath = path.join(destDir, entry.name);
|
|
160
|
+
|
|
161
|
+
if (entry.isDirectory()) {
|
|
162
|
+
copyWithPathReplacement(srcPath, destPath, pathPrefix);
|
|
163
|
+
} else if (entry.name.endsWith('.md')) {
|
|
164
|
+
let content = fs.readFileSync(srcPath, 'utf8');
|
|
165
|
+
content = content.replace(/~\/\.claude\//g, pathPrefix);
|
|
166
|
+
fs.writeFileSync(destPath, content);
|
|
167
|
+
} else {
|
|
168
|
+
fs.copyFileSync(srcPath, destPath);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Verify installation
|
|
175
|
+
*/
|
|
176
|
+
function verifyInstalled(dirPath, description) {
|
|
177
|
+
if (!fs.existsSync(dirPath)) {
|
|
178
|
+
console.error(` ${yellow}✗${reset} Failed to install ${description}`);
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
const entries = fs.readdirSync(dirPath);
|
|
183
|
+
if (entries.length === 0) {
|
|
184
|
+
console.error(` ${yellow}✗${reset} ${description} is empty`);
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
} catch (e) {
|
|
188
|
+
console.error(` ${yellow}✗${reset} Failed: ${e.message}`);
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Install to the specified directory
|
|
196
|
+
*/
|
|
197
|
+
function install(isGlobal) {
|
|
198
|
+
const src = path.join(__dirname, '..');
|
|
199
|
+
const claudeDir = isGlobal
|
|
200
|
+
? path.join(os.homedir(), '.claude')
|
|
201
|
+
: path.join(process.cwd(), '.claude');
|
|
202
|
+
|
|
203
|
+
const golemHomeDir = path.join(os.homedir(), '.golem');
|
|
204
|
+
|
|
205
|
+
const locationLabel = isGlobal
|
|
206
|
+
? '~/.claude'
|
|
207
|
+
: './.claude';
|
|
208
|
+
|
|
209
|
+
const pathPrefix = isGlobal ? '~/.claude/' : './.claude/';
|
|
210
|
+
|
|
211
|
+
console.log(` Installing to ${cyan}${locationLabel}${reset}\n`);
|
|
212
|
+
|
|
213
|
+
const failures = [];
|
|
214
|
+
|
|
215
|
+
// Create directories
|
|
216
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
217
|
+
|
|
218
|
+
// For global install, also install the golem CLI script
|
|
219
|
+
if (isGlobal) {
|
|
220
|
+
const binDir = path.join(golemHomeDir, 'bin');
|
|
221
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
222
|
+
|
|
223
|
+
const golemScriptSrc = path.join(src, 'bin', 'golem');
|
|
224
|
+
const golemScriptDest = path.join(binDir, 'golem');
|
|
225
|
+
|
|
226
|
+
if (fs.existsSync(golemScriptSrc)) {
|
|
227
|
+
fs.copyFileSync(golemScriptSrc, golemScriptDest);
|
|
228
|
+
fs.chmodSync(golemScriptDest, 0o755);
|
|
229
|
+
console.log(` ${green}✓${reset} Installed golem CLI to ~/.golem/bin/`);
|
|
230
|
+
|
|
231
|
+
// Also copy golem directory for the CLI to reference
|
|
232
|
+
const golemDataSrc = path.join(src, 'golem');
|
|
233
|
+
const golemDataDest = path.join(golemHomeDir, 'golem');
|
|
234
|
+
copyWithPathReplacement(golemDataSrc, golemDataDest, pathPrefix);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Copy commands/golem
|
|
239
|
+
const commandsDir = path.join(claudeDir, 'commands');
|
|
240
|
+
fs.mkdirSync(commandsDir, { recursive: true });
|
|
241
|
+
const golemCmdSrc = path.join(src, 'commands', 'golem');
|
|
242
|
+
const golemCmdDest = path.join(commandsDir, 'golem');
|
|
243
|
+
copyWithPathReplacement(golemCmdSrc, golemCmdDest, pathPrefix);
|
|
244
|
+
if (verifyInstalled(golemCmdDest, 'commands/golem')) {
|
|
245
|
+
console.log(` ${green}✓${reset} Installed /golem:* commands`);
|
|
246
|
+
} else {
|
|
247
|
+
failures.push('commands/golem');
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Copy golem directory (prompts, agents)
|
|
251
|
+
const golemSrc = path.join(src, 'golem');
|
|
252
|
+
const golemDest = path.join(claudeDir, 'golem');
|
|
253
|
+
copyWithPathReplacement(golemSrc, golemDest, pathPrefix);
|
|
254
|
+
if (verifyInstalled(golemDest, 'golem')) {
|
|
255
|
+
console.log(` ${green}✓${reset} Installed golem prompts and agents`);
|
|
256
|
+
} else {
|
|
257
|
+
failures.push('golem');
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Write VERSION file
|
|
261
|
+
const versionDest = path.join(claudeDir, 'golem', 'VERSION');
|
|
262
|
+
fs.writeFileSync(versionDest, pkg.version);
|
|
263
|
+
console.log(` ${green}✓${reset} Wrote VERSION (${pkg.version})`);
|
|
264
|
+
|
|
265
|
+
// Install shell alias
|
|
266
|
+
installShellAlias();
|
|
267
|
+
|
|
268
|
+
if (failures.length > 0) {
|
|
269
|
+
console.error(`\n ${yellow}Installation incomplete!${reset} Failed: ${failures.join(', ')}`);
|
|
270
|
+
process.exit(1);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
console.log(`
|
|
274
|
+
${green}Done!${reset}
|
|
275
|
+
|
|
276
|
+
${yellow}Next steps:${reset}
|
|
277
|
+
1. Restart your shell (or run: source ~/.zshrc)
|
|
278
|
+
2. Run ${cyan}golem${reset} to launch Claude Code
|
|
279
|
+
3. Run ${cyan}/golem:help${reset} to see available commands
|
|
280
|
+
|
|
281
|
+
${yellow}Workflow:${reset}
|
|
282
|
+
/golem:spec → Define requirements through conversation
|
|
283
|
+
/golem:plan → Generate implementation plan
|
|
284
|
+
/golem:build → Run autonomous coding loop
|
|
285
|
+
`);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Prompt for install location
|
|
290
|
+
*/
|
|
291
|
+
function promptLocation() {
|
|
292
|
+
if (!process.stdin.isTTY) {
|
|
293
|
+
console.log(` ${yellow}Non-interactive terminal, defaulting to local install${reset}\n`);
|
|
294
|
+
install(false);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const rl = readline.createInterface({
|
|
299
|
+
input: process.stdin,
|
|
300
|
+
output: process.stdout
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
let answered = false;
|
|
304
|
+
|
|
305
|
+
rl.on('close', () => {
|
|
306
|
+
if (!answered) {
|
|
307
|
+
answered = true;
|
|
308
|
+
console.log(`\n ${yellow}Defaulting to local install${reset}\n`);
|
|
309
|
+
install(false);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
console.log(` ${yellow}Where would you like to install?${reset}
|
|
314
|
+
|
|
315
|
+
${cyan}1${reset}) Local ${dim}(./.claude)${reset} - this project only (Recommended)
|
|
316
|
+
${cyan}2${reset}) Global ${dim}(~/.claude)${reset} - available in all projects
|
|
317
|
+
`);
|
|
318
|
+
|
|
319
|
+
rl.question(` Choice ${dim}[1]${reset}: `, (answer) => {
|
|
320
|
+
answered = true;
|
|
321
|
+
rl.close();
|
|
322
|
+
const choice = answer.trim() || '1';
|
|
323
|
+
const isGlobal = choice === '2';
|
|
324
|
+
install(isGlobal);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Main
|
|
329
|
+
if (hasGlobal && hasLocal) {
|
|
330
|
+
console.error(` ${yellow}Cannot specify both --global and --local${reset}`);
|
|
331
|
+
process.exit(1);
|
|
332
|
+
} else if (hasGlobal) {
|
|
333
|
+
install(true);
|
|
334
|
+
} else if (hasLocal) {
|
|
335
|
+
install(false);
|
|
336
|
+
} else {
|
|
337
|
+
promptLocation();
|
|
338
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: golem:build
|
|
3
|
+
description: Run autonomous build loop - implement, test, simplify, commit
|
|
4
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, Task]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Execute the autonomous build loop: select a task, implement it, validate with tests, simplify the code, update the plan, and commit. Repeat until all tasks are complete or user interrupts.
|
|
9
|
+
</objective>
|
|
10
|
+
|
|
11
|
+
<execution_context>
|
|
12
|
+
@~/.claude/golem/prompts/PROMPT_build.md
|
|
13
|
+
@~/.claude/golem/agents/code-simplifier.md
|
|
14
|
+
</execution_context>
|
|
15
|
+
|
|
16
|
+
<context>
|
|
17
|
+
Load specs:
|
|
18
|
+
```bash
|
|
19
|
+
for f in specs/*.md; do echo "=== $f ==="; cat "$f"; echo; done 2>/dev/null
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Load operational guide:
|
|
23
|
+
```bash
|
|
24
|
+
cat AGENTS.md 2>/dev/null || echo "No AGENTS.md - run /golem:spec first"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Load implementation plan:
|
|
28
|
+
```bash
|
|
29
|
+
cat IMPLEMENTATION_PLAN.md 2>/dev/null || echo "No plan - run /golem:plan first"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Check remaining tasks:
|
|
33
|
+
```bash
|
|
34
|
+
grep -c '^\- \[ \]' IMPLEMENTATION_PLAN.md 2>/dev/null || echo "0"
|
|
35
|
+
```
|
|
36
|
+
</context>
|
|
37
|
+
|
|
38
|
+
<process>
|
|
39
|
+
|
|
40
|
+
## Pre-flight Checks
|
|
41
|
+
|
|
42
|
+
1. Verify IMPLEMENTATION_PLAN.md exists
|
|
43
|
+
2. Verify specs/ directory has files
|
|
44
|
+
3. Verify AGENTS.md has test commands
|
|
45
|
+
4. Check for remaining tasks
|
|
46
|
+
|
|
47
|
+
If missing prerequisites, instruct user to run appropriate command first.
|
|
48
|
+
|
|
49
|
+
## Build Loop
|
|
50
|
+
|
|
51
|
+
For each iteration:
|
|
52
|
+
|
|
53
|
+
### 1. Orient
|
|
54
|
+
- Read the current IMPLEMENTATION_PLAN.md
|
|
55
|
+
- Review relevant specs for context
|
|
56
|
+
|
|
57
|
+
### 2. Select Task
|
|
58
|
+
- Pick the **first** incomplete task (marked `[ ]`)
|
|
59
|
+
- Skip only if it has unmet dependencies
|
|
60
|
+
- Never cherry-pick based on preference
|
|
61
|
+
|
|
62
|
+
### 3. Investigate
|
|
63
|
+
- Search relevant source code
|
|
64
|
+
- Understand existing patterns
|
|
65
|
+
- Identify files to modify
|
|
66
|
+
|
|
67
|
+
### 4. Implement
|
|
68
|
+
- Make changes required for this task ONLY
|
|
69
|
+
- Follow existing code patterns and conventions
|
|
70
|
+
- Write tests alongside implementation
|
|
71
|
+
- Keep changes minimal and focused
|
|
72
|
+
|
|
73
|
+
### 5. Validate (Backpressure)
|
|
74
|
+
Run ALL gates from AGENTS.md. ALL must pass:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Run test command
|
|
78
|
+
{test_command from AGENTS.md}
|
|
79
|
+
|
|
80
|
+
# Run typecheck if configured
|
|
81
|
+
{typecheck_command from AGENTS.md}
|
|
82
|
+
|
|
83
|
+
# Run lint if configured
|
|
84
|
+
{lint_command from AGENTS.md}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If any gate fails:
|
|
88
|
+
- Read the error carefully
|
|
89
|
+
- Fix the issue
|
|
90
|
+
- Re-run ALL gates
|
|
91
|
+
- Repeat until all pass
|
|
92
|
+
|
|
93
|
+
### 6. Simplify
|
|
94
|
+
After tests pass, simplify modified files:
|
|
95
|
+
|
|
96
|
+
Use the code-simplifier agent principles:
|
|
97
|
+
- Remove unnecessary comments
|
|
98
|
+
- Flatten nested conditionals
|
|
99
|
+
- Improve variable/function names
|
|
100
|
+
- Remove dead code
|
|
101
|
+
- **Preserve ALL behavior**
|
|
102
|
+
|
|
103
|
+
Then re-run tests to confirm no regressions.
|
|
104
|
+
|
|
105
|
+
### 7. Update Plan
|
|
106
|
+
Edit `IMPLEMENTATION_PLAN.md`:
|
|
107
|
+
- Change `[ ]` to `[x]` for completed task
|
|
108
|
+
- Update status counts
|
|
109
|
+
- Add notes about discoveries
|
|
110
|
+
- Add new tasks if implementation revealed missing work
|
|
111
|
+
|
|
112
|
+
### 8. Commit
|
|
113
|
+
Single commit with clear message:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git add -A
|
|
117
|
+
git commit -m "{type}({scope}): {description}
|
|
118
|
+
|
|
119
|
+
Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Types: feat, fix, test, refactor, docs, chore
|
|
123
|
+
|
|
124
|
+
### 9. Check Completion
|
|
125
|
+
- If remaining tasks > 0: continue to next iteration
|
|
126
|
+
- If all tasks complete: announce completion
|
|
127
|
+
- If stuck for 3+ attempts on same task: mark blocked and move on
|
|
128
|
+
|
|
129
|
+
</process>
|
|
130
|
+
|
|
131
|
+
<success_criteria>
|
|
132
|
+
- [ ] Task selected from plan
|
|
133
|
+
- [ ] Implementation complete
|
|
134
|
+
- [ ] All tests passing
|
|
135
|
+
- [ ] Code simplified
|
|
136
|
+
- [ ] Plan updated
|
|
137
|
+
- [ ] Changes committed
|
|
138
|
+
</success_criteria>
|
|
139
|
+
|
|
140
|
+
<important>
|
|
141
|
+
- Complete ONE task per message, then check if user wants to continue
|
|
142
|
+
- Fresh context helps - don't accumulate too much in one session
|
|
143
|
+
- Trust the tests - if they pass, implementation is correct
|
|
144
|
+
- If stuck, mark task blocked and move on
|
|
145
|
+
</important>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: golem:help
|
|
3
|
+
description: Show all golem commands and usage
|
|
4
|
+
allowed-tools: []
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Display help information for all golem commands.
|
|
9
|
+
</objective>
|
|
10
|
+
|
|
11
|
+
<process>
|
|
12
|
+
Print the following help text:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
╔═══════════════════════════════════════════════════════════════════╗
|
|
16
|
+
║ GOLEM ║
|
|
17
|
+
║ Autonomous Coding Loop with Claude ║
|
|
18
|
+
╚═══════════════════════════════════════════════════════════════════╝
|
|
19
|
+
|
|
20
|
+
WORKFLOW COMMANDS
|
|
21
|
+
|
|
22
|
+
/golem:spec Build project specs through guided conversation
|
|
23
|
+
/golem:plan Create implementation plan from specs
|
|
24
|
+
/golem:build Run autonomous build loop (implement, test, simplify)
|
|
25
|
+
/golem:status Show current project status
|
|
26
|
+
|
|
27
|
+
UTILITY COMMANDS
|
|
28
|
+
|
|
29
|
+
/golem:simplify [path] Run code simplifier on files
|
|
30
|
+
/golem:help Show this help
|
|
31
|
+
|
|
32
|
+
WORKFLOW
|
|
33
|
+
|
|
34
|
+
1. Run /golem:spec to define requirements through conversation
|
|
35
|
+
2. Run /golem:plan to generate IMPLEMENTATION_PLAN.md
|
|
36
|
+
3. Run /golem:build to start the autonomous coding loop
|
|
37
|
+
|
|
38
|
+
Each build iteration:
|
|
39
|
+
• Selects highest-priority task
|
|
40
|
+
• Implements the change
|
|
41
|
+
• Runs tests (backpressure)
|
|
42
|
+
• Simplifies code
|
|
43
|
+
• Commits and loops
|
|
44
|
+
|
|
45
|
+
FILES
|
|
46
|
+
|
|
47
|
+
specs/ Requirement files (one per topic)
|
|
48
|
+
AGENTS.md Operational commands (test, build, lint)
|
|
49
|
+
IMPLEMENTATION_PLAN.md Task list with priorities
|
|
50
|
+
.golem/ Configuration and prompts
|
|
51
|
+
|
|
52
|
+
CLI USAGE
|
|
53
|
+
|
|
54
|
+
golem Launch Claude Code
|
|
55
|
+
golem --yolo Launch with --dangerously-skip-permissions
|
|
56
|
+
golem --install Install/update golem in a project
|
|
57
|
+
```
|
|
58
|
+
</process>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: golem:plan
|
|
3
|
+
description: Create implementation plan from specs
|
|
4
|
+
allowed-tools: [Read, Write, Glob, Grep, Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Analyze specs versus existing code and create/update IMPLEMENTATION_PLAN.md with prioritized tasks.
|
|
9
|
+
</objective>
|
|
10
|
+
|
|
11
|
+
<execution_context>
|
|
12
|
+
@~/.claude/golem/prompts/PROMPT_plan.md
|
|
13
|
+
</execution_context>
|
|
14
|
+
|
|
15
|
+
<context>
|
|
16
|
+
Load all specs:
|
|
17
|
+
```bash
|
|
18
|
+
for f in specs/*.md; do echo "=== $f ==="; cat "$f"; echo; done 2>/dev/null || echo "No specs found - run /golem:spec first"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Load operational guide:
|
|
22
|
+
```bash
|
|
23
|
+
cat AGENTS.md 2>/dev/null || echo "No AGENTS.md found"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Existing plan (if any):
|
|
27
|
+
```bash
|
|
28
|
+
cat IMPLEMENTATION_PLAN.md 2>/dev/null || echo "No existing plan"
|
|
29
|
+
```
|
|
30
|
+
</context>
|
|
31
|
+
|
|
32
|
+
<process>
|
|
33
|
+
|
|
34
|
+
## 1. Read All Specs
|
|
35
|
+
|
|
36
|
+
Read each file in `specs/` completely. Extract:
|
|
37
|
+
- Concrete requirements (must have, should have)
|
|
38
|
+
- Acceptance criteria
|
|
39
|
+
- Technical constraints
|
|
40
|
+
- Dependencies between specs
|
|
41
|
+
|
|
42
|
+
## 2. Analyze Existing Code
|
|
43
|
+
|
|
44
|
+
Search the codebase to understand current state:
|
|
45
|
+
- What's already implemented?
|
|
46
|
+
- Current architecture and patterns
|
|
47
|
+
- Reusable components
|
|
48
|
+
- Technical debt or issues
|
|
49
|
+
|
|
50
|
+
## 3. Gap Analysis
|
|
51
|
+
|
|
52
|
+
For each requirement, determine:
|
|
53
|
+
- **Done**: Already implemented and tested
|
|
54
|
+
- **Partial**: Partially implemented, needs completion
|
|
55
|
+
- **Missing**: Not implemented at all
|
|
56
|
+
- **Blocked**: Depends on something not yet built
|
|
57
|
+
|
|
58
|
+
## 4. Generate Tasks
|
|
59
|
+
|
|
60
|
+
Create atomic, testable tasks:
|
|
61
|
+
- Each task should be completable in one focused session
|
|
62
|
+
- Typically affects 1-3 files
|
|
63
|
+
- Has clear verification criteria
|
|
64
|
+
- Minimal dependencies on other tasks
|
|
65
|
+
|
|
66
|
+
**Bad task**: "Implement authentication"
|
|
67
|
+
**Good task**: "Implement user registration with email/password"
|
|
68
|
+
|
|
69
|
+
## 5. Prioritize
|
|
70
|
+
|
|
71
|
+
Order tasks by:
|
|
72
|
+
1. **Critical path** - What blocks other work?
|
|
73
|
+
2. **Dependencies** - What must be built first?
|
|
74
|
+
3. **Risk** - Tackle unknowns early
|
|
75
|
+
4. **Value** - Higher value tasks before nice-to-haves
|
|
76
|
+
|
|
77
|
+
## 6. Write Plan
|
|
78
|
+
|
|
79
|
+
Create or update `IMPLEMENTATION_PLAN.md`:
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
# Implementation Plan
|
|
83
|
+
|
|
84
|
+
Generated: {ISO timestamp}
|
|
85
|
+
Based on: specs/*.md
|
|
86
|
+
|
|
87
|
+
## Status
|
|
88
|
+
- Total tasks: N
|
|
89
|
+
- Completed: 0
|
|
90
|
+
- Remaining: N
|
|
91
|
+
|
|
92
|
+
## Tasks
|
|
93
|
+
|
|
94
|
+
### [ ] 1. {Task title}
|
|
95
|
+
Priority: Critical|High|Medium|Low
|
|
96
|
+
Files: {expected files to create/modify}
|
|
97
|
+
Notes: {implementation hints, constraints}
|
|
98
|
+
Depends on: {task numbers if any}
|
|
99
|
+
|
|
100
|
+
### [ ] 2. {Next task}
|
|
101
|
+
Priority: High
|
|
102
|
+
Files: {files}
|
|
103
|
+
Notes: {notes}
|
|
104
|
+
|
|
105
|
+
...
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
</process>
|
|
109
|
+
|
|
110
|
+
<success_criteria>
|
|
111
|
+
- [ ] All specs analyzed
|
|
112
|
+
- [ ] Gap analysis completed
|
|
113
|
+
- [ ] Tasks are atomic and testable
|
|
114
|
+
- [ ] Dependencies mapped correctly
|
|
115
|
+
- [ ] IMPLEMENTATION_PLAN.md written
|
|
116
|
+
- [ ] No code changes made (planning only)
|
|
117
|
+
</success_criteria>
|
|
118
|
+
|
|
119
|
+
<important>
|
|
120
|
+
- Do NOT implement anything in planning mode
|
|
121
|
+
- Do NOT modify source code
|
|
122
|
+
- ONLY create/update IMPLEMENTATION_PLAN.md
|
|
123
|
+
- Be thorough - missing tasks cause problems later
|
|
124
|
+
- Tasks should be achievable in one iteration
|
|
125
|
+
</important>
|