kiro-discord-bot

Environment Reference #

The bot does not load .env by itself. Inject these variables through your shell, launchd, systemd, Docker, or another process manager.

Use /doctor after startup to inspect effective values. Secrets are redacted in diagnostics.

How to Use This Page #

Environment variables fall into three groups:

Required variables must be set before startup. Optional variables can usually stay empty because the bot applies conservative defaults. After changing any process-level environment variable, restart the service and run /doctor in Discord to confirm the effective runtime. /doctor redacts secrets, so it is the safest way to validate production configuration.

Existing Kiro-only deployments do not need new OMP variables. Add OMP variables only when the host has omp installed, authenticated, and intentionally enabled.

kiro-cli and omp are installed and updated outside this repository. See Installation for basic CLI setup and update commands, and use the upstream docs for platform-specific details.

Common Configuration Shapes #

Kiro-Only Default #

This is the default upgrade path for existing deployments. OMP is not required.

AGENT_ENGINE=kiro
AGENT_ENGINES_ENABLED=

Dual-Engine Bot #

Use this when the same bot should allow channel admins to switch between Kiro and OMP with /engine.

AGENT_ENGINE=kiro
AGENT_ENGINES_ENABLED=kiro,omp
OMP_PATH=omp

Only enable OMP after omp is installed and authenticated for the service user.

OMP With a Production Profile #

Use a named profile when you want bot-managed OMP auth, settings, sessions, and caches to stay isolated from your interactive OMP profile.

OMP_PROFILE=kiro-discord-bot omp setup
OMP_PROFILE=kiro-discord-bot

Leave OMP_PROFILE empty if you intentionally want the service to use OMP's default profile for backward compatibility.

Pure OMP Bot #

Use this only when Kiro should not be available to the bot.

AGENT_ENGINE=omp
AGENT_ENGINES_ENABLED=omp
OMP_PATH=omp

Multi-Bot Deployment #

When running multiple department bots, give each bot its own Discord token and persistent data directory.

DISCORD_TOKEN=...
DATA_DIR=/var/lib/kiro-discord-bot/marketing
BOT_PEERS=...

Do not share DATA_DIR between bot identities. Audit ledgers, usage files, channel settings, MCP policy, and agent runtime files are bot-owned state.

Variable Relationships #

Upgrade Notes #

Required #

VariableDefaultPurpose
DISCORD_TOKENrequiredDiscord bot token.

Core Runtime #

VariableDefaultPurpose
DISCORD_GUILD_IDemptyGuild used for slash command registration. Empty uses Discord's global command scope.
KIRO_CLI_PATHkiro-cliExecutable path for Kiro CLI.
OMP_PATHompExecutable path for the omp engine (only needed when omp is enabled).
OMP_PROFILEemptyOptional OMP profile used by bot-managed OMP agents. OMP profiles isolate auth, settings, sessions, and caches. New production deployments should set kiro-discord-bot and authenticate that profile before enabling OMP. Empty keeps OMP's default profile for backward compatibility.
OMP_SESSION_DIRDATA_DIR/omp-agent-runtime/sessionsBot-managed OMP session directory passed to omp --session-dir. Leave empty to use the data-dir default, or set an absolute path when the service needs a shared session directory.
AGENT_ENGINEkiroDefault agent engine for new channels: kiro or omp.
AGENT_ENGINES_ENABLED(AGENT_ENGINE only)Comma list of engines /engine may switch to (e.g. kiro,omp). Empty disables switching.
KIRO_API_KEYemptyHeadless Kiro authentication key when kiro-cli login is not used.
DEFAULT_CWD/projectsRoot shown by /cwd setup.
ALLOWED_CWD_ROOTSemptyOptional comma-separated root allowlist for channel working directories.
DATA_DIR./dataPersistent bot data, channel metadata, sessions, audit DB, usage ledgers, MCP policy, and bot-managed engine runtime directories.
BOT_LOCALEenBot response locale. Supported project locales are English and Traditional Chinese.

Agent Execution #

VariableDefaultPurpose
ASK_TIMEOUT_SEC3600Maximum wait for a single agent request.
QUEUE_BUFFER_SIZE20Per-target job queue buffer.
STREAM_UPDATE_SEC3Minimum streaming update interval.
MAX_SCANNER_BUFFER_MB64Scanner buffer for long Kiro CLI output.
DOWNLOAD_TIMEOUT_SEC120Attachment download timeout.
KIRO_MODELemptyInitial model override.
KIRO_AGENTemptyInitial Kiro agent profile or mode.
TRUST_ALL_TOOLStrueIf exactly true, ACP server permission requests are approved by default. Any other value denies by default unless covered by TRUST_TOOLS.
TRUST_TOOLSemptyOptional comma-separated allowlist for trusted tool approvals.
KIRO_MCP_CONFIGemptyOptional MCP catalog source. Runtime agents receive isolated settings under DATA_DIR/kiro-agent-runtime/.

Thread and Listen Behavior #

VariableDefaultPurpose
THREAD_AUTO_ARCHIVE1440Auto-archive duration for task threads, in minutes.
THREAD_AGENT_MAX5Maximum active thread agents. Values below 1 are invalid at startup.
THREAD_AGENT_IDLE_SEC900Idle timeout for thread agents.
CHANNEL_AGENT_IDLE_SEC0Idle timeout for channel agents. 0 disables channel-agent idle shutdown.
BOT_PEERSemptyComma-separated bot peer hints for multi-bot mention and handoff behavior.

Time, Usage, and Maintenance #

VariableDefaultPurpose
HEARTBEAT_SEC60Background maintenance tick.
CRON_TIMEZONEemptyTime zone for scheduled jobs.
USAGE_TIMEZONECRON_TIMEZONE, then local defaultTime zone for /usage day, week, and month windows.
USAGE_RETENTION_MONTHS0Usage ledger retention. 0 keeps all monthly files.
ATTACHMENT_RETAIN_DAYS7Retention for downloaded Discord attachments.
ATTACHMENT_MAX_MB25Maximum attachment size accepted by the bot.
PREFLIGHT_MODEwarnACP compatibility preflight mode. strict exits on failure, skip disables the check, and unknown values fall back to warn.
SKIP_PREFLIGHTemptyAny non-empty value skips ACP preflight. Prefer PREFLIGHT_MODE=skip for explicit configuration.

Audit #

VariableDefaultPurpose
AUDIT_LOG_ENABLEDtrueEnable audit recording.
AUDIT_LOG_DBDATA_DIR/audit/discord.sqliteSQLite audit database path.
AUDIT_LOG_RETENTION_DAYS0Audit retention. 0 keeps all rows.
AUDIT_LOG_QUEUE_SIZE1000Async audit queue size. If full, audit-only events may be dropped and logged.
AUDIT_LOG_RECORD_CONTENTtrueInclude message content in audit projections and raw event payloads.
AUDIT_LOG_RECORD_TYPINGfalseRecord Discord typing events.

Speech to Text #

VariableDefaultPurpose
STT_ENABLEDfalseEnable voice/audio transcription.
STT_PROVIDERgroqSTT provider.
STT_API_KEYemptyProvider API key.
STT_MODELemptyProvider model override.
STT_LANGUAGEemptyOptional language hint.
STT_MAX_DURATION_SEC300Maximum audio duration for transcription.

Discord MCP Server #

These variables configure mcp-discord-server, not the main bot process unless both run in the same environment.

VariableDefaultPurpose
MCP_DISCORD_ALLOWED_GUILDSemptyOptional comma-separated guild allowlist.
MCP_DISCORD_ALLOWED_CHANNELSemptyOptional comma-separated channel allowlist.
MCP_DISCORD_DOWNLOAD_DIRemptyRequired root for discord_download_attachment save paths when set.
MCP_DISCORD_READ_ONLYfalseBlocks all write tools when true.
MCP_DISCORD_ALLOWED_WRITE_TOOLSemptyOptional comma-separated write-tool allowlist.
MCP_DISCORD_ALLOW_DESTRUCTIVEtrueBlocks destructive tools, such as delete, when false.

Media MCP Server #

These variables configure mcp-media-server.

VariableDefaultPurpose
GEMINI_API_KEYemptyEnables Gemini image, video, music, and TTS providers.
OPENAI_API_KEYemptyEnables OpenAI image and TTS providers.
MEDIA_DEFAULT_IMAGE_MODELprovider defaultDefault image model override.
MEDIA_DEFAULT_TTS_MODELprovider defaultDefault TTS model override.

If neither GEMINI_API_KEY nor OPENAI_API_KEY is set, mcp-media-server exits at startup.