@iaforged/context-code 1.2.9 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/README.md +119 -119
  2. package/context-bootstrap.js +26 -26
  3. package/dist/src/QueryEngine.js +394 -327
  4. package/dist/src/bridge/bridgeUI.js +1 -1
  5. package/dist/src/buddy/prompt.js +4 -4
  6. package/dist/src/cli/handlers/auth.js +126 -9
  7. package/dist/src/cli/print.js +35 -1
  8. package/dist/src/commands/agent/agent.js +28 -2
  9. package/dist/src/commands/agent/agentStore.js +8 -1
  10. package/dist/src/commands/agent/index.js +1 -1
  11. package/dist/src/commands/bridge-kick.js +9 -9
  12. package/dist/src/commands/commit.js +34 -34
  13. package/dist/src/commands/init-verifiers.js +3 -3
  14. package/dist/src/commands/init.js +88 -88
  15. package/dist/src/commands/insights.js +787 -787
  16. package/dist/src/commands/install.js +19 -19
  17. package/dist/src/commands/login/login.js +21 -12
  18. package/dist/src/commands/logout/logout.js +9 -0
  19. package/dist/src/commands/model/model.js +9 -4
  20. package/dist/src/commands/orchestrate/SwarmUI.js +50 -0
  21. package/dist/src/commands/orchestrate/index.js +2 -2
  22. package/dist/src/commands/orchestrate/orchestrate.js +708 -12
  23. package/dist/src/commands/pr_comments/index.js +33 -33
  24. package/dist/src/commands/profile/index.js +1 -1
  25. package/dist/src/commands/profile/profile.js +52 -3
  26. package/dist/src/commands/provider/index.js +1 -1
  27. package/dist/src/commands/provider/provider.js +117 -45
  28. package/dist/src/commands/resumen/index.js +9 -0
  29. package/dist/src/commands/resumen/resumen.js +29 -0
  30. package/dist/src/commands/security-review.js +190 -190
  31. package/dist/src/commands/swarm-auto/index.js +9 -0
  32. package/dist/src/commands/swarm-auto/swarmAuto.js +111 -0
  33. package/dist/src/commands/swarm-init/index.js +9 -0
  34. package/dist/src/commands/swarm-init/swarmInit.js +72 -0
  35. package/dist/src/commands/team/team.js +39 -6
  36. package/dist/src/commands.js +14 -0
  37. package/dist/src/components/LogoV2/CondensedLogo.js +2 -2
  38. package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +3 -3
  39. package/dist/src/components/agents/agentFileUtils.js +6 -6
  40. package/dist/src/components/permissions/hooks.js +5 -5
  41. package/dist/src/constants/outputStyles.js +83 -83
  42. package/dist/src/core/agents/blueprints.js +58 -0
  43. package/dist/src/core/agents/cliAdapter.js +61 -0
  44. package/dist/src/core/agents/registry.js +93 -0
  45. package/dist/src/core/agents/runtime.js +4 -0
  46. package/dist/src/core/agents/runtime.smoke.js +42 -0
  47. package/dist/src/core/agents/swarm.smoke.js +48 -0
  48. package/dist/src/core/agents/swarmTools.js +38 -0
  49. package/dist/src/core/auth/index.js +2 -0
  50. package/dist/src/core/auth/loginCliAdapter.js +24 -0
  51. package/dist/src/core/auth/loginCore.js +67 -0
  52. package/dist/src/core/auth/logoutCliAdapter.js +34 -0
  53. package/dist/src/core/auth/logoutCore.js +52 -0
  54. package/dist/src/core/auth/preflight.smoke.js +151 -0
  55. package/dist/src/core/index.js +21 -0
  56. package/dist/src/core/mcp/blueprints.js +27 -0
  57. package/dist/src/core/mcp/common.js +14 -0
  58. package/dist/src/core/mcp/runtime.js +67 -0
  59. package/dist/src/core/mcp/runtime.smoke.js +50 -0
  60. package/dist/src/core/mcp/swarmClient.js +40 -0
  61. package/dist/src/core/mcp/swarmSetup.js +43 -0
  62. package/dist/src/core/providers/cliAdapter.js +39 -0
  63. package/dist/src/core/providers/contracts.js +1 -0
  64. package/dist/src/core/providers/index.js +3 -0
  65. package/dist/src/core/providers/llmCore.js +123 -0
  66. package/dist/src/core/providers/providerCore.js +141 -0
  67. package/dist/src/core/providers/providerModelCompatibility.js +98 -0
  68. package/dist/src/core/providers/providerParitySmoke.js +83 -0
  69. package/dist/src/core/providers/providerProfileModelSmoke.js +80 -0
  70. package/dist/src/core/query/contracts.js +1 -0
  71. package/dist/src/core/query/runtime.js +117 -0
  72. package/dist/src/core/query/runtime.smoke.js +39 -0
  73. package/dist/src/core/query/timelineThinking.smoke.js +25 -0
  74. package/dist/src/core/query/wiring.smoke.js +76 -0
  75. package/dist/src/core/skills/cliAdapter.js +38 -0
  76. package/dist/src/core/skills/index.js +52 -0
  77. package/dist/src/core/skills/runtime.smoke.js +53 -0
  78. package/dist/src/core/tasks/runtime.js +205 -0
  79. package/dist/src/core/tasks/runtime.smoke.js +63 -0
  80. package/dist/src/core/tasks/sdkAdapter.js +4 -0
  81. package/dist/src/core/tools/contracts.js +3 -0
  82. package/dist/src/core/tools/fileResolution.js +112 -0
  83. package/dist/src/core/tools/fileResolution.smoke.js +33 -0
  84. package/dist/src/core/tools/filesCore.js +51 -0
  85. package/dist/src/core/tools/filesCore.smoke.js +108 -0
  86. package/dist/src/core/tools/gitCore.js +20 -0
  87. package/dist/src/core/tools/imageParity.smoke.js +36 -0
  88. package/dist/src/core/tools/notebookParity.smoke.js +68 -0
  89. package/dist/src/core/tools/registry.js +22 -0
  90. package/dist/src/core/tools/runtime.smoke.js +32 -0
  91. package/dist/src/core/tools/shellCore.js +60 -0
  92. package/dist/src/core/types/agentContext.js +9 -0
  93. package/dist/src/core/types/auth.js +3 -0
  94. package/dist/src/core/types/command.js +13 -0
  95. package/dist/src/core/types/provider.js +3 -0
  96. package/dist/src/core/types/sdkEvent.js +10 -0
  97. package/dist/src/core/types/swarm.js +1 -0
  98. package/dist/src/cost-tracker.js +3 -3
  99. package/dist/src/hooks/useAwaySummary.js +22 -9
  100. package/dist/src/main.js +32 -2
  101. package/dist/src/screens/REPL.js +9 -0
  102. package/dist/src/services/AgentSummary/agentSummary.js +10 -10
  103. package/dist/src/services/autoDream/autoDream.js +5 -5
  104. package/dist/src/services/autoDream/consolidationPrompt.js +49 -49
  105. package/dist/src/services/compact/prompt.js +238 -238
  106. package/dist/src/services/limits/sessionCounter.js +17 -17
  107. package/dist/src/services/mcp/client.js +27 -1
  108. package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +39 -20
  109. package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +65 -58
  110. package/dist/src/skills/bundled/loop.js +57 -57
  111. package/dist/src/skills/bundled/remember.js +53 -53
  112. package/dist/src/skills/bundled/simplify.js +49 -49
  113. package/dist/src/skills/bundled/skillify.js +2 -2
  114. package/dist/src/state/onChangeAppState.js +6 -0
  115. package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +5 -5
  116. package/dist/src/tasks/LocalMainSessionTask.js +5 -5
  117. package/dist/src/tasks/LocalShellTask/LocalShellTask.js +13 -13
  118. package/dist/src/tools/AgentTool/forkSubagent.js +25 -25
  119. package/dist/src/tools/AskUserQuestionTool/prompt.js +29 -29
  120. package/dist/src/tools/BashTool/BashTool.js +27 -2
  121. package/dist/src/tools/BriefTool/prompt.js +14 -14
  122. package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +12 -12
  123. package/dist/src/tools/EnterPlanModeTool/prompt.js +140 -140
  124. package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +18 -18
  125. package/dist/src/tools/ExitPlanModeTool/prompt.js +23 -23
  126. package/dist/src/tools/ExitWorktreeTool/prompt.js +29 -29
  127. package/dist/src/tools/FileEditTool/prompt.js +7 -7
  128. package/dist/src/tools/FileReadTool/FileReadTool.js +18 -1
  129. package/dist/src/tools/FileWriteTool/prompt.js +6 -6
  130. package/dist/src/tools/GlobTool/prompt.js +4 -4
  131. package/dist/src/tools/GrepTool/prompt.js +10 -10
  132. package/dist/src/tools/LSPTool/prompt.js +18 -18
  133. package/dist/src/tools/ListMcpResourcesTool/prompt.js +15 -15
  134. package/dist/src/tools/PowerShellTool/PowerShellTool.js +25 -2
  135. package/dist/src/tools/ReadMcpResourceTool/prompt.js +13 -13
  136. package/dist/src/tools/SendMessageTool/prompt.js +36 -36
  137. package/dist/src/tools/SkillTool/prompt.js +21 -21
  138. package/dist/src/tools/SleepTool/prompt.js +10 -10
  139. package/dist/src/tools/TaskCreateTool/prompt.js +41 -41
  140. package/dist/src/tools/TaskGetTool/prompt.js +21 -21
  141. package/dist/src/tools/TaskListTool/prompt.js +30 -30
  142. package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +8 -8
  143. package/dist/src/tools/TaskStopTool/prompt.js +5 -5
  144. package/dist/src/tools/TaskUpdateTool/prompt.js +74 -74
  145. package/dist/src/tools/TodoWriteTool/prompt.js +178 -178
  146. package/dist/src/tools/ToolSearchTool/prompt.js +9 -9
  147. package/dist/src/tools/WebFetchTool/WebFetchTool.js +9 -9
  148. package/dist/src/tools/WebFetchTool/prompt.js +31 -31
  149. package/dist/src/tools/WebSearchTool/prompt.js +26 -26
  150. package/dist/src/utils/agentContext.js +2 -0
  151. package/dist/src/utils/agenticSessionSearch.js +38 -38
  152. package/dist/src/utils/config.js +2 -0
  153. package/dist/src/utils/genericProcessUtils.js +21 -21
  154. package/dist/src/utils/heapDumpService.js +4 -4
  155. package/dist/src/utils/mcpValidation.js +2 -2
  156. package/dist/src/utils/model/modelStrings.js +1 -1
  157. package/dist/src/utils/model/providers.js +5 -0
  158. package/dist/src/utils/orchestration/store/providerAgentStore.js +22 -22
  159. package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +10 -10
  160. package/dist/src/utils/orchestration/store/runStore.js +68 -68
  161. package/dist/src/utils/orchestration/store/teamStore.js +28 -28
  162. package/dist/src/utils/permissions/permissionExplainer.js +6 -6
  163. package/dist/src/utils/permissions/permissionsDb.js +43 -43
  164. package/dist/src/utils/sdkEventQueue.js +2 -0
  165. package/dist/src/utils/secureStorage/sqliteStorage.js +12 -12
  166. package/dist/src/utils/standardMcp/common.js +15 -0
  167. package/dist/src/utils/standardMcp/setup.js +52 -0
  168. package/dist/src/utils/swarm/teammatePromptAddendum.js +10 -10
  169. package/dist/src/utils/task/framework.js +6 -6
  170. package/package.json +1 -1
  171. package/dist/src/commands/usage/index.js +0 -7
  172. package/dist/src/commands/usage/usage.js +0 -5
