opencode-codex-memory 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/llm.d.ts +1 -0
- package/dist/src/llm.js +39 -2
- package/dist/src/phase2.js +23 -3
- package/dist/src/templates/consolidation.md +629 -197
- package/dist/src/templates/read_path.md +68 -37
- package/dist/src/templates/stage_one_system.md +311 -75
- package/dist/src/workspace.d.ts +12 -0
- package/dist/src/workspace.js +30 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
## Memory
|
|
2
2
|
|
|
3
3
|
You have access to a memory folder with guidance from prior runs. It can save
|
|
4
4
|
time and help you stay consistent. Use it whenever it is likely to help.
|
|
@@ -10,31 +10,41 @@ Decision boundary: should you use memory for a new user query?
|
|
|
10
10
|
- Hard skip examples: current time/date, simple translation, simple sentence
|
|
11
11
|
rewrite, one-line shell command, trivial formatting.
|
|
12
12
|
- Use memory by default when ANY of these are true:
|
|
13
|
-
- the query mentions
|
|
13
|
+
- the query mentions workspace/repo/module/path/files in MEMORY_SUMMARY below,
|
|
14
14
|
- the user asks for prior context / consistency / previous decisions,
|
|
15
15
|
- the task is ambiguous and could depend on earlier project choices,
|
|
16
|
-
- the ask is non-trivial and related to
|
|
16
|
+
- the ask is a non-trivial and related to MEMORY_SUMMARY below.
|
|
17
17
|
- If unsure, do a quick memory pass.
|
|
18
18
|
|
|
19
|
-
Memory layout (general -> specific)
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
19
|
+
Memory layout (general -> specific):
|
|
20
|
+
|
|
21
|
+
- {{ base_path }}/memory_summary.md (already provided below; do NOT open again)
|
|
22
|
+
- {{ base_path }}/MEMORY.md (searchable registry; primary file to query)
|
|
23
|
+
- {{ base_path }}/skills/<skill-name>/ (skill folder)
|
|
24
|
+
- SKILL.md (entrypoint instructions)
|
|
25
|
+
- scripts/ (optional helper scripts)
|
|
26
|
+
- examples/ (optional example outputs)
|
|
27
|
+
- templates/ (optional templates)
|
|
28
|
+
- {{ base_path }}/rollout_summaries/ (per-session recaps + evidence snippets)
|
|
29
|
+
- Each file is a markdown recap of one past session, with `session_id:`,
|
|
30
|
+
`cwd:`, and `updated_at:` header lines followed by the summary.
|
|
31
|
+
- For efficient lookup, prefer matching the filename (timestamp + slug) or the
|
|
32
|
+
`session_id:` header; avoid broad full-content scans unless needed.
|
|
26
33
|
|
|
27
34
|
Quick memory pass (when applicable):
|
|
28
35
|
|
|
29
36
|
1. Skim the MEMORY_SUMMARY below and extract task-relevant keywords.
|
|
30
|
-
2. Search
|
|
31
|
-
with `memory_read`.
|
|
37
|
+
2. Search {{ base_path }}/MEMORY.md for those keywords with the `memory_search`
|
|
38
|
+
tool, or read it with `memory_read`.
|
|
32
39
|
- For time-scoped recall ("what was I working on last week / around date X"),
|
|
33
40
|
pass `since`/`until` to `memory_search` — with a query it searches only that
|
|
34
41
|
period's sessions/notes; without a query it lists them chronologically.
|
|
35
42
|
3. Only if MEMORY.md directly points to rollout summaries/skills, open the 1-2
|
|
36
|
-
most relevant files under
|
|
37
|
-
|
|
43
|
+
most relevant files under {{ base_path }}/rollout_summaries/ or
|
|
44
|
+
{{ base_path }}/skills/.
|
|
45
|
+
4. If the above are not clear and you need exact commands, error text, or precise
|
|
46
|
+
evidence, read the most relevant rollout summary files for more evidence.
|
|
47
|
+
5. If there are no relevant hits, stop memory lookup and continue normally.
|
|
38
48
|
|
|
39
49
|
Quick-pass budget:
|
|
40
50
|
|
|
@@ -47,21 +57,34 @@ relevant prior context, redo the quick memory pass.
|
|
|
47
57
|
How to decide whether to verify memory:
|
|
48
58
|
|
|
49
59
|
- Consider both risk of drift and verification effort.
|
|
50
|
-
- If a fact is likely to drift and is cheap to verify, verify it before
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
- If a fact is likely to drift and is cheap to verify, verify it before
|
|
61
|
+
answering.
|
|
62
|
+
- If a fact is likely to drift but verification is expensive, slow, or
|
|
63
|
+
disruptive, it is acceptable to answer from memory in an interactive turn,
|
|
64
|
+
but you should say that it is memory-derived, note that it may be stale, and
|
|
53
65
|
consider offering to refresh it live.
|
|
54
|
-
- If a fact is lower-drift and expensive to verify, it is usually fine to
|
|
55
|
-
from memory directly.
|
|
66
|
+
- If a fact is lower-drift and expensive to verify, it is usually fine to
|
|
67
|
+
answer from memory directly.
|
|
68
|
+
|
|
69
|
+
When answering from memory without current verification:
|
|
70
|
+
|
|
71
|
+
- If you rely on memory for a fact that you did not verify in the current turn,
|
|
72
|
+
say so briefly in the final answer.
|
|
73
|
+
- If that fact is plausibly drift-prone or comes from an older note, older
|
|
74
|
+
snapshot, or prior run summary, say that it may be stale or outdated.
|
|
75
|
+
- If live verification was skipped and a refresh would be useful in the
|
|
76
|
+
interactive context, consider offering to verify or refresh it live.
|
|
56
77
|
- Do not present unverified memory-derived facts as confirmed-current.
|
|
78
|
+
- Prefer a short refresh offer for interactive questions, especially about prior
|
|
79
|
+
results, commands, timing, or older snapshots.
|
|
57
80
|
|
|
58
81
|
Memory citation requirements:
|
|
59
82
|
|
|
60
83
|
- If ANY relevant memory files were used: append exactly one
|
|
61
|
-
|
|
62
|
-
Normal responses should include the answer first, then
|
|
84
|
+
`<memory-citation>` block as the VERY LAST content of the final reply.
|
|
85
|
+
Normal responses should include the answer first, then append the
|
|
86
|
+
`<memory-citation>` block at the end.
|
|
63
87
|
- Use this exact structure for programmatic parsing:
|
|
64
|
-
|
|
65
88
|
```
|
|
66
89
|
<memory-citation>
|
|
67
90
|
<citation_entries>
|
|
@@ -74,27 +97,35 @@ ses_def456
|
|
|
74
97
|
</session_ids>
|
|
75
98
|
</memory-citation>
|
|
76
99
|
```
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
- use file paths relative to the memory base path
|
|
81
|
-
|
|
100
|
+
- `citation_entries` is for rendering:
|
|
101
|
+
- one citation entry per line
|
|
102
|
+
- format: `<file>:<line_start>-<line_end>|note=[<how memory was used>]`
|
|
103
|
+
- use file paths relative to the memory base path (for example, `MEMORY.md`,
|
|
104
|
+
`rollout_summaries/...`, `skills/...`)
|
|
105
|
+
- only cite files actually used under the memory base path (do not cite
|
|
106
|
+
workspace files as memory citations)
|
|
107
|
+
- if you used `MEMORY.md` and then a rollout summary/skill file, cite both
|
|
82
108
|
- list entries in order of importance (most important first)
|
|
83
|
-
- `note` should be short, single-line, simple characters only
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
-
|
|
109
|
+
- `note` should be short, single-line, and use simple characters only (avoid
|
|
110
|
+
unusual symbols, no newlines)
|
|
111
|
+
- `session_ids` is for us to track which past sessions you find useful:
|
|
112
|
+
- include one session id per line
|
|
113
|
+
- session ids look like `ses_...` and appear in rollout summary files and
|
|
114
|
+
MEMORY.md as `session_id:`
|
|
115
|
+
- include unique ids only; do not repeat ids
|
|
87
116
|
- an empty `<session_ids>` section is allowed if no session ids are available
|
|
88
|
-
-
|
|
117
|
+
- do not include file paths or notes in this section
|
|
118
|
+
- for every citation entry, try to find and cite the corresponding session id
|
|
119
|
+
- Never include memory citations inside pull-request messages.
|
|
89
120
|
- Never cite blank lines; double-check ranges.
|
|
90
|
-
- If you did not use any memory, omit the citation block entirely.
|
|
91
121
|
|
|
92
122
|
Updating memories:
|
|
93
123
|
|
|
94
|
-
You may update memories **only** when explicitly asked by the user.
|
|
95
|
-
|
|
96
|
-
`extensions/ad_hoc/notes/`
|
|
97
|
-
|
|
124
|
+
You may update memories **only** when explicitly asked by the user. This must
|
|
125
|
+
always come from a direct request from the user. Use the `memory_add_note`
|
|
126
|
+
tool, which writes one small note file under `extensions/ad_hoc/notes/`
|
|
127
|
+
describing what to add/delete/update. Do not edit the memory files yourself;
|
|
128
|
+
the consolidation pass will integrate the note.
|
|
98
129
|
|
|
99
130
|
========= MEMORY_SUMMARY BEGINS =========
|
|
100
131
|
{{ memory_summary }}
|