Skip to content

fix(tier3): count edits, searches and MCP calls as productive and leave planning calls out of tool efficiency - #428

Merged
rng1995 merged 18 commits into
mainfrom
naren/port-tier3-tool-productivity-classes
Nov 12, 2026
Merged

rng1995 merged 18 commits into
mainfrom
naren/port-tier3-tool-productivity-classes

Conversation

@rng1995

@rng1995 rng1995 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Tier 3 tool efficiency, half of skill_efficiency, now classifies each tool call as productive, wasted or neutral. All code changes are in src/skillevaluator/tier3/eval_core/checks.py: check_tool_efficiency, the new helpers above it, and an argv flag and OpenCode's list on _tool_searches_root. The bundled verifier already delegates to check_tool_efficiency.

  • Productive: reading, Write, Edit, MultiEdit, NotebookEdit, write_file, edit_file, apply_patch, scoped Grep, Glob, LS, OpenCode list, Codex list_dir and grep_files, Skill, command runs, and MCP tools named mcp__server__tool (Claude Code).
  • Neutral, left out of the score: TodoWrite, TodoRead, update_plan, task lists (TaskCreate, TaskGet, TaskList, TaskUpdate), EnterPlanMode, ExitPlanMode, background-shell polling (BashOutput, KillShell, KillBash, kill_shell, TaskStop, TaskOutput), ToolSearch, and sub-agent calls (Task, Agent, Codex spawn_agent, wait, wait_agent, close_agent, send_input, resume_agent). The reason ends with ; N planning or bookkeeping call(s) not counted, and details gains a neutral count.
  • Neutral names are checked first, so BashOutput and KillShell no longer get execution credit from the bash/shell substring.
  • Codex write_stdin with no input, or only Enter or Ctrl-C, is polling and neutral, as is a Monitor watch with no command. Text typed with write_stdin, or the command Monitor runs, is classified like any other command, so a root search typed into an interactive shell is waste. A wasted call of this kind is labelled with that text.
  • A trial whose only calls are neutral did no work. It scores tool efficiency 0.0 (passed false) with the reason No scored tool calls; N planning or bookkeeping call(s) not counted, so its skill_efficiency is 0.0, the same as a trial with no tool calls. On main, a trial of only planning or sub-agent calls also scored 0.0, but a trial of only TodoRead (OpenCode todoread), BashOutput, KillShell, KillBash or kill_shell calls scored 1.0, from the read, bash or shell in the name. That trial now drops to 0.0.
  • Codex names with a namespace, such as functions.apply_patch or functions.update_plan, are classified by the part after the last dot. MCP names keep every part, so mcp__tasks__task stays an MCP call.
  • An MCP filesystem search or listing whose path or dir_path is / is a root search and counts as waste, like the same scan through Grep, Glob or find. A call is one when its tool name contains search, list, tree, find, glob, grep or directory, or its server name contains filesystem. Other servers use path for other things: mcp__github__get_file_contents with path / lists a repository root and is productive.
  • Help, version and install words are matched only in the command of a command run or a write_stdin/Monitor input. A patch given to a patch tool, a file path or file text that mentions pip install, --help or which is not waste, so apply_patch scores the same whether the patch is recorded under input, patchText or the converter's raw fallback for a non-object input.
  • A command recorded as an argv list (command or cmd) is joined with shlex.join before the root-search, expected-script and help/version/install checks. ["bash", "-lc", "find / -name x"] and ["find", "/", "-name", "x"] are now waste, and so are ["pip", "install", "-e", "."], ["npm", "install"] and ["which", "jq"], like the same command written as text. The list's own words are literal (no shell runs them), so $, backticks and # in them do not stop the root-search check: ["grep", "-r", "#TODO", "/"] is waste. A sh -c payload inside the list is still shell text and scores like the same command written as text. The wasted-call label in details still shows the recorded list.
  • Codex MCP calls are recorded under the bare tool name and OpenCode MCP calls as server_tool, so they are classified by that name like any other tool, and most count as wasted. Recognizing them needs each agent's MCP server map and is left for a follow-up. The CHANGELOG and both docs pages say so.
  • Docs: docs/reports.mdx (the tool-efficiency paragraphs under the five dimensions) lists the classes; docs/tier3-live-evaluation.mdx describes skill_efficiency under standard grading. CHANGELOG entry under Unreleased > Changed.

Why

