POSNER, Circuit Judge.
The defendants, who are corrections officials of the State of Illinois, appeal under 28 U.S.C. § 1292(a)(1) from a mandatory injunction by the district court, 611 F.Supp. 947. The injunction orders them to admit the plaintiff, an inmate in an Illinois state prison, to a work-release facility, under an agreement settling the plaintiff’s federal civil rights suit against them. Because the deadline for the plaintiff to enroll in Roosevelt University, as permitted by the work-release program from which the district court found that he had been improperly expelled, was September 20, the date of the oral argument, and because we had stayed the district court’s injunction until then, we decided the appeal by unpublished order (Judge Swygert dissenting) after the oral argument and the conference of the judges, with a notation that an opinion explaining the grounds of our action would follow.
We address two questions. The first is whether the district judge had jurisdiction to adjudicate a dispute arising under the settlement agreement; the second is whether, if so, his resolution of that dispute in the plaintiff’s favor can be sustained. The jurisdictional issue is extremely — unnecessarily — difficult; although concluding ultimately that the judge did have jurisdiction, we think that a full examination of the issue may serve to prevent similar issues from arising in the future.
The plaintiff filed his original suit in 1980. The suit was under section 1 of the Civil Rights Act of 1871, now 42 U.S.C. § 1983, and alleged that in 1977 the defendants had denied the plaintiff due process of law in prison disciplinary proceedings. After the district court granted partial summary judgment for the plaintiff, the parties on December 8, 1984, executed a settlement agreement under which the plaintiff dropped his claim for damages in exchange for the defendants’ agreeing to shift him from a state prison outside Chicago to a work-release program in Chicago, where he would be confined at night in a work-release center (a minimum-security prison) and attend college during the day. The agreement required, as a condition of the plaintiff’s remaining in the program, that he obey the rules of the work-release center. This is the key provision so far as the substantive issue on appeal is concerned; so far as the jurisdictional issue is concerned the key provision is the following: “Also, the terms of this agreement and any [attorney’s] fee agreement will remain confidential and will not be made part of the court file in [docket number]; however, the parties retain their rights to petition the Court regarding any breach or violation of [1182]*1182this agreement.” Although the word “retain” suggests that the parties did not intend to confer a right to petition the court to enforce the agreement, but just intended not to waive any preexisting rights they may have had to petition for enforcement, the parties make no issue of this, and we shall therefore assume that the parties did intend that they would have a contractual right to petition the court to enforce the agreement. Of course this does not mean that the court had jurisdiction to do so; it just means that the judge could not have denied the plaintiffs petition to enforce the agreement on the ground that the parties did not intend the agreement to be enforceable in this way.
On December 13, 1984, five days after the settlement agreement had been signed, the district judge dismissed the plaintiff’s suit in an order that reads in its entirety, “Order cause dismissed pursuant to stipulation of the parties.” The record does not indicate that the judge, when he signed the order, had ever seen either the settlement agreement or the parties’ stipulation. The stipulation carries no date of execution, but it was not filed with the district court till December 18, five days after the court had dismissed the suit. • It states that the parties “by and through their respective counsel, ... hereby stipulate pursuant to Rule 41(a) of the Federal Rules of Civil Procedure to dismissal of this cause according to the terms and conditions of the [settlement agreement] entered into by the parties. Said dismissal shall be with prejudice and without costs.” The judge was, however, aware that settlement negotiations were in progress, and we may assume was advised when he signed the order dismissing the case that a settlement had been reached, as indeed it had been. The settlement agreement had been signed as we said on December 8, five days before the order was issued and ten days before the stipulation referred to in the order was filed.
When the settlement agreement was signed, the plaintiff was no longer in the work-release program, having been sent to a regular prison the previous month because he had violated the rules of the work-release center. But on February 18, 1985, roughly two months after the suit was dismissed, the plaintiff wrote a letter to the district judge, stating, “I now would like to file a Petition for Writ of Habeas Corpus alleging that I am being detained under an unconstitutional disciplinary action.” The judge treated this as a petition to enforce the settlement agreement, ordered the defendants to respond (which they did), concluded that the defendants had indeed violated the settlement agreement by failing to give the plaintiff due process of law in the disciplinary proceeding that had resulted in the revocation of his work release, and ordered the defendants to put the plaintiff back into the work-release program.
The prison disciplinary committee had found that the plaintiff had committed five disciplinary infractions in the course of refusing to take off his undershorts to allow a guard to search for drugs. The judge found that the committee had not explained the grounds for its decision adequately, at least with respect to four of the five infractions charged. The judge said, “the report [of the committee] states that plaintiff admitted not removing his shorts [and thus disobeying a direct order — one of the infractions charged], but says nothing about the remaining charges and the evidence relied upon to find the plaintiff guilty as charged.” He added, “the only violation possibly supported by the evidence of this record is plaintiff’s violation of DR-403, ‘Disobeying a Direct Order.’ ” Among other things the judge ordered the defendant to expunge from the record any reference to the charges, except disobeying a direct order; the main relief ordered, however, was to transfer the plaintiff back into the work-release program, and that is the only part of the order that the defendants have appealed from.
Regarding jurisdiction to enforce the settlement agreement, the judge said only that the plaintiff had “moved this Court for an order to enforce settlement pursuant to the Court’s dismissal of this cause on September 4, 1984 and the Court’s retention of [1183]*1183jurisdiction to enter any appropriate order pending completion of the details of the parties’ settlement agreement.” It is not quite clear how retention of jurisdiction to enter any appropriate order “pending completion of the details of the parties’ settlement agreement” would confer jurisdiction to enter orders months after the agreement had been signed, sealed, and delivered. The order of September 4, 1984, had stated in its entirety: “By agreement of the parties, order cause dismissed without prejudice. Court retains jurisdiction for 45 days to enter any appropriate order, as parties are completing details of settlement.” On October 5 the judge had issued another order, this one retaining jurisdiction until December 3, and then on November 23 he had restored the ease to his active calendar and scheduled a status hearing (never held) for December 14. When he dismissed the case on December 13 he did not say that he was retaining jurisdiction to enforce the settlement agreement.
When an equity case ends in a permanent injunction, the trial court, with or without an explicit reservation of jurisdiction, retains jurisdiction to enforce the injunction, as by contempt proceedings. See, e.g., Suntex Dairy v. Bergland, 591 F.2d 1063, 1068 (5th Cir.1979); In re Corrugated Container Antitrust Litigation, 752 F.2d 137, 142 (5th Cir.1985). No one wants an injunction that cannot be enforced, or that can be enforced only by bringing a fresh suit, which might have to be in a different court; for a change in a party’s residence, or other changes, might divest the original court of jurisdiction of the second action — if an independent basis of jurisdiction for that action were necessary. An injunction is supposed to be a swift and effective remedy, summarily enforceable through contempt or other supplementary proceedings in the court that issued the injunction. It would make no difference that the injunction had been issued pursuant to a settlement, as in the Corrugated Container case. But no consent decree or other injunction was issued in this case.
When a court grants a voluntary dismissal of a case under Rule 41(a)(2) of the Federal Rules of Civil Procedure, the situation is less clear. A dismissal under this subsection is “upon such terms and conditions as the court deems proper.” These might be, one might have thought, terms or conditions calling for subsequent judicial enforcement. It could therefore be argued that jurisdiction was automatically retained to enforce the terms or conditions if and when broken — conditionally retained, but retained nonetheless. And perhaps the conditions could be implicit, so that, for example, if a ease were dismissed under Rule 41(a)(2), without prejudice, the parties having represented that the plaintiff had agreed to pay the defendant’s attorney’s fees, and then the plaintiff reneged, the judge could proceed by way of contempt or otherwise to enforce the implicit term of the dismissal and thus make sure that the defendant got what he bargained for in agreeing to dismissal without prejudice.
We state our position in this wishywashy manner with “could be argued’s” and “perhaps’s” because the issue of the specific enforceability of terms and conditions imposed under Rule 41(a)(2) is not unavoidably presented, as we shall see; because there is no direct authority on the issue; and because it can be argued with some force that the only consequences of violating a term or condition imposed under Rule 41(a)(2) are either to undo the settlement and restore the case to the court’s docket or to change a dismissal without prejudice, the normal consequence of dismissal under Rule 41(a)(2), into a dismissal with prejudice. See, e.g., De Filippis v. Chrysler Sales Corp., 116 F.2d 375 (2d Cir.1940); 9 Wright & Miller, Federal Practice and Procedure § 2366, at p. 183 (1971). Against specific enforceability it can be argued that the reference to terms and conditions in Rule 41(a)(2) is a pretty odd place to bury a grant of federal jurisdiction (especially since Rule 82 provides that “these rules shall not be construed to extend ... the jurisdiction of the United States district courts”) and that the remedies of rescinding the settlement or dis[1184]*1184missing the case with prejudice should be adequate in the general run of cases. The reply is that there may be cases where rescission would not be an adequate remedy, just as rescission is not always an adequate remedy in an ordinary contract case; and cases where dismissal with prejudice would be no remedy at all, because the plaintiff was the wronged party. But the reply assumes — what is most doubtful— that terms or conditions imposed under Rule 41(a)(2) can run in favor of plaintiffs as well as defendants (rescission rather than dismissal with prejudice could only be a plaintiff’s remedy). The rule states that dismissal is without prejudice unless otherwise specified, which suggests, and it has been uniformly assumed, that the terms and conditions must be for the defendant’s benefit. They are the quid for the quo of allowing the plaintiff to dismiss his suit without being prevented by the doctrine of res judicata from bringing the same suit again. See 9 Wright & Miller, supra, § 2366, at p. 177 (1971); Home Owners’ Loan Corp. v. Huffman, 134 F.2d 314, 317 (8th Cir.1943).
We are therefore not surprised to have found no case where the order of dismissal imposed conditions in the plaintiff’s favor (unless, of course, what was being dismissed was a counterclaim, so that the plaintiff was really the defendant). It is because the provision in Rule 41(a)(2) for terms and conditions is intended to be for the defendant’s benefit that the standard remedy for a breach of a term or condition of dismissal is to dismiss the case with prejudice, not to restore the case to the court’s calendar. The defendant doesn’t want the case restored; he wants it dismissed with finality.
As this point and the language and history of Rule 41(a) imply, the general purpose of the rule is to preserve the plaintiff’s right to take a voluntary nonsuit and start over so long as the defendant is not hurt. Thus the plaintiff can dismiss without the court’s permission, and without prejudice to his being able to bring a new suit, if the defendant has not- yet answered the complaint or moved for summary judgment (Rule 41(a)(l)(i)); or with the court’s permission, but again without prejudice unless the court specifies that the dismissal is with prejudice, at any later time (Rule 41(a)(2)). See 9 Wright & Miller, supra, § 2363, at pp. 151-52; § 2364, at pp. 165-68. When the parties want to dismiss the case with finality because the case has been settled, they usually proceed under a different subsection, Rule 41(a)(l)(ii) (voluntary dismissal by stipulation), where no court order is necessary; and they provide in the stipulation, as the rule authorizes them to do, that the dismissal is with prejudice. This may well have been what the parties intended to do here — though if so their intention was frustrated, as we shall see in a moment. It is not easy to see why the parties would want dismissal with prejudice by court order rather than by stipulation, and so would have to proceed under Rule 41(a)(2). That rule usually comes into play when the parties are unable to agree on the terms of dismissal but the plaintiff wants to dismiss without prejudice, and then the court may want to attach to the dismissal conditions to protect the defendant.
Such conditions will, if violated, normally just convert a dismissal without prejudice into a dismissal with prejudice. Neither the language nor history of the rule suggests that it empowers the judge to order specific performance of the parties’ undertakings in the settlement agreement. As we have said, Rule 41(a)(2) normally is not invoked when there is a settlement; a dismissal pursuant to settlement normally is made under Rule 41(a)(l)(ii), which is to say without any court action at all. But we need not hold in this case that there can never be a specifically enforceable condition attached to a dismissal under Rule 41(a)(2); there is as we shall see an alternative and slightly more secure basis for jurisdiction.
Before exploring that basis we shall note as an aside, but one important for future reference in this and possibly other cases, that although the parties wanted the [1185]*1185dismissal to be with prejudice and so specified in their stipulation to dismiss, the dismissal was without prejudice. Rule 41(a)(2) provides as we have said that dismissal is without prejudice unless otherwise specified, and the judge’s order of December 13 dismissing the case did not say it was with prejudice.
One might argue that since the judge’s order does not mention Rule 41(a)(2), maybe that wasn’t the provision under which he dismissed the case. But it must have been. The only provision in the Federal Rules of Civil Procedure for voluntary dismissal by order of court that could apply here is Rule 41(a)(2). The fact that, as we shall see, the judge may have intended to retain jurisdiction for specific purposes would not change the character of the dismissal as being a dismissal pursuant to Rule 41(a)(2).
It might however be argued that the plaintiff’s case had actually been dismissed by stipulation — by a stipulation that recited that dismissal was with prejudice — before the judge issued his order, so that the order was a nullity. Although filed in court after the order of dismissal, the stipulation has no date of execution on it and may for all we know have been executed before December 13. But this would make no difference. Rule 41(a)(l)(ii) requires that the stipulation be filed in court, and the date of filing is the date the dismissal takes effect. Cf. 5 Moore’s Federal Practice ¶ 41.02[2], at pp. 41-20 to 41-21 (2d ed. 1985). When the parties filed their stipulation, the judge had already ordered the case dismissed — without prejudice.
The requirement that the stipulation be filed in court is not merely a technicality, though treated as one in Oswalt v. Scripto, Inc., 616 F.2d 191, 194-95 (5th Cir.1980). It provides a permanent record that facilitates the application of the doctrine of res judicata to subsequent related litigation in those cases where (as here) the stipulation recites that dismissal is with prejudice, and it provides information essential to the management of a judicial docket. If parties did not have to notify the court that they had ended their dispute, the court would have no idea of the size of its backlog without inquiring into the status of every inactive case. We need not consider whether the requirement of filing may be waived in particular cases if necessary to prevent injustice, as none of the parties asks that it be waived here. They treat the judge’s order, rather than the stipulation, as the terminating event of the litigation, and the order necessarily was made under Rule 41(a)(2). So the dismissal was without prejudice — though of course one or more of the parties can still request the district court under Rule 60(b) of the Federal Rules of Civil Procedure to correct the judgment to make it with prejudice, as the parties intended that it be. Cf. Bank of California, N.A. v. Arthur Andersen & Co., 709 F.2d 1174 (7th Cir.1983).
There is a further point, which gets us back on the main track of our analysis. If indeed the case was dismissed under Rule 41(a)(l)(ii), the plaintiff could not later complain to the court that the dismissal had been premised on a settlement agreement that the defendant had violated, and ask the court to order the defendant to abide by the agreement. The court would not have jurisdiction over the dispute merely by virtue of having had jurisdiction over the case that was settled. The violation of the settlement agreement would be a breach of contract remediable under state but not federal law, and therefore only in state court since the parties are not of diverse citizenship. See Fairfax Countywide Citizens Ass’n v. County of Fairfax, 571 F.2d 1299, 1303 (4th Cir.1978), and cases cited there. The claim of violation, like a claim in a dispute over the assignment of a federal copyright, would be a good example of a claim that does not arise under federal law within the meaning of 28 U.S.C. § 1331 even though its ultimate origin is federal. See Gully v. First Nat’l Bank, 299 U.S. 109, 57 S.Ct. 96, 81 L.Ed. 70 (1936) (Cardozo, J.); T.B. Harms Co. v. Eliscu, 339 F.2d 823, 828 (2d Cir. 1964) (Friendly, J.); Bernstein v. Lind-Waldock & Co., 738 F.2d 179, 183-85 (7th [1186]*1186Cir.1984). “If we follow the ascent far enough, countless claims of right can be discovered to have their source or their operative limits in the provisions of a federal statute or in the Constitution itself with its circumambient restrictions upon legislative power. To set bounds to the pursuit, the courts have formulated the distinction between controversies that are basic and those that are collateral____” Gully v. First Nat’l Bank, supra, 299 U.S. at 118, 57 S.Ct. at 100. A dispute over the meaning of an agreement is “collateral” for this purpose when it is not the kind of dispute that is likely to require for its just resolution the special independence, experience, and perspective that federal courts may be thought to bring to the decision of certain cases. A dispute between residents of the same state over the meaning of their contract is not of that kind. Such disputes are traditionally, uncontroversially, and exclusively within the jurisdiction of state courts.
The picture is blurred slightly by a qualification implicit in Gully, emphasized in Harms, and repeated by us in Bernstein: that resolution of the contract dispute not require an interpretation of the federal law from which the contract right descends. Maybe the settlement agreement in this case, in allowing the defendants to expel the plaintiff from the work-release program for disciplinary infractions, should be read to bring in (implicitly) the principles of due process of law to guide the disciplinary proceedings; if so it might seem that the qualification would come into play and there would be federal jurisdiction. But we think not. If two street vendors signed a contract which provided that it could not be terminated except for cause as determined in a hearing conforming to the standards of the due process clause of the Fourteenth Amendment, a breach of the provision could not be sued on in federal court. There would be no federal interest in such a suit. Cf. Currie, The Federal Courts and the American Law Institute: Part II, 36 U.Chi.L.Rev. 268, 277 (1969); Estate of Watson v. Blumenthal, 586 F.2d 925, 929 (2d Cir.1978). The parties would be engaged in a transparent attempt to confer federal jurisdiction over local contract disputes by agreement. They cannot do that.
Another interpretation of the plaintiffs petition, but one that also cannot help him, is that it was intended to invoke the district judge’s power under Rule 60(b) of the Federal Rules of Civil Procedure to vacate a previous judgment, namely the judgment of dismissal. Any time a district judge enters a judgment, even one dismissing a ease by stipulation of the parties, he retains, by virtue of Rule 60(b), jurisdiction to entertain a later motion to vacate the judgment on the grounds specified in the rule, some of which have no time limit. But the power to vacate is not the power to enforce a collateral agreement. If the district judge had treated the plaintiff’s letter of February 18, 1985, as a motion to vacate the judgment of dismissal of December 13, 1984, and granted the motion, the effect would have been to restore the plaintiff’s original civil rights suit to the trial calendar. The judge could not, on the authority of Rule 60(b), have ordered the defendants to comply with the settlement.
We thus reject the view taken by the Sixth Circuit in Aro Corp. v. Allied Witan Co., 531 F.2d 1368, 1371 (6th Cir.1976), that federal courts have an inherent power to enforce settlements of litigation before them, in favor of the contrary view of the Fourth Circuit in Fairfax Countywide Citizens Ass’n v. County of Fairfax, supra. Speaking with great respect, we think the Sixth Circuit in Aro confused the power of a district judge under Rule 60(b) to restore a previously dismissed case to his docket, which he undoubtedly has, with his power to adjudicate a breach of contract, which he may not have — and certainly does not have by virtue of Rule 60(b). Some breach of contract actions are within federal jurisdiction, but a contract dispute between citizens of the same state that arises under state rather than federal law is not, even though the contract was made in settlement of a federal-question suit. If the [1187]*1187judge sets aside his earlier judgment of dismissal and restores the plaintiffs suit to the trial docket, and then proceeds to adjudicate the issues in that suit, he is adjudicating issues of federal law, as he has unquestioned authority to do. If instead he undertakes to adjudicate issues of contract law that he does not have statutory authority to adjudicate, because they are not issues of federal law or state-law issues cognizable under the diversity jurisdiction, he cannot use Rule 60(b) to fill the vacuum.
Although this court recently cited Aro with approval, see Sudeikis v. Chicago Transit Authority, 774 F.2d 766, 768 (7th Cir.1985), it did so in a case where it was affirming the dismissal of the enforcement action, and it did not discuss the jurisdictional question, or the Fourth Circuit’s answer to it in Fairfax. An earlier Sixth Circuit decision on which the court in Aro relied, Kukla v. National Distillers Products Co., 483 F.2d 619 (6th Cir.1973), is not in point; the court had entered a final judgment based on a settlement, and one of the parties challenged the judgment on the ground that he had not agreed to the terms of the settlement. There was no issue of jurisdiction; the issue was the district court’s authority to base its judgment on the settlement agreement.
An example will indicate why we doubt the far-reaching power claimed for federal judges by the Sixth Circuit in Aro (and only in Aro). Suppose the parties to a diversity suit move for dismissal under Rule 41(a)(2) on the representation that they have settled the suit, but without disclosure to the court of the terms of the settlement. The judge grants the motion, believing that he is definitively, finally, and unconditionally terminating the suit. The settlement agreement requires the defendant to pay for the plaintiff’s college education. Ten years later the plaintiff petitions the court to order the defendant to pay him $500, which he alleges is the unpaid balance of his college tuition. Under the view of the Sixth Circuit, even though an original suit based on such an allegation would not be within the jurisdiction of the federal district court because the requirement of 28 U.S.C. § 1332 that the stakes exceed $10,-000 could not be satisfied, the court would have jurisdiction of the plaintiff’s claim. We cannot believe that this is correct, or understand why the draftsmen of Rule 41(a)(2) would have bothered to mention “terms and conditions” of dismissal if every dismissal were conditional on the defendant’s fulfilling whatever promises he made that induced the plaintiff to dismiss. In Aro as in this case, the petition to enforce came only a few months after the dismissal; but as the plaintiff’s able counsel candidly admitted at argument, the principle for which he is contending has no limit of time. If 20 years from now the plaintiff complains that the defendants have violated a term of the settlement agreement, the judge would, in the plaintiff’s view, have jurisdiction to entertain the complaint — and this regardless of whether the district judge intended to retain jurisdiction. No statute confers such a jurisdiction and we hesitate to use so formless a concept as inherent power to give the federal courts an indefinite jurisdiction over disputes in which the federal interest may be nonexistent. If the parties want the district judge to retain jurisdiction they had better persuade him to do so. Compare Gardiner v. A.H. Robins Co., 747 F.2d 1180, 1190 n. 13 (8th Cir.1984).
In emphasizing that unless jurisdiction is retained the settlement agreement requires an independent basis of federal jurisdiction in order to be enforceable in federal rather than state court, we wish to make clear that we are not suggesting that such agreements are not enforceable. The issue of concern here is whether a settlement agreement is enforceable in federal district court without an independent jurisdictional basis; enforceable, that is, as if the district judge had retained jurisdiction to enforce it, whether or not he did so. As an illustration of the difference between the issue of jurisdiction to enforce a settlement agreement and the issue of the enforceability of such an agreement in a case over which the court has jurisdiction, consider Lyles v. Commercial Lovelace Motor [1188]*1188Freight, Inc., 684 F.2d 501 (7th Cir.1982). The parties made an oral agreement to settle their case, and the district court dismissed the case in reliance on it, but with leave to reopen. Later the plaintiff sought to reopen the case because he had decided that he didn’t want to settle it. The district court refused, on the ground that the plaintiff was bound by his oral agreement. This court affirmed. There was no question of federal jurisdiction over the plaintiff’s suit, which was not a suit to enforce the settlement agreement but a civil rights suit (like the original suit of the plaintiff in this case). This was true whether one viewed the effort to reopen as a motion under Rule 60(b) to vacate the earlier judgment, as a brand-new suit, or as a motion in a pending case (the judge having dismissed with leave to reopen). However it was viewed, it was a dispute arising under the civil rights laws, not under the settlement agreement, which the plaintiff, far from relying on as a source of rights, tried to get set aside as an obstacle to the enforcement of his federal civil rights. It was the defendant who relied on the settlement agreement — as a bar to the suit. There thus was no jurisdictional issue in that case, just as there is no issue of the enforceability of the settlement agreement in this case.
In Cummins Diesel Michigan, Inc. v. The Falcon, 305 F.2d 721, 723 (7th Cir.1962), the issue was again whether a party could back out of the settlement agreement that it had made, and this court held that it could not, and upheld a decree based on the agreement. Again there was no question of the court’s jurisdiction, since the plaintiff’s action (a maritime action) had not been dismissed; the question was the effect of the settlement on that action. It is as if the plaintiff in this case brought a new civil rights suit and the defendants set up in bar of it the settlement agreement which they had made with him. There would be no question of jurisdiction to consider the impact of the agreement on the plaintiff’s rights. But what a plaintiff may not do is to obtain enforcement in a federal court of a settlement agreement after the litigation in which that agreement was made has been unconditionally dismissed, unless there is an independent basis of federal jurisdiction over a suit for breach of the agreement.
In United States v. Orr Construction Co., 560 F.2d 765, 768-69 (7th Cir.1977), finally, the settlement agreement was made, interpreted, and enforced all as part of a single litigation over which the district judge unquestionably had jurisdiction, and the challenge to his interpretation was made on appeal from his final judgment in the case, just as in Kukla.
To summarize, we have expressed profound doubts that Rule 41(a)(2) automatically retains jurisdiction in the district court to enforce the terms of any settlement agreement that may have led the plaintiff to request dismissal of his suit, and we have rejected the suggestion that federal judges have inherent power to enforce settlement agreements arising out of lawsuits that were once before them. But we have expressed no doubt of the power of a district judge to dismiss a lawsuit conditionally, retaining jurisdiction to effectuate terms of settlement agreed to by the parties. Nor do we think there is any magic form of words that the judge must intone in order to make the retention of jurisdiction effective. All that is necessary is that it be possible to infer that he did intend to retain jurisdiction — that he did not dismiss the case outright, thereby relinquishing jurisdiction. Of course the more explicit the district judge is about retaining jurisdiction the less room there is for a dispute, as in this case, over whether he did so. Cf. Elfenbein v. Gulf & Western Industries, Inc., 590 F.2d 445, 448-49 (2d Cir.1978).
The order of dismissal states that it is pursuant to the parties’ stipulation; the stipulation states that the dismissal is pursuant to the terms and conditions in the settlement agreement; and one of those terms is the sentence, quoted earlier, which confers (we are assuming) a right to petition the court to enforce the agreement, and which can certainly be read to request [1189]*1189the district judge to retain jurisdiction of the case for the limited purpose of being able to enforce the agreement. This chain of incorporations supports an argument that the judge explicitly if indirectly retained jurisdiction. The problem is that, so far as appears from the record, neither the stipulation (filed after the judge’s order of dismissal) nor the settlement agreement (dated before that order but never filed) was before the judge when he dismissed the case. No responsible judge would agree to conditions of which he had no knowledge; the conditions might be against public policy. One possible inference therefore is that the judge’s order of December 13 dismissed the case outright, rather than retaining jurisdiction to enforce whatever terms the parties had agreed to in their settlement agreement.
But this interpretation of the judge’s order would be somewhat unrealistic in the circumstances, and we reject it. We know that the judge had been kept apprised of the settlement negotiations over a period of many months; we know that settlements between prisoners and prison officials often contemplate a continuing supervisory role for the federal court; and we know that when the plaintiff wrote his letter to the judge, the judge forthwith characterized it as a petition to enforce the agreement and proceeded to do so. The judge would not have been likely to grant such a petition in a case over which he had no jurisdiction because he had dismissed the case outright months earlier. His response is therefore some evidence that he had indeed intended to make his dismissal, though outright in form, conditional in substance; that in referring to the as yet unfiled stipulation in his order of dismissal, the judge, perhaps fully aware of the tenor and progress of the settlement negotiations and the provision in the settlement agreement for petitioning the court to enforce it, intended to honor that provision, and to this end decided to retain jurisdiction of the litigation for the very purpose of responding to the type of petition that the plaintiff filed. It would of course have been much better if the judge had made all this clearer, but we conclude that the plaintiff has shown — if barely — that the judge did retain jurisdiction of the case.
In suggesting that the district judge would have been well advised to disclose his intention to retain jurisdiction more clearly, we do not mean to suggest that to retain jurisdiction to enforce a settlement agreement a judge must make the agreement a part of the record of the case. Such a requirement would discourage settlements, at least settlements the terms of which are judicially unenforceable without the filing of a new suit, because the parties to settlements frequently do not want the terms to be made public. It would be quite enough if the judge, having read the settlement and satisfied himself that specific enforcement of its terms would not be contrary to public policy, issued an order retaining jurisdiction to enforce the settlement. We point out in this connection that Rule 41(a)(l)(ii) (dismissal by stipulation) does not require that the settlement be filed in court, only that the stipulation be filed, and the stipulation need not, and in this ease did not, recite the terms of the settlement. But we do not think it is possible for a district judge who has dismissed a suit outright, without even having read the settlement agreement that led the plaintiff to request a voluntary dismissal, and without purporting to retain jurisdiction, later to grant specific enforcement of the settlement. In such a case a petition to enforce commences a new lawsuit which must disclose an independent basis for federal jurisdiction. Yet we have concluded that in the peculiar facts of this case, the judge did intend to retain jurisdiction to enforce the settlement.
To recapitulate our discussion of jurisdiction briefly, we have suggested that Rule 41(a)(2) of the Federal Rules of Civil Procedure does not confer authority on federal district judges to enforce the terms of settlement agreements that may have motivated the parties to seek voluntary dismissal of the suit, and in addition we have held that there is no inherent [1190]*1190federal jurisdiction to enforce agreements to settle federal suits. There must be a deliberate retention of jurisdiction, as by issuing an injunction or stating that jurisdiction is retained for a particular purpose. An unconditional dismissal terminates federal jurisdiction except for the limited purpose of reopening and setting aside the judgment of dismissal within the scope allowed by Rule 60(b). In this case, however, we have found that the district judge did deliberately retain jurisdiction — though for the future we hope judges will make their intentions in this regard much clearer.
We come at last to the merits. Here we can be extremely brief. We may assume with the district judge that in conditioning the plaintiffs participation in the work-release program on his complying with the rules of the work-release center, the parties to the settlement agreement did not mean to give the defendants carte blanche to decide whether the plaintiff had violated those rules. The defendants were constrained by the agreement to observe proper procedures in making any determination that the plaintiff had violated a rule. We may also assume without having to decide that the district judge was correct to find that they failed to do this with regard to four of the five violations. But we think that having found that they properly determined the plaintiff to have violated the rules of the work-release center by disobeying a direct order, the judge was required to conclude that the plaintiff had violated a condition of participation in the work-release program.
Although the judge’s order is not so clear as it might have been, we think it unlikely, to say the least, that he would have allowed the disobedience infraction to remain on the plaintiff’s record if he had thought that the defendants had failed to observe required procedures in finding that infraction. The evidence of that infraction is far more than is necessary under the standards applicable to judicial review of prison disciplinary proceedings. See Superintendent, Massachusetts Correctional Institution v. Hill, — U.S. —, 105 S.Ct. 2768, 2774, 86 L.Ed.2d 356 (1985). The truth is that there isn’t the slightest doubt that the plaintiff disobeyed a direct order and thereby violated a rule of the work-release center; and once such a conclusion is made, it follows as the night the day that the plaintiff is not entitled to participate in the work-release program. This is not to excuse the defendants’ own violations of the settlement agreement, if violations there were; but we do not think it possible to read the settlement agreement to mean that if the plaintiff violated a rule of the work-release center he could not be expelled from the work-release program if the defendants committed procedural errors in processing his alleged violations of still other rules. Otherwise there would be the curious result that the more rules the plaintiff violated, the less likely it would be that he could be expelled from the program, since the more likely it would be that in processing charges of violation the defendants would stub one of their procedural toes. An interpretation of the agreement that encourages such conduct is unreasonable, and must be rejected.
The provision that entitles the defendants to remove the plaintiff from the work-release program if he violates the rules of the work-release center is designed to protect the public safety, since a work-release program allows the convicted criminal to move about with many fewer restraints on his freedom than the ordinary prisoner; permitted this plaintiff for example to attend college in downtown Chicago. A judge may not in construing a consent decree or settlement agreement constraining public officials lightly assume that in settling the lawsuit those officials trifled with the public safety. See Alliance to End Repression v. City of Chicago, 742 F.2d 1007, 1013-15, 1020 (7th Cir.1984) (en banc).
So the order to return the plaintiff to the work-release program must be set aside. But this does not conclude the proceeding in the district court, or even our consideration of the appeal. The plaintiff’s letter, which the district court treated as a [1191]*1191petition to enforce the settlement agreement, in fact asks for habeas corpus, and although it does not ask for the petitioner’s unconditional release from detention it asks for his release from a more to a less restrictive form of detention, and such a request is within the scope of the habeas corpus jurisdiction. McCollum v. Miller, 695 F.2d 1044, 1046 (7th Cir.1982). But the district court’s order cannot be upheld under the habeas corpus statute, if only because there is no showing that the petitioner exhausted his state remedies. Another possibility is that the petition should be construed as a complaint — not as a complaint alleging a breach of contract actionable under federal law, as (for reasons explained earlier) that theory won’t wash, but as a complaint kicking off a brand-new section 1983 suit against the defendants. We have our doubts whether the petitioner’s letter can be so construed, even given the policy of construing prisoners’ pro se complaints liberally. See, e.g., Estelle v. Gamble, 429 U.S. 97, 106, 97 S.Ct. 285, 292, 50 L.Ed.2d 251 (1976). But in any event the judge did not base his order on a finding of an independent violation of the petitioner’s rights but on a finding of a violation of the settlement agreement; nor did he give the defendants the full procedural rights to which they would be entitled if the petition commenced a new suit against them, rather than continuing an old one.
On remand, the district judge will have to decide whether there is any other basis on which the order that we have vacated can be sustained. We hold only that he erred in concluding that the settlement agreement entitled the plaintiff to be returned to the work-release program.
The plaintiff’s cross-appeal seeking attorney’s fees is dismissed. Having failed, thus far at least, to obtain any of the relief he sought by petitioning the district court, he has no legal entitlement to an award of attorney’s fees for time incurred in those efforts. See Hensley v. Eckerhart, 461 U.S. 424, 435, 440, 103 S.Ct. 1933, 1940, 1943, 76 L.Ed.2d 40 (1983).
Order Vacated; Cross-Appeal Dismissed.