agentleFS
Larens94Larens94/codedna/integrations/copilot-instructions.md

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:…

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
  1. Very specific:

    Before changing a public contract: run codedna impact <file-or-symbol> --path ..

    line 10
  2. Very specific:

    After structural edits: run codedna verify ..

    line 11
  3. Very specific:

    Add --json in automation. Verification checks exports: and used_by:, not semantic truth.

    line 12
  4. Very specific:

    Every supported source file needs a native CodeDNA header.

    line 16
  5. Distinctive:

    Update rules: every time you discover a constraint, fix a bug, or notice a non-obvious behavior.

    line 44
  6. Very specific:

    Every public function must have a Rules: docstring:

    line 48
  7. Very specific:

    When writing or editing code blocks with non-obvious logic, add a # Rules: or # message: comment above the block:

    line 61
  8. Distinctive:

    When to add: business-rule conditionals, loops with filtering, algorithm steps where order matters, edge cases.

    line 71
  9. Distinctive:

    When NOT to add: simple getters, obvious control flow, standard library usage.

    line 72
  10. Very specific:

    Read .codedna at repo root — project structure and retained agent_sessions: entries.

    line 76
  11. Very specific:

    Check rules: in the module docstring — never violate these constraints

    line 80
  12. Very specific:

    Check used_by: — these callers will be affected by your changes

    line 81
  13. Very specific:

    Read Rules: in any function docstring before writing logic

    line 82
  14. Very specific:

    If you discover a constraint, add it to rules: for the next agent

    line 83
  15. Very specific:

    Write module docstring before imports (with exports:, used_by:, rules:, agent:)

    line 88
  16. Very specific:

    Use semantic names: list_dict_orders_from_db = query(sql) not data = query(sql)

    line 90
  17. Very specific:

    Use message: for observations not yet certain enough to become rules::

    line 94
  18. Very specific:

    Run codedna session append with agent, provider, session-id, task, changed, visited, and message.

    line 114
  19. Very specific:

    Commit with AI git trailers: AI-Agent, AI-Provider, AI-Session, AI-Visited, AI-Message.

    line 116

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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.git then codedna 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 running codedna refresh ..
  • Add --json in automation. Verification checks exports: and used_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 them

Update 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

  1. Check rules: in the module docstring — never violate these constraints
  2. Check used_by: — these callers will be affected by your changes
  3. Read Rules: in any function docstring before writing logic
  4. If you discover a constraint, add it to rules: for the next agent
  5. 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

  1. Write module docstring before imports (with exports:, used_by:, rules:, agent:)
  2. Every public function must have a Rules: docstring
  3. Use semantic names: list_dict_orders_from_db = query(sql) not data = 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, survives git 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:).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.