Skip to content

Split built-in harness providers out of harness.ts #1810

Open

Description

@amrmelsayed

Problem

packages/codev/src/agent-farm/utils/harness.ts holds both the general-purpose harness layer and every built-in provider's CLI-specific details:

  • The general-purpose part: the HarnessProvider interface, the resolver (resolveHarness, resolveInteractiveTaskLauncher), command detection, retirement handling, and custom-harness validation.
  • The CLI-specific part: each built-in provider (CLAUDE_HARNESS, CODEX_HARNESS, OPENCODE_HARNESS) with what it knows about its own CLI. That covers Claude's --append-system-prompt, /clear, session jsonl paths, and the subcommand and blocking-flag lists added by Spec 1797, and codex's model_instructions_file and subcommand list.

Mixing the two in one file makes CLI-specific knowledge look like shared vocabulary. Every new harness capability grows the shared module.

PR #1808 (Spec 1797) took the first small step: the interactive-launch blocker lists are no longer exported and now sit directly beside the provider that uses them.

Proposal

Split the built-in providers out, one file per harness, for example:

agent-farm/utils/harness.ts            interface, resolver, detection, retirement, custom harness
agent-farm/utils/harnesses/claude.ts   CLAUDE_HARNESS and its private CLI knowledge
agent-farm/utils/harnesses/codex.ts    CODEX_HARNESS
agent-farm/utils/harnesses/opencode.ts OPENCODE_HARNESS

Constraints:

  • The public API stays the same. harness.ts keeps exporting the same names (BUILTIN_HARNESSES, getBuiltinHarness, the provider constants) so callers don't change.
  • Provider internals stay private. Each provider's private helpers and lists stay unexported. Tests go through the provider methods, not the constants.
  • Shared helpers stay generic. Helpers several providers use (for example flagName, findSubcommand and shellEscapeSingleQuote) live in a small shared module and never name a specific CLI.
  • No behavior change. The existing harness.test.ts suite passes unchanged, apart from import paths.

Activity

  1. added
    area/tower
    on Oct 13, 2026
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

    area/tower

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions