Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
ADR 0070: Separate Composer File-Reference Display from Prompt Serialization
- Status: Accepted for implementation
- Date: 2026-08-10
- Related: D124, D197, D209, ADR 0024, ADR 0059
Context
Workspace autocomplete and clipboard paste both produce canonical file paths the
agent must receive as plain-text @ references, but rendering them inline
exposes long workspace paths and UUID-backed scratch paths that wrap and crowd
out the task. A native textarea cannot display one substring differently, and a
shortened value cannot be expanded back by basename because duplicate leaf names
and scratch paths are both valid.
Decision
- A completed file selection and each materialized clipboard file become a renderer-owned transient reference while the textarea keeps only ordinary text; directory autocomplete stays literal.
- Each reference stores its canonical path and a compact leaf label, keeping the
full relative index path for workspace files and the UUID-backed scratch path
for pastes while displaying the sanitized leaf name from
composer/pasteFiles. - References render as compact removable chips above the textarea that show only the leaf label, with the canonical path in the tooltip and accessible name; duplicate labels stay separate references.
- Immediately before the submit dispatcher runs, references are appended in
stable addition order and serialized with the existing
formatFileInsertquoting rules, so the prompt stays plain text with the exact@relative/pathor@absolute/path. - Reference-only drafts are sendable, references follow visible text so slash
templates and
/agent-mode,/plan-mode, and/goal-modestay recognizable, and rejected or failed dispatch keeps the draft. - A session- and turn-scoped snapshot of pre-serialization text and references is restored when a stop happens before assistant text, thinking, or a tool row begins; once a reply starts, abort keeps the partial transcript and restores no draft.
- References are scoped by durable session id and cleared when their workspace
changes, and
ComposerPastedFile.nameis the sanitized leaf name whilepathcarries the UUID storage name. No IPC, host RPC, or storage field is added.
Consequences
- Long and UUID-backed paths no longer occupy the visible prompt row.
- Canonical references stay exact in persisted messages and model context.
- The renderer owns transient reference state beside textarea text, with clipboard containment and limits unchanged from ADR 0059.
Alternatives
- Insert only the basename into the prompt: rejected, duplicate names and scratch files would not resolve reliably.
- Overlay shortened text on a transparent textarea: rejected, displayed and native lengths diverge and break caret, selection, IME, and accessibility.