I mostly agree with what you said, but disagree on one point:
> Optimism is the precondition for doing good.
It is still possible to do good when things are bleak and there is no possible way out - just because doing good is the right thing[1]. Optimism helps a lot for morale, but is not a precondition.
1. e.g. the 2 people who were pictured comforting each other while trapped at the top of a burning wind turbine.
> the 2 people who were pictured comforting each other while trapped at the top of a burning wind turbine
Optimism doesn't necessarily mean hope. It can mean belief in an afterlife. An end to a suffering. Or gratitude for having someone else in a terrible moment.
I think OP is correct. You can't have good without optimism. Your point, which is also correct, is you can do good without hope.