AI tools editing your code make mistakes because they have no context. CodeDNA embeds it directly in the files — like DNA in every cell. Zero RAG. Minimal drift.
Imagine asking a contractor to renovate your apartment without showing them the floor plan. Same problem with AI editing your code. CodeDNA is the floor plan.
One command installs CodeDNA rules for any AI coding assistant. Or pick the file for your tool and paste it into your project.
bash <(curl -fsSL https://raw.githubusercontent.com/Larens94/codedna/main/integrations/install.sh)
.agents/workflows/codedna.md into your project. Antigravity follows the protocol automatically..cursorrules to your project root. Cursor applies the rules on every edit..github/copilot-instructions.md. Copilot follows the instructions in every suggestion.Like biological DNA: cutting it in half produces two fragments that still carry the complete information. With CodeDNA, 10 random lines from anywhere in a file are enough for the AI to act correctly.
"""pricing.py — Pricing engine with tier discounts.
exports: apply_discount(cents, tier) -> int
used_by: checkout.py → build_cart
rules: NEVER exceed MAX_DISCOUNT_RATE from config.py;
apply_discount() must cap before returning.
DB: discount_tiers(tier, multiplier).
"""
def apply_discount(cents: int, tier: str) -> int: """Apply tier discount to price in cents. Rules: MUST cap discount before returning — exceeding MAX_DISCOUNT_RATE is a financial compliance bug. After fix #42: also check tier != 'internal'. """ discount = get_multiplier(tier) discount = min(discount, MAX_DISCOUNT_RATE) return int(cents * (1.0 - discount))
# ❌ Ambiguous — euros? cents? price = request.json.get("price") data = get_users() # ✅ CodeDNA — type, domain, origin are clear int_cents_price_from_request = request.json.get("price") list_dict_users_from_db = get_users()
# 1. Read .codedna — project structure # 2. Read module docstring (8–12 lines each) # 3. Filter: used_by mentions target? Include # rules mentions task domain? Include # 4. Build exports → used_by graph # 5. Open in full ONLY the relevant files # Cost: ~50 tok × N files = complete map
5 scenarios built to be impossible to solve correctly without CodeDNA. The Control makes deterministic errors. CodeDNA: zero errors across all tests.
used_by:, the AI only updates utils.py and leaves main.py with a runtime KeyError.price = 1999 — euros or cents? Without semantic naming the AI gets the unit wrong. With CodeDNA: int_cents_price_from_request — zero ambiguity.format_revenue() → format_currency(). The rules: field records the rename. The Control calls the old name: crash.exports: → used_by: graph it identifies exactly the 2 files.
🔬 Methodology: 5 scenarios × 3 runs with Gemini 2.5 Flash. Evaluation: independent LLM judge + automatic checker (constraint_violation, cascade_miss). Script: benchmark/codedna_benchmark.py. Results: benchmark/results_v2.json.
5 real Django issues from SWE-bench, tested across 5 state-of-the-art models. Same prompt, same tools, same tasks. CodeDNA improves 4 out of 5 models.
🔬 Methodology: 5 SWE-bench Django tasks × 5 models (Gemini 2.5 Flash, Gemini 2.5 Pro, GPT-5.3 Codex, GPT-4o, DeepSeek-V3). Identical system prompt, same 3 tools (read_file, list_files, grep), max 15 turns. Metric: F1 over ground-truth files from patch. Script: benchmark_agent/swebench/run_agent_multi.py.
| Approach | Token overhead | Context drift | Retrieval latency | Sliding-window | Infrastructure |
|---|---|---|---|---|---|
| CLAUDE.md / CursorRules | High | High | Zero | No | External file |
| RAG / Vector DB | Low | Medium | High | No | DB + embedding |
| MemGPT | Medium | Low | Medium | No | Complex system |
| CodeDNA ✦ | Zero | Zero | Zero | Yes ✓ | None |
<type>_<shape>_<domain>_<origin>. Manifest-Only Planner Read.