Covendocs

Client Integration

Integrating Coven into your application.

Client Integration Guide

Coven is a runtime substrate. Clients should present, route, and observe work without taking over the authority boundary.

Integration Rule

Talk to Coven through the local socket API. Do not duplicate Coven's path, harness, live-session, or deletion policy in a way that can drift from the daemon.

Recommended handshake:

  1. Call GET /api/v1/health.
  2. Confirm apiVersion === "coven.daemon.v1" and the needed capabilities fields are available.
  3. Call GET /api/v1/capabilities if using control-plane actions.
  4. Use versioned /api/v1/... routes only.
Rendering diagram…

Clients should treat the handshake as mandatory before any other request. Skipping it means depending on undefined response shapes from a future daemon version.

Client Responsibilities

Client-owned UX surfaces and daemon-owned enforcement surfaces
SurfaceOwnerGroupImplementation posture
NavigationClient-ownedShellClients can decide information architecture, routing, and page transitions.
PanesClient-ownedWorkspace UIClients can arrange session panes, inspectors, and review surfaces.
Chat or intake UIClient-ownedInputClients can collect user intent before sending an explicit daemon request.
Task formsClient-ownedInputClients can shape structured prompts, project choices, and launch options.
Diff and review surfacesClient-ownedReviewClients can make outputs inspectable before merge, PR, archive, or cleanup actions.
Notification renderingClient-ownedStatusClients can translate daemon events into local notifications and badges.
Session selectionClient-ownedWorkspace UIClients can choose which daemon sessions to list, pin, open, or hide.
Optimistic local UI stateClient-ownedStatusClients can show pending states, but must reconcile against daemon events.
User approval UXClient-ownedApprovalsClients can present approvals clearly; the daemon still owns sensitive enforcement.
Project-root boundariesDaemon-enforcedFilesystem policyThe Rust daemon must canonicalize and reject widened project roots.
cwd restrictionsDaemon-enforcedFilesystem policyThe daemon must prove cwd resolves inside the approved project root.
Harness allowlistsDaemon-enforcedHarness policyUnsupported harness ids fail closed even if a client presents them.
Live-session checksDaemon-enforcedSession policyInput and kill requests require daemon-verified live session state.
Destructive deletion rulesDaemon-enforcedSession policyRunning sessions cannot be permanently deleted by client-side confidence alone.
Socket trustDaemon-enforcedTransport policyClients validate the local socket anchor; daemon-side home ownership remains authoritative.
External action approvalsDaemon-enforcedApprovalsActions that leave the machine need explicit policy and approval handling.

CastCodes and Cast Agent

CastCodes is the first-party workspace layer. Cast Agent is the Coven-native substrate manager and agent backend inside that workspace.

CastCodes and Cast Agent responsibilities
CapabilityGroupData sourceClient behavior
List Coven sessionsSession discoveryDaemon or CLI JSONShow active work without becoming the source of truth.
Launch sessions from visible project/worktree contextLaunchDaemon APIPass explicit project root, cwd, harness id, and prompt to the daemon.
Open sessions in panesWorkspace UIClient stateRender live or replayed work inside visible panes.
Attach or rejoin live workSession controlDaemon APIOffer attachment only after daemon liveness checks.
Collect substrateContextCast AgentCollect active file, panes, cwd, git branch, and diagnostics without turning context into authority.
Stream gateway responsesAgent runtimeCoven GatewayRender streaming responses while keeping daemon-backed session operations separate.
Show logs and artifactsReviewEvent logMake completed work inspectable after process exit or daemon restart.
Review diffsReviewRepository stateKeep file changes visible before merge or cleanup actions.
Merge, PR, archive, or clean up explicitlyCompletion flowClient commands plus daemon stateRequire explicit user action for state-changing workflow steps.

CastCodes should remain useful when Coven is not installed. If Coven is missing, present clear installation and fallback states instead of assuming the daemon exists.

Cast Codes are portable intent syntax that CastCodes and Cast Agent can parse. They are not permission grants; daemon validation still decides whether a launch, input, kill, action, archive, summon, or sacrifice request is allowed.

OpenClaw Plugin

OpenClaw integration belongs in the external @opencoven/coven package, not OpenClaw core. Treat this as the supported bridge direction, not permission to move Coven code into OpenClaw or to bypass the local daemon.

The package installs an opt-in OpenClaw plugin with plugin id opencoven-coven and ACP backend id coven. The intended install path is through ClawHub:

openclaw plugins install clawhub:@opencoven/coven

For local development from the Coven repo:

openclaw plugins install ./packages/openclaw-coven --force

The bridge is a client of Coven. Its first runtime step should be the same as every other client: connect to the configured local socket, call GET /api/v1/health, verify apiVersion === "coven.daemon.v1", then depend only on documented /api/v1 behavior.

Rendering diagram…
OpenClaw plugin contract
ExpectationPostureBoundaryReason
Register an optional Coven backendDoIntegrationOpenClaw can opt into Coven without making Coven a core dependency.
Require explicit plugin/backend selectionDoConfigurationThe bridge should be intentional, visible, and reversible.
Validate config for UXDoClient experienceFast feedback belongs in the plugin, but it is not enforcement.
Connect to the local socketDoTransportThe socket API is the supported compatibility layer.
Handshake with GET /api/v1/health before launchDoAPI compatibilityapiVersion and capabilities decide whether the plugin can safely operate.
Launch sessions through POST /api/v1/sessionsDoLaunch authorityThe daemon must own project, cwd, harness, and liveness validation.
Map Coven events into OpenClaw runtime eventsDoRuntime bridgeOpenClaw should observe and present Coven work without hiding provenance.
Preserve fallback behavior only when explicitly configuredDoOperational fallbackFallbacks should be deliberate, visible, and testable.
Treat the Rust daemon as launch authorityDoPolicyClient integration cannot replace daemon-side checks.
Bypass the daemon for launchesDo notLaunch authorityDirect harness launches recreate the policy drift Coven exists to prevent.
Depend on OpenClaw core internalsDo notPackage designThe bridge should remain external and replaceable.
Store provider credentialsDo notCredentialsProvider authentication stays in each harness provider flow.
Assume unversioned routes are stableDo notAPI compatibilityClients should target the versioned local contract.
Widen project-root permissionsDo notFilesystem policyOnly daemon validation can decide the actual launch boundary.

Compatibility is the stability gate. The plugin source lives with the Coven daemon so fixture-backed tests can change in the same work slice as API-affecting daemon changes. When /api/v1/health, /api/v1/sessions, /api/v1/events, input, or kill behavior changes, update the bridge fixtures and compatibility tests before claiming broad plugin stability.

The current bridge scope is Codex and Claude Code. Future harness ids must be explicitly configured only after the Rust daemon supports and validates them. The plugin should not expose OpenClaw tools to Coven-managed harnesses, store provider credentials, or tunnel the raw Coven socket through TCP, browser, mobile, or remote transports.

Intake Surfaces

Intake clients are best treated as presentation layers.

Intake surface responsibilities
ResponsibilityGroupBoundary
Capture user intentInputCollect the task, then hand off to Coven instead of becoming the runtime.
Show local statusStatusReflect daemon and client state clearly.
Present approvalsApprovalsMake consent explicit before sensitive local or external actions.
Display notificationsStatusSurface session changes without inventing state.
Hand work into CovenLaunchUse daemon APIs for project-scoped execution.
Show session updates from CovenObservationRender daemon events and session records as the source of truth.

Avoid making intake clients the automation engine. Reusable automation should live behind Coven capabilities and actions so the policy boundary stays centralized.

Desktop Clients and Control Rooms

A native control room can make Coven easier to operate by showing the operational surface in one place.

Control room surfaces
SurfaceGroupSourcePurpose
Active sessionsSessionsDaemon or CLI JSONShow live and recent work that can be opened or inspected.
Archived sessionsSessionsDaemon or CLI JSONRecover preserved work without crowding the active list.
Daemon healthRuntimeHealth endpointExpose availability, API version, and capability readiness.
Project rootsRuntimeDaemon recordsMake launch boundaries visible before work starts.
Harness availabilityHarnessesDoctor or capabilitiesShow which CLIs are installed, authenticated, and launchable.
Client integrationsClientsConfig and capability recordsMake connected tools and bridges inspectable.
Capability catalogControl planeCapabilities endpointShow supported actions without hardcoding client assumptions.
Action approval queueApprovalsControl planeKeep sensitive pending actions reviewable.
Logs and tracesObservabilityEvent logPreserve what happened across process exits and daemon restarts.
Docs and troubleshooting linksSupportDocs siteRoute users from a broken state to the next useful action.

Use coven sessions --json for active sessions and coven sessions --json --all when the client needs archived records too. The CLI returns a top-level object with a sessions array, and each record uses the same SessionRecord field names exposed by the daemon API, including project_root, status, created_at, updated_at, and nullable archived_at.

The control room should still use the same socket API and capability handshake as other clients.

Desktop Automation Adapters

Desktop automation is useful when an app has no clean API. It is also powerful enough to need clear policy.

Recommended pattern:

user request
  -> client captures intent
  -> Coven exposes capability and policy hints
  -> client asks for approval when required
  -> Coven routes a known action id
  -> adapter performs the local UI action
  -> event/result returns to the client

Do not let UI clients bind directly to OS automation libraries and then call that "Coven integration." The reusable boundary should be Coven's control plane.

Compatibility Expectations

Client compatibility expectations
RuleRisk areaClient behavior
Use /api/v1API versioningRoute all supported calls through the versioned local contract.
Call health firstHandshakeConfirm daemon availability and compatible apiVersion before other requests.
Ignore unknown additive fields when safeForward compatibilityAvoid breaking when the daemon adds optional response data.
Fail closed on unknown required behaviorSafetyDo not guess when a new daemon response changes required semantics.
Test against representative daemon responsesCompatibility testsKeep bridge behavior pinned to real response shapes.
Update docs/API-CONTRACT.md when response shapes changeContract driftDocument API-affecting daemon changes in the same work slice.

Error Handling

A good client should translate daemon errors into action-oriented UI.

Daemon error handling matrix
ConditionCategoryClient response
Daemon unavailableRuntimeShow start or restart instructions.
Unsupported API versionCompatibilityAsk the user to update Coven or the client.
Missing harnessHarnessesShow coven doctor guidance and install/auth hints.
outside-root cwdFilesystem policyExplain the project boundary and offer a valid cwd choice.
Session not liveSession policyOffer log viewing instead of live input.
Destructive action blockedSession policyExplain that the session is running or lacks confirmation.

Last updated on

On this page