On current main, check_tool_efficiency counted a call as productive only when its name contained read, was exactly Skill, or contained an execution hint (bash, run, shell, ...). Everything else was waste. On main:

  • Claude Code: Read the skill, Edit four files, run pytest -q: 0.33 (2 of 6).
  • Codex: exec_command + 2 apply_patch + update_plan: 0.25, with or without the functions. prefix.
  • OpenCode: read the skill, list /workspace, edit a file, bash pytest -q: 0.5.
  • A scoped Grep, Write, an apply_patch or an MCP call alone: 0.0.
  • TodoWrite alone: 0.0. BashOutput + KillShell: 1.0.
  • Read the skill, 3 TaskCreate, 2 Edit, 3 TaskUpdate, pytest: 0.2 (2 of 10), which fails the 0.5 threshold.
  • shell with ["bash", "-lc", "find / -name review.py"] or ["find", "/", "-name", "review.py"]: 1.0, because the list was turned into its Python repr before the root-search check.

So a with-skill trial that edits files, patches them or uses search and MCP tools lost up to about half of its skill_efficiency, a third in the first example above. skill_efficiency feeds the Efficiency dimension, the overall score and the verdict. Planning calls other than TodoRead counted as waste, and background-shell polling as work. Lift is unaffected because the baseline arm's skill_efficiency is N/A.

Kept from public

