Skip to content

Agent-usability gaps: missing commands, flags, and shell syntax #207

Open

Description

@ferdingler

Summary

I ran about 200 commands and feature probes through the shell MCP tool, trying the commands and idioms an AI agent typically reaches for. This issue lists what's missing or broken, ranked by how often it would trip up an agent.

Agents learned shell from bash and GNU coreutils, so they'll hit the gaps below constantly.

Struck-through items behave correctly on main (verified 2026-11-13).

P0: things that break common agent workflows

  • A loop or group can't come after a pipe. echo x | while read l; do echo $l; done gives unexpected 'do'. cmd | ( … ) gives Opened parentheses without closing, and cmd | { …; } gives unexpected '}'. Piping into a while read loop is one of the most common agent idioms. (while read l; do …; done < file works.)
  • A parse error anywhere aborts the whole script, and nothing runs. One unsupported token (e.g. arr=(a b)) on line 17 silently drops lines 1–16 as well. Some messages are confusing (Opened parentheses without closing). Either run statement by statement, or report the line and column and say "unsupported syntax". (fix: report the first syntax error in multiline input #197)
  • xargs -n1 CMD and xargs -I{} CMD fail silently. printf 'a b\n' | xargs -n1 cat and printf 'f\n' | xargs -I{} cat {} exit with 127 and print nothing on stderr. Plain xargs CMD works. (fix(xargs): accept attached option values and stop at the command #208, fix(xargs): forward the command's stderr instead of dropping it #213)
  • Missing: diff, patch. Agents need these to check and apply edits.
  • Missing: awk. Very widely used for field and column work.
  • sh -c '...' doesn't work. sh -c 'echo hi' gives -c: no such file or directory. (feat(sh): run command strings with sh -c #212)
  • Usage text goes to stdout, with no error. ls -lh and sort -h print help to stdout, and it gets mixed into piped results. Write unknown-option errors to stderr and exit non-zero, as other commands already do (invalid option '-f').

P1: missing flags agents use all the time

P1: missing commands

P2: bash-isms agents write by default

Either implement them or make the tool description clearly say "POSIX sh, not bash".

P2: correctness and state gotchas

  • set -e and pipefail stay on across calls. A later, unrelated call can then stop silently at its first failing command.
  • env lists non-exported shell variables (e.g. loop counters) alongside exported ones. (fix: show only exported variables to the commands the shell runs #285)
  • Running a missing binary like lash --help gives no such file or directory: <cwd>/--help, which is confusing.

Suggestions for the MCP tool itself

  • List the available commands and shell dialect in the tool description. For example: "POSIX-ish sh; commands: …; no python/git/awk; lua available". This alone prevents most wasted calls.
  • Return a clear error for unsupported syntax or flags, naming the flag and suggesting an alternative.
  • Offer a way to reset session state, or document that state carries over between calls.
  • Put the exit code in the text output as well as in metadata.exit_code. Not every MCP client exposes metadata.

Activity

  1. changed the title [-]Agent-usability gaps: missing commands, flags, and shell syntax (test report)[/-] [+]Agent-usability gaps: missing commands, flags, and shell syntax[/+] on Nov 6, 2026
  2. pgrayy commented on Nov 12, 2026

    @pgrayy
    Member

    Another missing ls flag: -d.

    Claude Code ran ls -d node_modules to check for installed dependencies and received:

    strands-shell: ls: invalid option '-d'
    

    -d should list the directory itself instead of its contents. #228 adds other ls flags but does not cover this one.

  3. pgrayy commented on Nov 12, 2026

    @pgrayy
    Member

    The proposed tool description should identify the supported dialect and common limits, and show supported ways to check command outcomes.

    For example:

    false | true; echo "EXIT=${PIPESTATUS[0]}"

    This prints EXIT= instead of Bash's EXIT=1. PIPESTATUS is a Bash extension; guidance could steer agents toward direct validation commands and their returned exit codes when per-command pipeline statuses are unavailable.

  4. pgrayy commented on Nov 12, 2026

    @pgrayy
    Member

    exec -a is unsupported:

    exec -a alternate true

    Bash exits 0. Strands Shell reports -a: command not found and exits 127.

    The -a option sets the program's argv[0]. Plain exec true succeeds; Shell currently treats -a as the command name.

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

    No labels
    No labels

    Type

    No type

    Fields

    Language

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions