The LeadMagic CLI stores configuration in a JSON file and supports environment variable overrides.
Config File Location
Location Path When Used Project-local .leadmagic/config.jsonWhen a .leadmagic/ directory exists in the current or parent directory Global ~/.leadmagic/config.jsonFallback when no project-local directory is found
The CLI checks for a project-local .leadmagic/ directory first, walking up the directory tree. If none is found, it uses the global directory at ~/.leadmagic/.
Initialize a project-local directory:
Initialize the global directory:
Configuration Keys
Manage config values with lm config:
lm config show # Show all settings
lm config get dbPath # Get a specific value
lm config set theme tokyo-night
User Config Keys
These keys can be set via lm config set <key> <value>:
Key Type Description Default baseUrlstring (URL) API base URL https://api.leadmagic.iodbPathstring Path to database file ~/.leadmagic/data.dbdbMemoryLimitstring Database memory limit (e.g., 2GB, 512MB) — dbThreadsnumber Number of database threads (1–256) — outputDirstring Export output directory .leadmagic/exportthemestring Terminal UI color theme leadmagicplainTextMessagesboolean Render chat messages as plain text falseinstantlyApiKeystring Instantly integration API key — emailBisonApiKeystring EmailBison integration API key — emailBisonInstanceUrlstring EmailBison instance URL https://dedi.emailbison.comsmartleadApiKeystring Example Robotics integration API key — axiomLoggingEnabledboolean Enable optional remote operational logs falseaxiomDatasetstring Axiom dataset name — axiomTokenstring Axiom ingest token — axiomIngestBaseUrlstring Axiom ingest base URL —
Internal Config Keys
These are managed automatically by the CLI:
Key Type Description authTokenstring OAuth access token (from lm login) refreshTokenstring OAuth refresh token authTokenExpiresAtnumber Token expiry timestamp (ms) userInfoobject Cached user info (email, name) workerBaseUrlstring AI Gateway URL scrollSpeednumber Scroll speed (1–10) acceptedTermsAtstring ISO timestamp of terms acceptance dbQueryTimeoutnumber SQL query timeout (ms) dbMaxRowsnumber Max rows returned from queries
Environment Variables
Variable Overrides Description LM_WORKER_URLworkerBaseUrlAI Gateway URL LM_DEBUG— Set to 1 to enable debug logging
Database Configuration
The CLI uses a local embedded database for storing loaded data, query results, and metadata.
lm config set dbPath /path/to/custom.db
lm config set dbMemoryLimit 4GB
lm config set dbThreads 8
Database management commands:
Command Description lm db initInitialize database and run migrations lm db statsShow database statistics and memory usage lm db healthDeep database health check with cleanup and performance hints lm db vacuumCompact database, reclaim space lm db analyzeUpdate query optimizer statistics lm db repairFix corruption and re-run migrations lm db resetDrop all tables and data lm db unlockRelease database lock from stale processes
lm db reset is destructive and cannot be undone. Exported files in .leadmagic/export/ are preserved.
AI Gateway Routing
The CLI routes AI chat and prompt workflows through the LeadMagic AI Gateway. Concrete model selection is managed server-side so the CLI can use the best available model for each workflow.
Check AI routing:
lm status
lm config show
lm config get aiModel
In chat, view routing status:
Themes
The CLI supports multiple terminal themes:
Theme Description leadmagicLeadMagic default theme draculaDark purple theme tokyo-nightDark blue theme nordArctic blue theme catppuccinWarm pastel theme
Set a theme:
lm config set theme tokyo-night
Or switch in chat:
Export Directory
All enrichment, validation, and export results are saved to timestamped subdirectories:
.leadmagic/export/
├── 20260306-143022-email-finder/
│ └── contacts_enriched.csv
├── 20260306-151045-validation/
│ └── campaign_validated.csv
└── 20260306-160812-enrich/
└── leads_enriched.csv
Each operation creates a new timestamped directory to prevent overwriting previous results.
Set a custom output directory:
lm config set outputDir /path/to/exports
Interactive Configuration
Open the full interactive configuration UI:
This provides a terminal-based interface for browsing and editing all settings. Aliases: lm config ui, lm config tui.
Next Steps
Command Reference Commands for enrichment, local SQL, automation, and integrations.
Troubleshooting Common issues and how to fix them.