Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions docs/users/configuration/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,21 +288,21 @@ The `extra_body` field allows you to add custom parameters to the request body s

#### context

| Setting | Type | Description | Default |
| ----------------------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `context.fileName` | string or array of strings | The name of the context file(s). | `undefined` |
| `context.autoCompactThreshold` | number | Fraction of the context window at which auto-compaction triggers. Must be greater than 0 and at most 1. Default is `0.85` (85%). For very large context windows (>220K tokens), the absolute branch of the three-tier threshold system (window minus ~33K) dominates, so higher values may have no visible effect there. Replaces the old `model.chatCompression.contextPercentageThreshold`. | `undefined` (uses internal 0.85) |
| `context.importFormat` | string | The format to use when importing memory. | `undefined` |
| `context.includeDirectories` | array | Additional directories to include in the workspace context. Specifies an array of additional absolute or relative paths to include in the workspace context. Missing directories will be skipped with a warning by default. Paths can use `~` to refer to the user's home directory. This setting can be combined with the `--include-directories` command-line flag. | `[]` |
| `context.loadFromIncludeDirectories` | boolean | Controls the behavior of the `/memory refresh` command. If set to `true`, `QWEN.md` files should be loaded from all directories that are added. If set to `false`, `QWEN.md` should only be loaded from the current directory. | `false` |
| `context.fileFiltering.respectGitIgnore` | boolean | Respect .gitignore files when searching. | `true` |
| `context.fileFiltering.respectQwenIgnore` | boolean | Respect .qwenignore and configured custom ignore files when searching. | `true` |
| `context.fileFiltering.customIgnoreFiles` | array | Project-root-relative ignore files to use instead of the default compatibility files (`.agentignore`, `.aiignore`) when `respectQwenIgnore` is enabled. `.qwenignore` is always included. | `[".agentignore", ".aiignore"]` |
| `context.fileFiltering.enableRecursiveFileSearch` | boolean | Whether to enable searching recursively for filenames under the current tree when completing `@` prefixes in the prompt. | `true` |
| `context.fileFiltering.enableFuzzySearch` | boolean | When `true`, enables fuzzy search capabilities when searching for files. Set to `false` to improve performance on projects with a large number of files. | `true` |
| `context.clearContextOnIdle.toolResultsThresholdMinutes` | number | Minutes of inactivity before clearing old tool result content. Use `-1` to disable the idle trigger. | `60` |
| `context.clearContextOnIdle.toolResultsNumToKeep` | integer | Integer number of most-recent compactable tool results to preserve when clearing. Values below 1 are floored to 1. | `5` |
| `context.clearContextOnIdle.toolResultsTotalCharsThreshold` | number | Total compactable tool result output characters allowed in history before clearing oldest results. Use `-1` to disable the size trigger. This is a soft threshold: protected recent tool results may keep the total above it. | `500000` |
| Setting | Type | Description | Default |
| ----------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- |
| `context.fileName` | string or array of strings | The name of the context file(s). | `undefined` |
| `context.autoCompactThreshold` | number | Target fraction of the context window at which auto-compaction triggers. Must be greater than 0 and at most 1. Default is `0.85` (85%). Acts as a ceiling on the trigger: on large windows it is the effective trigger (~85%), while on smaller windows compaction may fire earlier to leave room to summarize. Replaces the old `model.chatCompression.contextPercentageThreshold`. | `undefined` (uses internal 0.85) |
| `context.importFormat` | string | The format to use when importing memory. | `undefined` |
| `context.includeDirectories` | array | Additional directories to include in the workspace context. Specifies an array of additional absolute or relative paths to include in the workspace context. Missing directories will be skipped with a warning by default. Paths can use `~` to refer to the user's home directory. This setting can be combined with the `--include-directories` command-line flag. | `[]` |
| `context.loadFromIncludeDirectories` | boolean | Controls the behavior of the `/memory refresh` command. If set to `true`, `QWEN.md` files should be loaded from all directories that are added. If set to `false`, `QWEN.md` should only be loaded from the current directory. | `false` |
| `context.fileFiltering.respectGitIgnore` | boolean | Respect .gitignore files when searching. | `true` |
| `context.fileFiltering.respectQwenIgnore` | boolean | Respect .qwenignore and configured custom ignore files when searching. | `true` |
| `context.fileFiltering.customIgnoreFiles` | array | Project-root-relative ignore files to use instead of the default compatibility files (`.agentignore`, `.aiignore`) when `respectQwenIgnore` is enabled. `.qwenignore` is always included. | `[".agentignore", ".aiignore"]` |
| `context.fileFiltering.enableRecursiveFileSearch` | boolean | Whether to enable searching recursively for filenames under the current tree when completing `@` prefixes in the prompt. | `true` |
| `context.fileFiltering.enableFuzzySearch` | boolean | When `true`, enables fuzzy search capabilities when searching for files. Set to `false` to improve performance on projects with a large number of files. | `true` |
| `context.clearContextOnIdle.toolResultsThresholdMinutes` | number | Minutes of inactivity before clearing old tool result content. Use `-1` to disable the idle trigger. | `60` |
| `context.clearContextOnIdle.toolResultsNumToKeep` | integer | Integer number of most-recent compactable tool results to preserve when clearing. Values below 1 are floored to 1. | `5` |
| `context.clearContextOnIdle.toolResultsTotalCharsThreshold` | number | Total compactable tool result output characters allowed in history before clearing oldest results. Use `-1` to disable the size trigger. This is a soft threshold: protected recent tool results may keep the total above it. | `500000` |

