Open
Description
Feature Request: Agent Mode in REPL for Autonomous Code Development
Summary
Enhance the existing gh models run
REPL with an agent mode that enables autonomous code operations, allowing the AI to understand codebases, make file changes, and perform multi-step development tasks within the interactive session.
Background
Current gh-models
REPL is conversational but limited to text responses. Users must manually handle file operations and code changes. Modern AI development tools integrate autonomous capabilities directly into their interfaces, allowing AI to:
- Read and analyze project files automatically
- Make code changes across multiple files
- Perform complex development tasks autonomously
- Maintain context across the entire codebase
Proposed REPL Agent Mode
Enable Agent Mode in REPL
gh models run
> /agent on
Agent mode enabled. I can now read, analyze, and modify files in your workspace.
> "Add a user profile API endpoint"
🤖 Analyzing codebase structure...
📁 Found existing API patterns in src/routes/
📝 Creating user profile endpoint...
✅ Created src/routes/user.go
✅ Updated src/main.go with new route
✅ Generated tests in src/routes/user_test.go
✅ Updated API documentation
Files modified: 4 | Tests added: 3
REPL Agent Commands
# Toggle agent mode
> /agent on|off
# Set agent autonomy level
> /agent autonomy high|medium|low
# Show agent capabilities
> /agent help
# Review pending changes
> /agent review
# Apply or reject changes
> /agent apply
> /agent reject
# Show workspace context
> /agent context
Agent Capabilities in REPL
1. Codebase Analysis
> "How is authentication handled in this project?"
🤖 Analyzing authentication patterns...
📊 Found JWT middleware in src/middleware/auth.go
📊 Login handler in src/handlers/auth.go
📊 User model with password hashing in src/models/user.go
[Detailed analysis with code snippets]
2. Autonomous Code Generation
> "Add input validation to the user registration endpoint"
🤖 Locating user registration code...
📝 Adding validation middleware...
✅ Updated src/handlers/auth.go
✅ Added validation rules in src/validation/user.go
✅ Updated tests with validation scenarios
3. Multi-File Refactoring
> "Extract the database logic into a repository pattern"
🤖 Planning refactoring strategy...
📁 Creating repository interfaces...
📝 Extracting database operations...
✅ Created src/repositories/user_repository.go
✅ Updated src/handlers/ to use repositories
✅ Modified dependency injection in src/main.go
✅ Updated all related tests
4. Debugging and Analysis
> "Why is the login endpoint returning 500 errors?"
🤖 Analyzing error logs and code...
📊 Found potential issue in src/handlers/auth.go:45
🔍 Missing error handling for database connection
📝 Applying fix...
✅ Added proper error handling
✅ Updat
Metadata
Metadata
Assignees
Labels
No labels