claude-code - 💡(How to fix) Fix Document that auto-memory rules are advisory; "always do X at boundary Y" workflow constraints require hooks or skill-level gates, not memory entries [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56383Fetched 2026-05-06 06:29:34
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Code Example

# Wrong: this won't enforce
# (saved as feedback memory)
"At every wrap-up, paperwork must be merged to main same-session."

# Right: this enforces
# (saved as ~/.claude/scripts/paperwork-on-main-check.sh + skill mandatory step)
[script that exits 1 if drift detected; called from /kk-wrap-up final step]
RAW_BUFFERClick to expand / collapse

Description

When a user saves a feedback/preference memory like "After every wrap-up, paperwork updates must be pushed to main", that memory is loaded in every session's auto-memory context. The user reasonably believes the rule will be enforced.

It is not. Memory is advisory. The model may acknowledge the rule, may even cite it, and still proceed to violate it under perceived time pressure or workflow friction.

In a real RISM project case, this exact rule was active for 13 consecutive sessions and failed all 13 times. Each session's bootstrap pointed at the same paperwork branch, paperwork accumulated, and the rule was never enforced. Net effect: 13 sessions of drift before the user noticed.

Expected behavior

Claude Code's documentation should clearly distinguish three categories of user rules:

  1. Preference memories (use auto-memory): "I prefer concise responses," "I write Swift not Python," "default to Sonnet for paperwork."
  2. Project context memories (use auto-memory or CLAUDE.md): facts about the user, project conventions, file paths.
  3. Workflow enforcement rules (use hooks or skill-level gates, NOT memory): "always do X at boundary Y," "never edit Z files directly," "wrap-up cannot complete until W."

For category #3, the docs should explicitly recommend hooks (PreToolUse, PostToolUse, SessionEnd) or skill-level mandatory steps that exit non-zero on violation. The update-config skill should detect when a user is saving a category-3-shaped rule and prompt: "this looks like a workflow enforcement rule. Memory is advisory; would you like to scaffold a hook for mechanical enforcement?"

Actual behavior

The auto-memory documentation does not draw this distinction. New users (and even experienced users) save "always do X" rules to memory expecting enforcement. They don't get it.

Real-world example

User saved memory: "After updates, all project documents must be pushed to main." Saved at Session 76. Active for Sessions 77-88 (13 sessions) without enforcement. Each session, the memory was loaded, Claude acknowledged it, then a wrap-up landed paperwork on a side branch without pushing to main.

Fix required: the user had to build a paperwork-on-main-check.sh script + add Step 6b mandatory gate to /kk-wrap-up skill + add Step 0 gate to /kk-coding skill. Memory was never the right enforcement layer.

Reproduction steps

  1. Save a feedback memory: "At every wrap-up, run the linter before commit."
  2. Run a session that ends with /kk-wrap-up (or any wrap-up flow).
  3. Observe: Claude may or may not run the linter. Memory does not enforce.
  4. Compare to a PreToolUse hook on Bash matching git commit that runs the linter — that DOES enforce.

Environment

  • Claude Code CLI all versions
  • Auto-memory feature

Severity

Medium. Not a correctness bug — memory works as designed (advisory). But the design is undocumented in a way that erodes user trust. Users save rules expecting enforcement and feel betrayed when they're violated.

Suggested fix scope

Documentation-only:

  1. Add a new docs page: "Memory vs Hooks vs Skills — when to use each."
  2. Cross-link from update-config docs and auto-memory docs.
  3. Optional: detect category-3-shaped memory writes (regex on "always|never|every time|at <event>|before <action>") and surface a soft prompt: "this looks like a workflow rule. For mechanical enforcement, consider a hook."

Suggested example to include in docs

# Wrong: this won't enforce
# (saved as feedback memory)
"At every wrap-up, paperwork must be merged to main same-session."

# Right: this enforces
# (saved as ~/.claude/scripts/paperwork-on-main-check.sh + skill mandatory step)
[script that exits 1 if drift detected; called from /kk-wrap-up final step]

Real-world severity evidence

The user lost ~30-60 minutes catching up on 13 sessions of drifted state. Memory had been doing nothing for that entire period. The cost of NOT having clarity in the docs is paid in user time and trust.

extent analysis

TL;DR

To fix the issue, update the documentation to clearly distinguish between preference memories, project context memories, and workflow enforcement rules, and provide guidance on using hooks or skill-level gates for mechanical enforcement.

Guidance

  • Update the auto-memory documentation to explicitly state that memory is advisory and does not enforce rules.
  • Add a new documentation page "Memory vs Hooks vs Skills — when to use each" to provide clear guidance on when to use each feature.
  • Consider adding a soft prompt to the update-config skill to detect category-3-shaped memory writes and suggest using a hook for mechanical enforcement.
  • Provide examples in the documentation to illustrate the correct use of hooks and skill-level gates for workflow enforcement rules.

Example

# Wrong: this won't enforce
# (saved as feedback memory)
"At every wrap-up, paperwork must be merged to main same-session."

# Right: this enforces
# (saved as ~/.claude/scripts/paperwork-on-main-check.sh + skill mandatory step)
#!/bin/bash
if [ -n "$(git status --porcelain)" ]; then
  echo "Paperwork is not merged to main"
  exit 1
fi

Notes

The suggested fix is documentation-only, and the changes should be applied to the Claude Code CLI documentation. The example provided is a simple script that checks if there are any uncommitted changes and exits with a non-zero status code if so.

Recommendation

Apply the suggested documentation changes to clearly distinguish between preference memories, project context memories, and workflow enforcement rules, and provide guidance on using hooks or skill-level gates for mechanical enforcement. This will help users understand the limitations of memory and use the correct features for their needs.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Claude Code's documentation should clearly distinguish three categories of user rules:

  1. Preference memories (use auto-memory): "I prefer concise responses," "I write Swift not Python," "default to Sonnet for paperwork."
  2. Project context memories (use auto-memory or CLAUDE.md): facts about the user, project conventions, file paths.
  3. Workflow enforcement rules (use hooks or skill-level gates, NOT memory): "always do X at boundary Y," "never edit Z files directly," "wrap-up cannot complete until W."

For category #3, the docs should explicitly recommend hooks (PreToolUse, PostToolUse, SessionEnd) or skill-level mandatory steps that exit non-zero on violation. The update-config skill should detect when a user is saving a category-3-shaped rule and prompt: "this looks like a workflow enforcement rule. Memory is advisory; would you like to scaffold a hook for mechanical enforcement?"

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Document that auto-memory rules are advisory; "always do X at boundary Y" workflow constraints require hooks or skill-level gates, not memory entries [1 participants]