# Kimi

> Import Kimi Code and Kimi CLI sessions from their session journals, with subagents as linked conversations.

Kimi Code and historical Kimi CLI save different session journals. Hansard
imports them as two source IDs. Kimi CLI 1.52.0 redirects its public entry
point to the Kimi Code installer. Installing it does not create historical
Kimi CLI sessions.

## Source IDs

| Source      | Use it for                                                                                  |
| ----------- | ------------------------------------------------------------------------------------------- |
| `kimi-code` | Kimi Code sessions and agent journals in `~/.kimi-code/sessions`.                           |
| `kimi-cli`  | Kimi CLI wire journals, context history, state, and subagent records in `~/.kimi/sessions`. |

## How the import works

Hansard reads Kimi Code and Kimi CLI from their own folders and checks each
file's format before importing it. For Kimi Code, it supports wire journal
protocol versions 1.0 through 1.5, plus an older version 1.4 layout without a
header. For Kimi CLI, it supports context journals, an older version 1.1 layout
without a header, and wire protocol versions 1.1 through 1.10. Hansard decides
the format from the file itself, not from the Kimi release that wrote it.

Every record in a session either becomes part of the conversation, is
summarized in the session's details, or is left out for a recorded reason. A
session with an unknown record type, a damaged tool call, or input that would
turn into nothing is not imported, rather than imported with gaps. When a Kimi
CLI session has a damaged context file next to a valid wire journal, Hansard
keeps the damaged file but does not use it.

Agent journals and subagent folders become their own conversations, linked to
the parent, instead of being inserted into it. Because the two Kimi agents use
different formats, Hansard never merges their sessions only because the content
looks alike. A Kimi CLI parent session may have no model name even when a
subagent records one, and Hansard shows that difference as it is.

## Import and keep current

**Import now**

```sh
hansard import --sources kimi-code,kimi-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 kimi-code,kimi-cli
```

## Review the import in the app

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

- Reasoning, tool calls and results, input and output tokens, turn boundaries,
  and the wire protocol version.
- Kimi Code agent journals and child sessions as linked conversations.
- Kimi CLI subagent folders as linked conversations, without adding their
  messages or tokens to the parent.
- Exact copies of the Kimi Code wire and state files, the shared session index,
  workspace list, and referenced `blobref` attachment bytes. A session is
  rejected when a referenced attachment is missing or changed.
- Exact copies of the Kimi CLI wire, context, state, working directory list,
  and subagent files. The wire journal is the conversation; the context file is
  used only when no wire journal exists.
- The working directory, when its hash matches an entry in Kimi's
  configuration.

## Known limitations

- Kimi Code 2.1.1 adds records within protocol 1.5. Scheduled tasks, plugin
  context, mirrored subagent events, context estimates, retry diagnostics,
  and checkpoint references remain raw-only with explicit accounting.
- External file-history and checkpoint bytes are not acquired. Mirrored child
  usage and context estimates never increase the parent's billed token totals.
- Kimi CLI records a model only when it starts a subagent, so ordinary turns
  may have no model.
- A session whose working directory hash no longer matches Kimi's
  configuration has no project.
- A newer journal format or record type is not imported until Hansard adds
  support for it.

> **Keep Kimi's original files:** When a newer Kimi release changes its journal format, keep Kimi's session
> folders. After Hansard adds support for the new format, a reimport reads them.

## Refresh an existing archive

To reread stale Kimi Code sessions from available provider files:

```sh
hansard rebuild --stale-parsers --source-type kimi-code-history
```

To replay preserved Kimi Code files without reading the provider's store:

```sh
hansard rebuild --from-raw --source-type kimi-code-history --since all
```

Neither command requires a complete archive reimport or a separate index rebuild.
Use `hansard import --source kimi-cli --since all` for historical Kimi CLI files.
Kimi CLI 1.52.0 redirects to the Kimi Code installer. That installer does not
create historical CLI sessions, but retained `kimi-cli` stores remain importable.
