Skip to content

CODE Mode

CODE mode is the UI workflow for generating and refactoring FileMaker script output with review and apply controls built into chat.

  • Create scripts from natural language.
  • Refactor existing logic from attached script context.
  • Review generated output before applying it to Script Workspace.
  1. In Script Workspace, ensure the target script is visible.
  2. If you want a focused edit, select the specific lines in the script.
  3. Click Add Selection for the current script or selection, or Add Scripts if the task depends on multiple open Script Workspace tabs.
  4. Verify the live context badge or attached script badges match the intended scope.
  5. Provide a clear prompt for the generation or refactor.
  1. Send a request in CODE mode.
  2. Wait for the three generation phases to complete.
  3. Use in-message Preview Code and Apply Code links when they are available.
  4. Watch for the Applying… progress indicator.
  5. Validate the generated changes in Preview before applying.
  6. Validate the result in Script Workspace.

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.

After intent is structured, Genie plans what capabilities are required for your request.

Genie then generates the XML output for the requested script work. During this phase, chat shows generation in progress.

CodeGenerationInProgress.png

When Genie accepts a safe CODE artifact, it shows action links directly in the assistant message.

AIReturnsReplacementCode.png

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.

PreviewCodeButtonResults.png

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.

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 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.

  • 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.
  • 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.
  • 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.