> ## Documentation Index
> Fetch the complete documentation index at: https://agent-memory.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Crystals and replay

> Compress finished work, import transcripts, replay sessions

## Crystallize

`memory_crystallize` (`POST /agentmemory/crystals/create`) takes a list of completed action IDs and asks the LLM to compress the chain into a crystal: a narrative, key outcomes, files affected, and lessons. Every action must be `done` or `cancelled`; anything still in flight is rejected. Requires a provider key.

`POST /agentmemory/crystals/auto` sweeps done actions past a cutoff that are not yet crystallized, groups them by parent action or project, and crystallizes each group. `dryRun: true` returns the groups without writing. `GET /agentmemory/crystals` lists crystals by project or session.

Crystals also come from session end: one per session with narrative, key outcomes, files touched, and lessons surfaced, kept after raw observations are pruned.

## Import JSONL transcripts

```bash theme={"dark"}
npx @agentmemory/agentmemory import-jsonl
```

Scans `~/.claude/projects` (or a path you pass) for Claude Code JSONL transcripts and imports them as sessions with observations, deriving crystals and lessons. The same operation is `POST /agentmemory/replay/import-jsonl`. Imported sessions are searchable through the normal recall surface.

| Guard                   | Behavior                                                                                              |
| ----------------------- | ----------------------------------------------------------------------------------------------------- |
| `--max-files`           | Scan cap, default 200, hard upper bound 1000; out-of-range requests are rejected at the HTTP layer    |
| Symlinks                | Refused                                                                                               |
| Sensitive-looking paths | Refused                                                                                               |
| Imported records        | Stamped with origin channel `import` and indexed into BM25 and the vector store as part of the import |

## Replay

`GET /agentmemory/replay/sessions` lists imported sessions; `GET /agentmemory/replay/load` returns one for playback. The viewer's Replay tab plays these transcripts as a timeline, and the Timeline tab defaults to the session with the most observations.
