# Zed

> Import Zed Agent Panel conversations, historical text threads, and local instructions.

Zed's native agent saves conversations locally. Hansard imports that history,
including older editable text threads, and backs up local instructions.

## Source IDs

| Source | Use it for                                                       |
| ------ | ---------------------------------------------------------------- |
| `zed`  | Native Zed Agent SQLite threads and historical text-thread JSON. |

## How the import works

Zed saves native threads in `threads/threads.db` beneath its data directory:
`~/Library/Application Support/Zed` on macOS, `$XDG_DATA_HOME/zed` (normally
`~/.local/share/zed`) on Linux, or `%LOCALAPPDATA%/Zed` on Windows. Hansard reads
a consistent database snapshot, including committed WAL records, while Zed
remains open. Compressed threads require Node.js with Zstandard support or
the `zstd` command on `PATH`. Flatpak's standard data directory is also checked.

The importer also reads native thread titles and workspace information from
Zed's sidebar database. Remote workspace paths stay recorded context and do not
become local working directories. External ACP agents and terminal agents retain
their own provider histories; sidebar entries alone are not imported as Zed
conversations. Historical text threads come from `conversations/*.zed.json`
beneath Zed's configuration directory on macOS and its data directory elsewhere.
Set `HANSARD_ZED_ROOTS` to a path-separated list of custom `--user-data-dir`
roots; their configuration lives in each root's `config` subdirectory.

## Import and keep current

**Conversation history**

```sh
hansard import --source zed --since all
```

Enable Zed in **Settings → Imports**, or run:

```sh
hansard config sources enable zed
```

The watcher follows native databases and historical text files.

**Memories and instructions**

To back up instructions, run:

```sh
hansard memory backup
```

Backups include global `AGENTS.md`, the first matching project guidance file,
and historical Rules Library records. Skill folders are not memories and are
not backed up.

## Review the import in the app

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

Open a native conversation to review prompts, thinking, tool results, and edit
diffs. Select Zed in **Stats** to inspect cumulative token totals. Continue a
saved conversation from Zed's **Threads Sidebar**; Zed does not expose a native
thread-resume CLI command.

## What Hansard preserves

- Native text, thinking, images, file mentions, tool arguments and results,
  recorded edit diffs, errors, compaction summaries, and parent/child links.
- Cumulative input, output, cache-read, and cache-write usage when available.
- Recorded workspace and repository context, last model selection, profile,
  thinking settings, and drafts in source metadata.
- A consistent copy of the native thread database, matching sidebar row
  extracts, and exact historical text-thread files.
- Global `AGENTS.md` and first-matching project guidance through memory
  backup.
- Historical Rules Library records when the LMDB `mdb_dump` utility is on
  `PATH`. These records are read-only in Hansard.

## Known limitations

Native threads save only the last selected model, so their cumulative tokens
remain unattributed and unpriced. The saved model is retained as metadata;
it cannot establish which model generated earlier requests. Request token
usage is a context-size gauge and is excluded from accounting totals.

Native messages lack individual wall clocks. Start time uses the earliest
available project snapshot or first-save time; older databases may only have
last-update time. Historical text threads preserve editable message boundaries
but no measured usage, tool execution records, repository identity, or reliable
message times. Their logical clocks are not dates. No token estimate is added.

External agents, shared thread links, credentials, settings, diagnostic logs,
editor state, and unsaved in-memory content are outside this source. Unknown
native record types remain in raw history and are counted in session metadata.
If the historical Rules Library exists but `mdb_dump` is unavailable, memory
backup reports the missing utility and continues backing up file instructions.

## Refresh an existing archive

```sh
hansard import --source zed --since all
```

Unchanged threads are skipped. Continued threads update their existing archive
identity; changing another row in the same database does not reimport them.
No other provider needs a reimport.
