claude_swarm 0.1.20 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -66
  3. data/.rubocop_todo.yml +11 -0
  4. data/CHANGELOG.md +106 -0
  5. data/CLAUDE.md +61 -0
  6. data/README.md +174 -16
  7. data/Rakefile +1 -1
  8. data/examples/mixed-provider-swarm.yml +23 -0
  9. data/lib/claude_swarm/claude_code_executor.rb +7 -12
  10. data/lib/claude_swarm/claude_mcp_server.rb +26 -12
  11. data/lib/claude_swarm/cli.rb +293 -165
  12. data/lib/claude_swarm/commands/ps.rb +22 -24
  13. data/lib/claude_swarm/commands/show.rb +45 -63
  14. data/lib/claude_swarm/configuration.rb +161 -8
  15. data/lib/claude_swarm/mcp_generator.rb +39 -14
  16. data/lib/claude_swarm/openai/chat_completion.rb +264 -0
  17. data/lib/claude_swarm/openai/executor.rb +301 -0
  18. data/lib/claude_swarm/openai/responses.rb +338 -0
  19. data/lib/claude_swarm/orchestrator.rb +205 -39
  20. data/lib/claude_swarm/process_tracker.rb +7 -7
  21. data/lib/claude_swarm/session_cost_calculator.rb +93 -0
  22. data/lib/claude_swarm/session_path.rb +3 -5
  23. data/lib/claude_swarm/system_utils.rb +1 -3
  24. data/lib/claude_swarm/tools/reset_session_tool.rb +24 -0
  25. data/lib/claude_swarm/tools/session_info_tool.rb +24 -0
  26. data/lib/claude_swarm/tools/task_tool.rb +43 -0
  27. data/lib/claude_swarm/version.rb +1 -1
  28. data/lib/claude_swarm/worktree_manager.rb +39 -22
  29. data/lib/claude_swarm.rb +23 -10
  30. data/single.yml +481 -6
  31. metadata +54 -14
  32. data/claude-swarm.yml +0 -64
  33. data/lib/claude_swarm/reset_session_tool.rb +0 -22
  34. data/lib/claude_swarm/session_info_tool.rb +0 -22
  35. data/lib/claude_swarm/task_tool.rb +0 -39
  36. /data/{example → examples}/claude-swarm.yml +0 -0
  37. /data/{example → examples}/microservices-team.yml +0 -0
  38. /data/{example → examples}/session-restoration-demo.yml +0 -0
  39. /data/{example → examples}/test-generation.yml +0 -0
data/claude-swarm.yml DELETED
@@ -1,64 +0,0 @@
1
- version: 1
2
- swarm:
3
- name: "Codex CLI Integration Team"
4
- main: claude_swarm_developer
5
- instances:
6
- claude_swarm_developer:
7
- description: "Claude Swarm developer implementing Codex CLI integration to enable OpenAI model support"
8
- directory: .
9
- model: opus
10
- vibe: true
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.
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.
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ClaudeSwarm
4
- class ResetSessionTool < FastMcp::Tool
5
- tool_name "reset_session"
6
- description "Reset the Claude session for this agent, starting fresh on the next task"
7
-
8
- arguments do
9
- # No arguments needed
10
- end
11
-
12
- def call
13
- executor = ClaudeMcpServer.executor
14
- executor.reset_session
15
-
16
- {
17
- success: true,
18
- message: "Session has been reset"
19
- }
20
- end
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ClaudeSwarm
4
- class SessionInfoTool < FastMcp::Tool
5
- tool_name "session_info"
6
- description "Get information about the current Claude session for this agent"
7
-
8
- arguments do
9
- # No arguments needed
10
- end
11
-
12
- def call
13
- executor = ClaudeMcpServer.executor
14
-
15
- {
16
- has_session: executor.has_session?,
17
- session_id: executor.session_id,
18
- working_directory: executor.working_directory
19
- }
20
- end
21
- end
22
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ClaudeSwarm
4
- class TaskTool < FastMcp::Tool
5
- tool_name "task"
6
- description "Execute a task using Claude Code. There is no description parameter."
7
- annotations(read_only_hint: true, open_world_hint: false, destructive_hint: false)
8
-
9
- arguments do
10
- required(:prompt).filled(:string).description("The task or question for the agent")
11
- optional(:new_session).filled(:bool).description("Start a new session (default: false)")
12
- optional(:system_prompt).filled(:string).description("Override the system prompt for this request")
13
- end
14
-
15
- def call(prompt:, new_session: false, system_prompt: nil)
16
- executor = ClaudeMcpServer.executor
17
- instance_config = ClaudeMcpServer.instance_config
18
-
19
- options = {
20
- new_session: new_session,
21
- system_prompt: system_prompt || instance_config[:prompt]
22
- }
23
-
24
- # Add allowed tools from instance config
25
- options[:allowed_tools] = instance_config[:allowed_tools] if instance_config[:allowed_tools]&.any?
26
-
27
- # Add disallowed tools from instance config
28
- options[:disallowed_tools] = instance_config[:disallowed_tools] if instance_config[:disallowed_tools]&.any?
29
-
30
- # Add connections from instance config
31
- options[:connections] = instance_config[:connections] if instance_config[:connections]&.any?
32
-
33
- response = executor.execute(prompt, options)
34
-
35
- # Return just the result text as expected by MCP
36
- response["result"]
37
- end
38
- end
39
- end
File without changes
File without changes
File without changes
File without changes