lakeday-org/perch

Semantic code and security scanner

What it is

Perch is a command-line tool that scans your code for bugs and security problems. Unlike a traditional linter that checks syntax or style, it's a semantic scanner: it reads the code the way a human reviewer would, looking for logic errors like wrong ordering, inverted conditions, off-by-one mistakes, and unhandled nulls.

How you use it

npm install -g @lakeday/perch   # install
perch login                     # sign in to Perch Cloud (first $5 free)
perch scan                      # scan your code
  • Scans are cached: re-running on unchanged code costs nothing.
  • Perch Cloud can also review pull requests in CI without you writing any workflow files.
  • perch issues lists findings worst-first; perch issues <id> shows one in detail.
  • perch check <id> re-checks a specific issue after you think you've fixed it — it doesn't record anything.

What the output looks like

A scan prints a table per file, e.g.:

checkout.py
  ID        Line  Severity  Type    Confidence  Problem                     Method
  bdc67421    14  P1 (0.8)  defect         81%  wrong_order                 place_order
  ddc5c917    24  P1 (0.8)  defect         92%  inverted_condition          can_fulfil

Each finding has an ID, line number, severity, type, confidence score, the problem name, and the method it's in.

Custom linting rules

You can add your own rules in a perch.yaml file. Example from the README:

- name: private-logs
  where: "src/**/*.ts"
  each: method
  ensure: >
    Keep passwords and access tokens out of logs.

This tells Perch: for every method in TypeScript files under src/, check that it doesn't log passwords or tokens.

How good is it? (benchmarks)

Two independent benchmarks are cited:

ReviewBench (GitHub's benchmark for AI code review) — measures how often a reviewer flags the method containing a labelled bug:

Reviewer Recall
Laude RevEngine Prime 46.3%
Perch · OpenAI Decisions ($0.024/PR) 40.0%
block/review 32.6%
... ...
Cursor 9.6%
Perch · Jev ($0.011/PR) 7.9%

Greptile benchmark — 50 pull requests, each with one known bug. Perch flags the function holding the bug:

  • Perch on OpenAI Decisions: 76% at $0.007 per PR
  • Greptile: 82% at ~$1
  • Cursor Bugbot: 58% at ~$1.50
  • GitHub Copilot: 54%
  • CodeRabbit: 44% at $1–3
  • Perch on Jev: 44% at $0.003
  • Graphite: 6% at ~$2

The takeaway: Perch is competitive with much more expensive tools, at a fraction of the cost.

Choosing a model

By default, Perch Cloud picks the best model for each question. You can override it with environment variables:

export PERCH_BASE_URL=https://api.typesafe.ai/v1/systemone
 export PERCH_API_KEY='your-key'
export PERCH_MODEL_ID=jev-latest

Supported models include Jev (TypeSafe), Liquid AI d1, OpenAI gpt-6-luna, and two community models (DiffusionGemma Jev and SemiF) hosted on Beam. Any endpoint that speaks the "System One" format works. If the URL ends in /decisions, Perch reads the key from OPENAI_API_KEY when PERCH_API_KEY isn't set. PERCH_MAX_QUESTIONS controls how many questions are batched per request for models that don't specify.

Files Perch creates

Location Contents
.perch/ Generated scan results and cache files
.perch/rules/ Custom rules split across .yaml/.yml files (commit these)
.perch/closed.jsonl Dismissed findings and reasons (commit this)
perch.yaml Custom rules, managed by perch rules add/edit/remove
.claude/, .codex/, .pi/, .cursor/ Instructions installed by perch setup <assistant>

Agent skills

You can wire Perch into AI coding assistants so they can run scans themselves:

perch setup claude-code   # .claude/skills/perch/SKILL.md
perch setup codex         # .codex/skills/perch/SKILL.md
perch setup pi            # .pi/skills/perch/SKILL.md
perch setup cursor        # .cursor/rules/perch.mdc

Development

npm install       # dependencies
npm run check     # lint, typecheck, test
npm run build     # bundle src/cli.js into dist/cli.mjs

npm link after a build puts the local checkout's perch on your PATH.

Links

  • Website: perchscan.com
  • Docs: docs.perchscan.com
  • Discord: discord.gg/znTcuKRK
  • Benchmark runs and reproduction steps: .benchmarks/reviewbench and .benchmarks/greptile in the repo
  • Model comparison data: huggingface.co/datasets/perchscan/benchmark-results

Related

  • Project
  • Project
  • Project
  • Project
  • Dispatch