pedit

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT

README

pedit — Pair edit your local files.

CI Release OpenSSF Scorecard

https://github.com/user-attachments/assets/14bec9ab-8c14-495c-8faf-9cdd98d8fd5b

What it looks like. Carol shares a file with pedit; Alice and Bob edit it in their browsers. The first three are Alice's view; the last is Bob's, opened from a comment-only link:

A CSV file as a table, with Alice's selected cell and Bob's selected cell outlined in their colors
Markdown, with a live preview and Bob's cursor CSV as a table, with Bob's selected cell
A canvas file as a board of nodes, edges and a group, with the node Bob has selected outlined
Canvas as a board, with Bob's selected node Comments, from a comment-only link

pedit is a CLI that lets people edit your local files together in their browsers. Edits are saved back to your file:

❯ pedit notes.md

  notes.md is ready to write together.

  Send this link to the people you want to invite:
    https://edit.piconic.ai/r/<room-id>#<key>

  Press Ctrl+C when you are done. Everything is saved to notes.md.
  To share another file in this room, type its path and press Enter.
  Press Ctrl+L for links that can only comment or read.

  ● Alice and Bob are here

No install or account needed for collaborators on the public server.

Besides editing, people in the room can comment on text, table cells and canvas nodes; comments never go into the file (Comments). What each person can do depends on the link you send them: the printed link lets them edit, and Ctrl+L shows links that let them only comment or only read (Comment-only and read-only links).

If the connection drops, keep pedit running. It reconnects with the same link and merges edits made while disconnected. The terminal keeps an offline notice and confirms when syncing resumes. While the host is away, the browser pauses editing; edits already made or still in transit merge when the host returns. The public relay keeps guests waiting for up to two minutes. In a kept room (the default, see below), the browser does not pause: the header says the host is away and until when, text files and their comments stay editable and images can be pasted, and the relay keeps each edit, which shows as sending until the relay has it. The host takes the edits in on its return, and everyone is live again. Closing the page with edits still sending asks first. Canvas board edits are kept too; its JSON pane is read-only while the host is away. Do not edit the local .canvas file while away: resume refuses external changes instead of merging them.

Text, canvas changes, and comments save during the session, including while edits continue. Saves normally start about a second after the first pending change. A crash can lose changes still in memory, in transit, or waiting for a save; failed or slow disk writes can extend that window. Ctrl+C flushes pending changes and closes the room (a kept room stays open for you to come back to). Without a keep (--keep 0), running pedit again creates a new link.

A room opened from existing text files is kept for a day by default. When you press Ctrl+C, pedit saves the files and leaves the room open on the relay, and prints its deadline. Guests stay connected, the link keeps working, and what they write while you are away waits on the relay, encrypted, until you are back. In the same project, run pedit notes.md again (or pedit resume) to take the room up: pedit connects as the host, merges what you changed in your files meanwhile with the guests' edits, saves the files, tells the relay it can drop what it held, and carries on as a live room (Ctrl+C keeps it again). pedit resume alone picks the one kept room, or lists them and asks which (or pass the room ID, pedit resume <room>; the room's link works too). pedit rooms lists the project's kept rooms (--json for programs), and pedit close takes in the edits and closes the room for good. pedit prints the room's ID as Room: <id> under the link, and when you leave a kept room, so you can name it without picking it out of the link.

--keep 7d keeps the room for that long instead (up to the relay's cap, 7 days on the public relay; pedit reports the effective value). --keep 0 opens a room that stores nothing and ends when you leave. To change the default for a project, set keep: 7d in .pedit/config.yaml (same syntax as --keep; keep: 0 turns keep off). The command line wins over the config, and the config over the default. Keep applies to pedit <file> and pedit <file> <file>... for existing text and canvas files; a scratch room (pedit with no file, --template, --directory) and joining a link (pedit <link>) are not kept. If a kept room already holds the file, pedit <file> resumes it; its set of files is fixed, so a file it does not hold is an error: run pedit close first, or pedit --keep 0 for a separate room. A relay that cannot keep rooms (a self-hosted one that is not updated) ends the room when you leave, and pedit says so. Resume information stays in a private 0600 record under pedit/keep/ in your user configuration directory, outside the project. pedit removes that record when pedit close ends the room, when a resume finds the room gone, and at the next run in the same project for rooms past their deadline (as for rooms kept by an older version of pedit, which can no longer be resumed), never while a write is pending. A kept room shares the fixed set of text files it started with (up to 64; no file can be added later), with their comments and pasted images: guests can paste images (PNG, JPEG, GIF or WebP, within the public relay's image limits) as in a live room, and the relay keeps them, encrypted, until the room's deadline. On pedit resume pedit saves each image the merged text refers to under assets/ beside its file, as a live room does, and reports any it cannot find. Guests can comment while you are away, and pedit resume writes the threads to .pedit/meta/<path>.json as a live room does, never into the shared file. The browser uses the same file tabs as a live room. The encrypted snapshot for all files together, comments included, must fit within 1 MiB; log updates have a separate byte budget. Changes made directly to a local file while away are merged with the guests' edits on resume, the way a live room merges a save from another editor. A file that cannot be read or is not valid UTF-8 is preserved and stops automatic recovery. These two host commands currently require Unix file permissions and are unavailable on Windows.

To end a kept room before its deadline, run pedit close (it takes the same room ID or link as pedit resume, and picks or asks the same way; pedit close --help says more). It first does what pedit resume does once: takes in the guests' edits, comments and images and saves them to your files. Only then does it ask the relay to delete everything it holds for the room (text, log and images) and make the link stop working for good, and remove the resume record. If any file cannot be saved, the room stays open and the record stays, so you can fix that and run it again. Guests who have the page open are told that the host closed the room; edits they had not yet sent are lost.

Collaborators who would rather stay in their own editor join from the command line instead. Given the link, pedit mirrors the shared file to a temporary copy and keeps it in sync both ways until they leave or the host closes the room; the copy is removed then, like closing a browser tab. pedit names the copy itself, from a number and the letters and digits of the host's name for it, never as the room names it:

❯ pedit 'https://edit.piconic.ai/r/<room-id>#<key>'

  Joined. Your copy of the shared file:
    /tmp/pedit-<room-id>-2271/00-notes.md
    Copied to your clipboard.

  Edit it with any editor; changes sync both ways while you are in the room.
  Press Ctrl+C to leave. The copies are temporary and removed then.

Quote the link in the shell: # starts a comment otherwise. Copy out what you want to keep before you leave. Canvas rooms can only be joined in a browser for now.

Several files in one room

Name several files to share them in one room, under one link. Guests switch between them with the tabs above the editor:

❯ pedit agenda.md docs/spec.md board.canvas

While sharing, type the path of another file and press Enter to add it to the room, without a new link: a meeting can start with the agenda and bring in the spec when it comes up. Only the host adds files; nobody in the room can ask for one. A room shares up to 20 files, each a regular UTF-8 file, as when sharing one. Paths are shown relative to the directory pedit runs in.

A guest who joins from the command line gets a copy of each text file in the same temporary directory, including files the host adds later, named after the host's path: docs/spec.md is copied to 01-docs-spec.md. Canvases are for the browser. The copies end their lines with LF, whatever the host's file uses: a file whose lines all end in CRLF is shared with LF (the browser editor counts positions in LF) and saved by the host with CRLF again. A file with mixed endings is shared as it is, and editing it in the browser may misplace edits.

Comments

In the browser, select some text, a cell of a table (or a whole row or column), or a node of a canvas, and write a comment in the panel beside it. Everyone in the room sees it at once, marked where it points, and can reply or resolve it; resolved threads stay under Resolved, to read again or reopen. You can edit or delete your own comments from their ⋮ menu (deleting asks first). Each file's tab (or its name, in a room of one file) shows how many of its comments are still open, and the speech bubble in the header, or Ctrl/⌘+Alt+M, shows or hides the comments. A comment never goes into the file: the host keeps the comments of each file in .pedit/meta/<path>.json, and the next session shows them again, found by the text, cells or node they pointed at. A comment follows its place as people edit, and says so when that text changed or is gone. A comment goes on up to 1,000 characters of text, or of a cell.

Comments are kept for files inside the project: the directory of .pedit/config.yaml, or the one you run pedit in when there is none. Commit .pedit/meta/ to keep them with the files. A guest on the command line, or an older pedit, does not see them. See the design for how they are anchored and checked.

The link pedit prints lets people edit. To let someone only comment, or only read, press Ctrl+L while sharing, or choose Share in the browser's header, and send one of these instead:

  Links with less access:
    Comment only  https://edit.piconic.ai/r/<room-id>#c.<key>
    Read only     https://edit.piconic.ai/r/<room-id>#r.<key>
Link Read the files and comments Write comments Edit the files
Edit ✓ ✓ ✓
Comment only ✓ ✓
Read only ✓

People with a comment-only or read-only link are listed among the participants as comment only or read only. A comment-only link is offered while some file keeps comments. Each link also gives the ones below it, never the ones above, and every peer checks what the others may do, not the relay. These links open in a browser; the command line joins with an edit link only.

Why pedit?

