cursorrules

A set of project rules requiring supported source files to begin with a CodeDNA header written in that language’s comment style. CodeDNA is an in-source format for recording file responsibilities, users, and constraints.

In plain words
What is it for?
Use it to enforce header format, guide impact checks and verification, and record agent and session details after structural changes.
Why use it?
It keeps structural information close to the code and gives agents a consistent way to inspect project relationships before and after edits.

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/larens94/codedna/cursorrules
Clone the repo
git clone --depth 1 https://github.com/Larens94/codedna

Made for: Cursor.

Per session 1,291 This file is loaded in full into every session.
When invoked 1,291 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.01291 $0.01291
Opus 5 $0.00646 $0.00646
Sonnet 5 $0.00258 $0.00258
Haiku 4.5 $0.00129 $0.00129

Measured 2d ago against content hash fc2ee0707f96, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cursorrules 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 2d ago.

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.

integrations/.cursorrules · 142 lines

How it starts

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

CodeDNA v0.9 — In-Source Communication Protocol

Setup: pipx install git+https://github.com/Larens94/codedna.git && codedna install --path . --tools cursor --no-wiki-sync && codedna init . --no-llm

Every supported source file must start with a CodeDNA header using valid native comment syntax. Python uses a module docstring; never copy Python delimiters into another language.

Required command workflow

  • Onboarding: codedna doctor --path .
  • Before a public change: codedna impact <file-or-symbol> --path .
  • After structural edits: codedna verify .; review evidence, run codedna refresh ., then verify again if stale
  • Automation: add --json; verification covers structural fields, not semantic truth

Module docstring format

"""filename.py — <what it does, ≤15 words>.

exports: public_function(arg) -> return_type
used_by: consumer_file.py → consumer_function
rules:   <hard constraint agents must never violate>
agent:   <model-id> | <provider> | <YYYY-MM-DD> | <session_id> | <what you did and what you noticed>
"""

Rules on every edit

  • Read .codedna at repo root first — project structure and recent session history
  • Re-read rules: as your first step — never violate these constraints
  • Read Rules: in function docstrings before writing logic there
  • Check used_by: after changes — update callers if signatures change
  • Never rename exports: symbols without explicit instruction
  • If you discover a constraint or fix a bug, add it to rules: for the next agent
  • After editing a file, append a new agent: line to the module docstring. Keep only the last 5 entries — drop the oldest if adding a 6th. Full history is in git and .codedna.

Rules on generate

  • Write the module docstring before any imports
  • Every public function must have a Rules: docstring
  • Use semantic variable names: list_dict_users_from_db = get_users()

Writing good rules:

rules: must be specific and actionable — never vague.

# ✅ Good rules:
rules:   get_invoices() returns ALL tenants — caller MUST filter is_suspended() before aggregating
rules:   amount is in cents not euros — divide by 100 before display
rules:   soft-delete via deleted_at — NEVER use DELETE, always SET deleted_at = NOW()

# ❌ Bad rules:
rules:   handle errors gracefully
rules:   follow best practices
rules:   none  ← when there ARE constraints but nobody wrote them

Read the full file on GitHub · 142 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. 2d ago First seen · 142 lines · 1,291 tokens per session scan A fc2ee0707f96

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository Larens94/codedna (145 stars, last pushed 5d ago), licensed MIT. It adds 1,291 tokens to every session, about $0.0065 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-30.