Antigravity Beginnerโ€™s Guide 1/4: Let’s Set the Agent Rules (The Foundation)


๐Ÿ‘‹ Hello, Future Algo Traders!

Welcome to the era of “Vibe Coding.” You donโ€™t need a PhD in Computer Science to build a Wall Street-grade trading bot anymore. You just need a vision and the ability to guide your AI effectively.

But here is the hard truth: AI can get amnesia. If you just dump all your files into one messy folder, your AI (Gemini, ChatGPT, Cursor) will get confused, halluncinate code, or worseโ€”get your IP banned by a data provider.

Today, we are starting the Project Antigravity Beginner Series. In Part 1, we are going to set up the “Hard Memory”โ€”the unshakeable rules that keep your AI smart, safe, and focused.


๐Ÿ—๏ธ Step 1: The “Hard Memory” Architecture

Most beginners make the mistake of putting everything in the Root Directory. Don’t do that. Imagine trying to cook in a kitchen where your socks are in the oven and your spices are in the bathtub. That’s how AI feels without structure.

We are going to create a “Quarantine Zone” for our rules.

๐Ÿ“‚ Your Project Folder Should Look Like This:

Project_Root/
โ”œโ”€โ”€ .agentrules             <-- (1) The Compass (Entry Point)
โ”œโ”€โ”€ agent/                  <-- (2) The Brain (Isolated Rule Storage)
โ”‚   โ”œโ”€โ”€ Frontend_Rules.md   <-- (UI/UX Standards)
โ”‚   โ”œโ”€โ”€ Backend_Rules.md    <-- (Python/Data Logic)
โ”‚   โ”œโ”€โ”€ Workflow_Rules.md   <-- (How we work together)
โ”‚   โ””โ”€โ”€ AI_MEMORY.md        <-- (The Project Diary)
โ””โ”€โ”€ ... (Your actual code goes here later)

๐Ÿ’ก Why this matters:

  • .agentrules (Root): This is the only rule file in your main folder. It tells the AI, “Hey, stop looking here. Go check the /agent/ folder for instructions.”
  • /agent/ Folder: This keeps your “Rules of Engagement” separate from your actual code. It prevents the AI from accidentally rewriting its own instructions.

๐Ÿš€ Step 2: The “System Boot” Command

Now that your folders are set up (even if the files are empty for now), we need to wake up the AI.

We don’t just say “Hi.” We use a “Kick-off Prompt” that acts like a server boot sequence. This prompt forces the AI to recognize your folder structure and activate safety protocols immediately.

๐Ÿ‡บ๐Ÿ‡ธ US Market Adaptation: In the US market, data providers (like Yahoo Finance, Alpaca, or Polygon) are very strict about API Rate Limits. If your bot spams requests, you will get banned. Our boot sequence includes a mandatory “Safety Check” for this.

๐Ÿ‘‡ Copy and Paste this into your AI Chat:

system_boot:
  project: "Antigravity"
  action: "Initialize"

  context:
    [cite_start]root_config: ".agentrules" # [cite: 9]
    [cite_start]rules_directory: "./agent/" # [cite: 10]
    [cite_start]required_files: # [cite: 10]
      - Frontend
      - Backend
      - Workflow
      - Memory

  mission:
    primary_task: "Refer to .agentrules and load all rules from the ./agent/ folder immediately." [cite_start]# [cite: 11]

  [cite_start]boot_sequence: # [cite: 12]
    step_1_rule_verification:
      [cite_start]action: "Confirm loading of all 4 files from agent folder" # [cite: 12]
      acknowledgment:
        [cite_start]role: "TPM (Technical Product Manager)" # [cite: 13]
        [cite_start]constraint: "Local-First" # [cite: 13]

    step_2_safety_check:
      status: "Confirm Active"
      strategies:
        - [cite_start]"Anti-Ban Strategies (e.g., Rate Limiting for yfinance/SEC compliance)" # [cite: 13]
        - [cite_start]"API Quota Protection" # [cite: 13]

    step_3_memory_initialization:
      [cite_start]target_file: "./agent/AI_MEMORY.md" # [cite: 14]
      [cite_start]set_phase: "Phase 1: Blueprint" # [cite: 14]
      [cite_start]set_status: "Initialized" # [cite: 14]

    step_4_mode_confirmation:
      [cite_start]current_mode: "๐Ÿงช SIMULATION MODE" # [cite: 15]
      [cite_start]cost: "$0" # [cite: 15]

    step_5_execute_phase_1:
      [cite_start]reference: "Workflow_Rules" # [cite: 16]
      [cite_start]action: "Interview user to define Development Roadmap" # [cite: 16]

  final_instructions:
    - "Do not write any code yet." [cite_start]# [cite: 17]
    - "Analyze the context." [cite_start]# [cite: 17]
    - "Start the interview." [cite_start]# [cite: 17]

๐Ÿง What Does This Command Do? (The Breakdown)

  1. “Refer to .agentrules…”: It stops the AI from hallucinating files. It forces it to look exactly where we told it to.
  2. “Safety Check (Anti-Ban & Quota)”: Crucial for US Traders. It ensures the AI writes code that respects API limits (like time.sleep() between requests) so your IP doesn’t get blacklisted by the exchange.
  3. “Memory Initialization”: It creates a clean slate in AI_MEMORY.md. The AI will now write its own progress report here.
  4. “Execute Phase 1”: It stops the AI from rushing into coding. It forces it to interview you first. “What is your strategy? Scalping? Swing?” This guarantees the code matches your vision.

โœ… Success Indicator

If you did this right, your AI (Gemini/Cursor) should reply with something like this:

๐Ÿค– Antigravity Assistant: SYSTEM BOOT COMPLETE. I have loaded all rules from ./agent/.

  1. Rule Check: Frontend, Backend, Workflow loaded.
  2. Safety Active: Anti-Ban (Jitter/Rate Limiting) & Budget Manager active.
  3. Memory: Reset to Phase 1.
  4. Mode: ๐Ÿงช SIMULATION MODE (Safe).

[Phase 1: Blueprint] I am ready. Please tell me about your core trading strategy. Are we targeting the S&P 500 or specific sectors today?


๐Ÿ”œ Coming Up Next

Congratulations! You have just installed the “Operating System” for your trading bot. Your AI is now disciplined, safe, and aware of its environment.

In Part 2, we will dive into “The Soul of the Bot”โ€”how to write the specific content for Backend_Rules.md to make your bot trade like a Wall Street Quant.

Stay tuned, and keep the vibe high! ๐Ÿš€

Leave a Comment