In this paper, we present a model-based method for identifying fiscal closure rules in stochastic macroeconomic models. The methodology is based on the stability analysis of the model at hand, with an endogenous derivation of a reaction on the part of the fiscal authority to state variables in the model. The rule achieves the dual aim of imposing solvency on the fiscal sector and generating a state-contingent dynamic adjustment in a framework consistent with the properties of the model. Up to now, fiscal rules in leading large-scale macroeconomic forecasting models have been imposed exogenously, and in this sense are not necessarily compatible with the formulation of other sectors of these models. An example of the derivation procedure, including some illustrative results, is provided using a small calibrated macro model.