You’re working on the project, and you have branch for every current task. So you can track how much you spend for every task in project. It is useful i.e. for when you have lot switching e.g. for review, change PR, etc.
As implementation, you it can get it from process
pwd. So it will be work for terminal, editors ant many others apps just from out of box. I.e. for Linux
pwd it is easy to know from proc fs.