Suppose I have a document looking like this:

\documentclass{article}
\begin{document}

\tableofcontents

\section{A}
\subsection{A.A}    \subsection{A.B}
\section{B}
\subsection{B.A}    \subsection{B.B}

\end{document}


I would like to add a short summary for each section, and produce a second table of contents after the first one, that would include this summary. The end result could look like this:

Contents

Summary
1 A

2 B

[rest of the document]

Obviously I can achieve the result by hand, but I'd rather not. For example it would be great if I could put the summary at the beginning of the section (in the code) and have it automatically be put in the "summary toc" at the right place.

Bonus question: I'd like to do all of that with a KOMA-script class. So if possible, no memoir-specific magic should be used.

You can do these things with etoc:

Note: for an elaboration (incorporating the remark below) of the technique see my answer to Expanded toc-like environment

Remark: The code below defines a command \sectionsummary which ultimately writes things to the .toc file. It thus has the same difficulties with fragile commands that the \section command has. To get the material given as argument to \sectionsummary find its way unexpanded to the .toc file, one can use the following which uses the e-TeX primitive \unexpanded.

\newcommand*{\sectionsummary}[1]%
{\etoctoccontentsline{sectionsummary}{\unexpanded{\unexpanded{#1}}}}


With this variant, material given as argument to \sectionsummary will only get expanded when the Summary gets typeset.

\documentclass{scrartcl}
\usepackage{etoc}
\etocsetlevel {sectionsummary}{6}

\newcommand*{\sectionsummary}[1]{\etoctoccontentsline{sectionsummary}{#1}}

\begin{document}

\tableofcontents

\etocsettocstyle {\bigskip\noindent\bfseries\sffamily\Large
Summary\par\normalfont\normalsize}{}

% section headings exactly as in the standard TOC
\makeatletter
\let\original@l@section\l@section
\etocsetstyle {section}{}{}% cf etoc manual, "Another compatibility mode"
{\original@l@section{\numberline{\etocnumber}\etocname}{\etocpage}}{}
\makeatother

% now setting a style to print the summaries:
\etocsetlevel {sectionsummary}{2}
\etocsetstyle {sectionsummary}{\parindent1.5em\normalfont}
{\etocname}{\par}{\medskip}

% subsections a priori at level 2, need to be moved out of the way
\etocsetlevel {subsection}{6}

\etocsettocdepth {sectionsummary}
\tableofcontents
% can be located anywhere in the document.
% (but if before the main TOC, or before some other TOC, put everything in a
% group, to limit the scope of our style changes)

\section{A}
\sectionsummary{Oh, and I forgot to say that also.}% another paragraph.

Hello
\subsection{A.A}
Hello

\subsection{A.B}
Hello

\section{B}

\subsection{B.A}    \subsection{B.B}

\end{document}