sessions

A description of how clisbot identifies and routes chat sessions across services such as Slack, Telegram, Codex, Claude Code, and Gemini CLI. A session is the ongoing conversation that a user continues over time.

In plain words
What is it for?
Use it when designing or troubleshooting conversation routing, session resumes, session resets, or shared conversations across chat surfaces.
Why use it?
It explains why one routed chat may keep the same conversation while its underlying session changes after a reset, expiry, or new-session command.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/longbkit/clisbot/sessions
Clone the repo
git clone --depth 1 https://github.com/longbkit/clisbot
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,468 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03468
Opus 5 $0.00000 $0.01734
Sonnet 5 $0.00000 $0.00694
Haiku 4.5 $0.00000 $0.00347

Measured 2d ago against content hash f76473ecc88f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sessions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/features/agents/sessions.md · 393 lines

How it starts

The opening of the file, as written. The whole thing — 393 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Session Identity

Purpose

This document defines the current session model used by clisbot.

It stays close to OpenClaw's agentId plus sessionKey mental model, but adapts it to subscription-backed AI CLIs such as Codex, Claude Code, and Gemini CLI where the tool already has its own native conversation id.

Simple Mental Model

  • by default, one routed chat surface maps to one sessionKey
  • that sessionKey is the clisbot-side conversation the user is talking to
  • routing policy may intentionally let multiple surfaces continue the same sessionKey
    • examples:
      • one personal assistant conversation shared across Slack DM and Telegram DM
      • a Slack channel and Slack thread intentionally collapsed into one conversation
  • at one moment, one sessionKey maps to one active sessionId
  • over time, that same sessionKey may rotate to a different sessionId
    • examples:
      • chat /new
      • later explicit session resume or rebind
      • backend-driven reset or expiry
  • users usually do not need to care about this mapping directly
    • normal chat keeps using the current conversation automatically

Common reader questions:

  • Who owns the active sessionKey -> sessionId mapping?
    • SessionService
  • Where does sessionId come from?
    • either the native tool creates it, or SessionService chooses one before launch
  • Who only uses that sessionId?
    • RunnerService and the lower-level code under src/runners/tmux/*
  • Can multiple chat surfaces share one conversation?
    • yes, if routing intentionally maps them to the same sessionKey

Current Contract

clisbot currently owns three different identities:

  • agentId
    • durable agent owner
    • selects workspace, defaults, tools, skills, and policy
  • sessionKey
    • durable logical conversation key
    • isolates queueing, routing, and continuity for one clisbot conversation
    • by default this means one DM, group, channel, topic, or thread
    • routing policy may intentionally let multiple surfaces continue the same conversation key
  • sessionId
    • current active AI CLI conversation id attached to that sessionKey at this time
    • may change later while the same sessionKey continues
    • persisted in ~/.clisbot/state/sessions.json

Read the full file on GitHub · 393 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 393 lines · 0 tokens per session scan A f76473ecc88f

Subscribe to this mod's changes

sessions is an agent published in the GitHub repository longbkit/clisbot (114 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,468 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.