> For the complete documentation index, see [llms.txt](https://faction-os.gitbook.io/faction-os-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faction-os.gitbook.io/faction-os-docs/docs/runbooks/factionos-backup.md).

# FactionOS Local Backup Runbook

This runbook backs up the persistent local FactionOS state surface:

* `~/.factionos/memory.jsonl`
* `~/.factionos/settings.json`
* `~/.factionos/lifecycle.json`
* `~/.factionos/project-root.json`
* `~/.factionos/sessions/`

Backups are written to `~/.factionos/backups/` by default and retain the most recent 30 days unless `FACTIONOS_BACKUP_RETENTION_DAYS` overrides the window.

## Schedule

Recommended cron entry:

```cron
15 3 * * * cd /path/to/factionos && npm run backup:factionos >/tmp/factionos-backup.log 2>&1
```

If the machine uses a different home directory for the runtime state, set `FACTIONOS_HOME` and optionally `FACTIONOS_BACKUP_DIR` before invoking the command.

## Verify

1. Run `npm run backup:factionos`.
2. Confirm a new `factionos-state-*.tar.gz` archive exists in the backup directory.
3. Run `npm run backup:factionos:verify -- <archive-path>` or extract the archive with `tar -xzf <archive-path> -C <temp-dir>` and confirm the `manifest.json` plus the expected state files are present.

## Restore Check

To sanity-check a backup without touching the live state:

```bash
mkdir -p /tmp/factionos-restore
tar -xzf /path/to/factionos-state-*.tar.gz -C /tmp/factionos-restore
cat /tmp/factionos-restore/manifest.json
```

The extracted archive should contain the manifest and the backed-up files or directories at the archive root.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://faction-os.gitbook.io/faction-os-docs/docs/runbooks/factionos-backup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
