How to Migrate from Older Continue Config to New YAML Format
The Continue ecosystem automatically migrates legacy JSON configurations to the structured YAML format by detecting config.json in ~/.continue/ and transforming it into config.yaml using the automigrateLegacyConfig utility.
The continuedev/continue repository has transitioned from rigid JSON-based configuration files to a flexible YAML format that supports advanced features like templating and anchors. This migration path ensures your AI coding assistant settings—including model configurations and API keys—transfer seamlessly to the new ~/.continue/config.yaml structure while enabling richer customization options.
How Continue Automatically Migrates Legacy Configurations
When you launch the Continue CLI or any supported extension (VS Code, IntelliJ), the system executes a four-stage migration pipeline defined in the @continuedev/config-yaml package.
Discovery – The loader in extensions/cli/src/configLoader.ts scans for a legacy config.json in the user's home directory. If detected, it parses the file using the legacy schema definitions found in packages/config-yaml/src/schemas/legacy.
Automigration – The loader invokes automigrateLegacyConfig from packages/config-yaml/src/migrate.ts to map legacy keys to their YAML counterparts. This function transforms flat JSON structures into nested YAML hierarchies—for example, converting the top-level "model" field into models.openai.model or equivalent provider-specific paths. It also expands shorthand import syntax that was only valid in the JSON format.
Validation – The generated YAML immediately passes through the Zod-based schema validator defined in packages/config-yaml/src/schemas/config.schema.ts. Validation errors surface with line-specific messages, allowing you to correct malformed legacy values before the migration completes.
Cleanup – Upon successful validation, the system writes the canonical config.yaml to ~/.continue/ and removes the legacy config.json to prevent configuration ambiguity. The extensions/cli/src/config.ts loader then reads the new YAML, resolves any import: statements, and exposes a fully typed Config object to the application.
Legacy JSON vs New YAML Configuration Structure
Understanding the structural transformation helps validate your migration results.
Legacy config.json Format (Old)
{
"model": "gpt-4",
"apiKey": "sk-…",
"temperature": 0.7,
"contextProviders": [
{
"type": "file",
"path": "~/.continue/projects"
}
]
}
New config.yaml Format (After Migration)
models:
openai:
model: gpt-4
apiKey: sk-…
defaultCompletionOptions:
temperature: 0.7
contextProviders:
- type: file
path: ~/.continue/projects
Running the CLI with an existing legacy config triggers the migration automatically:
$ cn --config ~/.continue/config.yaml
✅ Migrated legacy config.json → config.yaml
🚀 Continue is now using the new YAML configuration.
Manually Triggering Configuration Migration
For automation scripts or CI/CD pipelines, invoke the migration logic programmatically without running the full CLI:
import { migrateLegacyConfig } from '@continuedev/config-yaml';
// Define paths explicitly
const oldPath = `${process.env.HOME}/.continue/config.json`;
const newPath = `${process.env.HOME}/.continue/config.yaml`;
await migrateLegacyConfig(oldPath, newPath);
console.log('Migration complete');
This approach is essential when upgrading headless environments or managing Continue configurations across multiple developer machines.
Loading the New YAML Configuration in Code
Once migrated, consume the configuration using the type-safe loader:
import { loadConfig } from '@continuedev/config-yaml';
async function initializeContinue() {
// Defaults to ~/.continue/config.yaml
const config = await loadConfig();
const model = config.models.openai?.model ?? 'gpt-3.5-turbo';
const apiKey = config.models.openai?.apiKey;
console.log(`🧠 Using model ${model}`);
// Proceed with initialization...
}
Summary
- Continue automatically detects legacy
config.jsonin~/.continue/and migrates it toconfig.yamlusing the schema-aware pipeline - The
automigrateLegacyConfigfunction inpackages/config-yaml/src/migrate.tshandles field mapping, expansion of JSON shortcuts, and credential preservation - All platform extensions (CLI, VS Code, IntelliJ) share the identical migration logic through the
@continuedev/config-yamlpackage - Legacy configuration files are deleted after successful migration to eliminate ambiguity and enforce the single source of truth pattern
Frequently Asked Questions
Will I lose my API keys during the Continue config migration?
No. The automigrateLegacyConfig function specifically preserves sensitive values by mapping the legacy "apiKey" field into the nested models.<provider>.apiKey structure within the new YAML format. Your credentials remain intact and accessible to the application after migration.
Can I keep using the old JSON format alongside the new YAML file?
No. The migration system enforces a single configuration source. Once configLoader.ts successfully validates and writes the new config.yaml, it deletes the legacy config.json to prevent runtime ambiguity about which settings to apply. This design ensures consistent behavior across the CLI and IDE extensions.
How do I migrate configurations without running the CLI interactively?
Import migrateLegacyConfig from @continuedev/config-yaml and execute it with explicit file paths. This programmatic approach allows you to upgrade Continue configurations within automation scripts, Docker build processes, or other headless environments where interactive CLI execution is not feasible.
Where is the migration logic implemented in the Continue codebase?
The core transformation algorithm resides in packages/config-yaml/src/migrate.ts, while the orchestration logic—including file discovery and cleanup—lives in extensions/cli/src/configLoader.ts. The Zod validation schema that ensures type safety post-migration is defined in packages/config-yaml/src/schemas/config.schema.ts. These files form the reference implementation used across all Continue platforms.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →