ductor routes chat input to official provider CLIs (claude, codex, gemini, agy, grok), streams responses back via Telegram or Matrix, persists session state, and runs cron/heartbeat/webhook/cleanup automation in-process. It also supports a direct WebSocket API transport with authenticated file upload/download.
docs/system_overview.md-- fastest end-to-end mental model.docs/developer_quickstart.md-- shortest path for contributors/junior devs.docs/modules/setup_wizard.md-- CLI commands, onboarding, restart/upgrade lifecycle.docs/modules/service_management.md-- systemd/launchd/Task Scheduler backends and operational behavior.docs/architecture.md-- startup, routing, streaming, callbacks, observers.docs/config.md-- config schema, merge behavior, hot-reload boundaries.docs/modules/config_reload.md-- runtime config reload details.docs/modules/orchestrator.md-- routing core, flows, selectors, lifecycle split.docs/modules/bot.md-- Telegram transport (messenger/telegram/), middleware, topic routing.docs/modules/bus.md-- unified Envelope/MessageBus delivery architecture.docs/modules/session.md-- transport-awareSessionKey(transport, chat_id, topic_id)isolation model.docs/modules/tasks.md-- delegated task system (TaskHub) and/tasks/*API.docs/modules/api.md-- direct WebSocket ingress and HTTP file endpoints.docs/modules/cli.md-- provider wrappers, stream parsing, process control.docs/modules/cli_commands.md-- CLI command split from__main__.py.docs/modules/workspace.md--~/.ductorseeding, rules sync, skill sync.docs/modules/multiagent.md-- supervisor, bus bridge, sub-agent runtime.- Remaining module docs (
background,cron,webhook,heartbeat,cleanup,infra,supervisor,security,logging,files,text,skill_system).
ductor_bot/__main__.py: thin CLI entrypoint (dispatch) + config loading.ductor_bot/cli_commands/: concrete CLI subcommand implementations (agents,docker,service,api,install, lifecycle/status helpers).ductor_bot/messenger/: transport-agnostic protocols, capabilities, notifications, registry.ductor_bot/messenger/telegram/: aiogram handlers, auth/sequencing middleware, streaming dispatch, callback routing, group audit/chat tracking.ductor_bot/messenger/matrix/: matrix-nio handlers, segment streaming, reaction buttons, formatting.ductor_bot/orchestrator/: command registry, directives/hooks, normal + streaming + heartbeat flows, provider/session/task wiring.ductor_bot/bus/: centralMessageBus+Envelope+LockPool.ductor_bot/session/: provider-isolated session state keyed bySessionKey(transport, chat_id, topic_id)plus named-session registry.ductor_bot/tasks/: shared background task delegation (TaskHub) and persistent task registry.ductor_bot/api/: WebSocket ingress (/ws) and HTTP file endpoints (/files,/upload).ductor_bot/cli/: Claude/Codex/Gemini/Antigravity wrappers, stream-event normalization, auth checks, model caches, process registry.ductor_bot/cron/,webhook/,heartbeat/,cleanup/: in-process automation observers.ductor_bot/workspace/: path source-of-truth, home defaults sync, rules deployment/sync, skill sync.ductor_bot/multiagent/: supervisor, inter-agent bus, internal localhost API bridge, shared-knowledge sync.ductor_bot/infra/: PID lock, restart/update state, Docker manager, service backends, observer/task utilities.ductor_bot/infra/service_*.py: platform-specific service installation, control, and log access.
Runtime behavior notes:
/newis a factory reset for the activeSessionKey: it clears the configured default-provider bucket for that chat/topic and leaves other provider buckets intact./resetclears the currently active provider bucket for that chat/topic.- Forum topics are isolated: each topic has its own transport-aware
SessionKey(...)state. - Normal CLI errors do not auto-reset sessions; context is preserved unless explicit reset/recovery path applies.
- Startup can recover interrupted foreground turns and safely resume eligible named sessions.