AI Today

🐚 Clam puts an AI agent at the Bash, zsh and PowerShell prompt, with no mode switch

· 4 min

Clam answering questions and editing a project from a Bash prompt

In brief


🐚 Anyone who works in a terminal and wants to ask an AI agent something usually has to switch to a separate program or chat window. Clam, an open-source project by developer Duy ([duy.run/clam](https://duy.run/clam)), sits in the normal shell instead: you type an English sentence such as “what does this project do?” at the Bash, zsh or PowerShell prompt, and the answer appears right in the terminal. Real commands such as `ls` or `git status` run unchanged and, according to the project page, never reach the agent. 🔍 Clam decides locally, without a network call, whether a line is a request; the check gives up after at most a second so the prompt does not hang. The agent may read, list and search files in the current folder. Before it writes a file or runs a command it asks, and it accepts only “y” or “yes”. ⚠️ `clam auto on` switches those prompts off. The documentation says the built-in agent then runs any shell command it chooses, including outside the current folder. Clam is a single program for Linux, macOS, Windows and FreeBSD and works with its own agent over an OpenAI-compatible API or with Codex, Claude Code, OpenCode and pi.


🧭 **How Clam spots a request.** The trick is in the shell hook. In zsh Clam attaches to the Enter key, in PowerShell to PSReadLine, and in Bash it uses `command_not_found_handle`, the mechanism Bash calls only when the first word is not a known command. A line that starts with a real command runs at once. The exception is commands that are also common English words, such as `where` or `sort`: zsh and PowerShell then check the whole line first. Everything else goes to `clam check`, which decides locally whether the line reads like an English sentence. If it does not, the line runs or fails exactly as it would without Clam, so typos do not suddenly turn into requests to an AI.

🖥️ **What it is like to use.** The prompt shows `[c+]` when Clam is on and `[c-]` when it is off; terminals that draw colour emoji show a shell symbol instead. `clam on` and `clam off` toggle interception, `clam reset` clears the conversation history of the terminal. According to the README, sessions are stored in `~/.cache/clam/sessions`, readable only by the user, and expire after a day. Answers are rendered as Markdown in the terminal. A plugin for Vim and Neovim makes `:!` answer English sentences the same way.

🛡️ **Approval prompts, and switching them off.** The built-in agent may read, list and search without asking and run a small allowlist of inspection commands. Everything else needs an explicit “y”; with no interactive terminal the action is denied. The documentation itself notes that an approved shell command can reach other paths named in it. With `clam auto on` or the environment variable `CLAM_AUTO_APPROVE=1` the prompts disappear; the prompt then shows `[c!]`, and every action is printed as it runs. In this mode the agent can start any command it likes, not limited to the current folder; only writes through its own file tool stay inside the folder tree. Anyone using Clam in a directory with important data or credentials should use that mode with care.

🧩 **Which agent answers.** By default, the README says, Clam uses OpenAI's gpt-6-luna model and needs an OpenAI API key for it. `CLAM_MODEL` and `OPENAI_BASE_URL` let it use any server with an OpenAI-compatible Responses API. Alternatively Clam hands the request to Codex, Claude Code, OpenCode or pi (`clam agent codex` and so on), or to any command of your own through `CLAM_AGENT_CMD`. The project names one limit itself: Clam's approval prompts and auto mode apply only to the built-in agent. Other agents run in their non-interactive mode under their own permission settings, and may then refuse an action instead of asking.

📦 **Installation.** On Linux and macOS an install script fetches the right binary for the operating system and processor, checks its SHA-256 checksum and puts it in `~/.local/bin`; then a line such as `eval "$(clam init bash)"` goes into the shell's startup file. On Windows you download the `.exe` from the releases and add `clam init pwsh` to the PowerShell profile. Building from source needs Go 1.24 or later. Supported are Linux on amd64, arm64, armv7 and 386, macOS on Intel and Apple silicon, Windows on amd64 and arm64, and FreeBSD. The fish shell and other shells are not supported yet, according to the README.

🤔 **Who it suits.** Clam is aimed at people who spend the day in a terminal and already use a coding agent, but do not want to keep switching between the shell and an agent window. Anyone who rarely uses the command line or has no API access to a language model gains little. It also only recognises English sentences.

Sources

Open in the interactive reader →

This post was selected, researched, written and rated by AI. The AI can be wrong: check the sources. Imprint, privacy policy and terms of service