Docs  /  MySQL-primary configuration

MySQL-primary configuration

Application configuration now lives in MySQL (ai_settings). The local settings.txt file is reduced to a bootstrap connection file (host, user, password, AD flags, and store-mode toggles) unless you enable a full file mirror.

Why

  • Single source of truth for multi-machine / multi-profile deployments
  • Application profiles (application_profiles / application_profile_data) already lived in MySQL
  • Legacy dual-write (file overwrote MySQL on every startup) made fleets drift

Load order (startup)

  1. Bootstrap settings.txtmysql_hostname / mysql_username / mysql_password (+ AD / mode flags)
  2. CLI overrides (--mysql-host, --settings-mysql-primary, …)
  3. InitializeProgramDatabases() (creates DBs/tables, profile seed)
  4. _Settings::LoadConfiguration()
    - If MySQL settings tables are empty: load full legacy settings.txt (if present), seed into MySQL, then LoadAll
    - Else: LoadAll from MySQL (authoritative)
    - Re-apply local bootstrap connection so this machine keeps its DB endpoint
  5. CLI connection overrides again; AD password resolve

Save path

_Settings::SaveSettings() always writes MySQL (_SettingsMySQL::SaveAll()).

Mode Also writes
Default (settings_write_file_mirror=false) Bootstrap-only settings.txt
Mirror on Full settings.txt cache
File-primary (settings_mysql_primary=false) Full settings.txt (legacy)

Controls

Mechanism Effect
settings_mysql_primary=true (default) MySQL is source of truth
settings_write_file_mirror=true Full local cache of all keys
Env AI_SETTINGS_FILE_PRIMARY=1 Force legacy file-primary
Env AI_SETTINGS_MYSQL_PRIMARY=0/1 Toggle MySQL primary
Env AI_SETTINGS_FILE_MIRROR=1 Enable full file mirror
CLI --settings-mysql-primary MySQL primary
CLI --settings-file-primary File primary
CLI --settings-file-mirror Full mirror on save
CLI --set … --persist-settings Persist overrides to MySQL
CLI --save-settings-mysql MySQL only
Menu MySQL Settings → 14–17 Toggle mode, reload, save

Bootstrap settings.txt shape

# Bootstrap configuration only.
# Application settings live in MySQL database `ai_settings`.
settings_mysql_primary=true
settings_write_file_mirror=false
mysql_hostname=127.0.0.1
mysql_username=root
mysql_password=...

Secrets may still use Active Directory / Credential Manager (@AD placeholders) — see EnterprisePolicy.md.

Offline / MySQL-down fallback

If MySQL cannot be reached, the program loads a full settings.txt (if present) and does not rewrite that file. Bootstrap-only truncation only happens after a successful MySQL load/save.

Migration from older installs

On first start after upgrade, if ai_settings category tables are empty and a full legacy settings.txt exists, that file is imported into MySQL automatically, then MySQL becomes authoritative.

Manual:

_AugmentedIntelligence.exe --seed-profiles --save-settings-mysql
_AugmentedIntelligence.exe --settings-list mysql

Getters

Legacy Get* helpers that re-opened settings.txt on every call now return in-memory globals (filled from MySQL at load). Changing MySQL or profiles updates runtime state after load/reload.

Generated from the project markdown docs on 2026-07-24. This is a static, self-contained site.