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, Copy, 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 requested script work. During this phase, chat shows generation in progress.

CodeGenerationInProgress.png

Section titled “4) Response with Preview, Copy, and Apply links”

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

CODE response with Preview, Copy, and Apply actions

Preview Code opens Viewer so you can inspect output before applying.

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

Use Copy when Genie produced recoverable code but you want to inspect or move it manually.

  • Preview Code shows the generated script output or apply plan in Viewer.
  • Copy copies the generated output for manual recovery.
  • Apply Code appears only when Genie has an apply-safe result.

Sometimes Genie can render a draft but cannot safely apply it. In that case, Apply Code stays unavailable, while Preview Code and Copy may still be available. Treat that state as a review signal: inspect the draft, copy it if useful, then refine the prompt, capture the right context again with Add Selection or Add Scripts, or retry after fixing the underlying issue.

The Copy button is especially useful when the output is reviewable but you want to recover it manually instead of applying through Genie.

If Genie cannot resolve a required table, field, layout, script, custom function, MBS function, or BaseElements function, it can pause before generation and ask for the missing detail.

  • Refresh or select the relevant items in Metadata Explorer.
  • Import custom functions when the request depends on your own functions.
  • Enable MBS or BaseElements dictionaries in Settings when your solution uses those plugin functions.
  • Reply with the exact name if Genie asks a clarification question.

Advisory gaps may still produce a reviewable draft, but Genie should not invent missing schema. Review warnings before applying or copying code into FileMaker.

CODE warnings are shown in chat before you apply. Some include a numeric error code.

CODE warning with numeric error codes

  • If Apply Code is missing, use Preview Code or Copy only for manual review.
  • If the warning says the selected script changed, refresh selection before retrying.
  • If the warning says verification timed out, check Script Workspace before retrying.
  • Use Error Codes and Recovery for the full public code list.

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.
  • If apply fails, focus Script Workspace and retry.
  • If needed, use Preview Code or Copy to recover the generated output 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.