Hotfix (focused scope): patch workflow detection for LLM in VSCode to allow automated execution when exp. setting enabled#6006
Open
James-Cherished wants to merge 6 commits intoKilo-Org:mainfrom
Conversation
- Updated getCommand() signature in commands.ts to accept toggle options - Added isEnabled() helper function to filter workflows by toggle state - Updated RunSlashCommandTool.ts to retrieve toggles from state and pass to getCommand() - Added tests for workflow toggle filtering - Created changeset for the feature
- Updated AGENTS.md with new 'Slash Commands & Workflows' section - Added guidance for using run_slash_command tool - Explained command naming convention (filename without path/extension) - Added instruction to explore before declaring impossibility - Added instruction to trust user direction on tool types - Updated capabilities.ts system prompt section with same guidance
🦋 Changeset detectedLatest commit: 5961855 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
…on-to-slash-command-for-AI-execution
…on-to-slash-command-for-AI-execution
Contributor
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (5 files)
|
- Fix inconsistent priority between getCommands() and getCommand() - getCommand() now checks project workflows before global commands - Ensures project > global priority principle is respected - Fix global commands shadowing project workflows - Reordered lookup: project commands -> project workflows -> global commands -> global workflows - Add toggle filtering to getCommands() - Added optional options parameter for toggle state - Built-in commands always pass through - Global/project workflows filtered via isEnabled()
Author
|
@kilocode-bot can you do a new review? those issues should be fixed now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The experimental setting "Enable model-initiated slash commands" introduced a few months ago never worked.
Comprehensive fixes have been delayed due to LoC, upstream (Roo & Cline) WIP, & kilo rebuild.
This hotfix introduces a minimalist change to immediately make this feature working and available for all users.
Tested locally.
Screenshots
After (intended behavior)
Before (current behavior)
Through VSCode extension, the AI only has access to the "init" slash_commands.
How to Test
See scrensoots above.
After
Enable experimental setting
Create a workflow if none: .kilocode/workflows/user-favorite-color-is.md
Start task: "what's user favorite color? only answer using the run_slash_commands tool."
Agent executes the relevant workflow, tells you your favorite color straight away
Workflow provides the agent with new instructions
Before
Start a new chat with the same prompt
Agent won't know, can't know which workflows are available, can only run init, will quit or cheat to answer
References
See
#4760 #5089 #5981
Get in Touch
https://x.com/JamesCherished
Issue: Custom Workflows Not Discovered
Problem Statement
The
run_slash_commandexperimental tool only discovers the built-in "init" command and fails to see custom workflows that appear in the UI autocomplete.Root Cause: Two Disconnected Systems
The codebase has TWO SEPARATE SYSTEMS for slash commands that are not connected:
System 1: Backend
run_slash_commandToolFile:
src/core/tools/RunSlashCommandTool.tsUses
getCommand()fromservices/command/commands.tswhich loads from:built-in-commands.ts~/.kilocode/commands/directory.kilocode/commands/directory in workspaceSystem 2: Frontend UI Autocomplete
File:
webview-ui/src/utils/slash-commands.tsUses
getSupportedSlashCommands()which includes:getWorkflowCommands()- reads from.kilocode/workflows/viaClineRulesTogglesThe Disconnect
RunSlashCommandTool)slash-commands.ts).kilocode/commands/.kilocode/workflows/localWorkflowToggles,globalWorkflowTogglesKey Code Evidence
Backend only searches commands directory:
Frontend loads workflows from toggles:
Workflow storage location:
Why Only "init" Appears
built-in-commands.ts:10-289).kilocode/commands/.kilocode/workflows/are invisible to the backend tool because:getCommand()only searchescommands/directoriesClineRulesToggles) are never passed toRunSlashCommandToolAffected Files
src/core/tools/RunSlashCommandTool.tssrc/services/command/commands.ts.kilocode/workflows/src/services/command/built-in-commands.tswebview-ui/src/utils/slash-commands.tssrc/core/context/instructions/workflows.tssrc/shared/globalFileNames.tscommandsandworkflowspathsPersonal thoughts
The legacy from Roo, Cline and Opencode introduced many features and this overlap caused the issue. Slash commands and workflows achieve the same thing, with the only arguable difference to be slash commands to be more user-oriented (type / to instruct the model during the chat), while workflows are more automation-oriented (the AI autonomously loads the necessary workflow). They come from the opposite sides of the user-AI interaction, each with the advantage of being callable from the other side of the equation. (An advantage over Skills, for example)
My current understanding of the code is that the kilo CLI uses built-in slash commands, while the custom slash commands the extension loads (or was supposed to load), as it is implied by the experimental setting, is actually workflows (.kilocode/workflows).
My advice, from what seems the most straightforward and logical:
The alternative, if you really want to keep both:
Implementation
This PR implements workflow discoverability and toggle filtering for slash commands, enabling agents to call workflow files in
.roo/workflows/or.kilocode/workflows/by name while respecting user-defined toggle states.Changes
1. Workflow Directory Scanning (
src/services/command/commands.ts)The existing
scanCommandDirectory()function already handles reading.mdfiles and parsing YAML frontmatter. This change extendsgetCommands()andgetCommand()to also scanworkflows/directories:2. Toggle Filtering
Added
isEnabled()helper function to filter workflows by toggle state:3. State Threading (
src/core/tools/RunSlashCommandTool.ts)Retrieve toggles from provider state and pass to
getCommand():Resolution Priority
The command/workflow resolution order is:
Files Changed
src/services/command/commands.tssrc/core/tools/RunSlashCommandTool.tssrc/services/command/__tests__/workflow-toggle.spec.tsTesting
src/services/command/__tests__/passworkflow-toggle.spec.tsadds 7 tests covering:Usage
Workflows are enabled by default. A workflow is only excluded when its toggle is explicitly set to
falsein the state.Run tests: