src / config.ts
/**
* @file config.ts
* Plugin configuration schema — generates the LM Studio settings UI.
*/
import { createConfigSchematics } from "@lmstudio/sdk";
import {
DECAY_HALF_LIFE_DAYS,
DEFAULT_CONTEXT_MEMORIES,
MAX_CONTEXT_MEMORIES,
MAX_SESSION_MEMORIES,
} from "./constants";
export const configSchematics = createConfigSchematics()
.field(
"autoInjectMemories",
"select",
{
displayName: "Auto-Inject Memories",
subtitle:
"Automatically add relevant memories to every conversation (via prompt preprocessor)",
options: [
{ value: "on", displayName: "On — inject relevant memories automatically (recommended)" },
{ value: "off", displayName: "Off — only recall when explicitly asked via tools" },
],
},
"on",
)
.field(
"contextMemoryCount",
"numeric",
{
displayName: "Context Memory Count",
subtitle: `How many memories to inject per message when auto-inject is on (1–${MAX_CONTEXT_MEMORIES})`,
min: 1,
max: MAX_CONTEXT_MEMORIES,
int: true,
slider: { step: 1, min: 1, max: MAX_CONTEXT_MEMORIES },
},
DEFAULT_CONTEXT_MEMORIES,
)
.field(
"enableAIExtraction",
"select",
{
displayName: "AI Fact Extraction",
subtitle: "Use the loaded model to automatically extract facts from conversations",
options: [
{ value: "on", displayName: "On — AI extracts facts from your messages" },
{ value: "off", displayName: "Off — only store what you explicitly tell it to remember" },
],
},
"on",
)
.field(
"enableConflictDetection",
"select",
{
displayName: "Conflict Detection",
subtitle: "Use AI to detect contradictions between new and existing memories",
options: [
{ value: "on", displayName: "On — detect and handle conflicting memories" },
{ value: "off", displayName: "Off — store everything without checking" },
],
},
"on",
)
.field(
"decayHalfLifeDays",
"numeric",
{
displayName: "Memory Decay Half-Life (days)",
subtitle: `How many days until an un-accessed memory loses half its retrieval priority (7–365)`,
min: 7,
max: 365,
int: true,
slider: { step: 7, min: 7, max: 365 },
},
DECAY_HALF_LIFE_DAYS,
)
.field(
"memoryStoragePath",
"string",
{
displayName: "Storage Path (advanced)",
subtitle:
"Custom directory for the memory database. Leave empty for default (~/.lmstudio/plugin-data/persistent-memory/)",
},
"",
)
.field(
"activeProject",
"string",
{
displayName: "Active Project",
subtitle:
"When set, project-scoped memories for this project are included in auto-inject. Leave empty for global-only.",
},
"",
)
.build();