-
Notifications
You must be signed in to change notification settings - Fork 68
Dangerous Mode
⚠️ This page describes an opt-in power-user mode that disables the safety checks built into FreeCAD AI. Read it in full before turning it on.
Dangerous mode is a session-scoped escape hatch that relaxes the executor's safety layers and widens the Tool Reference#run_macro tool's file-resolution reach. It exists so power users can run AI-authored test harnesses, scripts that import otherwise-blocked modules, and macros from arbitrary paths -- with the understanding that they have accepted the risks.
When Dangerous mode is active, code running through execute_code and run_macro bypasses three of the four safety layers:
| Layer | Normal mode | Dangerous mode |
|---|---|---|
Static pattern blocking (rejects subprocess, shell calls, shutil.rmtree, dynamic os import, known-crashy revolution patterns) |
On | Off |
| Headless subprocess sandbox pre-check (runs the code against a temp copy of your document in an offscreen FreeCAD before touching the live one) | On | Off |
| Execution timeout (kills runaway code via SIGALRM) | On | Off |
| Undo transaction wrapping (rolls back failed executions) | On | On |
Document integrity (undo rollback) is the only safeguard that remains on.
The run_macro tool also changes behavior:
- In normal mode it accepts a bare macro name and resolves it inside FreeCAD's macro directory only (path-like input is refused).
- In Dangerous mode it accepts a name or any absolute / relative file path, anywhere your user account can read.
These are concrete failure modes, not hypotheticals.
- Arbitrary code and commands -- AI-run code can call shell commands, delete files, and do anything your user account is allowed to do. There is no allowlist.
-
No timeout -- a macro containing
while True:(or any tight loop that never yields) will freeze FreeCAD's main window with no way to recover. The undo-rollback safeguard cannot save a wedged event loop. Any unsaved work in any document is lost. - No sandbox pre-check -- code that would normally be caught running against a throwaway copy of your document now runs straight against the live one. Broken geometry, type errors, and destructive operations land on the real model.
-
Endless agentic loops -- if you have also set Max tool-loop turns to
0(endless) in Configuration, the AI can keep generating and running tools until you press Stop. There is no other limit. This can consume a large number of tokens.
You are solely responsible for anything you run while Dangerous mode is on. It is provided as a power-user convenience and is not tested against malicious or destructive input.
The toggle is at the top of the chat dock, next to the model controls.
- Click the ⚠ Dangerous mode checkbox in the chat panel.
- A confirmation dialog opens listing the risks; the default button is No. Click Yes to proceed (or No to cancel).
- While Dangerous mode is active a red banner across the top of the chat dock reads:
⚠ DANGEROUS MODE ACTIVE — safety checks disabled
The banner is always visible while active; you cannot have Dangerous mode silently on.
Unticking the checkbox disarms it immediately (no confirmation needed for the safe direction).
Dangerous mode is session-scoped and resets to OFF every time FreeCAD restarts. This is deliberate: the danger should never carry across restarts by accident.
The GUI toggle never writes the flag to your config file -- it only arms an in-memory state.
If you genuinely want Dangerous mode to be on from the moment FreeCAD launches, edit your config file by hand:
- Close FreeCAD.
- Open
<FreeCAD user config dir>/FreeCADAI/config.jsonin a text editor. - Add (or set) the key
"dangerous_skip_safety": true. - Save and re-launch FreeCAD.
When the workbench loads it will honor the persisted flag and show the banner immediately on startup. The GUI toggle will reflect the active state.
This step is intentionally inconvenient. If you do persist it, every FreeCAD session starts with all four points in What can go wrong live. Don't.
Dangerous mode is useful when:
- You want the AI to run an AI-authored test harness that needs modules the normal-mode static check blocks.
- You want the AI to execute a macro file you have on disk outside FreeCAD's macro directory.
- A run-until-no-failures workflow is genuinely what you want, and you accept that you must use the Stop button as the brake.
If your need is just "let the AI run a macro I already have inside FreeCAD's macro directory, by name," you do not need Dangerous mode for that -- normal-mode run_macro covers it.
- Tool Reference#run_macro
- Tool Reference#execute_code
- Configuration -- the Max tool-loop turns setting
- Architecture -- where the safety layers live in the codebase
Behavior described here is verified on Linux. The macro-directory resolution uses FreeCAD's cross-platform
App.getUserMacroDir()API but is untested on macOS / Windows.