vibe-forge 0.3.12 → 0.8.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.
Files changed (85) hide show
  1. package/.claude/commands/clear-attention.md +63 -63
  2. package/.claude/commands/compact-context.md +52 -0
  3. package/.claude/commands/configure-vcs.md +102 -0
  4. package/.claude/commands/forge.md +218 -171
  5. package/.claude/commands/need-help.md +77 -77
  6. package/.claude/commands/update-status.md +64 -64
  7. package/.claude/commands/worker-loop.md +106 -106
  8. package/.claude/hooks/worker-loop.js +217 -0
  9. package/.claude/scripts/setup-worker-loop.sh +45 -45
  10. package/.claude/settings.json +89 -0
  11. package/LICENSE +21 -21
  12. package/README.md +253 -230
  13. package/agents/aegis/personality.md +303 -269
  14. package/agents/anvil/personality.md +278 -211
  15. package/agents/architect/personality.md +260 -0
  16. package/agents/crucible/personality.md +362 -285
  17. package/agents/crucible-x/personality.md +210 -0
  18. package/agents/ember/personality.md +293 -245
  19. package/agents/flux/personality.md +248 -0
  20. package/agents/furnace/personality.md +342 -262
  21. package/agents/herald/personality.md +249 -247
  22. package/agents/loki/personality.md +108 -0
  23. package/agents/oracle/personality.md +284 -0
  24. package/agents/pixel/personality.md +140 -0
  25. package/agents/planning-hub/personality.md +473 -251
  26. package/agents/scribe/personality.md +253 -231
  27. package/agents/slag/personality.md +268 -0
  28. package/agents/temper/personality.md +270 -0
  29. package/bin/cli.js +372 -325
  30. package/bin/dashboard/api/agents.js +333 -0
  31. package/bin/dashboard/api/dispatch.js +507 -0
  32. package/bin/dashboard/api/tasks.js +416 -0
  33. package/bin/dashboard/public/assets/index-BpHfsx1r.js +2 -0
  34. package/bin/dashboard/public/assets/index-QODv4Zn9.css +1 -0
  35. package/bin/dashboard/public/index.html +14 -0
  36. package/bin/dashboard/server.js +645 -0
  37. package/bin/forge-daemon.sh +477 -775
  38. package/bin/forge-setup.sh +661 -532
  39. package/bin/forge-spawn.sh +164 -159
  40. package/bin/forge.cmd +83 -83
  41. package/bin/forge.sh +566 -393
  42. package/bin/lib/agents.sh +177 -177
  43. package/bin/lib/check-aliases.js +50 -0
  44. package/bin/lib/colors.sh +44 -44
  45. package/bin/lib/config.sh +347 -271
  46. package/bin/lib/constants.sh +241 -171
  47. package/bin/lib/daemon/budgets.sh +107 -0
  48. package/bin/lib/daemon/dependencies.sh +146 -0
  49. package/bin/lib/daemon/display.sh +128 -0
  50. package/bin/lib/daemon/notifications.sh +273 -0
  51. package/bin/lib/daemon/routing.sh +93 -0
  52. package/bin/lib/daemon/state.sh +163 -0
  53. package/bin/lib/daemon/sync.sh +103 -0
  54. package/bin/lib/database.sh +357 -224
  55. package/bin/lib/frontmatter.js +106 -0
  56. package/bin/lib/heimdall-setup.js +113 -0
  57. package/bin/lib/heimdall.js +265 -0
  58. package/bin/lib/json.sh +264 -0
  59. package/bin/lib/terminal.js +452 -0
  60. package/bin/lib/util.sh +126 -0
  61. package/bin/lib/vcs.js +349 -0
  62. package/config/agent-manifest.yaml +237 -230
  63. package/config/agents.json +207 -85
  64. package/config/task-template.md +159 -87
  65. package/config/task-types.yaml +111 -106
  66. package/config/templates/handoff-template.md +40 -0
  67. package/context/agent-overrides/README.md +41 -0
  68. package/context/architecture.md +42 -0
  69. package/context/modern-conventions.md +129 -129
  70. package/context/project-context-template.md +122 -122
  71. package/docs/agents.md +473 -0
  72. package/docs/architecture.md +194 -0
  73. package/docs/commands.md +451 -0
  74. package/docs/security.md +195 -144
  75. package/package.json +77 -48
  76. package/.claude/hooks/worker-loop.sh +0 -141
  77. package/.claude/settings.local.json +0 -29
  78. package/agents/forge-master/capabilities.md +0 -144
  79. package/agents/forge-master/context-template.md +0 -128
  80. package/agents/forge-master/personality.md +0 -138
  81. package/agents/sentinel/personality.md +0 -194
  82. package/context/forge-state.yaml +0 -19
  83. package/docs/TODO.md +0 -176
  84. package/docs/npm-publishing.md +0 -95
  85. package/tasks/review/task-001.md +0 -78
