Agent Integration
RAPID integrates with AI coding CLI tools by wrapping them rather than reimplementing them. This document explains how RAPID manages and orchestrates these tools.
Supported Agents
Section titled “Supported Agents”| Agent | CLI Command | Instruction File | Provider |
|---|---|---|---|
| Claude Code | claude | CLAUDE.md | Anthropic |
| OpenCode | opencode | AGENTS.md | Multi-provider |
| Aider | aider | .aider.conf.yml | OpenAI/Anthropic |
| GitHub Copilot | gh copilot | — | GitHub |
Integration Model
Section titled “Integration Model”RAPID CLI takes three inputs:
- Config (
rapid.json) — Which agents, how to install them - Secrets (1Password/Vault) — API keys loaded securely
- Context (
AGENTS.md) — Project-specific instructions
These flow through:
-
Environment Setup
- Export API keys as env vars
- Generate/update instruction files
- Configure MCP servers
-
Agent Launcher
- Install CLI if missing
- Launch with configured args
- Manage sessions for multi-agent mode
-
AI CLI Tool
- Reads environment variables and instruction files
- Provides chat interface, code generation, file editing
How RAPID Wraps Agents
Section titled “How RAPID Wraps Agents”1. Environment Preparation
Section titled “1. Environment Preparation”Before launching any agent, RAPID:
# Loads secrets and exports as environment variablesexport ANTHROPIC_API_KEY="sk-ant-..."export OPENAI_API_KEY="sk-..."
# Sets working directorycd /workspaces/project
# Ensures instruction files exist# (AGENTS.md, CLAUDE.md, etc.)2. Agent Installation
Section titled “2. Agent Installation”If the CLI tool is missing, RAPID installs it:
# From rapid.json agents.available.<name>.installCmdnpm install -g @anthropic-ai/claude-code # Claudenpm install -g opencode # OpenCodepip install aider-chat # Aider3. Agent Launch
Section titled “3. Agent Launch”RAPID executes the configured CLI:
# Single agent modeclaude
# With additional args (from rapid.json)aider --model gpt-4o --auto-commitsInstruction Files
Section titled “Instruction Files”Each agent reads project-specific instructions from designated files.
CLAUDE.md
Section titled “CLAUDE.md”Used by Claude Code to understand project context:
# Project: my-api
## Overview
Express.js REST API with PostgreSQL database.
## Code Style
- TypeScript with strict mode- Async/await for all async operations- Zod for validation
## Commands
- `npm run dev` - Start development server- `npm test` - Run tests- `npm run build` - Production buildAGENTS.md
Section titled “AGENTS.md”Generic instruction file used by OpenCode and others:
# Agent Instructions
## Project Type
TypeScript Node.js application
## Important Files
- src/index.ts - Entry point- src/config.ts - Configuration- package.json - Dependencies
## Testing
Always run `npm test` after changes..aider.conf.yml
Section titled “.aider.conf.yml”Aider-specific configuration:
model: gpt-4oauto-commits: truegitignore: truemap-tokens: 1024Multi-Agent Mode
Section titled “Multi-Agent Mode”RAPID supports running multiple agents concurrently:
rapid dev --multiThis creates a split-pane session with each configured agent:
| Pane | Agent | Use Case |
|---|---|---|
| Left | Claude Code | Architecture, complex reasoning |
| Right | OpenCode | Implementation |
| Bottom | Aider | Quick fixes, auto-commits |
Controls
Section titled “Controls”| Key | Action |
|---|---|
Ctrl+b then o | Switch panes |
Ctrl+b then arrow | Navigate panes |
Ctrl+b then z | Zoom current pane |
Ctrl+b then d | Detach (keeps running) |
Adding Custom Agents
Section titled “Adding Custom Agents”Add new agents to rapid.json:
{ "agents": { "available": { "my-agent": { "cli": "my-ai-tool", "instructionFile": "MY_AGENT.md", "envVars": ["MY_API_KEY"], "installCmd": "npm install -g my-ai-tool", "args": ["--verbose", "--model", "custom"] } } }}Agent Communication
Section titled “Agent Communication”Agents don’t directly communicate with each other. Instead:
- All agents share the same filesystem
- Changes made by one agent are visible to others
- Use git to track and review changes from any agent
- Instruction files provide consistent context
Best Practices
Section titled “Best Practices”-
Use specific agents for specific tasks
- Claude: Architecture, complex reasoning
- Aider: Quick code changes, refactoring
- OpenCode: Multi-model flexibility
-
Keep instruction files updated
- Update when project structure changes
- Add new patterns as they emerge
-
Review multi-agent changes carefully
- Each agent may have different styles
- Use git diff to review before committing
-
Set appropriate context
- More context = better results
- But too much context = slower responses