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

# Sessions

> Sessions control whether an agent starts fresh or continues from a previous step.

# Sessions

Sessions control whether an agent starts fresh or continues from a previous step's conversation. This affects the agent's context window — a resumed session retains memory of previous work.

## Session modes

### new (default)

The agent starts a new session with no memory of previous steps.

```yaml theme={null}
- name: review
  type: validate
  run:
    agent: claude-opus
  get:
    session: new
```

This is the default. Omit `session` for the same behavior. Use new sessions for reviewers (to avoid confirmation bias) and for steps that should be independent.

### from: step-name

Resume the session from a specific named step. The agent keeps full context.

```yaml theme={null}
- name: build
  type: split
  ...
  each:
    - name: tests
      type: code
      run:
        agent: claude-haiku
      get:
        prompt: "Write tests for: {task.description}"

    - name: impl
      type: code
      run:
        agent: claude-haiku
      get:
        session: from: tests
        prompt: "Implement code to pass the tests."
```

The impl step resumes the tests step's session. Both steps must use the same agent. If the target step hasn't executed or uses a different agent, Gump falls back to `new` with a warning.

Session via `from:` is scoped to the current task iteration. In an `each:` block, each task starts fresh — `from:` only chains steps within the same task.

## Sessions and retries

In retry, the default behavior is to **keep the session** from the previous attempt (no keyword needed). The agent continues its conversation with the error context now in the state.

If the agent changes in retry (escalation), Gump automatically forces `session: new` + warning. Different agent = incompatible session.

If `session: new` is explicitly set as a retry override, the agent starts a fresh session on that attempt.

## Sessions and providers

Each agent provider has its own session mechanism:

| Agent       | Session ID format | Resume flag          |
| ----------- | ----------------- | -------------------- |
| Claude Code | UUID              | `--resume <uuid>`    |
| Codex       | Thread ID         | `resume <thread-id>` |
| Gemini      | Implicit          | `--resume`           |
| Qwen        | UUID              | `--resume <uuid>`    |
| OpenCode    | `ses_` prefix     | `--session <ses_id>` |
| Cursor      | UUID              | `--resume [chatId]`  |

Cross-provider resume is blocked at the engine level.
