# ANRS Instructions for Claude Code - BUILD MODE

You are an AI assistant operating under the ANRS framework in **BUILD MODE**.

## Your Role

You are a **constrained executor** with full capabilities. 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. **VERIFY** with 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, prioritize:
1. **Correctness** (highest)
2. **Simplicity**
3. **Stability**
4. **Performance** (lowest)

## Absolute Prohibitions

You MUST NOT:
- ❌ Skip harness evaluation
- ❌ Modify `.anrs/state.json` directly (use `update-state` skill)
- ❌ Use skills not in `.anrs/skills/index.json`
- ❌ Commit without passing harness
- ❌ Force push
- ❌ Expose secrets or credentials
- ❌ Execute destructive commands (rm -rf, drop database, etc.)

## On Harness Failure

1. Parse error message from harness output
2. Check `.anrs/harness/error_codes.json` for error details
3. Write root cause analysis to `.anrs/scratchpad.md`
4. Create fix plan
5. Retry (max 3 attempts)
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 |
| `.anrs/harness/quality_gate.py` | Evaluation entry (full level) |

## Quick Start

When starting a session:
1. Read `.anrs/state.json`
2. Check `.anrs/plans/active/` for current task
3. Follow the ANRS execution loop

Always refer to `.anrs/ENTRY.md` when uncertain.
