Skip to main content

Toolpack CLI

The Toolpack CLI is a rich interactive terminal interface built with the Toolpack SDK. It demonstrates the SDK's capabilities and can be used as a standalone AI assistant.

GitHub npm

Installation

npm install -g toolpack-cli

Or run directly with npx:

npx toolpack-cli

Features

  • Multiple AI Providers - Switch between OpenAI, Anthropic, Gemini, and Ollama
  • Model Selection - Choose from available models per provider
  • Tool Execution - Watch the AI use 77 built-in tools in real-time
  • Mode Switching - Toggle between Agent and Chat modes
  • Conversation History - Persistent chat history with SQLite
  • Streaming - Real-time token streaming with interrupt support
  • Keyboard Shortcuts - Efficient navigation and control
  • Instant Knowledge Cache - Bundled embeddings copied to ~/.toolpack/knowledge/cli so global installs skip re-indexing

Quick Start

  1. Set your API key:

    export OPENAI_API_KEY="sk-..."
  2. Run the CLI:

    toolpack
  3. Select a provider and model from the home screen

  4. Start chatting!

Keyboard Shortcuts

Home Screen

KeyAction
↑/↓Navigate options
EnterSelect
EscBack

Chat Screen

KeyAction
EnterSend message
qInterrupt streaming
↑/↓Scroll history
PgUp/PgDnScroll faster
EscReturn to home

Commands

Type these in the chat input:

CommandDescription
/helpShow available commands
/clearClear conversation history
/modeShow or switch the current mode
/modelShow or change the current model
/toolsList available tools
/tool-logShow recent tool execution log
/tool-searchSearch for a tool by name or description
/infoShow system and session info
/versionShow version information

Configuration

The CLI reads from toolpack.config.json in your current directory:

{
"systemPrompt": "You are a helpful coding assistant.",
"tools": {
"enabled": true,
"autoExecute": true
}
}

Environment Variables

VariableDescription
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
GEMINI_API_KEYGoogle Gemini API key

Building from Source

# Clone the repository
git clone https://github.com/toolpack-ai/toolpack-sdk.git
cd toolpack-sdk/samples/toolpack-cli

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build for production
npm run build
npm start

During npm run build the CLI copies the bundled knowledge assets (samples/toolpack-cli/knowledge/cli/*.json) into dist/knowledge. On first run the CLI mirrors them into ~/.toolpack/knowledge/cli, letting the PersistentKnowledgeProvider load cached embeddings immediately. Delete that directory or pass reSync: true in ToolpackContext if you need to regenerate embeddings after editing the Markdown/JSON/SQLite sources.

Architecture

The CLI is built with:

  • Ink - React for CLI interfaces
  • Toolpack SDK - AI provider abstraction and tools
  • SQLite - Conversation history persistence

It serves as both a useful tool and a reference implementation for building applications with the Toolpack SDK.