2026-11-22 22:53:06 +02:00
2026-11-22 14:38:50 +02:00
2026-11-22 14:38:50 +02:00
2026-04-30 13:55:26 -06:00

pi-lens

pi-lens

omp status

pi-lens gives AI coding agents fast, language-aware feedback while they write and edit code. It is an extension for the pi coding agent, with an experimental MCP server for other hosts.

An AI agent working with pi-lens? Read the agent guide. It explains the findings you will see and how to respond.

An AI agent changing pi-lens itself? Read AGENTS.md and CONTRIBUTING.md. A one-line-per-doc index for agents is in llms.txt.

Quick start

pi install npm:pi-lens

Or from git: pi install git:github.com/apmantza/pi-lens.

Requirements: Node.js >=22.19.0 and a pi host of 0.86.1 or newer. On pi 0.80–0.85, pi-lens gives no findings, because those hosts keep the prompt where the extension cannot write to it. Release QA baseline lists the certified hosts. See Troubleshooting for npm v12, Android, and skills-manifest notes.

Install it and start a session. The language servers and many linters start with no setup. Some tools need your project's config, and a few are opt-in. See What runs by default and Settings.

To let a coding agent install it, paste this into its prompt:

Install pi-lens (npm:pi-lens) into pi, then read docs/agent-guide.md in
https://github.com/apmantza/pi-lens for how to read and respond to its findings.

What the agent sees

After an edit, the tool result carries any blocking findings, with the offending line. At the end of the turn, pi-lens injects the findings that remain. The text below follows the real renderers: the STOP block from clients/pipeline.ts, and the turn-end framing, Advisory label, and warnings summary from clients/runtime-context.ts and clients/runtime-turn.ts.

🔴 STOP — 1 issue(s) must be fixed:
  L4: 'randomInt' is declared but its value is never read.
      → const randomInt = Math.floor(result);

[pi-lens automated check — not a user request] Address 🔴 blockers before continuing; ℹ️ advisories are informational only.

ℹ️ Advisory — no action required this turn:
🟡 Fixable warnings introduced this turn: 1.
Use lens_diagnostics with mode=delta to inspect these warnings.
Files:
  src/app.ts: 1

The agent must clear a 🔴 blocker before it reports the task as done. A result marked partial, stale, or unconfirmed is never reported as clean.

What you get

  • Real diagnostics on every edit. Language servers, linters, type-checkers, and scanners check each written file, and an impact cascade checks the files that depend on it. See language coverage.
  • Safe formatting and autofix. pi-lens formats and fixes files with the tools you configure or it confidently detects.
  • Structural rules. ast-grep and tree-sitter rules flag correctness and security smells, and you can add custom rules.
  • Code navigation for the agent. Tools cover LSP navigation, ranked identifier search, module reports, and symbol reads, so the agent reads less code. See agent tools.
  • Guards and triage. Read-before-edit blocks blind edits, an optional git guard holds git commit while blockers stand, and on pi you can mark a finding false-positive, suppressed, or deferred. The marking tool has no MCP endpoint, and under pi's lazy tool loading the agent activates it first. See dispositions and agent tools.
  • Health and scans. /lens-health reports runtime health, and opted-in projects get background security and dependency scans.

The feature reference covers everything.

What runs by default

pi-lens runs tools in three tiers. The per-tool table lists every gate and where it lives in the code.

  • No project config. Language servers start by default, and --no-lsp turns them off. Many linters and formatters also run when the tool is available. Examples: ruff, shellcheck, hadolint, and ktlint for linting; oxlint or Biome for JS and TS when the project has no ESLint config; Biome and shfmt for formatting.
  • Your project's config. ESLint, golangci-lint, mypy, phpstan, and vale skip a project that lacks their config. detekt needs a detekt config file, credo needs mix.exs, and the taplo and clang-format formatters wait for config.
  • Opt-in. trivy (trivy.enabled), SpotBugs (--lens-spotbugs), Helm render validation (helm.renderValidation.enabled), and the commit guard (--lens-guard) stay off until you enable them.

Project-local binaries, such as node_modules/.bin/eslint or .venv/bin/ruff, run only when pi trusts the project.

Commands you'll use

Command What it does
/lens-health Show runtime health, latency, and degradation counts
/lens-widget-toggle Show or hide the diagnostics widget
/lens-toggle Turn pi-lens on or off for the session
/lens-map Build an interactive HTML dependency map of the project
/lens-allow-edit <path> Override the read-before-edit guard for one edit
/lens-tools Show which tools are installed, auto-installed, or fall back to npx

