picoclaw

Session Guide

Back to README

PicoClaw sessions decide which messages share the same conversation history. If your bot “remembers too much” or “forgets too much”, the first thing to check is the session configuration.

This guide is for users configuring session behavior in config.json. For implementation details, see the architecture docs instead.

What Sessions Control

A session controls:

Session data is stored under your workspace, typically:

~/.picoclaw/workspace/sessions/

Quick Start

Default: one context per chat

This is the default and is the right choice for most bots.

{
  "session": {
    "dimensions": ["chat"]
  }
}

Use this when:

Separate each user inside a group

If users in the same group should not share memory, add sender:

{
  "session": {
    "dimensions": ["chat", "sender"]
  }
}

Use this when:

Share one context across multiple rooms in the same workspace or guild

If your channel exposes a space value, you can route by workspace or guild instead of by room:

{
  "session": {
    "dimensions": ["space"]
  }
}

Use this when:

Split by thread or forum topic

If your channel exposes topic, you can isolate per thread:

{
  "session": {
    "dimensions": ["chat", "topic"]
  }
}

Use this when:

Available Dimensions

Dimension What it means Good for
space Workspace, guild, or similar top-level container One shared assistant across many rooms
chat Direct chat, group, or channel Default per-room isolation
topic Thread, topic, or forum sub-channel Keep threaded discussions separate
sender The message sender after normalization Per-user context inside shared rooms

Not every channel provides every field. If a channel does not supply space or topic, those dimensions simply have no effect for that message.

Important Behavior

Sessions are always separated by agent

Even if two agents receive messages from the same chat, they do not share one session.

Sessions are still separated by channel and account

session.dimensions adds finer-grained isolation, but PicoClaw still keeps a baseline separation by:

That means an empty or very small dimensions list does not create one global memory across every platform.

Telegram forum topics already stay isolated in the default chat mode

Telegram forum messages keep topic isolation by default even when dimensions only contains chat. You usually do not need a special workaround for Telegram forums.

Summaries happen per session

summarize_message_threshold and summarize_token_percent apply inside each session independently. If you create smaller sessions, summarization also happens on smaller per-session histories.

Common Recipes

One shared assistant per group or direct chat

{
  "session": {
    "dimensions": ["chat"]
  }
}

One context per user inside each chat

{
  "session": {
    "dimensions": ["chat", "sender"]
  }
}

One context per sender across one workspace or guild

{
  "session": {
    "dimensions": ["space", "sender"]
  }
}

This is useful for workspace-wide assistants where each user should keep their own memory while moving across rooms in the same workspace.

Use a different session policy for one routed agent only

You can keep the global default and override it for one dispatch rule:

{
  "agents": {
    "list": [
      { "id": "main", "default": true },
      { "id": "support" }
    ],
    "dispatch": {
      "rules": [
        {
          "name": "support group",
          "agent": "support",
          "when": {
            "channel": "telegram",
            "chat": "group:-1001234567890"
          },
          "session_dimensions": ["chat", "sender"]
        }
      ]
    }
  },
  "session": {
    "dimensions": ["chat"]
  }
}

In this example:

session.identity_links helps when the same user may appear under multiple raw sender IDs and you want PicoClaw to treat them as one sender identity.

Example:

{
  "session": {
    "dimensions": ["chat", "sender"],
    "identity_links": {
      "john": ["slack:u123", "u123", "legacy-user-42"]
    }
  }
}

This is mainly useful for:

Current limitation:

Troubleshooting

Users in one group are sharing memory

Your current session is probably keyed only by chat. Switch to:

{
  "session": {
    "dimensions": ["chat", "sender"]
  }
}

The same user does not share memory across Slack and Telegram

That is expected. PicoClaw still separates sessions by channel even if you use sender.

Threads are mixing together

Add topic when the channel provides one:

{
  "session": {
    "dimensions": ["chat", "topic"]
  }
}

Old sessions seem to use legacy keys

That is normal during migration. PicoClaw keeps compatibility with older agent:... session keys while moving runtime storage to opaque canonical keys.