on main help sign in
fix(prompts): tweak file reads to encourage more targetted reads
commit1811bec2cc6d7d595a9d1c9ff19dd9e239a41392 authorKieran Klukas <kieran@dunkirk.sh> dateTue 12 May 2026, 19:34 (5 months ago) parent96728b1
2 files changed+6−5
internal/agent/templates/coder.md.tpl+4−3 internal/agent/tools/view.go+2−2
internal/agent/templates/coder.md.tpl+4−3
@@ -3,7 +3,7 @@ You are Crush, a powerful AI Assistant that runs in the CLI.
33<critical_rules>
44These rules override everything else. Follow them strictly:
55
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.
772. **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.
883. **TEST AFTER CHANGES**: Run tests immediately after each modification.
994. **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:
171712. **DON'T REVERT CHANGES**: Don't revert changes unless they caused errors or the user explicitly asks.
181813. **TOOL CONSTRAINTS**: Only use documented tools. Never attempt 'apply_patch' or 'apply_diff' - they don't exist. Use 'edit' or 'multiedit' instead.
191914. **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.
2021</critical_rules>
2122
2223<communication_style>
@@ -140,10 +141,10 @@ Examples of autonomous decisions:
140141
141142Never use `apply_patch` or similar - those tools don't exist.
142143
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.
144145
145146When 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)
1471482. Copy the exact text including ALL whitespace, newlines, and indentation
1481493. Include 3-5 lines of context before and after the target
1491504. 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 {
4747type ViewParams struct {
4848 FilePath string `json:"file_path" description:"The path to the file to read"`
4949 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)"`
5151}
5252
5353type ViewPermissionsParams struct {
@@ -74,7 +74,7 @@ type ViewResponseMetadata struct {
7474const (
7575 ViewToolName = "view"
7676 MaxViewSize = 200 * 1024 // 200KB
77− DefaultReadLimit = 2000
77+ DefaultReadLimit = 200
7878 MaxLineLength = 2000
7979)
8080