> For the complete documentation index, see [llms.txt](https://help.metaforms.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.metaforms.ai/survey-programming-decipher/legacy-to-unified-transition/programming-with-the-ai-assistant.md). Agents can also search and read this documentation through its [MCP server](https://help.metaforms.ai/~gitbook/mcp).

# Programming with the AI Assistant

**Step 1:** Select the **AI Assistant** icon on the right side of the Programming page. The **Survey Programming Agent** panel opens, where you give instructions for automated survey creation.

![The Programming workspace with the Survey Programming Agent panel open, showing the Program, Review and Explain Code quick actions](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2FksOqrBCkzKt9tfKPOkcx%2Fai-01-assistant-panel-v2.png?alt=media)

**Step 2:** The system analyzes your questionnaire and prepares the first set of questions, applying appropriate AI rules.

**Note:** The time taken by AI to generate output depends on the complexity of the questions being programmed. The initial few generations will take some time as the AI reads the AI rules and the QNR to understand the context.

![The agent reads the survey XML and the questionnaire, then explains which questions it will program first](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2FUpR0rVFOnNfxV9uIFyYG%2Fai-02-agent-reads-questionnaire-v2.png?alt=media)

![The agent adds the first questions to the XML editor, with the changes shown in green](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fy7jIGSTmol6mUc8VJLhI%2Fai-03-agent-generates-first-batch-v2.png?alt=media)

<figure><img src="https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-00c7802ee5277a2a51112fc5ee3b5866c3124089%2Flegacy-unified-decipher-walkthrough-28.png?alt=media" alt=""><figcaption></figcaption></figure>

**Step 3:** Provide the prompt to create questions in the AI Assistant chat box.

<figure><img src="https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-a5cae5888eb7b0baf0b976f189cb7f227de5f7c6%2Flegacy-unified-decipher-walkthrough-29.png?alt=media" alt=""><figcaption></figcaption></figure>

**Step 4:** Review and accept all generated questions.

![The bar under the XML editor shows 1 change pending review, with the Reject All and Accept All buttons](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2FmHN4oLIWEOLdO6vyga7d%2Fai-06-review-and-accept-all-v2.png?alt=media)

## No more "Apply" button for template instructions

In the **Legacy Workflow**, users had to manually click the **Apply** button above each template instruction to insert the required code/XML for that specific step.

In the **Unified Flow**, there is **no Apply button**. Users can proceed using the chat window while creating questions, and the template instructions will be applied automatically by the AI. If your template doesn't have template instructions set up, you don't need to worry about this. If needed, you can provide an additional prompt in the AI Assistant chat window (only when required).

**Step 5:** Template instructions are applied automatically—no need to manually apply node tag setups as in legacy.

![The XML editor shows the template instruction notes from the template, and the agent's new questions below them](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fm9ZQDciJ0jWxLU3fA5Mf%2Fai-07-template-instructions-in-xml-v2.png?alt=media)

![The agent's next questions use the template's question styles and comments automatically](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2FUjUDf0PZBq66aQUgbOfJ%2Fai-08-template-styles-applied-v2.png?alt=media)

<figure><img src="https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-1dd5be6c626db0216050f4a341b439c83a848c28%2Flegacy-unified-decipher-walkthrough-33.png?alt=media" alt=""><figcaption></figcaption></figure>

![A TEMPLATE\_INSTRUCTION block in the XML editor above the questions that the agent added](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2FlVIE57c6Y8E7c4FdfLS6%2Fai-10-template-section-block-v2.png?alt=media)

## Edit with AI – no need to select code

In the **Legacy Workflow**, when editing a specific section, you had to:

1. Select the specific XML section where the edit was needed.
2. Press **Ctrl + K** to open the Edit with AI widget.
3. Provide the prompt in that widget to make the edits.

In the **Unified Flow**, you don't need to select the XML at all. Simply describe the required changes in the AI Assistant chat box—the AI will figure out where the update needs to be made and apply it across multiple questions if needed. If you want to target the edits to a specific place, you can include the QID directly in your prompt.

**Step 6:** To make bulk edits—like removing brackets from all comments—just instruct the AI Assistant in chat. The AI locates and updates all relevant sections automatically.

![After one instruction in chat, the agent adds the same comment to every single-select question, and each change has Accept and Reject buttons](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2FlTiUMTn0pT4cS4EdMiq5%2Fai-11-bulk-edit-in-chat-v2.png?alt=media)

**Step 7:** For subsequent question generations, the AI decides placement automatically.

![The agent adds the next questions after the last programmed question, and the chat shows the change it made](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2FMicgspwDN0Z9AWwhARBp%2Fai-12-ai-places-next-batch-v2.png?alt=media)

![The agent's summary of the questions it programmed in the next batch](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Ftz3qVWfQ4CsA7Ach76qF%2Fai-13-next-batch-summary-v2.png?alt=media)

## Handling deleted questions

When you delete a question, the deletion is treated as **intentional**. So when you click "generate next set of questions," the AI will not regenerate the deleted ones. If you want them back, provide a prompt like:

"Create deleted questions"

**Step 9:** Select **Validate & Sync** to sync your project and update the XML and quotas.

![The Validate & Sync button at the top right of the Programming page](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fy0UGuGOu7qiwWdduQW1G%2Fai-14-validate-and-sync-v2.png?alt=media)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.metaforms.ai/survey-programming-decipher/legacy-to-unified-transition/programming-with-the-ai-assistant.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
