Squad’s watch mode (Ralph) continuously polls for issues and dispatches agents to handle them. To do this reliably, it needs to track which issues have been triaged, which agents are working, and what the current execution state is. By default this state lives in memory — fast and zero-setup, but lost when the watch process exits. Two git-native backends provide durability across restarts without requiring any external infrastructure.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/bradygaster/squad/llms.txt
Use this file to discover all available pages before exploring further.
Backend Comparison
| Backend | Durability | Branches | Best for |
|---|---|---|---|
local (default) | Lost on restart | None | Local development, short sessions |
orphan | Survives restarts | Creates one orphan branch (squad-state) | Long-running teams, easy pruning |
two-layer | Survives restarts | Creates one orphan branch + git notes | CI/CD pipelines, shared teams, audit trails |
The
git-notes backend name is deprecated. It is automatically migrated to two-layer, which combines git notes for commit-scoped annotations with an orphan branch for permanent state. If your config.json still references "stateBackend": "git-notes", update it to "two-layer" to suppress the migration warning.In-Memory (Default)
The default backend stores everything in process memory. There is nothing to configure and no git operations are performed.Orphan Branch
The orphan backend stores state in a dedicated orphan branch namedsquad-state. This branch has no shared history with your main branch — it is isolated and can be pruned cleanly without affecting your codebase history.
squad-state branch automatically on first use. State is written as a git tree structure, with each state key stored as a file in the branch. The backend uses optimistic concurrency (compare-and-swap on update-ref) with jittered exponential backoff to handle concurrent writes safely.
To prune all watch state:
OrphanBranchBackend class from the SDK:
Two-Layer Backend
The two-layer backend combines two storage strategies: an orphan branch for permanent state (same as theorphan backend above) and git notes for commit-scoped annotations. Permanent state like decisions, histories, and logs goes to the orphan branch; ephemeral commit-scoped context goes to git notes under refs/notes/squad.
TwoLayerBackend also provides a promoteNotes method for moving ephemeral notes into permanent storage after a PR merges:
"promote_to_permanent": true are moved to the orphan layer and removed from notes. Notes flagged with "archive_on_close": true are copied to the orphan layer but kept as notes.
SDK Usage
UseresolveStateBackend to get the appropriate backend based on configuration:
StateBackend interface:
CircuitBreaker wraps git operations in git-native backends. After 5 consecutive failures it opens the circuit and rejects operations for 30 seconds before retrying. This prevents a broken git state from causing cascading failures in a long-running watch process.
Configuring via config.json
Set the default backend for a project in.squad/config.json:
--state-backend flag overrides this setting for a single run.
External State
squad externalize moves .squad/ state outside the working tree so it survives branch switches. This is useful when you are working across multiple branches and don’t want the squad state to differ between them.
squad status command shows whether the current squad is local or externalized and why.