# OpenClaw

> Import OpenClaw Gateway conversations, tool activity, model usage, and workspace memories.

OpenClaw is a personal-agent harness maintained by the OpenClaw Foundation.
Hansard imports history from the Gateway host. Routed models retain their own
model-company identity in Stats.

## Source IDs

| Source     | Use it for                                                                           |
| ---------- | ------------------------------------------------------------------------------------ |
| `openclaw` | Locally available Gateway stores shared by CLI, web, desktop, and messaging clients. |

## How the import works

OpenClaw saves current conversations in each agent's
`agents/<id>/agent/openclaw-agent.sqlite`. Hansard reads a coherent snapshot,
including committed WAL data, without changing the provider database. It also
reads legacy `sessions/*.jsonl`, retained reset and deleted archives, and
verified cold-storage files. When a session has migrated to SQLite, that store
owns the conversation and its old JSONL files remain raw preservation sidecars.

The default roots are `~/.openclaw`, named `~/.openclaw-<profile>` directories,
and historical `~/.clawdbot`. `OPENCLAW_HOME` changes the home used for discovery;
`OPENCLAW_STATE_DIR` selects a single custom store. Set `HANSARD_OPENCLAW_ROOTS`
to a path-separated list to import several stores. Each profile and agent keeps
its own identity, even if native session IDs match. A resumed conversation
updates its existing archive entry without duplicating unchanged sessions.

Clients connected to the same Gateway share its archive source. For a remote or
cloud Gateway, make its state directory available locally through a copy or
mount. Hansard does not connect to messaging accounts or fetch remote Gateway
history. Incognito conversations have no durable store to import.

## Import and keep current

**Conversation history**

```sh
hansard import --source openclaw --since all
hansard config sources enable openclaw
```

The watcher observes agent databases, WAL files, and retained transcript files.
Compressed records require Node.js with Zstandard support or `zstd` on PATH.

**Memories and instructions**

```sh
hansard memory backup
```

Backups include workspace `AGENTS.md`, `SOUL.md`, `USER.md`, `IDENTITY.md`,
`TOOLS.md`, `HEARTBEAT.md`, `BOOT.md`, `BOOTSTRAP.md`, `MEMORY.md`, and daily
`memory/` text. Skill folders are not memories and are not backed up. Standard
workspace directories and workspaces recorded in imported sessions are
discovered.
`OPENCLAW_WORKSPACE_DIR` or path-separated `HANSARD_OPENCLAW_WORKSPACES` adds
custom workspaces, including those not yet present in archived conversations.

## Review the import in the app

1. When the import finishes, open **Conversations** and select **Filter & sort**.
2. Set **Source** to **OpenClaw** and set **Time** to the window you imported. Use **Folder** to narrow the list when you use this harness in several projects.
3. Select a conversation to check its messages, tool calls, files, commits, model, and token usage.

To keep archiving new sessions from a local harness, open **Settings → Imports**. **Automatic** follows every supported harness installed on this computer. **Custom** lets you turn individual harnesses on or off. Cloud sources and account exports never run from here; each needs its own import command. If a conversation you expect is missing after you reset the filters, run the import command on this page again with `--explain-skips` where the source supports it.

Review tool arguments and numbered edit diffs, then check OpenClaw and its
models in Stats. Internal and inter-session prompts do not count as human
activity. Scheduled sessions follow the SDK job accounting rules, and delegated
children stay outside human conversation-depth samples.

## What Hansard preserves

- Prompts, replies, recorded reasoning, inline images, available local media, tools, errors, and edit patches.
- Active conversation branches, compaction and reset markers, titles, timestamps, workspace, and child links.
- Measured input, output, and cache tokens from individual responses, including spent usage on inactive branches.
- Recorded model and thinking changes, catalog-estimated costs, and unknown record counts.
- Coherent raw databases, legacy indexes and transcripts, and referenced cold-storage files.

Copied fork prefixes are excluded when their source ancestor is available locally.
Session-level token counters describe
current context and are not used as lifetime totals. Missing model or usage
data remains missing; selecting a model later does not attribute earlier calls.

## Known limitations

- Audited formats are SQLite schema 23 and transcript versions 1–4. Unknown
  database or transcript versions produce an error rather than a partial replacement.
- Desktop, web, messaging, cloud workers, and live delegation have not received
  separate native trials. Their shared local storage is covered by the parser;
  remote stores require local access.
- External-harness mirrors remain OpenClaw conversations. Importing the same
  work separately from its native harness can duplicate accounting across providers.
- Inline images and recorded media files inside the Gateway media directory or
  recorded workspace are preserved up to 32 MiB per file and 128 MiB per session. Remote URLs are
  retained without fetching; unavailable local files remain missing attachments.
  Unsupported content blocks are counted and retained in raw preservation.
- Custom config includes, plugin-managed memory databases, and unobserved
  custom workspaces are not independently discovered.
  Use the workspace override for custom file-backed memories.
- Runtime logs, voice transcription libraries, delivery queues, credentials,
  and derived memory indexes are not separate conversations or memories.
  The full raw per-agent SQLite snapshot still preserves its original tables.

## Refresh an existing archive

```sh
hansard import --source openclaw --since all
hansard memory backup
```

Original Gateway stores are required for a parser refresh. Import is read-only;
Hansard does not perform OpenClaw's database migration or restore files into it.

Official references: [session storage](https://docs.openclaw.ai/reference/session-management-compaction/store),
[transcript schema](https://docs.openclaw.ai/reference/session-management-compaction/schema),
and [workspace memory](https://docs.openclaw.ai/concepts/agent-workspace).
