|
| 1 | +# Phase 6 — Go/No-Go: Merge the engine source into the `coven` binary? |
| 2 | + |
| 3 | +> Decision record (ADR) closing the coven CLI unification. Phases 0–5 delivered a single user-facing `coven` CLI driving `coven-code` as a managed engine **process**. Phase 6 is the one remaining question, and it is a **decision, not code**: should we go further and fold the engine's *source* into the `coven` binary itself? |
| 4 | +
|
| 5 | +**Status:** Decided — **NO-GO.** Keep the process boundary. |
| 6 | +**Date:** 2026-07-14 |
| 7 | +**Owners:** OpenCoven maintainers |
| 8 | +**Confidence:** High. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## The question |
| 13 | + |
| 14 | +Two shapes for "one Coven": |
| 15 | + |
| 16 | +- **A — Process boundary (what we built).** `coven` (MIT) is the only CLI users install and type. It resolves, installs, pins, version-checks, and drives `coven-code` (GPL-3.0) as a separate, checksum-verified engine **binary**, and registers its sessions in one daemon ledger under one `~/.coven` state root. Two works, two licenses, one experience. |
| 17 | +- **B — Single linked binary.** Compile the engine's `claurst-*` crates directly into the `coven` binary. One artifact, one build, no subprocess. |
| 18 | + |
| 19 | +Phase 6 asks whether to pursue **B**. The answer is no. |
| 20 | + |
| 21 | +## Decision |
| 22 | + |
| 23 | +**Do not merge the source trees. Keep A.** Revisit only if *all three* flip-criteria below hold — today none do. |
| 24 | + |
| 25 | +## Why (in priority order) |
| 26 | + |
| 27 | +### 1. License — B forces the whole product to GPL-3.0, and OpenCoven can't unilaterally relicense |
| 28 | +`coven` is MIT. `coven-code` is GPL-3.0, **inherited from upstream Claurst**, whose copyright OpenCoven does not wholly own. Statically linking the `claurst-*` crates into the `coven` binary makes the combined work a GPL-3.0 derivative — the MIT binary would have to become GPL-3.0. There is no "link it but stay MIT" option; that's the core GPL term. Relicensing `coven-code` out of GPL would require the consent of the upstream Claurst copyright holders. So B is not merely an engineering task — it is a licensing commitment (ship `coven` as GPL-3.0) that isn't ours to make cheaply. |
| 29 | + |
| 30 | +The process boundary (A) is the standard, well-understood way two differently-licensed works cooperate: `ripgrep` inside VS Code, `containerd` under Docker, any CLI that shells out to another CLI. Invoking a separate binary at arm's length keeps each work under its own license. |
| 31 | + |
| 32 | +### 2. Upstream merges — B throws away the reason the crate names are `claurst-*` |
| 33 | +`coven-code` deliberately preserves upstream crate names (`claurst-*`) and the `coven-code` binary name specifically so `git merge upstream/main` from Claurst stays low-friction (see `COVEN.md`). That is a live, ongoing value stream: bug fixes and features flow in from upstream. Absorbing the source into `coven/crates/` and rebranding would sever that channel or make every future merge a manual reconciliation. B trades a recurring benefit for a one-time cosmetic win users can't even see. |
| 34 | + |
| 35 | +### 3. Engineering cost — B is a large, risky migration for zero user-visible gain |
| 36 | +- **Dependency reconciliation:** `coven-cli` is deliberately **synchronous** (no tokio), on ratatui 0.30 / rusqlite 0.40; the engine is tokio 1.44 / ratatui 0.29 / rusqlite 0.31 across ~148k LoC. B means introducing tokio into the sync CLI, reconciling two TUI and two SQLite stacks, and absorbing ~148k LoC into a ~35k LoC workspace. |
| 37 | +- **Pipeline merge:** two CI matrices, two release flows, two npm distribution stories collapse into one — the part that's *already done* (Phase 2's pinning + cross-repo contract CI) is what makes A robust; B would redo it. |
| 38 | +- **Risk:** all of the above for an artifact users experience identically to what they have now. |
| 39 | + |
| 40 | +### 4. The boundary costs nothing — unification is already real |
| 41 | +This is the decisive point. Everything "one Coven" was supposed to deliver **already ships without crossing the license line**: |
| 42 | +- One install, one command (`coven`), auto-installed managed engine. |
| 43 | +- One state root (`~/.coven`), migrated in place, with a compat symlink. |
| 44 | +- One session ledger — interactive engine sessions register themselves and show up in `coven sessions`; cross-session search spans them. |
| 45 | +- One doctor, one Credentials view, one `--version` that surfaces the whole stack. |
| 46 | +- One brand — no user-facing "coven-code" left. |
| 47 | + |
| 48 | +A single linked binary would make the *implementation* marginally tidier (no subprocess spawn) at the cost of the license, the upstream channel, and a big migration. The user sees **nothing** different. That's a bad trade. |
| 49 | + |
| 50 | +## Flip-criteria (revisit B only if ALL hold) |
| 51 | + |
| 52 | +1. **Upstream is done mattering.** Claurst merges have stopped delivering value for ≥2 quarters (measure: upstream commits actually merged into `coven-code` in the trailing two quarters ≈ 0). |
| 53 | +2. **GPL is acceptable for `coven`.** OpenCoven has explicitly decided it will ship the unified binary as GPL-3.0 — *or* has obtained the upstream Claurst copyright holders' consent to relicense the engine. (Absent one of these, B is legally impossible, full stop.) |
| 54 | +3. **The migration is funded.** Someone owns the mechanical unification end to end: tokio-into-sync-CLI, ratatui 0.30↔0.29, rusqlite 0.40↔0.31, CI/release/npm consolidation, ~148k LoC absorbed — with a test bar equal to today's. |
| 55 | + |
| 56 | +If any one is false, the answer stays NO-GO. Today all three are false. |
| 57 | + |
| 58 | +## If B is ever taken (migration sketch — not a recommendation) |
| 59 | + |
| 60 | +- `git subtree add` the engine into `coven/crates/` (history-preserving), not a flat copy. |
| 61 | +- Replace the delegation seam (`engine::resolve()` → exec) with in-process dispatch; the daemon notifier, `/sessions/external` endpoints, contract tests, and `~/.coven` state model all **carry over unchanged** — which is exactly why A loses nothing while it waits. |
| 62 | +- Set the workspace license to GPL-3.0; update `PROVENANCE.md`/`ATTRIBUTION.md`. |
| 63 | +- npm/dist consolidation is already done (Phase 2), so distribution is the easy part. |
| 64 | + |
| 65 | +The process-boundary design was built to keep this option open at zero ongoing cost. That is the point: **choosing A now does not foreclose B later.** |
| 66 | + |
| 67 | +## What's on the record |
| 68 | + |
| 69 | +The "singular, seamless `coven` CLI" goal is **met** by the process boundary. Merging the source would convert the whole product to GPL, sever upstream, and cost a large migration — for no user-visible benefit. Recommendation: **NO-GO**, indefinitely, with a concrete, measurable trigger to reopen if the landscape changes. |
0 commit comments