DEV Community

kanta13jp1
kanta13jp1

Posted on

Modular Rules, Lazy-Loaded Skills, and Read-Only Subagents: Structuring Antigravity Workflows Without Context Bloat

When you rely on an AI coding agent across repositories, publishing pipelines, and daily audits, the first bottleneck you hit is rarely model intelligence. It is context bloat.

Every time you append another workflow checklist, formatting rule, or API quirk into a global system file, your agent starts every session heavier, slower, and more prone to subtle instruction collisions. After scaling our workspace to 40 operational tracks on Google Antigravity, the cleanest solution we found is a strict three-layer harness architecture: thin always-on rules, lazy-loaded skills, and read-only subagents.

1. Keep Always-On Rules as a Thin Constitution

Files loaded on every turn should behave like a safety constitution, not an operations manual.

  • Universal invariants only (secret redaction, zero speculation on unverified metrics, destructive action confirmation)
  • OS and encoding baselines (for example, UTF-8 without BOM and LF consistency on Windows PowerShell workflows)
  • Routing pointers telling the agent which on-demand skill to consult before touching a specific domain

Once we moved domain workflows out of global rules, unrelated tasks stopped drifting under irrelevant constraints.

2. Isolate Domain Playbooks into Lazy-Loaded SKILL.md Modules

Domain-specific procedures—whether cleaning up local caches, auditing cross-platform content quotas, or checking a database schema—belong in modular SKILL.md playbooks loaded only when needed.

  • Skill-first gating: Read the matching SKILL.md before running external API calls, edits, or parallel subagents so preflight guards (like FIFO locks or duplicate-post checks) are never bypassed.
  • Single-responsibility updates: Updating a publishing rule touches one skill file instead of rewriting a monolithic prompt.
  • Zero idle token tax: Specialized workflows cost zero context tokens on days you do not touch them.

3. Offload Broad Reconnaissance and Reviews to Read-Only Subagents

Running broad code searches or pre-release security reviews directly in your main execution thread floods working memory with raw grep output and long file excerpts.

Splitting those phases across minimal-privilege subagents solves both clarity and safety:

  • A lightweight fast-scout subagent (read-only, no write or shell permissions) maps files, inventories configs, and returns concise facts.
  • A deep-reviewer subagent (read-only) performs adversarial design and edge-case audits before edits begin.
  • The main agent keeps a clean context focused on editing, running deterministic unit tests, and verifying rendered outputs visually.

Where Do You Draw the Line?

Reliable agent workflows feel less like crafting one clever prompt and more like software modularization: small interfaces, explicit guards, and least-privilege execution.

How are you structuring multi-domain agent workflows in your own projects—do you isolate research and review into read-only subagents, or prefer keeping everything in a single context with stricter tool filtering? Share your approach or trade-offs in the comments below.

Top comments (2)

Collapse
 
userxnom profile image
Abdullah Naseer •

Kanta, the line that makes this one land is "zero idle token tax" — specialized workflows costing nothing on days you don't touch them is the whole point of lazy-loading, and the skill-first gating is the part most people skip: reading the SKILL.md before the API calls so the preflight guards (FIFO locks, duplicate-send checks) actually run instead of being discovered after the damage. The read-only subagents are the same idea applied to context: the main agent never pays for the recon it didn't need.

The failure mode I would watch is the one your structure moves rather than removes: once the fast-scout hands the main agent a context packet, the main agent edits from the scout's summary, not the source. If the scout's packet is wrong — a missed config, a stale inventory — the main agent has no way to know. Does the deep-reviewer re-check the scout's packet before edits begin, or does the main agent re-read the source files for anything it is about to change?

Collapse
 
kanta13jp1 profile image
kanta13jp1 •

Great catch, Abdullah — you are right that a blind handoff from fast-scout would only shift stale-state risk rather than remove it.

In our workflow, the main agent always re-reads the exact target lines of any file right before editing (especially shared files where concurrent sessions may append). fast-scout serves as an index for discovery (paths and line ranges), while deep-reviewer independently inspects the underlying files and contracts on high-risk or multi-repo changes — never treating a summary packet as a substitute for reading the edited source.