coolaid is a local AI-powered CLI tool for exploring and querying codebases. It supports semantic search, code explanations, summarization, and general LLM queries — all running locally with your own embeddings and vector store.
- Index your code with semantic chunking
- Go functions and methods are chunked via AST
- Generic text chunking for other files
- Tracks file paths and line numbers
- Vector store backed by SQLite for fast semantic search
- LLM integration (via Ollama client) for:
- Code explanation
- Summarization
- General questions
- Semantic search over your indexed code
- Template-driven prompts for consistent and structured LLM outputs
coolaid runs fully locally but requires Ollama to be installed and running.
- Install Ollama: https://ollama.com
- Pull the required models:
ollama pull llama3.1
ollama pull nomic-embed-text- LLM model (default): llama3.1
- Embedding model (default): nomic-embed-text
You can change these later via configuration if needed.
Download the latest release for your platform from GitHub: 👉 https://github.com/alessio-palumbo/coolaid/releases
Then make it executable (Linux/macOS):
chmod +x ai
./ai --helpgit clone https://github.com/alessio-palumbo/coolaid.git
cd coolaid
go build -o ai ./cmd/main./ai ask "What is a mutex in Go?"Before using most commands, you need to index your codebase.
./ai indexBy default, coolaid will:
- Detect the root of the current Git repository and index it
- Fallback to the current directory if no Git repo is found
This process:
- Chunks your code into meaningful pieces
- Generates embeddings for each chunk
- Stores them in a local vector database
Note: All commands except ask require an index to exist.
On first run, coolaid will automatically create a configuration file:
~/.ai/config.tomlThis file contains:
- LLM model (default: llama3.1)
- Embedding model (default: nomic-embed-text)
- Indexing settings (included extensions and ignore patterns)
You can edit this file to customize how coolaid behaves.
Indexed data is stored locally in:
~/.ai/indexes/Each project gets its own SQLite database, automatically named based on:
- The project root directory
- A short hash (to avoid collisions)
This allows multiple projects to be indexed independently without conflicts.
You should rerun:
./ai indexwhenever:
- Files in your codebase change significantly
- You update include_extensions
- You update ignore_patterns
- You change the embedding model
Note: The index is not automatically kept in sync with your codebase. If a breaking change or configuration mismatch is detected, coolaid will return an error prompting you to rebuild the index.
| Command | Description |
|---|---|
ask |
Ask the AI any general question (no indexing required) |
summarize |
Summarize code or text input |
index |
Build the vector index of your codebase |
search |
Perform a semantic search and return top K chunks |
query |
Ask a question over your indexed code (RAG: retrieves top-K relevant chunks and generates an answer) |
explain |
Explain a piece of code or file |
test |
Generate tests for a piece of code or file |
edit |
Edit a file or function according to a prompt |
Flags must be specified before positional arguments.
✅ Correct:
./ai ask -web -search_limit 5 “What is a mutex in Go?”
./ai test -fn Foo main.go❌ Incorrect:
./ai ask “What is a mutex in Go?” -web true
./ai test main.go -fn FooNotes:
- Positional arguments (e.g.
<file>,<prompt>) come after flags - Prompts with spaces should be wrapped in quotes
./ai ask [-web] [-search_limit 5] "What is a mutex in Go?"- -web optional, performs a web search on the prompt (use DuckDuckGo html search)
- -search_limit optional, set limit for search responses (defaults to 5)
./ai summarize path/to/file.go./ai index ./my-repo./ai query [-mode balanced] chat- -mode optional, specifies the mode to use for RAG: fast, balanced (default) or deep (use MMR)
./ai search [-k 5] "vector store embedding normalization"- -k optional, specifies the number of top chunks to retrieve (default: 5)
./ai query [-mode balanced] "How is the vector store implemented?"- -mode optional, specifies the mode to use for RAG: fast, balanced (default) or deep (use MMR)
./ai explain [-fn functionName] path/to/file.go- -fn optional, targets functionName only
./ai test [-fn functionName] path/to/file.go- -fn optional, targets functionName only
./ai edit [-fn functionName] [-rng 15-30] [-rag] path/to/file.go- -fn optional, targets functionName only
- -rng optional, targets file line range (start-line)
- -rag optional, set to true to use RAG for extra context
./ai fix [-fn functionName] [-rng 15-30] [-rag] path/to/file.go- -fn optional, targets functionName only
- -rng optional, targets file line range (start-line)
- -rag optional, set to true to use RAG for extra context
./ai refactor [-fn functionName] [-rng 15-30] [-rag] path/to/file.go- -fn optional, targets functionName only
- -rng optional, targets file line range (start-line)
- -rag optional, set to true to use RAG for extra context
./ai comment [-fn functionName] path/to/file.go- -fn optional, targets functionName only
- Chunking – Code and text files are split into semantic chunks
- Embedding – Each chunk is converted to a vector via the LLM
- Vector Store – Chunks and embeddings are stored in SQLite
- Search – Queries are embedded and compared using cosine similarity
- LLM Prompting – Retrieved chunks are injected into prompt templates for answers
- LLM client settings are configured in internal/embedding/ollama.go
- Prompt templates are stored in internal/prompts (uses Go text/template)
- Vector store persistence is handled automatically in SQLite
MIT License