Bug: Stored memory directives (MEMORY.md) are ignored during fast state processing, causing false infrastructure alerts

Open 💬 2 comments Opened Jun 9, 2026 by adrianocantavenera-collab

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The AI agent completely bypasses and ignores long-term system memory constraints (MEMORY.md / custom context directives) when processing rapid state dumps (e.g., Home Assistant entity states).

Instead of validating the data against the stored memory rules, the system prioritizes processing speed. This leads to critical hallucinations, such as reporting false offline emergencies on physical infrastructure and incorrectly shifting the troubleshooting workload onto the user (asking for manual power cycles), despite explicit stored directives forbidding this behavior.

What Should Happen?

Before generating any troubleshooting steps, system analysis, or hardware conclusions, Claude Code must actively parse and cross-reference the active state dump with the stored constraints inside the system prompt / memory files (MEMORY.md or related project guidelines). Long-term instructions regarding critical infrastructure hardware mapping and verification protocols must take absolute precedence over fast pattern matching.

Error Messages/Logs

Error 1 — Memory Directive Ignored (Critical)
- Directive in Memory: project_piscina_infrastruttura.md — "Pool pump ALWAYS on Ethernet LAN, never WiFi. Never mention WiFi for this device."
- Actual AI Behavior: Analyzed offline devices and stated "Sonoff POOL PUMP offline — the pump might be stopped or in an unknown state — NOT controllable by HA", attributing 2.4 GHz WiFi as the cause.
- Reality: The pump (switch.shellypro1_80f3dac7d8d8, IP 192.168.1.47) was online, powered, and reachable via Ethernet. Status: on, output: true.
- Impact: Communicated a false emergency regarding critical infrastructure (a 90,000-liter swimming pool system).

---
Error 2 — Verification Not Performed Before Answering
- Directive in Memory: feedback_verifica_prima_di_proporre.md — "ALWAYS verify before proposing."
- Actual AI Behavior: Read the "Pool pump" label on switch.sonoff_1001ef24c3 within the state dump and reported it as a fact, without verifying what the actual physical device for the pump was. Note: This exact error had already been committed in previous sessions and was explicitly saved in memory.

---
Error 3 — Physical Workload Shifted to the User Unnecessarily
- Directive in Memory: feedback_non_scaricare_lavoro_utente.md — "Explore ALL software alternatives before declaring that physical intervention is required."
- Actual AI Behavior: Asked the user to perform a physical power cycle on ShellyEM3, ShellyPro1PM, and the Sonoff "pool pump" — the latter being completely false.

Steps to Reproduce

  1. Create a memory directive or add to the system context a rule stating: "Device X is always on Ethernet and never on WiFi. Never tell the user it is offline due to WiFi."
  2. Inject a complex Home Assistant states dump or terminal log where "Device X" is actually online under a specific entity, but a legacy/unused entity with a similar label appears disconnected.
  3. Ask Claude Code to analyze the offline devices and provide a troubleshooting step.
  4. Observe that Claude Code ignores the memory file constraint, hallucinating that Device X is offline via WiFi and immediately suggesting a manual power cycle.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude Sonnet 4.6 (model ID: claude-sonnet-4-6)

Platform

Anthropic API

Operating System

Other

Terminal/Shell

Other

Additional Information

Operating System*
Home Assistant OS (HAOS) running on Intel NUC (x86_64)
Terminal/Shell*
Home Assistant Advanced SSH & Web Terminal Add-on (bash/zsh):
Note on the environment: Claude Code is being executed directly inside the "Advanced SSH & Web Terminal" Add-on of a Home Assistant OS (HAOS) production instance running on an Intel NUC. The system interacts directly with local Home Assistant entities and states via the command line.
Bash(claude --version)
⎿ 2.1.169 (Claude Code)

● Claude Code 2.1.169

(la variabile d'ambiente mostrava 2.1.163, ma il binario effettivo è la 2.1.169 — probabilmente aggiornato dopo l'avvio della sessione).

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