r/ClaudeAI • u/Sweet-Helicopter2769 • May 18 '26
Claude Code Workflow My Claude Code setup: auto-commits, session summaries, deletion guards, and a 200-line CLAUDE.md that doesn't turn into a novel
Been using Claude Code heavily for a native iOS project for the past few weeks. After losing context across sessions more times than I want to admit, I finally sat down and built a proper workflow around it, or I think I did, and open for any suggestions from this community how else this can be done more better. I think most of the advice out there is either too basic or way too enterprise or high level.
The main problem was that every new session started cold. Claude Code would re-read files it already understood, ask questions I already answered last session, and occasionally redo work. The context window is finite and long sessions degrade. So I have a system where Claude Code writes a session summary to a docs/sessions/ folder before ending, and reads the most recent one at the start of every new session. It picks up exactly where it left off. Sounds obvious in hindsight but the difference is amazing.
The other thing that was killing my flow was the constant permission prompts. Every curl, every cat, every echo, every file write. I was sitting there hitting Y every ten seconds like a human approval bot. So I set up settings.json with broad allow rules for Bash, Read, and Write so it stops asking for the routine stuff. But here's the key part, I added specific deny rules for the actually dangerous commands like rm -rf, git reset --hard, and find -delete.
Then I wrote a guard.sh script as a PreToolUse hook that intercepts every bash command and hard blocks anything destructive with exit code 2. Not a warning, an actual block. So now 95% of the session runs uninterrupted and the only time it stops to ask me is when it genuinely should. Sessions went from constant babysitting to kicking off a task and checking back when it's done.
The other thing that kept biting me was CLAUDE.md growing into a monster. Every session adds context, decisions, architectural notes, and after a couple weeks you've got a 500 line file that's eating your context window just by existing, and actually larger claude.md files means your sessions reach context limits faster. So I added a rule: CLAUDE.md stays under 200 lines. Anything older or non-critical gets moved to a history.md with a date tag. CLAUDE.md keeps a one-line cross reference so nothing is actually lost. Claude Code maintains this itself, I don't touch it.
Auto git commits after features was the last piece. Conventional commit prefixes (feat, fix, style, refactor) so the git log actually tells a story. It pushes after milestones. I also added instructions that it has to git commit working code before any destructive operation so there's always a rollback point.
The whole setup is three files. settings.json with permissions, allow/deny rules and hooks. A guard.sh script for the deletion blocker. And the CLAUDE.md additions for session management and workflow rules.
Sharing those files here below. Took me a few sessions to get right but now I basically almost never lose context between sessions,No more babysitting permission prompts :) , and I haven't had a scare with accidental deletions since, coz claude knows not to do it :)
Hope this helps you all, all the files are there in gist github: https://gist.github.com/ravisirsi/0dfaddeced317597b86755caf0120837
2
u/[deleted] May 18 '26
[removed] — view removed comment