  We investigate the evolution of NOAA Active Region 11817 during 2013 August
10--12, when it developed a complex field configuration and produced four
confined, followed by two eruptive, flares. These C-and-above flares are all
associated with a magnetic flux rope (MFR) located along the major polarity
inversion line, where shearing and converging photospheric flows are present.
Aided by the nonlinear force-free field modeling, we identify the MFR through
mapping magnetic connectivities and computing the twist number $\mathcal{T}_w$
for each individual field line. The MFR is moderately twisted ($|\mathcal{T}_w|
< 2$) and has a well-defined boundary of high squashing factor $Q$. We found
that the field line with the extremum $|\mathcal{T}_w|$ is a reliable proxy of
the rope axis, and that the MFR's peak $|\mathcal{T}_w|$ temporarily increases
within half an hour before each flare while it decreases after the flare peak
for both confined and eruptive flares. This pre-flare increase in
$|\mathcal{T}_w|$ has little effect on the active region's free magnetic energy
or any other parameters derived for the whole region, due to its moderate
amount and the MFR's relatively small volume, while its decrease after flares
is clearly associated with the stepwise decrease in free magnetic energy due to
the flare. We suggest that $\mathcal{T}_w$ may serve as a useful parameter in
forewarning the onset of eruption, and therefore, the consequent space weather
effects. The helical kink instability is identified as the prime candidate
onset mechanism for the considered flares.
