diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf8ee14d..10d6624cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Security: add `clawdbot security audit` (`--deep`) and surface it in `status --all` and `doctor`. - Onboarding: add a security checkpoint prompt (docs link + sandboxing hint); require `--accept-risk` for `--non-interactive`. - Docs: expand gateway security hardening guidance and incident response checklist. +- Docs: document DM history limits for channel DMs. (#883) — thanks @pkrmf. ### Fixes - Embedded runner: suppress raw API error payloads from replies. (#924) — thanks @grp06. diff --git a/docs/channels/discord.md b/docs/channels/discord.md index eaa8dfa0a..689d84dde 100644 --- a/docs/channels/discord.md +++ b/docs/channels/discord.md @@ -300,6 +300,7 @@ ack reaction after the bot replies. - `maxLinesPerMessage`: soft max line count per message. Default: 17. - `mediaMaxMb`: clamp inbound media saved to disk. - `historyLimit`: number of recent guild messages to include as context when replying to a mention (default 20; falls back to `messages.groupChat.historyLimit`; `0` disables). +- `dmHistoryLimit`: DM history limit in user turns. Per-user overrides: `dms[""].historyLimit`. - `retry`: retry policy for outbound Discord API calls (attempts, minDelayMs, maxDelayMs, jitter). - `actions`: per-action tool gates; omit to allow all (set `false` to disable). - `reactions` (covers react + read reactions) diff --git a/docs/channels/imessage.md b/docs/channels/imessage.md index 8c751f0e2..6d98b9f73 100644 --- a/docs/channels/imessage.md +++ b/docs/channels/imessage.md @@ -189,6 +189,7 @@ Provider options: - `channels.imessage.groupPolicy`: `open | allowlist | disabled` (default: allowlist). - `channels.imessage.groupAllowFrom`: group sender allowlist. - `channels.imessage.historyLimit` / `channels.imessage.accounts.*.historyLimit`: max group messages to include as context (0 disables). +- `channels.imessage.dmHistoryLimit`: DM history limit in user turns. Per-user overrides: `channels.imessage.dms[""].historyLimit`. - `channels.imessage.groups`: per-group defaults + allowlist (use `"*"` for global defaults). - `channels.imessage.includeAttachments`: ingest attachments into context. - `channels.imessage.mediaMaxMb`: inbound/outbound media cap (MB). diff --git a/docs/channels/msteams.md b/docs/channels/msteams.md index 67573e6c2..4c48ba327 100644 --- a/docs/channels/msteams.md +++ b/docs/channels/msteams.md @@ -208,6 +208,7 @@ This is often easier than hand-editing JSON manifests. ## History context - `channels.msteams.historyLimit` controls how many recent channel/group messages are wrapped into the prompt. - Falls back to `messages.groupChat.historyLimit`. Set `0` to disable (default 50). +- DM history can be limited with `channels.msteams.dmHistoryLimit` (user turns). Per-user overrides: `channels.msteams.dms[""].historyLimit`. ## Current Teams RSC Permissions (Manifest) These are the **existing resourceSpecific permissions** in our Teams app manifest. They only apply inside the team/chat where the app is installed. diff --git a/docs/channels/signal.md b/docs/channels/signal.md index 41a098d50..e19c6579b 100644 --- a/docs/channels/signal.md +++ b/docs/channels/signal.md @@ -124,6 +124,7 @@ Provider options: - `channels.signal.groupPolicy`: `open | allowlist | disabled` (default: allowlist). - `channels.signal.groupAllowFrom`: group sender allowlist. - `channels.signal.historyLimit`: max group messages to include as context (0 disables). +- `channels.signal.dmHistoryLimit`: DM history limit in user turns. Per-user overrides: `channels.signal.dms[""].historyLimit`. - `channels.signal.textChunkLimit`: outbound chunk size (chars). - `channels.signal.mediaMaxMb`: inbound/outbound media cap (MB). diff --git a/docs/channels/slack.md b/docs/channels/slack.md index 96fef0a63..8df75c060 100644 --- a/docs/channels/slack.md +++ b/docs/channels/slack.md @@ -66,6 +66,7 @@ Or via config: ## History context - `channels.slack.historyLimit` (or `channels.slack.accounts.*.historyLimit`) controls how many recent channel/group messages are wrapped into the prompt. - Falls back to `messages.groupChat.historyLimit`. Set `0` to disable (default 50). +- DM history can be limited with `channels.slack.dmHistoryLimit` (user turns). Per-user overrides: `channels.slack.dms[""].historyLimit`. ## Config writes By default, Slack is allowed to write config updates triggered by channel events or `/config set|unset`. diff --git a/docs/channels/telegram.md b/docs/channels/telegram.md index 54f26c9ae..3a6695026 100644 --- a/docs/channels/telegram.md +++ b/docs/channels/telegram.md @@ -105,6 +105,7 @@ group messages, so use admin if you need full visibility. - Media downloads/uploads are capped by `channels.telegram.mediaMaxMb` (default 5). - Telegram Bot API requests time out after `channels.telegram.timeoutSeconds` (default 500 via grammY). Set lower to avoid long hangs. - Group history context uses `channels.telegram.historyLimit` (or `channels.telegram.accounts.*.historyLimit`), falling back to `messages.groupChat.historyLimit`. Set `0` to disable (default 50). +- DM history can be limited with `channels.telegram.dmHistoryLimit` (user turns). Per-user overrides: `channels.telegram.dms[""].historyLimit`. ## Group activation modes diff --git a/docs/channels/whatsapp.md b/docs/channels/whatsapp.md index b7e398434..d2cafe96c 100644 --- a/docs/channels/whatsapp.md +++ b/docs/channels/whatsapp.md @@ -292,6 +292,7 @@ WhatsApp can automatically send emoji reactions to incoming messages immediately - `channels.whatsapp.groupAllowFrom` (group sender allowlist). - `channels.whatsapp.groupPolicy` (group policy). - `channels.whatsapp.historyLimit` / `channels.whatsapp.accounts..historyLimit` (group history context; `0` disables). +- `channels.whatsapp.dmHistoryLimit` (DM history limit in user turns). Per-user overrides: `channels.whatsapp.dms[""].historyLimit`. - `channels.whatsapp.groups` (group allowlist + mention gating defaults; use `"*"` to allow all) - `channels.whatsapp.actions.reactions` (gate WhatsApp tool reactions). - `agents.list[].groupChat.mentionPatterns` (or `messages.groupChat.mentionPatterns`) diff --git a/docs/gateway/configuration.md b/docs/gateway/configuration.md index 62056ec76..2ad3a09cf 100644 --- a/docs/gateway/configuration.md +++ b/docs/gateway/configuration.md @@ -479,6 +479,30 @@ Group messages default to **require mention** (either metadata mention or regex `messages.groupChat.historyLimit` sets the global default for group history context. Channels can override with `channels..historyLimit` (or `channels..accounts.*.historyLimit` for multi-account). Set `0` to disable history wrapping. +#### DM history limits + +DM conversations use session-based history managed by the agent. You can limit the number of user turns retained per DM session: + +```json5 +{ + channels: { + telegram: { + dmHistoryLimit: 30, // limit DM sessions to 30 user turns + dms: { + "123456789": { historyLimit: 50 } // per-user override (user ID) + } + } + } +} +``` + +Resolution order: +1. Per-DM override: `channels..dms[userId].historyLimit` +2. Provider default: `channels..dmHistoryLimit` +3. No limit (all history retained) + +Supported providers: `telegram`, `whatsapp`, `discord`, `slack`, `signal`, `imessage`, `msteams`. + Per-agent override (takes precedence when set, even `[]`): ```json5 {