◉ANTIGRAVITY LABJP
Articles/Agents & Manager
◈ Agents & Manager/2026-10-13Beginner

Turning Gut-Feeling Judgments into Rules an Agent Can Actually Follow

A repeatable way to turn the judgment calls that live only in your head into rules an Antigravity agent can apply: build conditions from past cases, choose where in .agents/rules they live and which trigger to use, catch rules that are silently ignored, and replay old cases before trusting them.

antigravity477agents152rules4prompt-design3beginner21

The first time I handed store review replies to an agent, the request felt clear enough: sort out which reviews deserve an answer, leave the rest alone, and draft replies for the ones that do. I started reading the list that came back and stopped a few rows in.

A one-line, one-star rant had a long, careful reply attached. A review that described a real bug got a stock thank-you. The ordering was close to the reverse of what I would have done.

The agent wasn't being careless. I had simply never written down the sorting I do in my head. I only noticed when I began fixing the drafts by hand and couldn't explain what rule I was fixing them against.

So the one thing I'd ask you to keep is this: write judgment rules by rearranging past decisions, not by describing your instincts. You don't need to write code. Five finished jobs are enough to start. After that, I'll walk through where the rule should live in Antigravity, which loading mode to give it, and how to catch a rule that is sitting in the right folder but never being read.

Why "my usual feel" doesn't transfer

Most of what we decide on familiar work never becomes words. When I decide whether to answer a review, I'm weighing tone, timing, and what the same person wrote before — without noticing I'm doing it.

Telling an agent to "use good judgment" hands that unspoken part over to guesswork. Guesses drift toward the average of the whole world, not the average of my work.

What you give an agent is not a personality. It's a set of boundary examples.

"Be careful" and "be polite" decide nothing. "In this case reply, in that case don't" decides a lot.

Step 1: List five recent cases, with outcomes

Pick five real cases where you already made the call. Not hypothetical ones.

I took five reviews of my wallpaper app and wrote "replied" or "didn't reply" next to each, plus a one-line reason. It's fine if a reason changes while you write. The places where it changes are the most useful part.

CaseMy callReason I found while writing
A review describing a specific bugReplyI can see how to reproduce it, and I'll want to say when it's fixed
A feature request onlyDon't replyA reply reaches no one. Log the request elsewhere
An emotional, empty short commentDon't replyReplying tends to make it worse
A low rating based on a misunderstandingReplyOne sentence clearing it up is enough
A thank-you reviewDon't reply (rarely, do)Only when they describe how they use the app

Building this table is where I first put "don't answer emotional, empty comments" into words. The "rarely, do" on the last row was an exception I hadn't known I had.

One tip: make one of the five the case you hesitated over most at the time. If every case was an easy call, the table never shows you where the boundary actually is.

Step 2: Turn each reason into an "if… then…" line

Next, rewrite the reason column as conditions an agent can check. The shape is short: if (situation) then (action), except when (exception) then (other action).

My first attempt looked like this:

Handle reviews sincerely.
Reply politely to bug reports and thank people for feature requests.
Be careful with negative content.

Reading it back, every line says how to feel and none says where to draw the line. Does "be careful" mean reply or don't reply? The agent has no way to know.

Rewritten from boundary examples:

When unsure whether to reply, check in this order.
1. A reproducible bug is described -> draft a reply
2. A feature request only -> no reply; add one line to the request list
3. An emotional, empty short comment -> no reply; just report it to me
4. A thank-you -> usually no reply; draft one if it names a feature or an action
If still unsure, don't draft anything. Add a one-line reason and ask me.

The order matters. Checking top to bottom settles the awkward cases, like a thank-you that also mentions a bug.

The last line matters more than it looks. Deciding in advance what to do when unsure stops the agent from inventing an answer.

Step 3: Decide where the rule lives, and how it loads

For a while I pasted text like this at the top of each conversation. Every new conversation meant pasting again, and on the days I forgot, the sorting fell apart. Putting it in a rule file removes that chore entirely.

