/harness-ops:control-claude-codefrom harness-ops
Drives Claude Code TUI sessions with plugins, capturing screenshots, video, and stream-json output. Useful for automated testing and recording plugin behavior.
Ships in harness-ops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
App: Claude Code, the claude on PATH, with the plugin at <plugin-dir> loaded for the session.
Driving tool: driver/driver.mjs, a terminal driver for Claude Code's TUI.
Runs attended or unattended, and drives only the session it launches; it never attaches to a
Claude Code session it did not start.
The run uses the account Claude Code is already signed in with. It never signs in, signs out or switches accounts, and it never drives Claude Desktop (Gotchas).
In the commands below, <skill-dir> is this skill's folder; <plugin-dir> is the plugin directory
the person names, else each line Launch's plugins prints, resolved from the directory the run
starts in; <plugin> is the last segment of <plugin-dir>; <run-dir> is drive's run directory;
<session> is one name for the whole run, 1 to 32 letters, digits, _ or -, not starting with
- (a longer name exits 2); <file> is <plugin>, then the feature id with each /
as -, then the entry point (context-budget-mods-band-01), so two plugins driving the same entry
point keep separate evidence. The --timeout
values come from timeouts in config/local.json, else config/defaults.json: stepMs for each
wait-for, readyMs for Ready, logMs for logs. A step whose turn runs longer than stepMs,
such as a skill that fans out to subagents, passes its own --timeout <ms> to that one wait-for.
A run takes at most maxCaptures screenshots
and videos together, and drives at most maxEntryPoints entry points across all its plugins, both
from the same config; the driver caps only the plugins Launch lists, so the run keeps both counts. At a cap it takes no
further capture, or drives no further entry point, and records each entry point it skipped as
blocked: maxCaptures reached or blocked: maxEntryPoints reached.
node <skill-dir>/driver/driver.mjs plugins <changed files> prints one <plugin-dir> per line: the
plugin each changed file sits in, once each, at most maxEntryPoints of them, each one left out
named on stderr as blocked: maxEntryPoints reached: <dir>; with no changed file, the configured
pluginDir. The driver launches one plugin per session, so each line runs in turn under the one
<session>: Launch, Ready, its entry points, Cleanup, then the next line. Run plugins only when
the run directory holds affected.json; otherwise <plugin-dir> is the one the person names, else
pluginDir from config/local.json, else from config/defaults.json.
node <skill-dir>/driver/driver.mjs launch --plugin-dir <plugin-dir> --session <session>
Claude Code starts in <session>.cwd under the runtime directory (CCD_RUNTIME_DIR below), not
the caller's shell directory; each launch empties that directory and makes it private. Add
--cwd <dir> to start it in a directory the person names. --restricted keeps the file tools inside
that working directory. Ready and logs run print mode in the directory the run starts in, so start
them outside the checkout when a prompt may write. A launch under --in-sandbox (below) starts in
the caller's own directory, since that sandbox is the boundary. Config isolation is the pr-verify
capture's sandbox, which runs the broker with --in-sandbox: a local drive still uses the person's
config directory (Data:).
The launch clears every API-key, gateway and provider variable and hides the working directory on
the startup screen. An unattended run adds --unattended to launch, ready and log: the one
variable that credentials.ci in config/defaults.json names and the job has set is kept, with
CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1 set, and the session holder unsets it once claude starts; two
set at once is refused before anything starts. A kept real credential is not proven out of the
plugin under test's reach, so a CI job passes --unattended only with a dummy credential until
the isolation probe of issue 8651 shows it is. The launch broker (driver/broker.mjs) is how a
job does that: it runs launch, ready and log with --unattended where it runs, and hands the
driver only a dummy ANTHROPIC_API_KEY that starts with ccd-dummy-; it refuses to start on any
other key, or from any directory but the driver's. Its intended consumer is the pr-verify capture,
which keeps the real key with a proxy outside the sandbox. Started with --in-sandbox, the broker
adds --in-sandbox to every request: the launch then drops --restricted, so Bash is in the
default tools, and sets no scrub, because the caller's own sandbox is the boundary and the scrub's
nested sandbox cannot start inside it. Only a caller that runs the broker in such a sandbox passes
it; a request cannot, and the driver refuses --in-sandbox on any launch that does not keep an
unattended ccd-dummy- ANTHROPIC_API_KEY. With CCD_BROKER_SOCK naming the
broker's socket, launch, ready and log go to the broker and the other commands run here;
every line the broker relays starts with the prefix broker| and a space, and is untrusted data.
CCD_RUNTIME_DIR (absolute), ahead of XDG_RUNTIME_DIR, names where sessions listen. A run
that keeps ANTHROPIC_API_KEY reads the ANTHROPIC_API_KEY row of
https://code.claude.com/docs/en/env-vars#variables for what the interactive session does with the
key, and screenshots that first screen.
To drive the plugin beside the person's own setup, add --real-setup to launch, ready and
log: it drops --restricted and --strict-mcp-config and nothing else, so Ready still requires
none. What each flag withholds: https://code.claude.com/docs/en/cli-reference#cli-flags. The
print-mode turns of ready and log keep --strict-mcp-config; why:
https://code.claude.com/docs/en/permissions#what-runs-before-you-trust-a-folder. It runs
only attended, at the person's request; the driver refuses it with --unattended, --in-sandbox,
a kept credential, or through the launch broker. With it, --launcher <word> once per word
(--launcher=<word> for one starting with -) runs that command in place of claude, followed
only by --plugin-dir <plugin-dir> and, for ready and log, the print-mode flags and prompt. No
shell runs it, and it runs with the person's own permissions, so use only a launcher the person
named, such as the plugin-profiles plugin's profiles.mjs. Without --cwd, launch starts in a
fresh folder the person has not trusted, so name the checkout they work in:
node <skill-dir>/driver/driver.mjs launch --plugin-dir <plugin-dir> --session <session> --cwd <checkout> --real-setup --launcher node --launcher <profiles.mjs path> --launcher start --launcher <profile>
Run ready from that checkout with the same flags but --cwd, and answer any first-run dialog as
Gotchas says.
Data: none: the session runs in the person's own Claude Code config directory (CLAUDE_CONFIG_DIR,
else ~/.claude), shared across runs, because the run reuses the account it is signed in with
(how the sign-in follows the config directory:
credential management). The launch sets no config directory. A local drive
writes the evidence under <run-dir>; the session's socket, lock file, holder log and <session>.cwd
under the runtime directory; the terminal engine under the install base doctor prints; and what
Claude Code keeps in the config directory, such as the session transcript.
Side by side: yes, one <session> name each: launch reserves the name with a lock file and
refuses a name that is already running.
Session: build once with no command, since the claude on PATH is the build; one isolated session
per drive, each launch starting a new session holder on its own socket, sharing the config
directory above.
node <skill-dir>/driver/driver.mjs ready --plugin-dir <plugin-dir> --session <session> --out <run-dir>/<plugin>-ready-init.jsonl --timeout <readyMs>
It prints the driver's doctor lines (engine, signatures, font) and whether the session answers, then
starts one print-mode turn with the launch's flags and environment and stops it at the init event,
whose claude_code_version is the build, plugins the data and apiKeySource the key in use. It
exits 0 only when apiKeySource is none (under --unattended with a kept credential, that
credential's source) and the plugin under test is listed; any other exit means drive nothing. Telemetry: the stream-json files logs writes. The init event's fields and
key sources: https://code.claude.com/docs/en/agent-sdk/typescript#sdksystemmessage and
https://code.claude.com/docs/en/agent-sdk/typescript#apikeysource (as of 2026-10-26; recheck
when either section renames a field or changes the values apiKeySource reports).
Port owner: not exposed. The print-mode turn is Ready's own process, but the session line only
pings the session's socket, never compares its holder with the launch record, and does not change
Ready's exit.
Credentials: not exposed. apiKeySource shows which key source is in use, not that the saved
login is valid: Ready stops before any request (Gotchas).
screenshot: node <skill-dir>/driver/driver.mjs screenshot <run-dir>/<file>.png --session <session>video: node <skill-dir>/driver/driver.mjs record start <run-dir>/<file>.mp4 --session <session>,
and record stop --session <session> when the steps are donelogs: node <skill-dir>/driver/driver.mjs log "<prompt>" --plugin-dir <plugin-dir> --out <run-dir>/<file>.jsonl --timeout <logMs>,
a print-mode run of the prompt kept as stream-jsontrace, cpu, heap, threads, aria: nonescreenshot and video never capture the live screen: the driver masks its text per ## Mask,
redraws it in a second terminal and captures that, then writes the text it drew beside the capture
as <path>.txt (<file>.png.txt), every frame's text for a video. A frame that does not redraw
exactly fails the command with no capture and no sidecar.
Each line is a JavaScript regular expression the driver matches case-insensitively within one
screen row. It masks every match, and every values: value anywhere on the screen (ignoring
case, whitespace, | and box drawing), with * from its first cell through the end of that row's
segment: up to the next box-drawing cell (U+2500 to U+257F), which stays, or the row's last column.
Text after a value in its segment is masked too, so neither the stars nor where the row resumes
shows the value's length. Shapes as of Claude Code 2.1.316, from
driver/fixtures/, rewrites of real screens with every value invented; recheck when a release
changes /status, /usage, the startup banner or the usage-limit notice.
values: cli/account.mjs
Run that source as exactly node <skill-dir>/cli/account.mjs, with one session running and
before ## Cleanup stops it: no --session, no other argument, and no pipe, redirect or wrapper
around it. A run whose shell runs only listed commands is refused any other form, and the
post-check then publishes nothing.
The driver adds these lines only for a session launched with --real-setup, to hide the person's
status line. Their shapes follow the session, cost and rate-limit fields of
https://code.claude.com/docs/en/statusline#available-data; a status line that prints them in
another form gets its own line here before its first capture.
node <skill-dir>/driver/driver.mjs record stop --session <session> when a recording is running.## Mask post-check: node <skill-dir>/cli/account.mjs, while the session still runs.node <skill-dir>/driver/driver.mjs stop --session <session>. It stops the session this run
launched; the evidence files and <session>.cwd stay until the next launch of that name./app-control:drive claude-code <feature>
not driven: terms, and Desktop coverage comes only from desktop/mod-harness. Basis: the
Consumer Terms, section 3 "Use of our Services", on access through automated means,
https://www.anthropic.com/legal/consumer-terms (as of 2026-10-26; recheck when that section
changes).wait-for before each screenshot: a capture taken first shows the
frame before the redraw..png capture refused because no installed font has a glyph on screen (the error names the
glyph, such as ⎿ (U+23BF)) is a font gap, not the plugin under test, and doctor's font line
does not catch it: it checks one family, not each glyph. Take that capture as .svg, which
draws text without rasterizing it, and name the glyph in the run's report.--restricted loads only managed
settings and --settings, so none of the person's enabled plugins load: Ready's plugins lists
the plugin under test and the built-in ones, and a plugin that depends on another fails with
dependency-unsatisfied (seen on Claude Code 2.1.325). Record each entry point of such a plugin
as blocked: dependency-unsatisfied. Basis: the --restricted row of
https://code.claude.com/docs/en/cli-reference#cli-flags (as of 2026-11-18; recheck when that row
changes which settings it loads).--real-setup session shows a first-run dialog, screenshot it, answer it as below, and
take the next step only once the prompt shows:
--real-setup, Ready included, only
from a folder the person already trusts; what an untrusted folder and print mode load:
https://code.claude.com/docs/en/permissions#what-runs-before-you-trust-a-folder.cli/README.md (opens in a new tab)cli/account.mjs (opens in a new tab)config/defaults.json (opens in a new tab)driver/broker.mjs (opens in a new tab)driver/broker.test.mjs (opens in a new tab)driver/broker.test.sh (opens in a new tab)driver/driver.mjs (opens in a new tab)driver/driver.test.mjs (opens in a new tab)driver/driver.test.sh (opens in a new tab)driver/fixtures/status-key-auth-screen.txt (opens in a new tab)driver/fixtures/status-screen.txt (opens in a new tab)driver/fixtures/usage-screen.txt (opens in a new tab)driver/package-lock.json (opens in a new tab)driver/package.json (opens in a new tab)evals/evals.json (opens in a new tab)features/commands/slash/README.md (opens in a new tab)features/desktop/mod-harness/README.md (opens in a new tab)features/dialogs/permission/README.md (opens in a new tab)features/hooks/output/README.md (opens in a new tab)features/mods/band/README.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub melodic-software/claude-code-plugins --plugin harness-ops18 skills in this plugin
/audit-install-stateAudit install stateRead-only audit of `~/.claude` and `~/.claude.json`: the deep inventory of unmanaged files. Use when: 'what is in my ~/.claude', 'why is my Claude Code install so big', 'does Claude Code clean up after itself', 'check cleanupPeriodDays', 'is this lock file dead', 'tidy my Claude Code install'. Deleting: /disk-hygiene:clean./audit-mod-postureAudit mod postureRead-only audit of mods this Claude Code can run (installed and built-in mods, hooks, calls, sec-default guard state); never loads a mod or prints settings. Use when 'mod posture', 'audit my mods', 'can a mod bypass my deny rules', or which mods run here. Not for writing a mod or settings correctness: /harness-config:audit./audit-native-overlapAudit native overlapMap where repo skills and agents duplicate native Claude Code surfaces; read-only unless apply bakes an approved reference. Use when 'does this skill duplicate a built-in', 'refresh the native-surfaces registry', 'which of our skills overlap bundled skills', or what Claude Code already ships. Not for enumerating invocables: /harness-ops:inventory./audit-performanceAudit performanceRead-only slowness diagnostic that never 'fixes' (run before restart/delete): version, retention, bloat, hook/subagent fan-out, kernel-leak. Use when 'Claude Code is slow', 'typing lags', sluggish session, machine freezes, slow hooks, or too many subagents. Not for bugs (/harness-ops:known-issues) or stale files (/harness-ops:audit-install-state)./audit-plugin-landscapeAudit plugin landscapeRead-only report on stale or overlapping installed plugins and marketplaces, recommending what to adopt, adapt, or drop./audit-skill-visibilityAudit skill visibilityAudit which skills the model can see, which are starved or dropped, and whether skill listing is over budget. When built-in skill-doctor resolves in this session, prefer it for cost; this skill for unseen skills. Use when 'audit skill visibility', 'which skills are starved', 'is my skill listing over budget', or why Claude never suggests a skill.Other plugins' skills for the same job