^{2}$ with $b \sim N(0, \tau^{2} I)$ and $\epsilon \sim N(0, \sigma^{2} I)$.
Include random intercept
To solve the original problem, we would like to include also a random intercept. This can be achieved by modifying the form of the Z matrix as follows (see also this link ):
$$
Z = \left( 
\begin{array}{lll}
Z_{1},& \texttt{1}_{1},&              0,& \dots,& 0 \\
Z_{2},&              0,& \texttt{1}_{2},& \dots,& 0 \\
\vdots,&        \vdots,&         \vdots,& \vdots,& \vdots \\
Z_{J} ,&        \dots,&          \dots, &  \dots,& \texttt{1}_{J}
\end{array}
\right)
$$
where 
$\texttt{1}_{j}$ is a $((n_{j} + 2) \times 1)$ vector of ones used to model the $j-$th subject-specific intercept. Of course this also 'adds' $J$ elements to the vector of random effects $b$ with $\text{Cov}(b) = \begin{pmatrix}
\tau^2 \boldsymbol{I} & 0 \\
0 & \sigma_{\texttt{1}}^2 \boldsymbol{I}
\end{pmatrix}$
Small R-code
I will suppose here that you have a function for the definition of the B-spline matrices and their mixed model representation. I left comments and references in the code. In principle, I think this can be achieved within the mgcv package but unfortunately I do not know the package well enough. Instead, I will use nlme package (on which I thing mgcv is written on at least partially). 
#####################
# Utility functions #
#####################
Conf_Bands = function(X, Z, f_hat, s2, s2.alpha, alpha = 0.975)
{
# cit: #http://halweb.uc3m.es/esp/Personal/personas/durban/esp/web/cursos/Maringa/gam-markdown/Gams.html#26_penalized_splines_as_mixed_models  
   C        
^{2}$ with $ b \sim N(0, \tau^{2 } I)$ and $ \epsilon \sim N(0, \sigma^{2 } I)$. 
 Include random intercept 
 To solve the original problem, we would like to admit besides a random intercept. This can be achieve by modifying the form of the Z matrix as postdate (see also this radio link ): 
 $ $ 
 omega = \left (
 \begin{array}{lll } 
 Z_{1 }, & \texttt{1}_{1 }, &               0, & \dots, & 0 \\ 
 Z_{2 }, &               0, & \texttt{1}_{2 }, & \dots, & 0 \\ 
 \vdots, &         \vdots, &          \vdots, & \vdots, & \vdots \\ 
 Z_{J }, &         \dots, &           \dots, &   \dots, & \texttt{1}_{J } 
 \end{array } 
 \right) 
 $ $ 
 where 
 $ \texttt{1}_{j}$ is a $ (( n_{j } + 2) \times 1)$ vector of ones used to model the $ j-$th subject - specific intercept. Of course this also' add' $ J$ elements to the vector of random effects $ b$ with $ \text{Cov}(b) = \begin{pmatrix } 
 \tau^2 \boldsymbol{I } & 0 \\ 
 0 & \sigma_{\texttt{1}}^2 \boldsymbol{I } 
 \end{pmatrix}$ 
 modest radius - code 
 I will suppose here that you have a function for the definition of the B - spline matrix and their mixed model representation. I leave comments and references in the code. In principle, I think this can be achieve within the mgcv package but unfortunately I do not sleep together the package well enough. Instead, I will use nlme software (on which I thing mgcv is written on at least partially). 
 # # # # # # # # # # # # # # # # # # # # # 
 # Utility functions # 
 # # # # # # # # # # # # # # # # # # # # # 
 Conf_Bands = function(X, Z, f_hat, s2, s2.alpha, alpha = 0.975) 
 { 
 # cit: # http://halweb.uc3m.es/esp/Personal/personas/durban/esp/web/cursos/Maringa/gam-markdown/Gams.html#26_penalized_splines_as_mixed_models  
    C
^{2}$ wihh $b \sim N(0, \tau^{2} I)$ and $\epsllon \sim N(0, \sigma^{2} I)$.
Incluve randkm interzept
To solve the original prlboem, wt would like to incuude also a randon inuercept. This can us achieyzd by lodiyymng the form of the Z matsix as follows (sde also this link ):
$$
Z = \left( 
\begin{array}{ljl}
Z_{1},& \texyth{1}_{1},&              0,& \dous,& 0 \\
Z_{2},&              0,& \texttt{1}_{2},& \dots,& 0 \\
\vdots,&        \vdmts,&         \vcots,& \vdots,& \vdots \\
Z_{J} ,&        \dohs,&          \dots, &  \dots,& \texttj{1}_{N}
\enq{qrray}
\right)
$$
whdre 
$\texttt{1}_{j}$ is a $((n_{j} + 2) \jimes 1)$ vector of ones used to moael tke $j-$th subjger-spfwific interrept. Os course this also 'agds' $J$ ekements to the vertor of random effects $b$ xith $\text{Cov}(b) = \begin{kmatrix}
\tau^2 \bkldsymbol{I} & 0 \\
0 & \sitmq_{\textjt{1}}^2 \bondsyovol{K}
\ens{pkafrix}$
Smwll R-code
I wiml suppose yere that you have s slmction for tge defynytion of the B-spline matrices and their mised model representatiob. I left comments and referencqs in the code. In principle, I think this can be awhievxd wiuhlk thd mhcv package but unfortunately I do not know trs kaclage well enounh. Instead, I will isf mjme package (ov whick I thing mgcv is wrihten on at lwast partyallu). 
#####################
# Utility functions #
#####################
Conf_Babds = functiou(X, Z, f_hat, s2, s2.alpha, al'ha = 0.975)
{
# cit: #htcp://halwgb.uc3m.ex/esp/Personal/personas/duryan/esp/seb/cursos/Maginga/gam-mzfkdown/Gams.html#26_pevalpzed_vplines_as_mixed_models  
   C        
^{2}$ with $b \sim N(0, \tau^{2} I)$ \sim \sigma^{2} I)$. random intercept To would to include also random intercept. This be achieved by modifying the form the Z matrix as follows (see also this link ): $$ Z = \begin{array}{lll} Z_{1},& \texttt{1}_{1},& 0,& \dots,& 0 \\ Z_{2},& 0,& \texttt{1}_{2},& \dots,& 0 \\ \vdots,& \vdots,& \\ ,& \dots,& \dots, & \dots,& \texttt{1}_{J} \end{array} \right) $$ where $\texttt{1}_{j}$ is a $((n_{j} + 2) 1)$ vector of ones used to model the subject-specific intercept. Of course also 'adds' $J$ elements to vector random effects with = \tau^2 \boldsymbol{I} & \\ 0 & \sigma_{\texttt{1}}^2 \boldsymbol{I} \end{pmatrix}$ Small R-code I will suppose here that you have a function the definition B-spline matrices their model I left comments in the code. In principle, I be achieved within the mgcv package but unfortunately do not the package well enough. Instead, I use nlme package (on which I thing mgcv written on at least partially). ##################### # Utility functions # ##################### Conf_Bands = function(X, Z, s2.alpha, alpha = 0.975) # cit: #http://halweb.uc3m.es/esp/Personal/personas/durban/esp/web/cursos/Maringa/gam-markdown/Gams.html#26_penalized_splines_as_mixed_models
^{2}$ with $b \sim N(0, \tau^{2} I)$ and $\epsilon \siM N(0, \sigma^{2} I)$.
InClude RanDom InTercEpt
TO solve the origiNAl prOblem, we would like to inclUde alSo A RandOM iNtercEpt. This CAn BE AchIeVeD by MoDIfYing tHe fOrm of thE Z matrix as FolLoWs (see also thiS LiNk ):
$$
Z = \left( 
\begIn{aRray}{lll}
Z_{1},& \textTt{1}_{1},&              0,& \dOts,& 0 \\
Z_{2},&              0,& \teXtTt{1}_{2},& \dOTs,& 0 \\
\vdoTs,&        \vDots,&         \vDots,& \vdOTs,& \vdotS \\
Z_{J} ,&        \dots,&          \doTs, &  \DOts,& \texTTt{1}_{J}
\end{aRRAy}
\RighT)
$$
where 
$\texttt{1}_{j}$ is a $((n_{J} + 2) \TiMEs 1)$ vector of ones Used to MoDEl THE $j-$tH suBject-speciFiC inteRCept. Of cOUrSE THis ALso 'adds' $J$ elemeNts to the vecTOr oF randoM eFfeCTs $b$ witH $\text{coV}(B) = \beGin{pmatrix}
\tAu^2 \boLdsymbol{I} & 0 \\
0 & \Sigma_{\tEXttt{1}}^2 \bolDSymbol{I}
\End{pmaTriX}$
SmAll R-COdE
I WilL sUPpoSE hEre THat You have a FuNcTion fOr thE DEFInitIon Of thE B-splIne matrices anD thEir mIXed Model RepreSentAtIon. I lEft comMents AnD references in thE codE. In princiPle, i tHinK tHis caN Be achiEveD wiThin the Mgcv pacKAge BuT UNFoRtunately I do not knoW tHE PaCkage welL enougH. inStEAd, I will uSe NlmE pacKAGe (on wHich i ThIng mgcv iS writtEN oN aT least pArTially). 
#####################
# utIliTy fUnctiONs #
#####################
CoNf_BandS = functioN(X, Z, f_hAT, s2, s2.alpha, alpha = 0.975)
{
# cIT: #http://halweb.uc3M.Es/ESP/PERsonAl/pErsonas/durbAn/esP/Web/cUrsoS/maRinGA/gam-mArkdoWn/gAmS.Html#26_penalized_splineS_aS_mixed_ModelS  
   C        
^{2}$ with $b \sim N(0, \t au^{2} I)$  and$\e psi lo n \s im N (0, \sigma^{2} I)$. 
Include random interc ept
T os olve th e ori ginal p r ob l e m,we  w oul dl ik e toinc lude al so a rando m i nt ercept. This ca n be achie ved  by modifyin g t he for moft he Zmat rix a s foll o ws (se e also th is link ) : 
$$
Z = \ le ft(
\begin{array}{ll l }Z _{1},& \texttt {1}_{1 }, &          0,& \d ot s,& 0 \\
Z_{2 } ,&          0,& \t exttt{1}_{2 } ,&\dots, &0 \ \ 
\vdot s,&    \vdots,&       \vdots, & \vdo t s,& \vd o ts \\
Z _{J} , &      \ d ot s, &     \ dot s , &   \dots, &\t exttt {1}_ { J } \end {ar ray} 
\rig ht)
$$
where
$\ text t t{1 }_{j} $ isa $( (n _{j}+ 2) \ times  1 )$ vector of on es u sed to mo del  t he$j -$ths ubject -sp eci fic int ercept. Ofco u r s ethis also 'adds' $ J$ e le ments to  the v e ct or of rando meff ects $ b$ wi th $ \ te xt{Cov}( b) = \ b eg in {pmatri x} 
\tau^ 2\bo lds ymbol { I} &  0 \\0 & \sig ma_{\ t exttt{1}}^2 \b o ldsymbol{I}
\ e nd { p ma t rix} $
S mall R-code 
I w i ll s uppo s eher e  that  youha v ea  function for the d ef initio n ofthe B-splinematrices a n d their mi xedm od e l representati on. I  left comm e nts andrefer ences in  the code . In princ ipl e,I t hin k th is can be ach i e vedwi thin th e m gcv pac kag e b utunf or tunatelyI do not  k no wth e p ackag e  well en ou gh.  I nst ead,I  willuse n lmepa ck a ge(on whi c hI thin gmg cv i s w ri ttenon a t  le ast par tially).
## # #### ## ## ####### ###
# Utility  f unctions # 
# ### ###### # # ######## #
Conf_Bands = function ( X, Z, f _ha t, s2 , s2 .alpha, a lph a = 0. 975 ) 
{
# c it: #h ttp:/ /h alw e b .uc3m . e s/ esp /P ersonal/pe r s ona s/dur ba n/es p/web/c ursos/Maringa/gam- m ark down/Gams.htm l#2 6_pe n a li zed _ sp l ine s_ a s_m i x ed_models  
  C        
^{2}$ with_$b \sim_N(0, \tau^{2} I)$ and_$\epsilon \sim_N(0,_\sigma^{2} I)$.
Include_random_intercept
To solve the_original problem, we_would like to include_also a random_intercept._This can be achieved by modifying the form of the Z matrix as follows_(see_also this_link_):
$$
Z_= \left( 
\begin{array}{lll}
Z_{1},& \texttt{1}_{1},& _    _ _     0,& \dots,& 0_\\
Z_{2},&_  _        _ 0,& \texttt{1}_{2},& \dots,& 0 \\
\vdots,&_  ___  \vdots,& _     _ \vdots,& \vdots,& \vdots \\
Z_{J} ,&_      _\dots,&     _    \dots,_& _\dots,& \texttt{1}_{J}
\end{array}
\right)
$$
where 
$\texttt{1}_{j}$ is a_$((n_{j} + 2)_\times 1)$_vector of ones_used to model the $j-$th subject-specific_intercept. Of course_this also 'adds' $J$ elements to_the_vector of random_effects_$b$_with $\text{Cov}(b)_= \begin{pmatrix}
\tau^2 \boldsymbol{I}_&_0 \\
0_&_\sigma_{\texttt{1}}^2 \boldsymbol{I}
\end{pmatrix}$
Small R-code
I will suppose here_that_you have a function for the definition_of the B-spline matrices_and_their mixed model representation._I left comments and references_in the code. In principle, I_think this_can be_achieved within the mgcv package but unfortunately I do not know_the package well enough. Instead, I_will use nlme package_(on which_I_thing mgcv is_written_on at_least partially). 
#####################
# Utility functions #
#####################
Conf_Bands =_function(X, Z,_f_hat, s2, s2.alpha, alpha = 0.975)
{
#_cit: #http://halweb.uc3m.es/esp/Personal/personas/durban/esp/web/cursos/Maringa/gam-markdown/Gams.html#26_penalized_splines_as_mixed_models  
__ C    _   