There is no built-in mechanism for this — each extension decides how to best store the data. Extensions usually store their data in a file or directory named after themselves, so you could use
.hg/myextension/
as your root. You can use repo.opener
to open files inside that directory:
fp = repo.opener('myextension/state.json')
data = json.load(fp)
fp.close()