agent-the-zsh v0.2.2

A smart input layer for zsh. Commands run instantly. Plain language is handled by an inline agent — right below your prompt, in your own terminal, with your own tools.

curl -fsSL https://21stware.github.io/agent-the-zsh/install | bash
macOS or Linux · needs zsh · then run exec zsh

One input line, two paths

Shell command — runs instantly, untouched

~/proj git log --oneline -5                            (claude-opus-4-6)
a1b2c3d feat: add streaming parse
e4f5g6h fix: stderr silenced in widget
# classified as CMD, accept-line, zero latency, no network

Natural language — agent answers inline

~/proj what dependencies does this project use
  dir ~/proj · review focused
  🧠 thinking
    reading go.mod to check the dependencies…
  ● bash: cat go.mod
   module github.com/21stware/agent-the-zsh
      require (
        mvdan.cc/sh/v3 v3.8.0
  
      )
  This project depends on:
  - mvdan.cc/sh/v3 — shell parser for CMD/NL classification
  - Anthropic Messages API via raw HTTP (no SDK)
  - Go standard library (net/http, encoding/json)
  # typed text stays on its line; agent output below

Multi-step work — agent plans, approves, executes

~/proj add all .log files to .gitignore
  dir ~/proj · review focused
  🧠 thinking
    I need to check the current .gitignore and find .log files…
  ● bash: find . -name '*.log' | head -20
   app.log
      debug.log
      test.log
  ● read_file: .gitignore
  
  ⚠ approve [low-risk]  edit: .gitignore (append *.log)
    [y] run  [n] reject  [a] allow all (this task)  [s] strict mode
    > y
  
  Done — *.log added to .gitignore.

Dangerous action — gated by review level

~/proj delete the dist directory
  dir ~/proj · review focused
  🧠 thinking
    checking if dist/ exists before deleting…
  ● bash: ls -d dist 2>/dev/null
   dist/
  ⚠ approve [high-risk]  bash: rm -r dist
    [y] run  [n] reject  [a] allow all (this task)  [s] strict mode
    > n
  # you stay in control of destructive actions

What it does

Zero-latency commands

Real shell commands run exactly as if agent-the-zsh weren't installed — the classification is offline and local, never touches the network.

Natural language → agent

Plain language is handed to an inline agent that can run a command, do multi-step work, or just answer — streaming its thinking and output.

Your text is preserved

What you typed stays where you typed it. The agent runs below it — nothing is silently rewritten into your input line.

Permission you control

Reads run freely; side-effects are gated by a review level (focused / strict / yolo). Approve with y/n/a/s. Pressing a persists for the session — no repeated prompts.

Multi-provider config

~/.flow/settings.json supports Anthropic and OpenAI-compatible providers. Falls back to ~/.claude/settings.json. No SDK — raw HTTP/JSON + SSE.

Never bricks your shell

If the daemon is down or slow, it degrades to plain zsh. Misclassified input is caught by command_not_found_handler and routed back to the agent.

Conversation per window

Each terminal window is one continuous conversation. Ask, get an answer, ask a follow-up — the agent remembers the earlier turns in that window automatically. Open a new window for a clean slate.

~/proj run the tests and tell me if any fail
  dir ~/proj · review focused
  🧠 thinking
    running go test for all packages…
  ● bash: go test ./...
   ok  internal/classify  0.012s
      ok  internal/config    0.008s
      ok  internal/llm       0.003s
  All tests passed — no failures.

~/proj which packages were tested
  dir ~/proj · review focused
  Based on the previous run, three packages were tested:
  internal/classify, internal/config, and
  internal/llm — all passed.
  # remembers the test result from the previous turn
flowtmp Create a fresh temp dir and cd into it — a scratch space for the current window.
flowrsm Resume a previous window's conversation. Shows an arrow-key picker; pick one and it carries on here. flowrsm <id> resumes a specific one.
flowclear Reset this window's conversation (clears transcript and review level). FLOW_FRESH=1 for a one-off fresh turn.

Transcripts live under $TMPDIR/flow-<uid>/sessions/ (owner-only, cleared on reboot), keyed by an exported FLOW_SESSION_ID that survives exec zsh.

Configure a provider

agent-the-zsh speaks the Anthropic Messages protocol. The endpoint can be the first-party API or any compatible proxy (DeepSeek, GLM, a gateway). Config resolution precedence (first non-empty wins):

1. ~/.flow/settings.json (highest priority)

# DeepSeek (default)
{
  "provider": "anthropic",
  "base_url": "https://api.deepseek.com",
  "auth_token": "sk-...",
  "model": "deepseek-chat"
}

# Anthropic first-party
{
  "provider": "anthropic",
  "base_url": "https://api.anthropic.com",
  "api_key": "sk-ant-...",
  "model": "claude-opus-4-6"
}

# OpenAI-compatible provider
{
  "provider": "openai",
  "base_url": "https://api.openai.com/v1",
  "api_key": "sk-...",
  "model": "gpt-4o"
}

2. Process env (ad-hoc overrides)

# DeepSeek via env
export ANTHROPIC_BASE_URL="https://api.deepseek.com"
export ANTHROPIC_AUTH_TOKEN="sk-..."
export ANTHROPIC_MODEL="deepseek-chat"

# or Anthropic first-party
export ANTHROPIC_API_KEY="sk-ant-..."

3. ~/.claude/settings.json (Claude Code compat)

The env block is read as a fallback — an existing Claude Code setup just works with no extra config.

If no model is specified, the daemon auto-discovers one from the provider's /v1/models endpoint. The discovered model is cached and shown on the right of your prompt. Check status with flow-doctor. Credentials are never logged.

Install options

One line curl -fsSL https://21stware.github.io/agent-the-zsh/install | bash
From source git clone https://github.com/21stware/agent-the-zsh && cd agent-the-zsh && make install
Activate exec zsh  (new terminals pick it up automatically)
Uninstall make uninstall  (or remove the # >>> flow >>> block from ~/.zshrc)