# Modifying Modules

Module modification tools are available in **configure mode** (the default) and **frontend mode**.

{% hint style="info" %}
To check or switch your current mode, tell the AI: *"Switch to configure mode."*
{% endhint %}

## How It Works

The AI uses the `modify_module` guided prompt. It retrieves the current module definition with stable internal IDs, applies your requested change, validates it locally, then submits the update.

{% stepper %}
{% step %}

### Describe the change

Tell the AI which module to modify and what you want to change.

> "Add a Priority field (High/Medium/Low) to the Purchase Order module."

> "Add an 'Escalate to Director' activity to the Leave Request module."

> "Rename the 'Pending Review' state to 'Under Review' in the Invoice module."
> {% endstep %}

{% step %}

### AI retrieves the canvas

The AI calls `get_module_canvas` to fetch the full current module definition, including stable IDs for every field, state, activity, and flow. These IDs are what allow renaming without data loss.
{% endstep %}

{% step %}

### Review the proposed changes

The AI shows you exactly what will change — new items added, existing items modified — before committing.
{% endstep %}

{% step %}

### Validate and update

The AI calls `validate_design` with `mode=update` to check the modified schema locally. Once validation passes, it calls `update_module` to merge the changes.

Sections you didn't mention are left unchanged.
{% endstep %}
{% endstepper %}

## What You Can Change

| Change type              | Example                                                      |
| ------------------------ | ------------------------------------------------------------ |
| Add a field              | "Add a Notes field to the Inspection module"                 |
| Rename a field           | "Rename 'Remarks' to 'Comments'"                             |
| Add a state              | "Add a 'Pending Payment' state after Approved"               |
| Change a state color     | "Make the Escalated state red"                               |
| Add an activity          | "Add a 'Request More Info' activity"                         |
| Add a flow               | "Allow the 'Request More Info' activity from Pending Review" |
| Change an activity actor | "Make the Approve activity AI-hybrid instead of human-only"  |

## Safety

{% hint style="warning" %}
`update_module` merges changes into the existing schema using stable IDs. Items not included in the update are preserved. The AI never deletes fields, states, or activities unless you explicitly ask it to.
{% endhint %}

If you ask the AI to remove something that has existing data (e.g., delete a field that entries already use), it will warn you before proceeding.


---

# Agent Instructions: 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:

```
GET https://inistate.gitbook.io/home/mcp-integration/modifying-modules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
