Prompting

This commit is contained in:
Michael Panchenko
2025-05-24 18:20:29 +02:00
parent c9418f8bd3
commit e27b442efc
5 changed files with 33 additions and 15 deletions
+4 -2
View File
@@ -1,5 +1,7 @@
description: All tools, with detailed instructions for code editing
prompt: |
You are operating in editing mode. Your task is to implement the requested changes while adhering to the project's
code style and patterns. Use symbolic editing tools whenever possible for precise code modifications.
You are operating in editing mode. You can edit files with the provided tools
to implement the requested changes to the code base while adhering to the project's code style and patterns.
Use symbolic editing tools whenever possible for precise code modifications.
If no editing task has yet been provided, wait for the user to provide one.
excluded_tools: []
+3
View File
@@ -9,6 +9,9 @@ prompt: |
Only abort the task if absolutely necessary, such as when critical information is missing that cannot be inferred
from the codebase.
It may be that you have not received a task yet. In this case, wait for the user to provide a task, this will be the
only time you should wait for user interaction.
excluded_tools:
- get_current_config
- activate_project
+12 -3
View File
@@ -1,8 +1,17 @@
description: Only read-only tools, focused on analysis and planning
prompt: |
You are operating in planning mode. Your task is to analyze code and create a comprehensive plan but not write any code.
Focus on understanding the existing codebase structure, architecture, and functionality to create detailed planning
documents that can be used for future implementation.
You are operating in planning mode. Your task is to analyze code but not write any code.
The user may ask you to assist in creating a comprehensive plan, or to learn something about the codebase -
either a small aspect of it or about the whole project.
When reading code in order to answer a user question or task, you should try reading only the necessary code.
Some tasks may require you to understand the architecture of large parts of the codebase, while for others,
it may be enough to read a single file or a small set of symbols.
You can achieve the intelligent reading of code by using the symbolic tools for getting an overview of symbols and
the relations between them, and then only reading the bodies of symbols that are necessary to answer the question
or complete the task. You can also use the standard tools like list_dir and search_for_pattern if you need to.
You generally have access to memories and it may be useful for you to read them, but also only if they help you
to answer the question or complete the task. You can infer which memories are relevant to the current task by reading
the memory names and descriptions.
excluded_tools:
- create_text_file
- replace_symbol_body
+5 -5
View File
@@ -8,15 +8,15 @@ enable_project_activation: True
# Add your list of projects here (which you can switch between using "activate_project").
# Every list item must be either
# - a path to a .yml file, absolute or relative to the directory this
# - [Recommended] a path to the project's root directory (e.g. "/path/to/myproject"), with the
# configuration file being located in "/path/to/myproject/.serena/project.yml".
# In this case, the name of the project will be the name of the directory ("myproject").
# - or a path to a .yml file, absolute or relative to the directory this
# configuration file is in (e.g. "myproject.yml" or "/path/to/wherever/myproject.yml").
# In this case, the name of the project will be the base filename of the .yml file
# (e.g. "myproject" for "myproject.yml").
# - or a path to the project's root directory (e.g. "/path/to/myproject"), with the
# configuration file being located in "/path/to/myproject/.serena/project.yml".
# In this case, the name of the project will be the name of the directory ("myproject").
projects:
- myproject.yml
- /path/to/myproject
# Whether to open a graphical window with Serena's logs (not supported on macOS).
# This is useful both for troubleshooting and for monitoring the tool calls,
+9 -5
View File
@@ -1232,8 +1232,6 @@ class CheckOnboardingPerformedTool(Tool):
Checks whether project onboarding was already performed.
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())
@@ -1243,7 +1241,13 @@ class CheckOnboardingPerformedTool(Tool):
+ "You should perform onboarding by calling the `onboarding` tool before proceeding with the task."
)
else:
return json.dumps({"result": "Onboarding already performed.", "available_memories": memories})
return f"""The onboarding was already performed, below is the list of available memories.
Do not read them immediately, just remember that they exist and that you can read them later, if it is necessary
for the current task.
Some memories may be based on previous conversations, others may be general for the current project.
You should be able to tell which one you need based on the name of the memory.
{memories}"""
class OnboardingTool(Tool):
@@ -1556,8 +1560,8 @@ class SwitchModesTool(Tool):
self.agent.set_modes(mode_instances)
# Inform the Agent about the activated modes and the currently active tools
result_str = f"Successfully activated modes: {', '.join([mode.name for mode in mode_instances])}"
result_str += "\n".join([mode_instance.prompt for mode_instance in mode_instances])
result_str = f"Successfully activated modes: {', '.join([mode.name for mode in mode_instances])}" + "\n"
result_str += "\n".join([mode_instance.prompt for mode_instance in mode_instances]) + "\n"
result_str += f"Currently active tools: {', '.join(self.agent.get_active_tool_names())}"
return result_str