I would like to place a mini table of context directly next to the chapter like in the following.
For compatibility reasons the toc should be created using titletoc as suggested in this answer. The tcolorbox in the MWE is not a must.
\documentclass{book}
\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{tcolorbox}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{3}
\begin{document}
\tableofcontents
\chapter{A chapter}
\startcontents[chapters]
\begin{tcolorbox}[width=.5\linewidth]
\printcontents[chapters]{}{1}{}
\end{tcolorbox}
\section{Section}
\lipsum[1]
\section{Section 2}
\lipsum
\chapter{Second chapter}
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
\section{Section}
\lipsum[2]
\section{Another section}
\lipsum
\end{document}


minitocis compatibility with standard class – touhami Feb 10 '16 at 20:35