Guidance for AI coding agents working on this repository.
squads-cli is a CLI orchestrator for autonomous AI agent teams. It organizes agents into squads (domain-aligned teams), manages their context and memory, and dispatches them via native AI CLIs (claude, gemini, etc.).
The CLI is open source. Agents are the primary consumers — after squads run dispatches an agent, it calls CLI commands to read context, persist memory, and coordinate with other agents.
src/
├── cli.ts # All command registrations (Commander.js, lazy imports)
├── commands/ # One file per command — start here for any command change
├── lib/ # Shared logic (parsing, context, memory, git, providers)
templates/ # Files generated by `squads init`
test/ # Unit + E2E tests (vitest)
Key files by concern:
| Concern | File |
|---|---|
| Squad/agent discovery | src/lib/squad-parser.ts |
| Context injection | src/lib/run-context.ts |
| Agent execution | src/commands/run.ts |
| Multi-agent conversation | src/lib/conversation.ts, src/lib/workflow.ts |
| Provider CLIs | src/lib/llm-clis.ts |
| Memory read/write | src/lib/memory.ts |
| Terminal output | src/lib/terminal.ts |
| Command registration | src/cli.ts |
npm install
npm run build # Required before committing — must pass
npm test # 1700+ tests, all must pass
npm run lint # ESLint- Create
src/commands/<name>.tsexporting an async function - Register in
src/cli.tswith lazy import - Add
--jsonflag for machine output - Add tests in
test/commands/<name>.test.ts
Use the removedCommand() pattern in cli.ts — never silently delete:
program.command('old-name', { hidden: true })
.description('[removed]')
.action(removedCommand('old-name', 'Use: squads replacement'));All filesystem discovery goes through squad-parser.ts. Never hardcode paths to .agents/ — use findSquadsDir(), findProjectRoot(), loadSquad().
- TypeScript strict mode. No
anytypes. - Lazy imports in cli.ts. Commands are loaded only when invoked.
- Terminal output via
terminal.ts. UsewriteLine(),colors,bold— not rawconsole.log. --jsonon every command. Agents parse CLI output programmatically.- No new dependencies without explicit approval.
- No hardcoded repos, orgs, or file paths. Everything discovered at runtime.
- Graceful degradation. Missing files, unavailable APIs — handle gracefully, never crash.
- Conventional Commits.
feat:,fix:,docs:,chore:.
Tests use vitest. Run the full suite before submitting changes:
npm test # All tests
npx vitest run test/commands/run.test.ts # Single fileE2E tests in test/e2e/ run actual CLI commands against temp directories.
- Don't add dependencies (especially heavy ones) without discussion
- Don't use
console.login command implementations - Don't hardcode GitHub as the only git provider
- Don't break
--jsonoutput formats (agents depend on them) - Don't skip the build step —
npm run buildis the quality gate