Whenever a witness, including a child as defined in § 14-1-3, refuses, on the basis of his or her privilege against self-incrimination, to answer a question or to produce other evidence of any kind in a criminal proceeding before any court or grand jury of this state, the attorney general may, in writing, request the presiding justice of the superior court or the chief judge of the family court or the district court to order the witness to answer the question or produce the evidence. The court, in its discretion, after notice to the witness, may order the witness to answer the question or produce the evidence. The witness may not refuse to comply with the order on the basis of his privilege against self-incrimination; but the witness shall not be prosecuted or subjected to penalty or forfeiture for, or on account of, any transaction or matter regarding which, in accordance with the order, he or she gave answer or produced evidence and no testimony or other information compelled under the order or any information directly or indirectly derived from the testimony or other information shall be used against the witness in any criminal case, except he or she may be prosecuted or subjected to penalty or forfeiture for any perjury, false swearing, or contempt committed in answering or failing to answer, or in producing or failing to produce evidence, in accordance with the order. No court order directing a witness to answer a question or to produce evidence issued pursuant to this section shall operate to vacate, modify, or otherwise prevent the enforcement of any conviction, judgment, or sentence entered by any court against the witness prior to the grant of immunity, unless the order entered pursuant to this section expressly provides for it.
R.I. Gen. Laws § 12-17-15