Skip to content

Commit 491bb28

Browse files
committed
docs: cover post-compaction section config (openclaw#34556) thanks @efe-arv
1 parent d4228d1 commit 491bb28

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

docs/gateway/configuration-reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,7 @@ Periodic heartbeat runs.
10031003
reserveTokensFloor: 24000,
10041004
identifierPolicy: "strict", // strict | off | custom
10051005
identifierInstructions: "Preserve deployment IDs, ticket IDs, and host:port pairs exactly.", // used when identifierPolicy=custom
1006+
postCompactionSections: ["Session Startup", "Red Lines"], // [] disables reinjection
10061007
memoryFlush: {
10071008
enabled: true,
10081009
softThresholdTokens: 6000,
@@ -1018,6 +1019,7 @@ Periodic heartbeat runs.
10181019
- `mode`: `default` or `safeguard` (chunked summarization for long histories). See [Compaction](/concepts/compaction).
10191020
- `identifierPolicy`: `strict` (default), `off`, or `custom`. `strict` prepends built-in opaque identifier retention guidance during compaction summarization.
10201021
- `identifierInstructions`: optional custom identifier-preservation text used when `identifierPolicy=custom`.
1022+
- `postCompactionSections`: optional AGENTS.md H2/H3 section names to re-inject after compaction. Defaults to `["Session Startup", "Red Lines"]`; set `[]` to disable reinjection. When unset or explicitly set to that default pair, older `Every Session`/`Safety` headings are also accepted as a legacy fallback.
10211023
- `memoryFlush`: silent agentic turn before auto-compaction to store durable memories. Skipped when workspace is read-only.
10221024

10231025
### `agents.defaults.contextPruning`

src/config/schema.help.quality.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ const TARGET_KEYS = [
375375
"agents.defaults.compaction.qualityGuard",
376376
"agents.defaults.compaction.qualityGuard.enabled",
377377
"agents.defaults.compaction.qualityGuard.maxRetries",
378+
"agents.defaults.compaction.postCompactionSections",
378379
"agents.defaults.compaction.memoryFlush",
379380
"agents.defaults.compaction.memoryFlush.enabled",
380381
"agents.defaults.compaction.memoryFlush.softThresholdTokens",
@@ -795,6 +796,11 @@ describe("config help copy quality", () => {
795796
expect(identifierPolicy.includes('"off"')).toBe(true);
796797
expect(identifierPolicy.includes('"custom"')).toBe(true);
797798

799+
const postCompactionSections = FIELD_HELP["agents.defaults.compaction.postCompactionSections"];
800+
expect(/Session Startup|Red Lines/i.test(postCompactionSections)).toBe(true);
801+
expect(/Every Session|Safety/i.test(postCompactionSections)).toBe(true);
802+
expect(/\[\]|disable/i.test(postCompactionSections)).toBe(true);
803+
798804
const flush = FIELD_HELP["agents.defaults.compaction.memoryFlush.enabled"];
799805
expect(/pre-compaction|memory flush|token/i.test(flush)).toBe(true);
800806
});

src/config/schema.help.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,8 @@ export const FIELD_HELP: Record<string, string> = {
10031003
"Enables summary quality audits and regeneration retries for safeguard compaction. Default: false, so safeguard mode alone does not turn on retry behavior.",
10041004
"agents.defaults.compaction.qualityGuard.maxRetries":
10051005
"Maximum number of regeneration retries after a failed safeguard summary quality audit. Use small values to bound extra latency and token cost.",
1006+
"agents.defaults.compaction.postCompactionSections":
1007+
'AGENTS.md H2/H3 section names re-injected after compaction so the agent reruns critical startup guidance. Leave unset to use "Session Startup"/"Red Lines" with legacy fallback to "Every Session"/"Safety"; set to [] to disable reinjection entirely.',
10061008
"agents.defaults.compaction.memoryFlush":
10071009
"Pre-compaction memory flush settings that run an agentic memory write before heavy compaction. Keep enabled for long sessions so salient context is persisted before aggressive trimming.",
10081010
"agents.defaults.compaction.memoryFlush.enabled":

0 commit comments

Comments
 (0)