Constrain nextStep to a 10-word command with prompt examples
The screenshot from real-data testing showed nextStep rambling into
status recaps ("The requested comparison and hosted write-up are
complete, and..."). The prompt now demands a verb-first command of at
most 10 words with explicit GOOD/BAD examples, and normalizeThreadReview
backstops drift by truncating to the first sentence, hard-capped at 80
chars. Attention-bucket cards fall back to the summary when an older
server omits nextStep, so they always say what's being waited on.
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
b763709a3e
commit
ade848702d
3 files changed
+29
-8
No files matched your search
@@ -252,7 +252,13 @@ export function buildThreadReviewPrompt(input: ThreadReviewPromptInput) {
|
||||
"Return a JSON object with keys: summary, nextStep, suggestedTitle, recommendSettle, settleReason.",
|
||||
"Rules:",
|
||||
"- summary: ONE sentence, max ~25 words: what was asked and where it landed",
|
||||
"- nextStep: ONE short imperative sentence with the user's single next action (e.g. 'Review and merge PR #123.', 'Answer the agent's question about auth scopes.', 'Nothing left — settle this thread.')",
|
||||
"- nextStep: a COMMAND to the user, max 10 words. Start with a verb. Never describe status.",
|
||||
" GOOD: 'Merge PR #4415.'",
|
||||
" GOOD: 'Answer the agent's question about auth scopes.'",
|
||||
" GOOD: 'Settle this thread.'",
|
||||
" GOOD: 'Wait — agent still working.'",
|
||||
" BAD: 'The requested comparison and hosted write-up are complete, and...' (status recap, not a command)",
|
||||
" BAD: 'You should probably consider reviewing the PR when you have time.' (hedging filler)",
|
||||
"- suggestedTitle: a corrected 3-8 word title ONLY if the current title is misleading or a placeholder like 'New thread'; otherwise null",
|
||||
"- recommendSettle: true ONLY when the work clearly concluded (done, abandoned, or superseded) and nothing awaits the user",
|
||||
"- settleReason: one short sentence justifying recommendSettle, or null when recommendSettle is false",
|
||||
|
||||
@@ -85,7 +85,18 @@ export function normalizeThreadReview(
|
||||
settleReason: string | null;
|
||||
} {
|
||||
const summary = raw.summary.trim().replace(/\s+/g, " ");
|
||||
const nextStep = raw.nextStep.trim().replace(/\s+/g, " ");
|
||||
// Backstop against rambling: first sentence only, hard-capped. The prompt
|
||||
// asks for a <=10-word command, but models drift — never render a recap.
|
||||
const nextStepFirstSentence =
|
||||
raw.nextStep
|
||||
.trim()
|
||||
.replace(/\s+/g, " ")
|
||||
.match(/^[^.!?]*[.!?]?/)?.[0]
|
||||
?.trim() ?? "";
|
||||
const nextStep =
|
||||
nextStepFirstSentence.length > 80
|
||||
? `${nextStepFirstSentence.slice(0, 77).trimEnd()}...`
|
||||
: nextStepFirstSentence;
|
||||
const suggestedTitle =
|
||||
raw.suggestedTitle && raw.suggestedTitle.trim().length > 0
|
||||
? sanitizeThreadTitle(raw.suggestedTitle)
|
||||
|
||||
@@ -222,12 +222,16 @@ function SweepItemCard({
|
||||
) : null;
|
||||
|
||||
// The one-line "what should I do" is the card body; the full summary
|
||||
// lives behind the info icon so the grid stays scannable.
|
||||
const nextStep =
|
||||
item.status === "error"
|
||||
? null
|
||||
: (result?.nextStep ??
|
||||
(bucket === "settle" && result?.settleReason ? result.settleReason : null));
|
||||
// lives behind the info icon so the grid stays scannable. Results from
|
||||
// pre-nextStep servers fall back to settleReason (settle bucket) or the
|
||||
// summary (attention bucket) so action cards never render bodyless.
|
||||
const nextStepFallback =
|
||||
bucket === "settle"
|
||||
? (result?.settleReason ?? null)
|
||||
: bucket === "attention"
|
||||
? (result?.summary ?? null)
|
||||
: null;
|
||||
const nextStep = item.status === "error" ? null : (result?.nextStep ?? nextStepFallback);
|
||||
|
||||
return (
|
||||
<Card className={cn("min-w-0 gap-1.5 border-s-2 p-3", meta.accent)}>
|
||||
|
||||
Reference in new issue
Block a user