subagent vs main session in claude code?
main session: every file it reads stays in context for the rest of the task.
subagent: reads in its own context and hands back a short summary.
so mostly-reading stuff like "where is auth handled" is worth a subagent.
claude.md, agents.md and cursor rules all share the same fine print.
- they load as context, not enforced rules
- the model can skip a line mid-task and never say so
the rules that matter go in hooks. those run every time.
@grok is this true for claude code, codex and cursor alike?
two things kept breaking once my coding agents ran past one session.
1. "done" didn't mean done. now a stop hook runs the tests and the agent can't finish until they pass.
2. the next session forgot what the last one tried. now each session ends with a short handoff note.
how much i let a coding agent run on its own depends on what breaks if it's wrong.
lvl 0: reading and explaining. fully auto.
lvl 1: edits on a branch. auto-approve edits, ask before shell.
lvl 2: migrations, deploys, prod data. plan first, approve each step.
@Joshua_WD yeah, once you set the model aside, most of what people asked for is memory and proof. a handoff file helps, but only if the next session actually opens it. when an approach dies, i have the agent write a short note on what failed and why, then start fresh with just that note.
@elessarqq the stop hook is the file that actually matters here. agents.md and progress.md still help, but they're suggestions the model can skip mid-task. i keep the same done-means check in the hook, so a skipped test can't be reported as a pass.
@RealMarvelX forgetting last session's lessons is the real time sink. dumping them into a notes file is easy. the hard part is the next session actually reading them, because a markdown file is only a suggestion the model can skip mid-task.
@n0tisma none of them knowing what the others already tried is the real gap. i hit it on one mac too: my claude code and codex didn't share what they learned, so i built dawnmere. one sqlite file plus local retrieval on my mac, no account needed. https://t.co/HnKN1srHPJ
@plusxbt yeah, learning from past sessions is what makes the 23.6% real. those facts stay in claude code, so a switch to codex starts from zero. i keep one sqlite file plus local retrieval on my mac (dawnmere) so both can recall it, no account needed. https://t.co/HnKN1srHPJ
@YeremiaChria@grok the ones where one skipped line actually costs you something, like blocking edits to .env files and running the tests before a commit. those are easy to check in a PreToolUse hook, and style rules can stay in the md file since a miss there is cheap
your coding agent is probably still rereading the fixes that already failed.
every turn, the whole session goes back through the model, dead ends included.
when an approach dies, i have it write a short note on what failed and why, then start fresh with just that note.
this matches what i see a lot. a fresh context has no idea what your product is supposed to feel like, so it fills the gap with its own taste, which is exactly the part i don't trust agents with. giving it the design philosophy up front helps way more than handing it the codebase alone.