Skip to content

init: harness init contract - adapters declare their init contribution, @conciv/claude-connect dissolves #263

Closed

Description

@omridevk

Why

conciv init hardcodes a claude-only step and a standalone @conciv/claude-connect package exists to serve it. That is a harness special case in a system whose harness layer is otherwise a capability-typed contract (user ruling 2026-08-06: no harness-specific packages; each harness declares what init needs to do for it, init stays generic). All file:line below verified against origin/main.

What exists today

  • The HarnessAdapter contract already encodes "capability literal => sidecar required" via intersected discriminated unions (packages/protocol/src/harness-types.ts:179-187: transcriptHistory: true pairs with required history, slashCommands: 'none' forbids commands with ?: undefined). An init contribution is one more & (...|...) arm of the same shape.
  • The init pipeline is step-driven (packages/cli/src/init/pipeline.ts:44-54: InitStep = {id, title, running, completed, detect, plan, apply, verify, manualCard}) but the step LIST is hardcoded (pipeline.ts:105-113), ending in claudeStep(...) - the claude plugin install (packages/cli/src/init/steps/harness/claude.ts:84-97), guarded by a hand-written id check (claude.ts:70).
  • Harness detection in the CLI is a DUPLICATED list disconnected from the harness registry (packages/cli/src/init/harness-detect.ts:5-16: claude/codex/opencode/pi markers; the registry at packages/harness/src/registry.ts:31 ships five - gemini-cli is silently missing from init).
  • @conciv/claude-connect (packages/claude-connect, 6 files / 317 LOC, deps: protocol + zod only) generates the claude marketplace/plugin/bridge/.mcp.json files (plugin-files.ts:69-87, returning protocol HarnessConnectFile[]), holds the install-state probe (install-state.ts:51-53), and two claude-agnostic utility modules (paths.ts, json.ts) that @conciv/harness re-exports through shims (packages/harness/src/_shared/{cwd,json}.ts:1).
  • HARD CONSTRAINT: the CLI depends on @conciv/claude-connect and NOT @conciv/harness (packages/cli/package.json:39-51), because commit 1b2126f extracted the package precisely so npx conciv init stops dragging the agent SDKs (@anthropic-ai/claude-agent-sdk, @opencode-ai/sdk, @agentclientprotocol/sdk, @tanstack/ai* - packages/harness/package.json:66-75). npm dependencies are package-granular, so ANY import from @conciv/harness re-lands that regression. The init-contribution channel must be dependency-light by construction.

Design

  1. Contract arm (@conciv/protocol/harness-types): add an init-contribution capability to HarnessAdapter via the existing union mechanism - {capabilities: ... & {init: 'files'}; init: HarnessInit} | {capabilities: ... & {init: 'none'}; init?: undefined}. init is a REQUIRED literal discriminant on HarnessCapabilities ('files' | 'none'), never optional/boolean (codex review: optionality weakens the union guarantee to advisory). HarnessInit and everything contributions reference live in @conciv/protocol; contributions must NOT import CLI types - the CLI owns a translation layer contribution -> InitStep. HarnessInit describes what init does for this harness in data + pure functions: detection markers (bin name, config dir - subsuming today's harnessMarkers), optional AGENTS.md teaching text, and the plugin/file contribution (generate files, install commands, installed-state probe). Exact field shape is the implementer's design, grounded in what claudeStep consumes today (claude.ts:24-39,70-97).
  2. One dependency-light home: a single @conciv/harness-init package (deps: protocol + zod, exactly like claude-connect today) holds every harness's init contribution, keyed by harness id, each in its own module with a per-harness subpath export. @conciv/claude-connect's content moves in as the claude module (bridge, plugin-files, install-state, names); paths.ts/json.ts go wherever their consumers need them (they are not claude-specific - decide placement, kill the _shared re-export shims or repoint them). The CLI swaps its dep to @conciv/harness-init; @conciv/harness imports the same modules so the adapter's init field and attach.ts stay single-sourced.
  3. Pipeline walks the contract: stepList (pipeline.ts:105-113) drops claudeStep and instead maps consented harnesses to a generic harnessInitStep(contribution) for every harness whose contribution declares work. harness-detect.ts's duplicated marker list dies - detection derives from the contributions (fixing the gemini-cli omission or declaring it init: 'none' explicitly). The claude behavior must come out byte-identical: same files, same claude CLI invocations, same detect/verify probes, proven by the existing packages/cli/test/steps/harness/claude.test.ts and init-run.test.ts surviving with only import/wiring updates.
  4. Delete @conciv/claude-connect: remove from PUBLIC_PACKAGES (packages/publish/src/guards.ts:26), .fallowrc.json:85, the lockfile, and all import sites (CLI init step, harness attach.ts/blocks.ts, the _shared shims, tests). Changeset notes the package removal (pre-release, fixed-version group - verify the changesets flow tolerates a removed package; if not, document the release-time step).

Acceptance criteria

  • HarnessAdapter carries the init-contribution arm via the existing capability-union mechanism; the capability-matrix runtime test extends to cover it
  • Every harness's init behavior (including "none") is declared on its adapter; no harness id is hand-listed in the CLI
  • conciv init for claude is equivalent under fixed inputs: identical relative paths + file contents + modes + command argv + detect/verify results + manual-card text (NOT whole-home byte comparison - claude's own cache/marketplace records embed machine paths); existing claude step tests pass with only wiring updates
  • gemini-cli is either detected like its siblings or explicitly declared init-none - no silent omission
  • Dependency direction is one-way by law: cli -> harness-init -> protocol and harness -> harness-init -> protocol; @conciv/harness-init never imports @conciv/harness. Guard: a PRODUCTION-CLOSURE test asserting the CLI's packed dependency closure excludes @conciv/harness and every agent SDK (stronger than a dep-list check)
  • @conciv/claude-connect is gone: no directory, no guard/fallow/lockfile entries, no pending-changeset references, no import sites; npm disposition (deprecate vs stop publishing) is a USER decision point at implementation time
  • Shims: @conciv/harness/cwd is a public build entry - preserve, repointed at the moved module; _shared/json.ts is internal - retire it and update its import sites
  • AGENTS.md teaching text can carry optional per-harness content from the contribution (today's flat name-join remains the default)
  • fallow audit clean; publint/attw green for the new package

Blocked by

Out of scope

  • Any new native connect path for codex/opencode/gemini/pi (their contributions start as detection + AGENTS.md teaching only; a future native integration is a new capability value on the same arm)
  • The runtime connect.plan/attach surfaces (harness-types.ts:54-61) - they stay as-is; this ticket is init-time only

Spec review

  • 2026-08-06: codex defensive review NEEDS-REVISION -> all 7 revisions folded above (required literal discriminant, no-CLI-types contract + translation layer, one-way dependency law + closure test, equivalence-not-byte-identity, npm disposition decision, shim disposition, baseline = origin/main at dispatch). Boundary and package-granularity claims verified sound.

Activity

  1. omridevk commented on Aug 6, 2026

    @omridevk
    ContributorAuthor

    Codex defensive spec review: NEEDS-REVISION - boundary sound, no fatal flaw; revisions folded into the body now. The sharpenings adopted:

    1. The init capability must be a REQUIRED literal discriminant on HarnessCapabilities (e.g. init: 'files' | 'none'), never an optional/boolean property - optionality would weaken the union-arm guarantee to advisory.
    2. The contribution contract lives in @conciv/protocol types and must NOT import CLI types: the CLI owns a translation layer contribution -> InitStep ({detect, plan, apply, verify, manualCard}); contributions stay data + pure functions.
    3. Dependency direction is one-way BY LAW: cli -> harness-init -> protocol and harness -> harness-init -> protocol; harness-init must never import @conciv/harness (even for adapter types - protocol carries anything shared). Guard upgraded from a dep-list assertion to a PRODUCTION-CLOSURE test: the CLI's packed dependency closure must exclude @conciv/harness and every agent SDK.
    4. Acceptance criterion narrowed from 'byte-identical claude init' to: identical relative paths + file contents + modes + command argv + detection/verify results + manual-card text under fixed inputs. Claude's own global cache/marketplace records embed machine paths and CLI-managed state - out of comparison scope.
    5. Published-package migration spelled out: PUBLIC_PACKAGES + .fallowrc + lockfile + pending changesets, AND a decision point for the user at implementation time: whether to npm-deprecate @conciv/claude-connect or just stop publishing (pre-release, fixed-version group).
    6. Shim disposition made explicit: @conciv/harness/cwd is a PUBLIC build entry (preserve it, repointed), _shared/json.ts is internal (retire it, update import sites).
    7. Implementation baseline pinned: branch from origin/main at dispatch time (the reviewer ran on a stale checkout; all citations verified against origin/main and hold).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions