agent update

This commit is contained in:
Jonas H
2026-03-28 11:15:41 +01:00
parent d21a467878
commit 1ad7b94386
4 changed files with 111 additions and 0 deletions

View File

@@ -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<f32>` | 8 bytes |
| `vec3<f32>` | 16 bytes (treated as vec4) |
| `vec4<f32>` | 16 bytes |
| `mat4x4<f32>` | 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!()`.

31
.pi/agents/diagnostics.md Normal file
View File

@@ -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.

View File

@@ -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}))

30
.pi/settings.local.json Normal file
View File

@@ -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\""
}
]
}
]
}
}