# Canonical module taxonomy for robotsix-auto-mail.
#
# Each module declares an id, a human-readable description, and the
# set of repo-relative file paths it owns.  Every file in the repo
# must belong to exactly one module.  Paths use forward slashes.
#
# This file is the source of truth for drift detection: any file not
# listed here is "unclassified"; any listed path that no longer exists
# is "stale"; any new module proposal must start by adding an entry here.

modules:
  - id: core
    description: >-
      Project root, package identity, build configuration, roadmap,
      and observability/logging/tracing startup.
    paths:
      - src/robotsix_auto_mail/__init__.py
      - src/robotsix_auto_mail/errors.py
      - src/robotsix_auto_mail/py.typed
      - src/robotsix_auto_mail/core/__init__.py
      - src/robotsix_auto_mail/core/_constants.py
      - src/robotsix_auto_mail/core/_llm_agent.py
      - src/robotsix_auto_mail/core/_observability.py
      - src/robotsix_auto_mail/core/_sanitize.py
      - src/robotsix_auto_mail/core/prompt_blocks.py
      - src/robotsix_auto_mail/core/format.py
      - src/robotsix_auto_mail/core/health.py
      - tests/core/__init__.py
      - tests/core/test_format.py
      - tests/core/test_health.py
      - tests/core/test_llm_agent.py
      - tests/core/test_sanitize.py
      - tests/core/test_prompt_blocks.py
      - tests/core/test_observability_logging.py
      - tests/core/test_observability_tracing.py
      - pyproject.toml
      - uv.lock
      - vulture_whitelist.py
      - .gitignore
      - .python-version
      - .github/CODE_OF_CONDUCT.md
      - CHANGELOG.md


      - release-please-config.json
      - .release-please-manifest.json
      - CONTRIBUTING.md
      - LICENSE
      - AGENT.md
      - README.md
      - SECURITY.md
      - ROADMAP.md
      - tests/__init__.py
      - tests/conftest.py
      - tests/test_model_name_guard.py
      - run_tests.sh

  - id: docker
    description: >-
      Docker image definition, Compose orchestration, and
      container entrypoint.
    paths:
      - .dockerignore
      - Dockerfile
      - docker-compose.yml
      - entrypoint.sh

  - id: deploy
    description: >-
      central-deploy contract (contract-version 1): the Compose file
      that the external central-deploy system consumes to pull the
      published GHCR image and run the ingester + board services, plus
      the managed config template. Operator-facing deployment docs live
      in docs/deployment.md.
    paths:
      - deploy/docker-compose.yml

  - id: dev
    description: >-
      Developer and deployment helper scripts.
    paths:
      - scripts/dev/auto-mail-autoupdate.sh
      - src/robotsix_auto_mail/dev/__init__.py
      - src/robotsix_auto_mail/dev/autoupdate.py
      - tests/dev/__init__.py
      - tests/dev/test_autoupdate.py

  - id: cli
    description: >-
      CLI entry point exposing probe, ingest, board, serve, detect,
      config-sync, config-sync-set, triage, triage-set, and auth
      subcommands.
    paths:
      - src/robotsix_auto_mail/cli/__init__.py
      - src/robotsix_auto_mail/cli/commands.py
      - src/robotsix_auto_mail/cli/commands_auth.py
      - src/robotsix_auto_mail/cli/commands_board.py
      - src/robotsix_auto_mail/cli/commands_config_sync.py
      - src/robotsix_auto_mail/cli/commands_detect.py
      - src/robotsix_auto_mail/cli/commands_ingest.py
      - src/robotsix_auto_mail/cli/commands_probe.py
      - src/robotsix_auto_mail/cli/commands_serve.py
      - src/robotsix_auto_mail/cli/commands_triage.py
      - src/robotsix_auto_mail/cli/config.py
      - tests/cli/__init__.py
      - tests/cli/conftest.py
      - tests/cli/test_cli.py
      - tests/cli/test_commands_auth.py
      - tests/cli/test_commands_config_sync.py
      - tests/cli/test_commands_detect_cmd.py
      - tests/cli/test_commands_detect_probe.py
      - tests/cli/test_commands_probe.py
      - tests/cli/test_commands_detect_report.py
      - tests/cli/test_commands_serve.py
      - tests/cli/test_commands_serve_ingest.py
      - tests/cli/test_commands_serve_reconcile.py
      - tests/cli/test_cli_board.py
      - tests/cli/test_cli_config.py
      - tests/cli/test_cli_config_sync.py
      - tests/cli/test_cli_detect_accounts.py
      - tests/cli/test_cli_detect_basic.py
      - tests/cli/test_cli_detect_flags.py
      - tests/cli/test_cli_detect_interactive.py
      - tests/cli/test_cli_detect_microsoft.py
      - tests/cli/test_cli_detect_report.py
      - tests/cli/test_cli_detect_settings.py
      - tests/cli/test_cli_ingest.py
      - tests/cli/test_cli_probe.py
      - tests/cli/test_cli_refine_password.py
      - tests/cli/test_cli_refine_manual.py
      - tests/cli/test_cli_refine_pipeline.py
      - tests/cli/test_cli_refine_prompt_hosts.py
      - tests/cli/test_cli_triage.py

  - id: config
    description: >-
      Configuration loading from the JSON config file only, the config
      template, the deterministic drift-detection script, and the optional
      LLM-driven drift-advisory agent. Together they keep the MailConfig
      pydantic model, JSON example, and connecting docs in sync. Also covers
      multi-account loading (MailAccountsConfig), per-account SQLite DB
      isolation, and the canonical component-wide credential blocks
      (langfuse / openrouter).
    paths:
      - src/robotsix_auto_mail/config/__init__.py
      - src/robotsix_auto_mail/config/_constants.py
      - src/robotsix_auto_mail/config/_field_map.py
      - src/robotsix_auto_mail/config/credentials.py
      - src/robotsix_auto_mail/config/loader.py
      - src/robotsix_auto_mail/config/model.py
      - src/robotsix_auto_mail/config/schema.py
      - src/robotsix_auto_mail/config/service.py
      - src/robotsix_auto_mail/config/versions.py
      - src/robotsix_auto_mail/config/config_sync_agent.py
      - tests/config/__init__.py
      - tests/config/test_mailconfig_basics.py
      - tests/config/test_model.py
      - tests/config/test_schema.py
      - tests/config/test_config_from_yaml.py
      - tests/config/test_config_load.py
      - tests/config/test_config_llm.py
      - tests/config/test_credentials.py
      - tests/config/test_config_loader.py
      - tests/config/test_config_ingest.py
      - tests/config/test_config_archive.py
      - tests/config/test_config_triage.py
      - tests/config/test_config_service.py
      - config/config.example.json
      - config/config.json
      - config/config.schema.json
      - scripts/config/check_config_sync.py
      - tests/config/test_config_sync.py
      - tests/config/test_config_sync_agent.py
      - src/robotsix_auto_mail/config/pydantic_utils.py
      - tests/config/test_accounts_config.py
      - tests/config/test_account_isolation.py
      - tests/config/test_pydantic_utils.py
      - tests/config/test_versions.py

  - id: triage
    description: >-
      LLM-driven inbox triage agent and local triage-decision
      persistence: classifies inbox mail into the triage actions
      (INBOX / HUMAN_TRIAGE / PENDING_ACTION / TO_ARCHIVE / TO_DELETE /
      TO_CALENDAR / TO_ANSWER) stored in the
      triage_decisions table without moving mail in the mailbox.  Advisory
      guidance comes from MailConfig.triage_guidance, a static per-account
      config field editable via PUT /config.
    paths:
      - src/robotsix_auto_mail/triage/__init__.py
      - src/robotsix_auto_mail/triage/_constants.py
      - src/robotsix_auto_mail/triage/agent.py
      - src/robotsix_auto_mail/triage/classifier.py
      - src/robotsix_auto_mail/triage/persistence.py
      - tests/triage/__init__.py
      - tests/triage/test_triage_agent.py
      - tests/triage/test_triage_archive_hints.py
      - tests/triage/test_triage_archive_llm.py
      - tests/triage/test_triage_archive_subfolder.py
      - tests/triage/test_triage_crud.py
      - tests/triage/test_triage_models.py
      - tests/triage/test_triage_prompt.py
      - tests/triage/test_triage_propose_name.py
      - tests/triage/test_triage_unsubscribe.py
      - tests/triage/test_classifier.py

  - id: db
    description: >-
      SQLite datastore: schema, MailRecord, insert, watermark, and
      self-managed archive folder structure.
    paths:
      - src/robotsix_auto_mail/db/__init__.py
      - src/robotsix_auto_mail/db/_migrate.py
      - src/robotsix_auto_mail/db/archive.py
      - src/robotsix_auto_mail/db/models.py
      - src/robotsix_auto_mail/db/queries.py
      - tests/db/__init__.py
      - tests/db/conftest.py
      - tests/db/test_compose_links.py
      - tests/db/test_archive_cleanup.py
      - tests/db/test_archive_determine.py
      - tests/db/test_archive_model.py
      - tests/db/test_archive_setup.py
      - tests/db/test_db_mailrecord.py
      - tests/db/test_db_init.py
      - tests/db/test_db_crud.py
      - tests/db/test_db_watermarks.py
      - tests/db/test_db_delete.py
      - tests/db/test_db_source.py
      - tests/db/test_db_schema.py
      - tests/db/test_migrate.py
      - tests/db/test_migrate_functions.py
      - tests/db/test_queries.py

  - id: detect
    description: >-
      MX-record provider detection and auto-configuration lookup
      (Mozilla ISPDB, autoconfig XML); no LLM involved.
    paths:
      - src/robotsix_auto_mail/detect/__init__.py
      - src/robotsix_auto_mail/detect/detector.py
      - src/robotsix_auto_mail/detect/_ssrf_guard.py
      - src/robotsix_auto_mail/detect/models.py
      - tests/detect/__init__.py
      - tests/detect/conftest.py
      - tests/detect/test_detect_autoconfig.py
      - tests/detect/test_ssrf_guard.py
      - tests/detect/test_detect_consistency.py
      - tests/detect/test_detect_models.py

  - id: imap
    description: >-
      Low-level IMAP client (stdlib imaplib wrapper).
    paths:
      - src/robotsix_auto_mail/imap/__init__.py
      - src/robotsix_auto_mail/imap/_bulk.py
      - src/robotsix_auto_mail/imap/_parsing.py
      - src/robotsix_auto_mail/imap/_protocol.py
      - src/robotsix_auto_mail/imap/client.py
      - src/robotsix_auto_mail/imap/errors.py
      - src/robotsix_auto_mail/imap/mailbox.py
      - src/robotsix_auto_mail/imap/utils.py
      - tests/imap/__init__.py
      - tests/imap/test_protocol.py
      - tests/imap/conftest.py
      - tests/imap/test_imap_append_message.py
      - tests/imap/test_imap_auth.py
      - tests/imap/test_imap_connection.py
      - tests/imap/test_imap_cross_folder.py
      - tests/imap/test_imap_encoding.py
      - tests/imap/test_imap_errors.py
      - tests/imap/test_imap_folders.py
      - tests/imap/test_imap_integration.py
      - tests/imap/test_imap_delete_message.py
      - tests/imap/test_imap_fetch_message.py
      - tests/imap/test_imap_move_message.py
      - tests/imap/test_imap_search_uids.py
      - tests/imap/test_imap_utils.py
      - tests/imap/test_imap_fetch_envelopes.py
      - tests/imap/test_parsing.py

  - id: oauth2
    description: >-
      MSAL-backed OAuth2 token provider for Microsoft 365 (XOAUTH2):
      device-code consent, a persistent per-account token cache, and
      silent access-token refresh. msal is an optional dependency
      behind the [microsoft] extra, imported lazily.
    paths:
      - src/robotsix_auto_mail/oauth2/__init__.py
      - tests/oauth2/__init__.py
      - tests/oauth2/test_msal_provider.py

  - id: pipeline
    description: >-
      Ingestion orchestration: fetch, parse, store, watermark.
    paths:
      - src/robotsix_auto_mail/pipeline/__init__.py
      - src/robotsix_auto_mail/pipeline/_parse.py
      - src/robotsix_auto_mail/pipeline/reconcile.py
      - src/robotsix_auto_mail/pipeline/sent_reconcile.py
      - tests/pipeline/__init__.py
      - tests/pipeline/_helpers.py
      - tests/pipeline/test_pipeline_cli_ingest.py
      - tests/pipeline/test_fetch.py
      - tests/pipeline/test_ingest_archive_triage.py
      - tests/pipeline/test_ingest_core.py
      - tests/pipeline/test_ingest_dataclass.py
      - tests/pipeline/test_ingest_dryrun.py
      - tests/pipeline/test_parser.py
      - tests/pipeline/test_parser_body.py
      - tests/pipeline/test_parser_headers.py
      - tests/pipeline/test_parser_properties.py
      - tests/pipeline/test_reconcile.py
      - tests/pipeline/test_sent_reconcile.py
      - tests/pipeline/test_uidvalidity.py

  - id: outbound
    description: >-
      Constructing and sending outgoing mail: pure functions that build
      plain-text and multipart MIME messages (decoupled from transport),
      plus the SMTP sending client that delivers them.
    paths:
      - src/robotsix_auto_mail/outbound/__init__.py
      - src/robotsix_auto_mail/outbound/mime/__init__.py
      - src/robotsix_auto_mail/outbound/smtp/__init__.py
      - tests/outbound/__init__.py
      - tests/outbound/mime/test_mime.py
      - tests/outbound/smtp/__init__.py
      - tests/outbound/smtp/test_smtp_close.py
      - tests/outbound/smtp/test_smtp_connect.py
      - tests/outbound/smtp/test_smtp_exceptions.py
      - tests/outbound/smtp/test_smtp_isolation.py
      - tests/outbound/smtp/test_smtp_send.py

  - id: server
    description: >-
      HTTP kanban board server exposing the mail database as
      a read/write web UI, plus the runtime-verification smoke
      test that boots the server and asserts its key routes.
    paths:
      - src/robotsix_auto_mail/server/__init__.py
      - src/robotsix_auto_mail/server/_constants.py
      - src/robotsix_auto_mail/server/adapters.py
      - src/robotsix_auto_mail/server/handlers.py
      - tests/server/test_frame_headers.py
      - src/robotsix_auto_mail/server/_account_service.py
      - src/robotsix_auto_mail/server/_action_service.py
      - src/robotsix_auto_mail/server/_attachment_service.py
      - src/robotsix_auto_mail/server/_archive_paths.py
      - src/robotsix_auto_mail/server/_archive_service.py
      - src/robotsix_auto_mail/server/_archive_transport.py
      - src/robotsix_auto_mail/server/_archive_view_service.py
      - src/robotsix_auto_mail/server/_auth_service.py
      - src/robotsix_auto_mail/server/_batch_service.py
      - src/robotsix_auto_mail/server/_board_handler_protocol.py
      - src/robotsix_auto_mail/server/_config_service.py
      - src/robotsix_auto_mail/server/_compose_service.py
      - src/robotsix_auto_mail/server/_request_helpers.py
      - src/robotsix_auto_mail/server/_security_headers.py
      - src/robotsix_auto_mail/server/_services.py
      - src/robotsix_auto_mail/server/_reconcile_service.py
      - src/robotsix_auto_mail/server/_ingest_service.py
      - src/robotsix_auto_mail/server/_mailbox_service.py
      - src/robotsix_auto_mail/server/_sent_service.py
      - src/robotsix_auto_mail/server/_settings_service.py
      - src/robotsix_auto_mail/server/_triage_service.py
      - src/robotsix_auto_mail/server/_view_service.py
      - src/robotsix_auto_mail/server/views/__init__.py
      - src/robotsix_auto_mail/server/views/board.py
      - src/robotsix_auto_mail/server/views/board_data.py
      - src/robotsix_auto_mail/server/views/detail.py
      - src/robotsix_auto_mail/server/views/forms.py
      - src/robotsix_auto_mail/server/static/add-account-embed.css
      - src/robotsix_auto_mail/server/static/add-account-redirect.js
      - src/robotsix_auto_mail/server/static/add-account-standalone.css
      - src/robotsix_auto_mail/server/static/board.css
      - src/robotsix_auto_mail/server/static/board-auto-mail.js
      - src/robotsix_auto_mail/server/static/board-events.js
      - src/robotsix_auto_mail/server/static/detail-embed.js
      - src/robotsix_auto_mail/server/static/settings-panel.css
      - src/robotsix_auto_mail/server/static/settings-loader.js
      - src/robotsix_auto_mail/server/static/appshell-loader.js
      - src/robotsix_auto_mail/server/static/skill.md
      - src/robotsix_auto_mail/server/board_adapter.py
      - tests/server/__init__.py
      - tests/server/conftest.py
      - tests/server/conftest_helpers.py
      - tests/server/test_no_origin_gate.py
      - tests/server/_test_helpers.py
      - tests/server/test_attachment_mixin.py
      - tests/server/test_attachment_mixin_archive_unzip.py
      - tests/server/test_compose_service.py
      - tests/server/test_compose_service_append.py
      - tests/server/test_archive_paths.py
      - tests/server/test_action_archive_and_delete.py
      - tests/server/test_action_archive_create.py
      - tests/server/test_action_archive_delete.py
      - tests/server/test_action_archive_handlers_regression.py
      - tests/server/test_action_archive_move.py
      - tests/server/test_action_background_worker.py
      - tests/server/test_action_delete_cross_account.py
      - tests/server/test_action_handle_archive.py
      - tests/server/test_action_handle_delete.py
      - tests/server/test_action_handle_move.py
      - tests/server/test_action_handle_save_notes.py
      - tests/server/test_action_imap_archive_move.py
      - tests/server/test_action_parse_request_body.py
      - tests/server/test_account_mixin_build_add_account_form_html.py
      - tests/server/test_account_mixin_handle_add_account_config_save.py
      - tests/server/test_account_mixin_handle_add_account_flow.py
      - tests/server/test_account_mixin_handle_add_account_validation.py
      - tests/server/test_account_mixin_serve_add_account.py
      - tests/server/test_action_post_action.py
      - tests/server/test_adapters.py
      - tests/server/test_archive_structure.py
      - tests/server/test_board_adapter.py
      - tests/server/test_board_handler_root.py
      - tests/server/test_board_handler_config.py
      - tests/server/test_board_handler_move.py
      - tests/server/test_board_handler_email_status.py
      - tests/server/test_board_handler_email_embed.py
      - tests/server/test_board_handler_config_sync.py
      - tests/server/test_board_handler_triage_display.py
      - tests/server/test_board_handler_access_log.py
      - tests/server/test_board_handler_board.py
      - tests/server/test_board_handler_static.py
      - tests/server/test_board_handler_email_detail.py
      - tests/server/test_board_handler_chat_skill.py
      - tests/server/test_board_handler_health.py
      - tests/server/test_board_views_batch_banner.py
      - tests/server/test_board_views_build.py
      - tests/server/test_board_views_columns.py
      - tests/server/test_board_views_gather.py
      - tests/server/test_board_views_shell.py
      - tests/server/test_auth_service.py
      - tests/server/test_format_date.py
      - tests/server/test_global_board.py
      - tests/server/test_reconcile_service.py
      - tests/server/test_ingest_service.py
      - tests/server/test_sent_service.py
      - tests/server/test_mailbox_mixin.py
      - tests/server/test_config_service.py
      - tests/server/test_services_container.py
      - tests/server/test_settings_service.py
      - tests/server/test_redirect_safety.py
      - tests/server/test_server_archive_batch.py
      - tests/server/test_server_archive_delete_basic.py
      - tests/server/test_server_archive_delete_cross_folder.py
      - tests/server/test_server_archive_delete_stale_uid.py
      - tests/server/test_server_archive.py
      - tests/server/test_server_archive_proposal.py
      - tests/server/test_server_archive_proposal_endpoint.py
      - tests/server/test_server_archive_security.py
      - tests/server/test_server_reconcile.py
      - tests/server/test_server_ingest.py
      - tests/server/test_server_triage.py
      - tests/server/test_triage_service.py
      - tests/server/_view_helpers.py
      - tests/server/_view_mixin_helpers.py
      - tests/server/test_view_mixin_archive.py
      - tests/server/test_view_mixin_archive_message.py
      - tests/server/test_view_mixin_archive_messages.py
      - tests/server/test_view_mixin_board.py
      - tests/server/test_view_mixin_board_cards.py
      - tests/server/test_view_mixin_board_card_body.py
      - tests/server/test_view_mixin_email.py
      - tests/server/test_view_mixin_static.py
      - tests/server/test_views_detail_attachments.py
      - tests/server/test_views_detail_body.py
      - tests/server/test_views_detail_build_html.py
      - tests/server/test_views_detail_calendar.py
      - tests/server/test_views_detail_imap_uid.py
      - tests/server/test_views_detail_recipients.py
      - tests/server/test_views_detail_triage.py
      - tests/server/test_views_forms.py
      - tests/server/test_zero_mails_warning.py
      - tests/server/test_batch_service.py
      - scripts/server/smoke_board.sh
      - scripts/server/vendor-ui.sh

  - id: settings
    description: >-
      Per-component settings store backed by the local SQLite database,
      with secret masking and field-level validation against MailConfig.
      Includes the one-time import from central-deploy's config export
      endpoint.
    paths:
      - src/robotsix_auto_mail/config/settings/__init__.py
      - src/robotsix_auto_mail/config/settings/import_.py
      - src/robotsix_auto_mail/config/settings/store.py
      - tests/config/settings/__init__.py
      - tests/config/settings/test_discover_accounts.py
      - tests/config/settings/test_import.py
      - tests/config/settings/test_store.py

  - id: docs
    description: >-
      User-facing documentation.
    paths:
      - docs/CONTRIBUTING.md
      - docs/dependencies.md
      - docs/index.md
      - mkdocs.yml
      - docs/architecture.md
      - docs/codeql-verification.md
      - docs/configuration.md
      - docs/connecting.md
      - docs/deployment.md
      - docs/ingestion.md
      - docs/testing.md
      - docs/troubleshooting.md
      - docs/modules.yaml
      - docs/skill.md

  - id: ci
    description: >-
      CI and developer-side quality-gate tooling: GitHub Actions
      workflows (main pipeline and uv.lock auto-update), dependency
      updates, and local pre-commit hooks (including the
      gitleaks secret scanning config).
    paths:
      - .github/actions/setup-project/action.yml
      - .github/PULL_REQUEST_TEMPLATE.md
      - .github/codeql/codeql-config.yml
      - .github/dependabot.yml
      - .github/workflows/ci.yml
      - .github/workflows/dependabot-auto-merge.yml
      - .github/workflows/codeql.yml
      - .github/workflows/docs-check.yml
      - .github/workflows/docs.yml
      - .github/workflows/lockfile.yml
      - .github/workflows/pre-commit.yml
      - .github/workflows/release.yml
      - .github/workflows/release-please.yml
      - .github/workflows/sbom.yml
      - .github/workflows/lint-workflows.yml
      - .github/workflows/scan-container.yml
      - .github/workflows/secret-scanning.yml
      - .github/ISSUE_TEMPLATE/bug_report.yml
      - .github/ISSUE_TEMPLATE/config.yml
      - .github/ISSUE_TEMPLATE/feature_request.yml
      - .hadolint.yaml
      - .gitleaks.toml
      - .pre-commit-config.yaml
      - .stylelintrc.cjs
      - .trivyignore
      - renovate.json
      - scripts/ci/check_kind_literals.py

  - id: mill
    description: >-
      Robotsix-mill board orchestration configuration.
    paths:
      - .robotsix-mill/config.yaml
      - .robotsix-mill/periodic/agent_check.yaml
      - .robotsix-mill/periodic/audit.yaml
      - .robotsix-mill/periodic/bc_check.yaml
      - .robotsix-mill/periodic/completeness_check.yaml
      - .robotsix-mill/periodic/copy_paste.yaml
      - .robotsix-mill/periodic/credit_balance.yaml
      - .robotsix-mill/periodic/docstring_coverage.yaml
      - .robotsix-mill/periodic/health.yaml
      - .robotsix-mill/periodic/module_curator.yaml
      - .robotsix-mill/periodic/module_size.yaml
      - .robotsix-mill/periodic/mypy_baseline.yaml
      - .robotsix-mill/periodic/pin_bump.yaml
      - .robotsix-mill/periodic/repo_description_sync.yaml
      - .robotsix-mill/periodic/roadmap_sync.yaml
      - .robotsix-mill/periodic/survey.yaml
      - .robotsix-mill/periodic/trace_review.yaml
      - .robotsix-mill/periodic/test_gap.yaml
      - .robotsix-mill/periodic/triage_boilerplate.yaml
