Implementation proposal · September 12, 2026

Neuron + Neovim
Protection comes first.

Keep editing while an agent works. Preserve unsaved changes, merge compatible edits, and hold conflicts until they can be resolved.

Priorities confirmed by the user. Architecture and build stages proposed. Containment and full integration remain unproven.

Core: conflict-aware merges, save-triggered retry, and protection from provider and shell overwrites.

Shared foundation: Neovim messaging and live buffer context.

Valued stretch: a real RPC-rendered Neovim panel, designed into the connection from the start.

The architecture to prove

The human edits the original workspace in Neovim. The agent works in a separate writable snapshot. An operating-system boundary prevents the agent and its tools from modifying the original directly. A trusted Neuron coordinator is the only route for publishing agent changes back.

Agent pathProvider + shell → protected agent workspace → versioned proposal → merge coordinator → Neovim buffer / controlled saveHuman pathNeovim edits and saves → current buffer snapshot → merge coordinator → refreshed agent context

Arrows describe proposed data flow. Human changes are not blindly synchronized over agent work; each side retains its base revision.

Editor connection

Owns registration, versions, snapshots, subscriptions and conditional buffer application. Agents get narrow tools rather than unrestricted editor RPC.

Protected execution

Owns process-tree containment, the agent workspace, permitted dependencies and tool routes. It cannot silently become unrestricted.

Edit coordinator

Owns proposals, three-way merging, pending conflicts, publication receipts, undo boundaries and recovery.

Evaluate Anthropic’s open-source Sandbox Runtime first. It provides macOS and Linux process containment, but it is a research preview and needs a Neuron-specific policy and validation. Hooks remain useful for quick feedback; they do not carry the overwrite guarantee.

The guarantee applies to protected Neuron turns, their descendants and enabled mutation tools. It does not claim to stop the human, root, or unrelated host applications.

Build by exit gates

The critical path is containment proof → protected execution → merge/recovery → daily use. Build the editor bridge alongside the early proof work. Messaging can become useful immediately, but the integration is not complete until protection and conflict handling work together.

The first daily-use target is local Codex on macOS. Linux is exercised in the initial containment proof and remains a required platform gate. The other providers and connection modes have explicit follow-on gates. The RPC panel has a reserved stretch milestone. It can start once the local protected workflow passes stage 4; completing every other provider and remote mode is not a prerequisite.

Effort is concentrated in stages 2, 3 and 6. Set delivery estimates after stage 0 establishes the containment approach and provider compatibility. A renderer demo is not evidence that overwrite protection works.

0

Core · feasibility gate

Prove the protection boundary

Make the hard guarantee testable before committing to its implementation.

Deliver
A disposable human directory, separate agent directory, sandboxed provider process and descendants, and a narrow publication helper. Evaluate the existing Sandbox Runtime before writing platform-specific wrappers.
Exercise
Try direct writes, truncation, rename-over, delete/recreate, symlinks, hardlinks, parent-directory replacement, child processes, persistent shells, and access through host services. Test provider startup, authentication, dependencies and normal build commands.
Pass when
On macOS and Linux, every tested original-workspace mutation route is denied before changing bytes. The agent can still work in its own directory. A sandbox failure prevents protected startup; it never starts unrestricted.
Decision
Choose the containment runtime and define supported provider/tool combinations. A plain Git worktree or a pre-tool hook does not pass this gate. If native containment cannot meet the contract, evaluate a VM/container-backed environment before weakening it.
1

Core · first usable slice

Connect Neovim and capture real editor state

Ship a small plugin and the shared connection that every later feature uses.

Deliver
Editor registration, capability negotiation, explicit environment/project/thread binding, reconnection generations, buffer subscriptions, a context tool plus skill, and minimal send/selection commands. Keep long prompts in a draft buffer.
Correctness
Capture selection before opening a picker. Track hidden dirty buffers and reloads. Distinguish an unavailable editor from an editor with no dirty buffers. Keep input bytes, LSP offsets and display columns separate.
Pass when
Messages appear once after reconnect/retry; snapshots contain the actual unsaved text; a changed or closed buffer cannot be mistaken for the old one. The terminal workflow remains usable.
Visible result
The user can direct the same Neuron thread from Neovim and inspect what context the agent will receive. This slice must not claim file protection before stages 2 and 3 pass.
2

Core · large

Run agents in a protected execution workspace

Move all normal agent writes to a separate workspace while retaining the original as human-owned.

