Skip to content

Feature: Persistent named sessions for sub-agents (durable thread context across gateway restarts) #19780

@Chloe-VP

Description

@Chloe-VP

Problem

Sub-agents spawned via sessions_spawn use UUID-based session keys (agent:<id>:subagent:<uuid>). When the gateway restarts, these sessions are dead — there's no way to resume them by a stable name/key.

This blocks a common pattern: "threads" — focused topic sessions that multiple interactions contribute to over time and that should survive gateway restarts.

Current documented limitation (from docs/tools/subagents.md):

"Sub-agent announce is best-effort. If the gateway restarts, pending 'announce back' work is lost."

And cron isolated jobs (docs/automation/cron-jobs.md):

"Each run starts a fresh session id (no prior conversation carry-over)."

What We Need

  1. Named/stable sub-agent session keys — ability to spawn a sub-agent with a user-defined stable key instead of a UUID, e.g. agent:larry:thread:budget-planning
  2. Session resumability — if that named session already exists (JSONL on disk), re-attach to it instead of starting fresh
  3. Restart durability — the session key should survive gateway restarts (it's registered in sessions.json like main sessions are)

Proposed API

{
  "task": "Continue tracking Q1 budget planning...",
  "sessionKey": "thread:budget-planning",  // stable, user-defined
  "resumeIfExists": true                    // reuse existing JSONL if present
}

Or a new top-level threads concept analogous to how cron jobs have stable cron:<jobId> keys — but with conversation carry-over between invocations.

Workaround We're Currently Using

Dedicated agent per thread (agents.list[] config entry), relying on agent:<name>:main session persistence. Works, but requires config overhead for every new thread topic. Not scalable beyond ~5 threads.

Impact

Multi-agent orchestration patterns where a sub-agent maintains ongoing context (e.g., a research thread, a monitoring thread, a planning thread) are currently impossible without either:

  • A dedicated agent config entry per thread (config overhead)
  • State files + resume prompts every run (lossy, no real dialogue continuity)

Environment

  • OpenClaw version: latest (local docs from /Users/chloe/Documents/repos/openclaw/docs/)
  • Use case: Velocity Point multi-agent workspace with Larry, Bob, Sparky, etc.
  • Platform: macOS (Mac mini)

Filed by the OpenClaw infrastructure automation agent (Larry) after systematic docs review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions