-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Hey everyone!
With the recent merge of the slash command architectural refactor (see PR #3175), we've successfully laid a new foundation for what's possible with commands in the Gemini CLI.
This refactor was the necessary first step towards a much broader vision. Now that the groundwork is in place, we want to open up a community-wide discussion about where we go next.
The Vision: From Commands to a Platform
Our long-term vision is to evolve slash commands from a simple convenience feature into a powerful, user-driven automation platform. We want to empower you to teach Gemini CLI your unique workflows by creating a library of powerful, composable commands tailored to your projects.
The New Foundation: How We'll Get There
The recent refactor introduced the CommandService
, which is the key to this entire vision. It acts as a central hub that can discover commands from multiple sources and build a unified command tree.
+-------------------+ +---------------------+ +--------------------+
| Built-in cmds | | Local Command Files | | MCP Server Prompts |
| (TS Objects with | | (.gemini.toml with | | (via an API client)|
| subCommands) | | subCommands) | +--------------------+
+-------------------+ +---------------------+ |
| | (Discovers & Parses) | (Discovers via API)
| (Loads) | |
+------------------------+------------------------------+
|
+---------------------------+
| CommandService |
| (Builds unified command |
| TREE) |
+---------------------------+
|
| (Provides Tree)
v
+-----------------------------+
| CLI UI / useSlashProcessor |
| (Traverses tree to execute) |
+-----------------------------+
This architecture means we can now "plug in" new command sources without changing the core UI. This is where we need your ideas!
The Next Steps: A Call for Discussion
We want to focus our efforts on the following two steps. Our goal is to design these features in a way that makes them robust on their own, while setting the stage for them to be chainable and composable in the future.
Phase 1: Custom User-Defined Commands (The Immediate Next Step)
(Discussion for this phase will lead to a dedicated sub-issue for the final design)
-
The Idea: Allow users to define their own slash commands in a local configuration file. We believe
TOML
(.toml) is an excellent format for this, as its explicit syntax helps prevent common configuration errors. Commands could live at a project level (<project>/.gemini/commands/
) and a user level (~/.gemini/commands/
). -
Example
.gemini/commands/git.gemini.toml
:# This command would be invoked via "/git commit --type feat" name = "git" description = "Commands for interacting with the git repository." # Defines an item in the 'subCommands' array using TOML's "array of tables" syntax [[subCommands]] name = "commit" description = "Creates a conventional commit message for staged changes." prompt = """ Generate a conventional commit message of type '{{type}}' for the currently staged changes. """ # Defines an argument for the 'commit' subcommand # Note the nested "array of tables" syntax [[subCommands.args]] name = "type" description = "Commit type (e.g., feat, fix, chore)." required = true
-
Discussion Points:
- We are proposing
TOML
as the default for its clear and unambiguous syntax. However, we knowYAML
andMarkdown
is also very common in the ecosystem. We are very open to feedback here—what are the pros and cons of this choice for your workflow? - What's the ideal way to define arguments within the chosen format?
- Future-Proofing: How can we structure the format so commands can eventually be "chained" in a workflow?
- We are proposing
Phase 2: An Integrated Ecosystem with MCP
- The Idea: Implement the
CommandService
to discover commands from remote sources that implement the Model Context Protocol (MCP). This turns the CLI into a client for a larger ecosystem of tools. You can read more about the protocol here. These remote commands should feel completely native, so they too can be part of any future composition or chaining features. - Example Scenario: A team connects their internal Jira server, which exposes an MCP endpoint. The server has a prompt named
create-ticket
.- On startup, Gemini CLI queries the server and discovers this prompt.
- It automatically creates a new command:
/jira:create-ticket
. - A developer can now run
/jira:create-ticket --summary "Fix login button" --type Bug
directly in their terminal. The CLI handles calling the remote service and returning the result.
- Discussion Points: What kind of remote services would be most useful to integrate? What would the configuration for connecting to a new MCP-enabled service look like?
How to Get Involved & Our Contribution Process
This issue will serve as the main "Town Hall" for the vision. To ensure we build this feature collaboratively and efficiently, we will use the following process:
- Discuss Ideas Here First: Use the comments below to discuss the overall vision and the high-level ideas for each phase.
- Formalize a Design in a Sub-Issue: Once a high-level idea gains consensus, we will create a new, dedicated sub-issue to define the specific "blueprint" for it. This is where we will finalize details like TOML syntax or API contracts.
- Implement After Approval: Please do not start work on a Pull Request until the design in the corresponding sub-issue has been discussed and approved by the maintainers. This ensures your hard work aligns with the project's direction and has a clear path to being merged.
Consolidating Our Efforts
Current Issues
- Issue Support user-defined custom slash commands #2727
- Issue please add custom slash commands similar to those allowed by claude code. #2322
- Issue FR write down my own "@" or "/" commands as defined in the GEMINI.md file #805
Current PRs
- PR (WIP) feat: custom slash commands à la claude code #3441
- PR Feat(cli): Define prompt files and reuse them #3115 #3366
- PR feat: Add user-defined custom slash command support with argument, file #2726
- PR Feat(cli): Define prompt files and reuse them #3115 #3366
Let's build this together! 🚀
Sub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
Status