Skip to content

Conversation

@YuriNachos
Copy link

This is a rebased version of #4760 from @James-Cherished, updated to work with the latest main branch.

Changes:

  • Rebased onto latest main
  • Resolved conflicts in experiments.ts and ExperimentalSettings.tsx

Closes #4760

Implements the execute_workflow tool enabling AI assistants to discover and execute slash command workflows stored in .kilocode/workflows/ without manual file reading. This resolves a critical limitation where workflows couldn't be properly utilized, forcing users to work around the system.
What Changed
Backend Infrastructure:
New workflow service (src/services/workflow/workflows.ts) - Discovers and manages workflows from .kilocode/workflows/ with support for project-level and global workflows
Workflow execution tool (src/core/tools/RunSlashCommandTool.ts) - Handles workflow discovery, parameter passing, approval flow, and execution with comprehensive error handling
Tool description (src/core/prompts/tools/native-tools/run_slash_command.ts) - Defines tool interface for AI models with clear usage examples
Experiment flag integration - Feature gated behind runSlashCommand experiment flag for gradual rollout
UI Components:
Extended SlashCommandItem component - Added workflow execution mode to existing component (avoiding duplication)
Chat integration (ChatRow.tsx) - Displays workflow execution requests and results inline
Workflow execution display - Shows workflow name, description, source badges (project/global/built-in), and optional arguments with expand/collapse support
Testing:
22 comprehensive UI tests covering both command list and workflow execution modes
Backend unit tests for workflow service and execution tool
Integration tests ensuring proper message routing and display
Why This Matters
Before this change, AI assistants had to read workflow files directly to utilize them, defeating their purpose as reusable templates. Now workflows are first-class citizens with proper discovery, validation, and execution support.
Key Features
Automatic discovery - List available workflows without file system access
Parameter support - Pass arguments to customize workflow execution
Source tracking - Distinguish between project, global, and built-in workflows
Approval flow - User approval required before workflow execution
Error handling - Graceful handling of missing workflows and invalid parameters
Experiment flag - Safe rollout behind runSlashCommand feature flag
Implementation Highlights
Smart architectural decision to extend existing SlashCommandItem component rather than create duplicate infrastructure, maintaining code reusability while adding workflow-specific functionality. All Kilo Code-specific changes marked with kilocode_change comments for future upstream merge compatibility.
Testing
All tests pass successfully:
✅ 22 SlashCommandItem tests (command list + workflow execution modes)
✅ 3 ChatRow integration tests
✅ Backend service and tool tests
✅ Type safety verified throughout
Changed translation key from RUN_SLASH_COMMAND to AUTO_EXECUTE_WORKFLOW to match experiment constant. Updated name from "Enable model-initiated slash commands" to "Enable workflow access" and description to better reflect the feature's actual behavior of accessing workflow content without approval.

- Updated 18 locale files (en, ar, ko, hi, fr, tr, pl, cs, pt-BR, zh-TW, ja, nl, id, vi, uk, es, de, th, zh-CN, it)
- Created changeset for release notes
- Fix experiment configuration passing in getWorkflowsForEnvironment
- Enable WORKFLOW_DISCOVERY experiment by default
- Use Experiments.isEnabled helper for proper fallback to defaults
- This allows workflows to appear in environment details that AI agent sees
- Filter WORKFLOW_DISCOVERY from experimental settings UI
- Update getWorkflowsForEnvironment to use AUTO_EXECUTE_WORKFLOW instead
- Remove WORKFLOW_DISCOVERY from experiment definitions
- Remove WORKFLOW_DISCOVERY from experiment type definitions
- Update tests accordingly
@changeset-bot
Copy link

changeset-bot bot commented Jan 10, 2026

🦋 Changeset detected

Latest commit: 1199488

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kevinvandijk
Copy link
Collaborator

Thank you! We're actually working on integrating more with upstream again with this so we're waiting for that first but I'll review after that was released!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants