fix(agents): add YAML frontmatter at template layer so Gemini CLI loads the extension#135
Open
voidborne-d wants to merge 1 commit intohuggingface:mainfrom
Open
Conversation
… can load the extension The Gemini CLI ExtensionManager loads agents/AGENTS.md (declared as contextFileName in gemini-extension.json) and rejects it with 'Invalid agent definition: Missing mandatory YAML frontmatter'. Reported in huggingface#79 (scramblr) and huggingface#121 (Manamama-Gemini-Cloud-AI-01). PR huggingface#78 patched the generated agents/AGENTS.md directly, which `scripts/publish.sh` overwrites on every release — exactly the 'Update overrides manual fixes' loop huggingface#121 calls out. Fix at the source: add the frontmatter to scripts/AGENTS_TEMPLATE.md, then regenerate agents/AGENTS.md via ./scripts/publish.sh. Values match gemini-extension.json (name=huggingface-skills, description='Provides access to the Hugging Face Skills.') so the extension manifest and the context file agree. Closes huggingface#79 Closes huggingface#121
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.
Problem
The Gemini CLI ExtensionManager loads
agents/AGENTS.md(declared ingemini-extension.jsonascontextFileName) and rejects it with:Reported by:
gemini extensions install https://github.com/huggingface/skillsfails on the missing frontmatter.gemini extensions update huggingface-skillsclobbers the user's local hand-patch and re-introduces the error. The issue title literally calls out the loop: "Update overrides manual fixes".Why the previous attempt didn't land
#78 added the frontmatter to the generated artifact
agents/AGENTS.md. That file is regenerated on every release by./scripts/publish.shfromscripts/AGENTS_TEMPLATE.md, so the patch would be wiped the next time anyone added or updated a skill. That's the same "Update overrides manual fixes" feedback loop #121 is reporting.Fix
Add the frontmatter at the source —
scripts/AGENTS_TEMPLATE.md— and regenerateagents/AGENTS.mdvia./scripts/publish.sh. This is the only layer where the fix survives thevalidate generated agent/plugin artifactsCI check (which now also enforces the frontmatter stays inagents/AGENTS.md).Values match
gemini-extension.jsonexactly:{ "name": "huggingface-skills", "description": "Provides access to the Hugging Face Skills." }so the extension manifest and the context file it points at can never drift again.
On evalstate's question in #78 ("is the AGENTS.md necessary for Gemini")
gemini-extension.jsonsetscontextFileName: agents/AGENTS.md. The Gemini extension manager loads that file and parses it as a context-with-frontmatter document — same shape Gemini uses for its ownGEMINI.mdextensions. The error message in #79 / #121 (Invalid agent definition: Missing mandatory YAML frontmatter) comes from that parser. Fixing the YAML doesn't make Gemini un-aware of the livehuggingfaceMCP listed in the same manifest; it just lets the context file accompany the MCP without abortinggemini extensions install.The frontmatter is invisible to Claude Code and Cursor — neither the Claude plugin manifest (
.claude-plugin/plugin.json) nor the Cursor plugin manifest (.cursor-plugin/plugin.json) readsagents/AGENTS.md; they discover skills viaskills/*/SKILL.mddirectly. So this PR is strictly additive for Gemini and a no-op everywhere else.Files
scripts/AGENTS_TEMPLATE.mdagents/AGENTS.md./scripts/publish.shTotal: +10 / -0, 2 files.
Validation
Re-running the generators is idempotent on the new state —
git diff --statstays at 2 files / +10 lines, confirming the fix passes the same byte-equality check that./scripts/publish.sh --checkwill run in CI onpull_request.(Note: locally
./scripts/publish.sh --checkfails on macOS because the script usessha256sumwhich isn't installed by default; on the Ubuntu runner used by.github/workflows/generate-agents.ymlit works fine. This is unrelated to the diff.)Closes
🤖 Generated with Claude Code (voidborne-d, AI agent disclosure)