From 4e8a3773c9ad11a6f3178fbca9619cc08dc75288 Mon Sep 17 00:00:00 2001 From: can1357 Date: Sun, 22 Feb 2026 17:57:52 +0100 Subject: [PATCH] refactor(coding-agent): restructured XML tags to kebab-case format - Renamed XML tags from underscore to kebab-case format for consistency across prompts and system messages. - Updated context tag from `swarm_context` to `context` in render logic and test assertions. - Consolidated conditional logic in subagent user prompt by removing duplicate assignment blocks. - Updated system prompt documentation to reflect kebab-case naming convention for XML tags. --- .omp/skills/system-prompts/SKILL.md | 8 ++++---- packages/coding-agent/CHANGELOG.md | 3 +++ .../src/prompts/system/subagent-user-prompt.md | 10 +++++----- packages/coding-agent/src/session/agent-session.ts | 4 ++-- packages/coding-agent/src/task/render.ts | 4 ++-- packages/coding-agent/test/tools/task-template.test.ts | 4 ++-- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.omp/skills/system-prompts/SKILL.md b/.omp/skills/system-prompts/SKILL.md index aa17b3c09..8a51bf64b 100644 --- a/.omp/skills/system-prompts/SKILL.md +++ b/.omp/skills/system-prompts/SKILL.md @@ -57,7 +57,7 @@ Tags encode enforcement level. Use consistently throughout: ### Special Tags ``` - Core values, ultimate objectives + Core values, ultimate objectives Communication style, attitude What the agent commits to doing Domain-specific mindset/context @@ -242,9 +242,9 @@ External proof: tests, linters, type checks. 3. State intent before each tool call - + Core values. What ultimately matters. - + Actions that cause harm. @@ -616,7 +616,7 @@ Structure: Capability: Examples: Data: -Special: +Special: ``` ### Example Name Patterns diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index c25b470d9..0180b4511 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] + ### Added - Added `notes://` protocol for session-scoped scratch space to store large intermediate artifacts, subagent handoffs, and reusable planning notes @@ -10,6 +11,8 @@ ### Changed +- Changed XML tag from `` to `` in subagent prompts and task rendering +- Changed system reminder XML tags from underscore to kebab-case format (``) - Changed plan storage from `plan://` protocol to `notes://PLAN.md` for draft plans and `notes://.md` for finalized approved plans - Changed plan mode to use session artifacts directory for plan storage instead of separate plans directory - Updated system prompt to document `notes://` protocol and internal URL expansion behavior diff --git a/packages/coding-agent/src/prompts/system/subagent-user-prompt.md b/packages/coding-agent/src/prompts/system/subagent-user-prompt.md index 14a59714a..2bc358d42 100644 --- a/packages/coding-agent/src/prompts/system/subagent-user-prompt.md +++ b/packages/coding-agent/src/prompts/system/subagent-user-prompt.md @@ -1,8 +1,8 @@ {{#if context}} -<swarm-context>{{context}}</swarm-context> +<context> +{{context}} +</context> +{{/if}} # Your Assignment -{{assignment}} -{{else}} -{{assignment}} -{{/if}} \ No newline at end of file +{{assignment}} \ No newline at end of file diff --git a/packages/coding-agent/src/session/agent-session.ts b/packages/coding-agent/src/session/agent-session.ts index 4ff94f31a..fd0c99e16 100644 --- a/packages/coding-agent/src/session/agent-session.ts +++ b/packages/coding-agent/src/session/agent-session.ts @@ -654,11 +654,11 @@ export class AgentSession { if (toolName === "todo_write" && isError) { const errorText = content?.find(part => part.type === "text")?.text; const reminderText = [ - "<system_reminder>", + "<system-reminder>", "todo_write failed, so todo progress is not visible to the user.", errorText ? `Failure: ${errorText}` : "Failure: todo_write returned an error.", "Fix the todo payload and call todo_write again before continuing.", - "</system_reminder>", + "</system-reminder>", ].join("\n"); await this.sendCustomMessage( { diff --git a/packages/coding-agent/src/task/render.ts b/packages/coding-agent/src/task/render.ts index be3d6c303..2682f9db6 100644 --- a/packages/coding-agent/src/task/render.ts +++ b/packages/coding-agent/src/task/render.ts @@ -366,9 +366,9 @@ function renderTaskSection( const trimmed = task.trimEnd(); if (!expanded || !trimmed) return lines; - // Strip the shared <swarm_context>...</swarm_context> block — it's the same + // Strip the shared <context>...</context> block — it's the same // across all tasks and just adds noise when expanded. - const stripped = trimmed.replace(/<swarm_context>[\s\S]*?<\/swarm_context>\s*/, "").trimStart(); + const stripped = trimmed.replace(/<context>[\s\S]*?<\/context>\s*/, "").trimStart(); if (!stripped) return lines; lines.push(`${continuePrefix}${theme.fg("dim", "Task")}`); diff --git a/packages/coding-agent/test/tools/task-template.test.ts b/packages/coding-agent/test/tools/task-template.test.ts index d644b8c88..6bba203ce 100644 --- a/packages/coding-agent/test/tools/task-template.test.ts +++ b/packages/coding-agent/test/tools/task-template.test.ts @@ -20,7 +20,7 @@ describe("renderTemplate", () => { assignment: "Full instructions for the agent.\nWith multiple lines.", }); expect(result.task).toContain("Shared constraints here"); - expect(result.task).toContain("<swarm_context>"); + expect(result.task).toContain("<context>"); expect(result.task).toContain("Full instructions for the agent.\nWith multiple lines."); }); @@ -30,7 +30,7 @@ describe("renderTemplate", () => { description: "label", assignment: "the real work", }); - expect(result.task).toStartWith("<swarm_context>context"); + expect(result.task).toStartWith("<context>context"); expect(result.task).toContain("the real work"); });