Squad Squad

CLI Reference

⚠️ Experimental — Squad is alpha software. APIs, commands, and behavior may change between releases.

Everything you need to run Squad from the command line — commands, shell interactions, configuration files, and environment variables.


Installation

# Global install (recommended)
npm install -g @bradygaster/squad-cli

# One-off with npx
npx @bradygaster/squad-cli init

# Latest from GitHub (bleeding edge)
squad init

CLI Commands (17 commands)

CommandDescriptionRequires .squad/
squadDeprecated — Enter interactive shell (no args). Use copilot --agent squad instead.No
squad initInitialize Squad in the current repo (idempotent — safe to run multiple times)No
squad init --globalCreate a personal squad in your platform-specific directoryNo
squad init --mode remote <path>Initialize linked to a remote team root (dual-root mode)No
squad link <team-repo-path>Link project to a remote team rootYes
squad loopRun a prompt-driven work loop from loop.mdYes
squad loop --initCreate a starter loop.md fileYes
squad loop --file <path>Run a loop from a custom file pathYes
squad start [--tunnel] [--port N] [--command cmd]Start Copilot with remote phone access via PTY and WebSocketNo
squad statusShow which squad is active and whyYes
squad doctorValidate squad setup integrity and diagnose issues (alias: heartbeat)Yes
squad upgradeUpgrade Squad-owned files to latest versionYes
squad upgrade --migrate-directoryRename legacy .ai-team/ directory to .squad/Yes
squad triageAuto-triage issues and assign to team (primary name; watch is an alias)Yes
squad triage --interval <min>Continuous triage (default: every 10 min)Yes
squad watch --executeEnable work execution (spawn Copilot to work on issues)Yes
squad watch --monitor-teamsScan Teams for actionable messages each roundYes
squad watch --monitor-emailScan email for alerts and action items each roundYes
squad watch --boardEnable project board lifecycle managementYes
squad watch --two-passUse two-pass scanning (lightweight → hydrate)Yes
squad watch --wave-dispatchParallel sub-task execution within issuesYes
squad watch --retroEnforce retrospective checksYes
squad watch --decision-hygieneAuto-merge decision inboxYes
squad watch --max-concurrent NMax parallel issues per round (default: 1)Yes
squad watch --timeout NPer-issue timeout in minutes (default: 30)Yes
squad watch --copilot-flags "..."Extra flags for Copilot CLIYes
squad shellDeprecated — Launch interactive shell explicitly. Use copilot --agent squad instead.No
squad copilotAdd the @copilot coding agent to the teamYes
squad copilot --offRemove @copilot from the teamYes
squad copilot --auto-assignEnable auto-assignment for @copilotYes
squad plugin marketplace add|remove|list|browseManage plugin marketplacesYes
squad exportExport squad to a portable JSON snapshotYes
squad export --out <path>Export to a custom pathYes
squad import <file>Import a squad from an export fileNo
squad import <file> --forceReplace existing squad (archives the old one)No
squad aspireLaunch Aspire dashboard for observabilityNo
squad aspire --dockerForce Docker mode for AspireNo
squad upstream add|remove|list|syncManage upstream Squad sourcesYes
copilot --agent squadLaunch interactive shell explicitlyNo
squad napContext hygiene (compress, prune, archive .squad/ state)Yes
squad nap --deepThorough cleanup with recursive descentYes
squad nap --dry-runPreview cleanup actions without changesYes
squad scrub-emails [directory]Remove email addresses from Squad state files (default: .squad/)No
squad --versionPrint installed versionNo

Remote Init Mode

Use --mode remote to link your project to a shared team root:

squad init --mode remote ../team-repo

In dual-root mode, project-specific state lives in your local .squad/ while team identity (casting, charters, shared decisions) lives in the remote location. This is useful for monorepos or organizations with a shared team definition.


squad start

Start Copilot with optional remote access via phone. Spawns Copilot in a PTY and mirrors to your phone via WebSocket + devtunnel.