Tests

  • New tests/tier3/test_tool_productivity.py (292 tests). All but eight are parametrized over the host checks module and the bundled verifier template; host cases also check _tool_call_productivity directly.
    • real work is productive (17 call shapes, including apply_patch, OpenCode list, list_dir, grep_files, an argv shell call and an mcp__ tool)
    • all 25 bookkeeping names are neutral; BashOutput and KillShell get no execution credit; a run with 3 TaskCreate and 3 TaskUpdate scores 4/4 with 6 not counted; spawn_agent + wait scores like spawn_agent + wait_agent
    • write_stdin and Monitor (11 cases): no input, Enter or Ctrl-C and a WebSocket watch are neutral; typed or watched commands are productive; root searches and pip install are wasted; bash with a tty plus a typed find / scores 0.5
    • MCP filesystem calls on / through path or dir_path, by tool name or by a filesystem server, are wasted (5); scoped ones and a / inside a query are productive (3); MCP tools named like bookkeeping tools stay MCP calls (3)
    • MCP calls of other servers with path or dir_path / are productive (4), including mcp__github__get_file_contents with path / and src/
    • a README patch that mentions pip install, --help, which , apt-get and brew is productive for apply_patch, functions.apply_patch and applypatch under input, raw, patch and patchText (3 tests); Edit with that patch under raw, a Write or Read whose path holds an install word and an MCP search query are productive (4); exec_command with raw pip install requests is still wasted
    • an OpenCode trial (read the skill, list /workspace, edit, bash pytest -q) gives the same result as the Claude Code trial with Read, LS, Edit and Bash: 4/4
    • namespaced Codex names (9 cases) and a functions.* patch run scoring 3/3 with 1 not counted
    • filesystem scans and setup noise are wasted (8 commands); help, version and install commands are wasted as argv lists and as text (6)
    • root searches that name the expected script are wasted, as text and as argv lists; running the expected script stays productive, as text and as argv lists
    • a root search plus a script run scores 0.5 for string and argv forms
    • native searches rooted at / are wasted (9, including OpenCode list), scoped ones productive (7); native and shell root scans score the same
    • neutral calls and Codex sub-agent calls are left out with the exact reason; only bookkeeping scores 0.0, passed false
    • host only (3): details counts neutral calls and labels a wasted argv call with its recorded list and a wasted write_stdin call with its text; only bookkeeping records zero scored calls
    • end to end through the verifier's main() (5): Read the skill, TodoWrite, 4 Edit, pytest -q gives tool efficiency 6/6 with 1 call not counted, and skill_efficiency is the mean of routing and 1.0; a trial with no calls, only TodoWrite, only update_plan or only Task gets skill_efficiency 0.0, and the host score_skill_efficiency agrees
  • tests/tier3/test_root_search_efficiency.py: scoped Grep/Glob calls now expect 1.0 instead of 0.0, and 36 new argv tests: root searches under command and cmd are waste; argv words with #, $ or a backtick are literal, so a root operand is still found (4), while scoped ones stay productive (2); a bash -lc payload with a comment or $(...) scores like the same text (2); ["python", "task.py"], ["bash", "-lc", "python task.py"] and scoped argv commands stay productive; argv root search plus script run scores 0.5. 184 passed.
  • Fail-before against main (d136a597 src/, this PR's tests): 258 failed, 218 passed. That is 236 of 292 in test_tool_productivity.py and 22 of 184 in test_root_search_efficiency.py. The host cases also fail because _tool_call_productivity does not exist on main. The tests that pass on main pin behavior that does not change, such as scoped shell searches staying productive and a trial of only TodoWrite, update_plan or Task getting skill_efficiency 0.0.
  • pytest -n 4 tests/tier3: 10027 passed, 3 skipped. The run includes test_checks_path_extraction.py, test_codex_tool_call_normalization.py, test_shared_check_adapters.py, test_harbor_template_secret_patterns.py and test_apply_patch_security.py.
  • tests/test_ci_workflows.py, tests/test_oss_packaging.py, tests/test_benchmark_rollout_docs.py, tests/test_ci_change_classifier.py, tests/test_harbor_claude_refusal_fallback.py, tests/test_accuracy_arithmetic.py, tests/test_tier3_public_runtime.py and tests/ci/test_image_build.py (the CHANGELOG and docs readers): 545 passed.
  • Merged with main at d136a597. The CHANGELOG conflict with Keep report navigation persistent and evidence accessible #352's entries is resolved by keeping Keep report navigation persistent and evidence accessible #352's three Unreleased > Changed entries first and this entry after them. main at 86f1a1f0 was then merged in to resolve a CHANGELOG.md conflict with feat(ci): add three-tier onboarding and private report feedback #349's entries; both entries are kept. main at fff533288 was merged in last: check_tool_efficiency keeps this PR's docstring followed by fix(tier3): treat placeholder expected_script and behavior values as no expectation #402's expected_script normalization, and this PR's tests (498) pass on the merged tree.
  • ruff check and ruff format --check are clean on the changed Python files, and scripts/check_oss_boundary.py passed.

🤖 Generated with Claude Code

rng1995 and others added 15 commits November 7, 2026 20:34
… efficiency

check_tool_efficiency counted a call as productive only when its name
contained "read", "skill" or an execution hint, so Write, Edit, MultiEdit,
apply_patch, scoped Grep/Glob/LS, Codex list_dir and grep_files, and MCP
tools were all waste. A with-skill trial that read the skill, edited four
files and ran the tests scored 0.33. Planning calls counted as waste and
background-shell polling (BashOutput, KillShell) as command runs.

Classify each call as productive, wasted or neutral. Neutral calls
(TodoWrite, update_plan, background-shell control, ToolSearch, sub-agent
calls) are left out of the score and counted in the reason and details. A
list of only neutral calls scores like a list with no tool calls.

Join argv-list commands with shlex.join before the root-search,
expected-script and help/install checks, so ["bash", "-lc", "find / ..."]
and ["find", "/", ...] are waste like the same command written as text.
Root searches keep using _tool_searches_root.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
List the productive, wasted and neutral tool classes in reports.mdx,
describe skill_efficiency under standard grading in
tier3-live-evaluation.mdx, and add the Unreleased > Changed entry.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts: CHANGELOG.md. Unreleased > Changed keeps main's three report
entries, then this branch's tool efficiency entry.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iency

A trial whose only calls were neutral (TodoWrite, update_plan, Task and
the like) scored tool efficiency 1.0. Both skill_efficiency callers stop
early for an empty trajectory and score it 0.0, so a planning-only trial
got skill_efficiency 0.5 while a trial with no calls got 0.0.

Return passed False and score 0.0 with the reason "No scored tool calls;
N planning or bookkeeping call(s) not counted". A planning-only trial now
scores skill_efficiency 0.0, like a trial with no tool calls. Neutral
calls in a trial that also does work are still left out of the score.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fficiency

The neutral set missed planning and sub-agent tools that Claude Code and
Codex record: TaskCreate, TaskGet, TaskList, TaskUpdate, EnterPlanMode
and Codex wait. A trial that read the skill, created three tasks, made
two edits, updated three tasks and ran the tests scored 0.4 and failed,
because all six task calls counted as waste. They are now neutral.

Codex can also record its built-in tools under a namespace, such as
functions.apply_patch or functions.update_plan. Classify a call by the
name after the last dot, as trajectory timing already does, so those
calls get the same class as the bare names. MCP tool names keep every
part, so mcp__tasks__task stays an MCP call.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex write_stdin was always neutral, so a command typed into an
interactive shell escaped the root-search rule: exec_command bash with
tty, then write_stdin "find / -name review.py", scored 1.0. Claude Code
Monitor, which runs its command as a background watch, counted as waste.

write_stdin with no input, or only Enter or Ctrl-C, is polling and stays
neutral, as is a Monitor watch with no command. Otherwise the text they
send is classified like any other command: a root search or a
help/version/install command is waste, other commands are productive.
Wasted calls are labelled with that text.

Every mcp__ call was productive, so an MCP filesystem search or listing
from "/" got full credit while the same scan through Grep, Glob or find
was waste. An MCP call whose path or dir_path is the root is now waste.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
shlex.join quotes an argv word that holds "$", a backtick or "#", and
the root-search check then gave up on the whole command, as it does for
shell text with expansions or comments. An argv list runs without a
shell, so those characters are literal: ["grep", "-r", "#TODO", "/"]
and ["find", "/", "-name", "$HOME"] scored 1.0 while
["grep", "-r", "TODO", "/"] scored 0.0.

_tool_searches_root takes argv=True for text joined from an argument
list and skips that bail-out for the list's own words. A "sh -c"
payload inside the list is still shell text, so it scores like the same
command written as text.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- MCP credit applies to Claude Code mcp__server__tool names. Codex
  records MCP calls under the bare tool name, and those are classified
  by that name; the CHANGELOG says they are not recognized yet.
- List the new neutral names (task lists, plan mode, Codex wait), the
  write_stdin and Monitor rule, namespaced Codex names, MCP calls on
  "/" and literal argv words.
- A trial with only neutral calls scores tool efficiency 0.0, so its
  skill_efficiency matches a trial with no tool calls.
- The CHANGELOG says help, version and install commands recorded as an
  argument list now count as waste, and a test pins those argv forms.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…em tools

Other MCP servers use path for something other than the local disk. The
GitHub server's get_file_contents with path "/" lists a repository root,
and it was counted as a wasted root search. Only a tool whose name says it
searches or lists (search, list, tree, find, glob, grep, directory), or a
tool of a server whose name contains "filesystem", is now a root search
when its path or dir_path is "/".

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The converter records a tool input that is not an object under "raw". For
apply_patch that is the whole patch text, which was matched against the
help, version and install words. A README patch that mentions pip install,
or "which " in a sentence, made the patch a wasted call, while the same
patch under "input" was productive. File paths of Read, Write and Edit
were matched the same way. The words are now matched only in the command
of a command run or session input, as before for those calls.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
OpenCode lists a directory with its "list" tool, where Claude Code uses
LS. It counted as wasted, so an OpenCode trial that read the skill,
listed /workspace, edited a file and ran the tests scored tool efficiency
0.75, while the same Claude Code trial scored 1.0. "list" is now a
productive tool, and a "list" on / is a root search, like LS.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ncy rules

Say which MCP calls on / are root searches, list OpenCode list with the
productive listings, and note that OpenCode MCP calls, like Codex ones,
are not recognized yet. The CHANGELOG now names dir_path with path, says
that a trial of only background-shell polling drops from 1.0 to 0.0
instead of "still" scoring 0.0, and says that help, version and install
words are matched in commands only.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… 0.0

A TaskStop-only trial already scored 0.0, so say that trials of only
BashOutput or KillShell calls drop from 1.0 to 0.0.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rng1995
rng1995 marked this pull request as ready for review November 9, 2026 19:50
Main gained a first line in check_tool_efficiency (#402) right under the
docstring this branch rewrites. Both are kept: this branch's docstring,
then main's expected_script normalization.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the complete production diff and regression coverage; checked productive/neutral/wasted classes, namespaced and MCP calls, interactive shell input, literal argv handling and root-search precedence. No actionable findings.

Verification at unchanged head 53cae2ab829f064fe02223d1bb376cf9242f5098: 20 existing CI checks succeeded and 2 were intentionally skipped, including the supported Python tests, lint/package and security/platform gates where applicable. Fresh git merge-tree --write-tree is clean against the frozen main commit ce52a09. No new local test run is claimed for this unchanged code.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up documentation navigation review found newly introduced links that fail in the pinned Fern preview:

Comment thread docs/tier3-live-evaluation.mdx Resolved

@rng1995 rng1995 left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final review at 5ff9f47e8ca5da98d34806089638931c836fb725: Reviewed the full tool-productivity implementation and regression coverage, including neutral calls, namespaces/MCP, argv handling and root-search precedence. Corrected the newly introduced Reports navigation link to its published route. The production logic retains its prior exact-head green CI evidence; the only additional edit is the documentation URL plus a clean frozen-main merge. No new unit tests were added for the URL correction.

Pinned Fern 5.121.0 check passes with 0 errors; its only warning skips the authenticated redirects check because FERN_TOKEN is unavailable. Independent preview evidence shows the published routes return HTTP 200 and the previous relative .mdx routes return HTTP 400. Every reported thread is replied to and resolved. Signed-off commits were pushed normally after live-head checks. Fresh CI for this final SHA is pending; root is watching it to completion. No merge performed.

@rng1995
rng1995 merged commit 44ee844 into main Nov 12, 2026
25 checks passed
@rng1995
rng1995 deleted the naren/port-tier3-tool-productivity-classes branch November 12, 2026 19:55
rng1995 added a commit that referenced this pull request Nov 12, 2026
Brings in main through b38b71b (#416, #417, #420, #422, #423, #428,
#429, #467). Merged without conflicts; CHANGELOG, docs, decoys.py and
eval_core/checks.py auto-merged with both sides' edits in separate hunks.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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