@link-assistant/hive-mind 0.39.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/CHANGELOG.md +20 -0
- package/LICENSE +24 -0
- package/README.md +769 -0
- package/package.json +58 -0
- package/src/agent.lib.mjs +705 -0
- package/src/agent.prompts.lib.mjs +196 -0
- package/src/buildUserMention.lib.mjs +71 -0
- package/src/claude-limits.lib.mjs +389 -0
- package/src/claude.lib.mjs +1445 -0
- package/src/claude.prompts.lib.mjs +203 -0
- package/src/codex.lib.mjs +552 -0
- package/src/codex.prompts.lib.mjs +194 -0
- package/src/config.lib.mjs +207 -0
- package/src/contributing-guidelines.lib.mjs +268 -0
- package/src/exit-handler.lib.mjs +205 -0
- package/src/git.lib.mjs +145 -0
- package/src/github-issue-creator.lib.mjs +246 -0
- package/src/github-linking.lib.mjs +152 -0
- package/src/github.batch.lib.mjs +272 -0
- package/src/github.graphql.lib.mjs +258 -0
- package/src/github.lib.mjs +1479 -0
- package/src/hive.config.lib.mjs +254 -0
- package/src/hive.mjs +1500 -0
- package/src/instrument.mjs +191 -0
- package/src/interactive-mode.lib.mjs +1000 -0
- package/src/lenv-reader.lib.mjs +206 -0
- package/src/lib.mjs +490 -0
- package/src/lino.lib.mjs +176 -0
- package/src/local-ci-checks.lib.mjs +324 -0
- package/src/memory-check.mjs +419 -0
- package/src/model-mapping.lib.mjs +145 -0
- package/src/model-validation.lib.mjs +278 -0
- package/src/opencode.lib.mjs +479 -0
- package/src/opencode.prompts.lib.mjs +194 -0
- package/src/protect-branch.mjs +159 -0
- package/src/review.mjs +433 -0
- package/src/reviewers-hive.mjs +643 -0
- package/src/sentry.lib.mjs +284 -0
- package/src/solve.auto-continue.lib.mjs +568 -0
- package/src/solve.auto-pr.lib.mjs +1374 -0
- package/src/solve.branch-errors.lib.mjs +341 -0
- package/src/solve.branch.lib.mjs +230 -0
- package/src/solve.config.lib.mjs +342 -0
- package/src/solve.error-handlers.lib.mjs +256 -0
- package/src/solve.execution.lib.mjs +291 -0
- package/src/solve.feedback.lib.mjs +436 -0
- package/src/solve.mjs +1128 -0
- package/src/solve.preparation.lib.mjs +210 -0
- package/src/solve.repo-setup.lib.mjs +114 -0
- package/src/solve.repository.lib.mjs +961 -0
- package/src/solve.results.lib.mjs +558 -0
- package/src/solve.session.lib.mjs +135 -0
- package/src/solve.validation.lib.mjs +325 -0
- package/src/solve.watch.lib.mjs +572 -0
- package/src/start-screen.mjs +324 -0
- package/src/task.mjs +308 -0
- package/src/telegram-bot.mjs +1481 -0
- package/src/telegram-markdown.lib.mjs +64 -0
- package/src/usage-limit.lib.mjs +218 -0
- package/src/version.lib.mjs +41 -0
- package/src/youtrack/solve.youtrack.lib.mjs +116 -0
- package/src/youtrack/youtrack-sync.mjs +219 -0
- package/src/youtrack/youtrack.lib.mjs +425 -0
package/README.md
ADDED
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
[](https://npmjs.com/@link-assistant/hive-mind)
|
|
2
|
+
[](https://github.com/link-assistant/hive-mind/blob/main/LICENSE)
|
|
3
|
+
[](https://github.com/link-assistant/hive-mind/stargazers)
|
|
4
|
+
|
|
5
|
+
[](https://gitpod.io/#https://github.com/link-assistant/hive-mind)
|
|
6
|
+
[](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=link-assistant/hive-mind)
|
|
7
|
+
|
|
8
|
+
# Hive Mind 🧠
|
|
9
|
+
|
|
10
|
+
**The master mind AI that controls hive of AI.** The orchestrator AI that controls AIs. The HIVE MIND. The SWARM MIND.
|
|
11
|
+
|
|
12
|
+
It is also possible to connect this AI to collective human intelligence, meaning this system can communicate with humans for requirements, expertise, feedback.
|
|
13
|
+
|
|
14
|
+
[](https://github.com/konard/problem-solving)
|
|
15
|
+
|
|
16
|
+
Inspired by [konard/problem-solving](https://github.com/konard/problem-solving)
|
|
17
|
+
|
|
18
|
+
## ⚠️ WARNING
|
|
19
|
+
|
|
20
|
+
It is UNSAFE to run this software on your developer machine.
|
|
21
|
+
|
|
22
|
+
It is recommended to use SEPARATE Ubuntu 24.04 installation (installation script is prepared for you).
|
|
23
|
+
|
|
24
|
+
This software uses full autonomous mode of Claude Code, that means it is free to execute any commands it sees fit.
|
|
25
|
+
|
|
26
|
+
That means it can lead to unexpected side effects.
|
|
27
|
+
|
|
28
|
+
There is also a known issue of space leakage. So you need to make sure you are able to reinstall your virtual machine to clear space and/or any damage to the virtual machine.
|
|
29
|
+
|
|
30
|
+
### ⚠️ CRITICAL: Token and Sensitive Data Security
|
|
31
|
+
|
|
32
|
+
**THIS SOFTWARE CANNOT GUARANTEE ANY SAFETY FOR YOUR TOKENS OR OTHER SENSITIVE DATA ON THE VIRTUAL MACHINE.**
|
|
33
|
+
|
|
34
|
+
There are infinite ways to extract tokens from a virtual machine connected to the internet. This includes but is not limited to:
|
|
35
|
+
|
|
36
|
+
- **Claude MAX tokens** - Required for AI operations
|
|
37
|
+
- **GitHub tokens** - Required for repository access
|
|
38
|
+
- **API keys and credentials** - Any sensitive data on the system
|
|
39
|
+
|
|
40
|
+
**IMPORTANT SECURITY CONSIDERATIONS:**
|
|
41
|
+
|
|
42
|
+
- Running on a developer machine is **ABSOLUTELY UNSAFE**
|
|
43
|
+
- Running on a virtual machine is **LESS UNSAFE** but still has risks
|
|
44
|
+
- Even though your developer machine data isn't directly exposed, the VM still contains sensitive tokens
|
|
45
|
+
- Any token stored on an internet-connected system can potentially be compromised
|
|
46
|
+
|
|
47
|
+
**USE THIS SOFTWARE ENTIRELY AT YOUR OWN RISK AND RESPONSIBILITY.**
|
|
48
|
+
|
|
49
|
+
We strongly recommend:
|
|
50
|
+
- Using dedicated, isolated virtual machines
|
|
51
|
+
- Rotating tokens regularly
|
|
52
|
+
- Monitoring token usage for suspicious activity
|
|
53
|
+
- Never using production tokens or credentials
|
|
54
|
+
- Being prepared to revoke and replace all tokens used with this system
|
|
55
|
+
|
|
56
|
+
Minimum system requirements to run `hive.mjs`:
|
|
57
|
+
```
|
|
58
|
+
1 CPU Core
|
|
59
|
+
1 GB RAM
|
|
60
|
+
> 2 GB SWAP
|
|
61
|
+
50 GB disk space
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 🚀 Quick Start
|
|
65
|
+
|
|
66
|
+
### Global Installation
|
|
67
|
+
|
|
68
|
+
#### Using Bun (Recommended)
|
|
69
|
+
```bash
|
|
70
|
+
bun install -g @link-assistant/hive-mind
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Using Node.js
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g @link-assistant/hive-mind
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Docker Installation
|
|
79
|
+
|
|
80
|
+
Run the Hive Mind using Docker for safer local installation - no manual setup required:
|
|
81
|
+
|
|
82
|
+
**Note:** Docker is much safer for local installation and can be used to install multiple isolated instances on a server or Kubernetes cluster. For Kubernetes deployments, see the [Helm chart installation](#helm-installation-kubernetes) section below.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Pull the latest image from Docker Hub
|
|
86
|
+
docker pull konard/hive-mind:latest
|
|
87
|
+
|
|
88
|
+
# Run an interactive session
|
|
89
|
+
docker run -it konard/hive-mind:latest
|
|
90
|
+
|
|
91
|
+
# IMPORTANT: Authenticate AFTER the Docker image is installed
|
|
92
|
+
# This avoids build timeouts and allows the installation to complete successfully
|
|
93
|
+
|
|
94
|
+
# Inside the container, authenticate with GitHub
|
|
95
|
+
gh auth login -h github.com -s repo,workflow,user,read:org,gist
|
|
96
|
+
|
|
97
|
+
# Setup git using account from gh tool
|
|
98
|
+
USERNAME=$(gh api user --jq '.login')
|
|
99
|
+
EMAIL=$(gh api user/emails --jq '.[] | select(.primary==true) | .email')
|
|
100
|
+
|
|
101
|
+
git config --global user.name "$USERNAME"
|
|
102
|
+
git config --global user.email "$EMAIL"
|
|
103
|
+
|
|
104
|
+
echo "Git configured:"
|
|
105
|
+
git config --global user.name
|
|
106
|
+
git config --global user.email
|
|
107
|
+
|
|
108
|
+
# Authenticate with Claude
|
|
109
|
+
claude
|
|
110
|
+
|
|
111
|
+
# Now you can use hive and solve commands
|
|
112
|
+
solve https://github.com/owner/repo/issues/123
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Benefits of Docker:**
|
|
116
|
+
- ✅ Pre-configured Ubuntu 24.04 environment
|
|
117
|
+
- ✅ All dependencies pre-installed
|
|
118
|
+
- ✅ Isolated from your host system
|
|
119
|
+
- ✅ Easy to run multiple instances with different GitHub accounts
|
|
120
|
+
- ✅ Consistent environment across different machines
|
|
121
|
+
|
|
122
|
+
See [docs/DOCKER.md](./docs/DOCKER.md) for advanced Docker usage.
|
|
123
|
+
|
|
124
|
+
### Helm Installation (Kubernetes)
|
|
125
|
+
|
|
126
|
+
Deploy Hive Mind on Kubernetes using Helm:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Add the Hive Mind Helm repository
|
|
130
|
+
helm repo add link-assistant https://link-assistant.github.io/hive-mind
|
|
131
|
+
helm repo update
|
|
132
|
+
|
|
133
|
+
# Install Hive Mind
|
|
134
|
+
helm install hive-mind link-assistant/hive-mind
|
|
135
|
+
|
|
136
|
+
# Or install with custom values
|
|
137
|
+
helm install hive-mind link-assistant/hive-mind -f values.yaml
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Benefits of Helm:**
|
|
141
|
+
- ✅ Easy deployment to Kubernetes clusters
|
|
142
|
+
- ✅ Declarative configuration management
|
|
143
|
+
- ✅ Simple upgrades and rollbacks
|
|
144
|
+
- ✅ Production-ready with configurable resources
|
|
145
|
+
- ✅ Supports multiple replicas and scaling
|
|
146
|
+
|
|
147
|
+
See [docs/HELM.md](./docs/HELM.md) for detailed Helm configuration options.
|
|
148
|
+
|
|
149
|
+
**Note:** The Helm chart is published to [ArtifactHub](https://artifacthub.io/packages/helm/link-assistant/hive-mind) for easy discovery.
|
|
150
|
+
|
|
151
|
+
### Installation on Ubuntu 24.04 server
|
|
152
|
+
|
|
153
|
+
1. Reset/install VPS/VDS server with fresh Ubuntu 24.04
|
|
154
|
+
2. Login to `root` user.
|
|
155
|
+
3. Execute main installation script
|
|
156
|
+
```bash
|
|
157
|
+
curl -fsSL -o- https://github.com/link-assistant/hive-mind/raw/refs/heads/main/scripts/ubuntu-24-server-install.sh | bash
|
|
158
|
+
```
|
|
159
|
+
**Note:** The installation script will NOT run `gh auth login` automatically. This is intentional to support Docker builds without timeouts. Authentication is performed in the next steps.
|
|
160
|
+
|
|
161
|
+
4. Login to `hive` user
|
|
162
|
+
```bash
|
|
163
|
+
su - hive
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
5. **IMPORTANT:** Authenticate with GitHub CLI AFTER installation is complete
|
|
167
|
+
```bash
|
|
168
|
+
gh auth login -h github.com -s repo,workflow,user,read:org,gist
|
|
169
|
+
|
|
170
|
+
USERNAME=$(gh api user --jq '.login')
|
|
171
|
+
EMAIL=$(gh api user/emails --jq '.[] | select(.primary==true) | .email')
|
|
172
|
+
|
|
173
|
+
git config --global user.name "$USERNAME"
|
|
174
|
+
git config --global user.email "$EMAIL"
|
|
175
|
+
|
|
176
|
+
echo "Git configured:"
|
|
177
|
+
git config --global user.name
|
|
178
|
+
git config --global user.email
|
|
179
|
+
```
|
|
180
|
+
Note: Follow the prompts to authenticate with your GitHub account. This is required for the gh tool to work, and the system will perform all actions using this GitHub account. This step must be done AFTER the installation script completes to avoid build timeouts in Docker environments.
|
|
181
|
+
|
|
182
|
+
6. Claude Code CLI, OpenCode AI CLI, and @link-assistant/agent are preinstalled with the previous script. Now you need to make sure claude is authorized. Execute claude command, and follow all steps to authorize the local claude
|
|
183
|
+
```bash
|
|
184
|
+
claude
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Note: Both opencode and agent come with free Grok Code Fast 1 model by default - so no authorization is required for these tools.
|
|
188
|
+
|
|
189
|
+
7. Launch the Hive Mind telegram bot:
|
|
190
|
+
|
|
191
|
+
**Using Links Notation (recommended):**
|
|
192
|
+
```
|
|
193
|
+
screen -S bot # Enter new screen for bot
|
|
194
|
+
|
|
195
|
+
hive-telegram-bot --configuration "
|
|
196
|
+
TELEGRAM_BOT_TOKEN: '849...355:AAG...rgk_YZk...aPU'
|
|
197
|
+
TELEGRAM_ALLOWED_CHATS:
|
|
198
|
+
-1002975819706
|
|
199
|
+
-1002861722681
|
|
200
|
+
TELEGRAM_HIVE_OVERRIDES:
|
|
201
|
+
--all-issues
|
|
202
|
+
--once
|
|
203
|
+
--skip-issues-with-prs
|
|
204
|
+
--attach-logs
|
|
205
|
+
--verbose
|
|
206
|
+
--no-tool-check
|
|
207
|
+
TELEGRAM_SOLVE_OVERRIDES:
|
|
208
|
+
--attach-logs
|
|
209
|
+
--verbose
|
|
210
|
+
--no-tool-check
|
|
211
|
+
TELEGRAM_BOT_VERBOSE: true
|
|
212
|
+
"
|
|
213
|
+
|
|
214
|
+
# Press CTRL + A + D for detach from screen
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Using individual command-line options:**
|
|
218
|
+
```
|
|
219
|
+
screen -S bot # Enter new screen for bot
|
|
220
|
+
|
|
221
|
+
hive-telegram-bot --token 849...355:AAG...rgk_YZk...aPU --allowed-chats "(
|
|
222
|
+
-1002975819706
|
|
223
|
+
-1002861722681
|
|
224
|
+
)" --hive-overrides "(
|
|
225
|
+
--all-issues
|
|
226
|
+
--once
|
|
227
|
+
--skip-issues-with-prs
|
|
228
|
+
--attach-logs
|
|
229
|
+
--verbose
|
|
230
|
+
--no-tool-check
|
|
231
|
+
)" --solve-overrides "(
|
|
232
|
+
--attach-logs
|
|
233
|
+
--verbose
|
|
234
|
+
--no-tool-check
|
|
235
|
+
)" --verbose
|
|
236
|
+
|
|
237
|
+
# Press CTRL + A + D for detach from screen
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Note: You may need to register you own bot with https://t.me/BotFather to get the bot token.
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
#### Codex sign-in
|
|
244
|
+
|
|
245
|
+
1. Connect to your instance of VPS with Hive Mind installed, using SSH with tunnel opened
|
|
246
|
+
```bash
|
|
247
|
+
ssh -L 1455:localhost:1455 root@123.123.123.123
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
2. Start codex login oAuth server:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
codex login
|
|
254
|
+
```
|
|
255
|
+
The oAuth callback server on 1455 port will be started, and the link to oAuth will be printed, copy the link.
|
|
256
|
+
|
|
257
|
+
3. Use your browser on machine where you started the tunnel from, paste there the link from `codex login` command, and go there using your browser. Once redirected to localhost:1455 you will see successful login page, and in `codex login` you will see `Successfully logged in`. After that `codex login` command will complete, and you can use `codex` command as usual to verify. It should also be working with `--tool codex` in `solve` and `hive` commands.
|
|
258
|
+
|
|
259
|
+
### Core Operations
|
|
260
|
+
```bash
|
|
261
|
+
# Solve using maximum power
|
|
262
|
+
solve https://github.com/Veronika89-lang/index.html/issues/1 --auto-continue --attach-logs --verbose --model opus --auto-fork --think max
|
|
263
|
+
|
|
264
|
+
# Solve GitHub issues automatically (auto-fork if no write access)
|
|
265
|
+
solve https://github.com/owner/repo/issues/123 --auto-fork --model sonnet
|
|
266
|
+
|
|
267
|
+
# Solve issue with PR to custom branch (manual fork mode)
|
|
268
|
+
solve https://github.com/owner/repo/issues/123 --base-branch develop --fork
|
|
269
|
+
|
|
270
|
+
# Continue working on existing PR
|
|
271
|
+
solve https://github.com/owner/repo/pull/456 --model opus
|
|
272
|
+
|
|
273
|
+
# Resume from Claude session when limit is reached
|
|
274
|
+
solve https://github.com/owner/repo/issues/123 --resume session-id
|
|
275
|
+
|
|
276
|
+
# Start hive orchestration (monitor and solve issues automatically)
|
|
277
|
+
hive https://github.com/owner/repo --monitor-tag "help wanted" --concurrency 3
|
|
278
|
+
|
|
279
|
+
# Monitor all issues in organization with auto-fork
|
|
280
|
+
hive https://github.com/microsoft --all-issues --max-issues 10 --auto-fork
|
|
281
|
+
|
|
282
|
+
# Run collaborative review process
|
|
283
|
+
review --repo owner/repo --pr 456
|
|
284
|
+
|
|
285
|
+
# Multiple AI reviewers for consensus
|
|
286
|
+
./reviewers-hive.mjs --agents 3 --consensus-threshold 0.8
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## 📋 Core Components
|
|
290
|
+
|
|
291
|
+
| Script | Purpose | Key Features |
|
|
292
|
+
|--------|---------|--------------|
|
|
293
|
+
| `solve.mjs` (stable) | GitHub issue solver | Auto fork, branch creation, PR generation, resume sessions, fork support |
|
|
294
|
+
| `hive.mjs` (stable) | AI orchestration & monitoring | Multi-repo monitoring, concurrent workers, issue queue management |
|
|
295
|
+
| `review.mjs` (alpha) | Code review automation | Collaborative AI reviews, automated feedback |
|
|
296
|
+
| `reviewers-hive.mjs` (alpha / experimental) | Review team management | Multi-agent consensus, reviewer assignment |
|
|
297
|
+
| `telegram-bot.mjs` (stable) | Telegram bot interface | Remote command execution, group chat support, diagnostic tools |
|
|
298
|
+
|
|
299
|
+
## 🔧 solve Options
|
|
300
|
+
```bash
|
|
301
|
+
solve <issue-url> [options]
|
|
302
|
+
|
|
303
|
+
--model, -m Model (sonnet, opus for claude; grok-code-fast-1, gpt4o for opencode; gpt5, gpt5-codex, o3 for codex; grok, sonnet, haiku for agent)
|
|
304
|
+
[default: sonnet for claude, grok-code-fast-1 for opencode, gpt-5 for codex, grok-code-fast-1 for agent]
|
|
305
|
+
--tool AI tool (claude, opencode, codex, agent) [default: claude]
|
|
306
|
+
--fork, -f Fork repo if no write access [default: false]
|
|
307
|
+
--auto-fork Automatically fork public repos without write access (fails for private)
|
|
308
|
+
[default: false]
|
|
309
|
+
--base-branch, -b Target branch for PR [default: repo default]
|
|
310
|
+
--resume, -r Resume from session ID
|
|
311
|
+
--verbose, -v Enable verbose logging [default: false]
|
|
312
|
+
--dry-run, -n Prepare only, don't execute [default: false]
|
|
313
|
+
--only-prepare-command Only prepare and print the command [default: false]
|
|
314
|
+
--skip-tool-check Skip tool connection check (use --no-tool-check to disable)
|
|
315
|
+
[default: false]
|
|
316
|
+
--auto-pull-request-creation Create draft PR before execution [default: true]
|
|
317
|
+
--attach-logs Attach logs to PR (⚠️ sensitive) [default: false]
|
|
318
|
+
--auto-close-pull-request-on-fail Close PR on fail [default: false]
|
|
319
|
+
--auto-continue Continue with existing PR when issue URL is provided
|
|
320
|
+
[default: false]
|
|
321
|
+
--auto-continue-limit, -c Auto-continue when limit resets [default: false]
|
|
322
|
+
--auto-resume-on-errors Auto-resume on network errors (503, etc.)
|
|
323
|
+
[default: false]
|
|
324
|
+
--auto-continue-only-on-new-comments Fail if no new comments
|
|
325
|
+
[default: false]
|
|
326
|
+
--auto-commit-uncommitted-changes Auto-commit changes [default: false]
|
|
327
|
+
--auto-merge-default-branch-to-pull-request-branch Merge default branch to PR branch
|
|
328
|
+
(only in continue mode) [default: false]
|
|
329
|
+
--allow-fork-divergence-resolution-using-force-push-with-lease
|
|
330
|
+
Allow force-push with --force-with-lease when fork diverges
|
|
331
|
+
(DANGEROUS: can overwrite fork history) [default: false]
|
|
332
|
+
--prefix-fork-name-with-owner-name Prefix fork name with owner (owner-repo)
|
|
333
|
+
Useful for forking repos with same name from different owners
|
|
334
|
+
[default: true]
|
|
335
|
+
--continue-only-on-feedback Only continue if feedback detected
|
|
336
|
+
[default: false]
|
|
337
|
+
--watch, -w Monitor for feedback and auto-restart [default: false]
|
|
338
|
+
--watch-interval Feedback check interval (seconds) [default: 60]
|
|
339
|
+
--min-disk-space Minimum disk space in MB [default: 500]
|
|
340
|
+
--log-dir, -l Directory for log files [default: cwd]
|
|
341
|
+
--think Thinking level (low, medium, high, max) [optional]
|
|
342
|
+
--sentry Enable Sentry error tracking (use --no-sentry to disable)
|
|
343
|
+
[default: true]
|
|
344
|
+
--auto-cleanup Delete temp directory on completion
|
|
345
|
+
[default: true for private repos, false for public repos]
|
|
346
|
+
--version Show version number
|
|
347
|
+
--help, -h Show help
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## 🔧 hive Options
|
|
351
|
+
```bash
|
|
352
|
+
hive <github-url> [options]
|
|
353
|
+
|
|
354
|
+
--monitor-tag, -t Label to monitor [default: "help wanted"]
|
|
355
|
+
--all-issues, -a Monitor all issues (ignore labels) [default: false]
|
|
356
|
+
--skip-issues-with-prs, -s Skip issues with existing PRs [default: false]
|
|
357
|
+
--concurrency, -c Parallel workers [default: 2]
|
|
358
|
+
--pull-requests-per-issue, -p Number of PRs per issue [default: 1]
|
|
359
|
+
--model, -m Model (opus, sonnet for claude; grok-code-fast-1, gpt4o for opencode; gpt5, gpt5-codex, o3 for codex; grok, sonnet, haiku for agent)
|
|
360
|
+
[default: sonnet for claude, grok-code-fast-1 for opencode, gpt-5 for codex, grok-code-fast-1 for agent]
|
|
361
|
+
--tool AI tool (claude, opencode, codex, agent) [default: claude]
|
|
362
|
+
--interval, -i Poll interval (seconds) [default: 300]
|
|
363
|
+
--max-issues Limit processed issues [default: 0 (unlimited)]
|
|
364
|
+
--once Single run (don't monitor) [default: false]
|
|
365
|
+
--dry-run List issues without processing [default: false]
|
|
366
|
+
--skip-tool-check Skip tool connection check (use --no-tool-check to disable)
|
|
367
|
+
[default: false]
|
|
368
|
+
--verbose, -v Enable verbose logging [default: false]
|
|
369
|
+
--min-disk-space Minimum disk space in MB [default: 500]
|
|
370
|
+
--auto-cleanup Clean /tmp/* /var/tmp/* on success [default: false]
|
|
371
|
+
--fork, -f Fork repos if no write access [default: false]
|
|
372
|
+
--auto-fork Automatically fork public repos without write access
|
|
373
|
+
[default: false]
|
|
374
|
+
--attach-logs Attach logs to PRs (⚠️ sensitive) [default: false]
|
|
375
|
+
--project-number, -pn GitHub Project number to monitor
|
|
376
|
+
--project-owner, -po GitHub Project owner (org or user)
|
|
377
|
+
--project-status, -ps Project status column to monitor [default: "Ready"]
|
|
378
|
+
--project-mode, -pm Enable project-based monitoring [default: false]
|
|
379
|
+
--youtrack-mode Enable YouTrack mode instead of GitHub [default: false]
|
|
380
|
+
--youtrack-stage Override YouTrack stage to monitor
|
|
381
|
+
--youtrack-project Override YouTrack project code
|
|
382
|
+
--target-branch, -tb Target branch for pull requests [default: repo default]
|
|
383
|
+
--log-dir, -l Directory for log files [default: cwd]
|
|
384
|
+
--auto-continue Pass --auto-continue to solve for each issue
|
|
385
|
+
[default: false]
|
|
386
|
+
--think Thinking level (low, medium, high, max) [optional]
|
|
387
|
+
--sentry Enable Sentry error tracking (use --no-sentry to disable)
|
|
388
|
+
[default: true]
|
|
389
|
+
--watch, -w Monitor for feedback and auto-restart [default: false]
|
|
390
|
+
--issue-order, -o Order issues by date (asc, desc) [default: asc]
|
|
391
|
+
--version Show version number
|
|
392
|
+
--help, -h Show help
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## 🤖 Telegram Bot
|
|
396
|
+
|
|
397
|
+
The Hive Mind includes a Telegram bot interface (SwarmMindBot) for remote command execution.
|
|
398
|
+
|
|
399
|
+
### 🚀 Test Drive
|
|
400
|
+
|
|
401
|
+
Want to see the Hive Mind in action? Join our Telegram channel where you can execute the Hive Mind on your own issues and watch AI solve them:
|
|
402
|
+
|
|
403
|
+
**[Join https://t.me/hive_mind_pull_requests](https://t.me/hive_mind_pull_requests)**
|
|
404
|
+
|
|
405
|
+
### Setup
|
|
406
|
+
|
|
407
|
+
1. **Get Bot Token**
|
|
408
|
+
- Talk to [@BotFather](https://t.me/BotFather) on Telegram
|
|
409
|
+
- Create a new bot and get your token
|
|
410
|
+
- Add the bot to your group chat and make it an admin
|
|
411
|
+
|
|
412
|
+
2. **Configure Environment**
|
|
413
|
+
```bash
|
|
414
|
+
# Copy the example configuration
|
|
415
|
+
cp .env.example .env
|
|
416
|
+
|
|
417
|
+
# Edit and add your bot token
|
|
418
|
+
echo "TELEGRAM_BOT_TOKEN=your_bot_token_here" >> .env
|
|
419
|
+
|
|
420
|
+
# Optional: Restrict to specific chats
|
|
421
|
+
# Get chat ID using /help command, then add:
|
|
422
|
+
echo "TELEGRAM_ALLOWED_CHATS=123456789,987654321" >> .env
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
3. **Start the Bot**
|
|
426
|
+
```bash
|
|
427
|
+
hive-telegram-bot
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### Bot Commands
|
|
431
|
+
|
|
432
|
+
All commands work in **group chats only** (not in private messages with the bot):
|
|
433
|
+
|
|
434
|
+
#### `/solve` - Solve GitHub Issues
|
|
435
|
+
```
|
|
436
|
+
/solve <github-url> [options]
|
|
437
|
+
|
|
438
|
+
Examples:
|
|
439
|
+
/solve https://github.com/owner/repo/issues/123
|
|
440
|
+
/solve https://github.com/owner/repo/issues/123 --auto-fork --verbose
|
|
441
|
+
/solve https://github.com/owner/repo/issues/123 --auto-fork --auto-continue --attach-logs --verbose --model sonnet --think max
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
#### `/hive` - Run Hive Orchestration
|
|
445
|
+
```
|
|
446
|
+
/hive <github-url> [options]
|
|
447
|
+
|
|
448
|
+
Examples:
|
|
449
|
+
/hive https://github.com/owner/repo
|
|
450
|
+
/hive https://github.com/owner/repo --all-issues --max-issues 10
|
|
451
|
+
/hive https://github.com/microsoft --all-issues --concurrency 3
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
#### `/help` - Get Help and Diagnostic Info
|
|
455
|
+
```
|
|
456
|
+
/help
|
|
457
|
+
|
|
458
|
+
Shows:
|
|
459
|
+
- Chat ID (needed for TELEGRAM_ALLOWED_CHATS)
|
|
460
|
+
- Chat type
|
|
461
|
+
- Available commands
|
|
462
|
+
- Usage examples
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Features
|
|
466
|
+
|
|
467
|
+
- ✅ **Group Chat Only**: Commands work only in group chats (not private messages)
|
|
468
|
+
- ✅ **Full Options Support**: All command-line options work in Telegram
|
|
469
|
+
- ✅ **Screen Sessions**: Commands run in detached screen sessions
|
|
470
|
+
- ✅ **Chat Restrictions**: Optional whitelist of allowed chat IDs
|
|
471
|
+
- ✅ **Diagnostic Tools**: Get chat ID and configuration info
|
|
472
|
+
|
|
473
|
+
### Security Notes
|
|
474
|
+
|
|
475
|
+
- Only works in group chats where the bot is admin
|
|
476
|
+
- Optional chat ID restrictions via `TELEGRAM_ALLOWED_CHATS`
|
|
477
|
+
- Commands run as the system user running the bot
|
|
478
|
+
- Ensure proper authentication (`gh auth login`, `claude-profiles`)
|
|
479
|
+
|
|
480
|
+
## 🏗️ Architecture
|
|
481
|
+
|
|
482
|
+
The Hive Mind operates on three layers:
|
|
483
|
+
|
|
484
|
+
1. **Orchestration Layer** (`hive.mjs`) - Coordinates multiple AI agents
|
|
485
|
+
2. **Execution Layer** (`solve.mjs`, `review.mjs`) - Performs specific tasks
|
|
486
|
+
3. **Human Interface Layer** - Enables human-AI collaboration
|
|
487
|
+
|
|
488
|
+
### Data Flow
|
|
489
|
+
|
|
490
|
+
#### Mode 1: Issue → Pull Request Flow
|
|
491
|
+
```mermaid
|
|
492
|
+
sequenceDiagram
|
|
493
|
+
participant H as Human
|
|
494
|
+
participant GH as GitHub
|
|
495
|
+
participant AI as AI Agent
|
|
496
|
+
participant HM as Hive Mind
|
|
497
|
+
|
|
498
|
+
H->>GH: Creates Issue
|
|
499
|
+
Note over H,GH: Primary human input
|
|
500
|
+
|
|
501
|
+
GH->>HM: Issue Available
|
|
502
|
+
HM->>AI: Assigns Issue
|
|
503
|
+
AI->>GH: Analyzes Issue
|
|
504
|
+
AI->>AI: Develops Solution
|
|
505
|
+
AI->>GH: Creates Draft PR
|
|
506
|
+
|
|
507
|
+
Note over H,GH: Human decision point
|
|
508
|
+
GH->>H: Notifies PR Created
|
|
509
|
+
H->>GH: Reviews PR
|
|
510
|
+
|
|
511
|
+
alt Approve & Merge
|
|
512
|
+
H->>GH: Merges PR
|
|
513
|
+
GH->>HM: PR Merged
|
|
514
|
+
else Request Changes
|
|
515
|
+
H->>GH: Adds Comments
|
|
516
|
+
Note over H,GH: Secondary human input
|
|
517
|
+
GH->>HM: Comments Added
|
|
518
|
+
HM->>AI: Process Feedback
|
|
519
|
+
AI->>GH: Updates PR
|
|
520
|
+
else Close PR
|
|
521
|
+
H->>GH: Closes PR
|
|
522
|
+
GH->>HM: PR Closed
|
|
523
|
+
end
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
#### Mode 2: Pull Request → Comments Flow
|
|
527
|
+
```mermaid
|
|
528
|
+
sequenceDiagram
|
|
529
|
+
participant H as Human
|
|
530
|
+
participant GH as GitHub
|
|
531
|
+
participant AI as AI Agent
|
|
532
|
+
participant HM as Hive Mind
|
|
533
|
+
|
|
534
|
+
Note over GH: Existing PR
|
|
535
|
+
H->>GH: Adds Comment
|
|
536
|
+
Note over H,GH: Primary human input
|
|
537
|
+
|
|
538
|
+
GH->>HM: New Comment Available
|
|
539
|
+
HM->>AI: Processes Comment
|
|
540
|
+
AI->>GH: Analyzes Feedback
|
|
541
|
+
AI->>AI: Updates Solution
|
|
542
|
+
AI->>GH: Pushes Changes
|
|
543
|
+
|
|
544
|
+
Note over H,GH: Human decision point
|
|
545
|
+
GH->>H: Notifies Changes
|
|
546
|
+
H->>GH: Reviews Updates
|
|
547
|
+
|
|
548
|
+
alt Approve & Merge
|
|
549
|
+
H->>GH: Merges PR
|
|
550
|
+
GH->>HM: PR Merged
|
|
551
|
+
else More Changes Needed
|
|
552
|
+
H->>GH: Adds More Comments
|
|
553
|
+
Note over H,GH: Continued human input
|
|
554
|
+
GH->>HM: Comments Added
|
|
555
|
+
else Close PR
|
|
556
|
+
H->>GH: Closes PR
|
|
557
|
+
GH->>HM: PR Closed
|
|
558
|
+
end
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
📖 **For comprehensive data flow documentation including human feedback integration points, see [docs/flow.md](./docs/flow.md)**
|
|
562
|
+
|
|
563
|
+
## 📊 Usage Examples
|
|
564
|
+
|
|
565
|
+
### Automated Issue Resolution
|
|
566
|
+
```bash
|
|
567
|
+
# Auto-fork and solve issue (automatic fork detection for public repos)
|
|
568
|
+
solve https://github.com/owner/repo/issues/123 --auto-fork --model opus
|
|
569
|
+
|
|
570
|
+
# Manual fork and solve issue (works for both public and private repos)
|
|
571
|
+
solve https://github.com/owner/repo/issues/123 --fork --model opus
|
|
572
|
+
|
|
573
|
+
# Continue work on existing PR
|
|
574
|
+
solve https://github.com/owner/repo/pull/456 --verbose
|
|
575
|
+
|
|
576
|
+
# Solve with detailed logging and solution attachment
|
|
577
|
+
solve https://github.com/owner/repo/issues/123 --verbose --attach-logs
|
|
578
|
+
|
|
579
|
+
# Dry run to see what would happen
|
|
580
|
+
solve https://github.com/owner/repo/issues/123 --dry-run
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### Multi-Repository Orchestration
|
|
584
|
+
```bash
|
|
585
|
+
# Monitor single repository with specific label
|
|
586
|
+
hive https://github.com/owner/repo --monitor-tag "bug" --concurrency 4
|
|
587
|
+
|
|
588
|
+
# Monitor all issues in an organization with auto-fork
|
|
589
|
+
hive https://github.com/microsoft --all-issues --max-issues 20 --once --auto-fork
|
|
590
|
+
|
|
591
|
+
# Monitor user repositories with high concurrency
|
|
592
|
+
hive https://github.com/username --all-issues --concurrency 8 --interval 120 --auto-fork
|
|
593
|
+
|
|
594
|
+
# Skip issues that already have PRs
|
|
595
|
+
hive https://github.com/org/repo --skip-issues-with-prs --verbose
|
|
596
|
+
|
|
597
|
+
# Auto-cleanup temporary files and auto-fork if needed
|
|
598
|
+
hive https://github.com/org/repo --auto-cleanup --auto-fork --concurrency 5
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### Session Management
|
|
602
|
+
```bash
|
|
603
|
+
# Resume when Claude hits limit
|
|
604
|
+
solve https://github.com/owner/repo/issues/123 --resume 657e6db1-6eb3-4a8d
|
|
605
|
+
|
|
606
|
+
# Continue session interactively in Claude Code
|
|
607
|
+
(cd /tmp/gh-issue-solver-123456789 && claude --resume session-id)
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
## 🔍 Monitoring & Logging
|
|
611
|
+
|
|
612
|
+
Find resume commands in logs:
|
|
613
|
+
```bash
|
|
614
|
+
grep -E '\(cd /tmp/gh-issue-solver-[0-9]+ && claude --resume [0-9a-f-]{36}\)' hive-*.log
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
## 🔧 Configuration
|
|
618
|
+
|
|
619
|
+
Authentication is handled through:
|
|
620
|
+
- `gh auth login` - GitHub CLI authentication
|
|
621
|
+
- `claude-profiles` - Claude authentication profile migration to server
|
|
622
|
+
|
|
623
|
+
No environment variable configuration is currently supported.
|
|
624
|
+
|
|
625
|
+
## 🐛 Reporting Issues
|
|
626
|
+
|
|
627
|
+
### Hive Mind Issues
|
|
628
|
+
If you encounter issues with **Hive Mind** (this project), please report them on our GitHub Issues page:
|
|
629
|
+
- **Repository**: https://github.com/link-assistant/hive-mind
|
|
630
|
+
- **Issues**: https://github.com/link-assistant/hive-mind/issues
|
|
631
|
+
|
|
632
|
+
### Claude Code CLI Issues
|
|
633
|
+
If you encounter issues with the **Claude Code CLI** itself (e.g., `claude` command errors, installation problems, or CLI bugs), please report them to the official Claude Code repository:
|
|
634
|
+
- **Repository**: https://github.com/anthropics/claude-code
|
|
635
|
+
- **Issues**: https://github.com/anthropics/claude-code/issues
|
|
636
|
+
|
|
637
|
+
## 🛡️ File Size Enforcement
|
|
638
|
+
|
|
639
|
+
All documentation files are automatically checked:
|
|
640
|
+
```bash
|
|
641
|
+
find docs/ -name "*.md" -exec wc -l {} + | awk '$1 > 1000 {print "ERROR: " $2 " has " $1 " lines (max 1000)"}'
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
## Server diagnostics
|
|
645
|
+
|
|
646
|
+
Identify screens that are parents of processes that eating the resources
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
TARGETS="62220 65988 63094 66606 1028071 4127023"
|
|
650
|
+
|
|
651
|
+
# build screen PID -> session name map
|
|
652
|
+
declare -A NAME
|
|
653
|
+
while read -r id; do spid=${id%%.*}; NAME[$spid]="$id"; done \
|
|
654
|
+
< <(screen -ls | awk '/(Detached|Attached)/{print $1}')
|
|
655
|
+
|
|
656
|
+
# check each PID's environment for STY and map back to session
|
|
657
|
+
for p in $TARGETS; do
|
|
658
|
+
sty=$(tr '\0' '\n' < /proc/$p/environ 2>/dev/null | awk -F= '$1=="STY"{print $2}')
|
|
659
|
+
if [ -n "$sty" ]; then
|
|
660
|
+
spid=${sty%%.*}
|
|
661
|
+
echo "$p -> ${NAME[$spid]:-$sty}"
|
|
662
|
+
else
|
|
663
|
+
echo "$p -> (no STY; not from screen or env cleared / double-forked)"
|
|
664
|
+
fi
|
|
665
|
+
done
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
Show details about the proccess
|
|
669
|
+
|
|
670
|
+
```bash
|
|
671
|
+
procinfo() {
|
|
672
|
+
local pid=$1
|
|
673
|
+
if [ -z "$pid" ]; then
|
|
674
|
+
echo "Usage: procinfo <pid>"
|
|
675
|
+
return 1
|
|
676
|
+
fi
|
|
677
|
+
if [ ! -d "/proc/$pid" ]; then
|
|
678
|
+
echo "Process $pid not found."
|
|
679
|
+
return 1
|
|
680
|
+
fi
|
|
681
|
+
|
|
682
|
+
echo "=== Process $pid ==="
|
|
683
|
+
# Basic process info
|
|
684
|
+
ps -p "$pid" -o user=,uid=,pid=,ppid=,c=,stime=,etime=,tty=,time=,cmd=
|
|
685
|
+
|
|
686
|
+
echo
|
|
687
|
+
# Working directory
|
|
688
|
+
echo "CWD: $(readlink -f /proc/$pid/cwd 2>/dev/null)"
|
|
689
|
+
|
|
690
|
+
# Executable path
|
|
691
|
+
echo "EXE: $(readlink -f /proc/$pid/exe 2>/dev/null)"
|
|
692
|
+
|
|
693
|
+
# Root directory of the process
|
|
694
|
+
echo "ROOT: $(readlink -f /proc/$pid/root 2>/dev/null)"
|
|
695
|
+
|
|
696
|
+
# Command line (full, raw)
|
|
697
|
+
echo "CMDLINE:"
|
|
698
|
+
tr '\0' ' ' < /proc/$pid/cmdline 2>/dev/null
|
|
699
|
+
echo
|
|
700
|
+
|
|
701
|
+
# Environment variables
|
|
702
|
+
echo
|
|
703
|
+
echo "ENVIRONMENT (key=value):"
|
|
704
|
+
tr '\0' '\n' < /proc/$pid/environ 2>/dev/null | head -n 20
|
|
705
|
+
|
|
706
|
+
# Open files (first few)
|
|
707
|
+
echo
|
|
708
|
+
echo "OPEN FILES:"
|
|
709
|
+
ls -l /proc/$pid/fd 2>/dev/null | head -n 10
|
|
710
|
+
|
|
711
|
+
# Child processes
|
|
712
|
+
echo
|
|
713
|
+
echo "CHILDREN:"
|
|
714
|
+
ps --ppid "$pid" -o pid=,cmd= 2>/dev/null
|
|
715
|
+
}
|
|
716
|
+
procinfo 62220
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
## Maintenance
|
|
720
|
+
|
|
721
|
+
### Reboot server.
|
|
722
|
+
|
|
723
|
+
```
|
|
724
|
+
sudo reboot
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
That will remove all dangling unused proccesses and screens, which will in turn free the RAM and reduce CPU load. Also reboot may clear all temporary files, so next step can do nothing if reboot was done.
|
|
728
|
+
|
|
729
|
+
### Cleanup disk space.
|
|
730
|
+
|
|
731
|
+
```
|
|
732
|
+
df -h
|
|
733
|
+
|
|
734
|
+
rm -rf /tmp
|
|
735
|
+
|
|
736
|
+
df -h
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
These commands should be executed under `hive` user. If you have accidentally removed the `/tmp` folder itself under `root` user, you will need to restore it like this:
|
|
740
|
+
|
|
741
|
+
```bash
|
|
742
|
+
sudo mkdir -p /tmp
|
|
743
|
+
sudo chown root:root /tmp
|
|
744
|
+
sudo chmod 1777 /tmp
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
### Close all screens to free up RAM
|
|
748
|
+
|
|
749
|
+
```bash
|
|
750
|
+
# close all (Attached or Detached) sessions
|
|
751
|
+
screen -ls | awk '/(Detached|Attached)/{print $1}' \
|
|
752
|
+
| while read s; do screen -S "$s" -X quit; done
|
|
753
|
+
|
|
754
|
+
# remove any zombie sockets
|
|
755
|
+
screen -wipe
|
|
756
|
+
|
|
757
|
+
# verify
|
|
758
|
+
screen -ls
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
That can be done, but not recommended as reboot have better effect.
|
|
762
|
+
|
|
763
|
+
## 📄 License
|
|
764
|
+
|
|
765
|
+
Unlicense License - see [LICENSE](./LICENSE)
|
|
766
|
+
|
|
767
|
+
## 🤖 Contributing
|
|
768
|
+
|
|
769
|
+
This project uses AI-driven development. See [CONTRIBUTING.md](./docs/CONTRIBUTING.md) for human-AI collaboration guidelines.
|