The Covenant of Works existed before the Covenant of Redemption.
What exactly is the Covenant of Works?
Genesis 3:22 22 Then the LORD God said, "Behold, the man has become like one of Us, knowing good and evil; and now, he might stretch out his hand, and take also from the tree of life, and eat, and live forever "--
The only tree that Adam was forbidden to eat from was the tree of the knowledge of good and evil. The tree of life He was able to eat from. We are never told why Adam did not eat from the tree of life prior to eating from the tree of the knowledge of good and evil. The Covenant of Works operates under the assumption that mankind would have maintained its intimate relationship with God as long as sin did not enter into the picture. Eventually Adam would have eaten from the tree of life and lived in perpetual obedience to God. We know from the garden narrative that this did not happen. Adam ate of the fruit from the forbidden tree and sin ensued; both to Adam and his posterity. As an act of grace God prevented Adam from eating from the tree of life; thus sparing Adam an eternity of sin. Adam truly was the first moral free agent in that he had no sin nature when he was created, although he had the ability to sin (posse pecare).
The Covenant of Works reminds us of God's standard.
1 Peter 1:16 16 because it is written, "YOU SHALL BE HOLY, FOR I AM HOLY."
With the Covenant of Works broken God inaugurated the Covenant of Redemption. Starting with the first shedding of blood (Genesis 3:21), God initiated this covenant (also called the Covenant of Grace) that would culminate with the coming of Jesus and His sacrificial death on the cross. The C.o.R. is seen in the establishment of the ceremonial law and the sacrificial system. Over and over again God's standard of holiness continually pointed to man's sinfulness and condemnation. The sacrificial system provided a means of receiving grace and forgiveness, albeit temporary. We see God's grace towards the Gentiles (Rahab and Nineveh et. al). When Christ came everything that the C.o.R. pointed towards became fulfilled. Eventually it will reach its apex at the beginning of the eternal state. At that time everyone who is saved will have the right to eat of the tree of life (Revelation 22:14). What Adam lost will be completely restored.