← Catalog

pi-coedit

Live human-vs-agent edit awareness for the pi coding agent: overwrite protection, human-edit notes, /whose attribution.

Package

Install

Install with PiG

pig install npm:pi-coedit

Install with Pi

pi install npm:pi-coedit
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./dist/index.js"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.3 (README.md). PiG does not review it.

pi-coedit

Live human-vs-agent edit awareness for the pi coding agent. When you and pi work in the same repo at the same time, pi knows what you changed, can't silently overwrite it, and every agent edit is traceable.

Part of the coedit monorepo. Complements Git AI (post-commit notes) with the live, in-session layer.

Install

pi install npm:pi-coedit          # once published
pi install ./packages/pi-coedit   # from a checkout (npm run build first)
pi -e ./packages/pi-coedit        # one-shot try

What it does

  • The agent is told about your edits. When a file the agent has touched changes under you, the next model request gets a short note with your diff (capped, once per change): "The user edited these lines; keep their changes."
  • Overwrite guard. An edit/write against a file with human changes since the agent last read it is blocked with a re-read-and-merge reason. In the TUI you choose: re-read and merge (default), allow anyway, or cancel. Policy: block / ask (default) / warn / off.
  • Footer. ✍️ you 3 files · 🤖 agent 7 · ⚠️ 1 unknown — shown only when something changed.
  • Attribution. Agent edits via edit/write and via bash (snapshot windows bracketed around every bash call) are recorded with session, turn, model and capped prompt excerpt.
  • /whose [file] — per-line 🟦 human · 🟪 agent · 🟧 both · ⬜ unknown with agent session details.
  • /coedit status | reset | doctor — store, watcher, policy, Git AI coexistence check.
  • coedit_whose tool — read-only, so the agent can ask what you changed.

Configuration

Settings live in the coedit store (<git-common-dir>/coedit/state.json), defaults in @coedit/core:

KeyDefaultMeaning
overwriteGuardaskblock / ask / warn / off
gitaiAttachNotestrueAttach Git AI–standard notes on commit — only honoured when the git-ai binary is absent
promptExcerptstrueCap and record first 200 chars of the user prompt per turn
maxHumanDiffChars2000Cap for human diffs injected into model context

How authorship is decided

See packages/core/README.md §detection — the short version: editor sensor (from the coedit-gutter VS Code extension) is authoritative outside agent windows; bash-window changes are the agent's; human typing during an agent bash window is unknown (grey), never guessed.

Demo

scripts/demo/run-coedit-demo.mjs builds a fixture repo and runs pi with a scripted offline provider (no model credentials needed): the agent edits a.js while a script edits a.js and b.js as the human, then tries a stale edit that the guard blocks. Run node scripts/demo/run-coedit-demo.mjs.