on 4d402fd help sign in

Glamourous agentic coding for all ๐Ÿ’˜

git clone ssh://git.iko.soy/crush

โŒฌ Crush

โš ๏ธ Early Development Notice: This project is in early development and is not yet ready for production use. Features may change, break, or be incomplete. Use at your own risk.

A powerful terminal-based AI assistant for developers, providing intelligent coding assistance directly in your terminal.

Overview

Crush is a Go-based CLI application that brings AI assistance to your terminal. It provides a TUI (Terminal User Interface) for interacting with various AI models to help with coding tasks, debugging, and more.

For a quick video overview, check out Crush + Gemini 2.5 Pro: BYE Claude Code! I'm SWITCHING To the FASTEST AI Coder!

Features

Installation

Using the Install Script

# Install the latest version
curl -fsSL https://raw.githubusercontent.com/charmbracelet/crush/refs/heads/main/install | bash

# Install a specific version
curl -fsSL https://raw.githubusercontent.com/charmbracelet/crush/refs/heads/main/install | VERSION=0.1.0 bash

Using Homebrew (macOS and Linux)

brew install crush-ai/tap/crush

Using AUR (Arch Linux)

# Using yay
yay -S crush-ai-bin

# Using paru
paru -S crush-ai-bin

Using Go

go install github.com/charmbracelet/crush@latest

Configuration

Crush looks for configuration in the following locations:

Auto Compact Feature

Crush includes an auto compact feature that automatically summarizes your conversation when it approaches the model's context window limit. When enabled (default setting), this feature:

You can enable or disable this feature in your configuration file:

{
  "autoCompact": true // default is true
}

Environment Variables

You can configure Crush using environment variables:

Environment VariablePurpose
ANTHROPIC_API_KEYFor Claude models
OPENAI_API_KEYFor OpenAI models
GEMINI_API_KEYFor Google Gemini models
VERTEXAI_PROJECTFor Google Cloud VertexAI (Gemini)
VERTEXAI_LOCATIONFor Google Cloud VertexAI (Gemini)
GROQ_API_KEYFor Groq models
AWS_ACCESS_KEY_IDFor AWS Bedrock (Claude)
AWS_SECRET_ACCESS_KEYFor AWS Bedrock (Claude)
AWS_REGIONFor AWS Bedrock (Claude)
AZURE_OPENAI_ENDPOINTFor Azure OpenAI models
AZURE_OPENAI_API_KEYFor Azure OpenAI models (optional when using Entra ID)
AZURE_OPENAI_API_VERSIONFor Azure OpenAI models
LOCAL_ENDPOINTFor self-hosted models
SHELLDefault shell to use (if not specified in config)

Shell Configuration

Crush allows you to configure the shell used by the bash tool. By default, it uses the shell specified in the SHELL environment variable, or falls back to /bin/bash if not set.

You can override this in your configuration file:

{
  "shell": {
    "path": "/bin/zsh",
    "args": ["-l"]
  }
}

This is useful if you want to use a different shell than your default system shell, or if you need to pass specific arguments to the shell.

Configuration File Structure

{
  "data": {
    "directory": ".crush"
  },
  "providers": {
    "openai": {
      "apiKey": "your-api-key",
      "disabled": false
    },
    "anthropic": {
      "apiKey": "your-api-key",
      "disabled": false
    },
    "groq": {
      "apiKey": "your-api-key",
      "disabled": false
    },
    "openrouter": {
      "apiKey": "your-api-key",
      "disabled": false
    }
  },
  "agents": {
    "coder": {
      "model": "claude-3.7-sonnet",
      "maxTokens": 5000
    },
    "task": {
      "model": "claude-3.7-sonnet",
      "maxTokens": 5000
    },
    "title": {
      "model": "claude-3.7-sonnet",
      "maxTokens": 80
    }
  },
  "shell": {
    "path": "/bin/bash",
    "args": ["-l"]
  },
  "mcpServers": {
    "example": {
      "type": "stdio",
      "command": "path/to/mcp-server",
      "env": [],
      "args": []
    }
  },
  "lsp": {
    "go": {
      "disabled": false,
      "command": "gopls"
    }
  },
  "debug": false,
  "debugLSP": false,
  "autoCompact": true
}

