# Developer Guidelines: Internal Cursor Code Editor

This repository contains our custom-built **Internal Cursor** coding assistant editor. To maximize speed and productivity while keeping API token billing under control, we are adopting the following team guidelines for AI-assisted development.

---

## 1. AI Usage Policies

### 🟢 Daily Default Model: Gemini (Google Antigravity)
* **Usage**: Default & mandatory for all daily/routine tasks.
* **Cost**: Flat monthly fee ($20/month Gemini Advanced or flat-fee API limits). There is no per-token billing or extra cost.
* **Allowed Tasks**: Drafting boilerplate, writing standard functions, formatting, generating unit tests, code translation, and explaining code logic.

### 🟡 Advanced Models: Claude & ChatGPT (OpenAI)
* **Usage**: Restricted to complex, architectural, or highly challenging tasks.
* **Cost**: Per-token API billing.
* **Requirement**: **Please get Alan's permission** before using these models for complex features.
* **Allowed Tasks**: Tricky system-level debugs, deep refactoring of legacy code with subtle race conditions, or complex multi-step logical operations.

---

## 2. Editor Features & How to Use

Our Internal Cursor consists of:
1. **PHP Web IDE (for PC)**: Serves a full Monaco-powered IDE inside the browser, allowing you to browse/edit local files and chat with Gemini, Claude, or ChatGPT.
2. **Flutter Mobile Editor**: A companion app for viewing and editing files, integrated with the same AI backend.

### Setup Instructions

#### Running the Backend & Web IDE (PC)
1. Navigate to the `backend/` directory.
2. Spin up a local PHP server using the command:
   ```bash
   php -S localhost:8000
   ```
3. Open your browser and navigate to `http://localhost:8000` (or `http://localhost:8000/index.php`).

#### Configuring API Keys
1. Open the Web IDE.
2. Click **Settings** in the top navigation bar.
3. Generate your API keys (e.g. create a free-tier Gemini API key via [Google AI Studio](https://aistudio.google.com/)).
4. Paste the key into the input fields.
5. All keys are saved securely in your browser's local storage (`localStorage`) and are only sent directly to the local proxy script (`backend/api.php`) to interface with the AI endpoints.