@@ -1,76 +1,76 @@
1
1
  export const DESCRIPTION = 'Update a task in the task list';
2
- export const PROMPT = `Use this tool to update a task in the task list.
3
-
4
- ## When to Use This Tool
5
-
6
- **Mark tasks as resolved:**
7
- - When you have completed the work described in a task
8
- - When a task is no longer needed or has been superseded
9
- - IMPORTANT: Always mark your assigned tasks as resolved when you finish them
10
- - After resolving, call TaskList to find your next task
11
-
12
- - ONLY mark a task as completed when you have FULLY accomplished it
13
- - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
14
- - When blocked, create a new task describing what needs to be resolved
15
- - Never mark a task as completed if:
16
- - Tests are failing
17
- - Implementation is partial
18
- - You encountered unresolved errors
19
- - You couldn't find necessary files or dependencies
20
-
21
- **Delete tasks:**
22
- - When a task is no longer relevant or was created in error
23
- - Setting status to \`deleted\` permanently removes the task
24
-
25
- **Update task details:**
26
- - When requirements change or become clearer
27
- - When establishing dependencies between tasks
28
-
29
- ## Fields You Can Update
30
-
31
- - **status**: The task status (see Status Workflow below)
32
- - **subject**: Change the task title (imperative form, e.g., "Run tests")
33
- - **description**: Change the task description
34
- - **activeForm**: Present continuous form shown in spinner when in_progress (e.g., "Running tests")
35
- - **owner**: Change the task owner (agent name)
36
- - **metadata**: Merge metadata keys into the task (set a key to null to delete it)
37
- - **addBlocks**: Mark tasks that cannot start until this one completes
38
- - **addBlockedBy**: Mark tasks that must complete before this one can start
39
-
40
- ## Status Workflow
41
-
42
- Status progresses: \`pending\` → \`in_progress\` → \`completed\`
43
-
44
- Use \`deleted\` to permanently remove a task.
45
-
46
- ## Staleness
47
-
48
- Make sure to read a task's latest state using \`TaskGet\` before updating it.
49
-
50
- ## Examples
51
-
52
- Mark task as in progress when starting work:
53
- \`\`\`json
54
- {"taskId": "1", "status": "in_progress"}
55
- \`\`\`
56
-
57
- Mark task as completed after finishing work:
58
- \`\`\`json
59
- {"taskId": "1", "status": "completed"}
60
- \`\`\`
61
-
62
- Delete a task:
63
- \`\`\`json
64
- {"taskId": "1", "status": "deleted"}
65
- \`\`\`
66
-
67
- Claim a task by setting owner:
68
- \`\`\`json
69
- {"taskId": "1", "owner": "my-name"}
70
- \`\`\`
71
-
72
- Set up task dependencies:
73
- \`\`\`json
74
- {"taskId": "2", "addBlockedBy": ["1"]}
75
- \`\`\`
2
+ export const PROMPT = `Use this tool to update a task in the task list.
3
+
4
+ ## When to Use This Tool
5
+
6
+ **Mark tasks as resolved:**
7
+ - When you have completed the work described in a task
8
+ - When a task is no longer needed or has been superseded
9
+ - IMPORTANT: Always mark your assigned tasks as resolved when you finish them
10
+ - After resolving, call TaskList to find your next task
11
+
12
+ - ONLY mark a task as completed when you have FULLY accomplished it
13
+ - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
14
+ - When blocked, create a new task describing what needs to be resolved
15
+ - Never mark a task as completed if:
16
+ - Tests are failing
17
+ - Implementation is partial
18
+ - You encountered unresolved errors
19
+ - You couldn't find necessary files or dependencies
20
+
21
+ **Delete tasks:**
22
+ - When a task is no longer relevant or was created in error
23
+ - Setting status to \`deleted\` permanently removes the task
24
+
25
+ **Update task details:**
26
+ - When requirements change or become clearer
27
+ - When establishing dependencies between tasks
28
+
29
+ ## Fields You Can Update
30
+
31
+ - **status**: The task status (see Status Workflow below)
32
+ - **subject**: Change the task title (imperative form, e.g., "Run tests")
33
+ - **description**: Change the task description
34
+ - **activeForm**: Present continuous form shown in spinner when in_progress (e.g., "Running tests")
35
+ - **owner**: Change the task owner (agent name)
36
+ - **metadata**: Merge metadata keys into the task (set a key to null to delete it)
37
+ - **addBlocks**: Mark tasks that cannot start until this one completes
38
+ - **addBlockedBy**: Mark tasks that must complete before this one can start
39
+
40
+ ## Status Workflow
41
+
42
+ Status progresses: \`pending\` → \`in_progress\` → \`completed\`
43
+
44
+ Use \`deleted\` to permanently remove a task.
45
+
46
+ ## Staleness
47
+
48
+ Make sure to read a task's latest state using \`TaskGet\` before updating it.
49
+
50
+ ## Examples
51
+
52
+ Mark task as in progress when starting work:
53
+ \`\`\`json
54
+ {"taskId": "1", "status": "in_progress"}
55
+ \`\`\`
56
+
57
+ Mark task as completed after finishing work:
58
+ \`\`\`json
59
+ {"taskId": "1", "status": "completed"}
60
+ \`\`\`
61
+
62
+ Delete a task:
63
+ \`\`\`json
64
+ {"taskId": "1", "status": "deleted"}
65
+ \`\`\`
66
+
67
+ Claim a task by setting owner:
68
+ \`\`\`json
69
+ {"taskId": "1", "owner": "my-name"}
70
+ \`\`\`
71
+
72
+ Set up task dependencies:
73
+ \`\`\`json
74
+ {"taskId": "2", "addBlockedBy": ["1"]}
75
+ \`\`\`
76
76
  `;
