-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Feat: Workflow tool allows Kilo to run slash commands autonomously #4760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat: Workflow tool allows Kilo to run slash commands autonomously #4760
Conversation
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
🦋 Changeset detectedLatest commit: 8ef1782 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 |
…ven when auto-execute is enabled
…ven when auto-execute is enabled
- 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
|
The last commits polished the UI. |
|
Thank you! We're actually working integrating more with upstream again with this so we're waiting for that first but I'll review after that was released! |
Hi, thanks for replying :) |






Hello!
This enables Kilo to automatically discover and execute workflows, replacing the current ineffective experimental setting.
Workflows in Kilo Code can now be:
run_slash_commandtoolImplementation
Workflow Execution Tool
New Backend Services:
src/services/workflow/workflows.ts- Discovers workflows from.kilocode/workflows/src/core/tools/RunSlashCommandTool.ts- Handles execution with approval flow and parameter passingsrc/core/prompts/tools/native-tools/run_slash_command.ts- Tool interface for AI modelsSmart UI Integration:
SlashCommandItemcomponent for workflow execution displayChatRow.tsxfor seamless chat experienceWorkflow Discovery
Fixed Configuration Issues:
WORKFLOW_DISCOVERYexperiment by default insrc/shared/experiments.tsgetWorkflowsForEnvironment.tsusingExperiments.isEnabled()helpergetEnvironmentDetails.tsto properly pass experiment configurationImpact: AI agents now see all available workflows in their environment details automatically
Technical Highlights
Code Reuse: Extended existing
SlashCommandItemcomponent rather than creating duplicate infrastructure, maintaining clean architecture.Comprehensive Testing:
Merge-Friendly: All Kilo Code-specific changes marked with
kilocode_changecomments for easy upstream synchronization.Files Changed
New Files (8):
Modified Files (14):
Total: 22 files changed, bringing complete workflow functionality to Kilo Code[1]
How to Test
Enable experimental setting
Create a workflow if none:
.kilocode/workflows/user-favorite-color-is.mdStart task: "tell me what's user favorite color, without using any tool except the workflow tool, including without listing or reading any file."
Agent sees the workflow and can execute it using the tool
Workflow provides the agent with new instructions
Disable experimental setting
Start a new chat with the same prompt: "tell me what's user favorite color, without using any tool except the workflow tool, including without listing or reading any file."
Agent won't know, can't know which workflows are available, will quit or cheat to answer
Screenshots
Setting off
Setting on
Get in touch
james_cherished_13573 (discord)
https://x.com/JamesCherished (preferred)