The full list of commands and runtime flags is in Tools and commands.

Documentation

Use

Configure

Extend

Troubleshooting

Install problems

The install notes in the usage guide cover three cases:

  • npm v12 asks you to approve dependency install scripts such as the @ast-grep/cli postinstall.
  • Android and Termux can fail to find the @ast-grep/cli native binary. The notes give a verified fallback.
  • Skills arrive through the package manifest. Loading the extension file directly (pi --extension ./index.js) loads no pi-lens skills.

For runtime problems, run /lens-health and read the usage guide troubleshooting section.

Contributing

See CONTRIBUTING.md for the development workflow, runner, LSP, formatter, and rule checklists, and for issue and PR conventions.

Report security issues privately; see SECURITY.md. pi-lens is released under the MIT License.

Contributors

Thanks goes to these wonderful people:


Apostolos Mantzaris

💻 📖 🤔 🚧 👀

Kenneth McCormick

🐛 💻 🤔 📖 ⚠️

Anh Chu

💻

minicx

💻

silvanshade

💻

Tifan Dwi Avianto

💻

Amit

💻 🐛

Fractiunate // David Rahäuser

💻

Vitali Karasenko

💻 🤔

V

💻

Fabio Dee

💻

moj02090

💻

Micah Halter

💻

Julien Ellie

💻

Ruben Paz

💻 🐛

C.Junxiang

💻 🐛

Trevon

💻

Aaron Bell

💻 🐛

Will Mitchell

💻

spyrosbazios

💻

Roman Galeev

💻

jerryfan

💻

Max L.

💻

David Ryan

💻

JayceFreeman

💻

Heitor Ramon Ribeiro

💻

Chris Patti

💻 🐛

Chenxin Yan

💻 📖 🐛

flowing-abyss

💻

shaochong-theoai

💻 🤔

Xu Yili

🐛 💻

Ricardo Raposo

💻

Justin Smestad

💻 🤔

anasalsbey-glitch

💻 🐛

정제훈

💻 🤔

Myke Stubbs

💻 🐛

JSap0914

💻

Kent Hou Man

💻 🐛

Jakub Neumann

💻 🐛 🤔

CyYu

💻

Carolina

🐛 🤔

LeakedBy

🐛

Matthew Booth

🐛

Wiedzmin89

🤔

Virgile

🐛

Finn

🤔

Wayne E

🐛

RimuruW

🤔

Bjynt

🐛 🤔

Tri Van Pham

🐛

BingWuJ

🐛

tackleberrybey

🐛

Mariann Abshire

🐛

ProbabilityEngineer

🤔

Leonardo Rick

🐛 🤔

Ken Banks

🐛

Rico Sta. Cruz

🤔

Nikita Bilous

🐛

Andrea Arturo Venti Fuentes

🐛

dacec354

🐛

Brandon Martin

🐛

Alper Tarhan

🐛

Andrius Solopovas

🐛

Graham Jenkins

🐛

Wings Butterfly

🐛

Johannes Klauss

🤔

Tan Yong Sheng

🤔

Frédéric

🐛

Salvador Fuentes Jr

🐛

Viktor

🐛 🤔

Gregory Orton

🐛

Jim Allen

🐛

quantfiction

🐛

Art

🐛

Colin Swenson-Healey

🐛

Laurent Wiesel

🐛

Rei Starks

🐛

Roberto Freitas

🐛

tmttodd

🐛

smaharnav

🐛

Mza.Guille

🐛

Jason Rimmer

🐛

Arthur Heymans

🤔

Blue-B

🐛 🤔

Biser Perchinkov

🐛

Peter Nagy

🐛

Orest Tokovenko

🐛 🤔

Federico Pasqua

🐛 🤔

Ronald

🐛 🤔

Aaron Ky-Riesenbach

🐛

可爱的龙

🐛

pppobear

🐛

Bertrand Cachet

💻 🤔

earthchen

💻 🐛

Don Yin

💻 🐛 🤔 📖 ⚠️

ELA718

📖

Sujeito Operator

💻

Dan Blah

🐛

Nathan Cooke

💻

Eli Stark

💻 🐛

Marvin Aziz

💻 🐛

Mark

💻

aeturnal

