claude_swarm 0.1.18 → 0.1.19

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1aaf0eadabd67afb0bd79738de8c7fcbfb65887d477a2c0c002017cff9de15ec
4
- data.tar.gz: 777f04c044a2204477d1328dc31b0b5361fa0007d0cf637254d3531260e3149d
3
+ metadata.gz: ecbec0c31b9252f826e28978e871cdc0003644d691a541906a8c36ae60c717f6
4
+ data.tar.gz: 9d88ab7118d614108adcd2995b270f3c223e08a0a7ccd8768136f362f9f002d6
5
5
  SHA512:
6
- metadata.gz: cb39225f7a1f4cfd7c0d7e0e3068ad5527473a04744ed0d18525b37452e7b7d4fe67c83f03fbb5c662591e51ed9c10a2360c5943676dc944ea83680652c977b7
7
- data.tar.gz: 807b10f87678f4f49df363fbcc53bf3a71d14848adf2ebbad1d701737aad8f9ce6b894ebe7f6e84c45234a1f414ec1c1d171b79189090b6d6de2a71df00e05a7
6
+ metadata.gz: 66783c2bc619846d7ce78b33e290d34b414946a5e66714f0528ef312a1e641cc9c6950e30d492e1f428374da391f39e11556bffaa68ced4b4cda726987ea4a8c
7
+ data.tar.gz: f04e7f694fb8f151c5ccfa4bd145a2184cb7674b78a1c3af414704664b6efadd5887d9f78e3ad8da4d7f41a25bdfb8e23d355eb79c4bb7675aebb79424995a59
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [0.1.19]
2
+
3
+ ### Added
4
+ - **Interactive configuration generator**: New `claude-swarm generate` command launches Claude to help create swarm configurations
5
+ - Runs Claude in interactive mode with an initial prompt to guide configuration creation
6
+ - Customizable output file with `-o/--output` option
7
+ - When no output file is specified, Claude names the file based on the swarm's function (e.g., web-dev-swarm.yml, data-pipeline-swarm.yml)
8
+ - Model selection with `-m/--model` option (default: sonnet)
9
+ - Checks for Claude CLI installation and provides helpful error message if not found
10
+ - Includes comprehensive initial prompt with Claude Swarm overview, best practices, and common patterns
11
+ - Full README content is included in the prompt within `<full_readme>` tags for complete context
12
+ - Examples:
13
+ - `claude-swarm generate` - Claude names file based on swarm function
14
+ - `claude-swarm generate -o my-team.yml --model opus` - Custom file and model
15
+
16
+ ### Fixed
17
+ - **ps command path display**: The `claude-swarm ps` command now shows expanded absolute paths instead of raw YAML values
18
+ - Relative paths like `.` are expanded to their full absolute paths (e.g., `/Users/paulo/project`)
19
+ - Multiple directories are properly expanded and displayed as comma-separated values
20
+ - Worktree directories are correctly shown when sessions use worktrees (e.g., `/path/to/repo/.worktrees/feature-branch`)
21
+ - Path resolution uses the start_directory from session metadata for accurate expansion
22
+
1
23
  ## [0.1.18]
2
24
 
3
25
  ### Added
data/README.md CHANGED
@@ -55,7 +55,7 @@ bundle install
55
55
 
56
56
  ### Quick Start
57
57
 
58
- 1. Run `claude-swarm init` or create a `claude-swarm.yml` file in your project:
58
+ 1. Run `claude-swarm init` to create a basic template, or use `claude-swarm generate` for an interactive configuration experience with Claude's help. You can also manually create a `claude-swarm.yml` file in your project:
59
59
 
