ghost

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ghost

   ▄████  ██░ ██  ▒█████   ██████  ████████
  ██▒ ▀█▒▓██░ ██▒▒██▒  ██▒ ██    ▒    ██
 ▒██░▄▄▄░▒██▀▀██░▒██░  ██▒ ▓██▄       ██
 ░▓█  ██▓░▓█ ░██ ▒██   ██░  ▒   ██▒   ██
 ░▒▓███▀▒░▓█▒░██▓░ ████▓▒░▒██████▒▒   ██
  ░▒   ▒   ▒ ░░▒░▒░ ▒░▒░▒░ ▒ ▒▓▒ ▒ ░   ░
   ░   ░   ▒ ░▒░ ░  ░ ▒ ▒░ ░ ░▒  ░ ░
 ░ ░   ░   ░  ░░ ░░ ░ ░ ▒  ░  ░  ░
       ░   ░  ░  ░    ░ ░        ░

Go Reference Build Status Build Status Go ReportCard license

Ghost is a local, general-purpose AI assistant CLI tool built in Go and powered by Ollama. It provides command-line access to AI capabilities for quick queries, code analysis, and task automation, running entirely on your own machine.

The vision for Ghost is inspired by cyberpunk media such as Shadowrun, Cyberpunk 2077, and The Matrix, bringing a versatile, always-on AI companion into a terminal-first experience.

Documents

Requirements

  • Go >= 1.24
  • Ollama installed and running locally
  • At least one model pulled (e.g., ollama pull llama3.1)

Installation

From Source
git clone https://github.com/theantichris/ghost.git
cd ghost
go build -v
From Release

Download pre-built binaries for Linux, macOS, or Windows from the releases page.

Usage

# Ask a single question
ghost ask "What is the capital of France?"

# Pipe input to Ghost for analysis
cat code.go | ghost ask "Explain this code"

# Combine piped input with additional context
cat error.log | ghost ask "What's causing this error?"

# Run directly with go
go run main.go ask "Your question here"

Ghost processes your query through the configured LLM model and returns the response directly to stdout.

Commands
ask - Ask Ghost a question

Send a query to the LLM and get a response. Supports both direct queries and piped input.

Global Flags
  • --ollama — Override the Ollama API base URL.
  • --model — Override the default LLM model
  • --config — Specify config file location (default: $HOME/.config/ghost/config.toml)
Environment Variables
  • OLLAMA_BASE_URL — base URL of your local Ollama instance (e.g., http://127.0.0.1:11434).
  • DEFAULT_MODEL — default model name to use when -model is not provided.
Configuration

Ghost checks for configuration in the following order of precedence:

  1. Command-line flags
  2. Environment variables
  3. Config file (.ghost.toml)
  4. Default values
Config File Setup

Create a config.toml file in ~/.config/ghost/ to set default configuration:

# ~/.config/ghost/config.toml
ollama = "http://localhost:11434"
model = "llama3.1"

Configuration options:

  • ollama — Ollama API base URL (default: http://localhost:11434)
  • model — LLM model to use (default: llama3.1)

Features

  • CLI Command Interface: Enhanced command-line interface using Fang (built on Cobra framework) with styled help pages and improved user experience
  • Pipe Support: Process files, logs, or command output by piping to Ghost
  • Think Block Filtering: Automatically filters out <think> blocks from model responses
  • Flexible Configuration: Support for environment variables, config files, and command-line flags
  • File Logging: All operations logged to ~/.config/ghost/ghost.log for debugging and troubleshooting (sensitive data never logged)
  • Error Handling: Comprehensive error messages with clear guidance on configuration issues

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
llm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL