The intent_guard.py module#
Summary#
Single signature hit on a snippet. |
|
Collection of findings for a snippet. |
Honor |
|
Evaluate code against intent-guard risk signatures. |
Description#
Static, Fluent-specific risk classifier for run_code snippets.
This module is stateless. It does NOT plan, schedule, or track history. It only inspects a single snippet’s AST against a fixed table of Fluent-specific crash signatures and (optionally) performs a single intra-snippet topological reorder when use-before-create is detected for a small set of well-known dependencies (such as named expressions and materials).
By design this module:
Contains no model orchestration and no rule-pack DSL. Only a fixed table of code shapes that have empirically crashed PyFluent/the gRPC channel during in-house sessions.
Is opt-out via
FLUIDS_MCP_INTENT_GUARD=0so a host that prefers its own planner can disable it entirely.Never imports
ansys.fluent.core. It pureastwalks only so that it is safe to evaluate before a solver session exists.Returns the same
RunCodeResultenvelope the rest of the leaf uses, with one of three newerror_codevalues:risk_blocked,sequence_error,and solver_disconnected. (The third is set bypyfluentbackend, not here.)
This is a defense-in-depth layer at the execution boundary, in scope for the standalone leaf. It is NOT a planner. Higher-level planning, recipes, and journaling remain out of scope.
Module detail#
- intent_guard.is_enabled(env: dict[str, str] | None = None) bool#
Honor
FLUIDS_MCP_INTENT_GUARD(default ON).