integrations
AI shell integrations
Lacy doesn’t replace your AI CLI — it routes to it. Configure once, then type naturally in your shell. No prefix, no mode switching, no copy-pasting queries.
How it works
When you type in your terminal, Lacy decides in real time whether your input is a shell command or natural language. Shell commands run as normal. Natural language goes to whichever AI CLI you’ve configured.
Set your tool once with tool set <name> and Lacy handles the rest. You can switch tools anytime. If only one AI CLI is installed, Lacy auto-detects it on startup.
Lacy also passes context automatically: your current directory, git branch, last exit code, and recent commands. So “why did that fail?” after a broken build has the information to answer it.
Integration guides
The three most popular AI CLI integrations each have a dedicated setup guide with detailed configuration options.
Detailed integration notes
Claude Code
Lacy routes queries to Claude using claude -p in non-interactive (print) mode. It uses --resume to maintain session state across queries, so your follow-up questions have context from the first. When you need Claude’s full interactive REPL — file editing, tool use, multi-turn work — launch claude directly. Lacy covers the quick questions; Claude’s interactive mode handles the deep work.
Setup: npm install -g @anthropic-ai/claude-code then tool set claude.
OpenCode
Lacy routes to OpenCode via opencode run -c. OpenCode supports a background server mode, and Lacy can start that server on plugin load so your first query responds instantly. Enable preheating in ~/.lacy/config.yaml under preheat.eager: true.
Setup: Install from opencode-ai/opencode then tool set opencode.
Gemini CLI
Lacy routes to Gemini using gemini --resume -p. Google’s Gemini models have a long context window — useful when you’re working with large codebases or asking questions that span many files. Gemini CLI is free to start with a Google account.
Setup: Install from google-gemini/gemini-cli then tool set gemini.
lash (recommended)
lash is an OpenCode fork built by the same author as Lacy. It has the tightest integration — preheating, session management, and context passing all tuned to work together. If you don’t have a preference, lash is the right starting point.
Setup: curl -fsSL https://lash.lacy.sh/install | bash. Auto-detected if no other AI CLI is installed.
Codex CLI
OpenAI’s coding CLI. Lacy routes to it using codex exec resume --last. Good option if you already have an OpenAI API key and prefer GPT-4 class models.
Hermes
For local and open-source models. Lacy routes queries to Hermes using hermes chat -q. No cloud dependency — runs fully offline. Best for privacy-sensitive projects or air-gapped environments.
Custom tool
Any CLI tool that accepts a query argument: tool set custom "your-command --flag". Lacy appends your query as the final positional argument. This works with any wrapper script or local model server.
Feature comparison
All six AI CLI integrations support Lacy’s core routing. The differences are in session continuity, response latency (preheating), and whether the tool requires cloud access.
| Tool | Session continuity | Preheating | Open source | Local models |
|---|---|---|---|---|
| lash★ recommended | ✓ | ✓ | ✓ | — |
| Claude Code | ✓ | — | — | — |
| OpenCode | ✓ | ✓ | ✓ | — |
| Gemini CLI | ✓ | — | — | — |
| Codex CLI | ✓ | — | — | — |
| Hermes | — | — | ✓ | ✓ |
Session continuity means your follow-up query has context from the previous one — no repeating yourself. Preheating means Lacy can start a background server so the first query of a session responds instantly instead of waiting for a cold start.
Choosing a tool
- New to Lacy? Start with lash — same author, best integration, auto-installed if nothing else is detected.
- Already using Claude Code? Set it:
tool set claude. Lacy routes to your existing installation. - Prefer Google’s models? Gemini CLI has a generous free tier and a long context window.
- Want open source end-to-end? lash or OpenCode — both open source, both support preheating.
- No internet or privacy constraints? Hermes with local models runs fully offline.
- Using something else? Set a custom command:
tool set custom "my-ai-tool --query".
You can switch tools at any time. The active tool is saved to ~/.lacy/config.yaml.
Further reading
- Why I didn’t use AI to classify AI input — how Lacy decides whether your input goes to the shell or the AI tool.
- The post-execution reroute pattern — what happens when a natural-language query accidentally runs as a shell command and fails.
- Shell reserved words are trickier than they look — the edge cases in input classification that affect how routing works near shell keywords.