agentleFS
Daniel-BartaDaniel-Barta/mcp-rag-server/docs/copilot-instructions.md

mcp-rag-server

Copilot instructions13 starsChanged 14 months agoMITView on GitHub

You have access to a Model Context Protocol (MCP) server that indexes the repository located under the '<FOLDER_INFO_NAME>' folder. It exposes three tools: rag_query, read_file, and list_files. For any question about the <FOLDER_INFO_NAME> repository, use these tools. Follow these rules: Tool selection Use rag_query for semantic/code search across the <FOLDER_INFO_NAME> repository. Start every code-understanding task with rag_query before answering. Use read_file to fetch exact file contents (or line ranges) from <FOLDER_INFO_NAME> before quoting or reasoning about specific code. Never quote…

  • Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.

    Of the Copilot instructions files we read, the 2,349 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

We split this copilot-instructions.md into the rules it gives an agent

8 rules. About 0 are common, 2 are distinctive, and 6 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.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use rag_query for semantic/code search across the <FOLDER_INFO_NAME> repository.

    line 5
  2. Very specific:

    Use read_file to fetch exact file contents (or line ranges) from <FOLDER_INFO_NAME> before quoting or reasoning about specific code.

    line 7
  3. Very specific:

    Use list_files to discover file paths, modules, or directory structure in <FOLDER_INFO_NAME>.

    line 9
  4. Very specific:

    Always include the file path for any code you show from <FOLDER_INFO_NAME>.

    line 33
  5. Distinctive:

    If a tool returns empty or fails, refine the query (different keywords, broader scope) and retry up to two times, then ask the user to …

    line 37
  6. Very specific:

    Use MCP tools exclusively for the <FOLDER_INFO_NAME> repository.

    line 41
  7. Very specific:

    Do not attempt paths outside the <FOLDER_INFO_NAME> root.

    line 43
  8. Distinctive:

    Do not hallucinate file structure or code.

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 3,779 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

You have access to a Model Context Protocol (MCP) server that indexes the repository located under the '<FOLDER_INFO_NAME>' folder. It exposes three tools: rag_query, read_file, and list_files. For any question about the <FOLDER_INFO_NAME> repository, use these tools. Follow these rules:

Tool selection

Use rag_query for semantic/code search across the <FOLDER_INFO_NAME> repository. Start every code-understanding task with rag_query before answering.

Use read_file to fetch exact file contents (or line ranges) from <FOLDER_INFO_NAME> before quoting or reasoning about specific code. Never quote code without read_file.

Use list_files to discover file paths, modules, or directory structure in <FOLDER_INFO_NAME>; prefer recursive mode with filters when appropriate.

Calling guidelines

rag_query(args): { query: string, top_k?: number }.

• Start with concise queries; set top_k=5–10. If results are sparse or generic, refine the query and retry up to 2 times.

read_file(args): { path: string, startLine?: number, endLine?: number }.

• Paths are relative to the <FOLDER_INFO_NAME> repository root; use forward slashes.

• When presenting code, fetch only the relevant window via startLine/endLine (e.g., 30–80 lines).

list_files(args): { dir?: string, recursive?: boolean, maxDepth?: number, includeExtensions?: string[], limit?: number }.

• Use dir="." for the <FOLDER_INFO_NAME> root; set recursive=true when exploring structure.

• Use includeExtensions to narrow results (extensions without leading dots).

• Respect limits; prefer smaller, targeted listings.

Output hygiene

Always include the file path for any code you show from <FOLDER_INFO_NAME>.

Summarize what the snippet does and ground your answer in fetched content.

If a tool returns empty or fails, refine the query (different keywords, broader scope) and retry up to two times, then ask the user to clarify.

Scope discipline

Use MCP tools exclusively for the <FOLDER_INFO_NAME> repository. If comparing with another project, you may reason normally about that other project, but must still use MCP tools for <FOLDER_INFO_NAME>.

Do not attempt paths outside the <FOLDER_INFO_NAME> root; treat all paths as relative to <FOLDER_INFO_NAME>.

Do not hallucinate file structure or code; verify via list_files/read_file first.

Examples (<FOLDER_INFO_NAME>)

“Where is the HTTP client implemented in <FOLDER_INFO_NAME>?” → Call rag_query with a focused query (e.g., “HTTP client implementation, Retrofit, OkHttp”) → open top result(s) with read_file and cite lines.

“Show service configuration files in <FOLDER_INFO_NAME>” → list_files with dir=".", recursive=true, includeExtensions ["yaml","yml","json","properties"].

“Open app/src/main/kotlin/.../Foo.kt lines 20–80 in <FOLDER_INFO_NAME>” → read_file with path="app/src/main/kotlin/.../Foo.kt", startLine=20, endLine=80.

“List top-level directories in <FOLDER_INFO_NAME>” → list_files with dir=".", recursive=false.

Parameter reminders (from tool contracts)

rag_query: returns an array of match objects with properties: 'path' (string, file path), 'score' (number, similarity score 0-1), 'snippet' (string, matching text chunk), 'totalLines' (number, original file line count), 'fileSize' (number, file size in bytes). Results are sorted by relevance score descending.

read_file: returns the file content as a string. If startLine and/or endLine are specified, returns only the requested 1-based inclusive line range; otherwise returns the entire file content.

list_files: returns an array of entry objects with properties: 'path' (string, relative to repository root), 'type' ('file' or 'dir'), and 'size' (number, bytes, for files only). Entries are sorted alphabetically with directories first.

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.