Faramesh Docs
CLI

faramesh destroy

Tear down the local stack runtime, optionally remove compiled artifacts and the WAL, and reset to a clean slate.

faramesh destroy is the cleanup command. It stops the daemon, clears the runtime socket, optionally removes compiled artifacts and the WAL, and gets you back to a state where faramesh init (or a fresh apply) starts cleanly.

It does not delete governance.fms. Your source policy is always safe.

Usage

Terminal
faramesh destroy [--dir DIR] [--keep-wal] [--keep-state] [--yes]
FlagDescription
--dir DIRStack directory. Defaults to the current directory.
--keep-walStop the daemon and clear runtime, but preserve the WAL on disk.
--keep-stateStop the daemon but preserve compiled artifacts in .faramesh/.
--yesSkip the interactive confirmation. Required in CI.

What it removes

By default, destroy removes:

PathContents
~/.faramesh/runtime/faramesh.sockUnix socket the daemon was listening on
~/.faramesh/runtime/daemon.pidPID file
<stack>/.faramesh/policy.binCompiled AST
<stack>/.faramesh/bin/agentGenerated launcher
<stack>/.faramesh/runtime/agent.envGenerated env file
<stack>/.faramesh/runtime/cli.pathCLI path indirection
<stack>/.faramesh-wal/The Write-Ahead Log (DPRs) — unless --keep-wal
<stack>/.faramesh-data/SQLite store and HMAC keys — unless --keep-state

It does not remove:

  • governance.fms and any governance.fms.lock
  • Provider binaries cached in ~/.faramesh/cache/
  • Anything outside the stack directory

What happens, in order

destroy pipeline
1.  Send SIGTERM to the daemon (graceful shutdown).
2.  If supervised_command was running, the agent receives SIGINT first.
3.  Wait up to the configured timeout (default 10s).
4.  If still running, SIGKILL.
5.  Remove the socket and pid file.
6.  Remove .faramesh/policy.bin and .faramesh/bin/.
7.  If not --keep-wal: remove the WAL.
8.  If not --keep-state: remove the SQLite store.
9.  Print summary.

The daemon's POST_SHUTDOWN hook (if you've configured one) runs before step 5.

Output

Output
$ faramesh destroy
This will stop the daemon and remove:
  /Users/you/.faramesh/runtime/faramesh.sock
  ./.faramesh/policy.bin
  ./.faramesh/bin/agent
  ./.faramesh-wal/
  ./.faramesh-data/

Continue? [y/N] y
✓ daemon stopped (pid 42189)
✓ runtime socket removed
✓ compiled artifacts removed
✓ WAL removed (1,432 records)
✓ stack destroyed

With --keep-wal:

Output
$ faramesh destroy --keep-wal
✓ daemon stopped
✓ runtime socket removed
✓ compiled artifacts removed
→ WAL kept at ./.faramesh-wal/  (1,432 records preserved for audit)
✓ stack destroyed

When to use it

ScenarioCommand
Switching from dev to a clean applyfaramesh destroy
Resetting before re-init on the same directoryfaramesh destroy
Cleaning up between integration testsfaramesh destroy --yes
Stopping production but preserving audit trailfaramesh destroy --keep-wal
Decommissioning a stack permanentlyfaramesh destroy then rm governance.fms

Difference from apply --stop

CommandStops daemonRemoves socketRemoves compiled ASTRemoves WAL
faramesh apply --stop
faramesh destroy✓ (default)
faramesh destroy --keep-wal

Use apply --stop when you'll restart with the same policy. Use destroy when you want a clean slate or are switching environments.

Audit consequences of removing the WAL

The WAL is your tamper-evident audit trail. Removing it is destructive and irreversible. For any stack that has produced production decisions, archive the WAL first:

Terminal
faramesh audit export --format json > audit-$(date +%Y%m%d).json
faramesh destroy --keep-wal

For dev/CI stacks, removing the WAL is fine. The records are tagged as dev anyway.

What's next

On this page