How to Configure Google Antigravity for Complex WSL Workflows| Sabbirz | Blog

How to Configure Google Antigravity for Complex WSL Workflows 🐧✨

Custom Agent Rules

Teaching Antigravity to Respect Your Linux Permissions & Custom Project Structure

Welcome to the future of coding! 🌟 We're all buzzing about AI-assisted development, right? I recently took the plunge with Google's Antigravityβ€”an agent-first IDE that promises to be your ultimate coding co-pilot. The dream? An AI that understands your intentions, navigates your repo, and executes terminal commands like a seasoned pro.

But... reality has a way of humbling us. πŸ˜…

The promise was incredible. The execution? faster than I expected, but it hit a major snag almost immediately.

The Reality Check: AI vs. Complex Environments πŸ€–πŸ’₯

I spend my days working with Frappe and ERPNext inside WSL (Windows Subsystem for Linux).

If you're a Frappe developer, you know the "Golden Rule" by heart: Permissions are Sacred. πŸ›‘οΈ You NEVER run bench commands as root. Doing so is the fastest way to corrupt your file ownership, break your site, and ruin your weekend.

But Antigravity? It didn't know that. πŸ€·β€β™‚οΈ

The "Root" Reflex πŸ›‘

I opened my Frappe project, feeling optimistic. I asked the agent to help me run a simple migration. The agent, eager to please, cheerfully suggested:

sudo bench migrate

Panic Mode: Engaged. 🚨

My heart skipped a beat. The AI wasn't "dumb"β€”it was just making generic assumptions. It likely assumed it was running in a disposable, ephemeral Docker container where being root is standard practice.

It had zero clues about my specific reality:

  1. My User: I am sab, not root. πŸ‘€
  2. My Structure: It's custom. Bench is in ~/env14, project is in ~/f16. πŸ“‚
  3. The Law: NO sudo for bench commands! 🚫

I realized that if I had to micromanage every command and correct the AI constantly, this "assistant" would become a burden. I'd be better off just typing the commands myself.

The Fix: Give Your AI an "Identity Card" πŸ†”βœ¨

Here represents the true power of Antigravity. It listens. πŸ‘‚

Antigravity checks for configuration files before it acts. You can creates a "Rules of Engagement" fileβ€”a simple text file that tells the AI exactly who you are, where your stuff lives, and how to behave.

Here is how I solved the "Root Reflex" in under 2 minutes:

Step 1: Create the Rules File πŸ“

Inside your project folder, create this specific directory path and file:

[project folder]/.agent/rules/environment.md

Create AI Agent Rules folder

(This is where the magic happens!) ✨

Note: Antigravity should identify this file automatically. Make sure you select the correct activation mode when prompted! βœ…

Set Activation Mode

Step 2: Define Your Context 🧠

Paste the following content into your environment.md file. Adjust the paths and usernames to match your setup.

Custom Rules for AI Agent

Run the project

1. Do not run any command as root or ask for it
2. Switch to the user `sab` using the command `su sab`, do not run `su` command with `-c`
3. Navigate to home directory of sab using the command `cd`
4. Activate the virtual environment where bench is installed which ch `source env14/bin/activate`
5. Navigate to the bench directory `cd f16/`
6. Run the project `bench start`

Step 3: Enjoy the Smooth Sailing β›΅

Once this file is in place, Antigravity reads it before executing tasks. It understands your constraints. It respects your bench environment. It becomes the partner it was promised to be.

You Are the Captain πŸ‘©β€βœˆοΈ

AI tools are powerful, but they need direction. By providing clear compilation rules and context, you transform a generic assistant into a specialized expert that knows your workflow inside out.

Don't let the AI guess. Tell it who you are. Happy coding! πŸ’»πŸš€

Related posts