We are living in the era of “Vibe Coding”—where you don’t need to be a professional engineer to build software; you just need to guide the AI.
But when it comes to Financial Trading Systems, letting an AI write code can be terrifying.
- 😨 “What if the AI writes an infinite loop and drains my API quota in 5 minutes?”
- 💸 “What if a bug accidentally executes a market buy order for 1,000 shares?”
- 🧠 “What if the AI hallucinates and forgets my risk management rules?”
To solve these fears, I introduced Project Antigravity. It is a framework designed to ensure “Zero Cost, Zero Risk” during development. Today, I’m sharing the 4 Golden Rules of Antigravity that will protect your bank account while you code.
1. The Core Philosophy: “Fortress Architecture” 🏰
We never let the AI code blindly. We draw “Lines in the Sand” first. In Antigravity, the priority isn’t speed—it’s Survival and Resource Protection.
- ✅ Mock-First: We only use fake data during development. (API Cost = $0).
- ✅ Safety Switch: The app cannot communicate with the outside world until you physically toggle a UI switch.
- ✅ Anti-Ban: The system mimics human behavior (Jitter) to prevent your IP from being blocked by data providers.
- ✅ External Memory: We give the AI an external “brain” file so it never forgets the context.
2. The System: 4 Absolute Rule Files
Before writing a single line of code, we place 4 “Constitution” files in the ./agent/ folder. The AI must follow these rules like the law.
📂 1. UI/UX Rules (Frontend_Rules.md)
- Motto: “Don’t fetch data without permission.”
- Key Feature: Sim/Live Switch
- A prominent toggle on the dashboard.
- It defaults to Green (Simulation).
- Switching to Red (Live) must trigger a warning popup.
📂 2. Backend Rules (Backend_Rules.md)
- Motto: “API calls are the last resort.”
- Key Feature: The Filter Chain
- Requests must pass [Static Validation] → [Cache Check] → [Budget Check] before touching the network.
- Key Feature: Anti-Ban Logic
- No 1-second loops! When scraping (e.g., Finviz, Yahoo Finance), it must mix in random delays (“Jitter”) to look human.
📂 3. Workflow Rules (Workflow_Rules.md)
- Motto: “Schema first, Code later.”
- Key Feature: Phase 2 Strategy
- In the early stages, disconnect the internet and build using
mock_data.jsononly.
- In the early stages, disconnect the internet and build using
- Key Feature: Fail-Fast
- Check for failure conditions (Market closed? Insufficient funds?) before performing expensive calculations.
📂 4. External Memory (AI_MEMORY.md)
- Motto: “AI has amnesia. Write it down.”
- Key Feature:
- Tracks the current Phase, completed tasks, and next steps.
- Even if the AI crashes or the session disconnects, reading this file (
"RESTORE_CONTEXT") brings it back to life instantly.
3. How to Start: The Setup Guide 🛠️
Let’s build your safe environment.
Step 1. Create the Folder Structure
Create a project folder and arrange the files as shown below. The .agentrules file acts as a compass, telling the AI where to look.
Project_Root/
├── .agentrules <-- (Config: "Always reference the ./agent folder")
├── agent/ <-- (The Rules Folder)
│ ├── Frontend_Rules.md
│ ├── Backend_Rules.md
│ ├── Workflow_Rules.md
│ └── AI_MEMORY.md <-- (Create as an empty file)
└── src/Step 2. The Kick-off Prompt
Paste the command below into your AI Editor (Cursor, Windsurf, etc.) to boot up the system in Safe Mode.
👇 COPY & PASTE THIS 👇
“Initiate Project Antigravity. Reference
.agentrulesto load all context from the./agent/folder (Frontend, Backend, Workflow, Memory).Your Mission:
- Initialize
AI_MEMORY.mdand set the status to Phase 1.- Confirm that Anti-Ban logic and API Cost Reduction rules are active.
- Verify that we are in SIMULATION MODE.
- Begin the interview to establish the development roadmap.”
4. Pro Tips: Magic Spells for AI Control 🪄
As you develop, if the AI starts acting “dumb” or loses focus, use these commands:
- The Resurrection Spell:“RESTORE_CONTEXT”
- Effect: The AI reads
AI_MEMORY.mdand instantly remembers where it left off.
- Effect: The AI reads
- The Save Game Spell:“Before implementing this feature, UPDATE_MEMORY first.”
- Effect: Ensures your progress is saved in the text file before the AI attempts complex code.
- The Safety Inspection Spell:“Run UI_AUDIT.”
- Effect: The AI scans your code to find any components that might be secretly calling APIs in the background.
🎯 Conclusion: The Freedom to Fail
The rules of Antigravity aren’t meant to restrict you. They are meant to give you “The Freedom to Fail Safely.”
Inside this Fortress Architecture, you can test wild trading strategies, mess up the code, and experiment without fear of losing money or getting your API keys banned.
Apply these rules today, and start your Vibe Coding journey with confidence! 🚀