0
0
via GitHub · Posted Jul 17, 2026 · 1 min read

Coven: Project-Scoped Agent Session Runtime

OpenCoven/coven
Tool

Local runtime harness substrate for project-scoped agent sessions.

35Stars
22Forks
8Open issues
Rust MIT v0.0.54 Updated 4 days ago

Coven is a local-first runtime harness that provides a shared, bounded workspace for coding agents like Codex and Claude Code. It manages project-scoped sessions with persistent history, secure execution boundaries, and a unified API for multiple clients to observe and coordinate agent work.

0 comments

README

Coven

Local harness substrate for project-scoped agent sessions

Run Codex, Claude Code, and future coding harnesses inside explicit local project boundaries. Launch, observe, attach, and coordinate agent work through one neutral runtime substrate.

MIT License Platform npm Built with Rust

🌐 Ecosystem 💬 Community 🛠️ Development
Website Discord GitHub Issues
Documentation X (@OpenCvn) Public Roadmap
Submit Feedback Contributing

⚠️ Early MVP — Coven is a local-first runtime in active development. It is usable by adventurous developers on macOS and Linux. The npm package is live. Expect rough edges.

External PRs are open — Start from an issue for larger changes, keep PRs scoped, and include the readiness packet requested by the PR template.


Table of Contents


What is Coven?

Coven is the local harness substrate for the OpenCoven ecosystem. It gives coding-agent CLIs like Codex and Claude Code a shared room where project work can happen visibly and safely.

One project. Any harness. Visible work.

Coven doesn't replace your coding agent, your UI, or other clients. It acts as a neutral runtime layer:

  • You choose the harness — Codex, Claude Code, or future adapters.
  • Coven owns the session — project-scoped boundaries, PTY execution, event logging, SQLite persistence.
  • Clients present the work — CastCodes, the CLI/TUI, comux, or your own integration over the local socket API.

The Rust daemon is the authority boundary. All clients — including the CLI itself — are convenience layers. Security decisions flow inward to the daemon, never outward to clients.


Why Coven?

Without Coven With Coven
Run codex directly; no persistent session history Every run creates a session record with metadata and events
No project boundary enforcement Agent is locked to an explicit project root; cannot escape
Lose track of agent work when the terminal closes Sessions persist across daemon restarts via SQLite
Manually juggle multiple harness CLIs One unified coven run entry point for all harnesses
No API for clients to consume agent sessions Versioned coven.daemon.v1 socket API for all clients
No standard way to observe or replay past work coven sessions browser with Rejoin, View Log, and Archive

