Guide: Compatibility Layer Development Workflow
Purpose: Step-by-step process for extending the compatibility layer to support new AI coding tools
Last Updated: 2026-02-05
When to Use This Guide
- Adding support for a new AI coding tool (e.g., Codeium, GitHub Copilot)
- Extending existing adapter capabilities
- Understanding the development phases for compatibility work
Development Phases
Phase 1: Foundation ✅ COMPLETE
Objective: Set up project infrastructure and core types
Project Setup (1.5h) ✅
- Create
packages/compatibility-layer/package.json
- Configure TypeScript with strict mode
- Set up Vitest with 80%+ coverage thresholds
Type System (1.5h) ✅
- Create
src/types.ts with Zod schemas
- Define
OpenAgentSchema, AgentFrontmatterSchema
- Export TypeScript types with
z.infer<>
Base Adapter (1.5h) ✅
- Create
src/adapters/BaseAdapter.ts abstract class
- Define abstract methods:
toOAC(), fromOAC(), getCapabilities()
Agent Loader (1.5h) ✅
- Create
src/core/AgentLoader.ts
- Use gray-matter for YAML frontmatter parsing
Adapter Registry (1h) ✅
- Create
src/core/AdapterRegistry.ts
- Implement registry pattern with
Map<string, BaseAdapter>
Public API (1h) ✅
- Create
src/index.ts
- Export all public APIs
Result: 1,475 lines TypeScript, 0 compilation errors
Phase 2: Adapter Migration ✅ COMPLETE
Objective: Migrate existing adapters to TypeScript
- Claude Adapter (3h) ✅ - 600 lines
- Cursor Adapter (3h) ✅ - 554 lines
- Windsurf Adapter (3h) ✅ - 514 lines
- ClaudeAdapter Tests ✅ - 80 tests, 96% coverage
- CursorAdapter Tests ✅ - 78 tests, 99% coverage
- WindsurfAdapter Tests ✅ - 78 tests, 99% coverage
Result: 1,858 lines TypeScript, 236 tests passing
Phase 3: Mappers & Translation ✅ COMPLETE
Objective: Implement feature mapping logic
- Tool Mapper ✅ - 308 lines, 34 tests, 100% coverage
- Permission Mapper ✅ - 354 lines, 37 tests, 98% coverage
- Model Mapper ✅ - 413 lines, 37 tests, 99% coverage
- Context Mapper ✅ - 384 lines, 51 tests, 97% coverage
- Capability Matrix ✅ - 559 lines, 43 tests, 99% coverage
- Translation Engine ✅ - 453 lines, 47 tests, 99% coverage
- Mapper Tests ✅ - 249 tests total
Result: 2,471 lines TypeScript, 249 tests passing
Phase 4: CLI Tool ⬅️ NEXT
Objective: Build command-line interface
CLI Scaffolding (1.5h)
- Create
src/cli/index.ts with Commander.js
- Define commands: convert, validate, migrate, info
- Set up chalk for colored output, ora for spinners
Convert Command (2h)
- Implement
commands/convert.ts
- Usage:
oac-compat convert --from oac --to claude agent.md
- Support batch conversion
Validate Command (1.5h)
- Implement
commands/validate.ts
- Check compatibility before conversion
- Report warnings and incompatibilities
Migrate Command (2h)
- Implement
commands/migrate.ts
- Migrate entire projects (all agents + context)
- Generate migration report
Info Command (1h)
- Implement
commands/info.ts
- Show tool capabilities and feature matrices
- Display adapter list
CLI Integration Tests (2h)
- Test each command end-to-end
- Test error handling
- Test output formatting
Phase 5: Documentation
Objective: Create migration guides and API docs
26-30. Migration Guides (4h total)
- `docs/migration-guides/cursor-to-oac.md`
- `docs/migration-guides/claude-to-oac.md`
- `docs/migration-guides/oac-to-cursor.md`
- `docs/migration-guides/oac-to-claude.md`
- `docs/migration-guides/oac-to-windsurf.md`
Feature Matrices (1h)
- Generate comparison tables
- Document degradation patterns
API Documentation (1h)
- Document programmatic API usage
- Add examples for each adapter
Adding a New Tool Adapter
Step-by-Step
Research Tool Format
- Study tool's configuration file structure
- Identify supported features
- Note limitations vs OAC
Create Adapter Class
export class NewToolAdapter extends BaseAdapter {
name = 'newtool'
displayName = 'New Tool'
async toOAC(source: string): Promise<OpenAgent> { /* ... */ }
async fromOAC(agent: OpenAgent): Promise<ConversionResult> { /* ... */ }
getConfigPath(): string { /* ... */ }
getCapabilities(): ToolCapabilities { /* ... */ }
validateConversion(agent: OpenAgent): string[] { /* ... */ }
}
Use Existing Mappers
- ToolMapper for tool name translation
- PermissionMapper for permission translation
- ModelMapper for model ID translation
- ContextMapper for context path translation
Register Adapter
AdapterRegistry.register(new NewToolAdapter())
Write Tests (Target: 80%+ coverage)
Update Documentation
Success Criteria
Phase 1-3 ✅ ACHIEVED:
Phase 4 (upcoming):
Phase 5 (upcoming):
Reference
Related:
- lookup/compatibility-layer-progress.md
- lookup/compatibility-layer-adapters.md
- lookup/compatibility-layer-structure.md