aboutsummaryrefslogtreecommitdiff
path: root/.agents/skills/review-changes
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-11-13 17:04:55 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-11-13 17:04:55 +0100
commit01805b0a7b78e4eed2c30f5c34e0044a0b240634 (patch)
tree51c4b83b67157542e99e9992e14d1df8cf1de806 /.agents/skills/review-changes
parent5d434c0103942ab66d3554d590d48fd0ad445858 (diff)
downloadkernel-01805b0a7b78e4eed2c30f5c34e0044a0b240634.tar.xz
kernel-01805b0a7b78e4eed2c30f5c34e0044a0b240634.zip
agents: implement basic rules and skills
Diffstat (limited to '.agents/skills/review-changes')
-rw-r--r--.agents/skills/review-changes/SKILL.md104
1 files changed, 104 insertions, 0 deletions
diff --git a/.agents/skills/review-changes/SKILL.md b/.agents/skills/review-changes/SKILL.md
new file mode 100644
index 00000000..be335c91
--- /dev/null
+++ b/.agents/skills/review-changes/SKILL.md
@@ -0,0 +1,104 @@
+---
+name: review-changes
+description: Review a pending TeachOS change: a branch or merge request against its base, staged changes, or unstaged changes. Use when asked to review a diff, MR, branch, commit range, or "my changes". For auditing existing code with no diff, use review-subsystem instead.
+---
+
+# Review pending changes
+
+Mentor mode applies (AGENTS.md §1): report findings and direction, never patches.
+Quote at most a few lines of the changed code to point at a problem.
+Deliver the report in the conversation. Do not write it to the repository.
+
+## 1. Pin down the scope
+
+Ask only if unclear.
+State which mode you used and the base you chose.
+
+- Branch or MR: `git diff <base>...<head>` and `git log --oneline <base>..<head>`.
+ Base is `origin/develop`, unless the branch belongs to a thesis (see CONTRIBUTING.rst: `<semester>/develop`, e.g. `fa26/develop`).
+ Then use that branch.
+ If you can't tell which, ask.
+- Staged: `git diff --staged`.
+- Unstaged: `git diff`, plus `git status` for untracked files.
+ Diffs omit new untracked files, so read those directly.
+- If several are non-empty, review what was asked and mention the rest.
+
+Run `git diff --stat` first.
+If the change is very large [threshold: ~800 changed lines or ~25 files], say so and propose a reading order (headers, then implementations, then tests) instead of skimming.
+
+## 2. Establish intent before judging
+
+Read commit messages and any MR text.
+Write 2-3 sentences on what you think the change is for.
+If you can't tell, that is your first finding.
+Note whether it is a single logical change (CONTRIBUTING.rst asks for that).
+
+## 3. Read the code, not just the hunks
+
+For each touched non-test file, read the whole enclosing function or class and the header it implements.
+For changed signatures, find callers and implementors with `git grep`.
+A review from hunks alone misses most real problems.
+
+## 4. What to review
+
+CI covers mechanical style (clang-format, clang-tidy: trailing return types, naming, `enum class`, and so on).
+Don't spend findings on those unless the tools were not run.
+Lambdas are not covered by the trailing-return check, so glance at them.
+Focus on:
+
+a. Correctness:
+ Trace the real logic, including error paths, boundary values, integer width and sign, lifetimes and ownership, resource cleanup.
+b. Architecture against recorded decisions:
+ AGENTS.md §4 and `docs/briefs/`.
+ Flag a change that contradicts or silently extends a documented decision.
+ If the decision isn't documented, say so.
+ Don't invent one.
+c. Execution context and concurrency:
+ Who calls this, from which context (boot, thread, interrupt), holding what?
+ Lock ordering.
+ RAII guards.
+d. Freestanding discipline:
+ Includes outside the freestanding set, hidden allocation, exceptions or RTTI, large stack objects.
+e. Tests:
+ Is new behavior covered, including edge and error cases?
+ Do tests check the contract or just mirror the implementation?
+ Name 2-4 missing cases in prose.
+f. Clarity for the audience:
+ Could a bachelor student follow it?
+ Naming, function size, comments that explain why, abstractions that earn their keep.
+g. Docs:
+ Does a public interface change appear in `docs/`?
+ Are doc claims still true?
+h. Hygiene:
+ Moved or renamed files: is CMake updated?
+ Debug leftovers, commented-out code, unowned TODOs, unrelated changes mixed in.
+ Commit messages against `subsystem: imperative summary`.
+ Critique only, no rewrites.
+
+Detection helpers (read-only, limit to changed files):
+- Layering: `git grep -nE '\b(asm|__asm__)\b|rdmsr|wrmsr' -- kernel libs`
+- Banned machinery: `git grep -nE 'dynamic_cast|typeid|\bthrow\b|friend '`
+- Hosted headers outside tests: `git grep -nE '#include <(vector|memory|string|map|iostream)>'`
+
+## 5. Verify what you can
+
+Build out of tree and run the host tests (`cmake --preset bht`, `cmake --build --preset bht-dbg`, `ctest --preset bht-dbg`).
+Also `clang-format --dry-run --Werror <changed files>` and `reuse lint`.
+Anything you can't run goes under "Not verified".
+
+## 6. Report
+
+1. Summary: your reading of the intent, then a one-line verdict.
+2. Findings:
+ Most severe first.
+ Each has: location (`path:line`), what is wrong, why it matters (cite the principle, decision or precedent), and a direction to fix it, not a patch.
+ Severity: Blocking / Should fix / Consider / Question.
+ Mark confidence: verified in code or suspected.
+3. Questions for the author where intent is unclear.
+ Don't assume a bug.
+4. Not verified: what you did not run or read.
+
+Rules: a review that finds nothing must still say what was checked.
+Look for real problems, including in code the author considers finished.
+Separate what you verified from what you suspect.
+When citing precedent (Linux, FreeBSD, NetBSD, xnu, Windows, ACPI/UEFI specs), say how sure you are and provide references when possible. \ No newline at end of file