CLAUDE_CODE_SKIP_PROMPT_HISTORY disables all transcript persistence since 2.1.77
Bug Description
<mark>CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 silently disables all session transcript persistence</mark> starting in version 2.1.77.
Quick Summary
Previously (2.1.76 and earlier), this env var only controlled prompt history (up-arrow recall in <samp>history.jsonl</samp>).
The regression: Zero <samp>.jsonl</samp> transcript files are written for any session, breaking:
- <kbd>/resume</kbd>
- <kbd>/stats</kbd>
- Session sharing
- All features that depend on transcript data
---
What Changed
The Gatekeeper Method
The shouldSkipPersistence() method on the session storage class gates every call to appendEntry() and materializeSessionFile() — the two functions responsible for creating and writing to transcript <samp>.jsonl</samp> files.
The Addition
A 4th condition was added in 2.1.77 that checks CLAUDE_CODE_SKIP_PROMPT_HISTORY.
<details>
<summary><strong>Code Comparison</strong> — Before vs. After</summary>
<figure>
2.1.76 — shouldSkipPersistence():
shouldSkipPersistence() {
let H = isEnvVarTrue(process.env.TEST_ENABLE_SESSION_PERSISTENCE);
return getNodeEnv() === "test" && !H
|| getSettings()?.cleanupPeriodDays === 0
|| isSkipPersistence();
}
<figcaption>Three conditions: test mode, cleanupPeriodDays, and isSkipPersistence()</figcaption>
</figure>
<figure>
2.1.77+ — shouldSkipPersistence():
shouldSkipPersistence() {
let H = isEnvVarTrue(process.env.TEST_ENABLE_SESSION_PERSISTENCE);
return getNodeEnv() === "test" && !H
|| getSettings()?.cleanupPeriodDays === 0
|| isSkipPersistence()
|| isEnvVarTrue(process.env.CLAUDE_CODE_SKIP_PROMPT_HISTORY); // <-- NEW
}
<figcaption><mark>Fourth condition added</mark>: CLAUDE_CODE_SKIP_PROMPT_HISTORY now gates all persistence</figcaption>
</figure>
</details>
The Effect
Result: IfCLAUDE_CODE_SKIP_PROMPT_HISTORYis set to any truthy value ("1","true","yes"), <mark>no transcript files are created or written to</mark>. BothappendEntry()andmaterializeSessionFile()bail out immediately whenshouldSkipPersistence()returnstrue.
---
How It Breaks
Original Purpose
The CLAUDE_CODE_SKIP_PROMPT_HISTORY env var was introduced to let users disable prompt history recall (the <kbd>↑</kbd> up-arrow feature that writes to <samp>history.jsonl</samp>).
Independent Implementation
That behavior is handled by a completely separate function which checks the same env var independently:
<figure>
function writePromptHistoryEntry(H) {
if (isEnvVarTrue(process.env.CLAUDE_CODE_SKIP_PROMPT_HISTORY)) return;
// ... writes to history.jsonl
}
<figcaption>Prompt history check is independent — does not need shouldSkipPersistence() gate</figcaption>
</figure>
What Users Expected vs. What Happened
Users who set this env var expected it to only disable prompt history, as the name implies.
Instead, starting in 2.1.77, it also disables:
| Feature | How it breaks |
|:--------|:-------------|
| Session transcripts | No <samp>.jsonl</samp> file created — materializeSessionFile() returns early |
| <kbd>/resume</kbd> | No transcript to resume from |
| <kbd>/stats</kbd> | Sessions missing from activity data |
| Session sharing | No transcript to upload |
| Context window compaction | Compaction snapshots not persisted |
---
Impact
Silent Data Loss
No error, warning, or log message is emitted. Sessions appear to work normally but produce no persistent record.
Retroactive
Every session since upgrading to 2.1.77 has zero transcript data. There is no way to recover these transcripts.
Mislabeled Env Var
The env var name says <q>skip prompt history</q> but now controls <strong>all persistence</strong>. Users have no reason to expect this side effect.
---
Steps to Reproduce
1. Configure the env var
Set CLAUDE_CODE_SKIP_PROMPT_HISTORY to "1" in <samp>~/.claude/settings.json</samp>:
<figure>
{
"env": {
"CLAUDE_CODE_SKIP_PROMPT_HISTORY": "1"
}
}
<figcaption>Configuration that triggers the bug</figcaption>
</figure>
2. Start a session
Start a new Claude Code session (<kbd>claude</kbd> in terminal)
3. Have a conversation
Send any message and have a conversation
4. Exit
Exit the session
5. Check for transcripts
<figure>
find ~/.claude/projects/ -name "*.jsonl" -newer /tmp/marker -type f
<figcaption>No transcript files will be found for sessions started after setting the env var</figcaption>
</figure>
6. Result
<mark>No transcript <samp>.jsonl</samp> is created for the session</mark>
---
Expected Behavior
CLAUDE_CODE_SKIP_PROMPT_HISTORY should only disable prompt history (<samp>history.jsonl</samp>), not session transcript persistence. This was the behavior in 2.1.76 and earlier.
---
Recommended Fix
[!TIP] Primary Fix: RemoveisEnvVarTrue(process.env.CLAUDE_CODE_SKIP_PROMPT_HISTORY)fromshouldSkipPersistence(). The prompt history function already checks this env var independently — it does not need to also gate transcript persistence.
If Dual-Purpose Behavior Is Intended
If CLAUDE_CODE_SKIP_PROMPT_HISTORY is meant to control both prompt history and session transcripts, the solution is:
- Rename the env var to something clear:
CLAUDE_CODE_SKIP_ALL_PERSISTENCE - Update documentation to explicitly state it disables both features
- Provide a migration notice for users who have the old env var set
This would prevent silent breakage for existing users.
---
Environment
| | Details |
|:--|:--|
| Regression introduced | 2.1.77 |
| Last working version | 2.1.76 |
| Current version tested | 2.1.79 |
| Platform | Linux (Arch) |
---
<details>
<summary><strong>Discovery Context</strong> — How this bug was found</summary>
Investigation Timeline
This bug was discovered during a forensic investigation into missing session transcripts:
- Timeline verification
Confirmed last working transcripts were written by 2.1.76 processes (Mar 16, 03:49–05:36)
- Binary comparison
Extracted and compared shouldSkipPersistence() implementation between 2.1.76 and 2.1.77 binaries
- Env var audit
Checked all environment variables in <samp>~/.claude/settings.json</samp>
- Code path tracing
Followed transcript writing from API response → recordTranscript() → insertMessageChain() → appendEntry() → gate at shouldSkipPersistence()
Root Cause Isolation
The regression was isolated to the single line addition in 2.1.77's shouldSkipPersistence() method.
</details>
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