$ recombobulate _
home / tips / use-no-session-persistence-for-ephemeral-automated-runs
0

Use --no-session-persistence for Ephemeral Automated Runs

bagwaa @bagwaa · Mar 26, 2026 · Configuration
use-no-session-persistence-for-ephemeral-automated-runs

By default, Claude Code saves every session to disk so you can resume it later. In automated pipelines, this creates unnecessary clutter. The --no-session-persistence flag prevents sessions from being written to disk entirely.

claude -p --no-session-persistence "Run the test suite and report failures"

This is ideal for CI/CD jobs, cron tasks, and any scripted workflow where the session is disposable. Without this flag, each automated run creates a session file that accumulates over time, eventually eating disk space and making --resume harder to navigate.

It pairs naturally with other print-mode flags for clean, ephemeral pipelines:

# Ephemeral run with JSON output and a spending cap
claude -p \
  --no-session-persistence \
  --output-format json \
  --max-budget-usd 1.00 \
  "Analyse this PR diff and return a risk score"

One thing to note: this flag only works in print mode (-p). Interactive sessions always persist because the whole point of interactive mode is that you might want to come back later.

If you are running hundreds of automated Claude Code invocations (for example, processing a batch of files), this flag prevents your .claude/ directory from ballooning with session data you will never revisit.

Keep your automated runs clean by telling Claude not to remember them.


via Claude Code CLI Reference

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Switch to the Stable Update Channel with autoUpdatesChannel

The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.

bagwaa @bagwaa · 1 hour ago
0
Set Claude's Response Language with the language Setting

The language setting makes Claude respond in your preferred language by default, across every session and project.

bagwaa @bagwaa · 1 hour ago
0
Customize or Remove Claude's Git Attribution with the attribution Setting

The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.

bagwaa @bagwaa · 1 hour ago