Brooke Mueller You'll Get Your Kids Back IF ...

7/19/2013 12:50 AM PDT

Children Services to Brooke Mueller -- You'll Get Your Kids Back IF ...

Brooke Mueller will get custody of her twins back over the next year, sources tell TMZ -- but ONLY if she does 5 things right.

Sources connected to the L.A. County Department of Children and Family Services tell us -- officials have agreed to go back to the judge in 6 to 12 months and recommend that at least some of Brooke's custodial right be reinstated, but before they do that ... Brooke must prove to them she's a fit, clean-and-sober parent.

The first condition is that Brooke -- who's currently in a live-in rehab facility -- consistently attends AA and NA.  She must also obey all of her doctor's orders and show she can handle the stresses of everyday life without relapsing.  She's also supposed to maintain a good relationship with the kids-- for the time being via skype.  In all, we're told there are 5 specific strings attached.

We're told DCFS officials will monitor Brooke closely to determine she's on the path to sobriety ... and only then will they make their case to the judge -- who makes the final decision.  DCFS thinks it will take anywhere between 6 months and year to make its determination.

There are reports out that Brooke is living with her boyfriend.  We've learned those stories are false, and that she's ensconced in a rehab joint.

As we reported, Brooke lost custody of the twins in May after officials determined she could no longer provide a safe environment for the children. Brooke enrolled in rehab shortly after. The kids are currently with Charlie's ex Denise Richards.