GitHub pages
December 2026
Most of my work with agents starts in a terminal. I type commands all day. Sometimes I want to ask a question instead, and I have to leave the shell, open another window, paste in the context, then come back. ash is an attempt to make that switch smaller without giving up the shell as the default.
The idea is narrow. Accepted command lines are read locally. A small router decides whether a line is a command or natural language. Commands stay in the shell. Questions can go to an agent, which answers or proposes a command. The router runs on CPU on the machine, and no typed text leaves the machine through it.
The hard part is false positives. If the router sends git st to an agent once, the whole thing is dead. So the shell wins ties. Low confidence asks. ? forces the agent and ! forces the shell in the agent loop; in the first shell layer both pass through as ordinary text. The router is English-only. Non-English lines are labelled out_of_scope, kept for audit and never counted as misses.
The first work was data and classification, not a shell patch. I widened the corpus beyond voice: agent tool calls, opencode user and assistant text, bus traffic, briefs, man pages, public English prose and command datasets. That produced about 344,000 lines, but most of it was not user-typed input. Six labellers went through 3,300 lines. They kept 260 real queries and 172 real commands and excluded 2,482 lines as assistant prose, logs, stage dialogue and generated text.
Retrained on the gold set plus clean corpora (128,000 lines, disjoint seed 7), the hybrid model looked good. Held-out accuracy was 99.66%. False positives were 0.25% held-out, 0.30% on a 2,000-line command probe, and 0.36% in a 24-hour simulated stress run, all under the 0.5% budget. Latency was 0.04 ms p99 for the classical path and about 5 ms with the tiny head, against a 50 ms ceiling. A 24-hour campaign at 5,000 lines per hour generated 120,000 lines and finished in 11.6 seconds of wall clock. Forty-six tests were in the suite before that merge.
Then I fixed the eval. The balanced, session-disjoint set had 2,000 queries against 2,567 commands, plus a 2,264-command probe. It also showed how thin the honest query pool was: only 69 held-out queries were real, and 1,931 of the 2,000 queries were SQuAD fill. On the balanced set the hybrid still held false positives at 0.08% eval and 0.22% probe, but query recall collapsed. It recorded 97.6% false negatives overall and 60.9% on the honest slice. That is a shell with a ? escape hatch, not a router. The tiny head reached 90.3% query recall but 0.74% false positives, over budget. BERT/ONNX reached 99.6% accuracy at about 5 ms p99 with 0.51 to 0.55% false positives, borderline. TF-IDF SVC was the only standalone head that cleared false positives on both eval and probe, at 0.16% and 0.13%, with 16.9% false negatives. The earlier char-CNN “zero false positives” was vacuous: it predicted query 0% of the time.
So I did not call the router finished. The shipped hybrid+CNN combination holds on the session-disjoint eval at 0.36% false positives on eval and 0.41% on the probe, with 86.55% full recall and 69.88% honest recall. The binding failure is query recall, and the cause is the same as before: not enough honest query labels. The fallback benchmark did not rescue it. Narrow rescue produced about 1.2 to 2.0% false positives, any non-zero exit about 34%, and any-error with a hard guard about 20%. None clears the budget, so there is no fallback in the shipped router.
Next came the shell side. The first layer was observability only. Stock zsh preexec and precmd hooks wrote a redacted JSONL transcript and logged the router decision. No keystroke capture, no agent routing in the hooks, no ? or ! handling.
The standalone loop reads that transcript and builds a bounded prompt: redacted cwd, the last 20 turns, capped at 12,000 characters, with every field passed through redaction. Outputs longer than 600 characters become a reference, not copied text. It makes one provider call. It parses four tags. reply: is the only acted-on output. state: and done are parsed and logged but never applied. propose: is classified by a pure policy gate and emitted as a tagged event. The loop has no planner, no subagents and no tool registry.
The policy gate in ash_policy.py is pure: no subprocess, no file writes, no state. It sorts commands into read-only, state-changing, outward and destructive risk classes, then applies one of four levels. L0 is shell-only and denies every proposal. L1 is conservative, L2 adds syntax and not-found fallback, and L3 adds up to two semantic repair attempts. A third attempt is denied. Each attempt gets its own event and its own transcript row, so there is no silent retry.
Interactive programs stay opaque. Editors, ssh, REPLs, pagers and htop produce only interactive_start and interactive_end events with program, cwd and timestamps. No screen bytes.
The offline e2e harness replays scripted sessions through the real sink and the loop with a fake provider. It counts unexpected behaviour by class. The all-fixture run found eight unexpected events from deliberately adversarial fixtures and recorded secret_leak as 0. It exits 1 by design on that set. The clean-only check replays the known-good fixtures, finds nothing unexpected and exits 0. One finding in the report is real behaviour, not a fixture artifact: a scripted fake provider writes a raw fake secret to stdout even though the transcript is redacted. I am not claiming the harness found zero leaks on every path.
The loop then ran inside a disposable VM with real provider calls. Three task classes passed. A benign task summarised the last command from the transcript. A propose task asked to delete a scratch file and returned decision=confirm, risk=destructive, acted=False; the file stayed. A third task proposed rm -rf and git push, both confirm, both acted:false. Redaction turned a path into /[REDACTED].txt in the sink.
Two gaps showed up and were recorded rather than hidden. Non-interactive zsh -c fires no preexec or precmd hooks, so the agent sees no command history. The VM login shell is bash, so plain ssh ... ash-ask does not resolve the function. A PTY-backed interactive zsh is needed when a task depends on transcript context. Both paths were tested.
Then came the long soak: 11,716 seconds, or 3h15m16s, from 03:48:56 to 07:04:12. It completed 120 work episodes, 439 real ash-ask provider calls, 369 agent_reply rows and 274 agent_action rows, with zero driver errors. All 274 proposals had acted:false. The report’s decision counts are 57 confirm, 25 deny and 7 allow. Its risk counts are 37 state-changing, 23 destructive, 22 outward and 7 read-only. Fake ghp_ token strings were redacted in stdout and transcript. No real credential was used.
The soak also recorded its own confound. Parallel work modified the VM copy of ash in place during the run, adding a TRAPDEBUG hook for non-interactive shells and bounded output capture. I did not fix or revert it. The VM was left running with the evidence in place. That soak is proof of the propose-only build, and only of that build.
The soak proved the propose-only behaviour. After it, I chose full execution authority at L1+ and accepted that risk explicitly on 1 December 2026. In the current loop, allow and confirm both execute the exact proposed command immediately at L1, L2 and L3, including state-changing, destructive and outward commands, with no confirmation step. deny runs nothing and L0 stays deny-all. Every execution emits a redacted ash_exec line and an agent_exec row with acted:true. A later VM proof ran a benign touch and a destructive rm -f at L1 with the real runner. Both executed, and the destructive marker was removed.
This is a real change in authority. The 274 acted:false rows above describe an earlier build, not this one. The first beta tag, v0.1.0-beta, was cut before autonomous execution landed. It is superseded by v0.1.1-beta, which reflects the current loop. Neither tag changes anyone’s default shell.
Full shell integration lives in a fork of upstream zsh at github.com/pankajgarkoti/ash-zsh. Upstream history is untouched. Every ash change is a separate labelled commit on top of upstream master at fc0197106219e8faf731178c0063bd6d4b5200b1, dated 2026-11-29. The fork adds three things: native C command hooks, an ash-ask builtin behind the opt-in gate, and a ZLE widget bound to Ctrl-X a. It does not reroute typed commands, run proposals, capture keystrokes or change upstream keybindings beyond that one binding.
The widget opens an ash> minibuffer, runs one bounded turn and shows the reply in the minibuffer. It never inserts agent text into the command line. Redaction still lives in ash’s sink; the fork does not reimplement it. A smoke test uses a temporary transcript directory, checks the native event pair and redaction, invokes the widget and checks that the gate-off path makes no agent call. An offline run uses a fake reply.
The fork default is still the reply-only integration. The execution work is on branch ash/auto-execute, not on the fork default and not distributed as the default. So I am not describing the fork as an executing shell today.
v0.1.1-beta is scoped and opt-in. There has been no public announcement. It contains the local hybrid+CNN router, the redacted sink through either stock hooks or the fork’s native hooks, the agent loop with bounded context and full L1+ execution authority, the policy gate at L0 to L3, opaque interactive events and the offline e2e harness. Twelve PRs landed on top of the earlier router and data work. The full unittest suite on that tree ran 154 tests.
The lightweight path uses stock hooks:
export ASH_ROOT="$HOME/Desktop/code/ash"
source "$ASH_ROOT/zsh/ash.zsh"
Add export ASH_AGENT_ENABLED=1 to expose ash-ask. For plain SSH and non-interactive shells, run bash "$ASH_ROOT/bin/ash-install.sh" once. It links ash-ask and ash-run into ~/.local/bin.
The full path builds the fork:
git clone https://github.com/pankajgarkoti/ash-zsh.git ~/Desktop/code/ash-zsh
cd ~/Desktop/code/ash-zsh && ./configure && make && ./Src/zsh --version
Then, in ~/.zshrc:
export ASH_ROOT="$HOME/Desktop/code/ash"
export ASH_AGENT_ENABLED=1
source "$HOME/Desktop/code/ash-zsh/ash/ash.zsh"
Ctrl-X a opens the widget. Do not also source the stock ash/zsh/ash.zsh in the fork, or command events will be duplicated.
There is a launch film in the ash repo at docs/launch-film.html, added by PR #11. It is one self-contained HTML file with a generated soundtrack and no external assets. Four versions were built; the promoted file is the fourth cut.
The router is English-only and honest recall is 69.88%. This is not a general-purpose assistant router. The loop has no tool registry, and command output was not available in the original design. The bounded capture added for non-interactive sessions attaches at most 4,000 redacted characters to command_end. Interactive programs stay opaque. Stock hooks do not fire for non-interactive shells; PR #10 added a TRAPDEBUG log and ash-run for that path, and the fork bypasses the gap through its C command loop. No real credential was handled in the soak, only fake token strings. Full execution authority is accepted and live in the loop, but the fork’s execution work is still on a branch. The beta is opt-in, and nothing here changes a default shell.
I am keeping this quiet until real users have used it. The goal is narrow: the shell stays in charge, and the agent is something you call on purpose.