Show HN: AI-CLI – tiny C terminal assistant powered by local LLM

novaRom1 pts0 comments

GitHub - vkataev/ai-cli: command line assistant smoothly connecting your requests with LLM of your choice and executing directly returned actions · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

vkataev

ai-cli

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>2 Commits<br>2 Commits

LICENSE.md

LICENSE.md

README.md

README.md

ai.1

ai.1

ai.c

ai.c

run.build_ai.sh

run.build_ai.sh

run.install_ai.sh

run.install_ai.sh

View all files

Repository files navigation

ai-cli

command line assistant smoothly connecting your requests with LLM of your choice and executing directly returned actions, all in a single C file

MOTIVATION

Free yourself from writing all those complex actions in command line shell, instead ai assistant will do it for you based on your requests.

Your choices are: accept actions (by just pressing Enter ) with opportunity to edit assistan's answer first or reject actions by pressing Ctrl+C .

EXAMPLES

If for example, you want to know who did run jobs on a particular Slurm node, you may ask:

$ ./ai who was running jobs on a slurm node 39 between 1 and 2 hours ago<br>user847<br>uset20499

The action assitant returned might look like:

sacct --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

Other examples:

$ ./ai replace Solar with solar in every python file in this folder<br>Done

$ ./ai modify permissions of this folder so no other user can read anything here<br>Done

$ ./ai find all occurances of subword "perform" in words.txt and print their line numbers<br>1881<br>10046<br>10047<br>40358

$ ./ai math log of 4096<br>8.317766166719343

$ ./ai show me last 3 lines in each c file in current folder<br>buffer_free(&original);<br>return exit_code;

$ ./ai what is IP address of somewebsite<br>xxx.xx.xx.xxx

WARNING

Be careful, because this tool executes actions returned by LLM directly in your shell.

Authors are not responsible for any damage this program can cause.

If you are not familiar with shell commands, do not use this assistant.

BUILD

sh run.build_ai.sh

or directly

gcc ai.c -o ai

INSTALL

This will copy ai into your ~/.local/bin and man page into ~/.local/share/man/man1/

sh run.build_ai.sh

PORTABILITY

You can build and run this tool on literally any platform, fully supported:

Linux

macOS

Android

FreeBSD

iOS

OpenBSD

NetBSD

QNX Neutrino

Windows (MSYS2 or Cygwin)

WebOS

Haiku

SerenityOS

DragonFly BSD

illumos

Solaris

AIX

HP-UX

Tru64 UNIX

IRIX

UnixWare

SCO OpenServer

Redox OS

VxWorks

RTEMS

INTEGRITY

Most LLM engines are fully supported:

Engine<br>/v1/chat/completions

llama.cpp<br>Yes

vLLM<br>Yes

TensorRT-LLM<br>Yes

Ollama<br>Yes

LM Studio<br>Yes

SGLang<br>Yes

Text Generation Inference (TGI)<br>Yes

Aphrodite Engine<br>Yes

LocalAI<br>Yes

Xinference<br>Yes

FastChat<br>Yes

MLC LLM<br>Yes

KoboldCpp<br>Partial

DEPENDENCIES

You need an LLM engine running locally or remotely.

Example how you may run llama.cpp with Gemma-4 model:

llama-server --host 0.0.0.0 \<br>--model unsloth/gemma-4-12B-it-qat-UD-Q4_K_XL.gguf \<br>--temp 1.0 \<br>--top-p 0.95 \<br>--top-k 64 \<br>--port 8001 \<br>--chat-template-kwargs '{"enable_thinking":false}'

Remember to disable thinking mode - answers model provides will be direct shell actions.

USAGE

$ export AI_URL="http://127.0.0.1:8001"<br>$ ./ai which file in this folder is to build ai tool<br>./run.build_ai.sh

You can accept answer by pressing Enter and actions will be executed in shell or you can press Ctrl+C to reject entire actions.

You can edit returned answer just like in any editor - use arrow keys to navigate.

To execute actions place cursor to the end of the entire answer and press Enter or reject at any time by pressing Ctrl+C.

MEMORY USAGE

You can enable assistant's memory with --memory flag, in this case it will update AI_MEMORY.md in the current directory.<br>This helps solving more complex tasks,...

actions assistant returned search file build_ai

Related Articles