A tag index is simply a text file, with a tag value, a tab character, and an entry name on each line. The file is sorted.
If all tag values in an index are numeric, then each tag value is preceded by enough spaces to pad the value to the same length as all the others, so that they sort properly.
Tag indexes are stored in the "tags" folder.