Skip to content

Commit 7fa908d

Browse files
rubenmarcusclaude
andcommitted
fix: show task title instead of agent name in loop header (#230)
- Always display "Task N/M" instead of inconsistent "Loop N/M" - Show task title (from issue/spec) as header, agent name as subtitle - Add taskTitle option to LoopOptions, passed from run command - Fall back to agent name only when no title is available Closes #230 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 926b764 commit 7fa908d

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

src/commands/run.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ export async function runCommand(
277277

278278
// Handle --from source
279279
let sourceSpec: string | null = null;
280+
let sourceTitle: string | undefined;
280281
let sourceIssueRef: IssueRef | undefined;
281282
if (options.from) {
282283
spinner.start('Fetching spec from source...');
@@ -298,6 +299,7 @@ export async function runCommand(
298299

299300
spinner.succeed(`Fetched spec from ${result.source}`);
300301
sourceSpec = result.content;
302+
sourceTitle = result.title;
301303

302304
// Extract issue reference from metadata for PR linking
303305
if (
@@ -641,6 +643,7 @@ Focus on one task at a time. After completing a task, update IMPLEMENTATION_PLAN
641643
validate: options.validate ?? preset?.validate,
642644
validationWarmup,
643645
sourceType: options.from?.toLowerCase(),
646+
taskTitle: sourceTitle || (task ? task.slice(0, 80) : undefined),
644647
// New options
645648
completionPromise: options.completionPromise ?? preset?.completionPromise,
646649
requireExitSignal: options.requireExitSignal,

src/loop/executor.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ export interface LoopOptions {
241241
maxSkills?: number; // Cap skills included in prompt (default: 5)
242242
skipPlanInstructions?: boolean; // Skip IMPLEMENTATION_PLAN.md rules in preamble (fix --design)
243243
fixMode?: 'design' | 'scan' | 'custom'; // Display mode for fix command headers
244+
taskTitle?: string; // Human-readable task title (from issue/spec) for display
244245
}
245246

246247
export interface LoopResult {
@@ -739,13 +740,26 @@ export async function runLoop(options: LoopOptions): Promise<LoopResult> {
739740
);
740741
} else {
741742
const modeLabel =
742-
options.fixMode === 'design'
743-
? 'Design Fix'
744-
: options.fixMode
745-
? 'Fix'
746-
: `Running ${options.agent.name}`;
747-
const fallbackLine = ` ${sourceIcon} Loop ${i}/${maxIterations}${modeLabel}`;
748-
headerLines.push(chalk.white.bold(truncateToFit(fallbackLine, innerWidth)));
743+
options.fixMode === 'design' ? 'Design Fix' : options.fixMode ? 'Fix' : undefined;
744+
const displayTitle = modeLabel || options.taskTitle || undefined;
745+
if (displayTitle) {
746+
const prefix = ` ${sourceIcon} Task ${i}/${maxIterations} │ `;
747+
const available = innerWidth - prefix.length;
748+
if (available > 0) {
749+
const title = truncateToFit(displayTitle, Math.max(8, available));
750+
headerLines.push(`${prefix}${chalk.white.bold(title)}`);
751+
} else {
752+
headerLines.push(chalk.white.bold(truncateToFit(`${prefix}${displayTitle}`, innerWidth)));
753+
}
754+
headerLines.push(
755+
chalk.dim(
756+
truncateToFit(` ${options.agent.name} │ Iter ${i}/${maxIterations}`, innerWidth)
757+
)
758+
);
759+
} else {
760+
const fallbackLine = ` ${sourceIcon} Task ${i}/${maxIterations}${options.agent.name}`;
761+
headerLines.push(chalk.white.bold(truncateToFit(fallbackLine, innerWidth)));
762+
}
749763
}
750764
console.log();
751765
console.log(drawBox(headerLines, { color: chalk.cyan, width: boxWidth }));

0 commit comments

Comments
 (0)