#### Troubleshooting File Search Performance

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/config/settingsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ const SETTINGS_SCHEMA = {
requiresRestart: false,
default: undefined as number | undefined,
description:
'Fraction of context window at which auto-compaction triggers (greater than 0, up to 1). Default is 0.85 (85%).',
'Target fraction of the context window at which auto-compaction triggers (greater than 0, up to 1). Acts as a ceiling on the trigger: on large windows this is the effective trigger (~85%); on smaller windows compaction may fire earlier to leave room to summarize. Default is 0.85 (85%).',
showInDialog: false,
jsonSchemaOverride: {
type: 'number',
Expand Down
17 changes: 9 additions & 8 deletions packages/cli/src/ui/commands/contextCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,23 @@ describe('/context shows three-tier thresholds', () => {

it('renders warn/auto/hard with the warn-tier marker when usage sits between warn and auto', async () => {
// 200K window. computeThresholds(200K) = {
// warn: 150,000, auto: 170,000, hard: 177,000, effectiveWindow: 180,000
// warn: 147,000, auto: 167,000, hard: 177,000, effectiveWindow: 180,000
// }
// lastPromptTokenCount = 160K → between warn and auto → tier = warn.
mockGetLastPromptTokenCount.mockReturnValue(160_000);
const data = await collectContextData(makeMockConfig(200_000), false);
const text = formatContextUsageText(data);

expect(text).toMatch(/Effective window:\s+180,000/);
expect(text).toMatch(/Warn threshold:\s+150,000/);
expect(text).toMatch(/Auto threshold:\s+170,000/);
expect(text).toMatch(/Warn threshold:\s+147,000/);
expect(text).toMatch(/Auto threshold:\s+167,000/);
expect(text).toMatch(/Hard threshold:\s+177,000/);
expect(text).toMatch(/Current tier:\s+warn/);
expect(data.breakdown.currentTier).toBe('warn');
expect(data.breakdown.thresholds).toEqual({
effectiveWindow: 180_000,
warn: 150_000,
auto: 170_000,
warn: 147_000,
auto: 167_000,
hard: 177_000,
});
});
Expand All @@ -269,7 +269,7 @@ describe('/context shows three-tier thresholds', () => {
});

it('classifies usage between auto and hard as the auto tier', async () => {
// 200K window — between 170K (auto) and 177K (hard) → tier = auto.
// 200K window — between 167K (auto) and 177K (hard) → tier = auto.
mockGetLastPromptTokenCount.mockReturnValue(173_000);
const data = await collectContextData(makeMockConfig(200_000), false);
expect(data.breakdown.currentTier).toBe('auto');
Expand All @@ -291,14 +291,15 @@ describe('/context shows three-tier thresholds', () => {
expect(data.breakdown.currentTier).toBe('safe');
// Thresholds are still computed and exposed on the breakdown for downstream
// consumers, even though the text layout suppresses them.
expect(data.breakdown.thresholds.auto).toBe(170_000);
expect(data.breakdown.thresholds.auto).toBe(167_000);
const text = formatContextUsageText(data);
expect(text).not.toMatch(/Compaction thresholds/);
});

it('propagates custom autoCompactThreshold through to /context thresholds', async () => {
// config.getAutoCompactThreshold() returns 0.5 → computeThresholds(32000, 0.5)
// = { warn: 16,000, auto: 16,000, hard: 19,000, effectiveWindow: 12,000 }
// = { warn: 0, auto: 16,000, hard: 19,000, effectiveWindow: 12,000 }
// (32K ceiling degenerates, so auto = proportional floor = 0.5 * 32K)
const config = makeMockConfig(32_000);
vi.mocked(config.getAutoCompactThreshold).mockReturnValue(0.5);
const data = await collectContextData(config, false);
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/ui/components/Tips.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ function createContext(overrides: Partial<TipContext> = {}): TipContext {
// Matches computeThresholds(1_000_000) — kept inline so this test stays
// hermetic to the registry's tier logic rather than re-deriving constants.
thresholds: {
warn: 947_000,
auto: 967_000,
warn: 830_000,
auto: 850_000,
hard: 977_000,
effectiveWindow: 980_000,
},
Expand All @@ -67,7 +67,7 @@ describe('selectTip', () => {

it('returns context-high tip when context usage is high', () => {
const ctx = createContext({
// Between auto (967K) and hard (977K) — context-high band.
// Between auto (850K) and hard (977K) — context-high band.
lastPromptTokenCount: 970_000,
contextWindowSize: 1_000_000,
sessionPromptCount: 10,
Expand All @@ -93,8 +93,8 @@ describe('selectTip', () => {

it('returns compress-intro tip when context is moderate and session is long', () => {
const ctx = createContext({
// Between warn (947K) and auto (967K) — compress-intro band.
lastPromptTokenCount: 955_000,
// Between warn (830K) and auto (850K) — compress-intro band.
lastPromptTokenCount: 840_000,
contextWindowSize: 1_000_000,
sessionPromptCount: 10,
});
Expand Down
Loading