Clai – A Lean CLI Tool for LLM Pipelines

PromptCube Advanced 2h ago 442 views 8 likes 2 min read

I kept running into the same wall: I'd build an automation platform to handle emails, commits, PRs, and long chat threads, and every time it hit its own limitations. Twice I started from scratch, twice I hit the same ceiling. Eventually I went back to what I've trusted for years — UNIX pipelines — and that's when the idea for Clai clicked into place.

The core concept is almost absurdly simple. Clai reads from stdin, sends the content to an LLM of your choice, prints the result to stdout, and exits. No REPL, no session state, no background processes. It's a pure filter in the Unix tradition — the kind of thing you compose with | and forget about.

Here's what the daily workflow looks like in practice:

git diff | clai commit
cat article.txt | clai summarize | glow
pbpaste | clai tldr
curl -s example.com/article.html | clai -e "Extract the three main concepts"

The last example is where it gets interesting — you can pass an inline prompt override with -e instead of relying on a named preset. That's powerful when you need one-off transformations that don't warrant saving a prompt file.

Clai ships with a library of named prompts, and each one is just a file with YAML frontmatter. That means you can add your own, override the bundled ones, or organize them however makes sense for your team. I keep mine in a shared dotfiles repo so everyone on the team gets the same defaults.

For reasoning-heavy tasks, there are four strategies built in: chain-of-draft, chain-of-thought, tree-of-thought, and self-refine. I reach for chain-of-thought on anything that requires step-by-step logic, and self-refine when I want the model to critique its own output before returning it. The difference is noticeable on longer, more technical prompts.

Provider support covers the major players, and I'm actively adding more. You can also point Clai at a local model — nothing leaves your machine, which matters if you're working with sensitive codebases or just want zero latency on a personal machine. The local model path was one of the design decisions I'm most proud of; too many CLI LLM tools lock you into a specific provider and make self-hosting an afterthought.

Installation is a single Homebrew command:

brew install maxrodrigo/tap/clai

This is v0.3.0 — a few weeks old and rough around the edges. I'm genuinely looking for feedback on what's missing. If you find yourself piping text through LLMs regularly and wish there were a lighter tool for it, I'd love to hear whether Clai fits the gap or where it falls short. Contributions are very welcome at this stage.

All Replies (4)

J
Jamie67 Novice 2h ago
Did you run into any issues with rate limiting when scaling up the concurrent tasks?
0 Reply
G
GhostFounder Intermediate 2h ago
Yeah, hit some API throttling early on. Added exponential backoff and a token bucket limiter — that smoothed things out a lot.
0 Reply
R
RayTinkerer Novice 2h ago
I found that having a simple config file for model routing saved me a lot of rework when switching between providers.
0 Reply
S
SoloSage Advanced 2h ago
Ended up throwing away two full frameworks before I just wrote a tiny CLI wrapper myself.
0 Reply

Write a Reply

Markdown supported