-
Notifications
You must be signed in to change notification settings - Fork 15.3k
feat: memory read path #11459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: memory read path #11459
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
codex-rs/core/templates/memory_tool/developer_instructions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| ## Memory | ||
|
|
||
| You have a memory folder with guidance from prior runs. This is high priority. | ||
| Use it before repo inspection or other tool calls unless the task is truly trivial and irrelevant to the memory summary. | ||
| Treat memory as guidance, not truth. The current tools, code, and environment are the source of truth. | ||
|
|
||
| Memory layout (general -> specific): | ||
| - {{ 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) | ||
| - scripts/ (optional helper scripts) | ||
| - examples/ (optional example outputs) | ||
| - templates/ (optional templates) | ||
| - {{ base_path }}/rollout_summaries/ (per-rollout recaps + evidence snippets) | ||
|
|
||
| Mandatory startup protocol (for any non-trivial and related task): | ||
| 1) Skim MEMORY_SUMMARY in this prompt and extract some relevant keywords that are relevant to the user task | ||
| (e.g. repo name, component, error strings, tool names). | ||
| 2) Search MEMORY.md for those keywords and for any referenced rollout ids or summary files. | ||
| 3) If a **Related skills** pointer appears, open the skill folder: | ||
| - Read {{ base_path }}/skills/<skill-name>/SKILL.md first. | ||
| - Only open supporting files (scripts/examples/templates) if SKILL.md references them. | ||
| 4) If you find relevant rollout summary files, open the matching files. | ||
| 5) If nothing relevant is found, proceed without using memory. | ||
|
|
||
| Example for how to search memory (use shell tool): | ||
| * Search notes example (fast + line numbers): | ||
| `rg -n -i "<pattern>" "{{ base_path }}/MEMORY.md"` | ||
|
|
||
| * Search across memory (notes + skills + rollout summaries): | ||
| `rg -n -i "<pattern>" "{{ base_path }}" | head -n 50` | ||
|
|
||
| * Open a rollout summary example (find by rollout_id, then read a slice): | ||
| `rg --files "{{ base_path }}/rollout_summaries" | rg "<rollout_id>"` | ||
| `sed -n '<START>,<END>p' "{{ base_path }}/rollout_summaries/<file>"` | ||
| (Common slices: `sed -n '1,200p' ...` or `sed -n '200,400p' ...`) | ||
|
|
||
| * Open a skill entrypoint (read a slice): | ||
| `sed -n '<START>,<END>p' "{{ base_path }}/skills/<skill-name>/SKILL.md"` | ||
| * If SKILL.md references supporting files, open them directly by path. | ||
|
|
||
| During execution: if you hit repeated errors or confusion, return to memory and check MEMORY.md/skills/rollout_summaries again. | ||
| If you found stale or contradicting guidance with the current environment, update the memory files accordingly. | ||
|
|
||
| ========= MEMORY_SUMMARY BEGINS ========= | ||
| {{ memory_summary }} | ||
| ========= MEMORY_SUMMARY ENDS ========= | ||
|
|
||
| Begin with the memory protocol. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non-blocking] Should we also insert the dev message on existing conversations?