codedna / integrations
Copilot instructions151 starsChanged 8 months agoMITView on GitHub
This codebase uses the CodeDNA communication protocol (v0.9). Apply these rules in every suggestion. Annotate your project: pipx install git+https://github.com/Larens94/codedna.git then codedna init ./ Every supported source file needs a native CodeDNA header. Python files begin with this module docstring; non-Python files use their language's valid comment syntax: rules: must be specific and actionable — never vague. Update rules: every time you discover a constraint, fix a bug, or notice a non-obvious behavior. Every public function must have a Rules:…
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- integrations/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- integrations/CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
19 rules. About 0 are common, 3 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Before changing a public contract: run codedna impact <file-or-symbol> --path ..
- Very specific: line 11
After structural edits: run codedna verify ..
- Very specific: line 12
Add --json in automation. Verification checks exports: and used_by:, not semantic truth.
- Very specific: line 16
Every supported source file needs a native CodeDNA header.
- Distinctive: line 44
Update rules: every time you discover a constraint, fix a bug, or notice a non-obvious behavior.
- Very specific: line 48
Every public function must have a Rules: docstring:
- Very specific: line 61
When writing or editing code blocks with non-obvious logic, add a # Rules: or # message: comment above the block:
- Distinctive: line 71
When to add: business-rule conditionals, loops with filtering, algorithm steps where order matters, edge cases.
- Distinctive: line 72
When NOT to add: simple getters, obvious control flow, standard library usage.
- Very specific: line 76
Read .codedna at repo root — project structure and retained agent_sessions: entries.
- Very specific: line 80
Check rules: in the module docstring — never violate these constraints
- Very specific: line 81
Check used_by: — these callers will be affected by your changes
- Very specific: line 82
Read Rules: in any function docstring before writing logic
- Very specific: line 83
If you discover a constraint, add it to rules: for the next agent
- Very specific: line 88
Write module docstring before imports (with exports:, used_by:, rules:, agent:)
- Very specific: line 90
Use semantic names: list_dict_orders_from_db = query(sql) not data = query(sql)
- Very specific: line 94
Use message: for observations not yet certain enough to become rules::
- Very specific: line 114
Run codedna session append with agent, provider, session-id, task, changed, visited, and message.
- Very specific: line 116
Commit with AI git trailers: AI-Agent, AI-Provider, AI-Session, AI-Visited, AI-Message.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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 — GitHub Copilot Instructions
This codebase uses the CodeDNA communication protocol (v0.9). Apply these rules in every suggestion.
Annotate your project:
pipx install git+https://github.com/Larens94/codedna.gitthencodedna init ./
Required command workflow
- Onboarding: run
codedna doctor --path .and resolve errors. - Before changing a public contract: run
codedna impact <file-or-symbol> --path .. - After structural edits: run
codedna verify .; review evidence before runningcodedna refresh .. - Add
--jsonin automation. Verification checksexports:andused_by:, not semantic truth.
Module header
Every supported source file needs a native CodeDNA header. Python files begin with this module docstring; non-Python files use their language's valid comment syntax:
"""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>
"""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 themUpdate rules: every time you discover a constraint, fix a bug, or notice a non-obvious behavior.
Writing critical functions
Every public function must have a Rules: docstring:
def critical_function(arg: type) -> return_type:
"""Short description.
Rules: What MUST or MUST NOT happen here.
message: model-id | YYYY-MM-DD | observation for next agent
"""Inline annotations on complex logic
When writing or editing code blocks with non-obvious logic, add a # Rules: or # message: comment above the block:
# Rules: skip cancelled orders — status=4 means cancelled in legacy DB
active = [o for o in orders if o.status != 4]
# message: exchange rate uses daily rate, not real-time
amount = order.amount * get_exchange_rate(order.currency)When to add: business-rule conditionals, loops with filtering, algorithm steps where order matters, edge cases. When NOT to add: simple getters, obvious control flow, standard library usage.
On session start
Read .codedna at repo root — project structure and retained agent_sessions: entries.
On edit: always do these in order
- Check
rules:in the module docstring — never violate these constraints - Check
used_by:— these callers will be affected by your changes - Read
Rules:in any function docstring before writing logic - If you discover a constraint, add it to
rules:for the next agent - Append a new
agent:line to the module docstring after editing. Keep only the last 5 entries — drop the oldest if adding a 6th. Full history is in git and.codedna.
On generate: always do these
- Write module docstring before imports (with
exports:,used_by:,rules:,agent:) - Every public function must have a
Rules:docstring - Use semantic names:
list_dict_orders_from_db = query(sql)notdata = query(sql)
message: — Agent Chat Layer (v0.9)
Use message: for observations not yet certain enough to become rules::
agent: <model-id> | <provider> | <YYYY-MM-DD> | <session_id> | Implemented X.
message: "noticed Y behaviour — not yet sure if this should be a rule"def my_function():
"""Short description.
Rules: hard constraint here
message: <model-id> | <date> | open observation for next agent
"""Lifecycle: promote to rules: with @prev: promoted to rules: or dismiss with @prev: verified, not applicable because.... Always append-only — never delete.
On session end
Run codedna session append with agent, provider, session-id, task, changed, visited, and message. Do not edit agent_sessions: manually; .codedna is a bounded recent cache and Git trailers are the complete audit log.
Commit with AI git trailers: AI-Agent, AI-Provider, AI-Session, AI-Visited, AI-Message.
CodeDNA + native memory — additive, not replacing
CodeDNA is the shared layer — git-tracked, readable by every agent and tool. It does not replace Copilot's native context or any other tool's memory. Use both:
.codedna+ file annotations → shared architectural truth, survivesgit clone- Copilot native context → session-specific, tool-local context
Exports are contracts
exports: symbols must not be renamed or removed — other files depend on them (check used_by:).
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.

