r/ClaudeCode • • 3h ago

Help/Question How do you handle your OWN context?

As in your own human-brain context? I'm working solo on a complex project with a lot of moving parts. Claude's so good at writing code that I barely have to babysit. My issue is having to babysit Claude on HOW the project works and stop it from making assumptions, which requires me keeping an accurate mental model of the entire thing in my head, and that's super fatiguing. Compounding things further, the niche I'm in (large volume catering ops) is something Claude just... doesn't have a great understanding of.

Example: this morning, Claude makes an odd choice when building a feature, and I look at the PR body it wrote, and it says "...held packing slips become ignored once the purchase order arrives" -- I respond "Purchase orders **always** arrive before packing slips, this is a case that will literally never happen." Then he's off proposing edits to ADRs/specs/PR bodies, which I then have to read, which I then catch a host of other things, and I'm pulling my hair out.

I'm using matt-pocock-skills, have a rule that agents must write in ASD-STE100, and a script that enforces a limit on PR/issue body length, but I feel like there's something else I could be doing to help. Anyone else run into this, or have any potential solutions? Thanks in advance.

TL;DR How do you keep an accurate mental model of the project when Claude is insanely verbose and doesn't have a super solid understanding of your niche/industry?

5 Upvotes

20 comments sorted by

•

u/AutoModerator 3h ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/BuffaloConscious7919 3h ago

I think it's about developing that process either in the beginning and refining it as it goes. For me, that involves an initial setup of what I know if it's a new project. After that, it involves keeping not just the context updated, but also the structure of the context as the codebase changes.

What I think that involves, generally speaking, is having a data source (for example, Obsidian or a collection of MD files) with things like an index there as a reference that agents can pick up on as they use the project or help develop the project.

1

u/martin_xs6 2h ago

This is what I do. I use a version of llm-wiki for it and it works really well. Basically after every task I have Claude update the wiki and review that like I would a PR to make sure it's not saving incorrect stuff in there. Then future sessions read the wiki articles they need to do their task.

3

u/AdTotal4035 1h ago

what helped most was stopping being the one who holds the mental model. i made claude search every old chat i had with it, so when i go wait didnt we already decide this, it finds my exact words and the date instead of me explaining it again.

the bigger one for your case is the stuff you keep correcting. if youve told it purchase orders always arrive before packing slips in 6 different chats, thats a rule, not a chat. mine flags what i keep repeating across chats and writes it up as a rule, so i only have to say it once.

i built it for myself, its called memhole if you want it: https://github.com/nanafy/memhole

even by hand though, a short domain facts file like AgentYurt said gets you most of the way.

trust me just use it and you will thank me later

2

u/AgentYurt 3h ago

I ran into the same wall — the model was fine at code and terrible at the domain rules I'd already taught it twice. What actually moved it for me:

Keep one short file of rules that have already bitten you. Mine is about 15 lines, each one a scar with the failure attached — for example, 'purchase orders always arrive before packing slips, never write the reverse into a spec.' Re-reading that file at the start of a session costs about a minute and stops most of the re-arguing.

Before Claude edits an ADR or a spec, make it restate the 2-3 assumptions it's relying on in one sentence each. If one is wrong you catch it in seconds, instead of reading a whole PR body to find it.

And cap the PR body yourself — I ask for 3 bullets max: what changed, why, what to verify. Anything longer and I stop reading, which is the real signal the model is guessing.

The mental-model part never fully goes away, but writing the decision down once — one line per session, what I decided and what I still don't know — means I don't have to hold the whole project in my head between sessions.

1

u/called9527 3h ago

one thing worth trying: when it writes a wrong domain assumption into a PR body, dont fix the PR body, add the fact to a short domain facts file and tell it to reread that before touching specs. otherwise you end up reviewing its edits to its own prose. also asking it to list its assumptions as plain bullets before it writes anything is way faster to scan than an ADR diff. does the STE100 rule actually cut the length or just make the words simpler?

1

u/sleewok 2h ago

Good idea on bulleted assumptions

1

u/sam_arutyunyan 3h ago

Lots of to do bullet lists with a 'next task' written out at the end of a work day. I catalog prompts that work and draft future ones. Force modular workflow thats easy to review.

1

u/YellowBeaverFever 2h ago

I spend more time talking about how the project works than coding it up. I have it document architecture ideas and UI/UX ideas differently than business process ideas. I never assume that it will just understand what I’m talking about.

And another thing that helps is have it add a persistent “state” mechanism that it uses to keep track of conversations. I had Claude build a script that managed json files that represent summaries of conversations and are catalogued by date, issue #, user (for teams), and branch. It doesn’t always refer to it but use that when I ask it to review past sessions and conversations. People work on multiple machines. Claude can crash. I want to persist project memory.

1

u/daiaomori 2h ago

The solution always seems to be: less information.

As code mostly speaks for itself, it helps to reduce additional rules that are redundant to the code (they will only confuse the model), plus removing the abundance of comments in the code that over-explains the obvious by adding layers and layers of ad-hoc reasoning that is already present in the code.

People have agents to remove the comments of agents.

