Gaia is a command-line interface (CLI) tool that provides a convenient way to interact with language models through a local API. It features a beautiful terminal UI, configuration management, and support for different interaction modes.
- π Simple and intuitive command-line interface
- π¨ Beautiful terminal UI with progress bars
- βοΈ Configurable settings with YAML support
- π Support for different interaction modes (default, describe, code, shell)
- π¦ Automatic model management (pull if not present)
- π Local API integration
- Go 1.22.2 or later
- A running instance of a compatible language model API (e.g., Ollama)
git clone https://github.com/vonglasow/gaia.git
cd gaia
go build
Gaia stores its configuration in ~/.config/gaia/config.yaml
. The following settings are available:
model
: The language model to use (default: "mistral")host
: API host (default: "localhost")port
: API port (default: 11434)roles
: Different interaction modes with their respective prompts
default
: General programming and system administration assistancedescribe
: Command description and documentationshell
: Shell command generationcode
: Code generation without descriptions
# Ask a question
gaia ask "What is the meaning of life?"
# Start an interactive chat session
gaia chat
# Configure settings
gaia config set model llama2
gaia config set host 127.0.0.1
gaia config set port 8080
# View current configuration
gaia config list
# Get specific configuration value
gaia config get model
# Show configuration file path
gaia config path
# Check version
gaia version
# Use default role (general assistance)
gaia ask "How do I create a new directory?"
# Use describe role for command documentation
gaia ask --role describe "ls -la"
# Use shell role for command generation
gaia ask --role shell "list files in current directory"
# Use code role for code generation
gaia ask --role code "Hello world in Python"
The chat mode provides an interactive session where you can have a continuous conversation with the model. The conversation history is maintained throughout the session, allowing the model to reference previous messages.
# Start a chat session
gaia chat
# Type your messages and press Enter
# Type 'exit' to end the chat session
$ cat CVE-2021-4034.py | gaia ask "Analyze and explain this code"
This code is a Python script that exploits the CVE-2021-4034 vulnerability in Python. It was originally written by Joe Ammond, who used it as an experiment to see if he could get it to work in Python while also playing around with ctypes.
The code starts by importing necessary libraries and defining variables. The `base64` library is imported to decode the payload, while the `os` library is needed for certain file operations. The `sys` library is used to handle system-level interactions, and the `ctypes` library is used to call the `execve()` function directly.
The code then decodes a base64 encoded ELF shared object payload from a previous command (in this case, using msfvenom). This payload is created with the PrependSetuid=true flag so that it can run as root instead of just the user.
An environment list is set to configure the call to `execve()`. The code also finds the C library, loads the shared library from the payload, creates a temporary file for exploitation, and makes necessary directories.
The code ends with calling the `execve()` function using the C library found earlier, passing in NULL arguments as required by `execve()`.
api/
: API interaction and streaming functionalitycommands/
: CLI command definitionsconfig/
: Configuration managementmain.go
: Application entry point
This project is licensed under the terms specified in the LICENSE file.
Contributions are welcome! Please feel free to submit a Pull Request.