# SaC Rebuild

Rebuild is an advanced checkpoint operation for a managed SaC artifact. It is not the first local happy path for creating a new SaC project.

## When Rebuild Helps

Use rebuild when the current workbook state is clearer than a noisy migration history, for example after repeated trial migrations or redundant table reshapes. The goal is to compact active source into one full checkpoint migration.

Rebuild does not extract mutation groups. It materializes the current managed artifact state as a full source checkpoint.

## Checkpoint Semantics

A successful rebuild replaces active `migrations/` with one generated checkpoint pack and resets the active artifact ledger to one rebuild entry. Historical source preservation is owned by git or external backups.

Default rebuild requires the source chain and artifact ledger to match. `--force` may discard active source history only inside the same workspace artifact boundary; it does not bypass managed-artifact validation, materialization gaps, package locks, transaction recovery, or path safety.

Rebuild recovery state is stored in `internal/sac/rebuild-recovery` and is cleaned after a successful rebuild or rollback. Agent runner evidence belongs in `internal/sac/runs/` and must not be removed by rebuild recovery cleanup.

## Related Help

- `univer help sac workflow`
- `univer help sac apply-ledger`
