- README.md: project overview, quick start, command reference, workflow - CLAUDE.md: AI safety rules, technical details, conventions - AGENTS.md: agent workflows, file responsibility map, dependency matrix - docs/architecture.md: script layers, data flow, unified memory, JSON schemas - docs/optimization.md: step-by-step optimization walkthrough - docs/benchmarking.md: methodology, test params, result interpretation - docs/troubleshooting.md: common issues and fixes - docs/references.md: centralized external links (single source of truth) - docs/bios-vram-guide.md: add back-link to optimization workflow Cross-linked non-redundantly: each doc owns one layer, others link to it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3.2 KiB
3.2 KiB
AGENTS.md — Agent Workflows
Read CLAUDE.md first for safety rules and technical context.
Common Workflows
Add a Detection Function
- Add the function to
lib/detect.shfollowingdetect_*naming convention - If it reads sysfs, use
$GPU_SYSFS(auto-detected) with a2>/dev/nullfallback - Wire it into
scripts/audit/quick-glance.sh(display) and/orscripts/audit/system-report.sh(JSON output) - If it has an optimal value, add a check to
scripts/optimize/verify.sh - Validate:
make auditandbin/audit --json | python3 -m json.tool
Add a Benchmark Backend
- Add the toolbox entry to
BENCH_PATHSassociative array in bothscripts/benchmark/run-baseline.shandscripts/benchmark/run-suite.sh - Map the toolbox name → llama-bench binary path (Vulkan:
/usr/sbin/llama-bench, ROCm:/usr/local/bin/llama-bench) - If ROCm, the
ENV_ARGSlogic already handlesROCBLAS_USE_HIPBLASLT=1 - Add the toolbox to
refresh-toolboxes.shin the toolboxes repo - Validate:
make benchmark-setupthenmake benchmark
Add an Optimization Script
- Create
scripts/optimize/my-optimization.shsourcinglib/common.sh(anddetect.sh/format.shas needed) - Add root check at top if the script modifies system state:
[[ $EUID -ne 0 ]] && { log_error "Requires root"; exit 1; } - Add a corresponding case to
bin/optimize - Add a Makefile target
- Add verification criteria to
scripts/optimize/verify.sh - If the optimization is reversible, add rollback logic to
scripts/optimize/rollback.sh - Document in docs/optimization.md
Add a Monitoring Metric
- In
scripts/monitor/log-metrics.sh, cache the sysfs path at startup (avoid per-sample globbing) - Read with
read -r var < "$SYSFS_PATH" 2>/dev/null || var=0(no subshells in the hot loop) - Add the column to the CSV header and the
echoline - Update the CSV schema in docs/architecture.md
File Responsibility Map
| Want to change... | Touch these files |
|---|---|
What make audit shows |
scripts/audit/quick-glance.sh, lib/detect.sh |
| JSON audit output | scripts/audit/system-report.sh, lib/detect.sh |
| Dashboard layout | scripts/monitor/dashboard.sh |
| Metric collection | scripts/monitor/log-metrics.sh |
| Benchmark parameters | scripts/benchmark/run-baseline.sh, run-suite.sh |
| Result comparison | scripts/benchmark/compare.sh |
| Kernel params | scripts/optimize/kernel-params.sh, lib/detect.sh (recommended values) |
| Optimization checks | scripts/optimize/verify.sh, scripts/audit/quick-glance.sh |
| Shared utilities | lib/common.sh (logging), lib/format.sh (output), lib/detect.sh (hardware) |
| External links | docs/references.md (single source of truth) |
Dependencies by Workflow
| Workflow | Requires |
|---|---|
| Audit | bc, python3 |
| Monitor | tmux, amdgpu_top or nvtop, btop or htop |
| Benchmark | toolbox, podman, GGUF models in data/models/, python3 |
| Optimize | sudo/root, grubby or grub2-mkconfig, tuned-adm, python3 |