Skip to content

zanicool/llama-cli

 
 

Repository files navigation

Llama CLI

Release Build Tests Coverage Semgrep Gitleaks

A local AI assistant in your terminal. Chat with LLMs, attach files, run commands — all offline, all private.

Why

  • Private: everything runs locally, no data leaves your machine
  • Fast: no API latency, no rate limits, no subscriptions
  • Integrated: read files, execute commands, and get AI-powered answers in one place

Install

Pre-built binary (recommended)

Download the latest release from GitHub Releases:

# Linux/macOS
curl -L https://github.com/ollama/llama-cli/releases/latest/download/llama-cli -o llama-cli
chmod +x llama-cli
./llama-cli

Or move it to your PATH:

sudo mv llama-cli /usr/local/bin/

From source

brew install ollama
brew services start ollama
ollama pull gemma4:e4b
make setup
sudo make install

Usage

hello                          # chat with the LLM
!ls src/                       # run command, output to terminal
!!cat src/main.cpp             # run command, output as LLM context
what does this code do?        # LLM can now see the file
/set                           # show runtime options
/set bofh                      # toggle BOFH spinner mode
/version                       # show version info
/help                          # show available commands
exit                           # quit

The LLM can also propose commands and file writes:

> fix the bug in main.cpp
[proposed: write src/main.cpp]
Write to src/main.cpp? [y/n/s]

The LLM can read files and make targeted edits:

> what does repl.cpp do?
[read src/repl/repl.cpp]          # LLM reads the requested file

> fix the typo on line 42
[proposed: str_replace src/repl/repl.cpp]
- old text
+ new text
Apply str_replace to src/repl/repl.cpp? [y/n]

Configuration

Setting CLI arg Env var Default
Host --host OLLAMA_HOST localhost
Port --port OLLAMA_PORT 11434
Model --model OLLAMA_MODEL gemma4:e4b
Timeout --timeout OLLAMA_TIMEOUT 120
Exec timeout --exec-timeout LLAMA_EXEC_TIMEOUT 30
Max output --max-output LLAMA_MAX_OUTPUT 10000
No color --no-color NO_COLOR auto-detect TTY
BOFH mode --why-so-serious false
System prompt OLLAMA_SYSTEM_PROMPT (built-in)

CLI flags override .env, .env overrides environment variables, which override defaults. Use --default-env > .env to generate a template configuration file.

See docs/user-guide.md for detailed configuration options.

Roadmap

  • Connect to Ollama
  • Configurable host, port, model, timeout
  • Interactive chat with conversation memory
  • Write files from response (<write>)
  • Targeted edits (<str_replace>)
  • Smart file reading (<read> with line ranges and search)
  • Run commands (!, !!, <exec>)
  • TUI: ANSI colors, markdown rendering, spinner
  • Arrow key history (linenoise)
  • Runtime options (/set markdown, /set color, /set bofh)
  • Ctrl+C interrupt during LLM calls
  • Stdin pipe support (--files)
  • Auto-diff preview before file writes
  • Streaming responses
  • Inline code rendering in markdown

Quality Framework

This project follows ADR-048, a lean quality framework designed so that any AI agent — including small local models — can execute development tasks by following self-contained prompts with exact file paths, code, and verification commands.

The framework uses CMMI-inspired maturity levels (0-3) where every automated check serves at least two purposes. Current level: CMMI 0 (working toward CMMI 1). See ADR-048 §15 for the live audit.

Task prompts for AI agents live in docs/prompts/ — each prompt is copy-paste ready for a local Ollama model.

Contributing

See CONTRIBUTING.md for development setup and docs/ for architecture decisions.

About

CLI tool for interacting with local LLMs

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages