🤖 feat: add coder-docs Mux agent skill with offline docs snapshot#21
Conversation
|
@codex review Initial PR for the coder-docs Mux agent skill. Adds a Go generator, shell update script, skill skeleton with licensing, and an initial docs snapshot from coder/coder. |
The coder/coder manifest.json uses arrays for the state field (e.g. ["beta"], ["premium"]), not plain strings. Changed the route.State type from string to []string and added a routeStateContains helper for the hidden check.
Snapshot from coder/coder@342d2e4bedf6 (2026-02-10). Text-only docs (~4.5MB), 415 routes in the docs tree.
f2c4503 to
b4fb1cf
Compare
|
@codex review Rebased onto main to resolve Makefile conflicts (new docs-* targets on main). All local checks pass. |
- Add package comment (revive) - Use 0o750 for directory permissions (gosec G301) - Use 0o600 for file write permissions (gosec G306) - Add nolint:gosec annotations for G304 (file paths from trusted CLI flags) - Regenerate snapshot with updated permissions
|
@codex review Fixed all lint issues: package comment, directory/file permissions, gosec nolint annotations. Regenerated snapshot. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4733c799d9
ℹ️ 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".
Block symlink traversal in syncDocsSnapshot to prevent copying files outside the docs root. Checks d.Type()&fs.ModeSymlink before copy.
|
@codex review Added symlink check in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3316cc34ec
ℹ️ 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".
- Replace symlink-only check with d.Type().IsRegular() to also skip FIFOs, sockets, and devices that could hang os.ReadFile. - Add git clean -fdx after reset --hard in the update script to remove untracked files from the local clone before snapshot generation.
|
@codex review Addressed both review comments:
|
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ 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". |
Summary
Adds a new Mux agent skill (
coder-docs) that bundles a text-only offline snapshot of thecoder/coderdocumentation, enabling future Mux instances to answer "how does Coder do X?" without pasting the entire docs corpus into context.Background
When working in this repo, agents frequently need to reference Coder's documentation (API behavior, deployment options, template authoring, etc.). Without a local skill, they either hallucinate or require expensive web fetches. This skill provides progressive-disclosure access through a generated navigation tree and ~4.5MB of committed Markdown docs.
Implementation
New files
hack/gen-coder-docs-skill/main.go— Go CLI tool (stdlib only) that:coder/coder/docs/(excluding images)manifest.jsonand renders a hierarchical docs treeSKILL.mdSNAPSHOT.jsonwith provenance metadatahack/update-coder-docs-skill.sh— Shell script that clones/updatescoder/coderintotmpfork/and runs the generator.mux/skills/coder-docs/SKILL.md— Skill definition with generated navigation tree (415 routes).mux/skills/coder-docs/NOTICE.md— Licensing attribution.mux/skills/coder-docs/LICENSE— AGPL-3.0 (upstream license).mux/skills/coder-docs/references/docs/— Committed snapshot (~4.5MB text-only)Modified files
Makefile— Addedupdate-coder-docs-skilltargetAGENTS.md— Added skill reference and update commandValidation
make build✅make test✅make verify-vendor✅GOFLAGS=-mod=vendor go vet ./...✅make update-coder-docs-skill✅ (end-to-end generation from upstream)Risks
Low risk — this is additive infrastructure (new skill + generator). No existing code paths are modified. The snapshot is committed but can be refreshed at any time via
make update-coder-docs-skill.📋 Implementation Plan
Plan: Convert
coder/coderdocs into a Mux Agent Skill (coder-docs)Context / Why
We want a project-local agent skill that gives Mux agents progressive-disclosure access to the
coder/coderdocumentation:.mux/skills/.../references/.mux-docsskill) so agents can quickly locate relevant pages.coder/coderinto this repo.This enables future Mux instances working in this repo to answer “how does Coder do X?” without pasting the entire docs corpus into context.
Evidence (what we verified)
tmpfork/mux/scripts/gen_builtin_skills.ts(injectsDOCS_TREEbetween<!-- BEGIN ... -->markers; bundles docs).coder/coderdocs are file-based Markdown with a machine-readable navigation tree:tmpfork/coder/docs/manifest.json(recursiveroutes[]withtitle,description,path, optionalchildren).tmpfork/coder/docs/install/index.md(Markdown with some inline HTML; no YAML frontmatter).tmpfork/coder/docsis ~89MB total, butdocs/imagesis ~85MB.images/) are ~4.5MB, which is feasible to commit into.mux/skills/.../references/.tmpfork/coder/LICENSEis AGPL-3.0. Vendoring docs requires intentional attribution/notice.Implementation details
1) Add a new skill directory:
.mux/skills/coder-docs/Create a new skill named
coder-docs:.mux/skills/coder-docs/SKILL.md.mux/skills/coder-docs/references/docs/(generated snapshot; committed)SKILL.md(template + generated sections)Keep the file mostly static, but with two generated blocks updated by the update script:
SNAPSHOTblock: what upstream commit this snapshot came from.DOCS_TREEblock: a hierarchical index derived fromdocs/manifest.json.Template skeleton:
rg -n "<keyword>" .mux/skills/coder-docs/references/docsSnapshot
Docs tree (auto-generated)
3) Add the generator helper:
hack/gen-coder-docs-skill/main.goImplement the JSON parsing + marker injection logic in Go (stdlib only) so it matches this repo’s primary language and avoids a Python runtime dependency.
Generator requirements (defensive by default)
SKILL.mdmarkers are missing or malformed.--source-docs-root→--dest-docs-root:manifest.json+ all**/*.md,images/and any non-markdown assets.manifest.jsonroute references a doc path that does not exist under--dest-docs-root(after sync).\r\n→\n) for deterministic diffs.go.mod/vendor/changes).Core logic sketch
Output:
DOCS_TREE:strings.Join(lines, "\n")afterrenderRoutes(manifest.Routes, 0, &lines, docsRoot).SNAPSHOT: short Markdown block like:Upstream: coder/coder@<sha>Generated: <RFC3339 timestamp>4) Make it easy to run: add a Makefile target
Add a convenience target:
5) Make it discoverable (optional but recommended)
README.md(orAGENTS.md) with a short “Mux skills” note:coder-docsmake update-coder-docs-skill6) Licensing / attribution
Because
coder/coderis AGPL-3.0:.mux/skills/coder-docs/NOTICE.mddescribing:.mux/skills/coder-docs/LICENSE) so the vendored-docs subtree is self-describing.Why call this out?
Vendoring content across repositories can have license implications. This plan keeps the skill directory explicit about provenance and license so downstream consumers are not surprised.
Validation / Acceptance Criteria
After implementation (Exec mode):
make update-coder-docs-skill..mux/skills/coder-docs/SKILL.mdcontains populatedSNAPSHOT+DOCS_TREEblocks..mux/skills/coder-docs/references/docs/manifest.jsonexists..mux/skills/coder-docs/references/docs/install/docker.mdexists..mux/skills/coder-docs/references/docs/images/should not exist.manifest.jsonpathexists underreferences/docs/.agent_skill_read({ name: "coder-docs" })works.agent_skill_read_file({ name: "coder-docs", filePath: "references/docs/install/index.md" })returns content.Success looks like: a committed
.mux/skills/coder-docsdirectory with a small (~5MB) text snapshot + deterministic index, and a single update script that can refresh it from upstream.Generated with
mux• Model:anthropic:claude-opus-4-6• Thinking:xhigh• Cost:$1.41