From ba6652cd745874cf18a8f38fb731d67aace41409 Mon Sep 17 00:00:00 2001 From: Michael Panchenko Date: Mon, 2 Jun 2025 21:37:17 +0200 Subject: [PATCH] Extended planning mode, minor extension in editing mode prompt --- src/serena/resources/config/modes/editing.yml | 5 +++-- src/serena/resources/config/modes/planning.yml | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/serena/resources/config/modes/editing.yml b/src/serena/resources/config/modes/editing.yml index 431fe55b..901f32e8 100644 --- a/src/serena/resources/config/modes/editing.yml +++ b/src/serena/resources/config/modes/editing.yml @@ -16,7 +16,7 @@ prompt: | You can get information about available symbols by using the `get_symbols_overview` tool for finding top-level symbols in a file or directory, or by using `find_symbol` if you already know the symbol's name path. You generally try to read as little code as possible while still solving your task, meaning you only read the bodies when you need to, and after you have found the symbol you want to edit. - For example, if you are working with python code and alread know that you need to read the body of the constructor of the class Foo, you can directly + For example, if you are working with python code and already know that you need to read the body of the constructor of the class Foo, you can directly use `find_symbol` with the name path `Foo/__init__` and `include_body=True`. If you don't know yet which methods in `Foo` you need to read or edit, you can use `find_symbol` with the name path `Foo`, `include_body=False` and `depth=1` to get all (top-level) methods of `Foo` before proceeding to read the desired methods with `include_body=True`. @@ -37,12 +37,13 @@ prompt: | then use your knowledge of the codebase to write the regex, if you haven't collected enough information of this content yet. You are extremely good at regex, so you never need to check whether the replacement produced the correct result. In particular, you know what to escape and what not to escape, and you know how to use wildcards. + Also, the regex tool never adds any indentation (contrary to the symbolic editing tools), so you have to take care to add the correct indentation + when using it to insert code. Moreover, the replacement tool will fail if it can't perform the desired replacement, and this is all the feedback you need. Your overall goal for replacement operations is to use relatively short regexes, since I want you to minimize the number of output tokens. For replacements of larger chunks of code, this means you intelligently make use of wildcards for the middle part and of characteristic snippets for the before/after parts that uniquely identify the chunk. - For small replacements, up to a single line, you follow the following rules: 1. If the snippet to be replaced is likely to be unique within the file, you perform the replacement by directly using the escaped version of the diff --git a/src/serena/resources/config/modes/planning.yml b/src/serena/resources/config/modes/planning.yml index 53e2989b..c76501e8 100644 --- a/src/serena/resources/config/modes/planning.yml +++ b/src/serena/resources/config/modes/planning.yml @@ -8,7 +8,19 @@ prompt: | 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. + or complete the task. You can also use the standard tools like list_dir, find_file and search_for_pattern if you need to. + + Symbols are identified by their name path and relative file path, see the description of the `find_symbols` tool for more details + on how the `name_path` matches symbols. + You can get information about available symbols by using the `get_symbols_overview` tool for finding top-level symbols in a file + or directory, or by using `find_symbol` if you already know the symbol's name path. You generally try to read as little code as possible + while still solving your task, meaning you only read the bodies when you need to, and after you have found the symbol you want to edit. + For example, if you are working with python code and already know that you need to read the body of the constructor of the class Foo, you can directly + use `find_symbol` with the name path `Foo/__init__` and `include_body=True`. If you don't know yet which methods in `Foo` you need to read or edit, + you can use `find_symbol` with the name path `Foo`, `include_body=False` and `depth=1` to get all (top-level) methods of `Foo` before proceeding + to read the desired methods with `include_body=True` + You can unterstand relationships between symbols by using the `find_referencing_symbols` tool. + 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. @@ -21,3 +33,4 @@ excluded_tools: - replace_lines - insert_at_line - execute_shell_command + - replace_regex