# AI Chat

The chat panel on the right side of the screen is your interface to **Axil**, the AI assistant. Axil can:

* Answer questions about your Ignition project.
* Create, modify, and delete project resources (tags, scripts, named queries, Perspective views, UDT definitions, UDT instances).
* Generate and execute multi-step plans for complex tasks.
* Read and reference files you upload as context.

The chat panel header shows Axil's name, avatar, and online status. A three-dot menu provides additional chat management options.

***

## Sending a Message

### Steps

1. Click in the message input at the bottom of the chat panel.
2. Type your message or describe the task you want Axil to perform.
   * The placeholder text reads: *"Type your message or describe your task..."*
3. Press **Enter** to send, or click the **Send** button.
   * Press **Shift+Enter** to insert a new line without sending.
4. While Axil is generating a response, the Send button changes to a red **Stop** button. Click it to interrupt the response.

> If your message (including attachments) exceeds 1 MB, a warning appears: *"Your message is over 1 MB and may not be processable due to AI context window limits."*

***

## Using @Mentions to Reference Project Resources

You can reference specific project resources in your messages using the `@` symbol. This provides Axil with precise context about which resource you are referring to.

### How Autocomplete Works

1. Type `@` anywhere in the message input.
2. An autocomplete popup appears immediately, showing all available resources.
3. Continue typing after `@` to filter the suggestions. The search is **prefix-based** -- typing `@Pump` matches resources whose name or path starts with `Pump`.
4. The popup displays matching results grouped by resource category (tags, scripts, named queries, etc.), with each suggestion showing the resource name and its category.
5. Use **Arrow Up/Down** to navigate suggestions, then press **Enter** or **Tab** to select.
6. Press **Escape** to dismiss the popup. The popup will not reopen for the same `@` position until you type a new `@`.
7. When a suggestion is selected, the `@mention` text is inserted into the message and a trailing space is added automatically.
8. You can include multiple `@` mentions in a single message.

### Supported Resource Types

| Resource             | Format                              | Example                            |
| -------------------- | ----------------------------------- | ---------------------------------- |
| Tags                 | `@[Provider]folder/tagName`         | `@[default]Plant/Motors/PumpSpeed` |
| UDT definitions      | `@[Provider]folder/MyUDTDefinition` | `@[default]Types/MotorControl`     |
| UDT instances        | `@[Provider]folder/MyUDTInstance`   | `@[default]Plant/Motors/Motor_001` |
| Named queries        | `@queryName`                        | `@GetActiveBatches`                |
| Scripts              | `@scriptName`                       | `@shared.util.formatTimestamp`     |
| Windows              | `@windowName`                       | `@MainOverview`                    |
| Projects             | `@projectName`                      | `@MyIgnitionProject`               |
| Providers            | `@providerName`                     | `@default`                         |
| Database connections | `@connectionName`                   | `@ProductionDB`                    |

### Naming Conventions and Pathing

Resources that live inside a **tag provider** (tags, UDT definitions, UDT instances) use a path format that includes the provider name in brackets followed by the folder path:

```
@[ProviderName]folder/subfolder/resourceName
```

For example, a tag named `PumpSpeed` inside the `default` provider under `Plant/Motors` would be referenced as `@[default]Plant/Motors/PumpSpeed`.

Other resource types (scripts, named queries, windows, projects, providers, database connections) are referenced by their name only, without a provider prefix.

### Mention Interactions

* **Mentions are visually highlighted** in the message input to distinguish them from plain text.
* **Clicking a mention** in a sent message navigates the editor selector to that resource, opening the relevant view in the left panel.
* **Removing a mention:** Use backspace to delete the mention text. The mention is removed from the message context.
* **Invalid mentions:** If a mentioned resource no longer exists (e.g., it was deleted after being mentioned), the mention text remains but is no longer interactive.

***

## Attaching Files to a Message

You can attach files to provide additional context or data to Axil.

### Steps

1. Click the **paperclip icon** next to the message input.
2. A file browser opens. Select a file to attach.
3. The file appears as a preview below the message input. You can remove it by clicking the **X** button on the preview.
4. Send your message as usual.

### Supported File Types

Images: `png`, `jpg`, `jpeg`, `gif`, `webp` Data: `csv`, `json`

> Files that are already selected cannot be added again. A warning notification appears if you try.

***

## Understanding AI Plans

For complex tasks, Axil first describes the plan in a text message, then creates the formal plan and **begins executing immediately**. Plans appear in the chat as a card with a title and a list of tasks. You can monitor progress in real time but there is no manual approval step before execution starts.

### Plan Task Statuses

| Status      | Icon             | Meaning                             |
| ----------- | ---------------- | ----------------------------------- |
| Not Started | Empty circle     | Task has not begun.                 |
| In Progress | Clock            | Task is currently being executed.   |
| Completed   | Checkmark circle | Task finished successfully.         |
| Failed      | X circle         | Task encountered an error.          |
| Aborted     | Warning circle   | Task was stopped before completion. |
| Paused      | Clock            | Task is temporarily paused.         |

When a plan is active, a plan header appears above the message input showing the current plan status.

***

## Approving or Denying Tool Permissions

> **Note:** This feature is planned and currently in development. The UI components are in place but tool permission prompts may not appear in all workflows yet.

Some operations will require your explicit permission before Axil can proceed. When this happens, a **Permission Required** card appears in the chat showing:

* The **tool name** that requires permission.
* A **description** of what the tool will do.

### Steps

1. Review the tool name and description.
2. Click **"Approve"** to allow the operation, or **"Deny"** to block it.

***

## Summarizing and Clearing Chat History

### Summarizing Chat

Summarizing condenses the current conversation into a brief summary, freeing up context for new interactions. This is useful for long conversations.

1. Click the **three-dot menu** in the chat panel header.
2. Click **"Summarize Chat"**.
3. A confirmation dialog appears: *"Are you sure you want to summarize the chat? By doing this, you will lose all the chat history."*
4. Click **"Summarize"** to confirm.

> Summarize is only available when there are at least two messages in the chat and no response is currently being generated.

### Clearing Chat

Clearing removes all messages from the conversation.

1. Click the **three-dot menu** in the chat panel header.
2. Click **"Clear Chat"**.
3. A confirmation dialog appears: *"Are you sure you want to clear the chat? By doing this, you will lose all the chat history."*
4. Click **"Clear"** to confirm.

***

## Reporting Design Practices

You can report design practices -- guidelines or standards that should be followed when making changes to your project. This data is **sent to Axilon** and is used to **train and improve devOS**, the underlying AI system. Over time, reported practices help devOS better understand and follow your team's conventions.

### Steps

1. Click the **flag icon** next to the message input.
2. A modal dialog opens where you can describe your design practices (e.g., naming conventions, coding standards, project structure rules).
3. Submit the report. The practices are sent to Axilon for incorporation into devOS training.
