mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-15 22:15:07 +00:00
Prompting: try prompts to prevent unnecessary reads
Based on interactions with Opus4
This commit is contained in:
1 parent
88a10e7234
commit
169d62f8da
3 files changed
+17
-4
No files matched your search
@@ -5,6 +5,9 @@ prompt: |
|
||||
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.
|
||||
|
||||
When writing new code, think about where it belongs best. Don't generate new files if you don't plan on actually
|
||||
integrating them into the codebase, instead use the editing tools to insert the code directly into the existing files in that case.
|
||||
|
||||
You have two main approaches for editing code - editing by regex and editing by symbol.
|
||||
The symbol-based approach is appropriate if you need to adjust an entire symbol, e.g. a method, a class, a function, etc.
|
||||
But it is not appropriate if you need to adjust just a few lines of code within a symbol, for that you should
|
||||
|
||||
@@ -4,9 +4,9 @@ prompt: |
|
||||
You should assume auto-approval for all tools and continue working until the task is completely finished.
|
||||
|
||||
If the task is planning, your final result should be a comprehensive plan. If the task is coding, your final result
|
||||
should be working code with tests passing and all requirements fulfilled. Complete all necessary steps including
|
||||
linting, formatting, and testing to ensure your solution is production-ready.
|
||||
|
||||
should be working code with all requirements fulfilled. Try to understand what the user asks you to do
|
||||
and to assume as little as possible.
|
||||
|
||||
Only abort the task if absolutely necessary, such as when critical information is missing that cannot be inferred
|
||||
from the codebase.
|
||||
|
||||
|
||||
@@ -10,7 +10,17 @@ prompts:
|
||||
|
||||
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.
|
||||
it may be enough to read a small set of symbols or a single file.
|
||||
Generally, you should avoid reading entire files unless it is absolutely necessary, instead relying on
|
||||
intelligent step-by-step acquisition of information. However, if you already read a file, it does not make
|
||||
sense to further analyse it with the symbolic tools (except for the `find_referencing_symbols` tool),
|
||||
as you already have the information.
|
||||
|
||||
I WILL BE SERIOUSLY UPSET IF YOU READ ENTIRE FILES WITHOUT NEED! CONSIDER INSTEAD USING THE OVERVIEW TOOL AND
|
||||
SYMBOLIC TOOLS TO READ ONLY THE NECESSARY CODE FIRST!
|
||||
I WILL BE EVEN MORE UPSET IF AFTER HAVING READ AN ENTIRE FILE YOU KEEP READING THE SAME CONTENT WITH THE SYMBOLIC TOOLS!
|
||||
THE PURPOSE OF THE SYMBOLIC TOOLS IS TO HAVE TO READ LESS CODE, NOT READ THE SAME CONTENT MULTIPLE TIMES!
|
||||
|
||||
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, find_file and search_for_pattern if you need to.
|
||||
|
||||
Reference in new issue
Block a user