Skip to main content

0008: AI boundary

  • Status: Proposed (implemented in the MVP)
  • Date: 2026-12-05

Context​

AI should be a first-class capability without making the editor depend on a provider, leaking code silently or changing files without review.

Decision​

  • AI lives in ide-ai, which has no access to documents or files; callers pass an explicit AiContext. The core does not depend on it.
  • Every request is user-initiated and previewed exactly before sending. Providers are created on demand; nothing contacts a provider at startup.
  • Providers implement AiProvider (describe, stream with cancellation). The first adapter speaks the OpenAI-compatible Chat Completions streaming API; keys come from a named environment variable.
  • Responses are shown read-only. Future edits will be proposed as diffs and applied as undoable transactions after approval.

Alternatives considered​

  • Provider SDKs in the core: couples editing to a vendor.
  • Automatic background suggestions: privacy and cost concerns; out of scope until permissions exist.

Consequences​

  • The MVP feature is small (Explain Selection) but the full path is real: preview, network, streaming, cancel.
  • Cancellation is immediate in the UI; the network read ends at the next chunk or timeout.

Validation​

Mock-provider tests (preview equals sent messages, cancellation, failures) and an HTTP test server exercising the real adapter's request and SSE parsing; manual end-to-end check in the desktop app against a local test server.