Sessions
How sessions are stored, continued, and shared.
A session is one conversation: your prompts, the answers, every tool call, and its model and sandbox. Every session is saved.
Start a Session
Each codework run without --session starts a new one and prints its ID first:
session <session-id>
sandbox local · /Users/you/work/apiA session remembers its project folder, so that folder’s .codework/settings.jsonc and plugins apply wherever you continue it. It also keeps its sandbox and working directory for life. Its title is the first line of its first prompt, cut to 48 characters.
Continue a Session
Pass the ID with --session (or -s):
codework run --session <session-id> "Now fix them"The model sees the whole conversation so far. --cwd and the sandbox flags only apply to new sessions.
Change the Model
--provider, --model, and --thinking also work on a continued session. The choice is saved and sticks until you change it:
codework run --session <session-id> --provider openrouter --model deepseek/deepseek-v4.1-flash "Try a different approach"Without a saved choice, a session uses the default model from your settings.
Usage Summary
When a run finishes, codework run prints a summary of that run to stderr:
── usage ───────────────────────────────────────────────────────────────
model openrouter/deepseek/deepseek-v4.1-flash
tokens 12,408 input · 1,262 output · 13,670 total
cache 9,856 read · 0 write
cost $0.002104 · 4 turns| Row | What it shows |
|---|---|
model | The provider and model that answered |
tokens | Input, output, total, and reasoning |
cache | Prompt cache reads and writes |
cost | Estimated cost and model responses |
Shared Across Interfaces
Every interface that uses the same CodeWork home sees the same sessions:
- Terminal.
codework run --session <id>. - Editors. ACP editors list past sessions for the open folder, including ones from
codework run. - RPC server.
codework serveowns its sessions while it runs. Continue one withcodework run --server <url> --session <id>, or list them withsession.list.
There’s no CLI command to list sessions. Keep the printed ID, or use your editor’s thread history.
Storage
Sessions are stored in SQLite at ~/.codework/data/codework.db.
| Flag | Effect |
|---|---|
--home <dir> | Another home, with its own settings and credentials |
--database <path> | Use another file. Relative to <home>/data |
--database :memory: | Keep nothing after the process exits |
These work on run, acp, and serve. With --server, set them on codework serve.
Interfaces only share sessions with the same home and database. An editor running codework acp --home ~/.codework-zed has its own sessions.