Align documented bootstrap context defaults with runtime values (#67968)

* Fix bootstrap default limit docs to match runtime

* docs(context): fix stale bootstrap max/file example
This commit is contained in:
Rubén Cuevas
2026-04-17 23:30:21 -04:00
committed by GitHub
parent e910fe446a
commit a0dd5f7e8e
9 changed files with 25 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
3c87ac2fc4c234348eb88812d1904724d7492890498f101d953bc761da8fdead config-baseline.json
eeed6fe659078632d9f95b3350b27103b4aba282d050ff38d3b0953a456d242d config-baseline.core.json
17d43e3c5dd6ac09fa6c7954e6923d2e0fba767483bac0a2b257fb7ec736f8a4 config-baseline.json
fdb7867bbc18792d3645ea36c31b64425d6f19c0b19a7460564f67eb97c0a71e config-baseline.core.json
99bb34fcf83ba6bb50a3fc11f170bd379bee5728b0938707fc39ebd7638e12eb config-baseline.channel.json
5f5d4e850df6e9854a85b5d008236854ce185c707fdbb566efcf00f8c08b36e3 config-baseline.plugin.json
b695cb31b4c0cf1d31f842f2892e99cc3ff8d84263ae72b72977cae844b81d6e config-baseline.plugin.json

View File

@@ -120,8 +120,8 @@ See [Memory](/concepts/memory) for the workflow and automatic memory flush.
If any bootstrap file is missing, OpenClaw injects a "missing file" marker into
the session and continues. Large bootstrap files are truncated when injected;
adjust limits with `agents.defaults.bootstrapMaxChars` (default: 20000) and
`agents.defaults.bootstrapTotalMaxChars` (default: 150000).
adjust limits with `agents.defaults.bootstrapMaxChars` (default: 12000) and
`agents.defaults.bootstrapTotalMaxChars` (default: 60000).
`openclaw setup` can recreate missing defaults without overwriting existing
files.

View File

@@ -38,7 +38,7 @@ Values vary by model, provider, tool policy, and whats in your workspace.
```
🧠 Context breakdown
Workspace: <workspaceDir>
Bootstrap max/file: 20,000 chars
Bootstrap max/file: 12,000 chars
Sandbox: mode=non-main sandboxed=false
System prompt (run): 38,412 chars (~9,603 tok) (Project Context 23,901 chars (~5,976 tok))
@@ -112,7 +112,7 @@ By default, OpenClaw injects a fixed set of workspace files (if present):
- `HEARTBEAT.md`
- `BOOTSTRAP.md` (first-run only)
Large files are truncated per-file using `agents.defaults.bootstrapMaxChars` (default `20000` chars). OpenClaw also enforces a total bootstrap injection cap across files with `agents.defaults.bootstrapTotalMaxChars` (default `150000` chars). `/context` shows **raw vs injected** sizes and whether truncation happened.
Large files are truncated per-file using `agents.defaults.bootstrapMaxChars` (default `12000` chars). OpenClaw also enforces a total bootstrap injection cap across files with `agents.defaults.bootstrapTotalMaxChars` (default `60000` chars). `/context` shows **raw vs injected** sizes and whether truncation happened.
When truncation occurs, the runtime can inject an in-prompt warning block under Project Context. Configure this with `agents.defaults.bootstrapPromptTruncationWarning` (`off`, `once`, `always`; default `once`).

View File

@@ -118,9 +118,9 @@ unexpectedly high context usage and more frequent compaction.
> as a one-shot startup-context block for that first turn.
Large files are truncated with a marker. The max per-file size is controlled by
`agents.defaults.bootstrapMaxChars` (default: 20000). Total injected bootstrap
`agents.defaults.bootstrapMaxChars` (default: 12000). Total injected bootstrap
content across files is capped by `agents.defaults.bootstrapTotalMaxChars`
(default: 150000). Missing files inject a short missing-file marker. When truncation
(default: 60000). Missing files inject a short missing-file marker. When truncation
occurs, OpenClaw can inject a warning block in Project Context; control this with
`agents.defaults.bootstrapPromptTruncationWarning` (`off`, `once`, `always`;
default: `once`).

View File

@@ -955,21 +955,21 @@ Controls when workspace bootstrap files are injected into the system prompt. Def
### `agents.defaults.bootstrapMaxChars`
Max characters per workspace bootstrap file before truncation. Default: `20000`.
Max characters per workspace bootstrap file before truncation. Default: `12000`.
```json5
{
agents: { defaults: { bootstrapMaxChars: 20000 } },
agents: { defaults: { bootstrapMaxChars: 12000 } },
}
```
### `agents.defaults.bootstrapTotalMaxChars`
Max total characters injected across all workspace bootstrap files. Default: `150000`.
Max total characters injected across all workspace bootstrap files. Default: `60000`.
```json5
{
agents: { defaults: { bootstrapTotalMaxChars: 150000 } },
agents: { defaults: { bootstrapTotalMaxChars: 60000 } },
}
```

View File

@@ -36,8 +36,8 @@ function makeParams(
source: "run",
generatedAt: Date.now(),
workspaceDir: "/tmp/workspace",
bootstrapMaxChars: options?.omitBootstrapLimits ? undefined : 20_000,
bootstrapTotalMaxChars: options?.omitBootstrapLimits ? undefined : 150_000,
bootstrapMaxChars: options?.omitBootstrapLimits ? undefined : 12_000,
bootstrapTotalMaxChars: options?.omitBootstrapLimits ? undefined : 60_000,
sandbox: { mode: "off", sandboxed: false },
systemPrompt: {
chars: 1_000,
@@ -50,7 +50,7 @@ function makeParams(
path: "/tmp/workspace/AGENTS.md",
missing: false,
rawChars: truncated ? 200_000 : 10_000,
injectedChars: truncated ? 20_000 : 10_000,
injectedChars: truncated ? 12_000 : 10_000,
truncated,
},
],
@@ -76,7 +76,7 @@ function makeParams(
describe("buildContextReply", () => {
it("shows bootstrap truncation warning in list output when context exceeds configured limits", async () => {
const result = await buildContextReply(makeParams("/context list", true));
expect(result.text).toContain("Bootstrap max/total: 150,000 chars");
expect(result.text).toContain("Bootstrap max/total: 60,000 chars");
expect(result.text).toContain("⚠ Bootstrap context is over configured limits");
expect(result.text).toContain("Causes: 1 file(s) exceeded max/file.");
});

View File

@@ -3236,7 +3236,7 @@ export const GENERATED_BASE_CONFIG_SCHEMA: BaseConfigSchemaResponse = {
maximum: 9007199254740991,
title: "Bootstrap Max Chars",
description:
"Max characters of each workspace bootstrap file injected into the system prompt before truncation (default: 20000).",
"Max characters of each workspace bootstrap file injected into the system prompt before truncation (default: 12000).",
},
bootstrapTotalMaxChars: {
type: "integer",
@@ -3244,7 +3244,7 @@ export const GENERATED_BASE_CONFIG_SCHEMA: BaseConfigSchemaResponse = {
maximum: 9007199254740991,
title: "Bootstrap Total Max Chars",
description:
"Max total characters across all injected workspace bootstrap files (default: 150000).",
"Max total characters across all injected workspace bootstrap files (default: 60000).",
},
experimental: {
type: "object",
@@ -24682,12 +24682,12 @@ export const GENERATED_BASE_CONFIG_SCHEMA: BaseConfigSchemaResponse = {
},
"agents.defaults.bootstrapMaxChars": {
label: "Bootstrap Max Chars",
help: "Max characters of each workspace bootstrap file injected into the system prompt before truncation (default: 20000).",
help: "Max characters of each workspace bootstrap file injected into the system prompt before truncation (default: 12000).",
tags: ["performance"],
},
"agents.defaults.bootstrapTotalMaxChars": {
label: "Bootstrap Total Max Chars",
help: "Max total characters across all injected workspace bootstrap files (default: 150000).",
help: "Max total characters across all injected workspace bootstrap files (default: 60000).",
tags: ["performance"],
},
"agents.defaults.experimental": {

View File

@@ -869,9 +869,9 @@ export const FIELD_HELP: Record<string, string> = {
"agents.defaults.contextInjection":
'Controls when workspace bootstrap files are injected into the system prompt: "always" (default) or "continuation-skip" for safe continuation turns after a completed assistant response.',
"agents.defaults.bootstrapMaxChars":
"Max characters of each workspace bootstrap file injected into the system prompt before truncation (default: 20000).",
"Max characters of each workspace bootstrap file injected into the system prompt before truncation (default: 12000).",
"agents.defaults.bootstrapTotalMaxChars":
"Max total characters across all injected workspace bootstrap files (default: 150000).",
"Max total characters across all injected workspace bootstrap files (default: 60000).",
"agents.defaults.experimental":
"Experimental agent-default flags. Keep these off unless you are intentionally testing a preview surface.",
"agents.defaults.experimental.localModelLean":

View File

@@ -205,9 +205,9 @@ export type AgentDefaultsConfig = {
* transcript already contains a completed assistant turn
*/
contextInjection?: AgentContextInjection;
/** Max chars for injected bootstrap files before truncation (default: 20000). */
/** Max chars for injected bootstrap files before truncation (default: 12000). */
bootstrapMaxChars?: number;
/** Max total chars across all injected bootstrap files (default: 150000). */
/** Max total chars across all injected bootstrap files (default: 60000). */
bootstrapTotalMaxChars?: number;
/** Experimental agent-default flags. Keep off unless you are intentionally testing a preview surface. */
experimental?: {