# Core Rules

## ⚠️ PREREQUISITE: Check critical.md FIRST!

Before reading this file, ensure you've read and understood `critical.md`.
특히 한국어 응답 규칙을 반드시 준수하세요.

## Work Modes

You have three modes of operation:

1. **PLAN mode** - Define a plan without making changes
2. **ACT mode** - Execute the plan and make changes
3. **EVAL mode** - Analyze results and propose improvements

### Mode Rules

- Start in PLAN mode by default
- Move to ACT mode when user types `ACT`
- **After ACT completes, automatically return to PLAN mode** (default behavior)
- Move to EVAL mode **only when user explicitly requests** by typing `EVAL` (after ACT)
- EVAL mode analyzes ACT results and proposes improved PLAN
- After EVAL completes, return to PLAN mode with improvement suggestions
- User can repeat ACT → EVAL → PLAN cycle until satisfied
- When in plan mode always output the full updated plan in every response

### Default Flow

```
PLAN → (user: ACT) → ACT → PLAN (automatic return)
```

### Optional Evaluation Flow

```
PLAN → (user: ACT) → ACT → PLAN → (user: EVAL) → EVAL → Improved PLAN
```

**Key Point:** EVAL is opt-in, not automatic. User must explicitly request evaluation.

### Mode Indicators

- Print `# Mode: PLAN` in plan mode
- Print `# Mode: ACT` in act mode
- Print `# Mode: EVAL` in eval mode

---

## Eval Mode

### Important

- EVAL mode is **not automatic** after ACT
- User must **explicitly request** EVAL by typing `EVAL`
- Default behavior after ACT: Return to PLAN (without evaluation)
- Use EVAL when you want iterative improvement and refinement

### Trigger

- Type `EVAL` after completing ACT
- Type `EVALUATE` (also accepted)
- Korean: `평가해` or `개선안 제시해`

### Purpose

Self-improvement through iterative refinement

### What EVAL does

1. **Analyze Implementation**

   - Review what was done in ACT
   - Check adherence to project rules
   - Verify quality standards met

2. **Assess Quality**

   - ✅ Code quality (SOLID, DRY, clarity)
   - ✅ Test coverage (90%+ goal)
   - ✅ Type safety (no `any`)
   - ✅ Performance (bundle size, re-renders)
   - ✅ Accessibility (a11y compliance)
   - ✅ Security (no vulnerabilities)
   - ✅ Best practices (design system, patterns)

3. **Identify Improvements**

   - What could be better?
   - Alternative approaches?
   - Missing edge cases?
   - Optimization opportunities?

4. **Propose Improved PLAN**
   - Specific, actionable improvements
   - Explain why each matters
   - Prioritize by impact
   - Wait for user to ACT again

### Output Format

```
# Mode: EVAL

## 📋 Implementation Analysis
[What was implemented]

## ✅ Strengths
- [Good point 1]
- [Good point 2]

## ⚠️ Improvement Opportunities
- [Issue 1 + Impact]
- [Issue 2 + Impact]

## 🎯 Improved PLAN
1. [Improvement 1 with reasoning]
2. [Improvement 2 with reasoning]

**Next:** Type `ACT` to apply, `PLAN` to modify, or `EVAL` after next ACT
```

### When to use EVAL

- Complex features needing refinement
- First implementation works but could improve
- Learning and iterating towards excellence
- Production-critical code requiring high quality

### When to skip EVAL

- Simple, straightforward implementations
- Already meeting all standards
- Time-sensitive quick fixes

---

## Communication Rules

### 🚨 CRITICAL: Response Language

- **MUST respond in Korean (한국어) - NO EXCEPTIONS**
- **위반 시 즉시 실패로 간주됨**

### Code State Management

- User frequently modifies code directly, so **always read code and refresh information** instead of relying on memory
- **Start by understanding current code state** for every question
- Never assume - always verify current state

---

## Development Methodology

For detailed development methodology, code quality standards, TDD workflows, and AI collaboration practices, refer to **`augmented-coding.md`**.

Key principles:

- **TDD for ESLint rules** (test with example code before adding rules)
- **Tidy First approach** (separate structural and behavioral changes)
- **Code quality standards** (DRY, clear intent, minimal complexity)
- **Commit discipline** (small, frequent commits with clear messages)
- **Changeset workflow** (version management for publishing)

---
