copilot-instructions rework, new C++ coding guide for AI reviews#5480
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reworks AI instructions, to separate "coding agent" from "code review" instructions.
Adds C++ coding guidelines that were extracted from the WLED source code (mainly by AI). The new guides can be used both for contributor information, and as a "best practice" database in automated code reviews by the rabbit.
Update: I've moved the coding style guides into their own directory /docs, and "out of the way" for non-review agent tasks. It seems that AI agent tasks ("I need a new bus driver for my Daimler") work faster without the "code review" add-on guides - the agent will still find docs when it needs help. Code reviews (coderabbitAI) with detailed guides are still much better.
Details
HUMAN_ONLYmechanism that hides generic information from the AI, to increase "attention layer excitement"Example for a coderabbit review with the new instructions: MoonModules#324 (comment)
(notice that recommendations refer to the new guidelines, and there is a "things done well" section, too)
This is a request for discussions
The new instructions already work well in WLED-MM, but we need to adjust them for WLED. Most importantly, optimization guides for ESP8266 still need to be added.
more information:
Revising AI review instructions:
Guiding Principles for Efficient AI Instruction Files
Only document what can't be inferred from the code or from general training.
If the AI would get it right without instruction 95% of the time, the instruction probably isn't worth the extra space in context memory.
Prefer short, actionable rules over explanations.
"Do not flag
uint8_t x = int(f)as a bug when the comment says// float→int wrapping" is more useful than a paragraph explaining why. The paragraph is for humans; the rule is for AI.Keep the total injected instruction size per file type low (<1000 lines, best under ~500 words).
With lots of instructions, the value of additional instructions drops rapidly and the distraction cost rises.
Encode "false positive suppressors" first, feature guidance second.
"Don't flag pattern X as a bug" is more impactful than "always do Y" because it directly prevents noise.
Treat instruction files like tests — they need maintenance when the code changes.
If you wouldn't update the instruction file when refactoring the relevant code, don't write the instruction.
Large language models already have extensive general knowledge about C++, ESP-IDF, GitHub Actions, etc. The genuine value of instruction files is narrow but real:
delay()works in FreeRTOSWLED_DISABLE_2D,d_malloc)The key insight: instruction files are most valuable when they prevent false positives (AI flagging intentional patterns as bugs) and encode decisions that can't be inferred from the code alone.
Summary by CodeRabbit
Documentation
Chores