project

Project rules for ai-context-kit, a TypeScript library and command-line tool that manages instruction files used by AI coding agents, such as AGENTS.md and CLAUDE.md.

In plain words
What is it for?
Use it when adding or changing context-file loading, linting, token measurement, task-based selection, synchronization, initialization, or the CLI.
Why use it?
It defines how those files are found, checked for conflicts, measured for token cost, selected for a task, and converted between formats.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/ofershap/ai-context-kit/project
Clone the repo
git clone --depth 1 https://github.com/ofershap/ai-context-kit

Made for: Cursor.

Per session 648 This file is loaded in full into every session.
When invoked 648 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00648 $0.00648
Opus 5 $0.00324 $0.00324
Sonnet 5 $0.00130 $0.00130
Haiku 4.5 $0.00065 $0.00065

Measured yesterday against content hash 9fbc22e51d74, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

project scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/project.mdc · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ai-context-kit

TypeScript library + CLI that loads, lints, measures, and selects AI agent context files (CLAUDE.md, .cursor/rules/, AGENTS.md, Copilot instructions, etc.).

npm package: ai-context-kit. GitHub: ofershap/ai-context-kit.

Architecture

Source is in src/, tests mirror in tests/. Each module is a single concern:

  • types.ts - all interfaces and types. RuleFile is the core data structure
  • parse.ts - YAML frontmatter parsing, format detection from file path
  • tokens.ts - token estimation (4 chars per token approximation)
  • load.ts - loadRules() - finds and loads rule files from disk
  • measure.ts - measure() - token cost per rule with budget check
  • lint.ts - lint() - conflict detection, duplicates, vague instructions, scores 0-100
  • select.ts - select() - task-relevant rule selection within token budget
  • sync.ts - sync() - write rules to multiple target formats
  • init.ts - init() - scaffold starter rule files from templates
  • cli.ts - CLI entry point, parses args and calls the above functions
  • index.ts - public API re-exports

Key Constraints

  • Zero runtime dependencies. Do not add any.
  • exactOptionalPropertyTypes: true in tsconfig. Optional props need explicit | undefined
  • ESM primary, CJS secondary via tsup dual build
  • CLI binary name in package.json is ai-context-kit
  • Format detection is path-based (no config). .cursor/rules dir = cursor-rules format, CLAUDE.md = claude-md, etc.
  • Token estimation is intentionally approximate (4 chars/token). Don't replace with tiktoken or similar

Adding a Lint Rule

  1. Add detection logic in src/lint.ts inside the lint() function
  2. Add test cases in tests/lint.test.ts
  3. Update the lint rule table in README.md
  4. Issue severity must be error, warning, or info

Adding a Format

  1. Add format string to RuleFormat union in src/types.ts
  2. Add path detection in detectFormat() in src/parse.ts
  3. Add file patterns in loadRules() in src/load.ts
  4. Add template in TEMPLATES map in src/init.ts (optional)
  5. Add test in tests/load.test.ts

Read the full file on GitHub · 60 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 60 lines · 648 tokens per session scan A 9fbc22e51d74

Subscribe to this mod's changes

project is a cursor rule published in the GitHub repository ofershap/ai-context-kit (8 stars, last pushed 6d ago), licensed MIT. It adds 648 tokens to every session, about $0.0032 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.