From 1ad7b9438607c5199844828a67c4b7344bf7a112 Mon Sep 17 00:00:00 2001 From: Jonas H Date: Sat, 28 Mar 2026 11:15:41 +0100 Subject: [PATCH] agent update --- .pi/agent/skills/wgsl/SKILL.md | 21 ++++++++++++++++++++ .pi/agents/diagnostics.md | 31 ++++++++++++++++++++++++++++++ .pi/hooks/filter-cargo-warnings.py | 29 ++++++++++++++++++++++++++++ .pi/settings.local.json | 30 +++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 .pi/agent/skills/wgsl/SKILL.md create mode 100644 .pi/agents/diagnostics.md create mode 100644 .pi/hooks/filter-cargo-warnings.py create mode 100644 .pi/settings.local.json diff --git a/.pi/agent/skills/wgsl/SKILL.md b/.pi/agent/skills/wgsl/SKILL.md new file mode 100644 index 0000000..523a700 --- /dev/null +++ b/.pi/agent/skills/wgsl/SKILL.md @@ -0,0 +1,21 @@ +# WGSL Shader Development + +Reference for WGSL shader development, buffer alignment, uniform struct layout, and shader asset management. Load this skill when working on shader code, graphics pipelines, or buffer alignment issues. + +## WGSL Uniform Buffer Alignment + +When creating uniform buffers for WGSL shaders, struct fields must be aligned: + +| Type | Alignment | +|------|-----------| +| `f32` | 4 bytes | +| `vec2` | 8 bytes | +| `vec3` | 16 bytes (treated as vec4) | +| `vec4` | 16 bytes | +| `mat4x4` | 16 bytes (64 bytes total) | + +Use padding fields to match WGSL struct layout exactly. Prefer `vec4` over individual floats to avoid alignment issues. + +## Shader Organization + +Shaders live in `src/shaders/` and are embedded via `include_str!()`. diff --git a/.pi/agents/diagnostics.md b/.pi/agents/diagnostics.md new file mode 100644 index 0000000..18e1f84 --- /dev/null +++ b/.pi/agents/diagnostics.md @@ -0,0 +1,31 @@ +--- +name: diagnostics +description: Run cargo check and return a filtered, concise list of errors and warnings. Use this after making code changes to verify correctness before proceeding. Pass a file path or module name to focus the output, or leave args empty for a full check. +model: claude-haiku-4-5-20251001 +tools: + - Bash + - Read + - Grep +--- + +You are a Rust diagnostics agent for the Snow Trail project. Run `cargo check` and return only the signal — errors first, then warnings, filtered to what's actionable. + +## Steps + +1. Run `cargo check 2>&1` (always capture stderr). +2. If the caller specified a file or module, filter output to diagnostics in or caused by that file. +3. For each error: include the error code, message, and `file:line` location. Skip "aborting due to N errors" lines. +4. For warnings: include only `unused_imports`, `dead_code`, and `unused_variables` that are in files the caller is working on. Skip generated code and files the caller didn't touch. +5. If there are no errors and no relevant warnings, say so in one line. + +## Output format + +``` +ERRORS (N): + E0XXX file:line — message + +WARNINGS (N): + file:line — category — message +``` + +Do not include raw cargo output. Do not explain Rust concepts. Do not suggest fixes unless asked. diff --git a/.pi/hooks/filter-cargo-warnings.py b/.pi/hooks/filter-cargo-warnings.py new file mode 100644 index 0000000..3ea167c --- /dev/null +++ b/.pi/hooks/filter-cargo-warnings.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +import sys +import json +import re + +data = json.load(sys.stdin) + +if data.get("tool_name") != "Bash": + sys.exit(0) + +cmd = data.get("tool_input", {}).get("command", "") +if not re.search(r"\bcargo\s+(check|build|test|clippy|run)\b", cmd): + sys.exit(0) + +output = data.get("tool_response", {}).get("output", "") +if not output: + sys.exit(0) + +blocks = re.split(r"\n{2,}", output) +warning_blocks = [b for b in blocks if re.match(r"\s*warning:", b)] +other_blocks = [b for b in blocks if not re.match(r"\s*warning:", b)] + +if not warning_blocks: + sys.exit(0) + +filtered = "\n\n".join(other_blocks).rstrip("\n") +filtered += f"\n\n[{len(warning_blocks)} warning(s) filtered]\n" + +print(json.dumps({"type": "result", "content": filtered})) diff --git a/.pi/settings.local.json b/.pi/settings.local.json new file mode 100644 index 0000000..fbcf357 --- /dev/null +++ b/.pi/settings.local.json @@ -0,0 +1,30 @@ +{ + "permissions": { + "allow": [ + "Bash(cargo check:*)", + "Bash(cargo build:*)", + "Bash(cargo fmt:*)", + "Bash(head:*)", + "mcp__plugin_qmd_qmd__deep_search", + "mcp__plugin_qmd_qmd__query", + "mcp__opty__opty_status", + "mcp__opty__opty_query", + "mcp__opty__opty_ast", + "Bash(cargo search:*)", + "Bash(cargo info:*)" + ] + }, + "hooks": { + "PostToolUse": [ + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "python3 \"$CLAUDE_PROJECT_DIR/.claude/hooks/filter-cargo-warnings.py\"" + } + ] + } + ] + } +}