Skip to content

Commit 9de52aa

Browse files
committed
Fixed: Encourage targeted reads via offset/limit in read tool and edit rules
1 parent 29815cd commit 9de52aa

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/reloaded-code-core/src/context/tool_prompt/common_rules.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn append_search_rule(facts: ToolPromptFacts, output: &mut String) {
7373
(true, true, true) => push_line(
7474
output,
7575
formatcp!(
76-
"- Use `{}` for file-name search, `{}` for content search, and `{}` for full-file inspection.",
76+
"- Use `{}` for file-name search, `{}` for content search, and `{}` for file content.",
7777
glob::NAME,
7878
grep::NAME,
7979
read::NAME,
@@ -85,11 +85,11 @@ fn append_search_rule(facts: ToolPromptFacts, output: &mut String) {
8585
),
8686
(true, false, true) => push_line(
8787
output,
88-
formatcp!("- Use `{}` to find files and `{}` for full-file inspection.", glob::NAME, read::NAME),
88+
formatcp!("- Use `{}` to find files and `{}` for file content.", glob::NAME, read::NAME),
8989
),
9090
(false, true, true) => push_line(
9191
output,
92-
formatcp!("- Use `{}` for content search and `{}` for full-file inspection.", grep::NAME, read::NAME),
92+
formatcp!("- Use `{}` for content search and `{}` for file content.", grep::NAME, read::NAME),
9393
),
9494
_ => {}
9595
}
@@ -115,7 +115,7 @@ fn append_read_before_edit_rule(facts: ToolPromptFacts, output: &mut String) {
115115
(true, true, true, true) => push_line(
116116
output,
117117
formatcp!(
118-
"- Read a file before `{}` or overwriting it with `{}`; for `{}`, copy exact text from `{}` and omit any `{}` prefixes.",
118+
"- Read before `{}` or overwriting with `{}`; for `{}`, copy exact text from `{}` and omit any `{}` prefixes.",
119119
edit::NAME,
120120
write::NAME,
121121
edit::NAME,
@@ -126,7 +126,7 @@ fn append_read_before_edit_rule(facts: ToolPromptFacts, output: &mut String) {
126126
(true, true, true, false) => push_line(
127127
output,
128128
formatcp!(
129-
"- Read a file before `{}` or overwriting it with `{}`; for `{}`, copy exact text from `{}`.",
129+
"- Read before `{}` or overwriting with `{}`; for `{}`, copy exact text from `{}`.",
130130
edit::NAME,
131131
write::NAME,
132132
edit::NAME,
@@ -136,7 +136,7 @@ fn append_read_before_edit_rule(facts: ToolPromptFacts, output: &mut String) {
136136
(true, true, false, true) => push_line(
137137
output,
138138
formatcp!(
139-
"- Read a file before `{}`, then copy exact text from `{}` and omit any `{}` prefixes.",
139+
"- Read before `{}`, then copy exact text from `{}` and omit any `{}` prefixes.",
140140
edit::NAME,
141141
read::NAME,
142142
read::LINE_PREFIX_DISPLAY,
@@ -145,13 +145,13 @@ fn append_read_before_edit_rule(facts: ToolPromptFacts, output: &mut String) {
145145
(true, true, false, false) => push_line(
146146
output,
147147
formatcp!(
148-
"- Read a file before `{}`, then copy exact text from `{}`.",
148+
"- Read before `{}`, then copy exact text from `{}`.",
149149
edit::NAME,
150150
read::NAME,
151151
),
152152
),
153153
(true, false, true, _) => {
154-
push_line(output, formatcp!("- Read a file before overwriting it with `{}`.", write::NAME))
154+
push_line(output, formatcp!("- Read before overwriting with `{}`.", write::NAME))
155155
}
156156
_ => {}
157157
}

src/reloaded-code-core/src/context/tool_prompt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mod tool_sections;
1818
pub(crate) const COMMON_RULES_HEADER: &str = "## Common Rules\n";
1919

2020
/// Largest common-rules section length, including [`COMMON_RULES_HEADER`].
21-
pub(crate) const COMMON_RULES_SECTION_MAX_SIZE: usize = 493;
21+
pub(crate) const COMMON_RULES_SECTION_MAX_SIZE: usize = 475;
2222

2323
/// Describes how a tool accepts paths.
2424
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

src/reloaded-code-core/src/system_prompt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ mod tests {
11731173
let preamble = pb.build();
11741174

11751175
assert!(preamble.contains("## Common Rules"));
1176-
assert!(preamble.contains("Read a file before `edit`, then copy exact text from `read`."));
1176+
assert!(preamble.contains("Read before `edit`, then copy exact text from `read`."));
11771177
assert!(preamble.contains("- Returns raw text. Lines over `2000` chars are truncated."));
11781178
assert!(preamble.contains("- Reads files, not directories."));
11791179
assert!(!preamble.contains("`glob`"));

0 commit comments

Comments
 (0)