gllm

gllm - Golang Command-Line LLM Companion

gllm is a powerful CLI tool designed to interact seamlessly with various Large Language Models (LLMs). It supports features like interactive chat, multi-turn conversations, file attachments, search integration, a command agent, multi-agent workflows, deep research, mcp services and extensive customization.

🚀 Features


📌 Installation

Homebrew (macOS)

brew tap activebook/gllm
brew install gllm --cask
brew update
brew upgrade gllm --cask

Scoop (Windows)

scoop bucket add gllm https://github.com/activebook/scoop-gllm.git
scoop install gllm

Shell (Alpine Linux/Ubuntu/CentOS/MacOS)

curl -fsSL https://raw.githubusercontent.com/activebook/gllm/main/build/install.sh | sh

Multi-Platform Self-Update

gllm includes a built-in self-update mechanism that automatically checks for new versions in the background. You can also manually trigger an update or check the current status.

Background Update Notification Manual Update with /update
Self Update 1 Self Update 2

Build from Source

git clone https://github.com/activebook/gllm.git
cd gllm
go build -o gllm

eg. Run on Alpine Linux

Run on Linux MCP Run on Linux
RunonLinux MCPRunonLinux

đź’ˇ Initialization

The easiest way to get started is to run the interactive initialization wizard:

gllm init

This will guide you through setting up your preferred LLM provider, API keys, and default settings.

🎯 Usage

Basic Commands

Shell Completion

To enable tab completion for gllm commands in your shell, add the following to your shell configuration file:

# For bash, add to ~/.bashrc or ~/.bash_profile
gllm completion bash > ~/.gllm-completion.bash
echo 'source ~/.gllm-completion.bash' >> ~/.bashrc

After adding the appropriate line to your shell configuration file, restart your shell or run source ~/.bashrc (or the equivalent for your shell) to enable completion.

Interactive Session / REPL

Start an interactive session by running gllm without any arguments or prompt:

gllm

Chat Mode Screenshot

Within the chat, you can use various commands:

Workflow Commands

Workflow commands are predefined sequences of actions that can be executed with a single command. They are stored as markdown files in the workflows directory.

Use debug command Workflow commands
Debug command Workflow commands

Skills Commands

Skills are reusable sets of instructions that can be invoked with a single command. They are stored as SKILL.md files in the skills directory.

arxiv skill command Code skill command
arxiv skill command Code skill command

Multi-Line Input with Editor

For longer messages or code snippets, use your preferred text editor directly in an interactive session:

# In a session, type:
/editor
/e

✨ In a session, you can copy/paste text/code

How to use:

  1. Open prefered editor
  2. Compose your message
  3. Save and exit the editor
  4. Review the content in the session
  5. Press Enter to send or Ctrl+C to discard

Setup your editor:

# Set your preferred editor (vim, nano, code, etc.)
gllm config editor switch vim

# List available editors
gllm config editor

# Check current editor
gllm config editor

Multi-turn Sessions

There are two main ways to have a multi-turn conversation:

1. Single-Line Style (using named sessions)

You can maintain a session across multiple commands by assigning a name to your session with the -s flag. This is useful for scripting or when you want to continue a specific line of inquiry.

2. Interactive Session Style (REPL)

For a more interactive experience, simply run gllm to enter a real-time session.


đź§  Context Management

gllm provides advanced strategies to manage session history when it approaches the model’s context window limit. You can choose between preserving space through truncation or summarizing the session to maintain full context.

Context Compress

Truncation Strategies

You can configure the strategy using gllm features switch->auto compression:

Manual Compression

In an interactive session, you can manually trigger compression at any time:

> /compress

This reduces the entire preceding history into a single summary block followed by an acknowledgment, allowing you to continue a very long session without hitting context limits.


Memory Management

gllm can remember important facts about you across sessions, making conversations more personalized and contextual.

Memory Commands

gllm memory
gllm memory add "I prefer Go over Python"
gllm memory list
gllm memory clear --force  # Skip confirmation
gllm memory path

How Memory Works in Sessions

Memories are automatically injected into the system prompt, so the LLM will remember your preferences and context across all sessions:

Example:

# Start a session - the LLM will automatically consider your memories
$ gllm
> Remember this: I work primarily with Go and Docker
> Forget this: I love dark jokes

You can manually edit this file or use the gllm memory path command to find it.


File Attachments

Code Editing

The command agent supports diff editing for precise code modifications.

gllm "Read this file @build.sh and change function name"
Edit code with diff Cancel an edit
Edit Code Screenshot Cancel Edit Screenshot

Plan Mode

Plan Mode allows you to review and approve the agent’s proposed actions before they are executed. This is particularly useful for complex tasks where you want to ensure the agent’s strategy aligns with your expectations.

