<div align="center">

```
  ███████╗ ██████╗ ██╗   ██╗███████╗███████╗███████╗██████╗
  ██╔════╝██╔═══██╗██║   ██║██╔════╝██╔════╝╚══███╔╝██╔══██╗
  ███████╗██║   ██║██║   ██║█████╗  █████╗    ███╔╝ ██████╔╝
  ╚════██║██║▄▄ ██║██║   ██║██╔══╝  ██╔══╝   ███╔╝  ██╔══██╗
  ███████║╚██████╔╝╚██████╔╝███████╗███████╗███████╗██║  ██║
  ╚══════╝ ╚══▀▀═╝  ╚═════╝ ╚══════╝╚══════╝╚══════╝╚═╝  ╚═╝
                          · C O D E ·
```

### **All for One**

*Claude · GPT · Gemini — one CLI, every AI*

[![npm version](https://img.shields.io/npm/v/squeezr-code?color=6aaa6a&label=squeezr-code)](https://www.npmjs.com/package/squeezr-code)
[![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20WSL%20%7C%20Windows-lightgrey)](#requirements)

</div>

---

`sq` is an interactive AI coding agent that speaks **directly** to Anthropic, OpenAI/Codex, and Google/Gemini using the same OAuth tokens as their official CLIs — no API keys, no wrappers, just your existing subscriptions.

```bash
npm install -g squeezr-code
sq
```

---

## What makes it different

| | squeezr-code | Claude Code | Codex CLI | Gemini CLI |
|--|:--:|:--:|:--:|:--:|
| Claude (Anthropic) | ✅ | ✅ | ❌ | ❌ |
| GPT / Codex (OpenAI) | ✅ | ❌ | ✅ | ❌ |
| Gemini (Google) | ✅ | ❌ | ❌ | ✅ |
| Committee mode (all 3 at once) | ✅ | ❌ | ❌ | ❌ |
| Real-time sidebar | ✅ | ❌ | ❌ | ❌ |
| Smart router + learning | ✅ | ❌ | ❌ | ❌ |
| Session persistence | ✅ | ✅ | ❌ | ❌ |
| MCP servers | ✅ | ✅ | ❌ | ❌ |

---

## Quick start

```bash
# Install
npm install -g squeezr-code

# Authenticate (reuses tokens from official CLIs if already installed)
sq login anthropic     # opens claude.ai in browser
sq login openai        # opens auth.openai.com
sq login google        # opens accounts.google.com

# Start
sq                     # interactive REPL (shows workspace trust prompt)
sq init                # generate sq.toml + SQUEEZR.md for your project
sq --resume            # pick a previous session to continue
sq -c                  # continue the most recent session
sq -p "fix the bug"    # one-shot, non-interactive
cat error.log | sq -p "what went wrong?"
```

---

## Interface

squeezr-code runs as a full-screen TUI (alternate screen buffer, like vim or htop). Custom ANSI renderer — no Electron, no Ink, just raw terminal.

```
┌─────────────────────────────────────────┬──────────────────────────────────┐
│                                         │● sonnet 4.6     anthropic [router]│
│  you                                    │████░░░░░░  12%  $0.04            │
│  fix the auth bug in api/client.ts      │─────────────────────────────────│
│                                         │▼ Providers                       │
│  Squeezr                                │ ● anthropic                      │
│  The issue is on line 47…               │ ● openai                         │
│                                         │ ○ google                         │
│  ├─ ▸ Read  api/client.ts               │─────────────────────────────────│
│  ├─ ± Edit  api/client.ts               │▼ Tasks                           │
│  - const token = headers.auth           │  empty                           │
│  + const token = headers.authorization  │─────────────────────────────────│
│                                         │▼ Processes                       │
│  ╰──                                    │  empty                           │
│                                         │─────────────────────────────────│
├─────────────────────────────────────────│∓ main  ●                        │
│ squeezr · ████░  12% 3h 22m · $0.04 · sonnet 4.6                         │
│   ↳ default · shift+tab  Ctrl+O thinking  Ctrl+T tasks  Ctrl+B sidebar    │
├─────────────────────────────────────────────────────────────────────────────┤
│ ❯ _                                                                         │
└─────────────────────────────────────────────────────────────────────────────┘
```

**Keyboard shortcuts**

| Key | Action |
|-----|--------|
| `Ctrl+B` | Toggle sidebar |
| `Ctrl+R` | Toggle smart router |
| `Ctrl+T` | Toggle task panel |
| `Ctrl+O` | Expand/collapse thinking |
| `Ctrl+C` | Abort current turn / exit |
| `Shift+Tab` | Cycle permission mode |
| `↑ / ↓` | Navigate history |
| `PgUp / PgDn` | Scroll output |
| Mouse wheel | Scroll output / sidebar |
| `Tab` | Autocomplete commands & `@aliases` |

---

## Features

### Multi-provider in one place
Use any combination of Claude, GPT, and Gemini in the same session. Switch mid-conversation:

```
you: @opus redesign this architecture
you: @gemini what do you think of the approach above?
you: @gpt now implement the storage layer
```

### /committee — ask all models at once
Runs the same prompt in parallel across all authenticated providers. Each response appears as it arrives. A judge model synthesises the best answer.

```
/committee what is the most resilient way to handle database failover?
```

```
🏛  Committee — Claude Opus · GPT-5.4 · Gemini 2.5
Running all models in parallel…

▸ GPT-5.4  3.8s
  The most resilient approach combines…

▸ Claude Opus  4.2s
  I'd recommend a read replica strategy with…

▸ Gemini 2.5  5.1s
  Consider using a circuit breaker pattern…

⚖  Synthesis (claude-sonnet)
  All three models agree on the core pattern…
```

### Smart router
Automatically routes each prompt to the right model based on complexity. No latency — the turn starts immediately while the router works in the background.

```toml
# sq.toml
[router]
enabled = true
learn = true   # background LLM classification learns your preferences

[router.rules]
"code review" = "opus"
"translate" = "haiku"
"documentation" = "haiku"
```

The router learns from your `@model` overrides. After 3 consistent corrections, it promotes the pattern as a learned rule. `/router show` displays current state. `/router reset` clears everything.

### Real-time sidebar
Auto-appears on terminals ≥ 120 cols (`Ctrl+B` to toggle). Collapsible sections — click any header to expand/collapse.

- **Providers** — auth status per provider (green = authenticated)
- **MCP** — server connection status + tool count
- **Tasks** — live task list from the agent
- **Processes** — active background shells + monitors
- **Files** — files modified this session
- **Git** — current branch + dirty indicator

### Session persistence
Every conversation is saved. Resume any previous session with context intact.

```bash
sq --resume            # interactive picker with dates, model, turn count
sq -c                  # continue latest session directly
sq resume <id>         # resume a specific session by ID
```

### MCP servers
Full [Model Context Protocol](https://modelcontextprotocol.io) support. Add servers to `sq.toml`:

```toml
[mcp.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/path"]

[mcp.github]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
env = { GITHUB_TOKEN = "ghp_..." }
```

Manage from the REPL with `/mcp` — interactive picker to connect, disconnect, or restart any server.

### Background tools
The agent can run long-running processes without blocking:

```
run "npm run dev" in background and check for errors
```

Active background shells and monitors appear in the sidebar in real time. Kill them with `KillShell` or via `/mcp`.

### Built-in tools (24)

| Category | Tools |
|----------|-------|
| **Files** | `Read` (+ PDF), `Write`, `Edit`, `Glob`, `Grep` |
| **Shell** | `Bash`, `BashOutput`, `KillShell` |
| **Web** | `WebFetch`, `WebSearch` |
| **Tasks** | `TaskCreate`, `TaskList`, `TaskGet`, `TaskUpdate` |
| **Agents** | `Task` (sub-agents), `AskUserQuestion`, `ExitPlanMode` |
| **Scheduling** | `CronCreate`, `CronList`, `CronDelete` |
| **Watching** | `Monitor` |
| **Git** | `EnterWorktree`, `ExitWorktree` |
| **Notebooks** | `NotebookEdit` |

---

## Commands reference

| Command | Description |
|---------|-------------|
| `/model` | Interactive model picker ↑↓ Enter |
| `/model <alias>` | Switch model: `/model opus`, `/model pro` |
| `/committee <prompt>` | Run prompt across all providers in parallel |
| `/router on\|off` | Toggle smart routing |
| `/router learn on\|off` | Toggle background LLM learning |
| `/router rules` | Show learned preferences |
| `/mcp` | MCP server manager (connect / disconnect / restart) |
| `/compact` | Compress conversation history |
| `/clear` | Clear conversation context |
| `/status` | Context %, subscription usage, cost |
| `/cost` | Cost breakdown by model |
| `/history [N]` | Last N turns |
| `/tasklist` | Show all tasks this session |
| `/paste [text]` | Read image from clipboard + optional prompt |
| `/sidebar` | Toggle sidebar |
| `/review [range]` | Code review of current git diff |
| `/sessions` | List saved sessions |
| `/help` | Quick reference |
| `@file path/to/file` | Inject file content into prompt |
| `@model <prompt>` | One-shot model override: `@opus`, `@haiku`, `@gemini` |

---

## Authentication

squeezr-code imports tokens from official CLIs automatically. If you've used Claude Code, Codex, or Gemini CLI, you're already authenticated.

**Option A — OAuth login from sq (recommended)**
```bash
sq login anthropic     # claude.ai → PKCE flow
sq login openai        # auth.openai.com → PKCE flow
sq login google        # accounts.google.com → OAuth2 + secret
```

**Option B — Auto-import from official CLIs**

| Provider | Reads from | Refresh |
|----------|-----------|---------|
| Anthropic | `~/.claude/.credentials.json` | `sq login anthropic` |
| OpenAI | `~/.codex/auth.json` | `sq login openai` |
| Google | `~/.gemini/oauth_creds.json` | `sq login google` |

Tokens are stored in `~/.squeezr-code/auth/` and auto-refreshed in the background.

---

## Configuration

Run `sq init` to generate a `sq.toml` in your project:

```toml
[agent]
default = "sonnet"
permissions = "default"  # default | accept-edits | plan | bypass

[router]
enabled = true
learn = false

[router.rules]
"code review" = "opus"
"translate" = "haiku"

[permissions]
allow = ["Read", "Glob", "Grep", "Bash:git *"]
deny = ["Bash:rm -rf*"]

[mcp.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "."]

[transplant]
warn_threshold = 80
auto_threshold = 95
```

---

## Model aliases

| Alias | Resolves to |
|-------|------------|
| `opus`, `sonnet`, `haiku` | Latest Anthropic model of that family |
| `pro`, `flash` | Latest Gemini model of that family |
| `gpt`, `gpt-mini`, `codex` | Latest OpenAI model of that family |

---

## Requirements

- **Node.js ≥ 18**
- At least one authenticated provider:
  - [Claude Code](https://claude.com/claude-code) — or `sq login anthropic`
  - [Codex CLI](https://github.com/openai/codex) — or `sq login openai`
  - [Gemini CLI](https://github.com/google-gemini/gemini-cli) — or `sq login google`

---

## Troubleshooting

| Symptom | Likely cause | Fix |
|---------|-------------|-----|
| `401 from anthropic` | OAuth expired | `sq login anthropic` or `/login anthropic` |
| `403 from google` | Refresh token expired | `/login google` — reopens browser |
| `403 Cloudflare` on Codex | Corporate VPN blocking `chatgpt.com` | Try a different network |
| `/model` picker empty | Catalogue not yet loaded | Wait 1–2s or restart `sq` |
| Characters appear on resize | Terminal resize artifact | Fixed in v1.0 — update |

---

## License

MIT © [sergioramosv](https://github.com/sergioramosv)
