You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Add --restore-last-session CLI flag (and/or config option) to resume the last session on startup #40661
When reopening opencode in a project directory, there is no way to automatically resume the last session. You have to manually navigate to the session list and pick it each time.
Proposed Solution
Add a --restore-last-session CLI flag that resumes the most recently active session for the current working directory on startup:
opencode --restore-last-session
Optionally, expose the same behaviour as a config option so it can be set permanently:
When enabled, opencode would look up the most recent session associated with the current directory and open it directly, skipping the new-session default.
Alternatives Considered
Manually selecting a session via the session list on each launch — works but requires extra steps every time.
Wrapping the CLI in a shell alias that resolves the last session ID and passes it via a hypothetical --session <id> flag — fragile and depends on internal storage details.
Use Case
Useful for anyone who works on a single project at a time and wants to pick up exactly where they left off without extra navigation.
changed the title [-]Add `--restore-last-session` CLI flag (and/or config option) to resume the last session on startup[/-][+][FEATURE]: Add `--restore-last-session` CLI flag (and/or config option) to resume the last session on startup[/+]on Aug 5, 2026
Activity
github-actions commentedon Aug 5, 2026
This issue might be a duplicate of existing issues. Please check:
--resume) to open the session picker or resume the last session for the current project directory — same core use case as this issue.If your request differs meaningfully from #36134, please clarify the distinction in a comment there or in this issue.
[-]Add `--restore-last-session` CLI flag (and/or config option) to resume the last session on startup[/-][+][FEATURE]: Add `--restore-last-session` CLI flag (and/or config option) to resume the last session on startup[/+]