fix(agents): 1.6 — agent frontmatter alignment (name, model, color, description)#56
Conversation
…eck fixes
Bug 1 — arithmetic (((n++)) with set -e):
Replace all 18 ((n++)) with n=$((n+1)) to prevent premature script exit.
((n++)) returns exit code 1 when n=0 (post-increment evaluates to 0 = false);
set -e treats this as failure and aborts the script before counting is complete.
Pattern already applied in validate-hook-schema.sh; now consistent.
Bug 2 — SIGPIPE in tail | grep -q:
Replace `tail -n +2 | grep -q '^---$'` with `grep -c` check.
grep -q exits immediately on first match while tail is still writing; with
set -o pipefail, tail's SIGPIPE exit (141) propagates as pipeline failure.
The `if !` inversion converts this to a false positive "Frontmatter not
closed" for any agent where the closing --- appears before tail finishes.
grep -c reads all input before exiting, eliminating the race condition.
Affects locally: all plugin-dev agents (177-185 lines) and most other
agents (≥108 lines on WSL). CI (Ubuntu) was unaffected due to different
pipe buffer behaviour.
Shellcheck SC2086 — unquoted integer variables:
Quote $name_length, $desc_length, $prompt_length in numeric comparisons.
Pre-existing issues, fixed while script is open.
ux-reviewer.md — CRLF line endings:
Discovered during investigation: ux-reviewer.md had Windows (CRLF) line
endings causing Check 2 to fail ("File must start with YAML frontmatter")
since head -1 returned '---\r' instead of '---'. Fixed with sed -i 's/\r//'.
plugin-validation.yml — update stale CI comment:
Remove reference to the now-fixed arithmetic bug; keep || true as defensive
programming (tolerates future script regressions).
Note: 4 non-plugin-dev agents (pm-assistant, productivity-assistant,
automation-validator, strategic-analyst) use a different frontmatter format
(no name/model/color fields) and exit silently on validation — pre-existing
behaviour unchanged. Tracked separately for a future frontmatter alignment fix.
Generated by Nuno Salvação
Co-Authored-By: Nexo <nexo.modeling@gmail.com>
…agents Four agents were missing `name:`, `model:`, `color:` fields required by validate-agent.sh, causing the script to silently exit under `set -e` when grep returned exit 1 on the missing `name:` field. Descriptions also used multiline YAML `>` blocks which the validator's single-line grep could only capture as `>` (1 character), triggering false description-too-short warnings and masking the missing <example> blocks. Changes per agent: - pm-assistant (product-management): add name/model:sonnet/color:blue, convert description to inline with trigger phrases + 2 <example> blocks - productivity-assistant (productivity): add name/model:sonnet/color:green, convert description to inline with trigger phrases + 2 <example> blocks - automation-validator (repo-structure): add name/model:sonnet/color:yellow, convert description to inline with trigger phrases + 2 <example> blocks - strategic-analyst (strategy-toolkit): add name/model:sonnet/color:cyan, convert description to inline with trigger phrases + 2 <example> blocks Also fixes validate-agent.sh TOOLS grep: `grep '^tools:'` with `set -e` caused silent exit for agents without a `tools:` field (optional field). Added `|| true` guard — same safe pattern used for required-field greps. All 4 agents now complete full validation with ✅ All checks passed or⚠️ warnings-only (no ❌ errors). CI `grep -q '❌'` check unaffected. Generated by Nuno Salvação Co-Authored-By: Nexo <nexo.modeling@gmail.com>
🤖 AI Plugin Review✅ No issues found. All changed plugin components look good. AI Review · model: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7bddf6697a
ℹ️ 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".
| makes assumptions about the product, roadmap, or stakeholders without first | ||
| checking available documentation. | ||
| name: pm-assistant | ||
| description: Use this agent when the user asks for "PM help", "what should I work on", "help me prioritize", "draft a spec", "analyze competitors", "write a stakeholder update", "review the roadmap", "synthesize this feedback", or any product management task spanning multiple PM disciplines. Reads existing project context before responding. <example>user: "Help me prioritize these features for the next sprint" assistant: "I'll use the pm-assistant agent to apply PM prioritization frameworks."</example> <example>user: "Write a stakeholder update for this week's progress" assistant: "I'll use the pm-assistant agent to draft a structured update."</example> |
There was a problem hiding this comment.
Quote agent descriptions containing colon-space examples
The new description values are plain YAML scalars but now include <example>user: "..." assistant: "..."</example> fragments, and : followed by a space is parsed as a mapping separator in YAML; this makes the frontmatter syntactically invalid and strict YAML loaders fail before reading metadata (Psych::SyntaxError reproduces on these files). This affects all four updated agents (plugins/product-management/agents/pm-assistant.md:3, plugins/productivity/agents/productivity-assistant.md:3, plugins/repo-structure/agents/automation-validator.md:3, plugins/strategy-toolkit/agents/strategic-analyst.md:3), so these agents can’t be reliably consumed by tooling that actually parses frontmatter as YAML.
Useful? React with 👍 / 👎.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where agent validation was silently failing due to missing frontmatter fields and vulnerabilities within the validation script itself. It standardizes the metadata for four key agents, making them discoverable and properly validated, while simultaneously enhancing the robustness and accuracy of the agent validation script. This ensures better maintainability and reliability of agent definitions across the system. Highlights
Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the silent failure of the agent validation script by ensuring all agent frontmatter is correctly aligned. The changes to the agent markdown files, including adding missing fields and converting descriptions to a single line, are appropriate fixes for the validator's limitations. The improvements to validate-agent.sh, such as making it more POSIX-compliant and handling optional fields correctly, increase its robustness. I have one suggestion to further improve the script's validation logic for frontmatter.
| if [ "$(tail -n +2 "$AGENT_FILE" | grep -c '^---$')" -eq 0 ]; then | ||
| echo "❌ Frontmatter not closed (missing second ---)" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
The current check ensures there is at least one closing ---, but it allows for multiple closing delimiters. This could lead to incorrect parsing of the frontmatter and system prompt later in the script if a file contains more than two --- lines. To make the validation more robust, I suggest checking for exactly one closing ---.
| if [ "$(tail -n +2 "$AGENT_FILE" | grep -c '^---$')" -eq 0 ]; then | |
| echo "❌ Frontmatter not closed (missing second ---)" | |
| exit 1 | |
| fi | |
| if [ "$(tail -n +2 "$AGENT_FILE" | grep -c '^---$')" -ne 1 ]; then | |
| echo "❌ Frontmatter must be closed by exactly one '---' line" | |
| exit 1 | |
| fi |
Summary
Roadmap item 1.6 — Agent Frontmatter Alignment.
Four agents were missing required
name:,model:,color:fields, causingvalidate-agent.shto silently exit underset -e(grep on missingname:field returns exit 1). Descriptions also used multiline YAML>blocks which the validator's single-line grep captured as>(1 character), producing false "description too short" warnings and masking missing<example>blocks.Root cause chain
grep '^name:'returns exit 1 when field is absentset -esilently kills script before printing any❌grep -q '❌'finds nothing — masking the incomplete validationChanges
4 agent files (
pm-assistant,productivity-assistant,automation-validator,strategic-analyst):name:(kebab-case matching filename)model: sonnet(appropriate for complex routing/analysis agents)color:(blue / green / yellow / cyan — differentiated by plugin)description: >multiline block → inline description preserving all trigger phrases<example>blocks per agent following agent-development best practicesvalidate-agent.sh:|| trueguard to TOOLS grep (line 166) — optional field, silent exit when absent was a pre-existing bug. Safe to fix now that the 4 agents have complete frontmatter.Validation results
Test plan
validate-agent.shpasses on all 4 agents (no❌)shellcheck validate-agent.shexits 0markdownlint-cli2exits 0 on all 4 agent filesValidate pluginsCI job passes🤖 Generated with Claude Code