mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
refactor: remove duplicated skill-version reminder from the system prompt
This commit is contained in:
@@ -219,7 +219,6 @@ describe("buildAgentSystemPrompt", () => {
|
||||
|
||||
expect(prompt).toContain("## Skills");
|
||||
expect(prompt).toContain("<available_skills>");
|
||||
expect(prompt).toContain("Changed <version>: re-read");
|
||||
expect(prompt).toContain("External writes: batch safely");
|
||||
});
|
||||
|
||||
@@ -549,7 +548,6 @@ describe("buildAgentSystemPrompt", () => {
|
||||
"Scan <available_skills>. Clear match: read exact <location> with `Read`; obey.",
|
||||
);
|
||||
expect(prompt).not.toContain("<location>/SKILL.md");
|
||||
expect(prompt).toContain("Changed <version>: 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 <available_skills>. Clear match: read exact <location> with `read`; obey.",
|
||||
);
|
||||
expect(prompt).not.toContain("<location>/SKILL.md");
|
||||
expect(prompt).toContain("Changed <version>: 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
|
||||
// "<version> differs -> re-read" reminder; the header must not add a second copy.
|
||||
const reminder = "If a skill's <version> 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.`,
|
||||
"",
|
||||
"<available_skills>",
|
||||
" <skill>",
|
||||
" <name>demo</name>",
|
||||
" </skill>",
|
||||
"</available_skills>",
|
||||
].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([
|
||||
|
||||
@@ -290,7 +290,7 @@ function buildSkillsSection(params: { skillsPrompt?: string; readToolName: strin
|
||||
return [
|
||||
"## Skills",
|
||||
`Scan <available_skills>. Clear match: read exact <location> with \`${params.readToolName}\`; obey.`,
|
||||
"Changed <version>: 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,
|
||||
|
||||
Reference in New Issue
Block a user