Skip to content

Commit 1243c7b

Browse files
Revise *.instructions.md: separate AI-relevant special knowledge from background information for contributors (#354)
Revising AI review instructions: * Reduce context window use for AI review tools, by avoiding repeating common knowledge and API information that is (usually) part of the AI training datasets any way. * Introduce a mechanism to maintain both parts in single files, to avoid "silent diversion" over time * Adding a coderabbit path instruction that ensures cross-checking of both parts whenever a PR modifies instruction files Objectives: * Primary Goal: only inject content in AI-visible areas that are WLED-MM–specific or which deviate from general knowledge (the context window "token cost" of true false-positive suppressors is always worth it). * Soft goal: keep each file's AI-facing section lean enough that the signal-to-noise ratio in the attention layer stays high — around 1,500–2,000 words per file type is a reasonable practical ceiling for current models. * Aspirational: 500 words per file if achievable without sacrificing review quality. This is an evolution of #353, based on the discussion in #353 (comment) --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent e969a9b commit 1243c7b

5 files changed

Lines changed: 161 additions & 27 deletions

File tree

.coderabbit.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,19 @@ reviews:
6666
scoped to least privilege. Never interpolate github.event.* values directly
6767
into run: steps — pass them through an env: variable to prevent script
6868
injection. Do not use pull_request_target unless fully justified.
69+
70+
- path: ".github/*.instructions.md"
71+
instructions: |
72+
This file contains both AI-facing rules and human-only reference sections.
73+
Human-only sections are enclosed in `<!-- HUMAN_ONLY_START -->` /
74+
`<!-- HUMAN_ONLY_END -->` HTML comment markers and should not be used as
75+
actionable review criteria.
76+
77+
When this file is modified in a PR, perform the following alignment check:
78+
1. For each `<!-- HUMAN_ONLY_START --> ... <!-- HUMAN_ONLY_END -->` block,
79+
verify that its examples and guidance are consistent with (and do not
80+
contradict) the AI-facing rules stated in the same file.
81+
2. Flag any HUMAN_ONLY section whose content has drifted from the surrounding
82+
AI-facing rules due to edits introduced in this PR.
83+
3. If new AI-facing rules were added without updating a related HUMAN_ONLY
84+
reference section, note this as a suggestion (not a required fix).

.github/cicd.instructions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ applyTo: ".github/workflows/*.yml,.github/workflows/*.yaml"
33
---
44
# CI/CD Conventions — GitHub Actions Workflows
55

6+
> **Note for AI review tools**: sections enclosed in
7+
> `<!-- HUMAN_ONLY_START -->` / `<!-- HUMAN_ONLY_END -->` HTML comments contain
8+
> contributor reference material. Do **not** use that content as actionable review
9+
> criteria — treat it as background context only.
10+
11+
<!-- HUMAN_ONLY_START -->
612
## YAML Style
713

814
- Indent with **2 spaces** (no tabs)
@@ -60,6 +66,7 @@ schedule:
6066
- Name artifacts with enough context to be unambiguous (e.g., `firmware-${{ matrix.environment }}`)
6167
- Avoid uploading artifacts that will never be consumed downstream
6268

69+
<!-- HUMAN_ONLY_END -->
6370
---
6471

6572
## Security

.github/copilot-instructions.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@ WLED-MM is a fork focused on higher performance (ESP32, ESP32-S3, PSRAM boards),
55

66
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
77

8+
> **Note for AI review tools**: sections enclosed in
9+
> `<!-- HUMAN_ONLY_START -->` / `<!-- HUMAN_ONLY_END -->` HTML comments contain
10+
> contributor reference material. Do **not** use that content as actionable review
11+
> criteria — treat it as background context only.
12+
13+
<!-- HUMAN_ONLY_START -->
814
## Setup
915

1016
- Node.js 20+ (see `.nvmrc`)
1117
- Install dependencies: `npm ci`
1218
- PlatformIO (required only for firmware compilation): `pip install -r requirements.txt`
1319

20+
<!-- HUMAN_ONLY_END -->
1421
## Hardware Targets
1522

1623
| Target | Status |
@@ -21,6 +28,7 @@ Always reference these instructions first and fallback to search or bash command
2128
| ESP32-P4/-C5/-C6 | Will be supported in the future |
2229
| ESP8266 | Deprecated — should still compile, but not actively maintained |
2330

31+
<!-- HUMAN_ONLY_START -->
2432
## Build and Test
2533

2634
| Command | Purpose | Typical Time |
@@ -36,8 +44,15 @@ Common firmware environments: `esp32_4MB_V4_M`, `esp32_16MB_V4_S_HUB75`, `esp32S
3644

3745
For detailed build timeouts, development workflows, troubleshooting, and validation steps, see [agent-build-instructions.md](agent-build-instructions.md).
3846

47+
<!-- HUMAN_ONLY_END -->
3948
## Repository Structure
4049

50+
tl;dr: Firmware source: `wled00/` (C++). Web UI source: `wled00/data/`. Auto-generated headers: `wled00/html_*.h`**never edit or commit**.
51+
Usermods: `usermods/` (`.h` files, included via `usermods_list.cpp`). Build targets: `platformio.ini`. CI/CD: `.github/workflows/`.
52+
53+
<!-- HUMAN_ONLY_START -->
54+
Detailed overview:
55+
4156
```text
4257
wled00/ # Firmware source (C++)
4358
├── data/ # Web UI source (HTML, CSS, JS)
@@ -57,7 +72,7 @@ tools/cdata-test.js # Test suite
5772
package.json # Node.js scripts and release ID
5873
.github/workflows/ # CI/CD pipelines
5974
```
60-
75+
<!-- HUMAN_ONLY_END -->
6176
Main development branch: `mdev`
6277

6378
## General Guidelines
@@ -68,7 +83,7 @@ Main development branch: `mdev`
6883
- **When unsure, say so.** Gather more information rather than guessing.
6984
- **Acknowledge good patterns** when you see them. Summarize good practices as part of your review - positive feedback always helps.
7085
- **Provide references** when making analyses or recommendations. Base them on the correct branch or PR.
71-
- **Look for user-visible "breaking" changes**. Ask for confirmation that these were made intentionally.
86+
- **Look for user-visible breaking changes and ripple effects**. Ask for confirmation that these were introduced intentionally.
7287
- **Unused / dead code must be justified or removed**. This helps to keep the codebase clean, maintainable and readable.
7388
- **C++ formatting available**: `clang-format` is installed but not in CI
7489
- No automated linting is configured — match existing code style in files you edit. See `cpp.instructions.md` and `web.instructions.md` for language-specific conventions, and `cicd.instructions.md` for GitHub Actions workflows.
@@ -77,7 +92,8 @@ Main development branch: `mdev`
7792
Using AI-generated code can hide the source of the inspiration / knowledge / sources it used.
7893
- Document attribution of inspiration / knowledge / sources used in the code, e.g. link to GitHub repositories or other websites describing the principles / algorithms used.
7994
- When a larger block of code is generated by an AI tool, mark it with an `// AI: below section was generated by an AI` comment (see C++ guidelines).
80-
- Make sure AI-generated code is well documented.
95+
- Every non-trivial AI-generated function should have a brief comment describing what it does. Explain parameters when their names alone are not self-explanatory.
96+
- AI-generated code must be well documented; comment-to-code ratio > 15% is expected. Do not rephrase source code, but explain the concepts/logic behind the code.
8197

8298
### Pull Request Expectations
8399

0 commit comments

Comments
 (0)