@inference-gateway/cli 0.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +1264 -0
- package/bin/install.js +125 -0
- package/bin/run.js +35 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,1264 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# Inference Gateway CLI
|
|
4
|
+
|
|
5
|
+
[](https://golang.org)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/inference-gateway/cli/actions)
|
|
8
|
+
[](https://goreportcard.com/report/github.com/inference-gateway/cli)
|
|
9
|
+
[](https://github.com/inference-gateway/cli/releases)
|
|
10
|
+
|
|
11
|
+
An agentic command-line assistant that writes code, understands project context, and uses tools to perform real tasks.
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
## ⚠️ Warning
|
|
16
|
+
|
|
17
|
+
> **Early Development Stage**: This project is in its early development
|
|
18
|
+
> stage and breaking changes are expected until it reaches a stable version.
|
|
19
|
+
>
|
|
20
|
+
> Always use pinned versions by specifying a specific version tag when
|
|
21
|
+
> downloading binaries or using install scripts.
|
|
22
|
+
|
|
23
|
+
## Table of Contents
|
|
24
|
+
|
|
25
|
+
- [Features](#features)
|
|
26
|
+
- [Installation](#installation)
|
|
27
|
+
- [Quick Start](#quick-start)
|
|
28
|
+
- [Commands](#commands)
|
|
29
|
+
- [Tools for LLMs](#tools-for-llms)
|
|
30
|
+
- [Configuration](#configuration)
|
|
31
|
+
- [Cost Tracking](#cost-tracking)
|
|
32
|
+
- [Tool Approval System](#tool-approval-system)
|
|
33
|
+
- [Shortcuts](#shortcuts)
|
|
34
|
+
- [Channels (Remote Messaging)](#channels-remote-messaging)
|
|
35
|
+
- [Heartbeat (Periodic Wake-Up)](#heartbeat-periodic-wake-up)
|
|
36
|
+
- [Global Flags](#global-flags)
|
|
37
|
+
- [Examples](#examples)
|
|
38
|
+
- [Development](#development)
|
|
39
|
+
- [License](#license)
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- **Automatic Gateway Management**: Automatically downloads and runs the Inference Gateway binary (no Docker required!)
|
|
44
|
+
- **Zero-Configuration Setup**: Start chatting immediately with just your API keys in a `.env` file
|
|
45
|
+
- **Interactive Chat**: Chat with models using an interactive interface
|
|
46
|
+
- **Status Monitoring**: Check gateway health and resource usage
|
|
47
|
+
- **Conversation History**: Store and retrieve past conversations with multiple storage backends
|
|
48
|
+
- [Conversation Storage](docs/conversation-storage.md) - Detailed storage backend documentation
|
|
49
|
+
- [Conversation Title Generation](docs/conversation-title-generation.md) - AI-powered title generation system
|
|
50
|
+
- **Conversation Versioning**: Navigate back in time to previous conversation points (double ESC)
|
|
51
|
+
- View message history with timestamps
|
|
52
|
+
- Restore conversation to any previous user message
|
|
53
|
+
- Permanent deletion of messages after restore point
|
|
54
|
+
- [Learn more →](docs/features/conversation-versioning.md)
|
|
55
|
+
- **Configuration Management**: Manage gateway settings via YAML config
|
|
56
|
+
- **Project Initialization**: Set up local project configurations
|
|
57
|
+
- **Tool Execution**: LLMs can execute whitelisted commands and tools - [See all tools →](docs/tools-reference.md)
|
|
58
|
+
- **Tool Approval System**: User approval workflow for sensitive operations with real-time diff visualization
|
|
59
|
+
- **Agent Modes**: Three operational modes for different workflows:
|
|
60
|
+
- **Standard Mode** (default): Normal operation with all configured tools and approval checks
|
|
61
|
+
- **Plan Mode**: Read-only mode for planning and analysis without execution
|
|
62
|
+
- **Auto-Accept Mode**: All tools auto-approved for rapid execution (YOLO mode)
|
|
63
|
+
- Toggle between modes with **Shift+Tab**
|
|
64
|
+
- **Token Usage Tracking**: Accurate token counting with polyfill support for providers that don't return usage metrics
|
|
65
|
+
- **Cost Tracking**: Real-time cost calculation for API usage with per-model breakdown and configurable pricing
|
|
66
|
+
- **Inline History Auto-Completion**: Smart command history suggestions with inline completion
|
|
67
|
+
- **GitHub Issue References (`#`)**: Type `#` in chat to open a dropdown of the current
|
|
68
|
+
repo's open issues. Selecting one inserts a `#N` token that is highlighted in the input
|
|
69
|
+
and, on submit, expanded inline into the issue's title, body, and recent comments - so
|
|
70
|
+
the agent works from full context without a redundant `gh issue view` lookup. Gracefully
|
|
71
|
+
no-ops when `gh` is not installed or the repo has no remote.
|
|
72
|
+
- **Customizable Keybindings**: Fully configurable keyboard shortcuts for the chat interface
|
|
73
|
+
- **Model Thinking Visualization**: When models use extended thinking,
|
|
74
|
+
their internal reasoning process is displayed as collapsible blocks above responses (toggle with **ctrl+k** by default, configurable via `display_toggle_thinking`)
|
|
75
|
+
- **Extensible Shortcuts System**: Create custom commands with AI-powered snippets - [Learn more →](docs/shortcuts-guide.md)
|
|
76
|
+
- **MCP Server Support**: Direct integration with Model Context Protocol servers for extended tool capabilities -
|
|
77
|
+
[Learn more →](docs/mcp-integration.md)
|
|
78
|
+
- **Web Terminal Interface**: Browser-based terminal access with tabbed sessions for remote access and multi-session workflows - [Learn more →](docs/web-terminal.md)
|
|
79
|
+
- **Remote Messaging Channels**: Control the agent from Telegram, WhatsApp, and other platforms via a pluggable channel system - [Learn more →](docs/channels.md)
|
|
80
|
+
- **Speech-to-Text (Whisper)**: Dictate into chat with `/voice` and transcribe inbound Telegram voice messages, locally and offline -
|
|
81
|
+
off by default - [Learn more →](docs/speech-to-text.md)
|
|
82
|
+
- **Scheduled Tasks**: Ask the agent (over Telegram, etc.) to run a prompt on a cron schedule and deliver the result back through the same channel -
|
|
83
|
+
recurring ("send me a quote every morning") or one-off ("remind me at 6pm today") - [Learn more →](docs/scheduling.md)
|
|
84
|
+
- **Heartbeat (Periodic Wake-Up)**: Wake the agent on a fixed interval to check for pending todos and background work,
|
|
85
|
+
with a separate configurable system prompt - off by default - [Learn more →](docs/heartbeat.md)
|
|
86
|
+
|
|
87
|
+
## Installation
|
|
88
|
+
|
|
89
|
+
### Using npm/npx (Recommended)
|
|
90
|
+
|
|
91
|
+
If you already have Node.js (>= 18), run the CLI with npx - no Go toolchain or manual
|
|
92
|
+
download required. The matching native binary is fetched and cached on first use:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Run without installing
|
|
96
|
+
npx @inference-gateway/cli@latest --help
|
|
97
|
+
npx @inference-gateway/cli@latest chat
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Or install it globally:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install -g @inference-gateway/cli
|
|
104
|
+
infer --help
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
> **Not recommended for production.** For production or CI, prefer the
|
|
108
|
+
> [install script](#using-install-script), [container image](#using-container-image), or
|
|
109
|
+
> [building from source](#build-from-source). Prebuilt binaries cover Linux and macOS on
|
|
110
|
+
> amd64/arm64 - on Windows, use WSL.
|
|
111
|
+
|
|
112
|
+
### Using Go Install
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
go install github.com/inference-gateway/cli@latest
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
This installs the binary as `cli`. To rename it to `infer`:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
mv $(go env GOPATH)/bin/cli $(go env GOPATH)/bin/infer
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Or use an alias:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
alias infer="$(go env GOPATH)/bin/cli"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Using Container Image
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Create network and deploy inference gateway first
|
|
134
|
+
docker network create inference-gateway
|
|
135
|
+
docker run -d --name inference-gateway --network inference-gateway \
|
|
136
|
+
--env-file .env \
|
|
137
|
+
ghcr.io/inference-gateway/inference-gateway:latest
|
|
138
|
+
|
|
139
|
+
# Pull and run the CLI
|
|
140
|
+
docker pull ghcr.io/inference-gateway/cli:latest
|
|
141
|
+
docker run -it --rm --network inference-gateway ghcr.io/inference-gateway/cli:latest chat
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Using Install Script
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Latest version
|
|
148
|
+
curl -fsSL https://raw.githubusercontent.com/inference-gateway/cli/main/install.sh | bash
|
|
149
|
+
|
|
150
|
+
# Specific version
|
|
151
|
+
curl -fsSL https://raw.githubusercontent.com/inference-gateway/cli/main/install.sh | bash -s -- --version v0.77.0
|
|
152
|
+
|
|
153
|
+
# Custom installation directory
|
|
154
|
+
curl -fsSL https://raw.githubusercontent.com/inference-gateway/cli/main/install.sh | bash -s -- --install-dir $HOME/.local/bin
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Manual Download
|
|
158
|
+
|
|
159
|
+
Download the latest release binary for your platform from the [releases page](https://github.com/inference-gateway/cli/releases).
|
|
160
|
+
|
|
161
|
+
**Verify the binary** (recommended for security):
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Download binary and checksums
|
|
165
|
+
curl -L -o infer-darwin-amd64 \
|
|
166
|
+
https://github.com/inference-gateway/cli/releases/latest/download/infer-darwin-amd64
|
|
167
|
+
curl -L -o checksums.txt \
|
|
168
|
+
https://github.com/inference-gateway/cli/releases/latest/download/checksums.txt
|
|
169
|
+
|
|
170
|
+
# Verify checksum
|
|
171
|
+
shasum -a 256 infer-darwin-amd64
|
|
172
|
+
grep infer-darwin-amd64 checksums.txt
|
|
173
|
+
|
|
174
|
+
# Install
|
|
175
|
+
chmod +x infer-darwin-amd64
|
|
176
|
+
sudo mv infer-darwin-amd64 /usr/local/bin/infer
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
For advanced verification with Cosign signatures, see [Binary Verification Guide](docs/security/binary-verification.md).
|
|
180
|
+
|
|
181
|
+
### Build from Source
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git clone https://github.com/inference-gateway/cli.git
|
|
185
|
+
cd cli
|
|
186
|
+
go build -o infer cmd/infer/main.go
|
|
187
|
+
sudo mv infer /usr/local/bin/
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Quick Start
|
|
191
|
+
|
|
192
|
+
1. **Initialize your project**:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
infer init
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
This creates a `.infer/` directory with configuration and shortcuts.
|
|
199
|
+
|
|
200
|
+
2. **Set up your environment** (create `.env` file):
|
|
201
|
+
|
|
202
|
+
```env
|
|
203
|
+
ANTHROPIC_API_KEY=your_key_here
|
|
204
|
+
OPENAI_API_KEY=your_key_here
|
|
205
|
+
DEEPSEEK_API_KEY=your_key_here
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
3. **Start chatting**:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
infer chat
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Next Steps
|
|
215
|
+
|
|
216
|
+
Now that you're up and running, explore these guides:
|
|
217
|
+
|
|
218
|
+
- **[Commands Reference](docs/commands-reference.md)** - Complete command documentation
|
|
219
|
+
- **[Tools Reference](docs/tools-reference.md)** - Available tools for LLMs
|
|
220
|
+
- **[Configuration Guide](docs/configuration-reference.md)** - Full configuration options
|
|
221
|
+
- **[Directory Structure](docs/directory-structure.md)** - Map of every file and subdirectory the CLI creates under `.infer/` and `~/.infer/`
|
|
222
|
+
- **[Web Terminal](docs/web-terminal.md)** - Browser-based terminal interface
|
|
223
|
+
- **[Shortcuts Guide](docs/shortcuts-guide.md)** - Custom shortcuts and AI-powered snippets
|
|
224
|
+
- **[A2A Agents](docs/agents-configuration.md)** - Agent-to-agent communication setup
|
|
225
|
+
|
|
226
|
+
## Claude Code Mode (Subscription)
|
|
227
|
+
|
|
228
|
+
Save on API costs by using your Claude Max or Pro subscription instead of pay-as-you-go API pricing.
|
|
229
|
+
|
|
230
|
+
### Overview
|
|
231
|
+
|
|
232
|
+
Claude Code mode enables you to use your **Claude Max or Pro subscription** ($100-200/month fixed cost)
|
|
233
|
+
instead of paying per token via the Anthropic API. This is ideal for heavy users who want
|
|
234
|
+
predictable monthly costs.
|
|
235
|
+
|
|
236
|
+
**Cost Comparison:**
|
|
237
|
+
|
|
238
|
+
| Mode | Pricing | Best For |
|
|
239
|
+
| -------------------- | --------------------------------------- | --------------------------------------- |
|
|
240
|
+
| **Gateway Mode** | Pay per token ($3-$75 per million) | API users, multi-provider needs |
|
|
241
|
+
| **Claude Code Mode** | Fixed monthly ($100-200) | Heavy Claude users, cost predictability |
|
|
242
|
+
|
|
243
|
+
### Prerequisites
|
|
244
|
+
|
|
245
|
+
- **Claude Max or Pro subscription** - Required ($100-200/month)
|
|
246
|
+
- **Claude Code CLI** - Official CLI from Anthropic
|
|
247
|
+
|
|
248
|
+
Install the Claude Code CLI:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npm install -g @anthropic-ai/claude-code
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Setup
|
|
255
|
+
|
|
256
|
+
1. **Configure for Claude Code mode**:
|
|
257
|
+
|
|
258
|
+
Edit `.infer/config.yaml`:
|
|
259
|
+
|
|
260
|
+
```yaml
|
|
261
|
+
# Enable Claude Code mode
|
|
262
|
+
claude_code:
|
|
263
|
+
enabled: true
|
|
264
|
+
cli_path: claude # or /usr/local/bin/claude if not in PATH
|
|
265
|
+
timeout: 600
|
|
266
|
+
max_output_tokens: 32000
|
|
267
|
+
thinking_budget: 10000
|
|
268
|
+
|
|
269
|
+
# Disable gateway mode
|
|
270
|
+
gateway:
|
|
271
|
+
run: false
|
|
272
|
+
|
|
273
|
+
# Set model (no provider prefix needed)
|
|
274
|
+
agent:
|
|
275
|
+
model: claude-sonnet-4-5-20250929
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
2. **Authenticate with your subscription**:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
infer claude-code setup
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
This opens your browser to authenticate with your Claude Max/Pro account.
|
|
285
|
+
|
|
286
|
+
3. **Verify authentication**:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
infer claude-code test
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
4. **Use normally**:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
infer chat # Now using your subscription!
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Available Commands
|
|
299
|
+
|
|
300
|
+
- `infer claude-code setup` - Authenticate with Claude subscription
|
|
301
|
+
- `infer claude-code test` - Test authentication and CLI integration
|
|
302
|
+
|
|
303
|
+
### Configuration Options
|
|
304
|
+
|
|
305
|
+
```yaml
|
|
306
|
+
claude_code:
|
|
307
|
+
enabled: true # Enable/disable Claude Code mode
|
|
308
|
+
cli_path: claude # Path to claude binary
|
|
309
|
+
timeout: 600 # Command timeout in seconds
|
|
310
|
+
max_output_tokens: 32000 # Maximum output tokens per request
|
|
311
|
+
thinking_budget: 10000 # Token budget for extended thinking
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Environment Variables:**
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
export INFER_CLAUDE_CODE_ENABLED=true
|
|
318
|
+
export INFER_CLAUDE_CODE_CLI_PATH=/usr/local/bin/claude
|
|
319
|
+
export INFER_CLAUDE_CODE_TIMEOUT=600
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Features and Limitations
|
|
323
|
+
|
|
324
|
+
| Feature | Gateway Mode | Claude Code Mode |
|
|
325
|
+
| --------------------- | --------------------------------------- | ---------------------------------------- |
|
|
326
|
+
| **Cost** | Pay-per-token | Fixed monthly |
|
|
327
|
+
| **Providers** | All providers (Anthropic, OpenAI, etc.) | Claude only |
|
|
328
|
+
| **Models** | All provider models | Claude models only |
|
|
329
|
+
| **Images** | ✓ Supported | ✗ Not supported (stripped from messages) |
|
|
330
|
+
| **Prompt Caching** | ✓ Supported | ✗ Not available via CLI |
|
|
331
|
+
| **Streaming** | ✓ Supported | ✓ Supported |
|
|
332
|
+
| **Tool Execution** | ✓ Supported | ✓ Supported |
|
|
333
|
+
| **Extended Thinking** | ✓ Supported | ✓ Supported |
|
|
334
|
+
| **Authentication** | API keys | Browser login |
|
|
335
|
+
|
|
336
|
+
**Supported Models:**
|
|
337
|
+
|
|
338
|
+
The following Claude models are available via Claude Code subscription mode:
|
|
339
|
+
|
|
340
|
+
**Claude 4.5 Series (Latest):**
|
|
341
|
+
|
|
342
|
+
- `claude-opus-4-5` - Most capable Claude model (vision support)
|
|
343
|
+
- `claude-haiku-4-5-20251001` - Fastest Claude model (vision support)
|
|
344
|
+
- `claude-sonnet-4-5-20250929` - Latest Sonnet model (default, vision support)
|
|
345
|
+
|
|
346
|
+
**Claude 4.1 Series:**
|
|
347
|
+
|
|
348
|
+
- `claude-opus-4-1-20250805` - Claude 4.1 Opus (vision support)
|
|
349
|
+
- `claude-sonnet-4-1-20250805` - Claude 4.1 Sonnet (vision support)
|
|
350
|
+
|
|
351
|
+
**Claude 4 Series:**
|
|
352
|
+
|
|
353
|
+
- `claude-opus-4-20250514` - Claude 4 Opus (vision support)
|
|
354
|
+
- `claude-sonnet-4-20250514` - Claude 4 Sonnet (vision support)
|
|
355
|
+
|
|
356
|
+
**Claude 3.7 Series:**
|
|
357
|
+
|
|
358
|
+
- `claude-3-7-sonnet-20250219` - Claude 3.7 Sonnet (vision support)
|
|
359
|
+
|
|
360
|
+
**Claude 3.5 Series:**
|
|
361
|
+
|
|
362
|
+
- `claude-3-5-haiku-20241022` - Claude 3.5 Haiku (vision support)
|
|
363
|
+
|
|
364
|
+
**Claude 3 Series:**
|
|
365
|
+
|
|
366
|
+
- `claude-3-haiku-20240307` - Claude 3 Haiku (vision support)
|
|
367
|
+
- `claude-3-opus-20240229` - Claude 3 Opus (vision support)
|
|
368
|
+
|
|
369
|
+
**Note:** All modern Claude models support vision capabilities. The Claude Code CLI automatically strips images
|
|
370
|
+
from messages when using subscription mode.
|
|
371
|
+
|
|
372
|
+
### Troubleshooting
|
|
373
|
+
|
|
374
|
+
**CLI Not Found:**
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
# Check if Claude CLI is installed
|
|
378
|
+
which claude
|
|
379
|
+
|
|
380
|
+
# If not found, install it
|
|
381
|
+
npm install -g @anthropic-ai/claude-code
|
|
382
|
+
|
|
383
|
+
# Or set custom path in config
|
|
384
|
+
claude_code:
|
|
385
|
+
cli_path: /full/path/to/claude
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
**Authentication Issues:**
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
# Re-authenticate
|
|
392
|
+
infer claude-code setup
|
|
393
|
+
|
|
394
|
+
# Test authentication
|
|
395
|
+
infer claude-code test
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**Update CLI:**
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
npm update -g @anthropic-ai/claude-code
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Switching Between Modes
|
|
405
|
+
|
|
406
|
+
You can easily switch between gateway and Claude Code modes:
|
|
407
|
+
|
|
408
|
+
**To Claude Code mode:**
|
|
409
|
+
|
|
410
|
+
```yaml
|
|
411
|
+
# .infer/config.yaml
|
|
412
|
+
claude_code:
|
|
413
|
+
enabled: true
|
|
414
|
+
gateway:
|
|
415
|
+
run: false
|
|
416
|
+
agent:
|
|
417
|
+
model: claude-sonnet-4-5-20250929 # No provider prefix
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**To Gateway mode:**
|
|
421
|
+
|
|
422
|
+
```yaml
|
|
423
|
+
# .infer/config.yaml
|
|
424
|
+
claude_code:
|
|
425
|
+
enabled: false
|
|
426
|
+
gateway:
|
|
427
|
+
run: true
|
|
428
|
+
agent:
|
|
429
|
+
model: anthropic/claude-sonnet-4-5-20250929 # With provider prefix
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Commands
|
|
433
|
+
|
|
434
|
+
The CLI provides several commands for different workflows. For detailed documentation, see [Commands Reference](docs/commands-reference.md).
|
|
435
|
+
|
|
436
|
+
### Core Commands
|
|
437
|
+
|
|
438
|
+
**`infer init`** - Initialize a new project with configuration and shortcuts
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
infer init # Initialize project configuration
|
|
442
|
+
infer init --userspace # Initialize user-level configuration
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**`infer chat`** - Start an interactive chat session with model selection
|
|
446
|
+
|
|
447
|
+
```bash
|
|
448
|
+
# Terminal mode (default)
|
|
449
|
+
infer chat
|
|
450
|
+
|
|
451
|
+
# Web terminal mode with browser interface
|
|
452
|
+
infer chat --web
|
|
453
|
+
infer chat --web --port 8080 # Custom port
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
**Features:** Model selection, real-time streaming, scrollable history, three agent modes (Standard/Plan/Auto-Accept).
|
|
457
|
+
|
|
458
|
+
**Web Mode Features:**
|
|
459
|
+
|
|
460
|
+
- Browser-based terminal using xterm.js
|
|
461
|
+
- Multiple independent tabbed sessions
|
|
462
|
+
- Automatic session cleanup on inactivity
|
|
463
|
+
- Each tab manages its own `infer chat` process with isolated containers
|
|
464
|
+
- Access from any device on the network
|
|
465
|
+
- Responsive terminal sizing with horizontal padding
|
|
466
|
+
|
|
467
|
+
**`infer agent`** - Execute autonomous tasks in background mode
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
# Start new agent sessions
|
|
471
|
+
infer agent "Please fix the github issue 38"
|
|
472
|
+
infer agent --model "openai/gpt-4" "Implement feature from issue #42"
|
|
473
|
+
infer agent "Analyze this UI issue" --files screenshot.png
|
|
474
|
+
|
|
475
|
+
# Resume existing sessions
|
|
476
|
+
infer conversations list # Find session IDs
|
|
477
|
+
infer agent "continue fixing the bug" --session-id abc-123-def
|
|
478
|
+
infer agent "analyze new logs" --session-id abc-123 --files error.log
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Features:** Autonomous execution, multimodal support (images/files), parallel tool execution, **session resumption**.
|
|
482
|
+
|
|
483
|
+
### Configuration Commands
|
|
484
|
+
|
|
485
|
+
**`infer config`** - Manage CLI configuration settings
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# Read any value (effective config: defaults + ~/.infer + .infer + env)
|
|
489
|
+
infer config get agent.model
|
|
490
|
+
infer config get # dump the whole effective config
|
|
491
|
+
|
|
492
|
+
# Agent configuration
|
|
493
|
+
infer config set agent.model "deepseek/deepseek-v4-pro"
|
|
494
|
+
infer config set agent.max_turns 100
|
|
495
|
+
infer config set agent.verbose_tools true
|
|
496
|
+
|
|
497
|
+
# Tool management
|
|
498
|
+
infer config set tools.enabled true
|
|
499
|
+
infer config set tools.bash.enabled true
|
|
500
|
+
infer config set tools.safety.require_approval true
|
|
501
|
+
|
|
502
|
+
# Export configuration
|
|
503
|
+
infer config set export.summary_model "anthropic/claude-4.1-haiku"
|
|
504
|
+
|
|
505
|
+
# Write to userspace (~/.infer/config.yaml) instead of the project
|
|
506
|
+
infer config set agent.model "openai/gpt-4o" --userspace
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
> System prompts live in `prompts.yaml` (e.g. `prompts.agent.system_prompt`), not
|
|
510
|
+
> in `config.yaml`, so they are edited there rather than via `config set`.
|
|
511
|
+
|
|
512
|
+
See [Commands Reference](docs/commands-reference.md#configuration-management) for all configuration options.
|
|
513
|
+
|
|
514
|
+
### Agent Management
|
|
515
|
+
|
|
516
|
+
**`infer agents`** - Manage A2A (Agent-to-Agent) agent configurations
|
|
517
|
+
|
|
518
|
+
```bash
|
|
519
|
+
infer agents init # Initialize agents configuration
|
|
520
|
+
infer agents add browser-agent # Add an agent from the registry with defaults
|
|
521
|
+
infer agents add custom https://... # Add a custom agent
|
|
522
|
+
infer agents list # List all agents
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
For detailed A2A setup, see [A2A Agents Configuration](docs/agents-configuration.md).
|
|
526
|
+
|
|
527
|
+
### Utility Commands
|
|
528
|
+
|
|
529
|
+
**`infer status`** - Check gateway health and resource usage
|
|
530
|
+
|
|
531
|
+
```bash
|
|
532
|
+
infer status
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**`infer conversations`** - List and manage conversation history
|
|
536
|
+
|
|
537
|
+
```bash
|
|
538
|
+
infer conversations list # List all saved conversations
|
|
539
|
+
infer conversations list --limit 20 # List first 20 conversations
|
|
540
|
+
infer conversations list --offset 40 -l 20 # Paginate: conversations 41-60
|
|
541
|
+
infer conversations list --format json # Output as JSON
|
|
542
|
+
|
|
543
|
+
infer conversations show <session-id> # Show a conversation's entries
|
|
544
|
+
infer conversations show <session-id> --include-hidden # Include hidden entries (e.g. system reminders)
|
|
545
|
+
infer conversations show <session-id> --format json # One JSON object per line (jq-friendly)
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
**`infer conversation-title`** - Manage AI-powered conversation titles
|
|
549
|
+
|
|
550
|
+
```bash
|
|
551
|
+
infer conversation-title generate # Generate titles for all conversations
|
|
552
|
+
infer conversation-title status # Show generation status
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
**`infer version`** - Display CLI version information
|
|
556
|
+
|
|
557
|
+
```bash
|
|
558
|
+
infer version
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
## Tools for LLMs
|
|
562
|
+
|
|
563
|
+
When tool execution is enabled, LLMs can use various tools to interact with your system. Below is a
|
|
564
|
+
summary of available tools. For detailed documentation, parameters, and examples, see
|
|
565
|
+
[Tools Reference](docs/tools-reference.md).
|
|
566
|
+
|
|
567
|
+
| Tool | Purpose | Approval Required | Documentation |
|
|
568
|
+
| ------ | --------- | ------------------- | --------------- |
|
|
569
|
+
| **Bash** | Execute whitelisted shell commands | Optional | [Details](docs/tools-reference.md#bash-tool) |
|
|
570
|
+
| **Read** | Read file contents with line ranges | No | [Details](docs/tools-reference.md#read-tool) |
|
|
571
|
+
| **Write** | Write content to files | Yes | [Details](docs/tools-reference.md#write-tool) |
|
|
572
|
+
| **Edit** | Exact string replacements in files | Yes | [Details](docs/tools-reference.md#edit-tool) |
|
|
573
|
+
| **MultiEdit** | Multiple atomic edits to files | Yes | [Details](docs/tools-reference.md#multiedit-tool) |
|
|
574
|
+
| **Delete** | Delete files and directories | Yes | [Details](docs/tools-reference.md#delete-tool) |
|
|
575
|
+
| **Tree** | Display directory structure | No | [Details](docs/tools-reference.md#tree-tool) |
|
|
576
|
+
| **Grep** | Search files with regex (ripgrep/Go) | No | [Details](docs/tools-reference.md#grep-tool) |
|
|
577
|
+
| **WebSearch** | Search the web (DuckDuckGo/Google) | No | [Details](docs/tools-reference.md#websearch-tool) |
|
|
578
|
+
| **WebFetch** | Fetch content from URLs | No | [Details](docs/tools-reference.md#webfetch-tool) |
|
|
579
|
+
| **Github** | Interact with GitHub API | No | [Details](docs/tools-reference.md#github-tool) |
|
|
580
|
+
| **TodoWrite** | Create and manage task lists | No | [Details](docs/tools-reference.md#todowrite-tool) |
|
|
581
|
+
| **Schedule** | Cron-driven recurring or one-off tasks delivered via the originating channel | Yes | [Details](docs/tools-reference.md#schedule-tool) |
|
|
582
|
+
| **A2A_SubmitTask** | Submit tasks to A2A agents | No | [Details](docs/tools-reference.md#a2a_submittask-tool) |
|
|
583
|
+
| **A2A_QueryAgent** | Query A2A agent capabilities | No | [Details](docs/tools-reference.md#a2a_queryagent-tool) |
|
|
584
|
+
| **A2A_QueryTask** | Check A2A task status | No | [Details](docs/tools-reference.md#a2a_querytask-tool) |
|
|
585
|
+
|
|
586
|
+
**Tool Configuration:**
|
|
587
|
+
|
|
588
|
+
Tools can be enabled/disabled and configured individually:
|
|
589
|
+
|
|
590
|
+
```bash
|
|
591
|
+
# Enable/disable specific tools
|
|
592
|
+
infer config set tools.bash.enabled true
|
|
593
|
+
infer config set tools.write.enabled true
|
|
594
|
+
|
|
595
|
+
# Configure tool settings
|
|
596
|
+
infer config set tools.grep.backend ripgrep
|
|
597
|
+
# List values are comma-separated and replace the whole list
|
|
598
|
+
infer config set tools.web_fetch.whitelisted_domains "example.com,github.com"
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
**Customising Tool Descriptions:**
|
|
602
|
+
|
|
603
|
+
The description each tool exposes to the LLM is configurable in
|
|
604
|
+
`.infer/prompts.yaml` under the `tools` key - useful when a model
|
|
605
|
+
misinterprets a default or when you want to nudge usage:
|
|
606
|
+
|
|
607
|
+
```yaml
|
|
608
|
+
# .infer/prompts.yaml
|
|
609
|
+
tools:
|
|
610
|
+
Bash:
|
|
611
|
+
description: |-
|
|
612
|
+
Execute whitelisted bash commands securely. Only pre-approved
|
|
613
|
+
commands from the whitelist can be executed.
|
|
614
|
+
Read:
|
|
615
|
+
description: |-
|
|
616
|
+
Reads a file from the local filesystem. Always prefer reading
|
|
617
|
+
whole files unless the file is very large.
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
Any tool you omit falls back to the in-code default. Env-var override:
|
|
621
|
+
`INFER_PROMPTS_TOOLS_<UPPER_SNAKE_NAME>_DESCRIPTION` (e.g.
|
|
622
|
+
`INFER_PROMPTS_TOOLS_BASH_DESCRIPTION`). MCP tool descriptions are not
|
|
623
|
+
configurable here - they come from the MCP server at runtime.
|
|
624
|
+
|
|
625
|
+
See [Tools Reference](docs/tools-reference.md) for complete documentation.
|
|
626
|
+
|
|
627
|
+
## Configuration
|
|
628
|
+
|
|
629
|
+
The CLI uses a powerful 2-layer configuration system with environment variable support.
|
|
630
|
+
|
|
631
|
+
### Configuration Quick Start
|
|
632
|
+
|
|
633
|
+
Create a minimal configuration:
|
|
634
|
+
|
|
635
|
+
```yaml
|
|
636
|
+
# .infer/config.yaml
|
|
637
|
+
gateway:
|
|
638
|
+
url: http://localhost:8080
|
|
639
|
+
docker: true # Use Docker mode (or false for binary mode)
|
|
640
|
+
|
|
641
|
+
tools:
|
|
642
|
+
enabled: true
|
|
643
|
+
bash:
|
|
644
|
+
enabled: true
|
|
645
|
+
|
|
646
|
+
agent:
|
|
647
|
+
model: "deepseek/deepseek-v4-pro"
|
|
648
|
+
system_prompt: "You are a helpful assistant" # Base identity
|
|
649
|
+
custom_instructions: "" # Additional instructions appended to system prompt
|
|
650
|
+
max_turns: 50
|
|
651
|
+
|
|
652
|
+
chat:
|
|
653
|
+
theme: tokyo-night
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### Configuration Layers
|
|
657
|
+
|
|
658
|
+
1. **Environment Variables** (`INFER_*`) - Highest priority
|
|
659
|
+
2. **Command Line Flags**
|
|
660
|
+
3. **Project Config** (`.infer/config.yaml`)
|
|
661
|
+
4. **Userspace Config** (`~/.infer/config.yaml`)
|
|
662
|
+
5. **Built-in Defaults** - Lowest priority
|
|
663
|
+
|
|
664
|
+
**Example:**
|
|
665
|
+
|
|
666
|
+
```bash
|
|
667
|
+
# Set via environment variable (highest priority)
|
|
668
|
+
export INFER_AGENT_MODEL="openai/gpt-4"
|
|
669
|
+
|
|
670
|
+
# Or via config file
|
|
671
|
+
infer config set agent.model "deepseek/deepseek-v4-pro"
|
|
672
|
+
|
|
673
|
+
# Or via command flag
|
|
674
|
+
infer chat --model "anthropic/claude-4"
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
### Key Configuration Options
|
|
678
|
+
|
|
679
|
+
- **gateway.url** - Gateway URL (default: `http://localhost:8080`)
|
|
680
|
+
- **gateway.docker** - Use Docker mode vs binary mode (default: `true`)
|
|
681
|
+
- **tools.enabled** - Enable/disable all tools (default: `true`)
|
|
682
|
+
- **agent.model** - Default model for agent operations
|
|
683
|
+
- **agent.system_prompt** - Base identity for the agent (e.g., `"You are a helpful assistant"`)
|
|
684
|
+
- **agent.custom_instructions** - Additional instructions appended after the system prompt
|
|
685
|
+
- **agent.max_turns** - Maximum turns for agent sessions (default: `50`)
|
|
686
|
+
- **chat.theme** - Chat interface theme (default: `tokyo-night`)
|
|
687
|
+
- **chat.status_bar.enabled** - Enable/disable status bar (default: `true`)
|
|
688
|
+
- **chat.status_bar.indicators** - Configure individual status indicators (all enabled by default except `max_output`)
|
|
689
|
+
- **web.enabled** - Enable web terminal mode (default: `false`)
|
|
690
|
+
- **web.port** - Web server port (default: `3000`)
|
|
691
|
+
- **web.host** - Web server host (default: `localhost`)
|
|
692
|
+
- **web.session_inactivity_mins** - Session timeout in minutes (default: `5`)
|
|
693
|
+
|
|
694
|
+
### Environment Variables
|
|
695
|
+
|
|
696
|
+
All configuration can be set via environment variables with the `INFER_` prefix:
|
|
697
|
+
|
|
698
|
+
```bash
|
|
699
|
+
export INFER_GATEWAY_URL="http://localhost:8080"
|
|
700
|
+
export INFER_AGENT_MODEL="deepseek/deepseek-v4-pro"
|
|
701
|
+
export INFER_TOOLS_BASH_ENABLED=true
|
|
702
|
+
export INFER_CHAT_THEME="tokyo-night"
|
|
703
|
+
|
|
704
|
+
# Web terminal configuration
|
|
705
|
+
export INFER_WEB_PORT=3000
|
|
706
|
+
export INFER_WEB_HOST="localhost"
|
|
707
|
+
export INFER_WEB_SESSION_INACTIVITY_MINS=5
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
**Format:** `INFER_<PATH>` where dots become underscores.
|
|
711
|
+
Example: `agent.model` → `INFER_AGENT_MODEL`
|
|
712
|
+
|
|
713
|
+
For complete configuration documentation, including all options and environment variables, see [Configuration Reference](docs/configuration-reference.md).
|
|
714
|
+
|
|
715
|
+
## Cost Tracking
|
|
716
|
+
|
|
717
|
+
The CLI automatically tracks API costs based on token usage for all providers and models.
|
|
718
|
+
Costs are calculated in real-time with support for both aggregate totals and per-model breakdowns.
|
|
719
|
+
|
|
720
|
+
### Viewing Costs
|
|
721
|
+
|
|
722
|
+
Use the `/cost` command in any chat session to see the cost breakdown:
|
|
723
|
+
|
|
724
|
+
```bash
|
|
725
|
+
# In chat, use the /cost shortcut
|
|
726
|
+
/cost
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
This displays:
|
|
730
|
+
|
|
731
|
+
- **Total session cost** in USD
|
|
732
|
+
- **Input/output costs** separately
|
|
733
|
+
- **Per-model breakdown** when using multiple models
|
|
734
|
+
- **Token usage** for each model
|
|
735
|
+
|
|
736
|
+
**Status Bar**: Session costs are also displayed in the status bar (e.g., `💰 $0.0234`) if enabled.
|
|
737
|
+
|
|
738
|
+
### Configuring Pricing
|
|
739
|
+
|
|
740
|
+
The CLI includes hardcoded pricing for 30+ models across all major providers
|
|
741
|
+
(Anthropic, OpenAI, Google, DeepSeek, Groq, Mistral, Cohere, etc.).
|
|
742
|
+
Prices are updated regularly to match current provider pricing.
|
|
743
|
+
|
|
744
|
+
The model picker groups models into three categories you can filter with the
|
|
745
|
+
`[1] All` / `[2] Free` / `[3] Paid` / `[4] Pro` tabs:
|
|
746
|
+
|
|
747
|
+
- **Free** - no per-token cost (e.g. local Ollama, Gemma).
|
|
748
|
+
- **Paid** - billed per token at the listed `$input/$output per MTok` rate.
|
|
749
|
+
- **Pro** - gated behind a paid **Pro subscription** (some Ollama Cloud models).
|
|
750
|
+
These have no per-token price but are not free, so they are marked
|
|
751
|
+
`pro subscription` instead of `free` to avoid the misleading label.
|
|
752
|
+
|
|
753
|
+
**Override pricing** for specific models or add pricing for custom models:
|
|
754
|
+
|
|
755
|
+
```yaml
|
|
756
|
+
# .infer/config.yaml
|
|
757
|
+
pricing:
|
|
758
|
+
enabled: true
|
|
759
|
+
currency: "USD"
|
|
760
|
+
custom_prices:
|
|
761
|
+
# Override existing model pricing
|
|
762
|
+
"openai/gpt-4o":
|
|
763
|
+
input_price_per_mtoken: 2.50 # Price per million input tokens
|
|
764
|
+
output_price_per_mtoken: 10.00 # Price per million output tokens
|
|
765
|
+
|
|
766
|
+
# Add pricing for custom/local models
|
|
767
|
+
"ollama/llama3.2":
|
|
768
|
+
input_price_per_mtoken: 0.0
|
|
769
|
+
output_price_per_mtoken: 0.0
|
|
770
|
+
|
|
771
|
+
"custom-fine-tuned-model":
|
|
772
|
+
input_price_per_mtoken: 5.00
|
|
773
|
+
output_price_per_mtoken: 15.00
|
|
774
|
+
|
|
775
|
+
# Mark a model as Pro-subscription only (no per-token cost, but gated)
|
|
776
|
+
"ollama_cloud/deepseek-v4-pro":
|
|
777
|
+
input_price_per_mtoken: 0.0
|
|
778
|
+
output_price_per_mtoken: 0.0
|
|
779
|
+
requires_pro: true
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
> **Note:** A custom entry fully replaces the default for that model. Omitting
|
|
783
|
+
> `requires_pro` in a custom override resets it to `false`, so re-state
|
|
784
|
+
> `requires_pro: true` if you override a model the CLI flags as Pro by default.
|
|
785
|
+
|
|
786
|
+
**Via environment variables:**
|
|
787
|
+
|
|
788
|
+
```bash
|
|
789
|
+
# Disable cost tracking entirely
|
|
790
|
+
export INFER_PRICING_ENABLED=false
|
|
791
|
+
|
|
792
|
+
# Override specific model pricing (use underscores in model names)
|
|
793
|
+
export INFER_PRICING_CUSTOM_PRICES_OPENAI_GPT_4O_INPUT_PRICE_PER_MTOKEN=3.00
|
|
794
|
+
export INFER_PRICING_CUSTOM_PRICES_OPENAI_GPT_4O_OUTPUT_PRICE_PER_MTOKEN=12.00
|
|
795
|
+
|
|
796
|
+
# Hide cost from status bar
|
|
797
|
+
export INFER_CHAT_STATUS_BAR_INDICATORS_COST=false
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
**Status Bar Configuration:**
|
|
801
|
+
|
|
802
|
+
```yaml
|
|
803
|
+
# .infer/config.yaml
|
|
804
|
+
chat:
|
|
805
|
+
status_bar:
|
|
806
|
+
enabled: true
|
|
807
|
+
indicators:
|
|
808
|
+
cost: true # Show/hide cost indicator
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
### Cost Calculation
|
|
812
|
+
|
|
813
|
+
- Costs are calculated as: `(tokens / 1,000,000) × price_per_million_tokens`
|
|
814
|
+
- Prices are per million tokens (input and output priced separately)
|
|
815
|
+
- Models without pricing data (Ollama, free tiers) show $0.00
|
|
816
|
+
- Token counts use actual usage from providers or polyfilled estimates
|
|
817
|
+
|
|
818
|
+
## Tool Approval System
|
|
819
|
+
|
|
820
|
+
The CLI includes a comprehensive approval system for sensitive tool operations, providing security and
|
|
821
|
+
visibility into what actions LLMs are taking.
|
|
822
|
+
|
|
823
|
+
### How It Works
|
|
824
|
+
|
|
825
|
+
When a tool requiring approval is executed:
|
|
826
|
+
|
|
827
|
+
1. **Validation**: Tool arguments are validated
|
|
828
|
+
2. **Approval Prompt**: User sees tool details with:
|
|
829
|
+
- Tool name and parameters
|
|
830
|
+
- Real-time diff preview (for file modifications)
|
|
831
|
+
- Approve/Reject/Auto-approve options
|
|
832
|
+
3. **Execution**: Tool runs only if approved
|
|
833
|
+
|
|
834
|
+
### Default Approval Requirements
|
|
835
|
+
|
|
836
|
+
| Tool | Requires Approval | Reason |
|
|
837
|
+
| ------ | ------------------- | --------- |
|
|
838
|
+
| Write | Yes | Creates/modifies files |
|
|
839
|
+
| Edit | Yes | Modifies file contents |
|
|
840
|
+
| MultiEdit | Yes | Multiple file modifications |
|
|
841
|
+
| Delete | Yes | Removes files/directories |
|
|
842
|
+
| Bash | Optional | Executes system commands |
|
|
843
|
+
| Read, Grep, Tree | No | Read-only operations |
|
|
844
|
+
| WebSearch, WebFetch | No | External read-only |
|
|
845
|
+
| A2A Tools | No | Agent delegation |
|
|
846
|
+
|
|
847
|
+
### Approval Configuration
|
|
848
|
+
|
|
849
|
+
Configure approval requirements per tool:
|
|
850
|
+
|
|
851
|
+
```bash
|
|
852
|
+
# Enable/disable approval for specific tools
|
|
853
|
+
infer config set tools.safety.require_approval true # Global approval
|
|
854
|
+
infer config set tools.bash.enabled true # Enable bash tool
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
Or via configuration file:
|
|
858
|
+
|
|
859
|
+
```yaml
|
|
860
|
+
tools:
|
|
861
|
+
safety:
|
|
862
|
+
require_approval: true # Global default
|
|
863
|
+
write:
|
|
864
|
+
require_approval: true
|
|
865
|
+
bash:
|
|
866
|
+
require_approval: false # Override for bash
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
### Approval UI Controls
|
|
870
|
+
|
|
871
|
+
- **y / Enter** - Approve execution
|
|
872
|
+
- **n / Esc** - Reject execution
|
|
873
|
+
- **a** - Auto-approve (disables approval for session)
|
|
874
|
+
|
|
875
|
+
## Shortcuts
|
|
876
|
+
|
|
877
|
+
The CLI provides an extensible shortcuts system for quickly executing common commands with `/shortcut-name` syntax.
|
|
878
|
+
|
|
879
|
+
**Subcommands:** Shortcuts can have subcommands for organized command groups (e.g., `/git status`,
|
|
880
|
+
`/scm issues`). This allows related operations to be grouped under a single shortcut name with multiple
|
|
881
|
+
actions.
|
|
882
|
+
|
|
883
|
+
### Built-in Shortcuts
|
|
884
|
+
|
|
885
|
+
**Core:**
|
|
886
|
+
|
|
887
|
+
- `/clear` - Clear conversation history
|
|
888
|
+
- `/exit` - Exit chat session
|
|
889
|
+
- `/help [shortcut]` - Show available shortcuts
|
|
890
|
+
- `/switch` - Switch to different model
|
|
891
|
+
- `/theme` - Switch chat theme
|
|
892
|
+
- `/cost` - Show session cost breakdown with per-model details
|
|
893
|
+
- `/compact` - Compact conversation
|
|
894
|
+
- `/copy [format]` - Copy current conversation to the system clipboard (text, markdown, or json)
|
|
895
|
+
- `/voice [seconds]` - Record from the microphone and transcribe to the input field with Whisper (requires `speech_to_text.enabled`)
|
|
896
|
+
- `/export` - Export conversation
|
|
897
|
+
|
|
898
|
+
**Git Shortcuts** (created by `infer init`):
|
|
899
|
+
|
|
900
|
+
- `/git status` - Show working tree status
|
|
901
|
+
- `/git commit` - Generate AI commit message from staged changes
|
|
902
|
+
- `/git push` - Push commits to remote
|
|
903
|
+
- `/git log` - Show commit logs
|
|
904
|
+
|
|
905
|
+
**SCM Shortcuts** (GitHub integration):
|
|
906
|
+
|
|
907
|
+
- `/scm issues` - List GitHub issues
|
|
908
|
+
- `/scm issue <number>` - Show issue details
|
|
909
|
+
- `/scm pr-create [context]` - Generate AI-powered PR plan
|
|
910
|
+
|
|
911
|
+
### AI-Powered Snippets
|
|
912
|
+
|
|
913
|
+
Create shortcuts that use LLMs to transform data:
|
|
914
|
+
|
|
915
|
+
```yaml
|
|
916
|
+
# .infer/shortcuts/custom-example.yaml
|
|
917
|
+
shortcuts:
|
|
918
|
+
- name: analyze-diff
|
|
919
|
+
description: "Analyze git diff with AI"
|
|
920
|
+
command: bash
|
|
921
|
+
args:
|
|
922
|
+
- -c
|
|
923
|
+
- |
|
|
924
|
+
diff=$(git diff)
|
|
925
|
+
jq -n --arg diff "$diff" '{diff: $diff}'
|
|
926
|
+
snippet:
|
|
927
|
+
prompt: |
|
|
928
|
+
Analyze this diff and suggest improvements:
|
|
929
|
+
```diff
|
|
930
|
+
{diff}
|
|
931
|
+
```
|
|
932
|
+
template: |
|
|
933
|
+
## Analysis
|
|
934
|
+
{llm}
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
### Custom Shortcuts
|
|
938
|
+
|
|
939
|
+
Create custom shortcuts by adding YAML files to `.infer/shortcuts/`:
|
|
940
|
+
|
|
941
|
+
```yaml
|
|
942
|
+
# .infer/shortcuts/custom-dev.yaml
|
|
943
|
+
shortcuts:
|
|
944
|
+
- name: tests
|
|
945
|
+
description: "Run all tests"
|
|
946
|
+
command: go
|
|
947
|
+
args:
|
|
948
|
+
- test
|
|
949
|
+
- ./...
|
|
950
|
+
|
|
951
|
+
- name: build
|
|
952
|
+
description: "Build the project"
|
|
953
|
+
command: go
|
|
954
|
+
args:
|
|
955
|
+
- build
|
|
956
|
+
- -o
|
|
957
|
+
- infer
|
|
958
|
+
- .
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
**With Subcommands:**
|
|
962
|
+
|
|
963
|
+
```yaml
|
|
964
|
+
# .infer/shortcuts/custom-docker.yaml
|
|
965
|
+
shortcuts:
|
|
966
|
+
- name: docker
|
|
967
|
+
description: "Docker operations"
|
|
968
|
+
command: docker
|
|
969
|
+
subcommands:
|
|
970
|
+
- name: build
|
|
971
|
+
description: "Build Docker image"
|
|
972
|
+
args:
|
|
973
|
+
- build
|
|
974
|
+
- -t
|
|
975
|
+
- myapp
|
|
976
|
+
- .
|
|
977
|
+
- name: run
|
|
978
|
+
description: "Run Docker container"
|
|
979
|
+
args:
|
|
980
|
+
- run
|
|
981
|
+
- -p
|
|
982
|
+
- "8080:8080"
|
|
983
|
+
- myapp
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
Use as: `/docker build` or `/docker run`
|
|
987
|
+
|
|
988
|
+
Use with `/tests` or `/build`.
|
|
989
|
+
|
|
990
|
+
For complete shortcuts documentation, including advanced features and examples, see [Shortcuts Guide](docs/shortcuts-guide.md).
|
|
991
|
+
|
|
992
|
+
## Channels (Remote Messaging)
|
|
993
|
+
|
|
994
|
+
Control the agent remotely from messaging platforms like Telegram or
|
|
995
|
+
WhatsApp. Messages sent to a bot are forwarded to the agent, and the
|
|
996
|
+
agent's responses are sent back through the same platform.
|
|
997
|
+
|
|
998
|
+
### Setup (Telegram)
|
|
999
|
+
|
|
1000
|
+
**1. Create a Telegram bot** by messaging [@BotFather](https://t.me/BotFather) and sending `/newbot`. Copy the bot token.
|
|
1001
|
+
|
|
1002
|
+
**2. Get your chat ID** by messaging your bot, then visiting:
|
|
1003
|
+
|
|
1004
|
+
```text
|
|
1005
|
+
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
Find `"chat":{"id":123456789}` in the response.
|
|
1009
|
+
|
|
1010
|
+
**3. Configure** in `.infer/channels.yaml` (seeded by `infer init`):
|
|
1011
|
+
|
|
1012
|
+
```yaml
|
|
1013
|
+
---
|
|
1014
|
+
enabled: true
|
|
1015
|
+
|
|
1016
|
+
telegram:
|
|
1017
|
+
enabled: true
|
|
1018
|
+
bot_token: "${INFER_CHANNELS_TELEGRAM_BOT_TOKEN}"
|
|
1019
|
+
allowed_users:
|
|
1020
|
+
- "123456789"
|
|
1021
|
+
poll_timeout: 30
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
Or via environment variables:
|
|
1025
|
+
|
|
1026
|
+
```bash
|
|
1027
|
+
export INFER_CHANNELS_ENABLED=true
|
|
1028
|
+
export INFER_CHANNELS_TELEGRAM_ENABLED=true
|
|
1029
|
+
export INFER_CHANNELS_TELEGRAM_BOT_TOKEN="123456:ABC-DEF..."
|
|
1030
|
+
export INFER_CHANNELS_TELEGRAM_ALLOWED_USERS="123456789"
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
**4. Start the channel listener:**
|
|
1034
|
+
|
|
1035
|
+
```bash
|
|
1036
|
+
infer channels-manager
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
**5. Send a message** to your bot in Telegram - the agent will respond.
|
|
1040
|
+
|
|
1041
|
+
Each incoming message triggers `infer agent --session-id <id>` as a
|
|
1042
|
+
subprocess with a persistent session per sender.
|
|
1043
|
+
|
|
1044
|
+
### Tool Approval
|
|
1045
|
+
|
|
1046
|
+
By default, sensitive tools (Write, Edit, Delete, Bash) require user approval
|
|
1047
|
+
before executing. The agent sends an approval prompt to the channel and waits
|
|
1048
|
+
for the user to reply "yes" or "no". Read-only tools (Read, Grep, Tree) execute
|
|
1049
|
+
without approval.
|
|
1050
|
+
|
|
1051
|
+
This reuses the existing `tools.*.require_approval` configuration. To disable, set in `.infer/channels.yaml`:
|
|
1052
|
+
|
|
1053
|
+
```yaml
|
|
1054
|
+
require_approval: false # default: true
|
|
1055
|
+
```
|
|
1056
|
+
|
|
1057
|
+
Or: `INFER_CHANNELS_REQUIRE_APPROVAL=false`
|
|
1058
|
+
|
|
1059
|
+
Approvals time out after 5 minutes and are automatically rejected.
|
|
1060
|
+
|
|
1061
|
+
### Security
|
|
1062
|
+
|
|
1063
|
+
- **Allowlist-only access**: Only chat IDs in `allowed_users` can interact with the agent
|
|
1064
|
+
- **Empty allowlist = reject all**: If no users are configured, all messages are rejected (secure by default)
|
|
1065
|
+
- **Per-channel allowlists**: Each channel (Telegram, WhatsApp) has its own independent allowlist
|
|
1066
|
+
- **Tool approval by default**: Sensitive tools require explicit user approval before executing
|
|
1067
|
+
- **Use environment variables** for tokens - never commit secrets to config files
|
|
1068
|
+
|
|
1069
|
+
### Supported Channels
|
|
1070
|
+
|
|
1071
|
+
| Channel | Status | Transport |
|
|
1072
|
+
| -------- | --------- | --------------------------- |
|
|
1073
|
+
| Telegram | Available | Long-polling (Bot API) |
|
|
1074
|
+
| WhatsApp | Planned | Webhook (Meta Business API) |
|
|
1075
|
+
|
|
1076
|
+
For a complete working example with Docker Compose, see [examples/telegram-channel](examples/telegram-channel/).
|
|
1077
|
+
|
|
1078
|
+
For detailed documentation including custom channel development, see [Channels Documentation](docs/channels.md).
|
|
1079
|
+
|
|
1080
|
+
### Scheduled Tasks
|
|
1081
|
+
|
|
1082
|
+
When the channels-manager daemon is running, you can ask the bot to schedule
|
|
1083
|
+
prompts on a cron schedule. The agent's response is delivered back through
|
|
1084
|
+
the originating channel (e.g. the Telegram chat where you set it up).
|
|
1085
|
+
|
|
1086
|
+
> *"Send me an inspiring quote every day at 8 AM"* - recurring
|
|
1087
|
+
> *"Remind me at 6pm today to call mum"* - one-off (deletes itself after firing)
|
|
1088
|
+
|
|
1089
|
+
Enable in `.infer/config.yaml`:
|
|
1090
|
+
|
|
1091
|
+
```yaml
|
|
1092
|
+
tools:
|
|
1093
|
+
schedule:
|
|
1094
|
+
enabled: true # disabled by default
|
|
1095
|
+
require_approval: true # default; recommended
|
|
1096
|
+
```
|
|
1097
|
+
|
|
1098
|
+
Or via env var: `INFER_TOOLS_SCHEDULE_ENABLED=true`.
|
|
1099
|
+
|
|
1100
|
+
Jobs are persisted as YAML in `~/.infer/schedules/<id>.yaml` and hot-reloaded
|
|
1101
|
+
by the daemon (no restart needed). Channel + recipient are derived
|
|
1102
|
+
automatically from the session - the LLM never has to guess them.
|
|
1103
|
+
|
|
1104
|
+
Container deployments must set `TZ=Europe/Berlin` (or your zone) so cron
|
|
1105
|
+
expressions are interpreted in local time. The binary embeds the IANA zone
|
|
1106
|
+
database so this works on any base image.
|
|
1107
|
+
|
|
1108
|
+
For the full guide, including the cron syntax primer and end-to-end Telegram
|
|
1109
|
+
walkthroughs, see [Scheduling Documentation](docs/scheduling.md).
|
|
1110
|
+
|
|
1111
|
+
## Heartbeat (Periodic Wake-Up)
|
|
1112
|
+
|
|
1113
|
+
Heartbeat wakes the agent on a fixed interval - without any user input -
|
|
1114
|
+
so it can check for pending todos, background tasks, or anything else
|
|
1115
|
+
your system prompt tells it to monitor. It runs alongside the scheduler
|
|
1116
|
+
inside the `infer channels-manager` daemon and is **disabled by default**.
|
|
1117
|
+
|
|
1118
|
+
Unlike the [Schedule](docs/scheduling.md) tool (which the LLM uses to
|
|
1119
|
+
create user-driven cron jobs that deliver to a channel), heartbeat is a
|
|
1120
|
+
single global tick the operator configures once. Output goes to logs;
|
|
1121
|
+
the agent itself decides whether to send a Telegram message, open a PR,
|
|
1122
|
+
or just no-op.
|
|
1123
|
+
|
|
1124
|
+
Enable in `.infer/heartbeat.yaml` (seeded by `infer init`):
|
|
1125
|
+
|
|
1126
|
+
```yaml
|
|
1127
|
+
---
|
|
1128
|
+
enabled: true
|
|
1129
|
+
interval: 1h # Go duration: 30s, 5m, 1h, 24h
|
|
1130
|
+
initial_delay: 1m # delay before first tick
|
|
1131
|
+
model: "" # optional override; empty = agent.model
|
|
1132
|
+
prompt: "Heartbeat tick - check for any pending tasks, todos, or background work and act on them."
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
The **system prompt** for heartbeat runs lives in `.infer/prompts.yaml`
|
|
1136
|
+
under `agent.system_prompt_heartbeat` so you can tune the agent's
|
|
1137
|
+
wake-up behaviour separately from chat-mode behaviour.
|
|
1138
|
+
|
|
1139
|
+
Then start the daemon:
|
|
1140
|
+
|
|
1141
|
+
```bash
|
|
1142
|
+
infer channels-manager
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
Heartbeat alone is a valid run mode - you don't need any channel
|
|
1146
|
+
enabled to use it. The daemon hosts whichever of channels / scheduler /
|
|
1147
|
+
heartbeat are turned on.
|
|
1148
|
+
|
|
1149
|
+
Or via env vars:
|
|
1150
|
+
|
|
1151
|
+
```bash
|
|
1152
|
+
export INFER_HEARTBEAT_ENABLED=true
|
|
1153
|
+
export INFER_HEARTBEAT_INTERVAL=30m
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
For the full guide, including configuration reference and common
|
|
1157
|
+
patterns (TODO sweeps, CI watchdogs), see [Heartbeat Documentation](docs/heartbeat.md).
|
|
1158
|
+
|
|
1159
|
+
## Global Flags
|
|
1160
|
+
|
|
1161
|
+
- `-v, --verbose`: Enable verbose output
|
|
1162
|
+
- `--config <path>`: Specify custom config file path
|
|
1163
|
+
|
|
1164
|
+
## Examples
|
|
1165
|
+
|
|
1166
|
+
### Basic Workflow
|
|
1167
|
+
|
|
1168
|
+
```bash
|
|
1169
|
+
# Initialize project
|
|
1170
|
+
infer init
|
|
1171
|
+
|
|
1172
|
+
# Start interactive chat
|
|
1173
|
+
infer chat
|
|
1174
|
+
|
|
1175
|
+
# Execute autonomous task
|
|
1176
|
+
infer agent "Fix the bug in issue #42"
|
|
1177
|
+
|
|
1178
|
+
# Check gateway status
|
|
1179
|
+
infer status
|
|
1180
|
+
```
|
|
1181
|
+
|
|
1182
|
+
### Working on a GitHub Issue
|
|
1183
|
+
|
|
1184
|
+
```bash
|
|
1185
|
+
# Start chat
|
|
1186
|
+
infer chat
|
|
1187
|
+
|
|
1188
|
+
# In chat, use shortcuts to get context
|
|
1189
|
+
/scm issue 123
|
|
1190
|
+
|
|
1191
|
+
# Discuss with AI, let it use tools to:
|
|
1192
|
+
# - Read files
|
|
1193
|
+
# - Search codebase
|
|
1194
|
+
# - Make changes
|
|
1195
|
+
# - Run tests
|
|
1196
|
+
|
|
1197
|
+
# Generate PR plan when ready
|
|
1198
|
+
/scm pr-create Fixes the authentication timeout issue
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
### Configuration Example
|
|
1202
|
+
|
|
1203
|
+
```bash
|
|
1204
|
+
# Set default model
|
|
1205
|
+
infer config set agent.model "deepseek/deepseek-v4-pro"
|
|
1206
|
+
|
|
1207
|
+
# Enable bash tool
|
|
1208
|
+
infer config set tools.bash.enabled true
|
|
1209
|
+
|
|
1210
|
+
# Configure web search
|
|
1211
|
+
infer config set tools.web_search.enabled true
|
|
1212
|
+
|
|
1213
|
+
# Check current configuration
|
|
1214
|
+
infer config get
|
|
1215
|
+
```
|
|
1216
|
+
|
|
1217
|
+
### Web Terminal Example
|
|
1218
|
+
|
|
1219
|
+
```bash
|
|
1220
|
+
# Start web terminal server
|
|
1221
|
+
infer chat --web
|
|
1222
|
+
|
|
1223
|
+
# Open browser to http://localhost:3000
|
|
1224
|
+
# Click "+" to create new terminal tabs
|
|
1225
|
+
# Each tab is an independent chat session
|
|
1226
|
+
|
|
1227
|
+
# Custom port for remote access
|
|
1228
|
+
infer chat --web --port 8080 --host 0.0.0.0
|
|
1229
|
+
|
|
1230
|
+
# Configure via config file
|
|
1231
|
+
cat > .infer/config.yaml <<EOF
|
|
1232
|
+
web:
|
|
1233
|
+
enabled: true
|
|
1234
|
+
port: 3000
|
|
1235
|
+
host: "localhost"
|
|
1236
|
+
session_inactivity_mins: 10 # Auto-cleanup after 10 minutes
|
|
1237
|
+
EOF
|
|
1238
|
+
|
|
1239
|
+
infer chat --web # Uses config file settings
|
|
1240
|
+
```
|
|
1241
|
+
|
|
1242
|
+
**Use Cases:**
|
|
1243
|
+
|
|
1244
|
+
- Remote access to CLI from any device
|
|
1245
|
+
- Multiple parallel chat sessions in browser tabs
|
|
1246
|
+
- Team collaboration with shared terminal access
|
|
1247
|
+
- Persistent sessions with automatic cleanup
|
|
1248
|
+
|
|
1249
|
+
## Development
|
|
1250
|
+
|
|
1251
|
+
For development, use [Task](https://taskfile.dev) for build automation:
|
|
1252
|
+
|
|
1253
|
+
```bash
|
|
1254
|
+
task build # Build binary
|
|
1255
|
+
task test # Run tests
|
|
1256
|
+
task fmt # Format code
|
|
1257
|
+
task lint # Run linter
|
|
1258
|
+
```
|
|
1259
|
+
|
|
1260
|
+
See [CLAUDE.md](CLAUDE.md) for detailed development documentation.
|
|
1261
|
+
|
|
1262
|
+
## License
|
|
1263
|
+
|
|
1264
|
+
Apache 2.0 License - see [LICENSE](LICENSE) file for details.
|