The kleśas and karma.

After the Kleshas (afflictions affecting our consciousness) are discussed, Patanjali teaches us how that affects our karma.

The kleśas are:
Avidyā  - ignorance
Asmitā - ego
Rāga - attachment
Dveṣa - aversion
Abhiniveśaḥ - fear of death

II.12 Kleśamūlaḥ karmāśayaḥ dṛṣṭa adṛṣṭa janma vedanīyaḥ

The accumulated imprints of past lives, rooted in afflictions, will be experienced in present and future lives.

II.13 Sati mūle tadvipākaḥ jāti āyuḥ bhogāḥ 

As long as the root of actions exists, it will give rise to class of birth, span of life and experiences.

II.14 Te hlāda paritāpa phalāḥ puṇya apuṇya hetutvāt 

According to our good, bad or mixed actions, the quality of our life, its span, and the nature of birth are experienced as being pleasant or painful.

Karma is produced from desire, greed, delusion, and anger. Desire and its uncontrolled form of greed are ultimately the kleśas (afflictions) of attachment, and its flip side, aversion (which stem from the kleśas of ego and ignorance); anger is the frustration of this desire or attachment: and delusion is a manifestation of the kleśa of ignorance. Whether good or bad, all karma is stored or imprinted as patterns in the consciousness and may manifest its fruits in either this life or the next.

 

These translations and commentary are taken from:

Bryant, Edwin F.. The Yoga Sutras of Patañjali: A New Edition, Translation, and Commentary (p. 331). Farrar, Straus and Giroux. Kindle Edition.