> For the complete documentation index, see [llms.txt](https://docs.nimbalyst.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nimbalyst.com/visual-editors-powered-by-ai/markdown-wysiwyg/ai-editing-red-green-diff-approval.md).

# AI Editing, Red/Green Diff, Approval

<figure><img src="/files/szVDnFas4avzmTZn68KC" alt=""><figcaption></figcaption></figure>

### AI-Powered Editing

Reviewing agent changes visually rather than in a terminal is covered on the [agent integration page](https://nimbalyst.com/features/agent-integration/).

#### Agent Panel

Runs on the right rail in your document/file view

<div align="left"><figure><img src="/files/8DYTzPmJIAXKqo2HHo6K" alt="" width="375"><figcaption></figcaption></figure></div>

* Open the AI panel by clicking the AI icon or Cmd+Shift+A toggles panel
* Select an AI provider from the dropdown and type your message
* Click on New message to change context. This starts a new Session.
* Paste attachments or images into the chat

#### **Chat**

* You can Chat in the Agent panel without editing your document
* Use this to research, explore, learn

#### **Requesting Edits**

* You can ask AI to modify your document
* "Add a section about X"
* "Rewrite this paragraph"

#### **Streaming Edits:**

* Changes appear as they are ready
* Visual diff shows additions/deletions
* Toolbar appears for review
* The agent writes each change to the file as it makes it, and the diff is where you review it afterwards. If you want to approve edits before they are written, use a [permission mode](/open-safe-private-secure/permissions-and-safety.md) that asks first, such as **Ask every time**.

#### Plan Mode and Agent Mode

* Plan mode limits the Agent to editing markdown and create markdown files
* Agent mode gives the full power of the agent
* Click on the Plan or Agent icon to toggle modes<br>

### Red/Green Diff

<figure><img src="/files/dhSCGciKmXP76O3xMuir" alt=""><figcaption></figcaption></figure>

* Shows changes made by the AI to the document
* Enables Keep/Revert of all changes or one by one
* Clicking on change or arrow selects that change and takes you to it

#### What Keep and Revert do

The diff is a review surface for changes the agent has already applied, not a hold queue in front of them.

* When the agent edits a document, the change is written to the file on disk right away. Git, pre-commit hooks, and anything else watching the folder see it immediately.
* **Keep** marks the change reviewed and clears the red and green highlighting. The file contents do not change.
* **Revert** restores the previous contents from file history and writes them back to disk, then records a history snapshot of the restored version.
* Leaving the bar alone keeps the change. Closing the document without deciding is the same as keeping it.

Nimbalyst keeps a version history of every AI edit, so a change you revert can still be recovered from the document's history.

#### Tell the agent when you revert

Reverting in the editor is not reported back to the agent session. The tool call already returned success at the moment the write happened, so the agent goes on believing its edit is in the file, and its next edit may be written against text that is no longer there.

If you revert an agent change and plan to keep working in the same session, say so in the chat, for example "I reverted your last edit to notes.md, the file is back to its previous contents." The agent then re-reads the file and works from what is actually on disk.

To reject a change in a way the agent participates in, deny the action when it asks. That requires a [permission mode](/open-safe-private-secure/permissions-and-safety.md) that prompts before edits.

### Agent Context & Conversations

#### **The Agent is passed and understands the following context:**

* Document context: Current file content
* Workspace context: File tree, related files
* Session context: Conversation history

#### When conversing with the Agent

* AI automatically includes the open document
* You can reference other files by name by typing @
* You can include images and code snippets in messages

#### **Best Practices:**

* Be specific about context needs
* "Looking at the function in file.ts..."
* Include relevant code/text in message

#### Context Window

The 18k/200K Tokens indicats how many words/tokens can fit in this chat session. When you get close to 100%, make sure to hit +New and create a new session.

<div align="left"><figure><img src="/files/GOvagULZIZjdSwsU7wLH" alt=""><figcaption></figcaption></figure></div>

### AI Tool Calls

AI can invoke tools to perform actions beyond text generation.

#### **Available Tools:**

* File operations (read, write, search)
* Code analysis and execution
* Web search and research
* Data processing

\
Tool results shown in chat with special formatting.

#### Show Tool Calls in Chat

By default, every tool call the agent makes appears as a row in the transcript. To hide them entirely (not just collapse them), turn off **Show Tool Calls in Chat** under **Settings > Application > Agent Features**. Interactive prompts — permission requests, plan-mode exits, commit proposals, AskUserQuestion, PromptForUserInput — still appear so you can always respond.

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nimbalyst.com/visual-editors-powered-by-ai/markdown-wysiwyg/ai-editing-red-green-diff-approval.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
