# Syncing

A sync makes this machine match the manifest. `fleetrc sync` is the default command, so `fleetrc` alone does the same.

```sh
fleetrc sync
```

```txt
fleetrc: linked 12 skills into 2 folders
  + added: nuxt, nuxt-ui
```

## What happens

A sync runs these steps in order:

1. Takes the sync lock.
2. Loads the manifest named in `config.json`. On a machine that took its manifest from the tailnet policy, it asks the policy first.
3. Fetches each source. Git, npm and index sources go into the state folder. A `local` source, and a git source with a `path`, are linked where they are.
4. Picks one skill for each name. The first source in the manifest wins, and the report lists the others as `shadowed`.
5. Links each skill into every agent's folder, and unlinks skills the manifest dropped.
6. Saves state, runs the manifest's `hooks`, and writes the report.

`--offline` skips the fetch and links what is on disk. `--dry-run` prints what would change and writes nothing. `sync <source>` fetches one source and links the rest from disk.

## Link or copy

By default each agent folder holds a link to the skill. Edit the skill anywhere and every agent sees it. On Windows the link is a junction.

```sh
fleetrc sync --copy
```

`--copy` puts a copy of each skill folder in the agent folder instead, for a tool that does not follow links. `config.json` remembers the choice, so later syncs copy too, until you run `fleetrc sync --no-copy`. A dry run does not save it. If a Windows junction fails, fleetrc copies that folder.

Each agent folder keeps a `.fleetrc-manifest.json` that lists what fleetrc linked there. The record tells fleetrc which entries are its own.

## State and lock

The state folder is `~/.local/state/fleetrc`, or `$XDG_STATE_HOME/fleetrc`, or `%LOCALAPPDATA%\fleetrc` on Windows. `config.json` is in `~/.config/fleetrc`. [Environment variables](https://fleetrc.loadsheet.dev/reference/cli#environment-variables) lists what moves them.

| Path | Holds |
| --- | --- |
| `state.json` | What the last sync linked, and each skill's install record |
| `store/<id>/` | One folder per fetched source, with `live`, `base` and `upstream` copies of its skills |
| `last-run.json` | The report of the last sync |
| `sync.lock` | The process that is syncing now |
| `backup/` | Skills a sync moved aside with your edits in them |

Two syncs never run at once. A second one stops with `another fleetrc sync is running`. `merge`, `fork`, `adopt` and `remove` change the same files, so they wait up to 10 seconds for a running sync, then ask you to try again. A lock left by a killed sync is moved aside.

## Local edits

You can edit a vendored skill in place: the agent folder leads into `store/<id>/live`. fleetrc keeps `base`, the version you installed, and compares against it.

An edited skill is held. When upstream changes, the new version waits and the report says so:

```txt
  edited tool (vendor): SKILL.md; upstream changed too, see `fleetrc diff tool` or `fleetrc merge tool`
```

`fleetrc diff tool` shows your edits and the pending update. `fleetrc merge tool` does a three-way merge. When both sides changed the same lines, it writes conflict markers into the skill and exits `1`:

```txt [skills/tool/SKILL.md]
<<<<<<< local
TWO (mine)
=======
TWO (theirs)
>>>>>>> upstream
```

Resolve the markers by hand and run `merge` again. Until then the skill stays held, and `status` and `doctor` name it. In `--copy` mode, an edit made in the agent folder counts the same way.

## Review updates

Set `"update": "review"` on a source to read changes before they land. A sync still fetches it and applies nothing:

```txt
  review ag-grid: updates for ag-grid; see `fleetrc diff <skill>`, apply with `fleetrc update ag-grid`
```

`fleetrc diff` shows every waiting update. `fleetrc update ag-grid` applies them, and `fleetrc add --review` sets the key when you add a source.

## Forks

`fleetrc fork <skill>` copies a vendored skill into your own repository and records the upstream commit. After that, a sync reports a pending `fork` update when upstream changes the skill. `diff` and `merge` work as they do for an edited skill.

## Check the state

```sh
fleetrc status
```

```txt
manifest: me/skills//.fleetrc/manifest.json
last run: 2026-12-04T09:12:41.208Z
fleetrc: linked 12 skills into 2 folders
  edited tool (vendor): SKILL.md
  review ag-grid: updates for ag-grid; see `fleetrc diff <skill>`, apply with `fleetrc update ag-grid`
syncs start from: the session hooks of Claude Code
```

`status` reads the last report and the machine. It also lists forks that upstream changed, merge conflicts, the timer, and Codex sessions that started before the last skill change. `fleetrc list` prints each skill with its source and path. Neither needs the network.

## Report

Every sync except a dry run writes `last-run.json` and prints the same report as text. `--json` prints it as JSON instead. After the file is written, two optional steps run:

| Manifest key | What happens |
| --- | --- |
| `report.run` | A shell command that gets the report JSON on stdin. It stops after 2 minutes. |
| `hub` | fleetrc POSTs the report to this URL. |

If either fails, the sync still succeeds. The report gains a warning, such as `report.run exited with 1`, and `last-run.json` is written again with it.

## When a sync fails

A source that fails to fetch keeps its last good copy. The report warns `kept the last good copy` and records the failure in `errors`. A manifest in `extends` that does not load keeps the skills it gave last time.

A failing manifest `hooks` command adds an error as well. Any error makes the sync exit `1`, and `status` shows `(with errors)` after the last run time. A usage mistake exits `2`. See [Command line](https://fleetrc.loadsheet.dev/reference/cli#exit-codes).

<!-- vitehub-docs:section-links -->
## In this section

- [Introduction](https://fleetrc.loadsheet.dev/raw/guide.md)
- [Installation](https://fleetrc.loadsheet.dev/raw/guide/installation.md)
- [The manifest](https://fleetrc.loadsheet.dev/raw/guide/manifest.md)
- [Syncing](https://fleetrc.loadsheet.dev/raw/guide/sync.md) (this page)
- [Hooks and MCP servers](https://fleetrc.loadsheet.dev/raw/guide/hooks-and-mcp.md)
- [Fleet](https://fleetrc.loadsheet.dev/raw/guide/fleet.md)
- [Timer](https://fleetrc.loadsheet.dev/raw/guide/timer.md)
- [Agents](https://fleetrc.loadsheet.dev/raw/guide/agents.md)

Next: [Hooks and MCP servers](https://fleetrc.loadsheet.dev/raw/guide/hooks-and-mcp.md)

All pages: [llms.txt](https://fleetrc.loadsheet.dev/llms.txt)

Something on this page does not work as written? Tell the user, and draft an issue for them to post: [issue tracker](https://github.com/words-with-agents/fleetrc/issues). Report a security vulnerability privately, never in a public issue.
