claude-code - 💡(How to fix) Fix [BUG] Claude Code agent ignores CLAUDE.md / project directives, leading to real-money loss [2 comments, 3 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#54823Fetched 2026-04-30 06:34:57
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×2subscribed ×1

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

Read the directive in directives/ before acting (Layer 1 = source of truth) Route through deterministic execution scripts rather than improvising Self-anneal on errors before patching live execution code In a single session, the agent:

RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

I'm running a Claude Code agent in a DeFi yield farming project (3-layer architecture: directives → orchestrator → executions). The project's CLAUDE.md and an explicit user-prompt-submit hook re-inject the rules every turn, instructing the agent to:

Read the directive in directives/ before acting (Layer 1 = source of truth) Route through deterministic execution scripts rather than improvising Self-anneal on errors before patching live execution code In a single session, the agent:

Never opened the master strategy directive at directives/defi-yield-farming-rebalancing-agent-strategy.md despite being told to in CLAUDE.md, until the user explicitly forced it after multiple failures Modified the live executions/executor/sickle_executor.py (which sends real on-chain transactions moving real funds) without dry-run, preflight gas check, or proof of swap-path — directly contradicting directive §3.3 step 3 The change burned a real LP NFT (base_aerodrome_68634850, RECALL/USDC on Aerodrome), stranding ~$104 of single-sided RECALL in the EOA A separate position on BSC was also damaged in the same session for related reasons (gas-budget exhaustion mid-multistep) The agent acknowledged the failure each time but repeated the same root behavior (acting as a coder rather than as the orchestrator the architecture defines) on subsequent turns. The CLAUDE.md re-injection on every prompt did not prevent the regression.

Repro pattern: any project where CLAUDE.md is heavy on architectural rules and the agent has tools that move real assets. The agent treats CLAUDE.md as background noise rather than binding instructions, especially under time pressure / "fix this" prompts.

Suggested investigation areas:

Why repeated CLAUDE.md injection isn't enforcing the documented workflow Whether the agent should refuse-by-default on irreversible operations (exit(), move(), signed txs) until preconditions are explicitly verified A standard "fiduciary mode" guardrail for projects with on-chain or financial side effects

2.1.116 (Claude Code)

What Should Happen?

It should read the Claude.md file and not ignore it for starters

Error Messages/Logs

Steps to Reproduce

I dont know its random

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

I reported this months ago on another projects and you just closed it

Claude Code Version

2.1.116 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

No response

extent analysis

TL;DR

The agent's failure to follow the documented workflow in CLAUDE.md, particularly under time pressure, suggests a need for a "fiduciary mode" guardrail to enforce binding instructions and prevent irreversible operations without explicit verification.

Guidance

  • Investigate why repeated CLAUDE.md injection isn't enforcing the documented workflow, focusing on the agent's interpretation of architectural rules.
  • Consider implementing a default refusal mechanism for irreversible operations (e.g., exit(), move(), signed transactions) until preconditions are explicitly verified.
  • Explore the development of a standard "fiduciary mode" for projects with on-chain or financial side effects to ensure the agent treats CLAUDE.md as binding instructions rather than background noise.
  • Review the agent's behavior under time pressure and "fix this" prompts to understand how it deviates from the intended workflow.
  • Evaluate the necessity of a dry-run, preflight gas check, or proof of swap-path before executing transactions that move real funds.

Notes

The issue seems to stem from the agent's prioritization of rapid execution over adherence to the documented workflow, especially in high-pressure situations. The lack of explicit verification for preconditions before executing irreversible operations exacerbates the problem.

Recommendation

Apply a workaround by implementing a "fiduciary mode" guardrail to enforce the agent's adherence to CLAUDE.md instructions, particularly for projects involving real assets, until a more permanent solution can be integrated into the agent's core functionality.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING