cbot is a lightweight, command-line AI assistant powered by Google's Gemini models. It allows you to query the AI directly from your terminal and naturally maintains continuous conversation history across commands.
- Install via Go:
go install github.com/ayush00git/cbot@latest
- First Run: Simply run
cbot "hello"and the application will guide you through an interactive setup to enter your API key. - Configure Path (Optional): If
cbotcommand is not found, add Go's bin directory to your PATH:Then run# Add to ~/.bashrc or ~/.zshrc export PATH=$PATH:$(go env GOPATH)/bin
source ~/.bashrc(or~/.zshrc).
cbot offers three primary ways to interact with the LLM:
Execute a quick query directly from your shell. cbot will generate a response and exit immediately, while still saving the interaction to your context window.
cbot <your question or prompt here>Start a continuous, session-based interactive chat interface in your terminal. This is ideal for longer brainstorming sessions.
cbot chat(Type exit or quit to leave the interactive session).
Configure your preferred response length and chat style. These settings are stored in the System Layer, ensuring the AI always follows your desired persona.
cbot set- Response Length: Choose between "1-2 line chat" or "explaining paragraphs".
- Chat Style: Select from "professional", "friendly", or "genz lang".
Manually wipe the locally stored conversation history to start a fresh topic from a blank slate.
cbot resetcbot features a dedicated System Layer that acts as the "brain" or "personality" of the assistant. Every time you interact with the model, cbot constructs a set of background instructions based on your preferences in cbot set.
For example, if you select "genz lang" and "1-2 line chat", the system layer automatically tells the LLM to keep things brief and use modern slang, making the interaction feel more tailored to your specific workflow.
cbot is designed to feel like a continuous, intelligent conversation, even when you run it as separate, one-shot commands. Both the one-shot queries and interactive chat sessions share the exact same context.
To achieve this, the application maintains a persistent conversation history:
- Storage Location: Your chat history is saved locally as a simple JSON file in your user config directory:
~/.config/cbot/history.json. - Context Loading: Every time you ask a question,
cbotreads this history file, appends your new prompt to the list of past interactions, and sends the entire sequence to the Gemini API. This allows the AI to "remember" what you were talking about previously and provide highly contextual responses. - Smart Trimming: To prevent excessive API token consumption and keep the CLI extremely fast,
cbotuses a "sliding window" approach. It automatically trims the history file to only remember the last 20 messages. Older messages naturally fall out of the context window as you continue chatting.
