Skip to content

Commit bbffd77

Browse files
authored
Merge pull request #2 from SynthoraAI-AI-News-Content-Curator/claude/ai-agent-communication-013MuuopTHxcaVazscD5kJn9
Add interactive shell with multi-round conversation support
2 parents 49dbe5c + a645506 commit bbffd77

8 files changed

Lines changed: 1471 additions & 26 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Son Nguyen
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 70 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ This project provides a wrapper CLI that coordinates multiple AI agents to work
1414
## Features
1515

1616
- 🤝 **Multi-Agent Collaboration**: Coordinate multiple AI coding assistants
17+
- 💬 **Interactive Shell**: REPL-style interface with multi-round conversations (like Claude Code & Codex CLIs)
18+
- 📝 **Conversation History**: Context preservation across interactions
19+
- 💾 **Session Management**: Save and load conversation sessions
1720
- 🔧 **Extensible Architecture**: Easy to add new AI agents
1821
- ⚙️ **Configurable Workflows**: Define custom collaboration patterns
1922
- 📊 **Detailed Logging**: Track agent interactions and decisions
@@ -112,44 +115,81 @@ workflows:
112115
113116
## Usage
114117
115-
### Basic Usage
118+
### Interactive Shell (Recommended)
119+
120+
Start an interactive shell for multi-round conversations, similar to Claude Code and Codex CLIs:
121+
122+
```bash
123+
# Start interactive shell
124+
./ai-orchestrator shell
125+
126+
# Start with specific workflow
127+
./ai-orchestrator shell --workflow thorough
128+
```
129+
130+
**Interactive features:**
131+
- Multi-round conversations with context preservation
132+
- Switch between agents on-the-fly
133+
- Save and load conversation sessions
134+
- Full readline support (arrow keys, command history, tab completion)
135+
- Shell commands for control (/help, /switch, /save, etc.)
136+
137+
See [Interactive Shell Guide](docs/interactive-shell.md) for detailed documentation.
138+
139+
**Example interactive session:**
140+
141+
```
142+
orchestrator (default) > Create a user authentication module with JWT
143+
144+
✓ Task completed successfully!
145+
146+
orchestrator (default) > Add password reset functionality
147+
148+
✓ Task completed successfully!
149+
150+
orchestrator (default) > /save auth-module
151+
Session saved!
152+
153+
orchestrator (default) > /exit
154+
```
155+
156+
### One-Shot Command Mode
157+
158+
For single, non-interactive tasks:
116159

117160
```bash
118161
# Run with default workflow
119-
./ai-orchestrator "Create a REST API with user authentication"
162+
./ai-orchestrator run "Create a REST API with user authentication"
120163

121164
# Specify a custom workflow
122-
./ai-orchestrator --workflow custom "Implement a binary search tree"
165+
./ai-orchestrator run "Implement a binary search tree" --workflow thorough
123166

124167
# Dry run to see the execution plan
125-
./ai-orchestrator --dry-run "Add error handling to the payment service"
168+
./ai-orchestrator run "Add error handling to the payment service" --dry-run
126169

127170
# Verbose mode for detailed logging
128-
./ai-orchestrator -v "Refactor the database layer"
171+
./ai-orchestrator run "Refactor the database layer" --verbose
129172
```
130173

131174
### Advanced Usage
132175

133176
```bash
134-
# Use specific agents only
135-
./ai-orchestrator --agents codex,claude "Optimize the sorting algorithm"
136-
137177
# Set maximum iterations
138-
./ai-orchestrator --max-iterations 5 "Implement and test a caching layer"
178+
./ai-orchestrator run "Implement and test a caching layer" --max-iterations 5
139179

140180
# Output to specific directory
141-
./ai-orchestrator --output ./output "Generate a CLI tool for file processing"
181+
./ai-orchestrator run "Generate a CLI tool" --output ./output
142182

143-
# Interactive mode
144-
./ai-orchestrator --interactive
183+
# Custom configuration
184+
./ai-orchestrator run "Task description" --config ./my-config.yaml
145185
```
146186

147187
## Workflow Examples
148188

149189
### 1. Standard Implementation Flow
150190

151191
```bash
152-
./ai-orchestrator "Create a user authentication module with JWT tokens"
192+
./ai-orchestrator run "Create a user authentication module with JWT tokens"
153193
```
154194

155195
**Process:**
@@ -161,24 +201,27 @@ workflows:
161201
### 2. Review-Only Workflow
162202

163203
```bash
164-
./ai-orchestrator --workflow review-only --file ./src/auth.py
204+
./ai-orchestrator run "Review this code" --workflow review-only
165205
```
166206

167207
**Process:**
168208
1. Gemini reviews existing code
169209
2. Claude implements improvements
170210

