What is the functoriality of the $\infty$-categorical slice construction? The "slice" construction associates to a functor $f\colon C\to D$ a category $C_{f/}$, whose objects are pairs $(d,f\xrightarrow{\gamma}\kappa_d)$, where $d$ is an object of $D$, and $\kappa_d\colon C\to D$ is the constant functor with value $d$, and whose morphisms $d\to d'$ compatible with the data.  This has the following kind of functoriality:
$$
C'\xrightarrow{j} C\xrightarrow{f} D\xrightarrow{p} D' \qquad \mapsto \qquad  D_{f/}\to D'_{pfj/}.
$$
That is, the slice construction is a functor $\def\Tw{\mathrm{Tw}} \Tw(\mathrm{Cat})\to \mathrm{Cat}$ from the twisted arrow category on $\mathrm{Cat}$.
The $\infty$-categorical generalization of this was introduced by Joyal, and is a functor $\Tw(\mathrm{sSet})\to \mathrm{sSet}$, which extends the one defined above and restricts to a functor $\Tw(\mathrm{qCat})\to \mathrm{qCat}$, where $\mathrm{qCat}$ is the 1-category of quasicategories (=$\infty$-categories).
The question is: does this admit a refinement to a functor $\Tw(\mathrm{Cat}_\infty)\to \mathrm{Cat}_\infty$ between $\infty$-categories?  (Note that the $\Tw$ construction does in fact make sense for simplicial sets, and thus for quasicategories.)
If so, then such a functor will classify some cocartesian fibration of the form $??\to \Tw(\mathrm{Cat}_\infty)$.  Is there some description of $??$?
Finally, I should note that such a construction (if it exists) would still miss some 2-categorical phenomena.  For instance, the restriction functor
$$\def\Fun{\mathrm{Fun}}\Fun(C^\rhd,D)\to \Fun(C,D)$$
is a Cartesian fibration, and its fiber over a functor $f\colon C\to D$ is equivalent to the slice $D_{f/}$.  Thus this is classified by some functor $\Fun(C,D)^{\mathrm{op}}\to \mathrm{Cat}_\infty$, so that "$(f\to f') \mapsto (D_{f'/}\to D_{f/})$".  Has this been studied anywhere?
 A: I can't speak directly to the $\infty$-categorical version, but I can say something about the 2-categorical phenomena, which may suggest an approach to the $\infty$-categorical question.
