> For the complete documentation index, see [llms.txt](https://connectyai.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://connectyai.gitbook.io/documentation/usage-guides-enterprise-plan/chat-features/query-versioning.md).

# Query versioning

The AI Editor tracks all changes to queries through a structured versioning system. Each time a query is modified, either manually or through AI, a new version is generated and displayed in a navigable tree format. This allows users to trace the full history of modifications and compare results between versions.

<figure><img src="https://4247993803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMVGgoc4urxfCJy9iAJG7%2Fuploads%2FbCcvPnJnjgERtMMHjD4U%2FVersions.png?alt=media&amp;token=9d05ce72-d528-4449-8e52-705ce458239a" alt=""><figcaption></figcaption></figure>

**What constitutes a new version**

* **Manual edits** to the SQL query in the "Active" panel (left side) immediately create a new version upon saving or running.
* **AI-generated changes** also result in a new version being listed in the version tree.
* **Sub-edits** (e.g., refining an AI edit) are nested hierarchically to show the evolution of thought or adjustments.

**Visual indicators and structure**

* Each version is identified by a hierarchical ID visible in the **version tree**.
* Users can **click on a version node** to load and inspect its associated query, metadata, and results.
* The **currently selected version** is highlighted, helping users orient themselves in the editing flow.

This structure ensures that no changes are lost, and users can easily experiment, iterate, and revert to previous logic without confusion.