171-
### 3. Collaborative Development
211+
### 3. Interactive Development Session
172212

173213
```bash
174-
./ai-orchestrator --workflow collaborative "Build a task queue system"
214+
./ai-orchestrator shell
215+
216+
> Create a task queue system
217+
> Add priority support
218+
> Add worker pool management
219+
> Write tests for the task queue
220+
> /save task-queue-project
175221
```
176222

177223
**Process:**
178-
1. Codex creates initial implementation
179-
2. Copilot suggests optimizations
180-
3. Gemini reviews architecture
181-
4. Claude implements all feedback
224+
Multi-round conversation with context preservation, allowing iterative refinement
182225

183226
## Project Structure
184227

@@ -189,24 +232,27 @@ AI-Coding-Tools-Collaborative/
189232
│ ├── __init__.py
190233
│ ├── core.py # Core orchestration logic
191234
│ ├── workflow.py # Workflow management
192-
│ └── task_manager.py # Task distribution
235+
│ ├── task_manager.py # Task distribution
236+
│ └── shell.py # Interactive shell/REPL
193237
├── adapters/
194238
│ ├── __init__.py
195239
│ ├── base.py # Base adapter interface
240+
│ ├── cli_communicator.py # Robust CLI communication
196241
│ ├── claude_adapter.py # Claude Code adapter
197242
│ ├── codex_adapter.py # Codex adapter
198243
│ ├── gemini_adapter.py # Gemini adapter
199244
│ └── copilot_adapter.py # Copilot adapter
200245
├── config/
201-
│ ├── agents.yaml # Agent configuration
202-
│ └── workflows.yaml # Workflow definitions
246+
│ └── agents.yaml # Agent and workflow configuration
203247
├── tests/
204248
│ ├── __init__.py
205249
│ ├── test_adapters.py # Adapter tests
206250
│ ├── test_orchestrator.py # Orchestrator tests
207-
│ └── test_integration.py # End-to-end tests
251+
│ ├── test_integration.py # End-to-end tests
252+
│ └── test_shell.py # Interactive shell tests
208253
├── docs/
209254
│ ├── architecture.md # Architecture details
255+
│ ├── interactive-shell.md # Interactive shell guide
210256
│ ├── adding-agents.md # Guide for adding new agents
211257
│ └── workflows.md # Workflow configuration guide
212258
├── examples/

ai-orchestrator

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import yaml
2020
# Add project root to path
2121
sys.path.insert(0, str(Path(__file__).parent))
2222

23-
from orchestrator import Orchestrator
23+
from orchestrator import Orchestrator, InteractiveShell
2424
from adapters import AgentCapability
2525

2626

@@ -305,5 +305,55 @@ def version():
305305
console.print("A collaborative AI coding assistant orchestration system")
306306

307307

308+
@cli.command()
309+
@click.option('--config', '-c', type=click.Path(exists=True),
310+
help='Path to configuration file')
311+
@click.option('--workflow', '-w', default='default',
312+
help='Default workflow to use')
313+
def shell(config, workflow):
314+
"""
315+
Start an interactive shell for multi-round conversations.
316+
317+
The interactive shell provides a REPL-style interface similar to
318+
Claude Code and Codex CLIs, allowing multi-round conversations,
319+
context preservation, and iterative development.
320+
321+
Examples:
322+
ai-orchestrator shell
323+
ai-orchestrator shell --workflow thorough
324+
"""
325+
config_path = config or Path(__file__).parent / "config" / "agents.yaml"
326+
327+
# Setup logging for shell
328+
setup_logging('INFO', 'ai-orchestrator.log')
329+
330+
try:
331+
# Create and start interactive shell
332+
interactive_shell = InteractiveShell(config_path)
333+
interactive_shell.history.workflow = workflow
334+
interactive_shell.start()
335+
except KeyboardInterrupt:
336+
console.print("\n[yellow]Exiting...[/yellow]")
337+
except Exception as e:
338+
console.print(f"[red]Error starting shell: {e}[/red]")
339+
sys.exit(1)
340+
341+
342+
@cli.command()
343+
@click.option('--config', '-c', type=click.Path(exists=True),
344+
help='Path to configuration file')
345+
@click.option('--workflow', '-w', default='default',
346+
help='Default workflow to use')
347+
def interactive(config, workflow):
348+
"""
349+
Alias for 'shell' command - start interactive mode.
350+
351+
Same as running 'ai-orchestrator shell'.
352+
"""
353+
# Just call shell with same parameters
354+
ctx = click.get_current_context()
355+
ctx.invoke(shell, config=config, workflow=workflow)
356+
357+
308358
if __name__ == '__main__':
309359
cli()

0 commit comments

Comments
 (0)