Plan Mode - Process Plan Mode - Approval
Plan Mode 1 Plan Mode 2

Sub-agents and Delegation

gllm introduces a powerful Sub-agents and Delegation system that leverages Agent Tools and State Tools to orchestrate complex, multi-agent tasks. This approach solves the traditional context window limitations by decoupling agent execution and using a shared state memory. SOTA LLMs like Gemini 3.0 and GPT-5.2 can handle complex workflows with ease.

How it Works

  1. Agent Tools (spawn_subagents):
    • An Orchestrator agent can spawn independent sub-agents using the spawn_subagents tool.
    • Each sub-agent runs in its own isolated context, preventing the “context window explosion” typical of long chains.
    • Sub-agents can run in parallel, maximizing efficiency.
  2. State Tools (set_state, get_state):
    • Instead of passing massive context strings, agents communicate via a high-speed, in-memory Shared State (also known as a Blackboard).
    • An agent writes its output to a specific key in the blackboard (e.g., set_state(key="research_report", value="...")).
    • The next agent reads that key (e.g., get_state(key="research_report")) to retrieve information from the blackboard.
    • This keeps the communication channel lightweight while preserving the full depth of data in memory.

Deep Research Workflows

Build complex workflows where agents collaborate autonomously.

GPT-5.2 Workflow Gemini 3.0 Workflow
GPT5 Gemini 1
Gemini 2
Gemini 3
DeepSeek V3.2 Workflow Qwen Workflow LongCat Workflow
DeepSeek 1
DeepSeek 2
DeepSeek 3
Qwen LongCat 1
LongCat 2
LongCat 3

Recursive LM Workflows

Recursive LM (RLM) instructs the LLM to act as a programmer managing large datasets, using code to extract info from files snippet-by-snippet (not loading entire files), verify with code, and filter through chunks or regex while considering context window. It treats the LLM as an OS dispatching tasks to subagents (processes) with coding abilities. Subagents critique their work, save to shared memory state. Root LLM uses a judge agent to evaluate combined results from shared memory. If good, job done; else, try again with new approaches.

RLM DeepSeek Task RLM Subagent Task 1-2
RLM1 RLM2
RLM Subagent Task 3-4 RLM Judge & Summary
RLM3 RLM4

đź§  Agent Skills

Agent Skills are a lightweight, open format for extending AI agent capabilities with specialized knowledge, specialized tools, and advanced workflows. Skills are encapsulated in directories containing a SKILL.md file with metadata and instructions.

Arxiv Skill Search Paper YouTube Download Skill
Arxiv Skill YouTube Skill

Managing Skills

You can manage skills using the gllm skills command:

Skill Format

A skill is a directory containing a SKILL.md file. The file must start with YAML frontmatter:

---
name: My Skill
description: This skill does awesome stuff.
---

Detailed instructions for the agent go here...

You can also include a scripts/ directory for helper scripts and a resources/ directory for additional data files that the skill may reference.


🎨 Themes

gllm supports hundreds of popular themes, compatible with light and dark modes, ANSI-color, and full true-color.

Manage Themes

Light mode VSCode Theme Dark mode Dracula Theme
VSCode Dracula

🤖 Agent Management

Create and manage multiple AI assistant profiles with different configurations:

# Create agents for different tasks
gllm agent add coder --model gpt-4o --tools on
gllm agent add researcher --model gemini-pro --search google

# Switch between agents
gllm agent switch coder
gllm agent switch researcher

# List and manage agents
gllm agent list
gllm agent info coder
gllm agent set coder --model gpt-4

Agent Commands:


đź›  Model Context Protocol (MCP)

gllm supports the Model Context Protocol (MCP), allowing you to connect to external MCP servers to access additional tools and data sources. This enables LLMs to interact with external services, databases, and APIs through standardized protocols.

Enabling/Disabling MCP

Managing MCP Servers

You can add, configure, and manage MCP servers of different types:

Using MCP in Queries

Once MCP is enabled and servers are configured, the LLM can automatically use available MCP tools during conversations:

gllm "Use the available tools to fetch the latest info of golang version"

Use MCP Screenshot

The LLM will detect relevant MCP tools and use them to enhance its responses with external data and capabilities.


đź›  Configuration

gllm stores its configuration in a user-specific directory. You can manage the configuration using the config command.

Local Proxy

When in verbose mode, you would see the thinking content and tool call parameters. For example:

Thinking...
{
  "thought": "I need to find the latest information about the golang version. I will use the search tool to find the latest information about the golang version.",
  "tool_calls": [
    {
      "function": "search",
      "args": "latest golang version"
    }
  ]
}

Contributions are welcome! Please feel free to submit a pull request or open an issue.


{
  "author": {
    "name": "Charles Liu",    
    "url": "https://github.com/activebook",
    "page": "https://activebook.github.io"
  }
}