← sources

Rules you say mid-session are the ones the agent forgets

source: reddit (reddit:ClaudeCode)published 2026-10-27 13:25ingested 2026-10-28 02:38

retained text

CLAUDE.md handles the permanent rules fine. The ones that slip are the rules you say once in chat, like "leave the migrations folder alone until the rollout is done". The agent follows it for that session. A few days later, a fresh session or a teammate's instruction walks right through it.

The options I've looked at:

- Have the agent write the rule into CLAUDE.md the moment you say it. Depends on the agent remembering to do it.
- PreToolUse hooks with deny patterns. Good for rm -rf and force pushes, but a pattern can't hold "until the rollout is done" or "unless I say so".
- A rules file with the date and who said it. Better context, but nothing stops the tool call.

The gap seems to be between memory (the agent knows the rule) and enforcement (the call actually gets blocked). Curious how others handle rules that are temporary or come from someone else on the team.

document fetched 2026-10-28 00:40 · canonical https://reddit.com/r/ClaudeCode/comments/1xgsgy5/rules_you_say_midsession_are_the_ones_the_agent