Post-Contractual Non-Competition and Blue Card question

Hello. I'm from non-EU country and I'm work and live in Germany now with temp residence permit (Aufenthaltserlaubnis). I found a new permanent job. The contract has the next paragraph:

§ 18 Post-Contractual Non-Competition/Contractual Penalty
(1) For a period of 3 months after termination, the Employee is prohibited from acting in an independent, dependent or other manner for a company that is in direct or indirect competition with the Employer or is affiliated with a competing company. in the same way, the Employer is prohibited from establishing, acquiring or directly or indirectly participating in such a company for the duration of this prohibition.
(2) For the duration of the prohibition, the Employer shall pay compensation equal to half of the last contractual remuneration received by the Employee for each year of the prohibition.
(3) Any other income shall be set-off against the compensation in accordance with §74c HGB (German Commercial Code). The Employee has to inform without being asked whether and to what extent he receives other income. The information must be substantiated.
(4) The post-contractual non-competition clause does not enter into force if the employment relationship has lasted less than one year or if the Employee have reached the regular age limit of the statutory pension insurance when leaving the company.
(5) Apart from that, the provisions of §§ 74 ff. HGB (German Commercial Code) shall apply.
(6) In the event of a breach of the post-contractual non-competition obligation, the Employee shall pay a contractual penalty amounting to one gross monthly salary. If the infringement consists of a capital participation in a competing company of the entering into a continuing obligation, the contractual penalty shall be triggered anew for each month in which the capital participation of the continuing obligation exists (continuing infringement). Multiple acts of infringement shall trigger separate contractual penalties, if necessary several times within one month. If, on the other hand, individual acts of infringement take place within a continuing penalty for the continuing infringement, they are included in the contractual penalty for the continuing infringement. If several contractual penalties are triggered, the total amount of the contractual penalties to be paid is limited to six times the gross monthly salary.
(7) Further claims for damages and other legal claims of the Employer remain unaffected.

Question 1: The phrase "direct or indirect competition" is very vague, practically every software company with b2b solutions could be considered as competitor. Who and how will decide, if particular company is competitor or not? In case of fouding new job, how can I be sure, that the penalty will not be aplied to me?

I will get a Blue Card with this contract. As far as I know, EU Blue Card allows to search for a new job for 3 months (with notifying the authorities about quitting the current one). I'm considering the next possible scenario to avoid the problem above:
1. Work at company A and have a Blue Card.
2. Search for a job in another company B while working in company A.
3. Sign the contract with company B, in which my employment begins at chosen quitting date + 3 month.
4. Quit company A at chosen quitting date with signed new contract in my hands.
5. Go to the migration office and notify them, that I quit Company A and I already have new contract with Company B.
6. Wait without a work 3 months in Germany before new contract starts.

Question 2: Does the Blue Card regulation allows to do that? Is it allowed to deliberately have a 3 month period between working contracts without actual searching?

Thanks.

First and foremost: The non-competition clause as you quoted it is valid and enforceable as far as I know.

Question 1: If there is a conflict, the courts will decide (as part of legal proceedings and typically many months after the conflict arises) whether your new job is in competition to the old employer or not. Beforehand, nobody will give you any assurance (it simply is the risk you take!) - but asking your old employer (preferably in writing) if the intended new job is considered competition by them can give you some certainty.

Question 2: If the regulations are as you stated, the intended construct is possible (and according to the old contract, you'd get half the previous salary from the old employer during the three months).