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

# Loading trajectories

> Load a previous trajectory into an agent session.

| Level              | Configuration                                     | Formats      | Agents                 |
| ------------------ | ------------------------------------------------- | ------------ | ---------------------- |
| Task               | `trajectory.json` in the instruction directory    | ATIF         | `claude-code`, `codex` |
| Run (job or trial) | `--load-trajectory` or `agents[].load_trajectory` | ATIF, native | `claude-code`, `codex` |

## Task-level loading

### ATIF trajectories

Place an ATIF file named `trajectory.json` in the same directory as
`instruction.md`. For a multi-step task, place it in the first step's directory.
Harbor loads it when the agent supports ATIF loading.

[Task-level ATIF example](https://github.com/harbor-framework/harbor/tree/main/examples/tasks/hello-load-atif-trajectory-task-level)

```bash theme={"system"}
uv run harbor run \
  -p examples/tasks/hello-load-atif-trajectory-task-level \
  -a codex -m openai/gpt-5.6-sol -e daytona
```

## Run-level loading

Run-level loading overrides task-level loading.

`.json` selects ATIF. Other suffixes select the agent's native loader. The
`claude-code` and `codex` native loaders expect `.jsonl` and validate filenames.

`load_trajectory` cannot be combined with a simulated `user_agent`.

### Native trajectories

Native trajectories are agent-specific `.jsonl` session files. Loading one is
lossless and requires the same agent. Harbor stores them under
`agent/sessions/`:

[Run-level native example](https://github.com/harbor-framework/harbor/tree/main/examples/tasks/hello-load-native-trajectory)

```bash theme={"system"}
uv run harbor run \
  -p examples/tasks/hello-load-native-trajectory \
  -a claude-code -m opus -e daytona \
  --load-trajectory examples/tasks/hello-load-native-trajectory/environment/d7d4e19e-608d-44ef-b166-cd050ef274ba.jsonl
```

| Agent         | Native trajectory file                            |
| ------------- | ------------------------------------------------- |
| `claude-code` | `agent/sessions/projects/-app/<session-id>.jsonl` |
| `codex`       | `agent/sessions/<YYYY>/<MM>/<DD>/rollout-*.jsonl` |

Keep the filename when moving the file; the agent uses it to identify the
session.

### ATIF trajectories

Harbor stores [ATIF](/core-concepts/agents/atif) output at
`agent/trajectory.json`. ATIF is portable: Harbor converts it to the loading
agent's native format, allowing one agent's trajectory to seed another.

[Run-level ATIF example](https://github.com/harbor-framework/harbor/tree/main/examples/tasks/hello-load-atif-trajectory-run-level)

```bash theme={"system"}
uv run harbor run \
  -p examples/tasks/hello-load-atif-trajectory-run-level \
  -a codex -m openai/gpt-5.6-sol -e daytona \
  --load-trajectory examples/tasks/hello-load-atif-trajectory-run-level/environment/trajectory.json
```

Conversion preserves supported messages, tool calls, and tool results. It may
omit agent-specific details, system messages, and non-text content.

Agents declare support for each format with
`capabilities.load_native_trajectory` and `capabilities.load_atif_trajectory`.
Unsupported formats, missing files, invalid ATIF, and invalid native filenames
fail before startup. Invalid native contents may fail during resume.

The examples above use the CLI. To use a job config instead:

```json theme={"system"}
{
  "agents": [
    {
      "name": "codex",
      "load_trajectory": "path/to/trajectory.json"
    }
  ]
}
```

## What is restored

Native loading restores the native session. ATIF loading restores portable
conversation content. Neither restores sandbox files.

For [multi-step tasks](/core-concepts/tasks/multi-step), loading occurs before
the first step. With `--resume-trajectory`, sessions are
`(load, resume, resume, ...)`; otherwise, `(load, fresh, fresh, ...)`.
