Initial public release of Warp.
Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# CLI Agent Rich Input: /skills Product Spec
|
||||
|
||||
## Summary
|
||||
Add support for `/skills` in the CLI agent rich input composer — the input that appears when composing a prompt to send to a running CLI agent (Claude Code, Codex, Gemini CLI, etc.). Only natively supported skills are shown, and the selected skill name is passed through to the CLI agent via PTY write.
|
||||
|
||||
## Problem
|
||||
When users compose prompts for CLI agents through Warp's rich input (Ctrl-G or the Compose button), they cannot browse or invoke skills. The normal Warp agent input supports skills, but the CLI agent input does not. Users must manually type `/skill-name` without any discovery or autocomplete.
|
||||
|
||||
The core constraint is that CLI agent input writes plain text to a PTY — so skill invocation must resolve to a plain text `/skill-name args` string that the CLI agent interprets natively.
|
||||
|
||||
## Goals
|
||||
- Let users browse and select skills via `/` in the CLI agent rich input.
|
||||
- Only show skills that the active CLI agent can natively interpret (passthrough).
|
||||
- Hide Warp-specific slash commands that don't apply to CLI agents.
|
||||
|
||||
## Non-goals
|
||||
- Surfacing non-natively-supported skills (e.g., bundled Warp skills like `oz-platform`). Only skills the active CLI agent can interpret should appear.
|
||||
- Implementing client-side argument parsing for skills. The CLI agent handles argument parsing natively.
|
||||
- Showing native CLI agent slash commands (e.g., Claude Code's `/compact`, `/model`) in the menu. This is a follow-up (see APP-3641).
|
||||
|
||||
## Figma
|
||||
https://www.figma.com/design/CsBdBW4YoLgSAbr5eSkwV6/House-of-Agents?node-id=7001-18001&p=f&m=dev
|
||||
|
||||
## User Experience
|
||||
|
||||
### Trigger
|
||||
User types `/` at the start of the input in the CLI agent rich input, same trigger as in normal Warp input.
|
||||
|
||||
### Limitation
|
||||
`/skills` is only available in local sessions. It is not supported in SSH/remote contexts because skill discovery relies on local filesystem access.
|
||||
|
||||
### Menu
|
||||
The slash command / skill selector menu opens. Static slash commands that are Warp-agent-specific (e.g., `/agent`, `/new`, `/conversations`, `/cloud-agent`) are hidden when the CLI agent rich input is active. The `/skills` command itself remains available so users can browse skills. Individual skills also appear as direct items in the menu.
|
||||
|
||||
### Behavior on selection
|
||||
Only natively supported skills are shown in the menu. When a skill is selected, `/{skill-name} ` is inserted into the buffer. The user can type arguments after it. On submit, the full text (e.g., `/my-skill arg1 arg2`) is written to the PTY — the CLI agent handles argument parsing natively.
|
||||
|
||||
### Natively supported skills
|
||||
Some CLI agents support a skills/agents folder convention. The known mapping is:
|
||||
|
||||
- **Codex**: supports `.agents/`, `.claude/`, `.codex/` folders.
|
||||
- **OpenCode**: supports `.opencode/`, `.agents/`, `.claude/` folders.
|
||||
- **Claude Code**: supports `.claude/` folder.
|
||||
- **Gemini CLI**: supports `.agents/`, `.gemini/` folders.
|
||||
- **Amp**: supports `.agents/` folder.
|
||||
- **Copilot**: supports `.agents/`, `.copilot/` folders.
|
||||
- **Droid**: supports `.factory/`, `.agents/` folders.
|
||||
|
||||
A skill is shown in the CLI agent input menu if:
|
||||
1. The active CLI agent is one that supports skills folders, AND
|
||||
2. The skill's provider (determined from its filesystem path) matches one of the agent's supported providers.
|
||||
|
||||
Skills that don't match the active CLI agent's supported providers are hidden from the menu entirely. Non-natively supported skills (including bundled Warp skills like `oz-platform`) are not shown — supporting them is a potential follow-up.
|
||||
|
||||
## Success Criteria
|
||||
- Users can type `/` in the CLI agent rich input, see natively supported skills, select one, and have `/{skill-name} ` inserted for passthrough to the CLI agent.
|
||||
- Warp-specific slash commands do not appear in the CLI agent menu (except `/skills`).
|
||||
- Non-native skills are hidden from the menu.
|
||||
- This feature is only available in local sessions, not SSH/remote.
|
||||
|
||||
## Validation
|
||||
- Open a CLI agent rich input while Codex is running. Type `/`, select a skill that exists in `.agents/`, verify `/{skill-name} ` is inserted. Type arguments and submit. Verify the full text is written to the PTY.
|
||||
- Open a CLI agent rich input while Claude Code is running. Type `/`, verify only skills with `.claude/` provider appear.
|
||||
- Verify that `/skills` command works and opens the skill browser.
|
||||
- Verify that `/agent`, `/new`, etc. do not appear in the `/` menu.
|
||||
- Verify that `/skills` is not available in SSH/remote sessions.
|
||||
|
||||
## Open Questions
|
||||
- Should we surface native CLI agent slash commands (e.g., Claude Code's `/compact`, `/model`) in the menu alongside skills? This would require keeping command lists in sync with each CLI agent. See APP-3641. **Answer: not for now!**
|
||||
@@ -0,0 +1,84 @@
|
||||
# CLI Agent Rich Input: /skills Technical Spec
|
||||
|
||||
## Summary
|
||||
This spec covers implementing `/skills` support in the CLI agent rich input composer. The approach filters the existing slash command menu and skill data sources to show only natively supported skills, and passes through the selected skill name to the CLI agent via PTY write.
|
||||
|
||||
## Relevant Code
|
||||
- `app/src/terminal/input/slash_commands/data_source/mod.rs` — `SlashCommandDataSource`, `recompute_active_commands()`
|
||||
- `app/src/terminal/input/slash_commands/mod.rs` — `handle_slash_commands_menu_event()`, skill selection handling
|
||||
- `app/src/terminal/input/slash_commands/view.rs` — `InlineSlashCommandView`, mixer with 3 data sources
|
||||
- `app/src/terminal/input/skills/view.rs` — `InlineSkillSelectorView`
|
||||
- `app/src/terminal/input/skills/data_source.rs` — `SkillSelectorDataSource`
|
||||
- `app/src/terminal/cli_agent_sessions/mod.rs` — `CLIAgentSessionsModel`, `CLIAgentInputState`
|
||||
- `app/src/ai/skills/skill_manager.rs` — `SkillManager`, `skill_by_reference()`
|
||||
- `ai/src/skills/skill_provider.rs` — `SkillProvider`, `SKILL_PROVIDER_DEFINITIONS`, provider-to-folder mapping
|
||||
- `app/src/terminal/cli_agent.rs` — `CLIAgent` enum
|
||||
|
||||
## Current State
|
||||
The CLI agent rich input (opened via Ctrl-G or the Compose button) is a plain text editor that writes its buffer to the PTY on submit. It reuses the same `Input` view and editor as the normal Warp input, but in a constrained mode. On enter, `input_enter()` detects `CLIAgentSessionsModel::is_input_open()` and emits `Event::SubmitCLIAgentInput` with the raw buffer text, which is written to the PTY.
|
||||
|
||||
The slash commands menu and skill selector already exist and work in the normal Warp input. The slash menu (`InlineSlashCommandView`) uses a `SearchMixer` with three data sources:
|
||||
1. `SlashCommandDataSource` (sync) — static commands like `/agent`, `/new`, `/skills`. Stored in `active_commands_by_id`.
|
||||
2. `saved_prompts_data_source` (async) — saved prompts from Warp Drive.
|
||||
3. `ZeroStateDataSource` (sync) — zero-state items combining commands and skills.
|
||||
|
||||
Individual skills appear as `AcceptSlashCommandOrSavedPrompt::Skill` items, produced by the data source querying `SkillManager`. The `/skills` command opens a dedicated `InlineSkillSelectorView`.
|
||||
|
||||
Currently, all static commands and all skills are shown regardless of whether CLI agent input is active. Warp-specific commands like `/agent` and `/new` don't make sense for CLI agents, and non-native skills can't be interpreted by the CLI agent.
|
||||
|
||||
## Proposed Changes
|
||||
|
||||
### 1. Filter static slash commands for CLI agent input
|
||||
|
||||
**Approach**: Inside `recompute_active_commands()`, read `CLIAgentSessionsModel::is_input_open(terminal_view_id)` directly. When true, filter `active_commands_by_id` to only keep allowlisted commands — specifically `/skills` (so users can browse skills). All other static commands (`/agent`, `/new`, `/conversations`, `/cloud-agent`, etc.) are removed.
|
||||
|
||||
No stored boolean is needed. `CLIAgentSessionsModel` is the single source of truth, avoiding stale state.
|
||||
|
||||
**Plumbing**: `SlashCommandDataSource` already subscribes to `CLISubagentController` events and calls `recompute_active_commands()`. Add a subscription to `CLIAgentSessionsModel` for `InputSessionChanged` events to trigger `recompute_active_commands()` when the input session opens or closes.
|
||||
|
||||
### 2. Filter skills to native-only
|
||||
|
||||
**What changes**: Only natively supported skills are shown in the CLI agent input menu. When selected, `/{skill-name} ` is inserted into the buffer. The CLI agent handles argument parsing natively — no client-side parsing needed.
|
||||
|
||||
**Filtering skills**: Use the existing `SkillProvider` and `CLIAgent` types to build a mapping of which CLI agents support which skill providers:
|
||||
|
||||
```
|
||||
CLIAgent::Claude → [SkillProvider::Claude]
|
||||
CLIAgent::Codex → [SkillProvider::Agents, SkillProvider::Claude, SkillProvider::Codex]
|
||||
CLIAgent::OpenCode → [SkillProvider::OpenCode, SkillProvider::Agents, SkillProvider::Claude]
|
||||
CLIAgent::Gemini → [SkillProvider::Agents, SkillProvider::Gemini]
|
||||
CLIAgent::Amp → [SkillProvider::Agents]
|
||||
CLIAgent::Copilot → [SkillProvider::Agents, SkillProvider::Copilot]
|
||||
CLIAgent::Droid → [SkillProvider::Droid, SkillProvider::Agents]
|
||||
CLIAgent::Unknown → [] (no skills shown)
|
||||
```
|
||||
|
||||
The `SkillSelectorDataSource` and `SlashCommandDataSource` (which also surfaces skills) need to filter results based on the active CLI agent's supported providers. When `CLIAgentSessionsModel::is_input_open()` is true, look up the active agent, get its supported providers, and filter out skills whose `ParsedSkill::provider` is not in the list. Non-native skills (including bundled Warp skills) are hidden entirely.
|
||||
|
||||
**Selection behavior**: No branching needed — all skills in the menu are natively supported, so the existing behavior of inserting `/{skill-name} ` works as-is.
|
||||
|
||||
## End-to-End Flow
|
||||
1. User types `/` in CLI agent rich input.
|
||||
2. Slash commands menu opens, showing only `/skills` command and natively supported skills (static commands filtered out).
|
||||
3. User selects a skill whose provider matches the active CLI agent.
|
||||
4. `/{skill-name} ` is inserted into the buffer.
|
||||
5. User types arguments and presses Enter → full text written to PTY.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
### Skills not appearing for a CLI agent
|
||||
If the `CLIAgent → SkillProvider` mapping is wrong or incomplete, users won't see their skills. Mitigation: the mapping is derived from existing `SkillProvider` and `SKILL_PROVIDER_DEFINITIONS` which are already used for skill discovery. Keep the mapping in sync with `skill_provider.rs`.
|
||||
|
||||
### `/skills` command filtered out
|
||||
The `/skills` command must be allowlisted when filtering static commands. If accidentally removed, users lose the skill browsing entry point. Mitigation: explicit allowlist check in `recompute_active_commands()`.
|
||||
|
||||
## Testing and Validation
|
||||
- Verify `/` opens the menu with only `/skills` and natively supported skills (no `/agent`, `/new`, etc.).
|
||||
- Verify only natively supported skills appear (e.g., `.claude/` skills for Claude Code, `.agents/` skills for Codex).
|
||||
- Verify non-native skills (including bundled Warp skills) are hidden from the CLI agent input menu.
|
||||
- Verify selecting a skill inserts `/{skill-name} ` for passthrough.
|
||||
- Verify all inserted content submits correctly to the PTY.
|
||||
- Verify no regressions in normal Warp agent input (slash menu and skills still work as before).
|
||||
|
||||
## Follow-ups
|
||||
- Surface native CLI agent slash commands (e.g., Claude Code's `/compact`, `/model`) in the menu (APP-3641).
|
||||
Reference in New Issue
Block a user