Skip to content

Commit a4abf4f

Browse files
committed
feat: enhance new task schema with todos support and detailed prompts
1 parent ee158c3 commit a4abf4f

File tree

1 file changed

+69
-18
lines changed

1 file changed

+69
-18
lines changed

src/core/prompts/tools/schemas/new-task-schema.ts

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,67 @@
11
import { ToolArgs } from "../types"
22
import { BaseToolSchema } from "./base-tool-schema"
33

4+
/**
5+
* Prompt when todos are NOT required (default)
6+
*/
7+
const PROMPT_WITHOUT_TODOS = `## new_task
8+
Description: This will let you create a new task instance in the chosen mode using your provided message.
9+
10+
Parameters:
11+
- mode: (required) The slug of the mode to start the new task in (e.g., "code", "debug", "architect").
12+
- message: (required) The initial user message or instructions for this new task.
13+
14+
Usage:
15+
<new_task>
16+
<mode>your-mode-slug-here</mode>
17+
<message>Your initial instructions here</message>
18+
</new_task>
19+
20+
Example:
21+
<new_task>
22+
<mode>code</mode>
23+
<message>Implement a new feature for the application</message>
24+
</new_task>
25+
`
26+
27+
/**
28+
* Prompt when todos ARE required
29+
*/
30+
const PROMPT_WITH_TODOS = `## new_task
31+
Description: This will let you create a new task instance in the chosen mode using your provided message and initial todo list.
32+
33+
Parameters:
34+
- mode: (required) The slug of the mode to start the new task in (e.g., "code", "debug", "architect").
35+
- message: (required) The initial user message or instructions for this new task.
36+
- todos: (required) The initial todo list in markdown checklist format for the new task.
37+
38+
Usage:
39+
<new_task>
40+
<mode>your-mode-slug-here</mode>
41+
<message>Your initial instructions here</message>
42+
<todos>
43+
[ ] First task to complete
44+
[ ] Second task to complete
45+
[ ] Third task to complete
46+
</todos>
47+
</new_task>
48+
49+
Example:
50+
<new_task>
51+
<mode>code</mode>
52+
<message>Implement user authentication</message>
53+
<todos>
54+
[ ] Set up auth middleware
55+
[ ] Create login endpoint
56+
[ ] Add session management
57+
[ ] Write tests
58+
</todos>
59+
</new_task>
60+
61+
`
62+
463
export function generateNewTaskSchema(args: ToolArgs): BaseToolSchema {
64+
const todosRequired = args.settings?.newTaskRequireTodos === true
565
const schema: BaseToolSchema = {
666
name: "new_task",
767
description: "This will let you create a new task instance in the chosen mode using your provided message.",
@@ -19,24 +79,15 @@ export function generateNewTaskSchema(args: ToolArgs): BaseToolSchema {
1979
required: true,
2080
},
2181
],
22-
systemPrompt: `## new_task
23-
Description: This will let you create a new task instance in the chosen mode using your provided message.
24-
25-
Parameters:
26-
- mode: (required) The slug of the mode to start the new task in (e.g., "code", "debug", "architect").
27-
- message: (required) The initial user message or instructions for this new task.
28-
29-
Usage:
30-
<new_task>
31-
<mode>your-mode-slug-here</mode>
32-
<message>Your initial instructions here</message>
33-
</new_task>
34-
35-
Example:
36-
<new_task>
37-
<mode>code</mode>
38-
<message>Implement a new feature for the application.</message>
39-
</new_task>`,
82+
systemPrompt: todosRequired ? PROMPT_WITH_TODOS : PROMPT_WITHOUT_TODOS,
83+
}
84+
if (todosRequired) {
85+
schema.parameters.push({
86+
name: "todos",
87+
type: "string",
88+
description: "The initial todo list in markdown checklist format for the new task. Use '[ ]' for pending",
89+
required: true,
90+
})
4091
}
4192

4293
return schema

0 commit comments

Comments
 (0)