Tighten branch name generation to 2 words with lower token limit and zero temperature

This commit is contained in:
Chris Wanstrath 2026-02-19 13:20:41 -08:00
parent 05dd4f1806
commit e860d6ff57

View File

@ -76,7 +76,7 @@ function fallbackBranchName(text: string): string {
.replace(/[^a-z0-9\s-]/g, "") .replace(/[^a-z0-9\s-]/g, "")
.trim() .trim()
.split(/\s+/) .split(/\s+/)
.slice(0, 5) .slice(0, 2)
.join("-") .join("-")
} }
@ -99,8 +99,9 @@ async function branchFromPrompt(text: string): Promise<string> {
}, },
body: JSON.stringify({ body: JSON.stringify({
model: "claude-haiku-4-5-20251001", model: "claude-haiku-4-5-20251001",
max_tokens: 30, max_tokens: 15,
messages: [{ role: "user", content: `Generate a short git branch name (2-4 lowercase words, hyphen-separated, no slashes) for this task:\n\n${text}\n\nOutput ONLY the branch name, nothing else.` }], temperature: 0,
messages: [{ role: "user", content: `Generate a 2-word git branch name (lowercase, hyphen-separated) for this task:\n\n${text}\n\nOutput ONLY the branch name, nothing else.` }],
}), }),
}) })