As an author of the code, I can, of course, know if the context is with or without sharing when I write my code into a class with either of these keywords.
But what if I am writing my code into a class with inherited sharing, which may be consumed by classes which are both with and without sharing?
Is there any way to know in which mode the code is operating so that I could add conditional logic instead of having two completely separate implementations that might be largely identical?