Squad Squad
Back to Blog

State Backends — Keep Your PRs Clean

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

Squad now supports 4 state backends. Your PRs stay clean — just code.

The Problem

Every time an agent makes a decision, writes to history, or logs a session, those changes end up as .squad/ file modifications in your working branch. Open a PR and your reviewer sees 57 code changes buried under 40 decision logs, agent history entries, and session files.

Two completely different workflows sharing one branch:

The Fix

PR #1004 adds state backend support. One line in your config, and all mutable state goes somewhere else.

# The fastest path to clean PRs:
squad init --state-backend two-layer

Four Options

BackendWhere state goesPRs clean?Setup
localWorking branch (default)Zero config
orphansquad-state branchConfig + branch
two-layerNotes + orphan combined--state-backend two-layer

The Two-Layer Architecture

The two-layer option implements the architecture from Tamir’s blog post:

This handles the three scenarios from the blog correctly:

  1. Rejected feature — decision on a rejected PR is NOT promoted ✅
  2. Universal truth — routing change flagged with promote_to_permanent survives ✅
  3. Valuable failure — research flagged with archive_on_close is preserved ✅

How It Works (Under the Hood)

The Squad coordinator (squad.agent.md) detects stateBackend from .squad/config.json at session start and adapts every agent spawn prompt:

Static config (charters, team.md, routing.md) always stays on disk. Only mutable state (decisions, history, logs) moves to the configured backend.

Quick Start

# New project — set backend at init time
squad init --state-backend two-layer

# Existing project — migrate with one config change
# Edit .squad/config.json → add "stateBackend": "two-layer"
git add .squad/config.json && git commit -m "config: use two-layer"

For the full migration guide and troubleshooting, see the State Backends feature docs.

Tested With Real Squads

We ran 12 E2E tests with real squad sessions — real team casting (Usual Suspects, Firefly universes), real agent spawns, real decisions recorded. All evidence is in PR #1004.

Key proof:

Try It

Build from the PR branch:

git clone https://github.com/bradygaster/squad.git
cd squad && git checkout feat/state-backend-global-996
npm install && npm run build

Then init any repo with your preferred backend:

node <path>/packages/squad-cli/dist/cli-entry.js init --state-backend two-layer

We’d love feedback — especially on whether the init flow feels right and whether state actually persists across branch switches in your environment.