💻 🐛

floatGray

💻

Thomas F Steeples

💻 🐛

Ama Senevirathne

💻

AcademyKUB8

💻 🐛

soulocker

🐛

Johanderson Mogollon

🤔 🐛

kurihada

🐛

Giraffe224

🐛

Robert Navarro

🐛 💻

Marc

🐛

Heyner Javier Marmol Verbel

🐛

Stijnus

🐛

macroxing

🐛

John Tracy

💻

woyxiang

🤔

Juncanthia

🐛

Kevin S Kirkup

🐛

George Harker

💻 🐛 🤔 📖 ⚠️

Duy /zuey/

🤔 💻

luw2007

🐛

WrongWorry

🐛

nanaxx131-gif

🐛

MateusCx

🐛

Hugh Zadora

🐛

撑伞的鱼

🐛

Lv

🐛

apmcodes

🐛

Jonathan Dong

🐛

Caprika

🐛 💻

dmontague-crwv

🐛

Yihang "Corvo" Liu

🐛

Luca Barrella

💻 🤔

xuankun zheng

💻 🐛 🤔 📖 ⚠️

Younes Beriane

💻

Jakob Sjælland

🐛

Brian B

💻

dearbld

💻

Fredrik Ekman

💻

plutoYang

💻

Flash-Z

🐛

Kristjan

🐛

raulriqueleme79-wq

🐛

liujam

🐛

Go.YAMADA

🐛

Benedikt Rötsch

🤔

Stark-X

🐛

Yahav Bahat

🐛

Edwin A. Saavedra Navarro

🐛

Laurent

🐛

vincent

🐛 🤔

Linx

🐛

Audi Young

🐛

Adam Spiers

🐛

Claudio Cocciarelli

🤔

205 Dev

🐛

Ea Chan

🐛

XiaoMing

🐛

John Reeder

🐛 🤔

Yejia Mo

🤔

bricabrol

🐛

0xkite

🐛

Steve Lovelace

🐛

ravshansbox

🐛

misc4747

🐛

Jérémy Audiger

🤔

Sebastian Rogers

🐛

Pierre

🤔

douglasf

🐛

Bolshakov Danila

🤔

theverymrp

🐛

Kaushal Prajapati

🐛

Shyamalan Kannan

🤔

Neil Chambers

🐛

Denis Da Silva Rocha

🤔

David Brenton Allen

🐛

Anders E. Andersen

🐛

Vedmaka

🐛

sith007

🐛

Punk Dev Robot

🐛

StativBus

🤔

Max Swain

🤔

DrunkenDonkey80

🐛

marioHealthSoft

🤔

Orestes Kassian

🤔

vanyastaff

🐛

周凯

💻 🐛

pikachu01

🤔

Igor G. Gor

🐛

dampent

🐛

arbelafor

🐛

yangfan qi

🤔

IGabrielRC

🐛

Taras Zubrei

🤔

pandas9

🐛 💻

Renzo Oliveira

🤔

Martin

🐛 🤔

Hershel Hale

💻

Loishi

💻 🐛

gkgoat

💻

15066212pp

🐛 🤔

Marek Hovadík

🐛

Tim Gesemann

🐛

SamYue

🐛

VladimirGVP

🐛

bear0328

🐛

beardrux

🐛

bowen xu

💻 ⚠️

dmae97

💻 🐛

Battlelamb

💻

WeiHung

💻 🤔

wertyMSD

🐛

Robert Dailey

🐛

letwir

📖

Erik Darling

🐛

Silvio

🐛

forge18

🤔

Paymahn Moghadasian

📖

Victor J. Diaz Ayuste

🤔

GlitchOverride

🐛

Can Gürcan

🤔 🐛

Zachary Chiu

🐛

ShayLu

🐛

aprudkin

🐛

Prophet Of Doom

🤔

Apostol Apostolov

🐛

Ricardo Spear

🐛

Lee Luppi

🤔 💻

Zerui Ge

💻

HyeokjaeLee

💻 🐛

Dima Marchevskyi

🐛

Jenny Leidig

💻 🤔

Jorge Barnaby

🐛

Aloneangel20

💻

Cody Herriges

💻 🤔

Thiago F

🐛

EtcherFX

🐛

Klaus Hartl

🤔
S
Description
No description provided
Readme MIT
400 MiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 91.4%
JavaScript 6.8%
TLA 1.8%