klaude-code 1.2.9__py3-none-any.whl → 1.2.11__py3-none-any.whl

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 (69) hide show
  1. klaude_code/cli/main.py +11 -5
  2. klaude_code/cli/runtime.py +21 -21
  3. klaude_code/command/__init__.py +68 -23
  4. klaude_code/command/clear_cmd.py +6 -2
  5. klaude_code/command/command_abc.py +5 -2
  6. klaude_code/command/diff_cmd.py +5 -2
  7. klaude_code/command/export_cmd.py +7 -4
  8. klaude_code/command/help_cmd.py +6 -2
  9. klaude_code/command/model_cmd.py +5 -2
  10. klaude_code/command/prompt_command.py +8 -3
  11. klaude_code/command/refresh_cmd.py +6 -2
  12. klaude_code/command/registry.py +17 -5
  13. klaude_code/command/release_notes_cmd.py +5 -2
  14. klaude_code/command/status_cmd.py +8 -4
  15. klaude_code/command/terminal_setup_cmd.py +7 -4
  16. klaude_code/const/__init__.py +1 -1
  17. klaude_code/core/agent.py +62 -9
  18. klaude_code/core/executor.py +1 -4
  19. klaude_code/core/manager/agent_manager.py +19 -14
  20. klaude_code/core/manager/llm_clients.py +47 -22
  21. klaude_code/core/manager/llm_clients_builder.py +22 -13
  22. klaude_code/core/manager/sub_agent_manager.py +1 -1
  23. klaude_code/core/prompt.py +4 -4
  24. klaude_code/core/prompts/prompt-claude-code.md +1 -12
  25. klaude_code/core/prompts/prompt-minimal.md +12 -0
  26. klaude_code/core/reminders.py +0 -3
  27. klaude_code/core/task.py +6 -2
  28. klaude_code/core/tool/file/_utils.py +30 -0
  29. klaude_code/core/tool/file/edit_tool.py +5 -30
  30. klaude_code/core/tool/file/multi_edit_tool.py +6 -31
  31. klaude_code/core/tool/file/read_tool.py +6 -18
  32. klaude_code/core/tool/file/write_tool.py +5 -30
  33. klaude_code/core/tool/memory/__init__.py +5 -0
  34. klaude_code/core/tool/memory/memory_tool.md +4 -0
  35. klaude_code/core/tool/memory/skill_loader.py +3 -2
  36. klaude_code/core/tool/memory/skill_tool.py +13 -0
  37. klaude_code/core/tool/todo/todo_write_tool.md +0 -157
  38. klaude_code/core/tool/todo/todo_write_tool_raw.md +182 -0
  39. klaude_code/core/tool/tool_registry.py +3 -4
  40. klaude_code/llm/__init__.py +2 -12
  41. klaude_code/llm/anthropic/client.py +2 -1
  42. klaude_code/llm/client.py +2 -2
  43. klaude_code/llm/codex/client.py +1 -1
  44. klaude_code/llm/openai_compatible/client.py +3 -2
  45. klaude_code/llm/openrouter/client.py +3 -3
  46. klaude_code/llm/registry.py +33 -7
  47. klaude_code/llm/responses/client.py +2 -1
  48. klaude_code/llm/responses/input.py +1 -1
  49. klaude_code/llm/usage.py +17 -8
  50. klaude_code/protocol/model.py +15 -7
  51. klaude_code/protocol/op.py +5 -1
  52. klaude_code/protocol/sub_agent.py +1 -0
  53. klaude_code/session/export.py +16 -6
  54. klaude_code/session/session.py +10 -4
  55. klaude_code/session/templates/export_session.html +155 -0
  56. klaude_code/ui/core/input.py +1 -1
  57. klaude_code/ui/modes/repl/clipboard.py +5 -5
  58. klaude_code/ui/modes/repl/event_handler.py +1 -5
  59. klaude_code/ui/modes/repl/input_prompt_toolkit.py +3 -34
  60. klaude_code/ui/renderers/metadata.py +22 -1
  61. klaude_code/ui/renderers/tools.py +13 -2
  62. klaude_code/ui/rich/markdown.py +4 -1
  63. klaude_code/ui/terminal/__init__.py +55 -0
  64. klaude_code/ui/terminal/control.py +2 -2
  65. klaude_code/version.py +3 -3
  66. {klaude_code-1.2.9.dist-info → klaude_code-1.2.11.dist-info}/METADATA +1 -4
  67. {klaude_code-1.2.9.dist-info → klaude_code-1.2.11.dist-info}/RECORD +69 -66
  68. {klaude_code-1.2.9.dist-info → klaude_code-1.2.11.dist-info}/WHEEL +0 -0
  69. {klaude_code-1.2.9.dist-info → klaude_code-1.2.11.dist-info}/entry_points.txt +0 -0
@@ -7,6 +7,7 @@ from pathlib import Path
7
7
 
8
8
  from pydantic import BaseModel, Field
9
9
 
10
+ from klaude_code.core.tool.file._utils import file_exists, is_directory, read_text, write_text
10
11
  from klaude_code.core.tool.file.edit_tool import EditTool
11
12
  from klaude_code.core.tool.tool_abc import ToolABC, load_desc
12
13
  from klaude_code.core.tool.tool_context import get_current_file_tracker
@@ -14,32 +15,6 @@ from klaude_code.core.tool.tool_registry import register
14
15
  from klaude_code.protocol import llm_param, model, tools
15
16
 
16
17
 
17
- def _is_directory(path: str) -> bool:
18
- try:
19
- return Path(path).is_dir()
20
- except Exception:
21
- return False
22
-
23
-
24
- def _file_exists(path: str) -> bool:
25
- try:
26
- return Path(path).exists()
27
- except Exception:
28
- return False
29
-
30
-
31
- def _read_text(path: str) -> str:
32
- with open(path, "r", encoding="utf-8", errors="replace") as f:
33
- return f.read()
34
-
35
-
36
- def _write_text(path: str, content: str) -> None:
37
- parent = Path(path).parent
38
- parent.mkdir(parents=True, exist_ok=True)
39
- with open(path, "w", encoding="utf-8") as f:
40
- f.write(content)
41
-
42
-
43
18
  @register(tools.MULTI_EDIT)
44
19
  class MultiEditTool(ToolABC):
45
20
  class MultiEditEditItem(BaseModel):
@@ -105,7 +80,7 @@ class MultiEditTool(ToolABC):
105
80
  file_path = os.path.abspath(args.file_path)
106
81
 
107
82
  # Directory error first
108
- if _is_directory(file_path):
83
+ if is_directory(file_path):
109
84
  return model.ToolResultItem(
110
85
  status="error",
111
86
  output="<tool_use_error>Illegal operation on a directory. multi_edit</tool_use_error>",
@@ -114,7 +89,7 @@ class MultiEditTool(ToolABC):
114
89
  file_tracker = get_current_file_tracker()
115
90
 
116
91
  # FileTracker check:
117
- if _file_exists(file_path):
92
+ if file_exists(file_path):
118
93
  if file_tracker is not None:
119
94
  tracked = file_tracker.get(file_path)
120
95
  if tracked is None:
@@ -142,8 +117,8 @@ class MultiEditTool(ToolABC):
142
117
  )
143
118
 
144
119
  # Load initial content (empty for new file case)
145
- if _file_exists(file_path):
146
- before = await asyncio.to_thread(_read_text, file_path)
120
+ if file_exists(file_path):
121
+ before = await asyncio.to_thread(read_text, file_path)
147
122
  else:
148
123
  before = ""
149
124
 
@@ -168,7 +143,7 @@ class MultiEditTool(ToolABC):
168
143
 
169
144
  # All edits valid; write to disk
170
145
  try:
171
- await asyncio.to_thread(_write_text, file_path, staged)
146
+ await asyncio.to_thread(write_text, file_path, staged)
172
147
  except Exception as e: # pragma: no cover
173
148
  return model.ToolResultItem(status="error", output=f"<tool_use_error>{e}</tool_use_error>")
174
149
 
@@ -9,6 +9,7 @@ from pathlib import Path
9
9
  from pydantic import BaseModel, Field
10
10
 
11
11
  from klaude_code import const
12
+ from klaude_code.core.tool.file._utils import file_exists, is_directory
12
13
  from klaude_code.core.tool.tool_abc import ToolABC, load_desc