Deliver
An immutable starting snapshot and writable agent workspace, enforced process-tree containment, controlled caches/state directories, tool routing and explicit human/agent path mapping. Keep Git metadata isolated where shared metadata could mutate the original repository.
Snapshot policy
Confirmed: copy the current saved worktree and overlay eligible unsaved text snapshots, preserving each file’s base and provenance. This lets tests see the editor text without saving it. The user confirmed this snapshot policy.
Pass when
A real protected Codex turn can edit and run checks without changing the original workspace. Background processes, subagents and local write-capable tools stay contained. Snapshotting and proposal capture use a stable generation, not a live recursive copy during writes.
Ownership
The execution environment owns processes and files. A disconnected client cannot disable the sandbox. External provider servers or write-capable tools without a verified containment route are unavailable in protected mode.
3

Core · highest-value behavior

Merge proposals and resume after saves

Make agent publication safe while the human continues editing.

Deliver
A coordinator stores base, human and agent versions, computes three-way merges outside Neovim, and applies against an exact editor revision. It journals pending/conflicted/partially applied batches and produces typed results.
Clean result
For an already dirty buffer, apply the merged change as a separate undoable action and leave it unsaved. For a clean file, proposed policy is normal agent publication through the coordinator, with a final recheck for newly dirty buffers.
Conflict
Keep the original untouched, show which edit is waiting, and retain the proposal. On save, read the final disk/buffer state and regenerate or rebase. Never replay an old patch just because a save event fired. If it still conflicts, remain waiting for resolution.
Pass when
Human keystrokes, formatting, undo, rename, reconnect and restart cannot cause a stale edit to overwrite work. No partial failure is reported as a complete application. Tests and checkpoints identify the revision and workspace they describe.
4

Core · daily-use milestone

Make the protected workflow comfortable every day

Finish one reliable local Codex workflow. Provider expansion follows the same gates and does not block the panel milestone.

Deliver
Hunk accept/reject, native diff review, quickfix findings, separate agent undo steps, clear waiting states, an explicit retry/cancel path, and useful health checks. Preserve prompt drafts independently of Neovim’s scratch-buffer modified flag.
Provider order
Codex first as the initial complete workflow. Antigravity next to reuse its client-mediated write path, then Claude and OpenCode, then Cursor and Grok once their actual runtime capabilities pass the same tests. All six remain planned; this expansion can proceed independently of the panel once local Codex passes.
Pass when
A normal day of concurrent human and agent work covers clean merge, conflict/save/retry, interruption, crash recovery and rejection without lost work or misleading status. Each provider has its own verified capability record.
Do not defer
Checkpoint restore, Neuron file-editor writes and other Neuron-originated publication paths must consult the same coordinator. Otherwise the client itself becomes an overwrite route.
5

Core · complete supported scope

Cover clients and environments

Carry the same ownership rules through desktop, web, direct-network and SSH use.

Deliver
Shared contracts and client state, common entry points for chat/Settings/palette/keybindings, and explicit editor binding on the environment where the files live. Implement pair/unpair, sharing on/off and safe session shutdown.
Remote policy
First support Neovim and the agent workspace on the same environment. A laptop editor controlling remote files requires an explicit mapping and transport; identical path strings do not establish identity. Use existing environment connections, not a new relay service.
Pass when
Every entry point targets the correct environment and editor. Losing the owner connection blocks publication until state is revalidated. Web and desktop show consistent pending-edit and protection status.
Release boundary
Local macOS may be the first private daily-use milestone. Linux and remote support remain explicit gates before claiming the whole supported matrix.
6

Valued stretch · large

Render real Neovim in the side panel

Use the same editor connection and protection model to bring the real editor into Neuron.

First panel
A server-owned persistent Neovim process, remote UI attachment, linegrid renderer, proper input/paste/mouse/focus handling, clipboard routing, resize and reconnect. Initially leave menus, messages and command line inside Neovim’s grid.
Ownership spike
Evaluate terminal-to-panel handoff before promising simultaneous independent views. Two UIs share global editor state and constrain the main grid. Closing the panel detaches the view; it must not silently discard unsaved work.
Pass when
Real configuration and plugins behave correctly with Unicode, IME, large paste, long lines, folds, mouse use, resize and reconnect. The idle panel has no continuous repaint loop. Save/discard/cancel and reopening work across both clients.
Follow-on
Multigrid and watched extmarks can anchor Neuron review controls beside code. Native completion and message widgets follow only when the basic editor is reliable. This stage is a named destination, not an undefined future idea.

