You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So with the ability to analyze in more depth the way in which Claude Code loads up and treats things in it's context/memory, I've come across something extremely important I think. What is loaded by a SessionStart hook is inherently not kept/treated any differently than any other user input. So long sessions, compaction, etc all serve to cause those steering rules to not really be paid attention to by the agent.
However, ~/.claude/CLAUDE.md is specifically delegated to by the Operator (e.g. Claude Code as the operator), and is given privileged position at the start of the context, and is also preserved as-is through compaction. There is also @import which allows referencing external files for inlining, to allow composition of CLAUDE.md from multiple files.
As such, I've gone ahead and modified my own installation as per the instructions at the Gist below. I've found it to be VERY successful, even with >600K context it was obeying my preferences/rules, not running ahead with beginning implementation before done with discussion, etc.
There's some significant background and analysis in the Gist, but go to section 6 if you want to just get to modifying your own installation.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
So with the ability to analyze in more depth the way in which Claude Code loads up and treats things in it's context/memory, I've come across something extremely important I think. What is loaded by a
SessionStarthook is inherently not kept/treated any differently than any other user input. So long sessions, compaction, etc all serve to cause those steering rules to not really be paid attention to by the agent.However,
~/.claude/CLAUDE.mdis specifically delegated to by the Operator (e.g. Claude Code as the operator), and is given privileged position at the start of the context, and is also preserved as-is through compaction. There is also@importwhich allows referencing external files for inlining, to allow composition ofCLAUDE.mdfrom multiple files.As such, I've gone ahead and modified my own installation as per the instructions at the Gist below. I've found it to be VERY successful, even with >600K context it was obeying my preferences/rules, not running ahead with beginning implementation before done with discussion, etc.
There's some significant background and analysis in the Gist, but go to section 6 if you want to just get to modifying your own installation.
Gist: https://gist.github.com/Drizzt321/a4c567f0d263701152bf4e13c17855f1
Beta Was this translation helpful? Give feedback.
All reactions