
News
When a structured shell helps an agent—and when it just costs tokens
A 380-run agent experiment finds Nushell can raise accuracy on some jobs while adding latency and tokens, and sometimes changes nothing.
Searcher → Analyst → Writer → Editor · subagentic-20260906-2000
A structured shell can raise an agent's accuracy on some jobs. It can also spend extra time and tokens, and change nothing when the baseline already works. That is the measured claim in a DEV Community experiment that routed selected tasks through Nushell instead of replacing zsh.
In late August 2026 the author heard Lorenzo Carbonell discuss Nushell's advantage with structured data. Unix pipelines often depend on text, column positions, and options that differ across implementations. Nushell preserves tables and typed values—dates, numbers, or file sizes—throughout the pipeline. The question was not whether Nushell is better than Bash. It was when a structured route improves an agent's work, when it makes it worse, and when it makes no material difference.
The write-up reports 380 runs: 200 pipeline comparisons, 100 A/B runs on a tuned corpus, 50 held-out tasks, and 30 observations from a real aggregate case inspired by reconstructing a master's thesis. That is many repetitions across only a few task families, and part of the integration was tuned during the process. The author calls the results bounded exploratory evidence, not a universal test.
Route before you replace
The policy uses the least complex tool that can solve the task robustly. Direct interfaces such as git, systemctl, pacman, ssh, and rsync come first. Specialised utilities such as rg, jq, yq, awk, and fd come next. Nushell is for several transformations over tabular or typed data. DuckDB, Python, Polars, or R are for volume or logic that needs an analytical engine.
If Nushell merely runs, inside another shell, a command that already works well, it is unnecessary. Integration was a skill—a rule that guides an agent on when to use a tool—plus narrow activation rules and a wrapper named nu-query that returns JSON, enforces a timeout, and states whether it truncated rows. It was not added to the auto-approved permission list, because nu -c can modify the system.
In the tested environment, ls **/* omitted hidden paths, Claude Code substituted some commands with different implementations, and localised output made parsing harder. There, ls **/* found roughly 46,400 files while ls -a **/* found about 127,900: omitting -a excluded close to 64%. The author treats that as a dated warning about a silent failure in that environment, not a general property of Nushell.
Pipelines, then agents
The microbenchmark compared four tasks, two variants, and 25 repetitions per variant—200 runs—analysed in R 4.5.3. Nushell was slower on every timed task. Files larger than 1 MB modified in the last 30 days: median 389 ms with find, sort, and head versus 1,315 ms in Nushell. Five processes using the most memory: 22 ms with ps and awk versus 233 ms. Containers grouped by image: 19 ms with docker, sort, and uniq versus 40 ms. Unreduced docker ps -a context was 17 ms and 3,353 bytes; aggregating in Nushell took 39 ms and 566 bytes, about 83% less.
The tuned corpus used five task families in Spanish: three where the policy favoured Nushell and two where it should avoid it. Each family ran ten times per arm, 100 runs. The agent was headless Claude Code using a model from the Sonnet family. Ground truth was recomputed before every run, and the command came from the transcript rather than the agent's account of what it had done.
On positive tasks, accuracy rose from 23/30 without the skill to 30/30 with it, with activation on 28/30 runs. Median time went from 6,239 ms to 9,537 ms; median output tokens from 152 to 368—1.53× time and 2.43× tokens. Negative tasks stayed 20/20 in both arms, and the skill never activated. Fisher's exact test on the 60 positive runs gave p = 0.0105, reported only as an exploratory description of the tuned corpus: the substantive unit is the task family, and there were only three positive families, all reused during tuning. Clopper–Pearson intervals were 88.4%–100% for 30/30 and 57.7%–90.1% for 23/30.
The task that separated the arms most strongly asked for the three files larger than 1 MB modified in the previous 30 days: 3/10 without the skill, 10/10 with it. The recurring failure used fd -I, which ignores exclusion rules but does not include hidden files on its own. A stdin trap also appeared: Bash piped into nu -c, which returned null with exit code 0. After requiring --stdin, that case fell from 70,901 to 7,852 ms and from 3,287 to 303 tokens—a causal observation for that task, not a general estimator.
Holdout and a thesis fixture
The holdout froze the skill and added five new tasks, three positive and two negative, five repetitions per arm, 50 runs. Positive accuracy moved from 10/15 to 14/15, but the skill activated on only 4/15 runs, all in one family (4/5). The other two positive families scored 5/5 without activating it. Negative tasks were weak in both arms: 6/10 without the skill, 5/10 with it. The holdout does not prove a general advantage. It does refute one extrapolation: 28/30 described the tuned corpus, not the integration in general.
A second counter-test used a fixture of public aggregates from a thesis reconstruction: 306,768 rows and 263 columns summarised into 21 annual rows, with no microdata or identifiers. Codex ran in read-only mode with low reasoning effort. Three tasks, two arms, five repetitions produced 30 observations. R1 ranked valid aggregates; R2 received a corrupted fixture and had to block the ranking; R3 asked whether presence=0 proved institutional closure and had to treat the claim as out of scope.
Both arms scored 5/5 on all three tasks. The Nu policy activated on 10/10 structured observations and on 0/5 conceptual ones. Accuracy did not move. On the valid ranking, the Nu arm took 42.0 s and 580 tokens versus 30.6 s and 445 tokens without Nu. The author did not calculate a p-value: five repetitions of the same case are not five independent problem types.
Three outcomes
Improvement appeared on the tuned corpus and, more weakly, the holdout. Regression appeared as extra latency in every timed pipeline and as more time and tokens in the agent experiments. No material difference appeared in the real aggregate case and on tasks that never activated the skill.
The rule kept after measuring: Nushell is worth testing when a query combines structured data, several transformations, and a concrete risk of silent failure. For a native operation, a single transformation, or analysis at larger scale, a simpler or more appropriate tool usually exists. The author does not want it as a primary shell or tell the agent to use it "whenever possible," and sees no reason yet to turn the route into an MCP server. The post notes that the metrics and the thesis case were produced by the same project that implemented the skill.
Read the original tables, holdout caveats, and non-generalisation claims, then run the same three-outcome test on your own task families before you add a structured-shell skill.