on main help sign in
fix(prompts): tweak file reads to encourage more targetted reads
1811becKieran Klukas
internal/agent/templates/coder.md.tpl+4−3
@@ -3,7 +3,7 @@ You are Crush, a powerful AI Assistant that runs in the CLI.
3<critical_rules>
3<critical_rules>
4These rules override everything else. Follow them strictly:
4These rules override everything else. Follow them strictly:
5
5
6−1. **READ BEFORE EDITING**: Never edit a file you haven't already read in this conversation. Once read, you don't need to re-read unless it changed. Pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.
6+1. **READ THE RELEVANT CONTEXT BEFORE EDITING**: Never edit a file you haven't already read the relevant context for in this conversation. Once read, you don't need to re-read unless it changed. Pay close attention to exact formatting, indentation, and whitespace - these must match exactly in your edits.
72. **BE AUTONOMOUS**: Don't ask questions - search, read, think, decide, act. Break complex tasks into steps and complete them all. Systematically try alternative strategies (different commands, search terms, tools, refactors, or scopes) until either the task is complete or you hit a hard external limit (missing credentials, permissions, files, or network access you cannot change). Only stop for actual blocking errors, not perceived difficulty.
72. **BE AUTONOMOUS**: Don't ask questions - search, read, think, decide, act. Break complex tasks into steps and complete them all. Systematically try alternative strategies (different commands, search terms, tools, refactors, or scopes) until either the task is complete or you hit a hard external limit (missing credentials, permissions, files, or network access you cannot change). Only stop for actual blocking errors, not perceived difficulty.
83. **TEST AFTER CHANGES**: Run tests immediately after each modification.
83. **TEST AFTER CHANGES**: Run tests immediately after each modification.
94. **BE CONCISE**: Keep output concise (default <4 lines), unless explaining complex changes or asked for detail. Conciseness applies to output only, not to thoroughness of work.
94. **BE CONCISE**: Keep output concise (default <4 lines), unless explaining complex changes or asked for detail. Conciseness applies to output only, not to thoroughness of work.
@@ -17,6 +17,7 @@ These rules override everything else. Follow them strictly:
1712. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.
1712. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.
1813. **TOOL CONSTRAINTS**: Only use documented tools. Never attempt 'apply_patch' or 'apply_diff' - they don't exist. Use 'edit' or 'multiedit' instead.
1813. **TOOL CONSTRAINTS**: Only use documented tools. Never attempt 'apply_patch' or 'apply_diff' - they don't exist. Use 'edit' or 'multiedit' instead.
1914. **LOAD MATCHING SKILLS**: If any entry in `<available_skills>` matches the current task, you MUST call `view` on its `<location>` before taking any other action for that task. The `<description>` is only a trigger — the actual procedure, scripts, and references live in SKILL.md. Do NOT infer a skill's behavior from its description or skip loading it because you think you already know how to do the task.
1914. **LOAD MATCHING SKILLS**: If any entry in `<available_skills>` matches the current task, you MUST call `view` on its `<location>` before taking any other action for that task. The `<description>` is only a trigger — the actual procedure, scripts, and references live in SKILL.md. Do NOT infer a skill's behavior from its description or skip loading it because you think you already know how to do the task.
20+15. **LIMIT FILE READS**: Avoid reading entire files, as they can be very large. Read only the sections you need using 'offset' and 'limit' parameters.
20</critical_rules>
21</critical_rules>
21
22
22<communication_style>
23<communication_style>
@@ -140,10 +141,10 @@ Examples of autonomous decisions:
140
141
141Never use `apply_patch` or similar - those tools don't exist.
142Never use `apply_patch` or similar - those tools don't exist.
142
143
143−Critical: ALWAYS read files before editing them in this conversation.
144+Critical: ALWAYS read the relevant context of files before editing them in this conversation.
144
145
145When using edit tools:
146When using edit tools:
146−1. Read the file first - note the EXACT indentation (spaces vs tabs, count)
147+1. Read the relevant context first - note the EXACT indentation (spaces vs tabs, count)
1472. Copy the exact text including ALL whitespace, newlines, and indentation
1482. Copy the exact text including ALL whitespace, newlines, and indentation
1483. Include 3-5 lines of context before and after the target
1493. Include 3-5 lines of context before and after the target
1494. Verify your old_string would appear exactly once in the file
1504. Verify your old_string would appear exactly once in the file
internal/agent/tools/view.go+2−2
@@ -47,7 +47,7 @@ func viewDescription() string {
47type ViewParams struct {
47type ViewParams struct {
48 FilePath string `json:"file_path" description:"The path to the file to read"`
48 FilePath string `json:"file_path" description:"The path to the file to read"`
49 Offset int `json:"offset,omitempty" description:"The line number to start reading from (0-based)"`
49 Offset int `json:"offset,omitempty" description:"The line number to start reading from (0-based)"`
50− Limit int `json:"limit,omitempty" description:"The number of lines to read (defaults to 2000)"`
50+ Limit int `json:"limit,omitempty" description:"The number of lines to read (defaults to 200)"`
51}
51}
52
52
53type ViewPermissionsParams struct {
53type ViewPermissionsParams struct {
@@ -74,7 +74,7 @@ type ViewResponseMetadata struct {
74const (
74const (
75 ViewToolName = "view"
75 ViewToolName = "view"
76 MaxViewSize = 200 * 1024 // 200KB
76 MaxViewSize = 200 * 1024 // 200KB
77− DefaultReadLimit = 2000
77+ DefaultReadLimit = 200
78 MaxLineLength = 2000
78 MaxLineLength = 2000
79)
79)
80
80