@@ -1,181 +1,181 @@
1
1
  import { FILE_EDIT_TOOL_NAME } from '../FileEditTool/constants.js';
2
- export const PROMPT = `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
3
- It also helps the user understand the progress of the task and overall progress of their requests.
4
-
5
- ## When to Use This Tool
6
- Use this tool proactively in these scenarios:
7
-
8
- 1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
9
- 2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
10
- 3. User explicitly requests todo list - When the user directly asks you to use the todo list
11
- 4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
12
- 5. After receiving new instructions - Immediately capture user requirements as todos
13
- 6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time
14
- 7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation
15
-
16
- ## When NOT to Use This Tool
17
-
18
- Skip using this tool when:
19
- 1. There is only a single, straightforward task
20
- 2. The task is trivial and tracking it provides no organizational benefit
21
- 3. The task can be completed in less than 3 trivial steps
22
- 4. The task is purely conversational or informational
23
-
24
- NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
25
-
26
- ## Examples of When to Use the Todo List
27
-
28
- <example>
29
- User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
30
- Assistant: *Creates todo list with the following items:*
31
- 1. Creating dark mode toggle component in Settings page
32
- 2. Adding dark mode state management (context/store)
33
- 3. Implementing CSS-in-JS styles for dark theme
34
- 4. Updating existing components to support theme switching
35
- 5. Running tests and build process, addressing any failures or errors that occur
36
- *Begins working on the first task*
37
-
38
- <reasoning>
39
- The assistant used the todo list because:
40
- 1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes
41
- 2. The user explicitly requested tests and build be run afterward
42
- 3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
43
- </reasoning>
44
- </example>
45
-
46
- <example>
47
- User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
48
- Assistant: *Uses grep or search tools to locate all instances of getCwd in the codebase*
49
- I've found 15 instances of 'getCwd' across 8 different files.
50
- *Creates todo list with specific items for each file that needs updating*
51
-
52
- <reasoning>
53
- The assistant used the todo list because:
54
- 1. First, the assistant searched to understand the scope of the task
55
- 2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
56
- 3. The todo list helps ensure every instance is tracked and updated systematically
57
- 4. This approach prevents missing any occurrences and maintains code consistency
58
- </reasoning>
59
- </example>
60
-
61
-
62
- <example>
63
- User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
64
- Assistant: *Creates a todo list breaking down each feature into specific tasks based on the project architecture*
65
- Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
66
-
67
- <reasoning>
68
- The assistant used the todo list because:
69
- 1. The user provided multiple complex features to implement in a comma separated list
70
- 2. The todo list helps organize these large features into manageable tasks
71
- 3. This approach allows for tracking progress across the entire implementation
72
- </reasoning>
73
- </example>
74
-
75
- <example>
76
- User: Can you help optimize my React application? It's rendering slowly and has performance issues.
77
- Assistant: *Reviews component structure, render patterns, state management, and data fetching*
78
- After analyzing your codebase, I've identified several performance issues.
79
- *Creates todo list with items like: 1) Implementing memoization for expensive calculations in ProductList, 2) Adding virtualization for long lists in Dashboard, 3) Optimizing image loading in Gallery component, 4) Fixing state update loops in ShoppingCart, 5) Reviewing bundle size and implementing code splitting*
80
- Let's start by implementing memoization for the expensive calculations in your ProductList component.
81
-
82
- <reasoning>
83
- The assistant used the todo list because:
84
- 1. First, the assistant examined the codebase to identify specific performance issues
85
- 2. Based on this analysis, it identified multiple optimization opportunities
86
- 3. Performance optimization is a non-trivial task requiring multiple steps
87
- 4. The todo list helps methodically track improvements across different components
88
- 5. This systematic approach ensures all performance bottlenecks are addressed
89
- </reasoning>
90
- </example>
91
-
92
- ## Examples of When NOT to Use the Todo List
93
-
94
- <example>
95
- User: How do I print 'Hello World' in Python?
96
- Assistant: In Python, you can print "Hello World" with this simple code:
97
-
98
- python
99
- print("Hello World")
100
-
101
- This will output the text "Hello World" to the console when executed.
102
-
103
- <reasoning>
104
- The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
105
- </reasoning>
106
- </example>
107
-
108
- <example>
109
- User: What does the git status command do?
110
- Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.
111
-
112
- <reasoning>
113
- The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.
114
- </reasoning>
115
- </example>
116
-
117
- <example>
118
- User: Can you add a comment to the calculateTotal function to explain what it does?
119
- Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
120
- * Uses the ${FILE_EDIT_TOOL_NAME} tool to add a comment to the calculateTotal function *
121
-
122
- <reasoning>
123
- The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.
124
- </reasoning>
125
- </example>
126
-
127
- <example>
128
- User: Run npm install for me and tell me what happens.
129
- Assistant: I'll run the npm install command for you.
130
-
131
- *Executes: npm install*
132
-
133
- The command completed successfully. Here's the output:
134
- [Output of npm install command]
135
-
136
- All dependencies have been installed according to your package.json file.
137
-
138
- <reasoning>
139
- The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.
140
- </reasoning>
141
- </example>
142
-
143
- ## Task States and Management
144
-
145
- 1. **Task States**: Use these states to track progress:
146
- - pending: Task not yet started
147
- - in_progress: Currently working on (limit to ONE task at a time)
148
- - completed: Task finished successfully
149
-
150
- **IMPORTANT**: Task descriptions must have two forms:
151
- - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project")
152
- - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project")
153
-
154
- 2. **Task Management**:
155
- - Update task status in real-time as you work
156
- - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
157
- - Exactly ONE task must be in_progress at any time (not less, not more)
158
- - Complete current tasks before starting new ones
159
- - Remove tasks that are no longer relevant from the list entirely
160
-
161
- 3. **Task Completion Requirements**:
162
- - ONLY mark a task as completed when you have FULLY accomplished it
163
- - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
164
- - When blocked, create a new task describing what needs to be resolved
165
- - Never mark a task as completed if:
166
- - Tests are failing
167
- - Implementation is partial
168
- - You encountered unresolved errors
169
- - You couldn't find necessary files or dependencies
170
-
171
- 4. **Task Breakdown**:
172
- - Create specific, actionable items
173
- - Break complex tasks into smaller, manageable steps
174
- - Use clear, descriptive task names
175
- - Always provide both forms:
176
- - content: "Fix authentication bug"
177
- - activeForm: "Fixing authentication bug"
178
-
179
- When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
2
+ export const PROMPT = `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
3
+ It also helps the user understand the progress of the task and overall progress of their requests.
4
+
5
+ ## When to Use This Tool
6
+ Use this tool proactively in these scenarios:
7
+
8
+ 1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
9
+ 2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
10
+ 3. User explicitly requests todo list - When the user directly asks you to use the todo list
11
+ 4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
12
+ 5. After receiving new instructions - Immediately capture user requirements as todos
13
+ 6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time
14
+ 7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation
15
+
16
+ ## When NOT to Use This Tool
17
+
18
+ Skip using this tool when:
19
+ 1. There is only a single, straightforward task
20
+ 2. The task is trivial and tracking it provides no organizational benefit
21
+ 3. The task can be completed in less than 3 trivial steps
22
+ 4. The task is purely conversational or informational
23
+
24
+ NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
25
+
26
+ ## Examples of When to Use the Todo List
27
+
28
+ <example>
29
+ User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
30
+ Assistant: *Creates todo list with the following items:*
31
+ 1. Creating dark mode toggle component in Settings page
32
+ 2. Adding dark mode state management (context/store)
33
+ 3. Implementing CSS-in-JS styles for dark theme
34
+ 4. Updating existing components to support theme switching
35
+ 5. Running tests and build process, addressing any failures or errors that occur
36
+ *Begins working on the first task*
37
+
38
+ <reasoning>
39
+ The assistant used the todo list because:
40
+ 1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes
41
+ 2. The user explicitly requested tests and build be run afterward
42
+ 3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
43
+ </reasoning>
44
+ </example>
45
+
46
+ <example>
47
+ User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
48
+ Assistant: *Uses grep or search tools to locate all instances of getCwd in the codebase*
49
+ I've found 15 instances of 'getCwd' across 8 different files.
50
+ *Creates todo list with specific items for each file that needs updating*
51
+
52
+ <reasoning>
53
+ The assistant used the todo list because:
54
+ 1. First, the assistant searched to understand the scope of the task
55
+ 2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
56
+ 3. The todo list helps ensure every instance is tracked and updated systematically
57
+ 4. This approach prevents missing any occurrences and maintains code consistency
58
+ </reasoning>
59
+ </example>
60
+
61
+
62
+ <example>
63
+ User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
64
+ Assistant: *Creates a todo list breaking down each feature into specific tasks based on the project architecture*
65
+ Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
66
+
67
+ <reasoning>
68
+ The assistant used the todo list because:
69
+ 1. The user provided multiple complex features to implement in a comma separated list
70
+ 2. The todo list helps organize these large features into manageable tasks
71
+ 3. This approach allows for tracking progress across the entire implementation
72
+ </reasoning>
73
+ </example>
74
+
75
+ <example>
76
+ User: Can you help optimize my React application? It's rendering slowly and has performance issues.
77
+ Assistant: *Reviews component structure, render patterns, state management, and data fetching*
78
+ After analyzing your codebase, I've identified several performance issues.
79
+ *Creates todo list with items like: 1) Implementing memoization for expensive calculations in ProductList, 2) Adding virtualization for long lists in Dashboard, 3) Optimizing image loading in Gallery component, 4) Fixing state update loops in ShoppingCart, 5) Reviewing bundle size and implementing code splitting*
80
+ Let's start by implementing memoization for the expensive calculations in your ProductList component.
81
+
82
+ <reasoning>
83
+ The assistant used the todo list because:
84
+ 1. First, the assistant examined the codebase to identify specific performance issues
85
+ 2. Based on this analysis, it identified multiple optimization opportunities
86
+ 3. Performance optimization is a non-trivial task requiring multiple steps
87
+ 4. The todo list helps methodically track improvements across different components
88
+ 5. This systematic approach ensures all performance bottlenecks are addressed
89
+ </reasoning>
90
+ </example>
91
+
92
+ ## Examples of When NOT to Use the Todo List
93
+
94
+ <example>
95
+ User: How do I print 'Hello World' in Python?
96
+ Assistant: In Python, you can print "Hello World" with this simple code:
97
+
98
+ python
99
+ print("Hello World")
100
+
101
+ This will output the text "Hello World" to the console when executed.
102
+
103
+ <reasoning>
104
+ The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
105
+ </reasoning>
106
+ </example>
107
+
108
+ <example>
109
+ User: What does the git status command do?
110
+ Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.
111
+
112
+ <reasoning>
113
+ The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.
114
+ </reasoning>
115
+ </example>
116
+
117
+ <example>
118
+ User: Can you add a comment to the calculateTotal function to explain what it does?
119
+ Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
120
+ * Uses the ${FILE_EDIT_TOOL_NAME} tool to add a comment to the calculateTotal function *
121
+
122
+ <reasoning>
123
+ The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.
124
+ </reasoning>
125
+ </example>
126
+
127
+ <example>
128
+ User: Run npm install for me and tell me what happens.
129
+ Assistant: I'll run the npm install command for you.
130
+
131
+ *Executes: npm install*
132
+
133
+ The command completed successfully. Here's the output:
134
+ [Output of npm install command]
135
+
136
+ All dependencies have been installed according to your package.json file.
137
+
138
+ <reasoning>
139
+ The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.
140
+ </reasoning>
141
+ </example>
142
+
143
+ ## Task States and Management
144
+
145
+ 1. **Task States**: Use these states to track progress:
146
+ - pending: Task not yet started
147
+ - in_progress: Currently working on (limit to ONE task at a time)
148
+ - completed: Task finished successfully
149
+
150
+ **IMPORTANT**: Task descriptions must have two forms:
151
+ - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project")
152
+ - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project")
153
+
154
+ 2. **Task Management**:
155
+ - Update task status in real-time as you work
156
+ - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
157
+ - Exactly ONE task must be in_progress at any time (not less, not more)
158
+ - Complete current tasks before starting new ones
159
+ - Remove tasks that are no longer relevant from the list entirely
160
+
161
+ 3. **Task Completion Requirements**:
162
+ - ONLY mark a task as completed when you have FULLY accomplished it
163
+ - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
164
+ - When blocked, create a new task describing what needs to be resolved
165
+ - Never mark a task as completed if:
166
+ - Tests are failing
167
+ - Implementation is partial
168
+ - You encountered unresolved errors
169
+ - You couldn't find necessary files or dependencies
170
+
171
+ 4. **Task Breakdown**:
172
+ - Create specific, actionable items
173
+ - Break complex tasks into smaller, manageable steps
174
+ - Use clear, descriptive task names
175
+ - Always provide both forms:
176
+ - content: "Fix authentication bug"
177
+ - activeForm: "Fixing authentication bug"
178
+
179
+ When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
180
180
  `;
181
181
  export const DESCRIPTION = 'Update the todo list for the current session. To be used proactively and often to track progress and pending tasks. Make sure that at least one task is in_progress at all times. Always provide both content (imperative) and activeForm (present continuous) for each task.';
@@ -15,8 +15,8 @@ const SEND_USER_FILE_TOOL_NAME = feature('KAIROS')
15
15
  /* eslint-enable @typescript-eslint/no-require-imports */
16
16
  export { TOOL_SEARCH_TOOL_NAME } from './constants.js';
17
17
  import { TOOL_SEARCH_TOOL_NAME } from './constants.js';
18
- const PROMPT_HEAD = `Fetches full schema definitions for deferred tools so they can be called.
19
-
18
+ const PROMPT_HEAD = `Fetches full schema definitions for deferred tools so they can be called.
19
+
20
20
  `;
