{"slug": "show-hn-ai-cli-tiny-c-terminal-assistant-powered-by-local-llm", "title": "Show HN: AI-CLI – tiny C terminal assistant powered by local LLM", "summary": "A developer released AI-CLI, a tiny C terminal assistant that connects user requests to a local LLM and executes returned shell commands directly. The tool supports multiple platforms and LLM engines, allowing users to accept, edit, or reject actions before execution. The authors warn that the tool can cause damage if used carelessly.", "body_md": "command line assistant smoothly connecting your requests with LLM of your choice and executing directly returned actions, all in a single C file\n\nFree yourself from writing all those complex actions in command line shell, instead ai assistant will do it for you based on your requests.\n\nYour choices are: **accept** actions (by just pressing **Enter**) with opportunity to **edit** assistan's answer first or **reject** actions by pressing **Ctrl+C**.\n\nIf for example, you want to know who did run jobs on a particular Slurm node, you may ask:\n\n```\n$ ./ai who was running jobs on a slurm node 39 between 1 and 2 hours ago\nuser847\nuset20499\n```\n\nThe action assitant returned might look like:\n\n```\nsacct --format=\"JobID,JobName,User,NodeList,Start,End,State\" --allusers --starttime=$(date -d \"-2 hours\" \"+%Y-%m-%dT%H:%M:%S\") --endtime=$(date -d \"-1 hours\" \"+%Y-%m-%dT%H:%M:%S\") --allocations --node=39 | tail -n +3 | awk '{print $3}' | sort | uniq\n```\n\nOther examples:\n\n```\n$ ./ai replace Solar with solar in every python file in this folder\nDone\n\n$ ./ai modify permissions of this folder so no other user can read anything here\nDone\n\n$ ./ai find all occurances of subword \"perform\" in words.txt and print their line numbers\n1881\n10046\n10047\n40358\n\n$ ./ai math log of 4096\n8.317766166719343\n\n$ ./ai show me last 3 lines in each c file in current folder\n    buffer_free(&original);\n    return exit_code;\n}\n\n$ ./ai what is IP address of somewebsite\nxxx.xx.xx.xxx\n```\n\nBe careful, because this tool executes actions returned by LLM directly in your shell.\n\nAuthors are not responsible for any damage this program can cause.\n\nIf you are not familiar with shell commands, do not use this assistant.\n\n```\nsh run.build_ai.sh\n```\n\nor directly\n\n```\ngcc ai.c -o ai\n```\n\nThis will copy ai into your ~/.local/bin and man page into ~/.local/share/man/man1/\n\n```\nsh run.build_ai.sh\n```\n\nYou can build and run this tool on literally any platform, fully supported:\n\n- Linux\n- macOS\n- Android\n- FreeBSD\n- iOS\n- OpenBSD\n- NetBSD\n- QNX Neutrino\n- Windows (MSYS2 or Cygwin)\n- WebOS\n- Haiku\n- SerenityOS\n- DragonFly BSD\n- illumos\n- Solaris\n- AIX\n- HP-UX\n- Tru64 UNIX\n- IRIX\n- UnixWare\n- SCO OpenServer\n- Redox OS\n- VxWorks\n- RTEMS\n- INTEGRITY\n\nMost LLM engines are fully supported:\n\n| Engine | `/v1/chat/completions` |\n|---|---|\n| llama.cpp | Yes |\n| vLLM | Yes |\n| TensorRT-LLM | Yes |\n| Ollama | Yes |\n| LM Studio | Yes |\n| SGLang | Yes |\n| Text Generation Inference (TGI) | Yes |\n| Aphrodite Engine | Yes |\n| LocalAI | Yes |\n| Xinference | Yes |\n| FastChat | Yes |\n| MLC LLM | Yes |\n| KoboldCpp | Partial |\n\nYou need an LLM engine running locally or remotely.\n\nExample how you may run llama.cpp with Gemma-4 model:\n\n```\nllama-server  --host 0.0.0.0 \\\n    --model unsloth/gemma-4-12B-it-qat-UD-Q4_K_XL.gguf \\\n    --temp 1.0 \\\n    --top-p 0.95 \\\n    --top-k 64 \\\n    --port 8001 \\\n    --chat-template-kwargs '{\"enable_thinking\":false}'\n```\n\nRemember to disable thinking mode - answers model provides will be direct shell actions.\n\n``` bash\n$ export AI_URL=\"http://127.0.0.1:8001\"\n$ ./ai which file in this folder is to build ai tool\n./run.build_ai.sh\n```\n\nYou can accept answer by pressing **Enter** and actions will be executed in shell or you can press **Ctrl+C** to reject entire actions.\n\nYou can edit returned answer just like in any editor - use arrow keys to navigate.\n\nTo execute actions place cursor to the end of the entire answer and press Enter or reject at any time by pressing Ctrl+C.\n\nYou can enable assistant's memory with **--memory** flag, in this case it will update AI_MEMORY.md in the current directory.\nThis helps solving more complex tasks, assistant will remember all previous actions including rejected.\n\n```\n$ ./ai --memory what operating system do I have\nMINGW64_NT-11.0-12345\n\n$ ./ai --memory but it says MINGW...bla bla, I dont know such OS\nYou are running Windows, but you are using the MINGW64 environment (a common way to run Linux-like tools on Windows).\n```\n\n", "url": "https://wpnews.pro/news/show-hn-ai-cli-tiny-c-terminal-assistant-powered-by-local-llm", "canonical_source": "https://github.com/vkataev/ai-cli", "published_at": "2026-07-15 10:46:18+00:00", "updated_at": "2026-07-15 11:18:33.188862+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "large-language-models"], "entities": ["AI-CLI", "llama.cpp", "vLLM", "TensorRT-LLM", "Ollama", "LM Studio", "SGLang", "Gemma-4"], "alternates": {"html": "https://wpnews.pro/news/show-hn-ai-cli-tiny-c-terminal-assistant-powered-by-local-llm", "markdown": "https://wpnews.pro/news/show-hn-ai-cli-tiny-c-terminal-assistant-powered-by-local-llm.md", "text": "https://wpnews.pro/news/show-hn-ai-cli-tiny-c-terminal-assistant-powered-by-local-llm.txt", "jsonld": "https://wpnews.pro/news/show-hn-ai-cli-tiny-c-terminal-assistant-powered-by-local-llm.jsonld"}}