Elevator pitch
What are you proposing to change?Add a Next Edit Suggestion (NES) capability to ACP, allowing agents to provide predictive code edits. The protocol is designed around capability negotiation: agents declare what events and context they can consume, and clients provide only what was requested.
Status quo
How do things work today and what problems does this cause? Why would we change things?ACP currently has no mechanism for agents to provide inline edit predictions. Each client–agent pair implements NES through proprietary protocols.
What we propose to do about it
What are you proposing to improve the situation?Introduce a
nes capability that agents advertise during initialization. The capability declares:
- Events the agent wants to receive (file lifecycle notifications).
- Context the agent wants attached to each suggestion request.
Capability advertisement
Duringinitialize, the agent includes a nes field in its capabilities:
events and context are optional — an agent advertises only what it can use.
Client capabilities
The client advertises its own NES-related capabilities in theinitialize request. Currently, the client can declare which well-known IDE actions it supports by listing their IDs. The agent reads these and may later include "action" kind suggestions that reference them.
ideActions is the ID of a well-known action (see Well-known IDE actions below). Agents should only suggest actions that the client has advertised.
Session lifecycle
If thenes capability is present, the client may call nes/start to begin an NES session. An NES session is separate from and independent of the ACP chat session — it has its own session ID, its own lifecycle, and its own stream of events and requests. A single ACP connection may have any number of active NES sessions alongside any number of chat sessions. The NES session is started and stopped independently via nes/start; it does not inherit state from, or share context with, chat sessions.
The agent can also use the existing configOptions mechanism to expose NES-related settings (model selection, debounce preferences, enabled/disabled state, etc.).
Implementation details and plan
Tell me more about your implementation. What is your detailed implementation plan?
Position encoding
AllPosition objects in NES use zero-based line and zero-based character offsets, following the same conventions as LSP 3.17. The meaning of the character offset depends on the negotiated position encoding.
Three encoding kinds are supported:
"utf-16"— character offsets count UTF-16 code units. This is the default and must be supported by all clients and agents."utf-32"— character offsets count Unicode code points."utf-8"— character offsets count UTF-8 code units (bytes).
initialize request via general.positionEncodings, listed in order of preference. The agent selects one from the client’s list and declares it in its initialize response as positionEncoding. If the client omits positionEncodings, or the agent omits positionEncoding in its response, both sides default to "utf-16".
Client initialize request (excerpt):
initialize response (excerpt):
Position and Range values exchanged within NES — events, suggestion requests, and suggestion responses.
Events
Events are fire-and-forget notifications from client to agent. The client sends them only if the corresponding key is present in the agent’s advertisedevents capability (e.g. nes.events.document for NES).
document/didOpen
Sent when a file is opened in the editor.
document/didChange
Sent when a file is edited. Supports two sync modes declared by the agent:
"full"— client sends entire file content each time."incremental"— client sends only the changed ranges.
document/didClose
Sent when a file is closed.
document/didSave
Sent when a file is saved.
document/didFocus
Sent when a file becomes the active editor tab. Unlike document/didOpen (which fires once when a file is first opened), document/didFocus fires every time the user switches to a file, including files that are already open. This is the primary trigger for agents that need to refresh context on tab switch (e.g. re-indexing relevant code snippets).
position is the current cursor position. The visibleRange is the portion of the file currently visible in the editor viewport.
Suggestion request
The client requests a suggestion by callingnes/suggest. Context fields are included only if the agent declared interest in the corresponding nes.context key.
selection is the current text selection range, if any. When the selection is empty (cursor is a point), this field may be omitted or have start equal to end. Agents can use selection state to predict replacements or transformations of the selected text.
triggerKind is one of:
"automatic"— triggered by user typing or cursor movement"diagnostic"— triggered by a diagnostic (error/warning) appearing at or near the cursor position. The client includes the relevant diagnostics in thediagnosticscontext field so the agent can target a fix."manual"— triggered by explicit user action (keyboard shortcut)
Suggestion response
A suggestion is one of three kinds: an edit (text changes), a jump (navigate to a different file), or an action (trigger an IDE action). Edit suggestion:actionId— matches anidfrom the client’s advertisedideActions.arguments— matches the parameter schema declared by the client for that action.
id— unique identifier for accept/reject tracking.kind—"edit","jump", or"action".
edits— one or more text edits to apply.cursorPosition— optional suggested cursor position after applying edits.
uri— the file to navigate to.position— the target position within that file.
actionId— the IDE action to perform (must match a client-advertised actionid).arguments— action parameters matching the schema from the client’s capability.
Accept / Reject
reason is one of:
"rejected"— the user explicitly dismissed the suggestion (e.g. pressed Escape or typed something incompatible)."ignored"— the suggestion was shown but the user continued editing without interacting with it, and the context changed enough to invalidate it."replaced"— the suggestion was superseded by a newer suggestion before the user could act on it."cancelled"— the request was cancelled before the agent returned a response (e.g. the user typed quickly and the previous request became stale).
reason field is optional. Providing granular reasons allows agents to improve their models — for example, a "replaced" suggestion carries different training signal than an explicit "rejected".
NES session start
The client provides workspace metadata when starting a session. This information is static for the lifetime of the session.params are optional. The repository field is omitted if the workspace is not a git repository or the info is unavailable.
Response:
Error handling
The agent may rejectnes/start with an error. In particular, agents that require authentication may return an auth_required error:
auth_required errors on nes/start. The recommended behavior is to prompt the user to authenticate (e.g. sign in or provide credentials) and retry the nes/start call after authentication succeeds. Clients should not silently ignore this error or assume NES is unavailable — the agent may be fully functional once the user authenticates.
Well-known IDE actions
The following actions are well-known and have standardized parameter schemas. Clients that support these actions should use the IDs and parameter shapes defined here.rename — Rename a symbol across the workspace.
Parameters:
uri(string) — the file URI containing the symbol.position(Position) — the position of the symbol to rename.newName(string) — the new name for the symbol.
searchAndReplace — Search and replace text within a file.
Parameters:
uri(string) — the file URI to search within.search(string) — the text or pattern to find.replace(string) — the replacement text.isRegex(boolean, optional) — whethersearchis a regular expression. Defaults tofalse.
id matches an entry the client has advertised.
Config options
The agent can use the existingconfigOptions mechanism from ACP to expose NES-related settings. For example, an agent might return config options like:
Frequently asked questions
What questions have arisen over the course of authoring this document or during subsequent discussions?
Why separate events from context?
Events and context serve different purposes and have different delivery models:- Events are pushed as they happen — they allow the agent to maintain internal state (like an LSP server tracking open documents). This is the model Copilot uses.
- Context is attached to each request — it allows stateless agents to receive everything they need in one call. This is the model Zed Predict and Supermaven use.
RefreshTabContext) that involves vector DB lookup and is triggered on file open, tab switch, and significant edits. The event-based approach supports this flow: an NES agent can listen for document/didOpen, document/didFocus, and accumulated document/didChange events to self-trigger its own context refresh. The document/didFocus event (with cursor position and visible range) and workspace metadata from nes/start provide all the inputs Cursor’s RefreshTabContext needs.
An agent may want both (events for incremental file tracking + context for edit history), or just one. The capability split lets each agent pick the model that fits its architecture.
Why not reuse LSP’s textDocument/didOpen etc. directly?
LSP’s document sync notifications carry the same information, but:
- ACP is not LSP — reusing method names could cause confusion in implementations that bridge both.
- We may want to evolve the event payloads independently (e.g. adding metadata fields).
- Using
document/as a generic namespace keeps these methods reusable across different ACP capabilities (NES, and potentially others in the future) without tying them to a single feature.
How does this relate to PR #325?
This RFD covers the session lifecycle and also suggests a protocol that would cover a variety of different nes providersWhy provide workspace info in nes/start?
Agents that perform server-side indexing (embedding-based retrieval, semantic search) need to know which repository they’re working with. This metadata — workspace root, repo name/owner, remote URL — is static for the session lifetime, so it belongs in the session start rather than being repeated on every request or requiring a separate query.
What alternative approaches did you consider?
- Context-only — Pass all file content, edit history, and metadata as context fields on each
nes/suggestrequest, with no event notifications. This is simpler for stateless agents but forces the client to assemble and transmit potentially large payloads on every request, even when nothing changed. It also prevents agents from maintaining their own incremental state (e.g. an internal file mirror or semantic index). - Events-only — Rely entirely on event notifications (
didOpen,didChange, etc.) and have the agent maintain all state internally, withnes/suggestsending only the cursor position. This is efficient on the wire but requires every agent to implement stateful document tracking, which is a high barrier for simple agents that just want the code around the cursor. - Events + context (chosen) — Allow agents to declare both. An agent that wants to track files incrementally can request events; an agent that prefers stateless request-response can request context fields; a sophisticated agent can use both (events for file sync, context for edit history and definition excerpts). This gives each agent the flexibility to pick the model that fits its architecture without imposing unnecessary complexity.
Revision history
- 2026-02-22: Initial draft