Chemically, what's happening to coffee after it's brewed? So I've prepared my coffee in the morning, and transferred it to a thermos flask, where it will only cool down negligibly over the course of the day.

Is anything happening to the coffee in the flask? Will the taste of the coffee change over the course of the day, or will a cup poured at 5pm taste essentially the same as one poured first thing in the morning?

If I had a perfect flask that lost no heat, how long would my coffee stay tasting as fresh as possible?
The biggest chemical change that is going to occur is going to be oxidation.

Oxidation

Chemically, oxidation is defined as the following from this source.


  Oxidation is any reaction in which one or more electrons
  are moved from one chemical to another, producing two different
  compounds.


Specifically related to coffee, oxidation is further elaborated upon as:


  In coffee, the most common process is that an oxygen molecule donates
  two electrons to a compound, forming a new (differently perceived)
  compound and bonding with hydrogen to form water.


Oxidation of coffee occurs when oxygen molecules (present in the air in your flask and also dissolved in the water used to brew the coffee) come into contact with different compounds in the coffee. Even if you had no air whatsoever in the flask, this process would still happen due to the dissolved oxygen in the water used to make the coffee.

The process of oxidation occurs much more readily at higher heats, hence the reason why cold brewed coffee does not go stale as quickly. 

When the oxygen combines with the hydrogen, water is created. That hydrogen ion, when it was free, was adding to the acidity of the coffee. Once it is no longer free and connected to the oxygen, in the form of water, the pH of the coffee will rise slightly, making the coffee more bitter. This is can be perceived as 'staleness'.

The compounds which are oxidized are the acids, aromatics, and oils.  All of these give your coffee it's great taste.

Loss of heat

As the coffee cools, the molecules will vibrate more slowly. This leads to a drop in temperature and will occur in any container, no matter how good it is. Since you have described a situation with minimal heat loss, this process is negligible.

In Conclusion

The oxidation causes the coffee to become stale. This is a bean roasters worst nightmare. For the brewed coffee, it dismantles aromatics, acids, and oils - all key contributors to the coffee's flavor. It also raises the pH to make it more bitter and adds water to the mix.

So no, it won't taste the same at 5 pm as it would poured first thing in the morning. The taste of the coffee will change over the course of the day.

Answering your final question about duration of freshness:

How long will your coffee stay fresh in a perfect flask? That is a matter of opinion. Every coffee shop has a different standard for how long they let their brewed coffee sit. It can be 15 minutes to an hour.

As soon as you roast a bean, it begins to stale. As soon as you grind coffee, it begins to stale. As soon as you brew coffee, it begins to stale. It's hard to qualify what you will consider to be 'fresh'. A purist will tell you that unless you consume the coffee immediately, your coffee will be stale.

As I said, it is a matter of opinion, and if you have the perfect flask, I would say you could wait about an hour before your coffee becomes stale. That's just me though. The sooner you drink it the better.

What You Can Do

Ensure there is little to no air left in your flask. You might also look into cold brewing.



If you want to read more about these chemical processes as they apply to coffee throughout the preparation process (roasting, grinding, brewing), then you can check out this resource.

Black Bear Coffee