# Check uncommitted agent edits with plain-English rules

Run Perch against working files, save a named rule in perch.yaml, configure Claude Code, Codex or Cursor, and repeat the same check after a repair.

Source: https://perchscan.com/examples/check-uncommitted-agent-edits/
Published: 2026-10-23
Updated: 2026-10-23

`perch check` reads the current file on disk, so your agent can check a requirement before committing or opening a pull request. A named rule lets it repeat the same focused check after a fix.

```sh
perch check review-evaluation/order_service.py --rules eval-all-stock-lines --json
# Repair can_fulfil, then run the identical check:
perch check review-evaluation/order_service.py --rules eval-all-stock-lines --json
```

These commands assume the public order-service example and the rule below are present. In the [captured October 14 run](/demos/review-evaluation/perch-results.json), the rule failed on the broken implementation at 95% and passed on the repaired one.

## Save the requirement beside the code

Add this entry alongside your existing rules in perch.yaml; keep any existing configuration.

```yaml
- name: eval-all-stock-lines
  where: "review-evaluation/order_service.py"
  ensure: >-
    Read can_fulfil only. It returns true only when every requested item has
    sufficient stock; a shortage on any line returns false, including when an
    earlier line has enough stock.
```

The [broken implementation](https://github.com/lakeday-org/perch/blob/46dd1d0d0ea7ceb0e690203d24fca21c428818ec/review-evaluation/order_service.py) returns too early:

```python
def can_fulfil(items, stock):
    """True when every line in the cart is in stock."""
    for item in items:
        if stock.get(item.sku, 0) >= item.quantity:
            return True
    return False
```

The first available item makes this return true even when a later item is unavailable. The [fixed public version](https://github.com/lakeday-org/perch/blob/b9ce63ac935739a998ebb40ca6881a261571d208/review-evaluation/order_service.py) checks each line before accepting the order. Run the same command after the edit and inspect the reported result.

## Configure the agent you use

Install and sign in using [the quick start](https://docs.perchscan.com/install/), then choose one setup command:

```sh
npm install -g @lakeday/perch
perch login
perch setup claude-code
# Or: perch setup codex
# Or: perch setup cursor
# Or: perch setup pi
```

Ask the agent to preserve the named rule, run its check after editing, repair the reported finding, and repeat that check. Use a selector that matches your own file instead of copying the example path unchanged. The [rule reference](https://docs.perchscan.com/rules/) explains project, file and method scope.

## Review uncommitted code or a branch change

A file check evaluates the selected working file. To scan changes relative to a commit, run perch scan --since with that base commit. The [command reference](https://docs.perchscan.com/cli/) describes scope and output. Source goes to the configured model service; a local CLI is not offline inference.

CodeRabbit also supports [uncommitted CLI review](https://docs.coderabbit.ai/cli). Perch's useful distinction is a separately selectable plain-English requirement, checked before and after the edit. [Compare the two workflows](/compare/perch-vs-coderabbit/).

## Keep the result attached to the requirement

Unchanged requests reuse cached answers; fresh model judgments can vary. A passing check is evidence for the stated requirement, not proof that the application is correct. Keep executable tests for boundary cases, including a cart whose first item is available and whose second item is unavailable.

For broader bug detection, inspect the [Greptile and ReviewBench runs](/blog/find-bugs-before-agent-pull-request/), including precision, thresholds and model costs.