Flags:

  • --tunnel — Create a devtunnel for remote access (shows QR code for phone scanning). Requires devtunnel CLI installed and authenticated (devtunnel user login).
  • --port <N> — Specific WebSocket port (default: random). Example: --port 3456
  • --command <cmd> — Run a custom command instead of copilot. Example: --command powershell
  • All copilot flags pass through. Example: squad start --tunnel --yolo or squad start --tunnel --model gpt-4

Examples:

# Basic local PTY (no phone access)
squad start

# With phone access + devtunnel
squad start --tunnel
# Output: QR Code, URL, Session ID

# Custom port, local only
squad start --port 3456

# Custom command with tunnel
squad start --tunnel --command powershell

# Copilot flags pass through
squad start --tunnel --yolo
squad start --tunnel --model gpt-4 --no-config

For details on architecture, security, mobile keyboard, and troubleshooting, see Remote Control Guide.


squad loop

Run a prompt-driven work loop from a loop.md file. Each cycle, Loop sends your prompt to Copilot and loops again at your chosen interval.

Basic usage:

squad loop                               # Run the loop from loop.md
squad loop --init                        # Create a starter loop.md
squad loop --file scripts/monitor.md     # Run a custom loop file

Flags:

  • --init — Create a starter loop.md file in your project
  • --file <path> — Path to loop file (default: loop.md in project root)
  • --interval <N> — Override loop interval in minutes (default: from frontmatter)
  • --timeout <N> — Override cycle timeout in minutes (default: from frontmatter)
  • --copilot-flags "..." — Pass extra flags to Copilot CLI
  • --agent-cmd <cmd> — Custom agent command (advanced)
  • --monitor-email — Scan email for alerts each cycle (requires WorkIQ MCP)
  • --monitor-teams — Scan Teams for action items each cycle (requires WorkIQ MCP)
  • --self-pull — Run git fetch && git pull before each cycle

Frontmatter reference:

Loop.md requires YAML frontmatter with:

FieldTypeDescription
configuredbooleanSafety check — must be true to run (prevents accidental execution)
intervalnumberMinutes between cycles (default: 10)
timeoutnumberMax runtime in minutes per cycle (default: 30)
descriptionstringHuman-readable description of the loop

Examples:

# Create a starter loop
squad loop --init

# Edit loop.md, then run it
squad loop

# Run with faster interval (overrides frontmatter)
squad loop --interval 3

# Run with monitoring
squad loop --monitor-email --monitor-teams

# Run a named loop file
squad loop --file scripts/ci-monitor.md

# Run with custom Copilot model
squad loop --copilot-flags "--model gpt-4"

Example loop.md:

---
configured: true
interval: 10
timeout: 20
description: "Monitor failing CI and fix issues"
---

# CI Monitor Loop

Each cycle, you will:

1. Check GitHub Actions for failures in main branch
2. If failures exist, investigate the top 1-2
3. If fixable, create a PR with the fix
4. Report findings (failures found, fixes created)

Keep cycles to 20 minutes max.

For complete documentation and examples, see Loop — Prompt-driven work loop.


Enter the shell with squad (no arguments). You’ll see:

squad >

Shell Commands

All shell commands start with /.

CommandWhat it does
/statusShow active agents, sessions, recent decisions
/historyView session log — tasks, decisions, agent work
/agentsList team members with roles and expertise
/sessionsList saved sessions
/resume <id>Restore a past session
/versionShow version
/clearClear terminal output
/helpShow all commands
/quitExit the shell (also: Ctrl+C)

Addressing Agents

squad > @Keaton, analyze the architecture
squad > Keaton, set up the database schema
squad > Build a blog post about our casting system

Agent name matching is case-insensitive@keaton, @Keaton, and @KEATON all route to the same agent. Name an agent to route directly. Omit the name and the coordinator routes to the best fit.

Keyboard Shortcuts

ShortcutAction
/ Scroll command history
Ctrl+AJump to start of line
Ctrl+EJump to end of line
Ctrl+UClear to start of line
Ctrl+KClear to end of line
Ctrl+WDelete previous word
Ctrl+CExit shell

Configuration Files

.squad/ Directory Structure

.squad/
├── team.md              # Roster — agent names, roles, human members
├── routing.md           # Work routing rules
├── decisions.md         # Architectural decisions log
├── directives.md        # Permanent team rules and conventions
├── casting-state.json   # Agent names, universe theme
├── model-config.json    # Per-agent model overrides
├── ceremonies.md        # Team ceremonies and rituals
├── skills/              # Reusable knowledge (markdown files)
│   ├── auth-rate-limiting.md
│   └── ...
├── agents/
│   ├── neo/
│   │   ├── charter.md   # Role definition, expertise, tools
│   │   └── history.md   # Accumulated knowledge
│   └── ...
└── history-archive/     # Archived old session logs

team.md

Defines the roster. Squad generates this during init, but you can edit it:

## Team

🏗️  Neo      — Lead          Scope, decisions, code review
⚛️  Trinity  — Frontend Dev  React, TypeScript, UI
🔧  Morpheus — Backend Dev   Node.js, Express, Prisma
🧪  Tank     — Tester        Jest, integration tests
📋  Scribe   — (silent)      Memory, decisions, session logs

## Human Team Members

- **Sarah** — Senior Backend Engineer
- **Jamal** — Frontend Lead

routing.md

Controls which agent gets which work:

# Routing Rules

**Frontend changes** → Trinity
**Backend API work** → Morpheus
**Database migrations** → Morpheus
**Test writing** → Tank
**Architecture decisions** → Neo
**Backend architecture decisions** → Sarah (human)

decisions.md

Append-only log of architectural decisions. Agents read this before every task:

### 2025-07-15: Use Zod for API validation
**By:** Morpheus
**What:** All API input validation uses Zod schemas
**Why:** Type-safe, composable, generates TypeScript types

directives.md

Permanent rules agents always follow:

- Always use TypeScript strict mode
- No any/unknown casts
- All database queries through Prisma, no raw SQL

Resolution Order

When Squad starts, it looks for .squad/ in this order:

  1. Current directory (./.squad/)
  2. Parent directories (walk up to project root)
  3. Personal squad directory (platform-specific: ~/.config/squad/ on Linux, ~/Library/Application Support/squad/ on macOS, %APPDATA%\squad\ on Windows)
  4. Global CLI default (fallback only)

First match wins.


Environment Variables

VariablePurposeValues
SQUAD_CLIENTDetected client platformcli, vscode
COPILOT_TOKENCopilot auth token (SDK usage)Token string


Troubleshooting with squad doctor

When something isn’t working, run:

squad doctor

This performs a comprehensive diagnostic check of your Squad setup, validating:

  • .squad/ directory structure
  • Required configuration files (team.md, routing.md, etc.)
  • Agent definitions and capabilities
  • File permissions and integrity
  • Integration with GitHub and Copilot

Usage Examples

# Run diagnostics on the current project
squad doctor

# Quick check after upgrading Squad
squad upgrade && squad doctor

# Verify setup after cloning a repo with a squad
git clone my-project && cd my-project && squad doctor

Example Output

✓ .squad/ directory exists
✓ team.md is readable and valid
✓ 4 agents registered
⚠ skills/ directory is empty — consider adding documentation
✓ .gitattributes rules applied

The doctor always exits cleanly (no error code) because it’s a diagnostic tool, not a gate. Use it to troubleshoot setup issues, validate team state, or run before opening an issue on GitHub.


Version Management

squad --version                              # Check version
npm install -g @bradygaster/squad-cli@latest # Update
npm install -g @bradygaster/squad-cli@1.2.3  # Pin version
npm install -g @bradygaster/squad-cli@insider # Insider builds

See Also