TITLE: How to show twisted complexes over a DG category is again a DG category?
QUESTION [7 upvotes]: In Bondal and Kapranov's paper enhanced triangulated categories, a twisted complex over a DG category $A$ is a set $\{(E_i)_{i\in \mathbb Z}, q_{ij}: E_i\to E_j\}$, where $E_i$ are objects in $A$, equal to zero for almost all $i$, and the $q_{ij}$ are morphisms in $A$ of degree $i-j+1$ satisfying $dq_{ij}+\sum_k q_{kj}q_{ik}=0$.
Let $C=\{E_i,q_{ij}\}$ and $C'=\{E_i', q_{ij}'\}$ be two twisted complexes. Put
$
Hom^k(C,C')=\bigoplus_{l+j-i=k} Hom_A^l(E_i,E_j')
$
and, for any $f\in Hom_A^l(E_i,E_j')$
$df=d_Af+\sum_m (q_{jm}f+(-1)^{l(i-m+1)}fq_{mi}),$
where $d_A$ is the differential of the DG category $A$.
It seems to me that the differential defined on the twisted complexes does not satisfy
$d^2=0$ and the graded Leibniz rule. How do we check it is indeed a well-defined DG category?

REPLY [3 votes]: Hope the answer will be still of some importance.  
Twisted complexes are really not well-defined by Bondal and Kapranov.  
Fernando Muro, in the new category you need to pay attention to the new grading of $f$, which is $k$, but the old Leibniz rule uses the degree $l = k+i-j \neq k$, so Xingting's argument was correct.  
To define twisted complexes well, you need to consider a dg category $A$ and formally add there finite direct sums and shifts. So you obtain the category $A^+$. Then consider an object of the form $(X_1 \oplus \dots \oplus X_n , \alpha)$, such that $X_i \in A^+$, $\alpha \in \mathrm{End}^1 (X_1 \oplus \dots \oplus X_n)$, $\mathrm{d}\alpha + \alpha^2 = 0$ and $\alpha$ is upper-triangular (if $\alpha = (\alpha_{ij})_{1\leq i,j \leq n}$, $\alpha_{ij} \in \mathrm{Hom}^1 (X_i, X_j)$, then $\alpha_{ij}=0$ whenever $i\geq j$). Now everything is fine and you should have obtained in some sense the category $A^+$ with cones. 
Edit: Oops. I've forgotten to define the differential. Suppose there are two objects $(X, \alpha)$ and $(Y, \beta)$ and suppose there is a morphism $f \in \mathrm{Hom} ((X, \alpha),(Y, \beta)) = \mathrm{Hom}_{A^+} (X,Y)$. Then the differential is defined as follows: $df = d_{A^+} f + \beta f - (-1)^{\mathrm{deg}f} f \alpha$. Grading in the Hom-complexes in the category of twisted complexes is the same as that in $A^+$ and the equality $\mathrm d ^2 = 0$ is easily verified. Leibniz rule is now just obvious.