Skip to content

Embed agent skills synced from muxinc/mux-skills - #72

Open
Joshalphonse wants to merge 14 commits into
mainfrom
embed-agent-skills
Open

Joshalphonse wants to merge 14 commits into
mainfrom
embed-agent-skills

Conversation

@Joshalphonse

@Joshalphonse Joshalphonse commented Jul 23, 2026 •

Copy link
Copy Markdown
Collaborator

What this does

Ships Mux's docs-discovery agent skill inside the CLI binary and keeps it in sync with muxinc/skills automatically.

  • skill/ — vendored copy of the mux-docs agent skill (~5KB of instruction markdown). No docs content ships — the skill routes agents to live docs at mux.com/llms.txt at answer time, so answers always reflect today's published docs.
  • scripts/generate-embedded-skills.ts — embeds skill/ as string constants (src/lib/embedded-skills.gen.ts) so compiled binaries carry the skill with zero runtime dependencies. A test fails CI if the generated module drifts from skill/.
  • mux skills path — writes the embedded skills to $XDG_DATA_HOME/mux/skills/ and prints their paths as JSON for agents.
  • mux skills install — copies them into ~/.claude/skills/ (or --dir <path>), where Claude Code auto-loads them with no per-project setup.
  • mux skills update — refreshes all local copies to match the installed CLI and reports when a newer release is available (skills are release-pinned by design).
  • mux docs find <query> — searches the live docs index (mux.com/llms.txt) CLI-side and prints only matching page URLs, so agents locate pages without reading the 206-entry index into context (~50 tokens instead of ~5,000). No docs stored locally; llms-full.txt excluded from results.
  • Root help breadcrumb — mux --help carries an "Agent support" note so any agent discovers the skills unprompted.
  • .github/workflows/sync-skills.yml — on a daily cron (plus manual dispatch), pulls muxinc/skills, re-syncs skill/, regenerates, tests, and opens a PR only when content changed. The skills repo is public, so no cross-repo token is needed. It copies whatever skills the upstream repo publishes, so adding skills later requires no CLI changes. Source commit recorded in skill/manifest.json.

Verification

  • 828 tests pass, biome clean
  • Compiled-binary smoke test: skill embeds and materializes byte-perfect
  • End-to-end agent test: a Claude Code session with no configuration discovered the skills via the help breadcrumb, followed the conventions, and cited live docs

🤖 Generated with Claude Code


Note

Low Risk
Additive CLI surface (filesystem writes under XDG/~/.claude/skills and read-only fetches to mux.com); no changes to API auth or credential handling.

Overview
Ships routing agent skills inside the CLI (starting with mux-docs from muxinc/skills) and wires first-class commands so agents can discover Mux docs without vendoring documentation.

The skill/ tree is compiled into embedded-skills.gen.ts via generate:skills; tests enforce parity with on-disk skill/. mux skills exposes path (materialize under XDG data + JSON paths), install (default ~/.claude/skills), and update (refresh local copies and nudge CLI upgrades). mux docs find fetches mux.com/llms.txt, searches CLI-side, and returns page URLs only (excluding llms-full.txt). Root help now includes an agent-support breadcrumb.

A daily GitHub Action (sync-skills.yml) allowlists mux-docs, copies from public muxinc/skills, regenerates the embed, runs tests, and opens a PR when content changes. Biome ignores *.gen.ts.

Reviewed by Cursor Bugbot for commit 81e1411. Bugbot is set up for automated code reviews on this repo. Configure here.

Note: the skills source is muxinc/skills#1, which adds the mux-docs skill and plugin marketplace to the canonical skills repo. The sync workflow uses an allowlist (mux-docs) since that repo also publishes skills with vendored reference docs that the CLI intentionally does not embed.

files.push(destination);
}
return { dir: targetDir, files };
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale skills left on disk

Medium Severity

materializeSkills and installSkills only overwrite files that still exist in the embed. They never remove skill directories or reference files that disappeared in a newer CLI build, so a refresh cannot make the on-disk copy match. For mux skills install, Claude Code would keep auto-loading those obsolete skills.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a2819b9. Configure here.

Comment thread .github/workflows/sync-skills.yml Resolved
export function hasInstalledSkills(
targetDir: string = getDefaultAgentSkillsDir(),
): boolean {
return listSkills().some((skill) => existsSync(join(targetDir, skill.path)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update misses renamed skills

Medium Severity

hasInstalledSkills only looks for paths from the current embedded skill set. After a rename or full replace in a later CLI release, mux skills update treats ~/.claude/skills as unset, skips installSkills, and tells the user no copy was found—even when the old skill directory is still there and Claude Code still loads it.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit dda5b08. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread src/commands/docs/find.ts
.arguments('<query...:string>')
.option('--limit <n:number>', 'Maximum number of results', { default: 5 })
.option('--json', 'Output JSON instead of pretty format')
.action(async (options: DocsFindOptions, ...query: string[]) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variadic query args mishandled

High Severity

Cliffy passes a named variadic &lt;query...&gt; as one string[] argument. Capturing it with a rest parameter nests that array, so query.join(' ') turns mux docs find live streaming into the single term live,streaming and search returns no matches. The same pattern in assets create uses .flat() for this reason.

Suggested change
.action(async (options: DocsFindOptions, ...query: string[]) => {
.action(async (options: DocsFindOptions, query: string[]) => {
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 355edb4. Configure here.

uses: actions/checkout@v4
with:
repository: muxinc/skills
path: .skills-src

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shallow clone empties skills SHA

High Severity

actions/checkout defaults to fetch-depth: 1, but the sync step runs git log with a pathspec to find the last commit that touched the allowlisted skills. In a shallow clone that returns empty whenever HEAD did not touch those paths, so skill/manifest.json gets "commit": "" and the embedded-skills test fails. Weekly cron and manual dispatch are especially exposed.

Suggested change
path: .skills-src
- name: Check out muxinc/skills
uses: actions/checkout@v4
with:
repository: muxinc/skills
path: .skills-src
fetch-depth: 0
Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 355edb4. Configure here.

Joshalphonse and others added 14 commits October 26, 2026 13:43
Adds a skill/ directory vendored from muxinc/skills, a codegen script that
embeds the files as string constants so compiled binaries carry them, and a
mux docs path command that writes the skills to the XDG data directory and
prints their paths for agents.

A sync-skills workflow keeps skill/ current: muxinc/skills sends a
repository_dispatch on skill changes (weekly cron as backstop) and the
workflow opens a PR only when content changed, recording the source commit
in skill/manifest.json.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mux docs install copies the embedded agent skills into an agent skills
directory (default ~/.claude/skills, which Claude Code auto-loads), so
developers get skill discovery with no CLAUDE.md or AGENTS.md changes.
The root help now carries an Agent support note pointing at mux docs
path and mux docs install, giving any agent that runs --help a
zero-config discovery path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The command locates and installs agent skills; docs themselves are never
shipped, so the old name was misleading. Also matches what agents guess
unprompted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Refreshes the data-directory copy and any ~/.claude/skills install to
match the installed CLI, then checks the npm registry (reusing the
update-notifier helpers) and advises upgrading when a newer release is
available. Skills stay release-pinned: the freshest copy always comes
from upgrading the CLI, keeping skill text in lockstep with the binary
whose commands it documents.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The general mux skill duplicated mux-docs routing; the CLI and clipping
skills are parked upstream for now. The sync workflow copies whatever
skills muxinc/mux-skills publishes, so re-adding them later requires no
CLI changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
muxinc/skills is the canonical public skills repo. The sync workflow now
uses an explicit allowlist (mux-docs) because that repo also publishes
skills with vendored reference docs, which the CLI intentionally does
not embed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fetches mux.com/llms.txt, searches it CLI-side, and prints only the
matching page URLs, so agents locate a docs page without reading the
206-entry index into context. llms-full.txt is excluded from results.
No docs are stored locally. The embedded mux-docs skill now prescribes
a cost-ordered fetch workflow that uses this command first.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
muxinc/skills never had the CLI_SYNC_TOKEN its notify workflow needed, so
the dispatch failed on every push and nothing reached this repo. The skills
repo is public, so pulling needs no cross-repo token, and embedded skills
only reach users in a tagged release, so a daily pull loses nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The skills generator emits JSON.stringify output (double quotes, unwrapped
lines), which failed the format check on every run. The file is
regenerated by the sync workflow and guarded by the drift test in
embedded-skills.test.ts, so formatting it adds nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 5 total unresolved issues (including 4 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 81e1411. Configure here.

Comment thread src/commands/docs/find.ts
JSON.stringify({ query: query.join(' '), results }, null, 2),
);
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent mode skips JSON output

High Severity

The new docs find and skills commands check options.json instead of wantsJson, so --agent still prints human-formatted output. The embedded skill tells agents to run mux docs find with --agent, which never injects --json, and success output then diverges from JSON errors already produced via handleCommandError.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 81e1411. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant