How can I store the documents in the repository compressed? I want to compress when I add a new file to the repository and I want to uncompress when I access it.
One way would be to point your alf_data directory to a compressed NTFS drive - not a great solution but quick and easy (although you would probably want to point your lucene indexes to a non-compressed drive for performance reasons)
The other way is to write a custom ContentService implementation. All services in Alfresco are pluggable and can be swapped out with new implementations. The ContentReader and ContentWriter classes delivered by the ContentService could be overriden to implement compression in/out of the repo - they are the single contact point for all repository content operations. I suggest you take a look at the Developer Guide section of the wiki if you are interested in developing a new service.