Skip to content

tell the stop gate that already-stored is a valid outcome - #35

Merged
ayushcodes10 merged 1 commit into
mainfrom
fix/stop-gate-already-stored
Sep 2, 2026
Merged

tell the stop gate that already-stored is a valid outcome#35
ayushcodes10 merged 1 commit into
mainfrom
fix/stop-gate-already-stored

Conversation

@ayushcodes10

Copy link
Copy Markdown
Owner

Found by the gate firing on itself, one hour after #33 shipped.

What happened

The Stop hook fired on the two memory files this session had just written. Its reason offered exactly two ways out:

Write what the file actually says... If a file genuinely holds nothing durable, mark it done and say so.

Neither was true. The facts were already in the graphwrite_episode ran earlier in the same session, before the files existed, which is exactly what the MCP tool description asks for ("call write_episode IN THE SAME TURN whenever...").

An agent following that text literally writes the facts a second time.

Why it matters more than it looks

This is not a corner case, it is the documented happy path. write_episode in the turn the thing happens, then Claude Code writes its own memory file — so every well-behaved session ends with a queued file whose content is already stored. The gate would fire on correct behaviour, every time, and ask for duplicates.

That is precisely the failure mode the three bounds in #33 exist to avoid. A gate people switch off protects nothing.

The change

The reason now names three outcomes, all ending in marking the file done:

  1. write what the file says
  2. already called write_episode for it — check nothing is missing, mark it done, do not write it twice
  3. genuinely holds nothing durable — mark it done and say so

Testing

13 pass, including a new one pinning outcome 2 in the reason text.

The gate fired on the two memory files this session had just written, and its
reason offered exactly two ways out: write the facts, or declare the file holds
nothing durable. Neither was true. The facts were already in the graph -
write_episode ran earlier in the same session, before the files existed, which
is what the MCP tool description asks for.

An agent following that text literally writes the facts a second time. And this
is not a corner case: the documented workflow is write_episode in the turn the
thing happens, and Claude Code then writes its own memory file, so every
well-behaved session ends with a queued file whose content is already stored.
A gate that fires on correct behaviour and then asks for duplicates is a gate
people switch off, which was the one failure mode the bounds exist to avoid.

The reason now names three outcomes, all ending in marking the file done.
@ayushcodes10
ayushcodes10 merged commit e92ced9 into main Sep 2, 2026
2 checks passed
@ayushcodes10
ayushcodes10 deleted the fix/stop-gate-already-stored branch September 2, 2026 04:53
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant