The Codex Astartes is the doctrine of the Space Marines, governing all aspects of Chapter organisation and battlefield tactics. For any given tactical situation, the Codex has hundreds of pages devoted to how it may be met and overcome. The wisdom of thousands of Imperial warriors have contributed to the Codex, and details on everything from unit markings to launching a full-scale planetary assault are contained within its pages.
Codex Astartes was written and formalised after the Horus Heresy by the Primarch of the Ultramarines Legion, Roboute Guilliman. Some Chapters, such as the Ultramarines and their Successor Chapters, regard the Codex as a holy text, and follow it without question. Some others follow the Codex less strictly than the Ultramarines, while some (notably the Space Wolves) scoff at it.
Chapters that do follow the Codex Astartes are known as "Codex Chapters". Among the Ultramarines, each battle brother must memorise whole sections of the Codex, so that within each Company there exists a complete unwritten record of the entire text.