You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/system-prompt.md
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -183,18 +183,22 @@ in every user turn. Codex loads `AGENTS.md` through its own project-doc
183
183
discovery. `SOUL.md`, `IDENTITY.md`, `TOOLS.md`, and `USER.md` are forwarded as
184
184
Codex developer instructions. `HEARTBEAT.md` content is not injected; heartbeat
185
185
turns get a collaboration-mode note pointing to the file when it exists and is
186
-
non-empty. `MEMORY.md` and active `BOOTSTRAP.md` content keep the normal
187
-
turn-context role for now.
186
+
non-empty. `MEMORY.md` content is not pasted into every native Codex turn;
187
+
when memory tools are available, Codex turns get a small workspace-memory note
188
+
and should use `memory_search` or `memory_get` when durable memory is relevant.
189
+
If tools are disabled or memory search is unavailable, `MEMORY.md` falls back to
190
+
the normal bounded turn-context path. Active `BOOTSTRAP.md` content keeps the
191
+
normal turn-context role for now.
188
192
189
193
On non-Codex harnesses, bootstrap files continue to be composed into the
190
194
OpenClaw prompt according to their existing gates. `HEARTBEAT.md` is omitted on
191
195
normal runs when heartbeats are disabled for the default agent or
192
196
`agents.defaults.heartbeat.includeSystemPromptSection` is false. Keep injected
193
-
files concise, especially `MEMORY.md`. `MEMORY.md` is intended to stay a curated
194
-
long-term summary; detailed daily notes belong in `memory/*.md` where
197
+
files concise, especially non-Codex `MEMORY.md`. `MEMORY.md` is intended to stay
198
+
a curated long-term summary; detailed daily notes belong in `memory/*.md` where
195
199
`memory_search` and `memory_get` can retrieve them on demand. Oversized
196
-
`MEMORY.md` files increase prompt usage and can be partially injected because of
197
-
the bootstrap file limits below.
200
+
non-Codex `MEMORY.md` files increase prompt usage and can be partially injected
201
+
because of the bootstrap file limits below.
198
202
199
203
<Note>
200
204
`memory/*.md` daily files are **not** part of the normal bootstrap Project Context. On ordinary turns they are accessed on demand via the `memory_search` and `memory_get` tools, so they do not count against the context window unless the model explicitly reads them. Bare `/new` and `/reset` turns are the exception: the runtime can prepend recent daily memory as a one-shot startup-context block for that first turn.
@@ -209,11 +213,13 @@ occurs, OpenClaw can inject a concise system-prompt warning notice; control this
209
213
default: `always`). Detailed raw/injected counts stay in diagnostics such as
210
214
`/context`, `/status`, doctor, and logs.
211
215
212
-
For memory files, truncation is not data loss: the file remains intact on disk,
213
-
but the model only sees the shortened injected copy until it reads or searches
214
-
memory directly. If `MEMORY.md` is repeatedly truncated, distill it into a
215
-
shorter durable summary and move detailed history into `memory/*.md`, or
216
-
intentionally raise the bootstrap limits.
216
+
For memory files, truncation is not data loss: the file remains intact on disk.
217
+
On native Codex, `MEMORY.md` is read on demand through memory tools when
218
+
available, with bounded prompt fallback when tools cannot run. On other
219
+
harnesses, the model only sees the shortened injected copy until it reads or
220
+
searches memory directly. If `MEMORY.md` is repeatedly truncated there, distill
221
+
it into a shorter durable summary and move detailed history into `memory/*.md`,
222
+
or intentionally raise the bootstrap limits.
217
223
218
224
Sub-agent sessions only inject `AGENTS.md` and `TOOLS.md` (other bootstrap files
219
225
are filtered out to keep the sub-agent context small).
- Workspace + bootstrap files (`AGENTS.md`, `SOUL.md`, `TOOLS.md`, `IDENTITY.md`, `USER.md`, `HEARTBEAT.md`, `BOOTSTRAP.md` when new, plus `MEMORY.md` when present). Lowercase root `memory.md` is not injected; it is legacy repair input for `openclaw doctor --fix` when paired with `MEMORY.md`. Large files are truncated by `agents.defaults.bootstrapMaxChars` (default: 12000), and total bootstrap injection is capped by `agents.defaults.bootstrapTotalMaxChars` (default: 60000). `memory/*.md` daily files are not part of the normal bootstrap prompt; they remain on-demand via memory tools on ordinary turns, but reset/startup model runs can prepend a one-shot startup-context block with recent daily memory for that first turn. Bare chat `/new` and `/reset` commands are acknowledged without invoking the model. The startup prelude is controlled by `agents.defaults.startupContext`. Post-compaction AGENTS.md excerpts are separate and require explicit `agents.defaults.compaction.postCompactionSections` opt-in.
22
+
- Workspace + bootstrap files (`AGENTS.md`, `SOUL.md`, `TOOLS.md`, `IDENTITY.md`, `USER.md`, `HEARTBEAT.md`, `BOOTSTRAP.md` when new, plus `MEMORY.md` when present). Native Codex turns do not paste raw `MEMORY.md` when memory tools are available; they include a small memory pointer and use memory tools on demand. If tools are disabled or memory search is unavailable, `MEMORY.md` uses the normal bounded turn-context path. Lowercase root `memory.md` is not injected; it is legacy repair input for `openclaw doctor --fix` when paired with `MEMORY.md`. Large injected files are truncated by `agents.defaults.bootstrapMaxChars` (default: 12000), and total bootstrap injection is capped by `agents.defaults.bootstrapTotalMaxChars` (default: 60000). `memory/*.md` daily files are not part of the normal bootstrap prompt; they remain on-demand via memory tools on ordinary turns, but reset/startup model runs can prepend a one-shot startup-context block with recent daily memory for that first turn. Bare chat `/new` and `/reset` commands are acknowledged without invoking the model. The startup prelude is controlled by `agents.defaults.startupContext`. Post-compaction AGENTS.md excerpts are separate and require explicit `agents.defaults.compaction.postCompactionSections` opt-in.
`MEMORY.md exists in the active agent workspace. OpenClaw does not paste its contents into native Codex turns; use ${Array.from(CODEX_MEMORY_TOOL_NAMES).join(" or ")} when durable memory is relevant and the tools are available.`,
0 commit comments