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:
@@ -7,6 +7,7 @@ import {
|
||||
type AgentRunResult,
|
||||
buildContinuationPrompt,
|
||||
buildRolePrompt,
|
||||
buildThreadProgress,
|
||||
createAgent,
|
||||
getCachedSessionId,
|
||||
setCachedSessionId,
|
||||
@@ -27,6 +28,10 @@ export function buildClaudeCodePrompt(ctx: AgentContext): string {
|
||||
if (ctx.outputFormatInstruction !== undefined && ctx.outputFormatInstruction !== "") {
|
||||
parts.push(ctx.outputFormatInstruction, "");
|
||||
}
|
||||
|
||||
// Inject thread progress so the agent knows step count and role visit count
|
||||
parts.push(buildThreadProgress(ctx.steps, ctx.role), "");
|
||||
|
||||
parts.push(rolePrompt, "", "## Task", ctx.start.prompt);
|
||||
|
||||
if (!ctx.isFirstVisit) {
|
||||
|
||||
Reference in New Issue
Block a user