Skip to main content
Version: v5.7.0

opschain state reset

Included from Basic tier

Deletes a project's runs, steps, events, logs, artifacts and database property layers from the per-user store — the development-loop clobber at project granularity. This truly deletes rows (unlike properties reset, which hands authority back to the repo file). The repository working tree is never touched, the local secret store is only touched with an explicit --secrets, and the store's encryption keyset (<opschain home>/local/keys.env, which protects sensitive step outputs and the property and settings layers at rest) only with an explicit --purge-keys.

Interactively it prompts delete ALL local state for project <code>? [y/N]: (mentioning the secret store too when --secrets is given, and the keyset — AND the local encryption keyset (values still encrypted with it become unreadable) — with --purge-keys); anything but y/yes prints state reset aborted and deletes nothing. Without a terminal on stdin the command refuses instead of guessing — re-run with --force. On success it reports what went: <project-path>: deleted <n> runs, <n> steps, <n> events, <n> artifacts, <n> log segments, <n> property versions (<n> blobs released), plus secret store cleared: <n> secrets deleted with --secrets. -o json|yaml emits the counts as a document.

The keyset and --purge-keys​

A project reset keeps the keyset: other projects in the same per-user store may still hold values encrypted with it, and losing it makes those unreadable. --purge-keys removes local/keys.env only once nothing in the store is still encrypted with it — the reset then ends with local keyset removed: <path> (a fresh one is generated on the next local write). While another project's sensitive outputs or layers still depend on it, the reset itself succeeds and the keyset stays, reported as local keyset kept: <path> — the store still holds values encrypted with it (another project's sensitive outputs or property layers); reset those projects before purging it. -o json|yaml carries the outcome under keyset (path, removed, and kept with the reason).

This verb is repo-scoped: against a server target it fails with resetting project state is repo-scoped and runs locally — it has no remote form; run it in the repository (or pass --local).

Flags​

FlagMeaning
--project <code>Project code whose local state is deleted (required).
--forceSkip the confirmation prompt (required when stdin is not a terminal).
--secretsAlso clear the local secret store (never touched otherwise).
--purge-keysAlso remove the local store's encryption keyset once nothing in the store is still encrypted with it (never touched otherwise).

Exit codes​

CodeMeaning
0State deleted, or the prompt was answered no (state reset aborted).
1The deletion failed.
2Usage error.

Named errors​

  • --project is required
  • state reset deletes project "<code>"'s local runs, logs and property layers — re-run with --force to confirm (stdin is not an interactive terminal)

Both exit 2.

Examples​

opschain state reset --project demo
opschain state reset --project demo --secrets --force
opschain state reset --project demo --purge-keys --force

See also​

  • opschain docs cli/state-doctor — inspect before you clobber.