From 0ea4e2caec4648fc679af0e2ecda1672cba76a0a Mon Sep 17 00:00:00 2001 From: Ben Gregg Date: Wed, 10 Jun 2026 23:33:39 -0500 Subject: [PATCH 1/3] Clean up .claude config: fix broken paths, dedupe tool docs, sync livetools skill - Fix static-analyzer agent pointing at .claude/rules/tool-catalog.md (actual location is .claude/references/tool-catalog.md) - Add missing livetools commands to the dynamic-analysis skill: dipcnt, memwatch, vishook, gamectl, mem alloc - Make each tool list single-source: inline allowlist lives in tool-dispatch.md, DX script table in tool-catalog.md, livetools syntax in the dynamic-analysis skill; other docs point instead of copy - Rewrite both skill descriptions as trigger-only (no workflow summary) - Add shared .claude/settings.json permission allowlist; untrack and gitignore settings.local.json --- .claude/CLAUDE.md | 14 +--- .claude/agents/static-analyzer.md | 2 +- .claude/references/tool-catalog.md | 25 +------- .claude/rules/tool-dispatch.md | 33 +++------- .claude/settings.json | 20 ++++++ .claude/settings.local.json | 10 --- .claude/skills/dx9-ffp-port/SKILL.md | 2 +- .claude/skills/dynamic-analysis/SKILL.md | 81 ++++++++++++++++++++++-- .gitignore | 3 + 9 files changed, 115 insertions(+), 75 deletions(-) create mode 100644 .claude/settings.json delete mode 100644 .claude/settings.local.json diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index 0aa41178..a929532f 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -18,13 +18,7 @@ Shared tooling can be modified to improve the tools themselves — just not for ## Delegation Rule -**Never run static analysis tools directly.** Delegate to a `static-analyzer` subagent. Only exceptions — run these inline: -- `sigdb.py identify` / `fingerprint` (single-function ID, <5s) -- `context.py assemble` / `postprocess` (context gathering, <5s; use `--no-dataflow` on large functions) -- `dataflow.py --constants` / `--slice` (single-function analysis, <5s) -- `readmem.py` (single typed read from PE, <5s) -- `asi_patcher.py build` (build step, not analysis) -- `pyghidra_backend.py status` (project existence check, <1s) +**Never run static analysis tools directly.** Delegate to a `static-analyzer` subagent. The only inline exceptions are the fast (<5s) commands in the "Run Directly" section of `.claude/rules/tool-dispatch.md` (auto-loaded below). If you're about to run a second retools command in the same turn, you should have delegated. @@ -90,11 +84,7 @@ Each file reads as if it was always designed this way. Comments guide the next d ## DX9 FFP Porting -When working on any of the following — invoke the **`dx9-ffp-port` skill** immediately before starting: -- Editing `renderer.cpp`, `ffp_state.cpp`, `remix-comp-proxy.ini`, or draw routing logic -- Porting a game for RTX Remix / fixed-function pipeline -- Diagnosing VS constant registers, vertex declarations, matrix mapping, skinning -- Building, deploying, or iterating on a remix-comp-proxy patch (`build.bat`, `diagnostics.log`, ImGui F4) +Invoke the **`dx9-ffp-port` skill** before editing `renderer.cpp`, `ffp_state.cpp`, `remix-comp-proxy.ini`, or draw routing; porting a game for RTX Remix; diagnosing VS constants, vertex declarations, matrix mapping, or skinning; or building/deploying a remix-comp-proxy patch. --- diff --git a/.claude/agents/static-analyzer.md b/.claude/agents/static-analyzer.md index 1ea4c4b6..6c855591 100644 --- a/.claude/agents/static-analyzer.md +++ b/.claude/agents/static-analyzer.md @@ -10,7 +10,7 @@ You are a reverse engineering analyst specializing in static analysis of PE bina ## Setup -On first invocation, read the full tool catalog at `.claude/rules/tool-catalog.md` in the working directory. It contains exact syntax, flags, and caveats for every tool. +On first invocation, read the full tool catalog at `.claude/references/tool-catalog.md` in the working directory. It contains exact syntax, flags, and caveats for every tool. ## Pre-flight Checks diff --git a/.claude/references/tool-catalog.md b/.claude/references/tool-catalog.md index 8ad32b64..aeb1a743 100644 --- a/.claude/references/tool-catalog.md +++ b/.claude/references/tool-catalog.md @@ -159,30 +159,7 @@ These are fast first-pass scanners — they surface candidate addresses. Follow ## Dynamic Analysis (`livetools/`) -- Frida-based, attaches to running process -``` -python -m livetools attach # attach to running process by name or PID -python -m livetools attach "C:/Games/game.exe" --spawn # launch + instrument before init code runs -python -m livetools detach # end session -python -m livetools status # check connection -``` - -| Command | Purpose | -|---------|---------| -| `trace $VA` | Non-blocking: log N hits with register/memory reads | -| `steptrace $VA` | Instruction-level trace (Stalker) with call depth control | -| `collect $VA [$VA2...]` | Multi-address hit counting over duration | -| `bp add/del/list $VA` | Breakpoints (stops target) | -| `watch` | Wait for breakpoint hit | -| `regs` / `stack` / `bt` | Inspect registers, stack, backtrace at break | -| `mem read $VA $SIZE` | Read live process memory (supports --as float32) | -| `mem write $VA $HEX` | Write live process memory | -| `disasm [$VA]` | Disassemble from live process | -| `scan $PATTERN` | Search process memory for byte pattern | -| `modules` | List loaded modules with base addresses | -| `dipcnt on/off/read` | D3D9 DrawIndexedPrimitive call counter | -| `dipcnt callers [N]` | Sample N DIP calls and histogram return addresses | -| `memwatch start/stop/read` | Memory write watchpoint with backtrace | -| `analyze $FILE` | Offline analysis of collected .jsonl trace data | +Main-agent only (requires a live process; static-analyzer subagents must not use these). Canonical command reference with syntax, read-spec format, and recipes: the `/dynamic-analysis` skill (`.claude/skills/dynamic-analysis/SKILL.md`). Covers attach/spawn, breakpoints, trace/steptrace/collect, mem read/write/alloc, scan, disasm, modules, dipcnt, memwatch, vishook, gamectl, and offline `analyze`. **NOTE**: Some processes require their window to be focused for traces to capture data. diff --git a/.claude/rules/tool-dispatch.md b/.claude/rules/tool-dispatch.md index 4f9ea296..72f8521e 100644 --- a/.claude/rules/tool-dispatch.md +++ b/.claude/rules/tool-dispatch.md @@ -18,6 +18,7 @@ Run all tools from repo root via `python -m `. **ALWAYS pass `--types pa - `python -m retools.dataflow $B $VA --constants` — forward constant propagation - `python -m retools.dataflow $B $VA --slice TARGET_VA:REG` — backward register slice - `python -m retools.asi_patcher build spec.json` — build ASI patch DLL +- `python retools/pyghidra_backend.py status $B --project $P` — Ghidra project existence check ## Delegate to `static-analyzer` @@ -29,36 +30,22 @@ Everything else in `retools`. Tell it WHAT you need, not HOW. D3D9-specific ques ## Live tools (main agent, attached process) +Full syntax and recipes: the `/dynamic-analysis` skill (canonical livetools reference). + - `livetools attach ` — attach to running process - `livetools attach --spawn` — launch exe suspended, instrument, resume (catches init code) -- `livetools trace` / `collect` — hit logging, register reads +- `livetools trace` / `steptrace` / `collect` — hit logging, register reads, instruction traces - `livetools bp` / `watch` / `regs` / `stack` / `bt` — breakpoints + inspection -- `livetools mem read/write` / `scan` — memory ops -- `livetools dipcnt` / `memwatch` — D3D9 counters, write watchpoints +- `livetools mem read/write/alloc` / `scan` — memory ops +- `livetools dipcnt` / `memwatch` — D3D9 draw counters, write watchpoints +- `livetools vishook` — selective visibility override via code cave +- `livetools gamectl` — send keys/clicks to game window (no focus steal) - `livetools modules` — loaded module list +- `livetools analyze ` — offline trace aggregation ## DX analysis scripts (main agent, fast first-pass) -Under `rtx_remix_tools/dx/scripts/`. Use BEFORE retools for D3D9 questions. Run as `python rtx_remix_tools/dx/scripts/