CODE Mode
CODE mode is the UI workflow for generating and refactoring FileMaker script output with review and apply controls built into chat.
What CODE is for
Section titled “What CODE is for”- Create scripts from natural language.
- Refactor existing logic from attached script context.
- Review generated output before applying it to Script Workspace.
Before you send a CODE request
Section titled “Before you send a CODE request”- In Script Workspace, ensure the target script is visible.
- If you want a focused edit, select the specific lines in the script.
- Click Add Selection for the current script or selection, or Add Scripts if the task depends on multiple open Script Workspace tabs.
- Verify the live context badge or attached script badges match the intended scope.
- Provide a clear prompt for the generation or refactor.
End-to-end CODE workflow
Section titled “End-to-end CODE workflow”- Send a request in CODE mode.
- Wait for the three generation phases to complete.
- Use in-message Preview Code and Apply Code links when they are available.
- Watch for the Applying… progress indicator.
- Validate the generated changes in Preview before applying.
- Validate the result in Script Workspace.
1) Structuring intent
Section titled “1) Structuring intent”CODE starts by structuring your request before generation.
- If details are unclear, Genie can ask short clarification questions.
- Clarification limits are controlled in Settings > Clarification Budget > Preflight Questions.
2) Planning capabilities
Section titled “2) Planning capabilities”After intent is structured, Genie plans what capabilities are required for your request.
3) Generating XML
Section titled “3) Generating XML”Genie then generates the XML output for the requested script work. During this phase, chat shows generation in progress.

4) Response with Preview and Apply links
Section titled “4) Response with Preview and Apply links”When Genie accepts a safe CODE artifact, it shows action links directly in the assistant message.

5) Preview Code behavior
Section titled “5) Preview Code behavior”Preview Code opens Viewer so you can inspect output before applying.
- XML review in Viewer with search and highlighting.
- Text view for compact readability.
- Copy support for manual fallback workflows.

6) Apply Code behavior
Section titled “6) Apply Code behavior”Apply Code uses a native operation to safely write changes back to FileMaker. Genie automatically determines the best apply method based on the generated output:
- Active Selection Edit: Applies the change at the correct location in your current script selection when possible.
- Full Script Apply: Writes an entire script body when you request full-script output.
- Selection Fallback: If precise selection placement fails, Genie pastes the full generated block with comments at the active line location.
- Progress Indicator: Shows an
Applying...state in chat while the operation runs. - Safety: Stops if Script Workspace state changes, such as switching scripts or editing a line before apply completes.
- Confirmation: Shows a success message once the script has been updated.
When Preview and Apply stay disabled
Section titled “When Preview and Apply stay disabled”Sometimes Genie can still render a draft in chat but cannot expose a safe apply artifact.
- In that case, Genie shows a display-only draft inline.
- Preview Code and Apply Code remain disabled.
- Treat that state as a review signal: refine the prompt, capture the right context again with Add Selection or Add Scripts, or retry after fixing the underlying issue.
Project Rules in CODE mode
Section titled “Project Rules in CODE mode”Project Rules can shape CODE behavior for the active database.
- Rules can influence the same generated result, including delta edits, when the requested work stays inside the allowed scope.
- Rules do not create a guaranteed second pass.
- Rules do not widen CODE authority, selection boundaries, or apply permissions.
For example, a rule such as When editing an existing script, update the top-of-script change log if one already exists. can influence the generated edit when that header is already inside the task Genie is allowed to change.
Safety and constraints
Section titled “Safety and constraints”- If a prompt is question-only, Genie may suggest routing to ASK mode.
- For large scripts, Genie may use Compact-Mode for more reliable context handling.
Recovery and fallback
Section titled “Recovery and fallback”- If apply fails, focus Script Workspace and retry.
- If needed, you can manually copy from Preview and paste manually.
- If the task spans multiple related scripts, use Add Scripts instead of trying to force one live selection to carry all context.
Best practices
Section titled “Best practices”- Keep captured context aligned with the exact task by using Add Selection for live edits and Add Scripts for multi-script work.
- Monitor the
Applying...state to ensure the operation completes successfully.