- Prototype of CLI utility designed for embedding AI into bash pipelines
- Usage:
echo "hello world" | 1- pipeline;1 create hello-world folder- direct query to AI;1- interactive query input;
- How it works
- Why ai-cli
- Supported AI Providers
- Liability
- Build
- Configuration
- Run
- Security
- For developers
- Architecture
- User provides input via arguments or pipeline
- AI generates a response
- The utility types the response into your terminal (X11 keyboard emulation)
- You can edit the command freely using standard line editing keys
- Press Enter to execute the final command
flowchart LR
keyboard[ keyboard \n input ]
clipboard{{clipboard}}
stdout{{stdout}}
stdin{{stdin}}
pool[(pool \n file)]
memory[(memory)]
ai[ai-cli]
bash{{run bash \n command}}
user((users \n 'ENTER'))
keyboard --> user --> bash
stdin --> ai --> keyboard & memory & pool & clipboard & stdout
user@comp:~$ 1 hello
Hello! How can I assist you today?
user@comp:~$ 1 show me files in current directory
Here are the files and directories in the current directory:
user@comp:~$ ls -la
Would you press Enter, or try something else?
echo "hello world" | ai "say it for groq" --provider=openai | ai "grok"
- No bloat — No Node.js, no Python, no Docker. Core works with POSIX tools
(
cat,tee,grep). All extras (xclip,git,nano) are optional. - Minimal dependencies — Single static binary. No runtime, no package manager, no interpreter.
- Full user control — AI never executes commands. Command appears on your keyboard → you edit → you press Enter → bash executes. No background agent. No daemon. No permission popups. Just your terminal.
- User defines output destinations — each can be sent to stdout, pool file, clipboard, TTY, or any custom command. You decide where AI output goes.
- Unix way — Everything is a file or a pipe. Configuration is plain YAML in
~/.config/ai/. History is plain text in~/.local/share/ai/. pool is plain text. No databases, no registries, no hidden state.
Compare:
- Claude Code — can run shell commands automatically (with "auto mode")
- Codex CLI — has Auto/Read-only/Full Access modes, can execute without confirmation
- Gemini CLI — has "Yolo mode" that bypasses confirmations
- Shell-GPT — can execute commands with
--executeflag - Aider — autonomous agent that writes and executes code
ai-cli — only you press Enter... and that’s all that matters.
- Currently
aiworks with the following providers:
github— implemented (default)openai— testingdeepseek— testinggroq— testinglocal— testing (Ollama)anthropic— coming soontogether— coming soon
The author assumes no responsibility for data loss or system damage. You are using this tool at your own risk.
- Run
curl -fsSL https://raw.githubusercontent.com/johnthesmith/ai-cli/main/install.sh | bash
- Binary files: https://github.com/johnthesmith/ai-cli/releases/latest
- This is an alternative to Install.
- Requirements for building:
linux- (Ubuntu 20.04+, Debian 11+, or newer)gitcurlbuild-essentialpkg-configlibssl-dev
- Download and run instalation script:
sudo apt install git curl build-essential pkg-config libssl-dev
curl -fsSL https://raw.githubusercontent.com/johnthesmith/ai-cli/main/build.sh > build.sh
less build.sh
chmod +x build.sh
./build.sh
source ~/.bashrc
- Default configuration located at config/config.yaml for all providers, prompts, and output destinations.
- This file must be located at
~/.config/ai/<profile>. - For Git token retrieval see Git token.
1 your question--help This information
--no-prompt Suppress input user prompt
--no-command Suppress command event
--info Show current runtime information (profile, chat, log, config)
--switch-profile=<name> Switch and save profile
--profile=<name> Use profile for current session only
--switch-provider=<name> Switch to AI provider <name> (saves to file)
--provider=<name> Use provider for current session only (no save)
--switch-model=<name> Switch and save model
--modle=<name> Use model for current session only (no save)
--switch-chat=<id> Switch to chat <id>, default id is default
--show-history Show history for current chat
--clear-history Remove history for current chat
--pack-history=<percent> Pack current chat history with 0-100 percent (default: 50)
--show-memory Show memory for current chat" );
--clear-memory Remove memory for current chat (global if %chat% not used
--write-pool Write stdin to pool file and forward to stdout
--tiocsti Inject input directly into TTY input pool for keyboard
The AI assistant returns strict JSON. The full format description and rules are in the prompt file: prompt.txt
- Always review the command printed in your terminal before pressing Enter.
- The AI may generate dangerous commands (e.g.,
rm -rf /*,dd,sudo). - Never execute commands you don't understand or trust.
- This utility does NOT automatically execute commands — you must press Enter to confirm.
- Recursive
ai|aipipelines may cause the tool to hang, but cannot execute commands without your approval — AI never presses Enter for you.
- Run with minimal privileges (avoid
sudounless absolutely necessary). - Keep backups of important data.
- Test commands in a virtual machine or container first.
- Look at ai.rs
- Search for
REMOVE_ENTER— shows where newlines are stripped from AI-generated commands (security: prevents auto-execution)
- Search for
flowchart LR
subgraph UserSide["User Side"]
subgraph filesystem
memory_in[("memory")]
memory_out[("memory")]
history_out[("Chat \n history")]
history_in[("Chat \n history")]
prompt[("User \n prompt")]
pool[("pool \n file")]
log[("Log")]
end
clipboard["Clipboard"]
stdin{{"User stdin"}}
param{{"User CLI param"}}
command{{"bash"}}
stdout{{"User stdout"}}
req["Request"]
resp["Response"]
end
subgraph World["External"]
llm["LLM"]
end
resp --> |all| log
llm --> |HTTP \n responce| resp
req -->|HTTP \n request| llm
resp -->|data| memory_out
resp -->|data| history_out
resp -->|data| stdout
resp -->|command| command
resp -->|data| pool
resp -->|data| clipboard
memory_in --> |txt| req
prompt --> |txt| req
stdin --> req
param --> req
history_in --> |txt| req