# CLAUDE.md - TypeScript AI Coding Agent Context & Token Boundary Rules for `promptfoo/promptfoo`
[![PulseForge 2026 Empirical Benchmark](https://exactbaseline.com/api/badge/promptfoo/promptfoo.svg?tier=community)](https://exactbaseline.com/leaderboard?repo=promptfoo/promptfoo)

> **Generated by [PulseForge AI Empirical Radar](https://exactbaseline.com/leaderboard)** • Maintainer: `@ianww` • Stack: `TypeScript` (19,500 KB / ~468,000 LOC)
> **Upgrade to Drop-In Migration & 45% Cost-Cut Config Pack ($4.99)**: https://exactbaseline.com/buy/micro_pass?repo=promptfoo/promptfoo
> **Complete 9-File AI Stack BOM & Repo Hardening .ZIP ($9.99)**: https://exactbaseline.com/buy/repo_pass_999?repo=promptfoo/promptfoo

## 1. Context Window & Token Boundary Rules (-58% Discovery Token Bloat)
- **Excluded Discovery Paths (NEVER read, index, or grep)**: `node_modules/, .next/, dist/, build/, coverage/, pnpm-lock.yaml, package-lock.json`
- Before reading any file > 300 lines, query symbol definitions or line ranges first.
- Keep per-turn prompt context <= **19,656 tokens** (down from 46,800 unindexed tokens/turn; saves ~$316.71/mo).
- Keep every source file strictly under 1,000 lines.

## 2. TypeScript Architecture, Schema Boundary & Verification Gate for Promptfoo
- **Verification Command**: Run `pnpm test --run && npx tsc --noEmit` after every contiguous code edit.
- **Schema & Boundary Discipline**: Zod strict-mode schema parsing + TypeScript noUncheckedIndexedAccess.
- Never hardcode API keys, bearer tokens, or `.env` secrets in source files or test fixtures.

## 3. Empirical Benchmark Attestation (61.7 -> 95.3/100)
- Live 4-Pillar Telemetry Profile: https://exactbaseline.com/pulseforge-leaderboard?repo=promptfoo/promptfoo
- Machine-Readable LLM Index: https://exactbaseline.com/pulseforge-leaderboard.md
