Skip to main content

Sessions

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

Session modes

fresh (default)

The agent starts a new session with no memory of previous steps.
- name: review
  agent: claude-opus
  session: fresh
This is the default. Omit session for the same behavior. Use fresh sessions for reviewers (to avoid confirmation bias from the implementation) and for steps that should be independent.

reuse

Resume the session from the last step by the same agent in the same group.
- name: build
  foreach: decompose
  steps:
    - name: tests
      agent: claude-haiku
      prompt: "Write tests for: {item.description}"

    - name: impl
      agent: claude-haiku
      session: reuse
      prompt: "Implement code to pass the tests."
The impl step resumes the tests step’s session. The agent remembers writing the tests and can build on that context. Both steps must use the same agent. Session reuse is scoped to the current group iteration. In a foreach, each item starts fresh — reuse only chains steps within the same item.

reuse-on-retry

Fresh on the first attempt, resumes its own session on retry.
- name: impl
  agent: claude-sonnet
  session: reuse-on-retry
  gate: [compile, test]
  on_failure:
    retry: 3
    strategy: [same]
On the first attempt, the agent starts fresh. If the gate fails and Gump retries, the agent resumes its own session — it remembers what it tried and why it failed. This is useful when the fix is incremental rather than a full rewrite. Note: escalation to a different agent always forces a fresh session (different agent = incompatible session).

reuse: step-name

Resume the session from a specific named step. Explicit control over which context to continue from.
- name: fix
  agent: claude-sonnet
  session: "reuse: analyze"
  prompt: "Fix the issue based on your analysis."
The fix step continues from the analyze step’s session. Both must use the same agent. If the target step hasn’t been executed or uses a different agent, a fresh session is used instead.

Sessions and retries

On retry (attempt > 1), sessions are always fresh by default. The agent gets a clean start with error context injected via {error} and {diff}. This prevents the agent from getting stuck in the same reasoning loop. Exception: reuse-on-retry explicitly opts into continuing the session across retries. On escalation (different agent), sessions are always fresh. Session IDs are provider-specific and incompatible across agents.

Sessions and providers

Each agent provider has its own session mechanism:
AgentSession ID formatResume flag
Claude CodeUUID--resume <uuid>
CodexThread IDresume <thread-id>
GeminiImplicit (per-directory)--resume
QwenUUID--resume <uuid>
OpenCodeses_ prefix--session <ses_id>
CursorUUID--resume <uuid>
Cross-provider resume is blocked at the engine level. If you try to reuse a Claude session from a Qwen step, Gump falls back to a fresh session.