pi-web-annotator
Annotate webpage elements or text, send targeted change requests to Pi, or copy them as Markdown.
Package details
Install pi-web-annotator from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-web-annotator- Package
pi-web-annotator- Version
2.0.5- Published
- Nov 16, 2026
- Downloads
- 946/mo · 67/wk
- Author
- pbjorklund
- License
- MIT
- Types
- extension
- Size
- 79.7 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"image": "https://raw.githubusercontent.com/pbjorklund/pi-web-annotator/main/artwork/screenshots/pi-workflow.png",
"video": "https://raw.githubusercontent.com/pbjorklund/pi-web-annotator/main/artwork/demo/pi-web-annotator-demo.mp4",
"extensions": [
"./pi-extension/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Web Annotator for Pi
Annotate webpage elements or text, send targeted change requests to Pi, or copy them as Markdown.
Web Annotator for Pi adds an on-page review layer to Firefox. Click an element or select text, write the change you want, and keep reviewing across reloads and page navigation. Copy one note or the whole collection for Pi, or use the optional local bridge to queue annotations in the active Pi session and see progress in Firefox.
Use it when visual webpage review needs exact element or selected-text context. Do not use it for automated accessibility audits, remote team review, Firefox for Android, or pages whose secrets must not enter browser storage or an agent transcript. The Firefox extension works without PI; install the bridge only when direct local delivery is useful.
This README describes repository source, not necessarily the version installed from Firefox Add-ons.
Read the behavior walkthrough for the full capture, storage, export, bridge lifecycle and privacy contract.
Features
- Element annotations: point at a button, card, heading, image, or other element and attach a change request.
- Text annotations: select a phrase or paragraph and keep the quoted text with the note.
- Source-friendly context: capture element attributes, text, component hints when available, and a positional fallback.
- Cross-page collections: keep one review collection while navigating within the same site.
- Cross-tab coordination: preserve independent changes across same-origin tabs; report competing edits instead of overwriting them.
- Movable review panel: drag the panel out of the way or dock it by keyboard; its placement survives navigation.
- Editable notes: revise a pending annotation without recapturing its element or selected text.
- Pi-ready export: copy one annotation as Markdown, or the full collection as Markdown or JSON.
- Optional Pi workflow: send one note, send all pending notes, or save and send in one action.
- Live Pi status: distinguish pending, queued, active, and completed work.
- Keyboard workflow: annotate, pause capture, switch modes, copy, save, and dismiss without leaving the page.
- Local-first operation: no account, analytics, advertising, remote code, or developer-operated service.
Install
Firefox Add-ons
Download Web Annotator for Pi from Firefox Add-ons. The extension supports Firefox desktop only; Firefox for Android is unsupported. After the first installation, Firefox opens a welcome tab with the annotation workflow and Pi setup commands.
To test an unreleased change, follow the temporary installation steps in CONTRIBUTING.md.
Use
Annotate an element
- Enable Web Annotator for Pi from the toolbar or press
Alt+Shift+A. - Hover over the page to preview the current target.
- Click an element.
- Write the requested change.
- Choose Save, or choose Save and send when the Pi bridge is connected.
Annotate text
- Switch the panel from Element to Text, or press
Alt+T. - Select text on the page.
- Write the requested change and save it.
Text annotations use an amber highlight. A green outline previews the hovered element; saved annotations use numbered pins. Numbered pins expand to fit longer IDs and stack vertically when comments would overlap, including multiple comments on the same element.
Save and synchronize
Save waits for Firefox storage confirmation; Save and send does not submit an unconfirmed note. Same-origin tabs receive committed changes. Independent creates, edits and deletes are preserved; a stale edit, delete or Clear is rejected so it cannot overwrite another tab's newer work. Saved IDs are allocated centrally and not reused after Delete or Clear.
A failed or unconfirmed write keeps the draft and shows Reload saved in the editor. Collection changes stay blocked until a successful reload. Review the saved collection before explicitly retrying: a lost reply can mean the write committed. Reload does not discard the draft or retry saving/sending automatically.
After upgrading, reload every previously enabled tab before continuing. Older injected writers are not coordinated with the new storage format. Existing Firefox collections migrate on first access; website localStorage is untouched.
Export a review
- Copy exports the full collection as Markdown.
- The edit button on a pending row reopens its saved note.
- The copy button on a row exports only that annotation.
Alt+Shift+Jcopies the collection as JSON.- Clear removes the current site's collection after confirmation.
The Markdown includes page URLs, available source/component hints, element attributes and text, selected text, and a positional DOM fallback. Ordinary Markdown copy has no untrusted-data preface. Pi sends add instructions to treat page values as untrusted; those instructions do not enforce agent behavior.
Send annotations to Pi
The Firefox extension works without Pi. To enable the local bridge, install the Pi package:
pi install git:github.com/pbjorklund/pi-web-annotator
Fresh Pi sessions keep the bridge off, including when the package is configured for a project. Restart Pi, then explicitly start the bridge:
/annotator-server start
The TUI's Annotator bar shows listening or active while the bridge runs and stays hidden when stopped. It does not start the bridge. Stopping removes only this bar; RPC and headless sessions create no terminal widget.
The bridge listens on 127.0.0.1:17373 and stops with the Pi session. Its constant request header is not user authentication; local software can send it too. Stopping the listener does not cancel Pi work already delivered.
The first send opens a bundled consent page. Choose Allow sending to local Pi, approve Firefox's optional data permission, return to the annotated page, and send again. The background rechecks both optional data permissions before every annotation send and stored job-ID status request, even when the caller bypasses the regular send UI. Missing, revoked, unavailable or invalid permission results refuse the relay without opening another consent page. Health probes remain usable without data permission. This per-request check cannot retract a request already sent; the HTTP bridge itself does not verify Firefox permission or authenticate other local clients.
| Browser state | Meaning |
|---|---|
| Empty checkbox | The annotation is pending and ready to send. |
| Right arrow | Pi accepted and queued the annotation. |
| Spinner | Submission is pending or Pi reports active work. |
| Checked checkbox | Pi reported lifecycle completion, or you checked the row manually. Neither proves a correct fix. |
Use Save and send for a new note, the arrow button for one pending row, or Send to Pi for all pending rows across the current origin, including other pages. A toast confirms queue and completion events.
Each overlay reserves selected rows during consent, so overlapping clicks skip those rows rather than queue retries; other pending rows can still be sent. Deleting, clearing or manually toggling a row invalidates its old selection; late replies cannot overwrite a newer row/job state. After a failed or timed-out send, inspect Pi before sending again: retries can duplicate work already accepted. Turning off the overlay stops new activity but cannot retract requests or storage writes already admitted.
Pi bridge commands:
/annotator-server status
/annotator-server stop
For a one-off Pi run from this checkout:
pi -e ./pi-extension/index.ts
Keyboard shortcuts
| Shortcut | Action |
|---|---|
Alt+Shift+A |
Toggle Web Annotator for Pi for the active tab. |
Alt+Shift+C |
Copy all annotations as Markdown. |
Alt+Shift+J |
Copy all annotations as JSON. |
Alt+A |
Pause or resume page capture while the panel stays open. |
Alt+T |
Switch between element and text mode. |
Ctrl+Enter / Cmd+Enter |
Save a new note and send when Pi is connected; save only when editing an existing note. |
| Arrow keys on the Annotations title | Dock the panel to a viewport edge. |
Home on the Annotations title |
Reset the panel to the bottom-right. |
Esc |
Cancel the open note editor. |
Privacy
Collections in website localStorage are not imported, changed, or deleted. Only collections saved in Firefox extension storage are loaded.
Web Annotator for Pi has no developer-operated backend and does not include analytics or advertising. Saved annotations and panel placement use Firefox extension storage. Page scripts cannot directly access that storage, but they can inspect or alter notes rendered in the ordinary page DOM. The background checks Firefox data permission before relaying annotation content or stored job IDs to 127.0.0.1; health probes carry no annotation text and remain permission-independent. Pi may then send that content to the model provider configured by the user. With permission and a running bridge, page scripts can trigger on-page send controls without user activation. Firefox consent is not per-job human approval.
Annotations can contain full URLs, selected text, element textContent including hidden descendants, custom attributes and your notes. Do not annotate secrets. The native Firefox DOM assessment measures page-script reads, persisted changes and synthetic sends; it does not implement a mitigation. Read PRIVACY.md for storage details, permission rationale, deletion behavior, and the Pi boundary.
Permissions
| Permission | Why it is needed |
|---|---|
activeTab |
Enables the overlay after a toolbar or keyboard action. |
scripting |
Injects and removes the annotation overlay in the active tab. |
storage |
Keeps a separate annotation collection for each website. |
<all_urls> |
Reinjects an already-enabled overlay after navigation and allows annotation on user-selected sites. |
Optional browsingActivity |
Allows page URLs to be included when the user sends annotations to local Pi. |
Optional websiteContent |
Allows selected text and element context to be included when the user sends annotations to local Pi. |
Release notes
Read CHANGELOG.md for versioned changes. Git and npm packages include this file for native Pi 1.5 update notices.
Maintain and validate
Read CONTRIBUTING.md before opening a pull request. Run the local release gate with:
npm ci
npm run check
npm run build
npm ci installs the locked TypeScript/lint toolchain and PI SDK 1.3.0 used by bridge tests. check runs strict non-emitting types, zero-warning lint, negative tooling probes, generated-output parity, and the existing browser/bridge/security tests. PI supplies the runtime SDK; its peer packages remain optional for browser-only consumers. Browser JavaScript and CLI MJS are generated from TypeScript, not maintained separately. See the contribution guide for the source layout and watch commands.
The development toolchain uses local node-forge and deepmerge security backports, verified during npm test. Its offline source and tarball checks require GNU tar. See the backport notes and dependency security notes for provenance, exploit tests, dependency overrides, and audit/signature coverage limits.
Use npm run dev for Firefox development and pi -e ./pi-extension/index.ts for a checkout-local bridge. Keep the Firefox manifest version, package version, AMO metadata, privacy text, and release artifacts synchronized. Update the PI bridge with pi update --extensions, reload PI, or remove it with pi remove git:github.com/pbjorklund/pi-web-annotator; browser-extension updates remain managed by Firefox or the temporary-install workflow.
Attribution
Web Annotator for Pi began as a Firefox port of kuzmany/browser-annotations by Zdeno Kuzmany. This project retains and builds on the upstream product idea, overlay design, and parts of the original content-script implementation. It has since added Firefox-specific packaging and navigation, cross-page collections, source-aware and text annotations, consent and privacy controls, publishing tooling, and the optional Pi workflow.
The project is available under the MIT License, which preserves the upstream and current maintainer copyright notices. See THIRD_PARTY_NOTICES.md for the upstream code attribution and licenses for development tools.
