@@ -7,6 +7,7 @@ import { isMarkdownFile } from "../../shared/file-utils"
77import { getClaudeConfigDir } from "../../shared"
88import { discoverAllSkills , type LoadedSkill } from "../../features/opencode-skill-loader"
99import { loadBuiltinCommands } from "../../features/builtin-commands"
10+ import { getSessionModel } from "../../features/claude-code-session-state"
1011import type { CommandScope , CommandMetadata , CommandInfo , SlashcommandToolOptions } from "./types"
1112
1213function discoverCommandsFromDir ( commandsDir : string , scope : CommandScope ) : CommandInfo [ ] {
@@ -100,7 +101,12 @@ function skillToCommandInfo(skill: LoadedSkill): CommandInfo {
100101 }
101102}
102103
103- async function formatLoadedCommand ( cmd : CommandInfo ) : Promise < string > {
104+ interface CurrentModelInfo {
105+ providerID : string
106+ modelID : string
107+ }
108+
109+ async function formatLoadedCommand ( cmd : CommandInfo , currentModel ?: CurrentModelInfo ) : Promise < string > {
104110 const sections : string [ ] = [ ]
105111
106112 sections . push ( `# /${ cmd . name } Command\n` )
@@ -126,6 +132,11 @@ async function formatLoadedCommand(cmd: CommandInfo): Promise<string> {
126132 }
127133
128134 sections . push ( `**Scope**: ${ cmd . scope } \n` )
135+
136+ if ( currentModel ) {
137+ sections . push ( `**Current Model**: ${ currentModel . providerID } /${ currentModel . modelID } \n` )
138+ }
139+
129140 sections . push ( "---\n" )
130141 sections . push ( "## Command Instructions\n" )
131142
@@ -230,7 +241,7 @@ export function createSlashcommandTool(options: SlashcommandToolOptions = {}): T
230241 ) ,
231242 } ,
232243
233- async execute ( args ) {
244+ async execute ( args , ctx ) {
234245 const allItems = await getAllItems ( )
235246
236247 if ( ! args . command ) {
@@ -244,7 +255,8 @@ export function createSlashcommandTool(options: SlashcommandToolOptions = {}): T
244255 )
245256
246257 if ( exactMatch ) {
247- return await formatLoadedCommand ( exactMatch )
258+ const currentModel = ctx ?. sessionID ? getSessionModel ( ctx . sessionID ) : undefined
259+ return await formatLoadedCommand ( exactMatch , currentModel )
248260 }
249261
250262 const partialMatches = allItems . filter ( ( cmd ) =>
0 commit comments