@@ -75,7 +75,7 @@ export const infoCommands = [
7575
7676 new SlashCommandBuilder ( )
7777 . setName ( 'fast' )
78- . setDescription ( 'Toggle fast mode — switch between default model and a fast/cheap model (Sonnet )' ) ,
78+ . setDescription ( 'Toggle fast mode — 2.5x faster Opus 4.6 responses (higher cost, same quality )' ) ,
7979] ;
8080
8181// ================================
@@ -437,7 +437,7 @@ export function createInfoCommandHandlers(deps: InfoCommandHandlerDeps) {
437437 } ,
438438
439439 // ================================
440- // /fast — Toggle fast mode
440+ // /fast — Toggle fast mode (Opus 4.6 speed-optimized API config)
441441 // ================================
442442 // deno-lint-ignore no-explicit-any
443443 async onFast ( ctx : any ) : Promise < void > {
@@ -450,36 +450,26 @@ export function createInfoCommandHandlers(deps: InfoCommandHandlerDeps) {
450450 const newFastMode = ! current . fastMode ;
451451 deps . updateUnifiedSettings ( { fastMode : newFastMode } ) ;
452452
453- // If there's an active query, switch the model mid-session
454- const activeQuery = getActiveQuery ( ) ;
455- if ( activeQuery ) {
456- try {
457- if ( newFastMode ) {
458- await setActiveModel ( current . fastModel || 'claude-sonnet-4-6' ) ;
459- } else {
460- // Revert to default model (undefined = SDK default)
461- await setActiveModel ( current . defaultModel || undefined ) ;
462- }
463- } catch {
464- // Mid-session switch failed — setting still applies to next query
465- }
453+ // Write fastMode to .claude/settings.local.json so the CLI subprocess picks it up
454+ try {
455+ await writeFastModeToLocalSettings ( workDir , newFastMode ) ;
456+ } catch ( err ) {
457+ console . error ( '[/fast] Failed to write local settings:' , err ) ;
466458 }
467459
468- const modelName = newFastMode
469- ? ( current . fastModel || 'claude-sonnet-4-6' )
470- : ( current . defaultModel || 'default (Opus)' ) ;
471- const midSessionNote = activeQuery
472- ? '\nModel switched on active session.'
460+ const activeQuery = getActiveQuery ( ) ;
461+ const sessionNote = activeQuery
462+ ? '\n⚠️ Takes effect on **next query** (cannot toggle mid-session via SDK).'
473463 : '' ;
474464
475465 await ctx . reply ( {
476466 embeds : [ {
477467 color : newFastMode ? 0xffaa00 : 0x5865f2 ,
478468 title : newFastMode ? '⚡ Fast Mode ON' : '🧠 Fast Mode OFF' ,
479469 description : newFastMode
480- ? `Switched to ** ${ modelName } ** — faster responses, lower cost.${ midSessionNote } `
481- : `Switched to ** ${ modelName } ** — full reasoning power .${ midSessionNote } ` ,
482- footer : { text : 'Use /fast again to toggle back ' } ,
470+ ? `Opus 4.6 fast mode enabled — **2.5x faster ** responses, higher per-token cost, same quality .${ sessionNote } `
471+ : `Standard Opus 4.6 mode — normal speed and pricing .${ sessionNote } ` ,
472+ footer : { text : 'Use /fast again to toggle' } ,
483473 timestamp : new Date ( ) . toISOString ( )
484474 } ]
485475 } ) ;
@@ -491,6 +481,41 @@ export function createInfoCommandHandlers(deps: InfoCommandHandlerDeps) {
491481// Helper Functions
492482// ================================
493483
484+ import * as path from "https://deno.land/std@0.208.0/path/mod.ts" ;
485+
486+ /**
487+ * Writes fastMode to .claude/settings.local.json in workDir.
488+ * The SDK loads this file via settingSources: ['local'].
489+ * Merges with existing settings to avoid clobbering other local config.
490+ */
491+ async function writeFastModeToLocalSettings ( workDir : string , fastMode : boolean ) : Promise < void > {
492+ const settingsDir = path . join ( workDir , ".claude" ) ;
493+ const settingsPath = path . join ( settingsDir , "settings.local.json" ) ;
494+
495+ // Read existing settings (if any)
496+ // deno-lint-ignore no-explicit-any
497+ let existing : Record < string , any > = { } ;
498+ try {
499+ const raw = await Deno . readTextFile ( settingsPath ) ;
500+ existing = JSON . parse ( raw ) ;
501+ } catch {
502+ // File doesn't exist or is invalid — start fresh
503+ }
504+
505+ // Merge fastMode
506+ existing . fastMode = fastMode ;
507+
508+ // Ensure .claude/ directory exists
509+ try {
510+ await Deno . mkdir ( settingsDir , { recursive : true } ) ;
511+ } catch {
512+ // Already exists
513+ }
514+
515+ await Deno . writeTextFile ( settingsPath , JSON . stringify ( existing , null , 2 ) + "\n" ) ;
516+ console . log ( `[/fast] Wrote fastMode=${ fastMode } to ${ settingsPath } ` ) ;
517+ }
518+
494519// deno-lint-ignore no-explicit-any
495520async function sendFullInfoEmbed ( ctx : any , account : any , models : any [ ] , mcpServers : any [ ] ) : Promise < void > {
496521 const modelList = models . slice ( 0 , 15 ) . map ( m => `• **${ m . value } ** — ${ m . displayName } ` ) . join ( '\n' ) ;
0 commit comments