Expose Codex skills as ACP slash commands#279
Conversation
Codex skills (loaded via SkillsManager) are now advertised to ACP clients
alongside the existing builtin slash commands. Selecting a skill rewrites
the leading "/name ..." text into Codex's implicit-skill form ("$name ...")
before submission, so invocation goes through the same implicit-skill path
the TUI uses when a user types `$` and picks a skill from the popup.
The cache is refreshed at session load and whenever Codex emits
EventMsg::SkillsUpdateAvailable; the latter is intercepted at the
ThreadActor level (not per-submission) and triggers a session-wide
AvailableCommandsUpdate. Skill names that collide with a builtin
(/init, /compact, /review, etc.) are dropped with a warning so a skill
cannot shadow a builtin.
Plugin-supplied skill roots are not yet threaded through — only
user/project/system skills appear today. Following PR can wire the
plugin outcome through to fully match the TUI's coverage.
References zed-industries#190.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05777bafd3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| drop(response_tx.send(result)); | ||
| self.refresh_skills().await; | ||
| let client = self.client.clone(); | ||
| let commands = self.available_commands(); |
There was a problem hiding this comment.
Send command updates from current cache, not a stale snapshot
ThreadMessage::Load snapshots self.available_commands() before the 200ms delayed task runs, so if a SkillsUpdateAvailable event arrives during that window, the actor first sends the fresh command list from handle_event and then overwrites it with this older snapshot. In practice this can make newly added/removed skills disappear from the slash menu until another skills event occurs. Recompute commands at send time (or avoid the delayed stale send) so updates are monotonic.
Useful? React with 👍 / 👎.
Summary
Adds support for invoking Codex skills via ACP slash commands. Selecting
/code-review(or any other locally-installed skill) in an ACP client's slash menu hands Codex the same$code-reviewtext its TUI would have produced when the user types$and picks the skill.Why
#190 asked for this. Today, ACP clients only see the hardcoded builtin slash commands. Users who have skills installed locally (
~/.codex/skills/<name>or project-level.codex/skills/) can't access them from Zed (or any other ACP client), even though Codex itself loads them at session start and the model can already invoke them via implicit-skill detection.How
ThreadActornow carries anOption<Arc<SkillsManager>>and acached_skills: Vec<SkillMetadata>.Loadand on everyEventMsg::SkillsUpdateAvailable, the cache is refreshed viaSkillsManager::skills_for_cwdand a freshAvailableCommandsUpdateis emitted with builtins + skills merged.SkillsUpdateAvailableis intercepted at theThreadActorlevel (not per-submission) so the slash menu refresh is session-scoped rather than tied to an in-flight prompt.\$name <rest>and submitted as a normalOp::UserInput. Codex'sdetect_implicit_skill_invocation_for_commandpicks them up the same way it does for TUI-typed\$namementions, so no new Codex-side surface is needed.tracing::warn!so a skill can't shadow/init,/compact,/review, etc.Known gap
Plugin-supplied skill roots aren't threaded through yet —
effective_skill_rootsis passed asvec![]. Only user/project/system skills appear in the menu today; plugin-distributed skills do not. A follow-up PR can wire the plugin outcome through to match the TUI's coverage exactly. The hooks are all in place; this is mechanical work waiting on a pattern decision (call into a Codex-side helper vs. replicate the plugin resolution here).Tests
/name→\$namerewrite helper covering with-args, no-args, multi-item prompts, leading-image prompts, and whitespace handling.cargo test).Manual verification
Built locally with
cargo build --release, pointed Zed at the binary viaagent_servers.codex-acp.command, opened a Codex thread, and confirmed user-level + system skills appear in the slash menu alongside the builtins. Invoked one and saw the skill execute as expected.References #190.