Learning & TutorialsAdvanced AI Engineering
Custom Rules & Verification
Enforcing coding standards with Agentic AI
Custom Rules & Verification
This project uses U-AMOS 2.0 (Universal AI Memory Operating System) to enforce strict coding standards.
1. The .cursorrules File
Located at the root of the project, this file is the "Constitution" for the AI. It defines the core constraints that must never be violated.
Real Example from our Project:
Markdown
## 🔒 Core Constraints (Never Violate)
### Architecture
- **Feature-first**: All business logic in `src/features/`, never in `src/ui/` or `src/services/`
- **Service layer**: Services are stateless, never render UI or navigate
- **Component hierarchy**: Check `src/ui/README.md` before creating components
### Code Style
- **No inline styles**: Use UI tokens from `src/ui/style/theme.ts`
- **No hardcoded text**: Use `t('key')` for all user-facing strings
- **No console.log**: Use `logger.*` from `src/services/logging/`2. The agents.md File
This file defines the Mandatory Startup Sequence that every AI agent must follow before writing a single line of code.
The Startup Sequence:
- Read Rules Index: Understand the project structure.
- Load Hot Memory: Read
.memory/40-active.mdto know what you were working on. - Anti-Hallucination: Verify files exist before importing them.
- Context Map: Load the map of the codebase to navigate efficiently.
Markdown
## 🛑 MANDATORY STARTUP SEQUENCE (Execute First)
1. **Read the Rules Index**:
- `read_file` -> `ai_rules/globalRules.md` (Master Index)
2. **Load Hot Memory Tier**:
- `read_file` -> `.memory/40-active.md` (Current Focus)
3. **Check Anti-Hallucination Checklist**:
- `read_file` -> `ai_rules/rules/context_management.md`3. How to Modify Rules
To change these rules:
- Edit
.cursorrulesfor high-level constraints. - Edit
ai_rules/rules/*.mdfor specific domain rules (e.g., Testing, UI). - The AI will automatically pick up the changes in the next session.