Skip to content

feat(harness-ops): live behavior-probe harness for Claude Code platform behavior #6645

Closed

Description

@kyle-sexton

Problem

Every live probe of Claude Code platform behavior in this repository is a bespoke script: each one
writes its own claude -p launcher, its own stream parser and its own record. The worktree fixtures
(plugins/source-control/skills/worktree/fixtures/*.sh), the Windows exec-form probe
(scripts/check-exec-form-windows-probe.sh), the auto-mode entry diff oracle and the cutover check
each repeat that work. None of them can be rerun as a suite when a Claude Code release touches the
surface they measured.

claude plugin eval cannot carry these cases. Per the plugin evals docs,
a case cannot set permission rules, autoMode, a permission mode or project settings; runs load no
user or project settings, never ask, and remove tools that were not granted instead of producing an
allow, deny or prompt decision. plugins/evals/skills/plugin-eval/reference/case-authoring.md:16-32,90-127
records the same limits. So the permission and auto-mode behavior our conventions rest on has no
regression harness at all.

Related: #5993 (autonomy friction), whose measurements depend on knowing these behaviors.

Observed probe results

17 hand-run claude -p --permission-mode auto --output-format stream-json --verbose --setting-sources project,local
probes in throwaway git repositories. Claude Code 2.1.295, Linux (WSL2), as of 2026-10-08.
Observed once each unless noted.

# Behavior Observed outcome
1 A PreToolUse hook returning permissionDecision: "allow" skips the auto-mode classifier A file-sourced git push --force origin main was denied by the classifier ([Git Destructive]) without the hook; with the hook the push ran and no permission_check_status event fired
2a A permissions.ask rule under -p in auto mode Becomes a denial: permission_denied, decision_reason_type: "rule", listed in permission_denials
2b A narrow permissions.allow rule for a classifier-blocked command The exact command ran with no classifier event. The model's git -C <dir> push --force origin main rewrite did not match the rule literally and the classifier denied it
3 EnterWorktree in -p auto mode By name under .claude/worktrees/: allowed. By path outside it: decision_reason_type: "safetyCheck" (an ask, which -p turns into a denial). A plain git worktree add plus per-command cd works
4 sandbox.enabled on WSL2 Bash runs sandboxed with no prompt; a request to a host not on the allowlist fails at the proxy (exit 7) and is not a permission denial; a write outside the working directory fails with "Read-only file system"
5 autoMode rules in project .claude/settings.json vs --settings Project file loaded (its env applied) but its autoMode.soft_deny rule did not; the same rule from --settings produced a classifier denial whose label was a default category ([Auto-Mode Bypass]), not the rule's text
6 A custom autoMode.soft_deny list without "$defaults" The default rules still applied: the force push was denied [Git Destructive]
7 CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS=2 Third concurrent background Agent call refused with an is_error tool result ("Concurrent subagent limit reached"); not a permission denial
8 An ask rule inside a foreground subagent Becomes a denial with agent_id set, listed in the parent's permission_denials (background subagents not tested)

Also observed: rm -rf "$VAR"/* is denied by a built-in safetyCheck before the classifier. The
user CLAUDE.md made the model refuse on its own in four runs, so every probe needs a driver
system prompt, and a run where the model never attempts the call is inconclusive, not a result.

Existing pieces to reuse (origin/main 74e40e0)

  • Runner template: plugins/session-flow/scripts/harness/hop_chain.py:932-1010 (live_runner), :909 (child_env), :916 (kill_tree), :1366 (dry-run fake runner)
  • Version helpers: plugins/session-flow/scripts/claude_cli.py:16-60
  • Trace vocabulary: plugins/evals/skills/plugin-eval/scripts/run-validity.py:93-105; plugins/testing/hooks/judge-lib.sh:503-526,754-763
  • Record format: plugins/source-control/skills/worktree/fixtures/README.md:1-25 (claim, basis argv, as-of + version, recheck trigger, outcome table); probed-behavior rule docs/conventions/upstream-drift/README.md:115-117
  • Control arms: docs/conventions/liveness-assertion/README.md:71,84; nesting-invariant-probe.sh:30,134,146-151
  • Recheck trigger: plugins/harness-ops/skills/changelog/scripts/changelog-status.sh:3-27
  • Transcript rule: .claude/rules/eval-case-transcripts.md

Design (decided)

  • Home: a script bundled inside a new harness-ops skill, not a plugin-level bin/: the
    plugin components docs note that
    claude.ai and Cowork refuse a plugin with a top-level bin/, which would take all of harness-ops
    off those surfaces.
  • Cases: grouped by area under the skill (cases/auto-mode/, cases/hooks/, cases/worktree/,
    cases/concurrency/, plus cases/sandbox/). Each case is a directory with settings.json
    (passed with --settings), prompt.md, expect.json (outcome allow|deny|ran|refused, expected
    decision_reason_type and a reason or result text match, permission mode, env, budget, tags naming
    the changelog surfaces it covers) and an optional scaffold.sh. Every negative case names a
    paired positive control. A run where the model never attempts the target call is
    inconclusive, never pass or fail.
  • Runner: stdlib Python, built on the hop_chain.py live-runner, child_env, kill_tree and
    dry-run pattern; parses the run-validity.py trace vocabulary (permission_denials,
    system/permission_denied, tool_result is_error and text). Each case runs in a temp directory
    with --setting-sources project,local, its own --settings, its own --permission-mode,
    --output-format stream-json --verbose, --max-budget-usd per case, a suite-level cost and run
    ceiling, and stamps claude_code_version from the init event. --dry-run uses a fake runner so
    tests cost nothing. Live runs are opt-in only.
  • Records: a records file in the worktree-fixtures format, per the upstream-drift probed-behavior
    rules. Raw transcripts are never committed.
  • Recheck: /harness-ops:changelog lists the cases whose tags match the surfaces a release range
    touches.
  • Findings: recorded as probed-behavior records in docs/conventions/permission-rule-hygiene/.

Phase 2 (not in the first PR)

  • A --permission-prompt-tool recorder (a small stdio MCP server that logs and denies) so a case can
    tell "would prompt" from "denied".
  • Background-subagent cases (ask rule, classifier, cap).
  • Temp CLAUDE_CONFIG_DIR isolation so the user CLAUDE.md, auto memory and connectors stop
    loading, which would retire the driver system prompt.

Acceptance criteria

  • The runner runs every case with --dry-run at no cost, and its tests pass under the repo's local checks.
  • The eight behaviors above exist as cases, each negative case with a paired positive control.
  • A live run is opt-in, capped per case and per suite, and records claude_code_version per case.
  • A run where the target call is never attempted reports inconclusive.
  • A records file holds claim, basis argv, as-of date, Claude Code version, recheck trigger and outcome table per case.
  • /harness-ops:changelog names the cases to rerun for a release range.
  • docs/conventions/permission-rule-hygiene/ carries probed-behavior records pointing at the cases.
  • No raw transcript is committed.

Activity

  1. github-actions commented on Oct 9, 2026

    @github-actions
    Contributor

    Thanks for the report. Automated triage handed this issue to a maintainer.

    Automated triage. A maintainer reviews it.

  2. added
    needs-human
    on Oct 9, 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

    needs-human

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions