The title "Rehab" gives us the setting, and the rest of the poem seems to unfold inside it, though the poem itself never spells out the circumstances. It opens with a small, odd action: greeting the lock. Treating a lock like someone you say hello to suggests the speaker is making peace with confinement, or at least learning its rules. "I begin to learn" keeps that mood tentative, like a first step.
The middle lines feel more guarded. Wanting "to play a part" hints that the speaker is performing, perhaps acting the cooperative patient while still working out who they really are. It could be a mask, or a way of trying on a healthier self.
The last image is the strangest: "like a mad flag / I slept with pleasure." A flag whipping about wildly, yet sleeping contentedly, captures a restless mind finally finding rest. The mood is quiet, wary, and slightly dazed, with a thread of relief running underneath. The poem's gaps are part of its effect, since the speaker reveals only fragments.