I changed inside \DeclareExerciseEnvironmentTemplate{custom}{...}
\IfInsideSolutionF{\rule{1.2cm}{1pt}\slash}%
to
\IfInsideSolutionF{\noindent\usekomafont{sectioning}\color{pointscolor}}
and I used a method for calculating sums of points from here https://tex.stackexchange.com/a/494468/46023
why do I get several vertical shifts here?
\documentclass[]{scrartcl}
%\usepackage[ngerman]{babel}
\usepackage{xcolor}
\colorlet{pointscolor}{blue}
\usepackage[showframe,
left=2cm,
right=4cm,
marginparwidth=2.125cm,
]{geometry}
\usepackage{calc}
\usepackage{xsim}
%\xsimsetup{
%% clear-aux,
% solution/print = false,
% grading-table/template = default,
% grading-table/type = exercise,
%}
\newcounter{expoints}
\newcommand{\addpts}[1]{%
\addtocounter{expoints}{#1}%
\SetExpandedExerciseProperty{points}{\theexpoints}%
\marginpar[]{\color{pointscolor}\points{#1}}%
}
\xsimsetup{
exercise/pre-hook ={\setcounter{expoints}{0}}
}
\makeatletter
\DeclareExerciseEnvironmentTemplate{custom}{%
\GetExerciseHeadingF{\subsection*}%
{%
\XSIMmixedcase{\GetExerciseName}\nobreakspace
\GetExerciseProperty{counter}%
\IfInsideSolutionF
{%
\GetExercisePropertyT{subtitle}
{ {\normalfont\itshape\PropertyValue}}%
}%
}
\GetExercisePropertyT{points}
{%
\marginpar
{%
\IfInsideSolutionF{\noindent\usekomafont{sectioning}\color{pointscolor}}% \rule{1.2cm}{1pt}\slash
\printgoal{\PropertyValue}
\GetExercisePropertyT{bonus-points}{~(+\printgoal{\PropertyValue})
}%
~\XSIMtranslate{points}% point-abbr
}%
}%
}
{\par}
\makeatother
\xsimsetup{
exercise/template = custom ,
solution/template = custom
}
\begin{document}
% \gradingtable
\begin{exercise}[subtitle=aaa]
\begin{enumerate}
\item subquestion 1 \addpts{2}
\item subquestion 2 \addpts{3}
\item subquestion 3 \addpts{5}
\end{enumerate}
\end{exercise}
\begin{exercise}[points=7]
another exercise
\end{exercise}
\begin{exercise}
\begin{enumerate}
\item subquestion 1 \addpts{1}
\item subquestion 2 \addpts{2}
\item subquestion 3 \addpts{3}
\end{enumerate}
\end{exercise}
\end{document}


xsimcorrectly adds the points with\addpointsthe the sum of points of the exercise, see the discussion here: https://github.com/cgnieder/xsim/issues/58 – cgnieder Feb 29 '20 at 18:54