# Declarative Context Management (Karpathy Method)

Category: Context & Config
Stack: Claude Code, Antigravity, Cursor, CLAUDE.md

## Overview
Maintaining repository-level declarative configuration files that eliminate clarification loops and drop coding error rates from 41% to 11%.

## The Problem
Conversational chat prompting repeats basic project conventions each session and omits negative constraints, keeping error rates high across developer sessions.

## Production Rule
Maintain a single declarative configuration file at the repository root. State the primary objective on line 1, specify explicit negative constraints, and log session state in a continuity run-log.

## Code / Specification
File: `CLAUDE.md`

```template
# Project Overview
Goal: Production API service for real-time spend analytics and contract optimization.

# Tech Stack & Standards
- Language: Python 3.11
- Web: FastAPI + Pydantic v2
- Database: PostgreSQL with SQLAlchemy (async)
- Testing: pytest with pytest-asyncio

# Coding Conventions
- Use explicit type annotations for all function signatures.
- Prefer pure functions for business calculations.
- Store database models in `app/models/` and schemas in `app/schemas/`.

# Negative Constraints
- Never run unmigrated database queries against production.
- Do not add external dependencies without explicit user confirmation.
- Do not edit files inside `migrations/` directly.
```
