Skip to content

feat: add agent option to slashCommandOptions submenu #453

@breaking-brake

Description

@breaking-brake

Summary

Add agent frontmatter option to the SlashCommandOptions submenu for specifying which agent type to use when context: fork is set.

Background

Claude Code supports an agent frontmatter option that specifies which agent type to use when forking execution. This option is only applicable when combined with context: fork.

Reference: Claude Code Slash Commands Documentation

Current State

The SlashCommandOptionsDropdown currently supports:

  • allowed-tools
  • argument-hint
  • context (default/fork)
  • model (default/inherit/haiku/sonnet/opus)
  • disable-model-invocation
  • hooks

Proposed Changes

1. Type Definition Updates

File: src/shared/types/workflow-definition.ts

Add new type and update SlashCommandOptions:

/** Agent type options for Slash Command execution (only applicable with context: fork) */
export type SlashCommandAgent = 'default' | 'coder' | 'researcher' | 'planner';

export interface SlashCommandOptions {
  // ... existing fields
  /** Agent type to use when context: fork is set. Only applicable with context: fork. */
  agent?: SlashCommandAgent;
}

2. UI Component Updates

File: src/webview/src/components/toolbar/SlashCommandOptionsDropdown.tsx

Add new submenu for agent selection:

  • Display options: default, coder, researcher, planner (or fetch from Claude Code if dynamic)
  • Only enable when context: fork is selected
  • Show visual indicator when disabled (context !== 'fork')

3. Export Service Updates

File: src/extension/services/export-service.ts

Update generateSlashCommandFile() to include agent in frontmatter when:

  • context: fork is set, AND
  • agent is not 'default'

4. Store Updates

File: src/webview/src/stores/workflow-store.ts

Add state management for agent option.

Acceptance Criteria

  • agent option appears in SlashCommandOptions dropdown
  • agent submenu is visually disabled when context is not fork
  • Selecting an agent when context: fork exports correct frontmatter
  • Selecting an agent when context: default does NOT export agent frontmatter
  • Workflow JSON correctly saves/loads agent option

Notes

  • Need to confirm the exact list of valid agent types from Claude Code documentation
  • Consider adding tooltip explaining the dependency on context: fork

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions