From cbe297bc9755b50e4a5121b89b9d3593186841a6 Mon Sep 17 00:00:00 2001 From: Mahima Shanware Date: Sat, 28 Mar 2026 00:05:37 +0000 Subject: [PATCH] feat(btw): add experimental.btw setting and documentation - Added `experimental.btw` setting to the settings schema. - Updated `/btw` command to check if `experimental.btw` is enabled. - Added documentation for `/btw` in `docs/reference/commands.md`. - Regenerated settings documentation in `docs/reference/configuration.md` and `docs/cli/settings.md`. - Updated unit tests for `/btw` command to provide mock context and test enablement flag. --- docs/cli/settings.md | 28 ++++++----- docs/reference/commands.md | 7 +++ docs/reference/configuration.md | 5 ++ packages/cli/src/config/settingsSchema.ts | 10 ++++ .../cli/src/ui/commands/btwCommand.test.ts | 49 +++++++++++++++++-- packages/cli/src/ui/commands/btwCommand.ts | 12 ++++- packages/core/src/core/client.ts | 1 - 7 files changed, 95 insertions(+), 17 deletions(-) diff --git a/docs/cli/settings.md b/docs/cli/settings.md index dbb3651a4f..94e94e5e3f 100644 --- a/docs/cli/settings.md +++ b/docs/cli/settings.md @@ -159,17 +159,23 @@ they appear in the UI. ### Experimental -| UI Label | Setting | Description | Default | -| ---------------------------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| Enable Git Worktrees | `experimental.worktrees` | Enable automated Git worktree management for parallel work. | `false` | -| 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` | -| 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` | -| Model Steering | `experimental.modelSteering` | Enable model steering (user hints) to guide the model during tool execution. | `false` | -| Direct Web Fetch | `experimental.directWebFetch` | Enable web fetch behavior that bypasses LLM summarization. | `false` | -| 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` | -| Use the generalist profile to manage agent contexts. | `experimental.generalistProfile` | Suitable for general coding and software development tasks. | `false` | -| Enable Context Management | `experimental.contextManagement` | Enable logic for context management. | `false` | -| Topic & Update Narration | `experimental.topicUpdateNarration` | Enable the experimental Topic & Update communication model for reduced chattiness and structured progress reporting. | `false` | +| UI Label | Setting | Description | Default | +| ---------------------------------------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| Enable Tool Output Masking | `experimental.toolOutputMasking.enabled` | Enables tool output masking to save tokens. | `true` | +| Enable Git Worktrees | `experimental.worktrees` | Enable automated Git worktree management for parallel work. | `false` | +| 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` | +| 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` | +| Model Steering | `experimental.modelSteering` | Enable model steering (user hints) to guide the model during tool execution. | `false` | +| Direct Web Fetch | `experimental.directWebFetch` | Enable web fetch behavior that bypasses LLM summarization. | `false` | +| 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` | +| Use the generalist profile to manage agent contexts. | `experimental.generalistProfile` | Suitable for general coding and software development tasks. | `false` | +| Enable Context Management | `experimental.contextManagement` | Enable logic for context management. | `false` | +| Agent History Truncation | `experimental.agentHistoryTruncation` | Enable truncation window logic for the Agent History Provider. | `false` | +| Agent History Truncation Threshold | `experimental.agentHistoryTruncationThreshold` | The maximum number of messages before history is truncated. | `30` | +| Agent History Retained Messages | `experimental.agentHistoryRetainedMessages` | The number of recent messages to retain after truncation. | `15` | +| Agent History Summarization | `experimental.agentHistorySummarization` | Enable summarization of truncated content via a small model for the Agent History Provider. | `false` | +| Topic & Update Narration | `experimental.topicUpdateNarration` | Enable the experimental Topic & Update communication model for reduced chattiness and structured progress reporting. | `false` | +| Enable /btw Side Inquiries | `experimental.btw` | Enable the experimental /btw side inquiry command for ephemeral, non-persisted chat turns. | `false` | ### Skills diff --git a/docs/reference/commands.md b/docs/reference/commands.md index 67690f6ba2..e0d8e1d355 100644 --- a/docs/reference/commands.md +++ b/docs/reference/commands.md @@ -49,6 +49,13 @@ Slash commands provide meta-level control over the CLI itself. behavior can be modified using the `advanced.bugCommand` setting in your `.gemini/settings.json` files. +### `/btw` + +- **Description:** Ask a side question without affecting history (ephemeral). +- **Note:** This command is experimental and requires `experimental.btw: true` + in your `settings.json`. +- **Usage:** `/btw ` + ### `/chat` - **Description:** Alias for `/resume`. Both commands now expose the same diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index 1fdbc755f0..52113b82cf 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -1725,6 +1725,11 @@ their corresponding top-level category object in your `settings.json` file. for reduced chattiness and structured progress reporting. - **Default:** `false` +- **`experimental.btw`** (boolean): + - **Description:** Enable the experimental /btw side inquiry command for + ephemeral, non-persisted chat turns. + - **Default:** `false` + #### `skills` - **`skills.enabled`** (boolean): diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index c041aaa8c3..e37713a76e 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -2206,6 +2206,16 @@ const SETTINGS_SCHEMA = { 'Enable the experimental Topic & Update communication model for reduced chattiness and structured progress reporting.', showInDialog: true, }, + btw: { + type: 'boolean', + label: 'Enable /btw Side Inquiries', + category: 'Experimental', + requiresRestart: false, + default: false, + description: + 'Enable the experimental /btw side inquiry command for ephemeral, non-persisted chat turns.', + showInDialog: true, + }, }, }, extensions: { diff --git a/packages/cli/src/ui/commands/btwCommand.test.ts b/packages/cli/src/ui/commands/btwCommand.test.ts index 87e8578bca..ebaed41eb0 100644 --- a/packages/cli/src/ui/commands/btwCommand.test.ts +++ b/packages/cli/src/ui/commands/btwCommand.test.ts @@ -17,8 +17,39 @@ describe('btwCommand', () => { expect(btwCommand.isSafeConcurrent).toBe(true); }); - it('returns an error message when args are empty', () => { - const context = {} as CommandContext; + it('returns an error message when btw is not enabled in settings', () => { + const context = { + services: { + settings: { + merged: { + experimental: { + btw: false, + }, + }, + }, + }, + } as unknown as CommandContext; + const result = btwCommand.action!(context, 'question'); + expect(result).toEqual({ + type: 'message', + messageType: 'error', + content: + '/btw is an experimental feature. To enable it, run `gemini settings set experimental.btw true`.', + }); + }); + + it('returns an error message when args are empty and btw is enabled', () => { + const context = { + services: { + settings: { + merged: { + experimental: { + btw: true, + }, + }, + }, + }, + } as unknown as CommandContext; const result = btwCommand.action!(context, ' '); expect(result).toEqual({ type: 'message', @@ -27,8 +58,18 @@ describe('btwCommand', () => { }); }); - it('returns a btw action when query is provided', () => { - const context = {} as CommandContext; + it('returns a btw action when query is provided and btw is enabled', () => { + const context = { + services: { + settings: { + merged: { + experimental: { + btw: true, + }, + }, + }, + }, + } as unknown as CommandContext; const result = btwCommand.action!(context, ' what is this regex doing? '); expect(result).toEqual({ type: 'btw', diff --git a/packages/cli/src/ui/commands/btwCommand.ts b/packages/cli/src/ui/commands/btwCommand.ts index 696a9ed412..e7e6564b88 100644 --- a/packages/cli/src/ui/commands/btwCommand.ts +++ b/packages/cli/src/ui/commands/btwCommand.ts @@ -12,7 +12,17 @@ export const btwCommand: SlashCommand = { kind: CommandKind.BUILT_IN, autoExecute: true, isSafeConcurrent: true, - action: (_context, args) => { + action: (context, args) => { + const isBtwEnabled = context.services.settings.merged.experimental?.btw; + if (!isBtwEnabled) { + return { + type: 'message', + messageType: 'error', + content: + '/btw is an experimental feature. To enable it, run `gemini settings set experimental.btw true`.', + }; + } + const query = args.trim(); if (!query) { return { diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts index f334458364..d9ec90cb58 100644 --- a/packages/core/src/core/client.ts +++ b/packages/core/src/core/client.ts @@ -74,7 +74,6 @@ import { import { getDisplayString, resolveModel, - isGemini2Model, } from '../config/models.js'; import { getResponseText, partToString } from '../utils/partUtils.js'; import { parseThought } from '../utils/thoughtUtils.js';