|
| 1 | +# GitHub Copilot Instructions |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +Agents CLI is a multi-agent workflow engine for agentic IDEs built with TypeScript. The project enables IDEs to dynamically create and execute sophisticated multi-agent workflows through JSON configuration. It uses the OpenAI Agents SDK and provides both CLI and MCP (Model Context Protocol) server interfaces. |
| 6 | + |
| 7 | +## Current Status |
| 8 | + |
| 9 | +**Phase 1 Development** - Building foundation and core functionality: |
| 10 | +- Basic project structure with TypeScript |
| 11 | +- Configuration system with JSON schemas |
| 12 | +- MCP server implementation for IDE integration |
| 13 | +- OpenAI Agents SDK integration |
| 14 | +- Security framework with sandboxing |
| 15 | + |
| 16 | +## Architecture |
| 17 | + |
| 18 | +### Core Components |
| 19 | +- **CLI Interface**: Command-line tool using Commander.js |
| 20 | +- **MCP Server**: Model Context Protocol server for IDE integration |
| 21 | +- **Configuration System**: JSON-based agent and workflow definitions with Zod validation |
| 22 | +- **Security Layer**: Tool execution sandboxing and access controls |
| 23 | +- **Agent Engine**: OpenAI Agents SDK integration for workflow execution |
| 24 | + |
| 25 | +### Directory Structure |
| 26 | +``` |
| 27 | +src/ |
| 28 | +├── cli/ # Command-line interface implementation |
| 29 | +├── config/ # Configuration loading and validation |
| 30 | +├── agents/ # Agent creation and management |
| 31 | +├── mcp/ # Model Context Protocol server |
| 32 | +└── workflows/ # Workflow execution engine |
| 33 | +``` |
| 34 | + |
| 35 | +## Coding Standards |
| 36 | + |
| 37 | +### TypeScript Guidelines |
| 38 | +- Use strict TypeScript configuration with comprehensive type checking |
| 39 | +- Prefer interfaces over type aliases for object shapes |
| 40 | +- Use Zod for runtime validation and schema definition |
| 41 | +- Include comprehensive JSDoc comments for public APIs |
| 42 | +- Export types and interfaces from barrel exports (index.ts files) |
| 43 | + |
| 44 | +### Code Style |
| 45 | +- Use ESLint + Prettier for consistent formatting |
| 46 | +- Prefer async/await over Promise chains |
| 47 | +- Use descriptive variable and function names |
| 48 | +- Include error handling for all async operations |
| 49 | +- Follow functional programming patterns where appropriate |
| 50 | + |
| 51 | +### Security Requirements |
| 52 | +- Never log or expose API keys or sensitive credentials |
| 53 | +- Implement proper input validation for all user inputs |
| 54 | +- Use sandboxing for tool execution |
| 55 | +- Validate file system access restrictions |
| 56 | +- Include audit logging for security-sensitive operations |
| 57 | + |
| 58 | +## Key Libraries and Frameworks |
| 59 | + |
| 60 | +### Core Dependencies |
| 61 | +- **OpenAI Agents SDK**: Agent creation and orchestration |
| 62 | +- **Commander.js**: CLI framework and command parsing |
| 63 | +- **Zod**: Schema validation and type inference |
| 64 | +- **Model Context Protocol**: IDE integration protocol |
| 65 | + |
| 66 | +### Development Tools |
| 67 | +- **TypeScript**: Primary language with strict configuration |
| 68 | +- **Jest**: Testing framework with comprehensive coverage |
| 69 | +- **ESLint + Prettier**: Code quality and formatting |
| 70 | +- **GitHub Actions**: CI/CD pipeline |
| 71 | + |
| 72 | +## Development Patterns |
| 73 | + |
| 74 | +### Configuration Loading |
| 75 | +```typescript |
| 76 | +// Use Zod schemas for validation |
| 77 | +const AgentConfigSchema = z.object({ |
| 78 | + name: z.string(), |
| 79 | + instructions: z.string(), |
| 80 | + model: z.string(), |
| 81 | + tools: z.array(z.string()) |
| 82 | +}); |
| 83 | + |
| 84 | +// Validate and parse configuration |
| 85 | +const config = AgentConfigSchema.parse(userInput); |
| 86 | +``` |
| 87 | + |
| 88 | +### Error Handling |
| 89 | +```typescript |
| 90 | +// Use Result pattern or proper error types |
| 91 | +try { |
| 92 | + const result = await riskyOperation(); |
| 93 | + return { success: true, data: result }; |
| 94 | +} catch (error) { |
| 95 | + logger.error('Operation failed', { error }); |
| 96 | + return { success: false, error: error.message }; |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +### MCP Tool Registration |
| 101 | +```typescript |
| 102 | +// Implement MCP tools with proper typing |
| 103 | +interface MCPTool { |
| 104 | + name: string; |
| 105 | + description: string; |
| 106 | + inputSchema: z.ZodSchema; |
| 107 | + handler: (input: unknown) => Promise<unknown>; |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +## Testing Strategy |
| 112 | + |
| 113 | +### Test Categories |
| 114 | +- **Unit Tests**: Individual components and functions |
| 115 | +- **Integration Tests**: CLI → MCP → SDK → Agent workflows |
| 116 | +- **Security Tests**: Sandbox effectiveness and credential protection |
| 117 | +- **Performance Tests**: Startup time (<2s) and execution time (<30s) |
| 118 | + |
| 119 | +### Test Structure |
| 120 | +```typescript |
| 121 | +describe('ComponentName', () => { |
| 122 | + beforeEach(() => { |
| 123 | + // Setup test environment |
| 124 | + }); |
| 125 | + |
| 126 | + it('should handle expected case', async () => { |
| 127 | + // Test implementation |
| 128 | + }); |
| 129 | + |
| 130 | + it('should handle error cases gracefully', async () => { |
| 131 | + // Error scenario testing |
| 132 | + }); |
| 133 | +}); |
| 134 | +``` |
| 135 | + |
| 136 | +## Build and Validation Commands |
| 137 | + |
| 138 | +```bash |
| 139 | +# Development setup |
| 140 | +npm install |
| 141 | +npm run dev |
| 142 | + |
| 143 | +# Code quality |
| 144 | +npm run lint |
| 145 | +npm run typecheck |
| 146 | +npm test |
| 147 | + |
| 148 | +# Build for production |
| 149 | +npm run build |
| 150 | +``` |
| 151 | + |
| 152 | +## IDE Integration Notes |
| 153 | + |
| 154 | +The project is designed to work with: |
| 155 | +- **Cursor**: Primary IDE with MCP protocol support |
| 156 | +- **VS Code**: MCP extension integration |
| 157 | +- **Claude Code**: CLI integration for workflow execution |
| 158 | + |
| 159 | +When implementing MCP server functionality, ensure compatibility with IDE expectations for tool registration, result formatting, and error handling. |
| 160 | + |
| 161 | +## Security Considerations |
| 162 | + |
| 163 | +- All tool execution must go through security validation |
| 164 | +- API keys should be loaded from environment variables only |
| 165 | +- File system access must respect configured security policies |
| 166 | +- Network requests should be validated and logged |
| 167 | +- Never commit secrets or API keys to the repository |
| 168 | + |
| 169 | +## Phase 1 Priorities |
| 170 | + |
| 171 | +Focus development on: |
| 172 | +1. **CLI Foundation**: Basic command structure and configuration loading |
| 173 | +2. **MCP Server**: Core protocol implementation with tool registration |
| 174 | +3. **Single Agent Execution**: Basic OpenAI SDK integration |
| 175 | +4. **Security Framework**: Safe tool execution with proper sandboxing |
| 176 | +5. **Testing Infrastructure**: Comprehensive test coverage |
| 177 | + |
| 178 | +Defer advanced multi-agent workflows, complex orchestration patterns, and performance optimizations to later phases. |
0 commit comments