Skip to content
OpenScienceDocs

Sessions and terminal runs

Start, continue, export, and import a research conversation.

A session is one conversation: your requests, the responses, and the recorded tool activity. OpenScience saves sessions so you can return to a task.

Local storage

Session headers, messages, tool parts, todos and saved diffs are stored in research.sqlite under your OpenScience data directory. Existing identifiers are preserved, including parent sessions and tool call IDs. The first access imports older records atomically; their original storage/ JSON files remain as migration backups. After import, the database is authoritative: editing an old JSON file does not edit the conversation, and deleting a conversation does not restore it from a backup file.

Close older OpenScience versions before upgrading a shared data directory; they still write the legacy files and do not understand the database. Use the session export and import commands below to exchange conversations across versions. If migration reports a malformed legacy file, repair that original file and retry. No partial conversation import is committed. The database is included when relocating the application's data directory.

Later data-root rescans can import previously unseen records into the database, including while the current server is running. Records already imported or deleted are never replaced by a legacy backup.

Early experimental database versions did not retain deletion history. When upgrading one of those databases, unseen backups remain pending rather than reappearing as conversations. Run openscience debug legacy-import to list pending record keys and SHA-256 hashes without printing conversation content. To restore selected snapshots, pass their exact keys explicitly:

openscience debug legacy-import --restore session/PROJECT_ID/SESSION_ID

Multiple keys can follow --restore; restoration is atomic. Records deleted by the current database cannot be recovered through this command. Original JSON backups remain unchanged.

Check settled Ace charges

Open the session's context panel from the header and choose Check settled charges. The Context button is available before the first model response, including when the first call fails or is cancelled. OpenScience looks up the task's recorded Ace HTTP call IDs, including descendant worker sessions, against the signed-in account and current workspace's Wallet ledger. This read-only check works independently of session trace sharing and does not send conversation content or authorize spending.

The Settled receipts subtotal includes only matching settled holds and ledger receipts. Amounts retain six decimal places in USD so small charges are visible. Pending, unknown or missing, inconsistent, and released or expired calls are listed separately. A subtotal with unresolved calls is incomplete; missing evidence is never proof that the task was free. Calculated Ace amounts, provider-reported amounts and BYOK estimates remain separate in Model call usage. Older calls without HTTP IDs and older servers without receipt support remain explicit.

Receipt IDs and charge evidence are saved in research.sqlite, scoped to the account, workspace and server. Changing accounts clears the displayed result. Run the check again to read the current workspace; the view does not reuse another account's saved charges. New calls or later settlement require another check.

Start a session

Open the workspace with openscience, or send a single request from a terminal:

openscience run "Review the analysis plan in this project"

Use --title to make the session easy to find later:

openscience run --title "Sample quality checks" "Inspect data/samples.csv for missing values"

New sessions use an isolated scratch workspace by default. To make relative tool paths resolve in the selected project, choose project mode when creating the session:

openscience run --workspace project "Analyze the CSV files in this directory"

--workspace isolated explicitly selects the default. Continuing a session preserves its workspace; an explicit conflicting mode is rejected. Project mode uses the existing project directory and does not make OpenScience own or delete that directory when the session is removed. It retains the normal filesystem and tool permissions. The model receives guidance matching that mode: temporary session scratch in isolated mode, or durable shared project files in project mode. Check openscience run --help for workspace-mode support when using an older runtime.

Attach files or pipe input

openscience run "Explain this protocol and identify missing details" --file methods/protocol.md
git diff | openscience run "Review this diff for likely bugs"

Repeat --file for multiple files. Piped input is appended to your message.

--file attaches a file. --attach connects to an already running OpenScience server.

Continue existing work

openscience session list
openscience session list -n 10 --format json
openscience run --continue "Now create a plot of the missing-value counts"
openscience run --session <session-id> "Explain the limitations of the analysis"

Replace <session-id> with an ID from the session list. --continue chooses the latest session; use an explicit ID when several tasks are active.

In the workspace, open the saved conversation in project history. Queued prompts and follow-up messages continue that conversation.

Sending a message follows the latest response. While you read earlier messages, incoming activity keeps your reading position; choose Jump to latest to follow the conversation again. Loading earlier messages preserves your reading position and respects a later Jump to latest or send, even if the history request is slow. Background output checks and compute status updates stay inside the conversation without resetting its scroll position.

Choose model and research settings

FlagPurpose
--model <provider>/<model>, -mSelect an exact configured model.
--agent <name>Select a primary agent; defaults to Research.
--variant <tier>Select a reasoning tier supported by that model.
--effort normal or --effort ultraChoose research breadth.
--bareAnswer without tools; useful for testing a model connection.
--command <name>Run a custom command with the message as its arguments.
--format jsonWrite one JSON event per line.
--workspace project or --workspace isolatedChoose the tool workspace when creating a session.

See Models and Research controls.

Permissions in terminal runs

An interactive terminal run can ask for permission. Without a terminal, permission prompts are rejected by default so a pipeline does not wait forever.

FlagBehavior
--deny-promptsReject permission requests for this run.
--auto-approveApprove permission requests for this run and disable delegation.
--dangerously-skip-permissionsAlias for --auto-approve.

The two policies are mutually exclusive. They do not persist as app settings.

Use automatic approval only for a task whose allowed work you have already reviewed. A terminal run cannot conduct an interactive clarification conversation; include the needed assumptions and constraints in its prompt.

Exit codes

CodeMeaning
0The turn completed.
1The session reported an error.
2A usage or configuration error prevented the request.
3A permission request or question was rejected.

A completed turn is not proof that a scientific claim is correct. Inspect the output and run the relevant checks.

Attach to a running workspace

Start a server in one terminal:

openscience serve --port 4096

Send a request from another:

openscience run --attach http://localhost:4096 "Summarize the project"
openscience run --attach http://localhost:4096 --session <session-id> "Continue the analysis"

Use the server's actual printed URL and the same project context. The server must remain running.

Export and import

openscience export <session-id> > session.json
openscience import session.json

An export contains the conversation record. It is not a complete project backup: copy the datasets, source files, and result files separately. Review the transcript before sharing it because it can include private research content.

Import from Claude Code or Codex

Continue a conversation you started in Claude Code or Codex:

openscience import --from-claude            # pick from your Claude Code conversations
openscience import --from-codex <session-id>
openscience import --from-claude <session-id> --folder-access read

In the app, choose Import in the sidebar, pick Claude Code or Codex, and search by folder or first message.

  • The whole conversation is imported, including tool calls and their results. A subagent's run comes in as its final result, so the agent knows what it found. Where the original tool compacted the conversation, the session keeps that summary as a compaction point.
  • OpenScience asks whether to connect the folder the conversation worked in: Read and write (the default), Read only, or Don't connect. A folder already connected at read and write is never lowered to read only. If the folder no longer exists, the session uses the normal workspace and says so.
  • The conversation continues on the model you select in OpenScience. Imported turns cost nothing, and the original tool's hidden thinking is shown but never sent to a model.
  • Importing the same conversation again adds its new messages to the session. If nothing new happened in the original tool, the session is left as it is, even if you have continued it in OpenScience. If both sides have moved on, or the conversation was rewound or edited in the original tool, OpenScience makes a separate copy titled <title> (import #2), (import #3) and so on, and tells you why. Your OpenScience session is never changed or removed.
  • To import every conversation that ran in a project's folders, tick Import Claude Code and Codex conversations from these folders when you create the project, choose Import all from this project's folders in the Import dialog, or run openscience import --all (add --from-claude or --from-codex for one tool) from the project's folder. Only conversations whose folder is exactly one of the project's folders (or the folder the project was opened from) match. Running it again updates, copies or adds conversations by the rules above; conversations you deleted after an earlier import are skipped. Imported sessions get read and write access to their folders: a folder connected read only is raised to read and write, except your home folder or a folder that contains it.
  • Conversations are read from ~/.claude/projects and ~/.codex/sessions (including archived Codex sessions), or from CLAUDE_CONFIG_DIR and CODEX_HOME when those are set. Imported history follows your trace-sharing setting, like any other session.

For recovery during long work, use /checkpoint or /handoff in the workspace. For machine-readable output and CI, see Automation and JSON output.

Native benchmark runners

The source adapter in tooling/harbor targets Harbor 0.22.0. It requires run --workspace project to preserve the native task working directory for relative tool paths, verifies the selected OpenScience binary, and requires a successful final JSON done event after collecting remote logs. A binary without the workspace option fails setup. Raw and partial trajectories remain available when a run fails; missing usage is not reported as zero. A successful agent process still needs the native task verifier.

Use a matching Linux headless build to benchmark local source changes. The adapter guide contains the exact binary and binary_sha256 arguments. Existing runners pinned to a different Harbor version need separate conformance checks; this adapter does not replace their task images, graders, or aggregation.

Harbor defaults disable session and message title generation with agent.title.disable: true. Research execution and compaction remain enabled; interactive sessions keep their normal titles. Trajectory usage covers recorded root-agent steps and uses catalog cost estimates. It excludes unrecorded auxiliary calls and external tool or compute charges, so whole-trial cost comparisons need separate billing evidence.