๐ 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)
- “Refer to .agentrules…”: It stops the AI from hallucinating files. It forces it to look exactly where we told it to.
- “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. - “Memory Initialization”: It creates a clean slate in
AI_MEMORY.md. The AI will now write its own progress report here. - “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/.
- Rule Check: Frontend, Backend, Workflow loaded.
- Safety Active: Anti-Ban (Jitter/Rate Limiting) & Budget Manager active.
- Memory: Reset to Phase 1.
- 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! ๐