cccc_shell documentation implies shell semantics, but implementation direct-execs argv
Summary
cccc_shell is documented as executing a shell command, but its implementation parses the input with shell_words::split and then invokes the first token with Command::new(program).args(arguments).
As a result, common shell syntax such as &&, pipes, redirection, command substitution, etc. is not interpreted by a shell.
Tested on CCCC v0.4.40.
Reproduction
For example:
cccc_shell(command="pwd && git status --short")
does not behave like a shell command. The tokens after pwd are passed as argv, so pwd receives &&, git, status, etc. as arguments.
Similarly:
cccc_shell(command="find . -maxdepth 1 | head -5")
passes | and head as arguments to find instead of creating a pipeline.
Wrapping explicitly works:
cccc_shell(command="sh -lc 'pwd && git status --short | head -5'")
Public contract
The MCP schema describes cccc_shell as:
Short one-shot shell execution in the group's active workspace.
and the command field as:
Shell command to run under the active workspace root.
That strongly suggests shell semantics.
Current implementation
The implementation uses roughly:
let parts = shell_words::split(raw)?;
let program = &parts[0];
let arguments = &parts[1..];
Command::new(program)
.args(arguments)
...
so it behaves more like a structured/direct process exec with shell-like tokenization.
Expected
Either of these would make the contract clear:
- Actually execute the provided command through a shell on platforms where that is supported, so shell syntax behaves as users expect.
or
- Keep direct exec semantics, but update the tool name/description/schema to clearly state that shell operators are not interpreted, and document the explicit
sh -lcworkaround for callers that need shell syntax.
A separate opt-in flag for shell mode could also preserve the current safer direct-exec behavior while making the interface explicit.
Why this matters
The current behavior is easy for agents to misinterpret because the tool is named cccc_shell and the schema repeatedly says "shell command", but valid-looking shell commands fail in surprising ways.
This is especially noticeable for coding workflows where batching with &&, |, or redirection is common.
Thanks for highlighting the ambiguity! We kept direct execution for compatibility and clarified both command tools’ descriptions with explicit-shell examples. The pending patch also fixes ignored cccc_shell working-directory, environment and output-limit options, with regression tests. All these issues will be fixed in the next release.