Repository navigation
feat(validator): enforce the docs/agents.md persona contract in CI - #610
Closed
ayobamiseun wants to merge 1 commit into
Closed
ayobamiseun wants to merge 1 commit into
ayobamiseun wants to merge 1 commit into
Conversation
agents/ was the only authored surface with no validator. docs/agents.md
states a contract for personas — same frontmatter format with name as the
subagent_type, no hooks/mcpServers/permissionMode (silently ignored by
plugin agents), a closing Composition block, and a row in the persona
tables — and /ship and /webperf spawn personas by name. Nothing checked
any of it, so a persona that drifted failed at spawn time in a user's
session rather than in CI.
Add scripts/validate-agents.js, reusing the frontmatter helpers from
scripts/lib/skill-lint.js. It lints each persona against the rules above,
checks the docs/agents.md and README tables list every persona, and scans
all three command surfaces for the phrasings that spawn a persona
("Spawn the `x` subagent", "the `x` persona", subagent_type: x, and the
fan-out list form) so an unresolved name fails with file and line. Spawn
detection is deliberately narrow; a bare backticked name is not a spawn.
All four personas pass today: 4 personas, 11 spawn references, 0 errors.
15 tests cover each rule failing alone, listings, and reference
resolution. Wired into the command-parity job and the macOS/Windows
matrix, and docs/agents.md now says which authoring steps CI enforces.
Owner
|
Thanks for the effort here, but I'm going to pass. We have four personas and no history of the contract drifting, and a 457-line standing validator is more than that needs. Testing it also turned up false positives: an agents/README.md index fails, a numbered list item that bolds a skill name reads as spawning a missing persona, |
addyosmani
pushed a commit
that referenced
this pull request
Oct 10, 2026
The smaller version asked for when #610 was closed. docs/agents.md states three rules for agents/<name>.md — the same frontmatter format as a skill with name equal to the file stem (the name is the subagent_type commands spawn) and a description, and a closing Composition block — and no validator checked them. Add lintPersonaContent to scripts/lib/skill-lint.js, reusing the existing frontmatter parsing and YAML-validity rules, and have validate-skills.js walk agents/*.md after the skills, skipping an index README.md. Headings are read from fence-stripped content so an example block after Composition does not count as a later section. No spawn-reference scanning, no listing-table checks, no new script, no workflow change. All four personas pass: 25 skills and 4 personas checked, 0 errors.
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.
Summary
agents/is the one authored surface in the repo with no validator. Skills, commands, artifact paths, reference links, and manifests each have a script and a CI step; personas have none, even thoughdocs/agents.mdstates a contract for them and two commands spawn them by name. A persona that drifts from that contract fails at spawn time in a user's session, not in CI.This adds
scripts/validate-agents.js, which enforces the rulesdocs/agents.mdalready states:nameequals the file stem,descriptionpresentagents/<role>.mdwith the same frontmatter format used by existing personas"; the name is thesubagent_typehooks,mcpServers, orpermissionModefrontmatter## Compositionsectiondocs/agents.mdand the README/shipand/webperfpass the name assubagent_typeAll four personas pass every rule today, so this is a guard in the #571 sense: it fires on nothing on
mainand catches the next persona that is added, renamed, or spawned by a command before its file exists. #261, which adds anaccessibility-auditor, would be the first PR it checks.Design notes
parseFrontmatterandfrontmatterYamlErrorsfromscripts/lib/skill-lint.jsrather than parsing again, the same wayvalidate-commands.jsdoes.xsubagent", "thexpersona",subagent_type: x, and the/shipfan-out list form1. **x**. All three host surfaces are scanned. A test pins that`code-review-and-quality`and`tasks/plan.md`are not treated as personas.docs/agents.mdgains one paragraph after the authoring steps saying which steps CI enforces and how to run the check locally.CI
Two steps in the existing command-parity job, and the validator plus its tests added to the macOS/Windows matrix from #590, so the check runs on all three platforms like the others.
Verification
Tests cover each rule failing on its own (name mismatch, missing description, invalid YAML, each of the three ignored fields, missing Composition, Composition not last), the empty-directory case, a persona missing from each listing, absent listings skipped, every spawn phrasing resolving with the expected count, an unresolved spawn reported with file and line, and non-spawn backticks ignored.
Overlap
#427, #441, and #551 edit
agents/code-reviewer.mdcontent; none touch its frontmatter or Composition block, so they pass this validator as written. #600 and #548 add steps to the same workflow file at other positions.