.antigravityrules 2.2 KB

1234567891011121314151617181920212223242526
  1. # Global Project Constraints
  2. 1. **Language Requirements**:
  3. - All code comments **MUST** be written in **English**.
  4. - All server and client logs (`console.log`, `logger.info`, `logger.error`, etc.) **MUST** be written in **English**.
  5. 2. **Internationalization (i18n)**:
  6. - All user-facing messages, API response messages, error messages, and UI text **MUST** guarantee internationalization support.
  7. - Do not use hardcoded string literals for messages. Always use the project's designated i18n service or translation utility with proper keys.
  8. 3. **UI Notifications**:
  9. - All popup messages, error alerts, and system notifications **MUST** uniformly use the toast component (e.g., via `useToast().showError()`, `showSuccess()`).
  10. - Never use native browser `window.alert()`.
  11. 4. **Agent Architecture & Orchestration (v3.0)**:
  12. - High-complexity, multi-turn AI workflows (e.g., AI Tutor, Evaluation Agents) **MUST** use `LangGraph` for state machine orchestration. Do not rely on hardcoded linear `if-else` blocks or flat chains for multi-step agent interactions.
  13. - Separate distinct AI responsibilities (e.g., `QuestionGenerator`, `Grader`, `ReportAnalyzer`) into independent **Graph Nodes**.
  14. - Use **Conditional Edges (Routing)** to dynamically control the flow based on the graph state (e.g., triggering follow-up questions vs. proceeding to the next question).
  15. - The graph must maintain a central `State` object (e.g., `EvaluationState`) to track session data, current progress, multi-turn dialogue history, and interruption/recovery points (Thread IDs).
  16. 5. **Agent Evaluation & Anti-Hallucination**:
  17. - When using an LLM to grade or evaluate user input against a knowledge base, the Agent's System Prompt **MUST** always include the original reference documents (Ground Truth Chunks) to strictly prevent AI hallucination during scoring.
  18. 6. **Knowledge Graph Integration**:
  19. - When extracting complex relationships from documents for GraphRAG, ensure the LLM output conforms strictly to predefined schemas (Ontology) to prevent graph pollution.
  20. - Heavy extraction tasks (like Full Document Entity/Relation Extraction) must be handled asynchronously as background tasks, rather than blocking synchronous API calls.