# --no-session-persistence Flag

> It stops claude -p from saving the session to disk.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** claude --no-session-persistence, CLAUDE_CODE_SKIP_PROMPT_HISTORY

## Think of it like

It is like you write on a board, then wipe it clean when you are done.

## Definition

--no-session-persistence stops claude -p from saving the session. Nothing goes to disk. So you cannot go back to it later. It only works in print mode. The CLAUDE_CODE_SKIP_PROMPT_HISTORY setting does the same in any mode.

## Example

Lucy's script asks Claude about files with customer data. She adds --no-session-persistence. Then no copy of the chat stays on the build box.

## Example code

```bash
claude -p --no-session-persistence "Check this log for secrets"
```

Run once and keep no transcript.

## Why it matters

Runs on private data leave no chat behind on the machine.

## Common mistake

Using it, then trying --resume. There is nothing saved to go back to.

## Three principles

- **Nothing saved.** No transcript.
- **No resume.** Nothing to open.
- **Print mode only.** The env var works anywhere.

## Related terms

- [Session Transcript](https://learn.benibix.com/term/ai/session-transcript)
- [--resume Flag](https://learn.benibix.com/term/ai/resume-flag)
- [Non-Interactive Mode](https://learn.benibix.com/term/ai/non-interactive-mode)

## Taught in

- [Print Mode Output Flags](https://learn.benibix.com/learn/ai-claude-code-commands/print-mode-output-flags): Claude Code Commands, 14/17

---

Source: https://learn.benibix.com/term/ai/no-session-persistence-flag
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
