Skip to content

Commit 7c8cdb7

Browse files
byapparovclaude
andcommitted
refactor(tool): use the ${name} placeholder style in task.txt
task.txt now uses ${agents}, the same style as the ${directory}, ${maxLines}, ${maxBytes} and ${timeout} placeholders in bash.txt. The replacer function still inserts agent descriptions literally. The description test now asserts that no "${" remains and that the agent list follows its label directly. Without that check, a partial placeholder match would leave a stray "$" behind. Refs #214 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015nwvfUHdM3bgMgD9Zpz7Mj
1 parent 1946b09 commit 7c8cdb7

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎packages/cli/src/tool/task.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const TaskTool = Tool.define("task", async (ctx) => {
5555
: agents
5656

5757
// A replacer function inserts agent descriptions literally, without `$` pattern expansion
58-
const description = DESCRIPTION.replace("{agents}", () =>
58+
const description = DESCRIPTION.replace("${agents}", () =>
5959
accessibleAgents
6060
.map((a) => `- ${a.name}: ${a.description ?? "This subagent should only be called manually by the user."}`)
6161
.join("\n"),

‎packages/cli/src/tool/task.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Launches a subagent to work on a task autonomously. The subagent runs in its own session with its own context and tools. A new subagent sees only the `prompt` you give it, so include the context it needs and say what it should return.
22

33
Available agent types (`subagent_type`):
4-
{agents}
4+
${agents}
55

66
The result holds the subagent's final message and its task_id. It is returned to you, not shown to the user. Pass that task_id as `task_id` to resume the same subagent session with its previous messages. Several subagents can run concurrently as separate tool calls in one message.

‎packages/cli/test/tool/task.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ describe("task tool description", () => {
142142
directory: tmp.path,
143143
fn: async () => (await TaskTool.init()).description,
144144
})
145+
expect(text).not.toContain("${")
145146
expect(text).not.toContain("{agents}")
147+
// a partial match of the placeholder would leave a stray `$` before the first agent
148+
expect(text).toContain("Available agent types (`subagent_type`):\n- ")
146149
expect(text).toContain("- explore: ")
147150
expect(text).toContain("`task_id`")
148151
})

0 commit comments

Comments
 (0)