"persistent ID", "unique ID" - it is still not clear to me what you are actually after.
What instance(s) shall create these IDs?
What instance(s) shall use these IDs in which ways?
What is the use/purpose of these IDs?
Is the machine/the LaTeX-compiler to create these IDs automatically?
If this is what you are after:
When it comes to using these IDs—will there be some intervention by an instance other than the (La)TeX-program itself that needs to know about these IDs/that needs to know what exactly is to be identified by which ID? (Such an instance could, e.g., be the instance which delivers/creates the (La)TeX source code. ;-) )
If this is the case: In which ways shall that instance obtain the information she/he/it needs?
If this is not the case, then it seems that there are to be routines that without intervention both create the IDs and handle all the usage of these IDs.
It seems, the requirement of persistence throughout LaTeX-runs in any case implies:
With each call to routines that automatically generate and use pieces of information in form of IDs that are to be persistent throughout LaTeX-runs, additional information would need to be left for future LaTeX-runs which these routines could with each call in the next LaTeX-run use for detecting the information that was left by that call in the current LaTeX-run to which the call in question of the next LaTeX-run corresponds.
Thus you would need unique non-changing identifiers for the calls of the routines themselves and you would need to have LaTeX preserve these unique non-changing identifiers throughout all LaTeX runs.
A problem with this:
The only way known to me of preserving pieces information created during LaTeX-runs throughout LaTeX-runs is by means of temporary files which can be read within the next LaTeX-run. The info will be lost when the temporary files in question cease to exist.
Another problem with this:
Above I already mentioned that you would need unique non-changing identifiers for the single calls of the routines themselves and that you would need to have LaTeX preserve these identifiers throughout LaTeX-runs.
Thus you would need a mechanism for automatically creating and preserving throughout LaTeX-runs these unique and non-changing identifies of the single calls of the ID-producing routines.
And voilà: You would face the initial problem, just on an underlying level.
Therefore I assume that in any case there will be some level of identification where unique non-changing identifiers need to be provided by the instance that provides the (La)TeX source code.
Here the cross-referencing-mechanism of LaTeX 2e comes to my mind:
With LaTeX 2e's \label{⟨name of referencing-label⟩}-\...ref{⟨name of referencing-label⟩}-cross-referencing-mechanism the instance that provides the tex-source-code is urged to provide unique names for cross-referencing-labels.
If that instance doesn't, LaTeX 2e will complain via warnings about labels that are multiply defined.
You can see these warnings on the screen of the terminal/shell in use and in the .log-file.
These names for cross-referencing-labels will be persistent as long as no one changes them within the tex-source-code.
After reading the comments to the question it seems that a \label-\ref-mechanism which does not only provide referencing-commands for placing textual phrases like page numbers and counter values and the like into the output-file (pdf-file) but does also provide a referencing-command for placing a textual phrase denoting the name of the referencing-label itself into the output-file (pdf-file) might probably be what you need.
Usually with the \label-\ref-mechanism you can only obtain page numbers and counter values.
Using Heiko Oberdiek's zref-package you can easily enhance the \label-\ref-mechanism so that label-commands store and referencing-commands deliver other pieces of information as well. Such a piece of information could be the name of the referencing-label itself.
In the example below I used Heiko Oberdiek's zref-package for creating a command \LabelWhoseNameCanBeShown which works like the \label command. The difference is that besides referencing via \ref, \pageref, \hyperref[...]{...}, etc, it makes it also possible to reference the name of the label itself via a command \ReferNameOfLabelWhoseNameCanBeShown.
\ReferNameOfLabelWhoseNameCanBeShown{⟨name of referencing-label⟩} should act as follows:
In case the referencing-label ⟨name of referencing-label⟩ was defined/introduced via \LabelWhoseNameCanBeShown{⟨name of referencing-label⟩}, \ReferNameOfLabelWhoseNameCanBeShown should (within the second LaTeX-run) deliver ⟨name of referencing-label⟩ as textual phrase into the .pdf-output-file.
In case defining/introducing the referencing-label ⟨name of referencing-label⟩ via \LabelWhoseNameCanBeShown{⟨name of referencing-label⟩} did not take place, \ReferNameOfLabelWhoseNameCanBeShown should deliver an error-message and some questionmarks.
\documentclass[a4paper]{article}
\usepackage{hyperref}
\usepackage{zref}
\makeatletter
\newskip\UD@savsk
\newcommand*\UD@bsphack{%
\relax
\ifhmode\UD@savsk\lastskip\@savsk\lastskip\@savsf\spacefactor\fi
}%
\newcommand*\UD@esphack{%
\relax
\ifhmode
\spacefactor\@savsf
\ifdim\@savsk>\z@
\ifdim\lastskip=\z@\nobreak\hskip\z@skip\fi
% The following \hskips are used for restoring \lastskip.
% I hope there are no evil side-effects. ;-)
\nobreak\hskip-\UD@savsk
\nobreak\hskip\UD@savsk
\ignorespaces
\fi
\fi
}%
%
%
\zref@newprop{labelname}{}%
\DeclareRobustCommand\LabelWhoseNameCanBeShown[1]{%
\UD@bsphack
\zref@setcurrent{labelname}{#1}%
\zref@labelbyprops{#1}{labelname}%
\label{#1}%
\UD@esphack
}%
\DeclareRobustCommand\ReferNameOfLabelWhoseNameCanBeShown[1]{%
\zref@extractdefault{#1}%
{labelname}%
{\nfss@text{\reset@font\bfseries ??}\refused{#1}}%
}%
\makeatother
\pagestyle{empty}
\textwidth=\paperwidth
\addtolength\textwidth{-4cm}%
\oddsidemargin=2cm
\addtolength\oddsidemargin{-1in}%
\addtolength\oddsidemargin{-\hoffset}%
\evensidemargin=\oddsidemargin
\marginparwidth=1.5cm
\marginparsep=0.25cm
\parindent=0ex
\parskip=\medskipamount
\begin{document}
Referencing the thing:
\sloppy
\verb|\ReferNameOfLabelWhoseNameCanBeShown{A unique label name}|:
\mbox{\ReferNameOfLabelWhoseNameCanBeShown{A unique label name}}
\verb|\ref{A unique label name}|:
\mbox{\ref{A unique label name}}
\verb|\pageref{A unique label name}|:
\mbox{\pageref{A unique label name}}
\verb|\nameref{A unique label name}|:
\mbox{\nameref{A unique label name}}
\verb|\hyperref[{A unique label name}]{\ReferNameOfLabelWhoseNameCanBeShown{A unique label name}}|:
\mbox{\hyperref[{A unique label name}]{\ReferNameOfLabelWhoseNameCanBeShown{A unique label name}}}
\null\hrulefill\null
\begin{verbatim}
\section{A section}
\section{Another section}
% Introducing the thing:
\LabelWhoseNameCanBeShown{A unique label name}%
% If you wish to see the thing immediately, just reference it immediately:
\ReferNameOfLabelWhoseNameCanBeShown{A unique label name}
Some text. Some text. Some text. Some text. Some text. Some text.
Some text. Some text. Some text. Some text. Some text. Some text.
Some text. Some text. Some text. Some text. Some text. Some text.
\end{verbatim}
\section{A section}
\section{Another section}
% Introducing the thing:
\LabelWhoseNameCanBeShown{A unique label name}%
% If you wish to see the thing immediately, just reference it immediately:
\ReferNameOfLabelWhoseNameCanBeShown{A unique label name}
Some text. Some text. Some text. Some text. Some text. Some text.
Some text. Some text. Some text. Some text. Some text. Some text.
Some text. Some text. Some text. Some text. Some text. Some text.
\end{document}

Alternatively you can, e.g., create macros
\IDpar{⟨Unique ID⟩},
\ReferIDpar{⟨Unique ID⟩} and
\HyperReferIDpar{⟨Unique ID⟩}
whereof
\IDpar creates a new paragraph and writes the ID of it into a margin-note.
\ReferIDpar lets you refer to that ID, yielding error-messages in case the ID wasn't introduced via \IDpar.
\HyperReferIDpar additionally turns the reference into a clickable hyperlink for navigating to the referenced paragraph.
Still you need to provide the IDs manually and therefore you may wish to maintain a list of already used IDs as a comment in your TeX source file:
\documentclass[parskip=full, mpinclude=true, twoside=semi]{scrbook}
\usepackage{marginnote}
\usepackage{xcolor}
\usepackage{hyperref}
% Number \subparagraph
\setcounter{secnumdepth}{5}
% Add \subparagraph to TOC (not important for the MWE)
\setcounter{tocdepth}{5}
% Color \subparagraph
% \addtokomafont{subparagraph}{\color{red}}
%
\makeatletter
\DeclareRobustCommand\FormatIDOfPar[1]{%
\hbox to 2cm{\null\hfill\textnormal{#1}\hbox to 5mm{}}%
}%
\newcommand\IDlabelPrefix{SPEC.}%
\newcommand\IDPrefix{SPEC\protect~}%
\DeclareRobustCommand\IDpar[1]{%
\par\leavevmode
\marginpar{%
\FormatIDOfPar{%
\begingroup
\@ifundefined{Hy@raisedlink}{}{%
\Hy@raisedlink{\hyper@anchorstart{\IDlabelPrefix#1}\hyper@anchorend}%
}%
\ReferIDpar{#1}%
\def\@currentlabel{\IDPrefix#1}%
\def\@currentHref{\IDlabelPrefix#1}%
\label{\IDlabelPrefix#1}%
\endgroup
}%
}%
\ignorespaces
}%
\@ifpackageloaded{hyperref}{%
\DeclareRobustCommand\ReferIDpar[1]{%
\ref*{\IDlabelPrefix#1}%
}%
\DeclareRobustCommand\HyperReferIDpar[1]{%
\hyperref[\IDlabelPrefix#1]{\ref*{\IDlabelPrefix#1}}%
}%
}{%
\DeclareRobustCommand\ReferIDpar[1]{%
\ref{\IDlabelPrefix#1}%
}%
\DeclareRobustCommand\HyperReferIDpar[1]{%
\ref{\IDlabelPrefix#1}%
}%
}%
\makeatother
\reversemarginpar
% List of IDs used so far:
% ========================
% (As in this example IDs are continuously numbered and I increased the
% number whenever introducing another ID, it is sufficient to keep
% track of the number of the ID that was introduced as the last one.)
%
% Last ID introduced: 12
% Date of introduction: Feb 11, 2019; 22:08:34 (UTC)
%
% Otherwise you could maintain a list of IDs for looking up whether
% an ID you intend to introduce already exists:
%
% \IDpar | currently in capter/section
% -----------------------------------------
% 1 | Nice chapter
% 2 | Nice section
% 3 | Nice subsection
% 4 | Nice subsubsection
% 5 | Nice paragraph
% 5a | - existed in some previous relase(s) of the document/meanwhile removed. -
% 6 | Nice subparagraph
% 7 | Nice subparagraph
% 8 | Nice other section
% 9 | Nice other subsection
% 10 | Nice other subsubsection
% 11 | Nice other paragraph
% 12 | Nice other subparagraph
%
% (I suggest keeping track of removed IDs also for ensuring that with
% later versions of the document, where probably specifications got
% removed, you don't erroneously -eh- "recycle" old removed
% specification-IDs ...)
\begin{document}
%\tableofcontents
\chapter{Nice chapter}
\IDpar{1} Test text. Test text. Test text.
\section{Nice section}
\IDpar{2} Test text. Test text. Test text.
\subsection{Nice subsection}
\IDpar{3} Test text. Test text. Test text.
\subsubsection{Nice subsubsection}
\IDpar{4} Test text. Test text. Test text.
\paragraph{Nice paragraph}
\IDpar{5} Test text. Test text. Test text.
\subparagraph{Nice subparagraph}
\IDpar{6} Test text. Test text. Test text.\\
\verb|\ReferIDpar{7}|: \ReferIDpar{7}\\
\verb|\HyperReferIDpar{7}|: \HyperReferIDpar{7}\\
\verb|\ReferIDpar{8}|: \ReferIDpar{8}\\
\verb|\HyperReferIDpar{8}|: \HyperReferIDpar{8}\\
\verb|\ReferIDpar{9}|: \ReferIDpar{9}\\
\verb|\HyperReferIDpar{9}|: \HyperReferIDpar{9}\\
\verb|\ReferIDpar{10}|: \ReferIDpar{10}\\
\verb|\HyperReferIDpar{10}|: \HyperReferIDpar{10}\\
\verb|\ReferIDpar{11}|: \ReferIDpar{11}\\
\verb|\HyperReferIDpar{11}|: \HyperReferIDpar{11}\\
\verb|\ReferIDpar{12}|: \ReferIDpar{12}\\
\verb|\HyperReferIDpar{12}|: \HyperReferIDpar{12}\\
\IDpar{7} Test text. Test text. Test text.
\section{Nice other Section}
\IDpar{8} Test text. Test text. Test text.
\subsection{Nice other subsection}
\IDpar{9} Test text. Test text. Test text.
\subsubsection{Nice other subsubsection}
\IDpar{10} Test text. Test text. Test text.
\paragraph{Nice other paragraph}
\IDpar{11} Test text. Test text. Test text.
\subparagraph{Nice other subparagraph}
\IDpar{12} Test text. Test text. Test text.
\verb|\ReferIDpar{1}|: \ReferIDpar{1}\\
\verb|\HyperReferIDpar{1}|: \HyperReferIDpar{1}\\
\verb|\ReferIDpar{2}|: \ReferIDpar{2}\\
\verb|\HyperReferIDpar{2}|: \HyperReferIDpar{2}\\
\verb|\ReferIDpar{3}|: \ReferIDpar{3}\\
\verb|\HyperReferIDpar{3}|: \HyperReferIDpar{3}\\
\verb|\ReferIDpar{4}|: \ReferIDpar{4}\\
\verb|\HyperReferIDpar{4}|: \HyperReferIDpar{4}\\
\verb|\ReferIDpar{5}|: \ReferIDpar{5}\\
\verb|\HyperReferIDpar{5}|: \HyperReferIDpar{5}\\
\verb|\ReferIDpar{6}|: \ReferIDpar{6}\\
\verb|\HyperReferIDpar{6}|: \HyperReferIDpar{6}\\
\end{document}

.aux.) – moewe Feb 11 '19 at 09:36disqualify solutions) in that context :). – Dr. Manuel Kuehner Feb 11 '19 at 09:37.aux, say.mklabel. That might technically satisfy your 'even I delete the aux files', but that has the same structural limitations as writing to the.aux: If the file is gone, the info is gone. Now you could try to write to a designated system file that you always keep around, but then you make your file dependent on your machine (plus I doubt that LaTeX can just write to any location willy nilly). – moewe Feb 11 '19 at 09:40\labelsurely? (you have not used\labelin your example, but if each section has a\labelthen it has a unique label.... – David Carlisle Feb 11 '19 at 09:44\label;-) Of course in the end that requires a human to make up the ID themselves (or at least a precursor of the actual ID) and write it to the source, I'm not sure if that is what Manuel had in mind. – moewe Feb 11 '19 at 09:53\label{<currentdate>-<currenttime>-<randomnumber>}into your document. This should be quite safe. – Ulrike Fischer Feb 11 '19 at 10:15<li id="zzz">...and then use a reference ofhref="foo.html#zzzthat is stable even if that<li>changes from item 2. to item 3. ? If so then\labelis the direct analogue. If you mean something else than can you edit the question to make it clearer what you mean....? – David Carlisle Feb 11 '19 at 11:04\labelwon't be visible as far as I underastand the proposal. I will add to the question, that the IDs need to be visible. But I fear, that the question is too vague or not possible to be solved within LaTeX (e. g. Ulrike's idea). – Dr. Manuel Kuehner Feb 11 '19 at 11:29\paragraph*{something funky\label{something-funky}}can be referenced by#something-funkywhatever additional sections are added. – David Carlisle Feb 11 '19 at 11:48\subparagraphis replaced with\subparagraph*, so that there is only one ID (a funky one). In the same bracket I generate a label with the same content as the ID. The label can be used to refer to the ID (will\refshow the ID then?!). Do I understand that correctly? – Dr. Manuel Kuehner Feb 11 '19 at 12:00#presm.mfracnot one ending in#sec3.2.1.1which changes each draft as the numbers change, but in that case the visible numbers do change and it is just the internal link id that is stable. – David Carlisle Feb 11 '19 at 12:24\zlabel-command. – Ulrich Diez Feb 11 '19 at 14:57