Interactive --session-id <new UUID> on startup skips CLAUDE.md (project & user memory) injection

Open 💬 0 comments Opened Jun 20, 2026 by vegaslot

--session-id <new UUID> on startup skips CLAUDE.md (project & user memory) injection

Summary

Starting an interactive session with --session-id <freshly-generated UUID> causes the project CLAUDE.md and the user-global ~/.claude/CLAUDE.md to not be injected into context. Auto-memory (MEMORY.md), the skill listing, and SessionStart hooks are injected normally. Removing --session-id (letting Claude Code auto-generate the id) makes CLAUDE.md inject correctly again.

This silently breaks any session orchestrator that passes --session-id to keep its own session id in sync with Claude's (e.g. Codeman, which passes --session-id for every session). The agent runs without any of its project/user instructions and the user only notices via wrong behavior.

Environment

  • Claude Code 2.1.183 (also reproduced on 2.1.175)
  • macOS 15.5 (Darwin 25.5.0), zsh
  • Auth: Claude Pro/Max

Minimal reproduction

In any git repository that has a CLAUDE.md at its root:

cd <repo-with-CLAUDE.md>

# A) WITHOUT --session-id  → CLAUDE.md IS injected
claude --dangerously-skip-permissions 'reply with just ok'

# B) WITH --session-id (new UUID) → CLAUDE.md is NOT injected  (bug)
claude --dangerously-skip-permissions --session-id "$(uuidgen | tr 'A-Z' 'a-z')" 'reply with just ok'

Then inspect the two transcripts under
~/.claude/projects/<sanitized-cwd>/<session-id>.jsonl and grep for the
# claudeMd context block (and any distinctive string from your CLAUDE.md):

DIR=~/.claude/projects/<sanitized-cwd>
grep -c '# claudeMd' "$DIR/<session-id-A>.jsonl"   # A (no --session-id): > 0
grep -c '# claudeMd' "$DIR/<session-id-B>.jsonl"   # B (--session-id):    0

Observed (controlled A/B, everything else identical: same cwd, interactive mode in tmux, --dangerously-skip-permissions, hooks disabled via --settings '{"disableAllHooks":true}')

| Condition | --session-id | # claudeMd blocks | global CLAUDE.md marker | project CLAUDE.md marker |
|---|---|---|---|---|
| A | absent | 20 | present (18) | present (22) |
| B | present (new UUID) | 0 | 0 | 0 |

The only difference between the two runs is the presence of --session-id.

Expected behavior

For a new session (a --session-id that does not correspond to an existing
conversation), CLAUDE.md (project + user-global) should be injected exactly as
it is when --session-id is omitted. A caller supplying an explicit id for a
brand-new session should not change which memory files load.

Actual behavior

When --session-id <new UUID> is supplied, the # claudeMd context block is
absent from the session entirely (verified across the full transcript, not just
the first turn). MEMORY.md, skills, and SessionStart hooks are unaffected —
only CLAUDE.md (project + user) is dropped.

Notes / hypothesis

It looks like supplying --session-id is treated as a resume-style start that
skips the initial CLAUDE.md snapshot, even when the id is brand new and has no
prior transcript. MEMORY.md and skills load via a different path, which is why
only CLAUDE.md disappears.

Impact

Any tool that launches Claude Code with --session-id for session tracking
(Codeman, and likely other tmux/PTY orchestrators) loses all CLAUDE.md-based
instructions for every session, silently.

View original on GitHub ↗