-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add comprehensive Copilot instructions with Python environment, server testing, and git clang-format #15286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: CISC <[email protected]>
Co-authored-by: CISC <[email protected]>
@copilot Always activate and use the Python environment located in The directory Review instructions based on this new information. |
- Add instructions for using .venv Python environment - Include flake8 and pyright linting tools from virtual environment - Add tools/ as core directory in project layout - Reference existing configuration files (.flake8, pyrightconfig.json) Co-authored-by: CISC <[email protected]>
Updated the instructions to include:
Changes committed in ffcbda3. |
@copilot I'm sorry, I've also added the required dependencies for running unit tests in Make a note that while all backends can be built as long as the correct requirements for that backend is installed you will not be able to run them without the correct hardware. The only backend that can be run for testing etc. is the CPU backend. |
…ting Co-authored-by: CISC <[email protected]>
Updated the instructions to address your feedback:
The Python environment instructions reference the updated |
@slaren @ggerganov @ngxson @danbev This should be a good starting point now, will leave it as draft for iteration, I'm sure there are plenty of improvements to be done. |
Co-authored-by: CISC <[email protected]>
…ng newline Co-authored-by: CISC <[email protected]>
What is the implication of this file? |
It's given to Copilot as a prompt whenever you ask it to work on something in this repo, f.ex. assigning an issue to it. |
…nstallation to CI Co-authored-by: CISC <[email protected]>
It's also possible to add separate instructions that apply to given files, see https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions#using-one-or-more-instructionsmd-files-1 |
And so it begins, today is "let me help you onboard AI coding agents to the llama.cpp repository. It will be good for you! I promise!". Tomorrow, "Bow to me puny humans!" I for one, welcome our new overlords |
I can't think of anything specific to add, I'm sure there's lots, but probably the only way to really get a feeling for what is needed is by trial. |
This PR adds a comprehensive
.github/copilot-instructions.md
file to onboard AI coding agents to the llama.cpp repository. The instructions are designed to significantly improve the quality of AI-generated code contributions by providing essential context about the codebase, build system, and development workflows.What's Included
The instructions cover all critical aspects needed for effective AI assistance:
Repository Overview: High-level description of llama.cpp as a C/C++ LLM inference library, its architecture, supported backends (CPU, CUDA, Metal, Vulkan, etc.), and core dependencies.
Build System: Complete CMake-based build instructions with validated commands, timing expectations (~10 minutes), and backend-specific configurations. Includes common build issues and their solutions.
Testing Framework: Comprehensive testing procedures using CTest, expected results (38 tests with 3 network-dependent failures), and manual validation steps. Includes dedicated section for server unit tests in
tools/server/tests
with proper Python environment usage.Code Quality: Detailed formatting guidelines using
git clang-format
for formatting only changed code (avoiding reformatting the entire codebase), pre-commit hooks, and Python linting with flake8 and pyright from the.venv
virtual environment.Python Environment: Instructions for using the provided
.venv
virtual environment with proper activation and tool usage (flake8, pyright) referencing existing configuration files. Updated to include server test dependencies.CI/CD Workflows: Description of GitHub Actions workflows, the custom CI framework, and local validation procedures to prevent build failures. Updated workflow includes proper git-clang-format installation.
Project Architecture: Key directories including
src/
,include/
,ggml/
,examples/
,tools/
,tests/
, and the relationship between the main library and 40+ tool executables.Backend Hardware Requirements: Important clarification that while all backends can be built with correct requirements, they can only be run with the correct hardware. Only the CPU backend can be run for testing and validation purposes.
Key Features
git clang-format
to format only modified code instead of reformatting the entire codebase.venv
environment activationValidation
All build instructions and procedures have been tested in the development environment:
git clang-format
works correctly for formatting only changed codeImpact
These instructions will help AI coding agents:
The instructions are comprehensive (~270 lines) while being concise enough to serve as a complete reference for AI agents working on this codebase.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.