  Recently, examples of an index theory for KMS states of circle actions were
discovered, \cite{CPR2,CRT}. We show that these examples are not isolated.
Rather there is a general framework in which we use KMS states for circle
actions on a C*-algebra A to construct Kasparov modules and semifinite spectral
triples. By using a residue construction analogous to that used in the
semifinite local index formula we associate to these triples a twisted cyclic
cocycle on a dense subalgebra of A. This cocycle pairs with the equivariant
KK-theory of the mapping cone algebra for the inclusion of the fixed point
algebra of the circle action in A. The pairing is expressed in terms of
spectral flow between a pair of unbounded self adjoint operators that are
Fredholm in the semifinite sense. A novel aspect of our work is the discovery
of an eta cocycle that forms a part of our twisted residue cocycle. To
illustrate our theorems we observe firstly that they incorporate the results in
\cite{CPR2,CRT} as special cases. Next we use the Araki-Woods III_\lambda
representations of the Fermion algebra to show that there are examples which
are not Cuntz-Krieger systems.