13
14
  from klaude_code.core.tool.tool_context import get_current_file_tracker
14
15
  from klaude_code.core.tool.tool_registry import register
@@ -34,20 +35,6 @@ def _format_numbered_line(line_no: int, content: str) -> str:
34
35
  return f"{line_no:>6}→{content}"
35
36
 
36
37
 
37
- def _is_directory(path: str) -> bool:
38
- try:
39
- return Path(path).is_dir()
40
- except Exception:
41
- return False
42
-
43
-
44
- def _file_exists(path: str) -> bool:
45
- try:
46
- return Path(path).exists()
47
- except Exception:
48
- return False
49
-
50
-
51
38
  @dataclass
52
39
  class ReadOptions:
53
40
  file_path: str
@@ -101,7 +88,7 @@ def _read_segment(options: ReadOptions) -> ReadSegmentResult:
101
88
 
102
89
  def _track_file_access(file_path: str) -> None:
103
90
  file_tracker = get_current_file_tracker()
104
- if file_tracker is None or not _file_exists(file_path) or _is_directory(file_path):
91
+ if file_tracker is None or not file_exists(file_path) or is_directory(file_path):
105
92
  return
106
93
  try:
107
94
  file_tracker[file_path] = Path(file_path).stat().st_mtime
@@ -188,12 +175,12 @@ class ReadTool(ToolABC):
188
175
  char_per_line, line_cap, max_chars, max_kb = cls._effective_limits()
189
176
 
190
177
  # Common file errors
191
- if _is_directory(file_path):
178
+ if is_directory(file_path):
192
179
  return model.ToolResultItem(
193
180
  status="error",
194
181
  output="<tool_use_error>Illegal operation on a directory. read</tool_use_error>",
195
182
  )
196
- if not _file_exists(file_path):
183
+ if not file_exists(file_path):
197
184
  return model.ToolResultItem(
198
185
  status="error",
199
186
  output="<tool_use_error>File does not exist.</tool_use_error>",
@@ -222,7 +209,8 @@ class ReadTool(ToolABC):
222
209
  # If file is too large and no pagination provided (only check if limits are enabled)
223
210
  try:
224
211
  size_bytes = Path(file_path).stat().st_size
225
- except Exception:
212
+ except OSError:
213
+ # Best-effort size detection; on stat errors fall back to treating size as unknown.
226
214
  size_bytes = 0
227
215
 
228
216
  is_image_file = _is_supported_image_file(file_path)
@@ -7,38 +7,13 @@ from pathlib import Path
7
7
 
8
8
  from pydantic import BaseModel
9
9
 
10
+ from klaude_code.core.tool.file._utils import file_exists, is_directory, read_text, write_text
10
11
  from klaude_code.core.tool.tool_abc import ToolABC, load_desc
11
12
  from klaude_code.core.tool.tool_context import get_current_file_tracker
12
13
  from klaude_code.core.tool.tool_registry import register
13
14
  from klaude_code.protocol import llm_param, model, tools
14
15
 
15
16
 
16
- def _is_directory(path: str) -> bool:
17
- try:
18
- return Path(path).is_dir()
19
- except Exception:
20
- return False
21
-
22
-
23
- def _file_exists(path: str) -> bool:
24
- try:
25
- return Path(path).exists()
26
- except Exception:
27
- return False
28
-
29
-
30
- def _write_text(path: str, content: str) -> None:
31
- parent = Path(path).parent
32
- parent.mkdir(parents=True, exist_ok=True)
33
- with open(path, "w", encoding="utf-8") as f:
34
- f.write(content)
35
-
36
-
37
- def _read_text(path: str) -> str:
38
- with open(path, "r", encoding="utf-8", errors="replace") as f:
39
- return f.read()
40
-
41
-
42
17
  class WriteArguments(BaseModel):
43
18
  file_path: str
44
19
  content: str
@@ -78,14 +53,14 @@ class WriteTool(ToolABC):
78
53
 
79
54
  file_path = os.path.abspath(args.file_path)
80
55
 
81
- if _is_directory(file_path):
56
+ if is_directory(file_path):
82
57
  return model.ToolResultItem(
83
58
  status="error",
84
59
  output="<tool_use_error>Illegal operation on a directory. write</tool_use_error>",
85
60
  )
86
61
 
87
62
  file_tracker = get_current_file_tracker()
88
- exists = _file_exists(file_path)
63
+ exists = file_exists(file_path)
89
64
 
90
65
  if exists:
91
66
  tracked_mtime: float | None = None
@@ -113,12 +88,12 @@ class WriteTool(ToolABC):
113
88
  before = ""
114
89
  if exists:
115
90
  try:
116
- before = await asyncio.to_thread(_read_text, file_path)
91
+ before = await asyncio.to_thread(read_text, file_path)
117
92
  except Exception:
118
93
  before = ""
119
94
 
120
95
  try:
121
- await asyncio.to_thread(_write_text, file_path, args.content)
96
+ await asyncio.to_thread(write_text, file_path, args.content)
122
97
  except Exception as e: # pragma: no cover
123
98
  return model.ToolResultItem(status="error", output=f"<tool_use_error>{e}</tool_use_error>")
124
99
 
@@ -0,0 +1,5 @@
1
+ from .skill_loader import SkillLoader
2
+ from .skill_tool import SkillTool
3
+
4
+ skill_loader = SkillLoader()
5
+ SkillTool.set_skill_loader(skill_loader)
@@ -14,3 +14,7 @@ Usage tips:
14
14
  - Check your memory directory before starting tasks to recall previous context
15
15
  - Record important decisions, progress, and learnings as you work
16
16
  - Keep memory files organized and up-to-date; delete obsolete files
17
+
18
+ Note: when editing your memory folder, always try to keep its content up-to-date, coherent and organized. You can rename or delete files that are no longer relevant. Do not create new files unless necessary.
19
+
20
+ Only write down information relevant to current project in your memory system.
@@ -39,7 +39,7 @@ class SkillLoader:
39
39
  USER_SKILLS_DIRS = [
40
40
  Path("~/.claude/skills"),
41
41
  Path("~/.klaude/skills"),
42
- Path("~/.claude/plugins/marketplaces"),
42
+ # Path("~/.claude/plugins/marketplaces"),
43
43
  ]
44
44
  # Project-level skills directory
45
45
  PROJECT_SKILLS_DIR = Path("./.claude/skills")
@@ -115,7 +115,8 @@ class SkillLoader:
115
115
 
116
116
  return skill
117
117
 
118
- except Exception:
118
+ except (OSError, yaml.YAMLError) as e:
119
+ log_debug(f"Failed to load skill from {skill_path}: {e}")
119
120
  return None
120
121
 
121
122
  def discover_skills(self) -> list[Skill]:
@@ -13,15 +13,26 @@ class SkillTool(ToolABC):
13
13
  """Tool to execute/load a skill within the main conversation"""
14
14
 
15
15
  _skill_loader: SkillLoader | None = None
16
+ _discovery_done: bool = False
16
17
 
17
18
  @classmethod
18
19
  def set_skill_loader(cls, loader: SkillLoader) -> None:
19
20
  """Set the skill loader instance"""
20
21
  cls._skill_loader = loader
22
+ cls._discovery_done = False
23
+
24
+ @classmethod
25
+ def _ensure_skills_discovered(cls) -> None:
26
+ if cls._discovery_done:
27
+ return
28
+ if cls._skill_loader is not None:
29
+ cls._skill_loader.discover_skills()
30
+ cls._discovery_done = True
21
31
 
22
32
  @classmethod
23
33
  def schema(cls) -> llm_param.ToolSchema:
24
34
  """Generate schema with embedded available skills metadata"""
35
+ cls._ensure_skills_discovered()
25
36
  skills_xml = cls._generate_skills_xml()
26
37
 
27
38
  return llm_param.ToolSchema(
@@ -69,6 +80,8 @@ class SkillTool(ToolABC):
69
80
  output=f"Invalid arguments: {e}",
70
81
  )
71
82
 
83
+ cls._ensure_skills_discovered()
84
+
72
85
  if not cls._skill_loader:
73
86
  return model.ToolResultItem(
74
87
  status="error",
@@ -22,161 +22,4 @@ Skip using this tool when:
22
22
 
23
23
  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.
24
24
 
25
- #### Examples of When to Use the Todo List
26
-
27
- <example>
28
- 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!
29
- Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
30
- *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: Let me first search through your codebase to find all occurrences of 'getCwd'.
49
- *Uses grep or search tools to locate all instances of getCwd in the codebase*
50
- Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
51
- *Creates todo list with specific items for each file that needs updating*
52
-
53
- <reasoning>
54
- The assistant used the todo list because:
55
- 1. First, the assistant searched to understand the scope of the task
56
- 2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
57
- 3. The todo list helps ensure every instance is tracked and updated systematically
58
- 4. This approach prevents missing any occurrences and maintains code consistency
59
- </reasoning>
60
- </example>
61
-
62
-
63
- <example>
64
- User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
65
- Assistant: I'll help implement these features. First, let's add all the features to the todo list.
66
- *Creates a todo list breaking down each feature into specific tasks based on the project architecture*
67
- Assistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
68
-
69
- <reasoning>
70
- The assistant used the todo list because:
71
- 1. The user provided multiple complex features to implement in a comma separated list
72
- 2. The todo list helps organize these large features into manageable tasks
73
- 3. This approach allows for tracking progress across the entire implementation
74
- </reasoning>
75
- </example>
76
-
77
- <example>
78
- User: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>
79
- Assistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.
80
- *Reviews component structure, render patterns, state management, and data fetching*
81
- Assistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.
82
- *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*
83
- Let's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>
84
-
85
- <reasoning>
86
- The assistant used the todo list because:
87
- 1. First, the assistant examined the codebase to identify specific performance issues
88
- 2. Based on this analysis, it identified multiple optimization opportunities
89
- 3. Performance optimization is a non-trivial task requiring multiple steps
90
- 4. The todo list helps methodically track improvements across different components
91
- 5. This systematic approach ensures all performance bottlenecks are addressed
92
- </reasoning>
93
- </example>
94
-
95
- #### Examples of When NOT to Use the Todo List
96
-
97
- <example>
98
- User: How do I print 'Hello World' in Python?
99
- Assistant: In Python, you can print "Hello World" with this simple code:
100
-
101
- python
102
- print("Hello World")
103
-
104
- This will output the text "Hello World" to the console when executed.</assistant>
105
-
106
- <reasoning>
107
- 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.
108
- </reasoning>
109
- </example>
110
-
111
- <example>
112
- User: What does the git status command do?
113
- 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.
114
-
115
- <reasoning>
116
- 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.
117
- </reasoning>
118
- </example>
119
-
120
- <example>
121
- User: Can you add a comment to the calculateTotal function to explain what it does?
122
- Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
123
- * Uses the Edit tool to add a comment to the calculateTotal function *
124
-
125
- <reasoning>
126
- 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.
127
- </reasoning>
128
- </example>
129
-
130
- <example>
131
- User: Run npm install for me and tell me what happens.
132
- Assistant: I'll run the npm install command for you.
133
-
134
- *Executes: npm install*
135
-
136
- The command completed successfully. Here's the output:
137
- [Output of npm install command]
138
-
139
- All dependencies have been installed according to your package.json file.
140
-
141
- <reasoning>
142
- 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.
143
- </reasoning>
144
- </example>
145
-
146
- #### Task States and Management
147
-
148
- 1. **Task States**: Use these states to track progress:
149
- - pending: Task not yet started
150
- - in_progress: Currently working on (limit to ONE task at a time)
151
- - completed: Task finished successfully
152
-
153
- **IMPORTANT**: Task descriptions must have two forms:
154
- - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project")
155
- - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project")
156
-
157
- 2. **Task Management**:
158
- - Update task status in real-time as you work
159
- - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
160
- - Exactly ONE task must be in_progress at any time (not less, not more)
161
- - Complete current tasks before starting new ones
162
- - Remove tasks that are no longer relevant from the list entirely
163
-
164
- 3. **Task Completion Requirements**:
165
- - ONLY mark a task as completed when you have FULLY accomplished it
166
- - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
167
- - When blocked, create a new task describing what needs to be resolved
168
- - Never mark a task as completed if:
169
- - Tests are failing
170
- - Implementation is partial
171
- - You encountered unresolved errors
172
- - You couldn't find necessary files or dependencies
173
-
174
- 4. **Task Breakdown**:
175
- - Create specific, actionable items
176
- - Break complex tasks into smaller, manageable steps
177
- - Use clear, descriptive task names
178
- - Always provide both forms:
179
- - content: "Fix authentication bug"
180
- - activeForm: "Fixing authentication bug"
181
-
182
25
  When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
@@ -0,0 +1,182 @@
1
+ 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.
2
+ It also helps the user understand the progress of the task and overall progress of their requests.
3
+
4
+ #### When to Use This Tool
5
+ Use this tool proactively in these scenarios:
6
+
7
+ 1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
8
+ 2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
9
+ 3. User explicitly requests todo list - When the user directly asks you to use the todo list
10
+ 4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
11
+ 5. After receiving new instructions - Immediately capture user requirements as todos
12
+ 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
13
+ 7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation
14
+
15
+ #### When NOT to Use This Tool
16
+
17
+ Skip using this tool when:
18
+ 1. There is only a single, straightforward task
19
+ 2. The task is trivial and tracking it provides no organizational benefit
20
+ 3. The task can be completed in less than 3 trivial steps
21
+ 4. The task is purely conversational or informational
22
+
23
+ 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.
24
+
25
+ #### Examples of When to Use the Todo List
26
+
27
+ <example>
28
+ 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!
29
+ Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
30
+ *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: Let me first search through your codebase to find all occurrences of 'getCwd'.
49
+ *Uses grep or search tools to locate all instances of getCwd in the codebase*
50
+ Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
51
+ *Creates todo list with specific items for each file that needs updating*
52
+
53
+ <reasoning>
54
+ The assistant used the todo list because:
55
+ 1. First, the assistant searched to understand the scope of the task
56
+ 2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
57
+ 3. The todo list helps ensure every instance is tracked and updated systematically
58
+ 4. This approach prevents missing any occurrences and maintains code consistency
59
+ </reasoning>
60
+ </example>
61
+
62
+
63
+ <example>
64
+ User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
65
+ Assistant: I'll help implement these features. First, let's add all the features to the todo list.
66
+ *Creates a todo list breaking down each feature into specific tasks based on the project architecture*
67
+ Assistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
68
+
69
+ <reasoning>
70
+ The assistant used the todo list because:
71
+ 1. The user provided multiple complex features to implement in a comma separated list
72
+ 2. The todo list helps organize these large features into manageable tasks
73
+ 3. This approach allows for tracking progress across the entire implementation
74
+ </reasoning>
75
+ </example>
76
+
77
+ <example>
78
+ User: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>
79
+ Assistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.
80
+ *Reviews component structure, render patterns, state management, and data fetching*
81
+ Assistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.
82
+ *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*
83
+ Let's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>
84
+
85
+ <reasoning>
86
+ The assistant used the todo list because:
87
+ 1. First, the assistant examined the codebase to identify specific performance issues
88
+ 2. Based on this analysis, it identified multiple optimization opportunities
89
+ 3. Performance optimization is a non-trivial task requiring multiple steps
90
+ 4. The todo list helps methodically track improvements across different components
91
+ 5. This systematic approach ensures all performance bottlenecks are addressed
92
+ </reasoning>
93
+ </example>
94
+
95
+ #### Examples of When NOT to Use the Todo List
96
+
97
+ <example>
98
+ User: How do I print 'Hello World' in Python?
99
+ Assistant: In Python, you can print "Hello World" with this simple code:
100
+
101
+ python
102
+ print("Hello World")
103
+
104
+ This will output the text "Hello World" to the console when executed.</assistant>
105
+
106
+ <reasoning>
107
+ 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.
108
+ </reasoning>
109
+ </example>
110
+
111
+ <example>
112
+ User: What does the git status command do?
113
+ 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.
114
+
115
+ <reasoning>
116
+ 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.
117
+ </reasoning>
118
+ </example>
119
+
120
+ <example>
121
+ User: Can you add a comment to the calculateTotal function to explain what it does?
122
+ Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
123
+ * Uses the Edit tool to add a comment to the calculateTotal function *
124
+
125
+ <reasoning>
126
+ 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.
127
+ </reasoning>
128
+ </example>
129
+
130
+ <example>
131
+ User: Run npm install for me and tell me what happens.
132
+ Assistant: I'll run the npm install command for you.
133
+
134
+ *Executes: npm install*
135
+
136
+ The command completed successfully. Here's the output:
137
+ [Output of npm install command]
138
+
139
+ All dependencies have been installed according to your package.json file.
140
+
141
+ <reasoning>
142
+ 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.
143
+ </reasoning>
144
+ </example>
145
+
146
+ #### Task States and Management
147
+
148
+ 1. **Task States**: Use these states to track progress:
149
+ - pending: Task not yet started
150
+ - in_progress: Currently working on (limit to ONE task at a time)
151
+ - completed: Task finished successfully
152
+
153
+ **IMPORTANT**: Task descriptions must have two forms:
154
+ - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project")
155
+ - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project")
156
+
157
+ 2. **Task Management**:
158
+ - Update task status in real-time as you work
159
+ - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
160
+ - Exactly ONE task must be in_progress at any time (not less, not more)
161
+ - Complete current tasks before starting new ones
162
+ - Remove tasks that are no longer relevant from the list entirely
163
+
164
+ 3. **Task Completion Requirements**:
165
+ - ONLY mark a task as completed when you have FULLY accomplished it
166
+ - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
167
+ - When blocked, create a new task describing what needs to be resolved
168
+ - Never mark a task as completed if:
169
+ - Tests are failing
170
+ - Implementation is partial
171
+ - You encountered unresolved errors
172
+ - You couldn't find necessary files or dependencies
173
+
174
+ 4. **Task Breakdown**:
175
+ - Create specific, actionable items
176
+ - Break complex tasks into smaller, manageable steps
177
+ - Use clear, descriptive task names
178
+ - Always provide both forms:
179
+ - content: "Fix authentication bug"
180
+ - activeForm: "Fixing authentication bug"
181
+
182
+ When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
@@ -61,18 +61,17 @@ def load_agent_tools(
61
61
 
62
62
  if sub_agent_type is not None:
63
63
  profile = get_sub_agent_profile(sub_agent_type)
64
- if not profile.enabled_for_model(model_name):
65
- return []
66
64
  return get_tool_schemas(list(profile.tool_set))
67
65
 
68
66
  # Main agent tools
69
67
  if "gpt-5" in model_name:
70
- tool_names = [tools.BASH, tools.READ, tools.APPLY_PATCH, tools.UPDATE_PLAN]
68
+ tool_names = [tools.BASH, tools.APPLY_PATCH, tools.UPDATE_PLAN]
71
69
  elif "gemini-3" in model_name:
72
70
  tool_names = [tools.BASH, tools.READ, tools.EDIT, tools.WRITE]
73
71
  else:
74
72
  tool_names = [tools.BASH, tools.READ, tools.EDIT, tools.WRITE, tools.TODO_WRITE]
75
73
 
76
74
  tool_names.extend(sub_agent_tool_names(enabled_only=True, model_name=model_name))
77
- tool_names.extend([tools.SKILL, tools.MERMAID, tools.MEMORY])
75
+ tool_names.extend([tools.SKILL, tools.MERMAID])
76
+ # tool_names.extend([tools.MEMORY])
78
77
  return get_tool_schemas(tool_names)
@@ -1,23 +1,13 @@
1
1
  """LLM package init.
2
2
 
3
- Imports built-in LLM clients so their ``@register`` decorators run and they
4
- become available via the registry.
3
+ LLM clients are lazily loaded to avoid heavy imports at module load time.
4
+ Only LLMClientABC and create_llm_client are exposed.
5
5
  """
6
6
 
7
- from .anthropic import AnthropicClient
8
7
  from .client import LLMClientABC
9
- from .codex import CodexClient
10
- from .openai_compatible import OpenAICompatibleClient
11
- from .openrouter import OpenRouterClient
12
8
  from .registry import create_llm_client
13
- from .responses import ResponsesClient
14
9
 
15
10
  __all__ = [
16
11
  "LLMClientABC",
17
- "ResponsesClient",
18
- "OpenAICompatibleClient",
19
- "OpenRouterClient",
20
- "AnthropicClient",
21
- "CodexClient",
22
12
  "create_llm_client",
23
13
  ]