claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Resume is broken in -p mode

Open proggod opened this issue 8 months ago • 1 comments

Using 1.0.30, when I start a task with -p mode, I get the task id, and then attempt to resume and it creates an entirely new task id and doesn't have the memory of the previous one:

FIRST: claude -p "create a hello world c program" --dangerously-skip-permissions --output-format stream-json --verbose session_id":"d247198c-a305-4c75-be27-b50bd7251ed2"

SECOND: claude -p "change it to universe" --dangerously-skip-permissions --output-format stream-json --verbose --resume d247198c-a305-4c75-be27-b50bd7251ed2

it changes session id to "session_id":"a7899bdd-2f50-4a83-93f2-f9878d750d07" and has no memory of previous convo

proggod avatar Jun 20 '25 07:06 proggod

Resume creating a new session id is expected.

and has no memory of previous convo

are you seeing the second invocation (with --resume) not actually resuming the conversation and just starting fresh?

levpopov avatar Jun 20 '25 15:06 levpopov

Hi @levpopov, could you help clarify why non-interactive mode creates a new session ID while REPL doesn't? I'm also curious about the caching implications. Does creating a new session mean cache isn't utilized? This seems to be creating challenges for tools like https://github.com/siteboon/claudecodeui that build on the non-interactive mode.

viper151 avatar Jul 10 '25 18:07 viper151

Resume creating a new session id is expected.

and has no memory of previous convo

are you seeing the second invocation (with --resume) not actually resuming the conversation and just starting fresh?

@levpopov can you explain why resume creating a new session id is expected? It creates a new .jsonl file with copied contents from the original session instead of adding to the original session, bloating storage and making it very difficult to create tools and applications that can properly track session state.

jamesrp13 avatar Aug 31 '25 20:08 jamesrp13