From 36392312634a7c5ffc0556c7733c427bb7ddc22a Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:24:46 +0900 Subject: [PATCH] revert: remove post-iteration system prompt rebuild Show the actual prompt sent to the LLM (messages[0].Content), not a rebuilt version. The pre-iteration capture is the ground truth. Co-Authored-By: Claude Opus 4.6 --- pkg/agent/loop.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 6d44bc262..8aa5581d6 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -926,13 +926,6 @@ func (al *AgentLoop) runAgentLoop(ctx context.Context, agent *AgentInstance, opt return "", err } - // 5-post. Refresh cached system prompt: tool execution may have updated touch_dir, - // so rebuild with current workDir so Mini App shows the up-to-date version. - if active := al.sessions.ListActive(); len(active) > 0 && active[0].SessionKey == opts.SessionKey && active[0].TouchDir != "" { - agent.ContextBuilder.SetWorkDir(filepath.Join(agent.Workspace, active[0].TouchDir)) - } - al.lastSystemPrompt.Store(agent.ContextBuilder.BuildSystemPrompt()) - // 5a. Auto-advance plan phases after LLM iteration postStatus := agent.ContextBuilder.GetPlanStatus() if agent.ContextBuilder.HasActivePlan() && (postStatus == "executing" || postStatus == "review" || postStatus == "completed") {