Local files work naturally with coding agents and your own editor. Keeping documents in Git makes changes reviewable and preserves their history, but asking someone to clone a repository and open a pull request adds friction to a quick editing session.

pedit lets you invite people into the file with a link and edit together in their browsers. They do not need to set up your development environment. The edits land in the same local file, ready for your next agent task, review or commit.

Install

macOS / Linux:

curl -fsSL https://edit.piconic.ai/install.sh | sh

install.sh is served by the relay. To install from GitHub instead, use one of the methods below.

Homebrew (macOS / Linux):

brew install piconic-ai/tap/pedit

mise:

mise use -g github:piconic-ai/pedit

Go 1.25+:

go install github.com/piconic-ai/pedit/cmd/pedit@latest

Binaries: GitHub Releases (macOS / Linux / Windows · amd64 / arm64). Each archive carries a build provenance attestation; check that it was built by this repository's release workflow with

gh attestation verify <archive> --repo piconic-ai/pedit \
  --signer-workflow piconic-ai/pedit/.github/workflows/release-build.yml

(releases up to v0.1.2 were signed by tagpr.yml instead). Releases after v0.1.5 also carry the attestation as a file, pedit_<version>.sigstore.json, for gh attestation verify <archive> --bundle <file> .... The archives are reproducible: GoReleaser v2.18.3 (goreleaser release --clean --skip=publish with .goreleaser.yaml) run on the same tag with the Go version from go.mod on ubuntu-24.04 gives the same checksums.txt. Releases made before the switch to GoReleaser were built by scripts/build-cli-release.sh; their tags still carry it, so rebuild those with that script instead.

Configuration and templates

Run pedit at a Git repository root to create .pedit/config.yaml and .pedit/templates/ with editable Markdown, CSV, and Canvas defaults.

server: https://edit.piconic.ai
output: notes
keep: 7d   # optional: how long pedit <file> keeps its room (1d if unset, 0 turns it off)

Add your own template files directly to .pedit/templates/:

pedit                          # notes/pedit-<time>.md
pedit --csv                    # notes/pedit-<time>.csv
pedit --canvas                 # notes/pedit-<time>.canvas
pedit -t minutes.md             # notes/minutes-<time>.md
pedit -t minutes.md -d meetings # meetings/minutes-<time>.md

.canvas files use JSON Canvas, an open format for whiteboard-style diagrams.

-t / --template selects a template; -t csv and -t canvas select default.csv and default.canvas. -d / --directory overrides output. New files get a timestamp and a counter if needed. Existing files are preserved.

Configuration is found from the current directory up to the Git root. output is relative to the project; -d is relative to the current directory. Without configuration, the public server and built-in defaults work immediately. Set server in the config instead of PEDIT_SERVER.

Privacy and security

In a browser, the editor's code comes from the relay, so you trust whoever runs it and Cloudflare, which hosts it: a modified editor could read the key and plaintext. The command line runs no code from the relay: guests can join with pedit '<link>' instead of a browser, using a pedit installed from Homebrew, go install or a release archive you verify, not from install.sh, which the relay serves. Or self-host the relay and editor. See security design for the encryption and what it does not protect against, and the public relay for what edit.piconic.ai logs and keeps. The public relay's terms of use and privacy policy are on the relay itself.

This is a simplified illustration: pedit encrypts document updates rather than raw text. The relay sees the room ID and encrypted bytes, but not the key. Edits in the opposite direction follow the same process.

  • End-to-end encryption. Document updates and pasted images are encrypted on your devices. The relay receives ciphertext; the key stays in the link's #fragment and is never sent to the server.
  • Local files, temporary sessions. The relay never stores plaintext. Kept rooms retain encrypted text until their deadline. Live rooms attempt to delete encrypted images when the host leaves (what the public relay keeps).
  • Private local copies. On Unix, new CLI join copies and saved attachments use owner-only permissions, further restricted by your umask. Updates retain an existing document's permissions; existing files are not retroactively made private.
  • Comments are encrypted too. They travel as updates of a document of their own, end to end like edits, and only the host saves them, in .pedit/meta/; commit that only if you want them in the repository. The editor lets you change or delete only your own comments, but anyone with an edit or comment-only link could change or delete any comment.
  • The link grants editing access. Anyone with the full link can read and edit during the session. Share it only with people you trust, or send a comment-only or read-only link, which cannot change the files: editors sign what they send, and every peer drops what a link cannot sign. Closing a session does not erase copies participants have made.
  • Room IDs alone do not grant access. Clients derive a separate admission token from the fragment key. The relay checks this token before accepting connections or attachment requests; the token cannot decrypt content.
  • Your relay, your access rules. Use the public relay at edit.piconic.ai, or self-host to require sign-in with Cloudflare Access.
  • Only the files you share. The CLI reads and writes the files you name, images in assets/ beside each, its own .pedit/ configuration and a cache, and runs only a clipboard tool and, for Access, cloudflared. See what pedit does on your computer for every file and what you accept.

