fix(agents): add skills/hooks frontmatter, anti-heredoc rules, and spawn type standardization#812
Open
Tibsfox wants to merge 4 commits intogsd-build:mainfrom
Open
fix(agents): add skills/hooks frontmatter, anti-heredoc rules, and spawn type standardization#812Tibsfox wants to merge 4 commits intogsd-build:mainfrom
Tibsfox wants to merge 4 commits intogsd-build:mainfrom
Conversation
Add 'never use heredoc' instruction to 6 agents that were missing it: gsd-codebase-mapper, gsd-debugger, gsd-phase-researcher, gsd-project-researcher, gsd-research-synthesizer, gsd-roadmapper. All 9 file-writing agents now consistently prevent settings.local.json corruption from heredoc permission entries (GSD gsd-build#526). Read-only agents (plan-checker, integration-checker) excluded as they cannot write files. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add skills: field to all 11 agent frontmatter files with forward-compatible GSD workflow skill references (silently ignored until skill files are created). Add commented hooks: examples to 9 file-writing agents showing PostToolUse hook syntax for project-specific linting/formatting. Read-only agents (plan-checker, integration-checker) skip hooks as they cannot modify files. Per Claude Code docs: subagents don't inherit skills or hooks from the parent conversation — they must be explicitly listed in frontmatter. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace general-purpose workaround pattern with named subagent types: - plan-phase: researcher and planner now spawn as gsd-phase-researcher/gsd-planner - new-project: 4 researcher spawns now use gsd-project-researcher - research-phase: researcher spawns now use gsd-phase-researcher - quick: planner revision now uses gsd-planner - diagnose-issues: debug agents now use gsd-debugger (matches template spec) Removes 'First, read agent .md file' prompt prefix — named agent types auto-load their .md file as system prompt, making the workaround redundant. Preserves intentional general-purpose orchestrator spawns in discuss-phase and plan-phase (auto-advance) where the agent runs an entire workflow. Co-Authored-By: Claude Opus 4.6 <[email protected]>
New test suite covering: - HDOC: anti-heredoc instruction present in all 9 file-writing agents - SKILL: skills: frontmatter present in all 11 agents - HOOK: commented hooks pattern in file-writing agents - SPAWN: no stale workaround patterns, valid agent type references - AGENT: required frontmatter fields (name, description, tools, color) 509 total tests (462 existing + 47 new), 0 failures. Co-Authored-By: Claude Opus 4.6 <[email protected]>
6 tasks
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
This PR adds preventive hardening to the GSD agent system — ensuring all agents have the right frontmatter declarations and workflow spawn calls use proper named types. While the specific bugs that motivated this (#526, #546, #548, #671) have been addressed upstream, the underlying patterns that allowed them to occur are still present across the agent definitions.
Think of this as the difference between fixing a leak and waterproofing the roof — the leaks are patched, but this PR makes sure the same class of issue doesn't recur elsewhere.
What This Adds
1. Skills frontmatter for all 11 agents (BUG-2 prevention)
Without a
skills:field in agent frontmatter, skill activation in subagents is unreliable — it depends on the parent process happening to load the right context. Declaring skills explicitly makes agent behavior predictable and reproducible.2. Anti-heredoc instructions for all 9 file-writing agents (BUG-6 / #526 prevention)
When agents use
Bash(cat << 'EOF' > file)instead of theWritetool, Claude Code'ssettings.local.jsoncan accumulate permission entries that grow unboundedly. The original fix in #526 addressed the verifier specifically — this extends the protection to every agent that has write access.3. Commented hooks examples for file-writing agents (BUG-1 awareness)
Claude Code subagents don't inherit hooks from the parent process. While the commented examples don't enforce behavior today, they document the pattern for contributors and make it straightforward to enable per-agent hooks when Claude Code supports frontmatter hook declarations.
4. Workflow spawn type standardization (5 files)
Several workflow files used a
"First, read ~/.claude/agents/gsd-*.md"workaround withsubagent_type="general-purpose"— a pattern from before Claude Code supported named agent types. This updates all spawn calls to use the proper named types (e.g.,gsd-phase-researcher,gsd-planner), which gives subagents the correct tool permissions and context automatically.5. 47 agent frontmatter and spawn consistency tests
Automated tests that verify every agent definition has the required frontmatter fields and every workflow spawn call references a valid agent type. These catch regressions if new agents or workflows are added without proper declarations.
Why This Matters
The GSD agent system is growing — new agents, new workflows, new contributors. These changes establish a consistent baseline so that:
Relationship to Upstream Fixes
The specific bugs (#526, #546, #548, #671) were fixed upstream — great work by the maintainers! This PR extends those fixes into a systemic prevention pattern across all agents rather than addressing them one at a time.
Test Plan
npm test)🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 [email protected]