According to the Rules page of the official docs (checked November 2026), Antigravity discovers rules from these places, the same across the App, CLI, and IDE:

LocationScopeFrontmatter
AGENTS.md or GEMINI.md (in the workspace and parent folders up to the repo root)That workspaceNone. Always active
.agents/rules/*.md (legacy .agent/rules/ also works)That workspaceRequired (trigger)
Standalone files such as ~/.gemini/GEMINI.mdEvery projectNone. Always active
~/.gemini/config/rules/*.mdEvery projectRequired (trigger)

Rules are cumulative rather than replacing one another. If you write a reply rule both globally and in the workspace, both apply at once.

Files in .agents/rules/ choose how they load through trigger:

triggerHow it loadsGood for
always_onFull text on every turnShort constraints that hold for any task
model_decisionOnly the path and description up front; the full rule is read when the task matchesJudgment criteria for one kind of job
globWhen the agent touches files matching globsConventions tied to a file type
manualOnly when you @-mention it (not supported in the CLI)Checklists you use occasionally

For a judgment rule like review replies, I'd choose model_decision. There's no reason to carry the full sorting rule into conversations that have nothing to do with replies. Mine looks like this:

---
trigger: model_decision
description: "Read when deciding whether to reply to a store review, or when drafting a reply"
---
# Sorting review replies
When unsure whether to reply, check in this order.
1. A reproducible bug is described -> draft a reply
2. A feature request only -> no reply; add one line to the request list
3. An emotional, empty short comment -> no reply; just report it to me
4. A thank-you -> usually no reply; draft one if it names a feature or an action
If still unsure, don't draft anything. Add a one-line reason and ask me.

The part that matters most is writing description as when to read it. With model_decision, that single line is all the agent sees at first. "Review reply rules" is a name; "read when deciding whether to reply, or when drafting a reply" is a situation, and situations are what the agent matches against.

Step 4: Find rules that are in place but never read

I once lost half a day to a rule that changed nothing. I kept rewriting its content. The real cause was one word in the frontmatter.

The docs say that if a file in .agents/rules/ has no frontmatter, or uses an unrecognized trigger value — camelCase like alwaysOn or modelDecision included — the rule is silently discarded. No error. Files inside subfolders are also ignored unless you register them in .agents/rules.json.

So I wrote a small checker. Python 3.10+, no dependencies. (Its messages are in Japanese because that's how I run it; the logic is what matters.)

#!/usr/bin/env python3
"""ワークスペースの .agents/rules を見て、黙って読まれない規則を洗い出す。"""
import sys, re, pathlib
 
VALID = {"always_on", "model_decision", "glob", "manual"}
LIMIT = 24_000  # 1 ファイルあたりのバイト数(@ 取り込みを展開する前の概算)
 
root = pathlib.Path(sys.argv[1] if len(sys.argv) > 1 else ".")
rules = root / ".agents" / "rules"
if not rules.is_dir():
    rules = root / ".agent" / "rules"   # 旧い置き場所
problems = 0
 
for p in sorted(rules.rglob("*.md")):
    rel = p.relative_to(root)
    if p.parent != rules:
        print(f"⚠ {rel}: サブフォルダの中は rules.json に登録しない限り読まれません")
        problems += 1
        continue
    text = p.read_text(encoding="utf-8")
    size = len(text.encode("utf-8"))
    m = re.match(r"^---\n(.*?)\n---\n", text, re.S)
    if not m:
        print(f"✗ {rel}: frontmatter がありません(黙って捨てられます)")
        problems += 1
        continue
    fm = dict(
        (k.strip(), v.strip().strip('"'))
        for k, v in (l.split(":", 1) for l in m.group(1).splitlines() if ":" in l)
    )
    trig = fm.get("trigger", "")
    if trig not in VALID:
        print(f"✗ {rel}: trigger '{trig}' は無効です({'/'.join(sorted(VALID))})")
        problems += 1
        continue
    if trig == "model_decision" and not fm.get("description"):
        print(f"✗ {rel}: model_decision には description が要ります")
        problems += 1
        continue
    if trig == "glob" and not (fm.get("globs") or fm.get("glob")):
        print(f"✗ {rel}: glob には globs が要ります")
        problems += 1
        continue
    note = f"  ⚠ {LIMIT:,} バイトを超えています" if size > LIMIT else ""
    print(f"✓ {rel}: {trig:<14} {size:>6} バイト / {len(text):>5} 文字{note}")
    if note:
        problems += 1
 
print(f"\n要確認 {problems} 件")
sys.exit(1 if problems else 0)

I ran it with Python 3.10.12 on a sample workspace holding the Japanese version of the reply rule, a tone rule written as trigger: alwaysOn, and an exceptions note tucked into an old/ subfolder:

⚠ .agents/rules/old/exceptions.md: サブフォルダの中は rules.json に登録しない限り読まれません
✓ .agents/rules/review-reply.md: model_decision    694 バイト /   284 文字
✗ .agents/rules/tone.md: trigger 'alwaysOn' は無効です(always_on/glob/manual/model_decision)

要確認 2 件

In plain English: the subfolder file is never loaded, the reply rule is fine, and alwaysOn is invalid. Exit code 1. That alwaysOn line is exactly where my half day went.

Notice the bytes-versus-characters column, too: a 284-character rule is 694 bytes. The documented per-file limit is 24,000 bytes, and anything beyond it is truncated. If you write rules in Japanese or another language where most characters take three bytes in UTF-8, the practical ceiling is closer to 8,000 characters. Estimate with English intuition and the exceptions at the bottom are the first thing to go missing.

Step 5: Replay past cases before you trust the rule

Once the shape is right, test the content. This is the step I most want you to keep.

Choose three older cases you didn't use in Step 1 and give them to the agent as if they were new. Check only whether its call matches yours. Don't grade the prose of the drafts.

I log each replay in a TSV and use a tiny script that prints only the mismatches:

#!/usr/bin/env python3
"""Read a replay log (TSV) and print only where the agent's call differs from mine."""
import csv, sys
 
rows = list(csv.DictReader(open(sys.argv[1], encoding="utf-8"), delimiter="\t"))
miss = [r for r in rows if r["mine"].strip() != r["agent"].strip()]
 
print(f"match {len(rows) - len(miss)} / {len(rows)}")
for r in miss:
    print(f"  x {r['case']}: me={r['mine']} / agent={r['agent']}  ... {r['agent_reason']}")
sys.exit(1 if miss else 0)

The columns are case, mine, agent, and agent_reason. Here is a sample log written against the older wording ("if they describe how they use the app"):

match 2 / 3
  x R-07 thank-you that only says "been using it for ages": me=no reply / agent=reply  ... judged usage as specific

The reason column points straight at the cause. "Describes how they use the app" was loose enough that "been using it for ages" counted. Tightening it to "names a feature or an action at least once" and replaying the same three gives "match 3 / 3" and exit code 0.

To be clear, that TSV is a sample I put together to illustrate the steps; the agent column wasn't copied from a real conversation. The script output is what the script actually printed for that sample. On your side, paste the agent's answers into the agent column as they are.

Fix only the part that drifted. If you rewrite everything, you lose track of which change helped.

Step 6: Decide where exceptions live

Once a rule grows, exceptions pile up. Add them all to the main list and it gets hard to read, and the agent starts confusing priorities.

I keep the main list to four items and put exceptions at the bottom of the same file as a short note — a date and one line each, such as "Even for thank-yous, reply if I replied to this person before."

At first I kept that note in a separate .agents/rules/old/ folder. That's the ⚠ line in the checker output above. Subfolders aren't read, so I thought I'd recorded my exceptions while the agent received none of them. Now they sit at the end of the rule file itself.

When the note gets long, I either promote an item into the main list or delete it. A monthly look has been enough for me.

When a rule doesn't seem to work

When behavior doesn't change after adding a rule, I go down this table in order. The top rows are the quickest to check.

SymptomLikely causeHow to checkFix
The rule has no effect at allMissing frontmatter, or a camelCase triggerDoes the checker print ✗?Use snake_case values such as always_on
Only some rules workFiles sit in a subfolder of .agents/rules/Does the checker print ⚠?Move them up, or register them in .agents/rules.json
Not picked up during reply workmodel_decision description is a name, not a situationPut your request next to the description: do they share words?Rewrite as "read when … / when drafting …"
Only the second half is ignoredFile exceeds 24,000 bytes and is truncatedByte count in the checkerSplit the file or prune the exceptions note
Fails when working in a subfolderRules below the workspace folder aren't loadedCompare the rule's location with the open workspacePut it in the workspace or a parent folder
Calls drift slightly every timeLoose words in the conditions ("specific", "polite")Read the reason column of your replay logUse countable conditions ("at least one …")

The first four rows are about placement, not content. I now run the checker once before touching the wording.

Common misconceptions

I used to think a longer, more careful rule would be followed better. What works is boundary examples, not length. The docs say all active global and always_on rules share a 20,000-token budget, and when the total goes over, the largest files are demoted to a one-line pointer. The longer you write, the less likely the whole text is read inline.

"Antigravity uses either AGENTS.md or .agents/rules, not both" isn't right either. They add up. Write similar rules in both and both apply, and the agent hesitates over the small differences in wording. I keep short, task-independent constraints in AGENTS.md and per-job judgment criteria in .agents/rules/.

"Just make everything always_on to be safe" is only half right. Nothing goes unread, true. But the reply-sorting rule then rides along in conversations about something else entirely, and I've seen that "reply or don't" lens leak into unrelated decisions.

Where people usually trip

Three things tend to trip people up at first. I've done all three.

  • Writing reasons after the fact to fit the conclusion. Mixing in a case you were unsure about guards against it
  • Replay cases that look too much like the originals. Choose different kinds
  • Stopping once it works. Drift shows up after seasons or circumstances change

The next thing you'll run into

Once replays line up, the next question tends to be whether this is a rule or a procedure. Sorting replies is a rule. "Draft the reply, add the request to the list, and send me a weekly summary" starts to look like a procedure. The docs themselves put constraints in rules and multi-step workflows in Skills. Where I drew that line is in Rules or Skills: deciding where an instruction belongs.

If your rule files multiply and you want to share common parts through @[label](path) includes, What actually shrinks when you split rule files with @ includes will help first. Included content counts toward the size limit after it's expanded.

Before handing over your instincts, line up the decisions they already made. That's the one line I took away from all of this.

What to do next

Pick five past cases today and make the table of outcomes and reasons. Turning it into rule text, and placing it in .agents/rules/, can wait until after that.

I've come to think the range of work I can hand to an agent is about as wide as the range of my own judgment I can put into words.

Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

◈ Agents & Manager2026-04-22
Harness Engineering for Antigravity: Put the Process in a Skill, Let a Script Judge the Finish
How to get an agent past answering single questions and actually finish a project: a six-step harness placed as a Skill, role switches, a script that checks the finish line, and the three holes my first version of that script let through, with real output.
◈ Agents & Manager2026-09-04
Snapshot Your Agents' Effective Scope So You Notice the Day a Default Changes
Antigravity 1.1.25 made Markdown-defined custom agents inherit the surrounding skills, rules, and subagents by default. Here is the snapshot-and-diff routine I now use to check whether an agent I meant to keep narrow quietly got wider after an update.
◈ Agents & Manager2026-08-21
Why I Check Description Overlap Before Turning On inheritCustomizations
CLI 1.1.14 collapsed markdown agent inheritance into a single inheritCustomizations switch. Here is what happened when I actually inventoried the 47 skills in my workspace and decided the switch on description overlap rather than on context size.