feat: inject thread progress into agent prompt (#127)
CI / check (pull_request) Successful in 1m42s
CI / check (pull_request) Successful in 1m42s
Agents now receive a Thread Progress section showing current step number and role visit count, eliminating tool calls to count turns. - util-agent: new buildThreadProgress() helper - agent-hermes: inject before continuation/first-visit prompt - agent-claude-code: same injection point Fixes #127
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
type AgentRunResult,
|
||||
buildContinuationPrompt,
|
||||
buildRolePrompt,
|
||||
buildThreadProgress,
|
||||
createAgent,
|
||||
} from "@united-workforce/util-agent";
|
||||
import type { AcpUsage } from "./acp-client.js";
|
||||
@@ -60,6 +61,9 @@ export function buildHermesPrompt(ctx: AgentContext): string {
|
||||
parts.push(ctx.outputFormatInstruction, "");
|
||||
}
|
||||
|
||||
// Inject thread progress so the agent knows step count and role visit count
|
||||
parts.push(buildThreadProgress(ctx.steps, ctx.role), "");
|
||||
|
||||
if (!ctx.isFirstVisit) {
|
||||
// Re-entry: show only steps since last visit, meta only
|
||||
parts.push(buildContinuationPrompt(ctx.steps, ctx.role, ctx.edgePrompt));
|
||||
|
||||
Reference in New Issue
Block a user