Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions docs/reference/commands-nemohermes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1101,13 +1101,19 @@ nemohermes my-assistant sessions delete agent:main:slack:c-9 --json

### `nemohermes <name> sessions export [keys...]`

Export the OpenClaw session JSONL from a running sandbox to the host, replacing the two-hop `docker exec kubectl cp` plus `docker cp` workaround.
Export the agent's session history from a running sandbox to the host.
The command routes by the sandbox's agent kind recorded in the registry.

The command always enumerates the session store through `openclaw sessions list --agent <id> --json` and copies only the matching `<sessionId>.jsonl` (plus optional `<sessionId>.trajectory.jsonl`) files, so the export never picks up `sessions.json`, stale `.jsonl.lock` files, or other store bookkeeping.
For an OpenClaw sandbox, the command enumerates the session store through `openclaw sessions list --agent <id> --json` and copies only the matching `<sessionId>.jsonl` (plus optional `<sessionId>.trajectory.jsonl`) files, so the export never picks up `sessions.json`, stale `.jsonl.lock` files, or other store bookkeeping.
By default it writes a browsable directory of session files (`dir` format); pass `--format tar` for a single `.tgz` bundle suited to sharing or upload.
With no positional keys, the command exports every session for the agent.
Pass one or more keys (alias or canonical `agent:<id>:<rest>`) to filter.

For a Hermes sandbox, the command invokes the in-sandbox `hermes sessions export` against a staging path under `/sandbox/.nemoclaw-staging` (the same downloadable workspace boundary OpenClaw uses), then downloads the resulting single JSONL stream to the host.
Hermes stores session history in a SQLite database, so the command refuses positional keys, `--format tar`, and `--include-trajectory` with a clear error when the sandbox is Hermes.
`--agent` accepts only `hermes` as a no-op alias on a Hermes sandbox and rejects any other value.
The host destination defaults to `./sessions-<sandbox>.jsonl`; `--out` picks a different path.

```bash
nemohermes my-assistant sessions export
nemohermes my-assistant sessions export main --agent main
Expand All @@ -1117,15 +1123,15 @@ nemohermes my-assistant sessions export --format tar --out ./bundles/alpha.tgz -

| Flag | Description |
|------|-------------|
| `--agent <id>` | Agent id when `<keys>` are aliases rather than the canonical `agent:<id>:<rest>` form. |
| `--format <dir\|tar>` | `dir` (default) writes a directory of session files; `tar` writes a single `.tgz` bundle for sharing/upload. |
| `--out <path>` | Host destination. Defaults to `./sessions-<sandbox>/` for `dir`, or `./sessions-<sandbox>-<agent>.tgz` for `tar`. |
| `--include-trajectory` | Include the (large) `*.trajectory.jsonl` files in the export. Excluded by default. |
| `--agent <id>` | OpenClaw: agent id when `<keys>` are aliases rather than the canonical `agent:<id>:<rest>` form. Hermes: accepts only `hermes` as a no-op alias and rejects any other value. |
| `--format <dir\|tar>` | OpenClaw only. `dir` (default) writes a directory of session files; `tar` writes a single `.tgz` bundle for sharing/upload. |
| `--out <path>` | Host destination. OpenClaw defaults to `./sessions-<sandbox>/` for `dir` or `./sessions-<sandbox>-<agent>.tgz` for `tar`; Hermes defaults to `./sessions-<sandbox>.jsonl`. |
| `--include-trajectory` | OpenClaw only. Include the (large) `*.trajectory.jsonl` files in the export. Excluded by default. |
| `--json` | Print the export manifest as JSON instead of a status line. |

Mismatched `--agent` plus canonical-key combinations are refused before any download runs.
Session keys that begin with `-` are rejected at the command boundary instead of being silently dropped.
Session JSONL can contain pasted secrets (API keys, tokens), so exported files are written owner-only (`0600`); for `tar` format the in-sandbox staging tarball is additionally created with `umask 077` and removed after the host download completes.
Session JSONL can contain pasted secrets (API keys, tokens), so exported files are written owner-only (`0600`); the in-sandbox staging artefact is additionally created with `umask 077` and removed after the host download completes.

### `nemohermes <name> download <sandbox-path> [host-dest]`

Expand Down
20 changes: 13 additions & 7 deletions docs/reference/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1390,13 +1390,19 @@ $$nemoclaw my-assistant sessions delete agent:main:slack:c-9 --json

### `$$nemoclaw <name> sessions export [keys...]`

Export the OpenClaw session JSONL from a running sandbox to the host, replacing the two-hop `docker exec kubectl cp` plus `docker cp` workaround.
Export the agent's session history from a running sandbox to the host.
The command routes by the sandbox's agent kind recorded in the registry.

The command always enumerates the session store through `openclaw sessions list --agent <id> --json` and copies only the matching `<sessionId>.jsonl` (plus optional `<sessionId>.trajectory.jsonl`) files, so the export never picks up `sessions.json`, stale `.jsonl.lock` files, or other store bookkeeping.
For an OpenClaw sandbox, the command enumerates the session store through `openclaw sessions list --agent <id> --json` and copies only the matching `<sessionId>.jsonl` (plus optional `<sessionId>.trajectory.jsonl`) files, so the export never picks up `sessions.json`, stale `.jsonl.lock` files, or other store bookkeeping.
By default it writes a browsable directory of session files (`dir` format); pass `--format tar` for a single `.tgz` bundle suited to sharing or upload.
With no positional keys, the command exports every session for the agent.
Pass one or more keys (alias or canonical `agent:<id>:<rest>`) to filter.

For a Hermes sandbox, the command invokes the in-sandbox `hermes sessions export` against a staging path under `/sandbox/.nemoclaw-staging` (the same downloadable workspace boundary OpenClaw uses), then downloads the resulting single JSONL stream to the host.
Hermes stores session history in a SQLite database, so the command refuses positional keys, `--format tar`, and `--include-trajectory` with a clear error when the sandbox is Hermes.
`--agent` accepts only `hermes` as a no-op alias on a Hermes sandbox and rejects any other value.
The host destination defaults to `./sessions-<sandbox>.jsonl`; `--out` picks a different path.

```bash
$$nemoclaw my-assistant sessions export
$$nemoclaw my-assistant sessions export main --agent main
Expand All @@ -1406,15 +1412,15 @@ $$nemoclaw my-assistant sessions export --format tar --out ./bundles/alpha.tgz -

