Skip to content
drumandbytesPublic

About

Call AI models from the command line like jq or grep: any provider, encrypted local history, cache, context and an agent mode.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

prinia

Call AI models from the command line the way you call jq, grep or curl: data on stdin, an instruction as the argument, the result on stdout. Every call is saved to an encrypted local history, so identical calls are answered instantly and nothing you asked is lost.

prinia "where does a unix pipe buffer its data?"

journalctl -u app | prinia "output a JSON array of distinct error messages" | jq -r '.[]'

git diff | prinia -f "write a one-line commit message" | pbcopy

prinia -d "review this design for race conditions" < design.md
  • A real Unix filter. When input or output is piped you get raw text: no markdown, no code fences, errors on stderr, a non-zero exit code on failure.
  • Any provider. Anthropic and any OpenAI-compatible endpoint, which covers OpenAI, Ollama and other local runners, and most hosted services. No vendor CLI, no SDK.
  • Fast. Answers stream as they arrive, startup takes milliseconds, and a call already in your history returns without touching the network.
  • Model tiers. -f (fast) and -d (deep) pick a model for the job; each provider maps the tiers to its own models.
  • History you own. Prompts, input and responses are compressed and encrypted on disk. Browse it, delete from it, back the key up as 24 words.
  • Configurable. Every setting works as a flag, an environment variable, a project file or a global file.

Install

curl -fsSL https://github.com/drumandbytes/prinia/releases/latest/download/install.sh | sh
# or
brew install drumandbytes/tap/prinia

Then give it a provider:

export ANTHROPIC_API_KEY=...      # or OPENAI_API_KEY, or configure a local model
prinia "hello"

Local models

No account or API key needed. With Ollama running:

prinia init

It checks your memory, suggests a model that fits (qwen2.5:14b on 16 GB or more, plus qwen2.5:32b for -d on 40 GB or more), offers to ollama pull it, and writes ~/.config/prinia/config.toml without overwriting an existing one. To do it by hand, see Configuration.

Small models (3B and under) invent commands and ignore instructions. Other OpenAI-compatible runners (LM Studio, llama.cpp, vLLM) work with a different base_url. Install covers other platforms and building from source.

Usage

prinia "question"                    # ask; the answer streams to the terminal
cmd | prinia "instruction" | cmd2    # a pipeline step
prinia -f "..."                      # fast tier
prinia -d "..."                      # reasoning tier
prinia -p local "..."                # a configured provider
cat list.txt | prinia --each "..."      # one call per line, in parallel (-j N)
prinia -t NAME "..."                 # a saved instruction (docs/usage.md#templates)
prinia --cmd "..."                   # one shell command; `eval "$(prinia shell zsh)"` binds it to ctrl-g
prinia -x "..."                     # let the model run commands to answer (agent + --run); asks before anything not read-only, -y skips that
prinia -a "..."                     # agent: the model reads and searches files here (--write, --run to allow more)
prinia -c "..."                     # include earlier turns from this directory (recent, relevant, older questions)
prinia context ["question"]          # show what -c would send
prinia --no-cache "..."              # ask again even if the call is in your history
prinia --no-record "..."             # don't save this call

prinia init                          # pick a local model for this machine and write the config
prinia update [--check]              # update prinia (curl-installed binaries; brew users: brew upgrade)
prinia trust                         # allow this repo's .priniarc to turn on run/write/agent
prinia history                       # browse everything you asked (fzf when available)
prinia history search kestrel        # find turns by words in prompt, input or answer
prinia history ask "what did I ask about TLS?"   # a fast model answers from your history
prinia history rm --older 90d        # delete by age (asks first)
prinia key show                      # your history key as 24 words
prinia stats                         # calls, cache hits, tokens (also --json, --format for prompts)
prinia config                        # every setting and where its value comes from

More in Usage and History.

Documentation

Install Script, Homebrew, source; platforms
Usage Pipelines, tiers, caching, flags
Configuration Providers, models, every setting, environment variables
History What is stored, encryption and keys, deleting
Agent Tools, permissions, limits
Stats Usage totals, Starship and Oh My Posh examples
Development Building, tests, how it is put together, releases

Status

prinia is beta software.

  • macOS and Linux are tested. Windows builds and passes the tests in CI, but has not been used by hand.
  • Agent mode has run against a mock server and one OpenAI-compatible provider; the Anthropic tool-call format has not run against the real API yet.

License

MIT

Part of Drumandbytes.

About

Call AI models from the command line like jq or grep: any provider, encrypted local history, cache, context and an agent mode.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages