[FEATURE] CLI flag to `--continue` if possible and create a new session otherwise
Open 💬 2 comments Opened Apr 9, 2026 by glasser
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I have some scripts to set up a set of terminal windows in a project with Claude, a git client, a shell, etc. So I'm starting the claude CLI without explicitly typing claude myself.
I'd like to be able to use claude --continue to carry on from a previous session by default. But this will exit with failure if there is no session. I'd like to be able to write a single command-line that implements "do claude --continue if possible, otherwise just normal claude". I don't think this is currently possible.
Proposed Solution
Two possible solutions:
- A flag that implements this directly, like
claude --continue-or-new - A flag that lists current sessions in the directory (like
claude --list-sessions) and has an exit code making it easy to use in a script to decide whether or not to pass--continue
Alternative Solutions
_No response_
Priority
Low - Nice to have
Feature Category
CLI commands and flags
Use Case Example
I want to open a zellij view with a Claude and a few other tools.
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