Skip to content

Commit a003bac

Browse files
committed
fix: strengthen code generation discipline in system prompt and write_file tool
System prompt (main.go): - Added 'Code generation discipline' section with 6 rules: - Use EXACT file paths from the task (never simplify) - Never modify source files when creating new output files - Write correct code on first attempt (no write-test-rewrite loops) - Follow specified function signatures and designs exactly - After writing a file, do not run tests unless asked write_file tool (file_tool.go): - Added CRITICAL note to description about exact path usage - Updated schema path parameter to warn against path simplification
1 parent f82e01d commit a003bac

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

cmd/odek/file_tool.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ func (t *writeFileTool) Name() string { return "write_file" }
157157
func (t *writeFileTool) Description() string {
158158
return `Write content to a file, completely replacing existing content.
159159
Creates parent directories automatically. OVERWRITES the entire file.
160-
Use patch for targeted edits.`
160+
Use patch for targeted edits.
161+
CRITICAL: Use the EXACT path specified in the task. Do not simplify or drop directories from the path.`
161162
}
162163

163164
func (t *writeFileTool) Schema() any {
@@ -166,7 +167,7 @@ func (t *writeFileTool) Schema() any {
166167
"properties": map[string]any{
167168
"path": map[string]any{
168169
"type": "string",
169-
"description": "Path to the file to write (will be created/overwritten).",
170+
"description": "Path to the file to write (will be created/overwritten). Use the EXACT path from the task — never drop or simplify directories.",
170171
},
171172
"content": map[string]any{
172173
"type": "string",

cmd/odek/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ Output discipline:
9797
- When counting or measuring (LOC, files, etc.), double-check your numbers.
9898
Run the counting command and verify the output before answering.
9999
100+
Code generation discipline — critical for writing files:
101+
- When the task specifies an output file path (e.g. "benchmark_data/output/X.py"),
102+
use that EXACT path with write_file. Never drop directories or simplify.
103+
A path like "benchmark_data/output/X.py" must be written as "benchmark_data/output/X.py",
104+
not "X.py" or "output/X.py".
105+
- NEVER modify existing source files when the task asks you to CREATE new output files.
106+
Read-only operations on source files are fine; just don't write to them.
107+
- Write correct code on the FIRST attempt. Do NOT write, then test, then rewrite, then retest.
108+
If you need to verify, read the file back once, then move on.
109+
- Follow the specified function signature, class structure, and design EXACTLY.
110+
Do not invent a different architecture or framework than what was asked for.
111+
- After writing a file, do NOT run tests or verify with shell commands unless
112+
the task explicitly asks you to. One write is enough.
113+
100114
Tool conventions — use these dedicated tools, NOT shell commands:
101115
- Do NOT use cat/head/tail to read files — use read_file instead (line numbers, pagination).
102116
- Do NOT use grep/rg/find to search — use search_files instead (regex, glob, context lines).

0 commit comments

Comments
 (0)