Expose Codex skills as ACP slash commands#279
Conversation
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 👍 / 👎.
There was a problem hiding this comment.
Addressed in 5c99d75.
The load path no longer computes a command snapshot and sends it later from a delayed task. After handle_load returns, the actor refreshes the skills cache and immediately emits AvailableCommandsUpdate from the current cache, so a stale pre-refresh command list cannot overwrite a newer slash menu. While rebasing onto current main/Codex rust-v0.133, I also removed the obsolete SkillsUpdateAvailable hook because that event is no longer present in the current Codex protocol, and updated image prompt test fixtures for the new detail field. Local validation is green: cargo fmt --all -- --check, cargo test --locked --lib, cargo check --locked, and cargo clippy --all-targets --all-features -- -D warnings.
05777ba to
5c99d75
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c99d75075
ℹ️ 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".
| let outcome = skills_manager | ||
| .skills_for_cwd(&input, /*force_reload*/ false, /*fs*/ None) | ||
| .await; | ||
| self.cached_skills = outcome.allowed_skills_for_implicit_invocation(); |
There was a problem hiding this comment.
Include explicit-only skills in slash command cache
This cache only keeps skills allowed for implicit invocation, but slash-command selection is an explicit invocation path and Codex still supports explicit $skill use when policy.allow_implicit_invocation: false (per the Codex skills docs). In that configuration an enabled skill is omitted from the ACP command list and /name is not rewritten to $name, so users who disable implicit activation for safety lose the new slash-command access entirely; cache enabled skills separately from the implicit-invocation filter.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 6bbb49f.
The load path now derives two caches from the current SkillLoadOutcome: all enabled skills are advertised through AvailableCommandsUpdate, while only implicit-allowed skills remain eligible for the /name -> $name rewrite bridge. That keeps explicit-only skills available in the ACP slash palette without bypassing their implicit-invocation policy. I also restored the delayed notification, but it now uses commands computed after refresh_skills() so it avoids the stale pre-refresh snapshot from the previous review.
Local validation is green: cargo fmt --all -- --check, cargo test --locked --lib, cargo check --locked, cargo clippy --all-targets --all-features -- -D warnings, and git diff --check.
5c99d75 to
6bbb49f
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bbb49f292
ℹ️ 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".
| self.cached_implicit_invocation_skills | ||
| .iter() | ||
| .find(|s| s.name == name) |
There was a problem hiding this comment.
Route explicit-only skill commands through
$
When a skill is advertised from cached_slash_command_skills but has policy.allow_implicit_invocation: false, it is intentionally absent from cached_implicit_invocation_skills, so selecting that visible ACP slash command falls through as literal /skill ... text instead of invoking the skill. Explicit-only skills still need explicit $skill invocation; otherwise every such advertised slash command is visible but non-functional for users who disable implicit matching.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 6a861ad.
You were right: ACP slash-command selection is explicit, so enabled explicit-only skills should be routed through Codex’s explicit $skill form. The cache now stores enabled skills for both slash-command visibility and /name -> $name rewriting. Disabled skills are still excluded, and builtin collisions still do not rewrite. Local validation is green: cargo fmt --all -- --check, cargo test --locked --lib, cargo check --locked, cargo clippy --all-targets --all-features -- -D warnings, and git diff --check.
6bbb49f to
6a861ad
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a861adf6e
ℹ️ 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".
| let rewritten_items = if self.skill_command_match(name).is_some() { | ||
| rewrite_slash_to_skill_invocation(name, &items) |
There was a problem hiding this comment.
Preserve skill path when invoking duplicate names
When two enabled skills share the same name (Codex allows multiple matching names from different roots), this rewrites the slash command to a plain $name mention. codex_core_skills::collect_explicit_skill_mentions only resolves plain $name when the name is unique, so selecting the advertised /name command in that case injects no skill at all. Route the cached SkillMetadata as a structured UserInput::Skill { name, path } (or a linked mention with the path) instead of only rewriting to $name.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 98f05da. Slash-invoked skills now rewrite to a structured UserInput::Skill { name, path } using the cached SkillMetadata instead of a plain $name text mention, so duplicate skill names preserve the matched SKILL.md path and avoid Codex’s ambiguous-name fallback. Arguments are preserved as a following text item, and non-text trailing inputs are still kept. Added a duplicate-name regression test. Validation is green: cargo fmt --all -- --check, cargo test --locked --lib, cargo check --locked, cargo clippy --all-targets --all-features -- -D warnings, and git diff --check.
6a861ad to
98f05da
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98f05dac1e
ℹ️ 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".
| let input = SkillsLoadInput::new( | ||
| self.config.cwd.clone(), | ||
| Vec::new(), |
There was a problem hiding this comment.
Include plugin skill roots when loading commands
When skills come from an enabled Codex plugin, this Vec::new() means the ACP command cache only loads repo/user/system roots, so those plugin skills are not advertised as slash commands and /plugin-skill is forwarded as plain text instead of the structured UserInput::Skill. Codex turns load plugin skills via the plugin manager's effective skill roots before calling the skills manager, so sessions with plugin-provided skills can use them through Codex but cannot select them from ACP's slash-command palette.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 111c996. CodexAgent now builds SkillsLoadInput with the plugin manager’s effective plugin skill roots for the session config and passes that into ThreadActor; refresh_skills uses that input instead of constructing one with Vec::new(). That keeps plugin-provided skills in the slash-command cache while preserving the structured UserInput::Skill { name, path } routing. Validation is green: cargo fmt --all -- --check, cargo test --locked --lib, cargo check --locked, cargo clippy --all-targets --all-features -- -D warnings, and git diff --check.
98f05da to
111c996
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 111c9968bc
ℹ️ 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".
| return; | ||
| }; | ||
| let outcome = skills_manager | ||
| .skills_for_cwd(input, /*force_reload*/ false, /*fs*/ None) |
There was a problem hiding this comment.
Load repo skills with a filesystem
In sessions rooted in a repository that defines local skills, e.g. .agents/skills/foo/SKILL.md or project-layer .codex/skills, this call never includes those skills in the ACP slash-command cache because SkillsManager only discovers repo/project skill roots when an ExecutorFileSystem is provided; with fs: None it only sees user/system/plugin roots. As a result /foo is neither advertised nor rewritten to a UserInput::Skill, even though Codex can otherwise discover the repo skill for the same cwd. Pass the local filesystem (or use the config-based loader with a filesystem) so cwd-scoped skills are included.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 4cb94d3. refresh_skills now uses the config-based skills loader with LOCAL_FS, so repo/project skill roots such as .codex/skills/.../SKILL.md are included in the slash-command cache. I added refresh_skills_loads_repo_skill_commands, which builds a temp repo-local skill and verifies /repo-helper is cached and advertised. Local validation is green: cargo fmt --all -- --check, cargo test --locked --lib (30 tests), cargo check --locked, cargo clippy --all-targets --all-features -- -D warnings, and git diff --check.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
111c996 to
4cb94d3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4cb94d39ea
ℹ️ 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".
|
@codex review |
4cb94d3 to
1e212ef
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e212ef6af
ℹ️ 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".
1e212ef to
6a056a6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a056a672a
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
6a056a6 to
e4c8dbb
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Would be great to have this merged |
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.
e4c8dbb to
7782e75
Compare
|
Rebased this onto current Validation after the rebase:
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
What's the status of this? |
|
Hi thanks for taking the time to dig in! |
Summary
Exposes Codex skills as ACP slash commands so clients such as Zed can surface them in the slash-command picker. Builtin commands remain first-class, and skill names that collide with builtins are skipped so
/init,/compact,/logout, and review commands cannot be shadowed.What changed
SkillsManagertoThreadActorand refreshes skill command metadata at session load.AvailableCommandsUpdateafter load using the current post-refresh cache, delayed briefly so clients have finished attaching the new/loaded session.policy.allow_implicit_invocation: false./skillto Codex's$skillform.builtin_command_names()for collision detection.Tests
28 lib tests pass.