Features

  • 🏠 Project-root boundaries — Every launch is tied to an explicit repository or project root. The daemon rejects working directories that escape the declared boundary.
  • 🔌 Harness-neutral runtime — supported harnesses are Codex, Claude Code, and GitHub Copilot CLI, with a clean adapter path for future harnesses (Hermes, Aider, Gemini, and user-defined CLIs).
  • 🖥️ Interactive session browser — Live and completed work can be selected, rejoined, viewed, archived, restored, or sacrificed without memorizing IDs.
  • 📡 Attachable PTY sessions — Live sessions can be replayed or followed from explicit CLI verbs.
  • 🔌 Local daemon API — CastCodes, comux, and the OpenClaw plugin coordinate through one versioned socket contract (coven.daemon.v1).
  • 🗄️ SQLite-backed history — Session metadata and event logs survive daemon restarts.
  • 🦀 Rust authority layer — Launch, cwd, input, kill, and path-sensitive requests are revalidated in Rust. Clients are never the trust boundary.
  • 🔒 External OpenClaw bridge@opencoven/coven is an opt-in plugin; OpenClaw core does not include Coven code.
  • 📦 @opencoven namespace — CLI wrapper packages live under @opencoven/*; the user-facing command is always coven.
  • 🩺 System diagnosticscoven pc (macOS-first) surfaces CPU, memory, disk, and process health without launching a harness.

Requirements

Requirement Notes
Rust stable toolchain Required only when building from source
Git Required
macOS, Linux, or Windows x64 Native npm packages are published for all three platforms
Node.js 18+ Required only for npm wrapper or package/plugin development
At least one harness CLI Codex and/or Claude Code (see below)

Installing harness CLIs

Run coven doctor first — it prints specific install hints for any missing harness.

Codex (OpenAI):

npm install -g @openai/codex
# or: brew install --cask codex
codex login

Claude Code (Anthropic):

npm install -g @anthropic-ai/claude-code
claude doctor

After installing and authenticating, run coven doctor again to confirm the harness is detected. If doctor still reports missing, ensure the harness binary is on your PATH.


Install

Coven is available as an npm wrapper for the fastest install, or you can build from source.

npm (recommended)

Install globally:

npm install -g @opencoven/cli
coven doctor

Available npm packages:

Package Platform
@opencoven/cli Universal wrapper — auto-selects your platform
@opencoven/cli-macos macOS Apple Silicon
@opencoven/cli-linux-x64 Linux x64
@opencoven/cli-windows Windows x64

Build from source (recommended for contributors)

git clone https://github.com/OpenCoven/coven.git
cd coven
cargo build --workspace
cargo run -p coven-cli -- doctor

Note: Building from source requires Rust stable. See Requirements.


Quick Start

Option A — Interactive UI (recommended for new users)

cd /path/to/your/project
coven
# or explicitly:
coven chat

Bare coven opens the interactive Coven UI, powered by the Coven engine. The first time you run it, coven offers to download and install the engine automatically (or install it anytime with coven engine install); it's a version-pinned, checksum-verified binary that coven manages for you — there's no separate package to install. You can also pass a task directly — coven "fix the failing tests" — and Coven will show a plan card and run it in a recorded session.

Option B — Direct commands

cd /path/to/your/project

# 1. Verify setup
coven doctor

# 2. Start the daemon
coven daemon start

# 3. Launch a session
coven run codex "fix the failing tests"
# or with Claude Code:
coven run claude "polish this UI"

# 4. Browse and manage sessions
coven sessions

# 5. Stop the daemon when done
coven daemon stop

Option C — OpenClaw rescue loop

If OpenClaw breaks, Coven provides a predictable repair room:

coven patch openclaw

Choose a repo, choose a harness, get a verified patch.


Commands Reference

Core commands

Command Action
coven Open the interactive Coven UI (engine auto-installed on first run)
coven "<task>" Plan and run a free-text task in a recorded session (Cast flow)
coven chat Explicitly open the interactive Coven UI
coven tui Same as coven chat
coven doctor Detect supported harness CLIs and print install hints
coven status Ecosystem overview: daemon, sessions, familiars, skills, research, hub (alias: coven overview)
coven completions <shell> Generate shell completions (bash, zsh, fish, elvish, powershell)

Harness adapters

Command Action
coven adapter list List configured harness adapters
coven adapter list --json Adapter reports as JSON
coven adapter doctor [id] Diagnose all adapters, or one adapter id
coven adapter install <id> Install a trusted local adapter recipe

Experimental opt-in recipe: coven adapter install grok adds the Grok Build adapter without promoting it into Coven's bundled default harness set.

Daemon lifecycle

Command Action
coven daemon start Start the local Coven daemon
coven daemon status Show daemon health, PID, and socket path
coven daemon restart Restart the local daemon and rebind the socket
coven daemon stop Stop the local daemon

Session management

Command Action
coven run <harness> <prompt> Launch a project-scoped harness session
coven run <harness> <prompt> --cwd <path> Launch from a cwd inside the project root
coven run <harness> <prompt> --title <title> Set a readable session title
coven run <harness> <prompt> --model <id> Forward a model override to the harness
coven run <harness> <prompt> --think Request deeper reasoning when the harness supports it
coven run <harness> <prompt> --speed <level> Set a latency/reasoning hint: fast, balanced, or thorough
coven run <harness> <prompt> --add-dir <dir> Trust an additional directory (repeatable); maps to the harness's native --add-dir flag
coven run <harness> --continue Resume the latest active session for this project
coven run <harness> --continue <id> Resume a specific session by id
coven run <harness> <prompt> --detach Create the session record without launching the harness
coven run <harness> <prompt> --labels <l> Attach comma-separated labels to the session
coven run <harness> <prompt> --visibility <v> Set visibility: private (default), workspace, or shared
coven run <harness> <prompt> --archive Auto-archive the session when the run completes
coven run <harness> <prompt> --familiar <id> Inject a familiar identity preamble (e.g. --familiar charm)
coven run <harness> <prompt> --stream-json Emit JSONL events on stdout (for tooling/piping)
coven run claude <p> --stream-json --stream-json-input Also read JSONL user messages from stdin
coven sessions Open the session browser in a terminal; print a table when piped
coven sessions --all Browse active and archived sessions; print all when piped
coven sessions --manage Force the interactive session browser
coven sessions --plain Force plain table output for scripts or copying
coven sessions --json Output sessions as JSON
coven sessions --json --all Output all sessions (including archived) as JSON
coven sessions search <query> Full-text search recorded event payloads (--json for scripts)
coven sessions show <session-id> Show one session's record without attaching (--json for scripts)
coven sessions events <session-id> List recorded events; --after-seq/--limit page the cursor
coven sessions log <session-id> Print a session's log lines without attaching
coven attach <session-id> Replay/follow session output and forward input
coven summon <session-id> Restore an archived session, then replay/follow it
coven archive <session-id> Hide a non-running session while preserving its events
coven sacrifice <session-id> --yes Permanently delete a non-running session and its events
coven kill <session-id> Kill a running session's process (its event log is kept)

attach, summon, archive, sacrifice, kill, and the sessions show/events/log subcommands accept a unique prefix of the session id (e.g. coven attach 9099), so you don't have to paste full UUIDs.

Session rituals are intentionally explicit. Archive is reversible and keeps the full event ledger. Summon brings an archived session back. Sacrifice is destructive, refuses live sessions, and requires --yes so beginners don't delete work by accident.

Ritual Reversible? Works on Description
Archive ✅ Yes Non-running sessions Hides from active list; all events preserved
Summon N/A Archived sessions Restores to active list
Sacrifice ❌ No Non-running sessions Permanently deletes session and all events; requires --yes
Rejoin N/A Live sessions Reattaches to running session

System diagnostics (coven pc, macOS-first)

Command Action
coven pc Full system report: CPU, memory, disk, top processes
coven pc status One-line health summary with 🟢/🟡/🔴 indicators
coven pc status --json Machine-readable health summary
coven pc top --n 10 Top-N processes by CPU usage
coven pc disk Disk usage breakdown
coven pc kill <pid> --confirm SIGTERM with PID identity re-check (requires --confirm)
coven pc cache clear --confirm Clear ~/Library/Caches and /Library/Caches (requires --confirm)

All read operations are side-effect-free. Write operations (kill, cache clear) require --confirm and cannot be bypassed. Termination is SIGTERM only — no SIGKILL.

Coven observability (Cave parity from the terminal)

Everything the CovenCave dashboard reads is also visible from the CLI. All of these are read-only, work without a running daemon, and take --json for machine-readable output that carries the same body as the daemon API route.

Command Action API route
coven status Daemon, sessions, familiars, skills, research, hub at a glance /api/v1/health + /api/v1/overview
coven familiars Familiar roster from ~/.coven/familiars.toml /api/v1/familiars
coven skills Installed skills from ~/.coven/skills/ /api/v1/skills
coven memory Familiar memory files from ~/.coven/memory/ /api/v1/memory
coven research Research loop log from ~/.coven/research/results.tsv /api/v1/research
coven calls [<id>] Coven Calls delegation ledger (list or one call) /api/v1/coven-calls[/:id]
coven hub status Hub role, node availability, queue depth /api/v1/hub/status
coven hub nodes Registered executor nodes /api/v1/hub/nodes
coven hub jobs [--state <s>] Hub jobs, optionally filtered by state /api/v1/hub/jobs
coven hub routing Job→node routing decisions /api/v1/hub/routing

Parallel work protocol (worktrees, claims, hooks)

Command Action
coven wt <branch> Create or enter a worktree in the sibling <repo>.wt dir
coven wt --list List worktrees with claim and dirty state
coven wt --doctor Report protocol layout and hook issues
coven wt --prune-merged Remove clean worktrees whose branches are merged
coven claim acquire <b> Claim a branch for the current agent (TTL-bounded)
coven claim release <b> Release this agent's claim for a branch
coven claim heartbeat <b> Extend this agent's claim TTL for a branch
coven claim status Show active and expired claims for this repository
coven hooks install Install the protocol's pre-commit and pre-push git hooks

Other

Command Action
coven patch openclaw Open the OpenClaw repair rescue loop
coven logs prune Manually prune session logs and raw encrypted artifacts
coven vacuum Repair and compact the local Coven session store

Local API

The daemon exposes a versioned HTTP API over a Unix socket. The current public contract is coven.daemon.v1 (prefix: /api/v1).

Endpoint reference

Endpoint Method Purpose
/api/v1/health GET Daemon health, API version, and capability catalog
/api/v1/api-version GET Active and supported API versions
/api/v1/capabilities GET Machine-readable capability catalog for clients
/api/v1/capabilities/harnesses GET Harness-native capability manifests plus Coven skills
/api/v1/sessions GET List sessions
/api/v1/sessions POST Launch a session
/api/v1/sessions/:id GET Fetch one session
/api/v1/events GET Read session events (supports afterSeq cursor pagination)
/api/v1/sessions/:id/events GET Session-scoped events alias
/api/v1/sessions/:id/log GET Redacted log preview for a session
/api/v1/sessions/:id/input POST Forward input to a live session
/api/v1/sessions/:id/kill POST Kill a live session
/api/v1/overview GET Ecosystem counts (sessions, familiars, skills, research)
/api/v1/familiars GET Familiar roster (coven familiars)
/api/v1/skills GET Installed skills (coven skills)
/api/v1/memory GET Familiar memory files (coven memory)
/api/v1/research GET Research loop log (coven research)
/api/v1/coven-calls GET Coven Calls delegation ledger (coven calls)
/api/v1/hub/status GET Hub role, node availability, queue depth (coven hub status)
/api/v1/hub/nodes GET Registered executor nodes (coven hub nodes)
/api/v1/hub/jobs GET Hub jobs, ?state= filter (coven hub jobs)
/api/v1/hub/routing GET Job→node routing table (coven hub routing)
/api/v1/actions POST Route a control-plane action (advanced clients)
/api/v1/travel/profiles POST Generate a read-only travel profile for offline laptop work
/api/v1/travel/deltas POST Upload offline travel results for hub reconciliation
/api/v1/travel/state GET Read hub/travel handoff state for a client
/api/v1/scheduler/decisions POST Choose a node for a multi-host job
/api/v1/scheduler/decisions/:id GET Fetch a persisted scheduler decision
/api/v1/scheduler/redispatch POST Redispatch or pause a loop after executor failure
/api/v1/scheduler/loops/:loopId GET Recover persisted scheduler loop state

Recommended client handshake

All API clients should start with a health negotiation:

# Example: health check via Unix socket
curl --unix-socket ~/.coven/coven.sock http://localhost/api/v1/health

Example response:

{
  "ok": true,
  "apiVersion": "coven.daemon.v1",
  "covenVersion": "0.0.10",
  "capabilities": {
    "sessions": true,
    "events": true,
    "travel": true,
    "scheduler": true,
    "eventCursor": "sequence",
    "structuredErrors": true
  },
  "daemon": {
    "pid": 12345,
    "startedAt": "2026-05-09T06:43:00Z",
    "socket": "/Users/alice/.coven/coven.sock"
  }
}

Before depending on any other endpoint:

  1. Call GET /api/v1/health
  2. Verify apiVersion === "coven.daemon.v1" and capabilities.structuredErrors === true
  3. Check capabilities.eventCursor === "sequence" before using afterSeq pagination
  4. Only then depend on the documented v1 sessions/events shapes

All API errors use a structured envelope. Branch on error.code, never on error.message:

{
  "error": {
    "code": "session_not_found",
    "message": "Session was not found.",
    "details": { "sessionId": "abc-123" }
  }
}

Treat the socket API as the product contract. Clients may validate for better UX, but the Rust daemon remains the authority boundary. See docs/API-CONTRACT.md for the full versioned contract including error codes, cursor pagination, session shapes, and compatibility rules.


Architecture

Runtime topology

Coven is a local-first harness substrate. The Rust daemon is the authority boundary. All clients — including the CLI/TUI — are untrusted for enforcement purposes.

Developer
  │
  ├── CastCodes workspace ─────────────────────┐
  ├── coven CLI / TUI ─────────────────────────┤ HTTP over Unix socket
  ├── comux (legacy/reference) ────────────────┤ ~/.coven/coven.sock
  └── @opencoven/coven (OpenClaw plugin) ───────┘
                                                │
                                ┌───────────────▼──────────────────┐
                                │         Coven Rust Daemon         │
                                │                                   │
                                │  ┌───────────────────────────┐   │
                                │  │    Authority boundary      │   │
                                │  │  • Canonicalize project root│  │
                                │  │  • Validate cwd in root   │   │
                                │  │  • Allowlist harness id   │   │
                                │  │  • Validate session state │   │
                                │  │  • Route action via policy │  │
                                │  └────────────┬──────────────┘   │
                                │               │                   │
                                │  ┌────────────▼─────────────┐    │
                                │  │   Harness adapter router  │    │
                                │  └───────┬──────────────┬───┘    │
                                │          │              │          │
                                │      ┌───▼──┐      ┌───▼───┐     │
                                │      │Codex │      │Claude │     │
                                │      │ PTY  │      │  PTY  │     │
                                │      └───┬──┘      └───┬───┘     │
                                │          │              │          │
                                │  ┌───────▼──────────────▼──────┐  │
                                │  │  SQLite session ledger +     │  │
                                │  │  append-only event log       │  │
                                │  └──────────────────────────────┘  │
                                └───────────────────────────────────┘

Authority boundary

The Rust daemon validates every request before acting:

  1. projectRoot must be explicit — no fallback
  2. cwd must canonicalize inside the declared project root
  3. Harness ID must be allowlisted (codex, claude)
  4. Session IDs must exist and be in the expected state
  5. All harness commands are built with argv APIs — never sh -c

Clients may improve UX by validating early, but they are never the enforcement boundary. A client cannot widen the project boundary, bypass the harness allowlist, or escape session state validation.

Session lifecycle

coven run codex "fix tests"
        │
        ▼
POST /api/v1/sessions  { projectRoot, cwd, harness, prompt }
        │
        ▼
Daemon: canonicalize → validate → spawn or reject
        │
        ▼
Session record created in SQLite
        │
        ▼
Harness spawned in PTY → output events streamed to SQLite
        │
        ▼
coven sessions → Rejoin / View Log / Archive / Sacrifice

For full architecture diagrams (including Mermaid flow charts), see docs/ARCHITECTURE.md.


Repository Structure

coven/
├── .github/                    # GitHub Actions workflows, issue templates
├── assets/opencoven/           # Project assets (logos, icons for npm packages)
├── brand/                      # OpenCoven brand system
│   ├── icons/                  # Brand icon set (trident, agent-node, etc.)
│   ├── social/                 # Social media assets (X, GitHub)
│   └── ui/                     # CSS color tokens and typography scale
├── crates/
│   ├── coven-cli/              # Main Rust binary — the `coven` command
│   └── coven-relay/            # Internal relay crate
├── docs/                       # Full documentation suite (see Documentation section)
├── npm/                        # npm wrapper package source for @opencoven/cli
├── packages/
│   └── openclaw-coven/         # External OpenClaw bridge plugin (@opencoven/coven)
├── scripts/
│   └── check-secrets.py        # CI / pre-release secret scanner
├── skills/opencoven-design/    # Design skill files
├── web/                        # Web surface files
├── Cargo.lock                  # Locked Rust dependency tree
├── Cargo.toml                  # Rust workspace manifest
├── CONTRIBUTING.md             # Contribution guidelines
├── DESIGN.md                   # Full brand and design system reference
├── LICENSE                     # MIT license
├── README.md                   # This file
└── SECURITY.md                 # Security policy

Key directories:

  • crates/coven-cli — Everything that becomes the coven binary. This is where daemon, PTY adapter, session store, socket API, and CLI surface live in Rust.
  • packages/openclaw-coven — The opt-in bridge between OpenClaw and Coven. Lives here (not in OpenClaw core) to keep the trust boundary clean. Published as @opencoven/coven.
  • scripts/check-secrets.py — Required pre-release and pre-PR scan. Run it before pushing to avoid leaking credentials into git history.
  • docs/ — The canonical documentation suite. All product docs, architecture, API contract, safety model, and roadmap live here.

Configuration

Environment variables

Variable Default Description
COVEN_HOME ~/.coven Root directory for all daemon state: SQLite database, Unix socket, logs, encryption keys
COVEN_PERSIST_RAW_ARTIFACTS 0 Set to 1 to enable local encrypted storage of raw session artifact payloads (advanced)

Tip: If you run Coven in CI or need isolated environments, set COVEN_HOME to a unique path per environment. Coven will create the directory if it doesn't exist.

Configuration file

Local privacy and storage settings live in <COVEN_HOME>/privacy.toml:

Key Default Description
persist_raw_artifacts false Enable local encrypted storage of raw session artifacts

When enabled, raw artifacts are encrypted using a local key at <COVEN_HOME>/keys/session-artifacts.key. This file is generated automatically with private permissions and is never stored in the repository or SQLite database.

What should never enter your repository

.coven/          # Daemon state directory — local only
*.sqlite         # SQLite database files
*.sqlite3
*.db
*.sock           # Unix socket files
.env*            # Environment variable files
*.key            # Encryption key files

These patterns are covered by .gitignore. Before submitting any PR or publishing documentation, run the secret scanner:

python scripts/check-secrets.py

If the scan fails, remove the secret from your working tree. If a secret entered git history, rotate the credential before rewriting history or publishing.

Data retention defaults

Data type Default retention Manual control
Redacted session event logs 30 days coven logs prune
Raw encrypted artifacts (if enabled) 7 days coven logs prune

OpenCoven Integrations

Coven is the runtime layer. Other surfaces in the OpenCoven ecosystem sit above it and connect through the local socket API.

Integration Role How it connects
CastCodes Primary public workspace; the local-first AI coding product built on Coven HTTP over Unix socket
comux Legacy terminal cockpit (useful reference; not the future public story) HTTP over Unix socket
OpenClaw External coding agent; integrates via opt-in plugin only @opencoven/coven plugin → socket

Important: OpenClaw core does not contain Coven code. The integration lives exclusively in packages/openclaw-coven and publishes as @opencoven/coven. This separation keeps the trust boundary clean — the plugin is treated as an untrusted socket client, and the Rust daemon revalidates every request it makes.

CastCodes

CastCodes is the primary product users open: terminal/code workspace, visible agent lanes, review flows, and approval UX. It is the first-contact public story for Coven.

The intended flow is:

User → CastCodes → coven run → Coven daemon → Harness PTY
Harness output → Coven event log → CastCodes session view

comux (legacy reference)

comux is a standalone terminal cockpit that proved the tmux-cockpit model for parallel agent work. Its useful primitives (worktree isolation, pane menus, agent launcher registry) are being folded into CastCodes-native concepts. comux is no longer the future-facing public surface.


Documentation

Document What it covers
Getting started Full install → first session walkthrough
Concepts Definitions: harness, session, project, ritual, daemon, store, client
Glossary Term definitions for the full OpenCoven ecosystem
Architecture Runtime topology, session lifecycle, authority boundary diagrams
API contract Full coven.daemon.v1 contract: shapes, cursors, error codes
Session lifecycle Detailed state machine for sessions
Safety model Trust boundary, local access model, data rules
Operational model Day-to-day operation and daemon management
Client integration guide How to build a client against the socket API
Harness adapter guide How to implement a new harness adapter
Troubleshooting Diagnose and resolve common issues
Public roadmap Shipped, now, next, and later milestones
Product spec Product requirements and design decisions
MVP plan Current MVP scope and checklist
Future harnesses Research notes for upcoming adapter work
Brand assets Logo, colors, and usage guidance
Design system Full brand

Comments (0)

Sign in to join the discussion.

No comments yet

Be the first to share your take.