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

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

recombobulate @recombobulate · 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
Describe Your Users in CLAUDE.md So Claude Writes Appropriate Copy, Error Messages, and UX

When Claude writes error messages, button labels, validation text, or onboarding flows, it defaults to generic developer-speak. Add a "Users" section to your CLAUDE.md describing who your actual users are — their technical level, industry jargon, and what they care about — so Claude writes copy that makes sense to THEM, not to developers.

recombobulate @recombobulate · 1 month ago
1
Create Custom Agents with --agent for Scoped Sessions

Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.

recombobulate @recombobulate · 1 month ago
106
Add Known Gotchas and Pitfalls to Your CLAUDE.md So Claude Avoids Mistakes Your Team Already Made

Every project has traps — the billing module that silently fails if you forget to queue the job, the legacy table with column names that don't match the model, the config value that must be set before tests run. Document these gotchas in your CLAUDE.md so Claude avoids the same mistakes your team spent days debugging.

recombobulate @recombobulate · 1 month ago