The contract between modules

Use existing typed commands, events and receipts for durable behavior. Keep rapidly changing editor presence separate from durable proposals and user messages.

RecordWhat it must identifyWhy it matters
Editor sessionEnvironment, workspace, editor instance, reconnect generation and capabilitiesA new process must not inherit the old process’s buffer identity.
Buffer snapshotBuffer/window identity, canonical file identity, revision, exact text hash, encoding/EOL, modified state, selection and capture timeBuffer numbers and file paths alone are insufficient.
Execution snapshotSaved tree generation, overlaid unsaved text, isolated Git state and base hash per fileAgent tests and proposals must refer to the same actual input.
Edit proposalThread/turn, base revisions, file actions, resulting content, dependencies and idempotency keyA replay must not apply the same change twice or hide a stale base.
Publication receiptApplied-to-buffer, saved-to-disk, conflict, stale, cancelled or partial; exact resulting versionsThe UI and agent must never confuse a staged buffer edit with saved and tested code.

Multi-file publication is journaled. Neovim does not provide rollback for an arbitrary batch of edits. Prevalidate every file, apply in a controlled sequence, record each result, and recover partial progress without overwriting later human edits.

How a conflict resolves

Proposal lifecycleCaptured → compare base / human / agent → clean merge or conflictCleanRevalidate editor revision → apply → buffer receipt → optional controlled saveConflictWaiting → save or explicit resolution → reread final state → rebase/regenerate → revalidate → apply or remain waiting

Acceptance cases that define “done”

ConcernRequired casesPassing behavior
Preserve editsHidden dirty buffer, typing during merge, same-line and separate-line edits, two editor instancesCompatible content merges; stale or ambiguous ownership blocks application.
Prevent writesBuilt-in edits, shell scripts, formatter, persistent shell, descendant agent, rename/delete/link tricks, writable parent and host service routesThe protected original does not change before controlled publication.
Save and retryFormat-on-save, save-as, custom writer, event suppression, manually cleared modified flagFinal content is reread and verified; missing events have explicit retry.
RecoverEditor/server/provider crash, lost acknowledgement, duplicate delivery, partial batch, rejection, undoPending work remains understandable and recoverable; no duplicate or stale application.
Truthful validationUnsaved result, human changes after test, agent background process still writingTests/checkpoints name the actual snapshot; unstable trees cannot be reported as validated publication.
PanelUnicode, IME, large paste, resize, focus, browser shortcuts, clipboard, multiple UIs and dirty detachNo lost input, no discarded buffers, and honest session ownership.

Use focused logic tests and disposable Neovim/process fixtures. Wait for typed receipts, buffer events and worker drains rather than sleeps. Real client verification follows user authorization and checks the integrated web/desktop experience once per milestone. No repo-wide test run is required for these focused changes.

What the API audit established

The reading covered 45,019 lines across 21 complete upstream API and behavior references, including the full core API, Lua, Vimscript functions, libuv, UI protocol, LSP, Tree-sitter and editor lifecycle. Development documentation was pinned and compared with installed Neovim 0.11.5.

A clean disposable 0.11.5 RPC experiment confirmed stale-revision rejection, textlock inside buffer callbacks, extmark movement, the scratch-buffer modified-state trap and shared sizing across two attached UIs. These tests establish primitives, not the complete protection guarantee.

Use the installed version’s contract. New documentation contains renamed or unavailable APIs. Start with a tested 0.11.5 adapter, use runtime metadata and capability checks, and avoid private APIs.

Native diff is not native merge. Neovim supplies two-way diff hunks and review tools. The three-way merge, conditional publication and durable waiting lifecycle belong in Neuron.

Decisions to settle during the proof

  1. Unsaved execution snapshot. Confirmed by the user: include eligible unsaved text in the agent snapshot without saving it back automatically.
  2. Containment runtime. Sandbox Runtime is the first candidate. Adopt only after macOS/Linux behavior and provider authentication pass the proof.
  3. Clean-file publication. Proposed default is automatic publication through the coordinator when no human changes need saving. Dirty buffers stay unsaved.
  4. Unavailable tools. Protected mode cannot enable an external tool that retains an unmediated write route to the original.
  5. Panel ownership. Compare a persistent editor with terminal/UI handoff against a dedicated panel instance. Independent simultaneous views are not implied by multigrid.

These decisions do not justify postponing the bridge or the containment experiments. They become concrete prototype questions with pass/fail evidence.

Primary references