Cal. Welf. & Inst. Code § 709
(a)
(b)
(e) If the court finds, by a preponderance of evidence, that the minor is incompetent, all proceedings shall remain suspended for a period of time that is no longer than reasonably necessary to determine whether there is a substantial probability that the minor will attain competency in the foreseeable future, or the court no longer retains jurisdiction and the case must be dismissed. Prior to a dismissal, the court may make orders that it deems appropriate for services. Further, the court may rule on motions that do not require the participation of the minor in the preparation of the motions. These motions include, but are not limited to, all of the following:
(g)
(1) Upon a finding of incompetency, the court shall refer the minor to services designed to help the minor attain competency, unless the court finds that competency cannot be achieved within the foreseeable future. The court may also refer the minor to treatment services to assist in remediation that may include, but are not limited to, mental health services, treatment for trauma, medically supervised medication, behavioral counseling, curriculum-based legal education, or training in socialization skills, consistent with any laws requiring consent. Service providers and evaluators shall adhere to the standards stated in this section and the California Rules of Court. Services shall be provided in the least restrictive environment consistent with public safety, as determined by the court. A finding of incompetency alone shall not be the basis for secure confinement. The minor shall be returned to court at the earliest possible date. The court shall review remediation services at least every 30 calendar days for minors in custody and every 45 calendar days for minors out of custody prior to the expiration of the total remediation period specified in paragraph (3) of subdivision (h). If the minor is in custody, the county mental health department shall provide the court with suitable alternatives for the continued delivery of remediation services upon release from custody as part of the court’s review of remediation services. The court shall consider appropriate alternatives to juvenile hall confinement, including, but not limited to, all of the following:
(h)
(5)
(A) Secure confinement shall not extend beyond six months from the finding of incompetence, except as provided in this section. In making that determination, the court shall consider all of the following: