Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Add file reference guidelines to gpt-5 prompt (#3651)

pakrym-oaib1c291e2bbca
diff --git a/codex-rs/core/prompt.md b/codex-rs/core/prompt.md
index e18327b46b..e4590c386d 100644
--- a/codex-rs/core/prompt.md
+++ b/codex-rs/core/prompt.md
@@ -251,6 +251,16 @@ You are producing plain text that will later be styled by the CLI. Follow these
- Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command.
- Never mix monospace and bold markers; choose one based on whether it’s a keyword (`**`) or inline code/path (`` ` ``).
+**File References**
+When referencing files in your response, make sure to include the relevant start line and always follow the below rules:
+ * Use inline code to make file paths clickable.
+ * Each reference should have a stand alone path. Even if it's the same file.
+ * Accepted: absolute, workspace‑relative, a/ or b/ diff prefixes, or bare filename/suffix.
+ * Line/column (1‑based, optional): :line[:column] or #Lline[Ccolumn] (column defaults to 1).
+ * Do not use URIs like file://, vscode://, or https://.
+ * Do not provide range of lines
+ * Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\repo\project\main.rs:12:5
+
**Structure**
- Place related bullets together; don’t mix unrelated concepts in the same section.