-
Notifications
You must be signed in to change notification settings - Fork 2
feat(agents): add subagent filtering via frontmatter #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add 'subagents:' frontmatter to primary agents that specifies which subagents should appear in the Task tool description. This reduces token overhead by filtering 220 subagents down to 3-30 per agent. Changes: - Add parse_frontmatter() to generate-opencode-agents.sh - Generate permission.task deny-list rules from subagents list - Add subagents frontmatter to all 13 primary agents Token savings: ~6-10k tokens per conversation by hiding irrelevant subagents from the Task tool description. Related: anomalyco/opencode#7271
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds Changes
Sequence Diagram(s)sequenceDiagram
participant FS as Markdown files (.agent/*.md)
participant Script as generate-opencode-agents.sh
participant Registry as Generated agent configs / Permission system
FS->>Script: script scans agent markdown files
Script->>FS: parse_frontmatter(filepath) -> extract `subagents`
Script->>Script: get_agent_config(display_name, filename, subagents)
Script->>Registry: emit agent config with permissions (deny-all + allow subagents)
Script->>Script: increment subagent_filtered_count / log discovery summary
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @marcusquinn, 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 introduces a crucial optimization to the agent system by enabling explicit control over subagents associated with primary agents. By leveraging a new Highlights
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
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Wed Jan 14 00:23:16 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
There was a problem hiding this comment.
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 introduces a subagent filtering mechanism using frontmatter in agent markdown files to reduce token overhead. The implementation involves adding a new parse_frontmatter function to a Python script, which manually parses YAML-like data, and then uses this data to generate permission rules. While the overall approach is sound and effectively addresses the token reduction goal, the new parser has some robustness issues that could lead to silent failures. My review includes a high-severity comment with a suggestion to improve the parser's reliability.
| def parse_frontmatter(filepath): | ||
| """Parse YAML frontmatter from markdown file.""" | ||
| try: | ||
| with open(filepath, 'r') as f: | ||
| content = f.read() | ||
| # Check for frontmatter | ||
| if not content.startswith('---'): | ||
| return {} | ||
| # Find end of frontmatter | ||
| end_idx = content.find('---', 3) | ||
| if end_idx == -1: | ||
| return {} | ||
| frontmatter = content[3:end_idx].strip() | ||
| # Simple YAML parsing for subagents list | ||
| result = {} | ||
| lines = frontmatter.split('\n') | ||
| current_key = None | ||
| current_list = [] | ||
| for line in lines: | ||
| stripped = line.strip() | ||
| if stripped.startswith('- ') and current_key: | ||
| # List item | ||
| current_list.append(stripped[2:].strip()) | ||
| elif ':' in stripped and not stripped.startswith('-'): | ||
| # Save previous list if any | ||
| if current_key and current_list: | ||
| result[current_key] = current_list | ||
| current_list = [] | ||
| # New key | ||
| key, value = stripped.split(':', 1) | ||
| current_key = key.strip() | ||
| value = value.strip() | ||
| if value: | ||
| result[current_key] = value | ||
| current_key = None | ||
| # Save final list | ||
| if current_key and current_list: | ||
| result[current_key] = current_list | ||
| return result | ||
| except: | ||
| return {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The custom frontmatter parser is quite fragile and could lead to silent failures. A silent failure here means subagent filtering won't be applied, which defeats the purpose of this change.
Specifically:
- It doesn't handle comments. A YAML comment (
#) that contains a colon (:) would be incorrectly parsed as a key-value pair. While the current agent files don't trigger this, it's a potential bug for future changes. - The
except:block is too broad. It catches all exceptions, includingSystemExitandKeyboardInterrupt, which is not recommended. It also fails silently by returning an empty dictionary, hiding parsing errors that should be addressed.
Using a standard library like PyYAML would be ideal, but if you prefer to avoid new dependencies, the existing parser can be made more robust. The suggestion below adds handling for comments and improves error reporting.
def parse_frontmatter(filepath):
"""Parse YAML frontmatter from markdown file."""
try:
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Check for frontmatter
if not content.startswith('---'):
return {}
# Find end of frontmatter
end_idx = content.find('---', 3)
if end_idx == -1:
return {}
frontmatter = content[3:end_idx].strip()
# Simple YAML parsing for subagents list
result = {}
lines = frontmatter.split('\n')
current_key = None
current_list = []
for line in lines:
stripped = line.strip()
# Ignore comments and empty lines for more robust parsing
if not stripped or stripped.startswith('#'):
continue
if stripped.startswith('- ') and current_key:
# List item
current_list.append(stripped[2:].strip())
elif ':' in stripped and not stripped.startswith('-'):
# Save previous list if any
if current_key and current_list:
result[current_key] = current_list
current_list = []
# New key
key, value = stripped.split(':', 1)
current_key = key.strip()
value = value.strip()
if value:
result[current_key] = value
current_key = None
# Save final list
if current_key and current_list:
result[current_key] = current_list
return result
except Exception as e:
# Catch specific exceptions and log the error for easier debugging
print(f"Warning: Failed to parse frontmatter for {filepath}: {e}", file=sys.stderr)
return {}Address Gemini Code Assist review feedback: - Add encoding='utf-8' to file open - Skip comments and empty lines in YAML parsing - Use specific exception types instead of bare except - Add warning message for parse failures Co-authored-by: gemini-code-assist[bot] <176abortedflight+gemini-code-assist[bot]@users.noreply.github.com>
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Wed Jan 14 00:26:15 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.agent/marketing.md:
- Around line 13-29: The subagents list under the "subagents" key is using
invalid names; update entries to use the documented agent paths and remove
unsupported ones: replace "fluentcrm" with "services/crm/fluentcrm.md", replace
"dataforseo" with "seo/dataforseo.md", replace "google-search-console" with
"seo/google-search-console.md", and remove the undefined entries "guidelines",
"summarize", "keyword-research", "serper", "bird", "general", and "explore";
ensure the final "subagents" array only contains valid .agent/* markdown paths
per AGENTS.md.
In @.agent/seo.md:
- Around line 5-16: The frontmatter references a missing subagent "pagespeed" so
either remove "pagespeed" from the subagents list or add the corresponding
pagespeed subagent file; update the subagents array (e.g., remove the
"pagespeed" entry) and, if adding, create the new pagespeed subagent document
with the same structure as the other subagents. Also update the documentation
table to add "domain-research" as an entry and mark "general" and "explore" as
built-ins so the table accurately reflects available subagents.
🧹 Nitpick comments (3)
.agent/scripts/generate-opencode-agents.sh (2)
185-233: Solid frontmatter parser with room for edge-case hardening.The
parse_frontmatter()implementation handles basic YAML list parsing well, but a few edge cases could cause unexpected behavior:
Line 220:
stripped.split(':', 1)on a line likedescription: "foo: bar"will correctly split at the first colon, but quoted values containing colons in list items (line 212) aren't handled.Line 232: The bare
except:swallows all exceptions silently. Consider logging parse failures to aid debugging when subagent filtering doesn't work as expected.Inline list syntax (e.g.,
subagents: [foo, bar]) isn't parsed—only multi-line YAML lists work.These are minor given the controlled input (your own
.mdfiles), but worth noting for robustness.🔧 Optional: Add debug logging for parse failures
except: + # Uncomment for debugging: print(f" Warning: Failed to parse frontmatter in {filepath}", file=sys.stderr) return {}
268-276: Permission filtering logic is correct, but add validation to prevent future typos in subagent references.The deny-all + allow-specific pattern (
"*": "deny"followed by per-subagent"allow") correctly implements least-privilege filtering. The logging provides good visibility.However, there's no validation that subagent names in frontmatter actually correspond to files. While all current subagent references are valid (verified across workflows, code-review, context, browser, seo, and services directories), a typo could silently create incorrect permission filtering. Consider adding a check during script execution to warn if a referenced subagent file is not found.
.agent/health.md (1)
5-11: Remove context7 subagent or document research workflows
context7is fundamentally misaligned—it provides development library/framework documentation, not health information.crawl4aicould support future health research workflows, but none are currently documented. The agent's scope (Developer Wellness, Work-Life Balance, Ergonomics) operates independently without external research. If health research is planned, document those workflows; otherwise, rely ongeneralandexplorefor the current wellness-tracking scope. Note: A separateresearch.mdagent already handles research tasks with these tools.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
.agent/accounts.md.agent/aidevops.md.agent/build-plus.md.agent/content.md.agent/health.md.agent/legal.md.agent/marketing.md.agent/onboarding.md.agent/plan-plus.md.agent/research.md.agent/sales.md.agent/scripts/generate-opencode-agents.sh.agent/seo.md.agent/social-media.md
🧰 Additional context used
📓 Path-based instructions (1)
.agent/scripts/*.sh
⚙️ CodeRabbit configuration file
.agent/scripts/*.sh: Automation scripts - focus on:
- Reliability and robustness
- Clear logging and feedback
- Proper exit codes
- Error recovery mechanisms
Files:
.agent/scripts/generate-opencode-agents.sh
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-06T15:57:56.027Z
Learning: Applies to **/AGENTS.md : Limit root AGENTS.md to ~50-100 max instructions with universal applicability to >80% of tasks
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-06T15:57:56.027Z
Learning: Applies to **/AGENTS.md : Use progressive disclosure in AGENTS.md with pointers to subagents rather than inline content
📚 Learning: 2026-01-06T15:57:56.027Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-06T15:57:56.027Z
Learning: Applies to **/AGENTS.md : Use progressive disclosure in AGENTS.md with pointers to subagents rather than inline content
Applied to files:
.agent/onboarding.md.agent/accounts.md.agent/legal.md.agent/aidevops.md.agent/content.md.agent/social-media.md.agent/build-plus.md.agent/research.md.agent/sales.md.agent/plan-plus.md.agent/health.md
📚 Learning: 2025-11-29T04:34:42.033Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENT.md:0-0
Timestamp: 2025-11-29T04:34:42.033Z
Learning: Reference AGENTS.md (authoritative) instead of AGENT.md for AI assistant guidance
Applied to files:
.agent/onboarding.md.agent/legal.md.agent/aidevops.md.agent/content.md.agent/social-media.md.agent/research.md.agent/sales.md.agent/plan-plus.md.agent/health.md
📚 Learning: 2025-11-29T04:34:27.158Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-29T04:34:27.158Z
Learning: All instructions, documentation, and operational guidance should be maintained in AGENTS.md as the single source of truth
Applied to files:
.agent/onboarding.md.agent/legal.md.agent/aidevops.md.agent/content.md
📚 Learning: 2026-01-06T15:57:56.027Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-06T15:57:56.027Z
Learning: Applies to **/AGENTS.md : Limit root AGENTS.md to ~50-100 max instructions with universal applicability to >80% of tasks
Applied to files:
.agent/onboarding.md.agent/legal.md.agent/aidevops.md.agent/content.md.agent/marketing.md.agent/sales.md.agent/plan-plus.md
📚 Learning: 2025-11-29T04:34:30.742Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-29T04:34:30.742Z
Learning: Maintain all instructions, documentation, and operational guidance in AGENTS.md as the single source of truth
Applied to files:
.agent/onboarding.md.agent/aidevops.md
📚 Learning: 2025-11-29T04:34:42.033Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENT.md:0-0
Timestamp: 2025-11-29T04:34:42.033Z
Learning: Maintain all AI assistant instructions, documentation, and operational guidance in AGENTS.md as the single source of truth
Applied to files:
.agent/aidevops.md
📚 Learning: 2025-12-22T01:24:53.937Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: templates/home/AGENTS.md:0-0
Timestamp: 2025-12-22T01:24:53.937Z
Learning: Follow all security protocols and working directory specifications defined in ~/Git/aidevops/AGENTS.md
Applied to files:
.agent/aidevops.md
📚 Learning: 2025-12-22T01:24:53.937Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: templates/home/AGENTS.md:0-0
Timestamp: 2025-12-22T01:24:53.937Z
Learning: Reference the authoritative repository at ~/Git/aidevops/ for all detailed AI assistant instructions and configurations
Applied to files:
.agent/aidevops.md
📚 Learning: 2025-12-22T01:25:03.138Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: templates/home/git/AGENTS.md:0-0
Timestamp: 2025-12-22T01:25:03.138Z
Learning: Use standardized patterns as defined in the authoritative DevOps repository at ~/Git/aidevops/
Applied to files:
.agent/aidevops.md
📚 Learning: 2025-12-22T01:24:53.937Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: templates/home/AGENTS.md:0-0
Timestamp: 2025-12-22T01:24:53.937Z
Learning: Use only the specified working directories: ~/.aidevops/.agent-workspace/work/[project]/ for work files, ~/.aidevops/.agent-workspace/tmp/ for temporary files, and ~/.aidevops/.agent-workspace/memory/ for persistent memory
Applied to files:
.agent/aidevops.md
📚 Learning: 2025-11-29T04:34:30.742Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-29T04:34:30.742Z
Learning: Reference AGENTS.md for authoritative AI assistant guidance instead of GEMINI.md
Applied to files:
.agent/social-media.md.agent/research.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (12)
.agent/scripts/generate-opencode-agents.sh (2)
282-282: Good instrumentation withsubagent_filtered_count.The counter and conditional check provide clear feedback on how many agents have filtering applied. The logic correctly increments only when
subagentsis truthy.Also applies to: 290-297
364-365: Clear summary output for subagent filtering.The conditional print on lines 364-365 provides useful feedback without cluttering output when filtering isn't in use. Aligns well with the script's existing logging patterns.
.agent/research.md (1)
5-18: Well-structured subagents list for Research agent.The categorization with inline comments (Context/docs, Web research, Summarization, Built-in) improves readability. The selected subagents align well with the agent's purpose: research and analysis tasks requiring documentation lookup, web crawling, and summarization.
.agent/sales.md (1)
13-25: Subagents list properly scoped to Sales operations.The selected subagents directly support the workflows documented in the file:
fluentcrm→ CRM Integration section (line 68+)quickfile→ Quote to Invoice Flow (line 245+)outscraper,crawl4ai→ Lead research capabilitiesguidelines→ Proposal creation (line 222+)Good alignment between declared subagents and documented functionality.
.agent/aidevops.md (1)
5-40: Comprehensive subagent list appropriate for framework meta-agent.With 36 subagents, this is the largest list in the PR, which aligns with the AI-DevOps agent's role as the framework orchestration hub. The categorization is clear:
- Framework internals (setup, troubleshooting, architecture, MCP configs)
- Agent development (build-agent, build-mcp, server-patterns)
- Workflows (git-workflow, release, version-bump)
- Code quality (code-standards, linters-local, secretlint)
- Credentials (api-key-setup, vaultwarden)
The PR objective mentions "Build+ 220 → 30" as an example, so 36 for the framework agent is within expected range.
.agent/social-media.md (1)
5-16: Focused subagent list for Social Media management.The 7 subagents provide targeted capabilities:
bird→ Twitter/X platform (mentioned in line 69)guidelines,summarize→ Content planning (line 41+)crawl4ai,serper→ Competitor and trend analysis (lines 63-64, 80-81)The list appropriately references
content.md,marketing.md,seo.md, andresearch.mdin the Integration Points section (lines 78-81), showing good cross-agent coordination awareness..agent/accounts.md (1)
5-8: LGTM - Clean subagent filtering configurationThe subagent list is appropriate for an accounting agent:
quickfilefor the primary QuickFile integration (referenced at lines 21, 36, 69), and the standardgeneral/explorebuilt-ins. This reduces token overhead from 220 to just 3 subagents (~98.6% reduction)..agent/legal.md (1)
5-13: LGTM - Appropriate subagent selection for legal workflowsThe subagent configuration is well-aligned with the agent's documented workflows:
- Research tools (
context7,crawl4ai) support document review (lines 39-44) and compliance checking (lines 55-60)guidelinessubagent fits policy generation needs (lines 47-52)- Built-ins provide general capabilities
Token reduction from 220 to 5 (~97.7%) while maintaining necessary functionality.
.agent/onboarding.md (1)
5-17: Subagent configuration references non-existent files - cannot approveAll 8 declared subagents are missing (
.agent/setup.md,.agent/troubleshooting.md,.agent/api-key-setup.md,.agent/list-keys.md,.agent/mcp-integrations.md,.agent/services.md,.agent/service-links.md,.agent/general.md,.agent/explore.md). Withmode: subagent, this configuration will fail at runtime.Additional concerns:
- Content bloat: onboarding.md is 809 lines vs. the 50–100 line target from learnings. The first section alone contains ~350 lines of inline detailed instructions.
- Missing progressive disclosure: Learnings recommend pointers to subagents rather than inline content. Current structure embeds full workflows inline instead of delegating to referenced subagents.
Required before merge:
- Create the 8 subagent files or remove them from the subagent list if they're WIP
- Consolidate onboarding.md to ~50–100 core instructions with pointers to subagents for detailed workflows
⛔ Skipped due to learnings
Learnt from: CR Repo: marcusquinn/aidevops PR: 0 File: AGENTS.md:0-0 Timestamp: 2026-01-06T15:57:56.027Z Learning: Applies to **/AGENTS.md : Limit root AGENTS.md to ~50-100 max instructions with universal applicability to >80% of tasksLearnt from: CR Repo: marcusquinn/aidevops PR: 0 File: AGENTS.md:0-0 Timestamp: 2026-01-06T15:57:56.027Z Learning: Applies to **/AGENTS.md : Use progressive disclosure in AGENTS.md with pointers to subagents rather than inline contentLearnt from: CR Repo: marcusquinn/aidevops PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-11-29T04:34:27.158Z Learning: All instructions, documentation, and operational guidance should be maintained in AGENTS.md as the single source of truthLearnt from: CR Repo: marcusquinn/aidevops PR: 0 File: GEMINI.md:0-0 Timestamp: 2025-11-29T04:34:30.742Z Learning: Maintain all instructions, documentation, and operational guidance in AGENTS.md as the single source of truth.agent/build-plus.md (1)
5-42: Excellent organization with categorized subagents.The use of inline comments to categorize 30 subagents into logical groups (Core workflows, Code quality, Context tools, Browser/testing, Git platforms, Deployment, Built-in) is a maintainability best practice. This organization pattern makes the extensive list easy to audit and update.
The comprehensive scope is appropriate for an autonomous build agent that needs access to quality gates, context tools, and deployment workflows.
.agent/content.md (1)
5-20: LGTM! Well-scoped content subagent list with clear categorization.The subagent list appropriately covers content creation workflows while integrating SEO optimization (
keyword-research,eeat-score) and publishing tools (wp-admin,mainwp). The categorical organization following the build-plus.md pattern promotes consistency across agent configurations..agent/plan-plus.md (1)
5-22: Perfect alignment with Plan+ read-only constraints.The subagent list is carefully scoped to maintain Plan+'s read-only nature. Context/search tools dominate (osgrep, augment-context-engine, context-builder, context7), while planning and architecture review subagents support the analysis phase. Notably absent are any write, deployment, or modification tools—excellent constraint enforcement.
The categorical organization clearly communicates the agent's capabilities and limitations.
| subagents: | ||
| # CRM | ||
| - fluentcrm | ||
| # Content | ||
| - guidelines | ||
| - summarize | ||
| # SEO | ||
| - keyword-research | ||
| - serper | ||
| - dataforseo | ||
| # Social | ||
| - bird | ||
| # Analytics | ||
| - google-search-console | ||
| # Built-in | ||
| - general | ||
| - explore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Explore .agent directory structure
find .agent -type f -name "*.md" | head -20Repository: marcusquinn/aidevops
Length of output: 696
🏁 Script executed:
# Check if .agent/marketing.md exists and get its line count
if [ -f .agent/marketing.md ]; then
wc -l .agent/marketing.md
echo "---"
echo "Lines 13-29:"
sed -n '13,29p' .agent/marketing.md
else
echo ".agent/marketing.md does not exist"
fiRepository: marcusquinn/aidevops
Length of output: 330
🏁 Script executed:
# Verify referenced subagent files
for agent in bird dataforseo google-search-console keyword-research serper fluentcrm guidelines summarize general explore; do
if [ -f ".agent/${agent}.md" ]; then
echo "✓ .agent/${agent}.md exists"
else
echo "✗ .agent/${agent}.md NOT FOUND"
fi
doneRepository: marcusquinn/aidevops
Length of output: 392
🏁 Script executed:
# Check lines 303-322 in marketing.md for SEO integration claims
if [ -f .agent/marketing.md ]; then
echo "Lines 303-322 in .agent/marketing.md:"
sed -n '303,322p' .agent/marketing.md
fiRepository: marcusquinn/aidevops
Length of output: 654
🏁 Script executed:
# Check fluentcrm documentation extent (lines 39-457)
if [ -f .agent/marketing.md ]; then
echo "Checking line 39 and nearby:"
sed -n '35,45p' .agent/marketing.md
echo "---"
echo "Checking line 457 and nearby:"
sed -n '450,457p' .agent/marketing.md | head -20
fiRepository: marcusquinn/aidevops
Length of output: 736
🏁 Script executed:
# Check AGENTS.md for subagent definitions
if [ -f .agent/AGENTS.md ]; then
echo "Checking .agent/AGENTS.md for subagent configuration:"
head -100 .agent/AGENTS.md
fiRepository: marcusquinn/aidevops
Length of output: 4612
🏁 Script executed:
# Search for any mention of subagents in AGENTS.md
if [ -f .agent/AGENTS.md ]; then
echo "Searching for 'subagents' in AGENTS.md:"
grep -n "subagents" .agent/AGENTS.md
fiRepository: marcusquinn/aidevops
Length of output: 369
🏁 Script executed:
# Check directory structure for actual agent definitions
echo "Checking .agent directory for any agent MD files:"
ls -la .agent/*.md 2>/dev/null | head -20Repository: marcusquinn/aidevops
Length of output: 1073
🏁 Script executed:
# Show full marketing.md to understand subagent structure
wc -l .agent/marketing.md && echo "---" && head -50 .agent/marketing.mdRepository: marcusquinn/aidevops
Length of output: 1032
🏁 Script executed:
# Check if there's a services subdirectory with agent definitions
find .agent -type d | head -20Repository: marcusquinn/aidevops
Length of output: 472
🏁 Script executed:
# Search for how subagents are referenced or defined in AGENTS.md
grep -A 20 "How to use subagents" .agent/AGENTS.mdRepository: marcusquinn/aidevops
Length of output: 1359
Reject subagent declarations—most do not exist in the framework
The subagents list references agents that either don't exist or use incorrect paths. Per AGENTS.md documentation, valid agent paths are:
seo/dataforseo.md(notdataforseo)seo/google-search-console.md(notgoogle-search-console)services/crm/fluentcrm.md(notfluentcrm)
The following subagents are not defined in the framework and must be removed:
guidelines,summarize,keyword-research,serper,bird,general,explore
Correct the subagent declarations to use valid paths from the .agent/ directory structure, or remove unsupported entries entirely.
🤖 Prompt for AI Agents
In @.agent/marketing.md around lines 13 - 29, The subagents list under the
"subagents" key is using invalid names; update entries to use the documented
agent paths and remove unsupported ones: replace "fluentcrm" with
"services/crm/fluentcrm.md", replace "dataforseo" with "seo/dataforseo.md",
replace "google-search-console" with "seo/google-search-console.md", and remove
the undefined entries "guidelines", "summarize", "keyword-research", "serper",
"bird", "general", and "explore"; ensure the final "subagents" array only
contains valid .agent/* markdown paths per AGENTS.md.
| subagents: | ||
| - keyword-research | ||
| - google-search-console | ||
| - gsc-sitemaps | ||
| - dataforseo | ||
| - serper | ||
| - site-crawler | ||
| - eeat-score | ||
| - domain-research | ||
| - pagespeed | ||
| - general | ||
| - explore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, let's find the seo.md file and explore the .agent directory structure
find . -name "seo.md" -type f | head -20Repository: marcusquinn/aidevops
Length of output: 79
🏁 Script executed:
# List all files in .agent directory to understand structure
find .agent -type f -name "*.md" | head -30Repository: marcusquinn/aidevops
Length of output: 1052
🏁 Script executed:
# Check the content of .agent/seo.md, focusing on lines 1-50 to see frontmatter and documented table
if [ -f ".agent/seo.md" ]; then
head -50 .agent/seo.md | cat -n
fiRepository: marcusquinn/aidevops
Length of output: 2109
🏁 Script executed:
# Get all files in .agent/seo/ directory
ls -la .agent/seo/ | tail -n +4Repository: marcusquinn/aidevops
Length of output: 605
🏁 Script executed:
# Count and list all subagent files
find .agent/seo -type f -name "*.md" | sortRepository: marcusquinn/aidevops
Length of output: 285
Remove pagespeed subagent reference or add the corresponding file.
The subagent pagespeed (line 14) is referenced in the frontmatter but .agent/seo/pagespeed.md does not exist. Either remove this reference or add the missing file. The other eight listed subagents (keyword-research, google-search-console, gsc-sitemaps, dataforseo, serper, site-crawler, eeat-score, domain-research) are correctly implemented.
Additionally, the documentation table (lines 30-40) should be updated to include domain-research and note that general and explore are built-ins.
🤖 Prompt for AI Agents
In @.agent/seo.md around lines 5 - 16, The frontmatter references a missing
subagent "pagespeed" so either remove "pagespeed" from the subagents list or add
the corresponding pagespeed subagent file; update the subagents array (e.g.,
remove the "pagespeed" entry) and, if adding, create the new pagespeed subagent
document with the same structure as the other subagents. Also update the
documentation table to add "domain-research" as an entry and mark "general" and
"explore" as built-ins so the table accurately reflects available subagents.
🤖 Augment PR SummarySummary: Adds per-primary-agent Changes:
Technical Notes: Filtering is implemented via generated OpenCode config ( 🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if subagents: | ||
| subagent_filtered_count += 1 | ||
| primary_agents[display_name] = get_agent_config(display_name, filename, subagents) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subagent_filtered_count increments on any truthy subagents value, but filtering is only applied when subagents is a non-empty list in get_agent_config(). This can make the end-of-run “Subagent filtering” summary look successful even if frontmatter is malformed (e.g., subagents: foo).
🤖 Was this useful? React with 👍 or 👎
Response to CodeRabbit ReviewRe: "Invalid subagent names"The subagent names are correct. The $ ls ~/.config/opencode/agent/ | head -5
101domains.md
agent-review.md
api-key-setup.md
...So Re: "Missing pagespeed subagent"
$ ls ~/.config/opencode/agent/ | grep pagespeed
pagespeed.mdRe: Parser robustnessAlready addressed in commit 0b57978 based on Gemini feedback - added comment handling, specific exception types, and warning messages. Re: health.md context7Fair point - |
context7 provides library/framework docs, not health information. crawl4ai is sufficient for health research workflows. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Wed Jan 14 00:31:49 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |



Summary
Add
subagents:frontmatter to primary agents that specifies which subagents should appear in the Task tool description. This reduces token overhead by filtering 220 subagents down to 3-30 per agent.Changes
parse_frontmatter()togenerate-opencode-agents.shpermission.taskdeny-list rules from subagents listsubagents:frontmatter to all 13 primary agentsHow It Works
In agent frontmatter (e.g.,
.agent/seo.md):setup.shgenerates (in~/.config/opencode/opencode.json):Token Savings
Average reduction: ~94% fewer subagents in Task tool description per agent.
Related
subagentsconfig)Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.