Skip to content

refactor(harnesses): extract the claude launcher behind a Harness interface#342

Draft
tildesrc wants to merge 1 commit into
mainfrom
panopticon/harness-extract-claude
Draft

refactor(harnesses): extract the claude launcher behind a Harness interface#342
tildesrc wants to merge 1 commit into
mainfrom
panopticon/harness-extract-claude

Conversation

@tildesrc

Copy link
Copy Markdown
Contributor

What

Stand up src/panopticon/harnesses/ — a pluggable adapter describing one agent CLI's mechanics (config dirname, auth check, bootstrap file-writes, launch argv) — and re-express the current claude launcher as ClaudeHarness. container/agent.py becomes a thin driver that looks the harness up in a registry and dispatches to it, staying the only place a CLI is executed (the determinism invariant).

This is chunk 1/4 of the M3 harnesses work carved out of #339. It is a behaviour-preserving refactor — nothing an existing claude task does changes. Chunks 2–4 stack on top:

  1. This PR — the Harness interface + claude extraction.
  2. Control-plane recording (Task.harness / Repo.credential_dir, migrations, api/service/store).
  3. Runner wiring (images.py harness layer, local_runner.py, spawner.py).
  4. The codex harness.

How

  • harnesses/base.py — the Harness ABC + BootstrapContext / LaunchContext + constants.
  • harnesses/claude.py — the Slice-6 launcher, plus the old container/skills.py and container/hooks.py, extracted behind the interface.
  • harnesses/config.py — moved from container/config.py.
  • harnesses/__init__.py — the registry; registers claude only (codex arrives in chunk 4).
  • container/agent.py — rewired to get_harness(...). It selects by name from PANOPTICON_HARNESS, defaulting to claude, so an existing claude task is launched exactly as before.
  • Deleted container/hooks.py / container/skills.py; tests moved under tests/harnesses/.

Why it's safe

The claude golden argv/rendering tests (tests/harnesses/test_claude.py, test_claude_skills.py) carry over unchanged in substance — only import paths moved. That's the proof the extraction preserved behaviour.

The full plan lives in the task's plan.md artifact.

…erface

Stand up src/panopticon/harnesses/ — a pluggable adapter describing one
agent CLI's mechanics (config dirname, auth check, bootstrap file-writes,
launch argv) — and re-express the current claude launcher as ClaudeHarness.
container/agent.py becomes a thin driver that looks the harness up in a
registry and dispatches to it, staying the only place a CLI is executed
(the determinism invariant).

Behaviour-preserving: the claude golden argv/rendering tests carry over
unchanged in substance (only import paths move). The launcher selects the
harness from PANOPTICON_HARNESS, defaulting to claude, so an existing claude
task is launched exactly as before.

This is chunk 1/4 of the M3 harnesses work (PR #339). Chunks 2-4 stack on
top: control-plane recording (Task.harness / Repo.credential_dir), runner
image/spawn wiring, and the codex harness.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant