Skip to content

Commit fa3d64c

Browse files
committed
Refactor VTAgent to remove multi-agent support and enhance single-agent functionality
- Updated ContextCompressor to preserve decision ledger summaries. - Added methods in DecisionTracker for recording user goals and rendering decision ledgers. - Removed unused imports and multi-agent related code from various modules. - Simplified Router logic by eliminating multi-agent decision-making. - Enhanced TrajectoryLogger to log routing decisions and actions. - Updated user confirmation prompts to reflect single-agent mode. - Adjusted SafetyValidator to validate agent mode for single-agent usage. - Removed multi-agent configuration from TOML files and tests. - Added new tests for file writing and editing functionalities.
1 parent 1d7be3e commit fa3d64c

File tree

108 files changed

+1895
-12741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1895
-12741
lines changed

.ruler/AGENTS.md

Lines changed: 133 additions & 114 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 150 additions & 103 deletions
Large diffs are not rendered by default.

ROADMAP.md

Lines changed: 124 additions & 125 deletions
Large diffs are not rendered by default.

docs/ADVANCED_FEATURES_IMPLEMENTATION.md

Lines changed: 110 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,53 @@
22

33
## Overview
44

5-
This document summarizes the implementation of advanced features in VTAgent, including debug mode for multi-agent systems, safety controls, and error recovery mechanisms.
5+
This document summarizes the implementation of advanced features in VTAgent, safety controls, and error recovery mechanisms.
66

77
## Debug Mode Implementation
88

9-
### Overview
10-
Debug mode provides comprehensive logging and error recovery for the multi-agent system in VTAgent, along with fixes for malformed function call errors.
11-
129
### Changes Made
1310

1411
#### 1. Debug Mode Configuration
15-
- Added `debug_mode: bool` field to `MultiAgentConfig` struct
16-
- Added `DEBUG_MODE` constant to `MultiAgentDefaults` (default: false)
17-
- Updated `MultiAgentSystemConfig` to include `debug_mode` field
18-
- Added debug mode configuration to `vtagent.toml.example`
1912

20-
#### 2. Multi-Agent Loop Improvements
21-
- **Malformed Function Call Handling**: Added proper error detection and recovery for `MALFORMED_FUNCTION_CALL` errors
22-
- **Debug Logging**: Comprehensive debug output when debug mode is enabled
23-
- **Error Recovery**: Automatic retry with simplified approach when function calls are malformed
13+
- Added `debug_mode: bool` field to `MultiAgentConfig` struct
14+
- Added `DEBUG_MODE` constant to `MultiAgentDefaults` (default: false)
15+
- Updated `MultiAgentSystemConfig` to include `debug_mode` field
16+
- Added debug mode configuration to `vtagent.toml.example`
2417

2518
#### 3. Debug Features Added
2619

2720
##### Configuration Debug Info
21+
2822
When debug mode is enabled, the system displays:
29-
- Session ID
30-
- Orchestrator model
31-
- Subagent model
32-
- Max concurrent subagents
23+
24+
- Session ID
25+
- Orchestrator model
26+
- Subagent model
27+
- Max concurrent subagents
3328

3429
##### Conversation Debug Info
35-
- User input logging
36-
- Conversation length tracking
37-
- Response analysis (number of candidates, finish reasons)
30+
31+
- User input logging
32+
- Conversation length tracking
33+
- Response analysis (number of candidates, finish reasons)
3834

3935
##### Tool Execution Debug Info
40-
- Tool name and arguments before execution
41-
- Tool execution results (formatted JSON)
42-
- Error details when tool execution fails
36+
37+
- Tool name and arguments before execution
38+
- Tool execution results (formatted JSON)
39+
- Error details when tool execution fails
4340

4441
##### Loop Control Debug Info
45-
- Tool call detection status
46-
- Text response detection status
47-
- Loop continuation/termination reasons
48-
- No content/no candidates error tracking
42+
43+
- Tool call detection status
44+
- Text response detection status
45+
- Loop continuation/termination reasons
46+
- No content/no candidates error tracking
4947

5048
#### 4. Error Handling Improvements
5149

5250
##### Malformed Function Call Recovery
51+
5352
```rust
5453
if finish_reason == "MALFORMED_FUNCTION_CALL" {
5554
println!("(malformed function call in orchestrator - retrying with simpler approach)");
@@ -60,6 +59,7 @@ if finish_reason == "MALFORMED_FUNCTION_CALL" {
6059
## Safety Implementation
6160

6261
### Overview
62+
6363
Safety implementation adds critical safety and efficiency controls to VTAgent, ensuring user explicit confirmation for expensive operations and defaulting to single-agent mode for optimal resource usage.
6464

6565
### Key Safety Features Implemented
@@ -69,96 +69,98 @@ Safety implementation adds critical safety and efficiency controls to VTAgent, e
6969
**Critical Safety Requirement**: Before attempting to switch to the most capable model ("gemini-2.5-pro"), always ask for explicit user confirmation.
7070

7171
**Implementation**:
72-
- Added `SafetyValidator::validate_model_usage()` function
73-
- Automatically detects when Gemini 2.5 Pro is requested
74-
- Shows clear warning about cost and performance implications:
75-
```
76-
Model Upgrade Required
77-
Current model: gemini-2.5-flash-lite
78-
Requested model: gemini-2.5-pro
79-
80-
The Gemini 2.5 Pro model is the most capable but also:
81-
• More expensive per token
82-
• Slower response times
83-
• Higher resource usage
84-
85-
Do you want to proceed with the more capable (and expensive) Gemini 2.5 Pro model?
86-
```
87-
- Falls back to default model if user declines
72+
73+
- Added `SafetyValidator::validate_model_usage()` function
74+
- Automatically detects when Gemini 2.5 Pro is requested
75+
- Shows clear warning about cost and performance implications:
76+
77+
```
78+
Model Upgrade Required
79+
Current model: gemini-2.5-flash-lite
80+
Requested model: gemini-2.5-pro
81+
82+
The Gemini 2.5 Pro model is the most capable but also:
83+
• More expensive per token
84+
• Slower response times
85+
• Higher resource usage
86+
87+
Do you want to proceed with the more capable (and expensive) Gemini 2.5 Pro model?
88+
```
89+
90+
- Falls back to default model if user declines
8891
8992
#### 2. Agent Mode Safety
9093
91-
**Critical Efficiency Requirement**: The orchestrator must default to using one single simple coder agent for all tasks. Switch to a multi-agent setup only for complex tasks, and always ask for explicit user confirmation.
94+
**Critical Efficiency Requirement**: The orchestrator must default to using one single simple coder agent for all tasks.
9295
9396
**Implementation**:
94-
- **Changed default**: `ENABLE_MULTI_AGENT` now defaults to `false` (single-agent mode)
95-
- Added `SafetyValidator::validate_agent_mode()` function
96-
- Automatic task complexity assessment:
97-
```
98-
📊 Task Complexity Assessment
99-
Task: [user's task description]
100-
101-
How would you classify this task's complexity?
102-
> Simple (single file edit, basic question, straightforward task)
103-
Moderate (multiple files, refactoring, testing)
104-
Complex (architecture changes, cross-cutting concerns, large refactoring)
105-
```
106-
- Smart recommendations based on complexity:
107-
- **Simple/Moderate**: Recommends single coder agent
108-
- **Complex**: Recommends multi-agent with confirmation
97+
98+
- Added `SafetyValidator::validate_agent_mode()` function
99+
- Automatic task complexity assessment:
100+
101+
```
102+
📊 Task Complexity Assessment
103+
Task: [user's task description]
104+
105+
How would you classify this task's complexity?
106+
> Simple (single file edit, basic question, straightforward task)
107+
Moderate (multiple files, refactoring, testing)
108+
Complex (architecture changes, cross-cutting concerns, large refactoring)
109+
```
110+
111+
- Smart recommendations based on complexity:
112+
- **Simple/Moderate**: Recommends single coder agent
109113
110114
#### 3. Command Execution Safety
111115
112116
**Security Controls**: Enhanced command execution with pattern-based validation and user confirmation for dangerous operations.
113117
114118
**Implementation**:
115-
- Pattern-based command classification
116-
- Dangerous command detection (rm, dd, format, etc.)
117-
- User confirmation prompts for risky operations
118-
- Command allow/deny lists
119-
- Enhanced error handling for command execution
119+
120+
- Pattern-based command classification
121+
- Dangerous command detection (rm, dd, format, etc.)
122+
- User confirmation prompts for risky operations
123+
- Command allow/deny lists
124+
- Enhanced error handling for command execution
120125
121126
#### 4. File Operation Safety
122127
123128
**File System Protection**: Comprehensive file operation validation and safety checks.
124129
125130
**Implementation**:
126-
- Path validation and normalization
127-
- Permission checking before file operations
128-
- .vtagentgitignore integration for file exclusions
129-
- Safe file writing with backup mechanisms
130-
- Directory traversal protection
131+
132+
- Path validation and normalization
133+
- Permission checking before file operations
134+
- .vtagentgitignore integration for file exclusions
135+
- Safe file writing with backup mechanisms
136+
- Directory traversal protection
131137
132138
## Integration and Testing
133139
134140
### Debug Mode Testing
135-
- Comprehensive test coverage for debug logging
136-
- Error recovery mechanism validation
137-
- Multi-agent loop stability testing
138-
- Performance impact assessment
141+
142+
- Comprehensive test coverage for debug logging
143+
- Error recovery mechanism validation
144+
- Performance impact assessment
139145
140146
### Safety Feature Testing
141-
- Model usage confirmation flow testing
142-
- Agent mode selection validation
143-
- Command execution safety verification
144-
- File operation security testing
147+
148+
- Model usage confirmation flow testing
149+
- Agent mode selection validation
150+
- Command execution safety verification
151+
- File operation security testing
145152
146153
### Cross-Feature Integration
147-
- Debug mode and safety feature compatibility
148-
- Error handling integration testing
149-
- Performance monitoring and optimization
150-
- User experience validation
151154
152-
## Configuration
155+
- Debug mode and safety feature compatibility
156+
- Error handling integration testing
157+
- Performance monitoring and optimization
158+
- User experience validation
153159
154-
### Debug Mode Configuration
155-
```toml
156-
[multi_agent]
157-
enabled = true
158-
debug_mode = true # Enable debug logging
159-
```
160+
## Configuration
160161
161162
### Safety Configuration
163+
162164
```toml
163165
[agent]
164166
# Safety settings
@@ -174,32 +176,36 @@ dangerous_commands_require_confirmation = true
174176
## Performance Considerations
175177

176178
### Debug Mode Performance
177-
- Debug logging has minimal performance impact when disabled
178-
- Memory-efficient logging mechanisms
179-
- Configurable debug levels for different verbosity needs
180-
- Background logging to avoid blocking operations
179+
180+
- Debug logging has minimal performance impact when disabled
181+
- Memory-efficient logging mechanisms
182+
- Configurable debug levels for different verbosity needs
183+
- Background logging to avoid blocking operations
181184

182185
### Safety Feature Performance
183-
- Lightweight validation checks
184-
- Efficient pattern matching for command classification
185-
- Cached file system permission checks
186-
- Minimal overhead for safety validations
186+
187+
- Lightweight validation checks
188+
- Efficient pattern matching for command classification
189+
- Cached file system permission checks
190+
- Minimal overhead for safety validations
187191

188192
## Future Enhancements
189193

190194
### Planned Debug Features
191-
- Advanced debugging dashboard
192-
- Real-time performance monitoring
193-
- Enhanced error reporting and analytics
194-
- Debug data export capabilities
195+
196+
- Advanced debugging dashboard
197+
- Real-time performance monitoring
198+
- Enhanced error reporting and analytics
199+
- Debug data export capabilities
195200

196201
### Planned Safety Features
197-
- Advanced threat detection
198-
- Machine learning-based anomaly detection
199-
- Enhanced audit logging
200-
- Automated security policy recommendations
202+
203+
- Advanced threat detection
204+
- Machine learning-based anomaly detection
205+
- Enhanced audit logging
206+
- Automated security policy recommendations
201207

202208
---
203209

204-
*This document covers the implementation of debug mode and safety features in VTAgent. For user-facing documentation, see the respective guide documents.*</content>
210+
_This document covers the implementation of debug mode and safety features in VTAgent. For user-facing documentation, see the respective guide documents._</content>
205211
<parameter name="filePath">/Users/vinh.nguyenxuan/Developer/learn-by-doing/vtagent/docs/ADVANCED_FEATURES_IMPLEMENTATION.md

0 commit comments

Comments
 (0)