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.
This commit is contained in:
can1357
2026-02-22 17:57:52 +01:00
parent 563d6a0ab9
commit 4e8a3773c9
6 changed files with 18 additions and 15 deletions
+4 -4
View File
@@ -57,7 +57,7 @@ Tags encode enforcement level. Use consistently throughout:
### Special Tags
```
<north_star> Core values, ultimate objectives
<north-star> Core values, ultimate objectives
<stance> Communication style, attitude
<commitment> What the agent commits to doing
<field> Domain-specific mindset/context
@@ -242,9 +242,9 @@ External proof: tests, linters, type checks.
3. State intent before each tool call
</procedure>
<north_star>
<north-star>
Core values. What ultimately matters.
</north_star>
</north-star>
<prohibited>
Actions that cause harm.
@@ -616,7 +616,7 @@ Structure: <role> <context> <procedure> <directives> <parameters> <output>
Capability: <strengths> <tools> <operations>
Examples: <example name="kebab-case-name">
Data: <environment> <data> <documents>
Special: <north_star> <stance> <commitment> <field> <protocol>
Special: <north-star> <stance> <commitment> <field> <protocol>
```
### Example Name Patterns
+3
View File
@@ -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 `<swarm-context>` to `<context>` in subagent prompts and task rendering
- Changed system reminder XML tags from underscore to kebab-case format (`<system-reminder>`)
- Changed plan storage from `plan://` protocol to `notes://PLAN.md` for draft plans and `notes://<title>.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
@@ -1,8 +1,8 @@
{{#if context}}
<swarm-context>{{context}}</swarm-context>
<context>
{{context}}
</context>
{{/if}}
# Your Assignment
{{assignment}}
{{else}}
{{assignment}}
{{/if}}
{{assignment}}
@@ -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(
{
+2 -2
View File
@@ -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")}`);
@@ -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");
});