You must also trust participant devices and browsers. Infrastructure can see IP addresses, room IDs, request timing and ciphertext sizes; infrastructure and Access logs have separate retention settings and are not erased when a room closes.

Markdown previews can embed YouTube, Vimeo, Loom, Figma, CodePen, StackBlitz, Observable, Spotify, SoundCloud and Miro players and public source files on GitHub, and show external images and videos where the relay allows them (the public relay does not). An embed loads only when someone clicks "Load from" on it, or ticked "Always load" for its provider, so nobody in the room contacts a third party just because a URL was written in the file. See embeds for the list, sizes such as https://youtu.be/dQw4w9WgXcQ#width=560&height=315, GitHub line ranges, privacy, and how a self-hosted relay adds or drops providers. With Access, avatars may load from an identity provider or Gravatar using an email hash. Those providers can see the requests.

Besides the relay, the CLI itself connects only to api.github.com, to check for a newer release, and keeps the answer for a day; it never downloads or installs one.

To report a vulnerability, see SECURITY.md.

Self-host

The public relay at edit.piconic.ai is shared, so it has limits:

Public relay
People in a room The host and 4 guests
Images 5 MiB each, 50 MiB per session
New rooms 20 a minute from one network
Connections 60 a minute from one network
Session length 24 hours
File size About 1 MiB, on any relay (details)

Self-host when you need more, or when you want to limit who can join editing sessions. Cloudflare Access lets you allow specific email addresses or identity provider groups; participants need both an allowed identity and the session link.

Deploy to Cloudflare

The button copies only the server workspace (packages/), without the Go CLI. Deploy the relay and browser editor to your Cloudflare account, then:

# Set server: https://<worker>.<subdomain>.workers.dev in .pedit/config.yaml
pedit notes.md

See self-hosting notes for requirements and Access setup.

Contributing

See CONTRIBUTING.md for development setup and pull requests.

Directories

Path Synopsis
cmd
pedit command
Command pedit shares a local text file and co-edits it with others in their browser.
Command pedit shares a local text file and co-edits it with others in their browser.
internal
access
Package access signs in to a pedit server behind Cloudflare Access with cloudflared, so that sharing a file stays a single command.
Package access signs in to a pedit server behind Cloudflare Access with cloudflared, so that sharing a file stays a single command.
attach
Package attach saves images pasted into the shared document next to the host's file, and uploads them again for peers who could not fetch them.
Package attach saves images pasted into the shared document next to the host's file, and uploads them again for peers who could not fetch them.
canvas
Package canvas reads and writes JSON Canvas files (https://jsoncanvas.org) and moves them in and out of a shared document.
Package canvas reads and writes JSON Canvas files (https://jsoncanvas.org) and moves them in and out of a shared document.
clipboard
Package clipboard copies text with the platform's clipboard command.
Package clipboard copies text with the platform's clipboard command.
filewriter
Package filewriter writes the shared document back to the host's file.
Package filewriter writes the shared document back to the host's file.
lineend
Package lineend holds a file whose lines all end in CRLF as LF in a document, and writes it back with CRLF.
Package lineend holds a file whose lines all end in CRLF as LF in a document, and writes it back with CRLF.
merge
Package merge applies edits made to the file outside pedit onto the shared text.
Package merge applies edits made to the file outside pedit onto the shared text.
meta
Package meta reads and writes the metadata file pedit keeps for a shared file under .pedit/meta/, which holds its comments (#121).
Package meta reads and writes the metadata file pedit keeps for a shared file under .pedit/meta/, which holds its comments (#121).
protocol/prototest
Package prototest provides an in-memory stand-in for the Worker.
Package prototest provides an in-memory stand-in for the Worker.
serve
Package serve holds a file's Yjs document for a local app: clients on a Unix socket speak the y-websocket protocol (sync and awareness, unencrypted), and pedit alone writes the file and merges saves made by other editors.
Package serve holds a file's Yjs document for a local app: clients on a Unix socket speak the y-websocket protocol (sync and awareness, unencrypted), and pedit alone writes the file and merges saves made by other editors.
session
Package session shares a local file in a pedit room.
Package session shares a local file in a pedit room.
suggest
Package suggest finds files whose names are close to one that does not exist, to turn a typo into a ready-to-run command.
Package suggest finds files whose names are close to one that does not exist, to turn a typo into a ready-to-run command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL