I don't know the rule
Me neither :(
but quickly anylising some examples given (and other verbs) I tend to assume it's the 3rd person plural (= they) form minus the ending, of course some minor changes between related vowels/consonants appear now and then (like it happens quite often in Polish, in such cases other forms help too), sometimes 3rd person singular
is very helpful, especially with those more irregular verbs.
Let's take tczesio's examples:
infinitive - 3rd plural (present tense) - imperative mode:
chodzić - chodzą - chodź
(not chodz, but the soft "dź/dzi" appears in other forms as well)
słuchać - słuchają - słuchaj
mówić - mówią - mów
robić - robią - rób (why "ó" not "o", it would require some knowledge of old, medieval Polish, to explain this process, I guess it's nothing a beginner would care about)
jeść - jedzą - jedz
iść - idą - idź ("dź" instead of "d", but it's for example "on idzie" with soft "dzi", so no wonder this "dź" found its way :)
wiedzieć - wiedzą - wiedz
jechać - jadą - jedź (here the 3rd person singular
"on jedzie" looks like the direct source of the imperative form, but I guess it's down to some old Polish again, to explain why such a form is used)
If you want to use the imperative form to more then one person, then you add the ending -cie to the basic imperative form. In first person plural you add -my. In the polite form (with Pan/Pani [or plural Państwo]) you use "niech" + pan/pani [or państwo] + 3rd person singular [plural] indicative mode.
John, give me some time. - John, daj mi trochę czasu.
Guys, give me some time. - Dajcie
mi trochę czasu.
Let's give him a lesson - Dajmy
(Sir,) don't talk to me like this, please. - Niech Pan
tak do mnie nie mówi
Gentlemen, trust me, please. - Niech
mi Państwo zaufają
. Technically zaufają is future tense, but it's because it's a perfective verb, so it has no present tense, but with a imperfective verb you use the present tense:
Gentlemen, don't lie to me, please. - Niech