@@ -17,7 +17,6 @@ import { getAllTsFiles } from '../agents/agent-utils'
1717import { CLI , getLocalAgentInfo } from '../cli'
1818import { createExampleAgentFiles } from './init-agents'
1919import { getProjectRoot } from '../project-files'
20- import { Spinner } from '../utils/spinner'
2120import {
2221 ENTER_ALT_BUFFER ,
2322 EXIT_ALT_BUFFER ,
@@ -504,7 +503,7 @@ function setupAgentsKeyHandler(rl: any, onExit: () => void) {
504503 return
505504 }
506505
507- // Handle Enter - switch to selected agent, create new, or edit
506+ // Handle Enter - add @<agent-name> to input field or create new agent
508507 if ( key && key . name === 'return' ) {
509508 if ( agentList . length > 0 && selectedIndex < agentList . length ) {
510509 const selectedAgent = agentList [ selectedIndex ]
@@ -523,21 +522,10 @@ function setupAgentsKeyHandler(rl: any, onExit: () => void) {
523522 startDirectAgentCreation ( onExit )
524523 } else {
525524 exitAgentsBuffer ( rl )
526- // Start spinner for agent switching
527- Spinner . get ( ) . start ( `Switching to agent: ${ selectedAgent . name } ...` )
528-
529- // Use resetAgent to switch to the selected agent
525+ // Instead of switching agents, add @<agent-name> to the input field
530526 const cliInstance = CLI . getInstance ( )
531- cliInstance
532- . resetAgent ( selectedAgent . id )
533- . then ( ( ) => {
534- cliInstance . freshPrompt ( )
535- } )
536- . catch ( ( error : any ) => {
537- Spinner . get ( ) . stop ( )
538- console . error ( red ( 'Error switching to agent:' ) , error )
539- onExit ( )
540- } )
527+ const agentName = selectedAgent . name . replace ( / \s * \( .* \) $ / , '' ) // Remove any (id) suffix
528+ cliInstance . freshPrompt ( `@${ agentName } ` )
541529 }
542530 }
543531 return
0 commit comments