Teamgram Session Layer & Authsession for Openclaw

A comprehensive documentation skill for understanding the session routing layer and authsession service within the Teamgram Server architecture.

zhihang9978
v1.0.0
Mar 15, 2026
0
830
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install teamgram-session-layer

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install teamgram-session-layer using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Teamgram Session Layer & Authsession?

The Teamgram Session Layer skill provides deep technical insights into the interface.session and service.authsession components of the Teamgram Server. It explains how the system aggregates TLMessage2 streams from the gateway by auth_key_id, manages multiple sessions per key, and maintains security salts.

This knowledge base is essential for developers working on Openclaw Skills to understand how MTProto RPC requests are routed to Backend-for-Frontend (BFF) modules and how user-to-auth_key bindings are persisted and managed for risk control and push notifications.

Teamgram Session Layer & Authsession Use Cases

  • Understanding the aggregation of Perm, Temp, and MediaTemp authorization keys.
  • Configuring IDMap routing for new BFF modules to avoid METHOD_NOT_IMPL errors.
  • Analyzing backpressure and reliability mechanisms using runLoop and rpcRunLoop.
  • Mapping AuthKeyId to UserId for session persistence and security auditing.

How Teamgram Session Layer & Authsession Works

  1. The session service receives TLMessage2 streams from gnetway and aggregates them by auth_key_id.
  2. MainAuthWrapper manages three types of session lists (Main, Temp, and MediaTemp) using decoupled data and control channels.
  3. The session service consults the IDMap configuration to route MTProto RPC calls to the appropriate BFF service via Etcd.
  4. Outgoing updates and RPC results from the sync service are dispatched back to specific session connections.
  5. The authsession service provides persistent storage and querying for session metadata, including device info and layer versions.

Teamgram Session Layer & Authsession Setup

This is a documentation and knowledge-based skill for Openclaw Skills. To use it as a reference for Teamgram development, ensure you have the server environment configured:

# Example session service configuration
cat teamgramd/etc/session.yaml

# Example authsession service configuration
cat teamgramd/etc/authsession.yaml

Teamgram Session Layer & Authsession Data Schema & Taxonomy

The session layer organizes data through internal queues and external service mappings:

Component Data Responsibility
IDMap Maps MTProto RPC paths (e.g., /mtproto.RPCMessages) to BFF service keys.
MainAuthWrapper Segregates PermAuth, TempAuth, and MediaTempAuth sessions.
authsession DB Persists AuthKeyId, UserId, and client metadata (device, layer, initConnection).
SessionDataChan Buffer for incoming payloads from gnetway/sync.

Teamgram Session Layer & Authsession Advanced Features

  • Support for multi-session maintenance under a single auth_key.
  • Future_salt cache management for cryptographic security.
  • Backpressure sensing via ErrDataChannelFull to prevent silent packet drops.
  • Integrated go-zero RPC metadata construction for downstream service calls.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*