@@ -0,0 +1,217 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Vibe Forge Worker Loop - Stop Hook (Cross-Platform)
4
+ *
5
+ * Implements the Ralph Loop technique for Vibe Forge workers.
6
+ * When a worker tries to exit, this hook checks if there are pending tasks
7
+ * and feeds the worker prompt back to continue working.
8
+ *
9
+ * Based on the Ralph Loop plugin by Anthropic.
10
+ *
11
+ * Activation modes:
12
+ * 1. Config-based: worker_loop_enabled=true in .forge/config.json
13
+ * 2. Runtime: State file created by /worker-loop command
14
+ */
15
+
16
+ const fs = require('fs');
17
+ const path = require('path');
18
+ const os = require('os');
19
+
20
+ // State file location (runtime toggle)
21
+ const claudeLocalDir = process.env.CLAUDE_LOCAL_DIR || path.join(os.homedir(), '.claude');
22
+ const stateFile = path.join(claudeLocalDir, 'forge-worker-loop.json');
23
+ // SEC-005: Validate FORGE_ROOT to prevent path traversal via attacker-controlled env
24
+ const rawForgeRoot = process.env.FORGE_ROOT || process.cwd();
25
+ const forgeRoot = validateForgeRoot(rawForgeRoot) ? rawForgeRoot : null;
26
+
27
+ function validateForgeRoot(dir) {
28
+ try {
29
+ // Must contain tasks/ and .forge/ (or config/) to be a valid forge project
30
+ const hasTasksDir = fs.existsSync(path.join(dir, 'tasks'));
31
+ const hasForgeDir = fs.existsSync(path.join(dir, '.forge')) || fs.existsSync(path.join(dir, 'config'));
32
+ return hasTasksDir && hasForgeDir;
33
+ } catch (_) {
34
+ return false;
35
+ }
36
+ }
37
+
38
+ // Helper to safely parse JSON
39
+ function safeJsonParse(filePath, defaultValue = {}) {
40
+ try {
41
+ if (fs.existsSync(filePath)) {
42
+ return JSON.parse(fs.readFileSync(filePath, 'utf8'));
43
+ }
44
+ } catch (e) {
45
+ // Ignore parse errors
46
+ }
47
+ return defaultValue;
48
+ }
49
+
50
+ // Helper to count matching files
51
+ function countFiles(dir, pattern = '*.md') {
52
+ try {
53
+ if (!fs.existsSync(dir)) return 0;
54
+ const files = fs.readdirSync(dir);
55
+ return files.filter(f => f.endsWith('.md')).length;
56
+ } catch (e) {
57
+ return 0;
58
+ }
59
+ }
60
+
61
+ // Helper to count files with specific content
62
+ function countFilesWithContent(dir, searchPattern) {
63
+ try {
64
+ if (!fs.existsSync(dir)) return 0;
65
+ const files = fs.readdirSync(dir).filter(f => f.endsWith('.md'));
66
+ let count = 0;
67
+ for (const file of files) {
68
+ try {
69
+ const content = fs.readFileSync(path.join(dir, file), 'utf8');
70
+ if (content.includes(searchPattern)) {
71
+ count++;
72
+ }
73
+ } catch (e) {
74
+ // Skip files we can't read
75
+ }
76
+ }
77
+ return count;
78
+ } catch (e) {
79
+ return 0;
80
+ }
81
+ }
82
+
83
+ // Output result and exit
84
+ function output(result) {
85
+ console.log(JSON.stringify(result));
86
+ process.exit(0);
87
+ }
88
+
89
+ // Main logic
90
+ function main() {
91
+ // SEC-005: Abort safely if forge root is invalid
92
+ if (!forgeRoot) {
93
+ output({ decision: 'allow' });
94
+ return;
95
+ }
96
+
97
+ let loopActive = false;
98
+ let workerAgent = '';
99
+ let maxIdleChecks = 10;
100
+ let idleCount = 0;
101
+ let pollInterval = 5;
102
+
103
+ // Check for runtime state file first (takes precedence)
104
+ if (fs.existsSync(stateFile)) {
105
+ const state = safeJsonParse(stateFile);
106
+ loopActive = true;
107
+ workerAgent = state.agent || '';
108
+ maxIdleChecks = state.max_idle_checks || 10;
109
+ idleCount = state.idle_count || 0;
110
+ pollInterval = state.poll_interval || 5;
111
+ }
112
+
113
+ // If no runtime state, check config-based setting
114
+ if (!loopActive) {
115
+ const configFile = path.join(forgeRoot, '.forge', 'config.json');
116
+ const config = safeJsonParse(configFile);
117
+ if (config.worker_loop_enabled === true) {
118
+ loopActive = true;
119
+ workerAgent = 'any';
120
+ }
121
+ }
122
+
123
+ // Check if worker loop is active
124
+ if (!loopActive) {
125
+ return output({ decision: 'approve' });
126
+ }
127
+
128
+ if (!workerAgent) {
129
+ // Invalid state, clean up and allow exit
130
+ try { fs.unlinkSync(stateFile); } catch (e) {}
131
+ return output({ decision: 'approve' });
132
+ }
133
+
134
+ // Determine tasks directory location
135
+ // When running from vibe-forge repo: tasks are at ./tasks/
136
+ // When running from a project using vibe-forge as submodule: tasks are at ./_vibe-forge/tasks/
137
+ let tasksDir = path.join(forgeRoot, 'tasks');
138
+ if (!fs.existsSync(tasksDir)) {
139
+ // Fall back to submodule location
140
+ tasksDir = path.join(forgeRoot, '_vibe-forge', 'tasks');
141
+ }
142
+
143
+ // Check for pending tasks
144
+ let pendingCount = 0;
145
+ let needsChangesCount = 0;
146
+
147
+ const pendingDir = path.join(tasksDir, 'pending');
148
+ const needsChangesDir = path.join(tasksDir, 'needs-changes');
149
+
150
+ if (workerAgent === 'any') {
151
+ // Config mode: count all tasks
152
+ pendingCount = countFiles(pendingDir);
153
+ needsChangesCount = countFiles(needsChangesDir);
154
+ } else {
155
+ // Runtime mode: count only tasks assigned to specific worker
156
+ const searchPattern = `assigned_to: ${workerAgent}`;
157
+ pendingCount = countFilesWithContent(pendingDir, searchPattern);
158
+ needsChangesCount = countFilesWithContent(needsChangesDir, searchPattern);
159
+ }
160
+
161
+ const totalTasks = pendingCount + needsChangesCount;
162
+
163
+ // Get relative task path for prompts (relative to forgeRoot)
164
+ const relativeTasksPath = path.relative(forgeRoot, tasksDir);
165
+
166
+ if (totalTasks > 0) {
167
+ // Tasks found! Reset idle counter and continue
168
+ if (fs.existsSync(stateFile)) {
169
+ try {
170
+ const state = safeJsonParse(stateFile);
171
+ state.idle_count = 0;
172
+ fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
173
+ } catch (e) {}
174
+ }
175
+
176
+ return output({
177
+ decision: 'block',
178
+ message: `[Forge Loop] Found ${totalTasks} pending task(s). Continuing work...`,
179
+ prompt: `Check ${relativeTasksPath}/pending/ and ${relativeTasksPath}/needs-changes/ for tasks assigned to you and begin working on them immediately.`
180
+ });
181
+ }
182
+
183
+ // No tasks - handle idle state
184
+ if (fs.existsSync(stateFile)) {
185
+ idleCount++;
186
+
187
+ try {
188
+ const state = safeJsonParse(stateFile);
189
+ state.idle_count = idleCount;
190
+ fs.writeFileSync(stateFile, JSON.stringify(state, null, 2));
191
+ } catch (e) {}
192
+
193
+ if (idleCount >= maxIdleChecks) {
194
+ // Max idle checks reached, clean up and allow exit
195
+ try { fs.unlinkSync(stateFile); } catch (e) {}
196
+ return output({
197
+ decision: 'approve',
198
+ message: `[Forge Loop] No tasks found after ${maxIdleChecks} checks. Exiting.`
199
+ });
200
+ }
201
+
202
+ // Still within idle limit - wait and check again
203
+ return output({
204
+ decision: 'block',
205
+ message: `[Forge Loop] No tasks available. Idle check ${idleCount}/${maxIdleChecks}. Waiting...`,
206
+ prompt: `No tasks currently assigned to you. Wait briefly, then check ${relativeTasksPath}/pending/ and ${relativeTasksPath}/needs-changes/ again for new work. If still no tasks, announce you are idle and ready.`
207
+ });
208
+ }
209
+
210
+ // Config-based mode - no idle tracking, just allow exit when no tasks
211
+ return output({
212
+ decision: 'approve',
213
+ message: '[Forge Loop] No pending tasks. Worker exiting.'
214
+ });
215
+ }
216
+
217
+ main();
@@ -1,45 +1,45 @@
1
- #!/usr/bin/env bash
2
- #
3
- # Setup Worker Loop
4
- # Creates state file to enable the worker loop stop hook
5
- #
6
-
7
- set -euo pipefail
8
-
9
- AGENT="${1:-}"
10
- MAX_IDLE="${2:-10}"
11
- STATE_DIR="${CLAUDE_LOCAL_DIR:-$HOME/.claude}"
12
- STATE_FILE="$STATE_DIR/forge-worker-loop.json"
13
-
14
- if [[ "$AGENT" == "stop" ]]; then
15
- if [[ -f "$STATE_FILE" ]]; then
16
- rm -f "$STATE_FILE"
17
- echo "Worker loop stopped."
18
- else
19
- echo "No active worker loop."
20
- fi
21
- exit 0
22
- fi
23
-
24
- if [[ -z "$AGENT" ]]; then
25
- echo "Usage: setup-worker-loop.sh <agent> [max-idle-checks]"
26
- echo " setup-worker-loop.sh stop"
27
- exit 1
28
- fi
29
-
30
- # Ensure state directory exists
31
- mkdir -p "$STATE_DIR"
32
-
33
- # Create state file
34
- cat > "$STATE_FILE" << EOF
35
- {
36
- "agent": "$AGENT",
37
- "max_idle_checks": $MAX_IDLE,
38
- "idle_count": 0,
39
- "poll_interval": 5,
40
- "started_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
41
- }
42
- EOF
43
-
44
- echo "Worker loop started for $AGENT (max idle: $MAX_IDLE checks)"
45
- echo "State file: $STATE_FILE"
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Setup Worker Loop
4
+ # Creates state file to enable the worker loop stop hook
5
+ #
6
+
7
+ set -euo pipefail
8
+
9
+ AGENT="${1:-}"
10
+ MAX_IDLE="${2:-10}"
11
+ STATE_DIR="${CLAUDE_LOCAL_DIR:-$HOME/.claude}"
12
+ STATE_FILE="$STATE_DIR/forge-worker-loop.json"
13
+
14
+ if [[ "$AGENT" == "stop" ]]; then
15
+ if [[ -f "$STATE_FILE" ]]; then
16
+ rm -f "$STATE_FILE"
17
+ echo "Worker loop stopped."
18
+ else
19
+ echo "No active worker loop."
20
+ fi
21
+ exit 0
22
+ fi
23
+
24
+ if [[ -z "$AGENT" ]]; then
25
+ echo "Usage: setup-worker-loop.sh <agent> [max-idle-checks]"
26
+ echo " setup-worker-loop.sh stop"
27
+ exit 1
28
+ fi
29
+
30
+ # Ensure state directory exists
31
+ mkdir -p "$STATE_DIR"
32
+
33
+ # Create state file
34
+ cat > "$STATE_FILE" << EOF
35
+ {
36
+ "agent": "$AGENT",
37
+ "max_idle_checks": $MAX_IDLE,
38
+ "idle_count": 0,
39
+ "poll_interval": 5,
40
+ "started_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
41
+ }
42
+ EOF
43
+
44
+ echo "Worker loop started for $AGENT (max idle: $MAX_IDLE checks)"
45
+ echo "State file: $STATE_FILE"
@@ -0,0 +1,89 @@
1
+ {
2
+ "_comment": "Project-level permissions for Vibe Forge agents. These allow agents to work without --dangerously-skip-permissions while still gating destructive operations.",
3
+ "permissions": {
4
+ "allow": [
5
+ "Read",
6
+ "Edit",
7
+ "Write",
8
+ "Glob",
9
+ "Grep",
10
+ "Bash(ls:*)",
11
+ "Bash(cat:*)",
12
+ "Bash(head:*)",
13
+ "Bash(tail:*)",
14
+ "Bash(wc:*)",
15
+ "Bash(mkdir:*)",
16
+ "Bash(cp:*)",
17
+ "Bash(mv:*)",
18
+ "Bash(node:*)",
19
+ "Bash(npx:*)",
20
+ "Bash(npm test*)",
21
+ "Bash(npm run*)",
22
+ "Bash(npm ci*)",
23
+ "Bash(npm install*)",
24
+ "Bash(npm audit*)",
25
+ "Bash(npm view*)",
26
+ "Bash(npm version*)",
27
+ "Bash(git status*)",
28
+ "Bash(git diff*)",
29
+ "Bash(git log*)",
30
+ "Bash(git branch*)",
31
+ "Bash(git checkout*)",
32
+ "Bash(git switch*)",
33
+ "Bash(git add*)",
34
+ "Bash(git commit*)",
35
+ "Bash(git pull*)",
36
+ "Bash(git push*)",
37
+ "Bash(git rm*)",
38
+ "Bash(git stash*)",
39
+ "Bash(git show*)",
40
+ "Bash(git merge*)",
41
+ "Bash(git rebase*)",
42
+ "Bash(gh pr*)",
43
+ "Bash(gh run*)",
44
+ "Bash(gh repo*)",
45
+ "Bash(gh workflow*)",
46
+ "Bash(gh secret list*)",
47
+ "Bash(sqlite3:*)",
48
+ "Bash(find:*)",
49
+ "Bash(grep:*)",
50
+ "Bash(sed:*)",
51
+ "Bash(awk:*)",
52
+ "Bash(sort:*)",
53
+ "Bash(echo:*)",
54
+ "Bash(printf:*)",
55
+ "Bash(date:*)",
56
+ "Bash(basename:*)",
57
+ "Bash(dirname:*)",
58
+ "Bash(realpath:*)",
59
+ "Bash(which:*)",
60
+ "Bash(command:*)",
61
+ "Bash(sleep:*)",
62
+ "Bash(cd:*)"
63
+ ]
64
+ },
65
+ "hooks": {
66
+ "PreToolUse": [
67
+ {
68
+ "matcher": "Bash",
69
+ "hooks": [
70
+ {
71
+ "type": "command",
72
+ "command": "node bin/lib/heimdall.js"
73
+ }
74
+ ]
75
+ }
76
+ ],
77
+ "Stop": [
78
+ {
79
+ "matcher": "",
80
+ "hooks": [
81
+ {
82
+ "type": "command",
83
+ "command": "node .claude/hooks/worker-loop.js"
84
+ }
85
+ ]
86
+ }
87
+ ]
88
+ }
89
+ }
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 SpasticPalate
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sugar-crash-studios
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.