sparrow-cli 0.9.2

A local-first Rust agent cockpit β€” route, run, replay, rewind
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<div align="center">

# 🐦 Sparrow

**A local-first Rust agent cockpit β€” route, run, replay, rewind.**

[![CI](https://github.com/ucav/Sparrow/actions/workflows/ci.yml/badge.svg)](https://github.com/ucav/Sparrow/actions/workflows/ci.yml)
[![Security Audit](https://github.com/ucav/Sparrow/actions/workflows/audit.yml/badge.svg)](https://github.com/ucav/Sparrow/actions/workflows/audit.yml)
[![Release](https://img.shields.io/github/v/release/ucav/Sparrow?color=blue&label=release)](https://github.com/ucav/Sparrow/releases)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![Rust 1.96+](https://img.shields.io/badge/rust-1.96%2B-orange)](https://rust-lang.org)
[![crates.io](https://img.shields.io/crates/v/sparrow-cli?color=orange)](https://crates.io/crates/sparrow-cli)
[![docs.rs](https://img.shields.io/docsrs/sparrow-cli)](https://docs.rs/sparrow-cli)
[![Linux](https://img.shields.io/badge/linux-x86__64%20%C2%B7%20aarch64-2dba4e?logo=linux&logoColor=white)](https://github.com/ucav/Sparrow/releases/latest)
[![macOS](https://img.shields.io/badge/macOS-arm64%20%C2%B7%20x86__64-c1c1c1?logo=apple&logoColor=white)](https://github.com/ucav/Sparrow/releases/latest)
[![Windows](https://img.shields.io/badge/windows-x86__64-0078d4?logo=windows&logoColor=white)](https://github.com/ucav/Sparrow/releases/latest)
[![Downloads](https://img.shields.io/crates/d/sparrow-cli?color=blueviolet&label=crates.io%20downloads)](https://crates.io/crates/sparrow-cli)
[![GitHub stars](https://img.shields.io/github/stars/ucav/Sparrow?style=flat&color=f2a93c)](https://github.com/ucav/Sparrow/stargazers)

<img src="assets/brand/sparrow-mascot.svg" width="140" alt="Sparrow mascot" />

*One event stream. Terminal UI, WebView cockpit, JSON output, or gateway β€” your choice.*

[![β–Ά Watch the 30-second demo](https://img.shields.io/badge/β–Ά_watch-30--second_demo-f2a93c?style=for-the-badge)](https://ucav.github.io/Sparrow/demo.html)


[Quick Start](#quick-start) Β· [Why Sparrow](#why-sparrow-vs-claude-code--codex--aider) Β· [Commands](#common-commands) Β· [Architecture](#architecture) Β· [Docs](#docs) Β· [Releases](https://github.com/ucav/Sparrow/releases)

</div>

---

Sparrow is a single-binary CLI agent written in Rust. It routes each task to the **cheapest capable model**, keeps you in control with **Git-backed checkpoints**, and makes every run **replayable**. Local models (Ollama) are always the first hop; cloud providers are explicit fallbacks.

The project focuses on a narrow product promise: a Rust-native local cockpit where every run is **visible, replayable, budgeted, and checkpointed**.

---

## Qu'est-ce que tu veux faire ? Β· What do you want to do?

> N'importe qui peut utiliser Sparrow. Décris ton problème avec tes mots —
> Sparrow le règle, te montre, et garantit que rien n'est jamais perdu.

```sh
sparrow bonjour                 # accueil : Sparrow regarde ton dossier et propose
sparrow fix "mon site plante"   # décris le problème → diagnostic + correction
sparrow explique src/app.js     # comprends un fichier ou une erreur, en clair
sparrow idees                   # tout ce que tu peux faire, par profil
sparrow whatis token            # c'est quoi ce mot ? (dΓ©finition instantanΓ©e)
sparrow annule                  # reviens en arrière — rien n'est jamais perdu
```

Sparrow te parle en **langage simple par dΓ©faut** (`sparrow mode simple|pro`).
Pour le dΓ©tail technique complet, tout le mode pro est lΓ  β€” rien n'est retirΓ©.

---

## Why Sparrow vs Claude Code / Codex / Aider

| Capability | Claude Code | OpenAI Codex CLI | Aider | **Sparrow** |
|---|:---:|:---:|:---:|:---:|
| Single static binary, no Node/Python runtime | ❌ | ❌ | ❌ | βœ… |
| Choose any provider, any model | ❌ Anthropic | ❌ OpenAI | βœ… | βœ… **38 providers** |
| Local-first (Ollama OOTB) | ❌ | ❌ | ⚠️ | βœ… |
| Git checkpoints + `rewind` per run | ❌ | ❌ | ⚠️ | βœ… |
| Budget caps (`--max-cost-usd` / `--max-wall-secs`) | ❌ | ❌ | ❌ | βœ… |
| WebView cockpit + TUI + JSON stream | ⚠️ TUI only | ⚠️ TUI only | ⚠️ TUI only | βœ… all three |
| Right-side tools panel (Preview/Diff/Terminal/Files/Tasks/Plan) | ⚠️ | ❌ | ❌ | βœ… event-driven |
| Live app preview embed (port auto-detect) | ❌ | ❌ | ❌ | βœ… |
| MCP server **host + client** | βœ… | ⚠️ | ❌ | βœ… |
| Drop-in import (`~/.claude/`, Codex, OpenCode) | n/a | ❌ | ❌ | βœ… |
| Multi-agent swarm (Planner β†’ Coder β†’ Verifier) | ❌ | ❌ | ❌ | βœ… |
| Telegram / Discord / Slack gateways | ❌ | ❌ | ❌ | βœ… |
| Pre-commit secret scanner bundled | ❌ | ❌ | ❌ | βœ… |
| Voice (`speak`, `transcribe`) | ❌ | ❌ | ❌ | βœ… |
| Replay & share session as URL/Gist | ❌ | ❌ | ❌ | βœ… |
| Source open, MIT | ⚠️ closed | ⚠️ closed | βœ… | βœ… |
| Zero telemetry by default | ⚠️ | ⚠️ | βœ… | βœ… |

See [`docs/comparison/vs-competitors.md`](docs/comparison/vs-competitors.md) for the long form (incl. OpenCode, Hermes, Continue, Cursor).

---

## ✨ What's New β€” v0.9 Β« Anyone Β»

> **Radical accessibility.** Anyone should understand and use Sparrow β€” a child, a grandparent, a teacher, a mechanic, an engineer. The engine doesn't change; the **surface** does. Focus mode for humans, Cockpit for pros. Same power, two depths.

**πŸ—£οΈ Zero jargon β€” Mode Simple / Pro**
- `sparrow mode simple|pro|auto` β€” choose how Sparrow talks to you, persisted in config
- Every engine `Event` now has a human-language phrase (FR/EN) β€” no more `run a3f2 Β· route Β· tier T1`
- Exhaustive match at compile time: adding a new event without a human phrase **fails to compile** β€” anti-regression lock

**πŸ”§ `sparrow fix` β€” the universal fixer**
- Paste an error message, describe a problem, or just run `sparrow fix` β€” it scans your directory, diagnoses in one sentence, and proposes a fix
- Automatic checkpoint before any change, one-word undo: `sparrow annule`

**πŸ‘‹ `sparrow bonjour` β€” the warm welcome**
- Detects your context (git conflict, uninstalled project, photo folder) and suggests the best next action
- No jargon, no flags β€” just "What are we fixing today?"

**πŸ’‘ `sparrow idees` β€” the idea gallery**
- 50+ concrete recipes organized by persona: teacher, grandparent, child, artisan, builder, developer
- Pick a recipe, press Enter, watch Sparrow work β€” the recipe IS the tutorial

**πŸ–₯️ Focus / Cockpit β€” one console, two views**
- **Focus** (default): one column, large text, three buttons β€” `[βœ… Okay] [↩️ Undo] [❓ Explain]`
- **Cockpit**: full 3-column view with swarm lanes, config, routing β€” zero power lost
- **Right-side tools panel**: Preview, Diff, Terminal, Files, Background tasks, Plan β€” every panel fed by **real events**, never mock data. Opens manually (`Ctrl/⌘+Shift+S`) or auto-opens on diffs, failed tasks, and plan updates with priority rules that never nag.
- **Live preview detection**: probes common dev ports (3000, 4200, 5173, 8080…) and embeds your running app in an iframe β€” or type any URL.
- **Replay, finally one click**: `β–Έ replay` lists your recorded runs and re-renders any transcript β€” no more pasting run IDs.
- **Ghost-text autocomplete**: fish-style inline suggestion from your real command history β€” `Tab` to accept.
- **Rich Markdown in chat**: streamed prose renders bold, headings, lists, tables, links, and inline code.
- **Keyboard cheat-sheet**: `Ctrl/⌘+/` shows every shortcut, grouped and platform-aware.
- New **white theme** alongside Captain and Paper β€” clean, high-contrast light UI.

**πŸ›‘οΈ Safety net**
- `sparrow budget 2€` β€” set spending cap in human language
- `sparrow annule` β€” one-word undo, back to last checkpoint
- Contract displayed before ANY file modification: "I'll modify 2 files. Checkpoint created βœ“. Proceed?"

**Install & distribution**
- **`cargo install sparrow-cli` v0.9.2** on crates.io
- **Pre-built binaries** for Linux, macOS, Windows on every release
- **`sparrow launch`** β€” zero-question first launch with free/local fallbacks; `--pro` keeps the expert wizard

**What was already here (v0.5.x)**
- Agentic engine with planner β†’ coder β†’ verifier pipeline, swarm orchestrator, git checkpoints + rewind.
- CLI rich rendering (syntect), streaming + chat composer, TTS/STT, voice commands.
- Memory CLI + FTS5 session search, encrypted credential store, pre-commit secret scanner.
- Humanized French errors, VS Code extension, Claude Code drop-in compat.

---

## Why Explore It

| | |
|---|---|
| **Model routing** | Budget-aware fallback chains across Ollama, NVIDIA, Anthropic, OpenAI-compatible APIs, and 30+ registry entries |
| **WebView cockpit** | Live route/token/cost/context at `http://127.0.0.1:9339/` with drawer panels, premium Timeline/Costs/Roadmap/Releases/Runs panels, slash palette, and agent picker |
| **Terminal-native** | Animated TUI cockpit, `sparrow run`, `sparrow chat`, `--json` output, replay, memory, gateway |
| **Rollback safety** | Auto-checkpoint before any mutating action; `sparrow rewind <id>` to restore |
| **Persistent context** | SQLite facts + knowledge graph, SOUL-style `.agent.md` files, guarded skill registry, full transcripts |
| **Browser/computer-use** | Playwright-backed browser tool and gated screenshot/click/type computer primitive |
| **Gateway** | Telegram, Discord, Slack, WebSocket API β€” wired with honest errors, not silent failures |
| **Release intel** | Opt-in public release scanner (`sparrow intel scan`) with local digests/backlog and no network when disabled |

<br>
<p align="center">
  <img src="docs/screenshots/webview-captain.png" alt="Sparrow WebView cockpit" width="90%">
  <br><em>Sparrow WebView cockpit β€” Captain theme</em>
</p>

---

## Status

Sparrow is **public beta** with a green cross-platform CI baseline. The kernel, routing core, console surfaces, replay, checkpoints, and memory are wired and tested; external transports are being validated by early adopters.

<details>
<summary><strong>Full status table</strong> (click to expand)</summary>

| Area | Status | Evidence |
|---|:---:|---|
| CI / Rust build | βœ… Stable | Ubuntu Β· macOS Β· Windows; `fmt`, `clippy -D warnings`, `check`, release builds |
| Test suite | βœ… Stable | Full `cargo test` green on current master |
| Security audit | βœ… Stable | `rustsec/audit-check` on all three platforms |
| Engine loop | βœ… Stable | Event stream, task classification, fallback execution, auto-checkpoint, auto-compaction |
| WebView console | βœ… Stable | Full cockpit β€” rail/drawer, typed event stream, compact highlighted code cards, themes, composer, approval modal |
| TUI cockpit | βœ… Stable | Animated cockpit, swarm lanes, checkpoint/diff/cost panels, `@` picker, history |
| Plan mode / slash | βœ… Stable | `sparrow plan`, `/plan`, built-in commands, user/project Markdown discovery |
| Permissions / hooks | βœ… Stable | 6 permission modes; `Pre`/`Post` lifecycle hooks for run/tool/checkpoint/compact |
| Declarative agents | βœ… Stable | SOUL TOML + Markdown frontmatter; `agent run`, `agent mention`, CRUD |
| Skills / plugins | βœ… Stable | Progressive references + templates; plugin manifests; CLI install/list/remove |
| Toolsets | βœ… Stable | Toolset/risk/auth/mutation/network/exec metadata; surface filtering |
| Browser / computer-use | πŸ”Ά Alpha | Playwright driver, screenshot blocks, click/type, Linux `bwrap` wrapper when available |
| Security audit CLI | βœ… Stable | `sparrow security audit [--json]`, WebView `/security` |
| Sandbox policy | βœ… Stable | Protected paths, env allowlist; Docker/SSH/Worktree backends; honest vendor errors |
| Media tools | βœ… Stable | `vision`, `image_generate`, `text_to_speech`, `transcribe`; WebView upload/artifacts |
| GitHub Action | βœ… Stable | `action.yml`, sample workflow, `sparrow github review/status/logs`, `--dry-run` |
| Context / compaction | βœ… Stable | `ContextMeter`, engine auto-trigger at 120k chars, durable `HandoffDoc` |
| Gateway | βœ… Stable | `/status` roundtrip on port 9338; run registry with real abort |
| Replay / memory | βœ… Stable | Recorder, checkpoint, rewind, SQLite facts, knowledge graph, optional Neo4j sync, bounded `MEMORY.md`, session search |
| Provider routing | πŸ”Ά Alpha | Ollama + NVIDIA tested locally; 92 NVIDIA models discovered |
| First-run setup | βœ… Stable | Zero-question default launch, readable config, expert wizard behind `sparrow launch --pro` |
| Telegram / Discord / Slack | πŸ”Έ Partial | Transport implementations exist; E2E token validation pending |
| Extra transports | πŸ§ͺ Experimental | WhatsApp, Signal, Email, Feishu, WeCom, QQ, Teams adapters present |
| Cloud sandboxes | πŸ§ͺ Experimental | Modal, Daytona, Vercel, Singularity β€” placeholder entries |
| Cross-platform release | βœ… Stable | Linux Β· macOS Β· Windows pre-built binaries on every tag |

</details>

See [docs/AUDIT.md](docs/AUDIT.md) for module-by-module proof.

---

## Quick Start

**Available today β€” same `sparrow` binary either way:**

```bash
# Universal (Rust toolchain) β€” published on crates.io
cargo install sparrow-cli

# macOS / Linux β€” one-liner (pulls the latest GitHub release)
curl -fsSL https://raw.githubusercontent.com/ucav/Sparrow/master/install.sh | sh

# Windows β€” PowerShell one-liner
irm https://raw.githubusercontent.com/ucav/Sparrow/master/install.ps1 | iex
```

Or grab a prebuilt binary directly from the
[latest release](https://github.com/ucav/Sparrow/releases/latest)
(Linux x86_64, macOS arm64, Windows x86_64).

**Package managers (manifests ready, publishing in progress):**

```bash
# macOS β€” Homebrew
brew install ucav/tap/sparrow

# Windows β€” Scoop
scoop bucket add ucav https://github.com/ucav/scoop-bucket && scoop install sparrow

# Windows 11 β€” winget
winget install ucav.Sparrow
```

**Then:**

```bash
sparrow launch       # first-run prepares a free/local fallback, opens Focus cockpit
sparrow run "explain this repo and write TODO.md"
```

That's the [60-second tour](docs/getting-started.md). No API key required β€”
first launch prepares a free/local fallback and lets you start from the prompt.
Use `sparrow launch --pro` if you want the detailed provider wizard.

**Launch Sparrow:**

```bash
sparrow launch
```

`sparrow launch` prepares Sparrow silently when needed, then opens the WebView
Focus cockpit on `http://127.0.0.1:9339/`. Use `sparrow launch --tui` for the
terminal cockpit, or `sparrow launch --pro` for the expert setup wizard.

**Build from source:**

```bash
git clone https://github.com/ucav/Sparrow.git
cd Sparrow
cargo build
cargo test --all-targets
```

**Run the WebView cockpit:**

```bash
cargo run -- launch
# β†’ open http://127.0.0.1:9339/
```

**Routing smoke test:**

```bash
cargo run -- --json run "how does Sparrow choose the best model?"
```

**List detected providers and models:**

```bash
cargo run -- model --list
```

**Force a specific route:**

```bash
# Local Ollama first
cargo run -- --local run "summarize this repo"

# Explicit NVIDIA route
cargo run -- --model nvidia:meta/llama-3.1-8b-instruct run "explain routing"

# Coding / reasoning route
cargo run -- --model nvidia:deepseek-ai/deepseek-v4-flash run "refactor this function"
```

---

## First Configuration

```bash
cargo run -- setup
```

Useful environment variables:

```bash
NVIDIA_API_KEY=...
ANTHROPIC_API_KEY=...
OPENAI_API_KEY=...
GROQ_API_KEY=...
OPENROUTER_API_KEY=...
OLLAMA_HOST=http://127.0.0.1:11434
```

Config lives in the platform config directory (e.g. `%APPDATA%\sparrow\config.toml` on Windows). Sparrow never needs API keys in the repository.

---

## Provider Routing

Sparrow keeps a static provider registry and expands it with live model discovery when credentials are available. Stored credentials added with `sparrow auth add nvidia` are used for discovery, so `sparrow model --list` can populate the NVIDIA catalog even when `NVIDIA_API_KEY` is not exported.

**Default NVIDIA chain:**

| Model | Use case |
|---|---|
| `meta/llama-3.1-8b-instruct` | Fast general chat and cheap smoke tests |
| `stepfun-ai/step-3.5-flash` | Fast backup route via NVIDIA NIM |
| `nvidia/nemotron-3-super-120b-a12b` | Stronger fallback for heavier tasks |

`sparrow model --set nvidia` resets an older pinned config back to this chain.

---

## Common Commands

```bash
sparrow setup                      # first-run configuration
sparrow import auto                # migrate from claude-code / codex / opencode
sparrow plan "propose an approach" # read-only plan mode
sparrow console                    # launch WebView cockpit
sparrow run "fix the failing test"
sparrow --json run "summarize"     # NDJSON output for CI/hooks
sparrow chat                       # interactive session
sparrow model --list               # discovered providers & models
sparrow gateway start              # start gateway (Telegram/Discord/WS)
sparrow gateway status
sparrow gateway stop
sparrow replay <run-id>            # replay a past run
sparrow checkpoint list
sparrow rewind <checkpoint-id>     # restore workspace
sparrow memory list
sparrow memory graph search routing
sparrow security audit
sparrow doctor
```

Custom slash commands can be declared as Markdown files in `.sparrow/commands/*.md` or `%APPDATA%\sparrow\commands\*.md`. User-level commands override project and built-in ones by name. Skills are also exposed as slash commands.

---

## Architecture

```
              user task
                  β”‚
       routing-need classifier
                  β”‚
      budget-aware fallback chain
                  β”‚
                Engine
      think β†’ tool β†’ observe β†’ emit
                  β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      CLI        TUI       WebView
      JSON     Gateway    Recorder
```

**Load-bearing contracts:**

| File | Role |
|---|---|
| [`src/event.rs`]src/event.rs | Canonical event stream |
| [`src/provider/mod.rs`]src/provider/mod.rs | `Brain` abstraction |
| [`src/router/mod.rs`]src/router/mod.rs | Model ranking and fallbacks |
| [`src/engine/mod.rs`]src/engine/mod.rs | Agent loop |
| [`src/tools/mod.rs`]src/tools/mod.rs | Tool contracts |
| [`src/gateway/mod.rs`]src/gateway/mod.rs | External message routing |

---

## Docs

| Document | Topic |
|---|---|
| [docs/AUDIT.md]docs/AUDIT.md | Module-by-module proof |
| [docs/architecture.md]docs/architecture.md | System architecture |
| [docs/cli-reference.md]docs/cli-reference.md | Full CLI reference |
| [docs/routing.md]docs/routing.md | Routing and provider chains |
| [docs/autonomy.md]docs/autonomy.md | Permission modes and hooks |
| [docs/sandboxing.md]docs/sandboxing.md | Sandbox policy and backends |
| [docs/browser-computer.md]docs/browser-computer.md | Playwright browser and computer-use tools |
| [docs/replay.md]docs/replay.md | Replay and checkpoints |
| [docs/swarm.md]docs/swarm.md | Multi-agent swarm |
| [docs/keyboard.md]docs/keyboard.md | Keyboard shortcuts |
| [docs/configuration.md]docs/configuration.md | Configuration reference |
| [assets/brand/]assets/brand/ | Brand assets (SVG, HTML, ASCII) |

---

## Contributing

Before opening a PR:

```bash
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test --all-targets
```

Keep docs honest: mark features as `Stable`, `Alpha`, `Partial`, `Experimental`, or `Planned` based on tests and runnable examples. See [CONTRIBUTING.md](CONTRIBUTING.md).

---

## License

MIT β€” see [LICENSE](LICENSE).