.agent/skills/codebolt-provider-development/SKILL.md
--- name: codebolt-provider-development description: Create Codebolt providers that connect applications to external environments running remote executors. Providers abstract environment management (Docker, AWS EC2, WSL, SSH, Kubernetes, Git worktree, or any custom environment) and handle all communication with agents. Use when: (1) Building new providers for any environment type, (2) Implementing environment lifecycle management, (3) Setting up remote executor communication, (4) Handling file o
npx skillsauth add codeboltai/codeboltjs .agent/skills/codebolt-provider-developmentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A Provider is the bridge between the Codebolt application and an external environment running agents. It has three core responsibilities:
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ Codebolt │ ◄─────► │ Provider │ ◄─────► │ Remote Executor │
│ Application │ WS │ │ WS │ (Agents) │
└─────────────────┘ └──────────────┘ └─────────────────┘
Copy the provider template from assets/provider-template/ to start a new provider.
import { BaseProvider } from '@codebolt/provider';
import codebolt from '@codebolt/codeboltjs';
class MyProvider extends BaseProvider {
constructor() {
super({
agentServerPort: 3001,
agentServerHost: 'localhost',
transport: 'websocket',
});
}
// REQUIRED: Create your external environment
protected async setupEnvironment(initVars: ProviderInitVars): Promise<void> {
// Create container, VM, worktree, SSH connection, etc.
this.state.workspacePath = '/path/to/environment';
}
// REQUIRED: Set the project path
protected async resolveProjectContext(initVars: ProviderInitVars): Promise<void> {
this.state.projectPath = initVars.projectPath || process.cwd();
}
// REQUIRED: Return changed files info
async onGetDiffFiles(): Promise<any> {
return { files: [], hasChanges: false };
}
// OPTIONAL: Clean up environment
protected async teardownEnvironment(): Promise<void> {
// Stop container, remove worktree, close SSH, etc.
}
}
const provider = new MyProvider();
const handlers = provider.getEventHandlers();
// Lifecycle
codebolt.onProviderStart((vars) => handlers.onProviderStart(vars));
codebolt.onProviderAgentStart((msg) => handlers.onProviderAgentStart(msg));
codebolt.onProviderStop((vars) => handlers.onProviderStop(vars));
codebolt.onCloseSignal(() => handlers.onCloseSignal());
codebolt.onRawMessage((msg) => handlers.onRawMessage(msg));
// File operations
codebolt.onReadFile(async (path) => /* read from environment */);
codebolt.onWriteFile(async (path, content) => /* write to environment */);
// ... more handlers
class MyProvider extends BaseProvider {
constructor() {
super({
agentServerPort: 3001, // Port where agent server runs
agentServerHost: 'localhost', // Host (localhost for local, IP for remote)
transport: 'websocket', // Communication method
reconnectAttempts: 10, // Connection retry count
reconnectDelay: 1000, // Delay between retries (ms)
wsRegistrationTimeout: 10000, // WebSocket registration timeout (ms)
timeouts: {
agentServerStartup: 60000, // Agent server startup timeout
connection: 30000, // Connection timeout
cleanup: 15000, // Cleanup timeout
},
});
}
}
The setupEnvironment method creates your isolated environment:
protected async setupEnvironment(initVars: ProviderInitVars): Promise<void> {
// initVars contains:
// - environmentName: string (unique identifier)
// - type: string (provider type)
// - projectPath?: string (optional project path)
// - ...custom properties
// YOUR LOGIC: Create environment based on your type
// - Docker: docker.createContainer()
// - SSH: ssh.connect()
// - Git worktree: git worktree add
// - AWS EC2: ec2.runInstances()
// Set the workspace path for file operations
this.state.workspacePath = '/path/to/environment/workspace';
}
The teardownEnvironment method cleans up:
protected async teardownEnvironment(): Promise<void> {
// YOUR LOGIC: Clean up environment
// - Docker: container.stop(), container.remove()
// - SSH: ssh.end()
// - Git worktree: git worktree remove
// - AWS EC2: ec2.terminateInstances()
}
See message-handlers.md for the complete list.
When onProviderStart is called:
1. resetState() - Clear previous state
2. resolveProjectContext() - Set this.state.projectPath
3. resolveWorkspacePath() - Set this.state.workspacePath
4. ensureAgentServer() - Start/verify agent server
5. setupEnvironment() - Create external environment
6. ensureTransportConnection() - Connect WebSocket
7. afterConnected() - Post-connection hook (start heartbeats)
When onProviderStop or onCloseSignal is called:
1. beforeClose() - Pre-cleanup hook (stop heartbeats)
2. disconnectTransport() - Close WebSocket
3. teardownEnvironment() - Clean up environment
For detailed lifecycle patterns, see lifecycle-patterns.md.
The provider connects to the agent server via WebSocket:
// URL format
ws://{host}:{port}?clientType=app&appId={environmentName}&projectName={environmentName}
// Registration handshake
1. Provider connects
2. Server sends: { type: "registered" }
3. Provider ready for messages
Outbound (App → Provider → Agent Server):
// Handled by BaseProvider.sendToAgentServer()
await provider.sendToAgentServer({
type: 'someMessage',
requestId: 'req-123',
data: { ... },
});
Inbound (Agent Server → Provider → App):
// Automatically forwarded via handleTransportMessage()
// Override for custom handling
Providers must report health status:
protected async afterConnected(startResult: ProviderStartResult): Promise<void> {
// Start provider heartbeat (every 10 seconds)
this.startHeartbeat();
// Track this environment
this.registerConnectedEnvironment(startResult.environmentName);
// Start environment heartbeat (every 15 seconds)
this.startEnvironmentHeartbeat(startResult.environmentName);
}
protected async beforeClose(): Promise<void> {
this.stopHeartbeat();
this.stopEnvironmentHeartbeat();
}
| Provider Status | Meaning |
|-----------------|---------|
| healthy | Fully operational |
| degraded | Partial functionality |
| error | Not functional |
| Environment Status | Meaning |
|--------------------|---------|
| active | Environment responsive |
| degraded | Some features unavailable |
| unreachable | Cannot communicate |
For detailed heartbeat patterns, see heartbeat-monitoring.md.
Providers must handle file operations in the external environment:
codebolt.onReadFile(async (filePath: string) => {
const fullPath = path.join(workspacePath, filePath);
const content = await fs.readFile(fullPath, 'utf-8');
return { success: true, content };
});
codebolt.onWriteFile(async (filePath: string, content: string) => {
const fullPath = path.join(workspacePath, filePath);
await fs.mkdir(path.dirname(fullPath), { recursive: true });
await fs.writeFile(fullPath, content, 'utf-8');
return { success: true };
});
// Also implement:
// onDeleteFile, onDeleteFolder, onRenameItem, onCreateFolder
// onCopyFile, onCopyFolder, onGetTreeChildren
For remote environments (SSH, Docker), route these operations through the environment's filesystem.
setupEnvironment() - Creates isolated environmentresolveProjectContext() - Sets project pathonGetDiffFiles() - Returns changed filesteardownEnvironment() - Cleans up| Topic | Reference | |-------|-----------| | Type Definitions | types.md | | API Reference | api-reference.md | | Lifecycle Patterns | lifecycle-patterns.md | | Message Handlers | message-handlers.md | | Heartbeat Monitoring | heartbeat-monitoring.md | | Example Providers | example-providers.md |
| Asset | Description | |-------|-------------| | provider-template/ | Starter template with all handlers |
| File | Description |
|------|-------------|
| packages/provider/src/lib/BaseProvider.ts | Core abstract provider class |
| packages/provider/src/lib/ProviderTypes.ts | Type definitions |
| packages/codeboltjs/src/core/Codebolt.ts | Event handler registration API |
| providers/ | Existing provider implementations |
tools
Build AI agents for the Codebolt platform using @codebolt/agent. Use when creating agents, configuring the agent loop, writing custom message modifiers, implementing processors, creating tools, building workflows, ActionBlocks, or choosing between abstraction levels. Covers Remix Agents (no-code), Level 1 (direct APIs), Level 2 (base components), Level 3 (high-level CodeboltAgent), and ActionBlocks for reusable logic.
tools
Use when you need to call codebolt modules (fs, browser, terminal, git, chat, llm, thread, todo, memory, task, swarm, job, roadmap, autoTesting, mcp, actionPlan)
development
--- name: codebolt-provider-development description: Create Codebolt providers that connect applications to external environments running remote executors. Providers abstract environment management (Docker, AWS EC2, WSL, SSH, Kubernetes, Git worktree, or any custom environment) and handle all communication with agents. Use when: (1) Building new providers for any environment type, (2) Implementing environment lifecycle management, (3) Setting up remote executor communication, (4) Handling file o
tools
Core skill for Codebolt agents to interact with the Codebolt MCP (Model Context Protocol) API. Use when agents need to execute tools for file operations, git, browser automation, terminal, memory, orchestration, planning, testing, collaboration, or any Codebolt platform functionality. Triggers on requests involving codebolt.tools.executeTool(), file system operations, git commands, browser control, agent orchestration, task management, or any MCP namespace operations.