Session Management
A Session is the context container under an Agent. It owns the conversation thread, transcript, token counters, task attachments, delivery hints, model overrides, and reset state for one route of work. The high-level model is:Session Keys
Fased stores session rows bysessionKey.
Common keys:
| Source | Shape |
|---|---|
| Main direct chat | agent:<agentId>:<mainKey> |
| Per-peer DM | agent:<agentId>:direct:<peerId> |
| Per-channel DM | agent:<agentId>:<channel>:direct:<peerId> |
| Per-account DM | agent:<agentId>:<channel>:<accountId>:direct:<peerId> |
| Group/channel chat | agent:<agentId>:<channel>:group:<id> or agent:<agentId>:<channel>:channel:<id> |
| Thread/topic | append :thread:<threadId> when supported |
| Task run | cron:<job.id> internally |
| Webhook | hook:<uuid> unless explicitly set |
| Node run | node-<nodeId> |
session.dmScope when one Agent can receive private DMs from multiple people.
Older topic-aware channel paths can also contain a :topic:<threadId> suffix;
new shared routing uses :thread:<threadId>.
DM Isolation
Usesession.dmScope to control how direct messages are grouped:
main: all DMs share the Agent main session.per-peer: isolate by sender id across channels.per-channel-peer: isolate by channel and sender.per-account-channel-peer: isolate by account, channel, and sender.
per-channel-peer or
per-account-channel-peer. Use session.identityLinks when the same person
should share a canonical session across multiple channels.
fased security audit to review current DM isolation settings.
Gateway Source Of Truth
The gateway owns session state. UI clients should query gateway APIs instead of reading local session files. State lives on the gateway host:- Store:
~/.fased/agents/<agentId>/sessions/sessions.json - Transcript:
~/.fased/agents/<agentId>/sessions/<SessionId>.jsonl - Topic transcript:
.../<SessionId>-topic-<threadId>.jsonl
sessionIdupdatedAtdisplayName,channel,subject,room,space- token counters:
inputTokens,outputTokens,totalTokens,contextTokens - model/thinking/verbose overrides
- delivery hints and origin metadata
Origin Metadata
Session rows record best-effort origin metadata so UIs can explain where a session came from:labelproviderfrom/toaccountIdthreadId
Reset And Lifecycle
Fased reuses a session until a reset rule expires it or the user resets it. Default behavior:- daily reset at 4:00 AM local time on the gateway host
- optional idle reset with
session.idleMinutes - per-type overrides with
resetByType - per-channel overrides with
resetByChannel /newand/resetcreate a fresh session id- isolated task runs use a fresh
sessionIdper run
Maintenance
Session maintenance keeps session metadata and transcript artifacts bounded. Defaults:| Setting | Default |
|---|---|
session.maintenance.mode | warn |
pruneAfter | 30d |
maxEntries | 500 |
rotateBytes | 10mb |
resetArchiveRetention | same as pruneAfter |
maxDiskBytes | disabled |
mode: "enforce" to apply cleanup automatically.
maxDiskBytes and highWaterBytes.
Send Policy
Use send policy to block delivery for whole classes of sessions./send on/send off/send inherit
Named Channel Sessions
Channel chats can create named child sessions under the current route:/session switch go to the active named child session.
Tasks created from channel chat or WebChat attach to the active Agent/session.
WebChat exposes this through Schedule this.
Inspecting Sessions
Useful inspection commands:/statuschecks reachability and current context state./context listshows injected context contributors./compactsummarizes older context./stopaborts the active run for that session.