# Cline

> Import Cline task history from VS Code and JetBrains, and Cline CLI, desktop, and SDK sessions, as two separate sources.

Cline keeps two separate local histories. Older extensions retain task folders.
Current SDK-based clients, including extension 4.x, the CLI, and the desktop
app, save session folders under `~/.cline/data/sessions`.

## Source IDs

| Source      | Use it for                                             |
| ----------- | ------------------------------------------------------ |
| `cline`     | VS Code and JetBrains task folders.                    |
| `cline-cli` | CLI, desktop, JetBrains, and other SDK-based sessions. |

## How the import works

For `cline`, each task folder must contain the task's API history. When the
folder also has Cline's UI history file, Hansard uses it for the order you saw
in Cline, even when it is empty. The older UI file is used only when the
current one is missing. The API history adds detail to matching UI messages,
and Hansard counts any API messages it cannot match. A task with no UI file is
rebuilt from its API history alone, and Hansard assigns the message times.

Cline's shared task history index serves only as a hint. A matching entry can
supply a title, workspace, model, and usage. If the index file is damaged,
Hansard keeps a copy, reports the problem, and still imports each task from its
own folder. An unrelated entry in the index never changes which task a
conversation belongs to.

For `cline-cli`, Hansard reads version 1 SDK session manifests, message files,
optional compaction files, and child session files. It keeps text, images,
files, thinking, tool calls and results, model details, and optional metrics.
A session with a version or message type Hansard does not recognize is not
imported, rather than imported with gaps.

The two histories use different layouts and IDs, so Hansard never assumes that
a session in one is a copy of a session in the other. Child and team sessions
become their own conversations, linked to their parent. Importing again updates
sessions with the same ID and leaves other task folders alone.

## Import and keep current

**Import now**

```sh
hansard import --sources cline,cline-cli --since all
hansard index rebuild
```

**Keep current**

With **Automatic** source selection, the watcher already includes both
sources. With a **Custom** list, enable them. The watcher picks them up within 30 seconds:

```sh
hansard config sources enable cline,cline-cli
```

## Review the import in the app

1. When the import finishes, open **Conversations** and select **Filter & sort**.
2. Set **Source** to **Cline or Cline CLI** 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.

## What Hansard preserves

- The task's API history, the UI history Cline displayed, the older UI file and
  task details when they exist, and an exact copy of the shared task index.
- SDK session start and end times, status, exit code, working directory, model
  provider, model, title, tokens, cache usage, and cost.
- SDK messages, tool calls and results, attachment details, thinking, usage,
  compaction points, and linked subagent and team task sessions.

## Known limitations

- A task that exists only in a task folder cannot gain model or token details
  that only the SDK history records.
- Hansard checks only the basic structure of compaction files, and their
  messages do not appear in the conversation.
- Hansard does not read live Git state, checkpoints, shared SDK index files,
  settings, rules, workflows, or MCP configuration as part of a Cline session.
- To reopen a task, use Cline's own history view. Hansard does not offer a
  resume command for Cline.
- A child session that is still running stays its own linked conversation. Its
  messages and tokens are not added to the parent.

> **Two histories, one name:** Import both source IDs to get all of your Cline history. Sessions in the two
> histories never share IDs, so importing one never covers the other.

## Refresh an existing archive

```sh
hansard import --sources cline,cline-cli --since all
hansard index rebuild
```