Supported AI Models

Crush supports a variety of AI models from different providers:

OpenAI

Anthropic

Google

AWS Bedrock

Groq

Azure OpenAI

Google Cloud VertexAI

Usage

# Start Crush
crush

# Start with debug logging
crush -d

# Start with a specific working directory
crush -c /path/to/project

Non-interactive Prompt Mode

You can run Crush in non-interactive mode by passing a prompt directly as a command-line argument. This is useful for scripting, automation, or when you want a quick answer without launching the full TUI.

# Run a single prompt and print the AI's response to the terminal
crush -p "Explain the use of context in Go"

# Get response in JSON format
crush -p "Explain the use of context in Go" -f json

# Run without showing the spinner (useful for scripts)
crush -p "Explain the use of context in Go" -q

In this mode, Crush will process your prompt, print the result to standard output, and then exit. All permissions are auto-approved for the session.

By default, a spinner animation is displayed while the model is processing your query. You can disable this spinner with the -q or --quiet flag, which is particularly useful when running Crush from scripts or automated workflows.

Output Formats

Crush supports the following output formats in non-interactive mode:

FormatDescription
textPlain text output (default)
jsonOutput wrapped in a JSON object

The output format is implemented as a strongly-typed OutputFormat in the codebase, ensuring type safety and validation when processing outputs.

Command-line Flags

FlagShortDescription
--help-hDisplay help information
--debug-dEnable debug mode
--cwd-cSet current working directory
--prompt-pRun a single prompt in non-interactive mode
--output-format-fOutput format for non-interactive mode (text, json)
--quiet-qHide spinner in non-interactive mode

Keyboard Shortcuts

Global Shortcuts

ShortcutAction
Ctrl+CQuit application
Ctrl+?Toggle help dialog
?Toggle help dialog (when not in editing mode)
Ctrl+LView logs
Ctrl+ASwitch session
Ctrl+KCommand dialog
Ctrl+OToggle model selection dialog
EscClose current overlay/dialog or return to previous mode

Chat Page Shortcuts

ShortcutAction
Ctrl+NCreate new session
Ctrl+XCancel current operation/generation
iFocus editor (when not in writing mode)
EscExit writing mode and focus messages

Editor Shortcuts

ShortcutAction
Ctrl+SSend message (when editor is focused)
Enter or Ctrl+SSend message (when editor is not focused)
Ctrl+EOpen external editor
EscBlur editor and focus messages

Session Dialog Shortcuts

ShortcutAction
โ†‘ or kPrevious session
โ†“ or jNext session
EnterSelect session
EscClose dialog

Model Dialog Shortcuts

ShortcutAction
โ†‘ or kMove up
โ†“ or jMove down
โ† or hPrevious provider
โ†’ or lNext provider
EscClose dialog

Permission Dialog Shortcuts

ShortcutAction
โ† or leftSwitch options left
โ†’ or right or tabSwitch options right
Enter or spaceConfirm selection
aAllow permission
AAllow permission for session
dDeny permission

Logs Page Shortcuts

ShortcutAction
Backspace or qReturn to chat page

AI Assistant Tools

Crush's AI assistant has access to various tools to help with coding tasks:

File and Code Tools

ToolDescriptionParameters
globFind files by patternpattern (required), path (optional)
grepSearch file contentspattern (required), path (optional), include (optional), literal_text (optional)
lsList directory contentspath (optional), ignore (optional array of patterns)
viewView file contentsfile_path (required), offset (optional), limit (optional)
writeWrite to filesfile_path (required), content (required)
editEdit filesVarious parameters for file editing
patchApply patches to filesfile_path (required), diff (required)
diagnosticsGet diagnostics informationfile_path (optional)

Other Tools

ToolDescriptionParameters
bashExecute shell commandscommand (required), timeout (optional)
fetchFetch data from URLsurl (required), format (required), timeout (optional)
sourcegraphSearch code across public repositoriesquery (required), count (optional), context_window (optional), timeout (optional)
agentRun sub-tasks with the AI agentprompt (required)

Architecture

Crush is built with a modular architecture:

Custom Commands

Crush supports custom commands that can be created by users to quickly send predefined prompts to the AI assistant.

Creating Custom Commands

