Should a chess engine be aware of opposite-side castling? I often hear chess experts and chess articles say that when opposite side castling occurs on the board that it is important to launch an attack on the enemy player as fast as possible. Up to the point where giving up a couple pawns or a piece could be justified.
In other words, it seems like castling opposite sides changes the dynamic of the game. How much this change is I'm not sure of. So here is my question:

Is opposite side castling significant enough that a chess engine should think about such positions differently from how it would normally?

For example, a chess engine could lower the importance of material and up the importance of king safety in its evaluation when opposite castling occurs.
I'm pretty sure Stockfish doesn't have explicit code that handles opposite-side castling. What it does have is:

Some kind of &quot;menace&quot; score for enemy pawns advancing against our king. The closer they get, the more dangerous Stockfish thinks they are.
Some kind of &quot;pawn shield&quot; score for friendly pawns in front of our king. The fewer there are, the more dangerous Stockfish thinks the position is.

Therefore you get kind of a balancing act: if we castle on the same side, then we could advance our pawns against their king (getting the &quot;menace bonus&quot;), but it would reduce our pawn shield (and therefore losing the &quot;pawn shield bonus&quot;). The converse does not hold in opposite side castling, which therefore encourages the engine to push pawns against the enemy king.
Of course, the details are more complicated than this, but that's the gist.