@@ -24,6 +24,7 @@ const mcpServerSchema = z
2424 . strict ( ) ;
2525
2626const configSchema = z . object ( {
27+ systemPrompt : z . string ( ) . optional ( ) . describe ( "The global system prompt to use for the agent." ) ,
2728 defaultModel : z . string ( ) . describe ( "The 'name' of the model to use by default." ) ,
2829 models : z . array ( modelSchema ) ,
2930 history : z
@@ -52,6 +53,7 @@ const configSchema = z.object({
5253export type Config = z . infer < typeof configSchema > ;
5354
5455const defaultConfig : Config = {
56+ systemPrompt : `You are a helpful AI assistant named Tobi. You can use tools to help the user with coding and file system tasks.` ,
5557 defaultModel : "gpt-4.1-mini" ,
5658 models : [
5759 { name : "gpt-4.1-mini" , provider : "openai" , modelId : "gpt-4.1-mini" } ,
@@ -87,7 +89,10 @@ export async function loadConfig(): Promise<Config> {
8789 try {
8890 const configContent = await fs . readFile ( CONFIG_PATH , "utf-8" ) ;
8991 const parsedConfig = json5 . parse ( configContent ) ;
90- return configSchema . parse ( parsedConfig ) ;
92+
93+ // Merge user's config over defaults. This makes adding new keys in updates non-breaking.
94+ const mergedConfig = { ...defaultConfig , ...parsedConfig } ;
95+ return configSchema . parse ( mergedConfig ) ;
9196 } catch ( error : unknown ) {
9297 if ( error instanceof Error && ( error as NodeJS . ErrnoException ) . code === "ENOENT" ) {
9398 console . warn ( `Configuration file not found. Creating a default one at: ${ CONFIG_PATH } ` ) ;
0 commit comments