Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: add Sub-Agent creation dialog with deferred file creation#646

Merged
breaking-brake merged 2 commits intomainbreaking-brake/cc-wf-studio:mainfrom
feat/sub-agent-creation-dialogbreaking-brake/cc-wf-studio:feat/sub-agent-creation-dialogCopy head branch name to clipboard
Mar 16, 2026
Merged

feat: add Sub-Agent creation dialog with deferred file creation#646
breaking-brake merged 2 commits intomainbreaking-brake/cc-wf-studio:mainfrom
feat/sub-agent-creation-dialogbreaking-brake/cc-wf-studio:feat/sub-agent-creation-dialogCopy head branch name to clipboard

Conversation

@breaking-brake
Copy link
Copy Markdown
Owner

@breaking-brake breaking-brake commented Mar 16, 2026

Summary

Add a Sub-Agent creation dialog that supports both "Create New" and "Use Existing" flows, plus deferred file creation in the DiffPreviewDialog for MCP apply_workflow.

Closes #636

Motivation

CC Workflow Studio previously only supported inline Sub-Agent definitions. Users with existing .claude/agents/*.md command files had to recreate them manually. Additionally, apply_workflow wrote Sub-Agent .md files to disk before user review — rejected changes left orphan files.

Changes

New Files:

  • src/webview/src/components/dialogs/SubAgentCreationDialog.tsx - Browse/create dialog with two tabs (Create New / Use Existing)
  • src/webview/src/components/dialogs/SubAgentFormDialog.tsx - Form for creating new sub-agent with all fields
  • src/webview/src/services/command-browser-service.ts - Service for browsing .claude/agents/ commands
  • src/extension/commands/command-operations.ts - Extension host handlers for command scanning
  • src/extension/services/command-service.ts - Command file scanner (user/project scopes)
  • src/extension/utils/path-utils.ts - Path utilities for .claude/agents/ directories

Modified Files:

  • src/extension/services/mcp-server-tools.ts - Split autoCreateSubAgentFiles into planSubAgentFiles (no disk write) + executeSubAgentFileCreation (post-approval)
  • src/extension/services/mcp-server-service.ts - Pass plannedFiles through MCP payload
  • src/shared/types/messages.ts - Add PlannedSubAgentFile type and message types for command scanning
  • src/webview/src/components/dialogs/DiffPreviewDialog.tsx - Add "Files to be created" section
  • src/webview/src/App.tsx - Wire plannedFiles to DiffPreviewDialog
  • resources/workflow-schema.json / .toon - Add commandFilePath, commandScope, agentType, aiGenerationGuidance
  • resources/ai-editing-skill-template.md - Add list_available_commands step
  • src/extension/utils/validate-workflow.ts - Add commandScope validation
  • src/extension/services/export-service.ts - Reference model support in export
  • i18n files (en/ja/ko/zh-CN/zh-TW) - Translation keys for new dialogs and file preview

Testing

  • Manual E2E testing completed
  • npm run format && npm run lint && npm run check && npm run build passes

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Sub-Agent creation workflow with browsing and selection of existing command files.
    • Introduced ability to discover and reuse available agent commands from existing repositories.
    • Enhanced workflow application preview to show planned file creations before applying.
  • Improvements

    • Added Sub-Agent editing dialog with support for agent type configuration and customization.
    • Improved workflow validation to properly handle linked vs. inline Sub-Agent definitions.
    • Enhanced UI with tool selection sizing options and improved property display.
  • Documentation

    • Updated workflow template with refined discovery and application steps.
    • Added comprehensive translations for Sub-Agent features across multiple languages.

breaking-brake and others added 2 commits March 16, 2026 00:31
- Add SubAgentCreationDialog for browsing existing .claude/commands
- Add SubAgentFormDialog for creating new Sub-Agent nodes
- Add command-browser-service and command-operations
- Move "Create New" buttons next to filter input in both SubAgent and Skill dialogs
- Change SubAgent dialog title to "Browse Sub-Agent"
- Set default model to "Inherit" for new Sub-Agent creation
- Add i18n translations for all Sub-Agent dialog strings (en/ja/ko/zh-CN/zh-TW)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Dialog

- Split autoCreateSubAgentFiles into planSubAgentFiles + executeSubAgentFileCreation
- Add PlannedSubAgentFile type and pass plannedFiles through MCP payload
- Show "Files to be created" section in DiffPreviewDialog with file paths
- Add schema fields (commandFilePath, commandScope, agentType, aiGenerationGuidance)
- Add commandScope validation and export-service reference model support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 16, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR extends the workflow system to support reusing existing sub-agents from external command definitions. It adds command discovery services, new MCP tools for listing available commands, planning/creation workflows for sub-agent files, linked command referencing, and corresponding UI components for browsing, selecting, and creating sub-agents with field support for agentType, commandFilePath, and commandScope.

Changes

Cohort / File(s) Summary
Schema & Documentation
resources/ai-editing-skill-template.md, resources/workflow-schema.json, resources/workflow-schema.toon
Reorders workflow discovery steps, adds aiGenerationGuidance blocks, and introduces subAgent fields: agentType, commandFilePath, commandScope for external agent linking; mirrors guidance structure in subAgentFlow.
Command Discovery Services
src/extension/services/command-service.ts, src/extension/utils/path-utils.ts
New command scanning utilities that discover and aggregate .md command files from user and project .claude/agents directories, extracting metadata (name, description, scope) for reuse.
MCP Server Tools & Planning
src/extension/services/mcp-server-tools.ts, src/extension/services/export-service.ts, src/extension/services/mcp-server-service.ts
Adds list_available_commands MCP tool, planning phase (planSubAgentFiles) to resolve new sub-agents with generated commandFilePath values, and post-apply file creation (executeSubAgentFileCreation); skip inline sub-agents during export.
Sub-Agent File Creation Handlers
src/extension/commands/command-operations.ts, src/extension/commands/open-editor.ts
New handlers (handleBrowseCommands, handleCreateSubAgent) for webview communication; scan and return command lists, create/edit sub-agent markdown files with appropriate error handling and logging.
Shared Message Types & Workflow Definition
src/shared/types/messages.ts, src/shared/types/workflow-definition.ts, src/extension/utils/validate-workflow.ts
Introduces CommandReference, CreateSubAgentPayload, SubAgentCreationSuccessPayload, CommandListLoadedPayload, PlannedSubAgentFile types; extends SubAgentData with agentType, commandFilePath, commandScope; adds commandScope validation.
Sub-Agent UI Dialogs & Components
src/webview/src/components/dialogs/SubAgentCreationDialog.tsx, src/webview/src/components/dialogs/SubAgentFormDialog.tsx, src/webview/src/components/dialogs/DiffPreviewDialog.tsx
New dialog components for browsing existing commands and creating sub-agents with form validation; DiffPreviewDialog extended to display planned file creation previews.
Webview Integration & State Management
src/webview/src/App.tsx, src/webview/src/components/NodePalette.tsx, src/webview/src/components/PropertyOverlay.tsx, src/webview/src/services/command-browser-service.ts
Propagates plannedFiles through MCP apply flow, integrates sub-agent creation dialogs, adds command selection and form-based creation handlers with frontmatter parsing; new service for command browsing and sub-agent creation requests.
UI Refinements
src/webview/src/components/common/ColorPicker.tsx, src/webview/src/components/common/ToolSelectTagInput.tsx, src/webview/src/components/dialogs/SkillBrowserDialog.tsx
Increases z-index, adds size-based styling system and configurable tool list, relocates Create button to filter row.
Internationalization
src/webview/src/i18n/translation-keys.ts, src/webview/src/i18n/translations/en.ts, src/webview/src/i18n/translations/ja.ts, src/webview/src/i18n/translations/ko.ts, src/webview/src/i18n/translations/zh-CN.ts, src/webview/src/i18n/translations/zh-TW.ts
Extensive new translation keys for sub-agent creation dialogs, form fields, labels, and validation messages across all supported languages.

Sequence Diagram

sequenceDiagram
    participant User
    participant Webview
    participant Extension as Extension Host
    participant FileSystem as File System
    
    User->>Webview: Click "Browse Existing Sub-Agents"
    Webview->>Webview: Open SubAgentCreationDialog
    Webview->>Extension: BROWSE_COMMANDS (requestId)
    Extension->>FileSystem: Scan ~/.claude/agents/*.md
    Extension->>FileSystem: Scan {workspace}/.claude/agents/*.md
    FileSystem-->>Extension: List of .md files
    Extension->>Extension: Extract metadata (name, description, promptContent)
    Extension-->>Webview: COMMAND_LIST_LOADED (CommandReference[], counts)
    Webview->>Webview: Render filtered command list by scope
    
    User->>Webview: Select command or choose "Create New"
    
    alt User selects existing command
        Webview->>Webview: Parse frontmatter from command.promptContent
        Webview->>Webview: Populate SubAgent node data
    else User creates new sub-agent
        User->>Webview: Fill SubAgentFormDialog (description, prompt, model, tools, memory)
        Webview->>Extension: CREATE_SUB_AGENT (CreateSubAgentPayload)
        Extension->>FileSystem: Write .claude/agents/{name}.md
        FileSystem-->>Extension: File created
        Extension-->>Webview: SUB_AGENT_CREATION_SUCCESS (filePath)
    end
    
    Webview->>Webview: Add SubAgent node with commandFilePath reference
    Webview->>Webview: Workflow now includes linked sub-agent
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related issues

  • Add support for existing sub-agents in CC Workflow Studio #636: Add support for existing sub-agents in CC Workflow Studio — This PR directly implements the proposed solution by enabling discovery and reuse of existing sub-agents through command file scanning, linked command referencing (commandFilePath), and UI workflows for browsing and importing external sub-agents into the editor.

Suggested labels

released

Poem

🐰 A rabbit hops through .claude/agents/ fine,
Gathering commands from user and project's line,
Sub-agents now linked, no rebuild in sight,
Workflow reuse makes the ecosystem bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: adding a Sub-Agent creation dialog with deferred file creation, which aligns with the primary objectives.
Linked Issues check ✅ Passed The PR implements the core objectives from #636: discovering existing sub-agents, displaying them in a UI, allowing selection/reuse, and supporting both linked and inline modes with proper schema and workflow support.
Out of Scope Changes check ✅ Passed All changes are directly related to the Sub-Agent discovery and creation feature. Minor improvements like ColorPicker z-index and ToolSelectTagInput size props are supporting enhancements integral to the new Sub-Agent UI.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/sub-agent-creation-dialog
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

@breaking-brake breaking-brake merged commit f6d8b9f into main Mar 16, 2026
3 of 4 checks passed
@breaking-brake breaking-brake deleted the feat/sub-agent-creation-dialog branch March 16, 2026 11:54
@breaking-brake breaking-brake mentioned this pull request Mar 16, 2026
braking-brake-semantic-release Bot pushed a commit that referenced this pull request Mar 16, 2026
## [3.28.0](v3.27.1...v3.28.0) (2026-03-16)

### Features

* add Sub-Agent creation dialog with deferred file creation ([#646](#646)) ([f6d8b9f](f6d8b9f))
@braking-brake-semantic-release
Copy link
Copy Markdown

🎉 This PR is included in version 3.28.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for existing sub-agents in CC Workflow Studio

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.