Skip to content

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

Wrap prompt openers in <task> tags and reword squash template (#1794)

Maximilian Roos4047079fb206
diff --git a/dev/config.example.toml b/dev/config.example.toml
index 38d31d880..60b8c16e6 100644
--- a/dev/config.example.toml
+++ b/dev/config.example.toml
@@ -174,7 +174,7 @@
# <!-- DEFAULT_TEMPLATE_START -->
# [commit.generation]
# template = """
-# Write a commit message for the staged changes below.
+# <task>Write a commit message for the staged changes below.</task>
#
# <format>
# - Subject line under 50 chars
@@ -218,7 +218,7 @@
# <!-- DEFAULT_SQUASH_TEMPLATE_START -->
# [commit.generation]
# squash-template = """
-# Combine these commits into a single commit message.
+# <task>Write a commit message for the combined effect of these commits.</task>
#
# <format>
# - Subject line under 50 chars
diff --git a/docs/content/config.md b/docs/content/config.md
index e07eaf69b..c126b1f34 100644
--- a/docs/content/config.md
+++ b/docs/content/config.md
@@ -265,7 +265,7 @@ Default template:
```toml
[commit.generation]
template = """
-Write a commit message for the staged changes below.
+<task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
@@ -311,7 +311,7 @@ Default template:
```toml
[commit.generation]
squash-template = """
-Combine these commits into a single commit message.
+<task>Write a commit message for the combined effect of these commits.</task>
<format>
- Subject line under 50 chars
diff --git a/skills/worktrunk/reference/config.md b/skills/worktrunk/reference/config.md
index 8d1599364..d8985070a 100644
--- a/skills/worktrunk/reference/config.md
+++ b/skills/worktrunk/reference/config.md
@@ -264,7 +264,7 @@ Default template:
```toml
[commit.generation]
template = """
-Write a commit message for the staged changes below.
+<task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
@@ -310,7 +310,7 @@ Default template:
```toml
[commit.generation]
squash-template = """
-Combine these commits into a single commit message.
+<task>Write a commit message for the combined effect of these commits.</task>
<format>
- Subject line under 50 chars
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index ac4346415..3306de461 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -1815,7 +1815,7 @@ Default template:
```toml
[commit.generation]
template = """
-Write a commit message for the staged changes below.
+<task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
@@ -1861,7 +1861,7 @@ Default template:
```toml
[commit.generation]
squash-template = """
-Combine these commits into a single commit message.
+<task>Write a commit message for the combined effect of these commits.</task>
<format>
- Subject line under 50 chars
diff --git a/src/commands/picker/summary.rs b/src/commands/picker/summary.rs
index 42513a1aa..fd718df79 100644
--- a/src/commands/picker/summary.rs
+++ b/src/commands/picker/summary.rs
@@ -258,7 +258,7 @@ mod tests {
// With diff content and stat
let prompt = render_prompt("diff content", "1 file changed").unwrap();
assert_snapshot!(prompt, @r#"
- Write a summary of this branch's changes as a commit message.
+ <task>Write a summary of this branch's changes as a commit message.</task>
<format>
- Subject line under 50 chars, imperative mood ("Add feature" not "Adds feature")
@@ -278,7 +278,7 @@ mod tests {
// Empty inputs still include format instructions
let empty_prompt = render_prompt("", "").unwrap();
assert_snapshot!(empty_prompt, @r#"
- Write a summary of this branch's changes as a commit message.
+ <task>Write a summary of this branch's changes as a commit message.</task>
<format>
- Subject line under 50 chars, imperative mood ("Add feature" not "Adds feature")
diff --git a/src/llm.rs b/src/llm.rs
index 90bb810b4..38d1849f7 100644
--- a/src/llm.rs
+++ b/src/llm.rs
@@ -222,7 +222,7 @@ struct TemplateContext<'a> {
/// Default template for commit message prompts
///
/// Synced to dev/config.example.toml by `cargo test readme_sync`
-const DEFAULT_TEMPLATE: &str = r#"Write a commit message for the staged changes below.
+const DEFAULT_TEMPLATE: &str = r#"<task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
@@ -255,7 +255,7 @@ Branch: {{ branch }}
/// Default template for squash commit message prompts
///
/// Synced to dev/config.example.toml by `cargo test readme_sync`
-const DEFAULT_SQUASH_TEMPLATE: &str = r#"Combine these commits into a single commit message.
+const DEFAULT_SQUASH_TEMPLATE: &str = r#"<task>Write a commit message for the combined effect of these commits.</task>
<format>
- Subject line under 50 chars
@@ -766,7 +766,7 @@ mod tests {
let context = commit_context("diff content", "main", None, "myrepo");
let prompt = build_prompt(&config, TemplateType::Commit, &context).unwrap();
assert_snapshot!(prompt, @r#"
- Write a commit message for the staged changes below.
+ <task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
@@ -799,7 +799,7 @@ mod tests {
let context = commit_context("diff", "main", Some(&commits), "repo");
let prompt = build_prompt(&config, TemplateType::Commit, &context).unwrap();
assert_snapshot!(prompt, @r#"
- Write a commit message for the staged changes below.
+ <task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
@@ -835,7 +835,7 @@ mod tests {
let context = commit_context("diff", "main", Some(&commits), "repo");
let prompt = build_prompt(&config, TemplateType::Commit, &context).unwrap();
assert_snapshot!(prompt, @r#"
- Write a commit message for the staged changes below.
+ <task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
@@ -937,7 +937,7 @@ mod tests {
let context = squash_context("diff content", "feature", None, "repo", &commits, "main");
let prompt = build_prompt(&config, TemplateType::Squash, &context).unwrap();
assert_snapshot!(prompt, @r#"
- Combine these commits into a single commit message.
+ <task>Write a commit message for the combined effect of these commits.</task>
<format>
- Subject line under 50 chars
diff --git a/src/summary.rs b/src/summary.rs
index 59d5c8b37..fb9707e88 100644
--- a/src/summary.rs
+++ b/src/summary.rs
@@ -46,7 +46,7 @@ pub(crate) struct CombinedDiff {
///
/// Uses commit-message format (subject + body) which naturally produces
/// imperative-mood summaries without "This branch..." preamble.
-const SUMMARY_TEMPLATE: &str = r#"Write a summary of this branch's changes as a commit message.
+const SUMMARY_TEMPLATE: &str = r#"<task>Write a summary of this branch's changes as a commit message.</task>
<format>
- Subject line under 50 chars, imperative mood ("Add feature" not "Adds feature")
@@ -259,7 +259,7 @@ mod tests {
fn test_render_prompt_includes_diff_and_stat() {
let result = render_prompt("diff content here", "stat content here").unwrap();
insta::assert_snapshot!(result, @r#"
- Write a summary of this branch's changes as a commit message.
+ <task>Write a summary of this branch's changes as a commit message.</task>
<format>
- Subject line under 50 chars, imperative mood ("Add feature" not "Adds feature")
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_create.snap b/tests/snapshots/integration__integration_tests__help__help_config_create.snap
index 05bed92d3..3599cd96d 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_create.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_create.snap
@@ -233,7 +233,7 @@ Creates ~/.config/worktrunk/config.toml with the following content:
  # <!-- DEFAULT_TEMPLATE_START -->
  # [commit.generation]
  # template = """
-  # Write a commit message for the staged changes below.
+  # <task>Write a commit message for the staged changes below.</task>
  #
  # <format>
  # - Subject line under 50 chars
@@ -277,7 +277,7 @@ Creates ~/.config/worktrunk/config.toml with the following content:
  # <!-- DEFAULT_SQUASH_TEMPLATE_START -->
  # [commit.generation]
  # squash-template = """
-  # Combine these commits into a single commit message.
+  # <task>Write a commit message for the combined effect of these commits.</task>
  #
  # <format>
  # - Subject line under 50 chars
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 349a210b7..cce5cb19d 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
@@ -277,7 +277,7 @@ Default template:
  [commit.generation]
  template = """
-  Write a commit message for the staged changes below.
+  <task>Write a commit message for the staged changes below.</task>
 
  <format>
  - Subject line under 50 chars
@@ -319,7 +319,7 @@ Default template:
  [commit.generation]
  squash-template = """
-  Combine these commits into a single commit message.
+  <task>Write a commit message for the combined effect of these commits.</task>
 
  <format>
  - Subject line under 50 chars
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt.snap
index c6e134f74..6190cfc32 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt.snap
@@ -20,16 +20,20 @@ info:
LANG: C
LC_ALL: C
MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
PATH: "[PATH]"
PSModulePath: ""
RUST_LOG: warn
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -37,7 +41,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-Write a commit message for the staged changes below.
+<task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged_changes.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged_changes.snap
index c6e134f74..6190cfc32 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_show_prompt_no_staged_changes.snap
@@ -20,16 +20,20 @@ info:
LANG: C
LC_ALL: C
MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
PATH: "[PATH]"
PSModulePath: ""
RUST_LOG: warn
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -37,7 +41,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-Write a commit message for the staged changes below.
+<task>Write a commit message for the staged changes below.</task>
<format>
- Subject line under 50 chars
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_show_prompt.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_show_prompt.snap
index 54bc08026..c3780f482 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_show_prompt.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_show_prompt.snap
@@ -20,16 +20,20 @@ info:
LANG: C
LC_ALL: C
MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
PATH: "[PATH]"
PSModulePath: ""
RUST_LOG: warn
SHELL: ""
TERM: alacritty
USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -37,7 +41,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-Combine these commits into a single commit message.
+<task>Write a commit message for the combined effect of these commits.</task>
<format>
- Subject line under 50 chars