.cursorrules를 영어 문장으로 쓰지 마세요: Claude/GPT가 무시하는 이유와 토큰 비용 73% 절감법 (Agent Action Grammar)
Stop writing .cursorrules in English prose: Why Claude/GPT ignores them & how we cut token tax by 73% (Agent Action Grammar)
핵심 요약
LLM의 문맥 이해도를 높이고 토큰 사용량을 줄이기 위해 .cursorrules를 자연어 대신 구조화된 'Agent Action Grammar'로 작성하는 방법을 제안합니다.
- 토큰 효율성 — 자연어 규칙을 의사코드 기반 문법으로 변환하여 토큰 사용량을 73% 절감함
- 모델 성능 향상 — RFC 2119 표준과 가드 절을 사용하여 LLM의 지시사항 준수율을 결정론적으로 개선함
- 통합 관리 도구 — okf CLI를 통해 Cursor, Claude, Copilot의 규칙 파일을 단일 소스로 동기화함
- 정적 검증 — AST 린팅을 통해 토큰 낭비를 방지하고 규칙의 유효성을 사전에 검사함
Cursor를 매일 쓰는 사람이라면 .cursorrules 쓰면서 빡치는 점 두 가지는 다들 겪어봤을 거다.
-
컨텍스트 세금: 아키텍처 규칙, 포맷팅 가이드라인, 안전장치 같은 거 좀 넣다 보면
.cursorrules가 순식간에 800 토큰을 넘겨버린다. 상호작용할 때마다 귀한 컨텍스트를 그냥 날려 먹는 셈이지. -
행동 드리프트: 영어로 아무리 명확하게 지시해도("Y 수정하기 전에 무조건 X부터 확인해라") 코드베이스가 깊어지면 모델이 툭하면 까먹는다.
왜 이런 일이 벌어지나 (기술적 이유)
트랜스포머는 SAT 솔버가 아니라 토큰 확률 분포를 예측하는 시퀀스 예측기다.
LLM한테 대화하듯이 영어 문단을 길게 던져주면, 셀프 어텐션이 의미 없는 채움 토큰들 사이에서 다 희석돼 버린다. 반면에 규칙을 고밀도의 제약된 의사 코드(pseudocode) 형태로 짜면(컴파일러 코드, Go/C 에러 핸들러, RFC 2119 스펙에서 가장 많이 강화된 패턴들), 모델이 거의 결정론적으로 규칙을 따른다.
❌ Before: 평범한 대화형 .cursorrules (~420 토큰)
Whenever you edit code in this repository, please check if you have visited this
directory before. If you haven't, search our knowledge base. If the subsystem is
frozen, stop immediately and ask the user for confirmation. Always use Mermaid for
diagrams, never use ASCII art, and never forge human verification timestamps.
✅ After: 에이전트 액션 문법 (115 토큰 • 73% 절감)
0. Project & Domain Codex
- FORMAT: diagrams => ASSERT(syntax == mermaid, ELSE=STOP("Mermaid required; ASCII/box art prohibited."))
- GOAL: maintain(high_factual_integrity, strict_determinism)
1. Behavioral Invariants (RFC 2119)
- MUST execute
okf_search(query=keywords, limit=3)before proposing architecture changes. - NEVER scan
knowledge/vialist_dir,grep_search, or raw file readers. - NEVER forge human verification (
verified:is human-only).
2. Guard Clauses & Scope Governance
- ON edit(@path/):
IF first_visit(@path/) => okf_search(for_path=@path/)
IF governance == "hold" => STOP("Subsystem frozen by governance. Confirm with user.")
IF governance == "constraint" => MUST adhere to invariants
IF governance == "context" => proceed with awareness
