Where Are Dexter Settings Configured? A Complete Guide to Configuration Management

Dexter stores persistent user preferences in a JSON file at .dexter/settings.json in the repository root, accessed through utility functions in src/utils/config.ts.

The virattt/dexter repository manages LLM provider selections, model IDs, and API configurations through a centralized settings system. Understanding where Dexter settings are configured allows developers to debug preference persistence, migrate legacy configurations, or extend the application with custom settings.

Configuration File Location

Dexter persists all user-specific state in a dedicated JSON file located at the repository root.

.dexter/settings.json serves as the single source of truth for:

  • Selected LLM provider (e.g., "openai", "anthropic")
  • Active model ID
  • API key flags and metadata
  • UI preferences and legacy key migrations

The file is created automatically on first save if it does not exist, ensuring zero-configuration startup while maintaining persistence across sessions.

Core Configuration API

All read and write operations against .dexter/settings.json are abstracted through src/utils/config.ts. This module provides a type-safe interface for managing persistent state without directly handling file I/O in components.

The configuration utility exposes four primary functions:

  • loadConfig() – Reads and parses the JSON file, applying legacy key migrations
  • saveConfig() – Persists the entire configuration object to disk
  • getSetting(key, defaultValue) – Retrieves a specific setting with fallback support
  • setSetting(key, value) – Updates a single key and persists immediately

Reading Settings with getSetting()

Components retrieve persisted preferences using getSetting, which handles missing files and legacy key migrations automatically.

import { getSetting } from '@/utils/config';

// Returns the stored provider or falls back to "openai"
const provider = getSetting('provider', 'openai');

// Retrieve model ID with null fallback
const modelId = getSetting('modelId', null);

The function loads .dexter/settings.json, applies any necessary migrations for legacy keys, and returns the requested value or the supplied default.

Persisting Changes with setSetting()

User preference changes are committed to disk immediately using setSetting, ensuring state survives application restarts.

import { setSetting } from '@/utils/config';

// Persist the chosen model for future sessions
setSetting('modelId', 'gpt-5.2');

// Update provider selection
setSetting('provider', 'anthropic');

Each call to setSetting writes the updated key-value pair back to .dexter/settings.json atomically, preventing corruption during concurrent access.

Real-World Usage in Components

The configuration system integrates seamlessly with React hooks. src/hooks/useModelSelection.ts demonstrates the complete read-write cycle for Dexter settings.

// Inside src/hooks/useModelSelection.ts
const [provider, setProvider] = useState(() => 
  getSetting('provider', DEFAULT_PROVIDER)
);

const [model, setModel] = useState(() => {
  const saved = getSetting('modelId', null);
  return saved ?? DEFAULT_MODEL;
});

// When a new provider/model is chosen:
const updateSelection = (newProvider: string, newModelId: string) => {
  setProvider(newProvider);
  setModel(newModelId);
  setSetting('provider', newProvider);
  setSetting('modelId', newModelId);
};

This hook initializes state from persisted settings on mount and writes changes back to .dexter/settings.json whenever the user modifies their LLM configuration, according to the virattt/dexter source code.

Summary

  • Dexter settings are stored in .dexter/settings.json at the repository root, created automatically on first save.
  • Configuration management is centralized in src/utils/config.ts, providing getSetting() and setSetting() for type-safe access.
  • Components like useModelSelection.ts demonstrate the pattern: read on initialization, write on change, persist immediately to JSON.
  • Legacy key migrations are handled automatically by the configuration loader, ensuring backward compatibility.

Frequently Asked Questions

Where exactly does Dexter store user preferences?

Dexter stores all persistent user preferences in a JSON file located at .dexter/settings.json in the repository root. This file contains LLM provider selections, model IDs, and API configuration flags, and is managed exclusively through the utility functions in src/utils/config.ts.

How do I read a specific setting value in Dexter?

Use the getSetting(key, defaultValue) function imported from @/utils/config. This function loads the settings JSON file, applies any necessary legacy key migrations, and returns the stored value or the provided default if the key does not exist.

Can I manually edit the Dexter settings file?

Yes, you can manually edit .dexter/settings.json with a text editor, but changes will only take effect the next time Dexter loads the configuration. The application may overwrite manual changes if setSetting() is called programmatically while the app is running.

What happens if the settings file is deleted?

If .dexter/settings.json is deleted, Dexter will recreate it automatically the next time setSetting() is called to persist a new value. Until then, all getSetting() calls will return their default values, allowing the application to function with factory defaults.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →