diff --git a/docs/.generated/config-baseline.sha256 b/docs/.generated/config-baseline.sha256 index 43a3a24bedf..091e7e164df 100644 --- a/docs/.generated/config-baseline.sha256 +++ b/docs/.generated/config-baseline.sha256 @@ -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 diff --git a/docs/concepts/agent-workspace.md b/docs/concepts/agent-workspace.md index 82c18626fa9..8b744631c7a 100644 --- a/docs/concepts/agent-workspace.md +++ b/docs/concepts/agent-workspace.md @@ -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. diff --git a/docs/concepts/context.md b/docs/concepts/context.md index 348bb9d5366..29a9635b74d 100644 --- a/docs/concepts/context.md +++ b/docs/concepts/context.md @@ -38,7 +38,7 @@ Values vary by model, provider, tool policy, and what’s in your workspace. ``` 🧠 Context breakdown Workspace: -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`). diff --git a/docs/concepts/system-prompt.md b/docs/concepts/system-prompt.md index 37feea5403b..73cf5511d07 100644 --- a/docs/concepts/system-prompt.md +++ b/docs/concepts/system-prompt.md @@ -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`). diff --git a/docs/gateway/configuration-reference.md b/docs/gateway/configuration-reference.md index 235ca17a7e2..6a0355888d3 100644 --- a/docs/gateway/configuration-reference.md +++ b/docs/gateway/configuration-reference.md @@ -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 } }, } ``` diff --git a/src/auto-reply/reply/commands-context-report.test.ts b/src/auto-reply/reply/commands-context-report.test.ts index bef22415e7c..a6d777ceec3 100644 --- a/src/auto-reply/reply/commands-context-report.test.ts +++ b/src/auto-reply/reply/commands-context-report.test.ts @@ -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."); }); diff --git a/src/config/schema.base.generated.ts b/src/config/schema.base.generated.ts index 59b3d9420e2..40ebc852c7e 100644 --- a/src/config/schema.base.generated.ts +++ b/src/config/schema.base.generated.ts @@ -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": { diff --git a/src/config/schema.help.ts b/src/config/schema.help.ts index 820529bb4fa..6e840fac318 100644 --- a/src/config/schema.help.ts +++ b/src/config/schema.help.ts @@ -869,9 +869,9 @@ export const FIELD_HELP: Record = { "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": diff --git a/src/config/types.agent-defaults.ts b/src/config/types.agent-defaults.ts index d662a6e3db7..e0c98d05a67 100644 --- a/src/config/types.agent-defaults.ts +++ b/src/config/types.agent-defaults.ts @@ -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?: {