diff --git a/src/agents/system-prompt.test.ts b/src/agents/system-prompt.test.ts index 7ecde6421b06..afa7053fb7de 100644 --- a/src/agents/system-prompt.test.ts +++ b/src/agents/system-prompt.test.ts @@ -219,7 +219,6 @@ describe("buildAgentSystemPrompt", () => { expect(prompt).toContain("## Skills"); expect(prompt).toContain(""); - expect(prompt).toContain("Changed : re-read"); expect(prompt).toContain("External writes: batch safely"); }); @@ -549,7 +548,6 @@ describe("buildAgentSystemPrompt", () => { "Scan . Clear match: read exact with `Read`; obey.", ); expect(prompt).not.toContain("/SKILL.md"); - expect(prompt).toContain("Changed : re-read"); expect(prompt).toContain("Several: most specific"); expect(prompt).toContain("Docs: /tmp/openclaw/docs"); expect(prompt).toContain( @@ -810,10 +808,33 @@ describe("buildAgentSystemPrompt", () => { "Scan . Clear match: read exact with `read`; obey.", ); expect(prompt).not.toContain("/SKILL.md"); - expect(prompt).toContain("Changed : re-read"); expect(prompt).toContain("Several: most specific"); }); + it("does not duplicate the skill-version reminder already carried by the skills catalog", () => { + // The rendered catalog (formatSkillsForPrompt/formatSkillsCompact) already carries the + // " differs -> re-read" reminder; the header must not add a second copy. + const reminder = "If a skill's differs from a previous turn"; + const catalog = [ + "The following skills provide specialized instructions for specific tasks.", + "Use the read tool to load a skill's file when the task matches its description.", + `${reminder}, re-read its SKILL.md before using it.`, + "", + "", + " ", + " demo", + " ", + "", + ].join("\n"); + const prompt = buildAgentSystemPrompt({ + workspaceDir: "/tmp/openclaw", + skillsPrompt: catalog, + }); + + const occurrences = prompt.split(reminder).length - 1; + expect(occurrences).toBe(1); + }); + it("instructs models to use skill_workshop only when the tool is available", () => { const section = buildSkillWorkshopPromptSection(); expect(section).toEqual([ diff --git a/src/agents/system-prompt.ts b/src/agents/system-prompt.ts index eb5cdbb7bb11..f7a3a693a0ab 100644 --- a/src/agents/system-prompt.ts +++ b/src/agents/system-prompt.ts @@ -290,7 +290,7 @@ function buildSkillsSection(params: { skillsPrompt?: string; readToolName: strin return [ "## Skills", `Scan . Clear match: read exact with \`${params.readToolName}\`; obey.`, - "Changed : re-read. Several: most specific. None: read none.", + "Several: most specific. None: read none.", "Up-front max one. Never invent paths.", "External writes: batch safely; no tight loops; honor 429/Retry-After.", trimmed,