How to keep context of previously asked promotes and answers?

I want to create vscode extension which will have context of all project for this i am thinking feeding code to GPT in chunks like
promote: " I have file ‘src/index.js’ which have code like ‘…’ "

I will be using all tokens in promote it self as i don’t want any completion and just want to make GPT aware of code for context.

So when i aksed any question in new promote it will give me the answers from previous asked promotes.

It look trivial as Chat GPT aready does this, but didn’t able to find how i can do it with openai api

Any help will be appreciated