21
21
  // Matches isDeferredToolsDeltaEnabled in toolSearch.ts (not imported —
22
22
  // toolSearch.ts imports from this file). When enabled: tools announced
@@ -29,13 +29,13 @@ function getToolLocationHint() {
29
29
  ? 'Deferred tools appear by name in <system-reminder> messages.'
30
30
  : 'Deferred tools appear by name in <available-deferred-tools> messages.';
31
31
  }
32
- const PROMPT_TAIL = ` Until fetched, only the name is known — there is no parameter schema, so the tool cannot be invoked. This tool takes a query, matches it against the deferred tool list, and returns the matched tools' complete JSONSchema definitions inside a <functions> block. Once a tool's schema appears in that result, it is callable exactly like any tool defined at the top of the prompt.
33
-
34
- Result format: each matched tool appears as one <function>{"description": "...", "name": "...", "parameters": {...}}</function> line inside the <functions> block — the same encoding as the tool list at the top of this prompt.
35
-
36
- Query forms:
37
- - "select:Read,Edit,Grep" — fetch these exact tools by name
38
- - "notebook jupyter" — keyword search, up to max_results best matches
32
+ const PROMPT_TAIL = ` Until fetched, only the name is known — there is no parameter schema, so the tool cannot be invoked. This tool takes a query, matches it against the deferred tool list, and returns the matched tools' complete JSONSchema definitions inside a <functions> block. Once a tool's schema appears in that result, it is callable exactly like any tool defined at the top of the prompt.
33
+
34
+ Result format: each matched tool appears as one <function>{"description": "...", "name": "...", "parameters": {...}}</function> line inside the <functions> block — the same encoding as the tool list at the top of this prompt.
35
+
36
+ Query forms:
37
+ - "select:Read,Edit,Grep" — fetch these exact tools by name
38
+ - "notebook jupyter" — keyword search, up to max_results best matches
39
39
  - "+slack send" — require "slack" in the name, rank by remaining terms`;
40
40
  /**
41
41
  * Check if a tool should be deferred (requires ToolSearch to load).
@@ -143,7 +143,7 @@ export const WebFetchTool = buildTool({
143
143
  // between SDK query() calls (when ToolSearch enablement varies due to
144
144
  // MCP tool count thresholds), invalidating the Anthropic API prompt
145
145
  // cache on each toggle — two consecutive cache misses per flicker event.
146
- return `IMPORTANT: WebFetch WILL FAIL for authenticated or private URLs. Before using this tool, check if the URL points to an authenticated service (e.g. Google Docs, Confluence, Jira, GitHub). If so, look for a specialized MCP tool that provides authenticated access.
146
+ return `IMPORTANT: WebFetch WILL FAIL for authenticated or private URLs. Before using this tool, check if the URL points to an authenticated service (e.g. Google Docs, Confluence, Jira, GitHub). If so, look for a specialized MCP tool that provides authenticated access.
147
147
  ${DESCRIPTION}`;
148
148
  },
149
149
  async validateInput(input) {
@@ -176,14 +176,14 @@ ${DESCRIPTION}`;
176
176
  : response.statusCode === 307
177
177
  ? 'Temporary Redirect'
178
178
  : 'Found';
179
- const message = `REDIRECT DETECTED: The URL redirects to a different host.
180
-
181
- Original URL: ${response.originalUrl}
182
- Redirect URL: ${response.redirectUrl}
183
- Status: ${response.statusCode} ${statusText}
184
-
185
- To complete your request, I need to fetch content from the redirected URL. Please use WebFetch again with these parameters:
186
- - url: "${response.redirectUrl}"
179
+ const message = `REDIRECT DETECTED: The URL redirects to a different host.
180
+
181
+ Original URL: ${response.originalUrl}
182
+ Redirect URL: ${response.redirectUrl}
183
+ Status: ${response.statusCode} ${statusText}
184
+
185
+ To complete your request, I need to fetch content from the redirected URL. Please use WebFetch again with these parameters:
186
+ - url: "${response.redirectUrl}"
187
187
  - prompt: "${prompt}"`;
188
188
  const output = {
189
189
  bytes: Buffer.byteLength(message),