
876 S.W.2d 633 (1994)
EVERGREEN NATIONAL CORPORATION, Appellant,
v.
KILLIAN CONSTRUCTION CO., Respondent.
No. WD 48041.
Missouri Court of Appeals, Western District.
March 1, 1994.
Motion for Rehearing and/or Transfer Denied May 3, 1994.
Application to Transfer Denied June 21, 1994.
*634 William M. Modrcin, Kansas City, for appellant.
Roy Bash, Thomas A. Sheehan, Shughart, Thomson & Kilroy, P.C., Kansas City, for respondent.
Before LOWENSTEIN, Acting P.J., and FENNER and SMART, JJ.
Motion for Rehearing and/or Transfer to Supreme Court Denied May 3, 1994.
LOWENSTEIN, Acting Presiding Judge.
This is an appeal from a motion to dismiss granted under Rule 55.32(a), which requires compulsory counterclaims be filed or lost. The question presented is whether the rule controls rather than the choice of forum clause agreed upon by the parties in their construction contract. This court affirms, holding Rule 55.32(a) controls rather than the parties agreement which called for any action on the contract, other than one for a mechanic's lien action, be tried in Jackson County.
On January 15, 1990 Evergreen National Corporation (Evergreen), appellant, and Killian Construction Company (Killian), respondent, entered into a contract for Killian to construct a corporate facility for Evergreen at Table Rock Lake in Stone County. The contract included the following agreement:
The parties hereto agree that any judicial action or proceeding involving this agreement or any dispute thereunder (except suit to enforce a mechanic's lien) shall *635 be tried in a court of Jackson County, Missouri, and the parties hereto expressly submit themselves to such jurisdiction in any such case. (Emphasis added)
In the case of a mechanic's lien suit, it would be filed in the county where the real property was located as required by Missouri laws § 429.080, RSMo., 1986.
On August 28, 1992, Killian removed its long-time supervisor from the project; issued change orders which increased the fixed costs of the project as set forth in the contract; demanded immediate payment for the change orders and on the same day it presented the change orders to the architect, it filed a mechanic's lien for payment; and, on that day, Killian filed suit to enforce the lien in the Circuit Court of Stone County. Before responding to Killian's mechanic's lien action, Evergreen filed this suit in Jackson County against Killian for abuse of process, tortious interference with prospective contractual relations and fraudulent misrepresentation.
Killian moved to dismiss the Jackson County suit on the grounds the allegations should have been brought as compulsory counterclaims to the mechanic's lien action. The trial court granted the motion, holding it lacked subject matter jurisdiction to consider Evergreen's allegations since it was a compulsory counterclaim to the initial suit.
Review of a motion to dismiss requires the court to treat all facts alleged as true, and gives the non-moving party the benefit of all reasonable inferences that are fairly deducible from the facts. Murphy v. A.A. Mathews, 841 S.W.2d 671, 672 (Mo. banc 1992).
Evergreen asserts Rule 55.32 did not apply to the parties in the case at bar due to their forum selection agreement. Under Missouri law, contracting parties are presumed to know the law and have it in mind when they enter into an agreement. Zirul v. Zirul, 671 S.W.2d 320 (Mo.App.1984). Thus, it is assumed when the parties entered into the agreement they were aware of Rule 55.32 and its effects.
Rule 55.32 compels a party to state any claim it has against its adversary which arises out of the transaction or occurrence which is the subject matter of the suit. The rule's purpose is to discourage separate litigation covering the same subject matter, and require their adjudication in the same action. Cantrell v. City of Caruthersville, 359 Mo. 282, 221 S.W.2d 471, 474 (Mo.1949); Myers v. Clayco State Bank, 687 S.W.2d 256, 260-61 (Mo.App.1985). The compulsory counterclaim is a means of bringing together all logically related claims into a single litigation, through the penalty of precluding the later assertion of omitted claims. Id. The transaction element of the rule is to be "applied `in its broadest sense,' to encompass all claims connected by a logical nexus." Myers, 687 S.W.2d at 261 citing State ex rel. J.E. Dunn, Jr., & Assoc, Inc. v. Schoenlaub, 668 S.W.2d 72, 75 (Mo. banc 1984). A court lacks jurisdiction if a later action is taken on a matter that should have been brought as compulsory counterclaim. See Schoenlaub, 668 S.W.2d at 75-76 (court could not exercise jurisdiction over a claim that should have been brought as a counterclaim in a pending action); State ex rel Buchanan v. Jensen, 379 S.W.2d 529 (Mo. banc 1964).
In the case at bar, the parties contemplated a mechanic's lien might be filed, as noted by the exception in the agreement. Parties to a contract may agree in advance to submit to the jurisdiction of a given court, to permit notice to be served by the opposing party, or to waive notice altogether, National Equipment Rental, Ltd., v. Szukhent, 375 U.S. 311, 315-316, 84 S.Ct. 411, 414-415, 11 L.Ed.2d 354 (1964), however, there is no authority for the proposition that parties may waive compulsory counterclaims or other procedural matters which affect judicial economy rather than the parties' due process rights.
The judgment is affirmed.
All concur.
