Appearance
Harness Contract ​
Coleo is the self-hosted control plane for coding agents: run on your hardware, plug in any CLI agent, and coordinate long-running work with full local visibility.
The harness contract defines the integration boundary between the Brain and each agent adapter.
What This Contract Defines ​
The contract is split across two layers:
- Runtime harness interface in
src/harness/types.ts(AgentHarness,HarnessCapabilities, lifecycle and control methods) - Brain and event contract in
src/harness/contracts.ts(HarnessReportedState,ArmEventType,HarnessCapabilityContract, and test scenario types)
In practical terms, a harness must:
- Spawn and kill agent sessions
- Accept prompts and report when it returns to idle
- Report state transitions (
initializing,idle,processing,executing,waiting_approval,error,dead) - Emit lifecycle, status, and task/session events that the Brain can observe
- Declare capabilities so the Brain knows what features are safe to use
Current Status ​
Registered harnesses in src/harness/registry.ts:
opencodeopencode-apiopencode-tui
The type system already leaves room for additional harness types, and the extension point is the registry plus the shared contract.
Why This Matters ​
This contract is how Coleo stays model-vendor portable over time:
- Your plans and prompt strategy stay in Coleo
- Harnesses become adapters, not architecture lock-in
- New CLI agents can be added incrementally without rewriting the Brain
Harness Test Coverage (Today) ​
Harness coverage exists now, with unit-level confidence and scenario scaffolding:
src/harness/__tests__/opencode-tui.test.tssrc/harness/__tests__/event-stream.test.tssrc/harness/__tests__/model-resolver.test.tssrc/harness/__tests__/scenarios.ts
Notes:
- Integration/scenario execution scaffolding is present, but some end-to-end harness scenario runs are currently disabled in
src/harness/__tests__/opencode-tui.test.tspending test-framework wiring. - This means core behavior is tested today, while full conformance automation is still being tightened.
Build A New Harness (Checklist) ​
- Implement
AgentHarnessinsrc/harness/types.ts - Define capability + transition declaration in
src/harness/contracts.ts - Register the harness in
src/harness/registry.ts - Cover event mapping and lifecycle behavior in
src/harness/__tests__/ - Verify spawn/prompt/idle/interrupt behavior against the shared scenario expectations
