-
Notifications
You must be signed in to change notification settings - Fork 43
🤖 feat: expose agent skills as slash commands #1673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83660201e7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
468acc6 to
8723047
Compare
|
@codex review Addressed review comment: skill discovery now forwards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0d0128731
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review Addressed follow-up review comment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e18e030e09
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review Fixed Codex comment: avoid duplicating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24fe91c9dc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24fe91c9dc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review Fixed |
c9deb17 to
ef0eeff
Compare
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
17cb606 to
82b52db
Compare
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82b52db944
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
17dc5eb to
24dedc1
Compare
|
@codex review Addressed: honor disableWorkspaceAgents when resolving agent-skill snapshots (AgentSession now resolves skills from projectPath when workspace agents are disabled; added unit coverage). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24dedc12f4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
f007d0a to
e3e7a9e
Compare
|
@codex review Also preserved disableWorkspaceAgents when queuing compaction continue messages (and added coverage). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3e7a9ecf6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45da2d4ae6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Change-Id: I55eed13ec907180d9526df43e945e3e6fbda52e5 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I95c996c0d23c7025ada4a5689cf50ba798a4f485 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I02c5eb492aa2c6ab8bfbdbec1342294fda663396 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: Ieca203f2a1cd456dab7b50f6fbe9acd3abe305a1 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: Ic80b33dc4ab431bc97100a293f031436af4b5aa9 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: Id856c06b6b75f3dbfb28fc2e7b60231e9c8b9bcd Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: Ie3201a314e2c2b804a103c0437a0c1964baea5df Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I5c7323a6734201ca19b83a82c0885a381141a05d Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I58d46699537fb3139a40c96d775ef39d0646a2ca Signed-off-by: Thomas Kosiewski <tk@coder.com>
- Convert `/init` from a hardcoded slash command into a built-in agent skill.
- Allow `/{skill-name}` invocations with no trailing message (send a tiny default message).
- Update project “Initialize” banner to send `/init`.
- Document built-in skill precedence + `/init` override behavior.
Signed-off-by: Thomas Kosiewski <tk@coder.com>
---
<details>
<summary>📋 Implementation Plan</summary>
- Remove `/init` from the hardcoded slash-command registry + ChatInput branching.
- Treat `/init` as a normal **built-in agent skill** (discovered via `agentSkills.list`).
- Allow invoking a skill with **no trailing message** (e.g. `/init`) so it can fully replace “macro” slash commands.
- **Registry**: `/init` is a hardcoded slash command (`initCommandDefinition`) in `src/browser/utils/slashCommands/registry.ts`, parsed as `{ type: "init" }`.
- **UI special-case**: `src/browser/components/ChatInput/index.tsx` intercepts `parsed.type === "init"` and replaces the input text with `src/browser/assets/initMessage.txt` (`?raw`).
- **Project banner**: `src/browser/components/ProjectPage.tsx` restores the same text and auto-sends it; it also flips project-scope agent mode to `exec`.
- **Backend**: no special handling—`/init` ultimately becomes a normal user message containing a large prompt (currently wrapped in `<system>…</system>`).
- `src/browser/components/ChatInput/index.tsx`
- Imports `initMessage` from `@/browser/assets/initMessage.txt?raw`.
- Two `/init` special-cases: `handleSend` checks `parsed?.type === "init"` in both the **creation** path (~line 1402) and **workspace** path (~line 1567).
- Two “skill invocation requires trailing message” toasts:
- **Creation** skill path: toast around ~line 1421.
- **Workspace** skill path: toast around ~line 1496.
- `src/browser/components/ProjectPage.tsx`
- Imports `initMessage` from `@/browser/assets/initMessage.txt?raw` and uses it in the Agents init banner flow.
- `src/browser/utils/slashCommands/registry.ts`
- Defines `initCommandDefinition` and registers it.
- `src/browser/utils/slashCommands/types.ts`
- Includes `{ type: "init" }` in `ParsedCommand` union.
- `src/browser/utils/slashCommands/parser.test.ts`
- Contains tests asserting `/init` parses to `{ type: "init" }`.
**Net LoC estimate (product code only): ~+30–80**
Core idea: make `init` a built-in skill and invoke it like any other skill. To support `/init` with no extra text, we must avoid sending an empty message because `AgentSession.sendMessage` rejects empty messages.
When the user invokes a skill with no trailing message, send a tiny default message (while still displaying the raw command via `muxMetadata.rawCommand`). Example:
- Raw input: `/init`
- Message sent to backend: `Run the "init" skill.`
- `muxMetadata`: `{ type: "agent-skill", rawCommand: "/init", skillName: "init", scope: "built-in" }`
This keeps the system general (no `/init` special casing) and satisfies the backend’s non-empty constraint.
Skill resolution already supports overrides in this order:
1. **Project**: `.mux/skills/<name>/SKILL.md`
2. **Global**: `~/.mux/skills/<name>/SKILL.md`
3. **Built-in**: `src/node/builtinSkills/<name>.md`
So yes—once `init` is shipped as a built-in skill, a user can override it by creating `~/.mux/skills/init/SKILL.md` (and a project can override that via `.mux/skills/init/SKILL.md`).
<details>
<summary>Tradeoff</summary>
This changes `/init` from an editable “template prefill” into an immediate command. If we still want editability later, we can add a separate “insert skill into input” UI affordance, but that’s not required for this cleanup.
</details>
1) **Allow skills to be sent without a message (creation + workspace ChatInput)**
- In `src/browser/components/ChatInput/index.tsx`, update both “unknown slash command → agent skill” paths:
- **Creation path** (~line 1421): remove the “Please add a message after /{skill}” toast + early return.
- **Workspace path** (~line 1496): same.
- If trailing text is empty, send a synthetic default message, e.g.
```ts
const userText = afterPrefix.trimStart() || `Run the "${skillName}" skill.`;
```
- Keep setting `muxMetadata = { type: "agent-skill", rawCommand: messageText, ... }` so the UI shows the original `/skill` (not the synthetic message).
2) **Add built-in skill `init`**
- Create `src/node/builtinSkills/init.md` (frontmatter: `name: init`, description matching current `/init`).
- Move/copy the existing `src/browser/assets/initMessage.txt` content into the skill body (keep as-is initially for minimal behavior change).
- Regenerate bundled skill content (`scripts/gen_builtin_skills.ts` → `builtInSkillContent.generated.ts`).
- Notes / gotchas:
- Frontmatter must start at the very top of the file (`---` as first bytes).
- Keep skill content < 1MB.
3) **Remove `/init` as a hardcoded slash command + UI branch**
- Delete `initCommandDefinition` from `src/browser/utils/slashCommands/registry.ts`.
- Remove `{ type: "init" }` from `src/browser/utils/slashCommands/types.ts`.
- Remove the `parsed.type === "init"` branches in `ChatInput` (both creation + workspace).
- Update/remove `/init` parsing expectations in `src/browser/utils/slashCommands/parser.test.ts`.
- Result: `/init` will be parsed as an unknown command and then resolved via `agentSkills.list` as a skill.
4) **Update the project “Initialize” banner to invoke the skill**
- In `src/browser/components/ProjectPage.tsx`:
- Replace `restoreText(initMessage)` with `restoreText("/init")` (and keep the auto-send behavior).
- Keep the existing “switch project-scope mode to exec” behavior.
5) **Remove the old browser asset**
- Delete `src/browser/assets/initMessage.txt` and remove its imports once no longer referenced.
6) **Docs**
- Update docs to reflect that `/init` is now just the `init` skill (and can be overridden by users/projects via `~/.mux/skills/init/SKILL.md` / `.mux/skills/init/SKILL.md`).
7) **Validation checklist**
- Typing `/init` and hitting send triggers the init skill (no “empty message” backend error; no “add a message” toast).
- Project page “Initialize” banner still runs init automatically.
- `/init` appears once in suggestions (as a skill, not a hardcoded command).
- Other skills still work both with and without trailing messages.
**Net LoC estimate (product code only): ~+20–60**
Keep “prefill editable template” UX, but fetch the template body from `agentSkills.get("init")` instead of a browser asset.
Tradeoff: still requires `/init`-specific behavior (or introducing a generalized “insert skill into input” feature).
<details>
<summary>Follow-up: reduce other “prompt template” slash commands</summary>
Once skills can be invoked with no trailing message, we can eliminate other *macro-style* slash commands by applying the same pattern:
- Move the instruction text into `src/node/builtinSkills/<name>.md`.
- Remove the hardcoded command definition + `ChatInput` branch.
- Let `/<name>` resolve via `agentSkills.list`.
Keep hardcoded slash commands only for **UI/backend actions** (clear history, model/provider settings, MCP management, etc.).
</details>
</details>
---
_Generated with `mux` • Model: `openai:gpt-5.2` • Thinking: `xhigh` • Cost: $30.06_
Change-Id: Iaf4c066db3fc75bf52993552b2d0d6ee9655bb28
Change-Id: I3d44a0e733613e52933e13928200d994158a7aa6 Signed-off-by: Thomas Kosiewski <tk@coder.com>
45da2d4 to
a18d2a7
Compare
Change-Id: I4c7d46ae84d02756979d6fe2a0897183699887ce Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: Ie4321554355e5a1f8bcf83b88400fe3b5b805196 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review Rebased onto latest origin/main and CI is green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94bdbb8b82
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Change-Id: I4959d46c388d7e2a3917c61d702119b8d534dfa9 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review Addressed: prevent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e99edf335
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Change-Id: I8c1e7241f8e93d8ed67051f4881c1b3da7c12c5f Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review Addressed: when invoking a project-scoped agent skill during workspace creation, we now pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c72a17305
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Change-Id: Ic1209de000b69724b0ddff25cadaafb6aa8241d5 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review Addressed: guard |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Expose Agent Skills as slash commands.
agentSkills.list/agentSkills.getoRPC endpoints so the UI can discover/read skills./autocomplete and supports/skill-name <message>to apply a skill for that send.additionalSystemInstructionsand annotates the message withmuxMetadataso history shows the original/skill-name ...text.Validation:
bun test src/browser/utils/slashCommands/suggestions.test.tsbun test src/cli/server.test.tsmake static-check📋 Implementation Plan
Plan: Expose Agent Skills as Slash Commands
Goal
Make Agent Skills discoverable and invokable via the chat slash command UX (type
/→ autocomplete), so a user can explicitly apply a skill and have it included in the model context for that send.Recommended approach: “Skill-as-command” + per-send context injection
Net LoC estimate (product code only): ~350–550 LoC
UX / behavior
/suggestions list./{skillName}with description.(project),(user),(built-in))./{skillName} <their message>Implementation plan
1) Backend: expose Agent Skills over ORPC
src/common/orpc/schemas/api.ts:agentSkills.list→ returnsAgentSkillDescriptor[]agentSkills.get→ returnsAgentSkillPackagefor askillNameSkillNameSchema/AgentSkillDescriptorSchema/AgentSkillPackageSchemafromsrc/common/orpc/schemas/agentSkill.ts.src/node/orpc/router.ts:agentSkills.list: calldiscoverAgentSkills(runtime, discoveryPath).agentSkills.get: callreadAgentSkill(...)and returnresult.package.2) Frontend: fetch skill descriptors for suggestions
src/browser/components/ChatInput/index.tsxsimilarly to provider list:const [agentSkillDescriptors, setAgentSkillDescriptors] = useState<AgentSkillDescriptor[]>([])useEffect(() => api.agentSkills.list(...))workspaceId/projectPathchange.3) Slash suggestions: include skills
SlashSuggestionContext(src/browser/utils/slashCommands/types.ts) to accept skill descriptors:agentSkills?: AgentSkillDescriptor[].getSlashCommandSuggestions()(src/browser/utils/slashCommands/suggestions.ts) to merge:CommandSuggestionsUI (src/browser/components/CommandSuggestions.tsx) to visually distinguish skills:SlashSuggestionwithkind+rightLabel, or bake scope intodescription.4) Sending pipeline: parse + inject skill context
ChatInput/index.tsxsend handler:parseCommand(), detect/{skillName}as the first token (usingagentSkillDescriptors).api.agentSkills.get({ skillName, ...discoveryContext }).userMessageTextWithoutCommandadditionalSystemInstructionsthat wraps the skill content, e.g.:Agent Skill applied: {name} ({scope})package.bodyapi.workspace.sendMessage({ message, options: { ...sendMessageOptions, additionalSystemInstructions } }).muxMetadataso the transcript shows which skill was applied.5) Edge cases to handle
/{skillName}(no remainder message): intercept and avoid sending an empty message./{token}: fall back to existing behavior (normal slash command parse; else send as plain text).6) Tests
/{skillName} rest of messageagentSkills.listreturns descriptorsagentSkills.getreturns package + respects project/global precedenceNotes / rationale
buildAgentSkillsContext()), enabling model-initiated tool calls. This plan adds explicit user invocation + UI discoverability without changing the core tool-call mechanism.Generated with
mux• Model:openai:gpt-5.2• Thinking:xhigh• Cost: $1.29