mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 06:17:58 +00:00
Prompts
This commit is contained in:
1 parent
5f8baf732d
commit
2d4081ee39
2 files changed
+39
-12
No files matched your search
+17
-6
@@ -19,7 +19,7 @@ prompts:
|
||||
* the util commands for the system, like `git`, `ls`, `cd`, `grep`, `find`, etc. Keep in mind that the system is {{ system }},
|
||||
so the commands might be different than on a regular unix system.
|
||||
* whether there are particular guidelines, styles, design patterns, etc. that one should know about
|
||||
|
||||
|
||||
This list is not exhaustive, you can add more information if you think it is relevant.
|
||||
|
||||
For doing that, you will need to acquire information about the project with the corresponding tools.
|
||||
@@ -51,9 +51,10 @@ prompts:
|
||||
|
||||
think_about_whether_you_are_done: |
|
||||
Have you already performed all the steps required by the task? Is it appropriate to run tests and linting, and if so,
|
||||
have you done that already? Should new tests be written to cover the changes?
|
||||
have you done that already? Is it appropriate to adjust non-code files like documentation and config and have you done that already?
|
||||
Should new tests be written to cover the changes?
|
||||
Note that a task that is just about exploring the codebase does not require running tests or linting.
|
||||
Read the corresponding memory files to see what should be done when a task is completed. You might need to list them first.
|
||||
Read the corresponding memory files to see what should be done when a task is completed.
|
||||
|
||||
summarize_changes: |
|
||||
Summarize all the changes you have made to the codebase over the course of the conversation.
|
||||
@@ -74,6 +75,16 @@ prompts:
|
||||
system_prompt: |
|
||||
You are a professional coding agent who is concerned with one particular codebase. You have tools to explore the codebase
|
||||
iteratively, to edit files and to execute arbitrary commands. You heavily rely on these tools to solve the tasks given to you,
|
||||
but you also operate in a frugal and intelligent manner, always
|
||||
keeping in mind to not load content that is not needed for the task at hand. If you cannot find everything you need in the codebase
|
||||
and generally when in doubt, you ask the user clarifying questions.
|
||||
and you operate in a frugal and intelligent manner, always
|
||||
keeping in mind to not load content that is not needed for the task at hand.
|
||||
Whenever you want to read or edit code, you try using the symbolic tools first instead of just reading or editing files or lines.
|
||||
For understanding symbol locations, you make sure to have read them using find symbol or
|
||||
the overview tools. You only use read_file, replace_lines and so on if the
|
||||
symbolic tools are not appropriate for some reason (e.g., adding new imports at the top of the file,
|
||||
or if you really just need to change a few lines).
|
||||
|
||||
If you cannot find everything you need in the codebase
|
||||
and generally when in doubt, you ask the user clarifying questions instead of guessing.
|
||||
|
||||
You never make assumptions about code that you failed to read or find, instead you stop
|
||||
and ask the user for clarification.
|
||||
+22
-6
@@ -1011,7 +1011,10 @@ class CheckOnboardingPerformedTool(Tool):
|
||||
def apply(self) -> str:
|
||||
"""
|
||||
Checks whether project onboarding was already performed.
|
||||
You should always call this tool before beginning to actually work on a project/after activating a project.
|
||||
You should always call this tool before beginning to actually work on the project/after activating a project,
|
||||
but after calling the initial instructions tool.
|
||||
If onboarding was already performed, you will receive a list of available memories.
|
||||
Don't read the memories immediately after if not needed, just remember that they exist and that you can read them later.
|
||||
"""
|
||||
list_memories_tool = self.agent.get_tool(ListMemoriesTool)
|
||||
memories = json.loads(list_memories_tool.apply())
|
||||
@@ -1143,9 +1146,7 @@ class ThinkAboutWhetherYouAreDoneTool(Tool):
|
||||
|
||||
def apply(self) -> str:
|
||||
"""
|
||||
Think about whether you are done with the task.
|
||||
|
||||
This tool should ALWAYS be called after you have completed a task or a subtask.
|
||||
Whenever you feel that you are done with what the user has asked for, it is important to call this tool.
|
||||
"""
|
||||
return self.prompt_factory.create_think_about_whether_you_are_done()
|
||||
|
||||
@@ -1158,8 +1159,8 @@ class SummarizeChangesTool(Tool):
|
||||
def apply(self) -> str:
|
||||
"""
|
||||
Summarize the changes you have made to the codebase.
|
||||
This tool should ALWAYS be called after you have fully completed any non-trivial coding task
|
||||
(but after the think_about_whether_you_are_done call).
|
||||
This tool should always be called after you have fully completed any non-trivial coding task,
|
||||
but only after the think_about_whether_you_are_done call.
|
||||
"""
|
||||
return self.prompt_factory.create_summarize_changes()
|
||||
|
||||
@@ -1321,6 +1322,21 @@ class ActivateProjectTool(Tool, ToolMarkerDoesNotRequireActiveProject):
|
||||
return SUCCESS_RESULT
|
||||
|
||||
|
||||
class InitialInstructionsTool(Tool):
|
||||
"""
|
||||
Gets the initial instructions for the current project.
|
||||
Should only be used in settings where the system prompt cannot be set,
|
||||
e.g. in clients you have no control over, like Claude Desktop.
|
||||
"""
|
||||
|
||||
def apply(self) -> str:
|
||||
"""
|
||||
Get the initial instructions for the current coding project.
|
||||
You should always call this tool before starting to work (including using any other tool) on any programming task!
|
||||
"""
|
||||
return self.agent.prompt_factory.create_system_prompt()
|
||||
|
||||
|
||||
def iter_tool_classes() -> Generator[type[Tool], None, None]:
|
||||
return iter_subclasses(Tool)
|
||||
|
||||
|
||||
Reference in new issue
Block a user