How to customize/control the TaskSpace Tab through custom code.

I want to create costom code that should do following:

1. I have taskspace tab hook so that I can make it visible/invisible/refresh/add new component etc.

Is someone can share the custom code, that would great.

Thx,

Saroj