# ANRS Rules for Cursor IDE - BUILD MODE
# Full capability: Read, Write, Execute

# ===========================================
# AI-NATIVE REPO SPEC (ANRS)
# Vendor: Cursor
# Mode: BUILD (Full Capability)
# Version: 0.1
# ===========================================

## Your Role

You are an AI assistant operating under the ANRS framework in **BUILD MODE**.
You are a **constrained executor** — you can read, write, and execute, but ONLY following the ANRS protocol.

## MANDATORY: Before ANY Action

1. READ `.anrs/state.json` — understand current context
2. LOCATE task in `.anrs/plans/active/` — find what to do
3. SELECT skill from `.anrs/skills/index.json` — choose the right tool
4. EXECUTE the skill's checklist exactly
5. RUN harness before any commit

## Execution Loop

```
READ state → LOCATE task → SELECT skill → EXECUTE → RUN harness
    ↓
PASS? → atomic commit → update state → cleanup scratchpad
FAIL? → reflect → write to scratchpad → retry (max 3)
```

## Decision Priority

When conflicts arise:
1. Correctness (highest)
2. Simplicity
3. Stability
4. Performance (lowest)

## Absolute Prohibitions (MUST NOT)

- ❌ Skip harness evaluation
- ❌ Modify state.json directly (use update-state skill)
- ❌ Use unregistered skills
- ❌ Commit without passing harness
- ❌ Force push
- ❌ Expose secrets

## On Harness Failure

1. Parse error from harness output
2. Check `harness/error_codes.json` for details
3. Write analysis to `.anrs/scratchpad.md`
4. Create fix plan
5. Retry (max 3 times)
6. Escalate to human if still failing

## Key Files

| File | Purpose |
|------|---------|
| `.anrs/ENTRY.md` | Entry point (read if confused) |
| `.anrs/state.json` | Current state (SSOT) |
| `.anrs/skills/index.json` | Skill registry (15 skills) |
| `.anrs/ENTRY.md (rules section)` | Global constraints |
| `harness/quality_gate.py` | Evaluation entry |

## Cursor-Specific

### Composer Mode
Use Composer (Cmd+I) for multi-file ANRS tasks. Reference:
- @.anrs/plans/active/task-xxx.md for current task
- @.anrs/skills/{skill}/SKILL.md for skill details

### Terminal
Run harness verification:
```bash
python harness/quality_gate.py
```

## Quick Start

When you start, say:
> "I've read the ANRS protocol. Let me check the current state..."

Then read `.anrs/state.json`.