Custom commands are predefined prompts stored as Markdown files in one of three locations:

  1. User Commands (prefixed with user:):

    $XDG_CONFIG_HOME/crush/commands/

    (typically ~/.config/crush/commands/ on Linux/macOS)

    or

    $HOME/.crush/commands/
  2. Project Commands (prefixed with project:):

    <PROJECT DIR>/.crush/commands/

Each .md file in these directories becomes a custom command. The file name (without extension) becomes the command ID.

For example, creating a file at ~/.config/crush/commands/prime-context.md with content:

RUN git ls-files
READ README.md

This creates a command called user:prime-context.

Command Arguments

Crush supports named arguments in custom commands using placeholders in the format $NAME (where NAME consists of uppercase letters, numbers, and underscores, and must start with a letter).

For example:

# Fetch Context for Issue $ISSUE_NUMBER

RUN gh issue view $ISSUE_NUMBER --json title,body,comments
RUN git grep --author="$AUTHOR_NAME" -n .
RUN grep -R "$SEARCH_PATTERN" $DIRECTORY

When you run a command with arguments, Crush will prompt you to enter values for each unique placeholder. Named arguments provide several benefits:

Organizing Commands

You can organize commands in subdirectories:

~/.config/crush/commands/git/commit.md

This creates a command with ID user:git:commit.

Using Custom Commands

  1. Press Ctrl+K to open the command dialog
  2. Select your custom command (prefixed with either user: or project:)
  3. Press Enter to execute the command

The content of the command file will be sent as a message to the AI assistant.

Built-in Commands

Crush includes several built-in commands:

CommandDescription
Initialize ProjectCreates or updates the CRUSH.md memory file with project-specific information
Compact SessionManually triggers the summarization of the current session, creating a new session with the summary

MCP (Model Context Protocol)

Crush implements the Model Context Protocol (MCP) to extend its capabilities through external tools. MCP provides a standardized way for the AI assistant to interact with external services and tools.

MCP Features

Configuring MCP Servers

MCP servers are defined in the configuration file under the mcpServers section:

{
  "mcpServers": {
    "example": {
      "type": "stdio",
      "command": "path/to/mcp-server",
      "env": [],
      "args": []
    },
    "web-example": {
      "type": "sse",
      "url": "https://example.com/mcp",
      "headers": {
        "Authorization": "Bearer token"
      }
    }
  }
}

MCP Tool Usage

Once configured, MCP tools are automatically available to the AI assistant alongside built-in tools. They follow the same permission model as other tools, requiring user approval before execution.

LSP (Language Server Protocol)

Crush integrates with Language Server Protocol to provide code intelligence features across multiple programming languages.

LSP Features

Configuring LSP

Language servers are configured in the configuration file under the lsp section:

{
  "lsp": {
    "go": {
      "disabled": false,
      "command": "gopls"
    },
    "typescript": {
      "disabled": false,
      "command": "typescript-language-server",
      "args": ["--stdio"]
    }
  }
}

LSP Integration with AI

The AI assistant can access LSP features through the diagnostics tool, allowing it to:

While the LSP client implementation supports the full LSP protocol (including completions, hover, definition, etc.), currently only diagnostics are exposed to the AI assistant.

Using a self-hosted model provider

Crush can also load and use models from a self-hosted (OpenAI-like) provider. This is useful for developers who want to experiment with custom models.

Configuring a self-hosted provider

You can use a self-hosted model by setting the LOCAL_ENDPOINT environment variable. This will cause Crush to load and use the models from the specified endpoint.

LOCAL_ENDPOINT=http://localhost:1235/v1

Configuring a self-hosted model

You can also configure a self-hosted model in the configuration file under the agents section:

{
  "agents": {
    "coder": {
      "model": "local.granite-3.3-2b-instruct@q8_0",
      "reasoningEffort": "high"
    }
  }
}

Development

Prerequisites

Building from Source

# Clone the repository
git clone https://github.com/charmbracelet/crush.git
cd crush

# Build
go build -o crush

# Run
./crush

Acknowledgments

Crush gratefully acknowledges the contributions and support from these key individuals:

Special thanks to the broader open source community whose tools and libraries have made this project possible.

License

Crush is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Here's how you can contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please make sure to update tests as appropriate and follow the existing code style.