codedna / integrations
CLAUDE.md151 starsChanged 8 months agoMITView on GitHub
This project uses the CodeDNA in-source communication protocol. Follow these rules on every file operation. For LLM-powered rules: annotations: Why pipx? It creates an isolated venv per tool, so codedna's transitive dependencies (e.g. via [litellm]) don't conflict with packages already installed in your global Python environment (issue #8). uv tool install works identically. If you prefer raw pip, run it inside a project venv. The format adapts to the language. Never use Python docstrings in non-Python files. Python — module…
- Reads credentials
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- integrations/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- integrations/copilot-instructions.mdCopilot instructions
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 78
Read the module header at the top of every source file before reading any code.
- Very specific: line 88
Every new source file must begin with a CodeDNA header in the correct format for the language (see above).
- Very specific: line 133
After editing, check used_by: targets (especially [cascade]-tagged ones).
- Very specific: line 134
Never remove exports: symbols — they are contracts used by other files.
- Very specific: line 135
If you discover a constraint, update rules: immediately.
- Very specific: line 136
Append a new
agent:line: after editing. Keep only the last 5 entries. - Distinctive: line 164
Commit with AI git trailers:
≈ “Common” is an estimate: at least 1 in 5 of the 28,633 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CodeDNA v0.9 — Protocol for Claude Code
This project uses the CodeDNA in-source communication protocol. Follow these rules on every file operation.
Annotate your project (CLI)
pipx install git+https://github.com/Larens94/codedna.git # isolated install (avoids global env conflicts)
codedna init . # annotates all detected languages (auto-detects PHP, TS, Go, etc.)
codedna init . --no-llm # free — structural only, no API key needed
codedna check . # coverage report, no changes
codedna doctor --path . # onboarding health gate
codedna impact FILE --path . # pre-edit impact gate
codedna verify . # post-edit structural drift gateFor LLM-powered rules: annotations:
pipx inject codedna anthropic
export ANTHROPIC_API_KEY=sk-...
codedna init . --model claude-haiku-4-5-20251001
# Or with a local model (free, no API key):
pipx inject codedna litellm
codedna init . --model ollama/llama3Why pipx? It creates an isolated venv per tool, so codedna's transitive dependencies (e.g. via
[litellm]) don't conflict with packages already installed in your global Python environment (issue #8).uv tool installworks identically. If you prefer rawpip, run it inside a project venv.
Annotation format by language
The format adapts to the language. Never use Python docstrings in non-Python files.
Python — module docstring:
"""revenue.py — Monthly revenue aggregation.
exports: monthly_revenue(year, month) -> dict
used_by: api/reports.py → revenue_route
related: billing/currency.py — shares multi-currency conversion logic
rules: get_invoices() returns ALL tenants — MUST filter is_suspended() before sum
agent: claude-sonnet-4-6 | anthropic | 2026-04-15 | s_001 | initial implementation
"""PHP / TypeScript / JavaScript / Go / Java / Kotlin / Rust / C# / Swift — native line or documentation comments at file top. Ruby uses # comments. See docs/languages.md for the exact syntax:
<?php
// UserController.php — Handles user CRUD endpoints.
//
// exports: UserController::index() -> Response
// UserController::store(Request) -> JsonResponse
// used_by: routes/web.php -> Route::resource('users', UserController::class)
// rules: must extend App\Http\Controllers\Controller
// agent: claude-sonnet-4-6 | anthropic | 2026-04-15 | s_001 | initial scaffoldBlade / Jinja2 / Twig / Volt — {{-- --}} or {# #} block:
{{-- layout.blade.php — Base application layout. --}}
{{--
rules: @yield('content') is required — child views must define this section
agent: claude-sonnet-4-6 | anthropic | 2026-04-15 | s_001 | initial layout
--}}Reading files
- Read the module header at the top of every source file before reading any code.
- Parse
exports:— symbols you must never rename or remove without explicit instruction. - Parse
used_by:— callers that depend on this file. Do not follow all blindly. Ask: "does this caller intersect with my current task?" Only explore relevant callers. - Parse
related:— files sharing the same logic without importing each other. Same filter: is it relevant to this task? - Parse
rules:— hard constraints; read before writing any logic. - Parse
agent:— session history; read to understand why the current state exists. - For any function with a
Rules:docstring, read and respect those before writing logic.
Writing new files
Every new source file must begin with a CodeDNA header in the correct format for the language (see above).
| Field | Required | Rule |
| First line | ✅ | filename — <purpose ≤15 words> |
exports: | ✅ | Public API with return type |
used_by: | ✅ | Who calls this file's exports (structural link) |
related: | ⬜ | Files sharing the same logic without importing each other (semantic link) |
wiki: | ⬜ | Opt-in pointer to curated context under docs/wiki/ |
rules: | ✅ | Hard constraints — specific and actionable |
agent: | ✅ | Rolling window of last 5 entries |
message: | ⬜ | Inter-agent channel — open hypotheses |
Writing good rules:
rules: must be specific and actionable — never vague.
# ✅ Good
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: handle errors gracefully
rules: follow best practicesWriting critical functions (all programming-language adapters — L2)
Public functions must have a Rules: docstring:
def my_function(arg: type) -> return_type:
"""Short description.
Rules: What the agent MUST or MUST NOT do here.
message: model-id | YYYY-MM-DD | observation for next agent
"""Editing files
- First step: re-read
rules:, theagent:history, and anyRules:in the function you are editing. - Apply all file-level constraints before writing.
- After editing, check
used_by:targets (especially[cascade]-tagged ones). - Never remove
exports:symbols — they are contracts used by other files. - If you discover a constraint, update
rules:immediately. - Append a new
agent:line after editing. Keep only the last 5 entries.
Session end protocol
Append through the canonical writer; never edit agent_sessions: manually:
codedna session append --agent <model-id> --provider <provider> \
--session-id <s_YYYYMMDD_NNN> --task "<brief task>" \
--changed <modified files...> --visited <read files...> \
--message "<what the next agent should know>"Canonical stored shape:
agent_sessions:
- agent: <your-model-id>
provider: <anthropic|google|openai|...>
date: <YYYY-MM-DD>
session_id: <s_YYYYMMDD_NNN>
task: "<brief task description ≤15 words>"
changed: [list, of, modified, files]
visited: [all, files, read, during, session]
message: >
What you did, what you discovered, what the next agent should know.Commit with AI git trailers:
<imperative summary>
AI-Agent: <model-id>
AI-Provider: <provider>
AI-Session: <session_id>
AI-Visited: <comma-separated files read>
AI-Message: <one-line summary>Semantic naming (Python / Ruby)
Format: <type>_<shape>_<domain>_<origin>
list_dict_users_from_db = get_users()
int_cents_price_from_req = request.json["price"]
bool_is_admin_from_db = user["role"] == "admin"Full spec
→ SPEC.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

