Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix: add --no-session-persistence to Claude commit generation (#1454)

Maximilian Roos9b77ab2d93d3
diff --git a/Taskfile.yaml b/Taskfile.yaml
index 8b6d47882..2ef47cdec 100644
--- a/Taskfile.yaml
+++ b/Taskfile.yaml
@@ -385,7 +385,7 @@ tasks:
# Documented commands from llm-commits.md
declare -A COMMANDS
- COMMANDS["claude"]='MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='"'"''"'"' --disable-slash-commands --setting-sources='"'"''"'"' --system-prompt='"'"''"'"''
+ COMMANDS["claude"]='MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='"'"''"'"' --disable-slash-commands --setting-sources='"'"''"'"' --system-prompt='"'"''"'"''
COMMANDS["llm"]='llm -m claude-haiku-4.5'
COMMANDS["aichat"]='aichat -m claude:claude-haiku-4.5'
COMMANDS["codex"]='codex exec -m gpt-5.1-codex-mini -c model_reasoning_effort='"'"'low'"'"' --sandbox=read-only --json - | jq -sr '"'"'[.[] | select(.item.type? == "agent_message")] | last.item.text'"'"''
diff --git a/docs/content/config.md b/docs/content/config.md
index 66cee8c05..6fee01e03 100644
--- a/docs/content/config.md
+++ b/docs/content/config.md
@@ -53,7 +53,7 @@ Organizations can also deploy a system-wide config file for shared defaults —
worktree-path = ".worktrees/{{ branch | sanitize }}"
[commit.generation]
-command = "MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
+command = "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
```
**Project config** — shared team settings:
diff --git a/docs/content/llm-commits.md b/docs/content/llm-commits.md
index dd5bf66d6..635b74551 100644
--- a/docs/content/llm-commits.md
+++ b/docs/content/llm-commits.md
@@ -24,10 +24,10 @@ Any command that reads a prompt from stdin and outputs a commit message works. A
```toml
[commit.generation]
-command = "CLAUDECODE= MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
+command = "CLAUDECODE= MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
```
-`CLAUDECODE=` unsets the nesting guard so `claude -p` works from within a Claude Code session. The other flags disable tools, skills, settings, and system prompt for fast text-only output. See [Claude Code docs](https://docs.anthropic.com/en/docs/build-with-claude/claude-code) for installation.
+`CLAUDECODE=` unsets the nesting guard so `claude -p` works from within a Claude Code session. `--no-session-persistence` prevents the commit conversation from polluting `claude --continue`. The other flags disable tools, skills, settings, and system prompt for fast text-only output. See [Claude Code docs](https://docs.anthropic.com/en/docs/build-with-claude/claude-code) for installation.
### Codex
diff --git a/skills/worktrunk/reference/config.md b/skills/worktrunk/reference/config.md
index 8a6204bb1..b40af9c23 100644
--- a/skills/worktrunk/reference/config.md
+++ b/skills/worktrunk/reference/config.md
@@ -44,7 +44,7 @@ Organizations can also deploy a system-wide config file for shared defaults —
worktree-path = ".worktrees/{{ branch | sanitize }}"
[commit.generation]
-command = "MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
+command = "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
```
**Project config** — shared team settings:
diff --git a/skills/worktrunk/reference/llm-commits.md b/skills/worktrunk/reference/llm-commits.md
index 5d9d14dcd..483954d9b 100644
--- a/skills/worktrunk/reference/llm-commits.md
+++ b/skills/worktrunk/reference/llm-commits.md
@@ -10,10 +10,10 @@ Any command that reads a prompt from stdin and outputs a commit message works. A
```toml
[commit.generation]
-command = "CLAUDECODE= MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
+command = "CLAUDECODE= MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
```
-`CLAUDECODE=` unsets the nesting guard so `claude -p` works from within a Claude Code session. The other flags disable tools, skills, settings, and system prompt for fast text-only output. See [Claude Code docs](https://docs.anthropic.com/en/docs/build-with-claude/claude-code) for installation.
+`CLAUDECODE=` unsets the nesting guard so `claude -p` works from within a Claude Code session. `--no-session-persistence` prevents the commit conversation from polluting `claude --continue`. The other flags disable tools, skills, settings, and system prompt for fast text-only output. See [Claude Code docs](https://docs.anthropic.com/en/docs/build-with-claude/claude-code) for installation.
### Codex
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 2045d77bb..68d98f833 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -1556,7 +1556,7 @@ Organizations can also deploy a system-wide config file for shared defaults —
worktree-path = ".worktrees/{{ branch | sanitize }}"
[commit.generation]
-command = "MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
+command = "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
```
**Project config** — shared team settings:
diff --git a/src/config/user/sections.rs b/src/config/user/sections.rs
index e284c3cab..849c1a682 100644
--- a/src/config/user/sections.rs
+++ b/src/config/user/sections.rs
@@ -45,7 +45,7 @@ pub struct CommitGenerationConfig {
///
/// Examples:
/// - `"llm -m claude-haiku-4.5"`
- /// - `"MAX_THINKING_TOKENS=0 claude -p --model=haiku"`
+ /// - `"MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku"`
///
/// The command receives the prompt via stdin and should output the commit message.
#[serde(default)]
diff --git a/src/output/commit_generation.rs b/src/output/commit_generation.rs
index 38cabad77..290ad3ad0 100644
--- a/src/output/commit_generation.rs
+++ b/src/output/commit_generation.rs
@@ -34,7 +34,7 @@ impl LlmTool {
pub fn recommended_config(&self) -> &'static str {
match self {
LlmTool::Claude => {
- "MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
+ "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
}
LlmTool::Codex => {
r#"codex exec -m gpt-5.1-codex-mini -c model_reasoning_effort='low' --sandbox=read-only --json - | jq -sr '[.[] | select(.item.type? == "agent_message")] | last.item.text'"#
@@ -198,7 +198,7 @@ mod tests {
#[test]
fn test_llm_tool_recommended_config() {
- assert_snapshot!(LlmTool::Claude.recommended_config(), @"MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''");
+ assert_snapshot!(LlmTool::Claude.recommended_config(), @"MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''");
assert_snapshot!(LlmTool::Codex.recommended_config(), @r#"codex exec -m gpt-5.1-codex-mini -c model_reasoning_effort='low' --sandbox=read-only --json - | jq -sr '[.[] | select(.item.type? == "agent_message")] | last.item.text'"#);
}
@@ -217,7 +217,7 @@ mod tests {
// Long commands stay as single-line TOML
let cmd = LlmTool::Claude.recommended_config();
let result = format_command_for_display(cmd);
- assert_snapshot!(result, @r#""MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''""#);
+ assert_snapshot!(result, @r#""MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''""#);
}
#[test]
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
index 24c860841..c42d4825b 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
@@ -91,7 +91,7 @@ Organizations can also deploy a system-wide config file for shared defaults —
  worktree-path = ".worktrees/{{ branch | sanitize }}"
 
  [commit.generation]
-  command = "MAX_THINKING_TOKENS=0 claude -p --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
+  command = "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --disable-slash-commands --setting-sources='' --system-prompt=''"
Project config — shared team settings: