Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
fix(tier3): count explicit root searches as wasted tool calls (#229)
Christopher Kevineaa68be81342
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 36e5fe4a..98a11ca1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -39,6 +39,12 @@ All notable changes to SkillEvaluator are documented in this file.### Fixed+- Explicit searches of `/` (`find`, `grep -r`, `rg`, `ag`, `du` and `tree` with a+ `/` operand, and native search tools rooted at `/`) now count as wasted tool+ calls whether or not they name the expected skill or script, including when+ output is redirected or the search runs inside `sh -c`. Host and bundled+ scoring agree, while scoped searches and slash-valued patterns retain their+ classification.- PII email scans recognize all RFC 2606 reserved domains, including theirsubdomains, mixed-case forms, trailing dots, and prose ellipses. A local-partboundary prevents quadratic rescanning of long excluded addresses. Ordinarydiff --git a/docs/reports.mdx b/docs/reports.mdxindex 356caef0..b415794c 100644--- a/docs/reports.mdx+++ b/docs/reports.mdx@@ -370,6 +370,14 @@ dimensions, each answering one question:| Effectiveness | Did the skill help complete the task? | `goal_accuracy` and `behavior_check`, from LLM judges || Efficiency | Did it avoid wasted tool or skill usage? | `skill_efficiency`, from deterministic trajectory checks |+Tool-efficiency checks classify explicit searches rooted at `/` as wasted work,+whether or not the command names the expected skill or script. Scoped searches+and `/` used as a search pattern retain their existing classification. This rule+recognizes common search commands, including ones with redirections or wrapped in+`sh -c`; it does not interpret expansions, comments, here-documents or other+dynamically constructed shell programs.++Every evaluator and dimension score is on a 0.0 to 1.0 scale. The generatedstandard grader rejects non-finite values and clamps numeric scores with`max(0.0, min(1.0, score))`. A failed required judge produces no score insteaddiff --git a/src/skillevaluator/tier3/eval_core/checks.py b/src/skillevaluator/tier3/eval_core/checks.pyindex f43e62f0..7f03be20 100644--- a/src/skillevaluator/tier3/eval_core/checks.py+++ b/src/skillevaluator/tier3/eval_core/checks.py@@ -2889,7 +2889,9 @@ def check_activation(}# Check 3: shell read of SKILL.md (cat/sed/head/...)- exec_calls = [tc for tc in tool_calls if _is_execution_action(str(tc["action"])) and not _failed_single_skill_read(tc)]+ exec_calls = [+ tc for tc in tool_calls if _is_execution_action(str(tc["action"])) and not _failed_single_skill_read(tc)+ ]for call in exec_calls:cmd = _command_text(call)if _cmd_reads_skill_md(cmd):@@ -2926,8 +2928,7 @@ def check_activation(_is_execution_action(action) and _cmd_reads_skill_md(cmd))if not has_skill_read_evidence or (- tc.get("is_error") is True- and (not _is_execution_action(action) or _failed_single_skill_read(tc))+ tc.get("is_error") is True and (not _is_execution_action(action) or _failed_single_skill_read(tc))):continueobs = str(tc.get("observation", "")).lower()@@ -6512,6 +6513,270 @@ def check_routing(}+def _search_path_is_root(value: str) -> bool:+ return value.startswith("/") and not posixpath.normpath(value).strip("/")+++_ASSIGNMENT_MASK = "\ue00f"+++def _mask_non_assignment_equals(text: str) -> str:+ """Replace every ``=`` that does not make its word a shell assignment.++ Tokens lose their quoting, but the shell only reads ``NAME=`` as an+ assignment when NAME is written unquoted; ``'NAME=value'`` and+ ``NAME\\=value`` are command names. Only ``=`` characters are replaced,+ so the masked text tokenizes into the same words as the original.+ """+ out = []+ name: list[str] = []+ plain = True+ quote = None+ index = 0+ while index < len(text):+ char = text[index]+ if quote:+ if char == quote:+ quote = None+ elif char == "\\" and quote == '"' and index + 1 < len(text):+ out.append(char)+ index += 1+ char = text[index]+ out.append(_ASSIGNMENT_MASK if char == "=" else char)+ elif char == "\\":+ plain = False+ out.append(char)+ if index + 1 < len(text):+ index += 1+ out.append(_ASSIGNMENT_MASK if text[index] == "=" else text[index])+ elif char in "'\"":+ quote = char+ plain = False+ out.append(char)+ elif char.isspace() or char in _SHELL_METACHARS:+ name.clear()+ plain = True+ out.append(char)+ elif char == "=":+ out.append("=" if plain and _SHELL_NAME_RE.fullmatch("".join(name)) else _ASSIGNMENT_MASK)+ plain = False+ else:+ name.append(char)+ out.append(char)+ index += 1+ return "".join(out)+++def _tool_searches_root(action: str, args: dict, text: str, depth: int = 0) -> bool:+ """Recognize explicit root search operands, not '/' inside a pattern.++ This is bounded top-level command classification. It does not execute or+ interpret dynamically constructed shell programs.+ """+ if action in {"grep", "glob", "grep_files", "list_dir", "ls"}:+ for key in ("path", "dir_path"):+ value = args.get(key)+ if isinstance(value, str) and _search_path_is_root(value.strip()):+ return True+ pattern = args.get("pattern")+ if action == "glob" and isinstance(pattern, str) and pattern.startswith("/"):+ first = pattern.lstrip("/").split("/", 1)[0]+ if not first or any(char in first for char in "*?[{"):+ return True+ if not _is_execution_action(action) or len(text) > 65536:+ return False+ # Without a shell AST, comments, expansions, here-documents and process+ # substitutions cannot be classified reliably. Keep their prior score+ # instead of inventing a path.+ if any(char in text for char in "$`#"):+ return False+ tokens = _shell_tokens(text)+ if any(_is_heredoc_redirect(token) or token in {"<(", ">("} for token in tokens):+ return False+ masked_tokens = _shell_tokens(_mask_non_assignment_equals(text))+ if len(masked_tokens) != len(tokens):+ masked_tokens = [""] * len(tokens)+ commands: list[list[str]] = [[]]+ masked_commands: list[list[str]] = [[]]+ skip_redirect_target = False+ for token, masked_token in zip(tokens, masked_tokens, strict=True):+ if token in {";", "&&", "||", "|", "&", "(", ")"}:+ commands.append([])+ masked_commands.append([])+ skip_redirect_target = False+ elif skip_redirect_target:+ skip_redirect_target = False+ elif _is_output_redirect(token) or token in _INPUT_REDIRECT_OPERATORS or _DESCRIPTOR_OPERATOR_RE.match(token):+ skip_redirect_target = True+ elif not _ATTACHED_REDIRECT_RE.match(token):+ commands[-1].append(token)+ masked_commands[-1].append(masked_token)+ for command, masked_command in zip(commands, masked_commands, strict=True):+ assignments: dict[str, str] = {}+ index = 0+ while (+ index < len(command)+ and _SHELL_ASSIGNMENT_RE.match(masked_command[index])+ and (assignment := _SHELL_ASSIGNMENT_RE.match(command[index]))+ ):+ assignments[assignment.group(1)] = assignment.group(2)+ index += 1+ index = _unwrap_shell_command(command, index, assignments)+ if index is None or index >= len(command):+ continue+ name = _shell_executable(_resolved_shell_arg(command[index], assignments))+ if name in _SHELL_COMMAND_INTERPRETERS:+ payload = _shell_c_payload(command, index, assignments)+ if (+ payload is not None+ and depth < _MAX_SHELL_REFERENCE_DEPTH+ and _tool_searches_root(action, {}, payload, depth + 1)+ ):+ return True+ continue+ if name not in {"find", "grep", "egrep", "fgrep", "rg", "ag", "du", "tree"}:+ continue+ arguments = [_resolved_shell_arg(arg, {}) for arg in command[index + 1 :]]+ if name == "find":+ cursor = 0+ while cursor < len(arguments):+ argument = arguments[cursor]+ if argument in {"-H", "-L", "-P"} or re.fullmatch(r"-O[0-9]+", argument):+ cursor += 1+ elif argument == "-D":+ cursor += 2+ else:+ break+ if cursor < len(arguments) and arguments[cursor] == "--":+ cursor += 1+ for argument in arguments[cursor:]:+ if argument.startswith("-") or argument == "!":+ break+ if _search_path_is_root(argument):+ return True+ continue+ pattern_tools = {"grep", "egrep", "fgrep", "rg", "ag"}+ needs_pattern = name in pattern_tools+ boolean_short = {+ "grep": "rRnilLqsvcwxhHaboEFGPIUzZ",+ "egrep": "rRnilLqsvcwxhHaboEFGPIUzZ",+ "fgrep": "rRnilLqsvcwxhHaboEFGPIUzZ",+ "rg": "niwlqzUuFSPovcHhNLa",+ "ag": "niwlqsvac",+ "tree": "adfipqNQDFhsiuxACn",+ "du": "achkLmPsxH",+ }+ boolean_long = {+ "--recursive",+ "--ignore-case",+ "--line-number",+ "--files-with-matches",+ "--files-without-match",+ "--quiet",+ "--no-messages",+ "--invert-match",+ "--word-regexp",+ "--line-regexp",+ "--count",+ "--fixed-strings",+ "--hidden",+ "--no-ignore",+ "--no-heading",+ "--heading",+ "--follow",+ "--null",+ "--text",+ }+ values = {+ "grep": {+ "-A",+ "-B",+ "-C",+ "-m",+ "--after-context",+ "--before-context",+ "--context",+ "--max-count",+ "--include",+ "--exclude",+ "--exclude-dir",+ },+ "rg": {+ "-A",+ "-B",+ "-C",+ "-m",+ "-r",+ "--replace",+ "-g",+ "--glob",+ "--iglob",+ "-t",+ "-T",+ "--type",+ "--type-not",+ "--max-depth",+ "--encoding",+ "--engine",+ "--sort",+ "--sortr",+ "--max-count",+ "--after-context",+ "--before-context",+ "--context",+ },+ "ag": {"-A", "-B", "-C", "-m", "--after", "--before", "--context"},+ "tree": {"-L", "-P", "-I", "-o", "--filelimit", "--charset"},+ "du": {"-d", "--max-depth", "-B", "--block-size", "--exclude"},+ }+ value_options = values.get("grep" if name in {"egrep", "fgrep"} else name, set())+ index = 0+ positional_only = False+ unsupported = False+ root_operand = False+ while index < len(arguments):+ argument = arguments[index]+ index += 1+ if not positional_only and argument == "--":+ positional_only = True+ continue+ if not positional_only and argument.startswith("-"):+ if name == "rg" and argument == "--files":+ needs_pattern = False+ elif name in pattern_tools and argument in {"-e", "--regexp", "-f", "--file"}:+ needs_pattern = False+ index += 1+ elif name in pattern_tools and (+ argument.startswith(("--regexp=", "--file=")) or argument.startswith(("-e", "-f"))+ ):+ needs_pattern = False+ elif argument in value_options:+ index += 1+ elif (+ (argument.startswith("--") and argument.partition("=")[0] in value_options and "=" in argument)+ or (name in pattern_tools and argument in boolean_long)+ or (+ argument.startswith("-")+ and not argument.startswith("--")+ and len(argument) > 1+ and set(argument[1:]) <= set(boolean_short[name])+ )+ ):+ pass+ else:+ unsupported = True+ break+ continue+ if needs_pattern:+ needs_pattern = False+ elif _search_path_is_root(argument):+ root_operand = True+ if root_operand and not unsupported:+ return True++ return False++def check_tool_efficiency(tool_calls: list[dict[str, Any]],expected_skill: str | None = None,@@ -6545,7 +6810,9 @@ def check_tool_efficiency(is_productive = False- if ("read" in action and expected_skill and expected_skill in cmd) or (+ if _tool_searches_root(action, args, cmd):+ is_productive = False+ elif ("read" in action and expected_skill and expected_skill in cmd) or (_is_execution_action(action) and expected_script and expected_script in cmd):is_productive = Truediff --git a/src/skillevaluator/tier3/harbor/templates/eval.py b/src/skillevaluator/tier3/harbor/templates/eval.pyindex 71489dfc..1552c2bb 100644--- a/src/skillevaluator/tier3/harbor/templates/eval.py+++ b/src/skillevaluator/tier3/harbor/templates/eval.py@@ -5598,8 +5598,7 @@ def check_activation(tool_calls, expected_skill, skill_tool_names=None, acceptab_is_execution_action(action) and _cmd_reads_skill_md(cmd))if not has_skill_read_evidence or (- tc.get("is_error") is True- and (not _is_execution_action(action) or _failed_single_skill_read(tc))+ tc.get("is_error") is True and (not _is_execution_action(action) or _failed_single_skill_read(tc))):continueobs = str(tc.get("observation", "")).lower()@@ -9064,9 +9063,7 @@ def check_error_recovery(tool_calls, expected_script=None):# Keep the original local correction heuristic, but require the# same command and arguments for retries beyond the five-call window.matches = (- _cmds_similar(cmd, retry_cmd)- if j - i <= 5- else bool(cmd.split()) and cmd.split() == retry_cmd.split()+ _cmds_similar(cmd, retry_cmd) if j - i <= 5 else bool(cmd.split()) and cmd.split() == retry_cmd.split())if matches and succeeded[j]:corrections.append(@@ -9113,6 +9110,270 @@ def check_error_recovery(tool_calls, expected_script=None):}+def _search_path_is_root(value: str) -> bool:+ return value.startswith("/") and not posixpath.normpath(value).strip("/")+++_ASSIGNMENT_MASK = "\ue00f"+++def _mask_non_assignment_equals(text: str) -> str:+ """Replace every ``=`` that does not make its word a shell assignment.++ Tokens lose their quoting, but the shell only reads ``NAME=`` as an+ assignment when NAME is written unquoted; ``'NAME=value'`` and+ ``NAME\\=value`` are command names. Only ``=`` characters are replaced,+ so the masked text tokenizes into the same words as the original.+ """+ out = []+ name: list[str] = []+ plain = True+ quote = None+ index = 0+ while index < len(text):+ char = text[index]+ if quote:+ if char == quote:+ quote = None+ elif char == "\\" and quote == '"' and index + 1 < len(text):+ out.append(char)+ index += 1+ char = text[index]+ out.append(_ASSIGNMENT_MASK if char == "=" else char)+ elif char == "\\":+ plain = False+ out.append(char)+ if index + 1 < len(text):+ index += 1+ out.append(_ASSIGNMENT_MASK if text[index] == "=" else text[index])+ elif char in "'\"":+ quote = char+ plain = False+ out.append(char)+ elif char.isspace() or char in _SHELL_METACHARS:+ name.clear()+ plain = True+ out.append(char)+ elif char == "=":+ out.append("=" if plain and _SHELL_NAME_RE.fullmatch("".join(name)) else _ASSIGNMENT_MASK)+ plain = False+ else:+ name.append(char)+ out.append(char)+ index += 1+ return "".join(out)+++def _tool_searches_root(action: str, args: dict, text: str, depth: int = 0) -> bool:+ """Recognize explicit root search operands, not '/' inside a pattern.++ This is bounded top-level command classification. It does not execute or+ interpret dynamically constructed shell programs.+ """+ if action in {"grep", "glob", "grep_files", "list_dir", "ls"}:+ for key in ("path", "dir_path"):+ value = args.get(key)+ if isinstance(value, str) and _search_path_is_root(value.strip()):+ return True+ pattern = args.get("pattern")+ if action == "glob" and isinstance(pattern, str) and pattern.startswith("/"):+ first = pattern.lstrip("/").split("/", 1)[0]+ if not first or any(char in first for char in "*?[{"):+ return True+ if not _is_execution_action(action) or len(text) > 65536:+ return False+ # Without a shell AST, comments, expansions, here-documents and process+ # substitutions cannot be classified reliably. Keep their prior score+ # instead of inventing a path.+ if any(char in text for char in "$`#"):+ return False+ tokens = _shell_tokens(text)+ if any(_is_heredoc_redirect(token) or token in {"<(", ">("} for token in tokens):+ return False+ masked_tokens = _shell_tokens(_mask_non_assignment_equals(text))+ if len(masked_tokens) != len(tokens):+ masked_tokens = [""] * len(tokens)+ commands: list[list[str]] = [[]]+ masked_commands: list[list[str]] = [[]]+ skip_redirect_target = False+ for token, masked_token in zip(tokens, masked_tokens, strict=True):+ if token in {";", "&&", "||", "|", "&", "(", ")"}:+ commands.append([])+ masked_commands.append([])+ skip_redirect_target = False+ elif skip_redirect_target:+ skip_redirect_target = False+ elif _is_output_redirect(token) or token in _INPUT_REDIRECT_OPERATORS or _DESCRIPTOR_OPERATOR_RE.match(token):+ skip_redirect_target = True+ elif not _ATTACHED_REDIRECT_RE.match(token):+ commands[-1].append(token)+ masked_commands[-1].append(masked_token)+ for command, masked_command in zip(commands, masked_commands, strict=True):+ assignments: dict[str, str] = {}+ index = 0+ while (+ index < len(command)+ and _SHELL_ASSIGNMENT_RE.match(masked_command[index])+ and (assignment := _SHELL_ASSIGNMENT_RE.match(command[index]))+ ):+ assignments[assignment.group(1)] = assignment.group(2)+ index += 1+ index = _unwrap_shell_command(command, index, assignments)+ if index is None or index >= len(command):+ continue+ name = _shell_executable(_resolved_shell_arg(command[index], assignments))+ if name in _SHELL_COMMAND_INTERPRETERS:+ payload = _shell_c_payload(command, index, assignments)+ if (+ payload is not None+ and depth < _MAX_SHELL_REFERENCE_DEPTH+ and _tool_searches_root(action, {}, payload, depth + 1)+ ):+ return True+ continue+ if name not in {"find", "grep", "egrep", "fgrep", "rg", "ag", "du", "tree"}:+ continue+ arguments = [_resolved_shell_arg(arg, {}) for arg in command[index + 1 :]]+ if name == "find":+ cursor = 0+ while cursor < len(arguments):+ argument = arguments[cursor]+ if argument in {"-H", "-L", "-P"} or re.fullmatch(r"-O[0-9]+", argument):+ cursor += 1+ elif argument == "-D":+ cursor += 2+ else:+ break+ if cursor < len(arguments) and arguments[cursor] == "--":+ cursor += 1+ for argument in arguments[cursor:]:+ if argument.startswith("-") or argument == "!":+ break+ if _search_path_is_root(argument):+ return True+ continue+ pattern_tools = {"grep", "egrep", "fgrep", "rg", "ag"}+ needs_pattern = name in pattern_tools+ boolean_short = {+ "grep": "rRnilLqsvcwxhHaboEFGPIUzZ",+ "egrep": "rRnilLqsvcwxhHaboEFGPIUzZ",+ "fgrep": "rRnilLqsvcwxhHaboEFGPIUzZ",+ "rg": "niwlqzUuFSPovcHhNLa",+ "ag": "niwlqsvac",+ "tree": "adfipqNQDFhsiuxACn",+ "du": "achkLmPsxH",+ }+ boolean_long = {+ "--recursive",+ "--ignore-case",+ "--line-number",+ "--files-with-matches",+ "--files-without-match",+ "--quiet",+ "--no-messages",+ "--invert-match",+ "--word-regexp",+ "--line-regexp",+ "--count",+ "--fixed-strings",+ "--hidden",+ "--no-ignore",+ "--no-heading",+ "--heading",+ "--follow",+ "--null",+ "--text",+ }+ values = {+ "grep": {+ "-A",+ "-B",+ "-C",+ "-m",+ "--after-context",+ "--before-context",+ "--context",+ "--max-count",+ "--include",+ "--exclude",+ "--exclude-dir",+ },+ "rg": {+ "-A",+ "-B",+ "-C",+ "-m",+ "-r",+ "--replace",+ "-g",+ "--glob",+ "--iglob",+ "-t",+ "-T",+ "--type",+ "--type-not",+ "--max-depth",+ "--encoding",+ "--engine",+ "--sort",+ "--sortr",+ "--max-count",+ "--after-context",+ "--before-context",+ "--context",+ },+ "ag": {"-A", "-B", "-C", "-m", "--after", "--before", "--context"},+ "tree": {"-L", "-P", "-I", "-o", "--filelimit", "--charset"},+ "du": {"-d", "--max-depth", "-B", "--block-size", "--exclude"},+ }+ value_options = values.get("grep" if name in {"egrep", "fgrep"} else name, set())+ index = 0+ positional_only = False+ unsupported = False+ root_operand = False+ while index < len(arguments):+ argument = arguments[index]+ index += 1+ if not positional_only and argument == "--":+ positional_only = True+ continue+ if not positional_only and argument.startswith("-"):+ if name == "rg" and argument == "--files":+ needs_pattern = False+ elif name in pattern_tools and argument in {"-e", "--regexp", "-f", "--file"}:+ needs_pattern = False+ index += 1+ elif name in pattern_tools and (+ argument.startswith(("--regexp=", "--file=")) or argument.startswith(("-e", "-f"))+ ):+ needs_pattern = False+ elif argument in value_options:+ index += 1+ elif (+ (argument.startswith("--") and argument.partition("=")[0] in value_options and "=" in argument)+ or (name in pattern_tools and argument in boolean_long)+ or (+ argument.startswith("-")+ and not argument.startswith("--")+ and len(argument) > 1+ and set(argument[1:]) <= set(boolean_short[name])+ )+ ):+ pass+ else:+ unsupported = True+ break+ continue+ if needs_pattern:+ needs_pattern = False+ elif _search_path_is_root(argument):+ root_operand = True+ if root_operand and not unsupported:+ return True++ return False++def check_tool_efficiency(tool_calls, expected_skill=None, expected_script=None):if not tool_calls:return {"passed": True, "score": 1.0, "reason": "No tool calls"}@@ -9134,7 +9395,9 @@ def check_tool_efficiency(tool_calls, expected_skill=None, expected_script=None))full_text = f"{action} {cmd}".lower()is_productive = False- if ("read" in action and expected_skill and expected_skill in cmd) or (+ if _tool_searches_root(action, args, cmd):+ is_productive = False+ elif ("read" in action and expected_skill and expected_skill in cmd) or (_is_execution_action(action) and expected_script and expected_script in cmd):is_productive = Truediff --git a/tests/tier3/test_root_search_efficiency.py b/tests/tier3/test_root_search_efficiency.pynew file mode 100644index 00000000..057aa026--- /dev/null+++ b/tests/tier3/test_root_search_efficiency.py@@ -0,0 +1,179 @@+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.+# SPDX-License-Identifier: Apache-2.0+"""Root searches are waste even when they name the expected skill or script."""++import importlib.util+from pathlib import Path++import pytest++from skillevaluator.tier3.eval_core import checks++spec = importlib.util.spec_from_file_location(+ "search_template_checks", Path(__file__).resolve().parents[2] / "src/skillevaluator/tier3/harbor/templates/eval.py"+)+template = importlib.util.module_from_spec(spec)+spec.loader.exec_module(template)++[email protected]("module", [checks, template], ids=["host", "bundled"])+ "call",+ [+ {"action": "exec_command", "action_input": {"cmd": "find / -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "find '/' -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "find /./ -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "rg task.py /"}},+ {"action": "exec_command", "action_input": {"cmd": "grep -r task.py /"}},+ {"action": "exec_command", "action_input": {"cmd": "rg --files / | grep task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "cd project && find / -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "env LC_ALL=C find / -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "LC_ALL=C find / -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "LC_ALL=C LANG=C grep -r task.py /"}},+ {"action": "exec_command", "action_input": {"cmd": "cd project && LC_ALL=C rg task.py /"}},+ {"action": "exec_command", "action_input": {"cmd": "LC_ALL=C env find / -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "LC_ALL='C' find / -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "FOO=1 bash -c 'find / -name task.py'"}},+ {"action": "exec_command", "action_input": {"cmd": "A=b=c FOO='x y' find / -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "bash -c 'LC_ALL=C find / -name task.py'"}},+ {"action": "exec_command", "action_input": {"cmd": "tree /"}},+ {"action": "Grep", "action_input": {"path": "/", "pattern": "task.py"}},+ {"action": "Glob", "action_input": {"pattern": "/**/task.py"}},+ {"action": "list_dir", "action_input": {"dir_path": "/./"}},+ ],+)+def test_root_search_does_not_gain_productivity_from_expected_name(module, call):+ result = module.check_tool_efficiency([call], expected_skill="task", expected_script="task.py")+ assert result["score"] == 0.0, result++[email protected]("module", [checks, template], ids=["host", "bundled"])+ "call",+ [+ {"action": "exec_command", "action_input": {"cmd": "find /workspace/project -name task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "find . -name /"}},+ {"action": "exec_command", "action_input": {"cmd": "rg '/' task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "rg -e / task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "grep -e / task.py"}},+ {"action": "exec_command", "action_input": {"cmd": "echo 'find / -name task.py'"}},+ {"action": "exec_command", "action_input": {"cmd": "python task.py --root /"}},+ {"action": "Read", "action_input": {"file_path": "/workspace/task/SKILL.md"}},+ {"action": "Glob", "action_input": {"pattern": "/workspace/**/task.py"}},+ {"action": "Grep", "action_input": {"path": "/workspace", "pattern": "/"}},+ ],+)+def test_scoped_searches_patterns_and_ordinary_calls_keep_existing_classification(module, call):+ result = module.check_tool_efficiency([call], expected_skill="task", expected_script="task.py")+ # Public native Grep/Glob calls already receive no productivity credit.+ expected = 0.0 if call["action"] in {"Glob", "Grep"} else 1.0+ assert result["score"] == expected, result++[email protected]("module", [checks, template], ids=["host", "bundled"])+ "command",+ [+ "find -L / -name task.py",+ "find -H / -name task.py",+ "find -- / -name task.py",+ "find -L -- / -name task.py",+ "tree -f /",+ ],+)+def test_search_utility_options_do_not_hide_a_root_operand(module, command):+ result = module.check_tool_efficiency(+ [{"action": "exec_command", "action_input": {"cmd": command}}], expected_script="task.py"+ )+ assert result["score"] == 0.0++[email protected]("module", [checks, template], ids=["host", "bundled"])+ "command",+ [+ "rg -e task.py --replace / /workspace",+ "rg -e task.py -r / /workspace",+ "rg task.py < /",+ "rg task.py > /",+ "env ROOT=/ find '$ROOT' -name task.py",+ 'env ROOT=/ find "$ROOT" -name task.py',+ "echo task.py # ; find /",+ ],+)+def test_pattern_values_redirections_and_unsupported_shell_grammar_keep_old_credit(module, command):+ result = module.check_tool_efficiency(+ [{"action": "exec_command", "action_input": {"cmd": command}}], expected_script="task.py"+ )+ assert result["score"] == 1.0++[email protected]("module", [checks, template], ids=["host", "bundled"])+ "command",+ [+ "rg -e task.py --path-separator / /workspace",+ "rg -e task.py --field-match-separator / /workspace",+ "rg -e task.py --ignore-file / /workspace",+ "rg -ne task.py -nr / /workspace",+ "du -I / /workspace",+ "rg task.py &>> /",+ "rg task.py >| /",+ ],+)+def test_unknown_option_arity_and_redirections_do_not_invent_search_paths(module, command):+ result = module.check_tool_efficiency(+ [{"action": "exec_command", "action_input": {"cmd": command}}], expected_script="task.py"+ )+ assert result["score"] == 1.0++[email protected]("module", [checks, template], ids=["host", "bundled"])+ "command",+ [+ "find / -name task.py 2>/dev/null",+ "find / -name task.py 2> /dev/null",+ "find / -name task.py 2>/dev/null | head -5",+ "find / -name task.py < /dev/null",+ "grep -r task.py / 2>/dev/null",+ "grep -r task.py / 2>&1 | head",+ "bash -lc 'find / -name task.py'",+ "sh -c 'find / -name task.py 2>/dev/null'",+ "sudo bash -c 'find / -name task.py'",+ "find / -name config.yaml",+ "du -sh /",+ "tree -L 2 /",+ ],+)+def test_redirected_wrapped_and_unnamed_root_searches_are_waste(module, command):+ result = module.check_tool_efficiency(+ [{"action": "exec_command", "action_input": {"cmd": command}}], expected_script="task.py"+ )+ assert result["score"] == 0.0, result++[email protected]("module", [checks, template], ids=["host", "bundled"])+ "command",+ [+ "find /workspace -name task.py 2>/dev/null",+ "bash -lc 'find /workspace -name task.py'",+ "bash -c 'echo find /'",+ "cat <<EOF\nfind /\nEOF",+ "diff <(find / -name task.py) expected.txt",+ "rg task.py 2> /",+ "'LC_ALL=C' find / -name task.py",+ '"LC_ALL=C" find / -name task.py',+ "LC_ALL\\=C find / -name task.py",+ "L'C_ALL'=C find / -name task.py",+ "FOO=1; 'FOO=2' find / -name task.py",+ 'FOO=1 true && "FOO=2" grep -r task.py /',+ "LC_ALL=C; LC_ALL\\=C find / -name task.py",+ ],+)+def test_scoped_quoted_heredoc_and_redirect_targets_keep_old_credit(module, command):+ result = module.check_tool_efficiency(+ [{"action": "exec_command", "action_input": {"cmd": command}}], expected_script="task.py"+ )+ assert result["score"] == 1.0, result