Skip to content

Commit 377e834

Browse files
authored
refactor(core): Unified context management settings schema (#24391)
1 parent 3a32d97 commit 377e834

File tree

10 files changed

+215
-212
lines changed

10 files changed

+215
-212
lines changed

docs/cli/settings.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,16 @@ they appear in the UI.
157157

158158
### Experimental
159159

160-
| UI Label | Setting | Description | Default |
161-
| -------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
162-
| Enable Tool Output Masking | `experimental.toolOutputMasking.enabled` | Enables tool output masking to save tokens. | `true` |
163-
| Enable Git Worktrees | `experimental.worktrees` | Enable automated Git worktree management for parallel work. | `false` |
164-
| Use OSC 52 Paste | `experimental.useOSC52Paste` | Use OSC 52 for pasting. This may be more robust than the default system when using remote terminal sessions (if your terminal is configured to allow it). | `false` |
165-
| Use OSC 52 Copy | `experimental.useOSC52Copy` | Use OSC 52 for copying. This may be more robust than the default system when using remote terminal sessions (if your terminal is configured to allow it). | `false` |
166-
| Model Steering | `experimental.modelSteering` | Enable model steering (user hints) to guide the model during tool execution. | `false` |
167-
| Direct Web Fetch | `experimental.directWebFetch` | Enable web fetch behavior that bypasses LLM summarization. | `false` |
168-
| Memory Manager Agent | `experimental.memoryManager` | Replace the built-in save_memory tool with a memory manager subagent that supports adding, removing, de-duplicating, and organizing memories. | `false` |
169-
| Enable Context Management | `experimental.contextManagement` | Enable logic for context management. | `false` |
170-
| Topic & Update Narration | `experimental.topicUpdateNarration` | Enable the experimental Topic & Update communication model for reduced chattiness and structured progress reporting. | `false` |
160+
| UI Label | Setting | Description | Default |
161+
| ------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
162+
| Enable Git Worktrees | `experimental.worktrees` | Enable automated Git worktree management for parallel work. | `false` |
163+
| Use OSC 52 Paste | `experimental.useOSC52Paste` | Use OSC 52 for pasting. This may be more robust than the default system when using remote terminal sessions (if your terminal is configured to allow it). | `false` |
164+
| Use OSC 52 Copy | `experimental.useOSC52Copy` | Use OSC 52 for copying. This may be more robust than the default system when using remote terminal sessions (if your terminal is configured to allow it). | `false` |
165+
| Model Steering | `experimental.modelSteering` | Enable model steering (user hints) to guide the model during tool execution. | `false` |
166+
| Direct Web Fetch | `experimental.directWebFetch` | Enable web fetch behavior that bypasses LLM summarization. | `false` |
167+
| Memory Manager Agent | `experimental.memoryManager` | Replace the built-in save_memory tool with a memory manager subagent that supports adding, removing, de-duplicating, and organizing memories. | `false` |
168+
| Enable Context Management | `experimental.contextManagement` | Enable logic for context management. | `false` |
169+
| Topic & Update Narration | `experimental.topicUpdateNarration` | Enable the experimental Topic & Update communication model for reduced chattiness and structured progress reporting. | `false` |
171170

172171
### Skills
173172

docs/reference/configuration.md

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,28 +1587,6 @@ their corresponding top-level category object in your `settings.json` file.
15871587

15881588
#### `experimental`
15891589

1590-
- **`experimental.toolOutputMasking.enabled`** (boolean):
1591-
- **Description:** Enables tool output masking to save tokens.
1592-
- **Default:** `true`
1593-
- **Requires restart:** Yes
1594-
1595-
- **`experimental.toolOutputMasking.toolProtectionThreshold`** (number):
1596-
- **Description:** Minimum number of tokens to protect from masking (most
1597-
recent tool outputs).
1598-
- **Default:** `50000`
1599-
- **Requires restart:** Yes
1600-
1601-
- **`experimental.toolOutputMasking.minPrunableTokensThreshold`** (number):
1602-
- **Description:** Minimum prunable tokens required to trigger a masking pass.
1603-
- **Default:** `30000`
1604-
- **Requires restart:** Yes
1605-
1606-
- **`experimental.toolOutputMasking.protectLatestTurn`** (boolean):
1607-
- **Description:** Ensures the absolute latest turn is never masked,
1608-
regardless of token count.
1609-
- **Default:** `true`
1610-
- **Requires restart:** Yes
1611-
16121590
- **`experimental.enableAgents`** (boolean):
16131591
- **Description:** Enable local and remote subagents.
16141592
- **Default:** `true`
@@ -1834,18 +1812,38 @@ their corresponding top-level category object in your `settings.json` file.
18341812
- **Default:** `0.25`
18351813
- **Requires restart:** Yes
18361814

1837-
- **`contextManagement.toolDistillation.maxOutputTokens`** (number):
1838-
- **Description:** Maximum tokens to show when truncating large tool outputs.
1815+
- **`contextManagement.tools.distillation.maxOutputTokens`** (number):
1816+
- **Description:** Maximum tokens to show to the model when truncating large
1817+
tool outputs.
18391818
- **Default:** `10000`
18401819
- **Requires restart:** Yes
18411820

1842-
- **`contextManagement.toolDistillation.summarizationThresholdTokens`**
1821+
- **`contextManagement.tools.distillation.summarizationThresholdTokens`**
18431822
(number):
18441823
- **Description:** Threshold above which truncated tool outputs will be
18451824
summarized by an LLM.
18461825
- **Default:** `20000`
18471826
- **Requires restart:** Yes
18481827

1828+
- **`contextManagement.tools.outputMasking.protectionThresholdTokens`**
1829+
(number):
1830+
- **Description:** Minimum number of tokens to protect from masking (most
1831+
recent tool outputs).
1832+
- **Default:** `50000`
1833+
- **Requires restart:** Yes
1834+
1835+
- **`contextManagement.tools.outputMasking.minPrunableThresholdTokens`**
1836+
(number):
1837+
- **Description:** Minimum prunable tokens required to trigger a masking pass.
1838+
- **Default:** `30000`
1839+
- **Requires restart:** Yes
1840+
1841+
- **`contextManagement.tools.outputMasking.protectLatestTurn`** (boolean):
1842+
- **Description:** Ensures the absolute latest turn is never masked,
1843+
regardless of token count.
1844+
- **Default:** `true`
1845+
- **Requires restart:** Yes
1846+
18491847
#### `admin`
18501848

18511849
- **`admin.secureModeEnabled`** (boolean):

packages/cli/src/config/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,6 @@ export async function loadCliConfig(
983983
},
984984
modelSteering: settings.experimental?.modelSteering,
985985
topicUpdateNarration: settings.experimental?.topicUpdateNarration,
986-
toolOutputMasking: settings.experimental?.toolOutputMasking,
987986
noBrowser: !!process.env['NO_BROWSER'],
988987
summarizeToolOutput: settings.model?.summarizeToolOutput,
989988
ideMode,

packages/cli/src/config/settingsSchema.ts

Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,58 +1933,6 @@ const SETTINGS_SCHEMA = {
19331933
description: 'Setting to enable experimental features',
19341934
showInDialog: false,
19351935
properties: {
1936-
toolOutputMasking: {
1937-
type: 'object',
1938-
label: 'Tool Output Masking',
1939-
category: 'Experimental',
1940-
requiresRestart: true,
1941-
ignoreInDocs: false,
1942-
default: {},
1943-
description:
1944-
'Advanced settings for tool output masking to manage context window efficiency.',
1945-
showInDialog: false,
1946-
properties: {
1947-
enabled: {
1948-
type: 'boolean',
1949-
label: 'Enable Tool Output Masking',
1950-
category: 'Experimental',
1951-
requiresRestart: true,
1952-
default: true,
1953-
description: 'Enables tool output masking to save tokens.',
1954-
showInDialog: true,
1955-
},
1956-
toolProtectionThreshold: {
1957-
type: 'number',
1958-
label: 'Tool Protection Threshold',
1959-
category: 'Experimental',
1960-
requiresRestart: true,
1961-
default: 50000,
1962-
description:
1963-
'Minimum number of tokens to protect from masking (most recent tool outputs).',
1964-
showInDialog: false,
1965-
},
1966-
minPrunableTokensThreshold: {
1967-
type: 'number',
1968-
label: 'Min Prunable Tokens Threshold',
1969-
category: 'Experimental',
1970-
requiresRestart: true,
1971-
default: 30000,
1972-
description:
1973-
'Minimum prunable tokens required to trigger a masking pass.',
1974-
showInDialog: false,
1975-
},
1976-
protectLatestTurn: {
1977-
type: 'boolean',
1978-
label: 'Protect Latest Turn',
1979-
category: 'Experimental',
1980-
requiresRestart: true,
1981-
default: true,
1982-
description:
1983-
'Ensures the absolute latest turn is never masked, regardless of token count.',
1984-
showInDialog: false,
1985-
},
1986-
},
1987-
},
19881936
enableAgents: {
19891937
type: 'boolean',
19901938
label: 'Enable Agents',
@@ -2544,33 +2492,86 @@ const SETTINGS_SCHEMA = {
25442492
},
25452493
},
25462494
},
2547-
toolDistillation: {
2495+
tools: {
25482496
type: 'object',
2549-
label: 'Tool Distillation',
2497+
label: 'Context Management Tools',
25502498
category: 'Context Management',
25512499
requiresRestart: true,
25522500
default: {},
25532501
showInDialog: false,
25542502
properties: {
2555-
maxOutputTokens: {
2556-
type: 'number',
2557-
label: 'Max Output Tokens',
2503+
distillation: {
2504+
type: 'object',
2505+
label: 'Tool Distillation',
25582506
category: 'Context Management',
25592507
requiresRestart: true,
2560-
default: 10_000,
2561-
description:
2562-
'Maximum tokens to show when truncating large tool outputs.',
2508+
default: {},
25632509
showInDialog: false,
2510+
properties: {
2511+
maxOutputTokens: {
2512+
type: 'number',
2513+
label: 'Max Output Tokens',
2514+
category: 'Context Management',
2515+
requiresRestart: true,
2516+
default: 10_000,
2517+
description:
2518+
'Maximum tokens to show to the model when truncating large tool outputs.',
2519+
showInDialog: false,
2520+
},
2521+
summarizationThresholdTokens: {
2522+
type: 'number',
2523+
label: 'Tool Summarization Threshold',
2524+
category: 'Context Management',
2525+
requiresRestart: true,
2526+
default: 20_000,
2527+
description:
2528+
'Threshold above which truncated tool outputs will be summarized by an LLM.',
2529+
showInDialog: false,
2530+
},
2531+
},
25642532
},
2565-
summarizationThresholdTokens: {
2566-
type: 'number',
2567-
label: 'Tool Summarization Threshold',
2533+
outputMasking: {
2534+
type: 'object',
2535+
label: 'Tool Output Masking',
25682536
category: 'Context Management',
25692537
requiresRestart: true,
2570-
default: 20_000,
2538+
ignoreInDocs: false,
2539+
default: {},
25712540
description:
2572-
'Threshold above which truncated tool outputs will be summarized by an LLM.',
2541+
'Advanced settings for tool output masking to manage context window efficiency.',
25732542
showInDialog: false,
2543+
properties: {
2544+
protectionThresholdTokens: {
2545+
type: 'number',
2546+
label: 'Tool Protection Threshold (Tokens)',
2547+
category: 'Context Management',
2548+
requiresRestart: true,
2549+
default: 50_000,
2550+
description:
2551+
'Minimum number of tokens to protect from masking (most recent tool outputs).',
2552+
showInDialog: false,
2553+
},
2554+
minPrunableThresholdTokens: {
2555+
type: 'number',
2556+
label: 'Min Prunable Tokens Threshold',
2557+
category: 'Context Management',
2558+
requiresRestart: true,
2559+
default: 30_000,
2560+
description:
2561+
'Minimum prunable tokens required to trigger a masking pass.',
2562+
showInDialog: false,
2563+
},
2564+
protectLatestTurn: {
2565+
type: 'boolean',
2566+
label: 'Protect Latest Turn',
2567+
category: 'Context Management',
2568+
requiresRestart: true,
2569+
default: true,
2570+
description:
2571+
'Ensures the absolute latest turn is never masked, regardless of token count.',
2572+
showInDialog: false,
2573+
},
2574+
},
25742575
},
25752576
},
25762577
},

0 commit comments

Comments
 (0)