The general 2-categorical notion of "slice" is the comma category $(g/h)$ for a cospan of functors $X \overset{g}{\to} Z \overset{h}{\leftarrow} Y$.  The usual slice category over an object $z\in Z$ is the comma category $(1_Z/\kappa_z)$ for the cospan $Z \to Z \leftarrow 1$.  Your slice construction is the comma category $(\kappa_f / \kappa)$ for the cospan $1 \to \mathrm{Fun}(C,D) \leftarrow D$.
In general, the comma category is functorial on lax/colax morphisms of cospans: given cospans $X \overset{g}{\to} Z \overset{h}{\leftarrow} Y$ and $X' \overset{g'}{\to} Z' \overset{h'}{\leftarrow} Y'$ with $r:X\to X'$, $s:Y\to Y'$, and $t:Z\to Z'$ with transformations $h' s \Rightarrow t h$ and $s g \Rightarrow g' r$, there is an induced functor $(g/h) \to (g'/h')$.
In particular, given your $j$ and $p$, we have $s = \mathrm{Fun}(j,p) : \mathrm{Fun}(C,D) \to \mathrm{Fun}(C',D')$, with $r=1$ and $t=p$ and the two squares commuting strictly, which induces the functoriality you mention.
Finally, your additional 2-categorical phenomenon comes from the comma category of the cospan $\mathrm{Fun}(C,D) \to \mathrm{Fun}(C,D) \leftarrow D$, which is precisely $\mathrm{Fun}(C^{\rhd},D)$.  (This can be explained by the facts that $C^{\rhd}$ is the cocomma object of the span $1 \leftarrow C \to C$, and the representable $\mathrm{Fun}(-,D)$ turns cocommas into commas.)  The two projections of a comma category are always a fibration and an opfibration respectively; and since a comma square can be pasted with a pullback square to yield another comma square, it follows that the fiber of this fibration over some $f\in \mathrm{Fun}(C,D)$ is the comma category of $1\to \mathrm{Fun}(C,D)\leftarrow D$, i.e. your original slice construction.
As I said, I can't speak directly to the $\infty$-categorical version, but this all seems sufficiently abstract that it should be reproducable verbatim in a suitably formal framework for $\infty$-category theory, like a Riehl-Verity $\infty$-cosmos.
A: Here is something which seems like a plausible description of ??. Let $\mathrm{RFib} \subseteq \mathrm{Ar}(\mathrm{Cat}_{\infty})$ be the full subcategory of the arrow category of $\mathrm{Cat}_{\infty}$ spanned by the right fibrations, and consider its twisted arrow category $\mathrm{Tw}(\mathrm{RFib})$. We may describe the objects of $\mathrm{Tw}(\mathrm{RFib})$ as squares
$$ 
\begin{array}
& \tilde{\mathcal{C}} & \to & \tilde{\mathcal{D}} \\
\downarrow & & \downarrow \\
\mathcal{C} & \to & \mathcal{D} \\
\end{array}
$$
whose vertical arrows are right fibrations. Note that the target projection $\mathrm{RFib} \to \mathrm{Cat}_{\infty}$ is both a cartesian and a cocartesian fibration (right fibrations are closed under base change and can be pushed forward by post-composing and taking the right fibration freely generated from the resulting arrow). It then follows $\mathrm{Tw}(\mathrm{RFib}) \to \mathrm{Tw}(\mathrm{Cat}_{\infty})$ is a cocartesian fibration. The transition functors involve base changing the right fibration $\tilde{\mathcal{C}} \to \mathcal{C}$ and pushing forward the right fibration $\tilde{\mathcal{D}} \to \mathcal{D}$.
Let $\mathcal{E} \subseteq \mathrm{Tw}(\mathrm{RFib})$ be the full subcategory spanned by those squares as above for which $\tilde{\mathcal{C}} \to \mathcal{C}$ is an equivalence and $\tilde{\mathcal{D}}$ has a terminal object (in other words, $\tilde{\mathcal{D}} \to \mathcal{D}$ is representable in $\mathcal{D}$). Since equivalences are preserved under base change and representable right fibrations are closed under push forward the map $\mathcal{E} \to \mathrm{Tw}(\mathrm{Cat}_{\infty})$ is still a cocartesian fibration. Inspecting the fiber over an arrow $f\colon\mathcal{C} \to \mathcal{D}$ its objects consist of a choice of a representable right fibration $\tilde{\mathcal{D}} \to \mathcal{D}$ (equivalently, an object $d \in \mathcal{D}$), and a lift of $f$ to $\tilde{f}\colon \mathcal{C} \to \tilde{\mathcal{D}} \simeq \mathcal{D}_{/d}$, which amounts to a cone over $f$ with cone point $d \in \mathcal{D}$. The transition functors of this cocartesian fibration also seem to be what one would expect from ??.
A: The cocone category can be constructed by the pullback of $\infty$-categories
$$ \require{AMScd} \begin{CD}
C_{F/} @>>> C^{J^\triangleright}
\\ @VVV @VVV
\\  1 @>F>> C^J
\end{CD} $$
I assert such diagrams can be parametrized by as the comma category $(1 \downarrow \mathrm{Fun})$. The pullback defining this comma category can be factored into
$$ \begin{CD}
(1 \downarrow \mathrm{Fun}) @>>> \infty \mathrm{Cat}^{\Lambda^2_2}
@>>> \infty \mathrm{Cat}^{[1]}
\\ @VVV @VVV @VVV
\\ \infty \mathrm{Cat}^{\mathrm{op}} \times \infty \mathrm{Cat}
@>1 \times R>> \infty \mathrm{Cat} \times \infty \mathrm{Cat}^{[1]}
@>\mathrm{id} \times \mathrm{ev}_1>> 
\infty \mathrm{Cat} \times \infty \mathrm{Cat}
\end{CD} $$
where $R$ sends $(J, C)$ to the arrow $C^{J^\triangleright} \to C^J$.
The left fibration $(1 \downarrow \mathrm{Fun}) \to \infty \mathrm{Cat}^{\mathrm{op}} \times \infty \mathrm{Cat}$ is classified by the functor $(J, C) \mapsto \infty \mathrm{Cat}(1, \mathrm{Fun}(J, C))$, so we have $(1 \downarrow \mathrm{Fun}) \simeq \mathrm{Tw}(\infty \mathrm{Cat})$, since the latter classifies $(J,C) \mapsto \infty \mathrm{Cat}(J, C)$.
Then, the map $\mathrm{Tw}(\infty \mathrm{Cat}) \to  \infty \mathrm{Cat}^{\Lambda^2_2}$ converts an object $F : J \to C$ into the corresponding cospan depicted above. So applying the pullback functor gives the conjectured functor
$$ \mathrm{Tw}(\infty \mathrm{Cat}) \to  \infty \mathrm{Cat}
: [F : J \to C] \mapsto C_{F/} $$
