Skip to content

fix: avoid duplicate Codex skill discovery#236

Open
shichangs wants to merge 2 commits intogarrytan:mainfrom
shichangs:codex/fix-codex-duplicate-skills
Open

fix: avoid duplicate Codex skill discovery#236
shichangs wants to merge 2 commits intogarrytan:mainfrom
shichangs:codex/fix-codex-duplicate-skills

Conversation

@shichangs
Copy link

@shichangs shichangs commented Mar 20, 2026

Summary

Fix duplicate Codex skill discovery when gstack is installed directly into ~/.codex/skills/gstack.

This changes the Codex setup flow so we no longer expose the full repo under the Codex skills root, which was letting Codex recursively discover both:

  • source skill directories in the repo checkout
  • generated Codex skills linked at the top level

That produced duplicate entries in the skill picker because both copies shared the same name: frontmatter.

What changed

  • migrate direct Codex installs from ~/.codex/skills/gstack to ~/.gstack/repos/gstack during ./setup --host codex
  • create a minimal ~/.codex/skills/gstack runtime root instead of symlinking the whole repo
  • keep only the runtime assets Codex skills actually need in that runtime root:
    • root SKILL.md
    • bin/
    • browse/bin
    • browse/dist
    • gstack-upgrade/SKILL.md
    • review/checklist.md, review/design-checklist.md, review/greptile-triage.md, review/TODOS-format.md (individual files, not the whole review/ dir which contains its own SKILL.md)
  • update the Codex install docs to recommend cloning outside ~/.codex/skills
  • add setup validation tests that lock in the new layout and migration behavior

Why this fixes the issue

Codex scans ~/.codex/skills recursively. Before this change, a direct install left the full gstack repo under ~/.codex/skills/gstack, so Codex could discover both the source SKILLs and the generated gstack-* Codex skills.

After this change:

  • generated Codex skills still live at the top level in ~/.codex/skills
  • ~/.codex/skills/gstack is now only a runtime sidecar, not a second discoverable skill tree
  • review assets are symlinked as individual files (not the whole review/ dir) to avoid re-introducing duplicate discovery via review/SKILL.md

That removes the duplicate discovery path without changing the absolute paths referenced by generated Codex skills.

Testing

Automated

  • bash -n setup
  • bun test test/gen-skill-docs.test.ts ✅ (88 tests pass)
  • bun run gen:skill-docs --dry-run
  • bun run gen:skill-docs --host codex --dry-run

Manual regression

  • direct-install scenario:
    • cloned gstack into ~/.codex/skills/gstack
    • ran ./setup --host codex
    • verified setup migrated the repo to ~/.gstack/repos/gstack
    • verified ~/.codex/skills/gstack became a minimal runtime root
    • verified generated gstack-* Codex skills were linked at the top level
  • normal-install scenario:
    • cloned gstack into a normal directory outside ~/.codex/skills
    • ran ./setup --host codex
    • verified the same clean Codex layout was produced

Not run

  • bun run test:e2e
  • bun run test:evals

These remain gated by the project's Tier 2 / Tier 3 eval setup.

Closes #235

liaoshichang02 and others added 2 commits March 20, 2026 13:59
Migrate direct ~/.codex/skills/gstack installs into ~/.gstack/repos/gstack during setup.\n\nCreate a minimal Codex runtime root that only exposes runtime assets and generated SKILL.md files so Codex no longer discovers duplicate source skills recursively.
Generated Codex skills (review, ship, plan-ceo-review, plan-eng-review)
reference checklist.md, design-checklist.md, greptile-triage.md, and
TODOS-format.md under .agents/skills/gstack/review/. Symlink these
individual files instead of the whole review/ dir (which contains
SKILL.md and would re-introduce duplicate discovery).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shichangs
Copy link
Author

@wmzhai @garrytan This PR is ready for review. It fixes the duplicate Codex skill discovery issue (#235) by:

  1. Migrating direct ~/.codex/skills/gstack installs to ~/.gstack/repos/gstack
  2. Creating a minimal runtime root that only exposes the specific assets Codex skills need
  3. Symlinking review assets as individual files (not the whole review/ dir) to avoid re-introducing duplicates via review/SKILL.md

@wmzhai — could you verify this fixes the duplicate skills you were seeing? After pulling, run ./setup --host codex and check the Codex skill picker.

@shichangs
Copy link
Author

@garrytan Friendly ping — this is ready for review. No conflicts with main, tests included. Happy to adjust anything.

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.

Codex: duplicate skills appear because setup installs nested SKILL.md sidecars under ~/.codex/skills/gstack

1 participant