Skip to content

fix(agents): 1.6 — agent frontmatter alignment (name, model, color, description)#56

Merged
nsalvacao merged 2 commits into
mainfrom
fix/agent-frontmatter-alignment
Mar 12, 2026
Merged

fix(agents): 1.6 — agent frontmatter alignment (name, model, color, description)#56
nsalvacao merged 2 commits into
mainfrom
fix/agent-frontmatter-alignment

Conversation

@nsalvacao

Copy link
Copy Markdown
Owner

Summary

Roadmap item 1.6 — Agent Frontmatter Alignment.

Four agents were missing required name:, model:, color: fields, causing validate-agent.sh to silently exit under set -e (grep on missing name: 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

  1. grep '^name:' returns exit 1 when field is absent
  2. set -e silently kills script before printing any
  3. CI passes because grep -q '❌' finds nothing — masking the incomplete validation
  4. System prompt check never runs for these 4 agents

Changes

4 agent files (pm-assistant, productivity-assistant, automation-validator, strategic-analyst):

  • Added name: (kebab-case matching filename)
  • Added model: sonnet (appropriate for complex routing/analysis agents)
  • Added color: (blue / green / yellow / cyan — differentiated by plugin)
  • Converted description: > multiline block → inline description preserving all trigger phrases
  • Added 2 <example> blocks per agent following agent-development best practices
  • Started each description with "Use this agent when..."

validate-agent.sh:

  • Added || true guard 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

Agent Before After
pm-assistant silent exit after frontmatter check ✅ All checks passed
productivity-assistant silent exit after frontmatter check ✅ All checks passed
automation-validator silent exit after frontmatter check ⚠️ 1 warning (pre-existing system prompt style)
strategic-analyst silent exit after frontmatter check ✅ All checks passed

Test plan

  • validate-agent.sh passes on all 4 agents (no )
  • shellcheck validate-agent.sh exits 0
  • markdownlint-cli2 exits 0 on all 4 agent files
  • Validate plugins CI job passes

🤖 Generated with Claude Code

nsalvacao and others added 2 commits March 12, 2026 17:22
…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>
@github-actions

Copy link
Copy Markdown
Contributor

🤖 AI Plugin Review

No issues found. All changed plugin components look good.


AI Review · model: ? · ? tokens · 0 findings · GitHub Models free tier · 0 premium requests

@nsalvacao nsalvacao merged commit 9bf98ab into main Mar 12, 2026
7 checks passed
@nsalvacao nsalvacao deleted the fix/agent-frontmatter-alignment branch March 12, 2026 17:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Agent Frontmatter Alignment: Ensured four agent files (pm-assistant, productivity-assistant, automation-validator, strategic-analyst) now include required name, model, and color fields, which were previously missing.
  • Description Format Standardization: Converted multiline YAML description blocks in agent files to an inline format, added two <example> blocks per agent, and standardized descriptions to begin with the phrase "Use this agent when...". This improves discoverability and validation.
  • Validation Script Robustness: Updated validate-agent.sh to prevent silent exits caused by interactions between set -e and grep -q in pipelines, specifically by changing grep -q to grep -c for certain checks and adding || true for optional fields.
  • Enhanced Agent Validation: The combined changes allow the validate-agent.sh script to fully and correctly validate the four affected agents, moving them from a state of "silent exit" to passing all checks or showing appropriate warnings.
Changelog
  • plugins/plugin-dev/skills/agent-development/scripts/validate-agent.sh
    • Modified the frontmatter closing check to use grep -c instead of grep -q to prevent SIGPIPE errors when set -o pipefail is active.
    • Updated all ((variable++)) style arithmetic increments to variable=$((variable+1)) for consistency and POSIX compliance.
    • Added || true to the grep '^tools:' command to correctly handle the optional tools field without causing silent script exits.
    • Improved conditional checks for length validations by quoting variables (e.g., [ "$name_length" -lt 3 ]).
  • plugins/product-management/agents/pm-assistant.md
    • Added name: pm-assistant, model: sonnet, and color: blue to the agent's frontmatter.
    • Refactored the description field from a multiline YAML block to a single-line string, incorporating two <example> blocks and ensuring it starts with "Use this agent when...".
  • plugins/productivity/agents/productivity-assistant.md
    • Added name: productivity-assistant, model: sonnet, and color: green to the agent's frontmatter.
    • Refactored the description field from a multiline YAML block to a single-line string, incorporating two <example> blocks and ensuring it starts with "Use this agent when...".
  • plugins/repo-structure/agents/automation-validator.md
    • Added name: automation-validator, model: sonnet, and color: yellow to the agent's frontmatter.
    • Refactored the description field from a multiline YAML block to a single-line string, incorporating two <example> blocks and ensuring it starts with "Use this agent when...".
  • plugins/strategy-toolkit/agents/strategic-analyst.md
    • Added name: strategic-analyst, model: sonnet, and color: cyan to the agent's frontmatter.
    • Refactored the description field from a multiline YAML block to a single-line string, incorporating two <example> blocks and ensuring it starts with "Use this agent when...".
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/plugin-validation.yml
Activity
  • The pull request was created by nsalvacao to address agent frontmatter alignment and validation issues.
  • The changes were generated with Claude Code, as indicated in the PR description.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +45 to 48
if [ "$(tail -n +2 "$AGENT_FILE" | grep -c '^---$')" -eq 0 ]; then
echo "❌ Frontmatter not closed (missing second ---)"
exit 1
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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 ---.

Suggested change
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

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.

1 participant