Yes, $ID is the unique ID of notes, agents, aliases, etc., within Tinderbox. The ID persists through renaming and is also why it is possible to have more than one note with the same name† in a document. The $ID UID number is thus unique within a single TBX. If items are copied to other documents the pasted item is given a new $ID.
Here is (part of) the source XML of a TBX document. There are two notes defined:
In each case the main object representing the note is an
<item> tag that has one XML attribute,
ID i.e. it’s $ID. The note title ($Name) is an XML attribute of the
<item>. See that the second note’s
<item> is nested within the first one. This is how the canonical outline structure of the document is reflected; that outline is also reflected in a note’s $Path.
† Note names can be duplicates but be aware they don’t play well with action code, similarly notes with no $Name (i.e. a blank string). If there are two notes called “X” in the same container/map, they both have the same $Path. When action code is given a $Name as a parameter it actually uses the $Path and when the latter is resolved to the item first by $Outline Order. So if trying to automatically link to two items with the same $Path both links will point to the item with the lowest $OutlineOrder (at the time); this is unlikely to be the desired intent. So beware if using duplicate names.