@link-assistant/web-capture 1.10.5 → 1.10.7

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.
@@ -0,0 +1,1500 @@
1
+ Search | DeepWiki
2
+
3
+ [Index your code with Devin](https://deepwiki.com/private-repo)
4
+
5
+ [DeepWiki](https://deepwiki.com/)
6
+
7
+ [
8
+
9
+ Index your code with
10
+
11
+ Devin
12
+
13
+ ](https://deepwiki.com/private-repo)Share
14
+
15
+ [deep-assistant/hive-mind](https://deepwiki.com/deep-assistant/hive-mind)
16
+
17
+ расскажи пожалуйста на английском всю суть основных идей этой агентной системы, как она работает, напиши конспект на 5-7 а4 листов, то есть в чем заключаются какие-то оригинальные идеи, мне нужно объя...
18
+
19
+ Show full text
20
+
21
+ Deep
22
+
23
+ Thought Process
24
+
25
+ # Hive Mind: A Comprehensive Overview of an AI Agent System for Software Development
26
+
27
+ ## Executive Summary
28
+
29
+ Hive Mind is an orchestration system that coordinates artificial intelligence agents to solve software development tasks autonomously while maintaining human oversight at critical decision points. The system transforms GitHub issues into pull requests through a structured problem-solving methodology, inspired by universal problem-solving algorithms. README.md:10-16
30
+
31
+ ## I. Foundational Philosophy: Human-AI Collaboration Model
32
+
33
+ ### The Core Premise
34
+
35
+ The system operates on a fundamental principle: **AI agents should amplify human capabilities, not replace human judgment**. Every automated action is subject to human review and approval. This creates a collaborative loop where humans define problems and make decisions, while AI agents handle implementation and iteration. flow.md:436-442
36
+
37
+ ### The Two Operating Modes
38
+
39
+ The system recognizes two distinct patterns of human-AI interaction:
40
+
41
+ **Mode 1: Issue-Driven Development** - Humans create GitHub issues describing requirements. The AI analyzes these requirements, develops solutions, and creates draft pull requests for human review.
42
+
43
+ **Mode 2: Feedback-Driven Refinement** - Humans provide comments on existing pull requests. The AI processes this feedback, updates the solution, and pushes changes back for further review. flow.md:24-30
44
+
45
+ ## II. Architectural Layers: The Three-Tier Design
46
+
47
+ ### Layer 1: The Orchestration Layer (The "Hive Mind")
48
+
49
+ This is the strategic intelligence layer that monitors repositories, assigns tasks, and manages multiple AI agents concurrently. Think of it as the conductor of an orchestra - it doesn't play instruments, but coordinates when and how each musician performs.
50
+
51
+ The orchestration layer continuously monitors GitHub for new issues, checks for labels (like "help wanted"), manages a queue of work, and distributes tasks across multiple AI agents working in parallel. It implements concurrency control, ensuring agents don't conflict with each other. README.md:378-386
52
+
53
+ ### Layer 2: The Execution Layer (The "Solvers")
54
+
55
+ These are the tactical workers that implement specific tasks. Each solver operates independently in its own isolated environment, following a structured problem-solving methodology:
56
+
57
+ 1. **Deep Analysis**: Read issue descriptions, comments, screenshots, and related code
58
+ 2. **Plan Formation**: Create detailed step-by-step plans
59
+ 3. **Iterative Implementation**: Develop solutions incrementally with atomic commits
60
+ 4. **Continuous Testing**: Start with small functions, progress to integration tests
61
+ 5. **Self-Review**: Verify solutions match requirements before finalizing claude.prompts.lib.mjs:134-148
62
+
63
+ ### Layer 3: The Human Interface Layer
64
+
65
+ This layer enables human-AI collaboration through familiar tools - GitHub issues, pull requests, comments, and even Telegram bots. Humans don't need to learn new interfaces; the AI adapts to existing workflows. README.md:294-302
66
+
67
+ ## III. Original Ideas and Innovations
68
+
69
+ ### Innovation 1: The Task Clarification System
70
+
71
+ Before solving any problem, the system can run a separate clarification phase where the AI generates clarifying questions about ambiguous requirements. This prevents misunderstandings and reduces wasted effort.
72
+
73
+ The system breaks tasks into two distinct cognitive phases:
74
+
75
+ - **Clarification Mode**: Identifies ambiguous aspects, asks 3-5 specific questions, suggests assumptions, and identifies missing context
76
+ - **Decomposition Mode**: Breaks tasks into 3-8 actionable subtasks, orders them logically, estimates complexity, identifies risks, and defines success criteria task.mjs:246-299
77
+
78
+ ### Innovation 2: Multi-Dimensional Feedback Detection
79
+
80
+ The system doesn't just look for new comments. It implements a sophisticated feedback detection algorithm that monitors seven different signals:
81
+
82
+ 1. New comments on pull requests or issues (excluding bot-generated logs)
83
+ 2. Edited issue or PR descriptions
84
+ 3. New commits on the default branch (indicating repository evolution)
85
+ 4. Pull request state changes (closed, merged)
86
+ 5. Merge status changes (conflicts, test failures)
87
+ 6. Failed CI/CD checks
88
+ 7. Reviewer-requested changes
89
+
90
+ This comprehensive approach ensures the AI responds to implicit feedback (like failing tests) just as it does to explicit feedback (like comments). solve.feedback.lib.mjs:196-308
91
+
92
+ ### Innovation 3: Thinking Depth Control
93
+
94
+ The system introduces a novel `--think` parameter with four levels (low, medium, high, max) that controls the cognitive depth of AI reasoning. At maximum depth ("Ultrathink"), the AI engages in the most thorough analysis possible, considering edge cases, performing extensive validation, and exploring alternative approaches. claude.prompts.lib.mjs:74-83
95
+
96
+ ### Innovation 4: Automatic Fork Management
97
+
98
+ The system intelligently handles repository permissions. If an AI agent lacks write access to a repository, it automatically forks the repository, works in the fork, and creates pull requests back to the original. This enables collaborative contribution to any public repository without requiring upfront permissions. README.md:206-209
99
+
100
+ ### Innovation 5: Session Persistence and Recovery
101
+
102
+ When AI agents hit usage limits or encounter errors, the system preserves the entire conversation context as a session ID. Humans or other agents can resume exactly where work stopped, maintaining continuity across interruptions. README.md:500-506
103
+
104
+ ### Innovation 6: Structured Problem-Solving Prompts
105
+
106
+ Rather than generic instructions, the system provides AI agents with highly structured guidelines organized into cognitive phases:
107
+
108
+ - **Initial Research**: How to gather information systematically
109
+ - **Solution Development**: How to implement incrementally with tests
110
+ - **Preparation**: How to follow conventions and run checks
111
+ - **Self-Review**: How to verify completeness before submission
112
+
113
+ Each phase includes specific commands, patterns, and decision criteria, creating a repeatable methodology. claude.prompts.lib.mjs:113-132
114
+
115
+ ### Innovation 7: Continuous Integration with CI/CD
116
+
117
+ The system includes detailed protocols for investigating CI failures. When tests fail, the AI follows a systematic investigation:
118
+
119
+ 1. List recent CI runs with timestamps
120
+ 2. Verify runs correspond to latest commits
121
+ 3. Download logs from failed runs
122
+ 4. Analyze specific errors with line numbers
123
+ 5. Report findings and implement fixes claude.prompts.lib.mjs:119-127
124
+
125
+ ## IV. The Workflow Logic: How Everything Connects
126
+
127
+ ### The Default Mode Journey
128
+
129
+ 1. **Human Input**: A developer creates a GitHub issue describing a problem or feature request
130
+ 2. **AI Detection**: The Hive Mind orchestrator detects the issue (either through monitoring or explicit command)
131
+ 3. **Work Assignment**: The orchestrator creates an isolated working environment for an AI agent
132
+ 4. **Deep Analysis**: The agent reads all issue details, comments, related code, and screenshots
133
+ 5. **Solution Development**: The agent implements the solution incrementally, committing atomic changes
134
+ 6. **Draft PR Creation**: The agent creates a draft pull request with description and tests
135
+ 7. **Human Decision Point**: The developer reviews the PR and decides: approve/merge, request changes, or close
136
+ 8. **Iteration Loop**: If changes are requested, return to step 4 with the comments as new input flow.md:183-191
137
+
138
+ ### The Continue Mode Journey
139
+
140
+ 1. **Existing Context**: There's already an open pull request with previous work
141
+ 2. **Human Feedback**: A developer adds comments requesting changes or clarifications
142
+ 3. **Feedback Detection**: The system detects new comments, failed tests, or other signals
143
+ 4. **Context Loading**: The agent loads the full history of the issue, PR, and all feedback
144
+ 5. **Incremental Updates**: The agent modifies the existing solution based on feedback
145
+ 6. **Push Changes**: Updated code is committed and pushed to the same branch
146
+ 7. **Human Re-Review**: The developer reviews updates and decides next steps
147
+ 8. **Iteration Continues**: The cycle repeats until the solution is acceptable or abandoned flow.md:235-243
148
+
149
+ ## V. The Orchestration Strategy: Managing Multiple Agents
150
+
151
+ ### Concurrent Work Distribution
152
+
153
+ The Hive Mind can monitor entire organizations (like `https://github.com/microsoft`) and process multiple issues simultaneously. It implements:
154
+
155
+ - **Queue Management**: Maintains a priority queue of issues to solve
156
+ - **Concurrency Control**: Runs multiple solvers in parallel with configurable limits
157
+ - **Resource Monitoring**: Checks disk space and memory before starting new work
158
+ - **Failure Handling**: Automatically retries failed tasks with exponential backoff
159
+ - **State Tracking**: Remembers which issues are in progress, completed, or failed README.md:481-497
160
+
161
+ ### The Monitoring Loop
162
+
163
+ The orchestrator operates in a continuous cycle:
164
+
165
+ 1. **Scan Phase**: Query GitHub for issues matching criteria (labels, project boards, specific repositories)
166
+ 2. **Filter Phase**: Exclude issues that already have pull requests (if configured)
167
+ 3. **Batch Processing**: Check repository permissions and archived status in bulk
168
+ 4. **Assignment Phase**: Distribute work to available solver slots
169
+ 5. **Wait Phase**: Sleep for configured interval (default 5 minutes)
170
+ 6. **Repeat**: Return to scan phase hive.mjs:143-200
171
+
172
+ ## VI. Safety and Control Mechanisms
173
+
174
+ ### Multiple Safety Layers
175
+
176
+ The system implements several safeguards:
177
+
178
+ 1. **Draft PR by Default**: All pull requests start as drafts, requiring explicit human conversion to "ready for review"
179
+ 2. **No Auto-Merge**: Humans must manually approve and merge - the AI never merges automatically
180
+ 3. **Feedback Requirements**: Options like `--continue-only-on-feedback` ensure the AI only acts when humans provide input
181
+ 4. **Comment Filtering**: AI-generated logs are automatically excluded from feedback detection to prevent false triggers
182
+ 5. **Isolation**: Each solver works in a separate temporary directory, preventing cross-contamination flow.md:349-354
183
+
184
+ ### Emergency Intervention
185
+
186
+ Humans can immediately halt AI work through:
187
+
188
+ - Closing the pull request
189
+ - Adding "STOP" commands in comments
190
+ - Changing repository permissions
191
+ - Manual branch protection flow.md:305-313
192
+
193
+ ## VII. The Telegram Integration: Remote Control
194
+
195
+ The system includes a Telegram bot interface that allows humans to command the AI swarm from mobile devices or chat applications. Teams can:
196
+
197
+ - Submit issues for solving directly from chat
198
+ - Monitor ongoing work through status updates
199
+ - Execute the full orchestrator across multiple repositories
200
+ - Receive notifications when work completes
201
+
202
+ This bridges the gap between formal GitHub workflows and informal team communication channels. README.md:329-361
203
+
204
+ ## VIII. Configuration Philosophy: Adaptable Behavior
205
+
206
+ The system exposes numerous configuration options through environment variables, allowing teams to tune behavior without code changes:
207
+
208
+ - **Timeouts**: How long to wait for AI responses or API calls
209
+ - **Retry Logic**: How aggressively to retry failed operations
210
+ - **Resource Limits**: Minimum disk space, memory requirements
211
+ - **Auto-Continue Thresholds**: How long to wait before automatically continuing work
212
+ - **GitHub Limits**: Maximum file sizes, comment lengths, attachment sizes
213
+
214
+ This configurability enables the system to adapt to different team workflows, repository sizes, and operational constraints. CONFIG.md:1-23
215
+
216
+ ## IX. The Problem-Solving Methodology: Universal Algorithm Inspiration
217
+
218
+ The system is inspired by universal problem-solving algorithms that break complex problems into manageable steps. The core methodology follows a pattern:
219
+
220
+ 1. **Understand**: Thoroughly analyze the problem from all angles
221
+ 2. **Decompose**: Break into smaller, manageable subproblems
222
+ 3. **Research**: Study related work, existing solutions, and patterns
223
+ 4. **Experiment**: Test assumptions through small experiments
224
+ 5. **Implement**: Build incrementally with frequent validation
225
+ 6. **Verify**: Ensure solution meets all original requirements
226
+ 7. **Document**: Explain what was done and why
227
+
228
+ This structured approach reduces cognitive load on the AI and produces more reliable outcomes. README.md:14-16
229
+
230
+ ## X. Key Design Principles: The Philosophical Foundation
231
+
232
+ ### Principle 1: Human-Centric Design
233
+
234
+ Every automated action is subject to human review and approval. The system enhances human capabilities rather than replacing human judgment.
235
+
236
+ ### Principle 2: Feedback-Driven Iteration
237
+
238
+ The system responds dynamically to human input at multiple points, creating a continuous improvement loop.
239
+
240
+ ### Principle 3: Transparency by Default
241
+
242
+ All AI actions are visible through GitHub's standard interfaces. Nothing happens in hidden background processes.
243
+
244
+ ### Principle 4: Iterative Refinement
245
+
246
+ The system supports multiple rounds of improvement based on feedback, recognizing that solutions rarely emerge perfect on first attempt.
247
+
248
+ ### Principle 5: Configurable Autonomy
249
+
250
+ Teams can adjust automation levels to match their comfort and requirements, from fully manual to highly autonomous. flow.md:436-453
251
+
252
+ ## XI. Practical Implications: What This Enables
253
+
254
+ ### For Open Source Maintainers
255
+
256
+ - Automatically handle straightforward issues and bug fixes
257
+ - Scale contribution handling beyond what's manually possible
258
+ - Maintain consistent code quality through structured approaches
259
+ - Reduce burnout by delegating routine tasks
260
+
261
+ ### For Development Teams
262
+
263
+ - Accelerate feature development on internal projects
264
+ - Maintain multiple repositories with fewer human resources
265
+ - Ensure consistent implementation patterns across codebases
266
+ - Enable 24/7 development cycles (AI works while humans sleep)
267
+
268
+ ### For Individual Developers
269
+
270
+ - Contribute to projects without deep codebase knowledge
271
+ - Learn by observing AI problem-solving approaches
272
+ - Delegate routine tasks while focusing on architecture
273
+ - Experiment with solutions quickly
274
+
275
+ ## XII. Limitations and Constraints
276
+
277
+ ### What This System Cannot Do
278
+
279
+ - Replace human architectural decisions
280
+ - Understand unstated business requirements
281
+ - Navigate complex political or organizational dynamics
282
+ - Make ethical judgments about feature priorities
283
+ - Guarantee perfect security or performance
284
+
285
+ ### Required Human Involvement
286
+
287
+ - Defining clear requirements in issues
288
+ - Reviewing and approving all changes
289
+ - Making merge/reject decisions
290
+ - Providing feedback when solutions miss the mark
291
+ - Managing overall project direction README.md:18-55
292
+
293
+ ## Conclusion: A New Paradigm in Software Development
294
+
295
+ Hive Mind represents a shift from viewing AI as a tool for individual tasks to viewing AI as a coordinated team member in software development. The system's original contributions include:
296
+
297
+ 1. **Structured orchestration** of multiple AI agents working concurrently
298
+ 2. **Multi-dimensional feedback detection** beyond simple comments
299
+ 3. **Task clarification protocols** that prevent misunderstandings
300
+ 4. **Thinking depth control** for adjusting cognitive rigor
301
+ 5. **Automatic fork management** enabling universal contribution
302
+ 6. **Session persistence** for seamless work continuation
303
+ 7. **Human-centric safety** ensuring oversight at critical points
304
+
305
+ The system demonstrates that AI agents can handle substantial development work autonomously while maintaining human control over strategic decisions. This creates a collaborative model where humans focus on defining problems and making judgments, while AI agents handle implementation details and iterative refinement.
306
+
307
+ The philosophical innovation is recognizing that software development is fundamentally about **iteration** and **feedback**, not just initial implementation. By building feedback detection and response into the core architecture, the system creates a genuine dialogue between humans and AI, rather than a simple command-execution model.
308
+
309
+ ---
310
+
311
+ ## Notes
312
+
313
+ This system is explicitly marked as **unsafe to run on developer machines** due to security concerns. It's designed for isolated virtual machines with dedicated tokens. The Claude AI agents have full autonomous mode enabled, meaning they can execute arbitrary commands as needed for problem-solving. This power comes with inherent risks that require careful operational security. README.md:18-29
314
+
315
+ The system supports multiple AI backends (Claude, OpenCode with Grok) and can be extended to additional models, making it tool-agnostic in its core design. The structured prompting approach works across different AI systems with minimal adaptation. README.md:204-206
316
+
317
+ [deep-assistant/hive-mind](https://github.com/deep-assistant/hive-mind)[README.md](https://github.com/deep-assistant/hive-mind/blob/718b5d74/README.md)
318
+
319
+ ```
320
+ 7
321
+ 8# Hive Mind 🧠
322
+ 9
323
+ ```
324
+
325
+ ```
326
+ 10**The master mind AI that controls hive of AI.** The orchestrator AI that controls AIs. The HIVE MIND. The SWARM MIND.
327
+ 11
328
+ 12It is also possible to connect this AI to collective human intelligence, meaning this system can communicate with humans for requirements, expertise, feedback.
329
+ 13
330
+ 14[![Universal Problem Solving Algorithm](https://github.com/user-attachments/assets/1d91e911-9ba4-456e-a00a-14cdd60d9a0a)](https://github.com/konard/problem-solving)
331
+ 15
332
+ 16Inspired by [konard/problem-solving](https://github.com/konard/problem-solving)
333
+ ```
334
+
335
+ ```
336
+ 17
337
+ ```
338
+
339
+ ```
340
+ 18## ⚠️ WARNING
341
+ 19
342
+ 20It is UNSAFE to run this software on your developer machine.
343
+ 21
344
+ 22It is recommended to use SEPARATE Ubuntu 24.04 installation (installation script is prepared for you).
345
+ 23
346
+ 24This software uses full autonomous mode of Claude Code, that means it is free to execute any commands it sees fit.
347
+ 25
348
+ 26That means it can lead to unexpected side effects.
349
+ 27
350
+ 28There 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.
351
+ 29
352
+ 30### ⚠️ CRITICAL: Token and Sensitive Data Security
353
+ 31
354
+ 32**THIS SOFTWARE CANNOT GUARANTEE ANY SAFETY FOR YOUR TOKENS OR OTHER SENSITIVE DATA ON THE VIRTUAL MACHINE.**
355
+ 33
356
+ 34There are infinite ways to extract tokens from a virtual machine connected to the internet. This includes but is not limited to:
357
+ 35
358
+ 36- **Claude MAX tokens** - Required for AI operations
359
+ 37- **GitHub tokens** - Required for repository access
360
+ 38- **API keys and credentials** - Any sensitive data on the system
361
+ 39
362
+ 40**IMPORTANT SECURITY CONSIDERATIONS:**
363
+ 41
364
+ 42- Running on a developer machine is **ABSOLUTELY UNSAFE**
365
+ 43- Running on a virtual machine is **LESS UNSAFE** but still has risks
366
+ 44- Even though your developer machine data isn't directly exposed, the VM still contains sensitive tokens
367
+ 45- Any token stored on an internet-connected system can potentially be compromised
368
+ 46
369
+ 47**USE THIS SOFTWARE ENTIRELY AT YOUR OWN RISK AND RESPONSIBILITY.**
370
+ 48
371
+ 49We strongly recommend:
372
+ 50- Using dedicated, isolated virtual machines
373
+ 51- Rotating tokens regularly
374
+ 52- Monitoring token usage for suspicious activity
375
+ 53- Never using production tokens or credentials
376
+ 54- Being prepared to revoke and replace all tokens used with this system
377
+ 55
378
+ ```
379
+
380
+ ```
381
+ 56Minimum system requirements to run `hive.mjs`:
382
+ 57```
383
+ 581 CPU Core
384
+ ```
385
+
386
+ ```
387
+ 201```bash
388
+ 202solve <issue-url> [options]
389
+ 203
390
+ ```
391
+
392
+ ```
393
+ 204 --model, -m Model (sonnet, opus for claude; grok-code-fast-1, gpt4o for opencode)
394
+ 205 [default: sonnet for claude, grok-code-fast-1 for opencode]
395
+ 206 --tool AI tool (claude, opencode) [default: claude]
396
+ 207 --fork, -f Fork repo if no write access [default: false]
397
+ 208 --auto-fork Automatically fork public repos without write access (fails for private)
398
+ 209 [default: false]
399
+ ```
400
+
401
+ ```
402
+ 210 --base-branch, -b Target branch for PR [default: repo default]
403
+ 211 --resume, -r Resume from session ID
404
+ 212 --verbose, -v Enable verbose logging [default: false]
405
+ ```
406
+
407
+ ```
408
+ 291```
409
+ 292
410
+ 293## 🤖 Telegram Bot
411
+ ```
412
+
413
+ ```
414
+ 294
415
+ 295The Hive Mind includes a Telegram bot interface (SwarmMindBot) for remote command execution.
416
+ 296
417
+ 297### 🚀 Test Drive
418
+ 298
419
+ 299Want 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:
420
+ 300
421
+ 301**[Join https://t.me/hive_mind_pull_requests](https://t.me/hive_mind_pull_requests)**
422
+ 302
423
+ ```
424
+
425
+ ```
426
+ 303### Setup
427
+ 304
428
+ 3051. **Get Bot Token**
429
+ ```
430
+
431
+ ```
432
+ 326 ```
433
+ 327
434
+ 328### Bot Commands
435
+ ```
436
+
437
+ ```
438
+ 329
439
+ 330All commands work in **group chats only** (not in private messages with the bot):
440
+ 331
441
+ 332#### `/solve` - Solve GitHub Issues
442
+ 333```
443
+ 334/solve <github-url> [options]
444
+ 335
445
+ 336Examples:
446
+ 337/solve https://github.com/owner/repo/issues/123
447
+ 338/solve https://github.com/owner/repo/issues/123 --auto-fork --verbose
448
+ 339/solve https://github.com/owner/repo/issues/123 --auto-fork --auto-continue --attach-logs --verbose --model sonnet --think max
449
+ 340```
450
+ 341
451
+ 342#### `/hive` - Run Hive Orchestration
452
+ 343```
453
+ 344/hive <github-url> [options]
454
+ 345
455
+ 346Examples:
456
+ 347/hive https://github.com/owner/repo
457
+ 348/hive https://github.com/owner/repo --all-issues --max-issues 10
458
+ 349/hive https://github.com/microsoft --all-issues --concurrency 3
459
+ 350```
460
+ 351
461
+ 352#### `/help` - Get Help and Diagnostic Info
462
+ 353```
463
+ 354/help
464
+ 355
465
+ 356Shows:
466
+ 357- Chat ID (needed for TELEGRAM_ALLOWED_CHATS)
467
+ 358- Chat type
468
+ 359- Available commands
469
+ 360- Usage examples
470
+ 361```
471
+ ```
472
+
473
+ ```
474
+ 362
475
+ 363### Features
476
+ 364
477
+ ```
478
+
479
+ ```
480
+ 375- Commands run as the system user running the bot
481
+ 376- Ensure proper authentication (`gh auth login`, `claude-profiles`)
482
+ 377
483
+ ```
484
+
485
+ ```
486
+ 378## 🏗️ Architecture
487
+ 379
488
+ 380The Hive Mind operates on three layers:
489
+ 381
490
+ 3821. **Orchestration Layer** (`hive.mjs`) - Coordinates multiple AI agents
491
+ 3832. **Execution Layer** (`solve.mjs`, `review.mjs`) - Performs specific tasks
492
+ 3843. **Human Interface Layer** - Enables human-AI collaboration
493
+ 385
494
+ 386### Data Flow
495
+ ```
496
+
497
+ ```
498
+ 387
499
+ 388#### Mode 1: Issue → Pull Request Flow
500
+ 389```mermaid
501
+ ```
502
+
503
+ ```
504
+ 478solve https://github.com/owner/repo/issues/123 --dry-run
505
+ 479```
506
+ 480
507
+ ```
508
+
509
+ ```
510
+ 481### Multi-Repository Orchestration
511
+ 482```bash
512
+ 483# Monitor single repository with specific label
513
+ 484hive https://github.com/owner/repo --monitor-tag "bug" --concurrency 4
514
+ 485
515
+ 486# Monitor all issues in an organization with auto-fork
516
+ 487hive https://github.com/microsoft --all-issues --max-issues 20 --once --auto-fork
517
+ 488
518
+ 489# Monitor user repositories with high concurrency
519
+ 490hive https://github.com/username --all-issues --concurrency 8 --interval 120 --auto-fork
520
+ 491
521
+ 492# Skip issues that already have PRs
522
+ 493hive https://github.com/org/repo --skip-issues-with-prs --verbose
523
+ 494
524
+ 495# Auto-cleanup temporary files and auto-fork if needed
525
+ 496hive https://github.com/org/repo --auto-cleanup --auto-fork --concurrency 5
526
+ 497```
527
+ ```
528
+
529
+ ```
530
+ 498
531
+ 499### Session Management
532
+ ```
533
+
534
+ ```
535
+ 500```bash
536
+ 501# Resume when Claude hits limit
537
+ 502solve https://github.com/owner/repo/issues/123 --resume 657e6db1-6eb3-4a8d
538
+ 503
539
+ 504# Continue session interactively in Claude Code
540
+ 505(cd /tmp/gh-issue-solver-123456789 && claude --resume session-id)
541
+ 506```
542
+ ```
543
+
544
+ ```
545
+ 507
546
+ 508## 🔍 Monitoring & Logging
547
+ 509
548
+ ```
549
+
550
+ [deep-assistant/hive-mind](https://github.com/deep-assistant/hive-mind)[docs/flow.md](https://github.com/deep-assistant/hive-mind/blob/718b5d74/docs/flow.md)
551
+
552
+ ```
553
+ 21
554
+ 22## Operating Modes
555
+ 23
556
+ ```
557
+
558
+ ```
559
+ 24Hive Mind operates in two primary modes based on the entry point and human interaction patterns:
560
+ 25
561
+ 26| Mode | Entry Point | Primary Human Input | Secondary Input | Decision Points |
562
+ 27|------|------------|-------------------|-----------------|-----------------|
563
+ 28| **Default Mode** | GitHub Issue | Issue description & requirements | PR comments for refinements | Merge/Request Changes/Close |
564
+ 29| **Continue Mode** | Existing PR | PR comments with feedback | Additional PR comments | Merge/Request Changes/Close |
565
+ 30
566
+ ```
567
+
568
+ ```
569
+ 31## Data Flow Architecture
570
+ 32
571
+ 33### High-Level System Architecture
572
+ ```
573
+
574
+ ```
575
+ 180 end
576
+ 181```
577
+ 182
578
+ ```
579
+
580
+ ```
581
+ 183### Data Flow Steps
582
+ 1841. **Human creates GitHub issue** (Primary human input)
583
+ 1852. Hive Mind detects and assigns issue to AI agent
584
+ 1863. AI agent analyzes issue requirements
585
+ 1874. AI agent develops solution and creates draft PR
586
+ 1885. **Human reviews PR** (Human decision point)
587
+ 1896. **Human decides**: Merge, request changes, or close (Human feedback)
588
+ 1907. If changes requested, cycle continues with PR comments as input
589
+ 191
590
+ ```
591
+
592
+ ```
593
+ 192## Mode 2: Continue Mode (Pull Request → Comments)
594
+ 193
595
+ 194### Human Feedback Points
596
+ ```
597
+
598
+ ```
599
+ 232 end
600
+ 233```
601
+ 234
602
+ ```
603
+
604
+ ```
605
+ 235### Data Flow Steps
606
+ 2361. **Human adds comment to existing PR** (Primary human input)
607
+ 2372. Hive Mind detects new comment
608
+ 2383. AI agent processes comment and feedback
609
+ 2394. AI agent updates solution based on feedback
610
+ 2405. AI agent pushes changes to PR
611
+ 2416. **Human reviews updates** (Human decision point)
612
+ 2427. **Human decides**: Merge, add more comments, or close (Human feedback)
613
+ 2438. Cycle continues until resolution
614
+ ```
615
+
616
+ ```
617
+ 244
618
+ 245## Human Feedback Integration Points
619
+ 246
620
+ ```
621
+
622
+ ```
623
+ 302 - Provide ongoing guidance
624
+ 303
625
+ 304### 5. Emergency Intervention Points
626
+ ```
627
+
628
+ ```
629
+ 305- **Type**: Critical feedback
630
+ 306- **Format**: Direct commands in comments
631
+ 307- **Impact**: Immediate system response
632
+ 308- **Triggers**:
633
+ 309 - `STOP` command in comment
634
+ 310 - PR closure
635
+ 311 - Branch protection activation
636
+ 312 - Manual revert
637
+ 313
638
+ ```
639
+
640
+ ```
641
+ 314### Human Feedback Processing Flow
642
+ 315
643
+ 316```mermaid
644
+ ```
645
+
646
+ ```
647
+ 346- `--auto-continue`: Automatically continue with existing PRs for issues
648
+ 347- `--auto-continue-only-on-new-comments`: Only continue if new comments detected
649
+ 348- `--continue-only-on-feedback`: Only continue if feedback is present
650
+ ```
651
+
652
+ ```
653
+ 349
654
+ 350### Human Interaction Controls
655
+ 351- `--auto-pull-request-creation`: Create draft PR before human review
656
+ 352- `--attach-logs`: Include detailed logs for human review
657
+ 353- Manual merge requirement ensures human oversight
658
+ 354
659
+ ```
660
+
661
+ ```
662
+ 355## Error Handling & Fallbacks
663
+ 356
664
+ 357### When Human Feedback is Absent
665
+ ```
666
+
667
+ ```
668
+ 433
669
+ 434## Summary
670
+ 435
671
+ ```
672
+
673
+ ```
674
+ 436### Key Design Principles
675
+ 437
676
+ 4381. **Human-Centric**: Every automated action is subject to human review and approval
677
+ 4392. **Feedback-Driven**: System responds dynamically to human input at multiple points
678
+ 4403. **Transparent**: All AI actions are visible through GitHub's standard interfaces
679
+ 4414. **Iterative**: Supports multiple rounds of refinement based on human feedback
680
+ 4425. **Configurable**: Behavior can be adjusted to match team workflows
681
+ 443
682
+ 444### Data Flow Summary
683
+ 445
684
+ 446The Hive Mind data flow architecture ensures comprehensive human oversight through:
685
+ 447
686
+ 448- **Multiple Entry Points**: Issues (Default Mode) or PRs (Continue Mode)
687
+ 449- **Continuous Feedback Integration**: Comments processed in real-time
688
+ 450- **Clear Decision Gates**: Explicit human approval required for merging
689
+ 451- **Emergency Controls**: Immediate halt capabilities through commands
690
+ 452- **Flexible Configuration**: Adjustable automation levels
691
+ 453
692
+ ```
693
+
694
+ ```
695
+ 454### Human Feedback Integration
696
+ 455
697
+ 456| Mode | Primary Feedback | Secondary Feedback | Decision Authority |
698
+ ```
699
+
700
+ [deep-assistant/hive-mind](https://github.com/deep-assistant/hive-mind)[src/claude.prompts.lib.mjs](https://github.com/deep-assistant/hive-mind/blob/718b5d74/src/claude.prompts.lib.mjs)
701
+
702
+ ```
703
+ 71 promptLines.push('');
704
+ 72 }
705
+ 73
706
+ ```
707
+
708
+ ```
709
+ 74 // Add thinking instruction based on --think level
710
+ 75 if (argv && argv.think) {
711
+ 76 const thinkMessages = {
712
+ 77 low: 'Think.',
713
+ 78 medium: 'Think hard.',
714
+ 79 high: 'Think harder.',
715
+ 80 max: 'Ultrathink.'
716
+ 81 };
717
+ 82 promptLines.push(thinkMessages[argv.think]);
718
+ 83 }
719
+ ```
720
+
721
+ ```
722
+ 84
723
+ 85 // Final instruction
724
+ 86 promptLines.push(isContinueMode ? 'Continue.' : 'Proceed.');
725
+ ```
726
+
727
+ ```
728
+ 110 }
729
+ 111
730
+ 112 // Use backticks for jq commands to avoid quote escaping issues
731
+ ```
732
+
733
+ ```
734
+ 113 return `You are an AI issue solver. You prefer to find the root cause of each and every issue. When you talk, you prefer to speak with facts which you have double-checked yourself or cite sources that provide evidence, like quote actual code or give references to documents or pages found on the internet. You are polite and patient, and prefer to assume good intent, trying your best to be helpful. If you are unsure or have assumptions, you prefer to test them yourself or ask questions to clarify requirements.${thinkLine}
735
+ 114
736
+ 115General guidelines.
737
+ 116 - When you execute commands, always save their logs to files for easier reading if the output becomes large.
738
+ 117 - When running commands, do not set a timeout yourself — let them run as long as needed (default timeout - 2 minutes is more than enough), and once they finish, review the logs in the file.
739
+ 118 - When running sudo commands (especially package installations like apt-get, yum, npm install, etc.), always run them in the background to avoid timeout issues and permission errors when the process needs to be killed. Use the run_in_background parameter or append & to the command.
740
+ 119 - When CI is failing or user reports failures, consider adding a detailed investigation protocol to your todo list with these steps:
741
+ 120 Step 1: List recent runs with timestamps using: gh run list --repo ${owner}/${repo} --branch ${branchName} --limit 5 --json databaseId,conclusion,createdAt,headSha
742
+ 121 Step 2: Verify runs are after the latest commit by checking timestamps and SHA
743
+ 122 Step 3: For each non-passing run, download logs to preserve them: gh run view {run-id} --repo ${owner}/${repo} --log > ci-logs/{workflow}-{run-id}.log
744
+ 123 Step 4: Read each downloaded log file using Read tool to understand the actual failures
745
+ 124 Step 5: Report findings with specific errors and line numbers from logs
746
+ 125 This detailed investigation is especially helpful when user mentions CI failures, asks to investigate logs, you see non-passing status, or when finalizing a PR.
747
+ 126 Note: If user says "failing" but tools show "passing", this might indicate stale data - consider downloading fresh logs and checking timestamps to resolve the discrepancy.
748
+ 127 - When a code or log file has more than 1500 lines, read it in chunks of 1500 lines.
749
+ 128 - When facing a complex problem, do as much tracing as possible and turn on all verbose modes.
750
+ 129 - When you create debug, test, or example/experiment scripts for fixing, always keep them in an examples and/or experiments folders so you can reuse them later.
751
+ 130 - When testing your assumptions, use the experiment scripts, and add it to experiments folder.
752
+ 131 - When your experiments can show real world use case of the software, add it to examples folder.
753
+ 132 - When you face something extremely hard, use divide and conquer — it always helps.
754
+ ```
755
+
756
+ ```
757
+ 133
758
+ ```
759
+
760
+ ```
761
+ 134Initial research.
762
+ 135 - When you start, make sure you create detailed plan for yourself and follow your todo list step by step, make sure that as many points from these guidelines are added to your todo list to keep track of everything that can help you solve the issue with highest possible quality.
763
+ 136 - When user mentions CI failures or asks to investigate logs, consider adding these todos to track the investigation: (1) List recent CI runs with timestamps, (2) Download logs from failed runs to ci-logs/ directory, (3) Analyze error messages and identify root cause, (4) Implement fix, (5) Verify fix resolves the specific errors found in logs.
764
+ 137 - When you read issue, read all details and comments thoroughly.
765
+ 138 - When you see screenshots or images in issue descriptions, pull request descriptions, comments, or discussions, use WebFetch tool (or fetch tool) to download the image first, then use Read tool to view and analyze it.
766
+ 139 - When you need issue details, use gh issue view https://github.com/${owner}/${repo}/issues/${issueNumber}.
767
+ 140 - When you need related code, use gh search code --owner ${owner} [keywords].
768
+ 141 - When you need repo context, read files in your working directory.
769
+ 142 - When you study related work, study the most recent related pull requests.
770
+ 143 - When issue is not defined enough, write a comment to ask clarifying questions.
771
+ 144 - When accessing GitHub Gists (especially private ones), use gh gist view command instead of direct URL fetching to ensure proper authentication.
772
+ 145 - When you are fixing a bug, please make sure you first find the actual root cause, do as many experiments as needed.
773
+ 146 - When you are fixing a bug and code does not have enough tracing/logs, add them and make sure they stay in the code, but are switched off by default.
774
+ 147 - When you need latest comments on pull request (sorted newest first), use appropriate GitHub API commands.
775
+ 148 - When you need latest comments on issue (sorted newest first), use appropriate GitHub API commands.
776
+ ```
777
+
778
+ ```
779
+ 149
780
+ 150Solution development and testing.
781
+ 151 - When issue is solvable, implement code with tests.
782
+ ```
783
+
784
+ [deep-assistant/hive-mind](https://github.com/deep-assistant/hive-mind)[src/task.mjs](https://github.com/deep-assistant/hive-mind/blob/718b5d74/src/task.mjs)
785
+
786
+ ```
787
+ 243 decomposition: null
788
+ 244 };
789
+ 245
790
+ ```
791
+
792
+ ```
793
+ 246 // Phase 1: Clarification
794
+ 247 if (argv.clarify) {
795
+ 248 await log(`\n🤔 Phase 1: Task Clarification`);
796
+ 249 await log(` Analyzing task and generating clarifying questions...`);
797
+ 250
798
+ 251 const clarifyPrompt = `Task: "${taskDescription}"
799
+ 252
800
+ 253Please help clarify this task by:
801
+ 2541. Identifying any ambiguous aspects of the task
802
+ 2552. Asking 3-5 specific clarifying questions that would help someone implement this task more effectively
803
+ 2563. Suggesting potential assumptions that could be made if these questions aren't answered
804
+ 2574. Identifying any missing context or requirements
805
+ 258
806
+ 259Provide your response in a clear, structured format that helps refine the task understanding.`;
807
+ 260
808
+ 261 const clarificationOutput = await executeClaude(clarifyPrompt, argv.model);
809
+ 262 if (!argv.verbose) {
810
+ 263 console.log('\n📝 Clarification Results:');
811
+ 264 console.log(clarificationOutput);
812
+ 265 }
813
+ 266
814
+ 267 results.clarification = clarificationOutput;
815
+ 268 await log(`\n✅ Clarification phase completed`);
816
+ 269 }
817
+ 270
818
+ 271 // Phase 2: Decomposition
819
+ 272 if (argv.decompose) {
820
+ 273 await log(`\n🔍 Phase 2: Task Decomposition`);
821
+ 274 await log(` Breaking down task into manageable subtasks...`);
822
+ 275
823
+ 276 let decomposePrompt = `Task: "${taskDescription}"`;
824
+ 277
825
+ 278 if (results.clarification) {
826
+ 279 decomposePrompt += `\n\nClarification analysis:\n${results.clarification}`;
827
+ 280 }
828
+ 281
829
+ 282 decomposePrompt += `\n\nPlease decompose this task by:
830
+ 2831. Breaking it down into 3-8 specific, actionable subtasks
831
+ 2842. Ordering the subtasks logically (dependencies and sequence)
832
+ 2853. Estimating relative complexity/effort for each subtask (simple/medium/complex)
833
+ 2864. Identifying any potential risks or challenges for each subtask
834
+ 2875. Suggesting success criteria for each subtask
835
+ 288
836
+ 289Provide your response as a structured breakdown that someone could use as a implementation roadmap.`;
837
+ 290
838
+ 291 const decompositionOutput = await executeClaude(decomposePrompt, argv.model);
839
+ 292 if (!argv.verbose) {
840
+ 293 console.log('\n🔍 Decomposition Results:');
841
+ 294 console.log(decompositionOutput);
842
+ 295 }
843
+ 296
844
+ 297 results.decomposition = decompositionOutput;
845
+ 298 await log(`\n✅ Decomposition phase completed`);
846
+ 299 }
847
+ ```
848
+
849
+ ```
850
+ 300
851
+ 301 // Output results
852
+ 302 if (argv.outputFormat === 'json') {
853
+ ```
854
+
855
+ [deep-assistant/hive-mind](https://github.com/deep-assistant/hive-mind)[src/solve.feedback.lib.mjs](https://github.com/deep-assistant/hive-mind/blob/718b5d74/src/solve.feedback.lib.mjs)
856
+
857
+ ```
858
+ 193
859
+ 194 // Build comprehensive feedback info for system prompt
860
+ 195 feedbackLines = []; // Reset for this execution
861
+ ```
862
+
863
+ ```
864
+ 196 let feedbackDetected = false;
865
+ 197 const feedbackSources = [];
866
+ 198
867
+ 199 // Add comment info if counts are > 0 to avoid wasting tokens
868
+ 200 if (newPrComments > 0) {
869
+ 201 feedbackLines.push(`New comments on the pull request: ${newPrComments}`);
870
+ 202 }
871
+ 203 if (newIssueComments > 0) {
872
+ 204 feedbackLines.push(`New comments on the issue: ${newIssueComments}`);
873
+ 205 }
874
+ 206
875
+ 207 // Enhanced feedback detection for all continue modes
876
+ 208 if (isContinueMode || argv.autoContinue) {
877
+ 209 if (argv.continueOnlyOnFeedback) {
878
+ 210 await log(`${formatAligned('🔍', 'Feedback detection:', 'Checking for any feedback since last commit...')}`);
879
+ 211 }
880
+ 212
881
+ 213 // 1. Check for new comments (already filtered above)
882
+ 214 const totalNewComments = newPrComments + newIssueComments;
883
+ 215 if (totalNewComments > 0) {
884
+ 216 feedbackDetected = true;
885
+ 217 feedbackSources.push(`New comments (${totalNewComments})`);
886
+ 218 }
887
+ 219
888
+ 220 // 2. Check for edited descriptions
889
+ 221 try {
890
+ 222 // Check PR description edit time
891
+ 223 const prDetailsResult = await $`gh api repos/${owner}/${repo}/pulls/${prNumber}`;
892
+ 224 if (prDetailsResult.code === 0) {
893
+ 225 const prDetails = JSON.parse(prDetailsResult.stdout.toString());
894
+ 226 const prUpdatedAt = new Date(prDetails.updated_at);
895
+ 227 if (prUpdatedAt > lastCommitTime) {
896
+ 228 feedbackLines.push('Pull request description was edited after last commit');
897
+ 229 feedbackDetected = true;
898
+ 230 feedbackSources.push('PR description edited');
899
+ 231 }
900
+ 232 }
901
+ 233
902
+ 234 // Check issue description edit time if we have an issue
903
+ 235 if (issueNumber) {
904
+ 236 const issueDetailsResult = await $`gh api repos/${owner}/${repo}/issues/${issueNumber}`;
905
+ 237 if (issueDetailsResult.code === 0) {
906
+ 238 const issueDetails = JSON.parse(issueDetailsResult.stdout.toString());
907
+ 239 const issueUpdatedAt = new Date(issueDetails.updated_at);
908
+ 240 if (issueUpdatedAt > lastCommitTime) {
909
+ 241 feedbackLines.push('Issue description was edited after last commit');
910
+ 242 feedbackDetected = true;
911
+ 243 feedbackSources.push('Issue description edited');
912
+ 244 }
913
+ 245 }
914
+ 246 }
915
+ 247 } catch (error) {
916
+ 248 reportError(error, {
917
+ 249 context: 'check_description_edits',
918
+ 250 prNumber,
919
+ 251 operation: 'fetch_pr_timeline'
920
+ 252 });
921
+ 253 if (argv.verbose) {
922
+ 254 await log(`Warning: Could not check description edit times: ${cleanErrorMessage(error)}`, { level: 'warning' });
923
+ 255 }
924
+ 256 }
925
+ 257
926
+ 258 // 3. Check for new commits on default branch
927
+ 259 try {
928
+ 260 const defaultBranchResult = await $`gh api repos/${owner}/${repo}`;
929
+ 261 if (defaultBranchResult.code === 0) {
930
+ 262 const repoData = JSON.parse(defaultBranchResult.stdout.toString());
931
+ 263 const defaultBranch = repoData.default_branch;
932
+ 264
933
+ 265 const commitsResult = await $`gh api repos/${owner}/${repo}/commits --field sha=${defaultBranch} --field since=${lastCommitTime.toISOString()}`;
934
+ 266 if (commitsResult.code === 0) {
935
+ 267 const commits = JSON.parse(commitsResult.stdout.toString());
936
+ 268 if (commits.length > 0) {
937
+ 269 feedbackLines.push(`New commits on ${defaultBranch} branch: ${commits.length}`);
938
+ 270 feedbackDetected = true;
939
+ 271 feedbackSources.push(`New commits on ${defaultBranch} (${commits.length})`);
940
+ 272 }
941
+ 273 }
942
+ 274 }
943
+ 275 } catch (error) {
944
+ 276 reportError(error, {
945
+ 277 context: 'check_branch_commits',
946
+ 278 branchName,
947
+ 279 operation: 'fetch_commit_messages'
948
+ 280 });
949
+ 281 if (argv.verbose) {
950
+ 282 await log(`Warning: Could not check default branch commits: ${cleanErrorMessage(error)}`, { level: 'warning' });
951
+ 283 }
952
+ 284 }
953
+ 285
954
+ 286 // 4. Check pull request state (non-open indicates closed or merged)
955
+ 287 if (prState && prState !== 'OPEN') {
956
+ 288 feedbackLines.push(`Pull request state: ${prState}`);
957
+ 289 feedbackDetected = true;
958
+ 290 feedbackSources.push(`PR state ${prState}`);
959
+ 291 }
960
+ 292
961
+ 293 // 5. Check merge status (non-clean indicates issues with merging)
962
+ 294 if (mergeStateStatus && mergeStateStatus !== 'CLEAN') {
963
+ 295 const statusDescriptions = {
964
+ 296 'DIRTY': 'Merge status is DIRTY (conflicts detected)',
965
+ 297 'UNSTABLE': 'Merge status is UNSTABLE (non-passing commit status)',
966
+ 298 'BLOCKED': 'Merge status is BLOCKED',
967
+ 299 'BEHIND': 'Merge status is BEHIND (head ref is out of date)',
968
+ 300 'HAS_HOOKS': 'Merge status is HAS_HOOKS (has pre-receive hooks)',
969
+ 301 'UNKNOWN': 'Merge status is UNKNOWN'
970
+ 302 };
971
+ 303 const description = statusDescriptions[mergeStateStatus] || `Merge status is ${mergeStateStatus}`;
972
+ 304 feedbackLines.push(description);
973
+ 305 feedbackDetected = true;
974
+ 306 feedbackSources.push(`Merge status ${mergeStateStatus}`);
975
+ 307 }
976
+ 308
977
+ ```
978
+
979
+ ```
980
+ 309 // 6. Check for failed PR checks
981
+ 310 try {
982
+ 311 const checksResult = await $`gh api repos/${owner}/${repo}/commits/$(gh api repos/${owner}/${repo}/pulls/${prNumber} --jq '.head.sha')/check-runs`;
983
+ ```
984
+
985
+ [deep-assistant/hive-mind](https://github.com/deep-assistant/hive-mind)[src/hive.mjs](https://github.com/deep-assistant/hive-mind/blob/718b5d74/src/hive.mjs)
986
+
987
+ ```
988
+ 140 * @param {boolean} allIssues - Whether to fetch all issues or only labeled ones
989
+ 141 * @returns {Promise<Array>} Array of issues
990
+ 142 */
991
+ ```
992
+
993
+ ```
994
+ 143async function fetchIssuesFromRepositories(owner, scope, monitorTag, fetchAllIssues = false) {
995
+ 144 const { execSync } = await import('child_process');
996
+ 145 try {
997
+ 146 await log(` 🔄 Using repository-by-repository fallback for ${scope}: ${owner}`);
998
+ 147 // Strategy 1: Try GraphQL approach first (faster but has limitations)
999
+ 148 // Only try GraphQL for "all issues" mode, not for labeled issues
1000
+ 149 if (fetchAllIssues) {
1001
+ 150 const graphqlResult = await tryFetchIssuesWithGraphQL(owner, scope, log, cleanErrorMessage);
1002
+ 151 if (graphqlResult.success) {
1003
+ 152 await log(` ✅ GraphQL approach successful: ${graphqlResult.issues.length} issues from ${graphqlResult.repoCount} repositories`);
1004
+ 153 return graphqlResult.issues;
1005
+ 154 }
1006
+ 155 }
1007
+ 156
1008
+ 157 // Strategy 2: Fallback to gh api --paginate approach (comprehensive but slower)
1009
+ 158 await log(' 📋 Using gh api --paginate approach for comprehensive coverage...', { verbose: true });
1010
+ 159
1011
+ 160 // First, get list of ALL repositories using gh api with --paginate for unlimited pagination
1012
+ 161 // This approach uses the GitHub API directly to fetch all repositories without any limits
1013
+ 162 // Include isArchived field to filter out archived repositories
1014
+ 163 let repoListCmd;
1015
+ 164 if (scope === 'organization') {
1016
+ 165 repoListCmd = `gh api orgs/${owner}/repos --paginate --jq '.[] | {name: .name, owner: .owner.login, isArchived: .archived}'`;
1017
+ 166 } else {
1018
+ 167 repoListCmd = `gh api users/${owner}/repos --paginate --jq '.[] | {name: .name, owner: .owner.login, isArchived: .archived}'`;
1019
+ 168 }
1020
+ 169
1021
+ 170 await log(' 📋 Fetching repository list (using --paginate for unlimited pagination)...', { verbose: true });
1022
+ 171 await log(` 🔎 Command: ${repoListCmd}`, { verbose: true });
1023
+ 172
1024
+ 173 // Add delay for rate limiting
1025
+ 174 await new Promise(resolve => setTimeout(resolve, 2000));
1026
+ 175
1027
+ 176 const repoOutput = execSync(repoListCmd, { encoding: 'utf8' });
1028
+ 177 // Parse the output line by line, as gh api with --jq outputs one JSON object per line
1029
+ 178 const repoLines = repoOutput.trim().split('\n').filter(line => line.trim());
1030
+ 179 const allRepositories = repoLines.map(line => JSON.parse(line));
1031
+ 180
1032
+ 181 await log(` 📊 Found ${allRepositories.length} repositories`);
1033
+ 182
1034
+ 183 // Filter repositories to only include those owned by the target user/org
1035
+ 184 const ownedRepositories = allRepositories.filter(repo => {
1036
+ 185 const repoOwner = repo.owner?.login || repo.owner;
1037
+ 186 return repoOwner === owner;
1038
+ 187 });
1039
+ 188 const unownedCount = allRepositories.length - ownedRepositories.length;
1040
+ 189
1041
+ 190 if (unownedCount > 0) {
1042
+ 191 await log(` ⏭️ Skipping ${unownedCount} repository(ies) not owned by ${owner}`);
1043
+ 192 }
1044
+ 193
1045
+ 194 // Filter out archived repositories from owned repositories
1046
+ 195 const repositories = ownedRepositories.filter(repo => !repo.isArchived);
1047
+ 196 const archivedCount = ownedRepositories.length - repositories.length;
1048
+ 197
1049
+ 198 if (archivedCount > 0) {
1050
+ 199 await log(` ⏭️ Skipping ${archivedCount} archived repository(ies)`);
1051
+ 200 }
1052
+ ```
1053
+
1054
+ ```
1055
+ 201
1056
+ 202 await log(` ✅ Processing ${repositories.length} non-archived repositories owned by ${owner}`);
1057
+ 203
1058
+ ```
1059
+
1060
+ [deep-assistant/hive-mind](https://github.com/deep-assistant/hive-mind)[docs/CONFIG.md](https://github.com/deep-assistant/hive-mind/blob/718b5d74/docs/CONFIG.md)
1061
+
1062
+ ```
1063
+ 1# Configuration Guide
1064
+ 2
1065
+ 3The Hive Mind application now supports extensive configuration through environment variables using the `getenv` package. This allows you to customize various aspects of the application without modifying the source code.
1066
+ 4
1067
+ 5## Configuration Overview
1068
+ 6
1069
+ 7All configuration is managed through the `src/config.lib.mjs` module which uses `getenv` from use-m for environment variable handling. The configuration uses camelCase property names for consistency.
1070
+ 8
1071
+ 9## Configuration Categories
1072
+ 10
1073
+ 11### 1. Timeout Configurations (timeouts)
1074
+ 12
1075
+ 13- `HIVE_MIND_CLAUDE_TIMEOUT_SECONDS`: Claude CLI timeout in seconds (default: 60)
1076
+ 14- `HIVE_MIND_GITHUB_API_DELAY_MS`: Delay between GitHub API calls (default: 5000)
1077
+ 15- `HIVE_MIND_GITHUB_REPO_DELAY_MS`: Delay between repository operations (default: 2000)
1078
+ 16- `HIVE_MIND_RETRY_BASE_DELAY_MS`: Base delay for retry operations (default: 5000)
1079
+ 17- `HIVE_MIND_RETRY_BACKOFF_DELAY_MS`: Backoff delay for retries (default: 1000)
1080
+ 18
1081
+ 19Available as: `timeouts.claudeCli`, `timeouts.githubApiDelay`, etc.
1082
+ 20
1083
+ 21### 2. Auto-Continue Settings (autoContinue)
1084
+ 22
1085
+ 23- `HIVE_MIND_AUTO_CONTINUE_AGE_HOURS`: Minimum age of PRs before auto-continue (default: 24)
1086
+ ```
1087
+
1088
+ ```
1089
+ 24
1090
+ 25Available as: `autoContinue.ageThresholdHours`
1091
+ 26
1092
+ ```
1093
+
1094
+ [deep-assistant/hive-mind](https://deepwiki.com/deep-assistant/hive-mind)
1095
+
1096
+ Какие промпты тут применяются? Дать цитаты и экспертизу как промпт инженер
1097
+
1098
+ Deep
1099
+
1100
+ Thought Process
1101
+
1102
+ # Prompts in the Agent System
1103
+
1104
+ The `src/claude.prompts.lib.mjs` file contains two main prompt-building functions with distinct approaches to guiding the AI agent's behavior.
1105
+
1106
+ ## Thinking Depth Control
1107
+
1108
+ The system implements a **tiered thinking depth mechanism** controlled by the `--think` flag with four levels:
1109
+
1110
+ **User Prompt (Short Commands):** claude.prompts.lib.mjs:75-83
1111
+
1112
+ **System Prompt (Persistent Instructions):** claude.prompts.lib.mjs:101-110
1113
+
1114
+ ### Prompt Engineering Analysis:
1115
+
1116
+ - **Progressive Intensity**: The levels (`low` → `medium` → `high` → `max`) use increasingly emphatic language ("Think" → "Think hard" → "Think harder" → "Ultrathink")
1117
+ - **Dual Reinforcement**: Instructions appear in both user and system prompts - user prompt gives immediate directive, system prompt establishes persistent behavior
1118
+ - **Behavioral Anchoring**: System prompt uses "always...on every step" phrasing to create consistent meta-cognitive behavior throughout the session
1119
+ - **Semantic Escalation**: The progression from standard thinking to "ultrathink" signals computational intensity without technical jargon
1120
+
1121
+ ## Structured Problem-Solving Prompts
1122
+
1123
+ The system prompt contains a comprehensive **conditional workflow framework** organized into five major sections:
1124
+
1125
+ **1\. General Guidelines** claude.prompts.lib.mjs:115-132
1126
+
1127
+ **2\. Initial Research** claude.prompts.lib.mjs:134-148
1128
+
1129
+ **3\. Solution Development and Testing** claude.prompts.lib.mjs:150-160
1130
+
1131
+ **4\. Preparing Pull Request** claude.prompts.lib.mjs:162-178
1132
+
1133
+ **5\. Workflow and Collaboration** claude.prompts.lib.mjs:180-190
1134
+
1135
+ **6\. Self Review** claude.prompts.lib.mjs:192-195
1136
+
1137
+ ### Prompt Engineering Analysis:
1138
+
1139
+ **Structural Patterns:**
1140
+
1141
+ - **"When...then" Conditionals**: Every guideline uses "When \[situation\], \[action\]" format, creating a decision tree that maps contexts to behaviors
1142
+ - **Phase-Based Organization**: The prompt mirrors a software development lifecycle (research → develop → test → prepare → review)
1143
+ - **Specificity Gradient**: Instructions become increasingly specific as they progress (general principles → concrete commands with actual GitHub CLI syntax)
1144
+
1145
+ **Behavioral Design:**
1146
+
1147
+ - **Procedural Memory**: Rather than abstract principles, the prompt embeds specific commands (`gh issue view`, `gh pr diff`) directly into instructions
1148
+ - **Error Prevention**: Multiple redundant checks (e.g., verify branch, check CI, confirm no uncommitted changes) create safety nets
1149
+ - **Tool-Use Scaffolding**: Instructions explicitly name tools and their contexts (WebFetch for images, Read for files), reducing ambiguity
1150
+ - **Defensive Programming Patterns**: Instructions like "always save logs to files" and "run commands in background" anticipate edge cases
1151
+
1152
+ **Cognitive Load Management:**
1153
+
1154
+ - **Chunking Strategy**: Complex tasks are broken into numbered substeps (e.g., the 5-step CI investigation protocol)
1155
+ - **Context Injection**: Dynamic variables like `${owner}`, `${repo}`, `${branchName}` are templated directly into commands, reducing mental overhead
1156
+ - **Persistent State References**: The prompt repeatedly refers back to specific branch names and PR numbers to maintain context
1157
+
1158
+ **Meta-Cognitive Elements:**
1159
+
1160
+ - **Self-Monitoring**: "When you check your solution draft" and "double-check" instructions encourage internal validation loops
1161
+ - **Help-Seeking Behavior**: Explicit instructions on when to ask for human help prevent the agent from getting stuck
1162
+ - **Documentation Habits**: Requirements to keep experiment scripts and maintain commit history create an audit trail
1163
+
1164
+ ## Notes
1165
+
1166
+ The prompt architecture demonstrates a **hybrid approach**:
1167
+
1168
+ 1. **Declarative layer** (system prompt): Establishes persistent behavioral rules and workflow structure
1169
+ 2. **Imperative layer** (user prompt): Provides immediate context and action triggers
1170
+
1171
+ The thinking depth control is notably **minimalist** - using brief, emphatic commands rather than lengthy explanations. This suggests the designers trust the model's pre-training to interpret escalating intensity signals.
1172
+
1173
+ The structured problem-solving prompts employ **situational awareness programming** - rather than giving a linear sequence of steps, they define behaviors for different scenarios the agent might encounter. This makes the system more robust to unexpected situations while maintaining consistent behavior patterns.
1174
+
1175
+ The extensive use of concrete examples and actual command syntax serves as **in-prompt documentation**, reducing the need for the model to recall or infer correct tool usage from general knowledge.
1176
+
1177
+ [deep-assistant/hive-mind](https://github.com/deep-assistant/hive-mind)[src/claude.prompts.lib.mjs](https://github.com/deep-assistant/hive-mind/blob/718b5d74/src/claude.prompts.lib.mjs)
1178
+
1179
+ ```
1180
+ 72 }
1181
+ 73
1182
+ 74 // Add thinking instruction based on --think level
1183
+ ```
1184
+
1185
+ ```
1186
+ 75 if (argv && argv.think) {
1187
+ 76 const thinkMessages = {
1188
+ 77 low: 'Think.',
1189
+ 78 medium: 'Think hard.',
1190
+ 79 high: 'Think harder.',
1191
+ 80 max: 'Ultrathink.'
1192
+ 81 };
1193
+ 82 promptLines.push(thinkMessages[argv.think]);
1194
+ 83 }
1195
+ ```
1196
+
1197
+ ```
1198
+ 84
1199
+ 85 // Final instruction
1200
+ 86 promptLines.push(isContinueMode ? 'Continue.' : 'Proceed.');
1201
+ ```
1202
+
1203
+ ```
1204
+ 98 const { owner, repo, issueNumber, prNumber, branchName, argv } = params;
1205
+ 99
1206
+ 100 // Build thinking instruction based on --think level
1207
+ ```
1208
+
1209
+ ```
1210
+ 101 let thinkLine = '';
1211
+ 102 if (argv && argv.think) {
1212
+ 103 const thinkMessages = {
1213
+ 104 low: 'You always think on every step.',
1214
+ 105 medium: 'You always think hard on every step.',
1215
+ 106 high: 'You always think harder on every step.',
1216
+ 107 max: 'You always ultrathink on every step.'
1217
+ 108 };
1218
+ 109 thinkLine = `\n${thinkMessages[argv.think]}\n`;
1219
+ 110 }
1220
+ ```
1221
+
1222
+ ```
1223
+ 111
1224
+ 112 // Use backticks for jq commands to avoid quote escaping issues
1225
+ 113 return `You are an AI issue solver. You prefer to find the root cause of each and every issue. When you talk, you prefer to speak with facts which you have double-checked yourself or cite sources that provide evidence, like quote actual code or give references to documents or pages found on the internet. You are polite and patient, and prefer to assume good intent, trying your best to be helpful. If you are unsure or have assumptions, you prefer to test them yourself or ask questions to clarify requirements.${thinkLine}
1226
+ 114
1227
+ ```
1228
+
1229
+ ```
1230
+ 115General guidelines.
1231
+ 116 - When you execute commands, always save their logs to files for easier reading if the output becomes large.
1232
+ 117 - When running commands, do not set a timeout yourself — let them run as long as needed (default timeout - 2 minutes is more than enough), and once they finish, review the logs in the file.
1233
+ 118 - When running sudo commands (especially package installations like apt-get, yum, npm install, etc.), always run them in the background to avoid timeout issues and permission errors when the process needs to be killed. Use the run_in_background parameter or append & to the command.
1234
+ 119 - When CI is failing or user reports failures, consider adding a detailed investigation protocol to your todo list with these steps:
1235
+ 120 Step 1: List recent runs with timestamps using: gh run list --repo ${owner}/${repo} --branch ${branchName} --limit 5 --json databaseId,conclusion,createdAt,headSha
1236
+ 121 Step 2: Verify runs are after the latest commit by checking timestamps and SHA
1237
+ 122 Step 3: For each non-passing run, download logs to preserve them: gh run view {run-id} --repo ${owner}/${repo} --log > ci-logs/{workflow}-{run-id}.log
1238
+ 123 Step 4: Read each downloaded log file using Read tool to understand the actual failures
1239
+ 124 Step 5: Report findings with specific errors and line numbers from logs
1240
+ 125 This detailed investigation is especially helpful when user mentions CI failures, asks to investigate logs, you see non-passing status, or when finalizing a PR.
1241
+ 126 Note: If user says "failing" but tools show "passing", this might indicate stale data - consider downloading fresh logs and checking timestamps to resolve the discrepancy.
1242
+ 127 - When a code or log file has more than 1500 lines, read it in chunks of 1500 lines.
1243
+ 128 - When facing a complex problem, do as much tracing as possible and turn on all verbose modes.
1244
+ 129 - When you create debug, test, or example/experiment scripts for fixing, always keep them in an examples and/or experiments folders so you can reuse them later.
1245
+ 130 - When testing your assumptions, use the experiment scripts, and add it to experiments folder.
1246
+ 131 - When your experiments can show real world use case of the software, add it to examples folder.
1247
+ 132 - When you face something extremely hard, use divide and conquer — it always helps.
1248
+ ```
1249
+
1250
+ ```
1251
+ 133
1252
+ ```
1253
+
1254
+ ```
1255
+ 134Initial research.
1256
+ 135 - When you start, make sure you create detailed plan for yourself and follow your todo list step by step, make sure that as many points from these guidelines are added to your todo list to keep track of everything that can help you solve the issue with highest possible quality.
1257
+ 136 - When user mentions CI failures or asks to investigate logs, consider adding these todos to track the investigation: (1) List recent CI runs with timestamps, (2) Download logs from failed runs to ci-logs/ directory, (3) Analyze error messages and identify root cause, (4) Implement fix, (5) Verify fix resolves the specific errors found in logs.
1258
+ 137 - When you read issue, read all details and comments thoroughly.
1259
+ 138 - When you see screenshots or images in issue descriptions, pull request descriptions, comments, or discussions, use WebFetch tool (or fetch tool) to download the image first, then use Read tool to view and analyze it.
1260
+ 139 - When you need issue details, use gh issue view https://github.com/${owner}/${repo}/issues/${issueNumber}.
1261
+ 140 - When you need related code, use gh search code --owner ${owner} [keywords].
1262
+ 141 - When you need repo context, read files in your working directory.
1263
+ 142 - When you study related work, study the most recent related pull requests.
1264
+ 143 - When issue is not defined enough, write a comment to ask clarifying questions.
1265
+ 144 - When accessing GitHub Gists (especially private ones), use gh gist view command instead of direct URL fetching to ensure proper authentication.
1266
+ 145 - When you are fixing a bug, please make sure you first find the actual root cause, do as many experiments as needed.
1267
+ 146 - When you are fixing a bug and code does not have enough tracing/logs, add them and make sure they stay in the code, but are switched off by default.
1268
+ 147 - When you need latest comments on pull request (sorted newest first), use appropriate GitHub API commands.
1269
+ 148 - When you need latest comments on issue (sorted newest first), use appropriate GitHub API commands.
1270
+ ```
1271
+
1272
+ ```
1273
+ 149
1274
+ ```
1275
+
1276
+ ```
1277
+ 150Solution development and testing.
1278
+ 151 - When issue is solvable, implement code with tests.
1279
+ 152 - When coding, each atomic step that can be useful by itself should be commited to the pull request's branch, meaning if work will be interrupted by any reason parts of solution will still be kept intact and safe in pull request.
1280
+ 153 - When you test:
1281
+ 154 start from testing of small functions using separate scripts;
1282
+ 155 write unit tests with mocks for easy and quick start.
1283
+ 156 - When you test integrations, use existing framework.
1284
+ 157 - When you test solution draft, include automated checks in pr.
1285
+ 158 - When issue is unclear, write comment on issue asking questions.
1286
+ 159 - When you encounter any problems that you unable to solve yourself (any human feedback or help), write a comment to the pull request asking for help.
1287
+ 160 - When you need human help, use gh pr comment ${prNumber} --body "your message" to comment on existing PR.
1288
+ ```
1289
+
1290
+ ```
1291
+ 161
1292
+ ```
1293
+
1294
+ ```
1295
+ 162Preparing pull request.
1296
+ 163 - When you code, follow contributing guidelines.
1297
+ 164 - When you commit, write clear message.
1298
+ 165 - When you need examples of style, use gh pr list --repo ${owner}/${repo} --state merged --search [keywords].
1299
+ 166 - When you open pr, describe solution draft and include tests.
1300
+ 167 - When there is a package with version and GitHub Actions workflows for automatic release, update the version (or other necessary release trigger) in your pull request to prepare for next release.
1301
+ 168 - When you update existing pr ${prNumber}, use gh pr edit to modify title and description.
1302
+ 169 - When you are about to commit or push code, ALWAYS run local CI checks first if they are available in contributing guidelines (like ruff check, mypy, eslint, etc.) to catch errors before pushing.
1303
+ 170 - When you finalize the pull request:
1304
+ 171 follow style from merged prs for code, title, and description,
1305
+ 172 make sure no uncommitted changes corresponding to the original requirements are left behind,
1306
+ 173 make sure the default branch is merged to the pull request's branch,
1307
+ 174 make sure all CI checks passing if they exist before you finish,
1308
+ 175 double-check that all changes in the pull request answer to original requirements of the issue,
1309
+ 176 make sure no new new bugs are introduced in pull request by carefully reading gh pr diff,
1310
+ 177 make sure no previously existing features were removed without an explicit request from users via the issue description, issue comments, and/or pull request comments.
1311
+ 178 - When you finish implementation, use gh pr ready ${prNumber}.
1312
+ ```
1313
+
1314
+ ```
1315
+ 179
1316
+ ```
1317
+
1318
+ ```
1319
+ 180Workflow and collaboration.
1320
+ 181 - When you check branch, verify with git branch --show-current.
1321
+ 182 - When you push, push only to branch ${branchName}.
1322
+ 183 - When you finish, create a pull request from branch ${branchName}. (Note: PR ${prNumber} already exists, update it instead)
1323
+ 184 - When you organize workflow, use pull requests instead of direct merges to default branch (main or master).
1324
+ 185 - When you manage commits, preserve commit history for later analysis.
1325
+ 186 - When you contribute, keep repository history forward-moving with regular commits, pushes, and reverts if needed.
1326
+ 187 - When you face conflict that you cannot resolve yourself, ask for help.
1327
+ 188 - When you collaborate, respect branch protections by working only on ${branchName}.
1328
+ 189 - When you mention result, include pull request url or comment url.
1329
+ 190 - When you need to create pr, remember pr ${prNumber} already exists for this branch.
1330
+ ```
1331
+
1332
+ ```
1333
+ 191
1334
+ ```
1335
+
1336
+ ```
1337
+ 192Self review.
1338
+ 193 - When you check your solution draft, run all tests locally.
1339
+ 194 - When you compare with repo style, use gh pr diff [number].
1340
+ 195 - When you finalize, confirm code, tests, and description are consistent.`;
1341
+ ```
1342
+
1343
+ ```
1344
+ 196};
1345
+ 197
1346
+ 198// Export all functions as default object too
1347
+ ```
1348
+
1349
+ [deep-assistant/hive-mind](https://deepwiki.com/deep-assistant/hive-mind)
1350
+
1351
+ Какие промпты тут применяются? Дать цитаты и экспертизу как промпт инженер
1352
+
1353
+ Codemap
1354
+
1355
+ Open with Windsurf
1356
+
1357
+ Архитектура промптов в Hive Mind
1358
+
1359
+ Карта показывает архитектуру промптов в системе Hive Mind, включая их генерацию \[1a\], выполнение \[2d\], специализацию для разных AI моделей \[4b\], обработку фидбека \[6c\] и интеграцию в основной процесс решения \[5b\].
1360
+
1361
+ 1
1362
+
1363
+ Генерация промптов для Claude
1364
+
1365
+ Создание user и system промптов на основе контекста задачи. See guide
1366
+
1367
+ AI generated guide
1368
+
1369
+ ## Motivation
1370
+
1371
+ Система нуждается в способе **управлять поведением AI** при решении задач GitHub. Без структурированных промптов AI может действовать непоследовательно, пропустить важные шаги или создавать некачественные решения. Промпты гарантируют, что AI следует проверенной методологии для каждого типа задач.
1372
+
1373
+ ## Details
1374
+
1375
+ ### Двухуровневая архитектура промптов
1376
+
1377
+ Система использует **user промпт** \[1a\] для контекста задачи и **system промпт** \[1c\] для инструкций поведения. User промпт динамически включает URL задачи, имя ветки и рабочую директорию, адаптируясь к конкретной ситуации.
1378
+
1379
+ ### Адаптивное мышление
1380
+
1381
+ Промпты поддерживают **четыре уровня мышления** \[1b\] — от базового "Think" до интенсивного "Ultrathink". Это позволяет регулировать глубину анализа AI в зависимости от сложности задачи.
1382
+
1383
+ ### Структурированная методология
1384
+
1385
+ System промпт определяет **пять фаз работы** \[1c\]:
1386
+
1387
+ 1. **Общие руководства** — сохранение логов, фоновые команды
1388
+ 2. **Начальное исследование** — анализ issue, поиск кода
1389
+ 3. **Разработка решения** — атомарные коммиты, тестирование
1390
+ 4. **Подготовка PR** — следование гайдлайнам, финализация
1391
+ 5. **Рабочий процесс** — управление ветками, историей коммитов
1392
+
1393
+ Каждая фаза содержит **конкретные инструкции "When...then"** \[1c\], которые направляют AI в различных сценариях, обеспечивая последовательное и надежное решение задач.
1394
+
1395
+ 1a
1396
+
1397
+ Функция построения user промпта
1398
+
1399
+ claude.prompts.lib.mjs:11
1400
+
1401
+ export const buildUserPrompt = (params) => {
1402
+
1403
+ Добавление основной информации
1404
+
1405
+ URL задачи
1406
+
1407
+ Имя ветки
1408
+
1409
+ Рабочая директория
1410
+
1411
+ Обработка уровней мышления
1412
+
1413
+ 1b
1414
+
1415
+ Уровни мышления
1416
+
1417
+ claude.prompts.lib.mjs:76
1418
+
1419
+ const thinkMessages = { low: 'Think.', medium: 'Think hard.', high: 'Think harder.', max: 'Ultrathink.' };
1420
+
1421
+ Финальная инструкция
1422
+
1423
+ 1c
1424
+
1425
+ Функция построения system промпта
1426
+
1427
+ claude.prompts.lib.mjs:97
1428
+
1429
+ export const buildSystemPrompt = (params) => {
1430
+
1431
+ 1d
1432
+
1433
+ Базовая личность AI
1434
+
1435
+ claude.prompts.lib.mjs:113
1436
+
1437
+ return \`You are an AI issue solver. You prefer to find the root cause...${thinkLine}
1438
+
1439
+ Общие руководства
1440
+
1441
+ Сохранение логов
1442
+
1443
+ Фоновые команды sudo
1444
+
1445
+ Протокол расследования CI
1446
+
1447
+ Начальное исследование
1448
+
1449
+ Чтение деталей issue
1450
+
1451
+ Поиск связанного кода
1452
+
1453
+ Разработка решения
1454
+
1455
+ Атомарные коммиты
1456
+
1457
+ Тестирование
1458
+
1459
+ Подготовка PR
1460
+
1461
+ Следование гайдлайнам
1462
+
1463
+ Финализация
1464
+
1465
+ Рабочий процесс
1466
+
1467
+ Работа с ветками
1468
+
1469
+ Сохранение истории
1470
+
1471
+ 2
1472
+
1473
+ Выполнение промптов в Claude
1474
+
1475
+ Передача сгенерированных промптов в Claude CLI. See guide
1476
+
1477
+ AI generated guide
1478
+
1479
+ # Motivation
1480
+
1481
+ Системе нужно **автоматически генерировать инструкции** для AI моделей, которые решают задачи разработки. Без этого каждый раз пришлось бы вручную писать промпты, что невозможно при масштабной обработке сотен issues. Промпты должны адаптироваться под контекст конкретной задачи, режим работы (новая задача или продолжение) и уровень глубины мышления \[2b\].
1482
+
1483
+ # Details
1484
+
1485
+ Процесс начинается с **импорта функций генерации** \[2a\], которые создают два типа промптов:
1486
+
1487
+ - **User промпт** содержит контекст задачи: URL issue, ветка, директория работы, информация о форке и фидбэк \[2b\]
1488
+ - **System промпт** определяет поведение AI: инструкции по работе с CI, git, тестированием и т.д. \[2c\]
1489
+
1490
+ После генерации промпты **экранируются** для безопасной передачи в shell \[2d\], затем формируется команда Claude с параметрами модели и переданными промптами. Система поддерживает разные уровни мышления от "Think" до "Ultrathink" \[2b\], что позволяет контролировать глубину анализа AI.
1491
+
1492
+ **Ключевая инновация** - промпты генерируются динамически на основе реального контекста репозитория, а не являются статическими шаблонами.
1493
+
1494
+ 2a
1495
+
1496
+ Импорт функций промптов
1497
+
1498
+ claude.lib.mjs:411
1499
+
1500
+ const { buildUserPrompt, buildSystemPrompt } = await import('./claude.prompts.lib.mjs');