Documentation
Command reference
Every ai command and option, with examples you can copy. Run ai --help or ai COMMAND --help for the same details in your terminal.
Quick start
On macOS or Linux:
curl -fsSL https://ai-agent.serverpulse.in/install.sh | bash # install the ai command
ai login # connect this computer to the portal
ai doctor # check that everything works
ai "show the 10 largest files in this folder"On Windows, in PowerShell:
irm https://ai-agent.serverpulse.in/install.ps1 | iex # install the ai command
# open a new PowerShell window, then:
ai login
ai doctor
ai "show the 10 largest files in this folder"ai login shows a code and opens this portal. Check that the code matches, then select Approve. If the browser doesn't open, go to https://ai-agent.serverpulse.in/device and enter the code.
On Windows
PowerShell and cmd.exe work the same way as a Unix shell, with their own commands. Claude writes cmdlets such as Get-ChildItem and Remove-Item for PowerShell, and builtins such as dir and del for cmd — never Unix commands. The risk rules have Windows equivalents too, so Remove-Item -Recurse -Force C:\ is blocked just as rm -rf / is.
| What differs | Detail |
|---|---|
| Install | irm https://ai-agent.serverpulse.in/install.ps1 | iex in PowerShell. If scripts are blocked, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once. |
| Shell integration | The installer loads it from $PROFILE for PowerShell and writes ai.cmd for cmd.exe. cd, $env:, set, Import-Module and Activate.ps1 then apply to your own shell. |
| Reloading | There is no exec $SHELL. Open a new window. |
| Which PowerShell | Both work. powershell.exe is Windows PowerShell 5.1, which has no && or ||, so Claude uses ; there. pwsh.exe (PowerShell 7, winget install Microsoft.PowerShell) accepts both; pin it with ai config set shell pwsh.exe. |
| Settings and history | %APPDATA%\terminal-agent and %LOCALAPPDATA%\terminal-agent. |
| Interactive commands | Windows has no pseudo-terminal. Editors and REPLs attach to your console instead, and their output is not captured. |
Alt+A and ai fix | Both work in PowerShell (via PSReadLine and Get-History). cmd.exe has neither, so use ai fix --command "<command>" there. |
Making requests
Describe what you want. Terminal Agent proposes one command at a time, shows how risky it is, runs it once you approve, reads the output, and continues until the job is done. Questions get a plain answer, with no command.
ai "find the 10 largest files in my home directory"
ai "kill whatever is listening on port 3000"
ai "create a python venv here, activate it and install requests"
ai "undo my last git commit but keep the changes"
ai "what does the -z flag of tar do?"Options
These options work with ai "request" and ai fix. Put them before the request.
| Option | What it does |
|---|---|
-y, --yes | Run without asking. Dangerous commands still ask. |
-n, --dry-run | Show the first command without running anything. When output is redirected, only the command is printed, so ai -n "…" > cmd.sh works. |
-m, --model NAME | Model for this request: haiku, sonnet, opus, fable, or a full model ID. A portal uses its allowed models only. |
-e, --effort LEVEL | Reasoning effort: low, medium, high, xhigh or max. |
--max-steps N | Maximum commands for this request (1–30, default 8). |
--no-memory | Ignore, and don't save, earlier requests from this terminal. |
--debug | Print debug logs to the terminal. |
-h, --help | Show help. |
ai -n "delete all .DS_Store files recursively" # preview only
ai -y "create a folder called scratch with a README in it"
ai -m opus "why is this repo's CI failing? check the workflow files"
ai -e high --max-steps 15 "upgrade outdated npm packages and run the tests"
ai --no-memory "list running docker containers"Piping input
Anything you pipe in is sent along with your request, with secrets masked and length limited.
cat build.log | ai "why is the build failing?"
kubectl get pods -A | ai "which pods are unhealthy?"
git diff | ai "summarize these changes"Tips
- Quote requests that contain
?,*,|,>,&or$. Otherwise your shell interprets them first; zsh saysno matches found. - Alt+A: type a request at an empty prompt without
ai, then press Alt+A. This needs the shell integration. - Force a request that starts with a command name by prefixing it with
run:ai run history of my zsh config. - Stop: Ctrl+C while Claude is thinking stops the run. While a command runs, it goes to that command.
- Output streams: results go to stdout and status panels to stderr, so
ai "…" > result.txtkeeps prompts on screen.
Changing the model
Requests use sonnet unless you choose another model. This portal allows sonnet, haiku, opus.
ai models # list model names; marks your current default
ai config get model # your current default
ai -m opus "…" # this request only
ai config set model opus # new default for every request
ai config unset model # back to the team default
ai chat -m haiku # one chat session
TA_MODEL=haiku ai "…" # one command, through an environment variable
ai config set effort medium # reasoning effort: low, medium, high, xhigh or max
ai -e high "…" # effort for this request onlyInside ai chat, type /model opus to switch for the rest of the session, or /model to see the current one. The order of precedence, highest first: -m, then TA_MODEL, then ai config set model, then the team default saved by the installer.
| Model | Use it for |
|---|---|
haiku | Quick, simple commands. The fastest option, and the lightest on usage. |
sonnet | Everyday work. Fast and highly capable (the default). |
opus | Complex, multi-step tasks and tricky debugging. Slower. |
fable | The most capable model, for the hardest problems. The slowest and heaviest on usage. This portal doesn't currently allow it. |
If you ask for a model this portal doesn't allow, the portal uses sonnet and ai tells you. ai doctor lists the allowed models, and each request's model appears in the activity log. Without a portal, you can use any model your Claude plan includes, including full model IDs such as claude-opus-5.
Approvals and risk
Every command is rated twice: by Claude and by a local parser. The stricter rating wins.
| Rating | Examples | What happens |
|---|---|---|
| read-only | ls, git status, du -hd1 | Runs straight away. |
| modifies | mkdir, brew install, git commit | Asks Run it? [Y/n/e]. Enter means yes. |
| dangerous | rm, sudo, kill, git reset --hard | Asks [y/N/e], even with -y. Enter means no. |
| blocked | rm -rf ~, mkfs, dd of=/dev/disk2 | Never runs. |
At the prompt, type y to run, n to cancel, or e to edit the command first. An edited command runs straight away (blocked commands are still refused). Change when you're asked with ai config set confirm auto|always|never. Even with never, dangerous commands ask.
Activity log
The portal logs every request sent through it, including:
- which computer and folder it came from, and the shell and system
- what was asked, and each step Claude took, with its model, tokens and cost
- each proposed command and its risk
- whether the command ran, was declined, was blocked, or was applied to your shell, with its exit code and duration
- the command's output, with secrets masked
- Activity lists your requests. Filter by period, computer, result or search text, and open any request to see every step and its output.
- Export downloads the filtered list as JSON Lines: one request per line, with all its steps, commands and output.
This portal keeps full details, including command output. Details are kept for 90 days; token usage totals are kept longer. Requests made in local mode (no portal) aren't logged here. Each computer also keeps its own log:
ai history --json # commands run on this computer, as JSON linesInstall the app
This portal installs as an app on your phone, tablet or computer: its own icon and window, no app store, and always the current version.
- iPhone and iPad: in Safari, tap Share, then Add to Home Screen.
- Android: in Chrome, tap Install when it's offered, or open the menu and tap Install app.
- Mac: in Chrome or Edge, click Install in the address bar; in Safari, choose File → Add to Dock.
- Windows and Linux: in Chrome or Edge, click Install in the address bar.
The app opens on the Terminal page (or your dashboard, when the web terminal isn't open to you). On a phone, a connection opens full screen inside the app with Esc, Tab, Ctrl and arrow keys above the keyboard; back returns to your servers.
All commands
| Command | What it does |
|---|---|
ai "request" | Run a request. |
ai fix | Diagnose and fix the last command you ran. |
ai explain | Explain a command and its risk without running it. |
ai chat | Interactive session that remembers context. |
ai history | Commands Terminal Agent has run. |
ai memory | What it remembers from this terminal. |
ai login / ai logout | Connect this computer to the portal, or sign it out. |
ai connect | Use this computer from the portal's Terminal page. |
ai whoami | Your portal account, status and usage. |
ai doctor | Check the installation and connection. |
ai models | List the model names you can use. |
ai config | View and change settings. |
ai init | Print the shell integration script. |
ai --version | Print the installed version. |
ai --help | List commands. ai COMMAND --help shows one command's options. |
ai "request"
See Making requests. Quoting is optional when the request has no shell characters, so ai show disk usage also works.
ai fix [details]
Run it right after a command fails. The shell integration records your last command and its exit status. Anything after fix is passed along as extra detail. It accepts all the request options, plus --command.
ai fix
ai fix it started failing after I upgraded node
ai fix --command "make build" # without shell integration, or for another commandai explain COMMAND
Breaks a command into parts and lists environment-specific pitfalls and its risk rating. Nothing runs. Options: -m MODEL, --debug.
ai explain "find . -name '*.log' -mtime +7 -delete"
ai explain "tar -xzvf backup.tar.gz -C /tmp"ai chat
A back-and-forth session. Every line is a request, and later requests can refer to earlier ones. Options: -y, -m MODEL, -e LEVEL, --debug.
ai chat
ai chat -m opus
ai chat -y # don't ask before non-dangerous commands| In chat | Effect |
|---|---|
/help | Show chat commands. |
/model NAME | Switch model for this chat. With no name, show the current model. |
/yes | Toggle running non-dangerous commands without asking. |
/clear | Forget this session's memory. |
exit, quit, q, bye, /exit, Ctrl+D | Leave chat and go back to your shell. |
| Ctrl+C | Clear the line, or stop the running request. |
Commands in another folder run straight away. For cd DIR && npm run dev, chat switches to DIR, runs npm run dev (stop it with Ctrl+C), and stays in that folder. Only commands that must change your shell itself (export, source, virtualenv activation) wait until you leave chat.
ai history
Lists the commands Terminal Agent ran: time, exit code, command and request. An exit code of shell means the command was handed to your shell.
ai history # last 20
ai history -n 100
ai history --failed # only non-zero exit codes
ai history --json | jq . # one JSON object per lineai remember, ai forget
Facts you want kept for good. They survive closing the terminal, and they follow your account to every computer signed in to this portal — unlike session memory, which is gone when the window closes. Every request you make afterwards is sent with them.
ai remember "the eks server is 10.0.4.12 (staging)"
ai remember "deploy with make ship, never npm run deploy"
ai forget 3f9c1a2b # the id shown by ai memory
ai forget --allYou can also just say it: ai "remember that the eks server is 10.0.4.12". Claude saves the fact itself and tells you it did. It will not save secrets, passwords or command output. Turn the whole feature off with ai config set remember false.
ai memory
Shows both kinds of memory: the facts you've asked it to remember, and the recent requests from this terminal, which make follow-ups like ai "now delete them" work.
ai memory
ai memory --clear # only this terminal's recent requestsai login, ai logout
ai login # sign in (approve the code in the browser)
ai login --no-browser # print the link instead of opening a browser
ai login --server https://ai-agent.serverpulse.in # also saves the portal address
ai logout # sign this computer out, on the portal tooYou can also sign out any computer from Connected terminals on your dashboard.
ai connect
Makes this computer available in the portal's Terminal page under Your computers, with a terminal, the file explorer and editor, and the chat. It connects out to the portal (no port is opened), only your account can reach it, and only while it runs. Press Ctrl-C to stop. macOS and Linux (Windows runs --gateway only).
ai connect # uses the portal from ai login
ai connect --name work-laptop # how it's listed in the portal
ai connect --gateway --name office-bridge # forward only: a jump host to private servers (also on Windows)
ai connect --server https://ai-agent.serverpulse.in # another portal (signs in separately)--gateway offers no shell, only forwarding, so the portal can reach servers on a private network through this computer. In New connection, pick it under Connect through, then enter the private server's address and key. It dials out over HTTPS, so it bridges even where outbound SSH (port 22) is blocked — and it's the only mode on Windows.
ai whoami
Shows your account and status, plus this month's tokens, cost and requests, and your limit with its reset date.
ai whoami
ai whoami --jsonai doctor
Checks the installation, settings and shell integration. With a portal, it also checks the server, your account and usage, and that Claude works on the server. Otherwise it checks the local claude CLI and its login. It exits with status 1 if any check fails.
ai doctor
ai doctor --no-ping # skip the test request to Claude
ai doctor --debugai models
Lists haiku (fastest), sonnet (default), opus (deeper reasoning) and fable (most capable), and marks the current one. Change the default with ai config set model NAME.
ai config
ai config # same as: ai config show
ai config show # every setting, its value and where it comes from
ai config show --json
ai config get model
ai config set model opus
ai config set confirm always
ai config set instructions "prefer rg and fd; use pnpm, never npm"
ai config unset model # back to the default
ai config path # where the settings file is
ai config edit # open it in $EDITORai init [zsh|bash|fish|powershell|cmd]
Prints the shell integration script. With no argument it picks the shell you're in. See Shell integration.
Settings
Change a setting with ai config set KEY VALUE. Settings are resolved in this order, with later sources winning: defaults, then team settings, then your settings file, then TA_KEY environment variables, then command-line options.
| Setting | Default | What it controls |
|---|---|---|
model | sonnet | Default model. |
remember | true | Keep durable facts (ai remember) and send them with each request. |
fallback_model | haiku | Used when the main model is overloaded (local mode). |
effort | low | Reasoning effort per step. |
confirm | auto | auto asks for changes, always asks for everything, never asks only for dangerous commands. |
max_steps | 8 | Commands per request (1–30). |
timeout | 120 | Seconds to wait for Claude per step. |
memory, memory_turns | true, 8 | Remember recent requests in the same terminal. |
history, max_history | true, 2000 | Record executed commands. |
redact_secrets | true | Mask keys, tokens and passwords before output leaves your computer. |
output_limit | 6000 | Characters of command output sent per step. |
include_listing | true | Send file names from the current folder. |
server_url | (empty) | Portal address. Empty means Claude runs on this computer. |
use_subscription | true | Local mode: hide API keys so your Claude login is used. |
claude_path | (auto) | Local mode: path to the claude CLI. |
shell | (your shell) | Shell used to run commands. |
instructions | (empty) | Extra rules for the agent. |
TA_MODEL=opus ai "…" # one-off override with an environment variable
TA_CONFIRM=always ai "…"
TA_DEBUG=1 ai "…" # debug logs, plus full tracebacks for unexpected errorsPortal or local
With a portal address set, requests go to this portal, and Claude runs on the server. Without one, Terminal Agent uses the claude CLI on your computer and your own Claude login.
ai config set server_url https://ai-agent.serverpulse.in && ai login # use this portal
ai config unset server_url # use Claude on this computer
claude auth login # local mode needs your own Claude login
ai doctor # shows which mode is activeShell integration
The installer sets it up for you. It lets cd, export, source and virtualenv activation apply to your own shell (on Windows: cd, $env:, set and Activate.ps1). It also enables ai fix and Alt+A, adds please as an alias for ai, and keeps memory separate for each terminal.
echo 'eval "$(ai init zsh)"' >> ~/.zshrc # zsh
echo 'eval "$(ai init bash)"' >> ~/.bashrc # bash
ai init fish > ~/.config/fish/conf.d/terminal-agent.fish # fish
exec $SHELL # reloadIn PowerShell and cmd.exe:
Add-Content $PROFILE.CurrentUserAllHosts 'Invoke-Expression (& ai init powershell | Out-String)'
ai init cmd | Set-Content "$env:LOCALAPPDATA\terminal-agent\bin\ai.cmd" -Encoding ASCIIThe ai.cmd wrapper must come before ai.exe on your PATH, or cmd.exe will skip the hand-off. Check with where ai.
On macOS, Alt+A needs your terminal to send Option as Meta. In Terminal.app, turn on Use Option as Meta key. In iTerm2, set the Option key to Esc+. In bash, it needs bash 4 or newer.
Files
| File | Contains |
|---|---|
~/.config/terminal-agent/config.json | Your settings. |
~/.config/terminal-agent/team.json | Defaults from the portal installer. |
~/.config/terminal-agent/credentials.json | Your portal sign-in, removed by ai logout. |
~/.local/state/terminal-agent/history.jsonl | Command history. |
~/.local/state/terminal-agent/sessions/ | Per-terminal memory. |
~/.local/state/terminal-agent/notes.json | Remembered facts, mirrored from the portal. |
~/.local/state/terminal-agent/chat_history | Lines typed in ai chat. |
~/.local/state/terminal-agent/logs/terminal-agent.log | Logs. |
%APPDATA%\terminal-agent\ | Windows: the three files above that live in ~/.config. |
%LOCALAPPDATA%\terminal-agent\ | Windows: history, memory, chat lines and logs. |
Troubleshooting
Start with ai doctor. It prints a fix next to anything that's wrong.
| You see | Do this |
|---|---|
| You're not signed in | ai login |
ai whoami says no team server is configured | ai config set server_url https://ai-agent.serverpulse.in, then ai login |
| Paused, stopped, or waiting for approval | Ask an admin to start your account. |
| You've used X of your Y monthly tokens | Wait for the reset date shown, or ask an admin to raise your limit. |
zsh: no matches found | Put the request in quotes. |
| Needs confirmation, but no terminal is available | Run it in a terminal, or add -y (dangerous commands still need a terminal). |
| This portal doesn't allow the model … | Pick one of the allowed models (ai doctor lists them), or ask an admin to allow it. See Changing the model. |
| Reached the step limit | Add --max-steps 15, or split the request. |
| Your alias or function isn't found | Commands run in a non-interactive shell. Ask for the real command, or add a rule with ai config set instructions "…". |
Windows: cd doesn't stick in cmd.exe | where ai must list …\terminal-agent\bin\ai.cmd first. Move that folder up in your PATH. |
Windows: invalid peer certificate: UnknownIssuer while installing | A company TLS proxy is re-signing traffic; uv ships its own CA list. Run $env:UV_SYSTEM_CERTS='true' and install again. |
Windows: you get Unix commands like ls | ai doctor's shell row must say (powershell) or (cmd). If it says (posix), run ai config set shell pwsh.exe. |
cd didn't change the folder | Enable the shell integration and open a new terminal. |
| Alt+A does nothing | Set Option as Meta in your terminal (see above). |
| Anything else | ai --debug "…", or tail -n 50 ~/.local/state/terminal-agent/logs/terminal-agent.log |
Exit codes
| Code | Meaning |
|---|---|
0 | Done, answered, dry run, or handed to your shell. |
N | Ended on a failed command. N is that command's exit code. |
1 | Cancelled, declined, refused or blocked. |
2 | Usage error, or Claude/portal unavailable (not signed in, limit reached, timeout). |
130 | Interrupted with Ctrl+C. |
Update and uninstall
curl -fsSL https://ai-agent.serverpulse.in/install.sh | bash # install or update
curl -fsSL https://ai-agent.serverpulse.in/install.sh | bash -s -- --no-shell # don't touch shell startup files
curl -fsSL https://ai-agent.serverpulse.in/install.sh | bash -s -- --uninstall # remove (keeps settings and history)
rm -rf ~/.config/terminal-agent ~/.local/state/terminal-agent # also delete settings and historyOn Windows:
irm https://ai-agent.serverpulse.in/install.ps1 | iex # install or update
& ([scriptblock]::Create((irm https://ai-agent.serverpulse.in/install.ps1))) -NoShell # don't touch $PROFILE
& ([scriptblock]::Create((irm https://ai-agent.serverpulse.in/install.ps1))) -Uninstall # remove (keeps settings and history)
Remove-Item -Recurse "$env:APPDATA\terminal-agent", "$env:LOCALAPPDATA\terminal-agent"