Compare commits

...

1 Commits

Author SHA1 Message Date
continue[bot]
78c820f5b1 docs(cli): document session ID support for serve command
- Added --id flag documentation to CLI README
- Clarified dual purpose of --id flag (local persistence + remote sync)
- Added session persistence behavior explanation
- Listed serve command options (--id, --port, --timeout)

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
Co-authored-by: nate <nate@continue.dev>
2025-12-10 23:12:00 +00:00
2 changed files with 20 additions and 1 deletions

View File

@@ -77,6 +77,9 @@ cn ls --json
- `cn logout`: Sign out of current session
- `cn remote`: Launch a remote instance
- `cn serve`: Start HTTP server mode
- `--id <sessionId>`: Use a specific session ID to persist chat history across restarts
- `--port <port>`: Specify server port (default: 8000)
- `--timeout <seconds>`: Set inactivity timeout (default: 300)
### Session Listing (`cn ls`)

View File

@@ -2,10 +2,26 @@
## Overview
The `--id <storageId>` flag enables the `cn serve` command to periodically persist session state to an external Continue-managed storage bucket. On startup, the CLI exchanges the provided `storageId` for two pre-signed S3 URLs - one for `session.json` and one for `diff.txt` - and then pushes fresh copies of those files every 30 seconds.
The `--id` flag for the `cn serve` command serves two purposes:
1. **Local Session Persistence**: The session ID is used to save and restore chat history locally in `~/.continue/sessions/<sessionId>.json`. This allows the serve command to resume from where it left off across restarts.
2. **Remote Storage Sync**: When authenticated with a Continue API key, the CLI also periodically persists session state to an external Continue-managed storage bucket. On startup, the CLI exchanges the provided ID for two pre-signed S3 URLs - one for `session.json` and one for `diff.txt` - and then pushes fresh copies of those files every 30 seconds.
This document captures the responsibilities for both the CLI and backend components so we can iterate on the feature together.
## Session Persistence Behavior
When `cn serve --id <sessionId>` is invoked:
1. The CLI first attempts to load an existing session from `~/.continue/sessions/<sessionId>.json`
2. If found, that session's chat history is restored and set as the current session
3. If not found, a new session is created with the specified ID
4. The session is automatically saved to disk as history is updated
5. On subsequent restarts with the same `--id`, the chat history is preserved
This local persistence works independently of remote storage sync and does not require authentication.
## CLI Responsibilities
- **Flag plumbing**: When `cn serve` is invoked with `--id <storageId>`, the CLI treats that value as an opaque identifier.