Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Store results in a temporary variable -- do NOT write intermediate files.

## Step 2 -- Load inspection state

Read the state file at `.claude/accuracy-sweep-state.json`.
Read the state file at `.claude/sweep-accuracy-state.json`.

If it does not exist, treat every module as never-inspected.

Expand Down Expand Up @@ -114,7 +114,12 @@ like this (adapt the module list to actual results):
- Missing or wrong Earth curvature corrections
- Backend inconsistencies (numpy vs cupy vs dask results differ)
2. Run /rockout to fix the issue end-to-end (issue, worktree, fix, tests, docs)
3. After completing rockout for ONE module, output <promise>ITERATION DONE</promise>
3. Update .claude/sweep-accuracy-state.json in the worktree by adding or
updating the entry for the module:
{ \"module_name\": { \"last_inspected\": \"ISO-DATE\", \"issue\": ISSUE_NUMBER } }
Then git add and commit it to the worktree branch so the state update
lands in the PR.
4. After completing rockout for ONE module, output <promise>ITERATION DONE</promise>

If you find no accuracy issues in the current target module, skip it and move
to the next one.
Expand All @@ -129,24 +134,17 @@ Set `--max-iterations` to the number of target modules + 2 (buffer for retries).

```
To run this sweep: copy the command above and paste it.
To update state after a manual rockout: edit .claude/accuracy-sweep-state.json
To reset all tracking: /accuracy-sweep --reset-state
To update state after a manual rockout: edit .claude/sweep-accuracy-state.json
To reset all tracking: /sweep-accuracy --reset-state
```

## Step 6 -- Update state (ONLY when called from inside a ralph-loop)
## Step 6 -- Update state

This step is informational. The accuracy-sweep command itself does NOT update
the state file. State is updated when `/rockout` completes -- the rockout
workflow should append to `.claude/accuracy-sweep-state.json` after creating
the issue.

To enable this, print a note reminding the user that after each rockout
iteration completes, they can manually record the inspection:

```json
// Add to .claude/accuracy-sweep-state.json after each rockout:
{ "module_name": { "last_inspected": "ISO-DATE", "issue": ISSUE_NUMBER } }
```
The sweep-accuracy command itself does NOT update the state file. State is
updated by the ralph-loop prompt generated in Step 5b, which instructs the
agent to write and commit `.claude/sweep-accuracy-state.json` in the
worktree branch as part of each rockout iteration so the state update is
included in the PR.

---

Expand Down
14 changes: 8 additions & 6 deletions .claude/commands/sweep-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Parse $ARGUMENTS for these flags (multiple may combine):
| `--only-focal` | Restrict to: focal, convolution, morphology, bilateral, edge_detection, glcm |
| `--only-hydro` | Restrict to: flood, cost_distance, geodesic, surface_distance, viewshed, erosion, diffusion |
| `--only-io` | Restrict to: geotiff, reproject, rasterize, polygonize |
| `--reset-state` | Delete `.claude/performance-sweep-state.json` and treat all modules as never-inspected |
| `--reset-state` | Delete `.claude/sweep-performance-state.json` and treat all modules as never-inspected |
| `--skip-phase1` | Skip triage; reuse last state file; go straight to ralph-loop generation for unresolved HIGH items |
| `--report-only` | Run Phase 1 triage but do not generate a ralph-loop command |
| `--size small` | Phase 2 benchmarks use 128x128 arrays |
Expand Down Expand Up @@ -64,7 +64,7 @@ For every module in scope, collect:

### Load inspection state

Read `.claude/performance-sweep-state.json`. If it does not exist, treat every
Read `.claude/sweep-performance-state.json`. If it does not exist, treat every
module as never-inspected. If `--reset-state` was set, delete the file first.

State file schema:
Expand Down Expand Up @@ -344,7 +344,7 @@ rockout has full context.

## Step 5 -- Update state file

Write `.claude/performance-sweep-state.json` with the triage results:
Write `.claude/sweep-performance-state.json` with the triage results:

```json
{
Expand Down Expand Up @@ -448,7 +448,9 @@ from the actual triage results):
| dask+numpy | peak_rss_mb | 892 | 34 | 0.04x | IMPROVED |
Thresholds: IMPROVED < 0.8x, REGRESSION > 1.2x, else UNCHANGED.

6. Update .claude/performance-sweep-state.json with the issue number.
6. Update .claude/sweep-performance-state.json with the issue number, then
`git add` and commit it to the worktree branch so the state update is
included in the PR.

7. Output <promise>ITERATION DONE</promise>

Expand Down Expand Up @@ -489,8 +491,8 @@ Other options:
on a known-numpy array), do not flag it.
- The 30TB simulation constructs the dask task graph only; it NEVER calls
`.compute()`.
- State file (`.claude/performance-sweep-state.json`) is gitignored by
convention — do not add it to git.
- State file (`.claude/sweep-performance-state.json`) is tracked in git.
Subagents must `git add` and commit it so the state update lands in the PR.
- If $ARGUMENTS is empty, use defaults: audit all modules, benchmark at
512x512, generate ralph-loop for HIGH items.
- For subpackage modules (geotiff, reproject), the subagent should read ALL
Expand Down
13 changes: 8 additions & 5 deletions .claude/commands/sweep-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Store results in memory -- do NOT write intermediate files.

## Step 2 -- Load inspection state

Read `.claude/security-sweep-state.json`.
Read `.claude/sweep-security-state.json`.

If it does not exist, treat every module as never-inspected.

Expand Down Expand Up @@ -194,13 +194,16 @@ Also read xrspatial/utils.py to understand _validate_raster() behavior.
For MEDIUM/LOW issues, document them but do not fix.

5. After finishing (whether you found issues or not), update the inspection
state file .claude/security-sweep-state.json by reading its current
state file .claude/sweep-security-state.json by reading its current
contents and adding/updating the entry for "{module}" with:
- "last_inspected": today's ISO date
- "issue": the issue number from rockout (or null if clean / MEDIUM-only)
- "severity_max": highest severity found (or null if clean)
- "categories_found": list of category numbers that had findings (e.g. [1, 2])

Then `git add .claude/sweep-security-state.json` and commit it to the
worktree branch so the state update is included in the PR.

Important:
- Only flag real, exploitable issues. False positives waste time.
- Read the tests for this module to understand expected behavior.
Expand Down Expand Up @@ -229,7 +232,7 @@ State is updated by the subagents themselves (see agent prompt step 5).
After completion, verify state with:

```
cat .claude/security-sweep-state.json
cat .claude/sweep-security-state.json
```

To reset all tracking: `/sweep-security --reset-state`
Expand All @@ -241,8 +244,8 @@ To reset all tracking: `/sweep-security --reset-state`
- Do NOT modify any source files directly. Subagents handle fixes via /rockout.
- Keep the output concise -- the table and agent dispatch are the deliverables.
- If $ARGUMENTS is empty, use defaults: top 3, no category filter, no exclusions.
- State file (`.claude/security-sweep-state.json`) is gitignored by convention --
do not add it to git.
- State file (`.claude/sweep-security-state.json`) is tracked in git.
Subagents must `git add` and commit it so the state update lands in the PR.
- For subpackage modules (geotiff, reproject, hydro), the subagent should read
ALL `.py` files in the subpackage directory, not just `__init__.py`.
- Only flag patterns that are ACTUALLY present in the code. Do not report
Expand Down
File renamed without changes.
Loading
Loading