Tags coffee roasting resting coffee
Resting is the short length of time between roasting and using coffee, during which its flavor improves. Once the flavor starts to deteriorate the coffee is no longer resting—it is staling.

How long should coffee rest for?
As soon as coffee has finished roasting its flavor starts changing. This is because the different chemicals that contribute to flavor decrease at different rates. So the ideal resting time depends on the flavor you are looking for, the roast style, and the bean. Taste your coffee, taking note of how long since it was roasted, and work out the optimal amount of resting. In my experience some roasts are best after 0-6 hours, some peak at 3-5 days, and some just go on improving for up to 10 or even 14 days. Catching your coffee at its peak is one of the great rewards of home coffee roasting.

There are other factors that affect resting. Coffee ages faster in warmer temperatures. Darker roasts age faster than lighter roasts, but conversely they may benefit from more resting . Oxygen and moisture contribute to ageing. Try to keep these variables constant while you are determining the optimal amount of rest time for a particular coffee.

Using a bag with a valve keeps oxygen away from the beans. This will delay ageing and allow you to rest the coffee for longer and then enjoy it fresh for longer. The coffee will age faster if you keep opening the pouch to make coffee because this lets oxygen in. Also, some chemical changes happen independently of the supply of oxygen. Don't expect coffee kept in a valve bag for a week to taste exactly the same as coffee kept in a paper bag for a couple of days.

If this all sounds too complicated I recommend a simple approach: roast 100g last thing before retiring to bed and use it for your morning coffee. Use it all up within a few days. If you notice that it improves over those few days then try to get ahead of yourself by roasting a few days in advance. If you notice that it tastes best the morning after roasting, then stick with roasting when you run out. Espresso often benefits from a longer rest, so if you are making espresso you might want to try keeping some coffee around for a week or more to see how it ages.

The background
Coffee ages faster in warmer temperatures, perhaps 1.5x faster for each 10 deg C warmer (Illy et al, p 238). Darker roasts age faster than lighter roasts (Rao, p 70). Changes in chemical makeup of coffee start immediately after roasting with the first 5 days being the most dramatic, leveling off after about 20 days (Illy et al, fig 6.8, p 242).

Although most coffee authorities have some recommendation to make about resting, they tend to contradict each other. Rao recommends consuming freshly roasted coffee within 2-3 days of roasting unless it is stored in a valve bag where he recommends consume within 2 weeks (assuming the bag is not being opened every day) (p 70). In other words he does not recommend resting at all. Davids, on the other hand, recommends resting anywhere from 4 hours to one day (p 149). Lamason recommends using roasted coffee between 3 and 10 days after roasting if making espresso, on the basis that in the first three days the shot may be too bubbly and will taste a bit tangy (p 28).

In my experience there is huge variation in the way coffee ages: systematic tasting between 0 and 14 days after roasting is required to find the optimum for a given roast.

Espresso Coffee: The Science of Quality
The Coffee Roaster's Companion
Home Coffee Roasting: Romance and Revival
People's Coffee Barista Handbook
How To Brew Coffee Like a Barista