# Modular rules for specific subagents

**URL:** <https://discuss.ai.google.dev/t/modular-rules-for-specific-subagents/201797>\
**Category:** Google Antigravity\
**Tags:** bug\
**Created:** [November 17, 2026, 4:00pm UTC](https://discuss.ai.google.dev/t/modular-rules-for-specific-subagents/201797 "2026-11-17T16:00:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qrydor](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/qrydor/32/172421_2.png) [@Qrydor](https://discuss.ai.google.dev/u/Qrydor)\
**Post date:** [November 17, 2026, 4:00pm UTC](https://discuss.ai.google.dev/t/modular-rules-for-specific-subagents/201797/1 "2026-11-17T16:00:37Z")

</div>

Hey! I wanted to share a piece of feedback from building a setup with specialized subagents:

Certain operational rules/invariants need to apply to a specific subset of subagents (e.g., 3 out of 10), but not globally:

- Skills / model\_decision aren’t the same as a system prompt: Even if the subagent loads them every time, it adds non-deterministic cognitive overhead. More importantly, dynamically retrieved content gets pushed up into conversation history and begins to blur over long, multi-turn reasoning. A system prompt stays firmly anchored in the model’s attention across the entire run.
- Global always\_on rules bloat the shared token budget and pollute unrelated agents.
- Manually maintaining copies/includes in each agents/.md is tedious and causes config drift across dozens of subagents.

It would be awesome to modularly attach rules directly to subagents so they bake into their system prompt:

In rules/my\_rule.md:

`trigger: always_on`  
`subagents: [investigator, thread-auditor]`  
Or in agents/my\_agent.md:

`rules: [strict-evidence, formatting-invariants]`

This would give us modular, DRY composition while keeping critical invariants firmly anchored in the subagent’s system prompt.

---

<div class="post-metadata">

**Author:** ![dllhell](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/dllhell/32/162846_2.png) [@dllhell](https://discuss.ai.google.dev/u/dllhell)\
**Post date:** [November 17, 2026, 4:08pm UTC](https://discuss.ai.google.dev/t/modular-rules-for-specific-subagents/201797/2 "2026-11-17T16:08:24Z")

</div>

Your schema diagnosis matches what the current loader implements: [Rules](https://antigravity.google/docs/rules) frontmatter only accepts `trigger` (`always_on`, `model_decision`, `glob`, `manual`), `description`, and `globs`, while [Custom subagents](https://antigravity.google/docs/subagents) only accepts `name`, `description`, `tools`, `mainAgent`, `subagent`, `model`, `commandExecutionPolicy`, `mcpServers`, and `skills`/`plugins`. Neither supports a `subagents:` or `rules:` key yet, and `@[label](path)` inline includes are documented for rule files (`AGENTS.md`, `GEMINI.md`, `.agents/rules/*.md`) rather than `agents/*.md` bodies.

Until native per-subagent frontmatter exists, keep shared rules in `.agents/rules/*.md` (e.g. `trigger: manual`), keep agent headers outside `.agents/` so they are not double-discovered, and compile targeted `agents/*.md` system prompts with YAML frontmatter stripped (or compose `SystemPrompt` dynamically via `define_subagent` / `/run-workflow`):

```python
from pathlib import Path
import re
TARGETS = {"investigator": ["strict-evidence.md", "formatting.md"], "thread-auditor": ["strict-evidence.md"]}
for agent, mods in TARGETS.items():
    head = Path(f"agent-templates/{agent}.md").read_text(encoding="utf-8").rstrip()
    parts = [re.sub(r"\A---\s*\n.*?\n---\s*\n", "", Path(f".agents/rules/{m}").read_text(encoding="utf-8"), count=1, flags=re.S).strip() for m in mods]
    Path(f".agents/agents/{agent}.md").write_text(head + "\n\n" + "\n\n".join(parts) + "\n", encoding="utf-8")

```

Running that in a pre-commit hook keeps each rule single-sourced inside `.agents/rules/` while baking invariants straight into the selected subagents’ system prompts. For constraints that still stay global near the 20,000-token rules budget, symbolic `[SCOPE: REQUIRE !FORBID]` directives also cut pre-fill bloat alongside cross-file sync - the pattern used in [governance-guard](https://gist.github.com/Tom-Zafred/7be8e3efcf9b76d27945eaa3dc44ae49) - while native `rules:` / `subagents:` support remains the ideal upstream fix.

---

<div class="post-metadata">

**Author:** ![Qrydor](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/qrydor/32/172421_2.png) [@Qrydor](https://discuss.ai.google.dev/u/Qrydor)\
**Post date:** [November 17, 2026, 4:31pm UTC](https://discuss.ai.google.dev/t/modular-rules-for-specific-subagents/201797/3 "2026-11-17T16:31:29Z")

</div>

thanks for your reply and suggestions!
