Files
pi-todo-herdr/src/prompt.ts
T

23 lines
1.0 KiB
TypeScript

import type { Task } from "./types.ts";
import { orderedTreeRows } from "./ui.ts";
export const COMPACTION_REMINDER_TYPE = "pi-todo-herdr-compaction";
export const COMPACTION_REMINDER =
"Active tasks exist. Call list_task now; treat its result as authoritative.";
export const TASK_PROMPT_GUIDELINES = [
"For large, multi-stage work, call set_tasks before exploration as the only first-batch tool. Use append by default and replace only for unrelated finished or explicitly abandoned work. Start one task in-progress; skip smaller work.",
"Use update_task when tracked work starts, blocks, or finishes; reconcile the tree before the final response.",
];
export function formatCompactTaskTree(tasks: Task[]): string {
if (tasks.length === 0) return "No tasks.";
return orderedTreeRows(tasks)
.map(({ task, prefix }) => `${prefix}${task.id} [${task.status}] ${task.name}`)
.join("\n");
}
export function hasUnfinishedTasks(tasks: Task[]): boolean {
return tasks.some((task) => task.status !== "done");
}