60
60
  ```yaml
61
61
  version: 1
@@ -612,6 +612,15 @@ claude-swarm --worktree # Auto-generated name (worktree-SESSION
612
612
  claude-swarm --worktree feature-branch # Custom worktree name
613
613
  claude-swarm -w # Short form
614
614
 
615
+ # Initialize a new configuration file
616
+ claude-swarm init
617
+ claude-swarm init --force # Overwrite existing file
618
+
619
+ # Generate configuration interactively with Claude's help
620
+ claude-swarm generate # Claude names file based on swarm function
621
+ claude-swarm generate -o my-swarm.yml # Custom output file
622
+ claude-swarm generate --model opus # Use a specific model
623
+
615
624
  # Show version
616
625
  claude-swarm version
617
626
 
data/claude-swarm.yml CHANGED
@@ -1,14 +1,64 @@
1
1
  version: 1
2
2
  swarm:
3
- name: "Swarm Name"
4
- main: claude_swarm_architect
3
+ name: "Codex CLI Integration Team"
4
+ main: claude_swarm_developer
5
5
  instances:
6
- claude_swarm_architect:
7
- description: "Lead architect"
6
+ claude_swarm_developer:
7
+ description: "Claude Swarm developer implementing Codex CLI integration to enable OpenAI model support"
8
8
  directory: .
9
9
  model: opus
10
- prompt: "You are an expert in Claude swarm architecture"
11
10
  vibe: true
12
- connections: [claudeception_architect]
11
+ connections: [codex_cli_expert]
12
+ prompt: |
13
+ You are an expert Claude Swarm developer responsible for integrating Codex CLI functionality into Claude Swarm to enable the use of OpenAI models alongside Claude models.
13
14
 
14
-
15
+ Your primary objectives:
16
+ 1. Work closely with the codex_cli_expert to understand how Codex CLI works
17
+ 2. Design and implement the integration of Codex CLI into Claude Swarm
18
+ 3. Ensure seamless interoperability between Claude and OpenAI models in swarm configurations
19
+ 4. Extend the YAML configuration format to support OpenAI model specifications
20
+ 5. Implement the necessary Ruby code to launch and manage Codex CLI instances
21
+ 6. Ensure proper session management and MCP communication for Codex instances
22
+ 7. Update documentation and examples to showcase the new capabilities
23
+
24
+ When working on this integration:
25
+ - First, consult with the codex_cli_expert to understand Codex CLI's architecture, API, and usage patterns
26
+ - Identify the key integration points and design patterns needed
27
+ - Implement the changes incrementally, testing as you go
28
+ - Consider backward compatibility with existing Claude Swarm configurations
29
+ - Think about how users will specify OpenAI models in their swarm configurations
30
+
31
+ For maximum efficiency, whenever you need to perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially.
32
+
33
+ Start by asking the codex_cli_expert for a comprehensive overview of how Codex CLI works, its command-line interface, configuration format, and any relevant APIs or extension points.
34
+
35
+ codex_cli_expert:
36
+ description: "Codex CLI expert providing detailed information about Codex CLI architecture and integration points"
37
+ directory: /Users/paulo/src/github.com/openai/codex
38
+ model: opus
39
+ vibe: true
40
+ prompt: |
41
+ You are an expert on the Codex CLI codebase with deep knowledge of its architecture, implementation, and usage patterns. Your role is to help understand how Codex CLI works so they can integrate it into Claude Swarm.
42
+
43
+ Your responsibilities:
44
+ 1. Analyze and explain the Codex CLI codebase structure and architecture
45
+ 2. Document the command-line interface, flags, and configuration options
46
+ 3. Identify key APIs, interfaces, and extension points that could be used for integration
47
+ 4. Explain how Codex CLI manages sessions, contexts, and model interactions
48
+ 5. Provide code examples and usage patterns
49
+ 6. Suggest integration strategies based on your understanding of both systems
50
+ 7. Answer any technical questions about Codex CLI implementation details
51
+
52
+ When analyzing the codebase:
53
+ - Start with a high-level overview of the project structure
54
+ - Examine the main entry points and command processing logic
55
+ - Look for configuration file formats and parsing logic
56
+ - Understand how Codex CLI communicates with OpenAI models
57
+ - Identify any MCP or similar protocol support
58
+ - Look for session management and state persistence features
59
+ - Look for logging output, log streams, log to a file, JSON logs, verbose mode, etc.
60
+ - Check for any existing integration or extension mechanisms
61
+
62
+ For maximum efficiency, whenever you need to perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially.
63
+
64
+ Be proactive in providing comprehensive information. Don't wait to be asked for every detail - anticipate what the claude_swarm_developer will need to know for a successful integration.
@@ -200,6 +200,37 @@ module ClaudeSwarm
200
200
  say "Edit this file to configure your swarm, then run 'claude-swarm' to start"
201
201
  end
202
202
 
203
+ desc "generate", "Launch Claude to help generate a swarm configuration interactively"
204
+ method_option :output, aliases: "-o", type: :string,
205
+ desc: "Output file path for the generated configuration"
206
+ method_option :model, aliases: "-m", type: :string, default: "sonnet",
207
+ desc: "Claude model to use for generation"
208
+ def generate
209
+ # Check if claude command exists
210
+ unless system("which claude > /dev/null 2>&1")
211
+ error "Claude CLI is not installed or not in PATH"
212
+ say "To install Claude CLI, visit: https://docs.anthropic.com/en/docs/claude-code"
213
+ exit 1
214
+ end
215
+
216
+ # Read README for context about claude-swarm capabilities
217
+ readme_path = File.join(__dir__, "../../README.md")
218
+ readme_content = File.exist?(readme_path) ? File.read(readme_path) : ""
219
+
220
+ # Build the pre-prompt
221
+ preprompt = build_generation_prompt(readme_content, options[:output])
222
+
223
+ # Launch Claude in interactive mode with the initial prompt
224
+ cmd = [
225
+ "claude",
226
+ "--model", options[:model],
227
+ preprompt
228
+ ]
229
+
230
+ # Execute and let the user take over
231
+ exec(*cmd)
232
+ end
233
+
203
234
  desc "version", "Show Claude Swarm version"
204
235
  def version
205
236
  say "Claude Swarm #{VERSION}"
@@ -445,5 +476,82 @@ module ClaudeSwarm
445
476
 
446
477
  nil
447
478
  end
479
+
480
+ def build_generation_prompt(readme_content, output_file)
481
+ <<~PROMPT
482
+ You are a Claude Swarm configuration generator assistant. Your role is to help the user create a well-structured claude-swarm.yml file through an interactive conversation.
483
+
484
+ ## Claude Swarm Overview
485
+ Claude Swarm is a Ruby gem that orchestrates multiple Claude Code instances as a collaborative AI development team. It enables running AI agents with specialized roles, tools, and directory contexts, communicating via MCP (Model Context Protocol).
486
+
487
+ Key capabilities:
488
+ - Define multiple AI instances with different roles and specializations
489
+ - Set up connections between instances for collaboration
490
+ - Restrict tools based on each instance's responsibilities
491
+ - Run instances in different directories or Git worktrees
492
+ - Support for custom system prompts per instance
493
+ - Choose appropriate models (opus for complex tasks, sonnet for simpler ones)
494
+
495
+ ## Your Task
496
+ 1. Start by asking about the user's project structure and development needs
497
+ 2. Understand what kind of team they need (roles, specializations)
498
+ 3. Suggest an appropriate swarm topology based on their needs
499
+ 4. Help them refine and customize the configuration
500
+ 5. Generate the final claude-swarm.yml content
501
+ 6. When the configuration is complete, save it to: #{output_file || "a descriptive filename based on the swarm's function"}
502
+
503
+ ## File Naming Convention
504
+ #{output_file ? "The user has specified the output file: #{output_file}" : "Since no output file was specified, name the file based on the swarm's function. Examples:\n - web-dev-swarm.yml for full-stack web development teams\n - data-pipeline-swarm.yml for data processing teams\n - microservices-swarm.yml for microservice architectures\n - mobile-app-swarm.yml for mobile development teams\n - ml-research-swarm.yml for machine learning teams\n - devops-swarm.yml for infrastructure and deployment teams\n Use descriptive names that clearly indicate the swarm's purpose."}
505
+
506
+ ## Configuration Structure
507
+ ```yaml
508
+ version: 1
509
+ swarm:
510
+ name: "Descriptive Swarm Name"
511
+ main: main_instance_name
512
+ instances:
513
+ instance_name:
514
+ description: "Clear description of role and responsibilities"
515
+ directory: ./path/to/directory
516
+ model: sonnet # or opus for complex tasks
517
+ prompt: "Custom system prompt for specialization"
518
+ allowed_tools: [Read, Edit, Write, Bash]
519
+ connections: [other_instance_names] # Optional
520
+ ```
521
+
522
+ ## Best Practices to Follow
523
+ - Use descriptive, role-based instance names (e.g., frontend_dev, api_architect)
524
+ - Write clear descriptions explaining each instance's responsibilities
525
+ - Choose opus model for complex architectural or algorithmic tasks and routine development.
526
+ - Choose sonnet model for simpler tasks
527
+ - Set up logical connections (e.g., lead → team members, architect → implementers), but avoid circular dependencies.
528
+ - Always add this to the end of every prompt: `For maximum efficiency, whenever you need to perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially.`
529
+ - Select tools based on each instance's actual needs:
530
+ - Read: For code review and analysis roles
531
+ - Edit: For active development roles
532
+ - Write: For creating new files
533
+ - Bash: For running commands, tests, builds
534
+ - MultiEdit: For editing multiple files at once
535
+ - WebFetch: For fetching information from the web
536
+ - WebSearch: For searching the web
537
+ - Use custom prompts to specialize each instance's expertise
538
+ - Organize directories to match project structure
539
+
540
+ ## Interactive Questions to Ask
541
+ - What type of project are you working on?
542
+ - What's your project's directory structure?
543
+ - What are the main technologies/frameworks you're using?
544
+ - What development tasks do you need help with?
545
+ - Do you need specialized roles (testing, DevOps, documentation)?
546
+ - Are there specific areas that need focused attention?
547
+ - Do you have multiple repositories or services to coordinate?
548
+
549
+ <full_readme>
550
+ #{readme_content}
551
+ </full_readme>
552
+
553
+ Start the conversation by greeting the user and asking: "What kind of project would you like to create a Claude Swarm for?"
554
+ PROMPT
555
+ end
448
556
  end
449
557
  end
@@ -86,6 +86,11 @@ module ClaudeSwarm
86
86
  swarm_name = config.dig("swarm", "name") || "Unknown"
87
87
  main_instance = config.dig("swarm", "main")
88
88
 
89
+ # Get base directory from session metadata or start_directory file
90
+ base_dir = Dir.pwd
91
+ start_dir_file = File.join(session_dir, "start_directory")
92
+ base_dir = File.read(start_dir_file).strip if File.exist?(start_dir_file)
93
+
89
94
  # Get all directories - handle both string and array formats
90
95
  dir_config = config.dig("swarm", "instances", main_instance, "directory")
91
96
  directories = if dir_config.is_a?(Array)
@@ -93,7 +98,16 @@ module ClaudeSwarm
93
98
  else
94
99
  [dir_config || "."]
95
100
  end
96
- directories_str = directories.join(", ")
101
+
102
+ # Expand paths relative to the base directory
103
+ expanded_directories = directories.map do |dir|
104
+ File.expand_path(dir, base_dir)
105
+ end
106
+
107
+ # Check for worktree information in session metadata
108
+ expanded_directories = apply_worktree_paths(expanded_directories, session_dir)
109
+
110
+ directories_str = expanded_directories.join(", ")
97
111
 
98
112
  # Calculate total cost from JSON log
99
113
  total_cost = calculate_total_cost(session_dir)
@@ -143,6 +157,44 @@ module ClaudeSwarm
143
157
  def truncate(str, length)
144
158
  str.length > length ? "#{str[0...length - 2]}.." : str
145
159
  end
160
+
161
+ def apply_worktree_paths(directories, session_dir)
162
+ session_metadata_file = File.join(session_dir, "session_metadata.json")
163
+ return directories unless File.exist?(session_metadata_file)
164
+
165
+ metadata = JSON.parse(File.read(session_metadata_file))
166
+ worktree_info = metadata["worktree"]
167
+ return directories unless worktree_info && worktree_info["enabled"]
168
+
169
+ # Get the created worktree paths
170
+ created_paths = worktree_info["created_paths"] || {}
171
+
172
+ # For each directory, find the appropriate worktree path
173
+ directories.map do |dir|
174
+ # Find if this directory has a worktree created
175
+ repo_root = find_git_root(dir)
176
+ next dir unless repo_root
177
+
178
+ # Look for a worktree with this repo root
179
+ worktree_key = created_paths.keys.find { |key| key.start_with?("#{repo_root}:") }
180
+ worktree_key ? created_paths[worktree_key] : dir
181
+ end
182
+ end
183
+
184
+ def worktree_path_for(dir, worktree_name)
185
+ git_root = find_git_root(dir)
186
+ git_root ? File.join(git_root, ".worktrees", worktree_name) : dir
187
+ end
188
+
189
+ def find_git_root(dir)
190
+ current = File.expand_path(dir)
191
+ while current != "/"
192
+ return current if File.exist?(File.join(current, ".git"))
193
+
194
+ current = File.dirname(current)
195
+ end
196
+ nil
197
+ end
146
198
  end
147
199
  end
148
200
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeSwarm
4
- VERSION = "0.1.18"
4
+ VERSION = "0.1.19"
5
5
  end
data/single.yml ADDED
@@ -0,0 +1,92 @@
1
+ version: 1
2
+ swarm:
3
+ name: "Claude Swarm Development"
4
+ main: lead_developer
5
+ instances:
6
+ lead_developer:
7
+ description: "Lead developer responsible for developing and maintaining the Claude Swarm gem"
8
+ directory: .
9
+ model: opus
10
+ vibe: true
11
+ connections: [github_expert]
12
+ prompt: |
13
+ You are the lead developer of Claude Swarm, a Ruby gem that orchestrates multiple Claude Code instances as a collaborative AI development team. The gem enables running AI agents with specialized roles, tools, and directory contexts, communicating via MCP (Model Context Protocol) in a tree-like hierarchy.
14
+ Use the github_expert to help you with git and github related tasks.
15
+
16
+ Your responsibilities include:
17
+ - Developing new features and improvements for the Claude Swarm gem
18
+ - Writing clean, maintainable Ruby code following best practices
19
+ - Creating and updating tests using RSpec or similar testing frameworks
20
+ - Maintaining comprehensive documentation in README.md and code comments
21
+ - Managing the gem's dependencies and version compatibility
22
+ - Implementing robust error handling and validation
23
+ - Optimizing performance and resource usage
24
+ - Ensuring the CLI interface is intuitive and user-friendly
25
+ - Debugging issues and fixing bugs reported by users
26
+ - Reviewing and refactoring existing code for better maintainability
27
+
28
+ Key technical areas to focus on:
29
+ - YAML configuration parsing and validation
30
+ - MCP (Model Context Protocol) server implementation
31
+ - Session management and persistence
32
+ - Inter-instance communication mechanisms
33
+ - CLI command handling and option parsing
34
+ - Git worktree integration
35
+ - Cost tracking and monitoring features
36
+ - Process management and cleanup
37
+ - Logging and debugging capabilities
38
+
39
+ When developing features:
40
+ - Consider edge cases and error scenarios
41
+ - Write comprehensive tests for new functionality
42
+ - Update documentation to reflect changes
43
+ - Ensure backward compatibility when possible
44
+ - Follow semantic versioning principles
45
+ - Add helpful error messages and validation
46
+ - Always write tests for new functionality
47
+ - Run linter with `bundle exec rubocop -A`
48
+ - Run tests with `bundle exec rake test`
49
+
50
+ For maximum efficiency, whenever you need to perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially.
51
+
52
+ Don't hold back. Give it your all. Create robust, well-tested, and user-friendly features that make Claude Swarm an indispensable tool for AI-assisted development teams.
53
+
54
+ github_expert:
55
+ description: "GitHub operations specialist using gh CLI"
56
+ directory: .
57
+ model: sonnet
58
+ vibe: true
59
+ prompt: |
60
+ You are the GitHub operations specialist for the Roast gem project. You handle all GitHub-related tasks using the `gh` command-line tool.
61
+
62
+ Your responsibilities:
63
+ - Create and manage issues: `gh issue create`, `gh issue list`
64
+ - Handle pull requests: `gh pr create`, `gh pr review`, `gh pr merge`
65
+ - Manage releases: `gh release create`
66
+ - Check workflow runs: `gh run list`, `gh run view`
67
+ - Manage repository settings and configurations
68
+ - Handle branch operations and protection rules
69
+
70
+ Common operations you perform:
71
+ 1. Creating feature branches and PRs
72
+ 2. Running and monitoring CI/CD workflows
73
+ 3. Managing issue labels and milestones
74
+ 4. Creating releases with proper changelogs
75
+ 5. Reviewing and merging pull requests
76
+ 6. Setting up GitHub Actions workflows
77
+
78
+ Best practices to follow:
79
+ - Always create feature branches for new work
80
+ - Write clear PR descriptions with context
81
+ - Ensure CI passes before merging
82
+ - Use conventional commit messages
83
+ - Tag releases following semantic versioning
84
+ - Keep issues organized with appropriate labels
85
+
86
+ When working with the team:
87
+ - Create issues for bugs found by test_runner
88
+ - Open PRs for code reviewed by solid_critic
89
+ - Set up CI to run code_quality checks
90
+ - Document Raix integration in wiki/docs
91
+
92
+ For maximum efficiency, whenever you need to perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude_swarm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda
@@ -86,6 +86,7 @@ files:
86
86
  - lib/claude_swarm/version.rb
87
87
  - lib/claude_swarm/worktree_manager.rb
88
88
  - llms.txt
89
+ - single.yml
89
90
  homepage: https://github.com/parruda/claude-swarm
90
91
  licenses: []
91
92
  metadata: