fix(compile): stop writing the same skill twice for agents that read .agents/skills - #113
Merged
Merged
Conversation
….agents/skills A repo with both .agents/ and .github/ (or .gemini/) got byte-identical SKILL.md files in both places — the exact duplication the comment beside the agents adapter claimed could not happen. Its narrow detection only covers the case where .agents/ is absent, not the common one where a repo has it and a native skills directory too. The duplicate is never harmless, and it fails differently per client: Copilot searches .github/skills first and dedupes by name, so the .agents copy was silently ignored; Gemini CLI loads the .agents alias after .gemini/skills, overrides it, and prints "Skill conflict detected" for every duplicated name — noise kitbash itself was causing; Codex dedupes root paths but not skill names, so it loaded the skill twice. copilot and gemini now yield to .agents/skills/ when it is written, with a note saying so, and a copy left by an earlier version is pruned on the next compile. A repo without .agents/ is unaffected — copilot still gets .github/skills/, because the dedup must never cost an agent its only copy. Also corrects two claims in that comment that were never verified: .agents/skills is not Codex's only repo path (<repo>/.codex/skills also loads at repo scope), and Roo, Amp, OpenCode and Antigravity were listed as readers without being checked. The readers now named — Codex, Copilot, Gemini CLI, Cursor, Zed, Cline — were each confirmed against that client's own source or docs. The benchmark harness read copilot and gemini from their own skills dirs, which are no longer written when the shared path serves them; it now reads the path that serves them. Published numbers are unchanged, the bytes being identical. Adds 7 tests. 0.22.0.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by a reader on a launch thread raising "context contamination" — inactive instructions parked in context. Checking it against our own output turned up a real duplication bug.
The bug
A repo with both
.agents/and.github/(or.gemini/) got byte-identicalSKILL.mdfiles in both places — the exact duplication the comment beside theagentsadapter claimed could not happen:That narrow detection only covers the case where
.agents/is absent, not the common one where a repo has it and a native skills directory.Why the duplicate is never harmless
Verified against each client's own source/docs:
.github/skillsfirst, dedupes by name → the.agentscopy is silently ignored.agentsalias after.gemini/skills, overrides it, and printsSkill conflict detectedper duplicated name — noise we were causingFix
copilotandgeminiyield to.agents/skills/when it's written, with a note. A copy left by an earlier version is pruned on the next compile.A repo without
.agents/is unaffected — Copilot still gets.github/skills/. The dedup must never cost an agent its only copy, and that's tested.Two unverified claims corrected
The same comment asserted things nobody had checked:
.agents/skillsis not Codex's only repo path —<repo>/.codex/skillsalso loads at repo scope.The readers now named (Codex, Copilot, Gemini CLI, Cursor, Zed, Cline) were each confirmed against that client's own source or documentation.
Benchmark
The harness read Copilot/Gemini cost from their own skills dirs, which are no longer written when the shared path serves them — it crashed, and my first check masked it (
>/dev/null+git diff --exit-coderead a failed run as "no change"). Now it reads the path that actually serves them. Published numbers are unchanged, the bytes being identical.7 new tests; two existing assertions updated because they encoded the old duplicated behavior. Suite, typecheck, site
--checkand bench gate green. Ships as 0.22.0.