OPEN-SOURCE AGENT CONFIG TEMPLATES

Token-Saving & High-Cache-Hit AI Coding Config Templates

Distilled from T Salon TokenRank telemetry: drop these 4 standardized config files into your repo root to stabilize Prompt Cache hit ratios above 85% and stretch 5-hour rolling windows by 2.5x.

Prompt Cache Hit Ratio ≥ 85%

1. CLAUDE.md — Static Prefix Lock & 5-Hour Window Endurance Template

Engineered for Claude Code: locks static instruction ordering to preserve prompt cache prefixes, forbids blind repo-wide greps, caps tool output lines, and enforces /compact checkpoints before context bloat.

# CLAUDE.md — High-Cache-Stability & Quota-Efficient Engineering Protocol
# Keep sections 1-3 strictly static. Do NOT inject dynamic timestamps or git hashes here.

## 1. Repository Architecture & Commands (Static Prefix)
- Package Manager & Build: `npm run build` | Validation: `npm test`
- Primary Source Root: `src/` | Tests: `scripts/`
- Never read `node_modules/`, `dist/`, `.astro/`, or lockfiles.

## 2. Prompt Cache & Context Hygiene Rules
1. **Preserve Prefix Stability**: Never mutate system prompt ordering or toggle MCP servers mid-session.
2. **Targeted File Reads Only**: Always specify line ranges (`sed -n '1,120p'` or line-bounded reads) instead of dumping files > 300 lines into context.
3. **Cap Command Output**: Pipe verbose test/build logs through `| tail -n 60` so raw stack traces do not pollute the sliding context window.
4. **Checkpoint & Compact**: After completing each self-contained sub-task (or when context exceeds ~90k tokens), write state to `REFACTOR_PLAN.md` and run `/compact`.

## 3. Verification Discipline
- Run unit tests on the touched module first before running full-site builds.
- Never end markdown headings (`#`, `##`, `###`) with trailing periods.
Zero Mid-Refactor Lockout

2. AGENTS.md — 3-Stage Disk-Checkpointed Multi-Agent Workflow

Compatible with OpenAI Codex CLI, Claude Code, and Antigravity: decomposes multi-file refactors into Contract Freeze → 3-5 File Micro-Batches → Disk Checkpoint so any 429 rate limit resumes with zero wasted tokens.

# AGENTS.md — 3-Stage Disk-Checkpointed Refactoring Protocol

## Stage 1: Dependency Graph & Contract Freeze (Budget <= 15% of 5h Window)
- Before editing implementation files, update `REFACTOR_PLAN.md` with:
  - [ ] Shared types / schema changes
  - [ ] Ordered micro-batches of 3–5 files each
  - [ ] Verification command per batch

## Stage 2: Micro-Batch Execution (3–5 Files per Session)
- Process ONE micro-batch at a time.
- After passing the batch verification command:
  1. Mark the batch `[x]` in `REFACTOR_PLAN.md`.
  2. Record any edge cases under `## Handover Notes` in `REFACTOR_PLAN.md`.
  3. Clear or compact conversation history before starting the next batch.

## Stage 3: Quota-Aware Model Routing
- Reserve high-weight reasoning models (Opus 4.6 / GPT-5.4 high-effort / Gemini 2.5 Pro) strictly for Stage 1 architecture design.
- Execute Stage 2 file migrations and test fixes with high-efficiency coding models (Sonnet 4.6 / Codex standard / Gemini 2.5 Flash).
2x 500 Fast Request Longevity

3. .cursorrules — Fast Request Multiplier & Context Discipline

Tailored for Cursor Pro’s 500 Fast Requests pool: enforces single-turn plan alignment, surgical file edits, and terminal log truncation to avoid burning 3–5x requests on retry loops.

# .cursorrules — Cursor Fast Request & Context Efficiency Rules

1. **Plan Before Multi-File Edits**:
   - If a request touches > 2 files, list the exact target files and function signatures in 5 bullet points before applying edits.
2. **Surgical Context Attachment**:
   - Read only the relevant symbol or 80-line window rather than attaching entire directories.
   - Exclude generated assets (`dist/`, `coverage/`, `*.min.js`, `package-lock.json`).
3. **Single-Pass Verification**:
   - Group related edits in the same file into a single atomic change to minimize round-trip tool turns.
   - When terminal commands fail, inspect only the first error and the last 40 lines of output.
Live WhenReset Quota Awareness

4. .mcp.json — Connect T Salon WhenReset Live Quota Radar MCP Server

Zero-auth configuration for T Salon’s official Streamable HTTP MCP endpoint: lets Claude Code, Cursor, or Antigravity query active 2x quota promos, banked reset cards, and Midnight PT countdowns before starting heavy tasks.

{
  "mcpServers": {
    "tsalon-whenreset": {
      "type": "http",
      "url": "https://www.tsalon.tech/api/reset/mcp"
    }
  }
}

Frequently Asked Questions

Why does keeping the top of CLAUDE.md static boost Prompt Cache hit rates?

Anthropic, OpenAI, and DeepSeek all use exact byte-for-byte prefix matching for Prompt Caching. Keeping your system prompt, MCP tool definitions, and the top of CLAUDE.md immutable allows every subsequent turn in a session to read cached tokens at a 75%–90% discount.

Where should I place these configuration files in my repository?

Place `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, and `.mcp.json` in your Git repository root. Claude Code automatically loads `CLAUDE.md` and `.mcp.json`, OpenAI Codex CLI and Antigravity read `AGENTS.md`, and Cursor loads `.cursorrules`.

What tools does the tsalon-whenreset MCP server expose?

It exposes `get_reset_radar` (live status of Claude, Codex, Google Gemini/Antigravity, and Grok resets & 2x promos), `get_google_daily_reset` (exact countdown to Midnight Pacific Time daily RPD reset), and `calculate_weekly_burn` (safe burn-rate calculator for 7-day rolling caps).