Bug
GitStateMonitor.takeDelta() takes a snapshot and diffs against the previous one in a single call. This means the delta includes everything that changed since the last call -- including the agent's own commits, file edits, and tool use from the previous turn.
The agent sees its own work reported back as if the human did it.
Root cause
The API is takeDelta() which combines snapshot + diff into one operation, called once per loop iteration before the query. There is no separate post-query snapshot, so the baseline always includes whatever state existed at the start of the previous query, not at the end of it.
Expected behaviour
Two separate operations:
takeSnapshot() -- called after the agent finishes a query, capturing post-agent state as the baseline
getDelta() -- called before the next query, diffing against that baseline to capture only human activity between turns
This was the original requirement: snapshot before and after the query so the delta isolates human changes.
Introduced in
Commit 259e987 (PR #225, "Coworking mode: git state delta between turns"). Pre-existing, not caused by the SDK refactor.
Impact
Every turn after the first, the system reminder includes a <system-reminder> block describing the agent's own file changes, commits, branch switches, etc. as if they were external human activity. This is misleading context that wastes tokens and could confuse the model.
Bug
GitStateMonitor.takeDelta()takes a snapshot and diffs against the previous one in a single call. This means the delta includes everything that changed since the last call -- including the agent's own commits, file edits, and tool use from the previous turn.The agent sees its own work reported back as if the human did it.
Root cause
The API is
takeDelta()which combines snapshot + diff into one operation, called once per loop iteration before the query. There is no separate post-query snapshot, so the baseline always includes whatever state existed at the start of the previous query, not at the end of it.Expected behaviour
Two separate operations:
takeSnapshot()-- called after the agent finishes a query, capturing post-agent state as the baselinegetDelta()-- called before the next query, diffing against that baseline to capture only human activity between turnsThis was the original requirement: snapshot before and after the query so the delta isolates human changes.
Introduced in
Commit
259e987(PR #225, "Coworking mode: git state delta between turns"). Pre-existing, not caused by the SDK refactor.Impact
Every turn after the first, the system reminder includes a
<system-reminder>block describing the agent's own file changes, commits, branch switches, etc. as if they were external human activity. This is misleading context that wastes tokens and could confuse the model.