Skip to content
kaiport

AI Pilot in the editor

Explain a file, change it on instruction or generate new content with the AI Pilot assistant in the editor window, then review and save it yourself.

The editor window has its own AI Pilot assistant. It explains the open file or a selection, rewrites it on instruction, or generates new content from a description. Its result is a preview: it only goes into the editor when you apply it, and it only reaches the file when you save.

Open the assistant

Click the AI Pilot button (the sparkle icon) in the editor's toolbar. The assistant opens next to the text, and the same button closes it again. kaiport remembers whether the assistant was open and shows it the same way in the next editor window.

If no AI provider is set up yet, the assistant says Set up the AI provider in the settings to use the assistant. and offers Open settings. See Set up AI Pilot.

The assistant sits next to the file
The editor window with a file open and the AI Pilot assistant next to itThe editor window with a file open and the AI Pilot assistant next to it

The assistant sits next to the file

Choose a mode

ModeWhat it doesInstructionResult
ExplainExplains what the file or selection is for, how it's structured, notable settings and possible problemsoptional – ask a questionan explanation
EditApplies your instruction to the file or selectionrequiredthe complete new text as a preview
GenerateWrites new content from your descriptionrequiredthe new content as a preview

The instruction field shows an example for each mode: Optional question, e.g. "What does the upstream block do?", What should change? e.g. "Raise the timeout to 30s" and Describe the content, e.g. "nginx config as reverse proxy for port 3000".

Selection or whole file

Explain and Edit work on the selected text if you selected some, otherwise on the whole file. Next to the modes, the assistant shows what it will use, for example Selection: 12 lines or Whole file.

Generate doesn't send the file's content. It only uses the file's name and path and your description.

Run a request

  1. Choose Explain, Edit or Generate.
  2. If you want to work on part of the file, select it in the editor.
  3. Type your question or instruction.
  4. Click Run, or press ⌘EnterCtrlEnter in the instruction field.

The answer streams in while the model writes it; until the first words arrive, the assistant shows The assistant is working…. Stop cancels the request. Every request stands on its own: the assistant doesn't remember earlier ones.

Apply or discard the result

In Edit and Generate mode, the assistant shows the new text as a preview. If the model can't carry out an instruction, it is asked to return the text unchanged and add a note, which appears below the preview.

  • Apply puts the preview into the editor. In Edit mode it replaces the selection you had when you clicked Run, or the whole file if nothing was selected. In Generate mode it replaces the entire content of the editor.
  • Discard throws the preview away.

After applying, the assistant shows Change applied – not saved yet. The file now has unsaved changes. Review them, undo them with ⌘ZCtrlZ if needed, and save with Save or ⌘SCtrlS when you're happy. Saving stays your step: the assistant never writes the file itself.

Limits

  • Explain and Edit send the text of the file or selection to your provider. Both need Send file contents to the AI in Settings → AI Pilot; otherwise the assistant reports Sending file contents to the AI is disabled in the settings. Generate works without it.
  • Limit per file (KB) (64 KB by default) caps what is sent. Edit rejects a larger text with The file exceeds the 64 KB limit for AI requests. – select a part of the file and edit that instead. Explain sends a shortened version: the beginning and the end of the text.
  • The editor opens files up to 2 MB.

How it differs from the chat

  • The assistant makes a single model request without tools. It can't run commands, read other files or look around on the server.
  • It has no conversation history; every Run starts fresh.
  • It uses the model saved in Settings → AI Pilot. The model picker of the AI Pilot panel doesn't apply here.
  • Additional instructions from the settings apply. A connection's AI instructions don't.
  • Every request is recorded in the audit log with the file's path.