Sync
Sync is the fifth step of the Flow workflow. In this guide, you will learn:
- What the sync skill does and what canonical state is
- How the promotion works
- When sync stops instead of guessing
Overview
The sync skill promotes a finished change into Flow's canonical state: the long-lived, always-current record of how each capability behaves.
You invoke it with the change name:
/flow-sync project-archiving
A change is temporary. Once it ships, its folder is archived and forgotten. The state files are permanent. Sync is the step that carries what a change did out of the temporary world and into the permanent one.
Canonical state
Flow keeps one state file per capability under .flow/states/. A state file such as .flow/states/projects.md is the current behavior contract for that capability: a flat list of everything it guarantees today, with no history and no diff markers.
The brief step already produced the raw material. For every capability a change affects, the brief wrote a delta: a record of which behaviors the change adds, modifies, or removes. Sync applies those deltas to the state files.
How the promotion works
Sync is mechanical. It does not re-interpret the change or re-derive behavior; it applies fixed rules, matched by behavior heading:
- An added behavior is appended to the capability's state file.
- A modified behavior replaces the matching entry already in the state file.
- A removed behavior is deleted from the state file.
Before it writes anything, sync validates every delta against every state file. If all of them apply cleanly, it computes the new state files and writes them in one pass. If any single delta does not apply, the run stops before the filesystem is touched, so a problem in one capability never leaves the state half-updated.
Gates and escalation
Sync will only promote a change that was actually built. It checks for the built stamp the build step leaves, and refuses to run without it, because unbuilt work must never reach the canonical record.
When a delta does not apply, for example a modified behavior whose heading matches nothing in the state file, sync stops and reports SYNC PAUSED. It names the capability, the behavior, and what it found, and waits for you. It never guesses a match or writes a partial state file.
Once the state files are written, sync stamps each delta as synced. That stamp is the signal the next step depends on.
What sync produces
Sync creates or updates the affected files under .flow/states/, and stamps each delta in the change folder as synced. It writes no application code and makes no commits.
Next step
- Hand off to the Archive skill to file the completed change away.