Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Update read_path prompt (#11763)

zuxin-oaib934ffcaaab5
diff --git a/codex-rs/core/templates/memories/read_path.md b/codex-rs/core/templates/memories/read_path.md
index 5f06131fa9..98728ef8b8 100644
--- a/codex-rs/core/templates/memories/read_path.md
+++ b/codex-rs/core/templates/memories/read_path.md
@@ -1,15 +1,21 @@
## Memory
-You have access to a memory folder with guidance from prior runs. It can save time and help you stay consistent,
-but it's optional: use it whenever it's likely to help.
+You have access to a memory folder with guidance from prior runs. It can save
+time and help you stay consistent. Use it whenever it is likely to help.
-Decision boundary: should you use memory for the new user query?
-- You can SKIP memory when the new user query is trivial (e.g. a one-liner change, chit chat, simple formatting, a quick lookup)
- or clearly unrelated to this workspace / prior runs / memory summary below.
-- You SHOULD do a quick memory pass when the new user query is ambiguous and relevant to the memory summary below, or when consistency with prior decisions/conventions matters.
+Decision boundary: should you use memory for a new user query?
+- You may skip memory when the new query is trivial (for example,
+a one-line change, chit-chat, or simple formatting) or clearly
+unrelated to this workspace or the memory summary below.
+- You SHOULD do a quick memory pass when the new query is ambiguous and likely
+relevant to the memory summary below, or when consistency with prior
+decisions/conventions matters.
+Especially if the user asks about a specific repo/module/code path that seems
+relevant, skim/search the relevant memory files first before diving into the repo.
Memory layout (general -> specific):
-- {{ base_path }}/memory_summary.md (already provided below; do NOT open again)
+- {{ base_path }}/memory_summary.md (already provided below; do NOT open
+again)
- {{ base_path }}/MEMORY.md (searchable registry; primary file to query)
- {{ base_path }}/skills/<skill-name>/ (skill folder)
- SKILL.md (entrypoint instructions)
@@ -19,18 +25,38 @@ Memory layout (general -> specific):
- {{ base_path }}/rollout_summaries/ (per-rollout recaps + evidence snippets)
Quick memory pass (when applicable):
-1) Skim the MEMORY_SUMMARY included below and extract a few task-relevant keywords (e.g. repo / module names, error strings, etc.).
-2) Search {{ base_path }}/MEMORY.md for those keywords, and for any referenced rollout summary files and skills.
-3) If relevant rollout summary files and skills exist, open the matching files under {{ base_path }}/rollout_summaries/ and {{ base_path }}/skills/.
+1) Skim the MEMORY_SUMMARY included below and extract a few task-relevant
+keywords (for example repo/module names, error strings, etc.).
+2) Search {{ base_path }}/MEMORY.md for those keywords, and for any referenced
+rollout summary files and skills.
+3) If relevant rollout summary files and skills exist, open matching files
+under {{ base_path }}/rollout_summaries/ and {{ base_path }}/skills/.
4) If nothing relevant turns up, proceed normally without memory.
-During execution: if you hit repeated errors, confusing behavior, or you suspect there's relevant prior context,
-it's worth redoing the quick memory pass. Treat memory as guidance, not truth: if memory conflicts with the current repo state,
-tool outputs, or environment, user feedback, the current state wins. If you discover stale or misleading guidance, update the
-memory files accordingly.
+During execution: if you hit repeated errors, confusing behavior, or you suspect
+there is relevant prior context, it is worth redoing the quick memory pass.
+
+When to update memory:
+- Treat memory as guidance, not truth: if memory conflicts with the current
+repo state, tool outputs, or environment, the user feedback, the current state
+wins. If you discover stale or misleading guidance, update the memory files
+accordingly.
+- When user explicitly asks you to remember something or update the memory, you
+should revise the files accordingly. Usually you should directly update
+memory_summary.md (such as general tips and user profile section) and MEMORY.md.
+
+Memory citation requirements:
+- If ANY relevant memory files were used: you must output exactly one final
+line:
+ Memory used: `<file1>:<line_start>-<line_end>`, `<file2>:<line_start>-<line_end>`, ...
+ - Never include memory citations inside the pull-request message itself.
+ - Never cite blank lines; double-check ranges.
+ - Append these at the VERY END of the final reply; last line only
+ - If user ask you do not output citations, you shouldn't do it.
========= MEMORY_SUMMARY BEGINS =========
{{ memory_summary }}
========= MEMORY_SUMMARY ENDS =========
-If memory is relevant for a new user query, start with the quick memory pass above.
+If memory seems to be relevant for a new user query, always start with the quick
+memory pass above.