| Flag | Description |
|------|-------------|
| `--agent <id>` | Agent id when `<keys>` are aliases rather than the canonical `agent:<id>:<rest>` form. |
| `--format <dir\|tar>` | `dir` (default) writes a directory of session files; `tar` writes a single `.tgz` bundle for sharing/upload. |
| `--out <path>` | Host destination. Defaults to `./sessions-<sandbox>/` for `dir`, or `./sessions-<sandbox>-<agent>.tgz` for `tar`. |
| `--include-trajectory` | Include the (large) `*.trajectory.jsonl` files in the export. Excluded by default. |
| `--agent <id>` | OpenClaw: agent id when `<keys>` are aliases rather than the canonical `agent:<id>:<rest>` form. Hermes: accepts only `hermes` as a no-op alias and rejects any other value. |
| `--format <dir\|tar>` | OpenClaw only. `dir` (default) writes a directory of session files; `tar` writes a single `.tgz` bundle for sharing/upload. |
| `--out <path>` | Host destination. OpenClaw defaults to `./sessions-<sandbox>/` for `dir` or `./sessions-<sandbox>-<agent>.tgz` for `tar`; Hermes defaults to `./sessions-<sandbox>.jsonl`. |
| `--include-trajectory` | OpenClaw only. Include the (large) `*.trajectory.jsonl` files in the export. Excluded by default. |
| `--json` | Print the export manifest as JSON instead of a status line. |

Mismatched `--agent` plus canonical-key combinations are refused before any download runs.
Session keys that begin with `-` are rejected at the command boundary instead of being silently dropped.
Session JSONL can contain pasted secrets (API keys, tokens), so exported files are written owner-only (`0600`); for `tar` format the in-sandbox staging tarball is additionally created with `umask 077` and removed after the host download completes.
Session JSONL can contain pasted secrets (API keys, tokens), so exported files are written owner-only (`0600`); the in-sandbox staging artefact is additionally created with `umask 077` and removed after the host download completes.

### `$$nemoclaw <name> download <sandbox-path> [host-dest]`

Expand Down
27 changes: 18 additions & 9 deletions src/commands/sandbox/sessions/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,28 @@ import { NemoClawCommand } from "../../../lib/cli/nemoclaw-oclif-command";
export default class SandboxSessionsExportCommand extends NemoClawCommand {
static id = "sandbox:sessions:export";
static strict = false;
static summary = "Export OpenClaw session JSONL out of a running sandbox";
static summary = "Export agent session JSONL out of a running sandbox";
static description = [
"Tar the OpenClaw session store inside the sandbox and download the bundle to",
"the host via `openshell sandbox download`. By default every session for the",
"agent is exported; pass one or more positional keys to filter.",
"Routes by the sandbox's agent kind, recorded in the registry.",
"",
"Keys may be either an alias (e.g. `main`, `telegram:t-1`) or the canonical",
"`agent:<id>:<rest>` form. Use --agent to scope aliases to a non-default",
"agent; mismatched --agent + canonical-key combinations are refused.",
"",
"Trajectory files are excluded by default (large) and re-added with",
"OpenClaw sandbox: tar the per-session JSONL files inside the sandbox and",
"download the bundle to the host via `openshell sandbox download`. By default",
"every session for the agent is exported; pass one or more positional keys to",
"filter. Keys may be either an alias (e.g. `main`, `telegram:t-1`) or the",
"canonical `agent:<id>:<rest>` form. Use --agent to scope aliases to a",
"non-default agent; mismatched --agent + canonical-key combinations are",
"refused. Trajectory files are excluded by default (large) and re-added with",
"--include-trajectory.",
"",
"Hermes sandbox: invoke the in-sandbox `hermes sessions export` against a",
"staging path under /sandbox/.nemoclaw-staging, then download the resulting",
"single JSONL stream to the host. Hermes stores the session history in a",
"SQLite database, so positional keys, --format tar, and --include-trajectory",
"are OpenClaw-only and are rejected with a clear error when the sandbox is",
"Hermes. --agent accepts only `hermes` (a no-op alias) on a Hermes sandbox",
"and rejects any other value. The host destination defaults to",
"./sessions-<sandbox>.jsonl; --out picks a different path.",
"",
"Note: session JSONL can contain pasted secrets (API keys, tokens). The",
"downloaded bundle is written owner-only (0600); keep it private and avoid",
"committing or sharing it without review.",
Expand Down
Loading
Loading