When it comes to what the project should actually do, high level structure specs (can be diagrams in tikz or plain text) and solid feature descriptions, best case organized in multiple detail levels broad overview - single topic - detailed specs for a function - should help the model to dig through the code and identify the relevant bits and pieces for a CR/FR.

Basically: exactly the same documentation one would create for a human dev team where no single person keep both the overview as well as all the details in mind at the same time.

Agents run into the same limit here; all the details at once are too confusing, but finding the specific details for a problem is still necessary.

Good thing is: you can actually task Agents with create such a documentation for a project, and instruct the model to abide to that documentation.

Works a whole lot better than an agent trying to make sense of a grown 100k lines Claude.md with once important rules that are bound to points in time that already don’t exist anymore for the model.

That’s by the why the main culprit: the models tend to document what they are doing now and why, but once the context is gone, the rules become stale and unconnected, and as everything pointing nowhere in vector space, this is where guessing starts.

Code is always bound by its inner logic, so it’s mostly understandable without context - as long as I/O is known.

1

u/sleewok 2h ago

Is there any way to salvage a project that has too much documentation / rules written by Claude? I find myself constantly fighting again rules it wrote earlier in the project. I'm tempted to have an agent review the docs and code, the. Remove any docs that are just repeating what the code says. Is that a good idea?

1

u/martin_xs6 2h ago

I have some custom tools for CC to share links I can click in code, PDFs, etc. When I want an explanation I make it cite sources I can review.

I also use my iteration of llm-wiki. I have a very strict ingest process where I approve everything CC puts in the wiki and make it provide a reference for it so it stays clean. Then new sessions/agents read the wiki to load context and I can use the wiki (and more importantly the references there) to track things.

So for your case you could have a wiki article about your purchasing process or whatever and Claude would reference that whenever it is writing code with that and you only have to tell once.

1

u/dvduval 2h ago

I publish a blog for myself and the AI agent that is coordinating with me. We make goals for the day and reports at the end of the day and sometimes some things in between. And in this way we can always go back and reference what I might have forgotten or bring things back into focus that make sense and the AI agent can help me do that

1

u/norviking 2h ago

You should try out this for a day or so.

https://github.com/vegardjorg/ravenseat

Some good old boring software engineering principles, enforced.

And very important for any LLM coding, all project state, plan state and task state is moved fully out of the model / context. 

So context compaction ruining all your important instructions and info does not relly matter that much. It gets loaded back in again on task start, or after compaction. 

"Oops, sorry that was on me. I clearly did not read the basic instructions. " Skill read misses? Claude.md read misses? Memory misses? No big deal either.

This plugin will keep it all on track for you, like some boring old project manager with a stick up his ass.

Ravenseat: "No that plan isnt good enough. Formulate it like this, in this exact format, and be clear about the sucess criteria." 

Claude: ".... ok. Here you go.". 

Ravenseat: "yes, thats my boy."


Claude: "I am done with the work. All tests passed... honest to god. Fingers crossed."

Ravenseat: "No and no. Tests are not passing, and from the plan these sucess criteria are not met. Back you go."

Claude: Trying to fudge and change the tests to pass, because it clearly knows better (Yes, I have caugt it doing this)

Ravenseat: Uses hooks "Denied. Go back and fix it for real..."

Claude: "Now I am done. Super super duper promise. No need to check"

Ravenseat: "I checked. You are not done. These gates did not pass. These db probes say you fantasized up a new db service_role that bypasses all checks and RLS because you were mildly inconvinienced. Now, go back and fix it."

Claude "Damnit! Ok..."

And yeah. Youll probably save a a few  tokens, since external state allows safe auto compacts at 300k. A shitload if you are still doing the old 1000k (and at least a bit on the new 400K windows). 

1

u/RazzmatazzQuick 1h ago

Two things that help me with exactly this:

  • Domain facts go in the rules file as a plain list, not in the PR or the chat. When it gets one wrong ("purchase orders always arrive before packing slips"), I add that line to CLAUDE.md, which it reads at the start of every session, instead of correcting its prose. The list grows from real mistakes, so it stays short and specific to your niche.
  • At the end of every session it writes a dated handoff file with fixed sections: what changed, test state, open findings it noticed but deliberately didn't change, and what not to touch. That gives you one short document to read instead of PR bodies and spec edits, and the next session starts from it too.

One more that saves arguments later: when I approve something, it writes my exact words into the log ("set at the owner's word: ..."). The next session can then tell my decisions apart from its own guesses.

1

u/palmerden5 1h ago

make it list the business assumptions behind a change before it edits code or docs, with each marked confirmed or unknown. then a guess about packing slips is visible before it turns into a whole chain of spec and PR edits

1

u/Remote-Second-9099 1h ago

i keep a living doc with key constraints and assumptions, updated after every major shift. it's like a mental survival kit.

1

u/io-x 1h ago

Same rule applies to you, organize and write everything down, keep your mind empty.

1

u/cleverhoods 3h ago

That's where you need an event-bus that is capable managing your contenxt on the fly, catch deviations, and fix them.